Re[2]: How check if a directory exists?

FltIsDirectory requires an opened file object. If you successfully open
it to call this API then you know it exists. Of course if you do not
know if the object is a directory then you can use this API to make that
decision.

Pete


Kernel Drivers
Windows File System and Device Driver Consulting
www.KernelDrivers.com
866.263.9295

------ Original Message ------
From: “Pablo Glombovsky”
To: “Windows File Systems Devs Interest List”
Sent: 1/26/2017 7:36:06 AM
Subject: RE: [ntfsd] How check if a directory exists?

>You can try FltIsDirectory
>
>-----Original Message-----
>From: xxxxx@lists.osr.com
>[mailto:xxxxx@lists.osr.com] On Behalf Of
>xxxxx@hotmail.com
>Sent: jueves, 26 de enero de 2017 02:07 a.m.
>To: Windows File Systems Devs Interest List
>Subject: [ntfsd] How check if a directory exists?
>
>Hello,
>
>i want know (in kernel mode ), how discover if a specific directory
>really
>exists ?
>
>thank you.
>
>—
>NTFSD is sponsored by OSR
>
>
>MONTHLY seminars on crash dump analysis, WDF, Windows internals and
>software
>drivers!
>Details at http:
>
>To unsubscribe, visit the List Server section of OSR Online at
>http:
>
>
>
>—
>NTFSD is sponsored by OSR
>
>
>MONTHLY seminars on crash dump analysis, WDF, Windows internals and
>software drivers!
>Details at http:
>
>To unsubscribe, visit the List Server section of OSR Online at
>http:</http:></http:></http:></http:>

> “Gabriel Bercea” wrote in message news:xxxxx@ntfsd…

Just issue a ZwCreateFile to the directory path using as desired access
FILE_READ_ATTRIBUTES and check out whatever the ZwCreateFile returns.

I’d also suggest adding FILE_DIRECTORY_FILE to the options. Saves even
looking at the file object once you’ve done the open.

Be very careful with FltIsDirectory - some filesystems and even more
redirectors are not consistent about whether something is a directory or
not, so if you rely on the result from one path you must use it everywhere -
if you use FltIsDirectory, use it everywhere, if you look at
FileBasicInformation do that everywhere, and so on.