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

MsiProcessMessage always returns -1


8 replies to this topic

Barbara

Barbara
  • Members
  • 89 posts

Posted 16 October 2001 - 09:15

I am trying to write to the Windows Installer Log file using the MsipProcessMessage function called from an InstallScript custom action. I used the example from this site, but it seems I cannot get it to work. The function MsiProcessMessage always returns -1 and nothing is written to the log file. I am using an immediate custom action, directly after SetupInitialization in the user sequence. Any idea what  I am missing ?

Thank You

Barbara


Ian Blake

Ian Blake
  • Members
  • 483 posts

Posted 16 October 2001 - 12:57

-1 = Invalid handle or paramater.

What are you passing in?


Barbara

Barbara
  • Members
  • 89 posts

Posted 16 October 2001 - 13:35

First I create a handle and then pass this handle together with the debug string to the function:

hRec = MsiCreateRecord(1);  
nResult = MsiRecordSetString(hRec, 1, szMessage);        
nResult = MsiRecordSetString(hRec, 0, "[1]");
lCount = StrLength(szMessage);
nResult = MsiFormatRecord(hInstall, hRec, szOutput, lCount);
nResult = MsiProcessMessage(hInstall,INSTALLMESSAGE_INFO, hRec);

All functions are returning a correct value except the MsiProcessMessage. Maybe it is important, I am using Developer 7.
Barbara


Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 16 October 2001 - 14:47

Where do you obtain the handle? I think there's a problem in ISD with the install handle.

Barbara

Barbara
  • Members
  • 89 posts

Posted 17 October 2001 - 08:44

The handle top the installation (hInstall) is passed from the calling function.
function WriteLog(hInstall) -> obtains the handle
In this function the message is written and together with the handle passsed to the second function, which calls MsiProcessMessage.
But it makes no difference if I call MsiProcessMessage in the first function.

Barbara


Ian Blake

Ian Blake
  • Members
  • 483 posts

Posted 17 October 2001 - 09:06


hRec = MsiCreateRecord(1);  
nResult = MsiRecordSetString(hRec, 1, szMessage);        
nResult = MsiRecordSetString(hRec, 0, "[1]";

You are creating a record of  one field then trying to define 2 fields. The second field could not be created.
When MsiProcessMessage is called it needs the second string because you asked for it in the first.



Barbara

Barbara
  • Members
  • 89 posts

Posted 18 October 2001 - 10:47

I changed the function to create two record fields -> nothing changed, MsiProcessMessage constantly returns -1

Barbara


Donald Bristol

Donald Bristol
  • Members
  • 35 posts

Posted 18 October 2001 - 17:15

Ian,
I'm trying to do the same thing, however my return value = 0 when it gets to this line of code:
nResult = MsiProcessMessage(hInstall,INSTALLMESSAGE_INFO, hRec);

I know that this return code means no action was taken.  The code then hangs from there.  
If you could offer any assistance, please do.

hRec = MsiCreateRecord(1);  
nResult = MsiRecordSetString(hRec, 1, szMessage);        
nResult = MsiRecordSetString(hRec, 0, "[1]");
lCount = StrLength(szMessage);
nResult = MsiFormatRecord(hInstall, hRec, szOutput, lCount);
nResult = MsiProcessMessage(hInstall,INSTALLMESSAGE_INFO, hRec);