Restarting the process
-
I want to restart the process using the information of the previoulsy suspended process i.e. baseAddr,region,state, allocationbase, e.t.c but now i am stuck. It does not start even though i provided info from the file where it has to read from. my restart function is below here. What am i missing...
case 6://restarting the process using information from the file lpBaseAddress = 0; hProcess = mbi.BaseAddress; SetThreadContext( hThread, lpContext ); /* OpenThread( dwDesiredAccess, // handle to thread bInheritHandle, // access to process dwThreadId, GetLastError() // pointer to handle to open access token );*/ if (OpenProcess(dwDesiredAccess, bInheritHandle,dwThreadId, GetlastError()) == NULL) printf("Unable to open thread\n"); SuspendThread(pi.hThread);// identifies thread to suspend fp = fopen("info.bin","r"); if( fp ) nSize = 10000; //numbers of bytes in the file lpBuffer = 0; //pointer to the file where data is to be read WriteProcessMemory( dwDesiredAccess, // handle to process whose memory is written to lpBaseAddress, // address to start writing to lpBuffer, // pointer to buffer to write data to nSize, // number of bytes to write lpNumberOfBytesWritten // actual number of bytes written ); printf("Numbers of bytes writen: ",lpNumberOfBytesWritten); ResumeThread(dwDesiredAccess);// identifies thread to restart GetLastError(); break;
oam