@@ -68,6 +68,15 @@ public static bool TryGetHitmanVersionByScanning(Process process,
6868 tasks =>
6969 tasks . Select ( task => task . Result )
7070 . Where ( x => x != null ) ) ;
71+
72+ Task < IEnumerable < Patch [ ] > > getDynresEnablePatches =
73+ Task . Factory . ContinueWhenAll ( new Task < Patch [ ] > [ ]
74+ {
75+ findDynresEnable ( exeData ) ,
76+ } ,
77+ tasks =>
78+ tasks . Select ( task => task . Result )
79+ . Where ( x => x != null ) ) ;
7180
7281
7382 Task < IEnumerable < Patch [ ] > > [ ] alltasks =
@@ -76,7 +85,7 @@ public static bool TryGetHitmanVersionByScanning(Process process,
7685 getProtocolPatches , getDynresForceofflinePatches
7786 } ;
7887 // ReSharper disable once CoVariantArrayConversion
79- Task . WaitAll ( alltasks ) ;
88+ Task . WaitAll ( [ .. alltasks , getDynresEnablePatches ] ) ;
8089
8190 bench . Stop ( ) ;
8291#if DEBUG
@@ -96,7 +105,8 @@ public static bool TryGetHitmanVersionByScanning(Process process,
96105 Note ( "AuthHeader2" , getAuthheadPatches . Result . First ( ) [ 1 ] ) ;
97106 Note ( "ConfigDomain" , getConfigdomainPatches . Result . First ( ) [ 0 ] ) ;
98107 Note ( "Protocol" , getProtocolPatches . Result . First ( ) [ 0 ] ) ;
99- Note ( "DynamicResources" , getDynresForceofflinePatches . Result . First ( ) [ 0 ] ) ;
108+ Note ( "DynamicResources->ForceOffline" , getDynresForceofflinePatches . Result . First ( ) [ 0 ] ) ;
109+ Note ( "DynamicResources->Enable" , getDynresEnablePatches . Result . FirstOrDefault ( ) ? [ 0 ] ) ;
100110#endif
101111
102112 result = new HitmanVersion ( )
@@ -106,7 +116,9 @@ public static bool TryGetHitmanVersionByScanning(Process process,
106116 configdomain = getConfigdomainPatches . Result . First ( ) ,
107117 protocol = getProtocolPatches . Result . First ( ) ,
108118 dynres_noforceoffline =
109- getDynresForceofflinePatches . Result . First ( )
119+ getDynresForceofflinePatches . Result . First ( ) ,
120+ dynres_enable =
121+ getDynresEnablePatches . Result . FirstOrDefault ( ) ?? [ ]
110122 } ;
111123
112124 return true ;
@@ -117,6 +129,13 @@ public static bool TryGetHitmanVersionByScanning(Process process,
117129#if DEBUG
118130 private static void Note ( string name , Patch patch )
119131 {
132+ if ( patch == null )
133+ {
134+ Compositions . Logger . log ( $ "{ name } : n/a") ;
135+
136+ return ;
137+ }
138+
120139 Compositions . Logger . log ( $ "{ name } : { patch . offset : X} { BitConverter . ToString ( patch . original ) . Replace ( "-" , string . Empty ) } { BitConverter . ToString ( patch . patch ) . Replace ( "-" , string . Empty ) } ") ;
121140 }
122141#endif
@@ -528,6 +547,31 @@ private static Task<Patch[]> findDynresForceoffline(byte[] data)
528547
529548 #endregion
530549
550+ #region dynres_enable
551+
552+ private static Task < Patch [ ] > findDynresEnable ( byte [ ] data )
553+ {
554+ return Task . Factory . ContinueWhenAll ( new [ ]
555+ {
556+ Task . Factory . StartNew ( ( ) => findPattern ( data , 0x4 , "ba502e23f1488d0d" ) ) // 3.210
557+ . ContinueWith ( task =>
558+ task . Result . Select ( addr => addr + 0x22 + BitConverter . ToInt32 ( data , addr + 0x1A ) ) . ToArray ( ) ) ,
559+ } , tasks =>
560+ {
561+ IEnumerable < int > offsets =
562+ tasks . SelectMany ( task => task . Result ) ;
563+ if ( offsets . Count ( ) != 1 )
564+ return null ;
565+ return new [ ]
566+ {
567+ new Patch ( offsets . First ( ) , "01" , "00" ,
568+ MemProtection . PAGE_EXECUTE_READWRITE )
569+ } ;
570+ } ) ;
571+ }
572+
573+ #endregion
574+
531575 private static int [ ] findPattern ( byte [ ] data , byte alignment ,
532576 string pattern )
533577 {
0 commit comments