Nikolay Sivov : shell32: Load shell folder column names as A/ W strings depending on 9x/NT selector.
Alexandre Julliard
julliard at winehq.org
Mon Apr 19 11:51:19 CDT 2010
Module: wine
Branch: master
Commit: 1b31b377b6f4efa9d707541f3c0903e07993fda2
URL: http://source.winehq.org/git/wine.git/?a=commit;h=1b31b377b6f4efa9d707541f3c0903e07993fda2
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Sun Apr 18 18:48:58 2010 +0400
shell32: Load shell folder column names as A/W strings depending on 9x/NT selector.
---
dlls/shell32/shlfolder.c | 16 ++++++++-
dlls/shell32/shlview.c | 60 +++++++++++++++++-----------------
dlls/shell32/tests/shfldr_special.c | 14 +++++++-
3 files changed, 57 insertions(+), 33 deletions(-)
diff --git a/dlls/shell32/shlfolder.c b/dlls/shell32/shlfolder.c
index 99773b3..230d7c6 100644
--- a/dlls/shell32/shlfolder.c
+++ b/dlls/shell32/shlfolder.c
@@ -548,8 +548,20 @@ HRESULT SHELL32_GetColumnDetails(const shvheader *data, int column, SHELLDETAILS
{
details->fmt = data[column].fmt;
details->cxChar = data[column].cxChar;
- details->str.uType = STRRET_CSTR;
- LoadStringA (shell32_hInstance, data[column].colnameid, details->str.u.cStr, MAX_PATH);
+
+ if (SHELL_OsIsUnicode())
+ {
+ details->str.u.pOleStr = CoTaskMemAlloc(MAX_PATH * sizeof(WCHAR));
+ if (!details->str.u.pOleStr) return E_OUTOFMEMORY;
+
+ details->str.uType = STRRET_WSTR;
+ LoadStringW(shell32_hInstance, data[column].colnameid, details->str.u.pOleStr, MAX_PATH);
+ }
+ else
+ {
+ details->str.uType = STRRET_CSTR;
+ LoadStringA(shell32_hInstance, data[column].colnameid, details->str.u.cStr, MAX_PATH);
+ }
return S_OK;
}
diff --git a/dlls/shell32/shlview.c b/dlls/shell32/shlview.c
index 653e5f3..938ec13 100644
--- a/dlls/shell32/shlview.c
+++ b/dlls/shell32/shlview.c
@@ -387,42 +387,44 @@ static BOOL ShellView_CreateList (IShellViewImpl * This)
*
* - adds all needed columns to the shellview
*/
-static BOOL ShellView_InitList(IShellViewImpl * This)
+static void ShellView_InitList(IShellViewImpl *This)
{
- LVCOLUMNW lvColumn;
- SHELLDETAILS sd;
- int i;
- WCHAR szTemp[50];
+ LVCOLUMNW lvColumn;
+ SHELLDETAILS sd;
+ WCHAR nameW[50];
- TRACE("%p\n",This);
+ TRACE("(%p)\n", This);
- SendMessageW(This->hWndList, LVM_DELETEALLITEMS, 0, 0);
+ SendMessageW(This->hWndList, LVM_DELETEALLITEMS, 0, 0);
- lvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT;
- lvColumn.pszText = szTemp;
+ lvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT;
+ lvColumn.pszText = nameW;
+
+ if (This->pSF2Parent)
+ {
+ HRESULT hr;
+ INT i;
+
+ for (i = 0; 1; i++)
+ {
+ hr = IShellFolder2_GetDetailsOf(This->pSF2Parent, NULL, i, &sd);
+ if (FAILED(hr)) break;
- if (This->pSF2Parent)
- {
- for (i=0; 1; i++)
- {
- if (FAILED(IShellFolder2_GetDetailsOf(This->pSF2Parent, NULL, i, &sd)))
- break;
lvColumn.fmt = sd.fmt;
lvColumn.cx = sd.cxChar*8; /* chars->pixel */
- StrRetToStrNW( szTemp, 50, &sd.str, NULL);
+ StrRetToStrNW(nameW, sizeof(nameW)/sizeof(WCHAR), &sd.str, NULL);
SendMessageW(This->hWndList, LVM_INSERTCOLUMNW, i, (LPARAM) &lvColumn);
- }
- }
- else
- {
- FIXME("no SF2\n");
- }
-
- SendMessageW(This->hWndList, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)ShellSmallIconList);
- SendMessageW(This->hWndList, LVM_SETIMAGELIST, LVSIL_NORMAL, (LPARAM)ShellBigIconList);
+ }
+ }
+ else
+ {
+ FIXME("no SF2\n");
+ }
- return TRUE;
+ SendMessageW(This->hWndList, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)ShellSmallIconList);
+ SendMessageW(This->hWndList, LVM_SETIMAGELIST, LVSIL_NORMAL, (LPARAM)ShellBigIconList);
}
+
/**********************************************************
* ShellView_CompareItems()
*
@@ -688,10 +690,8 @@ static LRESULT ShellView_OnCreate(IShellViewImpl *This)
if (ShellView_CreateList(This))
{
- if (ShellView_InitList(This))
- {
- ShellView_FillList(This);
- }
+ ShellView_InitList(This);
+ ShellView_FillList(This);
}
hr = IShellView2_QueryInterface(iface, &IID_IDropTarget, (LPVOID*)&pdt);
diff --git a/dlls/shell32/tests/shfldr_special.c b/dlls/shell32/tests/shfldr_special.c
index 3320130..7be2bdf 100644
--- a/dlls/shell32/tests/shfldr_special.c
+++ b/dlls/shell32/tests/shfldr_special.c
@@ -33,6 +33,11 @@
#include "wine/test.h"
+static inline BOOL SHELL_OsIsUnicode(void)
+{
+ return !(GetVersion() & 0x80000000);
+}
+
/* Tests for My Network Places */
static void test_parse_for_entire_network(void)
{
@@ -129,8 +134,8 @@ static void test_printers_folder(void)
SHELLDETAILS details;
SHCOLSTATEF state;
LPITEMIDLIST pidl1, pidl2;
- INT i;
HRESULT hr;
+ INT i;
CoInitialize( NULL );
@@ -166,6 +171,9 @@ if (0)
ok(hr == S_OK, "got 0x%08x\n", hr);
/* all columns are left-aligned */
ok(details.fmt == LVCFMT_LEFT, "got 0x%x\n", details.fmt);
+ /* can't be on w9x at this point, IShellFolder2 unsupported there,
+ check present for running Wine with w9x setup */
+ if (SHELL_OsIsUnicode()) SHFree(details.str.u.pOleStr);
hr = IShellFolder2_GetDefaultColumnState(folder, i, &state);
ok(hr == S_OK, "got 0x%08x\n", hr);
@@ -176,6 +184,10 @@ if (0)
ok(state == (SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT), "got 0x%x\n", state);
}
+ hr = IShellFolder2_GetDetailsOf(folder, NULL, 0, &details);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+ ok(details.str.uType == STRRET_WSTR, "got %d\n", details.str.uType);
+
/* default pidl */
hr = IShellFolder2_QueryInterface(folder, &IID_IPersistFolder2, (void**)&pf);
ok(hr == S_OK, "got 0x%08x\n", hr);
More information about the wine-cvs
mailing list