[PATCH v6 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`). -- v6: 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 | 4 ++++ dlls/ntdll/loader.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/dlls/kernel32/tests/module.c b/dlls/kernel32/tests/module.c index 17881b88672..3b3b69d6563 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; @@ -1341,6 +1342,9 @@ static void test_AddDllDirectory(void) cookie = pAddDllDirectory( rootW ); ok( cookie != NULL, "AddDllDirectory failed err %lu\n", GetLastError() ); SetLastError( 0xdeadbeef ); + 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 ); 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
Alfred Agrell (@Alcaro) commented about dlls/kernel32/tests/module.c:
cookie = pAddDllDirectory( rootW ); ok( cookie != NULL, "AddDllDirectory failed err %lu\n", GetLastError() ); SetLastError( 0xdeadbeef ); + 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() );
I think you should duplicate these two lines too -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9917#note_127477
participants (3)
-
Alexandre Esteves -
Alexandre Esteves (@alexfmpe) -
Alfred Agrell (@Alcaro)