cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
gomochainstall
Level 6

Write multiple properties into registry at once

All,

The flow of my current Basic MSI setup is as follows:

1. Create a custom action 'MakePropertiesAvailableForRegistryInsertX'

2. Create a custom action 'CallInstallScriptThatInsertsProperty'

3. The InstallScript has the following:

 

 

 

 

export prototype CreateProcessInParallelRegistryKeyAndSetValue(HWND);

function CreateProcessInParallelRegistryKeyAndSetValue(hMSI)

    STRING szKey, szNumName, szNumValue, svNumValue, szTitle, szMsg;

    NUMBER nType, nSize, nvType, nvSize;

begin

    szKey = "Gomocha";
    // Create "Gomocha" registry key in HKEY_CLASSES_ROOT

    if (RegDBCreateKeyEx (szKey, "") < 0) then

        MessageBox ("Creating the registry key failed.", SEVERE);

        abort;

    endif;
    
	
	nvSize = MAX_PATH;
	
	MsiGetProperty(hMSI, "CustomActionData", szNumValue, nvSize);

    szNumName  = "ProcessInParallel";

    nType      = REGDB_STRING;

    nSize      = -1;


	RegDBSetKeyValueEx (szKey, szNumName, nType, szNumValue, nSize);

end;

 

 

For each property that I want in the registry, I follow the above 3 steps, which can get ugly when I have 20+ properties that I would like to set. 

What I would like is the following:

Insert a property into registry at Gomocha\ComponentName\Property1

Insert a property into registry at Gomocha\ComponentName\Property2

I tried adding multiple properties into the installscript by passing in the following into the 'MakePropertiesAvailable' custom action: [PROPERTY1];[PROPERTY2];[PROPERTY3];

But that resulted in szNumValue to be showing up empty in the messagebox:

 

export prototype CreateGatewayFileAdapterRegistryKeyAndSetValue(HWND);

function CreateGatewayFileAdapterRegistryKeyAndSetValue(hMSI)

    STRING szKey, szNumName, szNumValue, svNumValue, szTitle, szMsg;

    NUMBER nType, nSize, nvType, nvSize;

begin

    szKey = "Gomocha";
    // Create "Gomocha" registry key in HKEY_CLASSES_ROOT

    if (RegDBCreateKeyEx (szKey, "") < 0) then

        MessageBox ("Creating the registry key failed.", SEVERE);

        abort;

    endif;
    
	
	nvSize = MAX_PATH;
	
	MsiGetProperty(hMSI, "CustomActionData", szNumValue, nvSize);
	MessageBox ("CustomActionData" + szNumValue, SEVERE);

    szNumName  = "XSLTPath";

    nType      = REGDB_STRING;

    nSize      = -1;

	RegDBSetKeyValueEx (szKey, szNumName, nType, szNumValue, nSize);
	
	
    szNumName  = "ExportedPath";

	RegDBSetKeyValueEx (szKey, szNumName, nType, szNumValue[1], nSize);
	

    szNumName  = "SortImportFilesByFileName";

	RegDBSetKeyValueEx (szKey, szNumName, nType, szNumValue[2], nSize);
	

    szNumName  = "ProcessInParallel";

	RegDBSetKeyValueEx (szKey, szNumName, nType, szNumValue[3], nSize);

end;

 

 

 

 

I probably have to split the szNumValue into a list using StrGetTokens? Could someone provide an example? 

 

Is there a better way to "debug" installscript? Instead of adding the MessageBox(szNumValue, SEVERE)?

Labels (1)
0 Kudos
(0) Replies