[PT Run] Improvements on EnvironmentHelper and deletion of old env vars (#13363)

* Improve log message

* New method

* changes made so far

* code cleanup and new method

* fix method name

* final changes so far

* Code cleanup and typo fixes

* fix bugs and code cleanup

* fix typo

* rename Method

* fix cast exception

* fix type casting

* exception handling for testing

* Update path var name#

* make collections case insensitive

* fix spelling

* add code to update names

* improve comments

* exception handling and logging

* update comments

* final changes

* fix typo

* Update comments

* add summary to IsRunningAsSystem method

* update var and fix typos

* Update code

* add log warning for protected vars

* add comment

* fix bugs

* small change

* Update log text

* Skipp logging for USERNAME
This commit is contained in:
Heiko
2021-11-10 17:38:03 +01:00
committed by GitHub
parent c2adab0716
commit fb97ce040b
3 changed files with 189 additions and 54 deletions

View File

@@ -109,7 +109,7 @@ namespace PowerLauncher
string changeType = Marshal.PtrToStringUni(lparam);
if (changeType == EnvironmentChangeType)
{
Log.Info("Reload environment", typeof(EnvironmentHelper));
Log.Info("Reload environment: Updating environment variables for PT Run's process", typeof(EnvironmentHelper));
EnvironmentHelper.UpdateEnvironment();
handled = true;
}
@@ -125,6 +125,9 @@ namespace PowerLauncher
private void OnSourceInitialized(object sender, EventArgs e)
{
// Initialize protected environment variables before register the WindowMessage
EnvironmentHelper.GetProtectedEnvironmentVariables();
_hwndSource = HwndSource.FromHwnd(new WindowInteropHelper(this).Handle);
_hwndSource.AddHook(ProcessWindowMessages);