[APPHELP] Try Dos and Nt path formats in SdbGetFileAttributes.
authorMark Jansen <mark.jansen@reactos.org>
Sun, 7 Jan 2018 20:52:13 +0000 (21:52 +0100)
committerMark Jansen <mark.jansen@reactos.org>
Tue, 9 Jan 2018 21:43:36 +0000 (22:43 +0100)
dll/appcompat/apphelp/sdbapi.c

index f7d01f9..ba60048 100644 (file)
@@ -177,15 +177,22 @@ BOOL WINAPI SdbpOpenMemMappedFile(LPCWSTR path, PMEMMAPPED mapping)
 
     RtlZeroMemory(mapping, sizeof(*mapping));
 
-    if(!RtlDosPathNameToNtPathName_U(path, &FileName, NULL, NULL))
-    {
-        RtlFreeUnicodeString(&FileName);
-        return FALSE;
-    }
+    RtlInitUnicodeString(&FileName, path);
 
     InitializeObjectAttributes(&ObjectAttributes, &FileName, OBJ_CASE_INSENSITIVE, NULL, NULL);
     Status = NtOpenFile(&mapping->file, GENERIC_READ | SYNCHRONIZE, &ObjectAttributes, &IoStatusBlock, FILE_SHARE_READ, FILE_SYNCHRONOUS_IO_NONALERT);
-    RtlFreeUnicodeString(&FileName);
+
+    if (Status == STATUS_OBJECT_NAME_INVALID || Status == STATUS_OBJECT_PATH_SYNTAX_BAD)
+    {
+        if (!RtlDosPathNameToNtPathName_U(path, &FileName, NULL, NULL))
+        {
+            SHIM_ERR("Failed to convert %S to Nt path: 0x%lx\n", path, Status);
+            return FALSE;
+        }
+        InitializeObjectAttributes(&ObjectAttributes, &FileName, OBJ_CASE_INSENSITIVE, NULL, NULL);
+        Status = NtOpenFile(&mapping->file, GENERIC_READ | SYNCHRONIZE, &ObjectAttributes, &IoStatusBlock, FILE_SHARE_READ, FILE_SYNCHRONOUS_IO_NONALERT);
+        RtlFreeUnicodeString(&FileName);
+    }
 
     if (!NT_SUCCESS(Status))
     {