| ... | ... | @@ -168,15 +168,13 @@ fn exit2(code: usize) noreturn { |
| 168 | 168 | // exits(0) |
| 169 | 169 | .plan9 => std.os.plan9.exits(null), |
| 170 | 170 | .windows => { |
| 171 | | ExitProcess(@as(u32, @truncate(code))); |
| 171 | std.os.windows.ntdll.RtlExitUserProcess(@as(u32, @truncate(code))); |
| 172 | 172 | }, |
| 173 | 173 | else => @compileError("TODO"), |
| 174 | 174 | } |
| 175 | 175 | unreachable; |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | | extern "kernel32" fn ExitProcess(exit_code: u32) callconv(.C) noreturn; |
| 179 | | |
| 180 | 178 | //////////////////////////////////////////////////////////////////////////////// |
| 181 | 179 | |
| 182 | 180 | fn _DllMainCRTStartup( |
| ... | ... | @@ -345,7 +343,7 @@ fn WinStartup() callconv(std.os.windows.WINAPI) noreturn { |
| 345 | 343 | |
| 346 | 344 | std.debug.maybeEnableSegfaultHandler(); |
| 347 | 345 | |
| 348 | | std.os.windows.kernel32.ExitProcess(initEventLoopAndCallMain()); |
| 346 | std.os.windows.ntdll.RtlExitUserProcess(initEventLoopAndCallMain()); |
| 349 | 347 | } |
| 350 | 348 | |
| 351 | 349 | fn wWinMainCRTStartup() callconv(std.os.windows.WINAPI) noreturn { |
| ... | ... | @@ -357,7 +355,7 @@ fn wWinMainCRTStartup() callconv(std.os.windows.WINAPI) noreturn { |
| 357 | 355 | std.debug.maybeEnableSegfaultHandler(); |
| 358 | 356 | |
| 359 | 357 | const result: std.os.windows.INT = initEventLoopAndCallWinMain(); |
| 360 | | std.os.windows.kernel32.ExitProcess(@as(std.os.windows.UINT, @bitCast(result))); |
| 358 | std.os.windows.ntdll.RtlExitUserProcess(@as(std.os.windows.UINT, @bitCast(result))); |
| 361 | 359 | } |
| 362 | 360 | |
| 363 | 361 | fn posixCallMainAndExit() callconv(.C) noreturn { |
| ... | ... | @@ -605,8 +603,8 @@ pub fn callMain() u8 { |
| 605 | 603 | pub fn call_wWinMain() std.os.windows.INT { |
| 606 | 604 | const peb = std.os.windows.peb(); |
| 607 | 605 | const MAIN_HINSTANCE = @typeInfo(@TypeOf(root.wWinMain)).Fn.params[0].type.?; |
| 608 | | const hInstance = @as(MAIN_HINSTANCE, @ptrCast(std.os.windows.kernel32.GetModuleHandleW(null).?)); |
| 609 | | const lpCmdLine = std.os.windows.kernel32.GetCommandLineW(); |
| 606 | const hInstance = @as(MAIN_HINSTANCE, @ptrCast(peb.ImageBaseAddress)); |
| 607 | const lpCmdLine: [*:0]u16 = @ptrCast(peb.ProcessParameters.CommandLine.Buffer); |
| 610 | 608 | |
| 611 | 609 | // There are various types used for the 'show window' variable through the Win32 APIs: |
| 612 | 610 | // - u16 in STARTUPINFOA.wShowWindow / STARTUPINFOW.wShowWindow |