问题描述
我正在读取HID设备文件以检索句柄以供以后处理。问题是为什么从f139将pid值更改为0003导致createfile失败并返回值为5(TRUNCATE_EXISTING)?将pid值更改回原始
值意味着createfile函数不会出错。
I am reading a HID device file to retrieve a handle for later processing. The question is why would changing the pid value to 0003 from f139 cause the createfile to fail with a return value of 5 (TRUNCATE_EXISTING) ? Changing the pid value back to the original value means the createfile function does not error out.
原始代码行:
HIDfile = CreateFile((LPSTR)devicePath,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
HIDfile = CreateFile((LPSTR)devicePath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
Randy
Randy Seedle
Randy Seedle
推荐答案
错误代码5将是ERROR_ACCESS_DENIED。我对HID一无所知,希望这个小事实可以帮助你避免追逐红鲱鱼。
Error code 5 would be ERROR_ACCESS_DENIED. I don't know anything about HID, just hoping this little fact would help you avoid chasing a red herring.
这篇关于createfile TRUNCATE_EXISTING的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!