https://bugs.winehq.org/show_bug.cgi?id=48620
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|libmdbx (memory-mapped DB) |libmdbx (memory-mapped DB) |fail on Wine |needs ntdll.NtExtendSection | |stub Version|unspecified |5.1 Ever confirmed|0 |1 Status|UNCONFIRMED |NEW CC| |focht@gmx.net
--- Comment #7 from Anastasius Focht focht@gmx.net --- Hello folks,
filling some fields and confirming.
https://github.com/erthink/libmdbx/blob/5adbc75b3890c6cb8fc8b872c2f8d96eb830...
https://github.com/erthink/libmdbx/blob/5adbc75b3890c6cb8fc8b872c2f8d96eb830...
--- snip --- MDBX_INTERNAL_FUNC int mdbx_mresize(int flags, mdbx_mmap_t *map, size_t size, size_t limit) { assert(size <= limit); #if defined(_WIN32) || defined(_WIN64) assert(size != map->current || limit != map->limit || size < map->filesize);
NTSTATUS status; LARGE_INTEGER SectionSize; int err, rc = MDBX_SUCCESS;
if (!(flags & MDBX_RDONLY) && limit == map->limit && size > map->current) { /* growth rw-section */ if (!mdbx_NtExtendSection) return ERROR_CALL_NOT_IMPLEMENTED /* workaround for Wine */; SectionSize.QuadPart = size; status = mdbx_NtExtendSection(map->section, &SectionSize); if (!NT_SUCCESS(status)) return ntstatus2errcode(status); map->current = size; if (map->filesize < size) map->filesize = size; return MDBX_SUCCESS; } ... --- snip ---
https://source.winehq.org/git/wine.git/blob/be2b0b1cec5843f0145f376316d6c285...
--- snip --- 209 @ stub NtExtendSection --- snip ---
This results in auto-generated stub ('GetProcAddress' will return non-NULL). Any call of the function pointer will result in a crash, accompanied with infamous 'unimplemented function foobar' message.
https://undocumented.ntinternals.net/index.html?page=UserMode%2FUndocumented...
The technique to extend shared memory mappings via 'NtExtendSection' is also described here:
https://stackoverflow.com/questions/44101966/adding-new-bytes-to-memory-mapp...
Just do as you already proposed: add a stub 'NtExtendSection' that returns STATUS_NOT_IMPLEMENTED.
Regards