Resolve warnings

This commit is contained in:
yangzhi 2019-10-10 18:14:22 +08:00
parent 098fd15371
commit 0fffc7dd57
4 changed files with 7 additions and 4 deletions

View File

@ -20,7 +20,7 @@ bool Process::InjectDLL(string dllName) {
LPVOID load_library = (LPVOID) GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "LoadLibraryA"); 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); 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); 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); ResumeThread(thread);
return true; return true;
} }

View File

@ -11,7 +11,7 @@
#define MODLOADER_CRC 0x39D18E98 #define MODLOADER_CRC 0x39D18E98
#define CUBE_EXECUTABLE "cubeworld.exe" const char* CUBE_EXECUTABLE = "cubeworld.exe";
using namespace std; using namespace std;
@ -31,6 +31,9 @@ int main(int argc, char** argv) {
if (argc >= 2 && !strcmp(argv[1], "test")) { if (argc >= 2 && !strcmp(argv[1], "test")) {
testMode = true; testMode = true;
printf("Test mode enabled. CRC checks will be bypassed.\n"); printf("Test mode enabled. CRC checks will be bypassed.\n");
if (argc >= 3) {
CUBE_EXECUTABLE = argv[2];
}
} }
//Cube world is obviously required //Cube world is obviously required

View File

@ -9,7 +9,7 @@ DLL::DLL(std::string fileName) {
HMODULE DLL::Load() { HMODULE DLL::Load() {
this->handle = LoadLibraryA(this->fileName.c_str()); this->handle = LoadLibraryA(this->fileName.c_str());
if (!this->handle) { 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); exit(1);
} }
return this->handle; return this->handle;

View File

@ -57,7 +57,7 @@ void SetupHandlers() {
SetupP2PRequestHandler(); SetupP2PRequestHandler();
} }
void Popup(char* title, char* msg ){ void Popup(const char* title, char* msg ){
MessageBoxA(0, msg, title, MB_OK | MB_ICONINFORMATION); MessageBoxA(0, msg, title, MB_OK | MB_ICONINFORMATION);
} }