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*