LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW bug and Calling GetFileSizeEx in Kernel32.dll for larger than 4GB files

Hi All,
 
I run into a bug in LabVIEW 8.2.0 that does not allow me to get the correct file size with files larger than 4GB. I wonder if anyone has called the GetFileSizeEx function in Kernel32.dll? If you could post a VI, it is greatly appreciated. I tried to do it myself, somehow the LabVIEW file handle didnt work on the function. Thanks in advance.
0 Kudos
Message 1 of 9
(3,733 Views)
is the dll returning a valid number (64 bits?) or the the number typcast to a 32 bit number after the dll?  The max file size reported in a 32 bit number is 2^32 or ~4 GB.  If the windows dll is returning a 32 bit number then the problem is not with labview.  If it returen a 64 bit number then just change the vi to return a 32 bit number.
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 2 of 9
(3,730 Views)
Hi, I didnt got the vi built for calling the dll.  The bug I mentioned is from using LabView's "Get File/Directory Info" vi which used a I64 integer and supposed to cover much higher than 4G.  From their website, this bug is fixed in their LabView8.2.1 release which i dont have.  
 
I am trying to see if I can build my own vi to get the file size by calling the GetFileSizeEx funciton in Kernel32.dll with LabView's function call other libraries. I am having trouble to get it work.  I create a reference to a File Path control, then typecasted that reference with integer 0, and send that to the Call Function node. At the output of function node, i specified I64 for file size.  This simple vi will crush LabView.   Thanks for looking into this.
 
Bryan
0 Kudos
Message 3 of 9
(3,730 Views)
This is fixed in 8.2.1 (see bug 406GLS7U in the readme.html)

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 4 of 9
(3,719 Views)


@BryanL wrote:
Hi, I didnt got the vi built for calling the dll.  The bug I mentioned is from using LabView's "Get File/Directory Info" vi which used a I64 integer and supposed to cover much higher than 4G.  From their website, this bug is fixed in their LabView8.2.1 release which i dont have.  
 
I am trying to see if I can build my own vi to get the file size by calling the GetFileSizeEx funciton in Kernel32.dll with LabView's function call other libraries. I am having trouble to get it work.  I create a reference to a File Path control, then typecasted that reference with integer 0, and send that to the Call Function node. At the output of function node, i specified I64 for file size.  This simple vi will crush LabView.   Thanks for looking into this.
 
Bryan


The OpenG large_file library does deal with these things. It was written for LabVIEw 6.x which had no 64 bit integers. Most WinAPI functions dealing with large integer values for file size, have actually two 32bit integers with one being for the lower significant 32bit and a pointer to a 32bit integer being for the higher significant 32bits and you can provide a NULL pointer for the higher significant 32bit parameter if you are not interested in that. So I would check out that library if you want to know how this is done.

But upgrading to 8.2.1 would be probably easier 😉

Rolf Kalbermatter

Message Edited by rolfk on 04-17-2007 07:57 AM

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 5 of 9
(3,712 Views)
Bryan,

LabVIEW 8.2.1 is free to current members of National Instruments software service programs. If you are a member of the services program, you may visit the NI Services Resource Center, to download LabVIEW 8.2.1 immediately, as well as access LabVIEW related on-demand training. If you are not a service program member, then you may purchase LabVIEW 8.2.1 as an upgrade.


Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
0 Kudos
Message 6 of 9
(3,700 Views)
Hello Rolf and Adnan,
 
Thank you very much for your info. I thought we need to pay over 1K for an upgrade, actually I was told by my colleague that we are getting free upgrades for a year. That definitely will solve my problem. Thanks again for the great support.
 
Bryan
0 Kudos
Message 7 of 9
(3,696 Views)
The LabVIEW file handle has nothing to do with a windows file handle (although it would be great if it was the same thing, or a way to convert one to the other). You have to open a windows file handle yourself with OpenFile or CreateFile.

Regards,

Wiebe.
0 Kudos
Message 8 of 9
(3,682 Views)


wiebe@CARYA wrote:
The LabVIEW file handle has nothing to do with a windows file handle (although it would be great if it was the same thing, or a way to convert one to the other). You have to open a windows file handle yourself with OpenFile or CreateFile.

Regards,

Wiebe.

Checkout the large-file library. LabVIEW has two API levels for file handling. The low level API as exported from the LabVIEW File Manager interface  uses a "File" datatype as file handle. Incidentially on all platforms I have tested (Windows, Mac, Linux) this is the same as the according platform file handle. The other level is the file IO library on diagram level. File refnums are really higher level wrappers around the lower level file handles and the File Manager API exports functions to convert one into the other.

The only thing that can and might break in the future is the fact that the File handle of the low level File Manager API will not anymore directly map to the according platform file handle.Up until LabVIEW 7.1 this has certainly not been the case. I didn't test LabVIEW 8.x about this so far but don't expect existing platforms to suddenly change. New platforms are of course an entirely different cookie.

Rolf Kalbermatter

Message Edited by rolfk on 04-18-2007 03:45 PM

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 9 of 9
(3,681 Views)