public static void RegisterKeys(string access, string secret)
{
// with all this... it STILL doesn't seem to register in new command prompts or the system until you log out
// OR until you go into System properties / Advanced / Environment variables and hit OK...
//Registry.SetValue("HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment", "snapshot_schedule_access", access);
//Registry.SetValue("HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment", "snapshot_schedule_secret", secret);
System.Environment.SetEnvironmentVariable("snapshot_schedule_access", access, EnvironmentVariableTarget.Machine);
System.Environment.SetEnvironmentVariable("snapshot_schedule_secret", secret, EnvironmentVariableTarget.Machine);
/*
System.Environment.SetEnvironmentVariable("snapshot_schedule_access", access, EnvironmentVariableTarget.Process);
System.Environment.SetEnvironmentVariable("snapshot_schedule_secret", secret, EnvironmentVariableTarget.Process);
System.Environment.SetEnvironmentVariable("snapshot_schedule_access", access, EnvironmentVariableTarget.User);
System.Environment.SetEnvironmentVariable("snapshot_schedule_secret", secret, EnvironmentVariableTarget.User);
*/
int result;
SendMessageTimeout((System.IntPtr)HWND_BROADCAST,
WM_SETTINGCHANGE, 0, "Environment", SMTO_BLOCK | SMTO_ABORTIFHUNG |
SMTO_NOTIMEOUTIFNOTHUNG, 5000, out result);
}