@@ -71,7 +71,7 @@ public enum TYPE {
7171 // (but that's already handled, so it doesn't matter)
7272
7373 // note the trailing slashes on keys to make lookups easier
74- private Dictionary < string , List < string > > WOW64KeyList = new Dictionary < string , List < string > > ( ) {
74+ private Dictionary < string , List < string > > WOW64KeyList = new Dictionary < string , List < string > > ( StringComparer . OrdinalIgnoreCase ) {
7575 { "HKEY_LOCAL_MACHINE\\ SOFTWARE\\ " , null } ,
7676 { "HKEY_LOCAL_MACHINE\\ SOFTWARE\\ CLASSES\\ " , new List < string > ( ) {
7777 "APPID" ,
@@ -470,7 +470,7 @@ private string GetRedirectedKeyValueName(string keyValueName, BINARY_TYPE binary
470470 && wow64NodeSubkeys . Length > 0 ) {
471471 redirected = false ;
472472
473- if ( WOW64KeyList . TryGetValue ( redirectedKeyValueName . ToString ( ) . ToUpperInvariant ( ) , out List < string > wow64SubkeyList ) ) {
473+ if ( WOW64KeyList . TryGetValue ( redirectedKeyValueName . ToString ( ) , out List < string > wow64SubkeyList ) ) {
474474 // if there's no subkey list or we are at the end
475475 if ( wow64SubkeyList == null || wow64Node ) {
476476 redirected = true ;
@@ -884,6 +884,8 @@ public override void Activate(string templateName) {
884884
885885 ProgressManager . CurrentGoal . Start ( modificationsElement . RegistryStates . Count + modificationsElement . RegistryStates . Count ) ;
886886
887+ int registryStateIndex = 0 ;
888+
887889 try {
888890 // populate active modifications
889891 for ( int i = 0 ; i < modificationsElement . RegistryStates . Count ; i ++ ) {
@@ -1004,12 +1006,12 @@ public override void Activate(string templateName) {
10041006
10051007 SetFlashpointSecurePlayerSection ( TemplateName ) ;
10061008
1007- for ( int i = 0 ; i < modificationsElement . RegistryStates . Count ; i ++ ) {
1009+ for ( registryStateIndex = 0 ; registryStateIndex < modificationsElement . RegistryStates . Count ; registryStateIndex ++ ) {
10081010 // the "active" one is the one that doesn't have a name (it has the "active" attribute)
1009- registryStateElement = modificationsElement . RegistryStates . Get ( i ) as RegistryStateElement ;
1011+ registryStateElement = modificationsElement . RegistryStates . Get ( registryStateIndex ) as RegistryStateElement ;
10101012
10111013 if ( registryStateElement == null ) {
1012- throw new ConfigurationErrorsException ( "The Registry State Element (" + i + ") is null." ) ;
1014+ throw new ConfigurationErrorsException ( "The Registry State Element (" + registryStateIndex + ") is null." ) ;
10131015 }
10141016
10151017 activeRegistryStateElement = activeModificationsElement . RegistryStates . Get ( registryStateElement . Name ) as RegistryStateElement ;
@@ -1087,6 +1089,18 @@ public override void Activate(string templateName) {
10871089 ProgressManager . CurrentGoal . Steps ++ ;
10881090 }
10891091 } catch {
1092+ // remove keys we didn't touch
1093+ try {
1094+ while ( registryStateIndex < modificationsElement . RegistryStates . Count ) {
1095+ modificationsElement . RegistryStates . RemoveAt ( registryStateIndex ) ;
1096+ registryStateIndex ++ ;
1097+ }
1098+
1099+ SetFlashpointSecurePlayerSection ( TemplateName ) ;
1100+ } catch {
1101+ // fail silently
1102+ }
1103+
10901104 Deactivate ( ) ;
10911105 throw ;
10921106 } finally {
@@ -1389,18 +1403,20 @@ public void Deactivate(MODIFICATIONS_REVERT_METHOD modificationsRevertMethod) {
13891403 ProgressManager . CurrentGoal . Steps ++ ;
13901404 }
13911405
1392- activeModificationsElement . RegistryStates . BinaryType = BINARY_TYPE . SCS_64BIT_BINARY ;
1393- activeModificationsElement . RegistryStates . _Administrator = false ;
1394- activeModificationsElement . RegistryStates . _CurrentUser = String . Empty ;
1395- SetFlashpointSecurePlayerSection ( TemplateName ) ;
1396-
13971406 if ( taskRequiresElevationException != null ) {
1407+ SetFlashpointSecurePlayerSection ( TemplateName ) ;
13981408 throw taskRequiresElevationException ;
13991409 }
14001410
14011411 if ( exception != null ) {
1412+ SetFlashpointSecurePlayerSection ( TemplateName ) ;
14021413 throw exception ;
14031414 }
1415+
1416+ activeModificationsElement . RegistryStates . BinaryType = BINARY_TYPE . SCS_64BIT_BINARY ;
1417+ activeModificationsElement . RegistryStates . _Administrator = false ;
1418+ activeModificationsElement . RegistryStates . _CurrentUser = String . Empty ;
1419+ SetFlashpointSecurePlayerSection ( TemplateName ) ;
14041420 } finally {
14051421 ProgressManager . CurrentGoal . Stop ( ) ;
14061422 }
0 commit comments