These CA are called through DoAction, in the msdn it is clearly stated that if MsiProcessMessage invoked through DoAction the function will not work. http://msdn.microsoft.com/en-us/library/aa368322(VS.85).aspx
I think the alternative approach is through automation function Session.Message that can be written in vbscript, If I am catching it right I think even the default ICE(s) in darice.cub might be using Session.Message for generating the log as I see there are some vbs file in addition to DLL in the binary table. Naga Ram M Chavakula | Project Manager O: 608.448.3116 |M: 0091.9885778079 | nagara...@symphony.cc Symphony Corporation | Hyderabad, A.P.India-500 082 | A SEI-CMMI Level 4 Company We synchronize business, technology and people -----Original Message----- From: Blair [mailto:os...@live.com] Sent: Tuesday, January 05, 2010 5:18 AM To: nagara...@symphony.cc; 'General discussion for Windows Installer XML toolset.'; 'Schrieken, Rene' Subject: RE: [WiX-users] writing to console from smoke.exe using customaction Tests in a .CUB are always run from a sequence table (similar to the UI sequence table, but the sequence table is named _ICESequence) and never as control events (there is no UI associated with ICE tests). Why is a control event even an issue? -----Original Message----- From: nagaram.c [mailto:nagara...@symphony.cc] Sent: Monday, January 04, 2010 10:39 PM To: 'Blair'; 'General discussion for Windows Installer XML toolset.'; 'Schrieken, Rene' Subject: RE: [WiX-users] writing to console from smoke.exe using customaction It looks like MsiProcessMessage works only in case if CA is called through UI Sequence, it returns 0 (No action was taken) while the CA is called through control event, below posting has similar issue http://www.mombu.com/microsoft/platform-sdk-msi/t-how-to-check-whether-a-ca- is-called-by-a-controlevent-320176.html An alternative is Session.Message but this I cannot use in C++ code - Nag -----Original Message----- From: Blair [mailto:os...@live.com] Sent: Monday, January 04, 2010 3:57 PM To: nagara...@symphony.cc; 'General discussion for Windows Installer XML toolset.'; 'Schrieken, Rene' Subject: RE: [WiX-users] writing to console from smoke.exe using customaction Something like this? int SendSampleICEMessage(void) { PMSIHANDLE hRecord = MsiCreateRecord(1); UINT error = MsiRecordSetString(hRecord, 0, "Name of ICE\tMessage Type\tDescription\tHelp URL or location\tTable Name\tColumn Name\tPrimary Key\tPrimary Key\tPrimary Key . . . (repeat for as many primary keys as needed)"); // first three tab-delimited fields are required. Primary Key are the values of the primary key columns in order. Most tables have only one. if (0 == error) { return MsiProcessMessage(hInstall, INSTALLMESSAGE_USER, hRecord); } return (int) error; } -----Original Message----- From: nagaram.c [mailto:nagara...@symphony.cc] Sent: Monday, January 04, 2010 5:20 AM To: 'Blair'; 'General discussion for Windows Installer XML toolset.'; 'Schrieken, Rene' Subject: RE: [WiX-users] writing to console from smoke.exe using customaction I tried this option but still the issue exist. - Nag -----Original Message----- From: Blair [mailto:os...@live.com] Sent: Monday, January 04, 2010 5:22 AM To: nagara...@symphony.cc; 'General discussion for Windows Installer XML toolset.'; 'Schrieken, Rene' Subject: RE: [WiX-users] writing to console from smoke.exe using customaction What is the "Windows Installer project workspace" you speak of? The custom action code itself isn't "marked" for one or the other. That marking is done by the type setting in the CustomAction table for the custom action (the "InScript" flag). There are differences in what code that is run as either deferred or immediate can do/access, but those are beside the point. My C++ custom actions that I put in my custom .CUB files are simply Win32 dlls written in C++ where all the entry points are all Windows Installer custom actions that are marked 'extern "C"' and are also listed in the .def file to prevent any form of compiler/linker decoration. -----Original Message----- From: nagaram.c [mailto:nagara...@symphony.cc] Sent: Sunday, January 03, 2010 10:08 PM To: 'Blair'; 'General discussion for Windows Installer XML toolset.'; 'Schrieken, Rene' Subject: RE: [WiX-users] writing to console from smoke.exe using customaction Thanks Blair, yes I have read it in MSDN, but the example code for such configuration uses Microsoft Installer project workspace in which there is a properties toolbar for selecting either immediate or differed modes for the selected CA, here in this case I created the CA DLL using VC++ project workspace, there is no documentation that suggests what compiler setting is needed for the custom action DLL to be run in immediate mode. Can you suggest? - Nag -----Original Message----- From: Blair [mailto:os...@live.com] Sent: Thursday, December 31, 2009 9:47 PM To: nagara...@symphony.cc; 'General discussion for Windows Installer XML toolset.'; 'Schrieken, Rene' Subject: RE: [WiX-users] writing to console from smoke.exe using customaction Custom Actions in CUB files are supposed to be immediate custom actions. Please read MSDN. Use MsiProcessMessage. -----Original Message----- From: nagaram.c [mailto:nagara...@symphony.cc] Sent: Thursday, December 31, 2009 3:33 AM To: 'Schrieken, Rene'; 'General discussion for Windows Installer XML toolset.' Subject: Re: [WiX-users] writing to console from smoke.exe using customaction With the below code WriteFile is returning false, GetLastError shows Handle is invalid Nag _____ From: Schrieken, Rene [mailto:rene.schrie...@logica.com] Sent: Tuesday, December 29, 2009 11:41 AM To: General discussion for Windows Installer XML toolset. Cc: nagara...@symphony.cc Subject: RE: [WiX-users] writing to console from smoke.exe using customaction Looking at your code and reading msdn WriteConsole(szBuffer); might fail. Something with ansi and widechar but this is really not my area of expertise. Can you try to see if this might work: (everybody else: HELP!) AttachConsole(...); HANDLE file; file = GetStdHandle(STD_OUTPUT_HANDLE); // check if you have something valid // you might need an if for non-redirected output? BOOL ok; ok = WriteFile(file, szBuffer, somesafelenfunc(szBuffer), &written, NULL); // check if true is returned FreeConsole(...); Please save everything before you try this... _____ Van: nagaram.c [mailto:nagara...@symphony.cc] Verzonden: di 29-12-2009 8:04 Aan: Schrieken, Rene; 'General discussion for Windows Installer XML toolset.'; 'General discussion for Windows Installer XML toolset.' Onderwerp: Re: [WiX-users] writing to console from smoke.exe using customaction Thanks for that, but it is only writing to file what ever is displayed in the command window through other ICE(s) (ICE1 - 1CE100) performed by darice.cub, but not those of my CA even through it can display in the command window Nag _____ From: Schrieken, Rene [mailto:rene.schrie...@logica.com] Sent: Thursday, December 24, 2009 10:46 AM To: nagara...@symphony.cc; General discussion for Windows Installer XML toolset.; General discussion for Windows Installer XML toolset. Subject: RE: [WiX-users] writing to console from smoke.exe using customaction smoke.exe - cub myCub.cub myMSI.msi >> smoke.log (use two >> to redirect output, that will open the file for append, instead of create) _____ Van: nagaram.c [mailto:nagara...@symphony.cc] Verzonden: do 24-12-2009 6:46 Aan: 'General discussion for Windows Installer XML toolset.'; 'Blair' Onderwerp: Re: [WiX-users] writing to console from smoke.exe using customaction I found a solution, the custom action DLL isn't writing to console unless I call AttachConsole as like below cpid = GetCurrentProcessId(); hWnd = FindWindowEx(NULL, NULL, _T("ConsoleWindowClass"), NULL); //this need not be the same console where the process is running at //need to fetch parent process id & check if they are same GetWindowThreadProcessId(hWnd, & ppid); cppid = GetParentPID(cpid); //user defined function to get the parent id if(cppid == ppid) //then this is the same console what we are looking for { AttachConsole(cppid); WriteConsole(szBuffer); FreeConsole(); } else { //continue with FindWindow till the right parent is identified } Also smoke isn't calling CA directly instead its validation engine invokes these CA through msiexec process, so GetParentPID has to get its 2 parents for to cmd.exe PID Now I need to redirect validation errors that are displayed in console to log file I know this could be done by using something like smoke.exe - cub myCub.cub myMSI.msi > smoke.log but every time I run the smoke the log file gets overwritten, is there a way that I can append to the existing log file. If I do create my own logging in the CA then this log contains only those logs generated by my CA which in case the other validations of ICEs (1-100) done by darice.cub will not be listed into my log file, so this is not the efficient solution. It would be much efficient if the log file generated by > switch in the command line could get appended every time the program is executed Nag -----Original Message----- From: nagaram.c [mailto:nagara...@symphony.cc] Sent: Tuesday, December 22, 2009 11:54 PM To: 'Blair'; 'General discussion for Windows Installer XML toolset.' Subject: Re: [WiX-users] writing to console from smoke.exe using customaction I already tried below solution but is not writing to console, I think MsiProcessMessage works only if the custom action is run through msiexec or if the CA is immediate mode, but where as I am running these CA through smoke utility & for the CA to be made immediate I will have to create the CA from using installer project work space. In some of samples I have seen it uses OutputDebugString for writing it to the console Naga Ram M Chavakula | Project Manager O: 608.448.3116 |M: 0091.9885778079 | nagara...@symphony.cc Symphony Corporation | Hyderabad, A.P.India-500 082 | A SEI-CMMI Level 4 Company We synchronize business, technology and people -----Original Message----- From: Blair [mailto:os...@live.com] Sent: Tuesday, December 22, 2009 7:35 AM To: nagara...@symphony.cc; 'General discussion for Windows Installer XML toolset.' Subject: RE: [WiX-users] writing to console from smoke.exe using custom action You need to use MsiProcessMessage with the INSTALLMESSAGE_USER type. See http://msdn.microsoft.com/library/aa369205.aspx for details. -----Original Message----- From: nagaram.c [mailto:nagara...@symphony.cc] Sent: Tuesday, December 22, 2009 5:13 AM To: wix-users@lists.sourceforge.net Subject: [WiX-users] writing to console from smoke.exe using custom action Hi, I wrote a custom action dll in C++ & added to .cub file that I am using in -cub switch in smoke.exe, I was not successful in writing to console like the ICE(s) in darice.cub does it but I am able to display the log info in MessageBox. Thanks, Nag ---------------------------------------------------------------------------- -- This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users ---------------------------------------------------------------------------- -- This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users ---------------------------------------------------------------------------- -- This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users Please help Logica to respect the environment by not printing this email / Pour contribuer comme Logica au respect de l'environnement, merci de ne pas imprimer ce mail / Bitte drucken Sie diese Nachricht nicht aus und helfen Sie so Logica dabei, die Umwelt zu schützen. / Por favor ajude a Logica a respeitar o ambiente nao imprimindo este correio electronico. This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you. Please help Logica to respect the environment by not printing this email / Pour contribuer comme Logica au respect de l'environnement, merci de ne pas imprimer ce mail / Bitte drucken Sie diese Nachricht nicht aus und helfen Sie so Logica dabei, die Umwelt zu schützen. / Por favor ajude a Logica a respeitar o ambiente não imprimindo este correio electrónico. This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you. ---------------------------------------------------------------------------- -- This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users