mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-08 04:24:13 +08:00
mdbx: more ntpapi for Windows.
Change-Id: I616b09502302be9e3017db7e99cf4dcf8697f32f
This commit is contained in:
parent
24a8bdec49
commit
91a9d4d916
26
src/osal.c
26
src/osal.c
@ -1,4 +1,4 @@
|
|||||||
/* https://en.wikipedia.org/wiki/Operating_system_abstraction_layer */
|
/* https://en.wikipedia.org/wiki/Operating_system_abstraction_layer */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2015-2017 Leonid Yuriev <leo@yuriev.ru>
|
* Copyright 2015-2017 Leonid Yuriev <leo@yuriev.ru>
|
||||||
@ -61,6 +61,24 @@ extern NTSTATUS NTAPI NtCreateSection(
|
|||||||
IN OPTIONAL PLARGE_INTEGER MaximumSize, IN ULONG SectionPageProtection,
|
IN OPTIONAL PLARGE_INTEGER MaximumSize, IN ULONG SectionPageProtection,
|
||||||
IN ULONG AllocationAttributes, IN OPTIONAL HANDLE FileHandle);
|
IN ULONG AllocationAttributes, IN OPTIONAL HANDLE FileHandle);
|
||||||
|
|
||||||
|
typedef struct _SECTION_BASIC_INFORMATION {
|
||||||
|
ULONG Unknown;
|
||||||
|
ULONG SectionAttributes;
|
||||||
|
LARGE_INTEGER SectionSize;
|
||||||
|
} SECTION_BASIC_INFORMATION, *PSECTION_BASIC_INFORMATION;
|
||||||
|
|
||||||
|
typedef enum _SECTION_INFORMATION_CLASS {
|
||||||
|
SectionBasicInformation,
|
||||||
|
SectionImageInformation,
|
||||||
|
SectionRelocationInformation, // name:wow64:whNtQuerySection_SectionRelocationInformation
|
||||||
|
MaxSectionInfoClass
|
||||||
|
} SECTION_INFORMATION_CLASS;
|
||||||
|
|
||||||
|
extern NTSTATUS NTAPI NtQuerySection(
|
||||||
|
IN HANDLE SectionHandle, IN SECTION_INFORMATION_CLASS InformationClass,
|
||||||
|
OUT PVOID InformationBuffer, IN ULONG InformationBufferSize,
|
||||||
|
OUT PULONG ResultLength OPTIONAL);
|
||||||
|
|
||||||
extern NTSTATUS NTAPI NtExtendSection(IN HANDLE SectionHandle,
|
extern NTSTATUS NTAPI NtExtendSection(IN HANDLE SectionHandle,
|
||||||
IN PLARGE_INTEGER NewSectionSize);
|
IN PLARGE_INTEGER NewSectionSize);
|
||||||
|
|
||||||
@ -839,8 +857,10 @@ int mdbx_mmap(int flags, mdbx_mmap_t *map, size_t must, size_t limit) {
|
|||||||
|
|
||||||
rc = NtCreateSection(
|
rc = NtCreateSection(
|
||||||
&map->section,
|
&map->section,
|
||||||
/* DesiredAccess */ SECTION_MAP_READ | SECTION_EXTEND_SIZE |
|
/* DesiredAccess */ (flags & MDBX_WRITEMAP)
|
||||||
((flags & MDBX_WRITEMAP) ? SECTION_MAP_WRITE : 0),
|
? SECTION_QUERY | SECTION_MAP_READ | SECTION_EXTEND_SIZE |
|
||||||
|
SECTION_MAP_WRITE
|
||||||
|
: SECTION_QUERY | SECTION_MAP_READ | SECTION_EXTEND_SIZE,
|
||||||
/* ObjectAttributes */ NULL, /* MaximumSize */ NULL,
|
/* ObjectAttributes */ NULL, /* MaximumSize */ NULL,
|
||||||
/* SectionPageProtection */ (flags & MDBX_RDONLY) ? PAGE_READONLY
|
/* SectionPageProtection */ (flags & MDBX_RDONLY) ? PAGE_READONLY
|
||||||
: PAGE_READWRITE,
|
: PAGE_READWRITE,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user