createfile TRUNCATE_EXISTING [英] createfile TRUNCATE_EXISTING

查看:299
本文介绍了createfile TRUNCATE_EXISTING的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在读取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

推荐答案

在10/4/2017 10:22 PM,Randy Seedle写道:

On 10/4/2017 10:22 PM, Randy Seedle wrote:


我正在读取HID设备文件以检索句柄以供以后处理。问题是为什么从f139将pid值更改为0003会导致createfile失败并返回值为5(TRUNCATE_EXISTING)?

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) ?

错误代码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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆