-
Notifications
You must be signed in to change notification settings - Fork 327
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3973 from microsoft/main
Staging - 11/11/24
- Loading branch information
Showing
456 changed files
with
386 additions
and
50,831 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
using Microsoft.Win32; | ||
using Serilog; | ||
|
||
namespace DevHome.Common.Helpers; | ||
|
||
public class GPOHelper | ||
{ | ||
private static readonly ILogger _log = Log.ForContext("SourceContext", nameof(GPOHelper)); | ||
|
||
private enum GpoRuleConfigured | ||
{ | ||
WrongValue = -3, // The policy is set to an unrecognized value | ||
Unavailable = -2, // Couldn't access registry | ||
NotConfigured = -1, // Policy is not configured | ||
Disabled = 0, // Policy is disabled | ||
Enabled = 1, // Policy is enabled | ||
} | ||
|
||
// Registry path where gpo policy values are stored | ||
private const string PoliciesScopeMachine = "HKEY_LOCAL_MACHINE"; | ||
private const string PoliciesPath = @"\SOFTWARE\Policies\DevHome"; | ||
|
||
// Registry value names | ||
private const string PolicyConfigureEnabledDevHome = "ConfigureEnabledDevHome"; | ||
|
||
private static GpoRuleConfigured GetConfiguredValue(string registryValueName) | ||
{ | ||
try | ||
{ | ||
var rawValue = Registry.GetValue( | ||
keyName: PoliciesScopeMachine + PoliciesPath, | ||
valueName: registryValueName, | ||
defaultValue: GpoRuleConfigured.NotConfigured); | ||
|
||
_log.Error($"Registry value {registryValueName} set to {rawValue}"); | ||
|
||
// Value will be null if the subkey specified by keyName does not exist. | ||
if (rawValue == null) | ||
{ | ||
return GpoRuleConfigured.NotConfigured; | ||
} | ||
else if (rawValue is not int && rawValue is not GpoRuleConfigured) | ||
{ | ||
return GpoRuleConfigured.WrongValue; | ||
} | ||
else | ||
{ | ||
return (GpoRuleConfigured)rawValue; | ||
} | ||
} | ||
catch (System.Security.SecurityException) | ||
{ | ||
// The user does not have the permissions required to read from the registry key. | ||
return GpoRuleConfigured.Unavailable; | ||
} | ||
catch (System.IO.IOException) | ||
{ | ||
// The RegistryKey that contains the specified value has been marked for deletion. | ||
return GpoRuleConfigured.Unavailable; | ||
} | ||
catch (System.ArgumentException) | ||
{ | ||
// keyName does not begin with a valid registry root. | ||
return GpoRuleConfigured.NotConfigured; | ||
} | ||
} | ||
|
||
private static bool EvaluateConfiguredValue(string registryValueName, GpoRuleConfigured defaultValue) | ||
{ | ||
var configuredValue = GetConfiguredValue(registryValueName); | ||
if (configuredValue < 0) | ||
{ | ||
_log.Error($"Registry value {registryValueName} set to {configuredValue}, using default {defaultValue} instead."); | ||
configuredValue = defaultValue; | ||
} | ||
|
||
return configuredValue == GpoRuleConfigured.Enabled; | ||
} | ||
|
||
public static bool GetConfiguredEnabledDevHomeValue() | ||
{ | ||
var defaultValue = GpoRuleConfigured.Enabled; | ||
return EvaluateConfiguredValue(PolicyConfigureEnabledDevHome, defaultValue); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
using System; | ||
using System.Diagnostics.Tracing; | ||
using DevHome.Telemetry; | ||
using Microsoft.Diagnostics.Telemetry; | ||
using Microsoft.Diagnostics.Telemetry.Internal; | ||
|
||
namespace DevHome.Common.TelemetryEvents.GitExtension; | ||
|
||
// How git.exe was located | ||
public enum GitDetectStatus | ||
{ | ||
// git.exe was not found on the system | ||
NotFound, | ||
|
||
// In the PATH environment variable | ||
PathEnvironmentVariable, | ||
|
||
// Probed well-known registry keys to find a Git install location | ||
RegistryProbe, | ||
|
||
// Probed well-known folders under Program Files [(x86)] | ||
ProgramFiles, | ||
} | ||
|
||
[EventData] | ||
public class GitDetectEvent : EventBase | ||
{ | ||
public override PartA_PrivTags PartA_PrivTags => PrivTags.ProductAndServicePerformance; | ||
|
||
public string Status { get; } | ||
|
||
public string Version { get; } | ||
|
||
public GitDetectEvent(GitDetectStatus status, string version) | ||
{ | ||
Status = status.ToString(); | ||
Version = version; | ||
} | ||
|
||
public override void ReplaceSensitiveStrings(Func<string, string> replaceSensitiveStrings) | ||
{ | ||
// This event so far has no sensitive strings | ||
} | ||
} |
24 changes: 0 additions & 24 deletions
24
common/TelemetryEvents/SetupFlow/QuickstartPlayground/FeedbackSubmitted.cs
This file was deleted.
Oops, something went wrong.
22 changes: 0 additions & 22 deletions
22
common/TelemetryEvents/SetupFlow/QuickstartPlayground/GenerateButtonClicked.cs
This file was deleted.
Oops, something went wrong.
26 changes: 0 additions & 26 deletions
26
common/TelemetryEvents/SetupFlow/QuickstartPlayground/ProjectGenerationErrorInfo.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.