HANDLE hDiskHandle;
unsigned int Error = 0;
char caDirBuf[256] = {0};
char Drive[] = {'\\', '\\', '.', '\\', 'A', ':', '\0'};
STORAGE_DEVICE_NUMBER sdn;
DWORD dwBytesReturned = 0;
HANDLE hDriveHandle = INVALID_HANDLE_VALUE;
if(GetSystemDirectoryA(caDirBuf, MAX_PATH) == 0)
{
Error = 1;
return ;
}
Drive[4] = caDirBuf[0];
hDriveHandle = CreateFileA(Drive, GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
if(hDriveHandle == INVALID_HANDLE_VALUE)
{
//printf("Unable to open drive." );
return ;
}
if (DeviceIoControl(hDriveHandle,IOCTL_STORAGE_GET_DEVICE_NUMBER,
NULL, 0, &sdn,
sizeof(sdn), &dwBytesReturned, NULL))
{
}
else
{
Error = GetLastError();
}
please help me,
thanks,
hitesh ughreja
This does not work with legacy floppy drives.
Probably drive A: is one on the one Vista
computer and an USB floppy or an flash drive
on the other.
Uwe
hi uwe,
thanks for the reply.
i have checked, it is not floppy drive or any usb drive.
but it is performing operation on C:\ where it is a bootable partition
on both machines.
it is SATA connected disk on both machines on AHCI port.
does it have any relation with such driver?
if i am not wrong it is only disk driver which plays role,
please reply me,
thanks,
Hitesh
The drive must answer the request. If it says
ERROR_INVALID_FUNCTION then there is a good
reason.
Is it a dynamic volume or RAID? Then the volume
has more than one device number. Try
IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS instead.
What does my ListUsbDrives tool say?
ListUsbDrives -a
http://www.uwe-sieber.de/files/listusbdrives.zip
Uwe
thanks very much,
my problem gets solved.
regards,
hitesh
Do you realize this is exactly the same as this:
char Drive[] = "\\\\.\\A:";
--
Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.