Guest frank_que Posted July 27, 2004 Posted July 27, 2004 Is't possible to modify the function filegetsize to get the size of files greater than 2gb? Thanx Frank
this-is-me Posted July 27, 2004 Posted July 27, 2004 Are you running on win9x or XP? Who else would I be?
Guest frank_que Posted July 27, 2004 Posted July 27, 2004 I've tried both windows 2k and windows xp Frank
Westi Posted July 27, 2004 Posted July 27, 2004 Hi, you're right, strange result for a 2,89G file: -1190395904 under XP with NTFS. I think it's a bug but i have a solution: $before = DriveSpaceFree ( "C:\" ) ;This takes time $FC = FileCopy ( "myvideo.vob", "myvideo.tmp" ) ;This is faster;-) $FC = FileDelete ( "myvideo.vob" ) $after = DriveSpaceFree ( "C:\" ) If $FC = 1 then MsgBox(4096,"Filesize is:",$after - $before) FileDelete ( "myvideo.tmp" ) EndIf
emmanuel Posted July 27, 2004 Posted July 27, 2004 I wonder if this is a windows problem, when I search for files at least 20,971,520kb in size, I'm returned a ton of files, all of them under that size. Same for a search of at least 2,097,152kb... So, that's winXP... "I'm not even supposed to be here today!" -Dante (Hicks)
Guest frank_que Posted July 27, 2004 Posted July 27, 2004 I've looked into autoit sources: It uses the getfilesize() function.From msdn library documentation: ( http://msdn.microsoft.com/library/default....getfilesize.asp )"The GetFileSize function retrieves the size of the specified file.The file size that can be reported by this function is limited to a DWORD value.To retrieve a file size that is larger than a DWORD value, use the GetFileSizeEx function."I'm not a c++ programmer, can someone help me to implement it?TnxFrank
Valik Posted July 27, 2004 Posted July 27, 2004 I don't think GetFileSizeEx() is available on earlier versions of Windows or on NT or something. If I remember, there is a valid reason why it isn't used.
Holger Posted July 28, 2004 Posted July 28, 2004 Yeah, I think the small problem is not "GetFileSize", but the conversation to a result: vResult = (int)GetFileSize(fileIn, NULL); You see it's converted to integer and a file greater than 2 GB had a problem. cause the limit of "int" is:2.147.483.647 The highest what this function can is DWORD (4.294.967.295). So if someone has files bigger than this he has the problem again, but for the size up to 4 GB why we not use this instead (c++): ... char *dwMaxSize = "0"; ... _ultoa(GetFileSize(fileIn, NULL),dwMaxSize,10); vResult = dwMaxSize; ... Only an idea... Holger Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView
Administrators Jon Posted July 28, 2004 Administrators Posted July 28, 2004 Yeah, I think the small problem is not "GetFileSize", but the conversation to a result: vResult = (int)GetFileSize(fileIn, NULL); You see it's converted to integer and a file greater than 2 GB had a problem. cause the limit of "int" is:2.147.483.647 The highest what this function can is DWORD (4.294.967.295). So if someone has files bigger than this he has the problem again, but for the size up to 4 GB why we not use this instead (c++): ... char *dwMaxSize = "0"; ... _ultoa(GetFileSize(fileIn, NULL),dwMaxSize,10); vResult = dwMaxSize; ... Only an idea... HolgerWe can use a double instead to get to 4GB. Maybe doing getsizeEx when running under NT OSes. Holger, you do know that code you posted has a buffer overrun yeah? It's just one of your submissions has a similar thing in that I changed
ezzetabi Posted July 28, 2004 Posted July 28, 2004 In NTFS the limit of 4GB do not exist anymore... It is needed an other solution...
SlimShady Posted July 28, 2004 Posted July 28, 2004 In NTFS the limit of 4GB do not exist anymore... It is needed an other solution...Why? Do you have files bigger than 4GB?
Administrators Jon Posted July 28, 2004 Administrators Posted July 28, 2004 Why? Do you have files bigger than 4GB?Movie files and such. a DVD-R is 4.7 GB which could be in one or two files. (I DVD recorded CSI last night off TV and that was 1.47 GB )
SlimShady Posted July 28, 2004 Posted July 28, 2004 (edited) Ofcourse. I don't record/copy movies or television shows on my PC, that's why I hadn't thought about it. Edited July 28, 2004 by SlimShady
Holger Posted July 28, 2004 Posted July 28, 2004 @Jon: I hope I understand I think you mean the line:char *dwMaxSize = "0";Your'e absolutely right.I read a bit over buffer overruns and security problems a time ago...So I read it again and now I understand it.Better for is would be (I hope):char dwMaxSize[10];I will install later NT4.0 here on my test-pc as another partition an check what it says to a 10 GB file with "GetFileSizeEx"... Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView
Administrators Jon Posted July 28, 2004 Administrators Posted July 28, 2004 @Jon: I hope I understand I think you mean the line: char *dwMaxSize = "0"; Your'e absolutely right. I read a bit over buffer overruns and security problems a time ago... So I read it again and now I understand it. Better for is would be (I hope): char dwMaxSize[10]; I will install later NT4.0 here on my test-pc as another partition an check what it says to a 10 GB file with "GetFileSizeEx"...Yeah, that's the one. char *dwMaxSize = "0"; just allocates 2 bytes "0" and "\0".
ezzetabi Posted July 28, 2004 Posted July 28, 2004 Why? Do you have files bigger than 4GB?I dont, but it is not a reason for keeping a buggy function in Autoit.For example a .rar achivie can be at most 8,589,934,591 GB so the 4gB limit can be tight.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now