diff --git a/dlls/shell32/enumidlist.c b/dlls/shell32/enumidlist.c index 64b58ca66d8..a21bf654c6d 100644 --- a/dlls/shell32/enumidlist.c +++ b/dlls/shell32/enumidlist.c @@ -258,13 +258,12 @@ static BOOL32 WINAPI IEnumIDList_CreateEnumList(LPENUMIDLIST this, LPCSTR lpszPa if ( hFile != INVALID_HANDLE_VALUE32 ) { do { if ( (stffile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && strcmp (stffile.cFileName, ".") && strcmp (stffile.cFileName, "..")) - { pidl = _ILCreateFolder( stffile.cFileName); + { pidl = _ILCreateFolder( stffile.cAlternateFileName, stffile.cFileName); if(pidl) { pData = _ILGetDataPointer(pidl); FileTimeToDosDateTime(&stffile.ftLastWriteTime,&pData->u.folder.uFileDate,&pData->u.folder.uFileTime); pData->u.folder.dwFileSize = stffile.nFileSizeLow; pData->u.folder.uFileAttribs=stffile.dwFileAttributes; - strncpy (pData->u.folder.szAlternateName, stffile.cAlternateFileName,14); if(!IEnumIDList_AddToEnumList(this, pidl)) { return FALSE; } @@ -286,13 +285,12 @@ static BOOL32 WINAPI IEnumIDList_CreateEnumList(LPENUMIDLIST this, LPCSTR lpszPa if ( hFile != INVALID_HANDLE_VALUE32 ) { do { if (! (stffile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ) - { pidl = _ILCreateValue( stffile.cFileName); + { pidl = _ILCreateValue( stffile.cAlternateFileName, stffile.cFileName); if(pidl) { pData = _ILGetDataPointer(pidl); FileTimeToDosDateTime(&stffile.ftLastWriteTime,&pData->u.file.uFileDate,&pData->u.file.uFileTime); pData->u.file.dwFileSize = stffile.nFileSizeLow; pData->u.file.uFileAttribs=stffile.dwFileAttributes; - strncpy (pData->u.file.szAlternateName, stffile.cAlternateFileName,14); if(!IEnumIDList_AddToEnumList(this, pidl)) { return FALSE; } diff --git a/dlls/shell32/pidl.c b/dlls/shell32/pidl.c index 225491bc77c..5c053efb9d9 100644 --- a/dlls/shell32/pidl.c +++ b/dlls/shell32/pidl.c @@ -28,6 +28,7 @@ void pdump (LPCITEMIDLIST pidl) { DWORD type; CHAR * szData; + CHAR * szShortName; LPITEMIDLIST pidltemp = pidl; if (! pidltemp) { TRACE(pidl,"-------- pidl = NULL (Root)\n"); @@ -38,8 +39,10 @@ void pdump (LPCITEMIDLIST pidl) { do { type = _ILGetDataPointer(pidltemp)->type; szData = _ILGetTextPointer(type, _ILGetDataPointer(pidltemp)); + szShortName = _ILGetSTextPointer(type, _ILGetDataPointer(pidltemp)); - TRACE(pidl,"---- pidl=%p size=%u type=%lx %s\n",pidltemp, pidltemp->mkid.cb,type,debugstr_a(szData)); + TRACE(pidl,"---- pidl=%p size=%u type=%lx %s, (%s)\n", + pidltemp, pidltemp->mkid.cb,type,debugstr_a(szData), debugstr_a(szShortName)); pidltemp = ILGetNext(pidltemp); } while (pidltemp->mkid.cb); @@ -509,9 +512,9 @@ LPITEMIDLIST WINAPI SHSimpleIDListFromPath32AW (LPVOID lpszPath) lpszElement = PathFindFilename32A(lpszTemp); if( GetFileAttributes32A(lpszTemp) & FILE_ATTRIBUTE_DIRECTORY ) - { return _ILCreateFolder(lpszElement); + { return _ILCreateFolder(NULL, lpszElement); /*FIXME: fill shortname */ } - return _ILCreateValue(lpszElement); + return _ILCreateValue(NULL, lpszElement); /*FIXME: fill shortname */ } /************************************************************************* * SHGetDataFromIDListA [SHELL32.247] @@ -521,7 +524,7 @@ HRESULT WINAPI SHGetDataFromIDList32A(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, int { FIXME(shell,"sf=%p pidl=%p 0x%04x %p 0x%04x stub\n",psf,pidl,nFormat,dest,len); switch (nFormat) { case SHGDFIL_FINDDATA: - case SHGDFIL_NETRESOURCE: + case SHGDFIL_NETRESOURCE: case SHGDFIL_DESCRIPTIONID: break; default: @@ -565,13 +568,47 @@ LPITEMIDLIST WINAPI _ILCreateDrive( LPCSTR lpszNew) TRACE(pidl,"(%s)\n",sTemp); return _ILCreate(PT_DRIVE,(LPVOID)&sTemp[0],4); } -LPITEMIDLIST WINAPI _ILCreateFolder( LPCSTR lpszNew) -{ TRACE(pidl,"(%s)\n",lpszNew); - return _ILCreate(PT_FOLDER, (LPVOID)lpszNew, strlen(lpszNew)+1); +LPITEMIDLIST WINAPI _ILCreateFolder( LPCSTR lpszShortName, LPCSTR lpszName) +{ char buff[MAX_PATH]; + char * pbuff = buff; + ULONG len, len1; + + TRACE(pidl,"(%s, %s)\n",lpszShortName, lpszName); + + len = strlen (lpszName)+1; + memcpy (pbuff, lpszName, len); + pbuff += len; + + if (lpszShortName) + { len1 = strlen (lpszShortName)+1; + memcpy (pbuff, lpszShortName, len1); + } + else + { len1 = 1; + *pbuff = 0x00; + } + return _ILCreate(PT_FOLDER, (LPVOID)buff, len + len1); } -LPITEMIDLIST WINAPI _ILCreateValue(LPCSTR lpszNew) -{ TRACE(pidl,"(%s)\n",lpszNew); - return _ILCreate(PT_VALUE, (LPVOID)lpszNew, strlen(lpszNew)+1); +LPITEMIDLIST WINAPI _ILCreateValue(LPCSTR lpszShortName, LPCSTR lpszName) +{ char buff[MAX_PATH]; + char * pbuff = buff; + ULONG len, len1; + + TRACE(pidl,"(%s, %s)\n", lpszShortName, lpszName); + + len = strlen (lpszName)+1; + memcpy (pbuff, lpszName, len); + pbuff += len; + + if (lpszShortName) + { len1 = strlen (lpszShortName)+1; + memcpy (pbuff, lpszShortName, len1); + } + else + { len1 = 1; + *pbuff = 0x00; + } + return _ILCreate(PT_VALUE, (LPVOID)buff, len + len1); } /************************************************************************** @@ -926,7 +963,7 @@ LPPIDLDATA WINAPI _ILGetDataPointer(LPITEMIDLIST pidl) } /************************************************************************** * _ILGetTextPointer() - * gets a pointer to the string stored in the pidl + * gets a pointer to the long filename string stored in the pidl */ LPSTR WINAPI _ILGetTextPointer(PIDLTYPE type, LPPIDLDATA pidldata) {/* TRACE(pidl,"(type=%x data=%p)\n", type, pidldata);*/ @@ -940,7 +977,27 @@ LPSTR WINAPI _ILGetTextPointer(PIDLTYPE type, LPPIDLDATA pidldata) case PT_MYCOMP: case PT_FOLDER: case PT_VALUE: - return (LPSTR)&(pidldata->u.file.szText); + return (LPSTR)&(pidldata->u.file.szNames); + } + return NULL; +} +/************************************************************************** + * _ILGetSTextPointer() + * gets a pointer to the long filename string stored in the pidl + */ +LPSTR WINAPI _ILGetSTextPointer(PIDLTYPE type, LPPIDLDATA pidldata) +{/* TRACE(pidl,"(type=%x data=%p)\n", type, pidldata);*/ + + if(!pidldata) + { return NULL; + } + switch (type) + { case PT_MYCOMP: + case PT_DRIVE: + return NULL; + case PT_FOLDER: + case PT_VALUE: + return (LPSTR)(pidldata->u.file.szNames + strlen (pidldata->u.file.szNames) + 1); } return NULL; } diff --git a/dlls/shell32/pidl.h b/dlls/shell32/pidl.h index 4734649dca5..870fba0af5b 100644 --- a/dlls/shell32/pidl.h +++ b/dlls/shell32/pidl.h @@ -60,11 +60,9 @@ typedef struct tagPIDLDATA WORD uFileDate; /*06*/ WORD uFileTime; /*08*/ WORD uFileAttribs; /*10*/ - /* end of MS compatible. Here are comming just one or two - strings. The first is the long name. The second the dos name - when needed. */ - CHAR szAlternateName[14]; /* the 8.3 Name*/ - CHAR szText[1]; /* last entry, variable size */ + CHAR szNames[1]; /*12*/ + /* Here are comming two strings. The first is the long name. + The second the dos name when needed or just 0x00 */ } file, folder, generic; }u; } PIDLDATA, *LPPIDLDATA; @@ -104,8 +102,8 @@ BOOL32 WINAPI _ILIsValue(LPCITEMIDLIST); LPITEMIDLIST WINAPI _ILCreateDesktop(void); LPITEMIDLIST WINAPI _ILCreateMyComputer(void); LPITEMIDLIST WINAPI _ILCreateDrive(LPCSTR); -LPITEMIDLIST WINAPI _ILCreateFolder(LPCSTR); -LPITEMIDLIST WINAPI _ILCreateValue(LPCSTR); +LPITEMIDLIST WINAPI _ILCreateFolder(LPCSTR, LPCSTR); +LPITEMIDLIST WINAPI _ILCreateValue(LPCSTR, LPCSTR); /* * raw pidl handling (binary) @@ -120,6 +118,7 @@ LPITEMIDLIST WINAPI _ILCreate(PIDLTYPE,LPVOID,UINT16); */ LPPIDLDATA WINAPI _ILGetDataPointer(LPCITEMIDLIST); LPSTR WINAPI _ILGetTextPointer(PIDLTYPE type, LPPIDLDATA pidldata); +LPSTR WINAPI _ILGetSTextPointer(PIDLTYPE type, LPPIDLDATA pidldata); void pdump (LPCITEMIDLIST pidl); #endif diff --git a/dlls/shell32/shlfolder.c b/dlls/shell32/shlfolder.c index ef84930826a..7b7b47293ea 100644 --- a/dlls/shell32/shlfolder.c +++ b/dlls/shell32/shlfolder.c @@ -424,10 +424,10 @@ static HRESULT WINAPI IShellFolder_ParseDisplayName( if(pidlFull) { while((pszNext=GetNextElement(pszNext, szElement, MAX_PATH))) { if(!*pszNext && bIsFile) - { pidlTemp = _ILCreateValue(szElement); + { pidlTemp = _ILCreateValue(NULL, szElement); /* FIXME: shortname */ } else - { pidlTemp = _ILCreateFolder(szElement); + { pidlTemp = _ILCreateFolder(NULL, szElement); /* FIXME: shortname */ } pidlOld = pidlFull; pidlFull = ILCombine(pidlFull,pidlTemp); diff --git a/include/shlobj.h b/include/shlobj.h index 90469ac5c90..0db51f5f15a 100644 --- a/include/shlobj.h +++ b/include/shlobj.h @@ -3,6 +3,7 @@ #include "wintypes.h" #include "wine/obj_base.h" +#include "wine/obj_shelllink.h" #include "shell.h" #include "oleobj.h" #include "commctrl.h" @@ -687,122 +688,6 @@ struct tagCOMMDLGBROWSER { LPCOMMDLGBROWSER_VTABLE lpvtbl; DWORD ref; }; -#undef THIS -/**************************************************************************** - * IShellLink interface - */ - -#define THIS LPSHELLLINK this -/* IShellLink::Resolve fFlags */ -typedef enum { - SLR_NO_UI = 0x0001, - SLR_ANY_MATCH = 0x0002, - SLR_UPDATE = 0x0004 -} SLR_FLAGS; - -/* IShellLink::GetPath fFlags */ -typedef enum { - SLGP_SHORTPATH = 0x0001, - SLGP_UNCPRIORITY = 0x0002 -} SLGP_FLAGS; - - - -typedef struct IShellLink IShellLink,*LPSHELLLINK; -typedef struct IShellLink_VTable -{ - /* *** IUnknown methods *** */ - STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE; - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - STDMETHOD_(ULONG,Release) (THIS) PURE; - - STDMETHOD(GetPath)(THIS_ LPSTR pszFile,INT32 cchMaxPath, WIN32_FIND_DATA32A *pfd, DWORD fFlags) PURE; - - STDMETHOD(GetIDList)(THIS_ LPITEMIDLIST * ppidl) PURE; - STDMETHOD(SetIDList)(THIS_ LPCITEMIDLIST pidl) PURE; - - STDMETHOD(GetDescription)(THIS_ LPSTR pszName,INT32 cchMaxName) PURE; - STDMETHOD(SetDescription)(THIS_ LPCSTR pszName) PURE; - - STDMETHOD(GetWorkingDirectory)(THIS_ LPSTR pszDir,INT32 cchMaxPath) PURE; - STDMETHOD(SetWorkingDirectory)(THIS_ LPCSTR pszDir) PURE; - - STDMETHOD(GetArguments)(THIS_ LPSTR pszArgs,INT32 cchMaxPath) PURE; - STDMETHOD(SetArguments)(THIS_ LPCSTR pszArgs) PURE; - - STDMETHOD(GetHotkey)(THIS_ WORD *pwHotkey) PURE; - STDMETHOD(SetHotkey)(THIS_ WORD wHotkey) PURE; - - STDMETHOD(GetShowCmd)(THIS_ INT32 *piShowCmd) PURE; - STDMETHOD(SetShowCmd)(THIS_ INT32 iShowCmd) PURE; - - STDMETHOD(GetIconLocation)(THIS_ LPSTR pszIconPath,INT32 cchIconPath,INT32 *piIcon) PURE; - STDMETHOD(SetIconLocation)(THIS_ LPCSTR pszIconPath,INT32 iIcon) PURE; - - STDMETHOD(SetRelativePath)(THIS_ LPCSTR pszPathRel, DWORD dwReserved) PURE; - - STDMETHOD(Resolve)(THIS_ HWND32 hwnd, DWORD fFlags) PURE; - - STDMETHOD(SetPath)(THIS_ LPCSTR pszFile) PURE; -} IShellLink_VTable,*LPSHELLLINK_VTABLE; - -struct IShellLink { - LPSHELLLINK_VTABLE lpvtbl; - DWORD ref; - /* IPersistfile interface */ - LPPERSISTFILE lppf; -}; -#define IShellLinkA IShellLink - -#undef THIS - -#define THIS LPSHELLLINKW this - -typedef struct IShellLinkW IShellLinkW,*LPSHELLLINKW; -typedef struct IShellLinkW_VTable -{ - /* *** IUnknown methods *** */ - STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE; - STDMETHOD_(ULONG,AddRef) (THIS) PURE; - STDMETHOD_(ULONG,Release) (THIS) PURE; - - STDMETHOD(GetPath)(THIS_ LPWSTR pszFile,INT32 cchMaxPath, WIN32_FIND_DATA32A *pfd, DWORD fFlags) PURE; - - STDMETHOD(GetIDList)(THIS_ LPITEMIDLIST * ppidl) PURE; - STDMETHOD(SetIDList)(THIS_ LPCITEMIDLIST pidl) PURE; - - STDMETHOD(GetDescription)(THIS_ LPWSTR pszName,INT32 cchMaxName) PURE; - STDMETHOD(SetDescription)(THIS_ LPCWSTR pszName) PURE; - - STDMETHOD(GetWorkingDirectory)(THIS_ LPWSTR pszDir,INT32 cchMaxPath) PURE; - STDMETHOD(SetWorkingDirectory)(THIS_ LPCWSTR pszDir) PURE; - - STDMETHOD(GetArguments)(THIS_ LPWSTR pszArgs,INT32 cchMaxPath) PURE; - STDMETHOD(SetArguments)(THIS_ LPCWSTR pszArgs) PURE; - - STDMETHOD(GetHotkey)(THIS_ WORD *pwHotkey) PURE; - STDMETHOD(SetHotkey)(THIS_ WORD wHotkey) PURE; - - STDMETHOD(GetShowCmd)(THIS_ INT32 *piShowCmd) PURE; - STDMETHOD(SetShowCmd)(THIS_ INT32 iShowCmd) PURE; - - STDMETHOD(GetIconLocation)(THIS_ LPWSTR pszIconPath,INT32 cchIconPath,INT32 *piIcon) PURE; - STDMETHOD(SetIconLocation)(THIS_ LPCWSTR pszIconPath,INT32 iIcon) PURE; - - STDMETHOD(SetRelativePath)(THIS_ LPCWSTR pszPathRel, DWORD dwReserved) PURE; - - STDMETHOD(Resolve)(THIS_ HWND32 hwnd, DWORD fFlags) PURE; - - STDMETHOD(SetPath)(THIS_ LPCWSTR pszFile) PURE; -} IShellLinkW_VTable,*LPSHELLLINKW_VTABLE; - -struct IShellLinkW { - LPSHELLLINKW_VTABLE lpvtbl; - DWORD ref; - /* IPersistfile interface */ - LPPERSISTFILE lppf; -}; - #undef THIS /****************************************************************************