Is this Module Pointer function alright?

Posts 31–38 of 38 · Page 3 of 3
Thread can be closed, im giving up on this... Finding the error is pretty much pointless. It must be some random compiler error or something
Quote Originally Posted by derkrasseboy View Post
Thread can be closed, im giving up on this... Finding the error is pretty much pointless. It must be some random compiler error or something
No, do what i said, debug it correctly, it isn't a compiler issue.
Quote Originally Posted by WasserEsser View Post
No, do what i said, debug it correctly, it isn't a compiler issue.
I did debug it but whenever i enter the Module Function its not showing anything.. Its just always "Frame not in Module", looked that up on google just found some random posts about some debugging a Android app. I even did the solution of these things and the problem still persists. I really dont know what im suppose to do now. I just cant figure out what the problem is.
Quote Originally Posted by derkrasseboy View Post
I did debug it but whenever i enter the Module Function its not showing anything.. Its just always "Frame not in Module", looked that up on google just found some random posts about some debugging a Android app. I even did the solution of these things and the problem still persists. I really dont know what im suppose to do now. I just cant figure out what the problem is.
You are doing it wrong. You are supposed to set a breakpoint at the start of your function, then whenever the breakpoint hits, step through the code and take a look at the flow to see when it is returning, where it is returning and whatever is causing the issue here.

The error "Frame is not in Module" means that you're trying to debug code that you have no source available for the function that you're trying to step into. That for example can happen when you're trying to step through Process32First, just step over that function and see what it returned.
ahhh thanks dude now i can see how that whole thing works.. thats sick

well the stringcompare is alright i think because with each step over i get a new module. so i think that it just doesnt find "client.dll" so the comparision is always false and makes it return no value.

---------

EDIT: i figured out the problem. the convertion of mEntry.szModule to a string for stupid c++/cli is wrong. no matter what module it is its always "P&´r" which obviously never matches with "client.dll". So thats the actual problem not that it doenst list the client.dll module
Quote Originally Posted by derkrasseboy View Post
ahhh thanks dude now i can see how that whole thing works.. thats sick

well the stringcompare is alright i think because with each step over i get a new module. so i think that it just doesnt find "client.dll" so the comparision is always false and makes it return no value.
Log the modules it is comparing and list them here please.
Alright guys, i got my stuff working <3 So big thanks to @WasserEsser because of the awesome help and advice you gave me with debugging!

So what i did now is change the Module function to this:

Code:
DWORD Module(wchar_t* szModuleName)
	{
		HANDLE hModule = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, ProcessID);
		MODULEENTRY32 mEntry;
		mEntry.dwSize = sizeof(mEntry);

		if (Module32First(hModule, &mEntry))
		{
			do
			{
				if (!wcscmp(mEntry.szModule, szModuleName))
				{
					CloseHandle(hModule);
					return (DWORD)mEntry.modBaseAddr;
				}
			} while (Module32Next(hModule, &mEntry));
		}
		CloseHandle(hModule);
		return false;
	}
I pretty much just replaced the strcmp with wcscmp which makes it much easier for c++/cli, its not needed for normal c++!
Posts 31–38 of 38 · Page 3 of 3
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us