Minor injector and launcher payload refactoring

This commit is contained in:
mkrsym1
2023-06-10 18:28:19 +03:00
parent 3994188b08
commit 54a127b848
2 changed files with 4 additions and 12 deletions

View File

@ -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];