unknown1 Posted October 25, 2011 Share Posted October 25, 2011 I wanted to see if someone could help me understand the following code and what I have to do to get it to work... like what header files you need and should somthing like this be an injected dll or can it be ran in a console app... also how to get a offset from a base/function address. I know it's base address - function address but when the address is like Base : 0x52290000 || Address : 0x5234CBC0 || Offset : 0xBCBC0 I dont understand how you get 0xBCBC0 as the offset. Thanks in advance!! DWORD dwEngine = (DWORD)GetModuleHandle( "engine.dll" ); DWORD dwClientInit = dwFindPattern( dwEngine, dwClientDLL_Size, reinterpret_cast<PBYTE>(szClientDLL_Sig), szClientDLL_Mask ); LogMessage( "Base: 0x%X || Address: 0x%X || Offset: 0x%X", dwEngine, dwClientInit, dwClientInit - dwEngine ); Quote Link to comment https://forums.phpfreaks.com/topic/249810-c-help/ Share on other sites More sharing options...
unknown1 Posted October 25, 2011 Author Share Posted October 25, 2011 To be clear I do understand that DWORD dwEngine = (DWORD)GetModuleHandle( "engine.dll" ); gets the base address of engine.dll and that dwFindPattern(); is to find the pattern to get the function address and that LogMessage( "Base: 0x%X || Address: 0x%X || Offset: 0x%X", dwEngine, dwClientInit, dwClientInit - dwEngine ); is giving me a message showing me the base, address and finally the offset based on dwClientInit - dwEngine. but I don't understand how one would compiling it and make use of it and also how to do the calculation on getting the offset... Quote Link to comment https://forums.phpfreaks.com/topic/249810-c-help/#findComment-1282240 Share on other sites More sharing options...
requinix Posted October 25, 2011 Share Posted October 25, 2011 What do you mean you don't know how you get that offset? You just said you know it's base - function. Which it is. And compile what? Quote Link to comment https://forums.phpfreaks.com/topic/249810-c-help/#findComment-1282244 Share on other sites More sharing options...
unknown1 Posted October 25, 2011 Author Share Posted October 25, 2011 What do you mean you don't know how you get that offset? You just said you know it's base - function. Which it is. And compile what? base - function??? but I don't understand how to subtract 0x52290000 - 0x5234CBC0 to get 0xBCBC0 can you explain how that works?? Quote Link to comment https://forums.phpfreaks.com/topic/249810-c-help/#findComment-1282248 Share on other sites More sharing options...
requinix Posted October 25, 2011 Share Posted October 25, 2011 I was quoting you. You had the right idea but got the terms backwards. 0x5234CBC0 - 0x52290000 = 0x000BCBC0 But you already knew this. I know it's base address - function address To be clear I do understand... that LogMessage( "Base: 0x%X || Address: 0x%X || Offset: 0x%X", dwEngine, dwClientInit, dwClientInit - dwEngine ); is giving me a message showing me the base, address and finally the offset based on dwClientInit - dwEngine Quote Link to comment https://forums.phpfreaks.com/topic/249810-c-help/#findComment-1282249 Share on other sites More sharing options...
unknown1 Posted October 25, 2011 Author Share Posted October 25, 2011 yeah I understand how to should work but I don't understand the math i guess. how do you get the offest 0x52290000 - 0x5234CBC0 offest 0xBCBC0 0x52290000 0x5234CBC0 - ______________ 0xBCBC0 how does this work?? Quote Link to comment https://forums.phpfreaks.com/topic/249810-c-help/#findComment-1282250 Share on other sites More sharing options...
requinix Posted October 25, 2011 Share Posted October 25, 2011 Subtraction Oh. And Hexadecimal Quote Link to comment https://forums.phpfreaks.com/topic/249810-c-help/#findComment-1282251 Share on other sites More sharing options...
unknown1 Posted October 26, 2011 Author Share Posted October 26, 2011 Okay I get it now i think 0x5BD50000 0x5BF7F4DD - ___________ =0xD2F4DD is this correct?? now how do I make that code work?? show it be a dll file and be injected to work or can I make a console app?? Also how to I make this work?? dwFindPattern( dwEngine, dwClientDLL_Size, reinterpret_cast<PBYTE>(szClientDLL_Sig), szClientDLL_Mask ); Quote Link to comment https://forums.phpfreaks.com/topic/249810-c-help/#findComment-1282255 Share on other sites More sharing options...
requinix Posted October 26, 2011 Share Posted October 26, 2011 Okay I get it now i think 0x5BD50000 0x5BF7F4DD - ___________ =0xD2F4DD is this correct?? If you reversed the operands, yes. now how do I make that code work?? show it be a dll file and be injected to work or can I make a console app?? Also how to I make this work?? dwFindPattern( dwEngine, dwClientDLL_Size, reinterpret_cast(szClientDLL_Sig), szClientDLL_Mask ); I still don't know what you're trying to do. Make what work? What DLL file? Quote Link to comment https://forums.phpfreaks.com/topic/249810-c-help/#findComment-1282457 Share on other sites More sharing options...
unknown1 Posted October 26, 2011 Author Share Posted October 26, 2011 How do I make a program out of the following code. Also what headers are required to make it work.... Do I need to create a dll file and inject to make everything work or can I just run as a regular console app?? Just need someone to explain the code and how to use it.... DWORD dwEngine = (DWORD)GetModuleHandle( "engine.dll" ); DWORD dwClientInit = dwFindPattern( dwEngine, dwClientDLL_Size, reinterpret_cast<PBYTE>(szClientDLL_Sig), szClientDLL_Mask ); LogMessage( "Base: 0x%X || Address: 0x%X || Offset: 0x%X", dwEngine, dwClientInit, dwClientInit - dwEngine ); Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/249810-c-help/#findComment-1282483 Share on other sites More sharing options...
unknown1 Posted October 27, 2011 Author Share Posted October 27, 2011 How do I make a program out of the following code. Also what headers are required to make it work.... Do I need to create a dll file and inject to make everything work or can I just run as a regular console app?? Just need someone to explain the code and how to use it.... DWORD dwEngine = (DWORD)GetModuleHandle( "engine.dll" ); DWORD dwClientInit = dwFindPattern( dwEngine, dwClientDLL_Size, reinterpret_cast<PBYTE>(szClientDLL_Sig), szClientDLL_Mask ); LogMessage( "Base: 0x%X || Address: 0x%X || Offset: 0x%X", dwEngine, dwClientInit, dwClientInit - dwEngine ); If i compile it now it doesn't work so what do I need to do to make it functional???? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/249810-c-help/#findComment-1282549 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.