HyperDbg Debugger
Loading...
Searching...
No Matches
replace-sdk-wdk Namespace Reference

Functions

bool replace_in_file (str filepath)
None main ()

Variables

str TARGET_SDK_WDK_VERSION = "10.0.28000.0"
list TARGET_PROJECTS
dict REPLACEMENTS
dict EXCLUDED_DIR_NAMES = {".git"}

Function Documentation

◆ main()

None main ( void )
46def main() -> None:
47 script_path = os.path.abspath(__file__)
48 script_dir = os.path.dirname(script_path)
49 target_root = os.path.dirname(script_dir) # parent of this folder
50
51 wanted = set(TARGET_PROJECTS)
52 found = set()
53
54 print(f"Scanning under: {target_root}")
55 print(f"Looking for: {', '.join(sorted(wanted))}")
56
57 changed_count = 0
58 for root, dirs, files in os.walk(target_root):
59 # Prune in place so os.walk never descends into these directories.
60 dirs[:] = [d for d in dirs if d not in EXCLUDED_DIR_NAMES]
61
62 for file in files:
63 if file in wanted:
64 filepath = os.path.join(root, file)
65 found.add(file)
66
67 if replace_in_file(filepath):
68 print(f"Updated: {filepath}")
69 changed_count += 1
70 else:
71 print(f"No matching text found, left unchanged: {filepath}")
72
73 missing = wanted - found
74 for name in sorted(missing):
75 print(f"Warning: not found anywhere under {target_root}: {name}")
76
77 print(f"Done. {changed_count} file(s) updated.")
78
79
followed by execute main
Definition command-parser-testcases.txt:284
set(SourceFiles "header/core/Core.h" "header/driver/Driver.h" "header/driver/Loader.h" "header/misc/Global.h" "header/pch.h" "code/core/Core.c" "code/driver/Driver.c" "code/driver/Ioctl.c" "code/driver/Loader.c") include_directories("../../../hyperdbg/include" "header") wdk_add_driver(hyperdbg_driver KMDF 1.15 $
Definition CMakeLists.txt:2

◆ replace_in_file()

bool replace_in_file ( str filepath)
31def replace_in_file(filepath: str) -> bool:
32 with open(filepath, "r", encoding="utf-8", errors="ignore") as f:
33 content = f.read()
34
35 original = content
36 for old, new in REPLACEMENTS.items():
37 content = content.replace(old, new)
38
39 if content != original:
40 with open(filepath, "w", encoding="utf-8") as f:
41 f.write(content)
42 return True
43 return False
44
45

Variable Documentation

◆ EXCLUDED_DIR_NAMES

dict replace-sdk-wdk.EXCLUDED_DIR_NAMES = {".git"}

◆ REPLACEMENTS

dict replace-sdk-wdk.REPLACEMENTS
Initial value:
= {
"<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>": "<WindowsTargetPlatformVersion>" + TARGET_SDK_WDK_VERSION + "</WindowsTargetPlatformVersion>",
"<WindowsTargetPlatformVersion>$(LatestTargetPlatformVersion)</WindowsTargetPlatformVersion>": "<WindowsTargetPlatformVersion>" + TARGET_SDK_WDK_VERSION + "</WindowsTargetPlatformVersion>",
}

◆ TARGET_PROJECTS

list replace-sdk-wdk.TARGET_PROJECTS
Initial value:
= [
"hyperhv.vcxproj",
"hyperkd.vcxproj",
"hypertrace.vcxproj",
"hyperlog.vcxproj",
"hyperevade.vcxproj",
"hyperperf.vcxproj",
"kdserial.vcxproj",
"hyperdbg_driver.vcxproj",
]

◆ TARGET_SDK_WDK_VERSION

str replace-sdk-wdk.TARGET_SDK_WDK_VERSION = "10.0.28000.0"