[1/2] comdlg32: Use unicode Win32 APIs when possible

Dmitry Timoshkov dmitry at codeweavers.com
Wed Mar 7 07:18:40 CST 2007


Hello,

Changelog:
    comdlg32: Use unicode Win32 APIs when possible.

---
 dlls/comdlg32/filedlg.c |  175 +++++++++++++++++++++++------------------------
 1 files changed, 87 insertions(+), 88 deletions(-)

diff --git a/dlls/comdlg32/filedlg.c b/dlls/comdlg32/filedlg.c
index 73c9043..1c18e70 100644
--- a/dlls/comdlg32/filedlg.c
+++ b/dlls/comdlg32/filedlg.c
@@ -64,7 +64,6 @@
 #include "winreg.h"
 #include "winternl.h"
 #include "winnls.h"
-#include "wine/unicode.h"
 #include "wingdi.h"
 #include "winuser.h"
 #include "winreg.h"
@@ -72,7 +71,6 @@
 #include "dlgs.h"
 #include "cdlg.h"
 #include "filedlg31.h"
-#include "wine/debug.h"
 #include "cderr.h"
 #include "shellapi.h"
 #include "shlguid.h"
@@ -80,6 +78,9 @@
 #include "filedlgbrowser.h"
 #include "shlwapi.h"
 
+#include "wine/unicode.h"
+#include "wine/debug.h"
+
 WINE_DEFAULT_DEBUG_CHANNEL(commdlg);
 
 #define UNIMPLEMENTED_FLAGS \
@@ -140,40 +141,38 @@ typedef struct tagFD32_PRIVATE
 
 /* Combo box macros */
 #define CBAddString(hwnd,str) \
-  SendMessageA(hwnd,CB_ADDSTRING,0,(LPARAM)str);
-#define CBAddStringW(hwnd,str) \
-  SendMessageW(hwnd,CB_ADDSTRING,0,(LPARAM)str);
+    SendMessageW(hwnd, CB_ADDSTRING, 0, (LPARAM)(str));
 
 #define CBInsertString(hwnd,str,pos) \
-  SendMessageA(hwnd,CB_INSERTSTRING,(WPARAM)pos,(LPARAM)str);
+    SendMessageW(hwnd, CB_INSERTSTRING, (WPARAM)(pos), (LPARAM)(str));
 
 #define CBDeleteString(hwnd,pos) \
-  SendMessageA(hwnd,CB_DELETESTRING,(WPARAM)pos,0);
+    SendMessageW(hwnd, CB_DELETESTRING, (WPARAM)(pos), 0);
 
 #define CBSetItemDataPtr(hwnd,iItemId,dataPtr) \
-  SendMessageA(hwnd,CB_SETITEMDATA,(WPARAM)iItemId,(LPARAM)dataPtr);
+    SendMessageW(hwnd, CB_SETITEMDATA, (WPARAM)(iItemId), (LPARAM)(dataPtr));
 
 #define CBGetItemDataPtr(hwnd,iItemId) \
-  SendMessageA(hwnd,CB_GETITEMDATA,(WPARAM)iItemId,0)
+    SendMessageW(hwnd, CB_GETITEMDATA, (WPARAM)(iItemId), 0)
 
 #define CBGetLBText(hwnd,iItemId,str) \
-  SendMessageA(hwnd,CB_GETLBTEXT,(WPARAM)iItemId,(LPARAM)str);
+    SendMessageW(hwnd, CB_GETLBTEXT, (WPARAM)(iItemId), (LPARAM)(str));
 
 #define CBGetCurSel(hwnd) \
-  SendMessageA(hwnd,CB_GETCURSEL,0,0);
+    SendMessageW(hwnd, CB_GETCURSEL, 0, 0);
 
 #define CBSetCurSel(hwnd,pos) \
-  SendMessageA(hwnd,CB_SETCURSEL,(WPARAM)pos,0);
+    SendMessageW(hwnd, CB_SETCURSEL, (WPARAM)(pos), 0);
 
 #define CBGetCount(hwnd) \
-    SendMessageA(hwnd,CB_GETCOUNT,0,0);
+    SendMessageW(hwnd, CB_GETCOUNT, 0, 0);
 #define CBShowDropDown(hwnd,show) \
-  SendMessageA(hwnd,CB_SHOWDROPDOWN,(WPARAM)show,0);
+    SendMessageW(hwnd, CB_SHOWDROPDOWN, (WPARAM)(show), 0);
 #define CBSetItemHeight(hwnd,index,height) \
-  SendMessageA(hwnd,CB_SETITEMHEIGHT,(WPARAM)index,(LPARAM)height);
+    SendMessageW(hwnd, CB_SETITEMHEIGHT, (WPARAM)(index), (LPARAM)(height));
 
 #define CBSetExtendedUI(hwnd,flag) \
-  SendMessageA(hwnd,CB_SETEXTENDEDUI,(WPARAM)(flag),0)
+    SendMessageW(hwnd, CB_SETEXTENDEDUI, (WPARAM)(flag), 0)
 
 const char FileOpenDlgInfosStr[] = "FileOpenDlgInfos"; /* windows property description string */
 static const char LookInInfosStr[] = "LookInInfos"; /* LOOKIN combo box property */
@@ -478,7 +477,7 @@ BOOL  WINAPI GetFileDialog95W(LPOPENFILENAMEW ofn,UINT iDlgType)
   if(ofn->lpstrInitialDir)
   {
     /* fodInfos.initdir = strdupW(ofn->lpstrInitialDir); */
-    DWORD len = strlenW(ofn->lpstrInitialDir)+1;
+    DWORD len = lstrlenW(ofn->lpstrInitialDir)+1;
     fodInfos.initdir = MemAlloc(len*sizeof(WCHAR));
     memcpy(fodInfos.initdir,ofn->lpstrInitialDir,len*sizeof(WCHAR));
   }
@@ -877,10 +876,10 @@ static INT_PTR FILEDLG95_Handle_GetFilePath(HWND hwnd, DWORD size, LPVOID buffer
     if( fodInfos->unicode )
     {
         LPWSTR bufW = buffer;
-        total = strlenW(lpstrCurrentDir) + 1 + sizeUsed;
+        total = lstrlenW(lpstrCurrentDir) + 1 + sizeUsed;
 
         /* Prepend the current path */
-        n = strlenW(lpstrCurrentDir) + 1;
+        n = lstrlenW(lpstrCurrentDir) + 1;
         memcpy( bufW, lpstrCurrentDir, min(n,size) * sizeof(WCHAR));
         if(n<size)
         {
@@ -974,7 +973,7 @@ static INT_PTR FILEDLG95_HandleCustomDialogMessages(HWND hwnd, UINT uMsg, WPARAM
                     WideCharToMultiByte(CP_ACP, 0, lpstrPath, -1, 
                                         (LPSTR)lParam, (int)wParam, NULL, NULL);
             }        
-            retval = strlenW(lpstrPath);
+            retval = lstrlenW(lpstrPath);
             break;
 
         case CDM_GETSPEC:
@@ -1254,13 +1253,13 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd)
          if (result) {
 
             /* nameBit is always shorter than the original filename */
-            strcpyW(fodInfos->filename,nameBit);
+            lstrcpyW(fodInfos->filename,nameBit);
 
             *nameBit = 0x00;
             if (fodInfos->initdir == NULL)
                 MemFree(fodInfos->initdir);
-            fodInfos->initdir = MemAlloc((strlenW(tmpBuf) + 1)*sizeof(WCHAR));
-            strcpyW(fodInfos->initdir, tmpBuf);
+            fodInfos->initdir = MemAlloc((lstrlenW(tmpBuf) + 1)*sizeof(WCHAR));
+            lstrcpyW(fodInfos->initdir, tmpBuf);
             handledPath = TRUE;
             TRACE("Value in Filename includes path, overriding InitialDir: %s, %s\n",
                     debugstr_w(fodInfos->filename), debugstr_w(fodInfos->initdir));
@@ -1284,22 +1283,22 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd)
           WCHAR *nameBit;
           DWORD result;
 
-          strcpyW(tmpBuf, fodInfos->initdir);
+          lstrcpyW(tmpBuf, fodInfos->initdir);
           if( PathFileExistsW(tmpBuf) ) {
               /* initdir does not have to be a directory. If a file is
                * specified, the dir part is taken */
               if( PathIsDirectoryW(tmpBuf)) {
-                  if (tmpBuf[strlenW(tmpBuf)-1] != '\\') {
-                     strcatW(tmpBuf, szwSlash);
+                  if (tmpBuf[lstrlenW(tmpBuf)-1] != '\\') {
+                     lstrcatW(tmpBuf, szwSlash);
                   }
-                  strcatW(tmpBuf, szwStar);
+                  lstrcatW(tmpBuf, szwStar);
               }
               result = GetFullPathNameW(tmpBuf, MAX_PATH, tmpBuf2, &nameBit);
               if (result) {
                  *nameBit = 0x00;
                  MemFree(fodInfos->initdir);
-                 fodInfos->initdir = MemAlloc((strlenW(tmpBuf2) + 1)*sizeof(WCHAR));
-                 strcpyW(fodInfos->initdir, tmpBuf2);
+                 fodInfos->initdir = MemAlloc((lstrlenW(tmpBuf2) + 1)*sizeof(WCHAR));
+                 lstrcpyW(fodInfos->initdir, tmpBuf2);
                  handledPath = TRUE;
                  TRACE("Value in InitDir changed to %s\n", debugstr_w(fodInfos->initdir));
               }
@@ -1330,13 +1329,13 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd)
             int len;
 
             /* nameBit is always shorter than the original filename */
-            strcpyW(fodInfos->filename, nameBit);
+            lstrcpyW(fodInfos->filename, nameBit);
             *nameBit = 0x00;
 
-            len = strlenW(tmpBuf);
+            len = lstrlenW(tmpBuf);
             MemFree(fodInfos->initdir);
             fodInfos->initdir = MemAlloc((len+1)*sizeof(WCHAR));
-            strcpyW(fodInfos->initdir, tmpBuf);
+            lstrcpyW(fodInfos->initdir, tmpBuf);
 
             handledPath = TRUE;
             TRACE("Value in Filename includes path, overriding initdir: %s, %s\n",
@@ -1361,7 +1360,7 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd)
 
            /* Skip the title */
            if(! *lpstrPos) break;	/* end */
-           lpstrPos += strlenW(lpstrPos) + 1;
+           lpstrPos += lstrlenW(lpstrPos) + 1;
 
            /* See if any files exist in the current dir with this extension */
            if(! *lpstrPos) break;	/* end */
@@ -1370,7 +1369,7 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd)
 
            if (hFind == INVALID_HANDLE_VALUE) {
                /* None found - continue search */
-               lpstrPos += strlenW(lpstrPos) + 1;
+               lpstrPos += lstrlenW(lpstrPos) + 1;
 
            } else {
                searchMore = FALSE;
@@ -1686,23 +1685,23 @@ BOOL FILEDLG95_OnOpenMultipleFiles(HWND hwnd, LPWSTR lpstrFileList, UINT nFileCo
         LoadStringW(COMDLG32_hInstance, IDS_FILENOTFOUND, lpstrNotFound, 100);
         LoadStringW(COMDLG32_hInstance, IDS_VERIFYFILE, lpstrMsg, 100);
 
-        strcpyW(tmp, lpstrTemp);
-        strcatW(tmp, nl);
-        strcatW(tmp, lpstrNotFound);
-        strcatW(tmp, nl);
-        strcatW(tmp, lpstrMsg);
+        lstrcpyW(tmp, lpstrTemp);
+        lstrcatW(tmp, nl);
+        lstrcatW(tmp, lpstrNotFound);
+        lstrcatW(tmp, nl);
+        lstrcatW(tmp, lpstrMsg);
 
         MessageBoxW(hwnd, tmp, fodInfos->title, MB_OK | MB_ICONEXCLAMATION);
         return FALSE;
       }
 
       /* move to the next file in the list of files */
-      lpstrTemp += strlenW(lpstrTemp) + 1;
+      lpstrTemp += lstrlenW(lpstrTemp) + 1;
       COMDLG32_SHFree(pidl);
     }
   }
 
-  nSizePath = strlenW(lpstrPathSpec) + 1;
+  nSizePath = lstrlenW(lpstrPathSpec) + 1;
   if ( !(fodInfos->ofnInfos->Flags & OFN_EXPLORER) )
   {
     /* For "oldstyle" dialog the components have to
@@ -1713,7 +1712,7 @@ BOOL FILEDLG95_OnOpenMultipleFiles(HWND hwnd, LPWSTR lpstrFileList, UINT nFileCo
   if(fodInfos->unicode)
   {
     LPOPENFILENAMEW ofn = fodInfos->ofnInfos;
-    strcpyW( ofn->lpstrFile, lpstrPathSpec);
+    lstrcpyW( ofn->lpstrFile, lpstrPathSpec);
     memcpy( ofn->lpstrFile + nSizePath, lpstrFileList, sizeUsed*sizeof(WCHAR) );
   }
   else
@@ -1820,20 +1819,20 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
   /* if the user specifyed a fully qualified path use it */
   if(PathIsRelativeW(lpstrFileList))
   {
-    strcatW(lpstrPathAndFile, lpstrFileList);
+    lstrcatW(lpstrPathAndFile, lpstrFileList);
   }
   else
   {
     /* does the path have a drive letter? */
     if (PathGetDriveNumberW(lpstrFileList) == -1)
-      strcpyW(lpstrPathAndFile+2, lpstrFileList);
+      lstrcpyW(lpstrPathAndFile+2, lpstrFileList);
     else
-      strcpyW(lpstrPathAndFile, lpstrFileList);
+      lstrcpyW(lpstrPathAndFile, lpstrFileList);
   }
 
   /* resolve "." and ".." */
   PathCanonicalizeW(lpstrTemp, lpstrPathAndFile );
-  strcpyW(lpstrPathAndFile, lpstrTemp);
+  lstrcpyW(lpstrPathAndFile, lpstrTemp);
   TRACE("canon=%s\n", debugstr_w(lpstrPathAndFile));
 
   MemFree(lpstrFileList);
@@ -1880,13 +1879,13 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
       DWORD dwEaten, dwAttributes;
       LPWSTR p;
 
-      strcpyW(lpwstrTemp, lpszTemp);
+      lstrcpyW(lpwstrTemp, lpszTemp);
       p = PathFindNextComponentW(lpwstrTemp);
 
       if (!p) break; /* end of path */
 
       *p = 0;
-      lpszTemp = lpszTemp + strlenW(lpwstrTemp);
+      lpszTemp = lpszTemp + lstrlenW(lpwstrTemp);
 
       /* There are no wildcards when OFN_NOVALIDATE is set */
       if(*lpszTemp==0 && !(fodInfos->ofnInfos->Flags & OFN_NOVALIDATE))
@@ -1991,9 +1990,9 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
 
         /* replace the current filter */
         MemFree((LPVOID)fodInfos->ShellInfos.lpstrCurrentFilter);
-        len = strlenW(lpszTemp)+1;
+        len = lstrlenW(lpszTemp)+1;
         fodInfos->ShellInfos.lpstrCurrentFilter = MemAlloc(len * sizeof(WCHAR));
-        strcpyW( fodInfos->ShellInfos.lpstrCurrentFilter, lpszTemp);
+        lstrcpyW( fodInfos->ShellInfos.lpstrCurrentFilter, lpszTemp);
 
         /* set the filter cb to the extension when possible */
         if(-1 < (iPos = FILEDLG95_FILETYPE_SearchExt(fodInfos->DlgInfos.hwndFileTypeCB, lpszTemp)))
@@ -2047,10 +2046,10 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
             WCHAR *filterExt = NULL;
             LPWSTR lpstrFilter = NULL;
             static const WCHAR szwDot[] = {'.',0};
-            int PathLength = strlenW(lpstrPathAndFile);
+            int PathLength = lstrlenW(lpstrPathAndFile);
 
             /* Attach the dot*/
-            strcatW(lpstrPathAndFile, szwDot);
+            lstrcatW(lpstrPathAndFile, szwDot);
     
             /*Get the file extension from file type filter*/
             lpstrFilter = (LPWSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,
@@ -2060,9 +2059,9 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
                 filterExt = PathFindExtensionW(lpstrFilter);
 
             if ( filterExt && *filterExt ) /* attach the file extension from file type filter*/
-                strcatW(lpstrPathAndFile, filterExt + 1);
+                lstrcatW(lpstrPathAndFile, filterExt + 1);
             else if ( fodInfos->defext ) /* attach the default file extension*/
-                strcatW(lpstrPathAndFile, fodInfos->defext);
+                lstrcatW(lpstrPathAndFile, fodInfos->defext);
 
             /* In Open dialog: if file does not exist try without extension */
             if (!(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG) && !PathFileExistsW(lpstrPathAndFile))
@@ -2100,7 +2099,7 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
 
         /* Check that the size of the file does not exceed buffer size.
              (Allow for extra \0 if OFN_MULTISELECT is set.) */
-        if(strlenW(lpstrPathAndFile) < fodInfos->ofnInfos->nMaxFile -
+        if(lstrlenW(lpstrPathAndFile) < fodInfos->ofnInfos->nMaxFile -
             ((fodInfos->ofnInfos->Flags & OFN_ALLOWMULTISELECT) ? 1 : 0))
         {
           LPWSTR lpszTemp;
@@ -2179,7 +2178,7 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
         {
           WORD size;
 
-          size = strlenW(lpstrPathAndFile) + 1;
+          size = lstrlenW(lpstrPathAndFile) + 1;
           if (fodInfos->ofnInfos->Flags & OFN_ALLOWMULTISELECT)
              size += 1;
           /* return needed size in first two bytes of lpstrFile */
@@ -2349,15 +2348,15 @@ static HRESULT FILEDLG95_FILETYPE_Init(HWND hwnd)
       LPCWSTR lpstrPos = fodInfos->customfilter;
 
       /* Get the title */
-      lpstrPos += strlenW(fodInfos->customfilter) + 1;
+      lpstrPos += lstrlenW(fodInfos->customfilter) + 1;
 
       /* Copy the extensions */
       if (! *lpstrPos) return E_FAIL;	/* malformed filter */
-      if (!(lpstrExt = MemAlloc((strlenW(lpstrPos)+1)*sizeof(WCHAR)))) return E_FAIL;
-      strcpyW(lpstrExt,lpstrPos);
+      if (!(lpstrExt = MemAlloc((lstrlenW(lpstrPos)+1)*sizeof(WCHAR)))) return E_FAIL;
+      lstrcpyW(lpstrExt,lpstrPos);
 
       /* Add the item at the end of the combo */
-      CBAddStringW(fodInfos->DlgInfos.hwndFileTypeCB, fodInfos->customfilter);
+      CBAddString(fodInfos->DlgInfos.hwndFileTypeCB, fodInfos->customfilter);
       CBSetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB, nFilters, lpstrExt);
       nFilters++;
   }
@@ -2377,16 +2376,16 @@ static HRESULT FILEDLG95_FILETYPE_Init(HWND hwnd)
       /* Get the title */
       if(! *lpstrPos) break;	/* end */
       lpstrDisplay = lpstrPos;
-      lpstrPos += strlenW(lpstrPos) + 1;
+      lpstrPos += lstrlenW(lpstrPos) + 1;
 
-      CBAddStringW(fodInfos->DlgInfos.hwndFileTypeCB, lpstrDisplay);
+      CBAddString(fodInfos->DlgInfos.hwndFileTypeCB, lpstrDisplay);
 
       nFilters++;
 
       /* Copy the extensions */
-      if (!(lpstrExt = MemAlloc((strlenW(lpstrPos)+1)*sizeof(WCHAR)))) return E_FAIL;
-      strcpyW(lpstrExt,lpstrPos);
-      lpstrPos += strlenW(lpstrPos) + 1;
+      if (!(lpstrExt = MemAlloc((lstrlenW(lpstrPos)+1)*sizeof(WCHAR)))) return E_FAIL;
+      lstrcpyW(lpstrExt,lpstrPos);
+      lpstrPos += lstrlenW(lpstrPos) + 1;
 
       /* Add the item at the end of the combo */
       CBSetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB, nFilters-1, lpstrExt);
@@ -2432,9 +2431,9 @@ static HRESULT FILEDLG95_FILETYPE_Init(HWND hwnd)
     {
       DWORD len;
       CharLowerW(lpstrFilter); /* lowercase */
-      len = strlenW(lpstrFilter)+1;
+      len = lstrlenW(lpstrFilter)+1;
       fodInfos->ShellInfos.lpstrCurrentFilter = MemAlloc( len * sizeof(WCHAR) );
-      strcpyW(fodInfos->ShellInfos.lpstrCurrentFilter,lpstrFilter);
+      lstrcpyW(fodInfos->ShellInfos.lpstrCurrentFilter,lpstrFilter);
     }
   } else
       fodInfos->ofnInfos->nFilterIndex = 0;
@@ -2473,9 +2472,9 @@ static BOOL FILEDLG95_FILETYPE_OnCommand(HWND hwnd, WORD wNotifyCode)
       {
           DWORD len;
           CharLowerW(lpstrFilter); /* lowercase */
-          len = strlenW(lpstrFilter)+1;
+          len = lstrlenW(lpstrFilter)+1;
           fodInfos->ShellInfos.lpstrCurrentFilter = MemAlloc( len * sizeof(WCHAR) );
-          strcpyW(fodInfos->ShellInfos.lpstrCurrentFilter,lpstrFilter);
+          lstrcpyW(fodInfos->ShellInfos.lpstrCurrentFilter,lpstrFilter);
           SendCustomDlgNotificationMessage(hwnd,CDN_TYPECHANGE);
       }
 
@@ -2646,10 +2645,10 @@ static LRESULT FILEDLG95_LOOKIN_DrawItem(LPDRAWITEMSTRUCT pDIStruct)
   COLORREF crText = GetSysColor(COLOR_WINDOWTEXT);
   RECT rectText;
   RECT rectIcon;
-  SHFILEINFOA sfi;
+  SHFILEINFOW sfi;
   HIMAGELIST ilItemImage;
   int iIndentation;
-  TEXTMETRICA tm;
+  TEXTMETRICW tm;
   LPSFOLDER tmpFolder;
 
 
@@ -2667,20 +2666,20 @@ static LRESULT FILEDLG95_LOOKIN_DrawItem(LPDRAWITEMSTRUCT pDIStruct)
 
   if(pDIStruct->itemID == liInfos->uSelectedItem)
   {
-    ilItemImage = (HIMAGELIST) SHGetFileInfoA ((LPCSTR) tmpFolder->pidlItem,
+    ilItemImage = (HIMAGELIST) SHGetFileInfoW ((LPCWSTR) tmpFolder->pidlItem,
                                                0,
                                                &sfi,
-                                               sizeof (SHFILEINFOA),
+                                               sizeof (sfi),
                                                SHGFI_PIDL | SHGFI_SMALLICON |
                                                SHGFI_OPENICON | SHGFI_SYSICONINDEX    |
                                                SHGFI_DISPLAYNAME );
   }
   else
   {
-    ilItemImage = (HIMAGELIST) SHGetFileInfoA ((LPCSTR) tmpFolder->pidlItem,
+    ilItemImage = (HIMAGELIST) SHGetFileInfoW ((LPCWSTR) tmpFolder->pidlItem,
                                                   0,
                                                   &sfi,
-                                                  sizeof (SHFILEINFOA),
+                                                  sizeof (sfi),
                                                   SHGFI_PIDL | SHGFI_SMALLICON |
                                                   SHGFI_SYSICONINDEX |
                                                   SHGFI_DISPLAYNAME);
@@ -2704,10 +2703,10 @@ static LRESULT FILEDLG95_LOOKIN_DrawItem(LPDRAWITEMSTRUCT pDIStruct)
   if(pDIStruct->itemState & ODS_COMBOBOXEDIT)
   {
     iIndentation = 0;
-    ilItemImage = (HIMAGELIST) SHGetFileInfoA ((LPCSTR) tmpFolder->pidlItem,
+    ilItemImage = (HIMAGELIST) SHGetFileInfoW ((LPCWSTR) tmpFolder->pidlItem,
                                                 0,
                                                 &sfi,
-                                                sizeof (SHFILEINFOA),
+                                                sizeof (sfi),
                                                 SHGFI_PIDL | SHGFI_SMALLICON | SHGFI_OPENICON
                                                 | SHGFI_SYSICONINDEX | SHGFI_DISPLAYNAME  );
 
@@ -2725,7 +2724,7 @@ static LRESULT FILEDLG95_LOOKIN_DrawItem(LPDRAWITEMSTRUCT pDIStruct)
   rectIcon.bottom = pDIStruct->rcItem.bottom;
 
   /* Initialise the text display area */
-  GetTextMetricsA(pDIStruct->hDC, &tm);
+  GetTextMetricsW(pDIStruct->hDC, &tm);
   rectText.left = rectIcon.right;
   rectText.top =
 	  (pDIStruct->rcItem.top + pDIStruct->rcItem.bottom - tm.tmHeight) / 2;
@@ -2743,7 +2742,7 @@ static LRESULT FILEDLG95_LOOKIN_DrawItem(LPDRAWITEMSTRUCT pDIStruct)
 
   /* Draw the associated text */
   if(sfi.szDisplayName)
-    TextOutA(pDIStruct->hDC,rectText.left,rectText.top,sfi.szDisplayName,strlen(sfi.szDisplayName));
+    TextOutW(pDIStruct->hDC,rectText.left,rectText.top,sfi.szDisplayName,lstrlenW(sfi.szDisplayName));
 
 
   return NOERROR;
@@ -2798,7 +2797,7 @@ static BOOL FILEDLG95_LOOKIN_OnCommand(HWND hwnd, WORD wNotifyCode)
 static int FILEDLG95_LOOKIN_AddItem(HWND hwnd,LPITEMIDLIST pidl, int iInsertId)
 {
   LPITEMIDLIST pidlNext;
-  SHFILEINFOA sfi;
+  SHFILEINFOW sfi;
   SFOLDER *tmpFolder;
   LookInInfos *liInfos;
 
@@ -2826,20 +2825,20 @@ static int FILEDLG95_LOOKIN_AddItem(HWND hwnd,LPITEMIDLIST pidl, int iInsertId)
     liInfos->iMaxIndentation = tmpFolder->m_iIndent;
 
   sfi.dwAttributes = SFGAO_FILESYSANCESTOR | SFGAO_FILESYSTEM;
-  SHGetFileInfoA((LPSTR)pidl,
+  SHGetFileInfoW((LPCWSTR)pidl,
                   0,
                   &sfi,
                   sizeof(sfi),
                   SHGFI_DISPLAYNAME | SHGFI_SYSICONINDEX
                   | SHGFI_PIDL | SHGFI_SMALLICON | SHGFI_ATTRIBUTES | SHGFI_ATTR_SPECIFIED);
 
-  TRACE("-- Add %s attr=%08x\n", sfi.szDisplayName, sfi.dwAttributes);
+  TRACE("-- Add %s attr=%08x\n", debugstr_w(sfi.szDisplayName), sfi.dwAttributes);
 
   if((sfi.dwAttributes & SFGAO_FILESYSANCESTOR) || (sfi.dwAttributes & SFGAO_FILESYSTEM))
   {
     int iItemID;
 
-    TRACE("-- Add %s at %u\n", sfi.szDisplayName, tmpFolder->m_iIndent);
+    TRACE("-- Add %s at %u\n", debugstr_w(sfi.szDisplayName), tmpFolder->m_iIndent);
 
     /* Add the item at the end of the list */
     if(iInsertId < 0)
@@ -3192,8 +3191,8 @@ static int FILEDLG95_FILENAME_GetFileNames (HWND hwnd, LPWSTR * lpstrFileList, U
 	/* single, unquoted string */
 	if ((nStrLen > 0) && (*sizeUsed == 0) )
 	{
-	  strcpyW(*lpstrFileList, lpstrEdit);
-	  nFileIndex = strlenW(lpstrEdit) + 1;
+	  lstrcpyW(*lpstrFileList, lpstrEdit);
+	  nFileIndex = lstrlenW(lpstrEdit) + 1;
 	  (*sizeUsed) = nFileIndex;
 	  nFileCount = 1;
 	}
@@ -3959,7 +3958,7 @@ short WINAPI GetFileTitleW(LPCWSTR lpFile, LPWSTR lpTitle, WORD cbBuf)
 	if(lpFile == NULL || lpTitle == NULL)
 		return -1;
 
-	len = strlenW(lpFile);
+	len = lstrlenW(lpFile);
 
 	if (len == 0)
 		return -1;
@@ -3986,10 +3985,10 @@ short WINAPI GetFileTitleW(LPCWSTR lpFile, LPWSTR lpTitle, WORD cbBuf)
 
 	TRACE("---> %s\n", debugstr_w(&lpFile[i]));
 
-	len = strlenW(lpFile+i)+1;
+	len = lstrlenW(lpFile+i)+1;
 	if(cbBuf < len)
 		return len;
 
-	strcpyW(lpTitle, &lpFile[i]);
+	lstrcpyW(lpTitle, &lpFile[i]);
 	return 0;
 }
-- 
1.5.0.2






More information about the wine-patches mailing list