|
Background:
This function allegedly allows one process to collect information about the memory usage of other processes.
The (only) Microsoft sample code using this API seems to be a sample debugger that spawns a process under debug and then uses the API.
In true MS fashion, the documentation talks about about using OpenProcess to get a handle to another process and then using that handle in the call to VirtualQueryEx. There is no mention that you must be DEBUGGING the other application.
In some tests cases so far, I get access violation trying to OpenProcess, but assuming that succeeds, the error code is 'invalid parameter' on return from VirtualQueryEx. I know the other parameters are valid, so I am assuming it is a form of access denied.
The Problem:
Unless you are on Windows XP or later. You can not seem to attach to a process to debug and then detach without stopping the process which was being debugged. Not good for our application.
The Question:
Has anyone got this to work to spy on other process memory without 'debugging' the other process?
|
|
|
|
|
try it like this:
HANDLE hProcess;
MEMORY_BASIC_INFORMATION mem;
hProcess = OpenProcess( PROCESS_VM_OPERATION, FALSE, id );
VirtualQueryEx( hProcess, 0x00400000, &mem, 4 * 1024 );
this has to work... debugging is not nesassary
Don't try it, just do it!
|
|
|
|
|
Two things so far.
1. I do not think this is correct anyway:
VirtualQueryEx( hProcess, 0x00400000, &mem, 4 * 1024 );
Should probably be:
VirtualQueryEx( hProcess, 0x00400000, &mem, sizeof(MEMORY_BASIC_INFORMATION) );
which now works fine.
2. Why can I only query virtual memory usage from 0x00000000 to 0x7FFE0000 ?
Reading from 0x7FFF0000 causes 'invalid parameter' to be returned from GetLastError().
I REALLY want to make a map of memory usage between 0x80000000 to 0xFFFFFFFF.
Why are these memory ranges out of bounds? That is the range where the memory mapped files and shared memory between applications are usually located, and it is still initially aquired by a process using the VirtualAlloc calls.
|
|
|
|
|
Is it possible to append a status bar to to a property sheet?
BOOL CMyPropertySheet::CreateStatusBar()<br />
{<br />
static UINT nIndicators[] = <br />
{<br />
ID_SEPARATOR,<br />
IDS_TIME<br />
};<br />
<br />
if (!m_bar.Create (this))<br />
return FALSE;<br />
<br />
m_bar.SetIndicators (nIndicators, 2);<br />
return TRUE;<br />
}
The above function is called from the OnCreate() function of my PropertySheet but it fails to appear. Any ideas?
|
|
|
|
|
Hi All,
I'm new to programming, so i have been trying to read and go to a few classes.
I have been reading the tutorials on Server/Clients and am still a little confused.
Right now i have a dialog that has a couple of check boxes on it, and I want to send the information of whether the boxes are checked or not to the server side . The message is just a string that looks like this : 2000 or 2001
I know that the two connect, but I can not get the message to be sent to the server. I am using the command:
send (socket, buf,strlen(buf),0)
where socket is instantiated in another dialog class that i use to connect to the server. How do I use the same socket that is already connected to the server to send this message. It won't compile unless i instantiate another socket in the dialog class with the check boxes.
Many thanks in advance.
|
|
|
|
|
Under winsock, the program calls Win32 API to access the socket. If you wanted to send data on one object and receive data in another object, then one solution is to pass the socket.
Kuphryn
|
|
|
|
|
I'm sorry but i do not understand what to do.
Once I have the client and the server connected, how do i send the message to the server? It doesn't seem to send the data to the server. Is there something I have to pass between the two cpp files, or can i just connect and then instantiate a SOCKET object and send it to that?
Can someone possible give me some sample code...i looked at the tutorials on this site but i still can't get it to work.
Thanks in advance.
|
|
|
|
|
I have a few questions:
1. Can anyone tell me why a DLL may be loaded more than once by a program?
2. Can anyone suggest a good resource for learning more about how DLLs are loaded/unloaded by the Windows operating system?
3. Does anyone know what the clbcatq.dll contains?
Thanks!
|
|
|
|
|
1. as far as I know, you may 'load' it multiple times, but it will just increase some internal counter, in reality, you'll get just one dll in memory.
2. LoadLibrary is a good starter in MSDN, the Remarks section contains valuable hints and references.
3. sorry, no idea
|
|
|
|
|
Amity Binkert wrote:
1. Can anyone tell me why a DLL may be loaded more than once by a program?
How are you verifying this? If the DLL is implicitly loaded, it happens once. If the DLL is explicitly loaded, it is still only loaded once, but the reference count is incremented with each successive call to LoadLibrary() .
Amity Binkert wrote:
3. Does anyone know what the clbcatq.dll contains?
Are you sure the file isn't ~clbcatq.dll? Its presence indictaes that COM+ was not setup properly.
|
|
|
|
|
3. Run dependancy walker on the DLL. From having a look at that, and checking the product name ('COM Services') [edit] i guess [/edit] that it has to do with fundamental COM stuff.
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
3. It's part of the COM services (aka COM+) stuff.
Think it's part of the COM+ Catalog stuff (but not the admin interface)
Steve S
|
|
|
|
|
In a bit of a quandry here...
I have two constructors for a class:
CMatrix(unsigned int uiRows, unsigned int uiColumns);
CMatrix(unsigned int uiSize, bool bCreateIdentity);
Unfortunately when I call the constructor in the code:
CMatrix* aMatrix;
aMatrix = NULL;
aMatrix = new CMatrix(2,2);
The VS 6.0 compiler informs me:
<br />
error C2668: 'CMatrix::CMatrix' : ambiguous call to overloaded function<br />
Which, I suppose, leaves me with three solutions:
1.) Use BOOL in place of bool which
I wanted to avoid
2.) Use int instead of unsigned int which
would require changing alot of already existing code and which
is really not what I want to do (I prefer unsigned int )
3.) Add a 3rd dummy parameter to one of the constructors, but this
seems like a desperate hack
Has anyone run into this before and come up with a creative solution
they would be willing to share?
|
|
|
|
|
Does aMatrix = new CMatrix(2, 2U); help?
|
|
|
|
|
Ah, yes! Of course!
That's perfect. Thanks.
|
|
|
|
|
Actually, your use of the format specifier gave me
an idea. I tried this and it works also:
aMatrix = new CMatrix(2, static_cast<unsigned int>(2));
Unless this is safer, I prefer your solution - much shorter
and to the point.
Thanks again.
|
|
|
|
|
Just to comment on why you get this error... When the compiler sees the parameter 2 , it compares the parameter type (int ) with the param types of the available ctors. Since int can be implicitly converted, using language rules, to either unsigned or bool , the call is ambiguous. Changing it to 2U makes the parameter type unsigned , so the only possible choice is the ctor that takes an unsigned .
--Mike--
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
Latest art~!@#2rDFA#@(#*%$Rfa39f3fqwf--=
NO CARRIER
|
|
|
|
|
My situation is this:
I have made MFC program using CListView. Data
is listed very neatly, but now I would like
to be able to make reports of the data, maybe
print little bars & pies.
How can I open a new window with CScrollView
class as the view? I would also like to
be able to print the view.
I've tried a couple to things so far, but I
more or less lost. Would one possibility be to open
a window the same size as CListView, kind of like put
it on top of the CListView?
(Yes, I am a newbie
|
|
|
|
|
In a dialog based application I have to disable (lock) the enter-key until the dialog is closed. I think, using a keyboard-hook will be a good idea; does anybody have experiences concerning this method?
thanks in advance
|
|
|
|
|
You mean, you don't want your dialog to be closed when the user presses 'enter' ?
There is a much easier way to do that: just override the OnOk function: don't call CDialog::OnOk() !
(Create a button with id = IDOK and create a message handler)
Hope this helps
|
|
|
|
|
for my project , i have a CView contain a CTreeCtrl member. i want to cope with the tree notify message in the view.
for instance : msg: TVN_ITEMEXPANDED
CView::OnNotify(wParam , lParam , lpResult){
}
as far as i know wParam as idCtrl,
lParam as LPNMHDR strcut point.
but msdn says
TVN_ITEMEXPANDED
pnmtv = (LPNMTREEVIEW) lParam .
what really the lParam refer to??
help me.
love program
|
|
|
|
|
I'm not into MFC but pnmtv = (LPNMTREEVIEW) lParam means you're casting the lParam into a pointer to an NMTREEVIEW structure. That structure probably contains a TVITEM structure as well,. I would guess you need to examine the state of that TVITEM.
What's the difference between a C++ programmer and God? God knows he's not a C++ programmer :
anon
|
|
|
|
|
i see , as i digesting into the document. lParam is not only a pointer to NMHDR even more of that. we could change the type of it to proper struct pointer such as LPNMTREEVIEW.
thank you.
love program
|
|
|
|
|
Hi,
I have an MFC DLL plugged in to one of the exe.I have full control of the DLL.
My question is when i execute the exe can i pass command line arguments to the exe and access within the DLL.
Pls help
Thnks
|
|
|
|
|
Yes. If the EXE has a CWinApp -derived class, you can access the m_lpCmdLine member variable. If not, you can use the __argc and __argv global variables.
|
|
|
|