26 #if !LELY_NO_STDIO && _WIN32
34 LPFN_RTLNTSTATUSTODOSERROR lpfnRtlNtStatusToDosError;
36 static size_t io_init_refcnt = 0;
46 if (io_win32_ntdll_init() == -1) {
47 dwErrCode = GetLastError();
48 goto error_ntdll_init;
51 if (io_win32_sigset_init() == -1) {
52 dwErrCode = GetLastError();
53 goto error_sigset_init;
60 io_win32_ntdll_fini();
62 SetLastError(dwErrCode);
70 assert(io_init_refcnt);
75 io_win32_sigset_fini();
76 io_win32_ntdll_fini();
80 io_win32_ntdll_init(
void)
82 HMODULE hLibModule = GetModuleHandleA(
"ntdll.dll");
87 #pragma GCC diagnostic push
88 #pragma GCC diagnostic ignored "-Wcast-function-type"
90 lpfnRtlNtStatusToDosError = (LPFN_RTLNTSTATUSTODOSERROR)GetProcAddress(
91 hLibModule,
"RtlNtStatusToDosError");
92 if (!lpfnRtlNtStatusToDosError)
93 goto error_RtlNtStatusToDosError;
95 #pragma GCC diagnostic pop
101 error_RtlNtStatusToDosError:
107 io_win32_ntdll_fini(
void)
109 lpfnRtlNtStatusToDosError = NULL;
This header file is part of the I/O library; it contains system-dependent I/O initialization/finaliza...
int io_init(void)
Initializes the I/O library and makes the I/O functions available for use.
void io_fini(void)
Finalizes the I/O library and terminates the availability of the I/O functions.
This is the internal header file of the Windows-specific I/O declarations.