Skip to content

Commit

Permalink
Fix DLL path
Browse files Browse the repository at this point in the history
  • Loading branch information
villor committed Mar 5, 2020
1 parent ee8c278 commit 2b06555
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/injector.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#include <Windows.h>
#include <Shlwapi.h>
#include "shared.h"

#pragma comment(lib, "Shlwapi.lib")

static bool gShouldExit = 0;

// TODO: Add explorer.exe restart detection
Expand Down Expand Up @@ -30,8 +33,13 @@ int CALLBACK WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
return -1;
}

// Use current exe directory to make DLL path
const LPCSTR DLL_NAME = "squeeze.dll";
CHAR dllPath[MAX_PATH] = {0};
GetModuleFileNameA(NULL, dllPath, MAX_PATH);
StrCpyA(PathFindFileNameA(dllPath), DLL_NAME);

// Allocate memory in explorer.exe and write squeeze DLL path to it
LPCSTR dllPath = "D:\\Dev\\squeeze\\build\\squeeze.dll";
SIZE_T dllPathSize = strlen(dllPath) + 1;
SIZE_T dllPathNumBytesWritten;
LPVOID lpRemoteBuf = VirtualAllocEx(hProcess, NULL, dllPathSize, MEM_COMMIT, PAGE_READWRITE);
Expand Down

0 comments on commit 2b06555

Please sign in to comment.