How can I get the user name who invoked the method of COM server?

雨燕双飞 提交于 2019-12-24 02:04:58

问题


I have a COM server written in C++ running on some computer in a network. Clients may perform remote calls to it from the other computers. Can I determine the name of the user which make the call to the COM-methods from the methods itself?


回答1:


You can accomplish this by calling CoImpersonateClient() from within a COM method. One you're impersonating, you can then call GetUserNameEx() to fetch the user name.



来源:https://stackoverflow.com/questions/9486348/how-can-i-get-the-user-name-who-invoked-the-method-of-com-server

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!