mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-30 22:47:16 +08:00
mdbx: workaround for NtExtendSection() on Wine.
This fixes https://github.com/erthink/libmdbx/issues/83 Change-Id: I8e00aa91c86348fad9dbe4285143671d9cb3f802
This commit is contained in:
parent
d1173a1596
commit
60a6560a3b
@ -717,6 +717,7 @@ static uint64_t WINAPI stub_GetTickCount64(void) {
|
|||||||
|
|
||||||
/*----------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------*/
|
||||||
#ifndef MDBX_ALLOY
|
#ifndef MDBX_ALLOY
|
||||||
|
MDBX_NtExtendSection mdbx_NtExtendSection;
|
||||||
MDBX_GetFileInformationByHandleEx mdbx_GetFileInformationByHandleEx;
|
MDBX_GetFileInformationByHandleEx mdbx_GetFileInformationByHandleEx;
|
||||||
MDBX_GetVolumeInformationByHandleW mdbx_GetVolumeInformationByHandleW;
|
MDBX_GetVolumeInformationByHandleW mdbx_GetVolumeInformationByHandleW;
|
||||||
MDBX_GetFinalPathNameByHandleW mdbx_GetFinalPathNameByHandleW;
|
MDBX_GetFinalPathNameByHandleW mdbx_GetFinalPathNameByHandleW;
|
||||||
@ -775,4 +776,6 @@ static void mdbx_winnt_import(void) {
|
|||||||
const HINSTANCE hNtdll = GetModuleHandleA("ntdll.dll");
|
const HINSTANCE hNtdll = GetModuleHandleA("ntdll.dll");
|
||||||
mdbx_NtFsControlFile =
|
mdbx_NtFsControlFile =
|
||||||
(MDBX_NtFsControlFile)GetProcAddress(hNtdll, "NtFsControlFile");
|
(MDBX_NtFsControlFile)GetProcAddress(hNtdll, "NtFsControlFile");
|
||||||
|
mdbx_NtExtendSection =
|
||||||
|
(MDBX_NtExtendSection)GetProcAddress(hNtdll, "NtExtendSection");
|
||||||
}
|
}
|
||||||
|
@ -67,11 +67,6 @@ typedef struct _SECTION_BASIC_INFORMATION {
|
|||||||
LARGE_INTEGER SectionSize;
|
LARGE_INTEGER SectionSize;
|
||||||
} SECTION_BASIC_INFORMATION, *PSECTION_BASIC_INFORMATION;
|
} SECTION_BASIC_INFORMATION, *PSECTION_BASIC_INFORMATION;
|
||||||
|
|
||||||
extern NTSTATUS NTAPI NtExtendSection(IN HANDLE SectionHandle,
|
|
||||||
IN PLARGE_INTEGER NewSectionSize);
|
|
||||||
|
|
||||||
typedef enum _SECTION_INHERIT { ViewShare = 1, ViewUnmap = 2 } SECTION_INHERIT;
|
|
||||||
|
|
||||||
extern NTSTATUS NTAPI NtMapViewOfSection(
|
extern NTSTATUS NTAPI NtMapViewOfSection(
|
||||||
IN HANDLE SectionHandle, IN HANDLE ProcessHandle, IN OUT PVOID *BaseAddress,
|
IN HANDLE SectionHandle, IN HANDLE ProcessHandle, IN OUT PVOID *BaseAddress,
|
||||||
IN ULONG_PTR ZeroBits, IN SIZE_T CommitSize,
|
IN ULONG_PTR ZeroBits, IN SIZE_T CommitSize,
|
||||||
@ -1404,8 +1399,10 @@ MDBX_INTERNAL_FUNC int mdbx_mresize(int flags, mdbx_mmap_t *map, size_t size,
|
|||||||
|
|
||||||
if (!(flags & MDBX_RDONLY) && limit == map->limit && size > map->current) {
|
if (!(flags & MDBX_RDONLY) && limit == map->limit && size > map->current) {
|
||||||
/* growth rw-section */
|
/* growth rw-section */
|
||||||
|
if (!mdbx_NtExtendSection)
|
||||||
|
return ERROR_CALL_NOT_IMPLEMENTED /* workaround for Wine */;
|
||||||
SectionSize.QuadPart = size;
|
SectionSize.QuadPart = size;
|
||||||
status = NtExtendSection(map->section, &SectionSize);
|
status = mdbx_NtExtendSection(map->section, &SectionSize);
|
||||||
if (!NT_SUCCESS(status))
|
if (!NT_SUCCESS(status))
|
||||||
return ntstatus2errcode(status);
|
return ntstatus2errcode(status);
|
||||||
map->current = size;
|
map->current = size;
|
||||||
|
@ -849,6 +849,12 @@ typedef DWORD(WINAPI *MDBX_OfferVirtualMemory(
|
|||||||
MDBX_INTERNAL_VAR MDBX_OfferVirtualMemory mdbx_OfferVirtualMemory;
|
MDBX_INTERNAL_VAR MDBX_OfferVirtualMemory mdbx_OfferVirtualMemory;
|
||||||
#endif /* unused for now */
|
#endif /* unused for now */
|
||||||
|
|
||||||
|
typedef enum _SECTION_INHERIT { ViewShare = 1, ViewUnmap = 2 } SECTION_INHERIT;
|
||||||
|
|
||||||
|
typedef NTSTATUS(NTAPI *MDBX_NtExtendSection)(IN HANDLE SectionHandle,
|
||||||
|
IN PLARGE_INTEGER NewSectionSize);
|
||||||
|
MDBX_INTERNAL_VAR MDBX_NtExtendSection mdbx_NtExtendSection;
|
||||||
|
|
||||||
#endif /* Windows */
|
#endif /* Windows */
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user