Identity DLL routines

If you want the user to provide some kind of identification (indicate this on the Identity page), that information will need to be processed. You will need to create a DLL for this. Specify the DLL you want to use as the support DLL on the Project page. The support DLL can also provide other functionality besides managing the user's identity information.

The DLL must export the following four routines. Your DLL can export either the Ansi or the Unicode versions.

Pascal syntax (Ansi):

procedure InitIdentity(CompanyName, AppName, AppVersion: PAnsiChar); stdcall;
function ValidIdentity(Name, Company, Serial, RegCode: PAnsiChar): Bool; stdcall;
procedure LoadIdentity(Name, Company, Serial, RegCode: PAnsiChar); stdcall;
procedure SaveIdentity(Name, Company, Serial, RegCode: PAnsiChar); stdcall;

Pascal syntax (Unicode):

procedure InitIdentityW(CompanyName, AppName, AppVersion: PWideChar); stdcall;
function ValidIdentityW(Name, Company, Serial, RegCode: PWideChar): Bool; stdcall;
procedure LoadIdentityW(Name, Company, Serial, RegCode: PWideChar); stdcall;
procedure SaveIdentityW(Name, Company, Serial, RegCode: PWideChar); stdcall;

C syntax (append W to the function names when UNICODE is defined):

void __stdcall InitIdentity(LPCTSTR CompanyName, LPCTSTR AppName, LPCTSTR AppVersion);
BOOL __stdcall ValidIdentity(LPTSTR Name, LPTSTR Company, LPTSTR Serial, LPTSTR RegCode);
void __stdcall LoadIdentity(LPTSTR Name, LPTSTR Company, LPTSTR Serial, LPTSTR RegCode);
void __stdcall SaveIdentity(LPCTSTR Name, LPCTSTR Company, LPCTSTR Serial, LPCTSTR);

InitIdentity() is called right after the DLL is loaded. This allows the DLL to initialize itself, based on which application is being installed. The sample DLL will open the key HKEY_CURRENT_USER\Software\CompanyName\AppName in the Windows registry, where it will store the identity information. The parameters point to stings containing the information you specified on the Project page.
Note that CompanyName and AppVersion may be NULL, as these are not required fields. The sample DLL will open HKEY_CURRENT_USER\Software\AppName if no company name was specified.

LoadIdentity() is called right after InitIdentity() is called. If (another version of) the application is already installed, the DLL should be nice to the user and present the data entered when the previous install was done. Otherwise, the DLL has a chance to provide default data. If your setup tool asks for a registration code, the default would be a code that enables a 30-day trail mode of your application.
The sample DLL will try to load any previously written data from the registry and will return empty strings if no previous data exists.
If the user is not being requested to enter a certain piece of information, the corresponding argument will be NULL. It should remain untouched.
The other arguments will each be pointing to a character array that is 128 bytes in size. The function should write its data into these arrays. Mind the zero termination character, so the maximum string length is 127 characters. That should be enough.

ValidIdentity() is called when the user clicks on the Proceed button. It should return True if the entered information is valid, False otherwise. When True is returned, the installation will proceed. In the other case, nothing will happen. Since the user may be puzzled why her information is not being accepted, you may want to show up a message box in ValidIdentity() to inform the user about the reason why the installation is not proceeding.
The arguments are the same as for LoadIdentity(). Any changes made to them by ValidIdentity() will cause the edit fields in the setup application to be updated. You might want to erase an invalid registration code, to hamper guesswork.
The sample DLL accepts any information entered.

SaveIdentity() is called after ValidIdentity() has returned True. It should save the data somewhere so that it can be loaded by the application after it is installed and run. Right after this call, the DLL will be unloaded.
The arguments are again the same. There is no need for SaveIdentity() to modify them, as DeployMaster will dispose the strings right after the call returns.
The sample DLL writes the information to the Windows registry, under the key opened in InitIdentity(). The key is then closed.

Note: You should not rely on your Identity DLL as the only security measure against illegal use of your software. DeployMaster is designed to be a tool for creating nice and convenient installation programs, not as a security tool. Asking for identity information in the installation program, is nice and convenient for legitimate users. However, the actual security measures should be embedded into the actual software. So the DLL should do some basic validation to reject typing errors by legitimate users and store the data, so the installed application can do the real checking.