Problem with Getting a module name from a ME32 struct

Im trying to get a Module's name to compare to a string so i know when i have reached the one im looking for but when debugging using cout my output is

Output
1
2
3
4
5
M32.DLL
M32.DLL
M32.DLL
M32.DLL
etc...


Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
...
snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE,pid);
...

while(compare != "Game.dll"){
            cout << me32.szModule << endl;//Debug
            Module32Next(snapshot,&me32);
            compare = string(me32.szModule); //TCHAR to string for compare var
            if(GetLastError() == ERROR_NO_MORE_FILES){
                cout << "Game.dll Not Found" << endl;
                system("PAUSE");
                CloseHandle(hprocess);
                CloseHandle(snapshot);
                exit(1);
            }
        }

I have used this same code in another program and it worked just fine. The only thing that has changed is the process and name of the module i am looking for.

Also i checked, "M32.DLL" is not a module loaded in the process.
Last edited on
XCHYHFDU KI
Topic archived. No new replies allowed.