int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
// Structures for creating the process
STARTUPINFO si = {0};
PROCESS_INFORMATION pi = {0};
BOOL result = FALSE;
char* exeString = "C:\\WINDOWS\\notepad.exe";
char* workingDir = "C:\\WINDOWS";
// Holds where the DLL should be
char dllPath[MAX_PATH + 1] = {0};
// Set the static path of where the Inject DLL is, hardcoded just for a demo
_snprintf(dllPath, MAX_PATH, "E:\\Docutment\\DotNet\\MyCodes\\RemoteThead\\CSharpDllLoder.dll");
// Need to set this for the structure
si.cb = sizeof(STARTUPINFO);
// Try to load our process
result = CreateProcess(NULL, exeString, NULL, NULL, FALSE, CREATE_SUSPENDED, NULL, workingDir, &si, &pi);
if(!result)
{
MessageBox(0, "Process could not be loaded!", "Error", MB_ICONERROR);
return -1;
}
// Inject the DLL, the export function is named 'Initialize'
Inject(pi.hProcess, dllPath, "LoadCSharpDll");
//Inject(pi.hProcess, dllPath, "Initialize");
// Resume process execution
ResumeThread(pi.hThread);
// Standard return
return 0;
}