BFG asked me to put armadillo in my game code... but I wasn't able to. Anyone here used it? How can I "Call IncrementCounter() from ArmAccess.dll " (that's what they asked me) ? since he said that 14 other programmer had no problem doing it in 10 minutes, maybe someone of them is a member of this forums and can help me...I'm just a beginner C programmer after all...
I'm not much a system programmer, myself, but I managed to incorporate Armadillo into my Virtools-based project last year. I wrapped both the code install function and increment count function (I triggered this every minute--basically change a 60-use trial into a 60-minute trial...probably what Paul wants you to do). I honestly can't remember what else what needed, in terms of .DLL/LIB files for compilation. Armadillo intercepts the DLL loading call unless you rename ArmAccess.DLL. I'm sure someone here has a much more solid understanding of it than I do. Anyway, here's the code: Code: /* armadillo stuff start */ // These typedefs show the compiler the formats of the functions typedef bool (__stdcall *CheckCodeFn)(const char *name, const char *code); typedef bool (__stdcall *VerifyKeyFn)(const char *name, const char *code); typedef bool (__stdcall *InstallKeyFn)(const char *name, const char *code); typedef bool (__stdcall *InstallKeyLaterFn)(const char *name, const char *code); typedef bool (__stdcall *UninstallKeyFn)(void); typedef bool (__stdcall *SetDefaultKeyFn)(void); typedef bool (__stdcall *UpdateEnvironmentFn)(void); typedef bool (__stdcall *IncrementCounterFn)(void); typedef int (__stdcall *CopiesRunningFn)(void); typedef bool (__stdcall *ChangeHardwareLockFn)(void); typedef DWORD (__stdcall *GetShellProcessIDFn)(void); typedef bool (__stdcall *FixClockFn)(const char *fixclockkey); typedef DWORD (__stdcall *RawFingerprintInfoFn)(DWORD item); typedef bool (__stdcall *SetUserStringFn)(int which, const char *string); typedef DWORD (__stdcall *GetUserStringFn)(int which, char *buffer, DWORD bufferlength); bool InstallArmadilloCode(const char *name, const char *codestring) { bool returnvalue=false; /* Change "ArmAccess.DLL" to whatever you renamed it to */ HINSTANCE libInst=LoadLibrary("ArmAccess.DLL"); if (!libInst) return false; /* Couldn't load library */ /* Substitute the typedefs above for functions other than CheckCode */ CheckCodeFn CheckCode=(CheckCodeFn)GetProcAddress(libInst, "CheckCode"); if (CheckCode==0) return false; /* Couldn't find function */ returnvalue=CheckCode(name, codestring); FreeLibrary(libInst); return returnvalue; }; bool IncrementArmadilloCounter(void) { bool returnvalue=false; /* Change "ArmAccess.DLL" to whatever you renamed it to */ HINSTANCE libInst=LoadLibrary("ArmAccess.DLL"); if (!libInst) return false; /* Couldn't load library */ /* Substitute the typedefs above for functions other than CheckCode */ IncrementCounterFn IncrementCounter=(IncrementCounterFn)GetProcAddress(libInst, "IncrementCounter"); if (IncrementCounter==0) return false; /* Couldn't find function */ returnvalue=IncrementCounter(); FreeLibrary(libInst); return returnvalue; }; /* armadillo stuff end */
I was about to post some code but Matthew's looks similar to mine. We do the exact same thing: increment the usage counter every 60 seconds to simulate a timed demo (works great too!)
Thanks Seems that worked, since don't have armadillo I guess I'll send the new version to them hoping that works at least it does compile without problems!
Jack, I just added Armadillo/SoftwarePassport for a game for BigFish a few days ago. The standalone .dll they send really isn't enough info.. If you download the real SDK it has an API help file showing how to add it in different languages as well as the wrapper utility so you can test out the time limit yourself. Click download from here: http://siliconrealms.com/armadillo.shtml - it asks for info but sends you a link to download right away: Also, after each increment I check to see if it's expired and quit if it is, seemed like it needed this on my tests.
Ha yes, infact right now I only increase that mysterious counter without any way to know if it is expired or not Would you mind sending me (even privately in an email to info@studio4.com)the piece of code that check for expiration? thanks in advance ...so seems that wasn't so easy (10 minutes to implement? hmm)
Here... Code: #include <windows.h> typedef DWORD (__stdcall *GetUserStringFn)(int which, char *buffer, DWORD bufferlength); bool ARM_IsDemo() { #ifdef _DEBUG return (true); #endif char str[256]; if (!GetEnvironmentVariable("CRTTYPE", str, 255)) return (false); strupr(str); if (strcmp(str, "CRTTRIAL")==0) return (true); else return (false); } bool ARM_IsExpired() { if (GetEnvironmentVariable("EXPIRED", NULL, 0)) return (true); else return (false); } int ARM_GetCounterCurrent() { char value[256]=""; int retVal; if (!GetEnvironmentVariable("USESLEFT", value, 255)) return (0); else { // g_pLogFile->Infof("GetEnv(USESLEFT)=%s\n", value ); sscanf(value, "%i", &retVal); // g_pLogFile->Infof("GetEnv(USESLEFT) parsed=%i\n", retVal ); return(retVal); } } typedef bool (__stdcall *IncrementCounterFn)(void); void ARM_IncCounter() { /* Change "ArmAccess.DLL" to whatever you renamed it to */ HINSTANCE libInst=LoadLibrary("ArmAccess.DLL"); if (!libInst) return; /* Couldn't load library */ /* Substitute the typedefs above for functions other than CheckCode */ IncrementCounterFn IncrementCounter=(IncrementCounterFn)GetProcAddress(libInst, "IncrementCounter"); if (IncrementCounter==0) { return; /* Couldn't find function */ FreeLibrary(libInst); } IncrementCounter(); FreeLibrary(libInst); } BTW, we are the ones who told BFG about this "trick", but they didn't have the Pro version of Armadillo at that time, so we had to go with the sucky 3 uses expiration. *grumble*