A replacement for SdRegisterUserEx that validates the serial number.  The
parameters are identical to the orginal function.  If you do nothing special 
it will act just like the original dialog box.  If you wish dynamic serial 
number validation, however, you must follow these steps:

1. Provide a function which validates the serial number string.  In C/C++ 
   code, the string is passed as "const char*".  If it's contained in a DLL,
   it should be dropped into your Setup files.  In my configuration it's in 
   "Setup Files, Language Independent, Windows 95 & NT 3.51/4.0".

1. If your validation function is in a DLL, define VALIDATE_DLL to the name 
   of the DLL:

		  #define VALIDATE_DLL "validate.dll"

   DLG_INIT will execute UseDLL and DLG_CLOSE will handle UnUseDLL.

2. Prototype your validation function:

		// a dll function
		prototype int validate.ValidateThis(STRING);

		/// an IS function
		prototype ValidateThis(STRING);

3. Define ValidateSerialNumber to the function which validates the serial 
   number (the one you prototyped). e.g.,

		 #define ValidateSerialNumber ValidateThis

   It's done this way so you can give the function a name that does
   not reveal it's purpse.

4. Include validate.h at the beginning and validate.rul at the end
   of setup.rul.

5. Call MyRegisterUserEx instead of SdRegisterUserEx.  This call is
   typically found in DialogShowSdRegisterUserEx.

			-----+-----+-----+-----

Example validation function.  This routine is extremely simple
and is only meant as an example.

// sums the numerical digits and returns the total modulas 2
// e.g. "23" returns 1, while "33" returns 0.  Non-numerical
// characters are ignored

#include <windows.h>
extern "C" _declspec (dllexport)
int ValidateThis(const char * szSerial)
{
	unsigned int i;
	int sum = 0;
	for (i=0;i<strlen(szSerial);i++)
	{
		if (isdigit(szSerial[i]))
			sum += (szSerial[i]);
	}
	return sum % 2;
}

Your validation function should return the following:

	< 0, internal fatal error (will terminate the installation)
	= 0, invalid or incomplete serial number
	> 1, good serial number

The NEXT button will be enabled when all of the following conditions are true:

	1. Name not empty (spaces stripped)
	2. Company not empty (spaces stripped)
	3. your validation function returns > 0.

Otherwise the NEXT button will be disabled.  The code returned by your validate 
function is saved in nvValidationCode.  You could use different positive numbers
to indicate different validation levels such Professional and Student versions.

If you wish to allow empty strings for the User name or Company you
will need to modify MyRegExEnableButton.
