MSVC compiler hardening — enable SDL, guard checks, and treat warnings as errors
Summary¶
Phase A hardens the app binary first with /sdl and /guard:cf, then verifies
the produced binary with dumpbin /headers /loadconfig. Later phases can add
warning-policy enforcement and conformance tightening.
Current State¶
/Wall— all warnings enabled (already set)/W4equivalent in practice (some/Wallwarnings suppressed via#pragma warning(disable:...))- Phase A target: app project only
- Deferred:
/WX,/permissive-, third-party/test-project hardening,/analyze
Phase A Additions¶
srchybrid/emule.vcxprojSDLCheck=trueControlFlowGuard=GuardLinkControlFlowGuard=truerepos/emulebb-tooling/ci/check-workspace-policy.py build-policy- assert those properties for app
DebugandRelease python -m emule_workspace- after
build-app, verifyemule.execontains CFG metadata viadumpbin
Later Phases¶
- Expand hardening to tests and workspace-built dependency projects if desired.
- Audit warning suppressions and decide whether
/WXis realistic with/Wall. - Treat
/permissive-as a separate conformance pass.
Acceptance Criteria¶
- [x] app
DebugandReleasebuilds pass with/sdl - [x] app
DebugandReleasebuilds pass with/guard:cf - [x] supported
build-appverification confirms CFG metadata in the built app binary - [x] centralized build-policy audit fails if the app project drops those properties
- [x] later phases remain tracked separately and are not implied complete by Phase A
Completion Evidence¶
- App project state:
workspaces\v0.72a\app\eMule-main\srchybrid\emule.vcxprojdeclaresSDLCheck=true,ControlFlowGuard=Guard, andLinkControlFlowGuard=truefor both appDebugandRelease. - Policy audit state:
repos\emulebb-tooling\ci\check-workspace-policy.py build-policyasserts those app properties for both configurations, and routinepython -m emule_workspace validateruns that audit. - Build orchestration state:
python -m emule_workspacerunsdumpbin /headers /loadconfigthroughVerify-AppControlFlowGuardafterbuild-appand fails when CFG metadata is missing. - 2026-05-10 verification:
python -m emule_workspace build app --config Debug --platform x64passed withAPP mainandAPP main CFGboth OK. Build log:workspaces\v0.72a\state\build-logs\20260510-062221\summary.json. - 2026-05-10 verification:
python -m emule_workspace build app --config Release --platform x64passed withAPP mainandAPP main CFGboth OK. Build log:workspaces\v0.72a\state\build-logs\20260510-062302\summary.json.
Follow-Up Scope¶
This closes Phase A only. Warning-policy enforcement, /WX, /permissive-,
third-party/test-project expansion, and static analysis remain separate
hardening work covered by CI-004, CI-005, CI-010, and related refactor items.