Skip to content

Commit 643d740

Browse files
committed
don't assign binary types to the active modification element
1 parent d090c9b commit 643d740

1 file changed

Lines changed: 9 additions & 26 deletions

File tree

FlashpointSecurePlayer/RegistryStates.cs

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -945,11 +945,7 @@ public async Task StopImportAsync() {
945945
// to prevent issues with HKEY_LOCAL_MACHINE and crash recovery
946946
activeModificationsElement.RegistryStates._CurrentUser = WindowsIdentity.GetCurrent().User.Value;
947947
activeModificationsElement.RegistryStates._Administrator = TestLaunchedAsAdministratorUser();
948-
RegistryView registryView = RegistryView.Registry32;
949-
950-
if (modificationsElement.RegistryStates.BinaryType == BINARY_TYPE.SCS_64BIT_BINARY) {
951-
registryView = RegistryView.Registry64;
952-
}
948+
RegistryView registryView = (modificationsElement.RegistryStates.BinaryType == BINARY_TYPE.SCS_64BIT_BINARY) ? RegistryView.Registry64 : RegistryView.Registry32;
953949

954950
ProgressManager.CurrentGoal.Start(modificationsElement.RegistryStates.Count + modificationsElement.RegistryStates.Count);
955951

@@ -1123,8 +1119,8 @@ public void Deactivate(MODIFICATIONS_REVERT_METHOD modificationsRevertMethod = M
11231119
// don't allow infinite recursion!
11241120
if (String.IsNullOrEmpty(templateElementName)) {
11251121
activeModificationsElement.RegistryStates.Clear();
1126-
activeModificationsElement.RegistryStates.BinaryType = BINARY_TYPE.SCS_64BIT_BINARY;
11271122
activeModificationsElement.RegistryStates._Administrator = false;
1123+
activeModificationsElement.RegistryStates._CurrentUser = String.Empty;
11281124
SetFlashpointSecurePlayerSection(TemplateName);
11291125
return;
11301126
}
@@ -1142,8 +1138,8 @@ public void Deactivate(MODIFICATIONS_REVERT_METHOD modificationsRevertMethod = M
11421138

11431139
if (modificationsElement == null) {
11441140
activeModificationsElement.RegistryStates.Clear();
1145-
activeModificationsElement.RegistryStates.BinaryType = BINARY_TYPE.SCS_64BIT_BINARY;
11461141
activeModificationsElement.RegistryStates._Administrator = false;
1142+
activeModificationsElement.RegistryStates._CurrentUser = String.Empty;
11471143
SetFlashpointSecurePlayerSection(TemplateName);
11481144
return;
11491145
}
@@ -1159,12 +1155,7 @@ public void Deactivate(MODIFICATIONS_REVERT_METHOD modificationsRevertMethod = M
11591155
throw new TaskRequiresElevationException("Deactivating the Registry State requires elevation.");
11601156
}
11611157

1162-
RegistryView registryView = RegistryView.Registry32;
1163-
1164-
if (modificationsElement.RegistryStates.BinaryType == BINARY_TYPE.SCS_64BIT_BINARY) {
1165-
// Super Registry 64 DS
1166-
registryView = RegistryView.Registry64;
1167-
}
1158+
RegistryView registryView = (modificationsElement.RegistryStates.BinaryType == BINARY_TYPE.SCS_64BIT_BINARY) ? RegistryView.Registry64 : RegistryView.Registry32;
11681159

11691160
ProgressManager.CurrentGoal.Start(activeModificationsElement.RegistryStates.Count + activeModificationsElement.RegistryStates.Count);
11701161

@@ -1230,8 +1221,8 @@ public void Deactivate(MODIFICATIONS_REVERT_METHOD modificationsRevertMethod = M
12301221

12311222
if (clear) {
12321223
activeModificationsElement.RegistryStates.Clear();
1233-
activeModificationsElement.RegistryStates.BinaryType = BINARY_TYPE.SCS_64BIT_BINARY;
12341224
activeModificationsElement.RegistryStates._Administrator = false;
1225+
activeModificationsElement.RegistryStates._CurrentUser = String.Empty;
12351226
SetFlashpointSecurePlayerSection(TemplateName);
12361227
return;
12371228
}
@@ -1304,9 +1295,9 @@ public void Deactivate(MODIFICATIONS_REVERT_METHOD modificationsRevertMethod = M
13041295

13051296
ProgressManager.CurrentGoal.Steps++;
13061297
}
1307-
1308-
activeModificationsElement.RegistryStates.BinaryType = BINARY_TYPE.SCS_64BIT_BINARY;
1298+
13091299
activeModificationsElement.RegistryStates._Administrator = false;
1300+
activeModificationsElement.RegistryStates._CurrentUser = String.Empty;
13101301
SetFlashpointSecurePlayerSection(TemplateName);
13111302

13121303
if (exception != null) {
@@ -1379,11 +1370,7 @@ private void ModificationAdded(RegistryTraceData registryTraceData) {
13791370

13801371
ulong safeKeyHandle = registryTraceData.KeyHandle & 0x00000000FFFFFFFF;
13811372
object value = null;
1382-
RegistryView registryView = RegistryView.Registry32;
1383-
1384-
if (modificationsElement.RegistryStates.BinaryType == BINARY_TYPE.SCS_64BIT_BINARY) {
1385-
registryView = RegistryView.Registry64;
1386-
}
1373+
RegistryView registryView = (modificationsElement.RegistryStates.BinaryType == BINARY_TYPE.SCS_64BIT_BINARY) ? RegistryView.Registry64 : RegistryView.Registry32;
13871374

13881375
if (safeKeyHandle == 0) {
13891376
// we don't need to queue it, we can just add the key right here
@@ -1591,11 +1578,7 @@ private void KCBStopped(RegistryTraceData registryTraceData) {
15911578
RegistryStateElement registryStateElement;
15921579
object value = null;
15931580

1594-
RegistryView registryView = RegistryView.Registry32;
1595-
1596-
if (modificationsElement.RegistryStates.BinaryType == BINARY_TYPE.SCS_64BIT_BINARY) {
1597-
registryView = RegistryView.Registry64;
1598-
}
1581+
RegistryView registryView = (modificationsElement.RegistryStates.BinaryType == BINARY_TYPE.SCS_64BIT_BINARY) ? RegistryView.Registry64 : RegistryView.Registry32;
15991582

16001583
// we want to take care of any queued registry timeline events
16011584
// an event entails the date and time of the registry modification

0 commit comments

Comments
 (0)