[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now


Stuck on ReadProcessMemory() for over a week, can someone please take a look

Posted on 2006-06-12
Medium Priority
Last Modified: 2013-11-17
All the functions below main work fine, The SendMessage() work fine, Just the ReadProcessMemory. What I am trying to do is to copy a string from a listbox, to variable (with out looking at my code i think the variable is "testing". I have been programming 8 months, so i am not that experienced, my code might look like garbage in that ReadProcessMemory(), i have been trying differen't things.

Code is below

using std::cin;
using std::cout;
using std::endl;
HWND ListBox();
HWND FindChat();
int main()
    DWORD LBthread;
    DWORD ProcessID;
    char ScreenNames[17];
    DWORD NumberOfPeopleInRoom;
    unsigned long bytes;
    LBthread = GetWindowThreadProcessId(ListBox(),&ProcessID);
    HANDLE OpenProc;
    OpenProc = OpenProcess(PROCESS_VM_READ,FALSE,ProcessID);
        NumberOfPeopleInRoom = SendMessage(ListBox(), LB_GETCOUNT, 0, 0) - 1;
        cout << NumberOfPeopleInRoom << endl;
        DWORD itemData;
        WORD length;
        TCHAR *pszCmdLine = new TCHAR[length];
        itemData = SendMessage(ListBox(), LB_GETITEMDATA,(WPARAM) 10,0);
        ReadProcessMemory(OpenProc,(LPVOID) itemData,pszCmdLine,length,&bytes);
struct __INFOBLOCK
    DWORD   dwFiller[16];
    WORD    wLength;
    WORD    wMaxLength;
    DWORD   dwCmdLineAddress;
} Block;

ReadProcessMemory(hProcess, (LPVOID) PEB.dwInfoBlockAddress,
                             &Block, sizeof(Block), &dwSize);
TCHAR *pszCmdLine = new TCHAR[Block.wMaxLength];

ReadProcessMemory(hProcess, (LPVOID) Block.dwCmdLineAddress,
                  pszCmdLine, Block.wMaxLength, &dwSize);
            char testing[17];
            cout << *testing << endl;
    return 0;
    HWND AOLwindow;
    AOLwindow = FindWindowEx(0,0,"AOL Frame25",0);
    return AOLwindow;  
    HWND MDIwindow;
    MDIwindow = FindWindowEx(AOL(),0,"MDIClient",0);
    return MDIwindow;    
HWND FindChat()
     HWND hwndChild = 0, hwndAOLChatForm = 0;
          hwndAOLChatForm = FindWindowEx(hwndChild, 0, "_AOL_Static", "AOL_CHAT_FORM");
          if (hwndAOLChatForm) break;
          hwndChild = FindWindowEx(MDI(), hwndChild, "AOL Child", 0);
     while (hwndChild);
     return hwndChild;
HWND ListBox()
    HWND listbox;
    listbox = FindWindowEx(FindChat(),0,"_AOL_Listbox",0);
    return listbox;
Question by:crims
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
LVL 11

Accepted Solution

Jase-Coder earned 750 total points
ID: 16892486
where is hProcess defined and is the process(hProcess) created using PROCESS_VM_READ?

Author Comment

ID: 16899212
Wouldn't the handle be the OpenProc variable?

    [in] A handle to the process with memory that is being read. The handle must have PROCESS_VM_READ access to the process.
LVL 11

Expert Comment

ID: 16899985
thats correct:

    HANDLE OpenProc;
    OpenProc = OpenProcess(PROCESS_VM_READ,FALSE,ProcessID);


Author Comment

ID: 16917397
I don't understand the second parameter, of this function, it says a "base address" a base address to the handle, to the item to what??????? i don't get it. I tried everything i can think of.

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question