Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


VirtualQueryEx problem

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Freiza
Grandmaster Cheater
Reputation: 22

Joined: 28 Jun 2010
Posts: 662

PostPosted: Mon Apr 11, 2011 6:28 am    Post subject: VirtualQueryEx problem Reply with quote

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
View user's profile Send private message Send e-mail
Cheat Engine User
Something epic
Ban
Reputation: 60

Joined: 22 Jun 2007
Posts: 2071

PostPosted: Mon Apr 11, 2011 8:23 am    Post subject: Reply with quote

Call GetLastError, what do you get?
Back to top
View user's profile Send private message
Freiza
Grandmaster Cheater
Reputation: 22

Joined: 28 Jun 2010
Posts: 662

PostPosted: Mon Apr 11, 2011 10:59 am    Post subject: Reply with quote

Error Code : 87
ERROR_INVALID_PARAMETER
but i think all my parameter are fine..
Back to top
View user's profile Send private message Send e-mail
Cheat Engine User
Something epic
Ban
Reputation: 60

Joined: 22 Jun 2007
Posts: 2071

PostPosted: Mon Apr 11, 2011 11:11 am    Post subject: Reply with quote

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
View user's profile Send private message
Freiza
Grandmaster Cheater
Reputation: 22

Joined: 28 Jun 2010
Posts: 662

PostPosted: Mon Apr 11, 2011 11:16 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Cheat Engine User
Something epic
Ban
Reputation: 60

Joined: 22 Jun 2007
Posts: 2071

PostPosted: Mon Apr 11, 2011 11:17 am    Post subject: Reply with quote

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
View user's profile Send private message
Freiza
Grandmaster Cheater
Reputation: 22

Joined: 28 Jun 2010
Posts: 662

PostPosted: Mon Apr 11, 2011 11:23 am    Post subject: Reply with quote

on GetLastError at OpenProcess = 0
hproc = 28;
Back to top
View user's profile Send private message Send e-mail
Cheat Engine User
Something epic
Ban
Reputation: 60

Joined: 22 Jun 2007
Posts: 2071

PostPosted: Mon Apr 11, 2011 11:50 am    Post subject: Reply with quote

Freiza wrote:
on GetLastError at OpenProcess = 0
hproc = 28;
Code works for me, try (void *)addr as a parameter?
Back to top
View user's profile Send private message
Freiza
Grandmaster Cheater
Reputation: 22

Joined: 28 Jun 2010
Posts: 662

PostPosted: Mon Apr 11, 2011 11:56 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Mon Apr 11, 2011 2:52 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites