本文介绍了GetLastError()在CreateFile上返回5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在从远程系统(使用COM)调用CreateFile().它给出了INVALID_HANDLE_VALUE.
我已经使用GetLastError()检查了错误代码,给出了5.
谁能说出问题所在吗?
在本地模式下可以正常运行的相同代码:((..
I am calling CreateFile() form a remote system(using COM). It''s giving INVALID_HANDLE_VALUE.
I have checked the error code using GetLastError(), it giving 5.
Can anybody tell what is the problem??
The same code running ok in local mode :(( .
推荐答案
CoSetProxyBlanket(pReptGen, // pointer to enumerator
RPC_C_AUTHN_WINNT, // authentication service
RPC_C_AUTHZ_NONE, // authorization service
NULL, // server principle name
RPC_C_AUTHN_LEVEL_CALL, // authentication level
RPC_C_IMP_LEVEL_IMPERSONATE, // impersonation level
NULL, // identity of the client
EOAC_NONE); // capability flags
这里pReptGen是我使用CoCreateInstance创建的对象.
现在可以吗?
Here pReptGen is my object which I have created using CoCreateInstance.
Is it ok now??
这篇关于GetLastError()在CreateFile上返回5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!