Forum > Windows

[RESOLVED] Significant Discrepancy in FindAllFiles in 64-bit code vs 32-bit code

(1/2) > >>

ASBzone:
On this machine, I'm running Lazarus 1.8.4 with FPC 3.0.4

I have the 32-bit edition installed, plus cross-compile to 64-bit.

I've tested the code generation from several Windows 10 x64 systems, and I've tested the resulting executables on Windows 10, Windows Server 2012-R2, and Windows Server 2016, and the results are similar.   (Identical on same platforms)

The 32-bit compiled code finds less files which clearly exist as compared to a DIR command or other file manipulation.
The 64-bit compiled code finds all the same files.

The 32-bit list is much smaller (when I use larger search criteria).   I found this while testing output from my 32-bit and 64-bit utility...

It affects FindFirstFileExW as well.

Please see the attached sample code.

Bart:
The system32 folder is a bit of a strange one.
64-bit processes will find other files there than 32-bit processes.

Bart

ASBzone:
@Bart, I was so ready to contest that statement, but I tested with a different utility -- compiled in C++ -- and it turns out that you are quite correct.

Which is somewhat comforting, since I didn't want to think that I had broken utilities out there.

So, then, there is nothing to fix, eh?    :-[

440bx:
As Bart mentioned, the Windows system folders are special cases.  The results will be different depending on the bitness of the program. 

The difference is likely due to file system redirection.  You can temporarily disable redirection using Windows APIs.  Once redirection is disabled, the results between the two programs will be much closer (I hesitate to say the same because Windows has a way of doing unexpected things behind a program's back.)

check out:
https://msdn.microsoft.com/en-us/library/windows/desktop/aa365743(v=vs.85).aspx

HTH

ASBzone:

--- Quote from: ASBzone on November 30, 2018, 05:01:55 am ---So, then, there is nothing to fix, eh?    :-[

--- End quote ---

I ran my utility against the entire Windows folder, to see if this was just limited to System32 or what.

I only tracked for files up to 1000 bytes, just to make it fast.

Thanks again for that insight, @Bart.  Now I just have to do some digging at Microsoft to see why that approach was taken.

(My attachments are too big, unfortunately -- just accept that there was a huge file discrepancy: 46117 files via 32-bit code, 46314 files via 64-bit code)

Navigation

[0] Message Index

[#] Next page

Go to full version