51 Commits
v0.9 ... master

Author SHA1 Message Date
  he3als 97c2790bb8 Merge pull request 'Add de-amelioration & more' (#13) from review into master 1 month ago
  he3als ad8f622ffe
fix(de-ame): ChoicePrompt starts from 0, not 1 1 month ago
  he3als 69f5cb0be7
feat(de-ame): auto-uninstall of ExplorerPatcher 1 month ago
  he3als 2311044abc
fix(de-ame): no /Server for Win 10 1 month ago
  he3als a19de34df2
fix(deameliorate): remove debugging ReadKey 1 month ago
  he3als 8e3b009195
feat: deameliorate function 1 month ago
  he3als 544083e817
feat(SelectWindowsImage): return winver & check it 1 month ago
  he3als 8206fe87b4
feat(.NET): move Windows ISO mount to new class 1 month ago
  he3als 5f44c7cb79
fix: update all packages 1 month ago
  he3als a25c919eaa
feat: menu using WASD 1 month ago
  he3als e986cde90b
fix(.net 3.5): final touches (ejecting ISO, etc) 5 months ago
  he3als 96135bca0d
fix(.net 3.5): general fixes 5 months ago
  he3als e0d0bfd030
feat: .NET 3.5 with USB/folder 5 months ago
  he3als 8c6c9c3d3c
feat(users): password reconfirmation 5 months ago
  Styris d1858244ba Update README 8 months ago
  Styris 14359b9855 C# Update 8 months ago
  Styris 8fb460ba4f Update 'README.md' 1 year ago
  Styris bc8cec4dab Update 'README.md' 1 year ago
  Styris 8b04e77b8f Update 'README.md' 1 year ago
  Styris d5778d8e47 Update 'README.md' 1 year ago
  Styris 8688290afd Update README 1 year ago
  Styris 6ed9ff89f6 Update README 1 year ago
  Styris 09cece9a2b Release v1.4 1 year ago
  Joe 1d8824361f Remove Usage note from README 1 year ago
  Joe fe6a69b0b9 Release v1.3 1 year ago
  Joe 261ffbfe3b Release v1.3 1 year ago
  Joe 132207db69 Update README 1 year ago
  Joe c77ddc8b92 Update README 1 year ago
  Joe e9826f2421 Update README 1 year ago
  Joe 7e25b9492e Update to v1.2 1 year ago
  Joe 8975759622 Update 'screenshot.png' 1 year ago
  Joe 2d94f7cc70 Update to v1.1 1 year ago
  Joe fae04020d1 Update to v1.0 1 year ago
  Joe 55b6c53585 Updated README title 1 year ago
  Joe 56c8d3b937 Added NVIDIA-Control-Panel item to links.txt 1 year ago
  Joe 6d14ed1d99 Removed prev links file 1 year ago
  Joe 11584899da Updated links.txt 1 year ago
  Joe 99b50ac64d Updated links.txt 1 year ago
  Joe 5680324da9 Updated links.txt 1 year ago
  Joe e0bec3c875 Updated links.txt 1 year ago
  Joe 05dee84a0d Updated links.txt 1 year ago
  Joe a7677b5d06 Updated links.txt file 1 year ago
  Joe 0a10369d11 Updated links.txt file 1 year ago
  Joe be32e645a2 Updated wsldistrolinks.txt 2 years ago
  Joe f6aef36456 Updated wsldistrolinks.txt 2 years ago
  Joe c7f57c9a2f Added wsl links file for testing purposes 2 years ago
  Joe 6ea6ce22bb Output and spacing improvements. Functional improvements. Bug fixes 2 years ago
  Joe 4fb29f5ae4 Bug fixes and improvements 2 years ago
  Joe adbd3edff9 Changed script version 2 years ago
  Joe b978930cb1 Added profile image function. Added hibernation function. Added beta new user function. Bug fixes and improvements 2 years ago
  Joe 844f0eefc2 Update 'README.md' 2 years ago
46 changed files with 8617 additions and 1160 deletions
Split View
  1. +559
    -0
      .gitignore
  2. +0
    -1115
      CentralAMEScript.cmd
  3. +111
    -45
      README.md
  4. +29
    -0
      links.txt
  5. BIN
      screenshot.png
  6. BIN
      src/7z.dll
  7. +132
    -0
      src/Actions/.NET.cs
  8. +313
    -0
      src/Actions/AutoLogon.cs
  9. +239
    -0
      src/Actions/Deameliorate.cs
  10. +21
    -0
      src/Actions/Elevation.cs
  11. +1089
    -0
      src/Actions/Languages.cs
  12. +113
    -0
      src/Actions/Lockscreen.cs
  13. +124
    -0
      src/Actions/Profile.cs
  14. +220
    -0
      src/Actions/UserPass.cs
  15. +19
    -0
      src/Actions/UsernameRequirement.cs
  16. +299
    -0
      src/Actions/Users.cs
  17. +201
    -0
      src/Ameliorated.ConsoleUtils/ConsoleTUI/ConsoleTUI.cs
  18. +198
    -0
      src/Ameliorated.ConsoleUtils/ConsoleTUI/Frame.cs
  19. +397
    -0
      src/Ameliorated.ConsoleUtils/ConsoleTUI/FrameWriteMethods.cs
  20. +433
    -0
      src/Ameliorated.ConsoleUtils/ConsoleTUI/Menu.cs
  21. +196
    -0
      src/Ameliorated.ConsoleUtils/ConsoleTUI/MouseInterface.cs
  22. +604
    -0
      src/Ameliorated.ConsoleUtils/ConsoleTUI/Prompt.cs
  23. +250
    -0
      src/Ameliorated.ConsoleUtils/ConsoleUtils.cs
  24. +88
    -0
      src/Ameliorated.ConsoleUtils/Extensions.cs
  25. +74
    -0
      src/Ameliorated.ConsoleUtils/ParentProcess.cs
  26. +6
    -0
      src/Ameliorated.ConsoleUtils/Payload.cs
  27. +10
    -0
      src/App.config
  28. +342
    -0
      src/Extra/Extra.cs
  29. +281
    -0
      src/Extra/NVCP.cs
  30. +40
    -0
      src/Extra/WSH.cs
  31. +3
    -0
      src/FodyWeavers.xml
  32. +41
    -0
      src/Globals.cs
  33. +220
    -0
      src/Misc/FolderPicker.cs
  34. +261
    -0
      src/Misc/SelectWindowsImage.cs
  35. +525
    -0
      src/NSudo.cs
  36. +141
    -0
      src/Program.cs
  37. +35
    -0
      src/Properties/AssemblyInfo.cs
  38. +375
    -0
      src/Registry.cs
  39. +263
    -0
      src/amecs.cs
  40. +266
    -0
      src/amecs.csproj
  41. BIN
      src/amecs.ico
  42. BIN
      src/amecs.png
  43. +16
    -0
      src/amecs.sln
  44. BIN
      src/amecs_old.ico
  45. +17
    -0
      src/app.manifest
  46. +66
    -0
      src/packages.config

+ 559
- 0
.gitignore View File

@ -0,0 +1,559 @@
!*.gitkeep
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.tlog
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Nuget personal access tokens and Credentials
nuget.config
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd
# VS Code files for those working on multiple tools
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
# Local History for Visual Studio Code
.history/
# Windows Installer files from build outputs
*.cab
*.msi
*.msix
*.msm
*.msp
# JetBrains Rider
.idea/
*.sln.iml
### Git ###
# Created by git for backups. To disable backups in Git:
# $ git config --global mergetool.keepBackup false
*.orig
# Created by git when using merge tools for conflicts
*.BACKUP.*
*.BASE.*
*.LOCAL.*
*.REMOTE.*
*_BACKUP_*.txt
*_BASE_*.txt
*_LOCAL_*.txt
*_REMOTE_*.txt
### vs ###
# User-specific files
# User-specific files (MonoDevelop/Xamarin Studio)
# Mono auto generated files
# Build results
# Visual Studio 2015/2017 cache/options directory
# Uncomment if you have tasks that create the project's static files in wwwroot
# Visual Studio 2017 auto generated files
# MSTest test Results
# NUnit
# Build Results of an ATL Project
# Benchmark Results
# .NET Core
# StyleCop
# Files built by Visual Studio
# Chutzpah Test files
# Visual C++ cache files
# Visual Studio profiler
# Visual Studio Trace Files
# TFS 2012 Local Workspace
# Guidance Automation Toolkit
# ReSharper is a .NET coding add-in
# TeamCity is a build add-in
# DotCover is a Code Coverage Tool
# AxoCover is a Code Coverage Tool
# Coverlet is a free, cross platform Code Coverage Tool
coverage*[.json, .xml, .info]
# Visual Studio code coverage results
# NCrunch
# MightyMoose
# Web workbench (sass)
# Installshield output folder
# DocProject is a documentation generator add-in
# Click-Once directory
# Publish Web Output
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
# NuGet Packages
# NuGet Symbol Packages
# The packages folder can be ignored because of Package Restore
# except build/, which is used as an MSBuild target.
# Uncomment if necessary however generally it will be regenerated when needed
# NuGet v3's project.json files produces more ignorable files
# Microsoft Azure Build Output
# Microsoft Azure Emulator
# Windows Store app package directories and files
# Visual Studio cache files
# files ending in .cache can be ignored
# but keep track of directories ending in .cache
# Others
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
# RIA/Silverlight projects
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
# SQL Server files
# Business Intelligence projects
# Microsoft Fakes
# GhostDoc plugin setting file
# Node.js Tools for Visual Studio
# Visual Studio 6 build log
# Visual Studio 6 workspace options file
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
# Visual Studio LightSwitch build output
# Paket dependency manager
# FAKE - F# Make
# CodeRush personal settings
# Python Tools for Visual Studio (PTVS)
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
# Telerik's JustMock configuration file
# BizTalk build output
# OpenCover UI analysis results
# Azure Stream Analytics local run output
# MSBuild Binary and Structured Log
# NVidia Nsight GPU debugger configuration file
# MFractors (Xamarin productivity tool) working folder
# Local History for Visual Studio
# BeatPulse healthcheck temp database
# Backup folder for Package Reference Convert tool in Visual Studio 2017
# Ionide (cross platform F# VS Code tools) working folder

+ 0
- 1115
CentralAMEScript.cmd
File diff suppressed because it is too large
View File


+ 111
- 45
README.md View File

@ -1,88 +1,80 @@
# Central AME Script
# Central AME Script (amecs)
Script for automating a large assortment of AME related actions.
![Central-AME-Script Screenshot](screenshot.png)
![Central AME Script Screenshot](screenshot.png)
## Usage
You can download the script by going to the [latest release](https://git.ameliorated.info/Joe/Central-AME-Script/releases/latest) and downloading `Central-AME-Script.cmd` from the Downloads section.
You can download the script by going to the [latest release](https://git.ameliorated.info/Styris/amecs/releases/latest) and selecting `amecs.exe` from the **Downloads** section. Once downloaded, simply run `amecs.exe`.
Alternatively, you could clone the repository:
## Summary
git clone https://git.ameliorated.info/Joe/Central-AME-Script.git
As part of the amelioration process, certain UI elements, such as the **Region and language** page in Windows Settings, have been removed, and require alternative ways to execute the tasks. This script fills in those gaps, and allows for automating a large variety of customization tasks.
Once downloaded, you can simply run the script.
If you prefer manually executing commands for some of these tasks without a script, you can go through the step-by-step guides on [AME Guides](https://t.me/AMEGuides).
## Primary Functions
There are many actions in AME that require commands, the following functions essentially work as an interactive user interface for those.
There are many actions in AME that require commands or are otherwise unavailable. The following functions work as replacements for those actions.
#### Username/Password
This function allows for changing the user's username or password.
At its core, the following command is used for changing the username:
The following command can also be used for changing a username:
wmic useraccount where "name='<currentUsername>'" rename '<newUsername>'
wmic useraccount where "name='<User's Username>'" rename '<New Username>'
Similarly, the following command is used for changing the password:
Similarly, the following command can be for changing the password:
net user "<currentUsername>" "<newPassword>"
net user "<User's Username>" "<New Password>"
#### Lockscreen Image
This function allows for changing the lockscreen image. This is a modified version of [LoganDark's lockscreen-img script](https://git.ameliorated.info/LoganDark/lockscreen-img).
This function allows for changing the lockscreen image.
It works by taking ownership of the existing lockscreen image files, and replacing them with the new image supplied by the user.
It works by taking ownership of the existing profile image files, and replacing them with the new image supplied by the user.
#### User Elevation
This function allows for elevating the user to administrator. Elevating the user disables the password requirement when trying to run an executable as administrator. However, this has large security implications, thus why it is not the default setting.
At its core, it uses the following command:
#### Profile Image
net localgroup administrators "<currentUsername>" /add
This function allows for changing the user's profile image (PFP).
#### Display Language
It does this by taking ownership of the existing profile image files, and replacing them with the new image supplied by the user. Several necessary registry changes are made as well.
This function allows for changing the user's display language.
Firstly, it prompts the user to download a portion of a ~5.5GB language pack ISO file. Unfortunately, Microsoft no longer publicly distributes individual language pack files, so this is necessary.
Once the ISO is downloaded, it extracts the ISO file, and installs the language pack for the selected display language using the following commands:
#### User Elevation
7z e -y -o"<Script Path>\LangPacks" "<Script Path>\LangPacks.ISO" x64\langpacks\*.cab
lpksetup /i <Language/region ID> /p "<Script Path>\LangPacks\Microsoft-Windows-Client-Language-Pack_x64_<Language/region ID>.cab"
This function allows for elevating or de-elevating the user to or from administrator. Elevating the user disables the password requirement when trying to run an executable as administrator. However, this has large security implications, thus why it is not the default setting.
After the language pack is installed, the display language can finally be set. At its core, this is done by using the following commands:
The following command can also be used for this purpose:
PowerShell -NoP -C "Set-WinSystemLocale <Language/region ID>"
PowerShell -NoP -C "Set-WinUserLanguageList <Language/region ID>"
net localgroup administrators "<User's Username>" /add
The Language/region ID for a given language can be found [here](https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/available-language-packs-for-windows?view=windows-11#language-packs).
Or the following for de-elevating the user:
The script heavily enchances these simple commands. For instance, it keeps the existing keyboard input method (language), and let's the user decide whether or not to make the new language the default keyboard input method.
net localgroup administrators "<User's Username>" /delete
#### Keyboard Language
This function allows for adding a keyboard language.
These functions allow for adding or removing a keyboard language.
At its core, this is done by using the following command:
PowerShell -NoP -C "$NewLangs=Get-WinUserLanguageList; $NewLangs[0].InputMethodTips.Add('<Language/region ID>:<Keyboard identifier>'); Set-WinUserLanguageList $NewLangs -Force"
PowerShell -NoP -C "$NewLangs=Get-WinUserLanguageList; $NewLangs[0].InputMethodTips.Add('<Language/region ID>:<Keyboard Identifier>'); Set-WinUserLanguageList $NewLangs -Force"
If the user chose to make their selection the new default input method, the following command will also be run:
PowerShell -NoP -C "Set-WinDefaultInputMethodOverride -InputTip "<Language/region ID>:<Keyboard identifier>""
PowerShell -NoP -C "Set-WinDefaultInputMethodOverride -InputTip "<Language/region ID>:<Keyboard Identifier>""
The Language/region ID and Keyboard identifier for a given language can be found [here](https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/available-language-packs-for-windows?view=windows-11#language-packs) amd [here](https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/windows-language-pack-default-values?view=windows-11) respecively.
The Language/region ID and Keyboard identifier for a given language can be found [here](https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/available-language-packs-for-windows?view=windows-11#language-packs) and [here](https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/windows-language-pack-default-values?view=windows-11) respectively.
To remove a keyboard language, it fetches the existing language list, filters out the selected language, and sets the modified language list.
#### Username Login Requirement
This function allows for disabling or enabling the username login requirement.
At its core, it uses the following command:
The following command can also be used for this purpose:
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v dontdisplaylastusername /f
@ -90,29 +82,91 @@ Or the following for enabling the requirement:
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v dontdisplaylastusername /t REG_DWORD /d 1 /f
#### AutoLogon
This function allows for enabling or disabling the automatic login of the current user.
It uses modified code from [rzander's AutoLogon program](https://github.com/rzander/AutoLogon), which can also be used for enabling AutoLogon.
#### .NET 3.5
This function allows for enabling or disabling .NET 3.5, requiring a Windows ISO or boot drive for installation.
## Extra Functions
Currently this section only contains legacy functions, these are only useful for versions of AME predating the [REDACTED].
This section contains beta, legacy, or less used functions. Legacy functions are only useful for versions of AME predating the [REDACTED].
#### Windows Script Host
#### Windows Subsystem for Linux (WSL)
This function allows for enabling or disabling Windows Script Host (WSH). WSH is necessary for some programs.
These functions are currently unavailable.
#### Hibernation
This function allows for enabling or disabling the hibernation option in Windows.
At its core, the following commands are used:
reg add "HKEY_USERS\<userSID>\SOFTWARE\Microsoft\Windows Script Host\Settings" /v Enabled /t REG_DWORD /d 1 /f
powercfg /HIBERNATE /TYPE FULL
Or the following for disabling hibernation:
powercfg /HIBERNATE OFF
#### Notification Center
This function allows for enabling or disabling the Notification Center in the bottom right of the taskbar.
The following command can also be used for this purpose:
reg add "HKU\<User's SID>\Software\Policies\Microsoft\Windows\Explorer" /v DisableNotificationCenter /t REG_DWORD /d 0 /f
Or the following for disabling the Notification Center:
reg add "HKU\<User's SID>\Software\Policies\Microsoft\Windows\Explorer" /v DisableNotificationCenter /t REG_DWORD /d 1 /f
#### Desktop Notifications
This function allows for enabling or disabling desktop toast notifications.
The following command can also be used for this purpose:
reg add "HKU\<User's SID>\SOFTWARE\Microsoft\Windows\CurrentVersion\PushNotifications" /v ToastEnabled /t REG_DWORD /d 1 /f
Or the following for disabling desktop notifications:
reg add "HKU\<User's SID>\SOFTWARE\Microsoft\Windows\CurrentVersion\PushNotifications" /v ToastEnabled /t REG_DWORD /d 0 /f
#### Windows Script Host (Legacy)
This function allows for enabling or disabling Windows Script Host (WSH). WSH is necessary for some programs.
The following command can also be used for this purpose:
reg add "HKU\<User's SID>\SOFTWARE\Microsoft\Windows Script Host\Settings" /v Enabled /t REG_DWORD /d 1 /f
reg add "HKLM\SOFTWARE\Microsoft\Windows Script Host\Settings" /v Enabled /t REG_DWORD /d 1 /f
Or the following for disabling WSH:
reg add "HKEY_USERS\<userSID>\SOFTWARE\Microsoft\Windows Script Host\Settings" /v Enabled /t REG_DWORD /d 0 /f
reg add "HKU\<User's SID>\SOFTWARE\Microsoft\Windows Script Host\Settings" /v Enabled /t REG_DWORD /d 0 /f
reg add "HKLM\SOFTWARE\Microsoft\Windows Script Host\Settings" /v Enabled /t REG_DWORD /d 0 /f
#### NCSI Active Probing
#### Visual Basic Script (Legacy)
This function allows for enabling or disabling Visual Basic Script (VBS). VBS is necessary for some programs.
The following command can also be used for this purpose:
assoc .vbs=VBSFile
Or the following for disabling VBS:
assoc .vbs=
#### NCSI Active Probing (Legacy)
This function allows for enabling or disabling NCSI Active Probing. Some applications require this to be enabled.
At its core, it uses the following command:
The following command can also be used for this purpose:
reg add "HKLM\SYSTEM\CurrentControlSet\Services\NlaSvc\Parameters\Internet" /v EnableActiveProbing /t REG_DWORD /d 1 /f
@ -120,6 +174,18 @@ Or the following for disabling NCSI Active Probing:
reg add "HKLM\SYSTEM\CurrentControlSet\Services\NlaSvc\Parameters\Internet" /v EnableActiveProbing /t REG_DWORD /d 0 /f
#### NVIDIA Control Panel
This function allows for installing or uninstalling NVIDIA Control Panel. This is useful since NVIDIA Control Panel no longer properly installs during a driver installation* due to it using an APPX deployment (Not supported in AME).
Firstly, it fetches the store link from this git repository (`links.txt`), and fetches the download link from [store.rg-adguard.net](https://store.rg-adguard.net/). Afterwards, it downloads NVIDIA Control Panel from said link\*. Once NVIDIA Control Panel is downloaded, the script extracts and places it in `<System Drive>\Program Files\NVIDIA Control Panel`, and subsequently creates a start menu shortcut for it.
For removal, it simply removes the `<System Drive>\Program Files\NVIDIA Control Panel` directory, as well as the start menu shortcut.
Note: Even though NVIDIA Control Panel installation fails during a driver installation, it still creates the necessary NVIDIA Control Panel files in `<System Drive>\Program Files\WindowsApps`. If this is the case, the script will attempt to use those files instead of downloading them.
\*Standard drivers do not have this issue, however, those have been discontinued by NVIDIA.
## Known Issues
Some keyboard languages may not work, and a few are improperly tagged. This will be fixed in a future release.
Some keyboard languages may not work, and a few may be improperly tagged.

+ 29
- 0
links.txt View File

@ -0,0 +1,29 @@
[WSL DISTROS]
Ubuntu = |https://aka.ms/wslubuntu2004| -S |894.52 MB| -Alt |https://apps.microsoft.com/store/detail/ubuntu-2004/9N6SVWS3RX71| -AltF |Ubuntu20\.04.*_neutral_.*\.appxbundle| -AltDistro |Ubuntu-20.04|
Ubuntu-18.04 = |https://aka.ms/wsl-ubuntu-1804| -S |221.09 MB| -Alt |https://apps.microsoft.com/store/detail/ubuntu-1804-lts/9N9TNGVNDL3Q| -AltF |Ubuntu18\.04.*_neutral_.*\.appxbundle| -AltDistro |Ubuntu-18.04|
Ubuntu-16.04 = |https://aka.ms/wsl-ubuntu-1604| -S |199.08 MB|
Debian = |https://aka.ms/wsl-debian-gnulinux| -S |167.07 MB| -Alt |https://apps.microsoft.com/store/detail/9MSVKQC78PK6| -AltF |DebianGNULinux.*_neutral_.*76v4g.*\.appxbundle| -AltDistro |Debian|
kali-linux = |https://aka.ms/wsl-kali-linux-new| -S |189.1 MB| -Alt |https://apps.microsoft.com/store/detail/kali-linux/9PKR34TNCV07| -AltF |KaliLinux.*_neutral_.*ey8k8.*\.appxbundle| -AltDistro |kali-linux|
fedoraremix = |https://github.com/WhitewaterFoundry/Fedora-Remix-for-WSL/releases/download/35.12.3/Fedora-Remix-for-WSL-SL_35.12.3.0_x64_arm64.msixbundle| -S |640.22 MB| -Alt |https://apps.microsoft.com/store/detail/9N6GDM4K2HNC| -AltF |WhitewaterFoundryLtd.*FedoraRemixforWSL.*_neutral_.*\.msixbundle| -AltDistro |fedoraremix|
WLinux = |https://apps.microsoft.com/store/detail/pengwin/9NV1GV1PXZ6P| -F |WhitewaterFoundryLtd.*1657.*_neutral_.*\.msixbundle|
WLE = |https://apps.microsoft.com/store/detail/pengwin-enterprise-7/9N8LP0X93VCP| -F |WhitewaterFoundryLtd.*WLinuxEnterprise.*_neutral_.*\.appxbundle|
Alpine = |https://apps.microsoft.com/store/detail/alpine-wsl/9P804CRF0395| -F |AlpineWSL.*_neutral_.*my43b.*\.appxbundle|
openSUSE-42 = |https://aka.ms/wsl-opensuse-42| -S |199.3 MB|
openSUSE-Tumbleweed = |https://aka.ms/wsl-opensuse-tumbleweed| -S |183.03 MB|
openSUSE-Leap-15-1 = |https://apps.microsoft.com/store/detail/opensuseleap151/9NJFZK00FGKV| -F |openSUSE-Leap-15-1.*_x64_.*022rs.*\.appx|
openSUSE-Leap-15.2 = |https://aka.ms/wsl-opensuseleap15-2| -S |141.11 MB|
openSUSE-Leap-15.3 = |https://aka.ms/wsl-opensuseleap15-3| -S |174.81 MB|
OracleLinux_7_9 = |https://aka.ms/wsl-oraclelinux-7-9| -S |125.47 MB|
OracleLinux_8_5 = |https://aka.ms/wsl-oraclelinux-8-5| -S |109.42 MB|
SLES-12 = |https://aka.ms/wsl-sles-12| -S |198.61 MB|
SUSE-Linux-Enterprise-Server-12-SP5 = |https://apps.microsoft.com/store/detail/suse-linux-enterprise-server-12-sp5/9MZ3D1TRP8T1| -F |SUSELinux.*_x64_.*022rs.*\.appx|
SLES-15-SP1 = |https://apps.microsoft.com/store/detail/suse-linux-enterprise-server-15-sp1/9PN498VPMF3Z| -F |SUSELinux.*_x64_.*022rs.*\.appx|
SUSE-Linux-Enterprise-Server-15-SP2 = |https://aka.ms/wsl-SUSELinuxEnterpriseServer15SP2| -S |159.16 MB|
SUSE-Linux-Enterprise-Server-15-SP3 = |https://aka.ms/wsl-SUSELinuxEnterpriseServer15SP3| -S |194.2 MB|
[DRIVER GUIS]
NVIDIA-Control-Panel = |https://apps.microsoft.com/store/detail/nvidia-control-panel/9NF8H0H7WMLT| -F |NVIDIACorp.*_x64_.*56jyb.*\.appx|

BIN
screenshot.png View File

Before After
Width: 732  |  Height: 522  |  Size: 28 KiB Width: 732  |  Height: 538  |  Size: 34 KiB

BIN
src/7z.dll View File


+ 132
- 0
src/Actions/.NET.cs View File

@ -0,0 +1,132 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Security;
using System.Text;
using System.Threading;
using amecs.Misc;
using Ameliorated.ConsoleUtils;
using Microsoft.Dism;
namespace amecs.Actions
{
public class _NET
{
private static string _mountedPath;
private static string _isoPath;
private static void Unmount()
{
if (_isoPath == "none")
return;
SelectWindowsImage.DismountIso(_isoPath);
}
public static bool Install()
{
(_mountedPath, _isoPath, _, _, _) = SelectWindowsImage.GetMediaPath(true);
if (_mountedPath == null) return false;
if (!Directory.Exists(_mountedPath + @"\sources\sxs") || !Directory.GetFiles(_mountedPath + @"\sources\sxs", "*netfx3*").Any())
{
Unmount();
Console.WriteLine();
ConsoleTUI.OpenFrame.Close("ISO/USB/folder does not contain the required files.",
ConsoleColor.Red, Console.BackgroundColor, new ChoicePrompt() { AnyKey = true, Text = "Press any key to return to the Menu: " });
return false;
}
ConsoleTUI.OpenFrame.WriteCentered("\r\nInstalling .NET 3.5");
var topCache = Console.CursorTop;
var leftCache = Console.CursorLeft;
Console.WriteLine();
var inProgress = false;
try
{
using var indicator = new ConsoleUtils.LoadingIndicator();
DismApi.Initialize(DismLogLevel.LogErrors);
using (var session = DismApi.OpenOnlineSession())
{
var stdout = GetStdHandle(-11);
var indicatorStopped = false;
var maxHashTags = (ConsoleTUI.OpenFrame.DisplayWidth - 5);
DismApi.EnableFeatureByPackagePath(session, "NetFX3", null, true, true, new List<string>() { _mountedPath + @"\sources\sxs" }, delegate(DismProgress progress)
{
inProgress = true;
if (!indicatorStopped)
{
indicator.Stop();
Console.SetCursorPosition(leftCache, topCache);
Console.WriteLine(" ");
}
indicatorStopped = true;
var progressPercentage = progress.Current / 10;
var currentHashTags = (int)Math.Ceiling(Math.Min(((double)progressPercentage / 100) * maxHashTags, maxHashTags));
var spaces = maxHashTags - currentHashTags + (4 - progressPercentage.ToString().Length);
var sb = new StringBuilder(new string('#', currentHashTags) + new string(' ', spaces) + progressPercentage + "%");
WriteConsoleOutputCharacter(stdout, sb, (uint)sb.Length, new Languages.COORD((short)ConsoleTUI.OpenFrame.DisplayOffset, (short)Console.CursorTop), out _);
inProgress = false;
});
session.Close();
Thread.Sleep(100);
var sb = new StringBuilder(new string('#', maxHashTags) + " 100%");
uint throwaway;
WriteConsoleOutputCharacter(stdout, sb, (uint)sb.Length, new Languages.COORD((short)ConsoleTUI.OpenFrame.DisplayOffset, (short)Console.CursorTop), out throwaway);
}
DismApi.Shutdown();
Unmount();
} catch (Exception e)
{
while (inProgress)
{
Thread.Sleep(50);
}
Unmount();
Console.WriteLine();
Console.WriteLine();
ConsoleTUI.OpenFrame.Close("DISM error: " + e.Message, ConsoleColor.Red, Console.BackgroundColor, new ChoicePrompt()
{
AnyKey = true,
Text = "Press any key to return to the Menu: "
});
return false;
}
Console.WriteLine();
Console.WriteLine();
ConsoleTUI.OpenFrame.Close(".NET 3.5 installed successfully", ConsoleColor.Green, Console.BackgroundColor, new ChoicePrompt()
{
AnyKey = true,
Text = "Press any key to return to the Menu: "
});
return true;
}
[StructLayout(LayoutKind.Sequential)]
public struct COORD
{
public short X;
public short Y;
public COORD(short X, short Y)
{
this.X = X;
this.Y = Y;
}
};
[DllImport("kernel32.dll", SetLastError = true)]
internal static extern bool WriteConsoleOutputCharacter(IntPtr hConsoleOutput, StringBuilder lpCharacter, uint nLength, Languages.COORD dwWriteCoord, out uint lpNumberOfCharsWritten);
[DllImport("kernel32.dll", SetLastError = true)]
static extern IntPtr GetStdHandle(int nStdHandle);
}
}

+ 313
- 0
src/Actions/AutoLogon.cs View File

@ -0,0 +1,313 @@
using System;
using System.DirectoryServices.AccountManagement;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using Ameliorated.ConsoleUtils;
namespace amecs.Actions
{
public class AutoLogon
{
internal static class SafeNativeMethods
{
#region Structures
[StructLayout(LayoutKind.Sequential)]
public struct LSA_UNICODE_STRING : IDisposable
{
public UInt16 Length;
public UInt16 MaximumLength;
public IntPtr Buffer;
public void Dispose()
{
this = new LSA_UNICODE_STRING();
}
}
public struct LSA_OBJECT_ATTRIBUTES
{
public int Length;
public IntPtr RootDirectory;
public LSA_UNICODE_STRING ObjectName;
public UInt32 Attributes;
public IntPtr SecurityDescriptor;
public IntPtr SecurityQualityOfService;
}
public enum LSA_AccessPolicy : long
{
POLICY_VIEW_LOCAL_INFORMATION = 0x00000001L,
POLICY_VIEW_AUDIT_INFORMATION = 0x00000002L,
POLICY_GET_PRIVATE_INFORMATION = 0x00000004L,
POLICY_TRUST_ADMIN = 0x00000008L,
POLICY_CREATE_ACCOUNT = 0x00000010L,
POLICY_CREATE_SECRET = 0x00000020L,
POLICY_CREATE_PRIVILEGE = 0x00000040L,
POLICY_SET_DEFAULT_QUOTA_LIMITS = 0x00000080L,
POLICY_SET_AUDIT_REQUIREMENTS = 0x00000100L,
POLICY_AUDIT_LOG_ADMIN = 0x00000200L,
POLICY_SERVER_ADMIN = 0x00000400L,
POLICY_LOOKUP_NAMES = 0x00000800L,
POLICY_NOTIFICATION = 0x00001000L
}
#endregion
#region DLL Imports
[DllImport("advapi32")]
public static extern IntPtr FreeSid(IntPtr pSid);
[DllImport("advapi32.dll", PreserveSig = true)]
public static extern UInt32 LsaOpenPolicy(
ref LSA_UNICODE_STRING SystemName,
ref LSA_OBJECT_ATTRIBUTES ObjectAttributes,
Int32 DesiredAccess,
out IntPtr PolicyHandle);
[DllImport("advapi32.dll", SetLastError = true, PreserveSig = true)]
public static extern uint LsaStorePrivateData(
IntPtr PolicyHandle,
LSA_UNICODE_STRING[] KeyName,
LSA_UNICODE_STRING[] PrivateData);
[DllImport("advapi32.dll", PreserveSig = true)]
public static extern uint LsaRetrievePrivateData(
IntPtr PolicyHandle,
LSA_UNICODE_STRING[] KeyName,
out IntPtr PrivateData);
[DllImport("advapi32.dll", PreserveSig = true)]
public static extern uint LsaNtStatusToWinError(uint status);
[DllImport("advapi32.dll")]
public static extern uint LsaClose(IntPtr ObjectHandle);
#endregion
}
#region Functions
/// <summary>
/// Store Encrypted Data
/// </summary>
/// <param name="keyName"></param>
/// <param name="Data"></param>
/// <returns></returns>
public static long StoreData(String keyName, String Data)
{
long winErrorCode = 0;
IntPtr sid = IntPtr.Zero;
int sidSize = 0;
//allocate buffers
sid = Marshal.AllocHGlobal(sidSize);
//initialize an empty unicode-string
SafeNativeMethods.LSA_UNICODE_STRING systemName = new SafeNativeMethods.LSA_UNICODE_STRING();
//Set desired access rights (requested rights)
int access = (int)(SafeNativeMethods.LSA_AccessPolicy.POLICY_CREATE_SECRET);
//initialize a pointer for the policy handle
IntPtr policyHandle = IntPtr.Zero;
//these attributes are not used, but LsaOpenPolicy wants them to exists
SafeNativeMethods.LSA_OBJECT_ATTRIBUTES ObjectAttributes = new SafeNativeMethods.LSA_OBJECT_ATTRIBUTES();
ObjectAttributes.Length = 0;
ObjectAttributes.RootDirectory = IntPtr.Zero;
ObjectAttributes.Attributes = 0;
ObjectAttributes.SecurityDescriptor = IntPtr.Zero;
ObjectAttributes.SecurityQualityOfService = IntPtr.Zero;
//get a policy handle
uint resultPolicy = SafeNativeMethods.LsaOpenPolicy(ref systemName, ref ObjectAttributes, access, out policyHandle);
winErrorCode = SafeNativeMethods.LsaNtStatusToWinError(resultPolicy);
if (winErrorCode != 0)
{
ConsoleTUI.OpenFrame.WriteCenteredLine("OpenPolicy failed: " + winErrorCode);
}
else
{
//initialize an unicode-string for the keyName
SafeNativeMethods.LSA_UNICODE_STRING[] uKeyName = new SafeNativeMethods.LSA_UNICODE_STRING[1];
uKeyName[0] = new SafeNativeMethods.LSA_UNICODE_STRING();
uKeyName[0].Buffer = Marshal.StringToHGlobalUni(keyName);
uKeyName[0].Length = (UInt16)(keyName.Length * UnicodeEncoding.CharSize);
uKeyName[0].MaximumLength = (UInt16)((keyName.Length + 1) * UnicodeEncoding.CharSize);
//initialize an unicode-string for the Data to encrypt
SafeNativeMethods.LSA_UNICODE_STRING[] uData = new SafeNativeMethods.LSA_UNICODE_STRING[1];
uData[0] = new SafeNativeMethods.LSA_UNICODE_STRING();
uData[0].Buffer = Marshal.StringToHGlobalUni(Data);
uData[0].Length = (UInt16)(Data.Length * UnicodeEncoding.CharSize);
uData[0].MaximumLength = (UInt16)((Data.Length + 1) * UnicodeEncoding.CharSize);
//Store Encrypted Data:
SafeNativeMethods.LsaStorePrivateData(policyHandle, uKeyName, uData);
//winErrorCode = LsaNtStatusToWinError(res);
if (winErrorCode != 0)
{
ConsoleTUI.OpenFrame.WriteCenteredLine("LsaStorePrivateData failed: " + winErrorCode);
}
SafeNativeMethods.LsaClose(policyHandle);
}
SafeNativeMethods.FreeSid(sid);
return winErrorCode;
}
/// <summary>
/// Retrieve Encrypted Data
/// </summary>
/// <param name="keyName"></param>
/// <returns></returns>
public static string RetrieveData(String keyName)
{
string sout = "";
long winErrorCode = 0;
IntPtr sid = IntPtr.Zero;
int sidSize = 0;
//allocate buffers
sid = Marshal.AllocHGlobal(sidSize);
//initialize an empty unicode-string
SafeNativeMethods.LSA_UNICODE_STRING systemName = new SafeNativeMethods.LSA_UNICODE_STRING();
//Set desired access rights (requested rights)
int access = (int)(SafeNativeMethods.LSA_AccessPolicy.POLICY_CREATE_SECRET);
//initialize a pointer for the policy handle
IntPtr policyHandle = IntPtr.Zero;
//these attributes are not used, but LsaOpenPolicy wants them to exists
SafeNativeMethods.LSA_OBJECT_ATTRIBUTES ObjectAttributes = new SafeNativeMethods.LSA_OBJECT_ATTRIBUTES();
ObjectAttributes.Length = 0;
ObjectAttributes.RootDirectory = IntPtr.Zero;
ObjectAttributes.Attributes = 0;
ObjectAttributes.SecurityDescriptor = IntPtr.Zero;
ObjectAttributes.SecurityQualityOfService = IntPtr.Zero;
//get a policy handle
uint resultPolicy = SafeNativeMethods.LsaOpenPolicy(ref systemName, ref ObjectAttributes, access, out policyHandle);
winErrorCode = SafeNativeMethods.LsaNtStatusToWinError(resultPolicy);
if (winErrorCode != 0)
{
ConsoleTUI.OpenFrame.WriteCenteredLine("OpenPolicy failed: " + winErrorCode);
}
else
{
//initialize an unicode-string for the keyName
SafeNativeMethods.LSA_UNICODE_STRING[] uKeyName = new SafeNativeMethods.LSA_UNICODE_STRING[1];
uKeyName[0] = new SafeNativeMethods.LSA_UNICODE_STRING();
uKeyName[0].Buffer = Marshal.StringToHGlobalUni(keyName);
uKeyName[0].Length = (UInt16)(keyName.Length * UnicodeEncoding.CharSize);
uKeyName[0].MaximumLength = (UInt16)((keyName.Length + 1) * UnicodeEncoding.CharSize);
//Store Encrypted Data:
IntPtr pData;
long result = SafeNativeMethods.LsaRetrievePrivateData(policyHandle, uKeyName, out pData);
//winErrorCode = LsaNtStatusToWinError(res);
if (winErrorCode != 0)
{
ConsoleTUI.OpenFrame.WriteCenteredLine("LsaStorePrivateData failed: " + winErrorCode);
}
SafeNativeMethods.LSA_UNICODE_STRING ss = (SafeNativeMethods.LSA_UNICODE_STRING)Marshal.PtrToStructure(pData, typeof(SafeNativeMethods.LSA_UNICODE_STRING));
sout = Marshal.PtrToStringAuto(ss.Buffer);
SafeNativeMethods.LsaClose(policyHandle);
}
SafeNativeMethods.FreeSid(sid);
return sout;
}
#endregion
private const string LogonKey = @"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon";
public static bool Disable() => amecs.RunBasicAction("Disabling AutoLogon", "AutoLogon disabled successfully", new Action(() =>
{
new Reg.Value() { KeyName = LogonKey, ValueName = "DefaultUserName", Data = "", Type = Reg.RegistryValueType.REG_SZ}.Apply();
new Reg.Value() { KeyName = LogonKey, ValueName = "AutoAdminLogon", Operation = Reg.RegistryValueOperation.Delete}.Apply();
new Reg.Value() { KeyName = LogonKey, ValueName = "AutoLogonCount", Operation = Reg.RegistryValueOperation.Delete}.Apply();
new Reg.Value() { KeyName = LogonKey, ValueName = "ForceAutoLogon", Operation = Reg.RegistryValueOperation.Delete}.Apply();
new Reg.Value() { KeyName = LogonKey, ValueName = "DisableCAD", Operation = Reg.RegistryValueOperation.Delete}.Apply();
new Reg.Value() { KeyName = LogonKey, ValueName = "DefaultPassword", Operation = Reg.RegistryValueOperation.Delete}.Apply();
StoreData("DefaultPassword", "");
Thread.Sleep(1700);
}));
public static bool Enable()
{
PrincipalContext context = new PrincipalContext(ContextType.Machine);
string password = "";
while (true)
{
password = new InputPrompt() { MaskInput = true, Text = "Enter your password, or press escape to quit: " }.Start();
if (password == null)
return true;
if (String.IsNullOrEmpty(password))
{
try
{
Globals.User.ChangePassword("", "");
break;
} catch {}
}
else if (context.ValidateCredentials(Globals.Username, password))
break;
ConsoleTUI.OpenFrame.WriteLine("Incorrect password.");
Console.WriteLine();
}
try
{
ConsoleTUI.OpenFrame.WriteCentered("\r\nEnabling AutoLogon");
using (new ConsoleUtils.LoadingIndicator(true))
{
new Reg.Value() { KeyName = LogonKey, ValueName = "DefaultUserName", Data = Globals.Username, Type = Reg.RegistryValueType.REG_SZ}.Apply();
new Reg.Value() { KeyName = LogonKey, ValueName = "DefaultDomainName", Data = Environment.MachineName, Type = Reg.RegistryValueType.REG_SZ}.Apply();
new Reg.Value() { KeyName = LogonKey, ValueName = "AutoAdminLogon", Data = 1, Type = Reg.RegistryValueType.REG_DWORD}.Apply();
new Reg.Value() { KeyName = LogonKey, ValueName = "AutoLogonCount", Operation = Reg.RegistryValueOperation.Delete}.Apply();
new Reg.Value() { KeyName = LogonKey, ValueName = "DisableCAD", Data = 1, Type = Reg.RegistryValueType.REG_DWORD}.Apply();
new Reg.Value() { KeyName = LogonKey, ValueName = "DefaultPassword", Operation = Reg.RegistryValueOperation.Delete}.Apply();
StoreData("DefaultPassword", password);
Thread.Sleep(1700);
}
} catch (Exception e)
{
Console.WriteLine();
ConsoleTUI.OpenFrame.Close("Error: " + e.Message.TrimEnd('\n').TrimEnd('\r'), ConsoleColor.Red, Console.BackgroundColor, new ChoicePrompt()
{
AnyKey = true,
Text = "Press any key to return to the Menu: "
});
return false;
}
Console.WriteLine();
ConsoleTUI.OpenFrame.Close($"AutoLogon enabled successfully", ConsoleColor.Green, Console.BackgroundColor, new ChoicePrompt()
{
AnyKey = true,
Text = "Press any key to return to the Menu: "
});
return true;
}
}
}

+ 239
- 0
src/Actions/Deameliorate.cs View File

@ -0,0 +1,239 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Security.Principal;
using System.Threading;
using amecs.Misc;
using Ameliorated.ConsoleUtils;
using Microsoft.Win32;
namespace amecs.Actions
{
public class Deameliorate
{
private static string _mountedPath;
private static string _winVer;
private static string _win11Setup = "";
private static bool _win11 = Environment.OSVersion.Version.Build >= 22000;
private const string ExplorerPatcherId = "D17F1E1A-5919-4427-8F89-A1A8503CA3EB";
public static bool DeAme()
{
if (new ChoicePrompt()
{
Text = @"
This will de-ameliorate by reinstalling Windows.
Although user data should be kept, we strongly recommend
making backups of any important user data.
Continue? (Y/N): "
}.Start().Value == 1) return true;
Program.Frame.Clear();
(_mountedPath, _, _winVer, _, _) = SelectWindowsImage.GetMediaPath();
if (_mountedPath == null) return false;
if (new ChoicePrompt {Text = $"\r\nYour Windows image is {_winVer}. Continue? (Y/N): "}.Start().Value == 1)
return true;
var fc = Console.ForegroundColor;
Console.ForegroundColor = ConsoleColor.Yellow;
string userSid = null;
try
{
NSudo.GetSystemPrivilege();
NSudo.RunAsUser(() =>
{
userSid = WindowsIdentity.GetCurrent().User.ToString();
});
}
catch
{
// do nothing
}
try
{
ConsoleTUI.OpenFrame.WriteCentered("\r\nUninstalling AME-installed UI software...");
string openShellId = null;
var key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall");
foreach (var item in key.GetSubKeyNames())
{
try
{
if (((string)key.OpenSubKey(item).GetValue("DisplayName")).Equals("Open-Shell"))
openShellId = item;
}
catch
{
// do nothing
}
}
if (openShellId != null)
{
ConsoleTUI.OpenFrame.WriteCentered("\r\nUninstalling Open-Shell...");
Process.Start("MsiExec.exe", $"/X{openShellId} /quiet")?.WaitForExit();
if (userSid != null)
{
var appData = (string)Registry.Users.OpenSubKey(userSid + @"\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders").GetValue("AppData");
if (Directory.Exists(Path.Combine(appData, "OpenShell")))
Directory.Delete(Path.Combine(appData, "OpenShell"), true);
}
}
var epSetupPath = $@"{Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles)}\ExplorerPatcher\ep_setup.exe";
if (File.Exists(epSetupPath))
{
ConsoleTUI.OpenFrame.WriteCentered("\r\nUninstalling ExplorerPatcher...");
var winlogon = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", true);
winlogon?.SetValue("AutoRestartShell", 0);
// kill processes that the files use
foreach (var processName in new[] {"explorer.exe", "rundll32.exe", "dllhost.exe", "ShellExperienceHost.exe", "StartMenuExperienceHost.exe"})
{
foreach (var process in Process.GetProcessesByName(Path.GetFileNameWithoutExtension(processName)))
{
process.Kill();
process.WaitForExit();
}
}
// delete DWM service that removes rounded corners
Process.Start("sc", $"stop \"ep_dwm_{ExplorerPatcherId}\"")?.WaitForExit();
Process.Start("sc", $"delete \"ep_dwm_{ExplorerPatcherId}\"")?.WaitForExit();
// remove registered DLL
var explorerPatcherDllPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "ExplorerPatcher", "ExplorerPatcher.amd64.dll");
Process.Start("regsvr32.exe", $"/s /u \"{explorerPatcherDllPath}\"")?.WaitForExit();
// delete files
foreach (var file in new[]
{
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows),
@"SystemApps\ShellExperienceHost_cw5n1h2txyewy\dxgi.dll"),
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows),
@"SystemApps\ShellExperienceHost_cw5n1h2txyewy\wincorlib.dll"),
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows),
@"SystemApps\ShellExperienceHost_cw5n1h2txyewy\wincorlib_orig.dll"),
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows),
@"SystemApps\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\dxgi.dll"),
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows),
@"SystemApps\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\wincorlib.dll"),
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows),
@"SystemApps\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\wincorlib_orig.dll"),
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows),
"dxgi.dll")
})
{
if (File.Exists(file)) File.Delete(file);
}
foreach (var folder in new[]
{
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles),
"ExplorerPatcher"),
Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData),
@"Microsoft\Windows\Start Menu\Programs\ExplorerPatcher")
})
{
if (Directory.Exists(folder)) Directory.Delete(folder, true);
}
winlogon?.SetValue("AutoRestartShell", 1);
}
Program.Frame.Clear();
} catch (Exception e)
{
ConsoleTUI.OpenFrame.Close(
"Error when uninstalling software: " + e.Message,
ConsoleColor.Red, Console.BackgroundColor,
new ChoicePrompt { AnyKey = true, Text = "Press any key to continue anyways: " });
Program.Frame.Clear();
ConsoleTUI.OpenFrame.WriteCentered("\r\nContinuing without uninstalling software...\r\n");
}
// restart Explorer
if (Process.GetProcessesByName("explorer").Length == 0)
NSudo.RunProcessAsUser(NSudo.GetUserToken(), "explorer.exe", "", 0);
// all policies are cleared as a user that's de-ameliorating is unlikely to have their own policies in the first place
// also clear ExplorerPatcher Registry entries
ConsoleTUI.OpenFrame.WriteCentered("\r\nClearing policies...");
foreach (var keyPath in new[] {
$@"HKU\{userSid}\Software\Microsoft\Windows\CurrentVersion\Policies",
$@"HKU\{userSid}\Software\Policies",
$@"HKU\{userSid}\Software\ExplorerPatcher",
$@"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{{{ExplorerPatcherId}}}_ExplorerPatcher",
@"HKLM\Software\Microsoft\Windows\CurrentVersion\Policies",
@"HKLM\Software\Policies",
@"HKLM\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Policies"
})
{
var hive = RegistryHive.LocalMachine;
if (keyPath.StartsWith("HKU"))
hive = RegistryHive.Users;
var baseKey = RegistryKey.OpenBaseKey(hive, RegistryView.Default);
var subKeyPath = keyPath.Substring(keyPath.IndexOf('\\') + 1);
var key = baseKey.OpenSubKey(subKeyPath, true);
if (key == null) continue;
try
{
baseKey.DeleteSubKeyTree(subKeyPath);
}
catch
{
// do nothing - some values might fail, but almost all are deleted
}
key.Close();
}
Thread.Sleep(3000);
Program.Frame.Clear();
ConsoleTUI.OpenFrame.WriteCentered("\r\nCompleted initial setup!", ConsoleColor.Green);
if (_win11)
{
ConsoleTUI.OpenFrame.WriteCentered("\r\nWindows Setup will display as 'Windows Server,' but it's not actually installing Windows Server and is only set as such to bypass hardware requirements.");
Console.WriteLine();
}
ConsoleTUI.OpenFrame.WriteCentered("\r\nWaiting 10 seconds and starting Windows Setup...");
Console.ForegroundColor = fc;
Thread.Sleep(10000);
Console.WriteLine();
try
{
if (_win11) _win11Setup = "/Product Server";
Process.Start(Path.Combine(_mountedPath, "setup.exe"), $"/Auto Upgrade /DynamicUpdate Disable {_win11Setup}");
} catch (Exception e)
{
ConsoleTUI.OpenFrame.Close(
$"There was an error when trying to run the Windows Setup: {e}\r\nTry running the Windows Setup manually from File Explorer.",
ConsoleColor.Red, Console.BackgroundColor,
new ChoicePrompt { AnyKey = true, Text = $"Press any key to exit: " });
return false;
}
ConsoleTUI.OpenFrame.Close(
"Completed, Windows Setup should have started.",
ConsoleColor.Cyan, Console.BackgroundColor,
new ChoicePrompt { AnyKey = true, Text = $"Press any key to go back: " });
return true;
}
}
}

+ 21
- 0
src/Actions/Elevation.cs View File

@ -0,0 +1,21 @@
using System;
using System.Threading;
namespace amecs.Actions
{
public class Elevation
{
public static bool Elevate() => amecs.RunBasicAction("Elevating user to Administrator", "The current user is now an Administrator", new Action(() =>
{
Globals.Administrators.Members.Add(Globals.User);
Globals.Administrators.Save();
Thread.Sleep(1000);
}), true);
public static bool DeElevate() => amecs.RunBasicAction("Revoking Admin rights from the current user", "Admin rights have been revoked for the current user", new Action(() =>
{
Globals.Administrators.Members.Remove(Globals.User);
Globals.Administrators.Save();
Thread.Sleep(1000);
}), true);
}
}

+ 1089
- 0
src/Actions/Languages.cs
File diff suppressed because it is too large
View File


+ 113
- 0
src/Actions/Lockscreen.cs View File

@ -0,0 +1,113 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Security;
using System.Threading;
using Ameliorated.ConsoleUtils;
using Microsoft.Win32;
using System.Windows.Forms;
namespace amecs.Actions
{
public class Lockscreen
{
public static bool ChangeImage()
{
ConsoleTUI.OpenFrame.WriteCenteredLine("Select an image");
Thread.Sleep(1000);
var dialog = new System.Windows.Forms.OpenFileDialog();
dialog.Filter = "Image Files (*.jpg; *.jpeg; *.png; *.bmp; *.jfif)| *.jpg; *.jpeg; *.png; *.bmp; *.jfif"; // Filter files by extension
dialog.Multiselect = false;
dialog.InitialDirectory = Globals.UserFolder;
NativeWindow window = new NativeWindow();
window.AssignHandle(Process.GetCurrentProcess().MainWindowHandle);
if (dialog.ShowDialog(window) == DialogResult.OK)
{
string file;
try
{
file = dialog.FileName;
}
catch (SecurityException e)
{
Console.WriteLine();
ConsoleTUI.OpenFrame.Close("Security error: " + e.Message, ConsoleColor.Red, Console.BackgroundColor, new ChoicePrompt() {AnyKey = true, Text = "Press any key to return to the Menu: "});
return false;
}
Console.WriteLine();
var choice = new ChoicePrompt() { Text = "Remove lockscreen blur? (Y/N): " }.Start();
if (!choice.HasValue) return true;
bool blur = choice == 0;
ConsoleTUI.OpenFrame.WriteCentered("\r\nSetting lockscreen image");
using (new ConsoleUtils.LoadingIndicator(true))
{
Thread.Sleep(500);
try
{
if (blur)
new Reg.Value()
{
KeyName = @"HKLM\SOFTWARE\Policies\Microsoft\Windows\System",
ValueName = "DisableAcrylicBackgroundOnLogon",
Type = Reg.RegistryValueType.REG_DWORD,
Data = 1,
}.Apply();
else
new Reg.Value()
{
KeyName = @"HKLM\SOFTWARE\Policies\Microsoft\Windows\System",
ValueName = "DisableAcrylicBackgroundOnLogon",
Type = Reg.RegistryValueType.REG_DWORD,
Data = 0,
}.Apply();
} catch { }
new Reg.Value()
{
KeyName = @"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Creative\" + Globals.UserSID,
ValueName = "RotatingLockScreenEnabled",
Type = Reg.RegistryValueType.REG_DWORD,
Data = 0,
}.Apply();
new Reg.Value()
{
KeyName = @$"HKU\{Globals.UserSID}\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager",
ValueName = "RotatingLockScreenEnabled",
Type = Reg.RegistryValueType.REG_DWORD,
Data = 0,
}.Apply();
File.Delete(Environment.ExpandEnvironmentVariables(@"%WINDIR%\Web\Screen\img100.jpg"));
File.Copy(file, Environment.ExpandEnvironmentVariables(@"%WINDIR%\Web\Screen\img100.jpg"));
foreach (var dataDir in Directory.EnumerateDirectories(Environment.ExpandEnvironmentVariables(@"%PROGRAMDATA%\Microsoft\Windows\SystemData")))
{
var subDir = Path.Combine(dataDir, "ReadOnly");
if (!Directory.Exists(subDir))
continue;
Directory.GetDirectories(subDir, "Lockscreen_*").ToList().ForEach(x => Directory.Delete(x, true));
}
}
Console.WriteLine();
ConsoleTUI.OpenFrame.Close("Lockscreen image changed successfully", ConsoleColor.Green, Console.BackgroundColor, new ChoicePrompt() {AnyKey = true, Text = "Press any key to return to the Menu: "});
return true;
}