Unexpiring Plugin??

Status
Not open for further replies.

Boogadoog

Lifetime Member
Joined
Feb 2, 2006
Messages
46
Reaction score
0
Points
6
So how is it that a plugin can be unexpiring? When I do my own compiles I have to compile the plugin with the source code. But I have purchased a plugin from another source that i can add in with any compile. Any clues? PM me if it's some big secret and i'm allowed ;)
 
Boogadoog said:
So how is it that a plugin can be unexpiring? When I do my own compiles I have to compile the plugin with the source code. But I have purchased a plugin from another source that i can add in with any compile. Any clues? PM me if it's some big secret and i'm allowed ;)

Check the date of the plugin. In the virgin MQ2 code, it compares the date of the plugin against the date of MQ2Main. If MQ2Main is a later date, it won't load the plugin.. If someone, say, changed their date to 2007, compiled their plugin, then changed their date back and compiled everything else. That plugin would work with any compile up to that date. Granted, that's also assuming nothing else has changed in that plugin that would need updating.
 
So in otherwords it would need to actively seek new offsets in some cases to work too? Besides just the backstamping of the date.
 
If the plugin used offsets, structures, opcodes, detours, etc, it may need to be updated. There's alot of plugins that haven't changed in months, but needed to be recompiled to bypass the date check. Older version of our compile bypassed the date check, but that's the one thing I couldn't get around without modifying the main MQ2 source code. If you compile the rest of the source code yourself, you can set your date back a few months, compile MQ2Main, then set your date back to current and the compile everything else. You can also look at the "Making a Clean Compile" post about how to bypass the timestamp before you compile it.
 
something like this should work for ya Psycotic..

Code:
DWORD ADDR_CheckMe = (DWORD)GetProcAddress(ghModule, "checkme");

class CheckMeDetour {
public:
        DWORD CheckMe_Tramp(char *);
        DWORD CheckMe_Detour(char *module)
        {
               if (!stricmp((char*)GetModuleHandle("mq2main.dll"), module))
               {
                      return 1;
               } else {
                      return CheckMe_Tramp(module);
               }
       }
};

Just in theory untested of course...

Basically this should always set the mq2mainstamp to equal 1 and always past the timestamp check
 
I didn't even think about detouring checkme, I was trying to detour the whole LoadMQ2Plugin. The problem I ran into is the order of loading. The plugin with the detour would have to be loaded before anything else, and it would also have to have a datestamp higher than MQ2Main. I think the checkme detour will be a nice addition though so any thing older (as long as they load MQ2MMOBugsTools first) will work.
 
Galuvwen said:
something like this should work for ya Psycotic..

Code:
DWORD ADDR_CheckMe = (DWORD)GetProcAddress(ghModule, "checkme");

class CheckMeDetour {
public:
        DWORD CheckMe_Tramp(char *);
        DWORD CheckMe_Detour(char *module)
        {
               if (!stricmp((char*)GetModuleHandle("mq2main.dll"), module))
               {
                      return 1;
               } else {
                      return CheckMe_Tramp(module);
               }
       }
};

Just in theory untested of course...

Basically this should always set the mq2mainstamp to equal 1 and always past the timestamp check

I tried this using a class function (as above) and using just a normal function like the PluginCmdSort detour, and both CTD when entering the game. :( I'll keep playing with it tonight. I'd love to get this fixed.
 
Hmm.. For some reason, it's not pulling the address from the function "checkme".

Doing:
Code:
WriteChatf("checkme addr:%x",(DWORD)GetProcAddress(ghModule, "checkme"));
WriteChatf("dataString addr: %x",(DWORD)GetProcAddress(ghModule, "dataString")); 
WriteChatf("PluginCmdSort addr: %x",(DWORD)GetProcAddress(ghModule, "PluginCmdSort"));

Reports the address for PluginCmdSort, and dataString, but checkme comes back as 0..
 
It's not being exported.
You can make it do it. Not gonna work like you think though. ;-)
 
Put this in and play with it a bit, see what you get for various exported functions.

Code:
typedef UINT (CALLBACK* LPFNDLLFUNC1)(DWORD,UINT);

LPFNDLLFUNC1 GetFuncAddr(char *ModuleName, char *FunctionName) 
{ 
   LPFNDLLFUNC1 Func_Addr;
   if(ModuleName == NULL || FunctionName == NULL) {
       DebugSpewAlways("GetFuncAddr: ModuleName or FunctionName is NULL.");
       return NULL;
   }
   HMODULE hModuleHandle = GetModuleHandle(ModuleName);
   if (hModuleHandle == NULL) {
       DebugSpewAlways("GetFuncAddr: Can't get module handle (%s).", ModuleName);
       return NULL;
   }
   Func_Addr = (LPFNDLLFUNC1)GetProcAddress(hModuleHandle, FunctionName);
   if (!Func_Addr) {
       DebugSpewAlways("GetFuncAddr: Can't get Function Address (%s:%s).", ModuleName, FunctionName);
       return NULL;
   }
   DebugSpewAlways("GetFuncAddr: Returning address for %s (%s): 0x%x.", FunctionName, ModuleName, Func_Addr);
   return Func_Addr;
}

You might put this in MQ2Main\eqgame-private.h:

Code:
extern "C" __declspec(dllexport) DWORD checkme(char *);
 
Status
Not open for further replies.