help with getmodulehandle

I need help adding an address to GetModuleHandle. I'm using GetModuleHandle to get the module address of the exe because the module address changes every time I launch the application.

 
  *(INT8*)GetModuleHandle("application.exe"+0x500) = 5;


When I use this code, I get 2 errors:
argument of type "System::String ^ is incompatible with parameter of type "LPCSTR"
C2664 'HMODULE GetModuleHandleA(LPCSTR)': cannot convert argument 1 from 'System::String ^ to 'LPCSTR'
When I use this code:
 
  *(INT8*)GetModuleHandle("application.exe") = 5;

changing the GetModuleHandle value to 5 works fine.
I need help adding 0x500 to GetModuleHandle.
Last edited on
closed account (E0p9LyTq)
get the module address of the exe


Simply use GetModuleHandle().
https://msdn.microsoft.com/en-us/library/windows/desktop/ms683199(v=vs.85).aspx

If this parameter is NULL, GetModuleHandle returns a handle to the file used to create the calling process (.exe file).


What are you going to do with the returned value? You are not assigning it to a variable or using it as a parameter in another function, you are simply throwing that value away as soon as you retrieve it. Trying to add any value to to the returned handle as you've written it won't work.
i found a video that can help me
http://m.youtube.com/watch?v=imgEgeoYWr8
thanks for the help anyway
this is what i did to fix my code
 
*(INT8*)((DWORD)GetModuleHandle(L"application.exe) + 0x500) = 5; 
Topic archived. No new replies allowed.