flat assembler
Message board for the users of flat assembler.
Index
> Windows > [solved] GetFileSize and GetFileSizeEx issues |
Author |
|
StakFallT 10 May 2024, 12:11
Is there some kind of issue with the Windows GetFileSize (https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getfilesize) / GetFileSizeEx (https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getfilesizeex) API?
I've been trying to debug a small portion of a much larger project for several days now and it almost looks like there IS an issue. I've been primarily using x64dbg to debug the built executable and I wind up going pretty darn deep into kernel32.dll, ntdll.dll, and gdi32.dll. I've tried running a trace and it goes for hours and set an exception breakpoint on ERROR_INVALID_HANDLE (from the PDF at: https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/1bc92ddf-b79e-413c-bbaa-99a5281a6c90) but that didn't help. It seems I'm getting a handle to the file just fine via CreateFile as the last_error shown by x64dbg on that is ERROR_SUCCESS. However, the next call I make, to GetFileSize or GetFileSizeEx, the value of last_error, shown in x64dbg, is ERROR_INVALID_HANDLE. I've checked file permissions, I've ran chkdsk, I've tried running the file as administrator, at one point I even thought it might have been an issue with SysWOW64 paths with an x86 executable (so I started converting it to a 64-bit executable to test that theory), I started to think it might have been wide-code issues with the filepath / name I was specifying. None of that turned out to be the issue. I thought maybe it was because the system had pending updates; that turned out to not be the issue. I thought it might have been some weird failure due to a cascading / domino effect of some kind (ex. a lack of virtual memory, causing a DLL needing loading by the API failed, thus the DLL wasn't present in memory and returning a semi-erroneous error); that wasn't it as I tried it on another workstation and still got the same error. I've attached a small test-case. I've left most (but not all since) of the commented out code intact to show various things I've tried or lines of thought I had while trying to determine the issue. I am seriously hoping someone can shed some light on this; I'm at the end of my wits having tried to debug this for so long... Thanks in advance!
|
|||||||||||
10 May 2024, 12:11 |
|
StakFallT 10 May 2024, 13:25
Wow... THANK YOU!!! lol
|
|||
10 May 2024, 13:25 |
|
MatQuasar 10 May 2024, 13:36
macomics wrote:
Brilliant! I also helped to debug for about 30 mins, but didn't find this mistake. I keep getting 0xffffffff for low order DWORD. |
|||
10 May 2024, 13:36 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.