Skip to content

Commit

Permalink
Refactor for symbol fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
m417z committed Aug 26, 2024
1 parent 0c21576 commit e657027
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions scripts/01_extract_mod_symbols.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
'win7-alttab-loader': ['alttab.dll'],
}

SYMBOL_MODULES_FIX: dict[str, dict[str, str]] = {
'aerexplorer': {
'windowsstorage.dll': 'windows.storage.dll',
},
}

SYMBOL_BLOCK_MODULES_BY_BLOCK_NAME: dict[tuple[str, str], tuple[str, ...]] = {
('aerexplorer', 'efHooks'): ('ExplorerFrame.dll',),
('aerexplorer', 'isCplHooks'): ('ExplorerFrame.dll',),
Expand Down Expand Up @@ -145,9 +151,7 @@ def deduce_symbol_block_target_modules(mod_name: str, mod_source: str, symbol_bl
# Try the new rules as defined in pr_validation.py.
target_from_name = get_target_module_from_symbol_block_name(symbol_block_name)
if target_from_name:
# Special case for aerexplorer
if target_from_name.lower() != 'windowsstorage.dll':
return [target_from_name.lower()]
return [target_from_name.lower()]

line_num = 1 + mod_source[: symbol_block_match.start()].count('\n')
previous_line = mod_source.splitlines()[line_num - 2]
Expand Down Expand Up @@ -270,7 +274,11 @@ def sub_braced(match):

modules = deduce_symbol_block_target_modules(mod_name, mod_source, symbol_block_match)

modules = [x for x in modules if x not in SYMBOL_MODULES_SKIP.get(mod_name, [])]
modules = [
SYMBOL_MODULES_FIX.get(mod_name, {}).get(x, x)
for x in modules
if x not in SYMBOL_MODULES_SKIP.get(mod_name, [])
]

return {
'symbols': symbols,
Expand Down

0 comments on commit e657027

Please sign in to comment.