Follow along with the video below to see how to install our site as a web app on your home screen.
Anmerkung: This feature may not be available in some browsers.
// ripped from LibSpy.cpp
// http://www.codeproject.com/threads/winspy.asp
int InjectDll(HANDLE hProcess)
{
HANDLE hThread;
char szLibPath[_MAX_PATH];
void* pLibRemote = 0; // the address (in the remote process) where
// szLibPath will be copied to;
DWORD hLibModule = 0; // base adress of loaded module (==HMODULE);
HMODULE hKernel32 = GetModuleHandle("Kernel32");
// Get full path of this .exe
if( !GetModuleFileName( NULL,szLibPath,_MAX_PATH) ) {
fprintf(stderr, "GetModuleFileName(NULL, %s, %i) failed!\n", szLibPath, _MAX_PATH);
return -1;
}
// replace filename of this .exe with filename of to be injected .dll
strcpy (strrchr (szLibPath, '\\') + 1, DLLNAME);
// 1. Allocate memory in the remote process for szLibPath
// 2. Write szLibPath to the allocated memory
pLibRemote = VirtualAllocEx( hProcess, NULL, sizeof(szLibPath), MEM_COMMIT, PAGE_READWRITE );
if( pLibRemote == NULL ) {
fprintf(stderr, "VirtualAllocEx() failed: %d\n", GetLastError());
return -1;
}
if (!WriteProcessMemory(hProcess, pLibRemote, (void*)szLibPath,sizeof(szLibPath),NULL)) {
VirtualFreeEx( hProcess, pLibRemote, sizeof(szLibPath), MEM_RELEASE );
fprintf(stderr, "WriteProcessMemory() failed: %d\n", GetLastError());
return -1;
}
// Load dll into the remote process
// (via CreateRemoteThread & LoadLibrary)
hThread = CreateRemoteThread( hProcess, NULL, 0,
(LPTHREAD_START_ROUTINE) GetProcAddress(hKernel32,"LoadLibraryA"),
pLibRemote, 0, NULL );
if( hThread == NULL ) {
fprintf(stderr, "CreateRemoteThread() failed: %d\n", GetLastError());
VirtualFreeEx( hProcess, pLibRemote, sizeof(szLibPath), MEM_RELEASE );
return -1;
}
WaitForSingleObject( hThread, INFINITE );
// Get handle of loaded module
GetExitCodeThread( hThread, &hLibModule );
CloseHandle( hThread );
VirtualFreeEx( hProcess, pLibRemote, sizeof(szLibPath), MEM_RELEASE );
if(!hLibModule) {
fprintf(stderr, "Remote thread failed!\n");
return -1;
}
return 0;
}
LibMain proc hInstDLL:DWORD, reason:DWORD, unused:DWORD
.if reason == DLL_PROCESS_ATTACH
return TRUE
; -----------------------------
; If error at startup, return 0
; System will abort loading DLL
; -----------------------------
.elseif reason == DLL_PROCESS_DETACH
.elseif reason == DLL_THREAD_ATTACH
.elseif reason == DLL_THREAD_DETACH
.endif
Original von THRALL
Kann mal einer eine Dll posten die bei ihm funzt und z.B. eine Msgbox anzeigt ?
Original von CDW
Noch zu Dudes Methode zu erwähnen: funktioniert so nicht unter win 9.x.
We use essential cookies to make this site work, and optional cookies to enhance your experience.