Hello,
I’m using ZwCreateFile(…) for the following file: "\DosDevices\J:"
This drive is created by a Sony Memory Stick reader, but when no MemoryStick
is in the drive, a windows Message Box with the text:
“No disc in drive, please insert a disc in drive J:”
(I’m using a german WinXP, and this is only a rough translation.)
OS: WindowsXP Sp1
…
ntStatus = ZwCreateFile( &ntFileHandle, SYNCHRONIZE|FILE_READ_DATA,
&objectAttributes, &ioStatus, NULL, 0,
FILE_SHARE_READ|FILE_SHARE_WRITE,
FILE_OPEN,
FILE_SYNCHRONOUS_IO_NONALERT|FILE_DIRECTORY_FILE,
NULL, 0 );
Is there a way to get this file handle and avoid this message?
Best Regards
Michael
If you think about it, then the answer is no .
----- Original Message -----
From: “Michael Kurz”
To: “Windows System Software Developers Interest List”
Sent: Tuesday, September 09, 2003 2:49 PM
Subject: [ntdev] ZwCreateFile(…) problem with Memory Stick Drives.
("\DosDevices\J:")
> Hello,
>
> I’m using ZwCreateFile(…) for the following file: "\DosDevices\J:"
> This drive is created by a Sony Memory Stick reader, but when no
MemoryStick
> is in the drive, a windows Message Box with the text:
> “No disc in drive, please insert a disc in drive J:”
> (I’m using a german WinXP, and this is only a rough translation.)
>
> OS: WindowsXP Sp1
>
>
> …
> ntStatus = ZwCreateFile( &ntFileHandle, SYNCHRONIZE|FILE_READ_DATA,
> &objectAttributes, &ioStatus, NULL, 0,
> FILE_SHARE_READ|FILE_SHARE_WRITE,
> FILE_OPEN,
>
> FILE_SYNCHRONOUS_IO_NONALERT|FILE_DIRECTORY_FILE,
> NULL, 0 );
>
>
> Is there a way to get this file handle and avoid this message?
>
> Best Regards
> Michael
>
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@rdsor.ro
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
Michael,
Check out IoSetThreadHardErrorMode (documented in the DDK):
PreviousHardErrorMode = IoSetThreadHardErrorMode( FALSE );
Status = ZwCreateFile( … );
IoSetThreadHardErrorMode( PreviousHardErrorMode );
Myk
“Michael Kurz” wrote in message
news:xxxxx@ntdev…
>
> Hello,
>
> I’m using ZwCreateFile(…) for the following file: "\DosDevices\J:"
> This drive is created by a Sony Memory Stick reader, but when no
MemoryStick
> is in the drive, a windows Message Box with the text:
> “No disc in drive, please insert a disc in drive J:”
> (I’m using a german WinXP, and this is only a rough translation.)
>
> OS: WindowsXP Sp1
>
>
> …
> ntStatus = ZwCreateFile( &ntFileHandle, SYNCHRONIZE|FILE_READ_DATA,
> &objectAttributes, &ioStatus, NULL, 0,
> FILE_SHARE_READ|FILE_SHARE_WRITE,
> FILE_OPEN,
>
> FILE_SYNCHRONOUS_IO_NONALERT|FILE_DIRECTORY_FILE,
> NULL, 0 );
>
>
> Is there a way to get this file handle and avoid this message?
>
> Best Regards
> Michael
>
>
>
Note when you ask for "\DosDevices\J:" you are referring to the root
directory of the file system. If there’s no media present, it’s not
possible to get a handle to the root directory (for obvious reasons).
However, if you open “\DosDevices\J:” you may be able to get a handle to
the device even when no media is present.
Chuck
----- Original Message -----
From: “Michael Kurz”
To: “Windows System Software Developers Interest List”
Sent: Tuesday, September 09, 2003 6:49 PM
Subject: [ntdev] ZwCreateFile(…) problem with Memory Stick Drives.
("\DosDevices\J:")
> Hello,
>
> I’m using ZwCreateFile(…) for the following file: "\DosDevices\J:"
> This drive is created by a Sony Memory Stick reader, but when no
MemoryStick
> is in the drive, a windows Message Box with the text:
> “No disc in drive, please insert a disc in drive J:”
> (I’m using a german WinXP, and this is only a rough translation.)
>
> OS: WindowsXP Sp1
>
>
> …
> ntStatus = ZwCreateFile( &ntFileHandle, SYNCHRONIZE|FILE_READ_DATA,
> &objectAttributes, &ioStatus, NULL, 0,
> FILE_SHARE_READ|FILE_SHARE_WRITE,
> FILE_OPEN,
>
> FILE_SYNCHRONOUS_IO_NONALERT|FILE_DIRECTORY_FILE,
> NULL, 0 );
>
>
> Is there a way to get this file handle and avoid this message?
>
> Best Regards
> Michael