Page 1 of 1

Call DLL -- question re: specifying bool parameters

Posted: Fri Feb 06, 2009 6:39 pm
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

Posted: Fri Feb 06, 2009 9:24 pm
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!

Posted: Mon Feb 09, 2009 2:12 pm
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

Posted: Mon Feb 09, 2009 2:31 pm
by MichaelNesmith
Yes, exactly - it should work this way.

I've passed your request to R&D as well.