Jacek Caban : kernelbase: Simplify CreateFileW.

Alexandre Julliard julliard at winehq.org
Tue Dec 1 15:40:36 CST 2020


Module: wine
Branch: master
Commit: 60f11d2929629f0da257b810936f0239ad895596
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=60f11d2929629f0da257b810936f0239ad895596

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Dec  1 17:25:49 2020 +0100

kernelbase: Simplify CreateFileW.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/kernelbase/file.c | 24 ++++++------------------
 1 file changed, 6 insertions(+), 18 deletions(-)

diff --git a/dlls/kernelbase/file.c b/dlls/kernelbase/file.c
index 44d4c1c6b5a..7b122e263b0 100644
--- a/dlls/kernelbase/file.c
+++ b/dlls/kernelbase/file.c
@@ -738,7 +738,6 @@ HANDLE WINAPI DECLSPEC_HOTPATCH CreateFileW( LPCWSTR filename, DWORD access, DWO
     UNICODE_STRING nameW;
     IO_STATUS_BLOCK io;
     HANDLE ret;
-    DWORD dosdev;
     const WCHAR *vxd_name = NULL;
     SECURITY_QUALITY_OF_SERVICE qos;
 
@@ -770,25 +769,14 @@ HANDLE WINAPI DECLSPEC_HOTPATCH CreateFileW( LPCWSTR filename, DWORD access, DWO
            (sharing & FILE_SHARE_DELETE) ? "FILE_SHARE_DELETE " : "",
            creation, attributes);
 
-    if (!wcsncmp( filename, L"\\\\.\\", 4 ))
+    if ((GetVersion() & 0x80000000) && !wcsncmp( filename, L"\\\\.\\", 4 ) &&
+        !RtlIsDosDeviceName_U( filename + 4 ) &&
+        wcsnicmp( filename + 4, L"PIPE\\", 5 ) &&
+        wcsnicmp( filename + 4, L"MAILSLOT\\", 9 ))
     {
-        if ((filename[4] && filename[5] == ':' && !filename[6]) ||
-            !wcsnicmp( filename + 4, L"PIPE\\", 5 ) ||
-            !wcsnicmp( filename + 4, L"MAILSLOT\\", 9 ))
-        {
-            dosdev = 0;
-        }
-        else if ((dosdev = RtlIsDosDeviceName_U( filename + 4 )))
-        {
-            dosdev += MAKELONG( 0, 4*sizeof(WCHAR) );  /* adjust position to start of filename */
-        }
-        else if (GetVersion() & 0x80000000)
-        {
-            vxd_name = filename + 4;
-            if (!creation) creation = OPEN_EXISTING;
-        }
+        vxd_name = filename + 4;
+        if (!creation) creation = OPEN_EXISTING;
     }
-    else dosdev = RtlIsDosDeviceName_U( filename );
 
     if (creation < CREATE_NEW || creation > TRUNCATE_EXISTING)
     {




More information about the wine-cvs mailing list