This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: Change of behaviour of SprintfMsiLog between IS 2013 and IS 2015 on Vista
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jul 29, 2016
09:32 AM
Change of behaviour of SprintfMsiLog between IS 2013 and IS 2015 on Vista
Hi there,
Better late than never, we have just upgraded our projects from IS 2013 to IS 2015.
We bumped into a little issue with SprintfMsiLog.
Something must have changed in IS 2015 (or maybe already in IS 2014), as our installation packages no longer worked on Vista after we upgraded.
Here we go:
One of the calls of SprintMsiLog was like that:
It used to work fine when built with IS 2013, whatever szTitle and szMessage contained.
Once we started to build this project with IS 2015 and test it on various OS, the code above would abort the CustomAction and make the whole installation fail under Windows Vista (and only Vista!).
After quite a few trials and errors, I realized what conditions made it fail:
if either szTitle or szMessage contained a percent sign, the code above would fail if the project was built with IS 2015.
Changing the code to:
resolved the problem.
So here are my questions:
Thanks for reading!
Better late than never, we have just upgraded our projects from IS 2013 to IS 2015.
We bumped into a little issue with SprintfMsiLog.
Something must have changed in IS 2015 (or maybe already in IS 2014), as our installation packages no longer worked on Vista after we upgraded.
Here we go:
- We've got a Basic MSI project, with quite a few CustomActions of type InstallScript.
- One of them logs quite a lot of information to the Msi log file using SprintfMsiLog.
One of the calls of SprintMsiLog was like that:
SprintfMsiLog( "********************* " + szTitle + ": " + szMessage );
It used to work fine when built with IS 2013, whatever szTitle and szMessage contained.
Once we started to build this project with IS 2015 and test it on various OS, the code above would abort the CustomAction and make the whole installation fail under Windows Vista (and only Vista!).
After quite a few trials and errors, I realized what conditions made it fail:
if either szTitle or szMessage contained a percent sign, the code above would fail if the project was built with IS 2015.
Changing the code to:
SprintfMsiLog( "********************* %s: %s", szTitle, szMessage );
resolved the problem.
So here are my questions:
- Did you guys change the InstallScript implementation of SprintfMsiLog in either IS 2014 or in IS 2015 ?
- Is this change documented anywhere?
- Last but not least, any idea why it only fails on Vista?
Thanks for reading!
(2) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 03, 2016
12:19 PM
There weren't any explicit changes to SprintfMsiLog with any recent release of InstallShield, going back well before IS 2013. However, between 2013 and 2015, the compiler used to build the InstallScript engine was updated to a newer version. This is the only likely reason for the change in behavior, as changing the compiler brings a new version of the C and C++ runtime libraries, along with subtle changes in memory layout and usage.
The root issue here is the invalid usage of formatting specifiers. Since the first parameter to SprintfMsiLog is a format string that accepts printf style format specifiers, care must be taken to ensure any use of '%' characters is valid, either as valid format specifiers or an escaped '%' character ('%%'). Any invalid use of formatting specifiers will likely result in the format handling in the C runtime library crashing (try passing the same string in a native C/C++ application to printf or sprintf and notice the runtime behavior).
The change you made to use '%s' for the variable arguments to the string is the easiest solution as this avoids have to replace '%' characters with correctly escaped ones.
The root issue here is the invalid usage of formatting specifiers. Since the first parameter to SprintfMsiLog is a format string that accepts printf style format specifiers, care must be taken to ensure any use of '%' characters is valid, either as valid format specifiers or an escaped '%' character ('%%'). Any invalid use of formatting specifiers will likely result in the format handling in the C runtime library crashing (try passing the same string in a native C/C++ application to printf or sprintf and notice the runtime behavior).
The change you made to use '%s' for the variable arguments to the string is the easiest solution as this avoids have to replace '%' characters with correctly escaped ones.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 05, 2016
12:53 PM
Hi Josh,
Thanks for your reply.
I understood what the root cause was and it was easy to resolve, but you probably understood why I got a bit surprised to see it fail only on Vista.
But yes, this error in my code suddenly being revealed might well be related to the new runtime libraries. I would have thought that these libraries would work in the same way on Vista as on other OS's though.
Best regards,
Reureu
Thanks for your reply.
I understood what the root cause was and it was easy to resolve, but you probably understood why I got a bit surprised to see it fail only on Vista.
But yes, this error in my code suddenly being revealed might well be related to the new runtime libraries. I would have thought that these libraries would work in the same way on Vista as on other OS's though.
Best regards,
Reureu