Trying to get around W2K reporting FAT32 as FAT

Hi all!

GetVolumeInfo in W2K reports FAT32 as FAT -
tried using int21 f 440Dh m 66h IOCTL to get Media Descriptor - which works
in a few instances - but not always. I have tried different mixes of
permissions. Some pass, some fail either CreateFile or DeviceIoControl with
“access denied.” Mapped net drives never work (and that’s what I’m really
trying to get at - sigh!) Does anyone have info or ideas? Here is one
incarnation of my code:

Thanks in advance,
xxxxx@miramar.com

case OperatingSystemInfo::WINNT40:
case OperatingSystemInfo::WIN2000:
case OperatingSystemInfo::WHISTLER:
{
HANDLE hDevice; // handle to the drive to be examined
BOOL bResult = false; // results flag
DWORD junk; // discard results
TCHAR tsz[8];

::wsprintf(tsz, TEXT(“\\.\%c:”), TEXT(‘@’) + nDrive);
hDevice = CreateFile( tsz,
0, // share mode
0,
NULL,
OPEN_EXISTING,
0,
NULL); // don’t copy any file’s attributes

if (hDevice != INVALID_HANDLE_VALUE) // we can open the drive
{

PARTITION_INFORMATION partitionInfo;

bResult = DeviceIoControl( hDevice, // device we are querying
IOCTL_DISK_GET_PARTITION_INFO, // operation to perform
NULL,
0, // no input buffer, so pass zero
&partitionInfo,
sizeof(partitionInfo), // output buffer
&junk, // discard count of bytes returned
NULL); // synchronous I/O
if (bResult)
{
switch(partitionInfo.PartitionType)
{
case PARTITION_FAT32:
case PARTITION_FAT32_XINT13:
{
return CString(“FAT32”);
}

case PARTITION_FAT_12:
{
return CString(“FAT12”);
}

case PARTITION_FAT_16:
{
return CString(“FAT”);
}
} // switch on partition type
}

CloseHandle(hDevice); // we’re done with the handle

} // got handle

if (!bResult)
{
LPVOID lpMsgBuf;
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
0, // Default language
(LPTSTR) &lpMsgBuf,
0,
NULL
);
// Process any inserts in lpMsgBuf.
// …
// Display the string.
MessageBox( NULL, (LPCTSTR)lpMsgBuf, “Error”, MB_OK |
MB_ICONINFORMATION );
// Free the buffer.
} // failed

} // case NT/2000


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Windows 2000 does return FAT32. Make very sure you are looking at a
FAT32 volume.

-----Original Message-----
From: xxxxx@miramar.com [mailto:xxxxx@miramar.com]
Sent: Monday, March 19, 2001 5:00 PM
To: File Systems Developers
Subject: [ntfsd] Trying to get around W2K reporting FAT32 as FAT

Hi all!

GetVolumeInfo in W2K reports FAT32 as FAT -
tried using int21 f 440Dh m 66h IOCTL to get Media Descriptor - which
works
in a few instances - but not always. I have tried different mixes of
permissions. Some pass, some fail either CreateFile or DeviceIoControl
with
“access denied.” Mapped net drives never work (and that’s what I’m
really
trying to get at - sigh!) Does anyone have info or ideas? Here is one
incarnation of my code:

Thanks in advance,
xxxxx@miramar.com

case OperatingSystemInfo::WINNT40:
case OperatingSystemInfo::WIN2000:
case OperatingSystemInfo::WHISTLER:
{
HANDLE hDevice; // handle to the
drive to be examined
BOOL bResult = false; // results flag
DWORD junk; // discard results
TCHAR tsz[8];

::wsprintf(tsz, TEXT(“\\.\%c:”), TEXT(‘@’) +
nDrive);
hDevice = CreateFile( tsz,

0, // share mode

0,

NULL,

OPEN_EXISTING,

0,

NULL); // don’t copy any file’s attributes

if (hDevice != INVALID_HANDLE_VALUE) // we can
open the drive
{

PARTITION_INFORMATION partitionInfo;

bResult = DeviceIoControl( hDevice,
// device we are querying

IOCTL_DISK_GET_PARTITION_INFO, // operation to perform

NULL,

0, // no input buffer, so pass zero

&partitionInfo,

sizeof(partitionInfo), // output buffer

&junk, // discard count of bytes returned

NULL); // synchronous I/O
if (bResult)
{

switch(partitionInfo.PartitionType)
{
case PARTITION_FAT32:
case PARTITION_FAT32_XINT13:
{
return
CString(“FAT32”);
}

case PARTITION_FAT_12:
{
return
CString(“FAT12”);
}

case PARTITION_FAT_16:
{
return
CString(“FAT”);
}
} // switch on partition type
}

CloseHandle(hDevice); // we’re
done with the handle

} // got handle

if (!bResult)
{
LPVOID lpMsgBuf;
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |

FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
0, // Default language
(LPTSTR) &lpMsgBuf,
0,
NULL
);
// Process any inserts in lpMsgBuf.
// …
// Display the string.
MessageBox( NULL, (LPCTSTR)lpMsgBuf,
“Error”, MB_OK |
MB_ICONINFORMATION );
// Free the buffer.
} // failed

} // case NT/2000


You are currently subscribed to ntfsd as: xxxxx@exchange.microsoft.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Yes, when the volume is on the local machine - but not when it is a mapped
drive - then (and I just verified once again)
it reports the drive as FAT. Sorry about the mix-up.

xxxxx@miramar.com

“Daniel Lovinger”

soft.com> cc:
Sent by: Subject: [ntfsd] RE: Trying to get around W2K reporting FAT32 as FAT
xxxxx@lis
ts.osr.com

03/20/2001 05:44 PM
Please respond to
“File Systems
Developers”

Windows 2000 does return FAT32. Make very sure you are looking at a
FAT32 volume.

-----Original Message-----
From: xxxxx@miramar.com [mailto:xxxxx@miramar.com]
Sent: Monday, March 19, 2001 5:00 PM
To: File Systems Developers
Subject: [ntfsd] Trying to get around W2K reporting FAT32 as FAT

Hi all!

GetVolumeInfo in W2K reports FAT32 as FAT -
tried using int21 f 440Dh m 66h IOCTL to get Media Descriptor - which
works
in a few instances - but not always. I have tried different mixes of
permissions. Some pass, some fail either CreateFile or DeviceIoControl
with
“access denied.” Mapped net drives never work (and that’s what I’m
really
trying to get at - sigh!) Does anyone have info or ideas? Here is one
incarnation of my code:

Thanks in advance,
xxxxx@miramar.com

case OperatingSystemInfo::WINNT40:
case OperatingSystemInfo::WIN2000:
case OperatingSystemInfo::WHISTLER:
{
HANDLE hDevice; // handle to the
drive to be examined
BOOL bResult = false; // results flag
DWORD junk; // discard results
TCHAR tsz[8];

::wsprintf(tsz, TEXT(“\\.\%c:”), TEXT(‘@’) +
nDrive);
hDevice = CreateFile( tsz,

0, // share mode

0,

NULL,

OPEN_EXISTING,

0,

NULL); // don’t copy any file’s attributes

if (hDevice != INVALID_HANDLE_VALUE) // we can
open the drive
{

PARTITION_INFORMATION partitionInfo;

bResult = DeviceIoControl( hDevice,
// device we are querying

IOCTL_DISK_GET_PARTITION_INFO, // operation to perform

NULL,

0, // no input buffer, so pass zero

&partitionInfo,

sizeof(partitionInfo), // output buffer

&junk, // discard count of bytes returned

NULL); // synchronous I/O
if (bResult)
{

switch(partitionInfo.PartitionType)
{
case PARTITION_FAT32:
case PARTITION_FAT32_XINT13:
{
return
CString(“FAT32”);
}

case PARTITION_FAT_12:
{
return
CString(“FAT12”);
}

case PARTITION_FAT_16:
{
return
CString(“FAT”);
}
} // switch on partition type
}

CloseHandle(hDevice); // we’re
done with the handle

} // got handle

if (!bResult)
{
LPVOID lpMsgBuf;
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |

FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
0, // Default language
(LPTSTR) &lpMsgBuf,
0,
NULL
);
// Process any inserts in lpMsgBuf.
// …
// Display the string.
MessageBox( NULL, (LPCTSTR)lpMsgBuf,
“Error”, MB_OK |
MB_ICONINFORMATION );
// Free the buffer.
} // failed

} // case NT/2000


You are currently subscribed to ntfsd as: xxxxx@exchange.microsoft.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntfsd as: xxxxx@miramar.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

I had this same issue. My understanding is that ir reports remote
drives as FAT rather than FAT32 is becuase of some app compatability
issues.

Anyway the way to tell the difference is that remote FAT supports
extended attributes, but remote FAT32 does not.

Here is the code I use to see if the path supports EAs. Note that this
code requires write access, which is just fine for my use, but you may
want to rework it so that you don’t need write access.

Enjoy

BOOL DoesFileSystemSupportEAs(LPCTSTR strPath)
{
TCHAR strFileName[MAX_PATH];
FILE_FULL_EA_INFORMATION EaInformation[2];
IO_STATUS_BLOCK IoStatusBlock;
NTSTATUS Status;
CAutoHandle hFile;

if(0 == GetTempFileName(strPath,
_T(“”),
0,
strFileName))
{
// error
return FALSE;
}

hFile.Reset( CreateFile(strFileName,
GENERIC_WRITE,
0,
NULL,
CREATE_ALWAYS,
FILE_FLAG_DELETE_ON_CLOSE |
FILE_ATTRIBUTE_TEMPORARY,
NULL) );

if(!IsValidHandle(hFile))
{
// error
return FALSE;
}

ZeroMemory(EaInformation,sizeof(FILE_FULL_EA_INFORMATION) * 2);

EaInformation[0].NextEntryOffset = 0;
EaInformation[0].Flags = 0;
EaInformation[0].EaNameLength = 1;
EaInformation[0].EaValueLength = 1;
EaInformation[0].EaName[0] = ‘x’;

ZeroMemory(&IoStatusBlock,sizeof(IO_STATUS_BLOCK));

Status = NtSetEaFile(hFile,
&IoStatusBlock,
EaInformation,
sizeof(EaInformation));

switch(Status)
{
case STATUS_SUCCESS:
//
// It is FAT
//
return TRUE;

case STATUS_EAS_NOT_SUPPORTED:
//
// It is FAT32
//
// don’t do anything
default:
// don’t do anything
;
}

return FALSE;
}

-----Original Message-----
From: xxxxx@miramar.com [mailto:xxxxx@miramar.com]
Sent: Wednesday, March 21, 2001 9:45 AM
To: File Systems Developers
Subject: [ntfsd] RE: Trying to get around W2K reporting FAT32 as FAT

Yes, when the volume is on the local machine - but not when it is a
mapped
drive - then (and I just verified once again)
it reports the drive as FAT. Sorry about the mix-up.

xxxxx@miramar.com

“Daniel Lovinger”

Developers"
soft.com> cc:

Sent by: Subject: [ntfsd]
RE: Trying to get around W2K reporting FAT32 as FAT
xxxxx@lis

ts.osr.com

03/20/2001 05:44 PM

Please respond to

“File Systems

Developers”

Windows 2000 does return FAT32. Make very sure you are looking at a
FAT32 volume.

-----Original Message-----
From: xxxxx@miramar.com [mailto:xxxxx@miramar.com]
Sent: Monday, March 19, 2001 5:00 PM
To: File Systems Developers
Subject: [ntfsd] Trying to get around W2K reporting FAT32 as FAT

Hi all!

GetVolumeInfo in W2K reports FAT32 as FAT -
tried using int21 f 440Dh m 66h IOCTL to get Media Descriptor - which
works
in a few instances - but not always. I have tried different mixes of
permissions. Some pass, some fail either CreateFile or DeviceIoControl
with
“access denied.” Mapped net drives never work (and that’s what I’m
really
trying to get at - sigh!) Does anyone have info or ideas? Here is one
incarnation of my code:

Thanks in advance,
xxxxx@miramar.com

case OperatingSystemInfo::WINNT40:
case OperatingSystemInfo::WIN2000:
case OperatingSystemInfo::WHISTLER:
{
HANDLE hDevice; // handle to the
drive to be examined
BOOL bResult = false; // results flag
DWORD junk; // discard results
TCHAR tsz[8];

::wsprintf(tsz, TEXT(“\\.\%c:”), TEXT(‘@’) +
nDrive);
hDevice = CreateFile( tsz,

0, // share mode

0,

NULL,

OPEN_EXISTING,

0,

NULL); // don’t copy any file’s attributes

if (hDevice != INVALID_HANDLE_VALUE) // we can
open the drive
{

PARTITION_INFORMATION partitionInfo;

bResult = DeviceIoControl( hDevice,
// device we are querying

IOCTL_DISK_GET_PARTITION_INFO, // operation to perform

NULL,

0, // no input buffer, so pass zero

&partitionInfo,

sizeof(partitionInfo), // output buffer

&junk, // discard count of bytes returned

NULL); // synchronous I/O
if (bResult)
{

switch(partitionInfo.PartitionType)
{
case PARTITION_FAT32:
case PARTITION_FAT32_XINT13:
{
return
CString(“FAT32”);
}

case PARTITION_FAT_12:
{
return
CString(“FAT12”);
}

case PARTITION_FAT_16:
{
return
CString(“FAT”);
}
} // switch on partition type
}

CloseHandle(hDevice); // we’re
done with the handle

} // got handle

if (!bResult)
{
LPVOID lpMsgBuf;
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |

FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
0, // Default language
(LPTSTR) &lpMsgBuf,
0,
NULL
);
// Process any inserts in lpMsgBuf.
// …
// Display the string.
MessageBox( NULL, (LPCTSTR)lpMsgBuf,
“Error”, MB_OK |
MB_ICONINFORMATION );
// Free the buffer.
} // failed

} // case NT/2000


You are currently subscribed to ntfsd as: xxxxx@exchange.microsoft.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntfsd as: xxxxx@miramar.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntfsd as: xxxxx@microsoft.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com