从C中的Windows服务设置和检索系统范围的代理设置 [英] Setting and Retrieving system wide proxy settings from a Windows Service in C

查看:73
本文介绍了从C中的Windows服务设置和检索系统范围的代理设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个将作为服务并将选择系统代理设置以与外界进行通信。 API:

WinHttpGetIEProxyConfigForCurrentUser()

 与一起使用

ImpersonateLoggedOnUser()



检索当前登录到系统的用户的代理设置。现在,我想设置系统范围的代理设置,当系统启动且没有用户登录系统时启动的服务将选择
。目前,我不知道应用程序用户如何设置这些系统明智的代理设置以及我的服务将在系统启动时如何选择这些设置。 
可以
任何人请帮助。



retrieves the proxy settings for the user which is currently logged in to the system. Now, I want to set system wide proxy settings which will be picked by service that is started when  system boots up with no user being logged in to the system. At present, I have no idea how the application user can set those system wise proxy settings and how my service will pick those when system boots up. Can anybody please help.

推荐答案

您好
Gaurav Pruthi,

感谢您在此发布。

>>现在,我想要设置系统范围的代理设置,当系统启动且没有用户登录系统时启动的服务将选择这些设置。

对于这种情况,我建议您使用注册表文件来设置代理服务器设置。然后使用类似的代码将其添加到注册表中。

For this case, I suggest you use a registry file to set proxy server settings. Then use like this code to add it into register.

system("regedit add settings.reg");

这是一份供您参考的文件。

Here is a document for you as a reference.

https://support.microsoft.com/en-us/help/819961/how-to-configure-client-proxy-服务器设置使用注册表文件

希望这可以为您提供帮助。

Hope this could be help of you.

最好的问候,

Sera Yu

Best Regards,
Sera Yu


这篇关于从C中的Windows服务设置和检索系统范围的代理设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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