Call DLL -- question re: specifying bool parameters

Got a problem you cannot solve? Try here.
Post Reply
MikeOnline
Posts: 20
Joined: Tue Nov 25, 2008 8:54 pm
Location: N. California

Call DLL -- question re: specifying bool parameters

Post by MikeOnline »

I tried using a call to kernel32.dll's CopyFileA function, based on sample code in forum topic http://www.installaware.com/forums/viewtopic.php?t=1372. But the third parameter, a bool, is set to FALSE in this example, which should allow the target file to be overwritten if it exists, according to http://msdn.microsoft.com/en-us/library ... S.85).aspx.

Yet when I set the third parameter (as a bool) to FALSE, the function will not overwrite an existing file.

I suspect that bool must be 0 for FALSE, and 1 (or non-zero) for TRUE. But I cannot find any documentation or forum posts that mention how to set a value for a bool parameter in Call DLL. Please provide reference information for specifying parameters (especially bool type parameters) when using Call DLL.

Thanks,
- Michael
MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Post by MichaelNesmith »

This would unfortunately appear to be a bug with the current version of the plug-in. I have escalated this to R&D for resolution.

I do have a workaround for you.

Set the data type to double word instead of bool. Set the value to 0 to indicate false, and 1 to indicate true.

That will get the job done!
Michael Nesmith
Install[b]Aware[/b]
[i]Home of The Next Generation MSI Installer[/i]
Get your free copy today - http://www.installaware.com/
MikeOnline
Posts: 20
Joined: Tue Nov 25, 2008 8:54 pm
Location: N. California

Post by MikeOnline »

Thanks for the quick response. I'll use the work-around you posted.

I'll assume your work-around is valid for any bool parameter issued to kernel32.dll (and probably most other Microsoft DLL's).

Please ask your R&D department to enhance the Call DLL Plugin, so that the VALUE field could be treated to some form of minimal validation. For example, if the user adds a bool paramater, and specifies -1 as a value, a message would appear saying "valid values for bool parameter types are TRUE or FALSE". The validation and message would be tailored for each parameter type.

- Michael
MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Post by MichaelNesmith »

Yes, exactly - it should work this way.

I've passed your request to R&D as well.
Michael Nesmith
Install[b]Aware[/b]
[i]Home of The Next Generation MSI Installer[/i]
Get your free copy today - http://www.installaware.com/
Post Reply