在C#中重现optionalfeatures.exe [英] Reproduce optionalfeatures.exe in C#

查看:125
本文介绍了在C#中重现optionalfeatures.exe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

(单击窗口的可选功能GUI图像) [ ^ ]



我正在尝试使用Windows窗体构建GUI和C#,它的外观和感觉与在Windows-7上执行

(Click for Image of Window's Optional Features GUI)[^]

I am trying to build a GUI, utilizing Windows Forms and C#, that looks and feels identically the same as the GUI that comes up when you execute

%windir%\System32\OptionalFeatures.exe

时出现的GUI相同 - 更高的系统。我使用变量%windir%是DOS环境变量,它指向计算机上安装Windows本身的文件夹,通常是C:\ WINDOWS,这里,因为我知道并非所有系统都将Windows系统文件安装到相同的目录..



上面显示了我所指的特定GUI的图片。它必须工作相同。我认为它实际上只是DISM的一个shell并发出对DISM的调用,然后以某种方式格式化DISM的输出,这不是我的问题(我知道如何填充树视图)。



但是,根据我的经验,DISM不会返回美化功能名称,而是代码名称,而且,我很难搞清楚:



(a)如何解决windows features之间的依赖关系,即树视图显示某些功能依赖于其他功能启用

(b)当您单击以在给定功能的复选框中放置复选标记时,GUI将自动检查/取消选中其他功能的复选框,可能是根据某些规则

(c)如何用户单击确定后实际执行对Windows功能/设置的更改吗?



这是我努力开发交互式从头开始设置这台新计算机程序程序的一部分允许您使用此树并编写脚本,以便您可以将相同的打开或关闭设置的窗口功能应用于一堆其他计算机,作为IT操作/配置管理任务的一部分。


提前致谢...



Brian



什么我试过了:



我尝试使用Telerik JustDecompile反编译OptionalFeatures.exe但无济于事,因为它似乎不是有效的CLR程序集,并且显然,JustDecompile仅适用于此类程序集。



我知道所谓的Harding问题,你无法从已编译的二进制文件中找回确切的源代码......所以我要来了对于社区,看看是否有其他人从直接从操作系统获取信息的角度来解决这个问题,通过一些迄今为止未知的WinAPI呼叫。



我还尝试编写一个.bat文件例程,例如下面列出的例程,调用DISM输出所有功能列表并解析所述列表,然后调用dism / Online / NoRestart / Enable -Feature'< name>'/ All on each,我无法将所有功能都置于开启状态。这是我在当前应用程序中想要的,但GUI是允许系统管理员选择要启用/禁用的功能,然后我们将选择保存到某种脚本文件,然后可以在其他计算机上运行以进行配置他们的Windows功能是一样的。



提前再次感谢。

on a Windows-7-or-higher system. I am using the variable %windir% is the DOS environment variable that points to the folder on your computer where Windows itself is installed, typically C:\WINDOWS, here, since I am aware that not all systems install Windows system files into the same directory..

A picture of the specific GUI I am referring to is shown above. It must work the same. I assume it really is just a shell for DISM and issues calls to DISM and then formats the output of DISM somehow, and that is not my issue (I know how to populate a tree view).

However, it has been my experience that DISM does not return "prettified" feature names but "code names," and also, I am having trouble figuring out :

(a) how to resolve the dependencies between "windows features" i.e., the tree view is to reveal that some features depend on others being enabled
(b) when you click to place a check mark in a given feature's check box, the GUI will automatically check/uncheck other features' check box, presumably according to certain rules
(c) How to actually perform the changes to windows features/settings once the user has clicked OK?

This is my effort to develop an interactive "setup this new computer from scratch" program and part of the program lets you take this tree and script it so you can then apply the same "turn windows features on or off settings" to a bunch of other computers as part of a IT operations/configuration management tasks.

Thanks in advance...

Brian

What I have tried:

I tried decompiling OptionalFeatures.exe with Telerik JustDecompile but to no avail, as it appears to not be a valid CLR assembly, and apparently, JustDecompile only works with such assemblies.

I am aware of the so-called "Harding problem", in which you cannot get back the exact source code from the compiled binary...so I am coming to the community and seeing if anyone else out there has approached this problem from the standpoint of obtaining the information from the operating system directly, via some heretofore-unknown-to-me WinAPI call.

I have also tried writing, basically, a .bat file routine such as the one listed below, that calls DISM to output the list of all features and parses said list, and then calls dism /Online /NoRestart /Enable-Feature '<name>' /All on each, and I am not able to get all the features to the "turned on" state. This is what I want in the current application, but the GUI is to allow a sysadmin to pick and choose features to be enabled/disabled and then we save the choices to some sort of script file that can then be run on other machines to configure their "Windows Features" to be the same.

Thanks again in advance.

推荐答案

5种生成Windows中所有已安装程序列表的方法 [ ^ ]



Windows SIM概述主题| Microsoft Docs [ ^ ]



Windows SIM方案概述| Microsoft Docs [ ^ ]
5 Ways to Generate a List of All Installed Programs in Windows[^]

Windows SIM Overview Topics | Microsoft Docs[^]

Windows SIM Scenarios Overview | Microsoft Docs[^]


这篇关于在C#中重现optionalfeatures.exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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