Level 3

Compress Drive Check funtion broken in 2012

The following code has worked in previous versions of InstallShield, but now is broken in the 2012 Spring release. This is for an Installscript MSI project. The same code in a 2010 project doesn't display the Msgbox, but does for 2012.

Any ideas??

// Included header files ----------------------------------------------------
#include "ifx.h"

prototype Kernel32.GetFileAttributes(BYVAL STRING);

function OnBegin()
if (Kernel32.GetFileAttributes(INSTALLDIR) & FILE_ATTRIBUTE_COMPRESSED) then
MessageBox("App cannot be installed into a folder that is compressed.",SEVERE);
Labels (1)
0 Kudos
3 Replies
Level 7

I suspect this is not an issue with the change in the IDE to IS2012 Spring, rather the fact that this Win32 API has different behavior depending on whether the path is a local path or a remote path and different behavior on different OS. See this link.

I suggest refactoring the code to get the return code.
nReturn = Kernel32.GetFileAttributes(INSTALLDIR);

Then if INVALID_FILE_ATTRIBUTES is returned, use the InstallScript Err object to find out the last error code.
nDllReturned = Err.LastDllError;
And use that to determine what the problem is. From the above documentation you would to pass a network share to the code as you presented it.
0 Kudos
Level 12 Flexeran
Level 12 Flexeran

This is probably a Unicode related issue raised at the IS2010 to IS2011 migration border. See the release notes of IS2011 for full information, or change one of the following:

  • prototype Kernel32.GetFileAttributes(BYVAL WSTRING)
  • prototype Kernel32.GetFileAttributesA(BYVAL STRING)
I would typically suggest the first one as preferable to the second.
0 Kudos
Level 3

That worked MU.
0 Kudos