int check_connect_disk()
{
char Test_Connect_PHYSICALDRIVE[ ] = "\\\\.\\PHYSICALDRIVE0";
int j_how_many_disk_connect;
for(char i='0';i<'9';i++)
{
Test_Connect_PHYSICALDRIVE[17] = i;
//奇怪,应该位置不是17,但输出\\\\.\\PHYSICALDRIVE1结果一般是\\.\PHYSICALDRIVE0
//正解,从\.\\PHYSICALDRIVE1开始
HANDLE hDevice = CreateFile(Test_Connect_PHYSICALDRIVE, // drive to open
0, // no access to the drive
FILE_SHARE_READ, // share mode
NULL, // default security attributes
OPEN_EXISTING, // disposition
0, // file attributes
NULL); // do not copy file attributes
//Test_Connect_PHYSICALDRIVE
if (hDevice != INVALID_HANDLE_VALUE) // cannot open the drive
{
//ShowMessage(Test_Connect_PHYSICALDRIVE);
//ComboBox1->Items->Add("物理磁盘"+IntToStr(i-48));
j_how_many_disk_connect=i-48+1;