shell32: Use SetCurrentDirectoryW instead of [A] function to avoid additional conversions

Nikolay Sivov bunglehead at gmail.com
Fri Jan 9 09:03:21 CST 2009


There's an entry for SheGetDirW here http://wiki.winehq.org/CrossCallsWtoA

Changelog:
    - use SetCurrentDirectoryW instead of SetCurrentDirectoryA

>From 143bbb81f50bc5b367ed9f208f5c5a0de74076ea Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Fri, 9 Jan 2009 17:54:46 +0300
Subject:  Use SetCurrentDirectoryW instead of [A] function to avoid additional conversions

---
 dlls/shell32/shlfileop.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/dlls/shell32/shlfileop.c b/dlls/shell32/shlfileop.c
index ec7ba54..05bd7d0 100644
--- a/dlls/shell32/shlfileop.c
+++ b/dlls/shell32/shlfileop.c
@@ -1627,16 +1627,17 @@ DWORD WINAPI SheGetDirW(DWORD drive, LPWSTR buffer)
 {
     WCHAR org_path[MAX_PATH];
     DWORD ret;
-    char drv_path[3];
+    WCHAR drv_path[3];
+    static const WCHAR driveAW[] = {'A',':',0};
 
     /* change current directory to the specified drive */
     if (drive) {
-        strcpy(drv_path, "A:");
-        drv_path[0] += (char)drive-1;
+        strcpyW(drv_path, driveAW);
+        drv_path[0] += (WCHAR)drive-1;
 
         GetCurrentDirectoryW(MAX_PATH, org_path);
 
-        SetCurrentDirectoryA(drv_path);
+        SetCurrentDirectoryW(drv_path);
     }
 
     /* query current directory path of the specified drive */
-- 
1.5.6.5






More information about the wine-patches mailing list