searching a string in memory , but dont think i got it right somewhere

This is a discussion on searching a string in memory , but dont think i got it right somewhere within the Windows Programming forums, part of the Platform Specific Boards category; Code: //got the process handle with OpenProcess , so i just paste from here //not sure if its right void ...

  1. #1
    Registered User
    Join Date
    Nov 2002
    Posts
    306

    searching a string in memory , but dont think i got it right somewhere

    Code:
    //got the process handle with OpenProcess , so i just paste from here
    //not sure if its right 
    
    
    void VirtualQueryFunc(HANDLE hProcess)
    {
    
    char Buffer[32];
    DWORD dwRead;
    MEMORY_BASIC_INFORMATION meminfo;
    SYSTEM_INFO si;
    GetSystemInfo(&si);
    printf("%s   %i\n" , "si.lpMinimumApplicationAddress", si.lpMinimumApplicationAddress);
    printf("%s   %i\n" , "si.lpMaximumApplicationAddress" , si.lpMaximumApplicationAddress);
    int address = 0;
    DWORD  codebase = 0x0040000; 
    
    while (address < (int)si.lpMaximumApplicationAddress){
          
            VirtualQueryEx(hProcess , (LPCVOID) address, &meminfo, sizeof(meminfo));
          
              switch(meminfo.State)
              {
              case MEM_COMMIT: 
              ReadProcessMemoryFunc(hProcess , address);
              printf("%s\n" , "memory commited"); 
              break;
              case MEM_FREE: printf("%s\n" , "free memory"); break;
              case MEM_RESERVE: printf("%s\n" , "reserved memory"); break;
              }
          Sleep(30);
          
          
          address += meminfo.RegionSize;
      
          
    }     
          
    }  
    
    void ReadProcessMemoryFunc(HANDLE hProcess , int addresss)
    {
         BYTE byBuffer[0x1000];
         DWORD dwRead;
         ReadProcessMemory(hProcess, (void *)addresss, byBuffer, 0x1000, &dwRead);
         if(strcmpi((char *)byBuffer  ,"PRIVMSG")==0)
         {
         printf("%s\n" , (char *)byBuffer);
         }
    
    }
    Last edited by Anddos; 06-30-2007 at 02:19 AM.

  2. #2
    Registered User blueterry's Avatar
    Join Date
    Jun 2007
    Posts
    3

    ?

    does it work?
    Last edited by blueterry; 06-30-2007 at 10:51 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. OOP Question DB Access Wrapper Classes
    By digioz in forum C# Programming
    Replies: 2
    Last Post: 09-07-2008, 04:30 PM
  2. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  3. Linked List Help
    By CJ7Mudrover in forum C Programming
    Replies: 9
    Last Post: 03-10-2004, 09:33 PM
  4. Pointer's
    By xlordt in forum C Programming
    Replies: 13
    Last Post: 10-14-2003, 02:15 PM
  5. Manipulating the Windows Clipboard
    By Johno in forum Windows Programming
    Replies: 2
    Last Post: 10-01-2002, 09:37 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21