From: Gé van Geldorp Date: Fri, 12 Aug 2005 18:04:51 +0000 (+0000) Subject: Sync to Wine-20050725: X-Git-Tag: ReactOS-0.2.8~1044 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=9ba9b8ed9abd1af77463a921644c5b69f62c4521 Sync to Wine-20050725: Michael Jung - Initial support for the IPersistFolder3 interface. - Use CP_UNIXCP instead of CP_ACP when converting paths (Pointed out by Troy Rollo). - Add file type column in detailed shell view. - Make the order of shell view columns 'prefix-compatible' with shfldr_fs. - Don't remove filename extensions for path pidls in GetDisplayNameOf. - Do filename postprocessing in GetDisplayNameOf (Hide filename extensions if appropriate). - Don't cache child pidls in UnixFolder, but create them on the fly. - Don't use unix filesystem specific attributes in UnixFolder's pidls. - Partially implemented UnixFolder's ISFHelper::CopyItems method. - Return correct HRESULT code in UnixFolder's IEnumIDList::Next. - Corresponding test. - Release shell folders only if they were successfully acquired. - Implemented UnixFolder's ISFHelper::DeleteItems interface. - Fail in SHGetDataFromIDList when called on special folder. - Return correct attributes in ParseDisplayName. - Register unixfs at desktop level in DllRegisterServer. - Fix two more corner cases in UNIXFS_get_unix_path and UNIXFS_path_to_pidl. - If the unixfs is rooted at the Desktop folder, forward ParseDisplayName calls to it instead of to MyComputer. - Only initialize shell folders via the IPersistFolder3 interface in SHELL32_CoCreateInitSF if the pidl which specifies the child is of type 'Folder'. Otherwise fall back to IPersistFolder. - Append filename extension if necessary in IShellFolder::SetNameOf. - Release parent shell folder in GetAttributesOf. Francois Gouget - Assorted spelling fixes. Robert Shearman - Implement ShellDDEInit. Michael Lin Michael Jung - Implemented UnixFolder's ISFHelper::AddFolder. - ISFHelper interface support for UnixFolder (currently only stubs). - Implemented UnixFolder's IShellFolder::SetNameOf. Vincent Béron - Remove multiple declarations of the same function, keeping the public one as reference. Mike McCormack - gcc 4.0 -Wpointer-sign fixes (Reg* functions). - -Wpointer-sign fixes. Troy Rollo - Return attributes for the correct file in the unixfs ParseDisplayName. - When using PATHMODE_UNIX, all files are in the file system. Marcelo Duarte - Update shell32 resources for Portuguese. Detlef Riekenberg - Printers_RegisterWindowW / Printers_UnregisterWindow implemented as stub. - Show the FIXME in Printer_LoadIconsW only when needed. - Printer_LoadIconsW: implemented minimal version. svn path=/trunk/; revision=17338 --- diff --git a/reactos/lib/shell32/Makefile.in b/reactos/lib/shell32/Makefile.in index 7094a043679..690fe27f309 100644 --- a/reactos/lib/shell32/Makefile.in +++ b/reactos/lib/shell32/Makefile.in @@ -18,6 +18,7 @@ C_SRCS = \ clipboard.c \ control.c \ cpanelfolder.c \ + dde.c \ dataobject.c \ debughlp.c \ dialogs.c \ diff --git a/reactos/lib/shell32/autocomplete.c b/reactos/lib/shell32/autocomplete.c index 4926e3ad01f..c7603e30f60 100644 --- a/reactos/lib/shell32/autocomplete.c +++ b/reactos/lib/shell32/autocomplete.c @@ -64,7 +64,7 @@ typedef struct { const IAutoCompleteVtbl *lpVtbl; const IAutoComplete2Vtbl *lpvtblAutoComplete2; - DWORD ref; + LONG ref; BOOL enabled; HWND hwndEdit; HWND hwndListBox; diff --git a/reactos/lib/shell32/classes.c b/reactos/lib/shell32/classes.c index 334b2acb6f1..460f4f89b60 100644 --- a/reactos/lib/shell32/classes.c +++ b/reactos/lib/shell32/classes.c @@ -49,7 +49,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(shell); #define MAX_EXTENSION_LENGTH 20 -BOOL HCR_MapTypeToValueW(LPCWSTR szExtension, LPWSTR szFileType, DWORD len, BOOL bPrependDot) +BOOL HCR_MapTypeToValueW(LPCWSTR szExtension, LPWSTR szFileType, LONG len, BOOL bPrependDot) { HKEY hkey; WCHAR szTemp[MAX_EXTENSION_LENGTH + 2]; @@ -83,7 +83,7 @@ BOOL HCR_MapTypeToValueW(LPCWSTR szExtension, LPWSTR szFileType, DWORD len, BOOL return TRUE; } -BOOL HCR_MapTypeToValueA(LPCSTR szExtension, LPSTR szFileType, DWORD len, BOOL bPrependDot) +BOOL HCR_MapTypeToValueA(LPCSTR szExtension, LPSTR szFileType, LONG len, BOOL bPrependDot) { HKEY hkey; char szTemp[MAX_EXTENSION_LENGTH + 2]; @@ -194,7 +194,7 @@ static BOOL HCR_RegGetDefaultIconA(HKEY hkey, LPSTR szDest, DWORD len, LPDWORD d char sTemp[MAX_PATH]; char sNum[5]; - if (!RegQueryValueExA(hkey, NULL, 0, &dwType, szDest, &len)) + if (!RegQueryValueExA(hkey, NULL, 0, &dwType, (LPBYTE)szDest, &len)) { if (dwType == REG_EXPAND_SZ) { @@ -319,7 +319,7 @@ BOOL HCR_GetClassNameA(REFIID riid, LPSTR szDest, DWORD len) szDest[0] = 0; if (HCR_RegOpenClassIDKey(riid, &hkey)) { - if (!RegQueryValueExA(hkey,"",0,NULL,szDest,&len)) + if (!RegQueryValueExA(hkey,"",0,NULL,(LPBYTE)szDest,&len)) { ret = TRUE; } @@ -404,10 +404,10 @@ BOOL HCR_GetFolderAttributes(LPCITEMIDLIST pidlFolder, LPDWORD pdwAttributes) (LPVOID*)&psfFolder); if (SUCCEEDED(hr)) { hr = IShellFolder_GetAttributesOf(psfFolder, 0, NULL, pdwAttributes); + IShellFolder_Release(psfFolder); } + IShellFolder_Release(psfDesktop); } - IShellFolder_Release(psfFolder); - IShellFolder_Release(psfDesktop); if (FAILED(hr)) return FALSE; } else { lResult = RegQueryValueExW(hSFKey, wszAttributes, 0, NULL, (LPBYTE)&dwTemp, &dwLen); diff --git a/reactos/lib/shell32/cpanelfolder.c b/reactos/lib/shell32/cpanelfolder.c index 6f55c4c5788..3b9dcfe4def 100644 --- a/reactos/lib/shell32/cpanelfolder.c +++ b/reactos/lib/shell32/cpanelfolder.c @@ -59,7 +59,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(shell); typedef struct { const IShellFolder2Vtbl *lpVtbl; - DWORD ref; + LONG ref; const IPersistFolder2Vtbl *lpVtblPersistFolder2; const IShellExecuteHookWVtbl *lpVtblShellExecuteHookW; const IShellExecuteHookAVtbl *lpVtblShellExecuteHookA; diff --git a/reactos/lib/shell32/dataobject.c b/reactos/lib/shell32/dataobject.c index c8d4c11eea2..3fc4e422fae 100644 --- a/reactos/lib/shell32/dataobject.c +++ b/reactos/lib/shell32/dataobject.c @@ -43,7 +43,7 @@ typedef struct { /* IUnknown fields */ const IEnumFORMATETCVtbl *lpVtbl; - DWORD ref; + LONG ref; /* IEnumFORMATETC fields */ UINT posFmt; UINT countFmt; @@ -205,7 +205,7 @@ typedef struct { /* IUnknown fields */ const IDataObjectVtbl *lpVtbl; - DWORD ref; + LONG ref; /* IDataObject fields */ LPITEMIDLIST pidl; diff --git a/reactos/lib/shell32/dde.c b/reactos/lib/shell32/dde.c new file mode 100644 index 00000000000..270ebaf921a --- /dev/null +++ b/reactos/lib/shell32/dde.c @@ -0,0 +1,177 @@ +/* + * Shell DDE Handling + * + * Copyright 2004 Robert Shearman + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "windef.h" +#include "winbase.h" +#include "ddeml.h" +#include "shellapi.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(shell); + +/* String handles */ +static HSZ hszProgmanTopic; +static HSZ hszProgmanService; +static HSZ hszAsterisk; +static HSZ hszShell; +static HSZ hszAppProperties; +static HSZ hszFolders; +/* DDE Instance ID */ +static DWORD dwDDEInst; + + +static inline BOOL Dde_OnConnect(HSZ hszTopic, HSZ hszService) +{ + if ((hszTopic == hszProgmanTopic) && (hszService == hszProgmanService)) + return TRUE; + if ((hszTopic == hszProgmanTopic) && (hszService == hszAppProperties)) + return TRUE; + if ((hszTopic == hszShell) && (hszService == hszFolders)) + return TRUE; + if ((hszTopic == hszShell) && (hszService == hszAppProperties)) + return TRUE; + return FALSE; +} + +static inline void Dde_OnConnectConfirm(HCONV hconv, HSZ hszTopic, HSZ hszService) +{ + FIXME("stub\n"); +} + +static inline BOOL Dde_OnWildConnect(HSZ hszTopic, HSZ hszService) +{ + FIXME("stub\n"); + return FALSE; +} + +static inline HDDEDATA Dde_OnRequest(UINT uFmt, HCONV hconv, HSZ hszTopic, + HSZ hszItem) +{ + FIXME("stub\n"); + return NULL; +} + +static inline DWORD Dde_OnExecute(HCONV hconv, HSZ hszTopic, HDDEDATA hdata) +{ + BYTE * pszCommand; + + pszCommand = DdeAccessData(hdata, NULL); + if (!pszCommand) + return DDE_FNOTPROCESSED; + + FIXME("stub: %s\n", pszCommand); + + DdeUnaccessData(hdata); + + return DDE_FNOTPROCESSED; +} + +static inline void Dde_OnDisconnect(HCONV hconv) +{ + FIXME("stub\n"); +} + +static HDDEDATA CALLBACK DdeCallback( + UINT uType, + UINT uFmt, + HCONV hconv, + HSZ hsz1, + HSZ hsz2, + HDDEDATA hdata, + ULONG_PTR dwData1, + ULONG_PTR dwData2) +{ + switch (uType) + { + case XTYP_CONNECT: + return (HDDEDATA)Dde_OnConnect(hsz1, hsz2); + case XTYP_CONNECT_CONFIRM: + Dde_OnConnectConfirm(hconv, hsz1, hsz2); + return NULL; + case XTYP_WILDCONNECT: + return (HDDEDATA)Dde_OnWildConnect(hsz1, hsz2); + case XTYP_REQUEST: + return (HDDEDATA)Dde_OnRequest(uFmt, hconv, hsz1, hsz2); + case XTYP_EXECUTE: + return (HDDEDATA)Dde_OnExecute(hconv, hsz1, hdata); + case XTYP_DISCONNECT: + Dde_OnDisconnect(hconv); + return NULL; + default: + return NULL; + } +} + +/************************************************************************* + * ShellDDEInit (SHELL32.@) + * + * Registers the Shell DDE services with the system so that applications + * can use them. + * + * PARAMS + * bInit [I] TRUE to initialize the services, FALSE to uninitalize. + * + * RETURNS + * Nothing. + */ +void WINAPI ShellDDEInit(BOOL bInit) +{ + TRACE("bInit = %s\n", bInit ? "TRUE" : "FALSE"); + + if (bInit) + { + static const WCHAR wszProgman[] = {'P','r','o','g','m','a','n',0}; + static const WCHAR wszAsterisk[] = {'*',0}; + static const WCHAR wszShell[] = {'S','h','e','l','l',0}; + static const WCHAR wszAppProperties[] = + {'A','p','p','P','r','o','p','e','r','t','i','e','s',0}; + static const WCHAR wszFolders[] = {'F','o','l','d','e','r','s',0}; + + DdeInitializeW(&dwDDEInst, DdeCallback, CBF_FAIL_ADVISES | CBF_FAIL_POKES, 0); + + hszProgmanTopic = DdeCreateStringHandleW(dwDDEInst, wszProgman, CP_WINUNICODE); + hszProgmanService = DdeCreateStringHandleW(dwDDEInst, wszProgman, CP_WINUNICODE); + hszAsterisk = DdeCreateStringHandleW(dwDDEInst, wszAsterisk, CP_WINUNICODE); + hszShell = DdeCreateStringHandleW(dwDDEInst, wszShell, CP_WINUNICODE); + hszAppProperties = DdeCreateStringHandleW(dwDDEInst, wszAppProperties, CP_WINUNICODE); + hszFolders = DdeCreateStringHandleW(dwDDEInst, wszFolders, CP_WINUNICODE); + + DdeNameService(dwDDEInst, hszFolders, 0, DNS_REGISTER); + DdeNameService(dwDDEInst, hszProgmanService, 0, DNS_REGISTER); + DdeNameService(dwDDEInst, hszShell, 0, DNS_REGISTER); + } + else + { + /* unregister all services */ + DdeNameService(dwDDEInst, 0, 0, DNS_UNREGISTER); + + DdeFreeStringHandle(dwDDEInst, hszFolders); + DdeFreeStringHandle(dwDDEInst, hszAppProperties); + DdeFreeStringHandle(dwDDEInst, hszShell); + DdeFreeStringHandle(dwDDEInst, hszAsterisk); + DdeFreeStringHandle(dwDDEInst, hszProgmanService); + DdeFreeStringHandle(dwDDEInst, hszProgmanTopic); + + DdeUninitialize(dwDDEInst); + } +} diff --git a/reactos/lib/shell32/dialogs.c b/reactos/lib/shell32/dialogs.c index a243768bb63..8357d56fdd8 100644 --- a/reactos/lib/shell32/dialogs.c +++ b/reactos/lib/shell32/dialogs.c @@ -255,7 +255,7 @@ void FillList (HWND hCb, char *pszLatest) if (icList > 0) { pszList = HeapAlloc( GetProcessHeap(), 0, icList) ; - if (ERROR_SUCCESS != RegQueryValueExA (hkey, "MRUList", NULL, NULL, pszList, &icList)) + if (ERROR_SUCCESS != RegQueryValueExA (hkey, "MRUList", NULL, NULL, (LPBYTE)pszList, &icList)) MessageBoxA (hCb, "Unable to grab MRUList !", "Nix", MB_OK) ; } else @@ -278,7 +278,7 @@ void FillList (HWND hCb, char *pszLatest) pszCmd = HeapReAlloc(GetProcessHeap(), 0, pszCmd, icCmd) ; else pszCmd = HeapAlloc(GetProcessHeap(), 0, icCmd) ; - if (ERROR_SUCCESS != RegQueryValueExA (hkey, szIndex, NULL, NULL, pszCmd, &icCmd)) + if (ERROR_SUCCESS != RegQueryValueExA (hkey, szIndex, NULL, NULL, (LPBYTE)pszCmd, &icCmd)) MessageBoxA (hCb, "Unable to grab index", "Nix", MB_OK) ; if (NULL != pszLatest) @@ -328,7 +328,7 @@ void FillList (HWND hCb, char *pszLatest) memmove (&pszList[1], pszList, Nix) ; pszList[0] = cMatch ; szIndex[0] = cMatch ; - RegSetValueExA (hkey, szIndex, 0, REG_SZ, pszLatest, strlen (pszLatest) + 1) ; + RegSetValueExA (hkey, szIndex, 0, REG_SZ, (LPBYTE)pszLatest, strlen (pszLatest) + 1) ; } } @@ -350,10 +350,10 @@ void FillList (HWND hCb, char *pszLatest) memmove (&pszList[1], pszList, icList - 1) ; pszList[0] = cMatch ; szIndex[0] = cMatch ; - RegSetValueExA (hkey, szIndex, 0, REG_SZ, pszLatest, strlen (pszLatest) + 1) ; + RegSetValueExA (hkey, szIndex, 0, REG_SZ, (LPBYTE)pszLatest, strlen (pszLatest) + 1) ; } - RegSetValueExA (hkey, "MRUList", 0, REG_SZ, pszList, strlen (pszList) + 1) ; + RegSetValueExA (hkey, "MRUList", 0, REG_SZ, (LPBYTE)pszList, strlen (pszList) + 1) ; HeapFree( GetProcessHeap(), 0, pszCmd) ; HeapFree( GetProcessHeap(), 0, pszList) ; diff --git a/reactos/lib/shell32/dragdrophelper.c b/reactos/lib/shell32/dragdrophelper.c index 356bff29d46..bd58da09dca 100644 --- a/reactos/lib/shell32/dragdrophelper.c +++ b/reactos/lib/shell32/dragdrophelper.c @@ -49,7 +49,7 @@ WINE_DEFAULT_DEBUG_CHANNEL (shell); typedef struct { const IDropTargetHelperVtbl *lpVtbl; - DWORD ref; + LONG ref; } IDropTargetHelperImpl; static const IDropTargetHelperVtbl vt_IDropTargetHelper; diff --git a/reactos/lib/shell32/enumidlist.c b/reactos/lib/shell32/enumidlist.c index 17cda2c7057..9a0f41b8e5e 100644 --- a/reactos/lib/shell32/enumidlist.c +++ b/reactos/lib/shell32/enumidlist.c @@ -46,7 +46,7 @@ typedef struct tagENUMLIST typedef struct { const IEnumIDListVtbl *lpVtbl; - DWORD ref; + LONG ref; LPENUMLIST mpFirst; LPENUMLIST mpLast; LPENUMLIST mpCurrent; diff --git a/reactos/lib/shell32/folders.c b/reactos/lib/shell32/folders.c index e38beb6ce93..c989ccaea07 100644 --- a/reactos/lib/shell32/folders.c +++ b/reactos/lib/shell32/folders.c @@ -50,7 +50,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(shell); typedef struct { const IExtractIconWVtbl *lpVtbl; - DWORD ref; + LONG ref; const IPersistFileVtbl *lpvtblPersistFile; const IExtractIconAVtbl *lpvtblExtractIconA; LPITEMIDLIST pidl; diff --git a/reactos/lib/shell32/pidl.c b/reactos/lib/shell32/pidl.c index 1d582ba3220..54efcc123f4 100644 --- a/reactos/lib/shell32/pidl.c +++ b/reactos/lib/shell32/pidl.c @@ -1113,7 +1113,7 @@ HRESULT WINAPI SHGetDataFromIDListA(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, case SHGDFIL_FINDDATA: pfd = dest; - if (_ILIsDrive(pidl)) + if (_ILIsDrive(pidl) || _ILIsSpecialFolder(pidl)) return E_INVALIDARG; if (len < sizeof(WIN32_FIND_DATAA)) @@ -1488,7 +1488,7 @@ HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCI * ************************************************************************* */ -LPITEMIDLIST _ILAlloc(PIDLTYPE type, size_t size) +LPITEMIDLIST _ILAlloc(PIDLTYPE type, unsigned int size) { LPITEMIDLIST pidlOut = NULL; diff --git a/reactos/lib/shell32/pidl.h b/reactos/lib/shell32/pidl.h index d7da55a2085..df3d1f25f70 100644 --- a/reactos/lib/shell32/pidl.h +++ b/reactos/lib/shell32/pidl.h @@ -206,7 +206,7 @@ BOOL _ILIsCPanelStruct (LPCITEMIDLIST pidl); * - two bytes are the NULL PIDL terminator * Sets type of the returned PIDL to type. */ -LPITEMIDLIST _ILAlloc(PIDLTYPE type, size_t size); +LPITEMIDLIST _ILAlloc(PIDLTYPE type, unsigned int size); /* Creates a PIDL with guid format and type type, which must be one of PT_GUID, * PT_SHELLEXT, or PT_YAGUID. diff --git a/reactos/lib/shell32/regsvr.c b/reactos/lib/shell32/regsvr.c index 006cfddccb2..7375d247e67 100644 --- a/reactos/lib/shell32/regsvr.c +++ b/reactos/lib/shell32/regsvr.c @@ -20,6 +20,7 @@ #include #include +#include #include "windef.h" #include "winbase.h" @@ -30,6 +31,7 @@ #include "ole2.h" #include "shlguid.h" #include "shell32_main.h" +#include "shfldr.h" #include "wine/debug.h" @@ -79,6 +81,16 @@ struct regsvr_coclass static HRESULT register_coclasses(struct regsvr_coclass const *list); static HRESULT unregister_coclasses(struct regsvr_coclass const *list); +struct regsvr_namespace +{ + CLSID const *clsid; /* CLSID of the namespace extension. NULL for end of list */ + LPCWSTR parent; /* Mount point (MyComputer, Desktop, ..). */ + LPCWSTR value; /* Display name of the extension. */ +}; + +static HRESULT register_namespace_extensions(struct regsvr_namespace const *list); +static HRESULT unregister_namespace_extensions(struct regsvr_namespace const *list); + /*********************************************************************** * static string constants */ @@ -377,6 +389,66 @@ error_return: return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK; } +/********************************************************************** + * register_namespace_extensions + */ +static WCHAR *get_namespace_key(struct regsvr_namespace const *list) { + static const WCHAR wszExplorerKey[] = { + 'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\', + 'W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', + 'E','x','p','l','o','r','e','r','\\',0 }; + static const WCHAR wszNamespace[] = { '\\','N','a','m','e','s','p','a','c','e','\\',0 }; + WCHAR *pwszKey, *pwszCLSID; + + pwszKey = HeapAlloc(GetProcessHeap(), 0, sizeof(wszExplorerKey)+sizeof(wszNamespace)+ + sizeof(WCHAR)*(lstrlenW(list->parent)+CHARS_IN_GUID)); + if (!pwszKey) + return NULL; + + lstrcpyW(pwszKey, wszExplorerKey); + lstrcatW(pwszKey, list->parent); + lstrcatW(pwszKey, wszNamespace); + if (FAILED(StringFromCLSID(list->clsid, &pwszCLSID))) { + HeapFree(GetProcessHeap(), 0, pwszKey); + return NULL; + } + lstrcatW(pwszKey, pwszCLSID); + CoTaskMemFree(pwszCLSID); + + return pwszKey; +} + +static HRESULT register_namespace_extensions(struct regsvr_namespace const *list) { + WCHAR *pwszKey; + HKEY hKey; + + for (; list->clsid; list++) { + pwszKey = get_namespace_key(list); + + /* Create the key and set the value. */ + if (pwszKey && ERROR_SUCCESS == + RegCreateKeyExW(HKEY_LOCAL_MACHINE, pwszKey, 0, NULL, 0, KEY_WRITE, NULL, &hKey, NULL)) + { + RegSetValueExW(hKey, NULL, 0, REG_SZ, (LPBYTE)list->value, sizeof(WCHAR)*(lstrlenW(list->value)+1)); + RegCloseKey(hKey); + } + + HeapFree(GetProcessHeap(), 0, pwszKey); + } + return S_OK; +} + +static HRESULT unregister_namespace_extensions(struct regsvr_namespace const *list) { + WCHAR *pwszKey; + + for (; list->clsid; list++) { + pwszKey = get_namespace_key(list); + RegDeleteKeyW(HKEY_LOCAL_MACHINE, pwszKey); + HeapFree(GetProcessHeap(), 0, pwszKey); + } + return S_OK; +} + /*********************************************************************** * regsvr_key_guid */ @@ -544,6 +616,16 @@ static struct regsvr_interface const interface_list[] = { { NULL } /* list terminator */ }; +/*********************************************************************** + * namespace extensions list + */ +static const WCHAR wszDesktop[] = { 'D','e','s','k','t','o','p',0 }; +static const WCHAR wszSlash[] = { '/', 0 }; + +static struct regsvr_namespace const namespace_extensions_list[] = { + { NULL } +}; + /*********************************************************************** * DllRegisterServer (SHELL32.@) */ @@ -558,6 +640,8 @@ HRESULT WINAPI SHELL32_DllRegisterServer() hr = register_interfaces(interface_list); if (SUCCEEDED(hr)) hr = SHELL_RegisterShellFolders(); + if (SUCCEEDED(hr)) + hr = register_namespace_extensions(namespace_extensions_list); return hr; } @@ -573,5 +657,7 @@ HRESULT WINAPI SHELL32_DllUnregisterServer() hr = unregister_coclasses(coclass_list); if (SUCCEEDED(hr)) hr = unregister_interfaces(interface_list); + if (SUCCEEDED(hr)) + hr = unregister_namespace_extensions(namespace_extensions_list); return hr; } diff --git a/reactos/lib/shell32/shell32.spec b/reactos/lib/shell32/shell32.spec index 55a32d14b5f..afd3aee72fc 100644 --- a/reactos/lib/shell32/shell32.spec +++ b/reactos/lib/shell32/shell32.spec @@ -189,7 +189,7 @@ 202 stub SHLocalReAlloc 203 stub AddCommasW 204 stub ShortSizeFormatW - 205 stub Printer_LoadIconsW + 205 stdcall Printer_LoadIconsW(wstr ptr ptr) 206 stub Link_AddExtraDataSection 207 stub Link_ReadExtraDataSection 208 stub Link_RemoveExtraDataSection @@ -197,8 +197,8 @@ 210 stub LargeIntegerToString 211 stub Printers_GetPidl 212 stub Printers_AddPrinterPropPages - 213 stub Printers_RegisterWindowW - 214 stub Printers_UnregisterWindow + 213 stdcall Printers_RegisterWindowW(wstr long ptr ptr) + 214 stdcall Printers_UnregisterWindow(long long) 215 stdcall -noname SHStartNetConnectionDialog(long str long) 243 stdcall @(long long) shell32_243 244 stdcall -noname SHInitRestricted(ptr ptr) diff --git a/reactos/lib/shell32/shell32.xml b/reactos/lib/shell32/shell32.xml index 201f2a167af..2270ac061e5 100644 --- a/reactos/lib/shell32/shell32.xml +++ b/reactos/lib/shell32/shell32.xml @@ -28,6 +28,7 @@ control.c cpanelfolder.c dataobject.c + dde.c debughlp.c dialogs.c dragdrophelper.c diff --git a/reactos/lib/shell32/shell32_Pt.rc b/reactos/lib/shell32/shell32_Pt.rc index da1600677fd..8031ded2652 100644 --- a/reactos/lib/shell32/shell32_Pt.rc +++ b/reactos/lib/shell32/shell32_Pt.rc @@ -132,30 +132,33 @@ FONT 8, "MS Shell Dlg" PUSHBUTTON "&Procurar...", 12288, 170, 63, 50, 14, WS_TABSTOP } -/* - special folders -*/ STRINGTABLE DISCARDABLE { + /* columns in the shellview */ + IDS_SHV_COLUMN1 "Arquivo" + IDS_SHV_COLUMN2 "Tamanho" + IDS_SHV_COLUMN3 "Tipo" + IDS_SHV_COLUMN4 "Modificado" + IDS_SHV_COLUMN5 "Atributos" + IDS_SHV_COLUMN6 "Tamanho" + IDS_SHV_COLUMN7 "Disponível" + IDS_SHV_COLUMN8 "Nome" + IDS_SHV_COLUMN9 "Comentários" + IDS_SHV_COLUMN10 "Dono" + IDS_SHV_COLUMN11 "Grupo" + + /* special folders */ IDS_DESKTOP "Área de trabalho" IDS_MYCOMPUTER "Meu computador" -} -/* - context menus -*/ -STRINGTABLE DISCARDABLE -{ + /* context menus */ IDS_VIEW_LARGE "Ícones &grandes" IDS_VIEW_SMALL "Ícones &pequenos" IDS_VIEW_LIST "&Lista" IDS_VIEW_DETAILS "&Detalhes" IDS_SELECT "Selecionar" IDS_OPEN "Abrir" -} -STRINGTABLE DISCARDABLE -{ IDS_CREATEFOLDER_DENIED "Não pode criar nova pasta: Permissão negada." IDS_CREATEFOLDER_CAPTION "Erro durante a criação da nova pasta" IDS_DELETEITEM_CAPTION "Confirmar exclusão de arquivo" @@ -164,34 +167,14 @@ STRINGTABLE DISCARDABLE IDS_DELETEMULTIPLE_TEXT "Você tem certeza que deseja excluir estes %1 itens?" IDS_OVERWRITEFILE_TEXT "Sobreescrever arquivo %1?" IDS_OVERWRITEFILE_CAPTION "Confirmar sobreescrever arquivo" -} -/* colunas no shellview */ -STRINGTABLE -BEGIN - IDS_SHV_COLUMN1 "Arquivo" - IDS_SHV_COLUMN2 "Tamanho" - IDS_SHV_COLUMN3 "Tipo" - IDS_SHV_COLUMN4 "Modificado" - IDS_SHV_COLUMN5 "Atributos" - IDS_SHV_COLUMN6 "Tamanho" - IDS_SHV_COLUMN7 "Disponível" - IDS_SHV_COLUMN8 "Nome" - IDS_SHV_COLUMN9 "Comentários" -END + /* message box strings */ + IDS_RESTART_TITLE "Reiniciar" + IDS_RESTART_PROMPT "Você quer simular a reinicialização do Windows?" + IDS_SHUTDOWN_TITLE "Desligar" + IDS_SHUTDOWN_PROMPT "Você quer finalizar a sessão no ReactOS?" -/* message box strings */ -STRINGTABLE DISCARDABLE -{ - IDS_RESTART_TITLE "Reiniciar" - IDS_RESTART_PROMPT "Você quer simular a reinicialização do Windows?" - IDS_SHUTDOWN_TITLE "Desligar" - IDS_SHUTDOWN_PROMPT "Você quer finalizar a sessão no ReactOS?" -} - -/* shell folder path default values - */ -STRINGTABLE DISCARDABLE -{ + /* shell folder path default values */ IDS_PROGRAMS "Menu Iniciar\\Programas" IDS_PERSONAL "Meus Documentos" IDS_FAVORITES "Favoritos" diff --git a/reactos/lib/shell32/shell32_main.c b/reactos/lib/shell32/shell32_main.c index 64cdf6e706f..253635b3250 100644 --- a/reactos/lib/shell32/shell32_main.c +++ b/reactos/lib/shell32/shell32_main.c @@ -718,6 +718,63 @@ HICON WINAPI ExtractIconW(HINSTANCE hInstance, LPCWSTR lpszFile, UINT nIconIndex return NULL; } +/************************************************************************* + * Printer_LoadIconsW [SHELL32.205] + */ +VOID WINAPI Printer_LoadIconsW(LPCWSTR wsPrinterName, HICON * pLargeIcon, HICON * pSmallIcon) +{ + INT iconindex=IDI_SHELL_PRINTER; + + TRACE("(%s, %p, %p)\n", debugstr_w(wsPrinterName), pLargeIcon, pSmallIcon); + + /* We should check if wsPrinterName is + 1. the Default Printer or not + 2. connected or not + 3. a Local Printer or a Network-Printer + and use different Icons + */ + if((wsPrinterName != NULL) && (wsPrinterName[0] != 0)) + { + FIXME("(select Icon by PrinterName %s not implemented)\n", debugstr_w(wsPrinterName)); + } + + if(pLargeIcon != NULL) + *pLargeIcon = LoadImageW(shell32_hInstance, + (LPCWSTR) MAKEINTRESOURCE(iconindex), IMAGE_ICON, + 0, 0, LR_DEFAULTCOLOR|LR_DEFAULTSIZE); + + if(pSmallIcon != NULL) + *pSmallIcon = LoadImageW(shell32_hInstance, + (LPCWSTR) MAKEINTRESOURCE(iconindex), IMAGE_ICON, + 16, 16, LR_DEFAULTCOLOR); +} + +/************************************************************************* + * Printers_RegisterWindowW [SHELL32.213] + * used by "printui.dll": + * find the Window of the given Type for the specific Printer and + * return the already existent hwnd or open a new window + */ +BOOL WINAPI Printers_RegisterWindowW(LPCWSTR wsPrinter, DWORD dwType, + HANDLE * phClassPidl, HWND * phwnd) +{ + FIXME("(%s, %lx, %p (%p), %p (%p)) stub!\n", debugstr_w(wsPrinter), dwType, + phClassPidl, (phClassPidl != NULL) ? *(phClassPidl) : NULL, + phwnd, (phwnd != NULL) ? *(phwnd) : NULL); + + return FALSE; +} + +/************************************************************************* + * Printers_UnregisterWindow [SHELL32.214] + */ +VOID WINAPI Printers_UnregisterWindow(HANDLE hClassPidl, HWND hwnd) +{ + FIXME("(%p, %p) stub!\n", hClassPidl, hwnd); +} + +/*************************************************************************/ + typedef struct { LPCWSTR szApp; @@ -985,14 +1042,6 @@ void WINAPI FreeIconList( DWORD dw ) } -/************************************************************************* - * ShellDDEInit (SHELL32.@) - */ -void WINAPI ShellDDEInit(BOOL start) -{ - FIXME("stub: %d\n", start); -} - /*********************************************************************** * DllGetVersion [SHELL32.@] * diff --git a/reactos/lib/shell32/shell32_main.h b/reactos/lib/shell32/shell32_main.h index a425ca9d83b..6cf42409219 100644 --- a/reactos/lib/shell32/shell32_main.h +++ b/reactos/lib/shell32/shell32_main.h @@ -56,14 +56,14 @@ BOOL PidlToSicIndex (IShellFolder * sh, LPCITEMIDLIST pidl, BOOL bBigIcon, UINT INT SIC_GetIconIndex (LPCWSTR sSourceFile, INT dwSourceIndex, DWORD dwFlags ); /* Classes Root */ -BOOL HCR_MapTypeToValueW(LPCWSTR szExtension, LPWSTR szFileType, DWORD len, BOOL bPrependDot); +BOOL HCR_MapTypeToValueW(LPCWSTR szExtension, LPWSTR szFileType, LONG len, BOOL bPrependDot); BOOL HCR_GetExecuteCommandW( HKEY hkeyClass, LPCWSTR szClass, LPCWSTR szVerb, LPWSTR szDest, DWORD len ); BOOL HCR_GetDefaultIconW(LPCWSTR szClass, LPWSTR szDest, DWORD len, LPDWORD dwNr); BOOL HCR_GetDefaultIconFromGUIDW(REFIID riid, LPWSTR szDest, DWORD len, LPDWORD dwNr); BOOL HCR_GetClassNameW(REFIID riid, LPWSTR szDest, DWORD len); /* ANSI versions of above functions, supposed to go away as soon as they are not used anymore */ -BOOL HCR_MapTypeToValueA(LPCSTR szExtension, LPSTR szFileType, DWORD len, BOOL bPrependDot); +BOOL HCR_MapTypeToValueA(LPCSTR szExtension, LPSTR szFileType, LONG len, BOOL bPrependDot); BOOL HCR_GetDefaultIconA(LPCSTR szClass, LPSTR szDest, DWORD len, LPDWORD dwNr); BOOL HCR_GetClassNameA(REFIID riid, LPSTR szDest, DWORD len); @@ -223,6 +223,7 @@ UINT SHELL_FindExecutable(LPCWSTR lpPath, LPCWSTR lpFile, LPCWSTR lpOperation, extern WCHAR swShell32Name[MAX_PATH]; +BOOL UNIXFS_is_rooted_at_desktop(void); extern const GUID CLSID_UnixFolder; extern const GUID CLSID_UnixDosFolder; diff --git a/reactos/lib/shell32/shelllink.c b/reactos/lib/shell32/shelllink.c index 61d0fcc3e4a..51350b914c6 100644 --- a/reactos/lib/shell32/shelllink.c +++ b/reactos/lib/shell32/shelllink.c @@ -133,7 +133,7 @@ typedef struct const IShellExtInitVtbl *lpvtblShellExtInit; const IContextMenuVtbl *lpvtblContextMenu; - DWORD ref; + LONG ref; /* data structures according to the informations in the link */ LPITEMIDLIST pPidl; @@ -660,7 +660,7 @@ static LPWSTR Stream_LoadPath( LPSTR p, DWORD maxlen ) static HRESULT Stream_LoadLocation( IStream *stm, volume_info *volume, LPWSTR *path ) { - unsigned char *p = NULL; + char *p = NULL; LOCATION_INFO *loc; HRESULT r; int n; diff --git a/reactos/lib/shell32/shellole.c b/reactos/lib/shell32/shellole.c index e3c3d1bcdfc..d032b84ba79 100644 --- a/reactos/lib/shell32/shellole.c +++ b/reactos/lib/shell32/shellole.c @@ -500,11 +500,11 @@ HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf) typedef struct { const IClassFactoryVtbl *lpVtbl; - DWORD ref; + LONG ref; CLSID *rclsid; LPFNCREATEINSTANCE lpfnCI; const IID * riidInst; - ULONG * pcRefDll; /* pointer to refcounter in external dll (ugrrr...) */ + LONG * pcRefDll; /* pointer to refcounter in external dll (ugrrr...) */ } IDefClFImpl; static const IClassFactoryVtbl dclfvt; diff --git a/reactos/lib/shell32/shfldr.h b/reactos/lib/shell32/shfldr.h index bc35caf02e6..0cbdf91fd5e 100644 --- a/reactos/lib/shell32/shfldr.h +++ b/reactos/lib/shell32/shfldr.h @@ -70,3 +70,4 @@ static inline int SHELL32_GUIDToStringW (REFGUID guid, LPWSTR str) } void SHELL_FS_ProcessDisplayFilename(LPSTR szPath, DWORD dwFlags); +BOOL SHELL_FS_HideExtension(LPWSTR pwszPath); diff --git a/reactos/lib/shell32/shfldr_desktop.c b/reactos/lib/shell32/shfldr_desktop.c index dc4f6a1f9eb..0c535fd7181 100644 --- a/reactos/lib/shell32/shfldr_desktop.c +++ b/reactos/lib/shell32/shfldr_desktop.c @@ -61,7 +61,7 @@ WINE_DEFAULT_DEBUG_CHANNEL (shell); typedef struct { const IShellFolder2Vtbl *lpVtbl; - DWORD ref; + LONG ref; CLSID *pclsid; diff --git a/reactos/lib/shell32/shfldr_fs.c b/reactos/lib/shell32/shfldr_fs.c index c99a34304ff..f7bce84e9c7 100644 --- a/reactos/lib/shell32/shfldr_fs.c +++ b/reactos/lib/shell32/shfldr_fs.c @@ -61,7 +61,7 @@ WINE_DEFAULT_DEBUG_CHANNEL (shell); typedef struct { const IUnknownVtbl *lpVtbl; - DWORD ref; + LONG ref; const IShellFolder2Vtbl *lpvtblShellFolder; const IPersistFolder3Vtbl *lpvtblPersistFolder3; const IDropTargetVtbl *lpvtblDropTarget; @@ -590,8 +590,10 @@ IShellFolder_fnGetAttributesOf (IShellFolder2 * iface, UINT cidl, LPCITEMIDLIST rpidl = NULL; hr = SHBindToParent(This->pidlRoot, &IID_IShellFolder, (LPVOID*)&psfParent, (LPCITEMIDLIST*)&rpidl); - if(SUCCEEDED(hr)) + if(SUCCEEDED(hr)) { SHELL32_GetItemAttributes (psfParent, rpidl, rgfInOut); + IShellFolder_Release(psfParent); + } } else { while (cidl > 0 && *apidl) { @@ -698,7 +700,20 @@ static const WCHAR HideFileExtW[] = { 'H','i','d','e','F','i','l','e','E','x', static const WCHAR NeverShowExtW[] = { 'N','e','v','e','r','S','h','o','w','E', 'x','t',0 }; -static BOOL hide_extension(LPWSTR szPath) +/****************************************************************************** + * SHELL_FS_HideExtension [Internal] + * + * Query the registry if the filename extension of a given path should be + * hidden. + * + * PARAMS + * szPath [I] Relative or absolute path of a file + * + * RETURNS + * TRUE, if the filename's extension should be hidden + * FALSE, otherwise. + */ +BOOL SHELL_FS_HideExtension(LPWSTR szPath) { HKEY hKey; DWORD dwData; @@ -737,7 +752,7 @@ void SHELL_FS_ProcessDisplayFilename(LPSTR szPath, DWORD dwFlags) if (!(dwFlags & SHGDN_FORPARSING) && ((dwFlags & SHGDN_INFOLDER) || (dwFlags == SHGDN_NORMAL))) { MultiByteToWideChar(CP_ACP, 0, szPath, -1, pathW, MAX_PATH); - if (hide_extension(pathW) && szPath[0] != '.') + if (SHELL_FS_HideExtension(pathW) && szPath[0] != '.') PathRemoveExtensionA (szPath); } } @@ -842,7 +857,7 @@ static HRESULT WINAPI IShellFolder_fnSetNameOf (IShellFolder2 * iface, } else lstrcpynW(szDest, lpName, MAX_PATH); - if(!(dwFlags & SHGDN_FORPARSING) && hide_extension(szSrc)) { + if(!(dwFlags & SHGDN_FORPARSING) && SHELL_FS_HideExtension(szSrc)) { WCHAR *ext = PathFindExtensionW(szSrc); if(*ext != '\0') { INT len = strlenW(szDest); diff --git a/reactos/lib/shell32/shfldr_mycomp.c b/reactos/lib/shell32/shfldr_mycomp.c index 1181030b31f..8eb24f6447a 100644 --- a/reactos/lib/shell32/shfldr_mycomp.c +++ b/reactos/lib/shell32/shfldr_mycomp.c @@ -56,7 +56,7 @@ WINE_DEFAULT_DEBUG_CHANNEL (shell); typedef struct { const IShellFolder2Vtbl *lpVtbl; - DWORD ref; + LONG ref; const IPersistFolder2Vtbl *lpVtblPersistFolder2; /* both paths are parsible from the desktop */ @@ -443,8 +443,10 @@ static HRESULT WINAPI ISF_MyComputer_fnGetAttributesOf (IShellFolder2 * iface, LPCITEMIDLIST rpidl = NULL; hr = SHBindToParent(This->pidlRoot, &IID_IShellFolder, (LPVOID*)&psfParent, (LPCITEMIDLIST*)&rpidl); - if(SUCCEEDED(hr)) + if(SUCCEEDED(hr)) { SHELL32_GetItemAttributes (psfParent, rpidl, rgfInOut); + IShellFolder_Release(psfParent); + } } else { while (cidl > 0 && *apidl) { pdump (*apidl); diff --git a/reactos/lib/shell32/shlexec.c b/reactos/lib/shell32/shlexec.c index c6ff531d62c..30df2aed80b 100644 --- a/reactos/lib/shell32/shlexec.c +++ b/reactos/lib/shell32/shlexec.c @@ -743,7 +743,7 @@ UINT SHELL_FindExecutable(LPCWSTR lpPath, LPCWSTR lpFile, LPCWSTR lpOperation, /****************************************************************** * dde_cb * - * callback for the DDE connection. not really usefull + * callback for the DDE connection. not really useful */ static HDDEDATA CALLBACK dde_cb(UINT uType, UINT uFmt, HCONV hConv, HSZ hsz1, HSZ hsz2, HDDEDATA hData, diff --git a/reactos/lib/shell32/shlfolder.c b/reactos/lib/shell32/shlfolder.c index 6992d7e2cac..bd1d81207ec 100644 --- a/reactos/lib/shell32/shlfolder.c +++ b/reactos/lib/shell32/shlfolder.c @@ -204,7 +204,9 @@ HRESULT SHELL32_CoCreateInitSF (LPCITEMIDLIST pidlRoot, LPCSTR pathRoot, IPersistFolder *pPF; IPersistFolder3 *ppf; - if (SUCCEEDED (IUnknown_QueryInterface ((IUnknown *) * ppvOut, &IID_IPersistFolder3, (LPVOID *) & ppf))) { + if (_ILIsFolder(pidlChild) && + SUCCEEDED (IUnknown_QueryInterface ((IUnknown *) * ppvOut, &IID_IPersistFolder3, (LPVOID *) & ppf))) + { PERSIST_FOLDER_TARGET_INFO ppfti; char szDestPath[MAX_PATH]; diff --git a/reactos/lib/shell32/shlfsbind.c b/reactos/lib/shell32/shlfsbind.c index 1660a587413..e2bbfcce6c7 100644 --- a/reactos/lib/shell32/shlfsbind.c +++ b/reactos/lib/shell32/shlfsbind.c @@ -43,7 +43,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(pidl); typedef struct { const IFileSystemBindDataVtbl *lpVtbl; - DWORD ref; + LONG ref; WIN32_FIND_DATAW findFile; } IFileSystemBindDataImpl; diff --git a/reactos/lib/shell32/shlview.c b/reactos/lib/shell32/shlview.c index 3514bb72ee7..6ca119802fa 100644 --- a/reactos/lib/shell32/shlview.c +++ b/reactos/lib/shell32/shlview.c @@ -77,7 +77,7 @@ typedef struct typedef struct { const IShellViewVtbl* lpVtbl; - DWORD ref; + LONG ref; const IOleCommandTargetVtbl* lpvtblOleCommandTarget; const IDropTargetVtbl* lpvtblDropTarget; const IDropSourceVtbl* lpvtblDropSource; diff --git a/reactos/lib/shell32/shv_bg_cmenu.c b/reactos/lib/shell32/shv_bg_cmenu.c index 54dd9e8532e..885b5604dd4 100644 --- a/reactos/lib/shell32/shv_bg_cmenu.c +++ b/reactos/lib/shell32/shv_bg_cmenu.c @@ -45,7 +45,7 @@ typedef struct { const IContextMenu2Vtbl *lpVtbl; IShellFolder* pSFParent; - DWORD ref; + LONG ref; BOOL bDesktop; } BgCmImpl; diff --git a/reactos/lib/shell32/shv_item_cmenu.c b/reactos/lib/shell32/shv_item_cmenu.c index 5516c1d32bb..63219eaf8b5 100644 --- a/reactos/lib/shell32/shv_item_cmenu.c +++ b/reactos/lib/shell32/shv_item_cmenu.c @@ -44,7 +44,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(shell); */ typedef struct { const IContextMenu2Vtbl *lpVtbl; - DWORD ref; + LONG ref; IShellFolder* pSFParent; LPITEMIDLIST pidl; /* root pidl */ LPITEMIDLIST *apidl; /* array of child pidls */ diff --git a/reactos/lib/shell32/undocshell.h b/reactos/lib/shell32/undocshell.h index 2ae56a8b3d8..0cc5bce2b0d 100644 --- a/reactos/lib/shell32/undocshell.h +++ b/reactos/lib/shell32/undocshell.h @@ -65,9 +65,6 @@ HRESULT WINAPI SHILCreateFromPathW ( LPITEMIDLIST * ppidl, DWORD *attributes); -LPITEMIDLIST WINAPI ILCreateFromPathA(LPCSTR path); -LPITEMIDLIST WINAPI ILCreateFromPathW(LPCWSTR path); - /* string functions */ @@ -124,15 +121,6 @@ void WINAPI RunFileDlg( void WINAPI ExitWindowsDialog(HWND hwndOwner); -BOOL WINAPI GetFileNameFromBrowse( - HWND hwndOwner, - LPSTR lpstrFile, - DWORD nMaxFile, - LPCSTR lpstrInitialDir, - LPCSTR lpstrDefExt, - LPCSTR lpstrFilter, - LPCSTR lpstrTitle); - BOOL WINAPI SHFindComputer( LPCITEMIDLIST pidlRoot, LPCITEMIDLIST pidlSavedSearch);