Hi,
Using commnad prompt, I excuted the following commnad:
"susbst b: c:"
now my b: drive letter is subst to my physical c:
drive
When I call ZwCreateFile function from my driver,
exaclty with same parameters, I got different
behaviours:
- when FilePath is “??\C:\NewFile.txt” -
STATUS_SUCCESS returns and everything is OK
- when FilePath is “??\B:\NewFile.txt” - I get
status 0xC000003A (STATUS_OBJECT_PATH_NOT_FOUND)
Can anyone explain this issue?
Thanks
Alon
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
> 1. when FilePath is "??\C:\NewFile.txt" -
STATUS_SUCCESS returns and everything is OK
2. when FilePath is "??\B:\NewFile.txt" - I get
status 0xC000003A (STATUS_OBJECT_PATH_NOT_FOUND)
Have you considered the different namespaces?
If the SUBST command that you use uses the logon-session's namespace then it
is clear why the path is not found - because the SUBST took place in a
completely different "realm".
Cheers,
Oliver
--
May the source be with you, stranger 
ICQ: #281645
URL: http://assarbad.net
Well,
Another input:
When I call with “??\B:\NewFile.txt” from the system
process, I fail with the status i mentioned before,
when I call it from my process (in a context of IOCTL
for example) it succeeded.
I still be happy to get an answer
Alon.
“Oliver Schneider” wrote in
message news:xxxxx@ntfsd…
> > 1. when FilePath is “??\C:\NewFile.txt” -
> > STATUS_SUCCESS returns and everything is OK
> > 2. when FilePath is “??\B:\NewFile.txt” - I get
> > status 0xC000003A (STATUS_OBJECT_PATH_NOT_FOUND)
> Have you considered the different namespaces?
> If the SUBST command that you use uses the
logon-session’s namespace then it
> is clear why the path is not found - because the
SUBST took place in a
> completely different “realm”.
>
> Cheers,
>
> Oliver
>
> –
> ---------------------------------------------------
> May the source be with you, stranger 
>
> ICQ: #281645
> URL: http://assarbad.net
>
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
> Have you considered the different namespaces?
To add to what Oliver has said, a quote from
http://blogs.msdn.com/heaths/archive/2005/09/21/472464.aspx
“Windows Server 2003 and Windows XP: The function creates a device
name for a caller that is not running in the LocalSystem context in its own
Local MS-DOS device namespace. If the caller is running in the
LocalSystem context, the function creates the device name in the Global
MS-DOS device namespace.”
Tom, you can see a full path using DevView or its analogs.
From: “Oliver Schneider”
> Date: 2006/03/02 Thu AM 11:37:27 EST
> To: “Windows File Systems Devs Interest List”
> Subject: Re: [ntfsd] ZwCreateFile fails for subst drive path
>
> > 1. when FilePath is “??\C:\NewFile.txt” -
> > STATUS_SUCCESS returns and everything is OK
> > 2. when FilePath is “??\B:\NewFile.txt” - I get
> > status 0xC000003A (STATUS_OBJECT_PATH_NOT_FOUND)
> Have you considered the different namespaces?
> If the SUBST command that you use uses the logon-session’s namespace then it
> is clear why the path is not found - because the SUBST took place in a
> completely different “realm”.
>
> Cheers,
>
> Oliver
>
> –
> ---------------------------------------------------
> May the source be with you, stranger 
>
> ICQ: #281645
> URL: http://assarbad.net
>
>
> —
> Questions? First check the IFS FAQ at https://www.osronline.com/article.cfm?id=17
>
> You are currently subscribed to ntfsd as: xxxxx@bellsouth.net
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
> Well,
Another input:
When I call with "??\B:\NewFile.txt" from the system
process, I fail with the status i mentioned before,
when I call it from my process (in a context of IOCTL
for example) it succeeded.
I still be happy to get an answer
Again,
different sessions == different namespaces
what's so hard to understand that? Being called from usermode makes you
running in the context of that process and thus of the same session that
issued the SUBST, I assume - therefore it succeeds. Can you probably try to
convince your SUBST to use "\GLOBAL??" instead of "??"?
Oliver
--
May the source be with you, stranger 
ICQ: #281645
URL: http://assarbad.net
> 1. when FilePath is “??\C:\NewFile.txt” -
STATUS_SUCCESS returns and everything is OK
2. when FilePath is “??\B:\NewFile.txt” - I get
status 0xC000003A (STATUS_OBJECT_PATH_NOT_FOUND)
This is because the substed drives exist only in \Sessions and are per-terminal
session, while ZwCreateFile can only traverse the global drive letters.
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com