| View previous topic :: View next topic |
| Author |
Message |
Freiza Grandmaster Cheater
Reputation: 22
Joined: 28 Jun 2010 Posts: 662
|
Posted: Mon Apr 11, 2011 6:28 am Post subject: VirtualQueryEx problem |
|
|
| Code: | memblock* createscan(DWORD pid)
{
memblock *m= NULL;
HANDLE hproc= OpenProcess(PROCESS_ALL_ACCESS,FALSE,pid);
MEMORY_BASIC_INFORMATION meminfo;
unsigned char *addr=0;
if(hproc)
{
while(1)
{
if(VirtualQueryEx(hproc,addr,&meminfo,sizeof(meminfo))==0)
{
break;
} |
What is wrong in this code.. it always exits while loop. ie VirtualQueryEx always returns 0. |
|
| Back to top |
|
 |
Cheat Engine User Something epic
Reputation: 60
Joined: 22 Jun 2007 Posts: 2071
|
Posted: Mon Apr 11, 2011 8:23 am Post subject: |
|
|
| Call GetLastError, what do you get? |
|
| Back to top |
|
 |
Freiza Grandmaster Cheater
Reputation: 22
Joined: 28 Jun 2010 Posts: 662
|
Posted: Mon Apr 11, 2011 10:59 am Post subject: |
|
|
Error Code : 87
ERROR_INVALID_PARAMETER
but i think all my parameter are fine.. |
|
| Back to top |
|
 |
Cheat Engine User Something epic
Reputation: 60
Joined: 22 Jun 2007 Posts: 2071
|
Posted: Mon Apr 11, 2011 11:11 am Post subject: |
|
|
| Freiza wrote: | Error Code : 87
ERROR_INVALID_PARAMETER
but i think all my parameter are fine.. | What are you passing on as a PID? Is it being used? |
|
| Back to top |
|
 |
Freiza Grandmaster Cheater
Reputation: 22
Joined: 28 Jun 2010 Posts: 662
|
Posted: Mon Apr 11, 2011 11:16 am Post subject: |
|
|
yes.. For pid
Dword pid;
cin>>pid;
pid== active notepad (collected from task manager ) currently 6044.
i think there is some problem in addr ..
my complete code is long enuff to post..(though not advance). else i would have posted here.
Last edited by Freiza on Mon Apr 11, 2011 11:19 am; edited 1 time in total |
|
| Back to top |
|
 |
Cheat Engine User Something epic
Reputation: 60
Joined: 22 Jun 2007 Posts: 2071
|
Posted: Mon Apr 11, 2011 11:17 am Post subject: |
|
|
| Freiza wrote: | yes.. For pid
Dword pid;
cin>>pid;
pid== active notepad (collected from task manager)
i think there is some problem in addr .. | Are you sure, try putting a breakpoint inside the if(hproc) statement. I think it's OpenProcess returning that last error. |
|
| Back to top |
|
 |
Freiza Grandmaster Cheater
Reputation: 22
Joined: 28 Jun 2010 Posts: 662
|
Posted: Mon Apr 11, 2011 11:23 am Post subject: |
|
|
on GetLastError at OpenProcess = 0
hproc = 28; |
|
| Back to top |
|
 |
Cheat Engine User Something epic
Reputation: 60
Joined: 22 Jun 2007 Posts: 2071
|
Posted: Mon Apr 11, 2011 11:50 am Post subject: |
|
|
| Freiza wrote: | on GetLastError at OpenProcess = 0
hproc = 28; | Code works for me, try (void *)addr as a parameter? |
|
| Back to top |
|
 |
Freiza Grandmaster Cheater
Reputation: 22
Joined: 28 Jun 2010 Posts: 662
|
Posted: Mon Apr 11, 2011 11:56 am Post subject: |
|
|
I am using windows 7 .. can this be the reason? ( i mean administrator priviledge)
and already tried using LPCVOID addr.. but didn't worked. |
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Mon Apr 11, 2011 2:52 pm Post subject: |
|
|
Don't use PROCESS_ALL_ACCESS, specify what flags you need.
Call memset/ZeroMemory on your memory structure to initialize it for safety.
Use GetSystemInfo to get the page sizes of the system and the minimum address location too. _________________
- Retired. |
|
| Back to top |
|
 |
|