Does CreateFile() executes differently with FAT32 and NTFS ?

Hi All,

I wrote a encryption virtual disk driver. After mounted, the virtual disk devices created by the driver doesn’t process any read/write/deviceioctl until a deviceioctl to authenticate user password has been passed. Another deviceIoctl is to make the authentication null, after this, the driver denies read/write/deviceioctl again until another authentication executed successfully. I use CreateFile() to open handle of the device before every deviceIoctl, and after execution of deviceIoctl, I call CloseHandle to close it.

In Windows 2000, the driver works well.
In Windows XP, the driver works well if the virtual disk is formatted into NTFS.
But if the virtual disk is formatted into FAT32, there is a problem!

Firstly, the virtual disk is mounted as a volume(such as Z: partition);
Secondly, the application call authentication deviceIoctl to verify user property;
-----Now we can use the virtual disk like a physical disk.
Then the application call the deviceIoctl to nullify the authentication;
-----Now the virtual disk denies all access.

Here comes the problem, Now if I want to get handle of the device, the CreateFile() function return failed! GetLastError() return error code 1(ERROR_INVALID_FUNCTION).

Who can tell me why I get different result for NTFS and FAT32?

Hi,
I m not a FSD guy and this response may not be of much use. But in general
FAT and NTFS are differ only in way of security. You may be using some
security descriptors or flags which is/are not supported on FAT. Providing
code snippet would be a good idea, some champ here may give you some better
answer then me in that case ;-).

Dev

-----Original Message-----
From: Bruce Zhang [mailto:xxxxx@vip.sina.com]
Sent: Thursday, October 14, 2004 9:05 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Does CreateFile() executes differently with FAT32 and NTFS
?

Hi All,

I wrote a encryption virtual disk driver. After mounted, the virtual disk
devices created by the driver doesn't process any read/write/deviceioctl
until a deviceioctl to authenticate user password has been passed. Another
deviceIoctl is to make the authentication null, after this, the driver
denies read/write/deviceioctl again until another authentication executed
successfully. I use CreateFile() to open handle of the device before every
deviceIoctl, and after execution of deviceIoctl, I call CloseHandle to close
it.

In Windows 2000, the driver works well.
In Windows XP, the driver works well if the virtual disk is formatted into
NTFS.
But if the virtual disk is formatted into FAT32, there is a problem!

Firstly, the virtual disk is mounted as a volume(such as Z: partition);
Secondly, the application call authentication deviceIoctl to verify user
property;
-----Now we can use the virtual disk like a physical disk.
Then the application call the deviceIoctl to nullify the authentication;
-----Now the virtual disk denies all access.

Here comes the problem, Now if I want to get handle of the device, the
CreateFile() function return failed! GetLastError() return error code
1(ERROR_INVALID_FUNCTION).

Who can tell me why I get different result for NTFS and FAT32?

Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to $subst('List.Name') as:
$subst('Recip.EmailAddr')
To unsubscribe send a blank email to $subst('Email.UnSub')

Thank you for your answer. Could you tell me I can read which document about the difference of FAT and NTFS in security?

The dispatch routine to process IRP_MJ_CREATE is very simple, it just return success.
I call CreateFile() with the following parameters:

handle = CreateFile(
VolumeName,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
FILE_FLAG_NO_BUFFERING,
NULL);
when the deviceIoctl complete, use CloseHandle() to close it.

I noticed that in Win2000, it's ok. In WinXP, when using NTFS, it's ok, too.
----- Original Message -----
From: Dsingh@in.safenet-inc.com
To: Windows System Software Devs Interest List
Sent: Thursday, October 14, 2004 2:40 PM
Subject: RE: [ntdev] Does CreateFile() executes differently with FAT32 and NTFS ?

Hi,
I m not a FSD guy and this response may not be of much use. But in general FAT and NTFS are differ only in way of security. You may be using some security descriptors or flags which is/are not supported on FAT. Providing code snippet would be a good idea, some champ here may give you some better answer then me in that case ;-).

Dev
-----Original Message-----
From: Bruce Zhang [mailto:xxxxx@vip.sina.com]
Sent: Thursday, October 14, 2004 9:05 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Does CreateFile() executes differently with FAT32 and NTFS ?

Hi All,

I wrote a encryption virtual disk driver. After mounted, the virtual disk devices created by the driver doesn't process any read/write/deviceioctl until a deviceioctl to authenticate user password has been passed. Another deviceIoctl is to make the authentication null, after this, the driver denies read/write/deviceioctl again until another authentication executed successfully. I use CreateFile() to open handle of the device before every deviceIoctl, and after execution of deviceIoctl, I call CloseHandle to close it.

In Windows 2000, the driver works well.
In Windows XP, the driver works well if the virtual disk is formatted into NTFS.
But if the virtual disk is formatted into FAT32, there is a problem!

Firstly, the virtual disk is mounted as a volume(such as Z: partition);
Secondly, the application call authentication deviceIoctl to verify user property;
-----Now we can use the virtual disk like a physical disk.
Then the application call the deviceIoctl to nullify the authentication;
-----Now the virtual disk denies all access.

Here comes the problem, Now if I want to get handle of the device, the CreateFile() function return failed! GetLastError() return error code 1(ERROR_INVALID_FUNCTION).

Who can tell me why I get different result for NTFS and FAT32?

Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

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

Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

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

what object name are you passing to CreateFile in each step?

-p


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Bruce Zhang
Sent: Wednesday, October 13, 2004 8:35 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Does CreateFile() executes differently with FAT32 and
NTFS ?

Hi All,

I wrote a encryption virtual disk driver. After mounted, the virtual
disk devices created by the driver doesn't process any
read/write/deviceioctl until a deviceioctl to authenticate user password
has been passed. Another deviceIoctl is to make the authentication null,
after this, the driver denies read/write/deviceioctl again until another
authentication executed successfully. I use CreateFile() to open handle
of the device before every deviceIoctl, and after execution of
deviceIoctl, I call CloseHandle to close it.

In Windows 2000, the driver works well.
In Windows XP, the driver works well if the virtual disk is formatted
into NTFS.
But if the virtual disk is formatted into FAT32, there is a problem!

Firstly, the virtual disk is mounted as a volume(such as Z: partition);
Secondly, the application call authentication deviceIoctl to verify user
property;
-----Now we can use the virtual disk like a physical disk.
Then the application call the deviceIoctl to nullify the authentication;
-----Now the virtual disk denies all access.

Here comes the problem, Now if I want to get handle of the device, the
CreateFile() function return failed! GetLastError() return error code
1(ERROR_INVALID_FUNCTION).

Who can tell me why I get different result for NTFS and FAT32?

Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to $subst('List.Name') as:
$subst('Recip.EmailAddr')
To unsubscribe send a blank email to $subst('Email.UnSub')

What is VolumeName value? It seems you’re using one device for both virtual drive and your control IOCTL commands. It is IMO bad design; no wonder you have problems. Instead, you should create special device to handle custom IOCTLs and control all virtual drives. We have a driver designed this way and it works for long years with no problem.

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]


From: xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com] on behalf of Bruce Zhang[SMTP:xxxxx@vip.sina.com]
Reply To: Windows System Software Devs Interest List
Sent: Thursday, October 14, 2004 9:25 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Does CreateFile() executes differently with FAT32 and NTFS ?

Thank you for your answer. Could you tell me I can read which document about the difference of FAT and NTFS in security?

The dispatch routine to process IRP_MJ_CREATE is very simple, it just return success.
I call CreateFile() with the following parameters:

handle = CreateFile(
VolumeName,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
FILE_FLAG_NO_BUFFERING,
NULL);
when the deviceIoctl complete, use CloseHandle() to close it.

I noticed that in Win2000, it’s ok. In WinXP, when using NTFS, it’s ok, too.

----- Original Message -----
From: Dsingh@in.safenet-inc.com mailto:dsingh
> To: Windows System Software Devs Interest List mailto:xxxxx
> Sent: Thursday, October 14, 2004 2:40 PM
> Subject: RE: [ntdev] Does CreateFile() executes differently with FAT32 and NTFS ?
>
> Hi,
> I m not a FSD guy and this response may not be of much use. But in general FAT and NTFS are differ only in way of security. You may be using some security descriptors or flags which is/are not supported on FAT. Providing code snippet would be a good idea, some champ here may give you some better answer then me in that case ;-).
>
> Dev
>
> -----Original Message-----
> From: Bruce Zhang [mailto:xxxxx@vip.sina.com]
> Sent: Thursday, October 14, 2004 9:05 AM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Does CreateFile() executes differently with FAT32 and NTFS ?
>
>
>
> Hi All,
>
> I wrote a encryption virtual disk driver. After mounted, the virtual disk devices created by the driver doesn’t process any read/write/deviceioctl until a deviceioctl to authenticate user password has been passed. Another deviceIoctl is to make the authentication null, after this, the driver denies read/write/deviceioctl again until another authentication executed successfully. I use CreateFile() to open handle of the device before every deviceIoctl, and after execution of deviceIoctl, I call CloseHandle to close it.
>
> In Windows 2000, the driver works well.
> In Windows XP, the driver works well if the virtual disk is formatted into NTFS.
> But if the virtual disk is formatted into FAT32, there is a problem!
>
> Firstly, the virtual disk is mounted as a volume(such as Z: partition);
> Secondly, the application call authentication deviceIoctl to verify user property;
> -----Now we can use the virtual disk like a physical disk.
> Then the application call the deviceIoctl to nullify the authentication;
> -----Now the virtual disk denies all access.
>
> Here comes the problem, Now if I want to get handle of the device, the CreateFile() function return failed! GetLastError() return error code 1(ERROR_INVALID_FUNCTION).
>
> Who can tell me why I get different result for NTFS and FAT32?
> —
> Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256>
>
> You are currently subscribed to ntdev as: xxxxx@vip.sina.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
> —
> Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@vip.sina.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
> —
> Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to $subst(‘List.Name’) as: $subst(‘Recip.EmailAddr’)
> To unsubscribe send a blank email to $subst(‘Email.UnSub’)
></mailto:xxxxx></mailto:dsingh>

Can someone please show me how to subscribe to the group again?

Thank you so much
Dai

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Michal Vodicka
Sent: Thursday, October 14, 2004 10:50 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Does CreateFile() executes differently with FAT32
and NTFS ?

What is VolumeName value? It seems you’re using one device for both virtual drive and your control IOCTL commands. It is IMO bad design; no wonder you have problems. Instead, you should create special device to handle custom IOCTLs and control all virtual drives. We have a driver designed this way and it works for long years with no problem.

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]


From: xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com] on behalf of Bruce Zhang[SMTP:xxxxx@vip.sina.com]
Reply To: Windows System Software Devs Interest List
Sent: Thursday, October 14, 2004 9:25 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Does CreateFile() executes differently with FAT32 and NTFS ?

Thank you for your answer. Could you tell me I can read which document about the difference of FAT and NTFS in security?

The dispatch routine to process IRP_MJ_CREATE is very simple, it just return success.
I call CreateFile() with the following parameters:

handle = CreateFile(
VolumeName,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
FILE_FLAG_NO_BUFFERING,
NULL);
when the deviceIoctl complete, use CloseHandle() to close it.

I noticed that in Win2000, it’s ok. In WinXP, when using NTFS, it’s ok, too.

----- Original Message -----
From: Dsingh@in.safenet-inc.com mailto:dsingh
> To: Windows System Software Devs Interest List mailto:xxxxx
> Sent: Thursday, October 14, 2004 2:40 PM
> Subject: RE: [ntdev] Does CreateFile() executes differently with FAT32 and NTFS ?
>
> Hi,
> I m not a FSD guy and this response may not be of much use. But in general FAT and NTFS are differ only in way of security. You may be using some security descriptors or flags which is/are not supported on FAT. Providing code snippet would be a good idea, some champ here may give you some better answer then me in that case ;-).
>
> Dev
>
> -----Original Message-----
> From: Bruce Zhang [mailto:xxxxx@vip.sina.com]
> Sent: Thursday, October 14, 2004 9:05 AM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Does CreateFile() executes differently with FAT32 and NTFS ?
>
>
>
> Hi All,
>
> I wrote a encryption virtual disk driver. After mounted, the virtual disk devices created by the driver doesn’t process any read/write/deviceioctl until a deviceioctl to authenticate user password has been passed. Another deviceIoctl is to make the authentication null, after this, the driver denies read/write/deviceioctl again until another authentication executed successfully. I use CreateFile() to open handle of the device before every deviceIoctl, and after execution of deviceIoctl, I call CloseHandle to close it.
>
> In Windows 2000, the driver works well.
> In Windows XP, the driver works well if the virtual disk is formatted into NTFS.
> But if the virtual disk is formatted into FAT32, there is a problem!
>
> Firstly, the virtual disk is mounted as a volume(such as Z: partition);
> Secondly, the application call authentication deviceIoctl to verify user property;
> -----Now we can use the virtual disk like a physical disk.
> Then the application call the deviceIoctl to nullify the authentication;
> -----Now the virtual disk denies all access.
>
> Here comes the problem, Now if I want to get handle of the device, the CreateFile() function return failed! GetLastError() return error code 1(ERROR_INVALID_FUNCTION).
>
> Who can tell me why I get different result for NTFS and FAT32?
> —
> Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256&gt;
>
> You are currently subscribed to ntdev as: xxxxx@vip.sina.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
> —
> Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@vip.sina.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
> —
> Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com</mailto:xxxxx></mailto:dsingh>

Just the Symbol link name of the device such as \.\z:

Before this, I have called

DefineDosDevice(
DDD_RAW_TARGET_PATH,
...
)
to set the symbol link name to my device.

----- Original Message -----
From: Peter Wieland
To: Windows System Software Devs Interest List
Sent: Thursday, October 14, 2004 11:34 PM
Subject: RE: [ntdev] Does CreateFile() executes differently with FAT32 and NTFS ?

what object name are you passing to CreateFile in each step?

-p


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Bruce Zhang
Sent: Wednesday, October 13, 2004 8:35 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Does CreateFile() executes differently with FAT32 and NTFS ?

Hi All,

I wrote a encryption virtual disk driver. After mounted, the virtual disk devices created by the driver doesn't process any read/write/deviceioctl until a deviceioctl to authenticate user password has been passed. Another deviceIoctl is to make the authentication null, after this, the driver denies read/write/deviceioctl again until another authentication executed successfully. I use CreateFile() to open handle of the device before every deviceIoctl, and after execution of deviceIoctl, I call CloseHandle to close it.

In Windows 2000, the driver works well.
In Windows XP, the driver works well if the virtual disk is formatted into NTFS.
But if the virtual disk is formatted into FAT32, there is a problem!

Firstly, the virtual disk is mounted as a volume(such as Z: partition);
Secondly, the application call authentication deviceIoctl to verify user property;
-----Now we can use the virtual disk like a physical disk.
Then the application call the deviceIoctl to nullify the authentication;
-----Now the virtual disk denies all access.

Here comes the problem, Now if I want to get handle of the device, the CreateFile() function return failed! GetLastError() return error code 1(ERROR_INVALID_FUNCTION).

Who can tell me why I get different result for NTFS and FAT32?

Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@vip.sina.com
To unsubscribe send a blank email to xxxxx@lists.osr.com ---
Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ''
To unsubscribe send a blank email to xxxxx@lists.osr.com

Yes, I use one device. All Irp targeting to it is queued. But the NTFS format is always OK.

Can you speak of your design in some detail?
Thanks for your help.

----- Original Message -----
From: “Michal Vodicka”
To: “Windows System Software Devs Interest List”
Sent: Friday, October 15, 2004 1:49 AM
Subject: RE: [ntdev] Does CreateFile() executes differently with FAT32 and NTFS ?

What is VolumeName value? It seems you’re using one device for both virtual drive and your control IOCTL commands. It is IMO bad design; no wonder you have problems. Instead, you should create special device to handle custom IOCTLs and control all virtual drives. We have a driver designed this way and it works for long years with no problem.

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]

> ----------
> From: xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com] on behalf of Bruce Zhang[SMTP:xxxxx@vip.sina.com]
> Reply To: Windows System Software Devs Interest List
> Sent: Thursday, October 14, 2004 9:25 AM
> To: Windows System Software Devs Interest List
> Subject: Re: [ntdev] Does CreateFile() executes differently with FAT32 and NTFS ?
>
> Thank you for your answer. Could you tell me I can read which document about the difference of FAT and NTFS in security?
>
> The dispatch routine to process IRP_MJ_CREATE is very simple, it just return success.
> I call CreateFile() with the following parameters:
>
> handle = CreateFile(
> VolumeName,
> GENERIC_READ | GENERIC_WRITE,
> FILE_SHARE_READ | FILE_SHARE_WRITE,
> NULL,
> OPEN_EXISTING,
> FILE_FLAG_NO_BUFFERING,
> NULL);
> when the deviceIoctl complete, use CloseHandle() to close it.
>
> I noticed that in Win2000, it’s ok. In WinXP, when using NTFS, it’s ok, too.
>
> ----- Original Message -----
> From: Dsingh@in.safenet-inc.com mailto:dsingh
> To: Windows System Software Devs Interest List mailto:xxxxx
> Sent: Thursday, October 14, 2004 2:40 PM
> Subject: RE: [ntdev] Does CreateFile() executes differently with FAT32 and NTFS ?
>
> Hi,
> I m not a FSD guy and this response may not be of much use. But in general FAT and NTFS are differ only in way of security. You may be using some security descriptors or flags which is/are not supported on FAT. Providing code snippet would be a good idea, some champ here may give you some better answer then me in that case ;-).
>
> Dev
>
> -----Original Message-----
> From: Bruce Zhang [mailto:xxxxx@vip.sina.com]
> Sent: Thursday, October 14, 2004 9:05 AM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Does CreateFile() executes differently with FAT32 and NTFS ?
>
>
>
> Hi All,
>
> I wrote a encryption virtual disk driver. After mounted, the virtual disk devices created by the driver doesn’t process any read/write/deviceioctl until a deviceioctl to authenticate user password has been passed. Another deviceIoctl is to make the authentication null, after this, the driver denies read/write/deviceioctl again until another authentication executed successfully. I use CreateFile() to open handle of the device before every deviceIoctl, and after execution of deviceIoctl, I call CloseHandle to close it.
>
> In Windows 2000, the driver works well.
> In Windows XP, the driver works well if the virtual disk is formatted into NTFS.
> But if the virtual disk is formatted into FAT32, there is a problem!
>
> Firstly, the virtual disk is mounted as a volume(such as Z: partition);
> Secondly, the application call authentication deviceIoctl to verify user property;
> -----Now we can use the virtual disk like a physical disk.
> Then the application call the deviceIoctl to nullify the authentication;
> -----Now the virtual disk denies all access.
>
> Here comes the problem, Now if I want to get handle of the device, the CreateFile() function return failed! GetLastError() return error code 1(ERROR_INVALID_FUNCTION).
>
> Who can tell me why I get different result for NTFS and FAT32?
> —
> Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256&gt;
>
> You are currently subscribed to ntdev as: xxxxx@vip.sina.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
> —
> Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@vip.sina.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
> —
> Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com</mailto:xxxxx></mailto:dsingh>

Our driver creates one named device which is used for all custom IOCTL processing. Virtual drives are created/mounted/dismounted and deleted on demand when user mode software sends appropriate IOCTL (which includes drive identification). So there is one control device and N virtual drives with N devices which handle read and write requests and IOCTLs from system. No mix of system and custom IOCTLs and no problem.

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]


From: xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com] on behalf of Bruce Zhang[SMTP:xxxxx@vip.sina.com]
Reply To: Windows System Software Devs Interest List
Sent: Friday, October 15, 2004 3:32 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Does CreateFile() executes differently with FAT32 and NTFS ?

Yes, I use one device. All Irp targeting to it is queued. But the NTFS format is always OK.

Can you speak of your design in some detail?
Thanks for your help.

----- Original Message -----
From: “Michal Vodicka”
> To: “Windows System Software Devs Interest List”
> Sent: Friday, October 15, 2004 1:49 AM
> Subject: RE: [ntdev] Does CreateFile() executes differently with FAT32 and NTFS ?
>
>
> What is VolumeName value? It seems you’re using one device for both virtual drive and your control IOCTL commands. It is IMO bad design; no wonder you have problems. Instead, you should create special device to handle custom IOCTLs and control all virtual drives. We have a driver designed this way and it works for long years with no problem.
>
> Best regards,
>
> Michal Vodicka
> UPEK, Inc.
> [xxxxx@upek.com, http://www.upek.com]
>
>
> > ----------
> > From: xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com] on behalf of Bruce Zhang[SMTP:xxxxx@vip.sina.com]
> > Reply To: Windows System Software Devs Interest List
> > Sent: Thursday, October 14, 2004 9:25 AM
> > To: Windows System Software Devs Interest List
> > Subject: Re: [ntdev] Does CreateFile() executes differently with FAT32 and NTFS ?
> >
> > Thank you for your answer. Could you tell me I can read which document about the difference of FAT and NTFS in security?
> >
> > The dispatch routine to process IRP_MJ_CREATE is very simple, it just return success.
> > I call CreateFile() with the following parameters:
> >
> > handle = CreateFile(
> > VolumeName,
> > GENERIC_READ | GENERIC_WRITE,
> > FILE_SHARE_READ | FILE_SHARE_WRITE,
> > NULL,
> > OPEN_EXISTING,
> > FILE_FLAG_NO_BUFFERING,
> > NULL);
> > when the deviceIoctl complete, use CloseHandle() to close it.
> >
> > I noticed that in Win2000, it’s ok. In WinXP, when using NTFS, it’s ok, too.
> >
> > ----- Original Message -----
> > From: Dsingh@in.safenet-inc.com mailto:dsingh
> > To: Windows System Software Devs Interest List mailto:xxxxx
> > Sent: Thursday, October 14, 2004 2:40 PM
> > Subject: RE: [ntdev] Does CreateFile() executes differently with FAT32 and NTFS ?
> >
> > Hi,
> > I m not a FSD guy and this response may not be of much use. But in general FAT and NTFS are differ only in way of security. You may be using some security descriptors or flags which is/are not supported on FAT. Providing code snippet would be a good idea, some champ here may give you some better answer then me in that case ;-).
> >
> > Dev
> >
> > -----Original Message-----
> > From: Bruce Zhang [mailto:xxxxx@vip.sina.com]
> > Sent: Thursday, October 14, 2004 9:05 AM
> > To: Windows System Software Devs Interest List
> > Subject: [ntdev] Does CreateFile() executes differently with FAT32 and NTFS ?
> >
> >
> >
> > Hi All,
> >
> > I wrote a encryption virtual disk driver. After mounted, the virtual disk devices created by the driver doesn’t process any read> /write/deviceioctl until a deviceioctl to authenticate user password has been passed. Another deviceIoctl is to make the authentication null, after this, the driver denies read/write/deviceioctl again until another authentication executed successfully. I use CreateFile() to open handle of the device before every deviceIoctl, and after execution of deviceIoctl, I call CloseHandle to close it.
> >
> > In Windows 2000, the driver works well.
> > In Windows XP, the driver works well if the virtual disk is formatted into NTFS.
> > But if the virtual disk is formatted into FAT32, there is a problem!
> >
> > Firstly, the virtual disk is mounted as a volume(such as Z: partition);
> > Secondly, the application call authentication deviceIoctl to verify user property;
> > -----Now we can use the virtual disk like a physical disk.
> > Then the application call the deviceIoctl to nullify the authentication;
> > -----Now the virtual disk denies all access.
> >
> > Here comes the problem, Now if I want to get handle of the device, the CreateFile() function return failed! GetLastError() return error code 1(ERROR_INVALID_FUNCTION).
> >
> > Who can tell me why I get different result for NTFS and FAT32?
> > —
> > Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256&gt;
> >
> > You are currently subscribed to ntdev as: xxxxx@vip.sina.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> > —
> > Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: xxxxx@vip.sina.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> > —
> > Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
>
>
> —
> Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
> —
> Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to $subst(‘List.Name’) as: $subst(‘Recip.EmailAddr’)
> To unsubscribe send a blank email to $subst(‘Email.UnSub’)
></mailto:xxxxx></mailto:dsingh>

Thanks for your help

----- Original Message -----
From: “Michal Vodicka”
To: “Windows System Software Devs Interest List”
Sent: Tuesday, October 19, 2004 4:55 AM
Subject: RE: [ntdev] Does CreateFile() executes differently with FAT32 and NTFS ?

Our driver creates one named device which is used for all custom IOCTL processing. Virtual drives are created/mounted/dismounted and deleted on demand when user mode software sends appropriate IOCTL (which includes drive identification). So there is one control device and N virtual drives with N devices which handle read and write requests and IOCTLs from system. No mix of system and custom IOCTLs and no problem.

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]

> ----------
> From: xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com] on behalf of Bruce Zhang[SMTP:xxxxx@vip.sina.com]
> Reply To: Windows System Software Devs Interest List
> Sent: Friday, October 15, 2004 3:32 AM
> To: Windows System Software Devs Interest List
> Subject: Re: [ntdev] Does CreateFile() executes differently with FAT32 and NTFS ?
>
> Yes, I use one device. All Irp targeting to it is queued. But the NTFS format is always OK.
>
> Can you speak of your design in some detail?
> Thanks for your help.
>
> ----- Original Message -----
> From: “Michal Vodicka”
> To: “Windows System Software Devs Interest List”
> Sent: Friday, October 15, 2004 1:49 AM
> Subject: RE: [ntdev] Does CreateFile() executes differently with FAT32 and NTFS ?
>
>
> What is VolumeName value? It seems you’re using one device for both virtual drive and your control IOCTL commands. It is IMO bad design; no wonder you have problems. Instead, you should create special device to handle custom IOCTLs and control all virtual drives. We have a driver designed this way and it works for long years with no problem.
>
> Best regards,
>
> Michal Vodicka
> UPEK, Inc.
> [xxxxx@upek.com, http://www.upek.com]
>
>
> > ----------
> > From: xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com] on behalf of Bruce Zhang[SMTP:xxxxx@vip.sina.com]
> > Reply To: Windows System Software Devs Interest List
> > Sent: Thursday, October 14, 2004 9:25 AM
> > To: Windows System Software Devs Interest List
> > Subject: Re: [ntdev] Does CreateFile() executes differently with FAT32 and NTFS ?
> >
> > Thank you for your answer. Could you tell me I can read which document about the difference of FAT and NTFS in security?
> >
> > The dispatch routine to process IRP_MJ_CREATE is very simple, it just return success.
> > I call CreateFile() with the following parameters:
> >
> > handle = CreateFile(
> > VolumeName,
> > GENERIC_READ | GENERIC_WRITE,
> > FILE_SHARE_READ | FILE_SHARE_WRITE,
> > NULL,
> > OPEN_EXISTING,
> > FILE_FLAG_NO_BUFFERING,
> > NULL);
> > when the deviceIoctl complete, use CloseHandle() to close it.
> >
> > I noticed that in Win2000, it’s ok. In WinXP, when using NTFS, it’s ok, too.
> >
> > ----- Original Message -----
> > From: Dsingh@in.safenet-inc.com mailto:dsingh
> > To: Windows System Software Devs Interest List mailto:xxxxx
> > Sent: Thursday, October 14, 2004 2:40 PM
> > Subject: RE: [ntdev] Does CreateFile() executes differently with FAT32 and NTFS ?
> >
> > Hi,
> > I m not a FSD guy and this response may not be of much use. But in general FAT and NTFS are differ only in way of security. You may be using some security descriptors or flags which is/are not supported on FAT. Providing code snippet would be a good idea, some champ here may give you some better answer then me in that case ;-).
> >
> > Dev
> >
> > -----Original Message-----
> > From: Bruce Zhang [mailto:xxxxx@vip.sina.com]
> > Sent: Thursday, October 14, 2004 9:05 AM
> > To: Windows System Software Devs Interest List
> > Subject: [ntdev] Does CreateFile() executes differently with FAT32 and NTFS ?
> >
> >
> >
> > Hi All,
> >
> > I wrote a encryption virtual disk driver. After mounted, the virtual disk devices created by the driver doesn’t process any read> /write/deviceioctl until a deviceioctl to authenticate user password has been passed. Another deviceIoctl is to make the authentication null, after this, the driver denies read/write/deviceioctl again until another authentication executed successfully. I use CreateFile() to open handle of the device before every deviceIoctl, and after execution of deviceIoctl, I call CloseHandle to close it.
> >
> > In Windows 2000, the driver works well.
> > In Windows XP, the driver works well if the virtual disk is formatted into NTFS.
> > But if the virtual disk is formatted into FAT32, there is a problem!
> >
> > Firstly, the virtual disk is mounted as a volume(such as Z: partition);
> > Secondly, the application call authentication deviceIoctl to verify user property;
> > -----Now we can use the virtual disk like a physical disk.
> > Then the application call the deviceIoctl to nullify the authentication;
> > -----Now the virtual disk denies all access.
> >
> > Here comes the problem, Now if I want to get handle of the device, the CreateFile() function return failed! GetLastError() return error code 1(ERROR_INVALID_FUNCTION).
> >
> > Who can tell me why I get different result for NTFS and FAT32?
> > —
> > Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256&gt;
> >
> > You are currently subscribed to ntdev as: xxxxx@vip.sina.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> > —
> > Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: xxxxx@vip.sina.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> > —
> > Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
>
>
> —
> Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
> —
> Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com</mailto:xxxxx></mailto:dsingh>

We also moved to this approach with our FS filter.

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

----- Original Message -----
From: “Michal Vodicka”
To: “Windows System Software Devs Interest List”
Sent: Tuesday, October 19, 2004 12:55 AM
Subject: RE: [ntdev] Does CreateFile() executes differently with FAT32 and NTFS
?

> Our driver creates one named device which is used for all custom IOCTL
processing. Virtual drives are created/mounted/dismounted and deleted on demand
when user mode software sends appropriate IOCTL (which includes drive
identification). So there is one control device and N virtual drives with N
devices which handle read and write requests and IOCTLs from system. No mix of
system and custom IOCTLs and no problem.
>
> Best regards,
>
> Michal Vodicka
> UPEK, Inc.
> [xxxxx@upek.com, http://www.upek.com]
>
>
> > ----------
> > From:
xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com] on
behalf of Bruce Zhang[SMTP:xxxxx@vip.sina.com]
> > Reply To: Windows System Software Devs Interest List
> > Sent: Friday, October 15, 2004 3:32 AM
> > To: Windows System Software Devs Interest List
> > Subject: Re: [ntdev] Does CreateFile() executes differently with FAT32 and
NTFS ?
> >
> > Yes, I use one device. All Irp targeting to it is queued. But the NTFS
format is always OK.
> >
> > Can you speak of your design in some detail?
> > Thanks for your help.
> >
> > ----- Original Message -----
> > From: “Michal Vodicka”
> > To: “Windows System Software Devs Interest List”
> > Sent: Friday, October 15, 2004 1:49 AM
> > Subject: RE: [ntdev] Does CreateFile() executes differently with FAT32 and
NTFS ?
> >
> >
> > What is VolumeName value? It seems you’re using one device for both virtual
drive and your control IOCTL commands. It is IMO bad design; no wonder you have
problems. Instead, you should create special device to handle custom IOCTLs and
control all virtual drives. We have a driver designed this way and it works for
long years with no problem.
> >
> > Best regards,
> >
> > Michal Vodicka
> > UPEK, Inc.
> > [xxxxx@upek.com, http://www.upek.com]
> >
> >
> > > ----------
> > > From:
xxxxx@lists.osr.com[SMTP:xxxxx@lists.osr.com] on
behalf of Bruce Zhang[SMTP:xxxxx@vip.sina.com]
> > > Reply To: Windows System Software Devs Interest List
> > > Sent: Thursday, October 14, 2004 9:25 AM
> > > To: Windows System Software Devs Interest List
> > > Subject: Re: [ntdev] Does CreateFile() executes differently with FAT32
and NTFS ?
> > >
> > > Thank you for your answer. Could you tell me I can read which document
about the difference of FAT and NTFS in security?
> > >
> > > The dispatch routine to process IRP_MJ_CREATE is very simple, it just
return success.
> > > I call CreateFile() with the following parameters:
> > >
> > > handle = CreateFile(
> > > VolumeName,
> > > GENERIC_READ | GENERIC_WRITE,
> > > FILE_SHARE_READ | FILE_SHARE_WRITE,
> > > NULL,
> > > OPEN_EXISTING,
> > > FILE_FLAG_NO_BUFFERING,
> > > NULL);
> > > when the deviceIoctl complete, use CloseHandle() to close it.
> > >
> > > I noticed that in Win2000, it’s ok. In WinXP, when using NTFS, it’s ok,
too.
> > >
> > > ----- Original Message -----
> > > From: Dsingh@in.safenet-inc.com mailto:dsingh
> > > To: Windows System Software Devs Interest List
mailto:xxxxx
> > > Sent: Thursday, October 14, 2004 2:40 PM
> > > Subject: RE: [ntdev] Does CreateFile() executes differently with FAT32
and NTFS ?
> > >
> > > Hi,
> > > I m not a FSD guy and this response may not be of much use. But in
general FAT and NTFS are differ only in way of security. You may be using some
security descriptors or flags which is/are not supported on FAT. Providing code
snippet would be a good idea, some champ here may give you some better answer
then me in that case ;-).
> > >
> > > Dev
> > >
> > > -----Original Message-----
> > > From: Bruce Zhang [mailto:xxxxx@vip.sina.com]
> > > Sent: Thursday, October 14, 2004 9:05 AM
> > > To: Windows System Software Devs Interest List
> > > Subject: [ntdev] Does CreateFile() executes differently with FAT32 and
NTFS ?
> > >
> > >
> > >
> > > Hi All,
> > >
> > > I wrote a encryption virtual disk driver. After mounted, the virtual disk
devices created by the driver doesn’t process any read> /write/deviceioctl
until a deviceioctl to authenticate user password has been passed. Another
deviceIoctl is to make the authentication null, after this, the driver denies
read/write/deviceioctl again until another authentication executed
successfully. I use CreateFile() to open handle of the device before every
deviceIoctl, and after execution of deviceIoctl, I call CloseHandle to close
it.
> > >
> > > In Windows 2000, the driver works well.
> > > In Windows XP, the driver works well if the virtual disk is formatted
into NTFS.
> > > But if the virtual disk is formatted into FAT32, there is a problem!
> > >
> > > Firstly, the virtual disk is mounted as a volume(such as Z: partition);
> > > Secondly, the application call authentication deviceIoctl to verify user
property;
> > > -----Now we can use the virtual disk like a physical disk.
> > > Then the application call the deviceIoctl to nullify the authentication;
> > > -----Now the virtual disk denies all access.
> > >
> > > Here comes the problem, Now if I want to get handle of the device, the
CreateFile() function return failed! GetLastError() return error code
1(ERROR_INVALID_FUNCTION).
> > >
> > > Who can tell me why I get different result for NTFS and FAT32?
> > > —
> > > Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256&gt;
> > >
> > > You are currently subscribed to ntdev as: xxxxx@vip.sina.com
> > > To unsubscribe send a blank email to xxxxx@lists.osr.com
> > >
> > > —
> > > Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
> > >
> > > You are currently subscribed to ntdev as: xxxxx@vip.sina.com
> > > To unsubscribe send a blank email to xxxxx@lists.osr.com
> > >
> > > —
> > > Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
> > >
> > > You are currently subscribed to ntdev as: unknown lmsubst tag argument:
‘’
> > > To unsubscribe send a blank email to xxxxx@lists.osr.com
> > >
> >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
>
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
> To unsubscribe send a blank email to xxxxx@lists.osr.com
></mailto:xxxxx></mailto:dsingh>