[PATCH v7 0/1] MR9917: ntdll: Accept device paths in LdrAddDllDirectory.
This is needed to allow running Template Haskell inside Wine when cross-compiling as GHC uses device paths nowadays. Upstreaming from https://github.com/input-output-hk/haskell.nix/pull/2034/commits/44f2822afdb... Similar to https://gitlab.winehq.org/wine/wine/-/merge_requests/6308 but only for AddDll as the GetDll part seems to already allow `RtlPathTypeLocalDevice` (old `DEVICE_PATH`). -- v7: ntdll: Accept device paths in LdrAddDllDirectory. https://gitlab.winehq.org/wine/wine/-/merge_requests/9917
From: Alexandre Esteves <alexfmpe@proton.me> --- dlls/kernel32/tests/module.c | 6 ++++++ dlls/ntdll/loader.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/dlls/kernel32/tests/module.c b/dlls/kernel32/tests/module.c index 17881b88672..f548fdec316 100644 --- a/dlls/kernel32/tests/module.c +++ b/dlls/kernel32/tests/module.c @@ -1309,6 +1309,7 @@ static void test_AddDllDirectory(void) static const WCHAR tmpW[] = {'t','m','p',0}; static const WCHAR dotW[] = {'.','\\','.',0}; static const WCHAR rootW[] = {'\\',0}; + static const WCHAR deviceW[] = {'\\','\\','.','\\', 'C', ':', '\\', 0}; WCHAR path[MAX_PATH], buf[MAX_PATH]; DLL_DIRECTORY_COOKIE cookie; BOOL ret; @@ -1343,6 +1344,11 @@ static void test_AddDllDirectory(void) SetLastError( 0xdeadbeef ); ret = pRemoveDllDirectory( cookie ); ok( ret, "RemoveDllDirectory failed err %lu\n", GetLastError() ); + cookie = pAddDllDirectory( deviceW ); + ok( cookie != NULL, "AddDllDirectory failed err %lu\n", GetLastError() ); + SetLastError( 0xdeadbeef ); + ret = pRemoveDllDirectory( cookie ); + ok( ret, "RemoveDllDirectory failed err %lu\n", GetLastError() ); GetWindowsDirectoryW( buf, MAX_PATH ); lstrcpyW( buf + 2, tmpW ); cookie = pAddDllDirectory( buf ); diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 61cc9e1e112..ac42ba7c24c 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -4727,7 +4727,7 @@ NTSTATUS WINAPI LdrAddDllDirectory( const UNICODE_STRING *dir, void **cookie ) struct dll_dir_entry *ptr; RTL_PATH_TYPE type = RtlDetermineDosPathNameType_U( dir->Buffer ); - if (type != RtlPathTypeRooted && type != RtlPathTypeDriveAbsolute && type != RtlPathTypeUncAbsolute) + if (type != RtlPathTypeRooted && type != RtlPathTypeDriveAbsolute && type != RtlPathTypeUncAbsolute && type != RtlPathTypeLocalDevice) return STATUS_INVALID_PARAMETER; status = RtlDosPathNameToNtPathName_U_WithStatus( dir->Buffer, &nt_name, NULL, NULL ); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9917
On Wed Jan 21 00:19:23 2026 +0000, Alexandre Esteves wrote:
changed this file in version 7 of the diff Oh I see, was separating the `pRemoveDllDirectory` from the matching `rootW` section.
Fixed, I think. This would possibly be more readable if the block of each `pAddDllDirectory` had an empty line before it to separate the steps into easily parseable groups -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9917#note_127480
CI failure seems unrelated to the PR? https://gitlab.winehq.org/wine/wine/-/jobs/222990#L2043 -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9917#note_127481
participants (2)
-
Alexandre Esteves -
Alexandre Esteves (@alexfmpe)