Skip to content

Commit

Permalink
slight improvement to the method of checking for Application Hives
Browse files Browse the repository at this point in the history
  • Loading branch information
tomysshadow committed Jun 4, 2024
1 parent af413c6 commit b313b6b
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions FlashpointSecurePlayer/RegistryStates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,7 @@ private string GetUserKeyValueName(string keyValueName, string activeCurrentUser
keyValueName = keyValueNameCurrentUser + keyValueName.Substring(HKEY_LOCAL_MACHINE.Length);
}
}

keyValueName = RemoveTrailingSlash(keyValueName);
return keyValueName;
return RemoveTrailingSlash(keyValueName);
}

private string GetKeyValueNameFromKernelRegistryString(string kernelRegistryString) {
Expand Down Expand Up @@ -192,13 +190,9 @@ private string GetKeyValueNameFromKernelRegistryString(string kernelRegistryStri
keyValueName = "HKEY_CURRENT_USER\\" + keyValueName.Substring(keyValueNameCurrentUser.Length);
}
}
} else {
return null;
}
}

keyValueName = RemoveTrailingSlash(keyValueName);
return keyValueName;
return RemoveTrailingSlash(keyValueName);
}

private RegistryKey OpenBaseKeyInRegistryView(string keyName, RegistryView registryView) {
Expand All @@ -225,8 +219,6 @@ private RegistryKey OpenBaseKeyInRegistryView(string keyName, RegistryView regis
} else if (keyName.StartsWith("HKEY_DYN_DATA\\", StringComparison.OrdinalIgnoreCase)) {
registryHive = RegistryHive.DynData;
}

keyName = RemoveTrailingSlash(keyName);

if (registryHive == null) {
return null;
Expand Down Expand Up @@ -1574,7 +1566,8 @@ private void ModificationAdded(RegistryTraceData registryTraceData) {
);

// for keys that are not REGISTRY\MACHINE or REGISTRY\USER, ignore
if (keyName == null) {
// (for Application Hives)
if (String.IsNullOrEmpty(keyName)) {
ModificationRemoved(registryTraceData);
return;
}
Expand Down Expand Up @@ -1650,7 +1643,7 @@ private void ModificationAdded(RegistryTraceData registryTraceData) {
modificationsElement.RegistryStates.BinaryType
);

if (keyName == null) {
if (String.IsNullOrEmpty(keyName)) {
ModificationRemoved(registryTraceData);
return;
}
Expand Down Expand Up @@ -1865,7 +1858,7 @@ private void KCBStopped(RegistryTraceData registryTraceData) {
modificationsElement.RegistryStates.BinaryType
);

if (keyName == null) {
if (String.IsNullOrEmpty(keyName)) {
modificationsElement.RegistryStates.Remove(registryStateElement.Name);
} else {
registryStateElement.KeyName = keyName;
Expand Down

0 comments on commit b313b6b

Please sign in to comment.