Author: cwittich Date: Sun Aug 9 15:56:25 2009 New Revision: 42562
URL: http://svn.reactos.org/svn/reactos?rev=42562&view=rev Log: partial sync to wine 1.1.27
Modified: trunk/reactos/dll/win32/shell32/pidl.c trunk/reactos/dll/win32/shell32/pidl.h trunk/reactos/dll/win32/shell32/shfldr_mycomp.c trunk/reactos/dll/win32/shell32/shlfolder.c
Modified: trunk/reactos/dll/win32/shell32/pidl.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/pidl.c?re... ============================================================================== --- trunk/reactos/dll/win32/shell32/pidl.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/pidl.c [iso-8859-1] Sun Aug 9 15:56:25 2009 @@ -31,14 +31,17 @@ extern LPVOID WINAPI Alloc(INT); extern BOOL WINAPI Free(LPVOID);
-/************************************************************************* - * ILGetDisplayNameEx [SHELL32.186] +static LPSTR _ILGetSTextPointer(LPCITEMIDLIST pidl); +static LPWSTR _ILGetTextPointerW(LPCITEMIDLIST pidl); + +/************************************************************************* + * ILGetDisplayNameExA [SHELL32.186] * * Retrieves the display name of an ItemIDList * * PARAMS * psf [I] Shell Folder to start with, if NULL the desktop is used - * pidl [I] ItemIDList relativ to the psf to get the display name for + * pidl [I] ItemIDList relative to the psf to get the display name for * path [O] Filled in with the display name, assumed to be at least MAX_PATH long * type [I] Type of display name to retrieve * 0 = SHGDN_FORPARSING | SHGDN_FORADDRESSBAR uses always the desktop as root @@ -48,7 +51,7 @@ * RETURNS * True if the display name could be retrieved successfully, False otherwise */ -BOOL WINAPI ILGetDisplayNameExA(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, LPSTR path, DWORD type) +static BOOL ILGetDisplayNameExA(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, LPSTR path, DWORD type) { BOOL ret = FALSE; WCHAR wPath[MAX_PATH]; @@ -210,7 +213,7 @@ return NULL;
len = ILGetSize(pidl); - newpidl = (LPITEMIDLIST)SHAlloc(len); + newpidl = SHAlloc(len); if (newpidl) memcpy(newpidl,pidl,len);
@@ -237,7 +240,7 @@ if (pidl) { len = pidl->mkid.cb; - pidlNew = (LPITEMIDLIST) SHAlloc (len+2); + pidlNew = SHAlloc(len+2); if (pidlNew) { memcpy(pidlNew,pidl,len+2); /* 2 -> mind a desktop pidl */ @@ -271,7 +274,7 @@
IStream_AddRef (pStream);
- if (SUCCEEDED(IStream_Read(pStream, (LPVOID)&wLen, 2, &dwBytesRead))) + if (SUCCEEDED(IStream_Read(pStream, &wLen, 2, &dwBytesRead))) { TRACE("PIDL length is %d\n", wLen); if (wLen != 0) @@ -326,7 +329,7 @@
wLen = ILGetSize(pPidl);
- if (SUCCEEDED(IStream_Write(pStream, (LPVOID)&wLen, 2, NULL))) + if (SUCCEEDED(IStream_Write(pStream, &wLen, 2, NULL))) { if (SUCCEEDED(IStream_Write(pStream, pPidl, wLen, NULL))) ret = S_OK; @@ -442,7 +445,7 @@ return NULL;
len = ILGetSize(pidl); - newpidl = (LPITEMIDLIST)Alloc(len); + newpidl = Alloc(len); if (newpidl) memcpy(newpidl,pidl,len);
@@ -703,7 +706,7 @@ if (SUCCEEDED(hr)) { /*assert(pida->cidl==1);*/ - LPIDA pida = (LPIDA)GlobalLock(medium.u.hGlobal); + LPIDA pida = GlobalLock(medium.u.hGlobal);
LPCITEMIDLIST pidl_folder = (LPCITEMIDLIST) ((LPBYTE)pida+pida->aoffset[0]); LPCITEMIDLIST pidl_child = (LPCITEMIDLIST) ((LPBYTE)pida+pida->aoffset[1]); @@ -805,7 +808,7 @@ }
/************************************************************************* - * ILAppendID [SHELL32.154] + * ILAppend [SHELL32.154] * * Adds the single ItemID item to the ItemIDList indicated by pidl. * If bEnd is FALSE, inserts the item in the front of the list, @@ -963,7 +966,7 @@ * is used to avoid having to verify the current path element on disk, so * that creating an ItemIDList from a nonexistent path still can work. */ -static HRESULT WINAPI _ILParsePathW(LPCWSTR path, LPWIN32_FIND_DATAW lpFindFile, +static HRESULT _ILParsePathW(LPCWSTR path, LPWIN32_FIND_DATAW lpFindFile, BOOL bBindCtx, LPITEMIDLIST *ppidl, LPDWORD prgfInOut) { LPSHELLFOLDER pSF = NULL; @@ -994,7 +997,7 @@
IShellFolder_Release(pSF);
- if (!SUCCEEDED(ret) && ppidl) + if (FAILED(ret) && ppidl) *ppidl = NULL;
TRACE("%s %p 0x%x\n", debugstr_w(path), ppidl ? *ppidl : NULL, prgfInOut ? *prgfInOut : 0); @@ -1101,12 +1104,12 @@ shortname = _ILGetSTextPointer(pidl);
if (filename) - lstrcpynA(pfd->cFileName, filename, MAX_PATH); + lstrcpynA(pfd->cFileName, filename, sizeof(pfd->cFileName)); else pfd->cFileName[0] = '\0';
if (shortname) - lstrcpynA(pfd->cAlternateFileName, shortname, MAX_PATH); + lstrcpynA(pfd->cAlternateFileName, shortname, sizeof(pfd->cAlternateFileName)); else pfd->cAlternateFileName[0] = '\0'; return NOERROR; @@ -1300,7 +1303,14 @@ * ************************************************************************* */ -LPITEMIDLIST _ILAlloc(PIDLTYPE type, unsigned int size) + +/* Basic PIDL constructor. Allocates size + 5 bytes, where: + * - two bytes are SHITEMID.cb + * - one byte is PIDLDATA.type + * - two bytes are the NULL PIDL terminator + * Sets type of the returned PIDL to type. + */ +static LPITEMIDLIST _ILAlloc(PIDLTYPE type, unsigned int size) { LPITEMIDLIST pidlOut = NULL;
@@ -1412,7 +1422,7 @@ { LPPIDLDATA pData = _ILGetDataPointer(pidlOut);
- memcpy(&(pData->u.guid.guid), guid, sizeof(GUID)); + pData->u.guid.guid = *guid; TRACE("-- create GUID-pidl %s\n", debugstr_guid(&(pData->u.guid.guid))); } @@ -1429,7 +1439,7 @@ { IID iid;
- if (!SUCCEEDED(SHCLSIDFromStringA(szGUID, &iid))) + if (FAILED(SHCLSIDFromStringA(szGUID, &iid))) { ERR("%s is not a GUID\n", szGUID); return NULL; @@ -1904,7 +1914,7 @@ LPPIDLDATA _ILGetDataPointer(LPCITEMIDLIST pidl) { if(pidl && pidl->mkid.cb != 0x00) - return (LPPIDLDATA) &(pidl->mkid.abID); + return (LPPIDLDATA)pidl->mkid.abID; return NULL; }
@@ -1912,7 +1922,7 @@ * _ILGetTextPointerW() * gets a pointer to the unicode long filename string stored in the pidl */ -LPWSTR _ILGetTextPointerW(LPCITEMIDLIST pidl) +static LPWSTR _ILGetTextPointerW(LPCITEMIDLIST pidl) { /* TRACE(pidl,"(pidl%p)\n", pidl);*/
@@ -1952,7 +1962,7 @@ return NULL;
case PT_VALUEW: - return (LPWSTR)&(pdata->u.file.szNames); + return (LPWSTR)pdata->u.file.szNames; } return NULL; } @@ -1982,21 +1992,21 @@ case PT_DRIVE1: case PT_DRIVE2: case PT_DRIVE3: - return (LPSTR)&(pdata->u.drive.szDriveName); + return pdata->u.drive.szDriveName;
case PT_FOLDER: case PT_FOLDER1: case PT_VALUE: case PT_IESPECIAL1: case PT_IESPECIAL2: - return (LPSTR)&(pdata->u.file.szNames); + return pdata->u.file.szNames;
case PT_WORKGRP: case PT_COMP: case PT_NETWORK: case PT_NETPROVIDER: case PT_SHARE: - return (LPSTR)&(pdata->u.network.szNames); + return pdata->u.network.szNames; } return NULL; } @@ -2005,7 +2015,7 @@ * _ILGetSTextPointer() * gets a pointer to the short filename string stored in the pidl */ -LPSTR _ILGetSTextPointer(LPCITEMIDLIST pidl) +static LPSTR _ILGetSTextPointer(LPCITEMIDLIST pidl) { /* TRACE(pidl,"(pidl%p)\n", pidl); */
@@ -2020,10 +2030,10 @@ case PT_VALUE: case PT_IESPECIAL1: case PT_IESPECIAL2: - return (LPSTR)(pdata->u.file.szNames + strlen (pdata->u.file.szNames) + 1); + return pdata->u.file.szNames + strlen (pdata->u.file.szNames) + 1;
case PT_WORKGRP: - return (LPSTR)(pdata->u.network.szNames + strlen (pdata->u.network.szNames) + 1); + return pdata->u.network.szNames + strlen (pdata->u.network.szNames) + 1; } return NULL; }
Modified: trunk/reactos/dll/win32/shell32/pidl.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/pidl.h?re... ============================================================================== --- trunk/reactos/dll/win32/shell32/pidl.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/pidl.h [iso-8859-1] Sun Aug 9 15:56:25 2009 @@ -35,7 +35,6 @@ #ifndef __WINE_PIDL_H #define __WINE_PIDL_H
- #include <stdarg.h>
#include <windef.h> @@ -50,7 +49,7 @@ * a pidl of NULL means the desktop * * The structure of the pidl seems to be a union. The first byte of the -* PIDLDATA desribes the type of pidl. +* PIDLDATA describes the type of pidl. * * object ! first byte / ! format ! living space * ! size @@ -107,7 +106,6 @@ #define PT_YAGUID 0x70 /* yet another guid.. */ #define PT_IESPECIAL2 0xb1 #define PT_SHARE 0xc3 -
#include "pshpack1.h" typedef BYTE PIDLTYPE; @@ -257,14 +255,6 @@ * simple pidls */
-/* Basic PIDL constructor. Allocates size + 5 bytes, where: - * - two bytes are SHITEMID.cb - * - one byte is PIDLDATA.type - * - two bytes are the NULL PIDL terminator - * Sets type of the returned PIDL to type. - */ -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. */ @@ -297,8 +287,6 @@ */ LPPIDLDATA _ILGetDataPointer (LPCITEMIDLIST); LPSTR _ILGetTextPointer (LPCITEMIDLIST); -LPWSTR _ILGetTextPointerW (LPCITEMIDLIST); -LPSTR _ILGetSTextPointer (LPCITEMIDLIST); IID *_ILGetGUIDPointer (LPCITEMIDLIST pidl); FileStructW *_ILGetFileStructW (LPCITEMIDLIST pidl);
@@ -315,7 +303,6 @@ LPITEMIDLIST * _ILCopyaPidl(const LPCITEMIDLIST * apidlsrc, UINT cidl); LPITEMIDLIST * _ILCopyCidaToaPidl(LPITEMIDLIST* pidl, const CIDA * cida);
-BOOL WINAPI ILGetDisplayNameExA(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, LPSTR path, DWORD type); BOOL WINAPI ILGetDisplayNameExW(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, LPWSTR path, DWORD type);
#endif
Modified: trunk/reactos/dll/win32/shell32/shfldr_mycomp.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shfldr_my... ============================================================================== --- trunk/reactos/dll/win32/shell32/shfldr_mycomp.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shfldr_mycomp.c [iso-8859-1] Sun Aug 9 15:56:25 2009 @@ -94,7 +94,7 @@ sf->lpVtblPersistFolder2 = &vt_PersistFolder2; sf->pidlRoot = _ILCreateMyComputer (); /* my qualified pidl */
- if (!SUCCEEDED (IUnknown_QueryInterface (_IUnknown_ (sf), riid, ppv))) + if (FAILED (IUnknown_QueryInterface (_IUnknown_ (sf), riid, ppv))) { IUnknown_Release (_IUnknown_ (sf)); return E_NOINTERFACE; @@ -180,7 +180,7 @@ { TRACE ("-- destroying IShellFolder(%p)\n", This); SHFree (This->pidlRoot); - LocalFree ((HLOCAL) This); + LocalFree (This); } return refCount; }
Modified: trunk/reactos/dll/win32/shell32/shlfolder.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shlfolder... ============================================================================== --- trunk/reactos/dll/win32/shell32/shlfolder.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shlfolder.c [iso-8859-1] Sun Aug 9 15:56:25 2009 @@ -88,7 +88,7 @@ * * PARAMETERS * pszNext [IN] string to get the element from - * pszOut [IN] pointer to buffer whitch receives string + * pszOut [IN] pointer to buffer which receives string * dwOut [IN] length of pszOut * * RETURNS @@ -110,7 +110,7 @@ while (*pszTail && (*pszTail != (WCHAR) '\')) pszTail++;
- dwCopy = (const WCHAR *) pszTail - (const WCHAR *) pszNext + 1; + dwCopy = pszTail - pszNext + 1; lstrcpynW (pszOut, pszNext, (dwOut < dwCopy) ? dwOut : dwCopy);
if (*pszTail)