If you're looking for a easier programing language you may take a look at PureBasic.sfay wrote:Thought that might be the process, still have to learn C++.
Code: Select all
ProcedureDLL.l ValidateSerial_Sample(hInstall.l)
#PIDKEY_LENGTH = 256
szPidKey.s = Space(#PIDKEY_LENGTH)
dwLen = #PIDKEY_LENGTH
;// retrive the text entered by the user
res = MsiGetProperty_(hInstall, "PIDKEY", szPidKey, @dwLen)
If res <> #ERROR_SUCCESS
;// fail the installation
ProcedureReturn 1
EndIf
snIsValid = #False
;//validate the text from szPidKey according To your algorithm
;//put the result in snIsValid
*serialValid.STRING
If snIsValid
*serialValid = @"TRUE"
Else
;//eventually say something to the user
MessageBox_(0, "Invalid Serial Number", "Message", #MB_ICONSTOP)
*serialValid = @"FALSE"
EndIf
res = MsiSetProperty_(hInstall, "SERIAL_VALIDATION", *serialValid)
If res <> #ERROR_SUCCESS
ProcedureReturn 1
EndIf
;//the validation succeeded - even the serial is wrong
;//If the SERIAL_VALIDATION was set To FALSE the installation
;//will not continue
ProcedureReturn 0
EndProcedure