- C/C++ code
DWORD dwNum, dwOut = 4, dwOutRet; HANDLE hDriver = CreateFile(".//EnumProcess.sys", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if(INVALID_HANDLE_VALUE == hDriver) { MessageBox("CreateFile failed!"); return FALSE; } //获取进程个数 BOOL bOk = DeviceIoControl(hDriver, IOCTL_NUM, NULL, 0, &dwNum, dwOut, &dwOutRet, NULL);
bOk一直为FALSE, GetLastError()返回87,一直弄不明白,请高人指教小弟!
------解决方案--------------------