code wiki / (root) / nx_pe_container_win_sup.nx

nx_pe_container_win_sup.nx

buildroot/runtime/nx_pe_container_win_sup.nx

14993 B218 linesdepth 4pulls 4 transitivereach 0 importersview sourcekind tooltopic pe
docsdependenciesstructsconstsfunctions

about

nx_pe_container_win.nx -- W4-a: a NISHI ORGAN runs as a Job-Object-governed, supervised container. Composes W2c (Job boundary + limit + CreateProcessW + Wait + GetExitCode + reap) with W3b-6 (a realistic nxc2-compiled organ that runs entirely native). Same governed-run pipeline as W2c, but the child workload is no longer `cmd.exe /c exit 7` -- it is our own Nishi organ `nx_win_compiled_organ.exe` (allocate->fill->print->exit 88). So a sovereign Nishi organ now runs UNDER native Job-Object governance and is reaped by a native supervisor -- the core of nx_container_win, no HCS/VM/Docker. 1. CreateJobObjectW(NULL,NULL) -> hJob 2. SetInformationJobObject(hJob, 2, &basic{ActiveProcessLimit=8}, 0x40) (governance installed) 3. AssignProcessToJobObject(hJob, (HANDLE)-1) (self joins the job) 4. CreateProcessW(NULL,"nx_win_compiled_organ.exe",...,CREATE_NO_WINDOW,...,&si,&pi) (organ; auto-joins job) 5. WaitForSingleObject(pi.hProcess, INFINITE) 6. GetExitCodeProcess(pi.hProcess, &code) 7. ExitProcess(code) CreateProcessW (lpApplicationName=NULL) resolves the bare filename via the app-load-directory search rule: the supervisor exe and the organ exe both live in _offc, so "nx_win_compiled_organ.exe" is found there. The command line is in the RW .data section (CreateProcessW may modify it). NO-FALSE-GREEN: the organ prints "NX\n" and exits 88. Supervisor exit == 88 proves it launched the Nishi organ as a governed child and reaped its real exit code (cmd would never yield "NX"+88). The organ's "NX" on the console proves the governed child actually executed. 7 kernel32 imports, identical proven .text/.idata to W2c (nx_pe_job_run_test); ONLY the .data command line differs. Founded on nx_pe_writer.nx (hand byte-layout, tutor-scaffold). lineage_id: substrate_pe_container_win_v1 (genealogy: win32_job_objects_2000 + runc_init_2014)

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_hal.nx nx_pe_writer.nx nx_pe_container_win_sup.nx

imports: nx_syscalls.nxnx_hal.nxnx_pe_writer.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main nx_hal_alloc_pages nx_hal_active_shim nx_hal_alloc_pages_linux sys_mmap nx_hal_alloc_pages_bare_me nx_hal_alloc_pages_nishi_s nx_pe_emit_container _w16 _w32 _w8 _w64 _w32 ↻ _emit_section_header _w8 ↻ _w32 ↻ _w16 ↻ nxcw_put_utf16 _w16 ↻ nx_pe_write_to_file sys_openat_wr sys_write sys_close sys_write ↻

structs

none

consts

33const PE_CWIN_FILE_SIZE: i64 = 0x800

functions

36func nxcw_put_utf16(buf: *u8, off: i64, s: *u8) -> i64
called by 1: nx_pe_emit_container calls 1: _w16
47func nx_pe_emit_container(buf: *u8) -> i64
198func main() -> i64