IS_NULLSTR_PTR

InstallShield 2014 » InstallScript Language Reference

You can use the IS_NULLSTR_PTR variable to pass a null pointer to an external DLL function or Windows API through a parameter that has been prototyped as an InstallScript string. This functionality works for byval string, byref string, wstring, and binary data types.

This functionality does not apply to byref number parameters. If you want to specify a NULL pointer for byref number parameters, you must prototype the parameter as a pointer data type and pass the address of the number variable or NULL, as needed.

IS_NULLSTR_PTR is a global string variable instance with the value of <IS_NULLSTR_PTR>. A statement that assigns a new value to this variable compiles; however, the assignment does not have any effect. The variable’s value remains <IS_NULLSTR_PTR>.

If you pass this variable to a non-DLL function, the function receives the string <IS_NULLSTR_PTR>.

If you pass a string that has the value <IS_NULLSTR_PTR> to an external DLL function, the result is the same as if you used IS_NULLSTR_PTR.

Using the IS_NULLSTR_PTR Variable to Pass a Null Pointer to a Windows API

The Windows function WritePrivateProfileString lets you flush the INI file buffer on Windows 9x by specifying NULL for the first three parameters. However, since this function is prototyped as follows, there does not appear to be any way to accomplish this:

prototype number   KERNEL32.WritePrivateProfileString (byval string, byval string, byval string, byval string);

Using the pointer data type allows NULL to be specified, but it causes problems when trying to specify a valid string.

If you want the InstallScript engine to pass a null pointer to the function, you can use the following code:

KERNEL32.WritePrivateProfileString (IS_NULLSTR_PTR, IS_NULLSTR_PTR, IS_NULLSTR_PTR, szFile);

Using the IS_NULLSTR_PTR Variable to Pass a Null Pointer to an External DLL Function

You can use IS_NULLSTR_PTR with any external DLL function that expects a string. In this case, the DLL function receives a NULL pointer.

See Also