PostgreSQL Source Code git master
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
win32ntdll.h File Reference
#include <ntstatus.h>
#include <winternl.h>
Include dependency graph for win32ntdll.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define FLUSH_FLAGS_FILE_DATA_SYNC_ONLY   0x4
 

Typedefs

typedef NTSTATUS(__stdcall * RtlGetLastNtStatus_t) (void)
 
typedef ULONG(__stdcall * RtlNtStatusToDosError_t) (NTSTATUS)
 
typedef NTSTATUS(__stdcall * NtFlushBuffersFileEx_t) (HANDLE, ULONG, PVOID, ULONG, PIO_STATUS_BLOCK)
 

Functions

int initialize_ntdll (void)
 

Variables

PGDLLIMPORT RtlGetLastNtStatus_t pg_RtlGetLastNtStatus
 
PGDLLIMPORT RtlNtStatusToDosError_t pg_RtlNtStatusToDosError
 
PGDLLIMPORT NtFlushBuffersFileEx_t pg_NtFlushBuffersFileEx
 

Macro Definition Documentation

◆ FLUSH_FLAGS_FILE_DATA_SYNC_ONLY

#define FLUSH_FLAGS_FILE_DATA_SYNC_ONLY   0x4

Definition at line 21 of file win32ntdll.h.

Typedef Documentation

◆ NtFlushBuffersFileEx_t

typedef NTSTATUS(__stdcall * NtFlushBuffersFileEx_t) (HANDLE, ULONG, PVOID, ULONG, PIO_STATUS_BLOCK)

Definition at line 26 of file win32ntdll.h.

◆ RtlGetLastNtStatus_t

typedef NTSTATUS(__stdcall * RtlGetLastNtStatus_t) (void)

Definition at line 24 of file win32ntdll.h.

◆ RtlNtStatusToDosError_t

typedef ULONG(__stdcall * RtlNtStatusToDosError_t) (NTSTATUS)

Definition at line 25 of file win32ntdll.h.

Function Documentation

◆ initialize_ntdll()

int initialize_ntdll ( void  )

Definition at line 39 of file win32ntdll.c.

40{
41 HMODULE module;
42
43 if (initialized)
44 return 0;
45
46 if (!(module = LoadLibraryEx("ntdll.dll", NULL, 0)))
47 {
48 _dosmaperr(GetLastError());
49 return -1;
50 }
51
52 for (int i = 0; i < lengthof(routines); ++i)
53 {
54 pg_funcptr_t address;
55
56 address = (pg_funcptr_t) GetProcAddress(module, routines[i].name);
57 if (!address)
58 {
59 _dosmaperr(GetLastError());
60 FreeLibrary(module);
61
62 return -1;
63 }
64
65 *(pg_funcptr_t *) routines[i].address = address;
66 }
67
68 initialized = true;
69
70 return 0;
71}
#define lengthof(array)
Definition: c.h:759
void(* pg_funcptr_t)(void)
Definition: c.h:424
int i
Definition: isn.c:72
const char * name
void _dosmaperr(unsigned long)
Definition: win32error.c:177
static const NtDllRoutine routines[]
Definition: win32ntdll.c:30
static bool initialized
Definition: win32ntdll.c:36

References _dosmaperr(), i, initialized, lengthof, name, and routines.

Referenced by fdatasync().

Variable Documentation

◆ pg_NtFlushBuffersFileEx

PGDLLIMPORT NtFlushBuffersFileEx_t pg_NtFlushBuffersFileEx
extern

Definition at line 22 of file win32ntdll.c.

Referenced by fdatasync().

◆ pg_RtlGetLastNtStatus

PGDLLIMPORT RtlGetLastNtStatus_t pg_RtlGetLastNtStatus
extern

Definition at line 20 of file win32ntdll.c.

Referenced by _pglstat64(), and _pgstat64().

◆ pg_RtlNtStatusToDosError

PGDLLIMPORT RtlNtStatusToDosError_t pg_RtlNtStatusToDosError
extern

Definition at line 21 of file win32ntdll.c.

Referenced by fdatasync().