Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <windows.h>
- #include <dbghelp.h>
- #include <stdio.h>
- static BOOL CALLBACK FunkyCallback(HWND hWnd, LPARAM lParam ){
- char b[100]; RECT Rect;
- DWORD pid;
- if(!GetParent(hWnd)){
- GetWindowText(hWnd, b, 99); GetWindowRect(hWnd,&Rect);
- GetWindowThreadProcessId(hWnd, &pid);
- printf("%li: %s left:%li top:%li\n",pid,b,Rect.left,Rect.top);
- } return TRUE;
- }
- int main(int argc, char ** argv){
- if (argc > 1){
- HANDLE hFile = CreateFile(
- "proc.dmp",
- GENERIC_READ | GENERIC_WRITE,
- FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE,
- NULL,
- CREATE_ALWAYS,
- FILE_ATTRIBUTE_NORMAL,
- NULL
- );
- DWORD procID = atoi(argv[1]);
- HANDLE hProc = OpenProcess(
- PROCESS_ALL_ACCESS,
- FALSE,
- procID
- );
- fprintf(stderr,"Dumping hProc %p\n",hProc);
- if (!MiniDumpWriteDump(
- hProc,
- procID,
- hFile,
- MiniDumpNormal,
- NULL,
- NULL,
- NULL
- )) fprintf(stderr,"didn't work :(\n");
- CloseHandle(hFile);
- } else {
- fprintf(stderr,"Usage: %s procID\n",argv[0]);
- EnumChildWindows(GetDesktopWindow(),FunkyCallback, 0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement