Minor injector and launcher payload refactoring
This commit is contained in:
@ -4,11 +4,6 @@
|
||||
|
||||
#include <lpayload.h>
|
||||
|
||||
static inline void read_env(const char *env, char *dest, size_t size) {
|
||||
GetEnvironmentVariableA(env, dest, size);
|
||||
SetEnvironmentVariableA(env, "");
|
||||
}
|
||||
|
||||
BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved) {
|
||||
// Only listen for attach
|
||||
if (reason != DLL_PROCESS_ATTACH) {
|
||||
@ -16,12 +11,10 @@ BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved) {
|
||||
}
|
||||
|
||||
// Get target EXE path
|
||||
char targetExe[MAX_PATH];
|
||||
read_env(ENV_EXE_PATH, targetExe, sizeof(targetExe));
|
||||
char *targetExe = getenv(ENV_EXE_PATH);
|
||||
|
||||
// Get the path of the DLL to inject
|
||||
char injectDll[MAX_PATH];
|
||||
read_env(ENV_DLL_PATH, injectDll, sizeof(injectDll));
|
||||
char *injectDll = getenv(ENV_DLL_PATH);
|
||||
|
||||
// Compute the working directory path
|
||||
char workdir[MAX_PATH];
|
||||
|
||||
Reference in New Issue
Block a user