#define INVALID_HANDLE_VALUE (HANDLE)-1int ReadDrivePortsInWin9X()
{
int done = FALSE;
HANDLE VxDHandle = 0;
pt_IdeDInfo pOutBufVxD = 0;
DWORD lpBytesReturned = 0;
rt_IdeDInfo info;
unsigned long int i = 0;
// set the thread priority high so that we get exclusive access the disk
SetPriorityClass (GetCurrentProcess (), REALTIME_PRIORITY_CLASS);
// 1. Make an output buffer for the VxD
pOutBufVxD = &info;
ZeroMemory (&info, sizeof(info));
VxDHandle = CreateFile ("\\\\.\\IDE21201.VXD", 0, 0, 0,
0, FILE_FLAG_DELETE_ON_CLOSE, 0); if (VxDHandle != INVALID_HANDLE_VALUE)
{
// 2. Run VxD function
DeviceIoControl (VxDHandle, m_cVxDFunctionIdesDInfo,
0, 0, pOutBufVxD, sizeof(pt_IdeDInfo), &lpBytesReturned, 0); // 3. Unload VxD
CloseHandle (VxDHandle);
}
else
MessageBox (NULL, "ERROR: Could not open IDE21201.VXD file",
"TITLE", MB_OK); // 4. Translate and store data
for (i=0; i<8; i++)
{
if((pOutBufVxD->DiskExists[i]) && (pOutBufVxD->IDEExists[i/2]))
{
DWORD diskinfo [256];
int j;
for ( j = 0; j < 256; j++)
diskinfo [j] = pOutBufVxD -> DisksRawInfo [i * 256 + j]; ReturnInfo (i, diskinfo);
done = TRUE;
}
}
SetPriorityClass (GetCurrentProcess (), NORMAL_PRIORITY_CLASS); return done;
}
{
int done = FALSE;
HANDLE VxDHandle = 0;
pt_IdeDInfo pOutBufVxD = 0;
DWORD lpBytesReturned = 0;
rt_IdeDInfo info;
unsigned long int i = 0;
// set the thread priority high so that we get exclusive access the disk
SetPriorityClass (GetCurrentProcess (), REALTIME_PRIORITY_CLASS);
// 1. Make an output buffer for the VxD
pOutBufVxD = &info;
ZeroMemory (&info, sizeof(info));
VxDHandle = CreateFile ("\\\\.\\IDE21201.VXD", 0, 0, 0,
0, FILE_FLAG_DELETE_ON_CLOSE, 0); if (VxDHandle != INVALID_HANDLE_VALUE)
{
// 2. Run VxD function
DeviceIoControl (VxDHandle, m_cVxDFunctionIdesDInfo,
0, 0, pOutBufVxD, sizeof(pt_IdeDInfo), &lpBytesReturned, 0); // 3. Unload VxD
CloseHandle (VxDHandle);
}
else
MessageBox (NULL, "ERROR: Could not open IDE21201.VXD file",
"TITLE", MB_OK); // 4. Translate and store data
for (i=0; i<8; i++)
{
if((pOutBufVxD->DiskExists[i]) && (pOutBufVxD->IDEExists[i/2]))
{
DWORD diskinfo [256];
int j;
for ( j = 0; j < 256; j++)
diskinfo [j] = pOutBufVxD -> DisksRawInfo [i * 256 + j]; ReturnInfo (i, diskinfo);
done = TRUE;
}
}
SetPriorityClass (GetCurrentProcess (), NORMAL_PRIORITY_CLASS); return done;
}
解决方案 »
- 求个vc6.0的msdn的下载地址,要能用的
- error LNK2001: 无法解析的外部符号 "public:求教
- RichEdit控件接收输入的问题
- vc 下 activex 开发问题
- 关了图形界面后怎么打开?
- 简单简单的问题!
- 怎样随着程序进行一行一行的打印数据(针式打印机)?见才有分!!
- 请问如何使得CStatusBarCtrl在dialog sizing的时候调整位置?
- 请问 LRESULT OnThreadEnd(WPARM wParam,LPRAM lparam) ,这个LRESULT是什么类型
- 请问有没有公认的用VC设计VXD的工具或方法
- VC有8.0???
- 问一个WIN32窗口的问题,!!!
0, FILE_FLAG_DELETE_ON_CLOSE, 0);错误明示告诉你没有相应的东东了啦找到这个VXD文件,并放到你CreateFile的相应路径下