Click here to Skip to main content
15,902,865 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralProblem with socket Pin
densitet2-Mar-05 21:20
densitet2-Mar-05 21:20 
GeneralRe: Problem with socket Pin
vishalmore2-Mar-05 22:01
vishalmore2-Mar-05 22:01 
GeneralRe: Problem with socket Pin
densitet2-Mar-05 22:08
densitet2-Mar-05 22:08 
GeneralRe: Problem with socket Pin
ThatsAlok2-Mar-05 23:19
ThatsAlok2-Mar-05 23:19 
GeneralRe: Problem with socket Pin
vishalmore3-Mar-05 2:40
vishalmore3-Mar-05 2:40 
GeneralPlease help me immediatly Pin
ikram_ktk2-Mar-05 20:33
ikram_ktk2-Mar-05 20:33 
GeneralRe: Please help me immediatly Pin
Ravi Bhavnani3-Mar-05 3:59
professionalRavi Bhavnani3-Mar-05 3:59 
Generalchallenging one Pin
mpapeo2-Mar-05 19:34
mpapeo2-Mar-05 19:34 
Hello,
What I'm attempting to do here is access the memory of a process which i have already created for 'read' purposes. I feel that I'm close, but can't quite get it to work and its chalenging. After reading i then want all the info of the memory read to be displayed and save into a file
I need to have finished this by the end of the week, pliz assist.

Part of the code is below:

int main(int argc, char **argv)
{
PROCESS_INFORMATION pi; /* filled in by CreateProcess */
STARTUPINFO si; /* startup info for the new process*/
HANDLE hProcess = pi.hProcess;
BYTE buf[2000];
DWORD bufsize = sizeof buf;
DWORD baseaddr = 1;
DWORD error = GetLastError();
LPCVOID lpAddress;
PMEMORY_BASIC_INFORMATION lpBuffer;
DWORD dwLength;
DWORD flNewProtect;
PDWORD lpflOldProtect;
DWORD dwSize =0;
LPCVOID lpBaseAddress;
DWORD nSize;
LPDWORD lpNumberOfBytesRead;

printf("Process %d reporting for creation\n",GetCurrentProcessId());
GetStartupInfo(&si);

// Call CreateProcess, telling it to run an exe file
CreateProcess(NULL, /* lpApplicationName */
"numbers.exe", /* lpCommandLine assumes to use curent process directory*/
NULL, /* lpsaProcess */
NULL, /* lpsaThread */
FALSE, /* bInheritHandles */
CREATE_NEW_CONSOLE, /* dwCreationFlags */
NULL, /* lpEnvironment */
NULL, /* lpCurDir */
&si, /* lpStartupInfo */
&pi /* lpProcInfo */
);

printf("New Process ID: %d ",pi.dwProcessId);
printf("has started \n");
//============================================
OpenProcess(
PROCESS_ALL_ACCESS, // access flag
0, // handle inheritance flag
pi.dwProcessId // process identifier
);
//===============================================

GetModuleHandle(
"numbers.exe" // address of module name to return handle
// for
);

//============================================================
// ImageNtHeader(
// 1
// );
//============================================================
VirtualQueryEx(
hProcess, // handle to process
lpAddress, // address of region
lpBuffer,// address of information buffer
dwLength // size of buffer
);
//==========================================================
//*to avoid crashing

VirtualProtectEx(
hProcess, // handle to process
lpAddress, // address of region of committed pages
dwSize, // size of region
flNewProtect, // desired access protection
lpflOldProtect // address of variable to get old protection

);

//============================================================

ReadProcessMemory(hProcess,
lpBaseAddress,
lpBuffer,
nSize, //number of bytes to ead from process*/
lpNumberOfBytesRead //number of bytes transfered*/
);

ZeroMemory(buf, sizeof(buf));
if( ReadProcessMemory( hProcess, &baseaddr, &buf, bufsize, NULL ) == FALSE )
{
printf("\nProcess memory read failed");
_exit(1);
}
else
printf("\nProcess memory read \n");

return(0);
}
Thanx in advance

oam
GeneralRe: challenging one Pin
jan larsen2-Mar-05 20:19
jan larsen2-Mar-05 20:19 
GeneralRe: challenging one Pin
mpapeo2-Mar-05 22:17
mpapeo2-Mar-05 22:17 
GeneralRe: challenging one Pin
jan larsen2-Mar-05 22:39
jan larsen2-Mar-05 22:39 
GeneralRe: challenging one Pin
mpapeo4-Mar-05 11:02
mpapeo4-Mar-05 11:02 
QuestionHow 2 make a string of 10 * in a row? Pin
jj2jj22-Mar-05 18:55
jj2jj22-Mar-05 18:55 
AnswerRe: How 2 make a string of 10 * in a row? Pin
ThatsAlok2-Mar-05 19:11
ThatsAlok2-Mar-05 19:11 
AnswerRe: How 2 make a string of 10 * in a row? Pin
jones20003-Mar-05 1:48
jones20003-Mar-05 1:48 
General[IFileSystem ] Problem using IFileSystem Interface from scrrun.dll Pin
Member 862302-Mar-05 18:47
Member 862302-Mar-05 18:47 
GeneralQuestion about window's state!!! Pin
kokehqyu2-Mar-05 18:45
kokehqyu2-Mar-05 18:45 
GeneralRe: Question about window's state!!! Pin
Ravi Bhavnani3-Mar-05 3:55
professionalRavi Bhavnani3-Mar-05 3:55 
GeneralRe: Question about window's state!!! Pin
kokehqyu3-Mar-05 17:39
kokehqyu3-Mar-05 17:39 
GeneralDevstudio addin Ques Pin
Jetli Jerry2-Mar-05 18:37
Jetli Jerry2-Mar-05 18:37 
GeneralMFC MDI with sound! Pin
Member 14844962-Mar-05 18:24
Member 14844962-Mar-05 18:24 
GeneralRe: MFC MDI with sound! Pin
David Crow3-Mar-05 2:17
David Crow3-Mar-05 2:17 
Questionhow do i..... Pin
namaskaaram2-Mar-05 17:27
namaskaaram2-Mar-05 17:27 
AnswerRe: how do i..... Pin
Steen Krogsgaard2-Mar-05 21:12
Steen Krogsgaard2-Mar-05 21:12 
GeneralRe: how do i..... Pin
namaskaaram2-Mar-05 22:08
namaskaaram2-Mar-05 22:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.