BigFish games wants to sell my game Xeno Assault but I have to use a wrapper program to put a 60 minute time limit on the game. For this I need to load a DLL, check for its existence and call a certain function within it every minute. I have done nothing with DLLs in blitz before - Is this even possible? If it is, how can it be done?
Here is the document they sent me - I know very little about C++ so I really don't know how this will work in Blitz:
Version with armodillo protection. You can easily
implement this 60 minute wrapper into your source code. We have done this
with many developers and will require 5 to 10 minutes of your time to
implement. The instructions to do this are as follows:
a) Call IncrementCounter() from ArmAccess.dll (attached to this email) once
every minute from the game itself.
b) If ArmAccess.dll does not exist the game should not start
c) Provide us with a full version with this new code in a zip file for us
to wrap
C++ code example
//In the main game procedure, on start-up
//*****************************************
//Declare the function
typedef bool (__stdcall *IncrementCounterFn)(void);
//Load the DLL
HINSTANCE libIncr=LoadLibrary("ArmAccess.DLL");
//Get the function's address
IncrementCounterFn IncrementCounterFunction=(IncrementCounterFn)GetProcAddress(libIncr, "IncrementCounter");
//In the threaded (per-minute) function
//**************************************
//Read the Environment_Variables ALTUSERNAME value to check if a valid license was installed
//Note: During the Trial time, the license's user name is DEFAULT. A valid license key has a user name value that is different than
DEFAULT
GetEnvironmentVariable("ALTUSERNAME", name, 255);
If (!memcmp("DEFAULT", name,7))
{
//exit the thread as a valid license key was installed
}
//Increment the per-minute counter by 1
ReturnValue=IncrementCounterFunction;
//Read the Environment_Variables EXPIRED value
GetEnvironmentVariable("EXPIRED", isExpired, 10);
//Check if the Trial license expired AND NO VALID KEY was installed
if(((memcmp("True",isExpired,4)) || (ReturnValue==0)))
{
//exit Game gracefully as the Trial license expired
}
//In the main game procedure, on exit
//**************************************
//Free the loaded library
FreeLibrary;
Thanks in advance, Neil
|