就是,如果存在多个ide硬盘和,use活动存储介质的时候,
该怎么再把GetLogicalVolume函数返回的盘符名,正确分配至相应的disk和相应的分区,谢谢各位大虾了
char Buf[128];
char *p;
UINT Type;
GetLogicalDriveStrings(128,Buf);
for(p=Buf;*p;p+=lstrlen(p)+1)
{
Type=GetDriveType(p);
switch(Type)
{
case DRIVE_UNKNOWN: //The drive type cannot be determined.
case DRIVE_NO_ROOT_DIR: //The root directory does not exist.
case DRIVE_REMOVABLE: //The disk can be removed from the drive.
case DRIVE_FIXED: //The disk cannot be removed from the drive.
case DRIVE_REMOTE: //The drive is a remote (network) drive.
case DRIVE_CDROM: //The drive is a CD-ROM drive.
case DRIVE_RAMDISK: //The drive is a RAM disk.
Default:
}
}
不知道98是否支持
typedef DWORD DEVICE_TYPE ;
typedef struct _STORAGE_DEVICE_NUMBER {
DEVICE_TYPE DeviceType;
ULONG DeviceNumber;
ULONG PartitionNumber;
} STORAGE_DEVICE_NUMBER, *PSTORAGE_DEVICE_NUMBER;
BOOL GetDiskAndPartitionNumbers (char driveLetter, DWORD *diskNumberPtr,
DWORD *partitionNumberPtr)
{//I found this in a message from "Jacob Lorch", dated September 10, 1999:
HANDLE fileHandle;
STORAGE_DEVICE_NUMBER deviceInfo;
DWORD bytesReturned;
char rawDiskName[] = "\\\\.\\C:";
// Open the raw disk
rawDiskName[4] = driveLetter;
fileHandle = CreateFile(rawDiskName, GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL);
if (fileHandle == INVALID_HANDLE_VALUE) return FALSE;
// Get disk and partition number information using a device control
// request
if (!DeviceIoControl(fileHandle, IOCTL_STORAGE_GET_DEVICE_NUMBER, NULL,
0, &deviceInfo, sizeof(deviceInfo), &bytesReturned,
NULL))
return FALSE;
if (bytesReturned != sizeof(deviceInfo))
return FALSE;
// Put values into the passed pointers
*diskNumberPtr = deviceInfo.DeviceNumber;
*partitionNumberPtr = deviceInfo.PartitionNumber;
char msgbuf[128];
sprintf(msgbuf,"%d %d\n", deviceInfo.DeviceNumber, deviceInfo.PartitionNumber);
OutputDebugString(msgbuf);
// Close the handle to the raw disk and return success
CloseHandle(fileHandle);
return TRUE;
}
windows API:win32_GetLogicDrv(),具体的用法见MSDN!
安装SoftICE Driver Suite 2.6就有VToolsD.那边有的下载我也不知道我也是从同事哪里弄到的.