From 0fffc7dd577219f5a906edce2d1247e71976db29 Mon Sep 17 00:00:00 2001 From: yangzhi <@4F!xZpJwly&KbWq> Date: Thu, 10 Oct 2019 18:14:22 +0800 Subject: [PATCH] Resolve warnings --- CubeModLauncher/Process.cpp | 2 +- CubeModLauncher/main.cpp | 5 ++++- CubeModLoader/DLL.cpp | 2 +- CubeModLoader/main.cpp | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CubeModLauncher/Process.cpp b/CubeModLauncher/Process.cpp index 1dd0b57..06099cf 100644 --- a/CubeModLauncher/Process.cpp +++ b/CubeModLauncher/Process.cpp @@ -20,7 +20,7 @@ bool Process::InjectDLL(string dllName) { LPVOID load_library = (LPVOID) GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "LoadLibraryA"); LPVOID remote_string = (LPVOID) VirtualAllocEx(pi.hProcess, NULL, strlen(dllName.c_str()) + 1, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE); WriteProcessMemory(pi.hProcess, remote_string, dllName.c_str(), strlen(dllName.c_str()) + 1, NULL); - HANDLE thread = CreateRemoteThread(pi.hProcess, NULL, NULL, (LPTHREAD_START_ROUTINE) load_library, remote_string, CREATE_SUSPENDED, NULL); + HANDLE thread = CreateRemoteThread(pi.hProcess, NULL, 0, (LPTHREAD_START_ROUTINE) load_library, remote_string, CREATE_SUSPENDED, NULL); ResumeThread(thread); return true; } diff --git a/CubeModLauncher/main.cpp b/CubeModLauncher/main.cpp index bcd0c68..9197f9b 100644 --- a/CubeModLauncher/main.cpp +++ b/CubeModLauncher/main.cpp @@ -11,7 +11,7 @@ #define MODLOADER_CRC 0x39D18E98 -#define CUBE_EXECUTABLE "cubeworld.exe" +const char* CUBE_EXECUTABLE = "cubeworld.exe"; using namespace std; @@ -31,6 +31,9 @@ int main(int argc, char** argv) { if (argc >= 2 && !strcmp(argv[1], "test")) { testMode = true; printf("Test mode enabled. CRC checks will be bypassed.\n"); + if (argc >= 3) { + CUBE_EXECUTABLE = argv[2]; + } } //Cube world is obviously required diff --git a/CubeModLoader/DLL.cpp b/CubeModLoader/DLL.cpp index fcfa6d1..ebcd1ac 100644 --- a/CubeModLoader/DLL.cpp +++ b/CubeModLoader/DLL.cpp @@ -9,7 +9,7 @@ DLL::DLL(std::string fileName) { HMODULE DLL::Load() { this->handle = LoadLibraryA(this->fileName.c_str()); if (!this->handle) { - printf("Could not load %s: %d\n", this->fileName.c_str(), GetLastError()); + printf("Could not load %s: %ld\n", this->fileName.c_str(), GetLastError()); exit(1); } return this->handle; diff --git a/CubeModLoader/main.cpp b/CubeModLoader/main.cpp index aaff897..498428b 100644 --- a/CubeModLoader/main.cpp +++ b/CubeModLoader/main.cpp @@ -57,7 +57,7 @@ void SetupHandlers() { SetupP2PRequestHandler(); } -void Popup(char* title, char* msg ){ +void Popup(const char* title, char* msg ){ MessageBoxA(0, msg, title, MB_OK | MB_ICONINFORMATION); }