LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why LabVIEW is not closing properly after calling Kernel32.dll ?

When calling GetSystemDirectoryA, the VI seems to run normally but, when closing it, a Dr Watson error appears.
The function is called as reentrant in stdcall (WINAPI) convention. The "Return type" and "uSize" parameters are declared as unsigned 32-bit integers and the "lpbuffer" parameter has a "C String Pointer" format.
0 Kudos
Message 1 of 2
(2,715 Views)
> When calling GetSystemDirectoryA, the VI seems to run normally but,
> when closing it, a Dr Watson error appears.
> The function is called as reentrant in stdcall (WINAPI) convention.
> The "Return type" and "uSize" parameters are declared as unsigned
> 32-bit integers and the "lpbuffer" parameter has a "C String Pointer"
> format.

The most likely problem is that the string you are passing in isn't
large enough for the data written to it by the GetDir functions.

Since it is just a pointer being passed, it isn't possible for the
call to grow the string. It is up to the caller to have a big enough
buffer. For Win32, I'd make the string at least 256 characters, and
you might as well make it 1024 since that is what the system uses in
its header files.

To do th
is, either make a constant with that many characters in it, or
Do something to resize the string as large as you like.

Greg McKaskle
Message 2 of 2
(2,715 Views)