Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Writing Error message to WindowsInstaller Log


1 reply to this topic

venkateshwar_InstallShiled

venkateshwar_InstallShiled
  • Full Members
  • 21 posts

Posted 08 December 2007 - 08:09

Hi,
Iam using the following function to write the error message into the WindowsInstaller log. But I couldn't trace out the correct error message in the windows installer log.

function BOOL LogMessage(hMSI, szMessage)
....
nNumberOfFields = 1;
hRecord = MsiCreateRecord(nNumberOfFields);
if (hRecord != 0) then
nFieldIndex = 0;
if (MsiRecordSetString(hRecord, nFieldIndex, szMessage) = ERROR_SUCCESS) then
nReturnValue = MsiProcessMessage(hMSI, INSTALLMESSAGE_INFO, hRecord);
if (nReturnValue = IDOK) then
bMessageLogged = TRUE;
end;

The Real scenario is, Im using some validation functions in my script. As the concerned function execution fails(just like invalid serial number) then the above mentioned LogMessage function invokes and the error result will displays in the windows installer log.

Can any body trace out my code and suggest me where I went I went wrong. or Is there any other way to generate

Zweitze

Zweitze
  • Full Members
  • 522 posts

Posted 10 December 2007 - 00:08

From the top of my head:
CODE
hRecord = MsiCreateRecord(1);
MsiRecordSetString(hRecord, 0, "[1]");
MsiRecordSetString(hRecord, 1, szMessage);
MsiProcessMessage(hMSI, INSTALLMESSAGE_INFO, hRecord);
MsiCloseHandle(hRecord);

Note: include error handling on all statements.

Edited by Zweitze, 10 December 2007 - 00:09.