This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Object Explorer is a native Windows GUI tool (C++20, WTL/ATL) for exploring kernel objects: object types, the object manager namespace, objects, handles (system-wide / per type / per process), and zombie processes/threads.
Visual Studio solution ObjectExplorer.sln (toolset v145). Configurations: Debug, Release, ReleaseSigned; platform x64 (the solution's ARM64 configurations build the x64 projects). There are no linters.
git submodule update --init --recursive # WTLHelper and WinSys are submodules
msbuild ObjectExplorer.sln /p:Configuration=Debug /p:Platform=x64
x64\Debug\ObjExpTests.exe # run the tests
x64\Debug\ObjExpTests.exe "[ProcessHelper]" # tests with a tag; or a test case name
Output goes to x64\<Configuration>\. Run from a Developer Command Prompt (msbuild must be on PATH).
ObjExpTests is a Catch2 (v3) console project for code without UI. Catch2 comes from vcpkg (x64-windows-static, via the user-wide vcpkg MSBuild integration); the project has its own main since vcpkg doesn't link Catch2Main automatically.
- It compiles the ObjExp sources under test directly (
ProcessHelper,AccessMaskDecoder,ObjectManager,DriverHelper,NtDll) and references WTLHelper; add a source there when testing more ObjExp code. - It builds with exceptions (
_HAS_EXCEPTIONS=1), which ObjExp'spch.hallows to override; ObjExp itself builds without them. - It's built only in the solution's
Debug|x64andRelease|x64configurations. - Tests run against the live system (handle list, object namespace, processes); they use objects the test process creates where possible, and don't need elevation.
- UI classes aren't testable as is; logic worth testing is moved out of them (e.g.
SearchMatcher, used by the Find view). - The
[symbols]tests load the kernel's PDB through DIA: a post-build step copiesmsdia140.dll(VS DIA SDK) andsymsrv.dll(Windows SDK debuggers) to the output folder, and_NT_SYMBOL_PATHmust be set. They skip otherwise.
Solution projects:
ObjExp— the application.DiaHelper— static lib wrapping the DIA SDK (DiaSession/DiaSymbol) for reading kernel type layouts from PDBs.WTLHelper(submodule) — the author's shared WTL controls/helpers (virtual list views,CNativeCustomTabView,ToolbarHelper, theming/dark mode,SecurityHelper, etc.). Also vendors WTL itself underWTLHelper\WTL.WinSys(submodule) is not built as part of the solution; only its headers are used, notablyWinSys\WinSys\phnt(native NT API definitions).
Changes to shared helpers in the submodules affect other projects by the same author — prefer changing code in ObjExp unless the helper is clearly generic.
- Precompiled header
pch.h(every.cppincludes it first). Note_HAS_EXCEPTIONS 0— no C++ exceptions; use return values /NTSTATUS/bool. wilis used for RAII handles (wil::unique_handle, etc.); ATLCStringfor strings;std::formatis available.- Native APIs go through the
NT::namespace (NtDll.h) on top of phnt definitions. - New source files must be added to both
ObjExp.vcxprojandObjExp.vcxproj.filters.
- Main frame / tabs:
CMainFrame(MainFrm.*) implementsIMainFrame(Interfaces.h) and hosts aCNativeCustomTabView. Each tab is anIView. Commands are routed from the frame to the active view viaIView::ProcessCommand. - Views:
ViewFactory(singleton) creates views byViewTypeenum and adds them as tabs. Views derive fromCViewBase<T>(ViewBase.h), a CRTP base overCFrameWindowImplthat provides toolbar creation, UI-update access, page activation hooks (OnPageActivated,UpdateUIoverridables), and self-deletion inOnFinalMessage. To add a view: add aViewTypevalue, aCViewBase-derived class, and a case inViewFactory::CreateView. - Data layer:
ObjectManagerenumerates types (EnumTypes), handles (EnumHandles2<T>), and objects (EnumObjects<T>) fromSystemExtendedHandleInformation; object names/info are obtained by duplicating handles into this process (DupHandle) and callingNtQueryObject. Type info is cached in static maps keyed by type index and name.ObjectHelpers/ProcessHelper/AccessMaskDecoderprovide type-specific formatting and details. - Kernel access (requires elevation), two separate drivers:
DriverHelpertalks to the author'sKObjExpdriver (\\.\KObjExp, versioned viaDRIVER_CURRENT_VERSION) to open objects by address, duplicate handles from other processes, and get object addresses.DbgDriveruses Microsoft'skldbgdrv.sys(embedded as resourceIDR_DRIVER, extracted and installed as a service on demand) for reading/writing kernel virtual memory. Opened at startup only when running elevated (ObjExp.cpp).
- Symbols / structures:
SymbolManager+SymbolHandler(dbghelp) andDiaHelperresolve kernel structure layouts;StructurePage/SymbolToTreeViewdisplay a kernel object's structure, with memory read throughDbgDriver. - Properties dialog:
ObjectPropertiesDlgis a tabbed dialog;ObjectHelpersassembles its pages (GenericPage,HandlesPage,StructurePage) per object type. Security editing usesSecurityInfo(ACL UI). - Settings:
AppSettings(built on WTLHelper'sSettingsmacros) persists window placement, font, dark mode, etc.;CMainFramebroadcasts dark-mode changes to all views withWM_UPDATE_DARKMODE.