RE: IoCreateFileSpecifyDeviceObjectHint returning STATUS_ OBJECT_PATH_SYNTAX_BAD

The file object name being opened should be “\WINDOWS” which in your case is
relative to the FileSystem volume specified by:
devExt->AttachedToDeviceObject. The device name path is not allowed at this
level.

/ted

-----Original Message-----
From: Dana Epp [mailto:xxxxx@vulscan.com]
Sent: Wednesday, August 04, 2004 3:27 PM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] IoCreateFileSpecifyDeviceObjectHint returning
STATUS_OBJECT_PATH_SYNTAX_BAD

Under the assumption that Neal is going to find a viable solution for the
hotfix I have begun to write the required code to handle the
IoCreateFileSpecifyDeviceObjectHint and find I really don’t quite know how
to use this function properly.

I seem to always get a return of STATUS_OBJECT_PATH_SYNTAX_BAD, and from the
docs I am guessing it is because my CreateOptions and Dispositions are
wrong.

The below snippet has “\Device\HarddiskVolume1\WINDOWS” as tokenStr, and I
wish to open the directory so I can get the handle to make my FileObject and
then pass it to my routine doing the directory query IRP. Can anyone tell me
what causes the STATUS_OBJECT_PATH_SYNTAX_BAD to be returned?

InitializeObjectAttributes(
&attributes,
&tokenStr,
OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE,
NULL,
NULL );

status = IoCreateFileSpecifyDeviceObjectHint(
&handle, // File Handle
GENERIC_READ, // Desired Access
&attributes, // Attributes
&iosb, // IO Status Block
NULL, // Allocation size
FILE_ATTRIBUTE_DIRECTORY, // File attributes
FILE_SHARE_READ,
FILE_OPEN, // Create disposition
FILE_DIRECTORY_FILE, // Create options
NULL, // EA buffer
0, // EA size
CreateFileTypeNone, // CreateFileType
NULL, // Extra create parameters
0, // Options
devExt->AttachedToDeviceObject // Device object to use for open
);


Regards,
Dana Epp
[Blog: http://silverstr.ufies.org/blog/]


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

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

Thanks for the response Ted.

I have changed the path accordingly, but still get the STATUS_OBJECT_PATH_SYNTAX_BAD.

Could there be something wrong with the parameters I am passing to IoCreateFileSpecifyDeviceObjectHint?

Ted Hess wrote:

The file object name being opened should be “\WINDOWS” which in your case is
relative to the FileSystem volume specified by:
devExt->AttachedToDeviceObject. The device name path is not allowed at this
level.

/ted

-----Original Message-----
From: Dana Epp [mailto:xxxxx@vulscan.com]
Sent: Wednesday, August 04, 2004 3:27 PM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] IoCreateFileSpecifyDeviceObjectHint returning
STATUS_OBJECT_PATH_SYNTAX_BAD

Under the assumption that Neal is going to find a viable solution for the
hotfix I have begun to write the required code to handle the
IoCreateFileSpecifyDeviceObjectHint and find I really don’t quite know how
to use this function properly.

I seem to always get a return of STATUS_OBJECT_PATH_SYNTAX_BAD, and from the
docs I am guessing it is because my CreateOptions and Dispositions are
wrong.

The below snippet has “\Device\HarddiskVolume1\WINDOWS” as tokenStr, and I
wish to open the directory so I can get the handle to make my FileObject and
then pass it to my routine doing the directory query IRP. Can anyone tell me
what causes the STATUS_OBJECT_PATH_SYNTAX_BAD to be returned?

InitializeObjectAttributes(
&attributes,
&tokenStr,
OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE,
NULL,
NULL );

status = IoCreateFileSpecifyDeviceObjectHint(
&handle, // File Handle
GENERIC_READ, // Desired Access
&attributes, // Attributes
&iosb, // IO Status Block
NULL, // Allocation size
FILE_ATTRIBUTE_DIRECTORY, // File attributes
FILE_SHARE_READ,
FILE_OPEN, // Create disposition
FILE_DIRECTORY_FILE, // Create options
NULL, // EA buffer
0, // EA size
CreateFileTypeNone, // CreateFileType
NULL, // Extra create parameters
0, // Options
devExt->AttachedToDeviceObject // Device object to use for open
);


Regards,
Dana Epp
[Blog: http://silverstr.ufies.org/blog/]

No, what Ted said is not correct. The name should be a fully qualified
name including the device, just like you would pass into ZwCreateFile or
IoCreateFile. Yes, you are specifying the device stack with the
devExt->AtachedToDeviceObject, but the routine just verifies that that
device is in the same device stack to which the name resolves. If it
does not, you will get STATUS_INVALID_DEVICE_OBJECT_PARAMETER.

Just to rule out the obvious – did you double the '' in your string?
So the string to initialize tokenStr should be
L"\Device\HarddiskVolume1\WINDOWS". You probably just took this out
as you typed your email, but STATUS_OBJECT_PATH_SYNTAX_BAD usually means
that you have invalid characters in your path.

Thanks,
Molly Brown
Microsoft Corporation

This posting is provided “AS IS” with no warranties and confers no
rights.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Ted Hess
Sent: Wednesday, August 04, 2004 1:09 PM
To: Windows File Systems Devs Interest List
Subject: RE: [ntfsd] IoCreateFileSpecifyDeviceObjectHint returning
STATUS_ OBJECT_PATH_SYNTAX_BAD

The file object name being opened should be “\WINDOWS” which in your
case is
relative to the FileSystem volume specified by:
devExt->AttachedToDeviceObject. The device name path is not allowed at
this
level.

/ted

-----Original Message-----
From: Dana Epp [mailto:xxxxx@vulscan.com]
Sent: Wednesday, August 04, 2004 3:27 PM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] IoCreateFileSpecifyDeviceObjectHint returning
STATUS_OBJECT_PATH_SYNTAX_BAD

Under the assumption that Neal is going to find a viable solution for
the
hotfix I have begun to write the required code to handle the
IoCreateFileSpecifyDeviceObjectHint and find I really don’t quite know
how
to use this function properly.

I seem to always get a return of STATUS_OBJECT_PATH_SYNTAX_BAD, and from
the
docs I am guessing it is because my CreateOptions and Dispositions are
wrong.

The below snippet has “\Device\HarddiskVolume1\WINDOWS” as tokenStr, and
I
wish to open the directory so I can get the handle to make my FileObject
and
then pass it to my routine doing the directory query IRP. Can anyone
tell me
what causes the STATUS_OBJECT_PATH_SYNTAX_BAD to be returned?

InitializeObjectAttributes(
&attributes,
&tokenStr,
OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE,
NULL,
NULL );

status = IoCreateFileSpecifyDeviceObjectHint(
&handle, // File Handle
GENERIC_READ, // Desired Access
&attributes, // Attributes
&iosb, // IO Status Block
NULL, // Allocation size
FILE_ATTRIBUTE_DIRECTORY, // File attributes
FILE_SHARE_READ,
FILE_OPEN, // Create disposition
FILE_DIRECTORY_FILE, // Create options
NULL, // EA buffer
0, // EA size
CreateFileTypeNone, // CreateFileType
NULL, // Extra create parameters
0, // Options
devExt->AttachedToDeviceObject // Device object to use for open
);


Regards,
Dana Epp
[Blog: http://silverstr.ufies.org/blog/]


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

You are currently subscribed to ntfsd as: xxxxx@livevault.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: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Thanks for the clarification Molly. I got this working now.

I did rule out the obvious making sure the path was correct. However, after thinking about it I went looking a bit deeper and found what the problem was.

I am using RtlStringCchPrintfW to construct the tokenStr, and forgot to adjust the .Length of the UNICODE_STRING to properly address the copy. As such, the string was indeed a bad syntax. It had a zero length. My watch in WinDbg was showing the resulting .Buffer correctly, but I never realized that the .Length was invalid until further investigation.

Thanks for the prompt response. I’ll go cower in a corner for a moment while I let the group hit me with a wet noodle for being so dumb.

Molly Brown wrote:

No, what Ted said is not correct. The name should be a fully qualified
name including the device, just like you would pass into ZwCreateFile or
IoCreateFile. Yes, you are specifying the device stack with the
devExt->AtachedToDeviceObject, but the routine just verifies that that
device is in the same device stack to which the name resolves. If it
does not, you will get STATUS_INVALID_DEVICE_OBJECT_PARAMETER.

Just to rule out the obvious – did you double the '' in your string?
So the string to initialize tokenStr should be
L"\Device\HarddiskVolume1\WINDOWS". You probably just took this out
as you typed your email, but STATUS_OBJECT_PATH_SYNTAX_BAD usually means
that you have invalid characters in your path.

Thanks,
Molly Brown
Microsoft Corporation

This posting is provided “AS IS” with no warranties and confers no
rights.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Ted Hess
Sent: Wednesday, August 04, 2004 1:09 PM
To: Windows File Systems Devs Interest List
Subject: RE: [ntfsd] IoCreateFileSpecifyDeviceObjectHint returning
STATUS_ OBJECT_PATH_SYNTAX_BAD

The file object name being opened should be “\WINDOWS” which in your
case is
relative to the FileSystem volume specified by:
devExt->AttachedToDeviceObject. The device name path is not allowed at
this
level.

/ted

-----Original Message-----
From: Dana Epp [mailto:xxxxx@vulscan.com]
Sent: Wednesday, August 04, 2004 3:27 PM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] IoCreateFileSpecifyDeviceObjectHint returning
STATUS_OBJECT_PATH_SYNTAX_BAD

Under the assumption that Neal is going to find a viable solution for
the
hotfix I have begun to write the required code to handle the
IoCreateFileSpecifyDeviceObjectHint and find I really don’t quite know
how
to use this function properly.

I seem to always get a return of STATUS_OBJECT_PATH_SYNTAX_BAD, and from
the
docs I am guessing it is because my CreateOptions and Dispositions are
wrong.

The below snippet has “\Device\HarddiskVolume1\WINDOWS” as tokenStr, and
I
wish to open the directory so I can get the handle to make my FileObject
and
then pass it to my routine doing the directory query IRP. Can anyone
tell me
what causes the STATUS_OBJECT_PATH_SYNTAX_BAD to be returned?

InitializeObjectAttributes(
&attributes,
&tokenStr,
OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE,
NULL,
NULL );

status = IoCreateFileSpecifyDeviceObjectHint(
&handle, // File Handle
GENERIC_READ, // Desired Access
&attributes, // Attributes
&iosb, // IO Status Block
NULL, // Allocation size
FILE_ATTRIBUTE_DIRECTORY, // File attributes
FILE_SHARE_READ,
FILE_OPEN, // Create disposition
FILE_DIRECTORY_FILE, // Create options
NULL, // EA buffer
0, // EA size
CreateFileTypeNone, // CreateFileType
NULL, // Extra create parameters
0, // Options
devExt->AttachedToDeviceObject // Device object to use for open
);


Regards,
Dana Epp
[Blog: http://silverstr.ufies.org/blog/]

Whoops, I was thinking about what you put in the FileName field of a
FileObject when I do my own Create IRP handling.

Sorry for the bogus reply, /ted

-----Original Message-----
From: Molly Brown [mailto:xxxxx@windows.microsoft.com]
Sent: Wednesday, August 04, 2004 4:57 PM
To: Windows File Systems Devs Interest List
Subject: RE: [ntfsd] IoCreateFileSpecifyDeviceObjectHint returning STATUS_
OBJECT_PATH_SYNTAX_BAD

No, what Ted said is not correct. The name should be a fully qualified name
including the device, just like you would pass into ZwCreateFile or
IoCreateFile. Yes, you are specifying the device stack with the
devExt->AtachedToDeviceObject, but the routine just verifies that that
device is in the same device stack to which the name resolves. If it does
not, you will get STATUS_INVALID_DEVICE_OBJECT_PARAMETER.

Just to rule out the obvious – did you double the '' in your string? So
the string to initialize tokenStr should be
L"\Device\HarddiskVolume1\WINDOWS". You probably just took this out as
you typed your email, but STATUS_OBJECT_PATH_SYNTAX_BAD usually means that
you have invalid characters in your path.

Thanks,
Molly Brown
Microsoft Corporation

This posting is provided “AS IS” with no warranties and confers no rights.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Ted Hess
Sent: Wednesday, August 04, 2004 1:09 PM
To: Windows File Systems Devs Interest List
Subject: RE: [ntfsd] IoCreateFileSpecifyDeviceObjectHint returning STATUS_
OBJECT_PATH_SYNTAX_BAD

The file object name being opened should be “\WINDOWS” which in your case is
relative to the FileSystem volume specified by:
devExt->AttachedToDeviceObject. The device name path is not allowed at
this
level.

/ted

-----Original Message-----
From: Dana Epp [mailto:xxxxx@vulscan.com]
Sent: Wednesday, August 04, 2004 3:27 PM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] IoCreateFileSpecifyDeviceObjectHint returning
STATUS_OBJECT_PATH_SYNTAX_BAD

Under the assumption that Neal is going to find a viable solution for the
hotfix I have begun to write the required code to handle the
IoCreateFileSpecifyDeviceObjectHint and find I really don’t quite know how
to use this function properly.

I seem to always get a return of STATUS_OBJECT_PATH_SYNTAX_BAD, and from the
docs I am guessing it is because my CreateOptions and Dispositions are
wrong.

The below snippet has “\Device\HarddiskVolume1\WINDOWS” as tokenStr, and I
wish to open the directory so I can get the handle to make my FileObject and
then pass it to my routine doing the directory query IRP. Can anyone tell me
what causes the STATUS_OBJECT_PATH_SYNTAX_BAD to be returned?

InitializeObjectAttributes(
&attributes,
&tokenStr,
OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE,
NULL,
NULL );

status = IoCreateFileSpecifyDeviceObjectHint(
&handle, // File Handle
GENERIC_READ, // Desired Access
&attributes, // Attributes
&iosb, // IO Status Block
NULL, // Allocation size
FILE_ATTRIBUTE_DIRECTORY, // File attributes
FILE_SHARE_READ,
FILE_OPEN, // Create disposition
FILE_DIRECTORY_FILE, // Create options
NULL, // EA buffer
0, // EA size
CreateFileTypeNone, // CreateFileType
NULL, // Extra create parameters
0, // Options
devExt->AttachedToDeviceObject // Device object to use for open
);


Regards,
Dana Epp
[Blog: http://silverstr.ufies.org/blog/]


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

You are currently subscribed to ntfsd as: xxxxx@livevault.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: xxxxx@windows.microsoft.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: xxxxx@livevault.com To unsubscribe
send a blank email to xxxxx@lists.osr.com