У меня есть пара проблем с InstallScript, которые я не могу понять. Основной из них заключается в том, что мне нужно добавить в файл machine.config следующее:
<system.transactions>
<machineSettings maxTimeout="02:00:00" />
</system.transactions>
но он добавляет его как таковой:
<system.transactions>
<machineSettings>
<maxTimeout>"02:00:00"</maxTimeout>
</machineSettings>
</system.transactions>
Вот код, который я использую для обновления файла (окна сообщений предназначены для целей отладки).
function STRING GetMachineConfigPath(hMSI)
STRING strRetVal;
NUMBER nSize, nType;
begin
nSize = MAX_PATH - 1;
MsiGetProperty(ISMSI_HANDLE, "MACHINECONFIGPATH", strRetVal, nSize);
return strRetVal;
end;
function SaveMachineConfigSettings(hMSI)
OBJECT oDoc; // XML Document object
OBJECT oNode; // A node in the XML DOM tree
OBJECT CurrParent; // Current parent node
STRING szFilename;
BOOL successfulLoad;
begin
szFilename = GetMachineConfigPath(hMSI) + "config\\machine.config";
if Is(FILE_EXISTS, szFilename) = FALSE then
MessageBox("Could not find machine.config file.", 0);
return -1;
endif;
set oDoc = CreateObject("Msxml2.DOMDocument");
if (IsObject(oDoc) = FALSE) then
MessageBox("Could not open machine.config file.", 0);
return -1;
endif;
oDoc.Async = FALSE;
oDoc.setProperty("SelectionLanguage", "XPath");
successfulLoad = oDoc.load(szFilename);
MessageBox("File loaded successfully.", 0);
if (successfulLoad = FALSE) then
MessageBox("File did not load successfully.", 0);
return -1;
endif;
set CurrParent = oDoc.documentElement;
set oNode = AddSetting(oDoc, CurrParent, "system.transactions", "");
set CurrParent = oNode;
set oNode = AddSetting(oDoc, CurrParent, "machineSettings", "");
set CurrParent = oNode;
set oNode = AddSetting(oDoc, CurrParent, "maxTimeout", '"02:00:00"');
// Write the XML document to a file.
oDoc.save(szFilename);
MessageBox("File updated successfully.", 0);
set oNode = NOTHING;
set oDoc = NOTHING;
return 0;
end;
function OBJECT AddSetting(oDoc, oParent, szNodeName, szValue)
OBJECT oNode;
begin
// Add a carriage return & line feed to make the output easier to read.
set oNode = oDoc.createTextNode("\n");
oParent.appendChild(oNode);
// Create the new setting node and value.
set oNode = oDoc.createElement(szNodeName);
oNode.text = szValue;
oParent.appendChild(oNode);
MessageBox("Node created successfully.", 0);
return oNode;
end;
Любая помощь, которую вы могли бы предоставить, очень ценится!