using device name instead of drive letter (\\Device\\HarddiskVolume)

Hi,

I am trying to use device name in my application rather than using drive
letters like c:, so I am using createfile as below and it fails

handle =
CreateFile(“\Device\HarddiskVolume1\Windows\system32\notepad.exe”,
GENERIC_READ,
FILE_SHARE_READ|FILE_SHARE_WRITE, NULL , OPEN_EXISTING ,
FILE_ATTRIBUTE_NORMAL, 0);

is there any thing wrong in the above call? I feel that Createfile should be
able to take device name instead of drive letter.

Any information is helpful.

thanks,
Kedar.

use volume GUIDs instead.

On 5/19/06, kedar wrote:
>
> Hi,
>
> I am trying to use device name in my application rather than using drive
> letters like c:, so I am using createfile as below and it fails
>
> handle =
> CreateFile(“\Device\HarddiskVolume1\Windows\system32\notepad.exe”,
> GENERIC_READ,
> FILE_SHARE_READ|FILE_SHARE_WRITE, NULL , OPEN_EXISTING ,
> FILE_ATTRIBUTE_NORMAL, 0);
>
> is there any thing wrong in the above call? I feel that Createfile should
> be
> able to take device name instead of drive letter.
>
> Any information is helpful.
>
> thanks,
> Kedar.
>
>
>
> —
> Questions? First check the IFS FAQ at
> https://www.osronline.com/article.cfm?id=17
>
> You are currently subscribed to ntfsd as: xxxxx@gmail.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>



- amitr0

Seems a tad too obvious however http://support.microsoft.com/kb/q259131/

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of kedar
Sent: Friday, May 19, 2006 6:29 AM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] using device name instead of drive letter
(\Device\HarddiskVolume)

Hi,

I am trying to use device name in my application rather than using drive
letters like c:, so I am using createfile as below and it fails

handle =
CreateFile(“\Device\HarddiskVolume1\Windows\system32\notepad.exe”,
GENERIC_READ,
FILE_SHARE_READ|FILE_SHARE_WRITE, NULL , OPEN_EXISTING ,
FILE_ATTRIBUTE_NORMAL, 0);

is there any thing wrong in the above call? I feel that Createfile should be

able to take device name instead of drive letter.

Any information is helpful.

thanks,
Kedar.


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

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

Win32 API cannot use NT device names.
Use NtCreateFile.

L.

----- Original Message -----
From: “kedar”
Newsgroups: ntfsd
To: “Windows File Systems Devs Interest List”
Sent: Friday, May 19, 2006 1:29 PM
Subject: [ntfsd] using device name instead of drive letter
(\Device\HarddiskVolume)

> Hi,
>
> I am trying to use device name in my application rather than using drive
> letters like c:, so I am using createfile as below and it fails
>
> handle =
> CreateFile(“\Device\HarddiskVolume1\Windows\system32\notepad.exe”,
> GENERIC_READ,
> FILE_SHARE_READ|FILE_SHARE_WRITE, NULL , OPEN_EXISTING ,
> FILE_ATTRIBUTE_NORMAL, 0);
>
> is there any thing wrong in the above call? I feel that Createfile should
> be able to take device name instead of drive letter.
>
> Any information is helpful.
>
> thanks,
> Kedar.
>
>
> —
> Questions? First check the IFS FAQ at
> https://www.osronline.com/article.cfm?id=17
>
> You are currently subscribed to ntfsd as: xxxxx@volny.cz
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

Hi Ladislav Zezula,

But is it advisable to use NtCreateFile in applications?

I have filter driver and I want to move away from drive letters so that I
can avoid any problems that araise because of drive letter. For this I am
thinking to prepend the device name to the file name that is in the
Fileobject and send to my usermode application, which can open the same
file, which has device name and validate the file. So if CreateFile can not
take device names I cannot achieve what I want.

Please let me know if I am wrong.

thanks,
Kedar.

“Ladislav Zezula” wrote in message news:xxxxx@ntfsd…
> Win32 API cannot use NT device names.
> Use NtCreateFile.
>
> L.
>
> ----- Original Message -----
> From: “kedar”
> Newsgroups: ntfsd
> To: “Windows File Systems Devs Interest List”
> Sent: Friday, May 19, 2006 1:29 PM
> Subject: [ntfsd] using device name instead of drive letter
> (\Device\HarddiskVolume)
>
>
>> Hi,
>>
>> I am trying to use device name in my application rather than using drive
>> letters like c:, so I am using createfile as below and it fails
>>
>> handle =
>> CreateFile(“\Device\HarddiskVolume1\Windows\system32\notepad.exe”,
>> GENERIC_READ,
>> FILE_SHARE_READ|FILE_SHARE_WRITE, NULL , OPEN_EXISTING ,
>> FILE_ATTRIBUTE_NORMAL, 0);
>>
>> is there any thing wrong in the above call? I feel that Createfile should
>> be able to take device name instead of drive letter.
>>
>> Any information is helpful.
>>
>> thanks,
>> Kedar.
>>
>>
>> —
>> Questions? First check the IFS FAQ at
>> https://www.osronline.com/article.cfm?id=17
>>
>> You are currently subscribed to ntfsd as: xxxxx@volny.cz
>> To unsubscribe send a blank email to xxxxx@lists.osr.com
>>
>
>

Well it is not, but if you are gonna using native NT device names,
you can use native NT API with no worries.

L.

----- Original Message -----
From: “kedar”
Newsgroups: ntfsd
To: “Windows File Systems Devs Interest List”
Sent: Friday, May 19, 2006 1:55 PM
Subject: Re:[ntfsd] using device name instead of drive letter
(\Device\HarddiskVolume)

> Hi Ladislav Zezula,
>
> But is it advisable to use NtCreateFile in applications?
>
> I have filter driver and I want to move away from drive letters so that I
> can avoid any problems that araise because of drive letter. For this I am
> thinking to prepend the device name to the file name that is in the
> Fileobject and send to my usermode application, which can open the same
> file, which has device name and validate the file. So if CreateFile can
> not take device names I cannot achieve what I want.
>
> Please let me know if I am wrong.
>
> thanks,
> Kedar.
>
>
>
>
> “Ladislav Zezula” wrote in message news:xxxxx@ntfsd…
>> Win32 API cannot use NT device names.
>> Use NtCreateFile.
>>
>> L.
>>
>> ----- Original Message -----
>> From: “kedar”
>> Newsgroups: ntfsd
>> To: “Windows File Systems Devs Interest List”
>> Sent: Friday, May 19, 2006 1:29 PM
>> Subject: [ntfsd] using device name instead of drive letter
>> (\Device\HarddiskVolume)
>>
>>
>>> Hi,
>>>
>>> I am trying to use device name in my application rather than using drive
>>> letters like c:, so I am using createfile as below and it fails
>>>
>>> handle =
>>> CreateFile(“\Device\HarddiskVolume1\Windows\system32\notepad.exe”,
>>> GENERIC_READ,
>>> FILE_SHARE_READ|FILE_SHARE_WRITE, NULL , OPEN_EXISTING ,
>>> FILE_ATTRIBUTE_NORMAL, 0);
>>>
>>> is there any thing wrong in the above call? I feel that Createfile
>>> should be able to take device name instead of drive letter.
>>>
>>> Any information is helpful.
>>>
>>> thanks,
>>> Kedar.
>>>
>>>
>>> —
>>> Questions? First check the IFS FAQ at
>>> https://www.osronline.com/article.cfm?id=17
>>>
>>> You are currently subscribed to ntfsd as: xxxxx@volny.cz
>>> 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@volny.cz
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

> I am trying to use device name in my application rather than using drive

letters like c:, so I am using createfile as below and it fails

handle =
CreateFile(“\Device\HarddiskVolume1\Windows\system32\notepad.exe”,

Try \?\Device\Harddisk… instead. Anyway - the bad way. Use volume GUIDs is
you do not like the drive letters.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

> I have filter driver and I want to move away from drive letters so that I

can avoid any problems that araise because of drive letter.

Then use the volume GUIDs.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

Hi ;
I was under the assumption that you cannot access a device unless you
create a symbolic link to it in \?\ directory. (Still hold true 4 me)

Ladislav
Win32 API cannot use NT device names.
Use NtCreateFile.

So is there no restriction on the native Api. i.e can they access
\Device\xyz wihthout a symbolic link ???

handle =
NtCreateFile(“\Device\HarddiskVolume1\Windows\system32\notepad.exe”,
GENERIC_READ,
FILE_SHARE_READ|FILE_SHARE_WRITE, NULL , OPEN_EXISTING ,
FILE_ATTRIBUTE_NORMAL, 0);
L.

Thanks & Regards
Faraz.

On 5/20/06, Maxim S. Shatskih wrote:
>
> > I have filter driver and I want to move away from drive letters so that
> I
> > can avoid any problems that araise because of drive letter.
>
> Then use the volume GUIDs.
>
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
>
> —
> Questions? First check the IFS FAQ at
> https://www.osronline.com/article.cfm?id=17
>
> You are currently subscribed to ntfsd as: xxxxx@gmail.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

Hi All,

I tried using GUID’s and still the createfile fails, I used it as below

handle =
CreateFile(“\??\Volume{39399f6e-84bb-11d9-87cb-806d6172696f}\testfile.txt”,
GENERIC_READ, FILE_SHARE_READ, NULL , OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
0);

I have also ran the MSDN sample code for enumeration mount points and the
output is as below

Volume found is "\?\Volume{39399f6e-84bb-11d9-87cb-806d6172696f}".
No volume mount points found!
Volume found is "\?\Volume{39399f6f-84bb-11d9-87cb-806d6172696f}".
No volume mount points found!
Volume found is "\?\Volume{4155c5fd-df19-11d9-8824-001143ab3ee2}".
No volume mount points found!
Volume found is "\?\Volume{503d96c3-5dce-11d9-bd40-806d6172696f}".
No volume mount points found!
Volume found is "\?\Volume{503d96c2-5dce-11d9-bd40-806d6172696f}".
No volume mount points found!
Press any key to continue

Any information is helpful.

thanks,

Kedar.

“kedar” wrote in message news:xxxxx@ntfsd…
> Hi,
>
> I am trying to use device name in my application rather than using drive
> letters like c:, so I am using createfile as below and it fails
>
> handle =
> CreateFile(“\Device\HarddiskVolume1\Windows\system32\notepad.exe”,
> GENERIC_READ,
> FILE_SHARE_READ|FILE_SHARE_WRITE, NULL , OPEN_EXISTING ,
> FILE_ATTRIBUTE_NORMAL, 0);
>
> is there any thing wrong in the above call? I feel that Createfile should
> be able to take device name instead of drive letter.
>
> Any information is helpful.
>
> thanks,
> Kedar.
>
>

Hi All,

I tried using GUID’s and still the createfile fails, I used it as below

handle =
CreateFile(“\??\Volume{39399f6e-84bb-11d9-87cb-806d6172696f}\testfile.txt”,
GENERIC_READ, FILE_SHARE_READ, NULL , OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
0);

I have also ran the MSDN sample code for enumeration mount points and the
output is as below

Volume found is "\?\Volume{39399f6e-84bb-11d9-87cb-806d6172696f}".
No volume mount points found!
Volume found is "\?\Volume{39399f6f-84bb-11d9-87cb-806d6172696f}".
No volume mount points found!
Volume found is "\?\Volume{4155c5fd-df19-11d9-8824-001143ab3ee2}".
No volume mount points found!
Volume found is "\?\Volume{503d96c3-5dce-11d9-bd40-806d6172696f}".
No volume mount points found!
Volume found is "\?\Volume{503d96c2-5dce-11d9-bd40-806d6172696f}".
No volume mount points found!
Press any key to continue

Any information is helpful.

thanks,

Kedar.

“kedar” wrote in message news:xxxxx@ntfsd…
> Hi,
>
> I am trying to use device name in my application rather than using drive
> letters like c:, so I am using createfile as below and it fails
>
> handle =
> CreateFile(“\Device\HarddiskVolume1\Windows\system32\notepad.exe”,
> GENERIC_READ,
> FILE_SHARE_READ|FILE_SHARE_WRITE, NULL , OPEN_EXISTING ,
> FILE_ATTRIBUTE_NORMAL, 0);
>
> is there any thing wrong in the above call? I feel that Createfile should
> be able to take device name instead of drive letter.
>
> Any information is helpful.
>
> thanks,
> Kedar.
>
>

Hi,

Also another intresting point is that when I programatically enumerate
volumes I see no volume points found but the output of mountvol shows that
drive letters against GUID’s.

any information is helpful.

thanks,
Kedar.
“kedar” wrote in message news:xxxxx@ntfsd…
> Hi,
>
> I am trying to use device name in my application rather than using drive
> letters like c:, so I am using createfile as below and it fails
>
> handle =
> CreateFile(“\Device\HarddiskVolume1\Windows\system32\notepad.exe”,
> GENERIC_READ,
> FILE_SHARE_READ|FILE_SHARE_WRITE, NULL , OPEN_EXISTING ,
> FILE_ATTRIBUTE_NORMAL, 0);
>
> is there any thing wrong in the above call? I feel that Createfile should
> be able to take device name instead of drive letter.
>
> Any information is helpful.
>
> thanks,
> Kedar.
>
>