News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Looking for a file, but FindFile is strange

Started by learn64bit, August 07, 2022, 07:43:45 PM

Previous topic - Next topic

NoCforMe

Interesting: my own file-finder, FindIt!.exe, will find all the files in c:\windows\system32\drivers with that special string, but it won't recurse into any of the sub-folders like etc:

Assembly language programming should be fun. That's why I do it.

TimoVJL

C:\Windows\sysnative\drivers\etc
C:\Windows\sysnative\drivers\etc\hosts
C:\Windows\sysnative\drivers\etc\lmhosts.sam
C:\Windows\sysnative\drivers\etc\networks
C:\Windows\sysnative\drivers\etc\protocol
C:\Windows\sysnative\drivers\etc\services
May the source be with you

NoCforMe

So where does "\sysnative\" come from?

And yes, that works too. I have no idea why, though:
Assembly language programming should be fun. That's why I do it.

TimoVJL

https://docs.microsoft.com/en-us/windows/win32/winprog64/file-system-redirector
Quote32-bit applications can access the native system directory by substituting %windir%\Sysnative for %windir%\System32. WOW64 recognizes Sysnative as a special alias used to indicate that the file system should not redirect the access. This mechanism is flexible and easy to use, therefore, it is the recommended mechanism to bypass file system redirection. Note that 64-bit applications cannot use the Sysnative alias as it is a virtual directory not a real one.
May the source be with you

NoCforMe

Thank you for that clarification.

Question, though: The folder "etc" is still not found by using this alias. (However, the program will find files in this folder if you explicitly search C:\windows\system32\drivers\etc.) Why is this? What's so special about this folder?

(BTW, my code uses the legacy functions FindFirstFile() and FindNextFile().)

=========================================================
Editorializing:

At the rate things are going, I predict that within a couple years everything in Windoze will be "virtualized" to the point that nothing will be identifiable as a file or folder: everything will simply be part of some huge "class" of "objects", accessible only by C++ "methods".

Sort of the OS version of "you won't own anything"?
Assembly language programming should be fun. That's why I do it.

jj2007

Strange, my 32-bit proggie finds all folders on Win7-64 :cool:

0       01.06.2015  12:43:18    C:\Windows\System32\drivers\etc
0       16.01.2012  18:59:26    C:\Windows\System32\drivers\it-IT
0       14.10.2011  05:50:07    C:\Windows\System32\drivers\nti
0       14.10.2011  05:50:07    C:\Windows\System32\drivers\nti\2003_amd64
0       14.10.2011  05:50:07    C:\Windows\System32\drivers\nti\2003_ia64
0       14.10.2011  05:50:07    C:\Windows\System32\drivers\nti\2003_x86
0       14.10.2011  05:50:07    C:\Windows\System32\drivers\nti\Vista_amd64
0       14.10.2011  05:50:07    C:\Windows\System32\drivers\nti\Vista_ia64
0       14.10.2011  05:50:07    C:\Windows\System32\drivers\nti\Vista_x86
0       14.10.2011  05:50:07    C:\Windows\System32\drivers\nti\w2k_x86
0       14.10.2011  05:50:07    C:\Windows\System32\drivers\nti\Xp_x86
0       16.01.2012  19:02:02    C:\Windows\System32\drivers\UMDF
0       16.01.2012  18:59:26    C:\Windows\System32\drivers\UMDF\it-IT

NoCforMe

JJ, one request: could you please not post .asc files for those of us here who don't use whatever editor uses those files? I use Notepad, and in any case only deal with ANSI-type files, as I'm guessing do a lot of others here.
Assembly language programming should be fun. That's why I do it.

quarantined

Quote from: NoCforMe on August 09, 2022, 06:59:40 AM
JJ, one request: could you please not post .asc files...

Nah, it's his way of trying to convert users here to use his MasmBasic.
I generally ignore anything posted with

"include  \masm32\MasmBasic\MasmBasic.inc.   download" and believe such things don't belong here in the Campus anyway. But hutch apparently allows it, although mixing MasmBasic and Masm32 sources here would confuse newbies.


NoCforMe

Yesh, it does seem like some underhanded proselytizing on his part on behalf of MasmBasic. But I like JJ, and MB's pretty kewl (even though I haven't touched it yet), so I let all that slide ...
Assembly language programming should be fun. That's why I do it.

jj2007

Quote from: NoCforMe on August 09, 2022, 06:59:40 AM
JJ, one request: could you please not post .asc files for those of us here who don't use whatever editor uses those files? I use Notepad, and in any case only deal with ANSI-type files, as I'm guessing do a lot of others here.

The *.asc files open fine in MS Word, Wordpad, LibreOffice and others, but ok, I will try to attach also the plain asm versions from now on :cool:

Btw I had forgotten that we are in The Campus here. This is definitely not n00b stuff any more, maybe the thread could be moved to The Workshop.

As to proselytizing: my proggies find the etc folders, yours don't. Why? That's an interesting question. Either it's my machine, or it's my code that is different. Has anybody tried to run the exe that I posted above, and with which result?

NoCforMe

I totally believe that your code works (you posted the output) and was curious to see how that was accomplished, hence the non-.asc request. An interesting question, indeed.

After running it, I can see that it has the same problem as my FindIt! program: it doesn't find \etc at all. Shows everything else, though. So my system?
Assembly language programming should be fun. That's why I do it.

hutch--

Its basically the case that JJ's masmbasic is a derivation of MASM so its a rough fit here but the problem I agree with is files that require word processors to read it. This is like posting source that you have to use Photoshop to open where code historically and currently uses single byte characters sets that open correctly in any plain text editor.

The other problem is that masmbasic is closed source and its use in postings will be seen by many as advertising rather than posting source code. I try in this world to keep everybody happy and to this extent, JJ has a dedicated forum for masmbasic where most of this stuff should and up as mixing masm code and a derivation like masmbasic is confusing for people who come to the masm forum for masm code.

jj2007

Quote from: NoCforMe on August 09, 2022, 07:41:50 AMI can see that it has the same problem as my FindIt! program: it doesn't find \etc at all. Shows everything else, though. So my system?

This was my suspicion, too, because under the hood I use the same standard FindFirstFile* calls.

Now I've opened my brand new Win10 machine (which I avoid, I hate Win10), and surprise, surprise, it can't find the etc folder, but it does find the files inside that folder :cool:

@Hutch: ok, will try to reduce MB. But looking through my recent posts you'll find a lot of plain Masm32 SDK stuff, too. Even Masm64 ;-)

TimoVJL

FindfileMB.exe find these folders:
0 14.07.2009  08:37:46 C:\Windows\System32\drivers\en-US
0 14.07.2009  08:37:46 C:\Windows\System32\drivers\UMDF
0 14.07.2009  08:37:46 C:\Windows\System32\drivers\UMDF\en-US

Just check what you really have in C:\Windows\SysWOW64\drivers folder.
May the source be with you

NoCforMe

Hutch, did you remove the post I made suggesting (suggesting, not demanding) that JJ not post MasmBasic stuff in this forum?

If so, why? Please explain.
Assembly language programming should be fun. That's why I do it.