Author: janderwald Date: Thu Oct 11 14:00:11 2007 New Revision: 29491
URL: http://svn.reactos.org/svn/reactos?rev=29491&view=rev Log: Mikoaj Zalewski mikolaj@zalewski.pl - Make the shell view control Unicode - Change some more ANSI calls to Unicode
Modified: trunk/reactos/dll/win32/shell32/shlview.c
Modified: trunk/reactos/dll/win32/shell32/shlview.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shlview.c... ============================================================================== --- trunk/reactos/dll/win32/shell32/shlview.c (original) +++ trunk/reactos/dll/win32/shell32/shlview.c Thu Oct 11 14:00:11 2007 @@ -68,6 +68,10 @@
WINE_DEFAULT_DEBUG_CHANNEL(shell);
+#undef SV_CLASS_NAME + +static const WCHAR SV_CLASS_NAME[] = {'S','H','E','L','L','D','L','L','_','D','e','f','V','i','e','w',0}; + typedef struct { BOOL bIsAscending; INT nHeaderID; @@ -290,8 +294,8 @@
TRACE("(%p)\n", This);
- tmpstyle = GetWindowLongA(This->hWndList, GWL_STYLE); - SetWindowLongA(This->hWndList, GWL_STYLE, dwAdd | (tmpstyle & ~dwRemove)); + tmpstyle = GetWindowLongW(This->hWndList, GWL_STYLE); + SetWindowLongW(This->hWndList, GWL_STYLE, dwAdd | (tmpstyle & ~dwRemove)); }
/********************************************************** @@ -324,8 +328,8 @@ if (This->FolderSettings.fFlags & FWF_NOCLIENTEDGE) dwExStyle &= ~WS_EX_CLIENTEDGE;
- This->hWndList=CreateWindowExA( dwExStyle, - WC_LISTVIEWA, + This->hWndList=CreateWindowExW( dwExStyle, + WC_LISTVIEWW, NULL, dwStyle, 0,0,0,0, @@ -526,11 +530,11 @@ IShellViewImpl * This, LPCITEMIDLIST pidl) { - LVITEMA lvItem; + LVITEMW lvItem; lvItem.iSubItem = 0; lvItem.mask = LVIF_PARAM; for(lvItem.iItem = 0; - SendMessageA(This->hWndList, LVM_GETITEMA, 0, (LPARAM) &lvItem); + SendMessageW(This->hWndList, LVM_GETITEMW, 0, (LPARAM) &lvItem); lvItem.iItem++) { LPITEMIDLIST currentpidl = (LPITEMIDLIST) lvItem.lParam; @@ -548,7 +552,7 @@ */ static BOOLEAN LV_AddItem(IShellViewImpl * This, LPCITEMIDLIST pidl) { - LVITEMA lvItem; + LVITEMW lvItem;
TRACE("(%p)(pidl=%p)\n", This, pidl);
@@ -556,9 +560,9 @@ lvItem.iItem = ListView_GetItemCount(This->hWndList); /*add the item to the end of the list*/ lvItem.iSubItem = 0; lvItem.lParam = (LPARAM) ILClone(ILFindLastID(pidl)); /*set the item's data*/ - lvItem.pszText = LPSTR_TEXTCALLBACKA; /*get text on a callback basis*/ + lvItem.pszText = LPSTR_TEXTCALLBACKW; /*get text on a callback basis*/ lvItem.iImage = I_IMAGECALLBACK; /*get the image on a callback basis*/ - return (-1==ListView_InsertItemA(This->hWndList, &lvItem))? FALSE: TRUE; + return (-1==ListView_InsertItemW(This->hWndList, &lvItem))? FALSE: TRUE; }
/********************************************************** @@ -580,7 +584,7 @@ static BOOLEAN LV_RenameItem(IShellViewImpl * This, LPCITEMIDLIST pidlOld, LPCITEMIDLIST pidlNew ) { int nItem; - LVITEMA lvItem; + LVITEMW lvItem;
TRACE("(%p)(pidlold=%p pidlnew=%p)\n", This, pidlOld, pidlNew);
@@ -589,14 +593,14 @@ { lvItem.mask = LVIF_PARAM; /* only the pidl */ lvItem.iItem = nItem; - SendMessageA(This->hWndList, LVM_GETITEMA, 0, (LPARAM) &lvItem); + SendMessageW(This->hWndList, LVM_GETITEMW, 0, (LPARAM) &lvItem);
SHFree((LPITEMIDLIST)lvItem.lParam); lvItem.mask = LVIF_PARAM; lvItem.iItem = nItem; lvItem.lParam = (LPARAM) ILClone(ILFindLastID(pidlNew)); /* set the item's data */ - SendMessageA(This->hWndList, LVM_SETITEMA, 0, (LPARAM) &lvItem); - SendMessageA(This->hWndList, LVM_UPDATE, nItem, 0); + SendMessageW(This->hWndList, LVM_SETITEMW, 0, (LPARAM) &lvItem); + SendMessageW(This->hWndList, LVM_UPDATE, nItem, 0); return TRUE; /* FIXME: better handling */ } return FALSE; @@ -719,8 +723,8 @@ * ShellView_BuildFileMenu() */ static HMENU ShellView_BuildFileMenu(IShellViewImpl * This) -{ CHAR szText[MAX_PATH]; - MENUITEMINFOA mii; +{ WCHAR szText[MAX_PATH]; + MENUITEMINFOW mii; int nTools,i; HMENU hSubMenu;
@@ -734,7 +738,7 @@ /*add the menu items*/ for(i = 0; i < nTools; i++) { - LoadStringA(shell32_hInstance, Tools[i].idMenuString, szText, MAX_PATH); + LoadStringW(shell32_hInstance, Tools[i].idMenuString, szText, MAX_PATH);
ZeroMemory(&mii, sizeof(mii)); mii.cbSize = sizeof(mii); @@ -752,7 +756,7 @@ mii.fType = MFT_SEPARATOR; } /* tack This item onto the end of the menu */ - InsertMenuItemA(hSubMenu, (UINT)-1, TRUE, &mii); + InsertMenuItemW(hSubMenu, (UINT)-1, TRUE, &mii); } } TRACE("-- return (menu=%p)\n",hSubMenu); @@ -808,7 +812,7 @@ */ static UINT ShellView_GetSelections(IShellViewImpl * This) { - LVITEMA lvItem; + LVITEMW lvItem; UINT i = 0;
SHFree(This->apidl); @@ -827,7 +831,7 @@ lvItem.iItem = 0; lvItem.iSubItem = 0;
- while(ListView_GetItemA(This->hWndList, &lvItem) && (i < This->cidl)) + while(ListView_GetItemW(This->hWndList, &lvItem) && (i < This->cidl)) { if(lvItem.state & LVIS_SELECTED) { @@ -1257,7 +1261,7 @@
static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpnmh) { LPNMLISTVIEW lpnmlv = (LPNMLISTVIEW)lpnmh; - NMLVDISPINFOA *lpdi = (NMLVDISPINFOA *)lpnmh; + NMLVDISPINFOW *lpdi = (NMLVDISPINFOW *)lpnmh; LPITEMIDLIST pidl;
TRACE("%p CtlID=%u lpnmh->code=%x\n",This,CtlID,lpnmh->code); @@ -1302,8 +1306,8 @@ if (OnDefaultCommand(This) != S_OK) ShellView_OpenSelectedItems(This); break;
- case HDN_ENDTRACKA: - TRACE("-- HDN_ENDTRACKA %p\n",This); + case HDN_ENDTRACKW: + TRACE("-- HDN_ENDTRACKW %p\n",This); /*nColumn1 = ListView_GetColumnWidth(This->hWndList, 0); nColumn2 = ListView_GetColumnWidth(This->hWndList, 1);*/ break; @@ -1338,7 +1342,7 @@ } This->ListViewSortInfo.nLastHeaderID = This->ListViewSortInfo.nHeaderID;
- SendMessageA(lpnmlv->hdr.hwndFrom, LVM_SORTITEMS, (WPARAM) &This->ListViewSortInfo, (LPARAM)ShellView_ListViewCompareItems); + SendMessageW(lpnmlv->hdr.hwndFrom, LVM_SORTITEMS, (WPARAM) &This->ListViewSortInfo, (LPARAM)ShellView_ListViewCompareItems); break;
case LVN_GETDISPINFOA: @@ -1354,13 +1358,15 @@ IShellFolder2_GetDetailsOf(This->pSF2Parent, pidl, lpdi->item.iSubItem, &sd); if (lpnmh->code == LVN_GETDISPINFOA) { - StrRetToStrNA( lpdi->item.pszText, lpdi->item.cchTextMax, &sd.str, NULL); - TRACE("-- text=%s\n",lpdi->item.pszText); + /* shouldn't happen */ + NMLVDISPINFOA *lpdiA = (NMLVDISPINFOA *)lpnmh; + StrRetToStrNA( lpdiA->item.pszText, lpdiA->item.cchTextMax, &sd.str, NULL); + TRACE("-- text=%s\n",lpdiA->item.pszText); } else /* LVN_GETDISPINFOW */ { - StrRetToStrNW( ((NMLVDISPINFOW *)lpdi)->item.pszText, lpdi->item.cchTextMax, &sd.str, NULL); - TRACE("-- text=%s\n",debugstr_w((WCHAR*)(lpdi->item.pszText))); + StrRetToStrNW( lpdi->item.pszText, lpdi->item.cchTextMax, &sd.str, NULL); + TRACE("-- text=%s\n",debugstr_w(lpdi->item.pszText)); } } else @@ -1411,7 +1417,7 @@ } break;
- case LVN_BEGINLABELEDITA: + case LVN_BEGINLABELEDITW: { DWORD dwAttr = SFGAO_CANRENAME; pidl = (LPITEMIDLIST)lpdi->item.lParam; @@ -1426,30 +1432,27 @@ return TRUE; }
- case LVN_ENDLABELEDITA: + case LVN_ENDLABELEDITW: { TRACE("-- LVN_ENDLABELEDITA %p\n",This); if (lpdi->item.pszText) { HRESULT hr; - WCHAR wszNewName[MAX_PATH]; - LVITEMA lvItem; + LVITEMW lvItem;
lvItem.iItem = lpdi->item.iItem; lvItem.iSubItem = 0; lvItem.mask = LVIF_PARAM; - SendMessageA(This->hWndList, LVM_GETITEMA, 0, (LPARAM) &lvItem); + SendMessageW(This->hWndList, LVM_GETITEMW, 0, (LPARAM) &lvItem);
pidl = (LPITEMIDLIST)lpdi->item.lParam; - if (!MultiByteToWideChar( CP_ACP, 0, lpdi->item.pszText, -1, wszNewName, MAX_PATH )) - wszNewName[MAX_PATH-1] = 0; - hr = IShellFolder_SetNameOf(This->pSFParent, 0, pidl, wszNewName, SHGDN_INFOLDER, &pidl); + hr = IShellFolder_SetNameOf(This->pSFParent, 0, pidl, lpdi->item.pszText, SHGDN_INFOLDER, &pidl);
if(SUCCEEDED(hr) && pidl) { lvItem.mask = LVIF_PARAM; lvItem.lParam = (LPARAM)pidl; - SendMessageA(This->hWndList, LVM_SETITEMA, 0, (LPARAM) &lvItem); + SendMessageW(This->hWndList, LVM_SETITEMW, 0, (LPARAM) &lvItem); return TRUE; } } @@ -1586,14 +1589,14 @@ static LRESULT CALLBACK ShellView_WndProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam) { IShellViewImpl * pThis = (IShellViewImpl*)GetWindowLongPtrW(hWnd, GWLP_USERDATA); - LPCREATESTRUCTA lpcs; - - TRACE("(hwnd=%p msg=%x wparm=%x lparm=%lx)\n",hWnd, uMessage, wParam, lParam); + LPCREATESTRUCTW lpcs; + + TRACE("(hwnd=%p msg=%x wparm=%lx lparm=%lx)\n",hWnd, uMessage, wParam, lParam);
switch (uMessage) { case WM_NCCREATE: - lpcs = (LPCREATESTRUCTA)lParam; + lpcs = (LPCREATESTRUCTW)lParam; pThis = (IShellViewImpl*)(lpcs->lpCreateParams); SetWindowLongPtrW(hWnd, GWLP_USERDATA, (ULONG_PTR)pThis); pThis->hWnd = hWnd; /*set the window handle*/ @@ -1631,7 +1634,7 @@ break; }
- return DefWindowProcA (hWnd, uMessage, wParam, lParam); + return DefWindowProcW(hWnd, uMessage, wParam, lParam); } /********************************************************** * @@ -1768,7 +1771,7 @@
if ((lpmsg->message>=WM_KEYFIRST) && (lpmsg->message>=WM_KEYLAST)) { - TRACE("-- key=0x04%x\n",lpmsg->wParam) ; + TRACE("-- key=0x04%lx\n",lpmsg->wParam) ; } return S_FALSE; /* not handled */ } @@ -1847,7 +1850,7 @@ { IShellViewImpl *This = (IShellViewImpl *)iface;
- WNDCLASSA wc; + WNDCLASSW wc; *phWnd = 0;
@@ -1871,7 +1874,7 @@ }
/*if our window class has not been registered, then do so*/ - if(!GetClassInfoA(shell32_hInstance, SV_CLASS_NAME, &wc)) + if(!GetClassInfoW(shell32_hInstance, SV_CLASS_NAME, &wc)) { ZeroMemory(&wc, sizeof(wc)); wc.style = CS_HREDRAW | CS_VREDRAW; @@ -1880,16 +1883,16 @@ wc.cbWndExtra = 0; wc.hInstance = shell32_hInstance; wc.hIcon = 0; - wc.hCursor = LoadCursorA (0, (LPSTR)IDC_ARROW); + wc.hCursor = LoadCursorW(0, (LPWSTR)IDC_ARROW); wc.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1); wc.lpszMenuName = NULL; wc.lpszClassName = SV_CLASS_NAME;
- if(!RegisterClassA(&wc)) + if(!RegisterClassW(&wc)) return E_FAIL; }
- *phWnd = CreateWindowExA(0, + *phWnd = CreateWindowExW(0, SV_CLASS_NAME, NULL, WS_CHILD | WS_TABSTOP, @@ -1979,7 +1982,7 @@
if (i != -1) { - LVITEMA lvItem; + LVITEMW lvItem;
if(uFlags & SVSI_ENSUREVISIBLE) SendMessageW(This->hWndList, LVM_ENSUREVISIBLE, i, 0); @@ -1989,7 +1992,7 @@ lvItem.iItem = 0; lvItem.iSubItem = 0;
- while(SendMessageA(This->hWndList, LVM_GETITEMA, 0, (LPARAM) &lvItem)) + while(SendMessageW(This->hWndList, LVM_GETITEMW, 0, (LPARAM) &lvItem)) { if (lvItem.iItem == i) { @@ -2006,7 +2009,7 @@ if (uFlags & SVSI_DESELECTOTHERS) lvItem.state &= ~LVIS_SELECTED; } - SendMessageA(This->hWndList, LVM_SETITEMA, 0, (LPARAM) &lvItem); + SendMessageW(This->hWndList, LVM_SETITEMW, 0, (LPARAM) &lvItem); lvItem.iItem++; }
@@ -2212,7 +2215,7 @@ DWORD *pdwEffect) { LVHITTESTINFO htinfo; - LVITEMA lvItem; + LVITEMW lvItem; LONG lResult; HRESULT hr; RECT clientRect; @@ -2270,7 +2273,7 @@ lvItem.mask = LVIF_PARAM; lvItem.iItem = lResult; lvItem.iSubItem = 0; - SendMessageA(This->hWndList, LVM_GETITEMA, 0, (LPARAM) &lvItem); + SendMessageW(This->hWndList, LVM_GETITEMW, 0, (LPARAM) &lvItem);
/* ... and bind pCurDropTarget to the IDropTarget interface of an UIObject of this object */ hr = IShellFolder_GetUIObjectOf(This->pSFParent, This->hWndList, 1,