From: Zhiyi Zhang zzhang@codeweavers.com
--- dlls/ntdll/tests/rtl.c | 63 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+)
diff --git a/dlls/ntdll/tests/rtl.c b/dlls/ntdll/tests/rtl.c index d013848c07a..14ead067a37 100644 --- a/dlls/ntdll/tests/rtl.c +++ b/dlls/ntdll/tests/rtl.c @@ -110,6 +110,7 @@ static NTSTATUS (WINAPI *pLdrUnregisterDllNotification)(void *); static VOID (WINAPI *pRtlGetDeviceFamilyInfoEnum)(ULONGLONG *,DWORD *,DWORD *); static void (WINAPI *pRtlRbInsertNodeEx)(RTL_RB_TREE *, RTL_BALANCED_NODE *, BOOLEAN, RTL_BALANCED_NODE *); static void (WINAPI *pRtlRbRemoveNode)(RTL_RB_TREE *, RTL_BALANCED_NODE *); +static DWORD (WINAPI *pRtlConvertDeviceFamilyInfoToString)(DWORD *, DWORD *, WCHAR *, WCHAR *);
static HMODULE hkernel32 = 0; @@ -157,6 +158,7 @@ static void InitFunctionPtrs(void) pRtlGetDeviceFamilyInfoEnum = (void *)GetProcAddress(hntdll, "RtlGetDeviceFamilyInfoEnum"); pRtlRbInsertNodeEx = (void *)GetProcAddress(hntdll, "RtlRbInsertNodeEx"); pRtlRbRemoveNode = (void *)GetProcAddress(hntdll, "RtlRbRemoveNode"); + pRtlConvertDeviceFamilyInfoToString = (void *)GetProcAddress(hntdll, "RtlConvertDeviceFamilyInfoToString"); } hkernel32 = LoadLibraryA("kernel32.dll"); ok(hkernel32 != 0, "LoadLibrary failed\n"); @@ -3931,6 +3933,66 @@ static void test_rb_tree(void) free(nodes); }
+static void test_RtlConvertDeviceFamilyInfoToString(void) +{ + DWORD device_family_size, device_form_size, ret; + WCHAR device_family[16], device_form[16]; + + if (!pRtlConvertDeviceFamilyInfoToString) + { + todo_wine + win_skip("RtlConvertDeviceFamilyInfoToString is unavailable.\n" ); + return; + } + + if (0) /* Crash on Windows */ + { + ret = pRtlConvertDeviceFamilyInfoToString(NULL, NULL, NULL, NULL); + ok(ret == STATUS_INVALID_PARAMETER, "Got unexpected status %#lx.\n", ret); + + device_family_size = 0; + ret = pRtlConvertDeviceFamilyInfoToString(&device_family_size, NULL, NULL, NULL); + ok(ret == STATUS_BUFFER_TOO_SMALL, "Got unexpected status %#lx.\n", ret); + ok(device_family_size == (wcslen(L"Windows.Desktop") + 1) * sizeof(WCHAR), + "Got unexpected %#lx.\n", device_family_size); + + device_form_size = 0; + ret = pRtlConvertDeviceFamilyInfoToString(NULL, &device_form_size, NULL, NULL); + ok(ret == STATUS_BUFFER_TOO_SMALL, "Got unexpected status %#lx.\n", ret); + ok(device_form_size == (wcslen(L"Unknown") + 1) * sizeof(WCHAR), "Got unexpected %#lx.\n", + device_form_size); + + ret = pRtlConvertDeviceFamilyInfoToString(&device_family_size, NULL, device_family, NULL); + ok(ret == STATUS_SUCCESS, "Got unexpected status %#lx.\n", ret); + ok(device_family_size == (wcslen(L"Windows.Desktop") + 1) * sizeof(WCHAR), + "Got unexpected %#lx.\n", device_family_size); + ok(!wcscmp(device_family, L"Windows.Desktop"), "Got unexpected %s.\n", wine_dbgstr_w(device_family)); + + ret = pRtlConvertDeviceFamilyInfoToString(NULL, &device_form_size, NULL, device_form); + ok(ret == STATUS_SUCCESS, "Got unexpected status %#lx.\n", ret); + ok(device_form_size == (wcslen(L"Unknown") + 1) * sizeof(WCHAR), "Got unexpected %#lx.\n", + device_form_size); + ok(!wcscmp(device_form, L"Unknown"), "Got unexpected %s.\n", wine_dbgstr_w(device_form)); + + ret = pRtlConvertDeviceFamilyInfoToString(&device_family_size, &device_form_size, NULL, NULL); + ok(ret == STATUS_INVALID_PARAMETER, "Got unexpected status %#lx.\n", ret); + } + + device_family_size = wcslen(L"Windows.Desktop") * sizeof(WCHAR); + device_form_size = wcslen(L"Unknown") * sizeof(WCHAR); + ret = pRtlConvertDeviceFamilyInfoToString(&device_family_size, &device_form_size, NULL, NULL); + ok(ret == STATUS_BUFFER_TOO_SMALL, "Got unexpected status %#lx.\n", ret); + ok(device_family_size == (wcslen(L"Windows.Desktop") + 1) * sizeof(WCHAR), + "Got unexpected %#lx.\n", device_family_size); + ok(device_form_size == (wcslen(L"Unknown") + 1) * sizeof(WCHAR), "Got unexpected %#lx.\n", + device_form_size); + + ret = pRtlConvertDeviceFamilyInfoToString(&device_family_size, &device_form_size, device_family, device_form); + ok(ret == STATUS_SUCCESS, "Got unexpected status %#lx.\n", ret); + ok(!wcscmp(device_family, L"Windows.Desktop"), "Got unexpected %s.\n", wine_dbgstr_w(device_family)); + ok(!wcscmp(device_form, L"Unknown"), "Got unexpected %s.\n", wine_dbgstr_w(device_form)); +} + START_TEST(rtl) { InitFunctionPtrs(); @@ -3980,5 +4042,6 @@ START_TEST(rtl) test_RtlValidSecurityDescriptor(); test_RtlFindExportedRoutineByName(); test_RtlGetDeviceFamilyInfoEnum(); + test_RtlConvertDeviceFamilyInfoToString(); test_rb_tree(); }
From: Zhiyi Zhang zzhang@codeweavers.com
--- dlls/ntdll/ntdll.spec | 1 + dlls/ntdll/rtl.c | 27 +++++++++++++++++++++++++++ dlls/ntdll/tests/rtl.c | 1 - include/winnt.h | 1 + 4 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index 41d0500214d..1234205cf1a 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -542,6 +542,7 @@ # @ stub RtlComputeImportTableHash # @ stub RtlComputePrivatizedDllName_U @ stub RtlConsoleMultiByteToUnicodeN +@ stdcall RtlConvertDeviceFamilyInfoToString(ptr ptr ptr ptr) @ stub RtlConvertExclusiveToShared @ stdcall -arch=win32 -ret64 RtlConvertLongToLargeInteger(long) # @ stub RtlConvertPropertyToVariant diff --git a/dlls/ntdll/rtl.c b/dlls/ntdll/rtl.c index 55b0f5b8416..8bd6d9f6b9b 100644 --- a/dlls/ntdll/rtl.c +++ b/dlls/ntdll/rtl.c @@ -1030,3 +1030,30 @@ void WINAPI RtlGetDeviceFamilyInfoEnum(ULONGLONG *version, DWORD *family, DWORD if (family) *family = DEVICEFAMILYINFOENUM_DESKTOP; if (form) *form = DEVICEFAMILYDEVICEFORM_UNKNOWN; } + +/********************************************************************* + * RtlConvertDeviceFamilyInfoToString [NTDLL.@] + */ +DWORD WINAPI RtlConvertDeviceFamilyInfoToString(DWORD *device_family_size, DWORD *device_form_size, + WCHAR *device_family, WCHAR *device_form) +{ + static const WCHAR *windows_desktop = L"Windows.Desktop"; + static const WCHAR *unknown_form = L"Unknown"; + DWORD family_length, form_length; + + TRACE("%p %p %p %p\n", device_family_size, device_form_size, device_family, device_form); + + family_length = (wcslen(windows_desktop) + 1) * sizeof(WCHAR); + form_length = (wcslen(unknown_form) + 1) * sizeof(WCHAR); + + if (*device_family_size < family_length || *device_form_size < form_length) + { + *device_family_size = family_length; + *device_form_size = form_length; + return STATUS_BUFFER_TOO_SMALL; + } + + memcpy(device_family, windows_desktop, family_length); + memcpy(device_form, unknown_form, form_length); + return STATUS_SUCCESS; +} diff --git a/dlls/ntdll/tests/rtl.c b/dlls/ntdll/tests/rtl.c index 14ead067a37..1b262b80598 100644 --- a/dlls/ntdll/tests/rtl.c +++ b/dlls/ntdll/tests/rtl.c @@ -3940,7 +3940,6 @@ static void test_RtlConvertDeviceFamilyInfoToString(void)
if (!pRtlConvertDeviceFamilyInfoToString) { - todo_wine win_skip("RtlConvertDeviceFamilyInfoToString is unavailable.\n" ); return; } diff --git a/include/winnt.h b/include/winnt.h index 3609b55e924..55f0c396041 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -6065,6 +6065,7 @@ typedef struct _TAPE_GET_MEDIA_PARAMETERS { #define DEVICEFAMILYDEVICEFORM_MAX 0x21
NTSYSAPI void WINAPI RtlGetDeviceFamilyInfoEnum(ULONGLONG*,DWORD*,DWORD*); +NTSYSAPI DWORD WINAPI RtlConvertDeviceFamilyInfoToString(DWORD *,DWORD *,WCHAR *,WCHAR *);
#define EVENTLOG_SUCCESS 0x0000 #define EVENTLOG_ERROR_TYPE 0x0001
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=148793
Your paranoid android.
=== debian11b (64 bit WoW report) ===
user32: input.c:4305: Test succeeded inside todo block: button_down_hwnd_todo 1: got MSG_TEST_WIN hwnd 0000000000C900E6, msg WM_LBUTTONDOWN, wparam 0x1, lparam 0x320032
wmp: media: Timeout