RE: IoCreateFileSpecifyDeviceObjectHint can open the UNC files?

Hi,Tony

Thanks for your reply. I tried the following code:

RtlInitUnicodeString(&testName, L"\??\UNC\172.21.12.17\test\test.txt");
InitializeObjectAttributes( &ObjectAttributes,
&testName,
OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE,
NULL,
NULL );

status = IoCreateFileSpecifyDeviceObjectHint(
&FileHandle, // File Handle
FILE_READ_ATTRIBUTES, // Desired Access
&ObjectAttributes, // Attributes
&IoStatus, // IO Status Block
NULL, // Allocation size
FILE_ATTRIBUTE_NORMAL, // File attributes
FILE_SHARE_DELETE,
FILE_OPEN, // Create disposition
FILE_NON_DIRECTORY_FILE, // Create options
NULL, // EA buffer
0, // EA size
CreateFileTypeNone, // CreateFileType
NULL, // Extra create parameters
IO_IGNORE_SHARE_ACCESS_CHECK,
DevExt->NLExtHeader.AttachedToDeviceObject // Device object to use for
open
);

/*
status = ZwCreateFile(
&FileHandle,
FILE_READ_ATTRIBUTES, // Desired Access
&ObjectAttributes, // Attributes
&IoStatus, // IO Status Block
NULL,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_DELETE,
FILE_OPEN,
FILE_NON_DIRECTORY_FILE ,
NULL,
0
);

*/

The return stutus = STATUS_INVALID_PARAMETER
I debug the DevExt->NLExtHeader.AttachedToDeviceObject,
it’s drivername “\FileSystem\MRxSmb”, so it is
\Device\LanmanRedirector,right?

If i use the zwcreate(), it return 0. And if i open the local drive file, it
works fine.

Do you know why?

Thanks

Ben

From: “Tony Mason”
>Reply-To: “Windows File Systems Devs Interest List”
>To: “Windows File Systems Devs Interest List”
>Subject: RE: [ntfsd] IoCreateFileSpecifyDeviceObjectHint can open the UNC
>files?
>Date: Wed, 22 Mar 2006 11:55:02 -0500
>
>By “it doesn’t work” I assume you mean it doesn’t compile, right? If
>that is not the case you might want to be more specific about what you
>mean.
>
>Also, what device object are you using as the hint? The name needs to
>be valid relative to that device object (although this wouldn’t make it
>not compile, this would make it not run properly.)
>
>Regards,
>
>Tony
>
>Tony Mason
>Consulting Partner
>OSR Open Systems Resources, Inc.
>http://www.osr.com
>
>
>Looking forward to seeing you at the next OSR File Systems class in
>Boston, MA April 18-21, 2006.
>
>-----Original Message-----
>From: xxxxx@lists.osr.com
>[mailto:xxxxx@lists.osr.com] On Behalf Of Bin Zeng
>Sent: Wednesday, March 22, 2006 10:59 AM
>To: ntfsd redirect
>Subject: [ntfsd] IoCreateFileSpecifyDeviceObjectHint can open the UNC
>files?
>
>Hi,All
>
>I tried to open the UNC file with the funtion
>IoCreateFileSpecifyDeviceObjectHint.
>It doesn’t work, but it works fine with zwcreate()
>
>I used the string as following:
>
>RtlInitUnicodeString(
>&testName,L"\Device\UNC\172.21.12.17\test\test.txt");
>
>Can IoCreateFileSpecifyDeviceObjectHint open the UNC files?
>
>Thanks
>
>Ben
>
>
>
>
>—
>Questions? First check the IFS FAQ at
>https://www.osronline.com/article.cfm?id=17
>
>You are currently subscribed to ntfsd as: xxxxx@osr.com
>To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>—
>Questions? First check the IFS FAQ at
>https://www.osronline.com/article.cfm?id=17
>
>You are currently subscribed to ntfsd as: unknown lmsubst tag argument: ‘’
>To unsubscribe send a blank email to xxxxx@lists.osr.com

The name you are passing shouldn’t have any meaning to MRXSMB. I have
no idea why that name would work when you pass it to a local file
system, but it works through ZwCreateFile (and I suspect IoCreateFile)
because the name is a valid Windows name, it just isn’t a valid SMB
redirector name.

Perhaps you might do better to try just the portion of the name
following the UNC part (“\172.21.12.17\test\test.txt”) since that at
least looks like a potentially legitimate UNC name.

Regards,

Tony

Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com

Looking forward to seeing you at the next OSR File Systems class in
Boston, MA April 18-21, 2006 (note new date - MS scheduled plugfest the
same week again.)

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Bin Zeng
Sent: Wednesday, March 22, 2006 2:59 PM
To: ntfsd redirect
Subject: RE: [ntfsd] IoCreateFileSpecifyDeviceObjectHint can open the
UNC files?

Hi,Tony

Thanks for your reply. I tried the following code:

RtlInitUnicodeString(&testName,
L"\??\UNC\172.21.12.17\test\test.txt");
InitializeObjectAttributes( &ObjectAttributes,
&testName,
OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE,
NULL,
NULL );

status = IoCreateFileSpecifyDeviceObjectHint(
&FileHandle, // File Handle
FILE_READ_ATTRIBUTES, // Desired Access
&ObjectAttributes, // Attributes
&IoStatus, // IO Status Block
NULL, // Allocation size
FILE_ATTRIBUTE_NORMAL, // File attributes
FILE_SHARE_DELETE,
FILE_OPEN, // Create disposition
FILE_NON_DIRECTORY_FILE, // Create options
NULL, // EA buffer
0, // EA size
CreateFileTypeNone, // CreateFileType
NULL, // Extra create parameters
IO_IGNORE_SHARE_ACCESS_CHECK,
DevExt->NLExtHeader.AttachedToDeviceObject // Device object to
use for
open
);

/*
status = ZwCreateFile(
&FileHandle,
FILE_READ_ATTRIBUTES, // Desired Access
&ObjectAttributes, // Attributes
&IoStatus, // IO Status Block
NULL,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_DELETE,
FILE_OPEN,
FILE_NON_DIRECTORY_FILE ,
NULL,
0
);

*/

The return stutus = STATUS_INVALID_PARAMETER
I debug the DevExt->NLExtHeader.AttachedToDeviceObject,
it’s drivername “\FileSystem\MRxSmb”, so it is
\Device\LanmanRedirector,right?

If i use the zwcreate(), it return 0. And if i open the local drive
file, it
works fine.

Do you know why?

Thanks

Ben

From: “Tony Mason”
>Reply-To: “Windows File Systems Devs Interest List”

>To: “Windows File Systems Devs Interest List”
>Subject: RE: [ntfsd] IoCreateFileSpecifyDeviceObjectHint can open the
UNC
>files?
>Date: Wed, 22 Mar 2006 11:55:02 -0500
>
>By “it doesn’t work” I assume you mean it doesn’t compile, right? If
>that is not the case you might want to be more specific about what you
>mean.
>
>Also, what device object are you using as the hint? The name needs to
>be valid relative to that device object (although this wouldn’t make it
>not compile, this would make it not run properly.)
>
>Regards,
>
>Tony
>
>Tony Mason
>Consulting Partner
>OSR Open Systems Resources, Inc.
>http://www.osr.com
>
>
>Looking forward to seeing you at the next OSR File Systems class in
>Boston, MA April 18-21, 2006.
>
>-----Original Message-----
>From: xxxxx@lists.osr.com
>[mailto:xxxxx@lists.osr.com] On Behalf Of Bin Zeng
>Sent: Wednesday, March 22, 2006 10:59 AM
>To: ntfsd redirect
>Subject: [ntfsd] IoCreateFileSpecifyDeviceObjectHint can open the UNC
>files?
>
>Hi,All
>
>I tried to open the UNC file with the funtion
>IoCreateFileSpecifyDeviceObjectHint.
>It doesn’t work, but it works fine with zwcreate()
>
>I used the string as following:
>
>RtlInitUnicodeString(
>&testName,L"\Device\UNC\172.21.12.17\test\test.txt");
>
>Can IoCreateFileSpecifyDeviceObjectHint open the UNC files?
>
>Thanks
>
>Ben
>
>
>
>
>—
>Questions? First check the IFS FAQ at
>https://www.osronline.com/article.cfm?id=17
>
>You are currently subscribed to ntfsd as: xxxxx@osr.com
>To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>—
>Questions? First check the IFS FAQ at
>https://www.osronline.com/article.cfm?id=17
>
>You are currently subscribed to ntfsd as: unknown lmsubst tag argument:
‘’
>To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@osr.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Thanks,Tony

Right now when i set the DeviceObject to NULL in
IoCreateFileSpecifyDeviceObjectHint,
Then it works fine

Ben

From: “Tony Mason”
>Reply-To: “Windows File Systems Devs Interest List”
>To: “Windows File Systems Devs Interest List”
>Subject: RE: [ntfsd] IoCreateFileSpecifyDeviceObjectHint can open the UNC
>files?
>Date: Wed, 22 Mar 2006 15:41:30 -0500
>
>The name you are passing shouldn’t have any meaning to MRXSMB. I have
>no idea why that name would work when you pass it to a local file
>system, but it works through ZwCreateFile (and I suspect IoCreateFile)
>because the name is a valid Windows name, it just isn’t a valid SMB
>redirector name.
>
>Perhaps you might do better to try just the portion of the name
>following the UNC part (“\172.21.12.17\test\test.txt”) since that at
>least looks like a potentially legitimate UNC name.
>
>Regards,
>
>Tony
>
>Tony Mason
>Consulting Partner
>OSR Open Systems Resources, Inc.
>http://www.osr.com
>
>
>Looking forward to seeing you at the next OSR File Systems class in
>Boston, MA April 18-21, 2006 (note new date - MS scheduled plugfest the
>same week again.)
>
>
>-----Original Message-----
>From: xxxxx@lists.osr.com
>[mailto:xxxxx@lists.osr.com] On Behalf Of Bin Zeng
>Sent: Wednesday, March 22, 2006 2:59 PM
>To: ntfsd redirect
>Subject: RE: [ntfsd] IoCreateFileSpecifyDeviceObjectHint can open the
>UNC files?
>
>Hi,Tony
>
>Thanks for your reply. I tried the following code:
>
>RtlInitUnicodeString(&testName,
>L"\??\UNC\172.21.12.17\test\test.txt");
>InitializeObjectAttributes( &ObjectAttributes,
> &testName,
> OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE,
> NULL,
> NULL );
>
>status = IoCreateFileSpecifyDeviceObjectHint(
> &FileHandle, // File Handle
> FILE_READ_ATTRIBUTES, // Desired Access
> &ObjectAttributes, // Attributes
> &IoStatus, // IO Status Block
> NULL, // Allocation size
> FILE_ATTRIBUTE_NORMAL, // File attributes
> FILE_SHARE_DELETE,
> FILE_OPEN, // Create disposition
> FILE_NON_DIRECTORY_FILE, // Create options
> NULL, // EA buffer
> 0, // EA size
> CreateFileTypeNone, // CreateFileType
> NULL, // Extra create parameters
> IO_IGNORE_SHARE_ACCESS_CHECK,
> DevExt->NLExtHeader.AttachedToDeviceObject // Device object to
>use for
>open
> );
>
>
>/
>status = ZwCreateFile(
> &FileHandle,
> FILE_READ_ATTRIBUTES, // Desired Access
> &ObjectAttributes, // Attributes
> &IoStatus, // IO Status Block
> NULL,
> FILE_ATTRIBUTE_NORMAL,
> FILE_SHARE_DELETE,
> FILE_OPEN,
> FILE_NON_DIRECTORY_FILE ,
> NULL,
> 0
> );
>
>
/
>
>
>The return stutus = STATUS_INVALID_PARAMETER
> I debug the DevExt->NLExtHeader.AttachedToDeviceObject,
> it’s drivername “\FileSystem\MRxSmb”, so it is
>\Device\LanmanRedirector,right?
>
>If i use the zwcreate(), it return 0. And if i open the local drive
>file, it
>works fine.
>
>Do you know why?
>
>Thanks
>
>Ben
>
>
>
>
> >From: “Tony Mason”
> >Reply-To: “Windows File Systems Devs Interest List”
>
> >To: “Windows File Systems Devs Interest List”
> >Subject: RE: [ntfsd] IoCreateFileSpecifyDeviceObjectHint can open the
>UNC
> >files?
> >Date: Wed, 22 Mar 2006 11:55:02 -0500
> >
> >By “it doesn’t work” I assume you mean it doesn’t compile, right? If
> >that is not the case you might want to be more specific about what you
> >mean.
> >
> >Also, what device object are you using as the hint? The name needs to
> >be valid relative to that device object (although this wouldn’t make it
> >not compile, this would make it not run properly.)
> >
> >Regards,
> >
> >Tony
> >
> >Tony Mason
> >Consulting Partner
> >OSR Open Systems Resources, Inc.
> >http://www.osr.com
> >
> >
> >Looking forward to seeing you at the next OSR File Systems class in
> >Boston, MA April 18-21, 2006.
> >
> >-----Original Message-----
> >From: xxxxx@lists.osr.com
> >[mailto:xxxxx@lists.osr.com] On Behalf Of Bin Zeng
> >Sent: Wednesday, March 22, 2006 10:59 AM
> >To: ntfsd redirect
> >Subject: [ntfsd] IoCreateFileSpecifyDeviceObjectHint can open the UNC
> >files?
> >
> >Hi,All
> >
> >I tried to open the UNC file with the funtion
> >IoCreateFileSpecifyDeviceObjectHint.
> >It doesn’t work, but it works fine with zwcreate()
> >
> >I used the string as following:
> >
> >RtlInitUnicodeString(
> >&testName,L"\Device\UNC\172.21.12.17\test\test.txt");
> >
> >Can IoCreateFileSpecifyDeviceObjectHint open the UNC files?
> >
> >Thanks
> >
> >Ben
> >
> >
> >
> >
> >—
> >Questions? First check the IFS FAQ at
> >https://www.osronline.com/article.cfm?id=17
> >
> >You are currently subscribed to ntfsd as: xxxxx@osr.com
> >To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >—
> >Questions? First check the IFS FAQ at
> >https://www.osronline.com/article.cfm?id=17
> >
> >You are currently subscribed to ntfsd as: unknown lmsubst tag argument:
>‘’
> >To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
>
>—
>Questions? First check the IFS FAQ at
>https://www.osronline.com/article.cfm?id=17
>
>You are currently subscribed to ntfsd as: xxxxx@osr.com
>To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>—
>Questions? First check the IFS FAQ at
>https://www.osronline.com/article.cfm?id=17
>
>You are currently subscribed to ntfsd as: unknown lmsubst tag argument: ‘’
>To unsubscribe send a blank email to xxxxx@lists.osr.com

Setting the hint to NULL is the equivalent (more or less) of calling
IoCreateFile.

Regards,

Tony

Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com

Looking forward to seeing you at the next OSR File Systems class in
Boston, MA April 18-21, 2006.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Bin Zeng
Sent: Wednesday, March 22, 2006 4:33 PM
To: ntfsd redirect
Subject: RE: [ntfsd] IoCreateFileSpecifyDeviceObjectHint can open the
UNC files?

Thanks,Tony

Right now when i set the DeviceObject to NULL in
IoCreateFileSpecifyDeviceObjectHint,
Then it works fine

Ben

From: “Tony Mason”
>Reply-To: “Windows File Systems Devs Interest List”

>To: “Windows File Systems Devs Interest List”
>Subject: RE: [ntfsd] IoCreateFileSpecifyDeviceObjectHint can open the
UNC
>files?
>Date: Wed, 22 Mar 2006 15:41:30 -0500
>
>The name you are passing shouldn’t have any meaning to MRXSMB. I have
>no idea why that name would work when you pass it to a local file
>system, but it works through ZwCreateFile (and I suspect IoCreateFile)
>because the name is a valid Windows name, it just isn’t a valid SMB
>redirector name.
>
>Perhaps you might do better to try just the portion of the name
>following the UNC part (“\172.21.12.17\test\test.txt”) since that at
>least looks like a potentially legitimate UNC name.
>
>Regards,
>
>Tony
>
>Tony Mason
>Consulting Partner
>OSR Open Systems Resources, Inc.
>http://www.osr.com
>
>
>Looking forward to seeing you at the next OSR File Systems class in
>Boston, MA April 18-21, 2006 (note new date - MS scheduled plugfest the
>same week again.)
>
>
>-----Original Message-----
>From: xxxxx@lists.osr.com
>[mailto:xxxxx@lists.osr.com] On Behalf Of Bin Zeng
>Sent: Wednesday, March 22, 2006 2:59 PM
>To: ntfsd redirect
>Subject: RE: [ntfsd] IoCreateFileSpecifyDeviceObjectHint can open the
>UNC files?
>
>Hi,Tony
>
>Thanks for your reply. I tried the following code:
>
>RtlInitUnicodeString(&testName,
>L"\??\UNC\172.21.12.17\test\test.txt");
>InitializeObjectAttributes( &ObjectAttributes,
> &testName,
> OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE,
> NULL,
> NULL );
>
>status = IoCreateFileSpecifyDeviceObjectHint(
> &FileHandle, // File Handle
> FILE_READ_ATTRIBUTES, // Desired Access
> &ObjectAttributes, // Attributes
> &IoStatus, // IO Status Block
> NULL, // Allocation size
> FILE_ATTRIBUTE_NORMAL, // File attributes
> FILE_SHARE_DELETE,
> FILE_OPEN, // Create disposition
> FILE_NON_DIRECTORY_FILE, // Create options
> NULL, // EA buffer
> 0, // EA size
> CreateFileTypeNone, // CreateFileType
> NULL, // Extra create parameters
> IO_IGNORE_SHARE_ACCESS_CHECK,
> DevExt->NLExtHeader.AttachedToDeviceObject // Device object to
>use for
>open
> );
>
>
>/
>status = ZwCreateFile(
> &FileHandle,
> FILE_READ_ATTRIBUTES, // Desired Access
> &ObjectAttributes, // Attributes
> &IoStatus, // IO Status Block
> NULL,
> FILE_ATTRIBUTE_NORMAL,
> FILE_SHARE_DELETE,
> FILE_OPEN,
> FILE_NON_DIRECTORY_FILE ,
> NULL,
> 0
> );
>
>
/
>
>
>The return stutus = STATUS_INVALID_PARAMETER
> I debug the DevExt->NLExtHeader.AttachedToDeviceObject,
> it’s drivername “\FileSystem\MRxSmb”, so it is
>\Device\LanmanRedirector,right?
>
>If i use the zwcreate(), it return 0. And if i open the local drive
>file, it
>works fine.
>
>Do you know why?
>
>Thanks
>
>Ben
>
>
>
>
> >From: “Tony Mason”
> >Reply-To: “Windows File Systems Devs Interest List”
>
> >To: “Windows File Systems Devs Interest List”
> >Subject: RE: [ntfsd] IoCreateFileSpecifyDeviceObjectHint can open
the
>UNC
> >files?
> >Date: Wed, 22 Mar 2006 11:55:02 -0500
> >
> >By “it doesn’t work” I assume you mean it doesn’t compile, right? If
> >that is not the case you might want to be more specific about what
you
> >mean.
> >
> >Also, what device object are you using as the hint? The name needs
to
> >be valid relative to that device object (although this wouldn’t make
it
> >not compile, this would make it not run properly.)
> >
> >Regards,
> >
> >Tony
> >
> >Tony Mason
> >Consulting Partner
> >OSR Open Systems Resources, Inc.
> >http://www.osr.com
> >
> >
> >Looking forward to seeing you at the next OSR File Systems class in
> >Boston, MA April 18-21, 2006.
> >
> >-----Original Message-----
> >From: xxxxx@lists.osr.com
> >[mailto:xxxxx@lists.osr.com] On Behalf Of Bin Zeng
> >Sent: Wednesday, March 22, 2006 10:59 AM
> >To: ntfsd redirect
> >Subject: [ntfsd] IoCreateFileSpecifyDeviceObjectHint can open the UNC
> >files?
> >
> >Hi,All
> >
> >I tried to open the UNC file with the funtion
> >IoCreateFileSpecifyDeviceObjectHint.
> >It doesn’t work, but it works fine with zwcreate()
> >
> >I used the string as following:
> >
> >RtlInitUnicodeString(
> >&testName,L"\Device\UNC\172.21.12.17\test\test.txt");
> >
> >Can IoCreateFileSpecifyDeviceObjectHint open the UNC files?
> >
> >Thanks
> >
> >Ben
> >
> >
> >
> >
> >—
> >Questions? First check the IFS FAQ at
> >https://www.osronline.com/article.cfm?id=17
> >
> >You are currently subscribed to ntfsd as: xxxxx@osr.com
> >To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >—
> >Questions? First check the IFS FAQ at
> >https://www.osronline.com/article.cfm?id=17
> >
> >You are currently subscribed to ntfsd as: unknown lmsubst tag
argument:
>‘’
> >To unsubscribe send a blank email to
xxxxx@lists.osr.com
>
>
>
>
>—
>Questions? First check the IFS FAQ at
>https://www.osronline.com/article.cfm?id=17
>
>You are currently subscribed to ntfsd as: xxxxx@osr.com
>To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>—
>Questions? First check the IFS FAQ at
>https://www.osronline.com/article.cfm?id=17
>
>You are currently subscribed to ntfsd as: unknown lmsubst tag argument:
‘’
>To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@osr.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Is the system a Windows XP box? If it is, what SP are you running?

IoCreateFileSpecifyDeviceObjectHint fails like this due to a bug. See
http://support.microsoft.com/kb/322726/en-us

I think it was fixed in SP1.

Regards

Ben Curley
Data Encryption Systems Ltd.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Bin Zeng
Sent: 22 March 2006 19:59
To: Windows File Systems Devs Interest List
Subject: RE: [ntfsd] IoCreateFileSpecifyDeviceObjectHint can open the
UNC files?

Hi,Tony

Thanks for your reply. I tried the following code:

RtlInitUnicodeString(&testName,
L"\??\UNC\172.21.12.17\test\test.txt");
InitializeObjectAttributes( &ObjectAttributes,
&testName,
OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE,
NULL,
NULL );

status = IoCreateFileSpecifyDeviceObjectHint(
&FileHandle, // File Handle
FILE_READ_ATTRIBUTES, // Desired Access
&ObjectAttributes, // Attributes
&IoStatus, // IO Status Block
NULL, // Allocation size
FILE_ATTRIBUTE_NORMAL, // File attributes
FILE_SHARE_DELETE,
FILE_OPEN, // Create disposition
FILE_NON_DIRECTORY_FILE, // Create options
NULL, // EA buffer
0, // EA size
CreateFileTypeNone, // CreateFileType
NULL, // Extra create parameters
IO_IGNORE_SHARE_ACCESS_CHECK,
DevExt->NLExtHeader.AttachedToDeviceObject // Device object to
use for open
);

/*
status = ZwCreateFile(
&FileHandle,
FILE_READ_ATTRIBUTES, // Desired Access
&ObjectAttributes, // Attributes
&IoStatus, // IO Status Block
NULL,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_DELETE,
FILE_OPEN,
FILE_NON_DIRECTORY_FILE ,
NULL,
0
);

*/

The return stutus = STATUS_INVALID_PARAMETER
I debug the DevExt->NLExtHeader.AttachedToDeviceObject,
it’s drivername “\FileSystem\MRxSmb”, so it is
\Device\LanmanRedirector,right?

If i use the zwcreate(), it return 0. And if i open the local drive
file, it
works fine.

Do you know why?

Thanks

Ben

From: “Tony Mason”
>Reply-To: “Windows File Systems Devs Interest List”

>To: “Windows File Systems Devs Interest List”
>Subject: RE: [ntfsd] IoCreateFileSpecifyDeviceObjectHint can open the
UNC
>files?
>Date: Wed, 22 Mar 2006 11:55:02 -0500
>
>By “it doesn’t work” I assume you mean it doesn’t compile, right? If
>that is not the case you might want to be more specific about what you
>mean.
>
>Also, what device object are you using as the hint? The name needs to
>be valid relative to that device object (although this wouldn’t make it
>not compile, this would make it not run properly.)
>
>Regards,
>
>Tony
>
>Tony Mason
>Consulting Partner
>OSR Open Systems Resources, Inc.
>http://www.osr.com
>
>
>Looking forward to seeing you at the next OSR File Systems class in
>Boston, MA April 18-21, 2006.
>
>-----Original Message-----
>From: xxxxx@lists.osr.com
>[mailto:xxxxx@lists.osr.com] On Behalf Of Bin Zeng
>Sent: Wednesday, March 22, 2006 10:59 AM
>To: ntfsd redirect
>Subject: [ntfsd] IoCreateFileSpecifyDeviceObjectHint can open the UNC
>files?
>
>Hi,All
>
>I tried to open the UNC file with the funtion
>IoCreateFileSpecifyDeviceObjectHint.
>It doesn’t work, but it works fine with zwcreate()
>
>I used the string as following:
>
>RtlInitUnicodeString(
>&testName,L"\Device\UNC\172.21.12.17\test\test.txt");
>
>Can IoCreateFileSpecifyDeviceObjectHint open the UNC files?
>
>Thanks
>
>Ben
>
>
>
>
>—
>Questions? First check the IFS FAQ at
>https://www.osronline.com/article.cfm?id=17
>
>You are currently subscribed to ntfsd as: xxxxx@osr.com
>To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>—
>Questions? First check the IFS FAQ at
>https://www.osronline.com/article.cfm?id=17
>
>You are currently subscribed to ntfsd as: unknown lmsubst tag argument:
‘’
>To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@des.co.uk
To unsubscribe send a blank email to xxxxx@lists.osr.com

Tony,

You are right, setting the hint to NULL is the equivalent of calling
IoCreateFile.
So it isn’t what i want, i want it pass down to the lower file system
directly.

My filter driver running in Windows Xp sp2.

Any suggestion?

Thanks

Ben

From: “Tony Mason”
>Reply-To: “Windows File Systems Devs Interest List”
>To: “Windows File Systems Devs Interest List”
>Subject: RE: [ntfsd] IoCreateFileSpecifyDeviceObjectHint can open the UNC
>files?
>Date: Wed, 22 Mar 2006 18:53:09 -0500
>
>Setting the hint to NULL is the equivalent (more or less) of calling
>IoCreateFile.
>
>Regards,
>
>Tony
>
>Tony Mason
>Consulting Partner
>OSR Open Systems Resources, Inc.
>http://www.osr.com
>
>
>Looking forward to seeing you at the next OSR File Systems class in
>Boston, MA April 18-21, 2006.
>
>
>-----Original Message-----
>From: xxxxx@lists.osr.com
>[mailto:xxxxx@lists.osr.com] On Behalf Of Bin Zeng
>Sent: Wednesday, March 22, 2006 4:33 PM
>To: ntfsd redirect
>Subject: RE: [ntfsd] IoCreateFileSpecifyDeviceObjectHint can open the
>UNC files?
>
>Thanks,Tony
>
>Right now when i set the DeviceObject to NULL in
>IoCreateFileSpecifyDeviceObjectHint,
>Then it works fine
>
>Ben
>
>
> >From: “Tony Mason”
> >Reply-To: “Windows File Systems Devs Interest List”
>
> >To: “Windows File Systems Devs Interest List”
> >Subject: RE: [ntfsd] IoCreateFileSpecifyDeviceObjectHint can open the
>UNC
> >files?
> >Date: Wed, 22 Mar 2006 15:41:30 -0500
> >
> >The name you are passing shouldn’t have any meaning to MRXSMB. I have
> >no idea why that name would work when you pass it to a local file
> >system, but it works through ZwCreateFile (and I suspect IoCreateFile)
> >because the name is a valid Windows name, it just isn’t a valid SMB
> >redirector name.
> >
> >Perhaps you might do better to try just the portion of the name
> >following the UNC part (“\172.21.12.17\test\test.txt”) since that at
> >least looks like a potentially legitimate UNC name.
> >
> >Regards,
> >
> >Tony
> >
> >Tony Mason
> >Consulting Partner
> >OSR Open Systems Resources, Inc.
> >http://www.osr.com
> >
> >
> >Looking forward to seeing you at the next OSR File Systems class in
> >Boston, MA April 18-21, 2006 (note new date - MS scheduled plugfest the
> >same week again.)
> >
> >
> >-----Original Message-----
> >From: xxxxx@lists.osr.com
> >[mailto:xxxxx@lists.osr.com] On Behalf Of Bin Zeng
> >Sent: Wednesday, March 22, 2006 2:59 PM
> >To: ntfsd redirect
> >Subject: RE: [ntfsd] IoCreateFileSpecifyDeviceObjectHint can open the
> >UNC files?
> >
> >Hi,Tony
> >
> >Thanks for your reply. I tried the following code:
> >
> >RtlInitUnicodeString(&testName,
> >L"\??\UNC\172.21.12.17\test\test.txt");
> >InitializeObjectAttributes( &ObjectAttributes,
> > &testName,
> > OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE,
> > NULL,
> > NULL );
> >
> >status = IoCreateFileSpecifyDeviceObjectHint(
> > &FileHandle, // File Handle
> > FILE_READ_ATTRIBUTES, // Desired Access
> > &ObjectAttributes, // Attributes
> > &IoStatus, // IO Status Block
> > NULL, // Allocation size
> > FILE_ATTRIBUTE_NORMAL, // File attributes
> > FILE_SHARE_DELETE,
> > FILE_OPEN, // Create disposition
> > FILE_NON_DIRECTORY_FILE, // Create options
> > NULL, // EA buffer
> > 0, // EA size
> > CreateFileTypeNone, // CreateFileType
> > NULL, // Extra create parameters
> > IO_IGNORE_SHARE_ACCESS_CHECK,
> > DevExt->NLExtHeader.AttachedToDeviceObject // Device object to
> >use for
> >open
> > );
> >
> >
> >/
> >status = ZwCreateFile(
> > &FileHandle,
> > FILE_READ_ATTRIBUTES, // Desired Access
> > &ObjectAttributes, // Attributes
> > &IoStatus, // IO Status Block
> > NULL,
> > FILE_ATTRIBUTE_NORMAL,
> > FILE_SHARE_DELETE,
> > FILE_OPEN,
> > FILE_NON_DIRECTORY_FILE ,
> > NULL,
> > 0
> > );
> >
> >
/
> >
> >
> >The return stutus = STATUS_INVALID_PARAMETER
> > I debug the DevExt->NLExtHeader.AttachedToDeviceObject,
> > it’s drivername “\FileSystem\MRxSmb”, so it is
> >\Device\LanmanRedirector,right?
> >
> >If i use the zwcreate(), it return 0. And if i open the local drive
> >file, it
> >works fine.
> >
> >Do you know why?
> >
> >Thanks
> >
> >Ben
> >
> >
> >
> >
> > >From: “Tony Mason”
> > >Reply-To: “Windows File Systems Devs Interest List”
> >
> > >To: “Windows File Systems Devs Interest List”
> > >Subject: RE: [ntfsd] IoCreateFileSpecifyDeviceObjectHint can open
>the
> >UNC
> > >files?
> > >Date: Wed, 22 Mar 2006 11:55:02 -0500
> > >
> > >By “it doesn’t work” I assume you mean it doesn’t compile, right? If
> > >that is not the case you might want to be more specific about what
>you
> > >mean.
> > >
> > >Also, what device object are you using as the hint? The name needs
>to
> > >be valid relative to that device object (although this wouldn’t make
>it
> > >not compile, this would make it not run properly.)
> > >
> > >Regards,
> > >
> > >Tony
> > >
> > >Tony Mason
> > >Consulting Partner
> > >OSR Open Systems Resources, Inc.
> > >http://www.osr.com
> > >
> > >
> > >Looking forward to seeing you at the next OSR File Systems class in
> > >Boston, MA April 18-21, 2006.
> > >
> > >-----Original Message-----
> > >From: xxxxx@lists.osr.com
> > >[mailto:xxxxx@lists.osr.com] On Behalf Of Bin Zeng
> > >Sent: Wednesday, March 22, 2006 10:59 AM
> > >To: ntfsd redirect
> > >Subject: [ntfsd] IoCreateFileSpecifyDeviceObjectHint can open the UNC
> > >files?
> > >
> > >Hi,All
> > >
> > >I tried to open the UNC file with the funtion
> > >IoCreateFileSpecifyDeviceObjectHint.
> > >It doesn’t work, but it works fine with zwcreate()
> > >
> > >I used the string as following:
> > >
> > >RtlInitUnicodeString(
> > >&testName,L"\Device\UNC\172.21.12.17\test\test.txt");
> > >
> > >Can IoCreateFileSpecifyDeviceObjectHint open the UNC files?
> > >
> > >Thanks
> > >
> > >Ben
> > >
> > >
> > >
> > >
> > >—
> > >Questions? First check the IFS FAQ at
> > >https://www.osronline.com/article.cfm?id=17
> > >
> > >You are currently subscribed to ntfsd as: xxxxx@osr.com
> > >To unsubscribe send a blank email to xxxxx@lists.osr.com
> > >
> > >—
> > >Questions? First check the IFS FAQ at
> > >https://www.osronline.com/article.cfm?id=17
> > >
> > >You are currently subscribed to ntfsd as: unknown lmsubst tag
>argument:
> >‘’
> > >To unsubscribe send a blank email to
>xxxxx@lists.osr.com
> >
> >
> >
> >
> >—
> >Questions? First check the IFS FAQ at
> >https://www.osronline.com/article.cfm?id=17
> >
> >You are currently subscribed to ntfsd as: xxxxx@osr.com
> >To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >—
> >Questions? First check the IFS FAQ at
> >https://www.osronline.com/article.cfm?id=17
> >
> >You are currently subscribed to ntfsd as: unknown lmsubst tag argument:
>‘’
> >To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
>
>—
>Questions? First check the IFS FAQ at
>https://www.osronline.com/article.cfm?id=17
>
>You are currently subscribed to ntfsd as: xxxxx@osr.com
>To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>—
>Questions? First check the IFS FAQ at
>https://www.osronline.com/article.cfm?id=17
>
>You are currently subscribed to ntfsd as: unknown lmsubst tag argument: ‘’
>To unsubscribe send a blank email to xxxxx@lists.osr.com

I suspect you are experiencing the bug to which Ben pointed. In that
case it would seem there’s no fix for this bug at the present time so
you will need to find a way to code around this specific issue (you
could, for example try the IoCreateFileSpecifyDeviceObjectHint call and
if it returns STATUS_INVALID_PARAMETER fall back to IoCreateFile. This
doesn’t avoid the reentrancy problem, but it at least limits it to
Windows XP SP2.)

Of course, you can always fall back to a shadow device approach as well,
but as anyone who has ever implemented this can tell you it is a rather
complex solution to implement properly.

Regards

Tony

Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com

Looking forward to seeing you at the next OSR File Systems class in
Boston, MA April 18-21, 2006.