This is needed for Direct Storage part of newer MS d3d12 SDK (which is shipped with the games) to work (in particular, fixes New World crash on start after recent game update). QueryIoRingCapabilities() is present starting from Windows 11 only, and SDK still works on Win10, but Win10 doesn't provide api-ms-win-core-ioring-l1-1-0 apiset dll (while Wine does since commit 7d81575c680212f7bef7a7d7d11d2615ffde4c9a). SDK is fine if api-ms-win-core-ioring-l1-1-0 is absent but once it is present it expects at least QueryIoRingCapabilities to be present (and then gracefully handles error return from it).
From: Paul Gofman pgofman@codeweavers.com
--- include/Makefile.in | 2 ++ include/ioringapi.h | 42 ++++++++++++++++++++++++++++++++++++++++++ include/ntioring_x.h | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 81 insertions(+) create mode 100644 include/ioringapi.h create mode 100644 include/ntioring_x.h
diff --git a/include/Makefile.in b/include/Makefile.in index b1b582ff4d6..5fd20858aee 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -376,6 +376,7 @@ SOURCES = \ inspectable.idl \ interactioncontext.h \ intshcut.h \ + ioringapi.h \ ip2string.h \ ipexport.h \ iphlpapi.h \ @@ -575,6 +576,7 @@ SOURCES = \ ntdef.h \ ntdsapi.h \ ntgdi.h \ + ntioring_x.h \ ntlsa.h \ ntquery.h \ ntsecapi.h \ diff --git a/include/ioringapi.h b/include/ioringapi.h new file mode 100644 index 00000000000..36954869ea8 --- /dev/null +++ b/include/ioringapi.h @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2023 Paul Gofman for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef __IORINGAPI_H_ +#define __IORINGAPI_H_ + +#include "ntioring_x.h" + +struct IORING_CAPABILITIES +{ + IORING_VERSION MaxVersion; + UINT32 MaxSubmissionQueueSize; + UINT32 MaxCompletionQueueSize; + IORING_FEATURE_FLAGS FeatureFlags; +}; +typedef struct IORING_CAPABILITIES IORING_CAPABILITIES; + +#ifdef __cplusplus +extern "C" { +#endif + +HRESULT WINAPI QueryIoRingCapabilities(IORING_CAPABILITIES *caps); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/include/ntioring_x.h b/include/ntioring_x.h new file mode 100644 index 00000000000..40be1f28c54 --- /dev/null +++ b/include/ntioring_x.h @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2023 Paul Gofman for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef __NTIORING_X_H_ +#define __NTIORING_X_H_ +enum IORING_VERSION +{ + IORING_VERSION_INVALID = 0, + IORING_VERSION_1 = 1, + IORING_VERSION_2 = 2, + IORING_VERSION_3 = 300, +}; +typedef enum IORING_VERSION IORING_VERSION; + +enum IORING_FEATURE_FLAGS +{ + IORING_FEATURE_FLAGS_NONE = 0, + IORING_FEATURE_UM_EMULATION = 0x00000001, + IORING_FEATURE_SET_COMPLETION_EVENT = 0x00000002, +}; +typedef enum IORING_FEATURE_FLAGS IORING_FEATURE_FLAGS; +#endif
From: Paul Gofman pgofman@codeweavers.com
--- dlls/kernelbase/file.c | 12 +++++++ dlls/kernelbase/kernelbase.spec | 1 + dlls/kernelbase/tests/Makefile.in | 1 + dlls/kernelbase/tests/file.c | 57 +++++++++++++++++++++++++++++++ 4 files changed, 71 insertions(+) create mode 100644 dlls/kernelbase/tests/file.c
diff --git a/dlls/kernelbase/file.c b/dlls/kernelbase/file.c index 7c2e132bdcb..29d005e0e28 100644 --- a/dlls/kernelbase/file.c +++ b/dlls/kernelbase/file.c @@ -36,6 +36,7 @@ #include "shlwapi.h" #include "ddk/ntddk.h" #include "ddk/ntddser.h" +#include "ioringapi.h"
#include "kernelbase.h" #include "wine/exception.h" @@ -4483,3 +4484,14 @@ BOOL WINAPI DECLSPEC_HOTPATCH WaitCommEvent( HANDLE handle, DWORD *events, OVERL return DeviceIoControl( handle, IOCTL_SERIAL_WAIT_ON_MASK, NULL, 0, events, sizeof(*events), NULL, overlapped ); } + + +/*********************************************************************** + * QueryIoRingCapabilities (kernelbase.@) + */ +HRESULT WINAPI QueryIoRingCapabilities(IORING_CAPABILITIES *caps) +{ + FIXME( "caps %p stub.\n", caps ); + + return E_NOTIMPL; +} diff --git a/dlls/kernelbase/kernelbase.spec b/dlls/kernelbase/kernelbase.spec index 17ae37e824c..46492a59d92 100644 --- a/dlls/kernelbase/kernelbase.spec +++ b/dlls/kernelbase/kernelbase.spec @@ -1232,6 +1232,7 @@ @ stdcall QueryDosDeviceW(wstr ptr long) @ stdcall QueryFullProcessImageNameA(ptr long ptr ptr) @ stdcall QueryFullProcessImageNameW(ptr long ptr ptr) +@ stdcall QueryIoRingCapabilities(ptr) # @ stub QueryIdleProcessorCycleTime # @ stub QueryIdleProcessorCycleTimeEx @ stdcall QueryInterruptTime(ptr) diff --git a/dlls/kernelbase/tests/Makefile.in b/dlls/kernelbase/tests/Makefile.in index 675054c753d..b51eaefcd13 100644 --- a/dlls/kernelbase/tests/Makefile.in +++ b/dlls/kernelbase/tests/Makefile.in @@ -1,6 +1,7 @@ TESTDLL = kernelbase.dll
C_SRCS = \ + file.c \ path.c \ process.c \ sync.c diff --git a/dlls/kernelbase/tests/file.c b/dlls/kernelbase/tests/file.c new file mode 100644 index 00000000000..18dff0a32ab --- /dev/null +++ b/dlls/kernelbase/tests/file.c @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2023 Paul Gofman for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include <stdarg.h> +#include <stdlib.h> + +#include <ntstatus.h> +#define WIN32_NO_STATUS +#include <windef.h> +#include <winbase.h> +#include <winerror.h> +#include <ioringapi.h> + +#include "wine/test.h" + +static HRESULT (WINAPI *pQueryIoRingCapabilities)(IORING_CAPABILITIES *); + +static void test_ioring_caps(void) +{ + IORING_CAPABILITIES caps; + HRESULT hr; + + if (!pQueryIoRingCapabilities) + { + win_skip("QueryIoRingCapabilities is not available, skipping tests.\n"); + return; + } + + memset(&caps, 0xcc, sizeof(caps)); + hr = pQueryIoRingCapabilities(&caps); + todo_wine ok(hr == S_OK, "got %#lx.\n", hr); +} + +START_TEST(file) +{ + HMODULE hmod; + + hmod = LoadLibraryA("kernelbase.dll"); + pQueryIoRingCapabilities = (void *)GetProcAddress(hmod, "QueryIoRingCapabilities"); + + test_ioring_caps(); +}