6.3 KiB
6.3 KiB
CRT and Process Startup
- Roots:
entryat0x005a313b, CRT helpers in the0x005a2d..0x005ad4..range, andapp_bootstrap_mainat0x00484440. - Trigger/Cadence: single process startup path before shell or engine services exist.
- Key Dispatchers:
startup_init_tls_state,startup_init_file_handle_table,startup_run_init_callback_table,__setenvp,startup_build_argv,___crtGetEnvironmentStringsA, thenapp_bootstrap_main. - State Anchors: CRT heap and file-handle tables; process environment and argv storage.
- Subsystem Handoffs: exits the generic CRT path at
app_bootstrap_main, which becomes the first RT3-owned coordinator. - Local CRT side seams are tighter now too:
0x005a2c30/0x005a2cb0/0x005a2cd8/0x005a2d10own the global on-exit callback table at0x00dbb8dc/0x00dbb8d8,0x005a2d22is the optionalmscoree.dll!CorExitProcessbridge before the normal process-exit tail,0x005a2dc9/0x005a2e9c/0x005a2ead/0x005a2ebe/0x005a2ecdare the shared exit-cleanup owner plus its four terminate-vs-return and cleanup-vs-skip variants, and0x005a2d64is now bounded as the higher init owner that walks fixed callback tables0x005ed018..0x005ed034and0x005ed000..0x005ed014before registering callback0x005acaa1into that dynamic on-exit table. The same startup-owned table path is now tighter internally too:0x005acaa1is the fixed callback-table walker over0x005eab28..,0x005ac9e7is the capacity query helper that prefers the local CRT heap fast path overKERNEL32!HeapSize, and0x005a6649is the region-descriptor probe under that fast path. The surrounding early-init side is tighter now too:__heap_init0x005a644dis the realHeapCreate + heap-mode + small-block-heapowner, andstartup_run_init_callback_table0x005aca5dis the fixed startup callback walker over the currently empty0x005eab20..band. - the adjacent CRT runtime-report seam is explicit now too:
0x005acdb0is the shared runtime-error or math-error message emitter by code, selecting texts likeR6002,R6024,DOMAIN error,SING error, andTLOSS errorfrom0x0062aac0, then emitting them through the GUI report path or the consoleWriteFilepath.0x005acf27is the smaller banner-pair wrapper around that emitter, and0x005acf60is the registered floating-point exception dispatcher that translates Windows exception codes into the local runtime math codes before falling back toUnhandledExceptionFilter. The nearby unhandled-exception bridge is grounded now too:0x005b1dddis the top-level filter callback that first recognizes the VC++ exception signature before tailing into the previously installed filter, and0x005b1e23/0x005b1e36are its install and restore wrappers overSetUnhandledExceptionFilter. The neighboring fatal security-report owner0x005b1c31is now explicit too: it formats either the buffer-overrun or unknown-security-failure message, appends the current program path, emits that body through the same GUI runtime-report path, and then forces CRT termination. The nearby startup helper0x005ad0c4is the common command-line program-name-tail extractor used by the CRT argument path. The adjacent locale-startup strip is grounded now too:0x005ad524/0x005ad88b/0x005ada1bbuild, release, and publish the primary0xb8locale text record, while0x005adad9and0x005add7frebuild the narrower active locale-text bands rooted at0x0062acd4; those owners all materialize their individual fields through0x005b1a42. The startup-side locale option path is tighter now too: it resolves the older locale selector through0x005ae9d5, which chooses one LCID pair plus codepage from the incoming locale strings, validates them, and writes the resulting triple into0x00dba060. - the adjacent startup argument and environment seam is explicit now too:
0x005ad1f4is the shared two-pass command-line parser that counts and optionally copies argv pointers plus bytes while honoring quotes, backslashes, and the multibyte lead-byte table at0x00dba541.startup_build_argv0x005ad360is the owner above it: it chooses either raw command line0x00dbb8d0or the cached module-path fallback in0x00dba1e8, runs that parser once to size the allocation and once to materialize the final table, then storesargc-1in0x00dba024and the argv root in0x00dba028. On the environment side,___crtGetEnvironmentStringsA0x005ad402materializes one CRT-owned multibyte copy of the Windows environment block usingGetEnvironmentStringsW + WideCharToMultiBytewhen available andGetEnvironmentStringsAotherwise, and__setenvp0x005ad12dthen filters that block into the final envp table by skipping leading-=entries and cloning the admittedname=valuestrings into0x00dba030. - the broader startup owners above those helpers are tighter now too:
startup_init_tls_state0x005abd49is the realTlsAlloc + TlsSetValue + per-thread-blockbootstrap. Beneath it,startup_init_multithread_lock_table0x005a649eseeds the fixed CRT lock table from the static lock-storage band at0x00dba078,startup_release_tls_slot_and_multithread_lock_table0x005abcbais the shared failure cleanup owner, and the adjacent0x005a653c/0x005a6551/0x005a65d0strip now reads cleanly as the generic unlock, lazy-init, and lock-acquire helpers for those CRT multithread slots. The neighboringcrt_get_or_create_current_thread_data_preserving_last_error0x005abcd8is also grounded now as the older CRT per-thread data getter that allocates a zeroed0x88-byte record on first use while preservingGetLastError.startup_init_file_handle_table0x005abf1bis the concrete CRT handle-table owner that seeds the0x00dba780descriptor pages, imports inherited handles fromSTARTUPINFO, grows the table in0x20-entry chunks, and finally backfills the three standard streams fromGetStdHandleplusGetFileType. - Evidence:
artifacts/exports/rt3-1.06/startup-call-chain.md,artifacts/exports/rt3-1.06/function-map.csv. - Current Boundary: the current startup boundary is now carried at
app_bootstrap_main. The CRT shims ahead of it still read as compiler-owned bring-up and import plumbing, and the local static pass does not expose any earlier nontrivial game-owned callback that seeds globals before that handoff.