在OpenService(hSCM,"RPCSS",GENERIC_READ)方法中获取ERROR_ACCESS_DENIED错误 [英] Getting the ERROR_ACCESS_DENIED error in OpenService(hSCM, "RPCSS", GENERIC_READ) method

查看:96
本文介绍了在OpenService(hSCM,"RPCSS",GENERIC_READ)方法中获取ERROR_ACCESS_DENIED错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在OpenService(hSCM,"RPCSS",GENERIC_READ)方法中收到ERROR_ACCESS_DENIED错误.

Sudocode: SC_HANDLE hSCM;
hSCM = OpenSCManager(NULL,NULL,SC_MANAGER_CONNECT);

hSVC = OpenService(hSCM,"RPCSS",GENERIC_READ);

SERVICE_STATUS状态; <​​br> int bResult = QueryServiceStatus(hSVC,& Status);

CloseServiceHandle(hSCM);
CloseServiceHandle(hSVC);

以上sudocode在Windows XP和内置于Admin用户中的Windows Vista中都可以正常工作.

Above sudocode is working fine in windows XP and also Windows Vista built in Admin user.  But not for user created Admin user.

请尽快告诉我解决方案.

谢谢

Soma

推荐答案

这是由于用户帐户控制.您应该构建该应用程序,以便它提示您以管理员权限运行该应用程序.请参阅链接器文档.

This is due to the user account control. You should build the application so that it prompts you to run the application with admin privilages. Look at the linker documentation for this.

 


这篇关于在OpenService(hSCM,"RPCSS",GENERIC_READ)方法中获取ERROR_ACCESS_DENIED错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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