@@ -8180,7 +8180,7 @@ void FixTIFEBreakagesForLegacyControlInterfaces(const MODULEINFO* pmi)
81808180 );
81818181 if (match )
81828182 {
8183- match += 27 ; // Align to jump
8183+ match += 27 ; // Point to jump
81848184 }
81858185 else
81868186 {
@@ -8195,10 +8195,10 @@ void FixTIFEBreakagesForLegacyControlInterfaces(const MODULEINFO* pmi)
81958195 );
81968196 if (match )
81978197 {
8198- match += 8 ; // Align to jump
8198+ match += 8 ; // Point to jump
81998199 }
82008200 }
8201- if (match ) // Should be aligned to jump at this point
8201+ if (match ) // Should be pointed to jump at this point
82028202 {
82038203 PBYTE target = NULL ;
82048204 DWORD jmpInstrSize = 0 ;
@@ -8239,7 +8239,58 @@ void FixTIFEBreakagesForLegacyControlInterfaces(const MODULEINFO* pmi)
82398239 }
82408240 }
82418241#elif defined(_M_ARM64 )
8242- // ARM64 implementation not done yet
8242+ // No TIFE feature flag
8243+ // 69 ?? ?? B9 68 ?? ?? B9 69 ?? ?? 29 <TBZ/TBNZ>
8244+ // Ref: CInternetToolbar::_CreateBands()
8245+ PBYTE match = FindPattern (
8246+ pmi -> lpBaseOfDll ,
8247+ pmi -> SizeOfImage ,
8248+ "\x69\x00\x00\xB9\x68\x00\x00\xB9\x69\x00\x00\x29" ,
8249+ "x??xx??xx??x"
8250+ );
8251+ if (match )
8252+ {
8253+ match += 12 ; // Point to TBZ/TBNZ
8254+ }
8255+ else
8256+ {
8257+ // TIFE feature flag present
8258+ // 68 ?? ?? B9 68 00 20 36 08 79 1B 12 68 ?? ?? B9
8259+ // ^^^^^^^^^^^ <TBZ>
8260+ // Ref: CInternetToolbar::_CreateBands()
8261+ match = FindPattern (
8262+ pmi -> lpBaseOfDll ,
8263+ pmi -> SizeOfImage ,
8264+ "\x68\x00\x00\xB9\x68\x00\x20\x36\x08\x79\x1B\x12\x68\x00\x00\xB9" ,
8265+ "x??xxxxxxxxxx??x"
8266+ );
8267+ if (match )
8268+ {
8269+ match += 4 ; // Point to TBZ
8270+ }
8271+ }
8272+ if (match ) // Should be pointed to TBZ/TBNZ at this point
8273+ {
8274+ DWORD insnCurrent = * (DWORD * )match ;
8275+ DWORD insnNew = 0 ;
8276+ if (ARM64_IsTBZ (insnCurrent ))
8277+ {
8278+ insnNew = ARM64_TBZToB (insnCurrent );
8279+ }
8280+ else if (ARM64_IsTBNZ (insnCurrent ))
8281+ {
8282+ insnNew = 0xD503201F ; // NOP
8283+ }
8284+ if (insnNew != 0 )
8285+ {
8286+ DWORD dwOldProtect ;
8287+ if (VirtualProtect (match , 4 , PAGE_EXECUTE_READWRITE , & dwOldProtect ))
8288+ {
8289+ * (DWORD * )match = insnNew ;
8290+ VirtualProtect (match , 4 , dwOldProtect , & dwOldProtect );
8291+ }
8292+ }
8293+ }
82438294#endif
82448295}
82458296#pragma endregion
0 commit comments