ADR-010c: Phase 1 Win32 Surface — Tier Assignments

Proposed
2026-04-13
  • Status: Proposed
  • Date: 2026-04-13
  • Companion to: ADR-010 — classification rules and decision procedure
  • Applies to: Phase 1 target applications (QuickBooks Desktop, Sage 50, Lacerte, Drake) per win-compat.md § Phase 1

Purpose

ADR-010 defines the rules. This document applies them. Each Win32 function in the Phase 1 surface is classified using the five-axis decision procedure (determinism, statefulness, frequency, risk surface, argument complexity) and assigned a tier. Scaffolding of user/win-compat/ uses this catalog as the source of truth for per-function tier tags in the shim dispatch table.

When a new Win32 function enters the Phase 1 surface (because a target application calls it and we didn’t anticipate it), add it here using the decision procedure. The ADR itself needs revision only if the rules change.

Classification Shorthand

Tier values from ADR-010 § Decision Procedure:

  • T0 — Static shim. Hand-coded in user/win-compat/src/shims/<dll>.rs. Deterministic, fixed or bounded arguments, risk ≠ High.
  • T1 — JIT plan. Translator produces plan on first call, cached per ADR-010 § Caching and Promotion.
  • T2 — Behavioral pattern. Part of a named multi-call sequence; translation happens once per pattern, not per call.
  • T3 — Interactive fallback. Not a default assignment; reached only when T1/T2 translation fails validation.
  • R — Router. Argument-sensitive; see the per-function sub-routing for which sub-handler fires.

Where a function is a router, its sub-handlers are listed inline with their sub-tier assignments.

kernel32.dll

Core process, memory, file I/O, threading. Most of the hot path lives here.

FunctionTierNotes
CreateFileWRRouter. See sub-table below.
ReadFileT0IPC to FS service. Hot. Determinism=High, Args=Fixed, Risk=Medium.
WriteFileT0IPC to FS service. Hot. Same shape as ReadFile.
CloseHandleT0Handle-table free. Determinism=High, Args=Fixed, Risk=Low.
GetLastErrorT0TLS read. Hot. Trivial.
SetLastErrorT0TLS write. Hot. Trivial.
VirtualAllocT0SYS_ALLOCATE. Args=Bounded (protection flags enumerable). Risk=Medium.
VirtualFreeT0SYS_FREE. Determinism=High.
HeapCreateT0Allocator construction in sandbox heap. Cold.
HeapAllocT0Heap allocation. Hot. Statefulness=Handle-scoped.
HeapFreeT0Heap free. Hot.
HeapDestroyT0Heap teardown. Cold.
CreateThreadT1Thread model not yet finalized in CambiOS sandboxes. See Open Question in ADR-010.
ExitThreadT1Depends on CreateThread semantics.
WaitForSingleObjectT1Multiple object kinds (thread, mutex, event); argument-shape inspection needed.
GetModuleHandleWT0Lookup in sandbox’s loaded-module table.
GetProcAddressT0Lookup in shim dispatch table.
LoadLibraryWT1First call may trigger AI-generated shims for uncommon DLLs.
FreeLibraryT0Refcount decrement.
GetSystemTimeAsFileTimeT0SYS_GET_TIME + Win32 epoch conversion.
QueryPerformanceCounterT0SYS_GET_TIME + scaling. Hot.
QueryPerformanceFrequencyT0Constant from timer calibration.
GetTickCountT0SYS_GET_TIME ms. Hot.
GetVersionExWT0Returns configured fake Windows version.
GetSystemInfoT0Returns fixed Win32 SYSTEM_INFO struct.
FindFirstFileWT0VFS query, allocates find-handle.
FindNextFileWT0Find-handle iteration.
FindCloseT0Find-handle free.
GetFileAttributesWT0VFS resolve + attribute translation.
GetFileSizeT0VFS metadata read.
SetFilePointerT0Handle-scoped seek.
GetCommandLineWT0Returns sandbox-configured command line.
GetCurrentProcessIdT0SYS_GET_PID.
GetCurrentThreadIdT0TLS read.
ExitProcessT0SYS_EXIT. Tier 0 but always audited.
SleepT0Scheduler delay via SYS_YIELD + deadline.
EnterCriticalSectionT0User-space spinlock in sandbox heap.
LeaveCriticalSectionT0Same.
InitializeCriticalSectionT0Constructor.
DeleteCriticalSectionT0Destructor.
GetEnvironmentVariableWT0Sandbox-scoped env var read.
SetEnvironmentVariableWT0Sandbox-scoped env var write.
DeviceIoControlRRouter. See sub-table below.

CreateFileW sub-routing

Flag combinationTierHandler
OPEN_EXISTING + FILE_ATTRIBUTE_NORMAL + GENERIC_READ/WRITET0Direct FS-service IPC.
CREATE_NEW / CREATE_ALWAYS + FILE_ATTRIBUTE_NORMALT0FS-service create + IPC.
FILE_FLAG_OVERLAPPED (async I/O)T3Async I/O not yet supported in CambiOS. Prompts user.
FILE_FLAG_NO_BUFFERING / FILE_FLAG_WRITE_THROUGHT1Plan-based; semantics depend on FS service’s caching model.
FILE_ATTRIBUTE_DEVICE / device paths (\\.\)T3Device access via compat layer not supported; user consent.
FILE_FLAG_OPEN_REPARSE_POINTT1Junctions/symlinks; VFS handles but needs plan.

DeviceIoControl sub-routing

IOCTL classTierHandler
FSCTL_GET_VOLUME_INFORMATION, common volume queriesT0Hard-coded responses matching fake volume state.
IOCTL_DISK_*, storage control codesT3Direct device access not permitted.
IOCTL_SERIAL_*, serial port codesT3Defer to Phase 3 instrumentation support.
Vendor-specific / unknown IOCTLsT3User consent required.

ntdll.dll

Low-level runtime, heap, TLS, structured exception handling.

FunctionTierNotes
RtlAllocateHeapT0Heap allocation. Mirrors HeapAlloc. Hot.
RtlFreeHeapT0Heap free. Hot.
RtlReAllocateHeapT0Heap realloc.
RtlCreateHeapT0Heap construction.
RtlDestroyHeapT0Heap destruction.
RtlSizeHeapT0Heap size query.
RtlInitUnicodeStringT0Pure memory setup.
RtlInitAnsiStringT0Pure memory setup.
RtlUnicodeStringToAnsiStringT0UTF-16 → ANSI conversion.
RtlAnsiStringToUnicodeStringT0ANSI → UTF-16 conversion.
NtQueryInformationProcessRInformation class varies widely; most classes T0, some T1.
NtQuerySystemInformationT1Many info classes; per-class plans cached.
RtlAddVectoredExceptionHandlerT2SEH is a sandbox-scoped pattern; part of exception-handling dispatch.
RtlRemoveVectoredExceptionHandlerT2SEH teardown.
NtSetInformationThreadT1TLS, affinity, priority classes.
RtlAcquirePebLockT0Per-sandbox PEB lock.
RtlReleasePebLockT0Same.
NtCloseT0Generic handle close, routes by handle kind.
NtCreateFileRRouter. Lower-level than CreateFileW; used by .NET and some C runtimes.
NtReadFileT0Lower-level ReadFile; same FS-service mapping.
NtWriteFileT0Lower-level WriteFile.
NtQueryAttributesFileT0VFS metadata read.
RtlGetVersionT0Same as GetVersionExW.

user32.dll

Windowing, message pump, dialogs. Phase 1 coverage is minimal — business apps use standard controls.

FunctionTierNotes
CreateWindowExWT2Windowing pattern; coordinated with subsequent message-pump calls.
DestroyWindowT0Window teardown; handle-free.
ShowWindowT0Visibility state change via UI service IPC.
UpdateWindowT0Invalidation signal.
GetMessageWT0Hot. Message queue read. Summary-only audit.
TranslateMessageT0Pure transformation.
DispatchMessageWT0Message dispatch via registered window proc.
DefWindowProcWT0Default window proc; handles standard messages.
PostQuitMessageT0Sets quit flag in sandbox’s message loop.
RegisterClassExWT0Window class registration in sandbox table.
UnregisterClassWT0Window class teardown.
SendMessageWT0Synchronous message delivery within sandbox.
PostMessageWT0Asynchronous message post.
MessageBoxWT0Modal dialog via UI service; bounded set of button/icon combinations.
LoadStringWT0PE resource read.
LoadIconWT0PE resource read.
LoadCursorWT0PE resource read.
SetWindowTextWT0Window title update.
GetWindowTextWT0Window title read.

gdi32.dll

2D rendering, device contexts, fonts. Phase 1 needs basic text/drawing.

FunctionTierNotes
CreateDCWT1DC for printer, display, memory — mode-dependent.
CreateCompatibleDCT0Memory DC; bounded.
DeleteDCT0DC free.
CreateCompatibleBitmapT0Bitmap allocation.
SelectObjectT0DC state update.
DeleteObjectT0GDI object free.
TextOutWT1Font rendering via UI service; plan caches common font configurations.
ExtTextOutWT1Extended text out; similar.
BitBltT0Pixel transfer; mode-limited set.
StretchBltT1Scaling variant; uses UI service.
CreateSolidBrushT0Constant-color brush.
CreateFontIndirectWT1Font lookup; plan per font-family.
GetDeviceCapsT0Fixed DC capability table.

advapi32.dll

Registry, security tokens, cryptography stubs.

FunctionTierNotes
RegOpenKeyExWT0Virtual registry open.
RegQueryValueExWT0Virtual registry read. Warm.
RegSetValueExWT0Virtual registry write.
RegCreateKeyExWRRouter — some flag combinations (security descriptors) go T1.
RegCloseKeyT0Registry handle free.
RegEnumKeyExWT0Registry iteration.
RegEnumValueWT0Registry iteration.
RegDeleteKeyWT0Registry delete.
RegDeleteValueWT0Registry value delete.
OpenProcessTokenT1Security token API; sandbox-scoped.
GetTokenInformationT1Token info classes; per-class plans.
LookupAccountSidWT1SID lookup; sandbox returns parent Principal for user SIDs.
CryptAcquireContextWT1Crypto API; delegates to CambiOS crypto services.
CryptCreateHashT1Hash context creation.
CryptHashDataT0Hash update (Blake3/SHA-256).
CryptDestroyHashT0Hash context free.

ole32.dll

COM runtime. Phase 1 needs light COM for some apps (QuickBooks uses it sparingly).

FunctionTierNotes
CoInitializeExT0Apartment model init.
CoUninitializeT0Apartment teardown.
CoCreateInstanceT2Part of CoCreateInstance → QueryInterface → method behavioral pattern.
CoTaskMemAllocT0Task memory allocation.
CoTaskMemFreeT0Task memory free.
CoRegisterClassObjectT2Class factory registration pattern.
CoGetClassObjectT2Class factory lookup.

shell32.dll

File dialogs, shell integration.

FunctionTierNotes
SHGetFolderPathWT0Fixed mapping of known folder CSIDLs to VFS paths.
SHGetKnownFolderPathT0Same with KNOWNFOLDERID enum.
SHBrowseForFolderWT1UI service dialog; plan varies by BIF flags.
SHGetPathFromIDListWT1PIDL resolution.
ShellExecuteWT1Verb dispatch; sandbox-scoped.

comctl32.dll

Common controls (list view, tree view, status bar).

FunctionTierNotes
InitCommonControlsExT0Initialization call; sandbox state update.
ImageList_CreateT0Image list allocation.
ImageList_AddT0Image list append.
ImageList_DestroyT0Image list free.

Behavioral Patterns (Tier 2)

Multi-call patterns translated as sequences, not as individual functions.

Pattern nameParticipating functionsPattern description
COM instantiationCoCreateInstance, QueryInterface, first method callCreate object, get interface, dispatch. Translator recognizes common CLSID + IID combinations and collapses the sequence to a direct CambiOS service call.
Windowing bootstrapRegisterClassExW, CreateWindowExW, ShowWindow, UpdateWindowStandard window creation sequence. Mapped to UI service window creation.
File open dialogGetOpenFileNameW (plus callbacks, subclassing)Common-dialog file selection. Mapped to UI service file picker.
Printing pipelineStartDoc, StartPage, GDI calls, EndPage, EndDocPrint job construction. Mapped to print service job submission.
SEH dispatchRtlAddVectoredExceptionHandler, exception trigger, RtlRemoveVectoredExceptionHandlerSandbox-scoped exception handling. Requires kernel SEH support (Open Question in ADR-010).
Drag-and-dropDoDragDrop, IDropSource / IDropTarget vtable callsOLE drag-and-drop protocol. Deferred to Phase 2 (CAD apps use this heavily).

Summary

  • Total Phase 1 functions classified: 99
  • Tier 0 (static): 71
  • Tier 1 (JIT plan): 19
  • Tier 2 (behavioral patterns): 6 patterns covering ~12 function roles
  • Tier 3 (interactive fallback): 0 by default; reached via router sub-handlers (FILE_FLAG_OVERLAPPED, device IOCTLs, etc.)
  • Routers: 4 (CreateFileW, DeviceIoControl, NtCreateFile, RegCreateKeyExW)

This catalog is the authoritative per-function classification. When the Phase 0 scaffolding lands in user/win-compat/src/shims/, each shim entry in the dispatch table is tagged with its tier from this catalog. Tier 1 entries carry no implementation (the translator produces them at first call); Tier 0 entries carry a hand-written handler.