PDA

View Full Version : Serial Number validation and other custom action (Delphi)



leegrissom
02-02-2003, 02:27 PM
I have a DLL function that validates a Serial Number. Now, after the installation is completed successfully, I want to copy that serial number to an INI file in the installation directory. What's the best approach for that? My first attept was to call another custom DLL function after the setup progress has completed. The problem with that is that when I call msigetproperty(), it returns success, but the value I get is empty. So my question is two-fold. What am I doing wrong below, and what other option do I have for writing to the .ini file? Thanks.

(Delphi Syntax)
var
Buf: array[0..32] of Char;
size: Cardinal;
s: string;
begin
size := sizeof(Buf);
Result := MsiGetProperty(hInstall,'ProductID',Buf,size);
if Result = ERROR_SUCCESS then
begin
// program flow goes here, and Buf is ''.
MessageBox(GetFocus(),PChar(Buf),'', MB_SYSTEMMODAL);
end;
end;

Chandima
02-04-2003, 05:50 PM
Where do you do the serial number validation? Do you use the "Customer Information Dialog" (in Dialogs View) to prompt the user for the Serial Number? If so, at runtime, the value the user enters is stored in a property (or variable) named ISX_SERIALNUM. So in the Ini Files View (of Express) if you create a new keyword with a value of [ISX_SERIALNUM], whatever the user enters will get written here when the setup is complete.

leegrissom
02-04-2003, 08:51 PM
That might work. Is it also possible to do the same thing with the User name and Organization info too?

Aside from that, do you know if it's possible for me to query properties from the installation using MsiGetProperty? Do you know where I can get a list of properties? I tried looking in the MSI SDK help, but I didn't have much luck.

Thanks.

Chandima
02-05-2003, 05:10 PM
USERNAME and COMPANYNAME should give you the values the enter uses in the Customer Information dialog.

Yes, you can use MsiGetProperty to query properties at runtime. For a list of MSI properties, launch the MSI help, select "Properties" from the Index, and then select "Property reference" for a complete list.

wsteinford
12-17-2003, 12:49 PM
Ah!! ISX_SERIALNUM!!! That's what I've been looking for during the last 2 days (with no Internet access....) This property isn't documented anywhere, it seems.

Is there a way to programatically (in the custom action DLL) get a list of all the defined properties? (rather than guessing....)
Particularly since if I put all the Help file properties in to see their values, any that aren't defined just return blank ''..... It'd be nice during debugging to just dump all the known properties.