PDA

View Full Version : Windows file compression



mary_v
08-23-2010, 10:27 AM
Hi there,

i've got something weird i think - my function (see below) checks on compressed files - well it did until i migrated to is2011:

in is2010 my function returns - if a file really is NOT compressed - an iAttributes value 32

in is2011 the same function returns, same condition as before, an iAttributes value -1 for every file.

Could someone give me a quick hint where and what to look for?
(OS Windows 7 x86)

Thanks
Mary

function BOOL IsFileCompressed(filename)

INT iAttributes, nResult;
STRING sRes;

begin

iAttributes = GetFileAttributes(filename);
NumToStr(sRes, iAttributes);
MessageBox(sRes + " - " + filename, 0);
return (iAttributes & 0x800) == 0x800;

end;

joshstechnij
08-23-2010, 11:34 AM
Can you change your code to call GetFileAttributesW instead and test again? Due to the Unicode changes made to the InstallScript engine, calling any Win32 API without specifying which thunk version to use (A/ANSI or W/Unicode) will now default to calling the Unicode (W) version of the API (technically an API named GetFileAttributes does not exist as an export of Kernel32).

Also note that GetFileAttributesA and GetFileAttributesW are already prototyped by the InstallScript headers, which were updated with the Unicode changes to provide prototypes of the W versions of Win32 APIs. In order for this issue to occur, GetFileAttributes would need to have been prototyped directly in the project being built.

Note that due to the changes in the InstallScript engine, it is recommended that the article "Upgrading Projects to InstallShield 2011 ("http://kb.flexerasoftware.com/selfservice/microsites/search.do?cmd=displayKC&docType=kc&externalId=Q208911&sliceId=)" be reviewed to understand these changes, and to determine what may be necessary to change when upgrading a project to IS 2011.