PDA

View Full Version : Retrieve Computername



alex42
10-02-2003, 08:40 AM
How can one retrieve the Computername in InstallScript only projects? I used to do that with MsiGetProperty(), which doesn't work anymore, obviously.

Is there a property? Does anyone know of a registry key?

dbriggs
10-02-2003, 12:38 PM
There is a method in KERNEL32.DLL:-

prototype KERNEL32.GetComputerName (BYREF STRING, BYREF LONG);

This function returns a non-zero/TRUE result if is succeeded or zero/FALSE if it failed. The BYREF LONG tells Windows how long the BYREF STRING buffer is. It needs to be at least 16 characters long, possibly more.

Hope that helps,

David

alex42
10-03-2003, 03:54 AM
thanks, dbriggs, it sure helps...

I found a registry key, also:
HKEY_LOCAL_MACHINE
SYSTEM\\CurrentControlSet\\Control\\ComputerName\\ActiveComputerName

but I'll change it to use the kernel32 method, me thinks.....