当前位置: 代码迷 >> 驱动开发 >> DeviceIoControl失败,GetLastError()回到87,求高手解答!
  详细解决方案

DeviceIoControl失败,GetLastError()回到87,求高手解答!

热度:184   发布时间:2016-04-28 10:48:21.0
DeviceIoControl失败,GetLastError()返回87,求高手解答!!!
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,一直弄不明白,请高人指教小弟!

------解决方案--------------------