|
Hi everybody,
I have a slight problem with this segment of code, which gives me error. I want to read a process memory and save it to a file but then im having a syntax problems. Pliz help
ReadProcessMemory(HANDLE, /*hProcess*/
LPCVOID, /*lpBaseAddress*/
LPVOID, /*lpBuffer*/
SIZE_T, /*nSize*/
SIZE_T* /*lpNumberOfBytesRead*/
);
|
|
|
|
|
Can u post your code here. I mean the code which is giving error
"Aerodynamically, the bumble bee shouldn't be able to fly, but the
bumble bee doesn't know it so it goes on flying anyway." - Mary Kay Ash
My Articles
|
|
|
|
|
There is the code below
#include <windows.h>
#include <stdio.h>
//Program that creates a process
//This program assumes that numbers.exe is in the PATH!
int main(int argc, char **argv)
{
PROCESS_INFORMATION pi; /* filled in by CreateProcess */
STARTUPINFO si; /* startup info for the new process*/
/* print out our process ID */
printf("Process %d reporting for creation\n",GetCurrentProcessId());
/* Get startup info for current process, we will use this
as the startup info for the new process as well... */
GetStartupInfo(&si);
/* Call CreateProcess, telling it to run an exe file
with lots of defaults... (the NULLs mean "use defaults")
"\"F:\debug\numbers.exe\" -L",
*/
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 */
);
/* print out the new process iD and quit
(does not wait for new process to exit!)
*/
printf("New Process ID: %d ",pi.dwProcessId);
printf("has started \n");
ReadProcessMemory(HANDLE, /*hProcess*/
LPCVOID, /*lpBaseAddress*/
LPVOID, /*lpBuffer*/
SIZE_T, /*nSize number of bytes to ead from process*/
SIZE_T* /*lpNumberOfBytesRead number of bytes transfered*/
);
printf("Process memory has read \n");
/*
WriteProcessMemory(
HANDLE, /* hProcess,*/
// LPVOID, /* lpBaseAddress*/
//LPCVOID, /* lpBuffer,*/
//SIZE_T, /* nSize,*/
//SIZE_T* /*lpNumberOfBytesWritten*/
//);
DWORD SuspendThread(HANDLE /*hThread*/
// );
// GetLastError(void);
return(0);
}
|
|
|
|
|
Hi everyone,
Im new to the site(as well as MFC and C++), so I hope this question is being put in the right spot.
Basically I want to know how to add a Dialog bar to a dialog based application. Is it possible?
Ive found various examples on the web but they seem to be aimed at SDI and MDI style apps.
When I try and use what they say, no dialog bar is created (when I use Create() ) and if I try EnableDocking the app compiles but crashes when it tries to execute the code with an error in dockcont.cpp line 45. Furthermore it doesnt even recognise the call "DockControlBar". I have included "#include <Afxext.h>".
Ive been banging my head against this for over a day now.
Can anyone tell me if its possible to have a dialogbar in a dialog based application, and if so point me towards a tutorial?
Thanks,
Will.
Can anyone help?
|
|
|
|
|
BTW I am using VisC6. I dont even really need toolbars, all I really want is some modeless windows I can dock onto a main window... (basically I want an expandable interface as my app has lots of controls that I want to be dynamically visible...
Cheers
Will.
|
|
|
|
|
It is possible to add menu, toolbar status bar to a dialog; the question is it feasible.
Dialog simply was not designed to route commands nor was it designed to dock bars. CControlBar is looking for a docking site and expect frame window to be one.
I am not sure if amount of code that has to be add to a dialog to implement all the changes needed is justifiable.
Consider SDI application and CFormView as a base class for view be it with or without document/view architecture support.
Such an application with main frame that is not resizable will resemble dialog providing with all functionality and support for command routing, toolbar docking and more for free, without adding any additional code to support it.
JohnCz
|
|
|
|
|
Hello Will,
Here is atutorial[^] about how to add a toolbar to a dialog.
I think that the procedure may be the same for DialogBar.
But you should know that this thing doesn't make it dockable ( as I remember). So this might not be the solution to your problem.
|
|
|
|
|
Hello everybody
I am trying to inject a dll in a certain process but everytime I do It the injected process does not respond.
I have debuged the program step by step and I don't get any invalid handles or leaks of memoriy.
The funny thing is that when I enumerate all the modules from a process and I create a remote thread to free a library from a process it works just fine.
Also when I try to inject a certain library in my own process it works just fine
Here Is the code I use:
<br />
int WINAPI InjectLib(DWORD process_id, char *lib_name)<br />
{<br />
<br />
PTHREAD_START_ROUTINE pfnRemote =(PTHREAD_START_ROUTINE)<br />
GetProcAddress(GetModuleHandle("Kernel32"), "LoadLibraryA");<br />
if(pfnRemote ==NULL)<br />
return -1;<br />
HANDLE hProcess =OpenProcess(PROCESS_ALL_ACCESS, FALSE, process_id);<br />
if(hProcess ==NULL)<br />
{<br />
<br />
return -1;<br />
}<br />
<br />
int mem_size =strlen(lib_name)+1;<br />
void *premote_mem =VirtualAllocEx(hProcess, NULL, mem_size, MEM_COMMIT, PAGE_READWRITE);<br />
if(premote_mem ==NULL)<br />
{<br />
CloseHandle(hProcess);<br />
return -1;<br />
}<br />
<br />
int ret =WriteProcessMemory(hProcess, premote_mem, lib_name, mem_size,NULL);<br />
if(ret ==STATUS_ACCESS_VIOLATION || ret ==false)<br />
{<br />
<br />
VirtualFreeEx(hProcess, premote_mem, 0, MEM_RELEASE);<br />
CloseHandle(hProcess); <br />
return -1;<br />
}<br />
<br />
<br />
HANDLE hThread =CreateRemoteThread(hProcess, NULL, 0, <br />
pfnRemote, premote_mem, 0, NULL);<br />
<br />
if(hThread ==NULL)<br />
{<br />
VirtualFreeEx(hProcess, premote_mem, 0, MEM_RELEASE);<br />
CloseHandle(hProcess);<br />
return -1;<br />
}<br />
<br />
<br />
WaitForSingleObject(hThread, INFINITE);<br />
<br />
VirtualFreeEx(hProcess, premote_mem, 0, MEM_RELEASE);<br />
CloseHandle(hProcess);<br />
CloseHandle(hThread);<br />
<br />
return 0;<br />
}
Can someone tell me what am I missing.
gabby
|
|
|
|
|
im going to burn my program to a cd, and i need it to run as soon as the cd is in the drive.
|
|
|
|
|
|
Im just stumped on this and Im looking for any kind of demo
project to guide me alittle.
I have a CFormView project. If the user clicks the X in the
upper right corner or clicks File/Exit, I want to run a quick
command and then terminate the program. I dont know how to
handle the clicking of the X in the upper right corner and
if I try to handle File/Exit, the program never actually
terminates.
Any ideas or demo project on how to safely exit a program.
Please, any response any one can give me will be greatly
appreciated.
Sincerely,
Danielle Brina (an overworked graduate student)
|
|
|
|
|
|
Hi, all
I have such construction:
class CMyClass : public CObject
{
public:
static CMapWordToPtr m_Map;
}
In another file I try to access this member:
char* val = "Something";
CMyClass::m_Map[1] = val;
The linker gets an error:
error LNK2001: unresolved external symbol "public: static class CMapWordToPtr CMyClass::m_Map" (?m_Map@CMyClass@@2VCMapWordToPtr@@A)
Is it possible to access to this member in some way?
Thanks.
Mykhaylo
|
|
|
|
|
You will still need to declare the member in a source file for it to be created:
CMapWorldToPtr CMyClass::m_Map;
|
|
|
|
|
Thanks a lot!
|
|
|
|
|
Just give a Outre defination of your static CMapToPtr this way
class CMyClass : public CObject
{
public:
static CMapWordToPtr m_Map;
}
In your myclass.cpp file
CMapWordToPtr CMyClass::m_Map;
"I Think this Will Help"
[Vote One Here,.....]
<h5
alok="" gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
I'm using by MFC class CButton to create buttons on my dialog box.
I have to create buttons with a different color of text.
How I can make it ?
|
|
|
|
|
Follow These Steps
1 first make your button Owner Drawn , you will find this property by right clicking the button in Design View
2. then handle the WM_CTLCOLOR message wher nIDColor=..._btn
3. For Setting the Text Color use Api SetTextColor(...);
"I Think this Will Help"
[Vote One Here,.....]
<h5
alok="" gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
Owner Drawn property cause to button be unvisible ???
About steps 2 and 3 I made like that:
<br />
HBRUSH CvisualCalcDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)<br />
{<br />
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);<br />
<br />
if (pWnd->GetDlgCtrlID()==IDC_BUTTON1)<br />
{<br />
pDC->SetTextColor(RGB(0,0,255));<br />
}<br />
<br />
return hbr;<br />
}<br />
but it doesn't helps.
Could you explain more detailed ?
Please
|
|
|
|
|
This[^] article may help. See the section on colored captions.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Hi,
Why don't you use the activex button's of microsoft?
also,you can use all the button available here in Code project...
isn't it easier????
Regards,
Eli
|
|
|
|
|
Many ISPs put limits on the amount of internet traffic that an account can have before charging extra. Is there any way that a program can enquire as to how much data has been sent and received? Similar to the data supplied on the network status dialog.
|
|
|
|
|
Look for FireWall source code here At Code project in Internet Section or read documatation of IPHELPER apis in MSDN or look at this article by Mr David Crow here
http://www.codeproject.com/internet/IPHelper.asp
"I Think this Will Help"
[Vote One Here,.....]
<h5
alok="" gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
That's interesting stuff. Lots of useful functions there. However the statistics give the number of datagrams received, not the number of bytes, which is what ISPs quote. Are datagrams a fixed size? Or are there other functions?
|
|
|
|
|
Hello There!
This Morning i find a function that will give you statistics in Bytes.
And Function is RasGetConnectionStatistics
Hope that's Work Well for you.
"I Think this Will Help"
[Vote One Here,.....]
<h5
alok gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|