Changeset 6650 for trunk/src/shell32
- Timestamp:
- Sep 5, 2001, 3:54:53 PM (24 years ago)
- Location:
- trunk/src/shell32
- Files:
-
- 20 edited
-
brsfolder.c (modified) (6 diffs)
-
control.c (modified) (18 diffs)
-
initshell32.cpp (modified) (3 diffs)
-
initterm.cpp (modified) (2 diffs)
-
memorystream.c (modified) (6 diffs)
-
pidl.c (modified) (51 diffs)
-
shelllink.c (modified) (28 diffs)
-
shellole.c (modified) (21 diffs)
-
shellord.c (modified) (27 diffs)
-
shellpath.c (modified) (24 diffs)
-
shellreg.c (modified) (5 diffs)
-
shellstring.c (modified) (4 diffs)
-
shlfileop.c (modified) (21 diffs)
-
shlfolder.c (modified) (39 diffs)
-
shlmenu.c (modified) (7 diffs)
-
shlview.c (modified) (46 diffs)
-
shpolicy.c (modified) (7 diffs)
-
shv_bg_cmenu.c (modified) (12 diffs)
-
shv_item_cmenu.c (modified) (16 diffs)
-
systray.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/shell32/brsfolder.c
r6596 r6650 1 /* $Id: brsfolder.c,v 1.4 2001-09-05 13:46:55 bird Exp $ */ 1 2 #include <stdlib.h> 2 3 #include <string.h> … … 12 13 DEFAULT_DEBUG_CHANNEL(shell); 13 14 14 static HWND hwndTreeView;15 static LPBROWSEINFOA lpBrowseInfo;16 static LPITEMIDLIST pidlRet;15 static HWND hwndTreeView; 16 static LPBROWSEINFOA lpBrowseInfo; 17 static LPITEMIDLIST pidlRet; 17 18 18 19 static void FillTreeView(LPSHELLFOLDER lpsf, LPITEMIDLIST lpifq, HTREEITEM hParent); … … 20 21 static void InitializeTreeView(HWND hwndParent, LPCITEMIDLIST root) 21 22 { 22 HIMAGELISThImageList;23 IShellFolder *lpsf;24 HRESULThr;25 26 hwndTreeView = GetDlgItem (hwndParent, IDD_TREEVIEW);27 Shell_GetImageList(NULL, &hImageList);28 29 TRACE("dlg=%x tree=%x\n", hwndParent, hwndTreeView );30 31 if (hImageList && hwndTreeView)32 { TreeView_SetImageList(hwndTreeView, hImageList, 0);33 }34 35 /* so far, this method doesn't work (still missing the upper level), keep the old way */23 HIMAGELIST hImageList; 24 IShellFolder * lpsf; 25 HRESULT hr; 26 27 hwndTreeView = GetDlgItem (hwndParent, IDD_TREEVIEW); 28 Shell_GetImageList(NULL, &hImageList); 29 30 TRACE("dlg=%x tree=%x\n", hwndParent, hwndTreeView ); 31 32 if (hImageList && hwndTreeView) 33 { TreeView_SetImageList(hwndTreeView, hImageList, 0); 34 } 35 36 /* so far, this method doesn't work (still missing the upper level), keep the old way */ 36 37 #if 0 37 if (root == NULL) {38 hr = SHGetDesktopFolder(&lpsf);39 } else {40 IShellFolder *lpsfdesktop;41 42 hr = SHGetDesktopFolder(&lpsfdesktop);43 if (SUCCEEDED(hr)) {44 hr = IShellFolder_BindToObject(lpsfdesktop, root, 0,(REFIID)&IID_IShellFolder,(LPVOID *)&lpsf);45 IShellFolder_Release(lpsfdesktop);46 }47 }38 if (root == NULL) { 39 hr = SHGetDesktopFolder(&lpsf); 40 } else { 41 IShellFolder * lpsfdesktop; 42 43 hr = SHGetDesktopFolder(&lpsfdesktop); 44 if (SUCCEEDED(hr)) { 45 hr = IShellFolder_BindToObject(lpsfdesktop, root, 0,(REFIID)&IID_IShellFolder,(LPVOID *)&lpsf); 46 IShellFolder_Release(lpsfdesktop); 47 } 48 } 48 49 #else 49 hr = SHGetDesktopFolder(&lpsf);50 hr = SHGetDesktopFolder(&lpsf); 50 51 #endif 51 52 52 if (SUCCEEDED(hr) && hwndTreeView)53 { TreeView_DeleteAllItems(hwndTreeView);54 FillTreeView(lpsf, NULL, TVI_ROOT);55 }56 57 if (SUCCEEDED(hr))58 { IShellFolder_Release(lpsf);59 }60 TRACE("done\n");53 if (SUCCEEDED(hr) && hwndTreeView) 54 { TreeView_DeleteAllItems(hwndTreeView); 55 FillTreeView(lpsf, NULL, TVI_ROOT); 56 } 57 58 if (SUCCEEDED(hr)) 59 { IShellFolder_Release(lpsf); 60 } 61 TRACE("done\n"); 61 62 } 62 63 63 64 static int GetIcon(LPITEMIDLIST lpi, UINT uFlags) 64 { SHFILEINFOA sfi;65 SHGetFileInfoA((LPCSTR)lpi,0,&sfi, sizeof(SHFILEINFOA), uFlags);66 return sfi.iIcon;65 { SHFILEINFOA sfi; 66 SHGetFileInfoA((LPCSTR)lpi,0,&sfi, sizeof(SHFILEINFOA), uFlags); 67 return sfi.iIcon; 67 68 } 68 69 69 70 static void GetNormalAndSelectedIcons(LPITEMIDLIST lpifq,LPTVITEMA lpTV_ITEM) 70 { TRACE("%p %p\n",lpifq, lpTV_ITEM);71 72 lpTV_ITEM->iImage = GetIcon(lpifq, SHGFI_PIDL | SHGFI_SYSICONINDEX | SHGFI_SMALLICON);73 lpTV_ITEM->iSelectedImage = GetIcon(lpifq, SHGFI_PIDL | SHGFI_SYSICONINDEX | SHGFI_SMALLICON | SHGFI_OPENICON);74 75 return;71 { TRACE("%p %p\n",lpifq, lpTV_ITEM); 72 73 lpTV_ITEM->iImage = GetIcon(lpifq, SHGFI_PIDL | SHGFI_SYSICONINDEX | SHGFI_SMALLICON); 74 lpTV_ITEM->iSelectedImage = GetIcon(lpifq, SHGFI_PIDL | SHGFI_SYSICONINDEX | SHGFI_SMALLICON | SHGFI_OPENICON); 75 76 return; 76 77 } 77 78 … … 85 86 static BOOL GetName(LPSHELLFOLDER lpsf, LPITEMIDLIST lpi, DWORD dwFlags, LPSTR lpFriendlyName) 86 87 { 87 BOOL bSuccess=TRUE;88 STRRET str;89 90 TRACE("%p %p %lx %p\n", lpsf, lpi, dwFlags, lpFriendlyName);91 if (SUCCEEDED(IShellFolder_GetDisplayNameOf(lpsf, lpi, dwFlags, &str)))92 {93 if(FAILED(StrRetToStrNA (lpFriendlyName, MAX_PATH, &str, lpi)))94 {95 bSuccess = FALSE;96 }97 }98 else99 bSuccess = FALSE;100 101 TRACE("-- %s\n",lpFriendlyName);102 return bSuccess;88 BOOL bSuccess=TRUE; 89 STRRET str; 90 91 TRACE("%p %p %lx %p\n", lpsf, lpi, dwFlags, lpFriendlyName); 92 if (SUCCEEDED(IShellFolder_GetDisplayNameOf(lpsf, lpi, dwFlags, &str))) 93 { 94 if(FAILED(StrRetToStrNA (lpFriendlyName, MAX_PATH, &str, lpi))) 95 { 96 bSuccess = FALSE; 97 } 98 } 99 else 100 bSuccess = FALSE; 101 102 TRACE("-- %s\n",lpFriendlyName); 103 return bSuccess; 103 104 } 104 105 105 106 static void FillTreeView(IShellFolder * lpsf, LPITEMIDLIST pidl, HTREEITEM hParent) 106 107 { 107 TVITEMAtvi;108 TVINSERTSTRUCTAtvins;109 HTREEITEMhPrev = 0;110 LPENUMIDLISTlpe=0;111 LPITEMIDLISTpidlTemp=0;112 LPTV_ITEMDATAlptvid=0;113 ULONGulFetched;114 HRESULThr;115 charszBuff[256];116 HWNDhwnd=GetParent(hwndTreeView);117 118 TRACE("%p %p %x\n",lpsf, pidl, (INT)hParent);119 SetCapture(GetParent(hwndTreeView));120 SetCursor(LoadCursorA(0, IDC_WAITA));121 122 hr=IShellFolder_EnumObjects(lpsf,hwnd, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS,&lpe);123 124 if (SUCCEEDED(hr))125 { while (NOERROR == IEnumIDList_Next(lpe,1,&pidlTemp,&ulFetched))126 { ULONG ulAttrs = SFGAO_HASSUBFOLDER | SFGAO_FOLDER;127 IShellFolder_GetAttributesOf(lpsf, 1, &pidlTemp, &ulAttrs);128 if (ulAttrs & (SFGAO_HASSUBFOLDER | SFGAO_FOLDER))129 { if (ulAttrs & SFGAO_FOLDER)130 { tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM;131 132 if (ulAttrs & SFGAO_HASSUBFOLDER)133 { tvi.cChildren=1;134 tvi.mask |= TVIF_CHILDREN;135 }136 137 if (!( lptvid = (LPTV_ITEMDATA)SHAlloc(sizeof(TV_ITEMDATA))))138 goto Done;139 140 if (!GetName(lpsf, pidlTemp, SHGDN_NORMAL, szBuff))141 goto Done;142 143 tvi.pszText = szBuff;144 tvi.cchTextMax = MAX_PATH;145 tvi.lParam = (LPARAM)lptvid;146 147 IShellFolder_AddRef(lpsf);148 lptvid->lpsfParent = lpsf;149 lptvid->lpi= ILClone(pidlTemp);150 lptvid->lpifq= ILCombine(pidl, pidlTemp);151 GetNormalAndSelectedIcons(lptvid->lpifq, &tvi);152 153 tvins.DUMMYUNIONNAME.item = tvi;154 tvins.hInsertAfter = hPrev;155 tvins.hParent = hParent;156 157 hPrev = (HTREEITEM)TreeView_InsertItemA (hwndTreeView, &tvins);158 159 }160 }161 SHFree(pidlTemp); /* Finally, free the pidl that the shell gave us... */162 pidlTemp=0;163 }164 }108 TVITEMA tvi; 109 TVINSERTSTRUCTA tvins; 110 HTREEITEM hPrev = 0; 111 LPENUMIDLIST lpe=0; 112 LPITEMIDLIST pidlTemp=0; 113 LPTV_ITEMDATA lptvid=0; 114 ULONG ulFetched; 115 HRESULT hr; 116 char szBuff[256]; 117 HWND hwnd=GetParent(hwndTreeView); 118 119 TRACE("%p %p %x\n",lpsf, pidl, (INT)hParent); 120 SetCapture(GetParent(hwndTreeView)); 121 SetCursor(LoadCursorA(0, IDC_WAITA)); 122 123 hr=IShellFolder_EnumObjects(lpsf,hwnd, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS,&lpe); 124 125 if (SUCCEEDED(hr)) 126 { while (NOERROR == IEnumIDList_Next(lpe,1,&pidlTemp,&ulFetched)) 127 { ULONG ulAttrs = SFGAO_HASSUBFOLDER | SFGAO_FOLDER; 128 IShellFolder_GetAttributesOf(lpsf, 1, &pidlTemp, &ulAttrs); 129 if (ulAttrs & (SFGAO_HASSUBFOLDER | SFGAO_FOLDER)) 130 { if (ulAttrs & SFGAO_FOLDER) 131 { tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM; 132 133 if (ulAttrs & SFGAO_HASSUBFOLDER) 134 { tvi.cChildren=1; 135 tvi.mask |= TVIF_CHILDREN; 136 } 137 138 if (!( lptvid = (LPTV_ITEMDATA)SHAlloc(sizeof(TV_ITEMDATA)))) 139 goto Done; 140 141 if (!GetName(lpsf, pidlTemp, SHGDN_NORMAL, szBuff)) 142 goto Done; 143 144 tvi.pszText = szBuff; 145 tvi.cchTextMax = MAX_PATH; 146 tvi.lParam = (LPARAM)lptvid; 147 148 IShellFolder_AddRef(lpsf); 149 lptvid->lpsfParent = lpsf; 150 lptvid->lpi = ILClone(pidlTemp); 151 lptvid->lpifq = ILCombine(pidl, pidlTemp); 152 GetNormalAndSelectedIcons(lptvid->lpifq, &tvi); 153 154 tvins.DUMMYUNIONNAME.item = tvi; 155 tvins.hInsertAfter = hPrev; 156 tvins.hParent = hParent; 157 158 hPrev = (HTREEITEM)TreeView_InsertItemA (hwndTreeView, &tvins); 159 160 } 161 } 162 SHFree(pidlTemp); /* Finally, free the pidl that the shell gave us... */ 163 pidlTemp=0; 164 } 165 } 165 166 166 167 Done: 167 ReleaseCapture();168 SetCursor(LoadCursorA(0, IDC_ARROWA));169 170 if (lpe)171 IEnumIDList_Release(lpe);172 if (pidlTemp )173 SHFree(pidlTemp);168 ReleaseCapture(); 169 SetCursor(LoadCursorA(0, IDC_ARROWA)); 170 171 if (lpe) 172 IEnumIDList_Release(lpe); 173 if (pidlTemp ) 174 SHFree(pidlTemp); 174 175 } 175 176 176 177 static LRESULT MsgNotify(HWND hWnd, UINT CtlID, LPNMHDR lpnmh) 177 { 178 NMTREEVIEWA*pnmtv = (NMTREEVIEWA *)lpnmh;179 LPTV_ITEMDATAlptvid; /* Long pointer to TreeView item data */180 IShellFolder *lpsf2=0;181 182 183 TRACE("%x %x %p msg=%x\n", hWnd, CtlID, lpnmh, pnmtv->hdr.code);184 185 switch (pnmtv->hdr.idFrom)186 { case IDD_TREEVIEW:187 switch (pnmtv->hdr.code) 188 { case TVN_DELETEITEMA:189 { FIXME("TVN_DELETEITEMA\n");190 lptvid=(LPTV_ITEMDATA)pnmtv->itemOld.lParam;191 IShellFolder_Release(lptvid->lpsfParent);192 SHFree(lptvid->lpi); 193 SHFree(lptvid->lpifq); 194 SHFree(lptvid); 195 }196 break;197 198 case TVN_ITEMEXPANDINGA:199 { FIXME("TVN_ITEMEXPANDINGA\n");200 if ((pnmtv->itemNew.state & TVIS_EXPANDEDONCE))201 break;202 203 lptvid=(LPTV_ITEMDATA)pnmtv->itemNew.lParam;204 if (SUCCEEDED(IShellFolder_BindToObject(lptvid->lpsfParent, lptvid->lpi,0,(REFIID)&IID_IShellFolder,(LPVOID *)&lpsf2)))205 { FillTreeView( lpsf2, lptvid->lpifq, pnmtv->itemNew.hItem );206 }207 TreeView_SortChildren(hwndTreeView, pnmtv->itemNew.hItem, FALSE);208 }209 break;210 case TVN_SELCHANGEDA:211 lptvid=(LPTV_ITEMDATA)pnmtv->itemNew.lParam;212 pidlRet = lptvid->lpifq;213 if (lpBrowseInfo->lpfn)214 (lpBrowseInfo->lpfn)(hWnd, BFFM_SELCHANGED, (LPARAM)pidlRet, lpBrowseInfo->lParam);215 break;216 217 default:218 FIXME("unhandled (%d)\n", pnmtv->hdr.code);219 break;220 }221 break;222 223 default:224 break;225 }226 227 return 0;178 { 179 NMTREEVIEWA *pnmtv = (NMTREEVIEWA *)lpnmh; 180 LPTV_ITEMDATA lptvid; /* Long pointer to TreeView item data */ 181 IShellFolder * lpsf2=0; 182 183 184 TRACE("%x %x %p msg=%x\n", hWnd, CtlID, lpnmh, pnmtv->hdr.code); 185 186 switch (pnmtv->hdr.idFrom) 187 { case IDD_TREEVIEW: 188 switch (pnmtv->hdr.code) 189 { case TVN_DELETEITEMA: 190 { FIXME("TVN_DELETEITEMA\n"); 191 lptvid=(LPTV_ITEMDATA)pnmtv->itemOld.lParam; 192 IShellFolder_Release(lptvid->lpsfParent); 193 SHFree(lptvid->lpi); 194 SHFree(lptvid->lpifq); 195 SHFree(lptvid); 196 } 197 break; 198 199 case TVN_ITEMEXPANDINGA: 200 { FIXME("TVN_ITEMEXPANDINGA\n"); 201 if ((pnmtv->itemNew.state & TVIS_EXPANDEDONCE)) 202 break; 203 204 lptvid=(LPTV_ITEMDATA)pnmtv->itemNew.lParam; 205 if (SUCCEEDED(IShellFolder_BindToObject(lptvid->lpsfParent, lptvid->lpi,0,(REFIID)&IID_IShellFolder,(LPVOID *)&lpsf2))) 206 { FillTreeView( lpsf2, lptvid->lpifq, pnmtv->itemNew.hItem ); 207 } 208 TreeView_SortChildren(hwndTreeView, pnmtv->itemNew.hItem, FALSE); 209 } 210 break; 211 case TVN_SELCHANGEDA: 212 lptvid=(LPTV_ITEMDATA)pnmtv->itemNew.lParam; 213 pidlRet = lptvid->lpifq; 214 if (lpBrowseInfo->lpfn) 215 (lpBrowseInfo->lpfn)(hWnd, BFFM_SELCHANGED, (LPARAM)pidlRet, lpBrowseInfo->lParam); 216 break; 217 218 default: 219 FIXME("unhandled (%d)\n", pnmtv->hdr.code); 220 break; 221 } 222 break; 223 224 default: 225 break; 226 } 227 228 return 0; 228 229 } 229 230 … … 233 234 */ 234 235 static BOOL WINAPI BrsFolderDlgProc( HWND hWnd, UINT msg, WPARAM wParam, 235 LPARAM lParam )236 LPARAM lParam ) 236 237 { TRACE("hwnd=%i msg=%i 0x%08x 0x%08lx\n", hWnd, msg, wParam, lParam ); 237 238 238 switch(msg)239 { case WM_INITDIALOG:240 pidlRet = NULL;241 lpBrowseInfo = (LPBROWSEINFOA) lParam;242 if (lpBrowseInfo->ulFlags & ~(BIF_STATUSTEXT))243 FIXME("flags %x not implemented\n", lpBrowseInfo->ulFlags & ~(BIF_STATUSTEXT));244 if (lpBrowseInfo->lpszTitle) {245 SetWindowTextA(GetDlgItem(hWnd, IDD_TITLE), lpBrowseInfo->lpszTitle);246 } else {247 ShowWindow(GetDlgItem(hWnd, IDD_TITLE), SW_HIDE);248 }249 if (!(lpBrowseInfo->ulFlags & BIF_STATUSTEXT))250 ShowWindow(GetDlgItem(hWnd, IDD_STATUS), SW_HIDE);251 252 if ( lpBrowseInfo->pidlRoot )253 FIXME("root is desktop\n");254 255 InitializeTreeView( hWnd, lpBrowseInfo->pidlRoot );256 257 if (lpBrowseInfo->lpfn) {258 (lpBrowseInfo->lpfn)(hWnd, BFFM_INITIALIZED, 0, lpBrowseInfo->lParam);239 switch(msg) 240 { case WM_INITDIALOG: 241 pidlRet = NULL; 242 lpBrowseInfo = (LPBROWSEINFOA) lParam; 243 if (lpBrowseInfo->ulFlags & ~(BIF_STATUSTEXT)) 244 FIXME("flags %x not implemented\n", lpBrowseInfo->ulFlags & ~(BIF_STATUSTEXT)); 245 if (lpBrowseInfo->lpszTitle) { 246 SetWindowTextA(GetDlgItem(hWnd, IDD_TITLE), lpBrowseInfo->lpszTitle); 247 } else { 248 ShowWindow(GetDlgItem(hWnd, IDD_TITLE), SW_HIDE); 249 } 250 if (!(lpBrowseInfo->ulFlags & BIF_STATUSTEXT)) 251 ShowWindow(GetDlgItem(hWnd, IDD_STATUS), SW_HIDE); 252 253 if ( lpBrowseInfo->pidlRoot ) 254 FIXME("root is desktop\n"); 255 256 InitializeTreeView( hWnd, lpBrowseInfo->pidlRoot ); 257 258 if (lpBrowseInfo->lpfn) { 259 (lpBrowseInfo->lpfn)(hWnd, BFFM_INITIALIZED, 0, lpBrowseInfo->lParam); 259 260 #ifndef __WIN32OS2__ 260 (lpBrowseInfo->lpfn)(hWnd, BFFM_SELCHANGED, 0/*FIXME*/, lpBrowseInfo->lParam);261 (lpBrowseInfo->lpfn)(hWnd, BFFM_SELCHANGED, 0/*FIXME*/, lpBrowseInfo->lParam); 261 262 #endif 262 }263 264 return TRUE;265 266 case WM_NOTIFY:267 MsgNotify( hWnd, (UINT)wParam, (LPNMHDR)lParam);268 break;269 270 case WM_COMMAND:271 switch (wParam)272 { case IDOK:273 pdump ( pidlRet );274 SHGetPathFromIDListA(pidlRet, lpBrowseInfo->pszDisplayName);275 EndDialog(hWnd, (DWORD) ILClone(pidlRet));276 return TRUE;277 278 case IDCANCEL:279 EndDialog(hWnd, 0);280 return TRUE;281 break;282 }283 break;284 case BFFM_SETSTATUSTEXTA:285 TRACE("Set status %s\n", debugstr_a((LPSTR)lParam));286 SetWindowTextA(GetDlgItem(hWnd, IDD_STATUS), (LPSTR)lParam);287 break;288 case BFFM_SETSTATUSTEXTW:289 TRACE("Set status %s\n", debugstr_w((LPWSTR)lParam));290 SetWindowTextW(GetDlgItem(hWnd, IDD_STATUS), (LPWSTR)lParam);291 break;292 case BFFM_ENABLEOK:293 TRACE("Enable %ld\n", lParam);294 EnableWindow(GetDlgItem(hWnd, 1), (lParam)?TRUE:FALSE);295 break;296 case BFFM_SETSELECTIONA:297 if (wParam)298 TRACE("Set selection %s\n", debugstr_a((LPSTR)lParam));299 else300 TRACE("Set selection %p\n", (void*)lParam);301 break;302 case BFFM_SETSELECTIONW:303 if (wParam)304 TRACE("Set selection %s\n", debugstr_w((LPWSTR)lParam));305 else306 TRACE("Set selection %p\n", (void*)lParam);307 break;308 }309 return FALSE;263 } 264 265 return TRUE; 266 267 case WM_NOTIFY: 268 MsgNotify( hWnd, (UINT)wParam, (LPNMHDR)lParam); 269 break; 270 271 case WM_COMMAND: 272 switch (wParam) 273 { case IDOK: 274 pdump ( pidlRet ); 275 SHGetPathFromIDListA(pidlRet, lpBrowseInfo->pszDisplayName); 276 EndDialog(hWnd, (DWORD) ILClone(pidlRet)); 277 return TRUE; 278 279 case IDCANCEL: 280 EndDialog(hWnd, 0); 281 return TRUE; 282 break; 283 } 284 break; 285 case BFFM_SETSTATUSTEXTA: 286 TRACE("Set status %s\n", debugstr_a((LPSTR)lParam)); 287 SetWindowTextA(GetDlgItem(hWnd, IDD_STATUS), (LPSTR)lParam); 288 break; 289 case BFFM_SETSTATUSTEXTW: 290 TRACE("Set status %s\n", debugstr_w((LPWSTR)lParam)); 291 SetWindowTextW(GetDlgItem(hWnd, IDD_STATUS), (LPWSTR)lParam); 292 break; 293 case BFFM_ENABLEOK: 294 TRACE("Enable %ld\n", lParam); 295 EnableWindow(GetDlgItem(hWnd, 1), (lParam)?TRUE:FALSE); 296 break; 297 case BFFM_SETSELECTIONA: 298 if (wParam) 299 TRACE("Set selection %s\n", debugstr_a((LPSTR)lParam)); 300 else 301 TRACE("Set selection %p\n", (void*)lParam); 302 break; 303 case BFFM_SETSELECTIONW: 304 if (wParam) 305 TRACE("Set selection %s\n", debugstr_w((LPWSTR)lParam)); 306 else 307 TRACE("Set selection %p\n", (void*)lParam); 308 break; 309 } 310 return FALSE; 310 311 } 311 312 … … 316 317 LPITEMIDLIST WINAPI SHBrowseForFolderA (LPBROWSEINFOA lpbi) 317 318 { 318 TRACE("(%p{lpszTitle=%s,owner=%i})\n", 319 lpbi, debugstr_a(lpbi->lpszTitle), lpbi->hwndOwner);320 321 return (LPITEMIDLIST) DialogBoxParamA( shell32_hInstance,322 "SHBRSFORFOLDER_MSGBOX", 323 lpbi->hwndOwner,324 BrsFolderDlgProc, (INT)lpbi );325 } 319 TRACE("(%p{lpszTitle=%s,owner=%i})\n", 320 lpbi, debugstr_a(lpbi->lpszTitle), lpbi->hwndOwner); 321 322 return (LPITEMIDLIST) DialogBoxParamA( shell32_hInstance, 323 "SHBRSFORFOLDER_MSGBOX", 324 lpbi->hwndOwner, 325 BrsFolderDlgProc, (INT)lpbi ); 326 } -
trunk/src/shell32/control.c
r5618 r6650 1 /* $Id: control.c,v 1.2 2001-09-05 13:46:56 bird Exp $ */ 1 2 /* Control Panel management */ 2 3 /* Eric Pouech 2001 */ … … 16 17 17 18 typedef struct CPlApplet { 18 struct CPlApplet* next; /* linked list */19 HWND hWnd;20 unsigned count;/* number of subprograms */21 HMODULE hModule;/* module of loaded applet */22 APPLET_PROC proc;/* entry point address */23 NEWCPLINFOA info[1]; /* array of count information.24 * dwSize field is 0 if entry is invalid */19 struct CPlApplet* next; /* linked list */ 20 HWND hWnd; 21 unsigned count; /* number of subprograms */ 22 HMODULE hModule; /* module of loaded applet */ 23 APPLET_PROC proc; /* entry point address */ 24 NEWCPLINFOA info[1]; /* array of count information. 25 * dwSize field is 0 if entry is invalid */ 25 26 } CPlApplet; 26 27 27 28 typedef struct CPanel { 28 CPlApplet* first;/* linked list */29 HWND hWnd;29 CPlApplet* first; /* linked list */ 30 HWND hWnd; 30 31 unsigned status; 31 CPlApplet* clkApplet;32 CPlApplet* clkApplet; 32 33 unsigned clkSP; 33 34 } CPanel; 34 35 35 static CPlApplet*Control_UnloadApplet(CPlApplet* applet)36 { 37 unsigned i;38 CPlApplet* next;36 static CPlApplet* Control_UnloadApplet(CPlApplet* applet) 37 { 38 unsigned i; 39 CPlApplet* next; 39 40 40 41 for (i = 0; i < applet->count; i++) { … … 49 50 } 50 51 51 static CPlApplet* Control_LoadApplet(HWND hWnd, LPCSTR cmd, CPanel* panel)52 { 53 CPlApplet* applet;54 unsigned i;55 CPLINFO info;52 static CPlApplet* Control_LoadApplet(HWND hWnd, LPCSTR cmd, CPanel* panel) 53 { 54 CPlApplet* applet; 55 unsigned i; 56 CPLINFO info; 56 57 57 58 if (!(applet = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*applet)))) … … 62 63 if (!(applet->hModule = LoadLibraryA(cmd))) { 63 64 WARN("Cannot load control panel applet %s\n", cmd); 64 goto theError;65 goto theError; 65 66 } 66 67 if (!(applet->proc = (APPLET_PROC)GetProcAddress(applet->hModule, "CPlApplet"))) { 67 68 WARN("Not a valid control panel applet %s\n", cmd); 68 goto theError;69 goto theError; 69 70 } 70 71 if (!applet->proc(hWnd, CPL_INIT, 0L, 0L)) { 71 72 WARN("Init of applet has failed\n"); 72 goto theError;73 goto theError; 73 74 } 74 75 if ((applet->count = applet->proc(hWnd, CPL_GETCOUNT, 0L, 0L)) == 0) { 75 76 WARN("No subprogram in applet\n"); 76 goto theError;77 } 78 79 applet = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, applet, 80 sizeof(*applet) + (applet->count - 1) * sizeof(NEWCPLINFOA));81 77 goto theError; 78 } 79 80 applet = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, applet, 81 sizeof(*applet) + (applet->count - 1) * sizeof(NEWCPLINFOA)); 82 82 83 for (i = 0; i < applet->count; i++) { 83 84 applet->info[i].dwSize = sizeof(NEWCPLINFOA); 84 85 /* proc is supposed to return a null value upon success for 85 * CPL_INQUIRE and CPL_NEWINQUIRE86 * However, real drivers don't seem to behave like this87 * So, use introspection rather than return value88 */86 * CPL_INQUIRE and CPL_NEWINQUIRE 87 * However, real drivers don't seem to behave like this 88 * So, use introspection rather than return value 89 */ 89 90 applet->proc(hWnd, CPL_NEWINQUIRE, i, (LPARAM)&applet->info[i]); 90 91 if (applet->info[i].hIcon == 0) { 91 applet->proc(hWnd, CPL_INQUIRE, i, (LPARAM)&info);92 if (info.idIcon == 0 || info.idName == 0) {93 WARN("Couldn't get info from sp %u\n", i);94 applet->info[i].dwSize = 0;95 } else {96 /* convert the old data into the new structure */97 applet->info[i].dwFlags = 0;98 applet->info[i].dwHelpContext = 0;99 applet->info[i].lData = info.lData;100 applet->info[i].hIcon = LoadIconA(applet->hModule, 101 MAKEINTRESOURCEA(info.idIcon));102 LoadStringA(applet->hModule, info.idName, 103 applet->info[i].szName, sizeof(applet->info[i].szName));104 LoadStringA(applet->hModule, info.idInfo, 105 applet->info[i].szInfo, sizeof(applet->info[i].szInfo));106 applet->info[i].szHelpFile[0] = '\0';107 }92 applet->proc(hWnd, CPL_INQUIRE, i, (LPARAM)&info); 93 if (info.idIcon == 0 || info.idName == 0) { 94 WARN("Couldn't get info from sp %u\n", i); 95 applet->info[i].dwSize = 0; 96 } else { 97 /* convert the old data into the new structure */ 98 applet->info[i].dwFlags = 0; 99 applet->info[i].dwHelpContext = 0; 100 applet->info[i].lData = info.lData; 101 applet->info[i].hIcon = LoadIconA(applet->hModule, 102 MAKEINTRESOURCEA(info.idIcon)); 103 LoadStringA(applet->hModule, info.idName, 104 applet->info[i].szName, sizeof(applet->info[i].szName)); 105 LoadStringA(applet->hModule, info.idInfo, 106 applet->info[i].szInfo, sizeof(applet->info[i].szInfo)); 107 applet->info[i].szHelpFile[0] = '\0'; 108 } 108 109 } 109 110 } … … 119 120 } 120 121 121 static void Control_WndProc_Create(HWND hWnd, const CREATESTRUCTA* cs)122 { 123 CPanel* panel = (CPanel*)cs->lpCreateParams;122 static void Control_WndProc_Create(HWND hWnd, const CREATESTRUCTA* cs) 123 { 124 CPanel* panel = (CPanel*)cs->lpCreateParams; 124 125 125 126 SetWindowLongA(hWnd, 0, (LPARAM)panel); … … 128 129 } 129 130 130 #define XICON32131 #define XSTEP 128132 #define YICON32133 #define YSTEP 64134 135 static BOOL Control_Localize(const CPanel* panel, unsigned cx, unsigned cy,136 CPlApplet** papplet, unsigned* psp)137 { 138 unsigned i, x = (XSTEP-XICON)/2, y = 0;139 CPlApplet* applet;140 RECT rc;141 131 #define XICON 32 132 #define XSTEP 128 133 #define YICON 32 134 #define YSTEP 64 135 136 static BOOL Control_Localize(const CPanel* panel, unsigned cx, unsigned cy, 137 CPlApplet** papplet, unsigned* psp) 138 { 139 unsigned i, x = (XSTEP-XICON)/2, y = 0; 140 CPlApplet* applet; 141 RECT rc; 142 142 143 GetClientRect(panel->hWnd, &rc); 143 144 for (applet = panel->first; applet; applet = applet = applet->next) { 144 145 for (i = 0; i < applet->count; i++) { 145 if (!applet->info[i].dwSize) continue;146 if (x + XSTEP >= rc.right - rc.left) {147 x = (XSTEP-XICON)/2;148 y += YSTEP;149 }150 if (cx >= x && cx < x + XICON && cy >= y && cy < y + YSTEP) {151 *papplet = applet;152 *psp = i;153 return TRUE;154 }155 x += XSTEP;156 }146 if (!applet->info[i].dwSize) continue; 147 if (x + XSTEP >= rc.right - rc.left) { 148 x = (XSTEP-XICON)/2; 149 y += YSTEP; 150 } 151 if (cx >= x && cx < x + XICON && cy >= y && cy < y + YSTEP) { 152 *papplet = applet; 153 *psp = i; 154 return TRUE; 155 } 156 x += XSTEP; 157 } 157 158 } 158 159 return FALSE; … … 161 162 static LRESULT Control_WndProc_Paint(const CPanel* panel, WPARAM wParam) 162 163 { 163 HDC hdc;164 PAINTSTRUCT ps;165 RECT rc, txtRect;166 unsigned i, x = 0, y = 0;167 CPlApplet* applet;168 HGDIOBJ hOldFont;164 HDC hdc; 165 PAINTSTRUCT ps; 166 RECT rc, txtRect; 167 unsigned i, x = 0, y = 0; 168 CPlApplet* applet; 169 HGDIOBJ hOldFont; 169 170 170 171 hdc = (wParam) ? (HDC)wParam : BeginPaint(panel->hWnd, &ps); … … 173 174 for (applet = panel->first; applet; applet = applet = applet->next) { 174 175 for (i = 0; i < applet->count; i++) { 175 if (x + XSTEP >= rc.right - rc.left) {176 x = 0;177 y += YSTEP;178 }179 if (!applet->info[i].dwSize) continue;180 DrawIcon(hdc, x + (XSTEP-XICON)/2, y, applet->info[i].hIcon);181 txtRect.left = x;182 txtRect.right = x + XSTEP;183 txtRect.top = y + YICON;184 txtRect.bottom = y + YSTEP;185 DrawTextA(hdc, applet->info[i].szName, -1, &txtRect, 186 DT_CENTER | DT_VCENTER);187 x += XSTEP;188 }176 if (x + XSTEP >= rc.right - rc.left) { 177 x = 0; 178 y += YSTEP; 179 } 180 if (!applet->info[i].dwSize) continue; 181 DrawIcon(hdc, x + (XSTEP-XICON)/2, y, applet->info[i].hIcon); 182 txtRect.left = x; 183 txtRect.right = x + XSTEP; 184 txtRect.top = y + YICON; 185 txtRect.bottom = y + YSTEP; 186 DrawTextA(hdc, applet->info[i].szName, -1, &txtRect, 187 DT_CENTER | DT_VCENTER); 188 x += XSTEP; 189 } 189 190 } 190 191 SelectObject(hdc, hOldFont); … … 195 196 static LRESULT Control_WndProc_LButton(CPanel* panel, LPARAM lParam, BOOL up) 196 197 { 197 unsigned i;198 CPlApplet* applet;199 198 unsigned i; 199 CPlApplet* applet; 200 200 201 if (Control_Localize(panel, LOWORD(lParam), HIWORD(lParam), &applet, &i)) { 201 202 if (up) { 202 if (panel->clkApplet == applet && panel->clkSP == i) {203 applet->proc(applet->hWnd, CPL_DBLCLK, i, applet->info[i].lData);204 }203 if (panel->clkApplet == applet && panel->clkSP == i) { 204 applet->proc(applet->hWnd, CPL_DBLCLK, i, applet->info[i].lData); 205 } 205 206 } else { 206 panel->clkApplet = applet;207 panel->clkSP = i;207 panel->clkApplet = applet; 208 panel->clkSP = i; 208 209 } 209 210 } … … 211 212 } 212 213 213 static LRESULT WINAPI Control_WndProc(HWND hWnd, UINT wMsg,214 WPARAM lParam1, LPARAM lParam2)215 { 216 CPanel* panel = (CPanel*)GetWindowLongA(hWnd, 0);214 static LRESULT WINAPI Control_WndProc(HWND hWnd, UINT wMsg, 215 WPARAM lParam1, LPARAM lParam2) 216 { 217 CPanel* panel = (CPanel*)GetWindowLongA(hWnd, 0); 217 218 218 219 if (panel || wMsg == WM_CREATE) { 219 220 switch (wMsg) { 220 221 case WM_CREATE: 221 Control_WndProc_Create(hWnd, (CREATESTRUCTA*)lParam2);222 return 0;222 Control_WndProc_Create(hWnd, (CREATESTRUCTA*)lParam2); 223 return 0; 223 224 case WM_DESTROY: 224 while ((panel->first = Control_UnloadApplet(panel->first)));225 break;225 while ((panel->first = Control_UnloadApplet(panel->first))); 226 break; 226 227 case WM_PAINT: 227 return Control_WndProc_Paint(panel, lParam1);228 return Control_WndProc_Paint(panel, lParam1); 228 229 case WM_LBUTTONUP: 229 return Control_WndProc_LButton(panel, lParam2, TRUE);230 return Control_WndProc_LButton(panel, lParam2, TRUE); 230 231 case WM_LBUTTONDOWN: 231 return Control_WndProc_LButton(panel, lParam2, FALSE);232 return Control_WndProc_LButton(panel, lParam2, FALSE); 232 233 /* EPP case WM_COMMAND: */ 233 /* EPP return Control_WndProc_Command(mwi, lParam1, lParam2); */234 /* EPP return Control_WndProc_Command(mwi, lParam1, lParam2); */ 234 235 } 235 236 } … … 240 241 static void Control_DoInterface(CPanel* panel, HWND hWnd, HINSTANCE hInst) 241 242 { 242 WNDCLASSA wc;243 MSG msg;243 WNDCLASSA wc; 244 MSG msg; 244 245 245 246 wc.style = CS_HREDRAW|CS_VREDRAW; … … 256 257 if (!RegisterClassA(&wc)) return; 257 258 258 CreateWindowExA(0, wc.lpszClassName, "Wine Control Panel", 259 WS_OVERLAPPEDWINDOW | WS_VISIBLE, 260 CW_USEDEFAULT, CW_USEDEFAULT, 261 CW_USEDEFAULT, CW_USEDEFAULT, 262 hWnd, (HMENU)0, hInst, panel);259 CreateWindowExA(0, wc.lpszClassName, "Wine Control Panel", 260 WS_OVERLAPPEDWINDOW | WS_VISIBLE, 261 CW_USEDEFAULT, CW_USEDEFAULT, 262 CW_USEDEFAULT, CW_USEDEFAULT, 263 hWnd, (HMENU)0, hInst, panel); 263 264 if (!panel->hWnd) return; 264 265 while (GetMessageA(&msg, panel->hWnd, 0, 0)) { 265 266 TranslateMessage(&msg); 266 267 DispatchMessageA(&msg); 267 if (!panel->first) break;268 } 269 } 270 271 static voidControl_DoWindow(CPanel* panel, HWND hWnd, HINSTANCE hInst)272 { 273 HANDLE h;274 WIN32_FIND_DATAA fd;275 char buffer[MAX_PATH];268 if (!panel->first) break; 269 } 270 } 271 272 static void Control_DoWindow(CPanel* panel, HWND hWnd, HINSTANCE hInst) 273 { 274 HANDLE h; 275 WIN32_FIND_DATAA fd; 276 char buffer[MAX_PATH]; 276 277 277 278 /* FIXME: should grab path somewhere from configuration */ 278 279 if ((h = FindFirstFileA("c:\\windows\\system\\*.cpl", &fd)) != 0) { 279 280 do { 280 sprintf(buffer, "c:\\windows\\system\\%s", fd.cFileName);281 Control_LoadApplet(hWnd, buffer, panel);282 } while (FindNextFileA(h, &fd));283 FindClose(h);281 sprintf(buffer, "c:\\windows\\system\\%s", fd.cFileName); 282 Control_LoadApplet(hWnd, buffer, panel); 283 } while (FindNextFileA(h, &fd)); 284 FindClose(h); 284 285 } 285 286 … … 287 288 } 288 289 289 static voidControl_DoLaunch(CPanel* panel, HWND hWnd, LPCSTR cmd)290 static void Control_DoLaunch(CPanel* panel, HWND hWnd, LPCSTR cmd) 290 291 /* forms to parse: 291 * foo.cpl,@sp,str292 * foo.cpl,@sp293 * foo.cpl,,str294 * foo.cpl @sp295 * foo.cpl str292 * foo.cpl,@sp,str 293 * foo.cpl,@sp 294 * foo.cpl,,str 295 * foo.cpl @sp 296 * foo.cpl str 296 297 */ 297 298 { 298 char* buffer;299 char* beg = NULL;300 char* end;301 char ch;302 unsigned sp = 0;303 char* extraPmts = NULL;299 char* buffer; 300 char* beg = NULL; 301 char* end; 302 char ch; 303 unsigned sp = 0; 304 char* extraPmts = NULL; 304 305 305 306 buffer = HeapAlloc(GetProcessHeap(), 0, strlen(cmd) + 1); … … 309 310 310 311 for (;;) { 311 ch = *end;312 if (ch == ' ' || ch == ',' || ch == '\0') {313 *end = '\0';314 if (beg) {315 if (*beg == '@') {316 sp = atoi(beg + 1);317 } else if (*beg == '\0') {318 sp = 0;319 } else {320 extraPmts = beg;321 }322 }323 if (ch == '\0') break;324 beg = end + 1;325 if (ch == ' ') while (end[1] == ' ') end++;326 }327 end++;312 ch = *end; 313 if (ch == ' ' || ch == ',' || ch == '\0') { 314 *end = '\0'; 315 if (beg) { 316 if (*beg == '@') { 317 sp = atoi(beg + 1); 318 } else if (*beg == '\0') { 319 sp = 0; 320 } else { 321 extraPmts = beg; 322 } 323 } 324 if (ch == '\0') break; 325 beg = end + 1; 326 if (ch == ' ') while (end[1] == ' ') end++; 327 } 328 end++; 328 329 } 329 330 Control_LoadApplet(hWnd, buffer, panel); … … 334 335 assert(applet && applet->next == NULL); 335 336 if (sp >= applet->count) { 336 WARN("Out of bounds (%u >= %u), setting to 0\n", sp, applet->count);337 sp = 0;337 WARN("Out of bounds (%u >= %u), setting to 0\n", sp, applet->count); 338 sp = 0; 338 339 } 339 340 if (applet->info[sp].dwSize) { 340 if (!applet->proc(applet->hWnd, CPL_STARTWPARMSA, sp, (LPARAM)extraPmts))341 applet->proc(applet->hWnd, CPL_DBLCLK, sp, applet->info[sp].lData);341 if (!applet->proc(applet->hWnd, CPL_STARTWPARMSA, sp, (LPARAM)extraPmts)) 342 applet->proc(applet->hWnd, CPL_DBLCLK, sp, applet->info[sp].lData); 342 343 } 343 344 Control_UnloadApplet(applet); … … 347 348 348 349 /************************************************************************* 349 * Control_RunDLL [SHELL32.12]350 * Control_RunDLL [SHELL32.12] 350 351 * 351 352 */ 352 353 void WINAPI Control_RunDLL(HWND hWnd, HINSTANCE hInst, LPCSTR cmd, DWORD nCmdShow) 353 354 { 354 CPanel panel;355 356 TRACE("(0x%08x, 0x%08lx, %s, 0x%08lx)\n", 357 hWnd, (DWORD)hInst, debugstr_a(cmd), nCmdShow);355 CPanel panel; 356 357 TRACE("(0x%08x, 0x%08lx, %s, 0x%08lx)\n", 358 hWnd, (DWORD)hInst, debugstr_a(cmd), nCmdShow); 358 359 359 360 memset(&panel, 0, sizeof(panel)); … … 367 368 368 369 /************************************************************************* 369 * Control_FillCache_RunDLL [SHELL32.8]370 * Control_FillCache_RunDLL [SHELL32.8] 370 371 * 371 372 */ … … 377 378 378 379 /************************************************************************* 379 * RunDLL_CallEntry16 [SHELL32.122]380 * RunDLL_CallEntry16 [SHELL32.122] 380 381 * the name is propably wrong 381 382 */ -
trunk/src/shell32/initshell32.cpp
r6401 r6650 1 /* $Id: initshell32.cpp,v 1.3 2001-09-05 13:46:56 bird Exp $ */ 1 2 /* 2 3 * DLL entry point … … 55 56 case DLL_THREAD_ATTACH: 56 57 case DLL_THREAD_DETACH: 57 return Shell32LibMain(hinstDLL, fdwReason, fImpLoad);58 return Shell32LibMain(hinstDLL, fdwReason, fImpLoad); 58 59 59 60 case DLL_PROCESS_DETACH: 60 ret = Shell32LibMain(hinstDLL, fdwReason, fImpLoad);61 return ret;61 ret = Shell32LibMain(hinstDLL, fdwReason, fImpLoad); 62 return ret; 62 63 } 63 64 return FALSE; … … 88 89 CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/ 89 90 90 dllHandle = RegisterLxDll(hModule, OdinLibMain, (PVOID)&shell32_PEResTab, 91 dllHandle = RegisterLxDll(hModule, OdinLibMain, (PVOID)&shell32_PEResTab, 91 92 SHELL32_MAJORIMAGE_VERSION, SHELL32_MINORIMAGE_VERSION, 92 93 IMAGE_SUBSYSTEM_WINDOWS_GUI); 93 if(dllHandle == 0) 94 return 0UL;94 if(dllHandle == 0) 95 return 0UL; 95 96 96 97 break; 97 98 case 1 : 98 99 if(dllHandle) { 99 UnregisterLxDll(dllHandle);100 UnregisterLxDll(dllHandle); 100 101 } 101 102 break; -
trunk/src/shell32/initterm.cpp
r6375 r6650 1 /* $Id: initterm.cpp,v 1.16 2001-09-05 13:46:56 bird Exp $ */ 1 2 /* 2 3 * DLL entry point … … 64 65 case 1 : 65 66 inittermShell32(hModule, ulFlag); 66 ctordtorTerm();67 ctordtorTerm(); 67 68 break; 68 69 default : -
trunk/src/shell32/memorystream.c
r5618 r6650 1 /* $Id: memorystream.c,v 1.3 2001-09-05 13:46:56 bird Exp $ */ 1 2 /* 2 * this class implements a pure IStream object3 * and can be used for many purposes3 * this class implements a pure IStream object 4 * and can be used for many purposes 4 5 * 5 * the main reason for implementing this was6 * a cleaner implementation of IShellLink which7 * needs to be able to load lnk's from a IStream8 * interface so it was obvious to capsule the file9 * access in a IStream to.6 * the main reason for implementing this was 7 * a cleaner implementation of IShellLink which 8 * needs to be able to load lnk's from a IStream 9 * interface so it was obvious to capsule the file 10 * access in a IStream to. 10 11 */ 11 12 … … 36 37 static HRESULT WINAPI IStream_fnClone (IStream * iface, IStream** ppstm); 37 38 38 static ICOM_VTABLE(IStream) stvt = 39 { 40 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE41 IStream_fnQueryInterface,42 IStream_fnAddRef,43 IStream_fnRelease,44 IStream_fnRead,45 IStream_fnWrite,46 IStream_fnSeek,47 IStream_fnSetSize,48 IStream_fnCopyTo,49 IStream_fnCommit,50 IStream_fnRevert,51 IStream_fnLockRegion,52 IStream_fnUnlockRegion,53 IStream_fnStat,54 IStream_fnClone55 39 static ICOM_VTABLE(IStream) stvt = 40 { 41 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 42 IStream_fnQueryInterface, 43 IStream_fnAddRef, 44 IStream_fnRelease, 45 IStream_fnRead, 46 IStream_fnWrite, 47 IStream_fnSeek, 48 IStream_fnSetSize, 49 IStream_fnCopyTo, 50 IStream_fnCommit, 51 IStream_fnRevert, 52 IStream_fnLockRegion, 53 IStream_fnUnlockRegion, 54 IStream_fnStat, 55 IStream_fnClone 56 56 57 }; 57 58 58 typedef struct 59 { ICOM_VTABLE(IStream)*lpvtst;60 DWORDref;61 LPBYTEpImage;62 HANDLEhMapping;63 DWORDdwLength;64 DWORDdwPos;59 typedef struct 60 { ICOM_VTABLE(IStream) *lpvtst; 61 DWORD ref; 62 LPBYTE pImage; 63 HANDLE hMapping; 64 DWORD dwLength; 65 DWORD dwPos; 65 66 } ISHFileStream; 66 67 … … 72 73 HRESULT CreateStreamOnFile (LPCSTR pszFilename, IStream ** ppstm) 73 74 { 74 ISHFileStream*fstr;75 OFSTRUCTofs;76 HFILEhFile = OpenFile( pszFilename, &ofs, OF_READ );77 HRESULTret = E_FAIL;78 79 fstr = (ISHFileStream*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(ISHFileStream));80 fstr->lpvtst=&stvt;81 fstr->ref = 1;82 fstr->dwLength = GetFileSize (hFile, NULL);83 84 shell32_ObjCount++;85 86 if (!(fstr->hMapping = CreateFileMappingA(hFile,NULL,PAGE_READONLY|SEC_COMMIT,0,0,NULL)))87 {88 WARN("failed to create filemap.\n");89 goto end_2;90 }91 92 if (!(fstr->pImage = MapViewOfFile(fstr->hMapping,FILE_MAP_READ,0,0,0)))93 {94 WARN("failed to mmap filemap.\n");95 goto end_3;96 }97 98 ret = S_OK;99 goto end_1;100 101 end_3: CloseHandle(fstr->hMapping);102 end_2: HeapFree(GetProcessHeap(), 0, fstr);103 fstr = NULL;104 105 end_1: _lclose(hFile);106 (*ppstm) = (IStream*)fstr;107 return ret;75 ISHFileStream* fstr; 76 OFSTRUCT ofs; 77 HFILE hFile = OpenFile( pszFilename, &ofs, OF_READ ); 78 HRESULT ret = E_FAIL; 79 80 fstr = (ISHFileStream*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(ISHFileStream)); 81 fstr->lpvtst=&stvt; 82 fstr->ref = 1; 83 fstr->dwLength = GetFileSize (hFile, NULL); 84 85 shell32_ObjCount++; 86 87 if (!(fstr->hMapping = CreateFileMappingA(hFile,NULL,PAGE_READONLY|SEC_COMMIT,0,0,NULL))) 88 { 89 WARN("failed to create filemap.\n"); 90 goto end_2; 91 } 92 93 if (!(fstr->pImage = MapViewOfFile(fstr->hMapping,FILE_MAP_READ,0,0,0))) 94 { 95 WARN("failed to mmap filemap.\n"); 96 goto end_3; 97 } 98 99 ret = S_OK; 100 goto end_1; 101 102 end_3: CloseHandle(fstr->hMapping); 103 end_2: HeapFree(GetProcessHeap(), 0, fstr); 104 fstr = NULL; 105 106 end_1: _lclose(hFile); 107 (*ppstm) = (IStream*)fstr; 108 return ret; 108 109 } 109 110 … … 113 114 static HRESULT WINAPI IStream_fnQueryInterface(IStream *iface, REFIID riid, LPVOID *ppvObj) 114 115 { 115 ICOM_THIS(ISHFileStream, iface);116 117 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj);118 119 *ppvObj = NULL;120 121 if(IsEqualIID(riid, &IID_IUnknown) ||122 IsEqualIID(riid, &IID_IStream))123 {124 *ppvObj = This;125 }126 127 if(*ppvObj)128 { 129 IStream_AddRef((IStream*)*ppvObj); 130 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);131 return S_OK;132 }133 TRACE("-- Interface: E_NOINTERFACE\n");134 return E_NOINTERFACE;116 ICOM_THIS(ISHFileStream, iface); 117 118 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj); 119 120 *ppvObj = NULL; 121 122 if(IsEqualIID(riid, &IID_IUnknown) || 123 IsEqualIID(riid, &IID_IStream)) 124 { 125 *ppvObj = This; 126 } 127 128 if(*ppvObj) 129 { 130 IStream_AddRef((IStream*)*ppvObj); 131 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj); 132 return S_OK; 133 } 134 TRACE("-- Interface: E_NOINTERFACE\n"); 135 return E_NOINTERFACE; 135 136 } 136 137 … … 140 141 static ULONG WINAPI IStream_fnAddRef(IStream *iface) 141 142 { 142 ICOM_THIS(ISHFileStream, iface);143 144 TRACE("(%p)->(count=%lu)\n",This, This->ref);145 146 shell32_ObjCount++;147 return ++(This->ref);143 ICOM_THIS(ISHFileStream, iface); 144 145 TRACE("(%p)->(count=%lu)\n",This, This->ref); 146 147 shell32_ObjCount++; 148 return ++(This->ref); 148 149 } 149 150 … … 153 154 static ULONG WINAPI IStream_fnRelease(IStream *iface) 154 155 { 155 ICOM_THIS(ISHFileStream, iface);156 157 TRACE("(%p)->()\n",This);158 159 shell32_ObjCount--;160 161 if (!--(This->ref)) 162 { TRACE(" destroying SHFileStream (%p)\n",This);163 164 UnmapViewOfFile(This->pImage);165 CloseHandle(This->hMapping);166 167 HeapFree(GetProcessHeap(),0,This);168 return 0;169 }170 return This->ref;156 ICOM_THIS(ISHFileStream, iface); 157 158 TRACE("(%p)->()\n",This); 159 160 shell32_ObjCount--; 161 162 if (!--(This->ref)) 163 { TRACE(" destroying SHFileStream (%p)\n",This); 164 165 UnmapViewOfFile(This->pImage); 166 CloseHandle(This->hMapping); 167 168 HeapFree(GetProcessHeap(),0,This); 169 return 0; 170 } 171 return This->ref; 171 172 } 172 173 173 174 static HRESULT WINAPI IStream_fnRead (IStream * iface, void* pv, ULONG cb, ULONG* pcbRead) 174 175 { 175 ICOM_THIS(ISHFileStream, iface);176 177 DWORD dwBytesToRead, dwBytesLeft;178 179 TRACE("(%p)->(%p,0x%08lx,%p)\n",This, pv, cb, pcbRead);180 181 if ( !pv )182 return STG_E_INVALIDPOINTER;183 184 dwBytesLeft = This->dwLength - This->dwPos;185 186 if ( 0 >= dwBytesLeft )/* end of buffer */187 return S_FALSE;188 189 dwBytesToRead = ( cb > dwBytesLeft) ? dwBytesLeft : cb;190 191 memmove ( pv, (This->pImage) + (This->dwPos), dwBytesToRead);192 193 This->dwPos += dwBytesToRead;/* adjust pointer */194 195 if (pcbRead)196 *pcbRead = dwBytesToRead;197 198 return S_OK;176 ICOM_THIS(ISHFileStream, iface); 177 178 DWORD dwBytesToRead, dwBytesLeft; 179 180 TRACE("(%p)->(%p,0x%08lx,%p)\n",This, pv, cb, pcbRead); 181 182 if ( !pv ) 183 return STG_E_INVALIDPOINTER; 184 185 dwBytesLeft = This->dwLength - This->dwPos; 186 187 if ( 0 >= dwBytesLeft ) /* end of buffer */ 188 return S_FALSE; 189 190 dwBytesToRead = ( cb > dwBytesLeft) ? dwBytesLeft : cb; 191 192 memmove ( pv, (This->pImage) + (This->dwPos), dwBytesToRead); 193 194 This->dwPos += dwBytesToRead; /* adjust pointer */ 195 196 if (pcbRead) 197 *pcbRead = dwBytesToRead; 198 199 return S_OK; 199 200 } 200 201 static HRESULT WINAPI IStream_fnWrite (IStream * iface, const void* pv, ULONG cb, ULONG* pcbWritten) 201 202 { 202 ICOM_THIS(ISHFileStream, iface);203 204 TRACE("(%p)\n",This);205 206 return E_NOTIMPL;203 ICOM_THIS(ISHFileStream, iface); 204 205 TRACE("(%p)\n",This); 206 207 return E_NOTIMPL; 207 208 } 208 209 static HRESULT WINAPI IStream_fnSeek (IStream * iface, LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER* plibNewPosition) 209 210 { 210 ICOM_THIS(ISHFileStream, iface);211 212 TRACE("(%p)\n",This);213 214 return E_NOTIMPL;211 ICOM_THIS(ISHFileStream, iface); 212 213 TRACE("(%p)\n",This); 214 215 return E_NOTIMPL; 215 216 } 216 217 static HRESULT WINAPI IStream_fnSetSize (IStream * iface, ULARGE_INTEGER libNewSize) 217 218 { 218 ICOM_THIS(ISHFileStream, iface);219 220 TRACE("(%p)\n",This);221 222 return E_NOTIMPL;219 ICOM_THIS(ISHFileStream, iface); 220 221 TRACE("(%p)\n",This); 222 223 return E_NOTIMPL; 223 224 } 224 225 static HRESULT WINAPI IStream_fnCopyTo (IStream * iface, IStream* pstm, ULARGE_INTEGER cb, ULARGE_INTEGER* pcbRead, ULARGE_INTEGER* pcbWritten) 225 226 { 226 ICOM_THIS(ISHFileStream, iface);227 228 TRACE("(%p)\n",This);229 230 return E_NOTIMPL;227 ICOM_THIS(ISHFileStream, iface); 228 229 TRACE("(%p)\n",This); 230 231 return E_NOTIMPL; 231 232 } 232 233 static HRESULT WINAPI IStream_fnCommit (IStream * iface, DWORD grfCommitFlags) 233 234 { 234 ICOM_THIS(ISHFileStream, iface);235 236 TRACE("(%p)\n",This);237 238 return E_NOTIMPL;235 ICOM_THIS(ISHFileStream, iface); 236 237 TRACE("(%p)\n",This); 238 239 return E_NOTIMPL; 239 240 } 240 241 static HRESULT WINAPI IStream_fnRevert (IStream * iface) 241 242 { 242 ICOM_THIS(ISHFileStream, iface);243 244 TRACE("(%p)\n",This);245 246 return E_NOTIMPL;243 ICOM_THIS(ISHFileStream, iface); 244 245 TRACE("(%p)\n",This); 246 247 return E_NOTIMPL; 247 248 } 248 249 static HRESULT WINAPI IStream_fnLockRegion (IStream * iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) 249 250 { 250 ICOM_THIS(ISHFileStream, iface);251 252 TRACE("(%p)\n",This);253 254 return E_NOTIMPL;251 ICOM_THIS(ISHFileStream, iface); 252 253 TRACE("(%p)\n",This); 254 255 return E_NOTIMPL; 255 256 } 256 257 static HRESULT WINAPI IStream_fnUnlockRegion (IStream * iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) 257 258 { 258 ICOM_THIS(ISHFileStream, iface);259 260 TRACE("(%p)\n",This);261 262 return E_NOTIMPL;259 ICOM_THIS(ISHFileStream, iface); 260 261 TRACE("(%p)\n",This); 262 263 return E_NOTIMPL; 263 264 } 264 265 static HRESULT WINAPI IStream_fnStat (IStream * iface, STATSTG* pstatstg, DWORD grfStatFlag) 265 266 { 266 ICOM_THIS(ISHFileStream, iface);267 268 TRACE("(%p)\n",This);269 270 return E_NOTIMPL;267 ICOM_THIS(ISHFileStream, iface); 268 269 TRACE("(%p)\n",This); 270 271 return E_NOTIMPL; 271 272 } 272 273 static HRESULT WINAPI IStream_fnClone (IStream * iface, IStream** ppstm) 273 274 { 274 ICOM_THIS(ISHFileStream, iface);275 276 TRACE("(%p)\n",This);277 278 return E_NOTIMPL;279 } 275 ICOM_THIS(ISHFileStream, iface); 276 277 TRACE("(%p)\n",This); 278 279 return E_NOTIMPL; 280 } -
trunk/src/shell32/pidl.c
r5618 r6650 1 /* $Id: pidl.c,v 1.4 2001-09-05 13:46:56 bird Exp $ */ 1 2 /* 2 * pidl Handling3 * 4 * Copyright 1998Juergen Schmied3 * pidl Handling 4 * 5 * Copyright 1998 Juergen Schmied 5 6 * 6 7 * NOTES … … 30 31 void pdump (LPCITEMIDLIST pidl) 31 32 { 32 BOOL bIsShellDebug;33 34 LPITEMIDLIST pidltemp = pidl;35 if (!TRACE_ON(pidl))36 return;37 38 /* silence the sub-functions */39 bIsShellDebug = TRACE_ON(shell);40 __SET_DEBUGGING(__DBCL_TRACE, __wine_dbch_shell, FALSE);41 __SET_DEBUGGING(__DBCL_TRACE, __wine_dbch_pidl, FALSE);42 43 if (! pidltemp)44 {45 MESSAGE ("-------- pidl=NULL (Desktop)\n");46 }47 else48 {49 MESSAGE ("-------- pidl=%p\n", pidl);50 if (pidltemp->mkid.cb)51 { 52 do53 {54 DWORD dwAttrib = 0;55 LPPIDLDATA pData = _ILGetDataPointer(pidltemp);56 DWORD type = pData->type;57 LPSTR szLongName = _ILGetTextPointer(pidltemp);58 LPSTR szShortName = _ILGetSTextPointer(pidltemp);59 char szName[MAX_PATH];60 61 _ILSimpleGetText(pidltemp, szName, MAX_PATH);62 if( PT_FOLDER == type)63 dwAttrib = pData->u.folder.uFileAttribs;64 else if( PT_VALUE == type)65 dwAttrib = pData->u.file.uFileAttribs;66 67 MESSAGE ("-- pidl=%p size=%u type=%lx attr=0x%08lx name=%s (%s,%s)\n",68 pidltemp, pidltemp->mkid.cb,type,dwAttrib,szName,debugstr_a(szLongName), debugstr_a(szShortName));69 70 pidltemp = ILGetNext(pidltemp);71 72 } while (pidltemp->mkid.cb);73 }74 else75 {76 MESSAGE ("empty pidl (Desktop)\n");77 }78 pcheck(pidl);79 }80 81 __SET_DEBUGGING(__DBCL_TRACE, __wine_dbch_shell, bIsShellDebug);82 __SET_DEBUGGING(__DBCL_TRACE, __wine_dbch_pidl, TRUE);33 BOOL bIsShellDebug; 34 35 LPITEMIDLIST pidltemp = pidl; 36 if (!TRACE_ON(pidl)) 37 return; 38 39 /* silence the sub-functions */ 40 bIsShellDebug = TRACE_ON(shell); 41 __SET_DEBUGGING(__DBCL_TRACE, __wine_dbch_shell, FALSE); 42 __SET_DEBUGGING(__DBCL_TRACE, __wine_dbch_pidl, FALSE); 43 44 if (! pidltemp) 45 { 46 MESSAGE ("-------- pidl=NULL (Desktop)\n"); 47 } 48 else 49 { 50 MESSAGE ("-------- pidl=%p\n", pidl); 51 if (pidltemp->mkid.cb) 52 { 53 do 54 { 55 DWORD dwAttrib = 0; 56 LPPIDLDATA pData = _ILGetDataPointer(pidltemp); 57 DWORD type = pData->type; 58 LPSTR szLongName = _ILGetTextPointer(pidltemp); 59 LPSTR szShortName = _ILGetSTextPointer(pidltemp); 60 char szName[MAX_PATH]; 61 62 _ILSimpleGetText(pidltemp, szName, MAX_PATH); 63 if( PT_FOLDER == type) 64 dwAttrib = pData->u.folder.uFileAttribs; 65 else if( PT_VALUE == type) 66 dwAttrib = pData->u.file.uFileAttribs; 67 68 MESSAGE ("-- pidl=%p size=%u type=%lx attr=0x%08lx name=%s (%s,%s)\n", 69 pidltemp, pidltemp->mkid.cb,type,dwAttrib,szName,debugstr_a(szLongName), debugstr_a(szShortName)); 70 71 pidltemp = ILGetNext(pidltemp); 72 73 } while (pidltemp->mkid.cb); 74 } 75 else 76 { 77 MESSAGE ("empty pidl (Desktop)\n"); 78 } 79 pcheck(pidl); 80 } 81 82 __SET_DEBUGGING(__DBCL_TRACE, __wine_dbch_shell, bIsShellDebug); 83 __SET_DEBUGGING(__DBCL_TRACE, __wine_dbch_pidl, TRUE); 83 84 84 85 } … … 87 88 BOOL pcheck (LPCITEMIDLIST pidl) 88 89 { DWORD type, ret=TRUE; 89 BOOL bIsPidlDebug;90 BOOL bIsPidlDebug; 90 91 91 92 LPITEMIDLIST pidltemp = pidl; 92 93 93 bIsPidlDebug = TRACE_ON(shell);94 __SET_DEBUGGING(__DBCL_TRACE, __wine_dbch_pidl, FALSE);94 bIsPidlDebug = TRACE_ON(shell); 95 __SET_DEBUGGING(__DBCL_TRACE, __wine_dbch_pidl, FALSE); 95 96 96 97 if (pidltemp && pidltemp->mkid.cb) … … 98 99 { type = _ILGetDataPointer(pidltemp)->type; 99 100 switch (type) 100 { case PT_DESKTOP:101 case PT_MYCOMP:102 case PT_SPECIAL:103 case PT_DRIVE:104 case PT_DRIVE1:105 case PT_DRIVE2:106 case PT_DRIVE3:107 case PT_FOLDER:108 case PT_VALUE:109 case PT_FOLDER1:110 case PT_WORKGRP:111 case PT_COMP:112 case PT_NETWORK:113 case PT_IESPECIAL1:114 case PT_IESPECIAL2:115 case PT_SHARE:116 break;117 default:118 {119 char szTemp[BYTES_PRINTED*4 + 1];120 int i;121 unsigned char c;122 123 memset(szTemp, ' ', BYTES_PRINTED*4 + 1);124 for ( i = 0; (i<pidltemp->mkid.cb) && (i<BYTES_PRINTED); i++)125 {126 c = ((unsigned char *)pidltemp)[i];127 128 szTemp[i*3+0] = ((c>>4)>9)? (c>>4)+55 : (c>>4)+48;129 szTemp[i*3+1] = ((0x0F&c)>9)? (0x0F&c)+55 : (0x0F&c)+48;130 szTemp[i*3+2] = ' ';131 szTemp[i+BYTES_PRINTED*3] = (c>=0x20 && c <=0x80) ? c : '.';132 }133 szTemp[BYTES_PRINTED*4] = 0x00;134 ERR("unknown IDLIST type size=%u type=%lx\n%s\n",pidltemp->mkid.cb,type, szTemp);135 ret = FALSE;136 }137 }138 pidltemp = ILGetNext(pidltemp);139 } while (pidltemp->mkid.cb);140 }141 __SET_DEBUGGING(__DBCL_TRACE, __wine_dbch_pidl, bIsPidlDebug);142 return ret;143 } 144 145 /************************************************************************* 146 * ILGetDisplayName [SHELL32.15]101 { case PT_DESKTOP: 102 case PT_MYCOMP: 103 case PT_SPECIAL: 104 case PT_DRIVE: 105 case PT_DRIVE1: 106 case PT_DRIVE2: 107 case PT_DRIVE3: 108 case PT_FOLDER: 109 case PT_VALUE: 110 case PT_FOLDER1: 111 case PT_WORKGRP: 112 case PT_COMP: 113 case PT_NETWORK: 114 case PT_IESPECIAL1: 115 case PT_IESPECIAL2: 116 case PT_SHARE: 117 break; 118 default: 119 { 120 char szTemp[BYTES_PRINTED*4 + 1]; 121 int i; 122 unsigned char c; 123 124 memset(szTemp, ' ', BYTES_PRINTED*4 + 1); 125 for ( i = 0; (i<pidltemp->mkid.cb) && (i<BYTES_PRINTED); i++) 126 { 127 c = ((unsigned char *)pidltemp)[i]; 128 129 szTemp[i*3+0] = ((c>>4)>9)? (c>>4)+55 : (c>>4)+48; 130 szTemp[i*3+1] = ((0x0F&c)>9)? (0x0F&c)+55 : (0x0F&c)+48; 131 szTemp[i*3+2] = ' '; 132 szTemp[i+BYTES_PRINTED*3] = (c>=0x20 && c <=0x80) ? c : '.'; 133 } 134 szTemp[BYTES_PRINTED*4] = 0x00; 135 ERR("unknown IDLIST type size=%u type=%lx\n%s\n",pidltemp->mkid.cb,type, szTemp); 136 ret = FALSE; 137 } 138 } 139 pidltemp = ILGetNext(pidltemp); 140 } while (pidltemp->mkid.cb); 141 } 142 __SET_DEBUGGING(__DBCL_TRACE, __wine_dbch_pidl, bIsPidlDebug); 143 return ret; 144 } 145 146 /************************************************************************* 147 * ILGetDisplayName [SHELL32.15] 147 148 */ 148 149 BOOL WINAPI ILGetDisplayName(LPCITEMIDLIST pidl,LPSTR path) 149 150 { 150 TRACE_(shell)("pidl=%p %p semi-stub\n",pidl,path);151 return SHGetPathFromIDListA(pidl, path);151 TRACE_(shell)("pidl=%p %p semi-stub\n",pidl,path); 152 return SHGetPathFromIDListA(pidl, path); 152 153 } 153 154 /************************************************************************* … … 157 158 * observed: pidl=Desktop return=pidl 158 159 */ 159 LPITEMIDLIST WINAPI ILFindLastID(LPITEMIDLIST pidl) 160 { LPITEMIDLIST pidlLast = pidl;161 162 TRACE("(pidl=%p)\n",pidl);163 164 while (pidl->mkid.cb)165 {166 pidlLast = pidl;167 pidl = ILGetNext(pidl);168 }169 return pidlLast; 160 LPITEMIDLIST WINAPI ILFindLastID(LPITEMIDLIST pidl) 161 { LPITEMIDLIST pidlLast = pidl; 162 163 TRACE("(pidl=%p)\n",pidl); 164 165 while (pidl->mkid.cb) 166 { 167 pidlLast = pidl; 168 pidl = ILGetNext(pidl); 169 } 170 return pidlLast; 170 171 } 171 172 /************************************************************************* … … 177 178 BOOL WINAPI ILRemoveLastID(LPCITEMIDLIST pidl) 178 179 { 179 TRACE_(shell)("pidl=%p\n",pidl);180 181 if (!pidl || !pidl->mkid.cb)182 return 0;183 ILFindLastID(pidl)->mkid.cb = 0;184 return 1;180 TRACE_(shell)("pidl=%p\n",pidl); 181 182 if (!pidl || !pidl->mkid.cb) 183 return 0; 184 ILFindLastID(pidl)->mkid.cb = 0; 185 return 1; 185 186 } 186 187 … … 197 198 if (!pidl) 198 199 return NULL; 199 200 200 201 len = ILGetSize(pidl); 201 202 newpidl = (LPITEMIDLIST)SHAlloc(len); … … 215 216 */ 216 217 LPITEMIDLIST WINAPI ILCloneFirst(LPCITEMIDLIST pidl) 217 { DWORD len;218 LPITEMIDLIST pidlNew = NULL;219 220 TRACE("pidl=%p \n",pidl);221 pdump(pidl);222 223 if (pidl)224 {225 len = pidl->mkid.cb; 226 pidlNew = (LPITEMIDLIST) SHAlloc (len+2);227 if (pidlNew)228 {229 memcpy(pidlNew,pidl,len+2);/* 2 -> mind a desktop pidl */230 231 if (len)232 ILGetNext(pidlNew)->mkid.cb = 0x00;233 }234 }235 TRACE("-- newpidl=%p\n",pidlNew);236 237 return pidlNew;218 { DWORD len; 219 LPITEMIDLIST pidlNew = NULL; 220 221 TRACE("pidl=%p \n",pidl); 222 pdump(pidl); 223 224 if (pidl) 225 { 226 len = pidl->mkid.cb; 227 pidlNew = (LPITEMIDLIST) SHAlloc (len+2); 228 if (pidlNew) 229 { 230 memcpy(pidlNew,pidl,len+2); /* 2 -> mind a desktop pidl */ 231 232 if (len) 233 ILGetNext(pidlNew)->mkid.cb = 0x00; 234 } 235 } 236 TRACE("-- newpidl=%p\n",pidlNew); 237 238 return pidlNew; 238 239 } 239 240 … … 245 246 */ 246 247 HRESULT WINAPI ILLoadFromStream (IStream * pStream, LPITEMIDLIST * ppPidl) 247 { WORDwLen = 0;248 DWORDdwBytesRead;249 HRESULTret = E_FAIL;250 251 252 TRACE_(shell)("%p %p\n", pStream , ppPidl);253 254 if (*ppPidl)255 { SHFree(*ppPidl);256 *ppPidl = NULL;257 }258 259 IStream_AddRef (pStream);260 261 if (SUCCEEDED(IStream_Read(pStream, (LPVOID)&wLen, 2, &dwBytesRead)))262 { *ppPidl = SHAlloc (wLen);263 if (SUCCEEDED(IStream_Read(pStream, *ppPidl , wLen, &dwBytesRead)))264 { ret = S_OK;265 }266 else267 { SHFree(*ppPidl);268 *ppPidl = NULL;269 }270 }271 272 /* we are not yet fully compatible */273 if (!pcheck(*ppPidl))274 { SHFree(*ppPidl);275 *ppPidl = NULL;276 }277 278 279 IStream_Release (pStream);280 281 return ret;248 { WORD wLen = 0; 249 DWORD dwBytesRead; 250 HRESULT ret = E_FAIL; 251 252 253 TRACE_(shell)("%p %p\n", pStream , ppPidl); 254 255 if (*ppPidl) 256 { SHFree(*ppPidl); 257 *ppPidl = NULL; 258 } 259 260 IStream_AddRef (pStream); 261 262 if (SUCCEEDED(IStream_Read(pStream, (LPVOID)&wLen, 2, &dwBytesRead))) 263 { *ppPidl = SHAlloc (wLen); 264 if (SUCCEEDED(IStream_Read(pStream, *ppPidl , wLen, &dwBytesRead))) 265 { ret = S_OK; 266 } 267 else 268 { SHFree(*ppPidl); 269 *ppPidl = NULL; 270 } 271 } 272 273 /* we are not yet fully compatible */ 274 if (!pcheck(*ppPidl)) 275 { SHFree(*ppPidl); 276 *ppPidl = NULL; 277 } 278 279 280 IStream_Release (pStream); 281 282 return ret; 282 283 } 283 284 … … 290 291 HRESULT WINAPI ILSaveToStream (IStream * pStream, LPCITEMIDLIST pPidl) 291 292 { 292 LPITEMIDLISTpidl;293 WORDwLen = 0;294 HRESULTret = E_FAIL;295 296 TRACE_(shell)("%p %p\n", pStream, pPidl);297 298 IStream_AddRef (pStream);299 300 pidl = pPidl;293 LPITEMIDLIST pidl; 294 WORD wLen = 0; 295 HRESULT ret = E_FAIL; 296 297 TRACE_(shell)("%p %p\n", pStream, pPidl); 298 299 IStream_AddRef (pStream); 300 301 pidl = pPidl; 301 302 while (pidl->mkid.cb) 302 303 { … … 305 306 } 306 307 307 if (SUCCEEDED(IStream_Write(pStream, (LPVOID)&wLen, 2, NULL)))308 {309 if (SUCCEEDED(IStream_Write(pStream, pPidl, wLen, NULL)))310 { ret = S_OK;311 }312 }313 314 315 IStream_Release (pStream);316 317 return ret;318 } 319 320 /************************************************************************* 321 * SHILCreateFromPath [SHELL32.28]308 if (SUCCEEDED(IStream_Write(pStream, (LPVOID)&wLen, 2, NULL))) 309 { 310 if (SUCCEEDED(IStream_Write(pStream, pPidl, wLen, NULL))) 311 { ret = S_OK; 312 } 313 } 314 315 316 IStream_Release (pStream); 317 318 return ret; 319 } 320 321 /************************************************************************* 322 * SHILCreateFromPath [SHELL32.28] 322 323 * 323 324 * NOTES … … 325 326 */ 326 327 HRESULT WINAPI SHILCreateFromPathA (LPCSTR path, LPITEMIDLIST * ppidl, DWORD * attributes) 327 { LPSHELLFOLDER sf;328 WCHAR lpszDisplayName[MAX_PATH];329 DWORD pchEaten;330 HRESULT ret = E_FAIL;331 332 TRACE_(shell)("%s %p 0x%08lx\n",path,ppidl,attributes?*attributes:0);328 { LPSHELLFOLDER sf; 329 WCHAR lpszDisplayName[MAX_PATH]; 330 DWORD pchEaten; 331 HRESULT ret = E_FAIL; 332 333 TRACE_(shell)("%s %p 0x%08lx\n",path,ppidl,attributes?*attributes:0); 333 334 334 335 if (!MultiByteToWideChar( CP_ACP, 0, path, -1, lpszDisplayName, MAX_PATH )) 335 336 lpszDisplayName[MAX_PATH-1] = 0; 336 337 337 if (SUCCEEDED (SHGetDesktopFolder(&sf)))338 {339 ret = IShellFolder_ParseDisplayName(sf,0, NULL,lpszDisplayName,&pchEaten,ppidl,attributes);340 IShellFolder_Release(sf);341 }342 return ret;338 if (SUCCEEDED (SHGetDesktopFolder(&sf))) 339 { 340 ret = IShellFolder_ParseDisplayName(sf,0, NULL,lpszDisplayName,&pchEaten,ppidl,attributes); 341 IShellFolder_Release(sf); 342 } 343 return ret; 343 344 } 344 345 HRESULT WINAPI SHILCreateFromPathW (LPCWSTR path, LPITEMIDLIST * ppidl, DWORD * attributes) 345 { LPSHELLFOLDER sf;346 DWORD pchEaten;347 HRESULT ret = E_FAIL;348 349 TRACE_(shell)("%s %p 0x%08lx\n",debugstr_w(path),ppidl,attributes?*attributes:0);350 351 if (SUCCEEDED (SHGetDesktopFolder(&sf)))352 {353 ret = IShellFolder_ParseDisplayName(sf,0, NULL, (LPWSTR) path, &pchEaten, ppidl, attributes);354 IShellFolder_Release(sf);355 }356 return ret;346 { LPSHELLFOLDER sf; 347 DWORD pchEaten; 348 HRESULT ret = E_FAIL; 349 350 TRACE_(shell)("%s %p 0x%08lx\n",debugstr_w(path),ppidl,attributes?*attributes:0); 351 352 if (SUCCEEDED (SHGetDesktopFolder(&sf))) 353 { 354 ret = IShellFolder_ParseDisplayName(sf,0, NULL, (LPWSTR) path, &pchEaten, ppidl, attributes); 355 IShellFolder_Release(sf); 356 } 357 return ret; 357 358 } 358 359 HRESULT WINAPI SHILCreateFromPathAW (LPCVOID path, LPITEMIDLIST * ppidl, DWORD * attributes) 359 360 { 360 if ( SHELL_OsIsUnicode())361 return SHILCreateFromPathW (path, ppidl, attributes);362 return SHILCreateFromPathA (path, ppidl, attributes);361 if ( SHELL_OsIsUnicode()) 362 return SHILCreateFromPathW (path, ppidl, attributes); 363 return SHILCreateFromPathA (path, ppidl, attributes); 363 364 } 364 365 365 366 /************************************************************************* 366 367 * SHCloneSpecialIDList [SHELL32.89] 367 * 368 * 368 369 * PARAMETERS 369 * hwndOwner [in]370 * nFolder [in]CSIDL_xxxxx ??370 * hwndOwner [in] 371 * nFolder [in] CSIDL_xxxxx ?? 371 372 * 372 373 * RETURNS … … 376 377 */ 377 378 LPITEMIDLIST WINAPI SHCloneSpecialIDList(HWND hwndOwner,DWORD nFolder,DWORD x3) 378 { LPITEMIDLIST ppidl;379 WARN_(shell)("(hwnd=0x%x,csidl=0x%lx,0x%lx):semi-stub.\n",380 hwndOwner,nFolder,x3);381 382 SHGetSpecialFolderLocation(hwndOwner, nFolder, &ppidl);383 384 return ppidl;379 { LPITEMIDLIST ppidl; 380 WARN_(shell)("(hwnd=0x%x,csidl=0x%lx,0x%lx):semi-stub.\n", 381 hwndOwner,nFolder,x3); 382 383 SHGetSpecialFolderLocation(hwndOwner, nFolder, &ppidl); 384 385 return ppidl; 385 386 } 386 387 … … 390 391 */ 391 392 LPITEMIDLIST WINAPI ILGlobalClone(LPCITEMIDLIST pidl) 392 { DWORD len;393 LPITEMIDLIST newpidl;394 395 if (!pidl)396 return NULL;397 398 len = ILGetSize(pidl);399 newpidl = (LPITEMIDLIST)pCOMCTL32_Alloc(len);400 if (newpidl)401 memcpy(newpidl,pidl,len);402 403 TRACE("pidl=%p newpidl=%p\n",pidl, newpidl);404 pdump(pidl);405 406 return newpidl;393 { DWORD len; 394 LPITEMIDLIST newpidl; 395 396 if (!pidl) 397 return NULL; 398 399 len = ILGetSize(pidl); 400 newpidl = (LPITEMIDLIST)pCOMCTL32_Alloc(len); 401 if (newpidl) 402 memcpy(newpidl,pidl,len); 403 404 TRACE("pidl=%p newpidl=%p\n",pidl, newpidl); 405 pdump(pidl); 406 407 return newpidl; 407 408 } 408 409 … … 413 414 BOOL WINAPI ILIsEqual(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2) 414 415 { 415 charszData1[MAX_PATH];416 charszData2[MAX_PATH];417 418 LPITEMIDLIST pidltemp1 = pidl1;419 LPITEMIDLIST pidltemp2 = pidl2;420 421 TRACE("pidl1=%p pidl2=%p\n",pidl1, pidl2);422 423 /* explorer reads from registry directly (StreamMRU),424 so we can only check here */425 if ((!pcheck (pidl1)) || (!pcheck (pidl2))) return FALSE;426 427 pdump (pidl1);428 pdump (pidl2);429 430 if ( (!pidl1) || (!pidl2) ) return FALSE;431 432 while (pidltemp1->mkid.cb && pidltemp2->mkid.cb)433 {434 _ILSimpleGetText(pidltemp1, szData1, MAX_PATH);435 _ILSimpleGetText(pidltemp2, szData2, MAX_PATH);436 437 if (strcasecmp ( szData1, szData2 )!=0 )438 return FALSE;439 440 pidltemp1 = ILGetNext(pidltemp1);441 pidltemp2 = ILGetNext(pidltemp2);442 } 443 444 if (!pidltemp1->mkid.cb && !pidltemp2->mkid.cb)445 {446 return TRUE;447 }448 449 return FALSE;416 char szData1[MAX_PATH]; 417 char szData2[MAX_PATH]; 418 419 LPITEMIDLIST pidltemp1 = pidl1; 420 LPITEMIDLIST pidltemp2 = pidl2; 421 422 TRACE("pidl1=%p pidl2=%p\n",pidl1, pidl2); 423 424 /* explorer reads from registry directly (StreamMRU), 425 so we can only check here */ 426 if ((!pcheck (pidl1)) || (!pcheck (pidl2))) return FALSE; 427 428 pdump (pidl1); 429 pdump (pidl2); 430 431 if ( (!pidl1) || (!pidl2) ) return FALSE; 432 433 while (pidltemp1->mkid.cb && pidltemp2->mkid.cb) 434 { 435 _ILSimpleGetText(pidltemp1, szData1, MAX_PATH); 436 _ILSimpleGetText(pidltemp2, szData2, MAX_PATH); 437 438 if (strcasecmp ( szData1, szData2 )!=0 ) 439 return FALSE; 440 441 pidltemp1 = ILGetNext(pidltemp1); 442 pidltemp2 = ILGetNext(pidltemp2); 443 } 444 445 if (!pidltemp1->mkid.cb && !pidltemp2->mkid.cb) 446 { 447 return TRUE; 448 } 449 450 return FALSE; 450 451 } 451 452 /************************************************************************* 452 453 * ILIsParent [SHELL32.23] 453 454 * 454 * parent=a/b child=a/b/c -> true, c is in folder a/b455 * child=a/b/c/d -> false if bImmediate is true, d is not in folder a/b456 * child=a/b/c/d -> true if bImmediate is false, d is in a subfolder of a/b455 * parent=a/b child=a/b/c -> true, c is in folder a/b 456 * child=a/b/c/d -> false if bImmediate is true, d is not in folder a/b 457 * child=a/b/c/d -> true if bImmediate is false, d is in a subfolder of a/b 457 458 */ 458 459 BOOL WINAPI ILIsParent( LPCITEMIDLIST pidlParent, LPCITEMIDLIST pidlChild, BOOL bImmediate) 459 460 { 460 charszData1[MAX_PATH];461 charszData2[MAX_PATH];462 463 LPITEMIDLIST pParent = pidlParent;464 LPITEMIDLIST pChild = pidlChild;465 466 TRACE("%p %p %x\n", pidlParent, pidlChild, bImmediate);467 468 while (pParent->mkid.cb && pChild->mkid.cb)469 {470 _ILSimpleGetText(pParent, szData1, MAX_PATH);471 _ILSimpleGetText(pChild, szData2, MAX_PATH);472 473 if (strcasecmp ( szData1, szData2 )!=0 )474 return FALSE;475 476 pParent = ILGetNext(pParent);477 pChild = ILGetNext(pChild);478 } 479 480 if ( pParent->mkid.cb || ! pChild->mkid.cb)/* child shorter or has equal length to parent */481 return FALSE;482 483 if ( ILGetNext(pChild)->mkid.cb && bImmediate)/* not immediate descent */484 return FALSE;485 486 return TRUE;461 char szData1[MAX_PATH]; 462 char szData2[MAX_PATH]; 463 464 LPITEMIDLIST pParent = pidlParent; 465 LPITEMIDLIST pChild = pidlChild; 466 467 TRACE("%p %p %x\n", pidlParent, pidlChild, bImmediate); 468 469 while (pParent->mkid.cb && pChild->mkid.cb) 470 { 471 _ILSimpleGetText(pParent, szData1, MAX_PATH); 472 _ILSimpleGetText(pChild, szData2, MAX_PATH); 473 474 if (strcasecmp ( szData1, szData2 )!=0 ) 475 return FALSE; 476 477 pParent = ILGetNext(pParent); 478 pChild = ILGetNext(pChild); 479 } 480 481 if ( pParent->mkid.cb || ! pChild->mkid.cb) /* child shorter or has equal length to parent */ 482 return FALSE; 483 484 if ( ILGetNext(pChild)->mkid.cb && bImmediate) /* not immediate descent */ 485 return FALSE; 486 487 return TRUE; 487 488 } 488 489 … … 493 494 * Compares elements from pidl1 and pidl2. 494 495 * 495 * pidl1 is desktop pidl2496 * pidl1 shorter pidl2 pointer to first different element of pidl2497 * if there was at least one equal element498 * pidl2 shorter pidl1 0499 * pidl2 equal pidl1 pointer to last 0x00-element of pidl2496 * pidl1 is desktop pidl2 497 * pidl1 shorter pidl2 pointer to first different element of pidl2 498 * if there was at least one equal element 499 * pidl2 shorter pidl1 0 500 * pidl2 equal pidl1 pointer to last 0x00-element of pidl2 500 501 */ 501 502 LPITEMIDLIST WINAPI ILFindChild(LPCITEMIDLIST pidl1,LPCITEMIDLIST pidl2) 502 503 { 503 charszData1[MAX_PATH];504 charszData2[MAX_PATH];505 506 LPITEMIDLIST pidltemp1 = pidl1;507 LPITEMIDLIST pidltemp2 = pidl2;508 LPITEMIDLIST ret=NULL;509 510 TRACE("pidl1=%p pidl2=%p\n",pidl1, pidl2);511 512 /* explorer reads from registry directly (StreamMRU),513 so we can only check here */514 if ((!pcheck (pidl1)) || (!pcheck (pidl2)))515 return FALSE;516 517 pdump (pidl1);518 pdump (pidl2);519 520 if ( _ILIsDesktop(pidl1) )521 {522 ret = pidl2;523 }524 else525 {526 while (pidltemp1->mkid.cb && pidltemp2->mkid.cb)527 {528 _ILSimpleGetText(pidltemp1, szData1, MAX_PATH);529 _ILSimpleGetText(pidltemp2, szData2, MAX_PATH);530 531 if (strcasecmp(szData1,szData2))532 break;533 534 pidltemp1 = ILGetNext(pidltemp1);535 pidltemp2 = ILGetNext(pidltemp2);536 ret = pidltemp2; 537 }538 539 if (pidltemp1->mkid.cb)540 {541 ret = NULL; /* elements of pidl1 left*/542 }543 }544 TRACE_(shell)("--- %p\n", ret);545 return ret; /* pidl 1 is shorter */504 char szData1[MAX_PATH]; 505 char szData2[MAX_PATH]; 506 507 LPITEMIDLIST pidltemp1 = pidl1; 508 LPITEMIDLIST pidltemp2 = pidl2; 509 LPITEMIDLIST ret=NULL; 510 511 TRACE("pidl1=%p pidl2=%p\n",pidl1, pidl2); 512 513 /* explorer reads from registry directly (StreamMRU), 514 so we can only check here */ 515 if ((!pcheck (pidl1)) || (!pcheck (pidl2))) 516 return FALSE; 517 518 pdump (pidl1); 519 pdump (pidl2); 520 521 if ( _ILIsDesktop(pidl1) ) 522 { 523 ret = pidl2; 524 } 525 else 526 { 527 while (pidltemp1->mkid.cb && pidltemp2->mkid.cb) 528 { 529 _ILSimpleGetText(pidltemp1, szData1, MAX_PATH); 530 _ILSimpleGetText(pidltemp2, szData2, MAX_PATH); 531 532 if (strcasecmp(szData1,szData2)) 533 break; 534 535 pidltemp1 = ILGetNext(pidltemp1); 536 pidltemp2 = ILGetNext(pidltemp2); 537 ret = pidltemp2; 538 } 539 540 if (pidltemp1->mkid.cb) 541 { 542 ret = NULL; /* elements of pidl1 left*/ 543 } 544 } 545 TRACE_(shell)("--- %p\n", ret); 546 return ret; /* pidl 1 is shorter */ 546 547 } 547 548 … … 556 557 LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1,LPCITEMIDLIST pidl2) 557 558 { 558 DWORD len1,len2;559 LPITEMIDLIST pidlNew;560 561 TRACE("pidl=%p pidl=%p\n",pidl1,pidl2);562 563 if(!pidl1 && !pidl2) return NULL;564 565 pdump (pidl1);566 pdump (pidl2);567 568 if(!pidl1)569 {570 pidlNew = ILClone(pidl2);571 return pidlNew;572 }573 574 if(!pidl2)575 {576 pidlNew = ILClone(pidl1);577 return pidlNew;578 }579 580 len1 = ILGetSize(pidl1)-2;581 len2 = ILGetSize(pidl2);582 pidlNew = SHAlloc(len1+len2);583 584 if (pidlNew)585 {586 memcpy(pidlNew,pidl1,len1);587 memcpy(((BYTE *)pidlNew)+len1,pidl2,len2);588 }589 590 /* TRACE(pidl,"--new pidl=%p\n",pidlNew);*/591 return pidlNew;559 DWORD len1,len2; 560 LPITEMIDLIST pidlNew; 561 562 TRACE("pidl=%p pidl=%p\n",pidl1,pidl2); 563 564 if(!pidl1 && !pidl2) return NULL; 565 566 pdump (pidl1); 567 pdump (pidl2); 568 569 if(!pidl1) 570 { 571 pidlNew = ILClone(pidl2); 572 return pidlNew; 573 } 574 575 if(!pidl2) 576 { 577 pidlNew = ILClone(pidl1); 578 return pidlNew; 579 } 580 581 len1 = ILGetSize(pidl1)-2; 582 len2 = ILGetSize(pidl2); 583 pidlNew = SHAlloc(len1+len2); 584 585 if (pidlNew) 586 { 587 memcpy(pidlNew,pidl1,len1); 588 memcpy(((BYTE *)pidlNew)+len1,pidl2,len2); 589 } 590 591 /* TRACE(pidl,"--new pidl=%p\n",pidlNew);*/ 592 return pidlNew; 592 593 } 593 594 /************************************************************************* … … 598 599 LPITEMIDLIST WINAPI SHGetRealIDL(LPSHELLFOLDER lpsf, LPITEMIDLIST pidl, DWORD z) 599 600 { 600 FIXME("sf=%p pidl=%p 0x%04lx\n",lpsf,pidl,z);601 602 pdump (pidl);603 return 0;601 FIXME("sf=%p pidl=%p 0x%04lx\n",lpsf,pidl,z); 602 603 pdump (pidl); 604 return 0; 604 605 } 605 606 … … 608 609 * 609 610 * NOTES 610 * pild = CSIDL_DESKTOP ret = 0611 * pild = CSIDL_DRIVES ret = 0611 * pild = CSIDL_DESKTOP ret = 0 612 * pild = CSIDL_DRIVES ret = 0 612 613 */ 613 614 LPITEMIDLIST WINAPI SHLogILFromFSIL(LPITEMIDLIST pidl) 614 615 { 615 FIXME("(pidl=%p)\n",pidl);616 617 pdump(pidl);618 619 return 0;616 FIXME("(pidl=%p)\n",pidl); 617 618 pdump(pidl); 619 620 return 0; 620 621 } 621 622 … … 635 636 DWORD WINAPI ILGetSize(LPITEMIDLIST pidl) 636 637 { 637 LPSHITEMID si = &(pidl->mkid);638 DWORD len=0;639 640 if (pidl)641 { while (si->cb) 642 { len += si->cb;643 si = (LPSHITEMID)(((LPBYTE)si)+si->cb);644 }645 len += 2;646 }647 TRACE("pidl=%p size=%lu\n",pidl, len);648 return len;638 LPSHITEMID si = &(pidl->mkid); 639 DWORD len=0; 640 641 if (pidl) 642 { while (si->cb) 643 { len += si->cb; 644 si = (LPSHITEMID)(((LPBYTE)si)+si->cb); 645 } 646 len += 2; 647 } 648 TRACE("pidl=%p size=%lu\n",pidl, len); 649 return len; 649 650 } 650 651 … … 661 662 LPITEMIDLIST WINAPI ILGetNext(LPITEMIDLIST pidl) 662 663 { 663 WORD len;664 665 TRACE("(pidl=%p)\n",pidl);666 667 if(pidl)668 {669 len = pidl->mkid.cb;670 if (len)671 {672 pidl = (LPITEMIDLIST) (((LPBYTE)pidl)+len);673 return pidl;674 }675 }676 return NULL;664 WORD len; 665 666 TRACE("(pidl=%p)\n",pidl); 667 668 if(pidl) 669 { 670 len = pidl->mkid.cb; 671 if (len) 672 { 673 pidl = (LPITEMIDLIST) (((LPBYTE)pidl)+len); 674 return pidl; 675 } 676 } 677 return NULL; 677 678 } 678 679 /************************************************************************* … … 687 688 LPITEMIDLIST WINAPI ILAppend(LPITEMIDLIST pidl,LPCITEMIDLIST item,BOOL bEnd) 688 689 { 689 LPITEMIDLIST idlRet;690 691 WARN("(pidl=%p,pidl=%p,%08u)semi-stub\n",pidl,item,bEnd);692 693 pdump (pidl);694 pdump (item);695 696 if (_ILIsDesktop(pidl))697 {698 idlRet = ILClone(item);699 if (pidl)700 SHFree (pidl);701 return idlRet;702 }703 704 if (bEnd)705 {706 idlRet=ILCombine(pidl,item);707 }708 else709 {710 idlRet=ILCombine(item,pidl);711 }712 713 SHFree(pidl);714 return idlRet;690 LPITEMIDLIST idlRet; 691 692 WARN("(pidl=%p,pidl=%p,%08u)semi-stub\n",pidl,item,bEnd); 693 694 pdump (pidl); 695 pdump (item); 696 697 if (_ILIsDesktop(pidl)) 698 { 699 idlRet = ILClone(item); 700 if (pidl) 701 SHFree (pidl); 702 return idlRet; 703 } 704 705 if (bEnd) 706 { 707 idlRet=ILCombine(pidl,item); 708 } 709 else 710 { 711 idlRet=ILCombine(item,pidl); 712 } 713 714 SHFree(pidl); 715 return idlRet; 715 716 } 716 717 /************************************************************************* … … 722 723 * exported by ordinal 723 724 */ 724 DWORD WINAPI ILFree(LPITEMIDLIST pidl) 725 { 726 TRACE("(pidl=0x%08lx)\n",(DWORD)pidl);727 728 if(!pidl) return FALSE;729 SHFree(pidl);730 return TRUE;725 DWORD WINAPI ILFree(LPITEMIDLIST pidl) 726 { 727 TRACE("(pidl=0x%08lx)\n",(DWORD)pidl); 728 729 if(!pidl) return FALSE; 730 SHFree(pidl); 731 return TRUE; 731 732 } 732 733 /************************************************************************* … … 736 737 void WINAPI ILGlobalFree( LPCITEMIDLIST pidl) 737 738 { 738 TRACE("%p\n",pidl);739 740 if(!pidl) return;741 pCOMCTL32_Free(pidl);739 TRACE("%p\n",pidl); 740 741 if(!pidl) return; 742 pCOMCTL32_Free(pidl); 742 743 } 743 744 /************************************************************************* … … 745 746 * 746 747 */ 747 LPITEMIDLIST WINAPI ILCreateFromPathA (LPCSTR path) 748 { 749 LPITEMIDLIST pidlnew;750 DWORD attributes = 0;751 752 TRACE_(shell)("%s\n",path);753 754 if (SUCCEEDED (SHILCreateFromPathA (path, &pidlnew, &attributes)))755 return pidlnew;756 return FALSE;757 } 758 LPITEMIDLIST WINAPI ILCreateFromPathW (LPCWSTR path) 759 { 760 LPITEMIDLIST pidlnew;761 DWORD attributes = 0;762 763 TRACE_(shell)("%s\n",debugstr_w(path));764 765 if (SUCCEEDED (SHILCreateFromPathW (path, &pidlnew, &attributes)))766 return pidlnew;767 return FALSE;768 } 769 LPITEMIDLIST WINAPI ILCreateFromPathAW (LPCVOID path) 770 { 771 if ( SHELL_OsIsUnicode())772 return ILCreateFromPathW (path);773 return ILCreateFromPathA (path);748 LPITEMIDLIST WINAPI ILCreateFromPathA (LPCSTR path) 749 { 750 LPITEMIDLIST pidlnew; 751 DWORD attributes = 0; 752 753 TRACE_(shell)("%s\n",path); 754 755 if (SUCCEEDED (SHILCreateFromPathA (path, &pidlnew, &attributes))) 756 return pidlnew; 757 return FALSE; 758 } 759 LPITEMIDLIST WINAPI ILCreateFromPathW (LPCWSTR path) 760 { 761 LPITEMIDLIST pidlnew; 762 DWORD attributes = 0; 763 764 TRACE_(shell)("%s\n",debugstr_w(path)); 765 766 if (SUCCEEDED (SHILCreateFromPathW (path, &pidlnew, &attributes))) 767 return pidlnew; 768 return FALSE; 769 } 770 LPITEMIDLIST WINAPI ILCreateFromPathAW (LPCVOID path) 771 { 772 if ( SHELL_OsIsUnicode()) 773 return ILCreateFromPathW (path); 774 return ILCreateFromPathA (path); 774 775 } 775 776 /************************************************************************* … … 778 779 LPITEMIDLIST WINAPI SHSimpleIDListFromPathA (LPCSTR lpszPath) 779 780 { 780 LPITEMIDLISTpidl=NULL;781 HANDLEhFile;782 WIN32_FIND_DATAAstffile;783 784 TRACE("path=%s\n", lpszPath);785 786 if (!lpszPath) return NULL;787 788 hFile = FindFirstFileA(lpszPath, &stffile);789 790 if ( hFile != INVALID_HANDLE_VALUE )791 {792 if (stffile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)793 {794 pidl = _ILCreateFolder (&stffile);795 }796 else797 {798 pidl = _ILCreateValue (&stffile);799 }800 FindClose (hFile);801 }802 return pidl;781 LPITEMIDLIST pidl=NULL; 782 HANDLE hFile; 783 WIN32_FIND_DATAA stffile; 784 785 TRACE("path=%s\n", lpszPath); 786 787 if (!lpszPath) return NULL; 788 789 hFile = FindFirstFileA(lpszPath, &stffile); 790 791 if ( hFile != INVALID_HANDLE_VALUE ) 792 { 793 if (stffile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) 794 { 795 pidl = _ILCreateFolder (&stffile); 796 } 797 else 798 { 799 pidl = _ILCreateValue (&stffile); 800 } 801 FindClose (hFile); 802 } 803 return pidl; 803 804 } 804 805 LPITEMIDLIST WINAPI SHSimpleIDListFromPathW (LPCWSTR lpszPath) 805 806 { 806 charlpszTemp[MAX_PATH];807 TRACE("path=%s\n",debugstr_w(lpszPath));807 char lpszTemp[MAX_PATH]; 808 TRACE("path=%s\n",debugstr_w(lpszPath)); 808 809 809 810 if (!WideCharToMultiByte( CP_ACP, 0, lpszPath, -1, lpszTemp, sizeof(lpszTemp), NULL, NULL )) 810 811 lpszTemp[sizeof(lpszTemp)-1] = 0; 811 812 812 return SHSimpleIDListFromPathA (lpszTemp);813 return SHSimpleIDListFromPathA (lpszTemp); 813 814 } 814 815 815 816 LPITEMIDLIST WINAPI SHSimpleIDListFromPathAW (LPCVOID lpszPath) 816 817 { 817 if ( SHELL_OsIsUnicode())818 return SHSimpleIDListFromPathW (lpszPath);819 return SHSimpleIDListFromPathA (lpszPath);820 } 821 822 /************************************************************************* 823 * SHGetSpecialFolderLocation [SHELL32.223]818 if ( SHELL_OsIsUnicode()) 819 return SHSimpleIDListFromPathW (lpszPath); 820 return SHSimpleIDListFromPathA (lpszPath); 821 } 822 823 /************************************************************************* 824 * SHGetSpecialFolderLocation [SHELL32.223] 824 825 * 825 826 * gets the folder locations from the registry and creates a pidl 826 827 * creates missing reg keys and directorys 827 * 828 * 828 829 * PARAMS 829 830 * hwndOwner [I] … … 833 834 */ 834 835 HRESULT WINAPI SHGetSpecialFolderLocation( 835 HWND hwndOwner,836 INT nFolder,837 LPITEMIDLIST * ppidl)838 { 839 CHARszPath[MAX_PATH];840 HRESULThr = E_INVALIDARG;841 842 TRACE_(shell)("(%04x,0x%x,%p)\n", hwndOwner,nFolder,ppidl);843 844 if (ppidl)845 {846 *ppidl = NULL;847 switch (nFolder)848 {849 case CSIDL_DESKTOP:850 *ppidl = _ILCreateDesktop();851 break;852 853 case CSIDL_DRIVES:854 *ppidl = _ILCreateMyComputer();855 break;856 857 case CSIDL_NETWORK:858 *ppidl = _ILCreateNetwork ();859 break;860 861 case CSIDL_CONTROLS:862 *ppidl = _ILCreateControl ();863 break;864 865 case CSIDL_PRINTERS:866 *ppidl = _ILCreatePrinter ();867 break;868 869 case CSIDL_BITBUCKET:870 *ppidl = _ILCreateBitBucket ();871 break;872 873 default:874 if (SHGetSpecialFolderPathA(hwndOwner, szPath, nFolder, TRUE))875 {876 DWORD attributes=0;877 TRACE_(shell)("Value=%s\n",szPath);878 hr = SHILCreateFromPathA(szPath, ppidl, &attributes);879 }880 }881 if(*ppidl) hr = NOERROR;882 }883 884 TRACE_(shell)("-- (new pidl %p)\n",*ppidl);885 return hr;836 HWND hwndOwner, 837 INT nFolder, 838 LPITEMIDLIST * ppidl) 839 { 840 CHAR szPath[MAX_PATH]; 841 HRESULT hr = E_INVALIDARG; 842 843 TRACE_(shell)("(%04x,0x%x,%p)\n", hwndOwner,nFolder,ppidl); 844 845 if (ppidl) 846 { 847 *ppidl = NULL; 848 switch (nFolder) 849 { 850 case CSIDL_DESKTOP: 851 *ppidl = _ILCreateDesktop(); 852 break; 853 854 case CSIDL_DRIVES: 855 *ppidl = _ILCreateMyComputer(); 856 break; 857 858 case CSIDL_NETWORK: 859 *ppidl = _ILCreateNetwork (); 860 break; 861 862 case CSIDL_CONTROLS: 863 *ppidl = _ILCreateControl (); 864 break; 865 866 case CSIDL_PRINTERS: 867 *ppidl = _ILCreatePrinter (); 868 break; 869 870 case CSIDL_BITBUCKET: 871 *ppidl = _ILCreateBitBucket (); 872 break; 873 874 default: 875 if (SHGetSpecialFolderPathA(hwndOwner, szPath, nFolder, TRUE)) 876 { 877 DWORD attributes=0; 878 TRACE_(shell)("Value=%s\n",szPath); 879 hr = SHILCreateFromPathA(szPath, ppidl, &attributes); 880 } 881 } 882 if(*ppidl) hr = NOERROR; 883 } 884 885 TRACE_(shell)("-- (new pidl %p)\n",*ppidl); 886 return hr; 886 887 } 887 888 … … 894 895 */ 895 896 HRESULT WINAPI SHGetFolderLocation( 896 HWND hwnd,897 int csidl,898 HANDLE hToken,899 DWORD dwFlags,900 LPITEMIDLIST *ppidl)901 { 902 FIXME("0x%04x 0x%08x 0x%08x 0x%08lx %p\n",903 hwnd, csidl, hToken, dwFlags, ppidl);904 return SHGetSpecialFolderLocation(hwnd, csidl, ppidl);897 HWND hwnd, 898 int csidl, 899 HANDLE hToken, 900 DWORD dwFlags, 901 LPITEMIDLIST *ppidl) 902 { 903 FIXME("0x%04x 0x%08x 0x%08x 0x%08lx %p\n", 904 hwnd, csidl, hToken, dwFlags, ppidl); 905 return SHGetSpecialFolderLocation(hwnd, csidl, ppidl); 905 906 } 906 907 … … 914 915 HRESULT WINAPI SHGetDataFromIDListA(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, int nFormat, LPVOID dest, int len) 915 916 { 916 TRACE_(shell)("sf=%p pidl=%p 0x%04x %p 0x%04x stub\n",psf,pidl,nFormat,dest,len);917 918 pdump(pidl);919 if (!psf || !dest ) return E_INVALIDARG;920 921 switch (nFormat)922 {923 case SHGDFIL_FINDDATA:924 {925 WIN32_FIND_DATAA * pfd = dest;926 927 if ( len < sizeof (WIN32_FIND_DATAA)) return E_INVALIDARG;928 929 ZeroMemory(pfd, sizeof (WIN32_FIND_DATAA));930 _ILGetFileDateTime( pidl, &(pfd->ftLastWriteTime));931 pfd->dwFileAttributes = _ILGetFileAttributes(pidl, NULL, 0);932 pfd->nFileSizeLow = _ILGetFileSize ( pidl, NULL, 0);933 lstrcpynA(pfd->cFileName,_ILGetTextPointer(pidl), MAX_PATH);934 lstrcpynA(pfd->cAlternateFileName,_ILGetSTextPointer(pidl), 14);935 }936 return NOERROR;937 938 case SHGDFIL_NETRESOURCE:939 case SHGDFIL_DESCRIPTIONID:940 FIXME_(shell)("SHGDFIL %i stub\n", nFormat);941 break;942 943 default:944 ERR_(shell)("Unknown SHGDFIL %i, please report\n", nFormat);945 }946 947 return E_INVALIDARG;917 TRACE_(shell)("sf=%p pidl=%p 0x%04x %p 0x%04x stub\n",psf,pidl,nFormat,dest,len); 918 919 pdump(pidl); 920 if (!psf || !dest ) return E_INVALIDARG; 921 922 switch (nFormat) 923 { 924 case SHGDFIL_FINDDATA: 925 { 926 WIN32_FIND_DATAA * pfd = dest; 927 928 if ( len < sizeof (WIN32_FIND_DATAA)) return E_INVALIDARG; 929 930 ZeroMemory(pfd, sizeof (WIN32_FIND_DATAA)); 931 _ILGetFileDateTime( pidl, &(pfd->ftLastWriteTime)); 932 pfd->dwFileAttributes = _ILGetFileAttributes(pidl, NULL, 0); 933 pfd->nFileSizeLow = _ILGetFileSize ( pidl, NULL, 0); 934 lstrcpynA(pfd->cFileName,_ILGetTextPointer(pidl), MAX_PATH); 935 lstrcpynA(pfd->cAlternateFileName,_ILGetSTextPointer(pidl), 14); 936 } 937 return NOERROR; 938 939 case SHGDFIL_NETRESOURCE: 940 case SHGDFIL_DESCRIPTIONID: 941 FIXME_(shell)("SHGDFIL %i stub\n", nFormat); 942 break; 943 944 default: 945 ERR_(shell)("Unknown SHGDFIL %i, please report\n", nFormat); 946 } 947 948 return E_INVALIDARG; 948 949 } 949 950 /************************************************************************* … … 953 954 HRESULT WINAPI SHGetDataFromIDListW(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, int nFormat, LPVOID dest, int len) 954 955 { 955 TRACE_(shell)("sf=%p pidl=%p 0x%04x %p 0x%04x stub\n",psf,pidl,nFormat,dest,len);956 957 pdump(pidl);958 959 if (! psf || !dest ) return E_INVALIDARG;960 961 switch (nFormat)962 {963 case SHGDFIL_FINDDATA:964 {965 WIN32_FIND_DATAW * pfd = dest;966 967 if ( len < sizeof (WIN32_FIND_DATAW)) return E_INVALIDARG;968 969 ZeroMemory(pfd, sizeof (WIN32_FIND_DATAA));970 _ILGetFileDateTime( pidl, &(pfd->ftLastWriteTime));971 pfd->dwFileAttributes = _ILGetFileAttributes(pidl, NULL, 0);972 pfd->nFileSizeLow = _ILGetFileSize ( pidl, NULL, 0);956 TRACE_(shell)("sf=%p pidl=%p 0x%04x %p 0x%04x stub\n",psf,pidl,nFormat,dest,len); 957 958 pdump(pidl); 959 960 if (! psf || !dest ) return E_INVALIDARG; 961 962 switch (nFormat) 963 { 964 case SHGDFIL_FINDDATA: 965 { 966 WIN32_FIND_DATAW * pfd = dest; 967 968 if ( len < sizeof (WIN32_FIND_DATAW)) return E_INVALIDARG; 969 970 ZeroMemory(pfd, sizeof (WIN32_FIND_DATAA)); 971 _ILGetFileDateTime( pidl, &(pfd->ftLastWriteTime)); 972 pfd->dwFileAttributes = _ILGetFileAttributes(pidl, NULL, 0); 973 pfd->nFileSizeLow = _ILGetFileSize ( pidl, NULL, 0); 973 974 if (!MultiByteToWideChar( CP_ACP, 0, _ILGetTextPointer(pidl), -1, 974 975 pfd->cFileName, MAX_PATH )) … … 977 978 pfd->cAlternateFileName, 14 )) 978 979 pfd->cFileName[13] = 0; 979 }980 return NOERROR;981 case SHGDFIL_NETRESOURCE:982 case SHGDFIL_DESCRIPTIONID:983 FIXME_(shell)("SHGDFIL %i stub\n", nFormat);984 break;985 986 default:987 ERR_(shell)("Unknown SHGDFIL %i, please report\n", nFormat);988 }989 990 return E_INVALIDARG;991 } 992 993 /************************************************************************* 994 * SHGetPathFromIDListA [SHELL32.261][NT 4.0: SHELL32.220]980 } 981 return NOERROR; 982 case SHGDFIL_NETRESOURCE: 983 case SHGDFIL_DESCRIPTIONID: 984 FIXME_(shell)("SHGDFIL %i stub\n", nFormat); 985 break; 986 987 default: 988 ERR_(shell)("Unknown SHGDFIL %i, please report\n", nFormat); 989 } 990 991 return E_INVALIDARG; 992 } 993 994 /************************************************************************* 995 * SHGetPathFromIDListA [SHELL32.261][NT 4.0: SHELL32.220] 995 996 * 996 997 * PARAMETERS 997 * pidl, [IN] pidl 998 * pidl, [IN] pidl 998 999 * pszPath [OUT] path 999 1000 * 1000 * RETURNS 1001 * RETURNS 1001 1002 * path from a passed PIDL. 1002 1003 * 1003 1004 * NOTES 1004 * NULL returns FALSE1005 * desktop pidl gives path to desktopdirectory back1006 * special pidls returning FALSE1005 * NULL returns FALSE 1006 * desktop pidl gives path to desktopdirectory back 1007 * special pidls returning FALSE 1007 1008 * 1008 1009 * FIXME … … 1010 1011 */ 1011 1012 BOOL WINAPI SHGetPathFromIDListA (LPCITEMIDLIST pidl,LPSTR pszPath) 1012 { STRRET str;1013 LPSHELLFOLDER shellfolder;1014 1015 TRACE_(shell)("(pidl=%p,%p)\n",pidl,pszPath);1016 1017 if (!pidl) return FALSE;1018 1019 pdump(pidl);1020 1021 if(_ILIsDesktop(pidl))1022 {1023 SHGetSpecialFolderPathA(0, pszPath, CSIDL_DESKTOPDIRECTORY, FALSE); 1024 }1025 else if (_ILIsSpecialFolder(ILFindLastID(pidl)))1026 {1027 /* we are somewhere in a special folder */1028 return FALSE;1029 }1030 else1031 {1032 if (SHGetDesktopFolder(&shellfolder)==S_OK)1033 {1034 IShellFolder_GetDisplayNameOf(shellfolder,pidl,SHGDN_FORPARSING,&str);1035 StrRetToStrNA (pszPath, MAX_PATH, &str, pidl);1036 IShellFolder_Release(shellfolder);1037 }1038 }1039 TRACE_(shell)("-- (%s)\n",pszPath);1040 1041 return TRUE;1042 } 1043 /************************************************************************* 1044 * SHGetPathFromIDListW [SHELL32.262]1013 { STRRET str; 1014 LPSHELLFOLDER shellfolder; 1015 1016 TRACE_(shell)("(pidl=%p,%p)\n",pidl,pszPath); 1017 1018 if (!pidl) return FALSE; 1019 1020 pdump(pidl); 1021 1022 if(_ILIsDesktop(pidl)) 1023 { 1024 SHGetSpecialFolderPathA(0, pszPath, CSIDL_DESKTOPDIRECTORY, FALSE); 1025 } 1026 else if (_ILIsSpecialFolder(ILFindLastID(pidl))) 1027 { 1028 /* we are somewhere in a special folder */ 1029 return FALSE; 1030 } 1031 else 1032 { 1033 if (SHGetDesktopFolder(&shellfolder)==S_OK) 1034 { 1035 IShellFolder_GetDisplayNameOf(shellfolder,pidl,SHGDN_FORPARSING,&str); 1036 StrRetToStrNA (pszPath, MAX_PATH, &str, pidl); 1037 IShellFolder_Release(shellfolder); 1038 } 1039 } 1040 TRACE_(shell)("-- (%s)\n",pszPath); 1041 1042 return TRUE; 1043 } 1044 /************************************************************************* 1045 * SHGetPathFromIDListW [SHELL32.262] 1045 1046 */ 1046 1047 BOOL WINAPI SHGetPathFromIDListW (LPCITEMIDLIST pidl,LPWSTR pszPath) 1047 { char sTemp[MAX_PATH];1048 1049 TRACE_(shell)("(pidl=%p)\n", pidl);1050 1051 SHGetPathFromIDListA (pidl, sTemp);1048 { char sTemp[MAX_PATH]; 1049 1050 TRACE_(shell)("(pidl=%p)\n", pidl); 1051 1052 SHGetPathFromIDListA (pidl, sTemp); 1052 1053 MultiByteToWideChar( CP_ACP, 0, sTemp, -1, pszPath, MAX_PATH ); 1053 1054 1054 TRACE_(shell)("-- (%s)\n",debugstr_w(pszPath));1055 1056 return TRUE;1057 } 1058 1059 /************************************************************************* 1060 * SHBindToParent[shell version 5.0]1055 TRACE_(shell)("-- (%s)\n",debugstr_w(pszPath)); 1056 1057 return TRUE; 1058 } 1059 1060 /************************************************************************* 1061 * SHBindToParent [shell version 5.0] 1061 1062 */ 1062 1063 HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast) 1063 1064 { 1064 IShellFolder* psf;1065 LPITEMIDLISTpidlChild, pidlParent;1066 HRESULThr=E_FAIL;1067 1068 TRACE_(shell)("pidl=%p\n", pidl);1069 pdump(pidl);1070 1071 *ppv = NULL;1072 if (ppidlLast) *ppidlLast = NULL;1073 1074 if (_ILIsPidlSimple(pidl))1075 {1076 /* we are on desktop level */1077 if (ppidlLast) 1078 *ppidlLast = ILClone(pidl);1079 hr = SHGetDesktopFolder((IShellFolder**)ppv);1080 }1081 else1082 {1083 pidlChild = ILClone(ILFindLastID(pidl));1084 pidlParent = ILClone(pidl);1085 ILRemoveLastID(pidlParent);1086 1087 hr = SHGetDesktopFolder(&psf);1088 1089 if (SUCCEEDED(hr))1090 hr = IShellFolder_BindToObject(psf, pidlParent, NULL, riid, ppv);1091 1092 if (SUCCEEDED(hr) && ppidlLast)1093 *ppidlLast = pidlChild;1094 else1095 ILFree (pidlChild);1096 1097 SHFree (pidlParent);1098 if (psf) IShellFolder_Release(psf);1099 }1100 1101 1102 TRACE_(shell)("-- psf=%p pidl=%p ret=0x%08lx\n", *ppv, (ppidlLast)?*ppidlLast:NULL, hr);1103 return hr;1104 } 1105 1106 /************************************************************************* 1107 * SHGetPathFromIDListAW [SHELL32.221][NT 4.0: SHELL32.219]1065 IShellFolder * psf; 1066 LPITEMIDLIST pidlChild, pidlParent; 1067 HRESULT hr=E_FAIL; 1068 1069 TRACE_(shell)("pidl=%p\n", pidl); 1070 pdump(pidl); 1071 1072 *ppv = NULL; 1073 if (ppidlLast) *ppidlLast = NULL; 1074 1075 if (_ILIsPidlSimple(pidl)) 1076 { 1077 /* we are on desktop level */ 1078 if (ppidlLast) 1079 *ppidlLast = ILClone(pidl); 1080 hr = SHGetDesktopFolder((IShellFolder**)ppv); 1081 } 1082 else 1083 { 1084 pidlChild = ILClone(ILFindLastID(pidl)); 1085 pidlParent = ILClone(pidl); 1086 ILRemoveLastID(pidlParent); 1087 1088 hr = SHGetDesktopFolder(&psf); 1089 1090 if (SUCCEEDED(hr)) 1091 hr = IShellFolder_BindToObject(psf, pidlParent, NULL, riid, ppv); 1092 1093 if (SUCCEEDED(hr) && ppidlLast) 1094 *ppidlLast = pidlChild; 1095 else 1096 ILFree (pidlChild); 1097 1098 SHFree (pidlParent); 1099 if (psf) IShellFolder_Release(psf); 1100 } 1101 1102 1103 TRACE_(shell)("-- psf=%p pidl=%p ret=0x%08lx\n", *ppv, (ppidlLast)?*ppidlLast:NULL, hr); 1104 return hr; 1105 } 1106 1107 /************************************************************************* 1108 * SHGetPathFromIDListAW [SHELL32.221][NT 4.0: SHELL32.219] 1108 1109 */ 1109 1110 BOOL WINAPI SHGetPathFromIDListAW(LPCITEMIDLIST pidl,LPVOID pszPath) 1110 1111 { 1111 TRACE_(shell)("(pidl=%p,%p)\n",pidl,pszPath);1112 1113 if (SHELL_OsIsUnicode())1114 return SHGetPathFromIDListW(pidl,pszPath);1115 return SHGetPathFromIDListA(pidl,pszPath);1112 TRACE_(shell)("(pidl=%p,%p)\n",pidl,pszPath); 1113 1114 if (SHELL_OsIsUnicode()) 1115 return SHGetPathFromIDListW(pidl,pszPath); 1116 return SHGetPathFromIDListA(pidl,pszPath); 1116 1117 } 1117 1118 1118 1119 /************************************************************************** 1119 1120 * 1120 * internal functions1121 * 1122 * ### 1. section creating pidls ###1121 * internal functions 1122 * 1123 * ### 1. section creating pidls ### 1123 1124 * 1124 1125 ************************************************************************* … … 1127 1128 * _ILCreateMyComputer() 1128 1129 * _ILCreateDrive() 1129 * _ILCreateFolder() 1130 * _ILCreateFolder() 1130 1131 * _ILCreateValue() 1131 1132 */ 1132 1133 LPITEMIDLIST _ILCreateDesktop() 1133 { TRACE("()\n");1134 return _ILCreate(PT_DESKTOP, NULL, 0);1134 { TRACE("()\n"); 1135 return _ILCreate(PT_DESKTOP, NULL, 0); 1135 1136 } 1136 1137 1137 1138 LPITEMIDLIST _ILCreateMyComputer() 1138 { TRACE("()\n");1139 return _ILCreate(PT_MYCOMP, &CLSID_MyComputer, sizeof(GUID));1139 { TRACE("()\n"); 1140 return _ILCreate(PT_MYCOMP, &CLSID_MyComputer, sizeof(GUID)); 1140 1141 } 1141 1142 1142 1143 LPITEMIDLIST _ILCreateIExplore() 1143 { TRACE("()\n");1144 return _ILCreate(PT_MYCOMP, &CLSID_Internet, sizeof(GUID));1144 { TRACE("()\n"); 1145 return _ILCreate(PT_MYCOMP, &CLSID_Internet, sizeof(GUID)); 1145 1146 } 1146 1147 1147 1148 LPITEMIDLIST _ILCreateControl() 1148 { TRACE("()\n");1149 return _ILCreate(PT_SPECIAL, &CLSID_ControlPanel, sizeof(GUID));1149 { TRACE("()\n"); 1150 return _ILCreate(PT_SPECIAL, &CLSID_ControlPanel, sizeof(GUID)); 1150 1151 } 1151 1152 1152 1153 LPITEMIDLIST _ILCreatePrinter() 1153 { TRACE("()\n");1154 return _ILCreate(PT_SPECIAL, &CLSID_Printers, sizeof(GUID));1154 { TRACE("()\n"); 1155 return _ILCreate(PT_SPECIAL, &CLSID_Printers, sizeof(GUID)); 1155 1156 } 1156 1157 1157 1158 LPITEMIDLIST _ILCreateNetwork() 1158 { TRACE("()\n");1159 return _ILCreate(PT_MYCOMP, &CLSID_NetworkPlaces, sizeof(GUID));1159 { TRACE("()\n"); 1160 return _ILCreate(PT_MYCOMP, &CLSID_NetworkPlaces, sizeof(GUID)); 1160 1161 } 1161 1162 1162 1163 LPITEMIDLIST _ILCreateBitBucket() 1163 { TRACE("()\n");1164 return _ILCreate(PT_MYCOMP, &CLSID_RecycleBin, sizeof(GUID));1164 { TRACE("()\n"); 1165 return _ILCreate(PT_MYCOMP, &CLSID_RecycleBin, sizeof(GUID)); 1165 1166 } 1166 1167 1167 1168 LPITEMIDLIST _ILCreateDrive( LPCSTR lpszNew) 1168 { char sTemp[4];1169 lstrcpynA (sTemp,lpszNew,4);1170 sTemp[2]='\\';1171 sTemp[3]=0x00;1172 TRACE("(%s)\n",sTemp);1173 return _ILCreate(PT_DRIVE,(LPVOID)&sTemp[0],4);1169 { char sTemp[4]; 1170 lstrcpynA (sTemp,lpszNew,4); 1171 sTemp[2]='\\'; 1172 sTemp[3]=0x00; 1173 TRACE("(%s)\n",sTemp); 1174 return _ILCreate(PT_DRIVE,(LPVOID)&sTemp[0],4); 1174 1175 } 1175 1176 1176 1177 LPITEMIDLIST _ILCreateFolder( WIN32_FIND_DATAA * stffile ) 1177 1178 { 1178 charbuff[MAX_PATH + 14 +1]; /* see WIN32_FIND_DATA */1179 char *pbuff = buff;1180 ULONGlen, len1;1181 LPITEMIDLIST pidl;1182 1183 TRACE("(%s, %s)\n",stffile->cAlternateFileName, stffile->cFileName);1184 1185 /* prepare buffer with both names */1186 len = strlen (stffile->cFileName) + 1;1187 memcpy (pbuff, stffile->cFileName, len);1188 pbuff += len;1189 1190 if (stffile->cAlternateFileName)1191 {1192 len1 = strlen (stffile->cAlternateFileName)+1;1193 memcpy (pbuff, stffile->cAlternateFileName, len1);1194 }1195 else1196 {1197 len1 = 1;1198 *pbuff = 0x00;1199 }1200 1201 pidl = _ILCreate(PT_FOLDER, (LPVOID)buff, len + len1);1202 1203 /* set attributes */1204 if (pidl)1205 {1206 LPPIDLDATA pData;1207 pData = _ILGetDataPointer(pidl);1208 FileTimeToDosDateTime(&(stffile->ftLastWriteTime),&pData->u.folder.uFileDate,&pData->u.folder.uFileTime);1209 pData->u.folder.dwFileSize = stffile->nFileSizeLow;1210 pData->u.folder.uFileAttribs=stffile->dwFileAttributes;1211 }1212 1213 return pidl;1179 char buff[MAX_PATH + 14 +1]; /* see WIN32_FIND_DATA */ 1180 char * pbuff = buff; 1181 ULONG len, len1; 1182 LPITEMIDLIST pidl; 1183 1184 TRACE("(%s, %s)\n",stffile->cAlternateFileName, stffile->cFileName); 1185 1186 /* prepare buffer with both names */ 1187 len = strlen (stffile->cFileName) + 1; 1188 memcpy (pbuff, stffile->cFileName, len); 1189 pbuff += len; 1190 1191 if (stffile->cAlternateFileName) 1192 { 1193 len1 = strlen (stffile->cAlternateFileName)+1; 1194 memcpy (pbuff, stffile->cAlternateFileName, len1); 1195 } 1196 else 1197 { 1198 len1 = 1; 1199 *pbuff = 0x00; 1200 } 1201 1202 pidl = _ILCreate(PT_FOLDER, (LPVOID)buff, len + len1); 1203 1204 /* set attributes */ 1205 if (pidl) 1206 { 1207 LPPIDLDATA pData; 1208 pData = _ILGetDataPointer(pidl); 1209 FileTimeToDosDateTime(&(stffile->ftLastWriteTime),&pData->u.folder.uFileDate,&pData->u.folder.uFileTime); 1210 pData->u.folder.dwFileSize = stffile->nFileSizeLow; 1211 pData->u.folder.uFileAttribs=stffile->dwFileAttributes; 1212 } 1213 1214 return pidl; 1214 1215 } 1215 1216 1216 1217 LPITEMIDLIST _ILCreateValue(WIN32_FIND_DATAA * stffile) 1217 1218 { 1218 charbuff[MAX_PATH + 14 +1]; /* see WIN32_FIND_DATA */1219 char *pbuff = buff;1220 ULONGlen, len1;1221 LPITEMIDLIST pidl;1222 1223 TRACE("(%s, %s)\n",stffile->cAlternateFileName, stffile->cFileName);1224 1225 /* prepare buffer with both names */1226 len = strlen (stffile->cFileName) + 1;1227 memcpy (pbuff, stffile->cFileName, len);1228 pbuff += len;1229 1230 if (stffile->cAlternateFileName)1231 {1232 len1 = strlen (stffile->cAlternateFileName)+1;1233 memcpy (pbuff, stffile->cAlternateFileName, len1);1234 }1235 else1236 {1237 len1 = 1;1238 *pbuff = 0x00;1239 }1240 1241 pidl = _ILCreate(PT_VALUE, (LPVOID)buff, len + len1);1242 1243 /* set attributes */1244 if (pidl)1245 {1246 LPPIDLDATA pData;1247 pData = _ILGetDataPointer(pidl);1248 FileTimeToDosDateTime(&(stffile->ftLastWriteTime),&pData->u.folder.uFileDate,&pData->u.folder.uFileTime);1249 pData->u.folder.dwFileSize = stffile->nFileSizeLow;1250 pData->u.folder.uFileAttribs=stffile->dwFileAttributes;1251 }1252 1253 return pidl;1219 char buff[MAX_PATH + 14 +1]; /* see WIN32_FIND_DATA */ 1220 char * pbuff = buff; 1221 ULONG len, len1; 1222 LPITEMIDLIST pidl; 1223 1224 TRACE("(%s, %s)\n",stffile->cAlternateFileName, stffile->cFileName); 1225 1226 /* prepare buffer with both names */ 1227 len = strlen (stffile->cFileName) + 1; 1228 memcpy (pbuff, stffile->cFileName, len); 1229 pbuff += len; 1230 1231 if (stffile->cAlternateFileName) 1232 { 1233 len1 = strlen (stffile->cAlternateFileName)+1; 1234 memcpy (pbuff, stffile->cAlternateFileName, len1); 1235 } 1236 else 1237 { 1238 len1 = 1; 1239 *pbuff = 0x00; 1240 } 1241 1242 pidl = _ILCreate(PT_VALUE, (LPVOID)buff, len + len1); 1243 1244 /* set attributes */ 1245 if (pidl) 1246 { 1247 LPPIDLDATA pData; 1248 pData = _ILGetDataPointer(pidl); 1249 FileTimeToDosDateTime(&(stffile->ftLastWriteTime),&pData->u.folder.uFileDate,&pData->u.folder.uFileTime); 1250 pData->u.folder.dwFileSize = stffile->nFileSizeLow; 1251 pData->u.folder.uFileAttribs=stffile->dwFileAttributes; 1252 } 1253 1254 return pidl; 1254 1255 } 1255 1256 … … 1275 1276 LPITEMIDLIST _ILCreate(PIDLTYPE type, LPCVOID pIn, UINT uInSize) 1276 1277 { 1277 LPITEMIDLIST pidlOut = NULL, pidlTemp = NULL;1278 LPPIDLDATA pData;1279 UINT uSize = 0;1280 LPSTRpszDest;1281 1282 TRACE("(0x%02x %p %i)\n",type,pIn,uInSize);1283 1284 switch (type)1285 {1286 case PT_DESKTOP:1287 uSize = 0;1288 break;1289 case PT_SPECIAL:1290 case PT_MYCOMP:1291 uSize = 2 + 2 + sizeof(GUID);1292 break;1293 case PT_DRIVE:1294 uSize = 2 + 23;1295 break;1296 case PT_FOLDER:1297 case PT_VALUE: 1298 uSize = 2 + 12 + uInSize;1299 break;1300 default:1301 FIXME("can't create type: 0x%08x\n",type); 1302 return NULL;1303 }1304 1305 if(!(pidlOut = SHAlloc(uSize + 2))) return NULL;1306 ZeroMemory(pidlOut, uSize + 2);1307 pidlOut->mkid.cb = uSize;1308 1309 switch (type)1310 {1311 case PT_DESKTOP:1312 TRACE("- create Desktop\n");1313 break;1314 1315 case PT_SPECIAL:1316 case PT_MYCOMP:1317 pData =_ILGetDataPointer(pidlOut);1318 pData->type = type;1319 memcpy(&(pData->u.mycomp.guid), pIn, uInSize);1320 TRACE("- create GUID-pidl\n");1321 break;1322 1323 case PT_DRIVE:1324 pData =_ILGetDataPointer(pidlOut);1325 pData->type = type;1326 pszDest = _ILGetTextPointer(pidlOut);1327 memcpy(pszDest, pIn, uInSize);1328 TRACE("- create Drive: %s\n",debugstr_a(pszDest));1329 break;1330 1331 case PT_FOLDER:1332 case PT_VALUE: 1333 pData =_ILGetDataPointer(pidlOut);1334 pData->type = type;1335 pszDest = _ILGetTextPointer(pidlOut);1336 memcpy(pszDest, pIn, uInSize);1337 TRACE("- create Value: %s\n",debugstr_a(pszDest));1338 break;1339 }1340 1341 pidlTemp = ILGetNext(pidlOut);1342 if (pidlTemp)1343 pidlTemp->mkid.cb = 0x00;1344 1345 TRACE("-- (pidl=%p, size=%u)\n", pidlOut, uSize);1346 return pidlOut;1278 LPITEMIDLIST pidlOut = NULL, pidlTemp = NULL; 1279 LPPIDLDATA pData; 1280 UINT uSize = 0; 1281 LPSTR pszDest; 1282 1283 TRACE("(0x%02x %p %i)\n",type,pIn,uInSize); 1284 1285 switch (type) 1286 { 1287 case PT_DESKTOP: 1288 uSize = 0; 1289 break; 1290 case PT_SPECIAL: 1291 case PT_MYCOMP: 1292 uSize = 2 + 2 + sizeof(GUID); 1293 break; 1294 case PT_DRIVE: 1295 uSize = 2 + 23; 1296 break; 1297 case PT_FOLDER: 1298 case PT_VALUE: 1299 uSize = 2 + 12 + uInSize; 1300 break; 1301 default: 1302 FIXME("can't create type: 0x%08x\n",type); 1303 return NULL; 1304 } 1305 1306 if(!(pidlOut = SHAlloc(uSize + 2))) return NULL; 1307 ZeroMemory(pidlOut, uSize + 2); 1308 pidlOut->mkid.cb = uSize; 1309 1310 switch (type) 1311 { 1312 case PT_DESKTOP: 1313 TRACE("- create Desktop\n"); 1314 break; 1315 1316 case PT_SPECIAL: 1317 case PT_MYCOMP: 1318 pData =_ILGetDataPointer(pidlOut); 1319 pData->type = type; 1320 memcpy(&(pData->u.mycomp.guid), pIn, uInSize); 1321 TRACE("- create GUID-pidl\n"); 1322 break; 1323 1324 case PT_DRIVE: 1325 pData =_ILGetDataPointer(pidlOut); 1326 pData->type = type; 1327 pszDest = _ILGetTextPointer(pidlOut); 1328 memcpy(pszDest, pIn, uInSize); 1329 TRACE("- create Drive: %s\n",debugstr_a(pszDest)); 1330 break; 1331 1332 case PT_FOLDER: 1333 case PT_VALUE: 1334 pData =_ILGetDataPointer(pidlOut); 1335 pData->type = type; 1336 pszDest = _ILGetTextPointer(pidlOut); 1337 memcpy(pszDest, pIn, uInSize); 1338 TRACE("- create Value: %s\n",debugstr_a(pszDest)); 1339 break; 1340 } 1341 1342 pidlTemp = ILGetNext(pidlOut); 1343 if (pidlTemp) 1344 pidlTemp->mkid.cb = 0x00; 1345 1346 TRACE("-- (pidl=%p, size=%u)\n", pidlOut, uSize); 1347 return pidlOut; 1347 1348 } 1348 1349 … … 1356 1357 */ 1357 1358 DWORD _ILGetDrive(LPCITEMIDLIST pidl,LPSTR pOut, UINT uSize) 1358 { TRACE("(%p,%p,%u)\n",pidl,pOut,uSize);1359 1360 if(_ILIsMyComputer(pidl))1361 pidl = ILGetNext(pidl);1362 1363 if (pidl && _ILIsDrive(pidl))1364 return _ILSimpleGetText(pidl, pOut, uSize);1365 1366 return 0;1359 { TRACE("(%p,%p,%u)\n",pidl,pOut,uSize); 1360 1361 if(_ILIsMyComputer(pidl)) 1362 pidl = ILGetNext(pidl); 1363 1364 if (pidl && _ILIsDrive(pidl)) 1365 return _ILSimpleGetText(pidl, pOut, uSize); 1366 1367 return 0; 1367 1368 } 1368 1369 1369 1370 /************************************************************************** 1370 1371 * 1371 * ### 2. section testing pidls ###1372 * ### 2. section testing pidls ### 1372 1373 * 1373 1374 ************************************************************************** … … 1381 1382 */ 1382 1383 BOOL _ILIsDesktop(LPCITEMIDLIST pidl) 1383 { TRACE("(%p)\n",pidl);1384 return ( !pidl || (pidl && pidl->mkid.cb == 0x00) );1384 { TRACE("(%p)\n",pidl); 1385 return ( !pidl || (pidl && pidl->mkid.cb == 0x00) ); 1385 1386 } 1386 1387 1387 1388 BOOL _ILIsMyComputer(LPCITEMIDLIST pidl) 1388 1389 { 1389 REFIID iid = _ILGetGUIDPointer(pidl);1390 1391 TRACE("(%p)\n",pidl);1392 1393 if (iid)1394 return IsEqualIID(iid, &CLSID_MyComputer);1395 return FALSE;1390 REFIID iid = _ILGetGUIDPointer(pidl); 1391 1392 TRACE("(%p)\n",pidl); 1393 1394 if (iid) 1395 return IsEqualIID(iid, &CLSID_MyComputer); 1396 return FALSE; 1396 1397 } 1397 1398 1398 1399 BOOL _ILIsSpecialFolder (LPCITEMIDLIST pidl) 1399 1400 { 1400 LPPIDLDATA lpPData = _ILGetDataPointer(pidl);1401 TRACE("(%p)\n",pidl);1402 return (pidl && ( (lpPData && (PT_MYCOMP== lpPData->type || PT_SPECIAL== lpPData->type)) || 1403 (pidl && pidl->mkid.cb == 0x00)1404 ));1401 LPPIDLDATA lpPData = _ILGetDataPointer(pidl); 1402 TRACE("(%p)\n",pidl); 1403 return (pidl && ( (lpPData && (PT_MYCOMP== lpPData->type || PT_SPECIAL== lpPData->type)) || 1404 (pidl && pidl->mkid.cb == 0x00) 1405 )); 1405 1406 } 1406 1407 1407 1408 BOOL _ILIsDrive(LPCITEMIDLIST pidl) 1408 { LPPIDLDATA lpPData = _ILGetDataPointer(pidl);1409 TRACE("(%p)\n",pidl);1410 return (pidl && lpPData && (PT_DRIVE == lpPData->type ||1411 PT_DRIVE1 == lpPData->type ||1412 PT_DRIVE2 == lpPData->type ||1413 PT_DRIVE3 == lpPData->type));1409 { LPPIDLDATA lpPData = _ILGetDataPointer(pidl); 1410 TRACE("(%p)\n",pidl); 1411 return (pidl && lpPData && (PT_DRIVE == lpPData->type || 1412 PT_DRIVE1 == lpPData->type || 1413 PT_DRIVE2 == lpPData->type || 1414 PT_DRIVE3 == lpPData->type)); 1414 1415 } 1415 1416 1416 1417 BOOL _ILIsFolder(LPCITEMIDLIST pidl) 1417 { LPPIDLDATA lpPData = _ILGetDataPointer(pidl);1418 TRACE("(%p)\n",pidl);1419 return (pidl && lpPData && (PT_FOLDER == lpPData->type || PT_FOLDER1 == lpPData->type));1418 { LPPIDLDATA lpPData = _ILGetDataPointer(pidl); 1419 TRACE("(%p)\n",pidl); 1420 return (pidl && lpPData && (PT_FOLDER == lpPData->type || PT_FOLDER1 == lpPData->type)); 1420 1421 } 1421 1422 1422 1423 BOOL _ILIsValue(LPCITEMIDLIST pidl) 1423 { LPPIDLDATA lpPData = _ILGetDataPointer(pidl);1424 TRACE("(%p)\n",pidl);1425 return (pidl && lpPData && PT_VALUE == lpPData->type);1424 { LPPIDLDATA lpPData = _ILGetDataPointer(pidl); 1425 TRACE("(%p)\n",pidl); 1426 return (pidl && lpPData && PT_VALUE == lpPData->type); 1426 1427 } 1427 1428 1428 1429 /************************************************************************** 1429 * _ILIsPidlSimple1430 * _ILIsPidlSimple 1430 1431 */ 1431 1432 BOOL _ILIsPidlSimple ( LPCITEMIDLIST pidl) 1432 1433 { 1433 BOOL ret = TRUE;1434 1435 if(! _ILIsDesktop(pidl))/* pidl=NULL or mkid.cb=0 */1436 {1437 WORD len = pidl->mkid.cb;1438 LPCITEMIDLIST pidlnext = (LPCITEMIDLIST) (((LPBYTE)pidl) + len );1439 if (pidlnext->mkid.cb)1440 ret = FALSE;1441 }1442 1443 TRACE("%s\n", ret ? "Yes" : "No");1444 return ret;1434 BOOL ret = TRUE; 1435 1436 if(! _ILIsDesktop(pidl)) /* pidl=NULL or mkid.cb=0 */ 1437 { 1438 WORD len = pidl->mkid.cb; 1439 LPCITEMIDLIST pidlnext = (LPCITEMIDLIST) (((LPBYTE)pidl) + len ); 1440 if (pidlnext->mkid.cb) 1441 ret = FALSE; 1442 } 1443 1444 TRACE("%s\n", ret ? "Yes" : "No"); 1445 return ret; 1445 1446 } 1446 1447 1447 1448 /************************************************************************** 1448 1449 * 1449 * ### 3. section getting values from pidls ###1450 * ### 3. section getting values from pidls ### 1450 1451 */ 1451 1452 … … 1459 1460 DWORD _ILSimpleGetText (LPCITEMIDLIST pidl, LPSTR szOut, UINT uOutSize) 1460 1461 { 1461 DWORD dwReturn=0; 1462 LPSTRszSrc;1463 GUID const *riid;1464 char szTemp[MAX_PATH];1465 1466 TRACE("(%p %p %x)\n",pidl,szOut,uOutSize);1467 1468 if (!pidl) return 0;1469 1470 if (szOut)1471 *szOut = 0;1472 1473 if (_ILIsDesktop(pidl)) 1474 {1475 /* desktop */1476 if (HCR_GetClassName(&CLSID_ShellDesktop, szTemp, MAX_PATH))1477 {1478 if (szOut)1479 lstrcpynA(szOut, szTemp, uOutSize);1480 1481 dwReturn = strlen (szTemp);1482 }1483 }1484 else if (( szSrc = _ILGetTextPointer(pidl) ))1485 {1486 /* filesystem */1487 if (szOut)1488 lstrcpynA(szOut, szSrc, uOutSize);1489 1490 dwReturn = strlen(szSrc);1491 }1492 else if (( riid = _ILGetGUIDPointer(pidl) ))1493 {1494 /* special folder */1495 if ( HCR_GetClassName(riid, szTemp, MAX_PATH) )1496 {1497 if (szOut)1498 lstrcpynA(szOut, szTemp, uOutSize);1499 1500 dwReturn = strlen (szTemp);1501 }1502 }1503 else1504 {1505 ERR("-- no text\n");1506 }1507 1508 TRACE("-- (%p=%s 0x%08lx)\n",szOut,(char*)szOut,dwReturn);1509 return dwReturn;1462 DWORD dwReturn=0; 1463 LPSTR szSrc; 1464 GUID const * riid; 1465 char szTemp[MAX_PATH]; 1466 1467 TRACE("(%p %p %x)\n",pidl,szOut,uOutSize); 1468 1469 if (!pidl) return 0; 1470 1471 if (szOut) 1472 *szOut = 0; 1473 1474 if (_ILIsDesktop(pidl)) 1475 { 1476 /* desktop */ 1477 if (HCR_GetClassName(&CLSID_ShellDesktop, szTemp, MAX_PATH)) 1478 { 1479 if (szOut) 1480 lstrcpynA(szOut, szTemp, uOutSize); 1481 1482 dwReturn = strlen (szTemp); 1483 } 1484 } 1485 else if (( szSrc = _ILGetTextPointer(pidl) )) 1486 { 1487 /* filesystem */ 1488 if (szOut) 1489 lstrcpynA(szOut, szSrc, uOutSize); 1490 1491 dwReturn = strlen(szSrc); 1492 } 1493 else if (( riid = _ILGetGUIDPointer(pidl) )) 1494 { 1495 /* special folder */ 1496 if ( HCR_GetClassName(riid, szTemp, MAX_PATH) ) 1497 { 1498 if (szOut) 1499 lstrcpynA(szOut, szTemp, uOutSize); 1500 1501 dwReturn = strlen (szTemp); 1502 } 1503 } 1504 else 1505 { 1506 ERR("-- no text\n"); 1507 } 1508 1509 TRACE("-- (%p=%s 0x%08lx)\n",szOut,(char*)szOut,dwReturn); 1510 return dwReturn; 1510 1511 } 1511 1512 1512 1513 /************************************************************************** 1513 1514 * 1514 * ### 4. getting pointers to parts of pidls ###1515 * ### 4. getting pointers to parts of pidls ### 1515 1516 * 1516 1517 ************************************************************************** … … 1519 1520 LPPIDLDATA _ILGetDataPointer(LPITEMIDLIST pidl) 1520 1521 { 1521 if(pidl && pidl->mkid.cb != 0x00)1522 return (LPPIDLDATA) &(pidl->mkid.abID);1523 return NULL;1522 if(pidl && pidl->mkid.cb != 0x00) 1523 return (LPPIDLDATA) &(pidl->mkid.abID); 1524 return NULL; 1524 1525 } 1525 1526 … … 1529 1530 */ 1530 1531 LPSTR _ILGetTextPointer(LPCITEMIDLIST pidl) 1531 {/* TRACE(pidl,"(pidl%p)\n", pidl);*/1532 1533 LPPIDLDATA pdata =_ILGetDataPointer(pidl);1534 1535 if (pdata)1536 {1537 switch (pdata->type)1538 {1539 case PT_MYCOMP:1540 case PT_SPECIAL:1541 return NULL;1542 1543 case PT_DRIVE:1544 case PT_DRIVE1:1545 case PT_DRIVE2:1546 case PT_DRIVE3:1547 return (LPSTR)&(pdata->u.drive.szDriveName);1548 1549 case PT_FOLDER:1550 case PT_FOLDER1:1551 case PT_VALUE:1552 case PT_IESPECIAL1:1553 case PT_IESPECIAL2:1554 return (LPSTR)&(pdata->u.file.szNames);1555 1556 case PT_WORKGRP:1557 case PT_COMP:1558 case PT_NETWORK:1559 case PT_SHARE:1560 return (LPSTR)&(pdata->u.network.szNames);1561 }1562 }1563 return NULL;1532 {/* TRACE(pidl,"(pidl%p)\n", pidl);*/ 1533 1534 LPPIDLDATA pdata =_ILGetDataPointer(pidl); 1535 1536 if (pdata) 1537 { 1538 switch (pdata->type) 1539 { 1540 case PT_MYCOMP: 1541 case PT_SPECIAL: 1542 return NULL; 1543 1544 case PT_DRIVE: 1545 case PT_DRIVE1: 1546 case PT_DRIVE2: 1547 case PT_DRIVE3: 1548 return (LPSTR)&(pdata->u.drive.szDriveName); 1549 1550 case PT_FOLDER: 1551 case PT_FOLDER1: 1552 case PT_VALUE: 1553 case PT_IESPECIAL1: 1554 case PT_IESPECIAL2: 1555 return (LPSTR)&(pdata->u.file.szNames); 1556 1557 case PT_WORKGRP: 1558 case PT_COMP: 1559 case PT_NETWORK: 1560 case PT_SHARE: 1561 return (LPSTR)&(pdata->u.network.szNames); 1562 } 1563 } 1564 return NULL; 1564 1565 } 1565 1566 … … 1569 1570 */ 1570 1571 LPSTR _ILGetSTextPointer(LPCITEMIDLIST pidl) 1571 {/* TRACE(pidl,"(pidl%p)\n", pidl);*/1572 1573 LPPIDLDATA pdata =_ILGetDataPointer(pidl);1574 1575 if (pdata)1576 {1577 switch (pdata->type)1578 {1579 case PT_FOLDER:1580 case PT_VALUE:1581 case PT_IESPECIAL1:1582 case PT_IESPECIAL2:1583 return (LPSTR)(pdata->u.file.szNames + strlen (pdata->u.file.szNames) + 1);1584 1585 case PT_WORKGRP:1586 return (LPSTR)(pdata->u.network.szNames + strlen (pdata->u.network.szNames) + 1);1587 }1588 }1589 return NULL;1572 {/* TRACE(pidl,"(pidl%p)\n", pidl);*/ 1573 1574 LPPIDLDATA pdata =_ILGetDataPointer(pidl); 1575 1576 if (pdata) 1577 { 1578 switch (pdata->type) 1579 { 1580 case PT_FOLDER: 1581 case PT_VALUE: 1582 case PT_IESPECIAL1: 1583 case PT_IESPECIAL2: 1584 return (LPSTR)(pdata->u.file.szNames + strlen (pdata->u.file.szNames) + 1); 1585 1586 case PT_WORKGRP: 1587 return (LPSTR)(pdata->u.network.szNames + strlen (pdata->u.network.szNames) + 1); 1588 } 1589 } 1590 return NULL; 1590 1591 } 1591 1592 … … 1597 1598 REFIID _ILGetGUIDPointer(LPCITEMIDLIST pidl) 1598 1599 { 1599 LPPIDLDATA pdata =_ILGetDataPointer(pidl);1600 1601 if (pdata)1602 {1603 switch (pdata->type)1604 {1605 case PT_SPECIAL:1606 case PT_MYCOMP:1607 return (REFIID) &(pdata->u.mycomp.guid);1608 }1609 }1610 return NULL;1600 LPPIDLDATA pdata =_ILGetDataPointer(pidl); 1601 1602 if (pdata) 1603 { 1604 switch (pdata->type) 1605 { 1606 case PT_SPECIAL: 1607 case PT_MYCOMP: 1608 return (REFIID) &(pdata->u.mycomp.guid); 1609 } 1610 } 1611 return NULL; 1611 1612 } 1612 1613 … … 1624 1625 * 1625 1626 * NOTES 1626 * 1627 * 1627 1628 */ 1628 1629 BOOL _ILGetFileDateTime(LPCITEMIDLIST pidl, FILETIME *pFt) … … 1633 1634 1634 1635 switch (pdata->type) 1635 { 1636 { 1636 1637 case PT_FOLDER: 1637 1638 DosDateTimeToFileTime(pdata->u.folder.uFileDate, pdata->u.folder.uFileTime, pFt); 1638 break; 1639 break; 1639 1640 case PT_VALUE: 1640 1641 DosDateTimeToFileTime(pdata->u.file.uFileDate, pdata->u.file.uFileTime, pFt); … … 1647 1648 1648 1649 BOOL _ILGetFileDate (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize) 1649 { 1650 FILETIME ft,lft;1651 SYSTEMTIME time;1652 1653 if (! _ILGetFileDateTime( pidl, &ft )) return FALSE;1654 1655 FileTimeToLocalFileTime(&ft, &lft);1656 FileTimeToSystemTime (&lft, &time);1657 return GetDateFormatA(LOCALE_USER_DEFAULT,DATE_SHORTDATE,&time, NULL, pOut, uOutSize);1650 { 1651 FILETIME ft,lft; 1652 SYSTEMTIME time; 1653 1654 if (! _ILGetFileDateTime( pidl, &ft )) return FALSE; 1655 1656 FileTimeToLocalFileTime(&ft, &lft); 1657 FileTimeToSystemTime (&lft, &time); 1658 return GetDateFormatA(LOCALE_USER_DEFAULT,DATE_SHORTDATE,&time, NULL, pOut, uOutSize); 1658 1659 } 1659 1660 … … 1665 1666 * PARAMS 1666 1667 * pidl [I] The ItemIDList 1667 * pOut[I] The buffer to save the result1668 * pOut [I] The buffer to save the result 1668 1669 * uOutsize [I] The size of the buffer 1669 1670 * … … 1672 1673 * 1673 1674 * NOTES 1674 * pOut can be null when no string is needed1675 * 1675 * pOut can be null when no string is needed 1676 * 1676 1677 */ 1677 1678 DWORD _ILGetFileSize (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize) 1678 1679 { 1679 LPPIDLDATA pdata =_ILGetDataPointer(pidl);1680 DWORD dwSize;1681 1682 if(! pdata) return 0;1683 1684 switch (pdata->type)1685 {1686 case PT_VALUE:1687 dwSize = pdata->u.file.dwFileSize;1688 if (pOut) StrFormatByteSizeA(dwSize, pOut, uOutSize);1689 return dwSize;1690 }1691 if (pOut) *pOut = 0x00;1692 return 0;1680 LPPIDLDATA pdata =_ILGetDataPointer(pidl); 1681 DWORD dwSize; 1682 1683 if(! pdata) return 0; 1684 1685 switch (pdata->type) 1686 { 1687 case PT_VALUE: 1688 dwSize = pdata->u.file.dwFileSize; 1689 if (pOut) StrFormatByteSizeA(dwSize, pOut, uOutSize); 1690 return dwSize; 1691 } 1692 if (pOut) *pOut = 0x00; 1693 return 0; 1693 1694 } 1694 1695 1695 1696 BOOL _ILGetExtension (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize) 1696 1697 { 1697 char szTemp[MAX_PATH];1698 const char * pPoint;1699 LPITEMIDLIST pidlTemp=pidl;1700 1701 TRACE("pidl=%p\n",pidl);1702 1703 if (!pidl) return FALSE;1704 1705 pidlTemp = ILFindLastID(pidl);1706 1707 if (!_ILIsValue(pidlTemp)) return FALSE;1708 if (!_ILSimpleGetText(pidlTemp, szTemp, MAX_PATH)) return FALSE;1709 1710 pPoint = PathFindExtensionA(szTemp);1711 1712 if (! *pPoint) return FALSE;1713 1714 pPoint++;1715 lstrcpynA(pOut, pPoint, uOutSize);1716 TRACE("%s\n",pOut);1717 1718 return TRUE;1698 char szTemp[MAX_PATH]; 1699 const char * pPoint; 1700 LPITEMIDLIST pidlTemp=pidl; 1701 1702 TRACE("pidl=%p\n",pidl); 1703 1704 if (!pidl) return FALSE; 1705 1706 pidlTemp = ILFindLastID(pidl); 1707 1708 if (!_ILIsValue(pidlTemp)) return FALSE; 1709 if (!_ILSimpleGetText(pidlTemp, szTemp, MAX_PATH)) return FALSE; 1710 1711 pPoint = PathFindExtensionA(szTemp); 1712 1713 if (! *pPoint) return FALSE; 1714 1715 pPoint++; 1716 lstrcpynA(pOut, pPoint, uOutSize); 1717 TRACE("%s\n",pOut); 1718 1719 return TRUE; 1719 1720 } 1720 1721 … … 1730 1731 * 1731 1732 * RETURNS 1732 * nothing1733 * 1734 * NOTES 1735 * This function copies as much as possible into the buffer.1733 * nothing 1734 * 1735 * NOTES 1736 * This function copies as much as possible into the buffer. 1736 1737 */ 1737 1738 void _ILGetFileType(LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize) 1738 1739 { 1739 if(_ILIsValue(pidl))1740 {1741 char sTemp[64];1740 if(_ILIsValue(pidl)) 1741 { 1742 char sTemp[64]; 1742 1743 if(uOutSize > 0) 1743 1744 { 1744 1745 pOut[0] = 0; 1745 1746 } 1746 if (_ILGetExtension (pidl, sTemp, 64))1747 {1748 if (!( HCR_MapTypeToValue(sTemp, sTemp, 64, TRUE)1749 && HCR_MapTypeToValue(sTemp, pOut, uOutSize, FALSE )))1750 {1751 lstrcpynA (pOut, sTemp, uOutSize - 6);1752 strcat (pOut, "-file");1753 }1754 }1755 }1756 else1757 {1758 lstrcpynA(pOut, "Folder", uOutSize);1759 }1747 if (_ILGetExtension (pidl, sTemp, 64)) 1748 { 1749 if (!( HCR_MapTypeToValue(sTemp, sTemp, 64, TRUE) 1750 && HCR_MapTypeToValue(sTemp, pOut, uOutSize, FALSE ))) 1751 { 1752 lstrcpynA (pOut, sTemp, uOutSize - 6); 1753 strcat (pOut, "-file"); 1754 } 1755 } 1756 } 1757 else 1758 { 1759 lstrcpynA(pOut, "Folder", uOutSize); 1760 } 1760 1761 } 1761 1762 … … 1775 1776 * FIXME 1776 1777 * return value 0 in case of error is a valid return value 1777 * 1778 * 1778 1779 */ 1779 1780 DWORD _ILGetFileAttributes(LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize) 1780 1781 { 1781 LPPIDLDATA pData =_ILGetDataPointer(pidl);1782 WORD wAttrib = 0;1783 int i;1784 1785 if(! pData) return 0;1786 1787 switch(pData->type)1788 {1789 case PT_FOLDER:1790 wAttrib = pData->u.folder.uFileAttribs;1791 break;1792 case PT_VALUE:1793 wAttrib = pData->u.file.uFileAttribs;1794 break;1795 }1796 1797 if(uOutSize >= 6)1798 {1799 i=0;1800 if(wAttrib & FILE_ATTRIBUTE_READONLY)1801 {1802 pOut[i++] = 'R';1803 }1804 if(wAttrib & FILE_ATTRIBUTE_HIDDEN)1805 {1806 pOut[i++] = 'H';1807 }1808 if(wAttrib & FILE_ATTRIBUTE_SYSTEM)1809 {1810 pOut[i++] = 'S';1811 }1812 if(wAttrib & FILE_ATTRIBUTE_ARCHIVE)1813 {1814 pOut[i++] = 'A';1815 }1816 if(wAttrib & FILE_ATTRIBUTE_COMPRESSED)1817 {1818 pOut[i++] = 'C';1819 }1820 pOut[i] = 0x00;1821 }1822 return wAttrib;1782 LPPIDLDATA pData =_ILGetDataPointer(pidl); 1783 WORD wAttrib = 0; 1784 int i; 1785 1786 if(! pData) return 0; 1787 1788 switch(pData->type) 1789 { 1790 case PT_FOLDER: 1791 wAttrib = pData->u.folder.uFileAttribs; 1792 break; 1793 case PT_VALUE: 1794 wAttrib = pData->u.file.uFileAttribs; 1795 break; 1796 } 1797 1798 if(uOutSize >= 6) 1799 { 1800 i=0; 1801 if(wAttrib & FILE_ATTRIBUTE_READONLY) 1802 { 1803 pOut[i++] = 'R'; 1804 } 1805 if(wAttrib & FILE_ATTRIBUTE_HIDDEN) 1806 { 1807 pOut[i++] = 'H'; 1808 } 1809 if(wAttrib & FILE_ATTRIBUTE_SYSTEM) 1810 { 1811 pOut[i++] = 'S'; 1812 } 1813 if(wAttrib & FILE_ATTRIBUTE_ARCHIVE) 1814 { 1815 pOut[i++] = 'A'; 1816 } 1817 if(wAttrib & FILE_ATTRIBUTE_COMPRESSED) 1818 { 1819 pOut[i++] = 'C'; 1820 } 1821 pOut[i] = 0x00; 1822 } 1823 return wAttrib; 1823 1824 } 1824 1825 … … 1830 1831 void _ILFreeaPidl(LPITEMIDLIST * apidl, UINT cidl) 1831 1832 { 1832 int i;1833 1834 if(apidl)1835 {1836 for(i = 0; i < cidl; i++) SHFree(apidl[i]);1837 SHFree(apidl);1838 }1833 int i; 1834 1835 if(apidl) 1836 { 1837 for(i = 0; i < cidl; i++) SHFree(apidl[i]); 1838 SHFree(apidl); 1839 } 1839 1840 } 1840 1841 … … 1846 1847 LPITEMIDLIST * _ILCopyaPidl(LPITEMIDLIST * apidlsrc, UINT cidl) 1847 1848 { 1848 int i;1849 LPITEMIDLIST * apidldest = (LPITEMIDLIST*)SHAlloc(cidl * sizeof(LPITEMIDLIST));1850 if(!apidlsrc) return NULL;1851 1852 for(i = 0; i < cidl; i++)1853 apidldest[i] = ILClone(apidlsrc[i]);1854 1855 return apidldest;1849 int i; 1850 LPITEMIDLIST * apidldest = (LPITEMIDLIST*)SHAlloc(cidl * sizeof(LPITEMIDLIST)); 1851 if(!apidlsrc) return NULL; 1852 1853 for(i = 0; i < cidl; i++) 1854 apidldest[i] = ILClone(apidlsrc[i]); 1855 1856 return apidldest; 1856 1857 } 1857 1858 … … 1863 1864 LPITEMIDLIST * _ILCopyCidaToaPidl(LPITEMIDLIST* pidl, LPCIDA cida) 1864 1865 { 1865 int i;1866 LPITEMIDLIST * dst = (LPITEMIDLIST*)SHAlloc(cida->cidl * sizeof(LPITEMIDLIST));1867 1868 if(!dst) return NULL;1869 1870 if (pidl)1871 *pidl = ILClone((LPITEMIDLIST)(&((LPBYTE)cida)[cida->aoffset[0]]));1872 1873 for(i = 0; i < cida->cidl; i++)1874 dst[i] = ILClone((LPITEMIDLIST)(&((LPBYTE)cida)[cida->aoffset[i + 1]]));1875 1876 return dst;1877 } 1866 int i; 1867 LPITEMIDLIST * dst = (LPITEMIDLIST*)SHAlloc(cida->cidl * sizeof(LPITEMIDLIST)); 1868 1869 if(!dst) return NULL; 1870 1871 if (pidl) 1872 *pidl = ILClone((LPITEMIDLIST)(&((LPBYTE)cida)[cida->aoffset[0]])); 1873 1874 for(i = 0; i < cida->cidl; i++) 1875 dst[i] = ILClone((LPITEMIDLIST)(&((LPBYTE)cida)[cida->aoffset[i + 1]])); 1876 1877 return dst; 1878 } -
trunk/src/shell32/shelllink.c
r6502 r6650 1 /* $Id: shelllink.c,v 1.8 2001-09-05 13:46:57 bird Exp $ */ 1 2 /* 2 3 * 3 * Copyright 1997Marcus Meissner4 * Copyright 1998Juergen Schmied4 * Copyright 1997 Marcus Meissner 5 * Copyright 1998 Juergen Schmied 5 6 * 6 7 */ … … 57 58 58 59 /* flag1: lnk elements: simple link has 0x0B */ 59 #define WORKDIR0x1060 #define ARGUMENT0x2061 #define ICON0x4062 #define UNC 0x8060 #define WORKDIR 0x10 61 #define ARGUMENT 0x20 62 #define ICON 0x40 63 #define UNC 0x80 63 64 64 65 /* fStartup */ 65 #define NORMAL0x0166 #define MAXIMIZED0x0367 #define MINIMIZED0x0768 69 typedef struct _LINK_HEADER 70 { DWORD MagicStr;/* 0x00 'L','\0','\0','\0' */71 GUID MagicGuid;/* 0x04 is CLSID_ShellLink */72 DWORD Flag1;/* 0x14 describes elements following */73 DWORD Flag2;/* 0x18 */74 FILETIME Time1;/* 0x1c */75 FILETIME Time2;/* 0x24 */76 FILETIME Time3;/* 0x2c */77 DWORD Unknown1;/* 0x34 */78 DWORD Unknown2;/* 0x38 icon number */79 DWORD fStartup;/* 0x3c startup type */80 DWORD wHotKey;/* 0x40 hotkey */81 DWORD Unknown5;/* 0x44 */82 DWORD Unknown6;/* 0x48 */83 USHORT PidlSize;/* 0x4c */84 ITEMIDLIST Pidl;/* 0x4e */66 #define NORMAL 0x01 67 #define MAXIMIZED 0x03 68 #define MINIMIZED 0x07 69 70 typedef struct _LINK_HEADER 71 { DWORD MagicStr; /* 0x00 'L','\0','\0','\0' */ 72 GUID MagicGuid; /* 0x04 is CLSID_ShellLink */ 73 DWORD Flag1; /* 0x14 describes elements following */ 74 DWORD Flag2; /* 0x18 */ 75 FILETIME Time1; /* 0x1c */ 76 FILETIME Time2; /* 0x24 */ 77 FILETIME Time3; /* 0x2c */ 78 DWORD Unknown1; /* 0x34 */ 79 DWORD Unknown2; /* 0x38 icon number */ 80 DWORD fStartup; /* 0x3c startup type */ 81 DWORD wHotKey; /* 0x40 hotkey */ 82 DWORD Unknown5; /* 0x44 */ 83 DWORD Unknown6; /* 0x48 */ 84 USHORT PidlSize; /* 0x4c */ 85 ITEMIDLIST Pidl; /* 0x4e */ 85 86 } LINK_HEADER, * PLINK_HEADER; 86 87 … … 89 90 typedef struct 90 91 { 91 BYTE bWidth;92 BYTE bHeight;93 BYTE bColorCount;94 BYTE bReserved;95 WORD wPlanes;96 WORD wBitCount;97 DWORD dwBytesInRes;98 WORD nID;92 BYTE bWidth; 93 BYTE bHeight; 94 BYTE bColorCount; 95 BYTE bReserved; 96 WORD wPlanes; 97 WORD wBitCount; 98 DWORD dwBytesInRes; 99 WORD nID; 99 100 } GRPICONDIRENTRY; 100 101 101 102 typedef struct 102 103 { 103 WORD idReserved;104 WORD idType;105 WORD idCount;106 GRPICONDIRENTRY idEntries[1];104 WORD idReserved; 105 WORD idType; 106 WORD idCount; 107 GRPICONDIRENTRY idEntries[1]; 107 108 } GRPICONDIR; 108 109 109 110 typedef struct 110 111 { 111 BYTE bWidth;112 BYTE bHeight;113 BYTE bColorCount;114 BYTE bReserved;115 WORD wPlanes;116 WORD wBitCount;117 DWORD dwBytesInRes;118 DWORD dwImageOffset;112 BYTE bWidth; 113 BYTE bHeight; 114 BYTE bColorCount; 115 BYTE bReserved; 116 WORD wPlanes; 117 WORD wBitCount; 118 DWORD dwBytesInRes; 119 DWORD dwImageOffset; 119 120 } ICONDIRENTRY; 120 121 121 122 typedef struct 122 123 { 123 WORD idReserved;124 WORD idType;125 WORD idCount;124 WORD idReserved; 125 WORD idType; 126 WORD idCount; 126 127 } ICONDIR; 127 128 … … 130 131 131 132 132 static ICOM_VTABLE(IShellLinkA) slvt;133 static ICOM_VTABLE(IShellLinkW) slvtw;134 static ICOM_VTABLE(IPersistFile) pfvt;135 static ICOM_VTABLE(IPersistStream) psvt;133 static ICOM_VTABLE(IShellLinkA) slvt; 134 static ICOM_VTABLE(IShellLinkW) slvtw; 135 static ICOM_VTABLE(IPersistFile) pfvt; 136 static ICOM_VTABLE(IPersistStream) psvt; 136 137 137 138 /* IShellLink Implementation */ … … 139 140 typedef struct 140 141 { 141 ICOM_VFIELD(IShellLinkA);142 DWORDref;143 144 ICOM_VTABLE(IShellLinkW)*lpvtblw;145 ICOM_VTABLE(IPersistFile)*lpvtblPersistFile;146 ICOM_VTABLE(IPersistStream)*lpvtblPersistStream;147 148 /* internal stream of the IPersistFile interface */149 IStream*lpFileStream;150 151 /* data structures according to the informations in the lnk */152 LPSTRsPath;153 LPITEMIDLISTpPidl;154 WORDwHotKey;155 SYSTEMTIMEtime1;156 SYSTEMTIMEtime2;157 SYSTEMTIMEtime3;158 159 LPSTRsIcoPath;160 INTiIcoNdx;161 LPSTRsArgs;162 LPSTRsWorkDir;163 LPSTRsDescription;142 ICOM_VFIELD(IShellLinkA); 143 DWORD ref; 144 145 ICOM_VTABLE(IShellLinkW)* lpvtblw; 146 ICOM_VTABLE(IPersistFile)* lpvtblPersistFile; 147 ICOM_VTABLE(IPersistStream)* lpvtblPersistStream; 148 149 /* internal stream of the IPersistFile interface */ 150 IStream* lpFileStream; 151 152 /* data structures according to the informations in the lnk */ 153 LPSTR sPath; 154 LPITEMIDLIST pPidl; 155 WORD wHotKey; 156 SYSTEMTIME time1; 157 SYSTEMTIME time2; 158 SYSTEMTIME time3; 159 160 LPSTR sIcoPath; 161 INT iIcoNdx; 162 LPSTR sArgs; 163 LPSTR sWorkDir; 164 LPSTR sDescription; 164 165 } IShellLinkImpl; 165 166 … … 178 179 */ 179 180 static HRESULT WINAPI IPersistFile_fnQueryInterface( 180 IPersistFile* iface,181 REFIID riid,182 LPVOID *ppvObj)183 { 184 _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface)185 186 TRACE("(%p)\n",This);187 188 return IShellLinkA_QueryInterface((IShellLinkA*)This, riid, ppvObj);181 IPersistFile* iface, 182 REFIID riid, 183 LPVOID *ppvObj) 184 { 185 _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface) 186 187 TRACE("(%p)\n",This); 188 189 return IShellLinkA_QueryInterface((IShellLinkA*)This, riid, ppvObj); 189 190 } 190 191 … … 194 195 static ULONG WINAPI IPersistFile_fnAddRef(IPersistFile* iface) 195 196 { 196 _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface)197 198 TRACE("(%p)->(count=%lu)\n",This,This->ref);199 200 return IShellLinkA_AddRef((IShellLinkA*)This);197 _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface) 198 199 TRACE("(%p)->(count=%lu)\n",This,This->ref); 200 201 return IShellLinkA_AddRef((IShellLinkA*)This); 201 202 } 202 203 /****************************************************************************** … … 205 206 static ULONG WINAPI IPersistFile_fnRelease(IPersistFile* iface) 206 207 { 207 _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface)208 209 TRACE("(%p)->(count=%lu)\n",This,This->ref);210 211 return IShellLinkA_Release((IShellLinkA*)This);208 _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface) 209 210 TRACE("(%p)->(count=%lu)\n",This,This->ref); 211 212 return IShellLinkA_Release((IShellLinkA*)This); 212 213 } 213 214 214 215 static HRESULT WINAPI IPersistFile_fnGetClassID(IPersistFile* iface, CLSID *pClassID) 215 216 { 216 _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface)217 FIXME("(%p)\n",This);218 return NOERROR;217 _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface) 218 FIXME("(%p)\n",This); 219 return NOERROR; 219 220 } 220 221 static HRESULT WINAPI IPersistFile_fnIsDirty(IPersistFile* iface) 221 222 { 222 _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface)223 FIXME("(%p)\n",This);224 return NOERROR;223 _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface) 224 FIXME("(%p)\n",This); 225 return NOERROR; 225 226 } 226 227 static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile* iface, LPCOLESTR pszFileName, DWORD dwMode) 227 228 { 228 _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface)229 _IPersistStream_From_ICOM_THIS(IPersistStream, This)230 231 LPSTRsFile = HEAP_strdupWtoA ( GetProcessHeap(), 0, pszFileName);232 HRESULThRet = E_FAIL;233 234 TRACE("(%p, %s)\n",This, sFile);235 236 237 if (This->lpFileStream)238 IStream_Release(This->lpFileStream);239 240 if SUCCEEDED(CreateStreamOnFile(sFile, &(This->lpFileStream)))241 {242 if SUCCEEDED (IPersistStream_Load(StreamThis, This->lpFileStream))243 {244 return NOERROR;245 }246 }247 248 return hRet;229 _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface) 230 _IPersistStream_From_ICOM_THIS(IPersistStream, This) 231 232 LPSTR sFile = HEAP_strdupWtoA ( GetProcessHeap(), 0, pszFileName); 233 HRESULT hRet = E_FAIL; 234 235 TRACE("(%p, %s)\n",This, sFile); 236 237 238 if (This->lpFileStream) 239 IStream_Release(This->lpFileStream); 240 241 if SUCCEEDED(CreateStreamOnFile(sFile, &(This->lpFileStream))) 242 { 243 if SUCCEEDED (IPersistStream_Load(StreamThis, This->lpFileStream)) 244 { 245 return NOERROR; 246 } 247 } 248 249 return hRet; 249 250 } 250 251 251 252 252 253 #ifdef __WIN32OS2__ 253 static BOOL SaveIconResAsOS2ICO(GRPICONDIR *pIconDir, HINSTANCE hInstance, 254 static BOOL SaveIconResAsOS2ICO(GRPICONDIR *pIconDir, HINSTANCE hInstance, 254 255 const char *szXPMFileName) 255 256 { … … 394 395 #ifdef __WIN32OS2__ 395 396 if(!hResInfo) { 396 hResInfo = FindResourceA(hModule, MAKEINTRESOURCEA(nIndex), RT_ICONA); 397 hResInfo = FindResourceA(hModule, MAKEINTRESOURCEA(nIndex), RT_ICONA); 397 398 if(hResInfo) { 398 399 GRPICONDIR icondir = {0}; 399 400 BITMAPINFO *bmi; 400 401 401 bmi = (BITMAPINFO *)LockResource(LoadResource(hModule, hResInfo));402 bmi = (BITMAPINFO *)LockResource(LoadResource(hModule, hResInfo)); 402 403 403 404 icondir.idReserved = 0; … … 684 685 tmp[3] = 'O'; 685 686 /* extract the icon */ 686 if (!extract_icon( This->sIcoPath && strlen(This->sIcoPath) ? 687 if (!extract_icon( This->sIcoPath && strlen(This->sIcoPath) ? 687 688 This->sIcoPath : This->sPath, 688 689 icon_name, This->iIcoNdx)) goto done; … … 690 691 if(OSLibWinCreateObject(This->sPath, This->sArgs, This->sWorkDir, filename, 691 692 This->sDescription, icon_name, 692 This->iIcoNdx, bDesktop) == FALSE) 693 This->iIcoNdx, bDesktop) == FALSE) 693 694 { 694 695 ret = E_ACCESSDENIED; 695 696 } 696 697 697 698 done: 698 699 if(shell_link_app) HeapFree( GetProcessHeap(), 0, shell_link_app ); … … 760 761 761 762 /* extract the icon */ 762 if (!(icon_name = extract_icon( This->sIcoPath && strlen(This->sIcoPath) ? 763 if (!(icon_name = extract_icon( This->sIcoPath && strlen(This->sIcoPath) ? 763 764 This->sIcoPath : This->sPath, 764 765 This->iIcoNdx ))) goto done; … … 829 830 static HRESULT WINAPI IPersistFile_fnSaveCompleted(IPersistFile* iface, LPCOLESTR pszFileName) 830 831 { 831 _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface);832 FIXME("(%p)->(%s)\n",This,debugstr_w(pszFileName));833 return NOERROR;832 _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface); 833 FIXME("(%p)->(%s)\n",This,debugstr_w(pszFileName)); 834 return NOERROR; 834 835 } 835 836 static HRESULT WINAPI IPersistFile_fnGetCurFile(IPersistFile* iface, LPOLESTR *ppszFileName) 836 837 { 837 _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface);838 FIXME("(%p)\n",This);839 return NOERROR;840 } 841 842 static ICOM_VTABLE(IPersistFile) pfvt = 843 { 844 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE845 IPersistFile_fnQueryInterface,846 IPersistFile_fnAddRef,847 IPersistFile_fnRelease,848 IPersistFile_fnGetClassID,849 IPersistFile_fnIsDirty,850 IPersistFile_fnLoad,851 IPersistFile_fnSave,852 IPersistFile_fnSaveCompleted,853 IPersistFile_fnGetCurFile838 _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface); 839 FIXME("(%p)\n",This); 840 return NOERROR; 841 } 842 843 static ICOM_VTABLE(IPersistFile) pfvt = 844 { 845 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 846 IPersistFile_fnQueryInterface, 847 IPersistFile_fnAddRef, 848 IPersistFile_fnRelease, 849 IPersistFile_fnGetClassID, 850 IPersistFile_fnIsDirty, 851 IPersistFile_fnLoad, 852 IPersistFile_fnSave, 853 IPersistFile_fnSaveCompleted, 854 IPersistFile_fnGetCurFile 854 855 }; 855 856 … … 858 859 */ 859 860 static HRESULT WINAPI IPersistStream_fnQueryInterface( 860 IPersistStream* iface,861 REFIID riid,862 VOID** ppvoid)863 { 864 _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface);865 866 TRACE("(%p)\n",This);867 868 return IShellLinkA_QueryInterface((IShellLinkA*)This, riid, ppvoid);861 IPersistStream* iface, 862 REFIID riid, 863 VOID** ppvoid) 864 { 865 _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface); 866 867 TRACE("(%p)\n",This); 868 869 return IShellLinkA_QueryInterface((IShellLinkA*)This, riid, ppvoid); 869 870 } 870 871 … … 873 874 */ 874 875 static ULONG WINAPI IPersistStream_fnRelease( 875 IPersistStream* iface)876 { 877 _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface);878 879 TRACE("(%p)\n",This);880 881 return IShellLinkA_Release((IShellLinkA*)This);876 IPersistStream* iface) 877 { 878 _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface); 879 880 TRACE("(%p)\n",This); 881 882 return IShellLinkA_Release((IShellLinkA*)This); 882 883 } 883 884 … … 886 887 */ 887 888 static ULONG WINAPI IPersistStream_fnAddRef( 888 IPersistStream* iface)889 { 890 _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface);891 892 TRACE("(%p)\n",This);893 894 return IShellLinkA_AddRef((IShellLinkA*)This);895 } 889 IPersistStream* iface) 890 { 891 _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface); 892 893 TRACE("(%p)\n",This); 894 895 return IShellLinkA_AddRef((IShellLinkA*)This); 896 } 896 897 897 898 /************************************************************************ … … 900 901 */ 901 902 static HRESULT WINAPI IPersistStream_fnGetClassID( 902 IPersistStream* iface,903 CLSID* pClassID)904 { 905 _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface);906 907 TRACE("(%p)\n", This);908 909 if (pClassID==0)910 return E_POINTER;911 912 /* memcpy(pClassID, &CLSID_???, sizeof(CLSID_???)); */913 914 return S_OK;903 IPersistStream* iface, 904 CLSID* pClassID) 905 { 906 _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface); 907 908 TRACE("(%p)\n", This); 909 910 if (pClassID==0) 911 return E_POINTER; 912 913 /* memcpy(pClassID, &CLSID_???, sizeof(CLSID_???)); */ 914 915 return S_OK; 915 916 } 916 917 … … 919 920 */ 920 921 static HRESULT WINAPI IPersistStream_fnIsDirty( 921 IPersistStream* iface)922 { 923 _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface);924 925 TRACE("(%p)\n", This);926 927 return S_OK;922 IPersistStream* iface) 923 { 924 _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface); 925 926 TRACE("(%p)\n", This); 927 928 return S_OK; 928 929 } 929 930 /************************************************************************ … … 932 933 933 934 static HRESULT WINAPI IPersistStream_fnLoad( 934 IPersistStream* iface,935 IStream* pLoadStream)936 { 937 PLINK_HEADER lpLinkHeader = HeapAlloc(GetProcessHeap(), 0, LINK_HEADER_SIZE);938 ULONGdwBytesRead;939 DWORDret = E_FAIL;940 charsTemp[MAX_PATH];941 942 _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface);943 944 TRACE("(%p)(%p)\n", This, pLoadStream);945 946 if ( ! pLoadStream)947 {948 return STG_E_INVALIDPOINTER;949 }950 951 IStream_AddRef (pLoadStream);952 if(lpLinkHeader)953 {954 if (SUCCEEDED(IStream_Read(pLoadStream, lpLinkHeader, LINK_HEADER_SIZE, &dwBytesRead)))955 {956 if ((lpLinkHeader->MagicStr == 0x0000004CL) && IsEqualIID(&lpLinkHeader->MagicGuid, &CLSID_ShellLink))957 {958 lpLinkHeader = HeapReAlloc(GetProcessHeap(), 0, lpLinkHeader, LINK_HEADER_SIZE+lpLinkHeader->PidlSize);959 if (lpLinkHeader)960 {961 if (SUCCEEDED(IStream_Read(pLoadStream, &(lpLinkHeader->Pidl), lpLinkHeader->PidlSize, &dwBytesRead)))962 {963 if (pcheck (&lpLinkHeader->Pidl))964 { 965 This->pPidl = ILClone (&lpLinkHeader->Pidl);966 967 SHGetPathFromIDListA(&lpLinkHeader->Pidl, sTemp);968 This->sPath = HEAP_strdupA ( GetProcessHeap(), 0, sTemp);969 }970 This->wHotKey = lpLinkHeader->wHotKey;971 FileTimeToSystemTime (&lpLinkHeader->Time1, &This->time1);972 FileTimeToSystemTime (&lpLinkHeader->Time2, &This->time2);973 FileTimeToSystemTime (&lpLinkHeader->Time3, &This->time3);935 IPersistStream* iface, 936 IStream* pLoadStream) 937 { 938 PLINK_HEADER lpLinkHeader = HeapAlloc(GetProcessHeap(), 0, LINK_HEADER_SIZE); 939 ULONG dwBytesRead; 940 DWORD ret = E_FAIL; 941 char sTemp[MAX_PATH]; 942 943 _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface); 944 945 TRACE("(%p)(%p)\n", This, pLoadStream); 946 947 if ( ! pLoadStream) 948 { 949 return STG_E_INVALIDPOINTER; 950 } 951 952 IStream_AddRef (pLoadStream); 953 if(lpLinkHeader) 954 { 955 if (SUCCEEDED(IStream_Read(pLoadStream, lpLinkHeader, LINK_HEADER_SIZE, &dwBytesRead))) 956 { 957 if ((lpLinkHeader->MagicStr == 0x0000004CL) && IsEqualIID(&lpLinkHeader->MagicGuid, &CLSID_ShellLink)) 958 { 959 lpLinkHeader = HeapReAlloc(GetProcessHeap(), 0, lpLinkHeader, LINK_HEADER_SIZE+lpLinkHeader->PidlSize); 960 if (lpLinkHeader) 961 { 962 if (SUCCEEDED(IStream_Read(pLoadStream, &(lpLinkHeader->Pidl), lpLinkHeader->PidlSize, &dwBytesRead))) 963 { 964 if (pcheck (&lpLinkHeader->Pidl)) 965 { 966 This->pPidl = ILClone (&lpLinkHeader->Pidl); 967 968 SHGetPathFromIDListA(&lpLinkHeader->Pidl, sTemp); 969 This->sPath = HEAP_strdupA ( GetProcessHeap(), 0, sTemp); 970 } 971 This->wHotKey = lpLinkHeader->wHotKey; 972 FileTimeToSystemTime (&lpLinkHeader->Time1, &This->time1); 973 FileTimeToSystemTime (&lpLinkHeader->Time2, &This->time2); 974 FileTimeToSystemTime (&lpLinkHeader->Time3, &This->time3); 974 975 #if 1 975 GetDateFormatA(LOCALE_USER_DEFAULT,DATE_SHORTDATE,&This->time1, NULL, sTemp, 256);976 TRACE("-- time1: %s\n", sTemp);977 GetDateFormatA(LOCALE_USER_DEFAULT,DATE_SHORTDATE,&This->time2, NULL, sTemp, 256);978 TRACE("-- time1: %s\n", sTemp);979 GetDateFormatA(LOCALE_USER_DEFAULT,DATE_SHORTDATE,&This->time3, NULL, sTemp, 256);980 TRACE("-- time1: %s\n", sTemp);981 pdump (This->pPidl);982 #endif 983 ret = S_OK;984 }985 }986 }987 else988 {989 WARN("stream contains no link!\n");990 }991 }992 }993 994 IStream_Release (pLoadStream);995 996 pdump(This->pPidl);997 998 HeapFree(GetProcessHeap(), 0, lpLinkHeader);999 1000 return ret;976 GetDateFormatA(LOCALE_USER_DEFAULT,DATE_SHORTDATE,&This->time1, NULL, sTemp, 256); 977 TRACE("-- time1: %s\n", sTemp); 978 GetDateFormatA(LOCALE_USER_DEFAULT,DATE_SHORTDATE,&This->time2, NULL, sTemp, 256); 979 TRACE("-- time1: %s\n", sTemp); 980 GetDateFormatA(LOCALE_USER_DEFAULT,DATE_SHORTDATE,&This->time3, NULL, sTemp, 256); 981 TRACE("-- time1: %s\n", sTemp); 982 pdump (This->pPidl); 983 #endif 984 ret = S_OK; 985 } 986 } 987 } 988 else 989 { 990 WARN("stream contains no link!\n"); 991 } 992 } 993 } 994 995 IStream_Release (pLoadStream); 996 997 pdump(This->pPidl); 998 999 HeapFree(GetProcessHeap(), 0, lpLinkHeader); 1000 1001 return ret; 1001 1002 } 1002 1003 … … 1005 1006 */ 1006 1007 static HRESULT WINAPI IPersistStream_fnSave( 1007 IPersistStream* iface,1008 IStream* pOutStream,1009 BOOL fClearDirty)1010 { 1011 _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface);1012 1013 TRACE("(%p) %p %x\n", This, pOutStream, fClearDirty);1014 1015 return E_NOTIMPL;1008 IPersistStream* iface, 1009 IStream* pOutStream, 1010 BOOL fClearDirty) 1011 { 1012 _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface); 1013 1014 TRACE("(%p) %p %x\n", This, pOutStream, fClearDirty); 1015 1016 return E_NOTIMPL; 1016 1017 } 1017 1018 … … 1020 1021 */ 1021 1022 static HRESULT WINAPI IPersistStream_fnGetSizeMax( 1022 IPersistStream* iface,1023 ULARGE_INTEGER* pcbSize)1024 { 1025 _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface);1026 1027 TRACE("(%p)\n", This);1028 1029 return E_NOTIMPL;1023 IPersistStream* iface, 1024 ULARGE_INTEGER* pcbSize) 1025 { 1026 _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface); 1027 1028 TRACE("(%p)\n", This); 1029 1030 return E_NOTIMPL; 1030 1031 } 1031 1032 1032 1033 static ICOM_VTABLE(IPersistStream) psvt = 1033 1034 { 1034 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE1035 IPersistStream_fnQueryInterface,1036 IPersistStream_fnAddRef,1037 IPersistStream_fnRelease,1038 IPersistStream_fnGetClassID,1039 IPersistStream_fnIsDirty,1040 IPersistStream_fnLoad,1041 IPersistStream_fnSave,1042 IPersistStream_fnGetSizeMax1035 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 1036 IPersistStream_fnQueryInterface, 1037 IPersistStream_fnAddRef, 1038 IPersistStream_fnRelease, 1039 IPersistStream_fnGetClassID, 1040 IPersistStream_fnIsDirty, 1041 IPersistStream_fnLoad, 1042 IPersistStream_fnSave, 1043 IPersistStream_fnGetSizeMax 1043 1044 }; 1044 1045 1045 1046 /************************************************************************** 1046 * IShellLink_Constructor1047 */ 1048 IShellLinkA * IShellLink_Constructor(BOOL bUnicode) 1049 { IShellLinkImpl * sl;1050 1051 sl = (IShellLinkImpl *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IShellLinkImpl));1052 sl->ref = 1;1053 ICOM_VTBL(sl) = &slvt;1054 sl->lpvtblw = &slvtw;1055 sl->lpvtblPersistFile = &pfvt;1056 sl->lpvtblPersistStream = &psvt;1057 1058 TRACE("(%p)->()\n",sl);1059 shell32_ObjCount++;1060 return bUnicode ? (IShellLinkA *) &(sl->lpvtblw) : (IShellLinkA *)sl;1047 * IShellLink_Constructor 1048 */ 1049 IShellLinkA * IShellLink_Constructor(BOOL bUnicode) 1050 { IShellLinkImpl * sl; 1051 1052 sl = (IShellLinkImpl *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IShellLinkImpl)); 1053 sl->ref = 1; 1054 ICOM_VTBL(sl) = &slvt; 1055 sl->lpvtblw = &slvtw; 1056 sl->lpvtblPersistFile = &pfvt; 1057 sl->lpvtblPersistStream = &psvt; 1058 1059 TRACE("(%p)->()\n",sl); 1060 shell32_ObjCount++; 1061 return bUnicode ? (IShellLinkA *) &(sl->lpvtblw) : (IShellLinkA *)sl; 1061 1062 } 1062 1063 … … 1066 1067 static HRESULT WINAPI IShellLinkA_fnQueryInterface( IShellLinkA * iface, REFIID riid, LPVOID *ppvObj) 1067 1068 { 1068 ICOM_THIS(IShellLinkImpl, iface);1069 1070 TRACE("(%p)->(\n\tIID:\t%s)\n",This,debugstr_guid(riid));1071 1072 *ppvObj = NULL;1073 1074 if(IsEqualIID(riid, &IID_IUnknown) ||1075 IsEqualIID(riid, &IID_IShellLinkA))1076 {1077 *ppvObj = This;1078 } 1079 else if(IsEqualIID(riid, &IID_IShellLinkW))1080 {1081 *ppvObj = (IShellLinkW *)&(This->lpvtblw);1082 } 1083 else if(IsEqualIID(riid, &IID_IPersistFile))1084 {1085 *ppvObj = (IPersistFile *)&(This->lpvtblPersistFile);1086 }1087 else if(IsEqualIID(riid, &IID_IPersistStream))1088 {1089 *ppvObj = (IPersistStream *)&(This->lpvtblPersistStream);1090 } 1091 1092 if(*ppvObj)1093 {1094 IUnknown_AddRef((IUnknown*)(*ppvObj));1095 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);1096 return S_OK;1097 }1098 TRACE("-- Interface: E_NOINTERFACE\n");1099 return E_NOINTERFACE;1100 } 1069 ICOM_THIS(IShellLinkImpl, iface); 1070 1071 TRACE("(%p)->(\n\tIID:\t%s)\n",This,debugstr_guid(riid)); 1072 1073 *ppvObj = NULL; 1074 1075 if(IsEqualIID(riid, &IID_IUnknown) || 1076 IsEqualIID(riid, &IID_IShellLinkA)) 1077 { 1078 *ppvObj = This; 1079 } 1080 else if(IsEqualIID(riid, &IID_IShellLinkW)) 1081 { 1082 *ppvObj = (IShellLinkW *)&(This->lpvtblw); 1083 } 1084 else if(IsEqualIID(riid, &IID_IPersistFile)) 1085 { 1086 *ppvObj = (IPersistFile *)&(This->lpvtblPersistFile); 1087 } 1088 else if(IsEqualIID(riid, &IID_IPersistStream)) 1089 { 1090 *ppvObj = (IPersistStream *)&(This->lpvtblPersistStream); 1091 } 1092 1093 if(*ppvObj) 1094 { 1095 IUnknown_AddRef((IUnknown*)(*ppvObj)); 1096 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj); 1097 return S_OK; 1098 } 1099 TRACE("-- Interface: E_NOINTERFACE\n"); 1100 return E_NOINTERFACE; 1101 } 1101 1102 /****************************************************************************** 1102 1103 * IShellLinkA_AddRef … … 1104 1105 static ULONG WINAPI IShellLinkA_fnAddRef(IShellLinkA * iface) 1105 1106 { 1106 ICOM_THIS(IShellLinkImpl, iface);1107 1108 TRACE("(%p)->(count=%lu)\n",This,This->ref);1109 1110 shell32_ObjCount++;1111 return ++(This->ref);1107 ICOM_THIS(IShellLinkImpl, iface); 1108 1109 TRACE("(%p)->(count=%lu)\n",This,This->ref); 1110 1111 shell32_ObjCount++; 1112 return ++(This->ref); 1112 1113 } 1113 1114 /****************************************************************************** 1114 * IShellLinkA_Release1115 * IShellLinkA_Release 1115 1116 */ 1116 1117 static ULONG WINAPI IShellLinkA_fnRelease(IShellLinkA * iface) 1117 1118 { 1118 ICOM_THIS(IShellLinkImpl, iface);1119 1120 TRACE("(%p)->(count=%lu)\n",This,This->ref);1121 1122 shell32_ObjCount--;1123 if (!--(This->ref)) 1124 { TRACE("-- destroying IShellLink(%p)\n",This);1125 1126 if (This->sIcoPath)1127 HeapFree(GetProcessHeap(), 0, This->sIcoPath);1128 1129 if (This->sArgs)1130 HeapFree(GetProcessHeap(), 0, This->sArgs);1131 1132 if (This->sWorkDir)1133 HeapFree(GetProcessHeap(), 0, This->sWorkDir);1134 1135 if (This->sDescription)1136 HeapFree(GetProcessHeap(), 0, This->sDescription);1137 1138 if (This->sPath)1139 HeapFree(GetProcessHeap(),0,This->sPath);1140 1141 if (This->pPidl)1142 SHFree(This->pPidl);1143 1144 if (This->lpFileStream)1145 IStream_Release(This->lpFileStream);1146 1147 This->iIcoNdx = 0;1148 1149 HeapFree(GetProcessHeap(),0,This);1150 return 0;1151 }1152 return This->ref;1119 ICOM_THIS(IShellLinkImpl, iface); 1120 1121 TRACE("(%p)->(count=%lu)\n",This,This->ref); 1122 1123 shell32_ObjCount--; 1124 if (!--(This->ref)) 1125 { TRACE("-- destroying IShellLink(%p)\n",This); 1126 1127 if (This->sIcoPath) 1128 HeapFree(GetProcessHeap(), 0, This->sIcoPath); 1129 1130 if (This->sArgs) 1131 HeapFree(GetProcessHeap(), 0, This->sArgs); 1132 1133 if (This->sWorkDir) 1134 HeapFree(GetProcessHeap(), 0, This->sWorkDir); 1135 1136 if (This->sDescription) 1137 HeapFree(GetProcessHeap(), 0, This->sDescription); 1138 1139 if (This->sPath) 1140 HeapFree(GetProcessHeap(),0,This->sPath); 1141 1142 if (This->pPidl) 1143 SHFree(This->pPidl); 1144 1145 if (This->lpFileStream) 1146 IStream_Release(This->lpFileStream); 1147 1148 This->iIcoNdx = 0; 1149 1150 HeapFree(GetProcessHeap(),0,This); 1151 return 0; 1152 } 1153 return This->ref; 1153 1154 } 1154 1155 1155 1156 static HRESULT WINAPI IShellLinkA_fnGetPath(IShellLinkA * iface, LPSTR pszFile,INT cchMaxPath, WIN32_FIND_DATAA *pfd, DWORD fFlags) 1156 1157 { 1157 ICOM_THIS(IShellLinkImpl, iface);1158 1159 TRACE("(%p)->(pfile=%p len=%u find_data=%p flags=%lu)(%s)\n",This, pszFile, cchMaxPath, pfd, fFlags, debugstr_a(This->sPath));1160 1161 if (This->sPath)1162 lstrcpynA(pszFile,This->sPath, cchMaxPath);1163 else1164 return E_FAIL;1165 1166 return NOERROR;1158 ICOM_THIS(IShellLinkImpl, iface); 1159 1160 TRACE("(%p)->(pfile=%p len=%u find_data=%p flags=%lu)(%s)\n",This, pszFile, cchMaxPath, pfd, fFlags, debugstr_a(This->sPath)); 1161 1162 if (This->sPath) 1163 lstrcpynA(pszFile,This->sPath, cchMaxPath); 1164 else 1165 return E_FAIL; 1166 1167 return NOERROR; 1167 1168 } 1168 1169 static HRESULT WINAPI IShellLinkA_fnGetIDList(IShellLinkA * iface, LPITEMIDLIST * ppidl) 1169 1170 { 1170 ICOM_THIS(IShellLinkImpl, iface);1171 1172 TRACE("(%p)->(ppidl=%p)\n",This, ppidl);1173 1174 *ppidl = ILClone(This->pPidl);1175 return NOERROR;1171 ICOM_THIS(IShellLinkImpl, iface); 1172 1173 TRACE("(%p)->(ppidl=%p)\n",This, ppidl); 1174 1175 *ppidl = ILClone(This->pPidl); 1176 return NOERROR; 1176 1177 } 1177 1178 static HRESULT WINAPI IShellLinkA_fnSetIDList(IShellLinkA * iface, LPCITEMIDLIST pidl) 1178 1179 { 1179 ICOM_THIS(IShellLinkImpl, iface);1180 1181 TRACE("(%p)->(pidl=%p)\n",This, pidl);1182 1183 if (This->pPidl)1184 SHFree(This->pPidl);1185 This->pPidl = ILClone (pidl);1186 return NOERROR;1180 ICOM_THIS(IShellLinkImpl, iface); 1181 1182 TRACE("(%p)->(pidl=%p)\n",This, pidl); 1183 1184 if (This->pPidl) 1185 SHFree(This->pPidl); 1186 This->pPidl = ILClone (pidl); 1187 return NOERROR; 1187 1188 } 1188 1189 static HRESULT WINAPI IShellLinkA_fnGetDescription(IShellLinkA * iface, LPSTR pszName,INT cchMaxName) 1189 1190 { 1190 ICOM_THIS(IShellLinkImpl, iface);1191 1192 FIXME("(%p)->(%p len=%u)\n",This, pszName, cchMaxName);1193 lstrcpynA(pszName,"Description, FIXME",cchMaxName);1194 return NOERROR;1191 ICOM_THIS(IShellLinkImpl, iface); 1192 1193 FIXME("(%p)->(%p len=%u)\n",This, pszName, cchMaxName); 1194 lstrcpynA(pszName,"Description, FIXME",cchMaxName); 1195 return NOERROR; 1195 1196 } 1196 1197 static HRESULT WINAPI IShellLinkA_fnSetDescription(IShellLinkA * iface, LPCSTR pszName) 1197 1198 { 1198 ICOM_THIS(IShellLinkImpl, iface);1199 1200 TRACE("(%p)->(pName=%s)\n", This, pszName);1201 1202 if (This->sDescription)1203 HeapFree(GetProcessHeap(), 0, This->sDescription);1204 if (!(This->sDescription = HEAP_strdupA(GetProcessHeap(), 0, pszName)))1205 return E_OUTOFMEMORY;1206 1207 return NOERROR;1199 ICOM_THIS(IShellLinkImpl, iface); 1200 1201 TRACE("(%p)->(pName=%s)\n", This, pszName); 1202 1203 if (This->sDescription) 1204 HeapFree(GetProcessHeap(), 0, This->sDescription); 1205 if (!(This->sDescription = HEAP_strdupA(GetProcessHeap(), 0, pszName))) 1206 return E_OUTOFMEMORY; 1207 1208 return NOERROR; 1208 1209 } 1209 1210 static HRESULT WINAPI IShellLinkA_fnGetWorkingDirectory(IShellLinkA * iface, LPSTR pszDir,INT cchMaxPath) 1210 1211 { 1211 ICOM_THIS(IShellLinkImpl, iface);1212 1213 TRACE("(%p)->(%p len=%u)\n", This, pszDir, cchMaxPath);1214 1215 lstrcpynA( pszDir, This->sWorkDir ? This->sWorkDir : "", cchMaxPath );1216 1217 return NOERROR;1212 ICOM_THIS(IShellLinkImpl, iface); 1213 1214 TRACE("(%p)->(%p len=%u)\n", This, pszDir, cchMaxPath); 1215 1216 lstrcpynA( pszDir, This->sWorkDir ? This->sWorkDir : "", cchMaxPath ); 1217 1218 return NOERROR; 1218 1219 } 1219 1220 static HRESULT WINAPI IShellLinkA_fnSetWorkingDirectory(IShellLinkA * iface, LPCSTR pszDir) 1220 1221 { 1221 ICOM_THIS(IShellLinkImpl, iface);1222 1223 TRACE("(%p)->(dir=%s)\n",This, pszDir);1224 1225 if (This->sWorkDir)1226 HeapFree(GetProcessHeap(), 0, This->sWorkDir);1227 if (!(This->sWorkDir = HEAP_strdupA(GetProcessHeap(), 0, pszDir)))1228 return E_OUTOFMEMORY;1229 1230 return NOERROR;1222 ICOM_THIS(IShellLinkImpl, iface); 1223 1224 TRACE("(%p)->(dir=%s)\n",This, pszDir); 1225 1226 if (This->sWorkDir) 1227 HeapFree(GetProcessHeap(), 0, This->sWorkDir); 1228 if (!(This->sWorkDir = HEAP_strdupA(GetProcessHeap(), 0, pszDir))) 1229 return E_OUTOFMEMORY; 1230 1231 return NOERROR; 1231 1232 } 1232 1233 static HRESULT WINAPI IShellLinkA_fnGetArguments(IShellLinkA * iface, LPSTR pszArgs,INT cchMaxPath) 1233 1234 { 1234 ICOM_THIS(IShellLinkImpl, iface);1235 1236 TRACE("(%p)->(%p len=%u)\n", This, pszArgs, cchMaxPath);1237 1238 lstrcpynA( pszArgs, This->sArgs ? This->sArgs : "", cchMaxPath );1239 1240 return NOERROR;1235 ICOM_THIS(IShellLinkImpl, iface); 1236 1237 TRACE("(%p)->(%p len=%u)\n", This, pszArgs, cchMaxPath); 1238 1239 lstrcpynA( pszArgs, This->sArgs ? This->sArgs : "", cchMaxPath ); 1240 1241 return NOERROR; 1241 1242 } 1242 1243 static HRESULT WINAPI IShellLinkA_fnSetArguments(IShellLinkA * iface, LPCSTR pszArgs) 1243 1244 { 1244 ICOM_THIS(IShellLinkImpl, iface);1245 1246 TRACE("(%p)->(args=%s)\n",This, pszArgs);1247 1248 if (This->sArgs)1249 HeapFree(GetProcessHeap(), 0, This->sArgs);1250 if (!(This->sArgs = HEAP_strdupA(GetProcessHeap(), 0, pszArgs)))1251 return E_OUTOFMEMORY;1252 1253 return NOERROR;1245 ICOM_THIS(IShellLinkImpl, iface); 1246 1247 TRACE("(%p)->(args=%s)\n",This, pszArgs); 1248 1249 if (This->sArgs) 1250 HeapFree(GetProcessHeap(), 0, This->sArgs); 1251 if (!(This->sArgs = HEAP_strdupA(GetProcessHeap(), 0, pszArgs))) 1252 return E_OUTOFMEMORY; 1253 1254 return NOERROR; 1254 1255 } 1255 1256 static HRESULT WINAPI IShellLinkA_fnGetHotkey(IShellLinkA * iface, WORD *pwHotkey) 1256 1257 { 1257 ICOM_THIS(IShellLinkImpl, iface);1258 1259 TRACE("(%p)->(%p)(0x%08x)\n",This, pwHotkey, This->wHotKey);1260 1261 *pwHotkey = This->wHotKey;1262 1263 return NOERROR;1258 ICOM_THIS(IShellLinkImpl, iface); 1259 1260 TRACE("(%p)->(%p)(0x%08x)\n",This, pwHotkey, This->wHotKey); 1261 1262 *pwHotkey = This->wHotKey; 1263 1264 return NOERROR; 1264 1265 } 1265 1266 static HRESULT WINAPI IShellLinkA_fnSetHotkey(IShellLinkA * iface, WORD wHotkey) 1266 1267 { 1267 ICOM_THIS(IShellLinkImpl, iface);1268 1269 TRACE("(%p)->(hotkey=%x)\n",This, wHotkey);1270 1271 This->wHotKey = wHotkey;1272 1273 return NOERROR;1268 ICOM_THIS(IShellLinkImpl, iface); 1269 1270 TRACE("(%p)->(hotkey=%x)\n",This, wHotkey); 1271 1272 This->wHotKey = wHotkey; 1273 1274 return NOERROR; 1274 1275 } 1275 1276 static HRESULT WINAPI IShellLinkA_fnGetShowCmd(IShellLinkA * iface, INT *piShowCmd) 1276 1277 { 1277 ICOM_THIS(IShellLinkImpl, iface);1278 1279 FIXME("(%p)->(%p)\n",This, piShowCmd);1280 *piShowCmd=0;1281 return NOERROR;1278 ICOM_THIS(IShellLinkImpl, iface); 1279 1280 FIXME("(%p)->(%p)\n",This, piShowCmd); 1281 *piShowCmd=0; 1282 return NOERROR; 1282 1283 } 1283 1284 static HRESULT WINAPI IShellLinkA_fnSetShowCmd(IShellLinkA * iface, INT iShowCmd) 1284 1285 { 1285 ICOM_THIS(IShellLinkImpl, iface);1286 1287 FIXME("(%p)->(showcmd=%x)\n",This, iShowCmd);1288 return NOERROR;1286 ICOM_THIS(IShellLinkImpl, iface); 1287 1288 FIXME("(%p)->(showcmd=%x)\n",This, iShowCmd); 1289 return NOERROR; 1289 1290 } 1290 1291 static HRESULT WINAPI IShellLinkA_fnGetIconLocation(IShellLinkA * iface, LPSTR pszIconPath,INT cchIconPath,INT *piIcon) 1291 1292 { 1292 ICOM_THIS(IShellLinkImpl, iface);1293 1294 TRACE("(%p)->(%p len=%u iicon=%p)\n", This, pszIconPath, cchIconPath, piIcon);1295 1296 lstrcpynA( pszIconPath, This->sIcoPath ? This->sIcoPath : "", cchIconPath );1297 *piIcon = This->iIcoNdx;1298 1299 return NOERROR;1293 ICOM_THIS(IShellLinkImpl, iface); 1294 1295 TRACE("(%p)->(%p len=%u iicon=%p)\n", This, pszIconPath, cchIconPath, piIcon); 1296 1297 lstrcpynA( pszIconPath, This->sIcoPath ? This->sIcoPath : "", cchIconPath ); 1298 *piIcon = This->iIcoNdx; 1299 1300 return NOERROR; 1300 1301 } 1301 1302 static HRESULT WINAPI IShellLinkA_fnSetIconLocation(IShellLinkA * iface, LPCSTR pszIconPath,INT iIcon) 1302 1303 { 1303 ICOM_THIS(IShellLinkImpl, iface);1304 1305 TRACE("(%p)->(path=%s iicon=%u)\n",This, pszIconPath, iIcon);1306 1307 if (This->sIcoPath)1308 HeapFree(GetProcessHeap(), 0, This->sIcoPath);1309 if (!(This->sIcoPath = HEAP_strdupA(GetProcessHeap(), 0, pszIconPath)))1310 return E_OUTOFMEMORY; 1311 This->iIcoNdx = iIcon;1312 1313 return NOERROR;1304 ICOM_THIS(IShellLinkImpl, iface); 1305 1306 TRACE("(%p)->(path=%s iicon=%u)\n",This, pszIconPath, iIcon); 1307 1308 if (This->sIcoPath) 1309 HeapFree(GetProcessHeap(), 0, This->sIcoPath); 1310 if (!(This->sIcoPath = HEAP_strdupA(GetProcessHeap(), 0, pszIconPath))) 1311 return E_OUTOFMEMORY; 1312 This->iIcoNdx = iIcon; 1313 1314 return NOERROR; 1314 1315 } 1315 1316 static HRESULT WINAPI IShellLinkA_fnSetRelativePath(IShellLinkA * iface, LPCSTR pszPathRel, DWORD dwReserved) 1316 1317 { 1317 ICOM_THIS(IShellLinkImpl, iface);1318 1319 FIXME("(%p)->(path=%s %lx)\n",This, pszPathRel, dwReserved);1320 return NOERROR;1318 ICOM_THIS(IShellLinkImpl, iface); 1319 1320 FIXME("(%p)->(path=%s %lx)\n",This, pszPathRel, dwReserved); 1321 return NOERROR; 1321 1322 } 1322 1323 static HRESULT WINAPI IShellLinkA_fnResolve(IShellLinkA * iface, HWND hwnd, DWORD fFlags) 1323 1324 { 1324 ICOM_THIS(IShellLinkImpl, iface);1325 1326 FIXME("(%p)->(hwnd=%x flags=%lx)\n",This, hwnd, fFlags);1327 return NOERROR;1325 ICOM_THIS(IShellLinkImpl, iface); 1326 1327 FIXME("(%p)->(hwnd=%x flags=%lx)\n",This, hwnd, fFlags); 1328 return NOERROR; 1328 1329 } 1329 1330 static HRESULT WINAPI IShellLinkA_fnSetPath(IShellLinkA * iface, LPCSTR pszFile) 1330 1331 { 1331 ICOM_THIS(IShellLinkImpl, iface);1332 1333 TRACE("(%p)->(path=%s)\n",This, pszFile);1334 1335 if (This->sPath)1336 HeapFree(GetProcessHeap(), 0, This->sPath);1337 if (!(This->sPath = HEAP_strdupA(GetProcessHeap(), 0, pszFile)))1338 return E_OUTOFMEMORY;1339 1340 return NOERROR;1332 ICOM_THIS(IShellLinkImpl, iface); 1333 1334 TRACE("(%p)->(path=%s)\n",This, pszFile); 1335 1336 if (This->sPath) 1337 HeapFree(GetProcessHeap(), 0, This->sPath); 1338 if (!(This->sPath = HEAP_strdupA(GetProcessHeap(), 0, pszFile))) 1339 return E_OUTOFMEMORY; 1340 1341 return NOERROR; 1341 1342 } 1342 1343 … … 1345 1346 */ 1346 1347 1347 static ICOM_VTABLE(IShellLinkA) slvt = 1348 { 1349 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE1350 IShellLinkA_fnQueryInterface,1351 IShellLinkA_fnAddRef,1352 IShellLinkA_fnRelease,1353 IShellLinkA_fnGetPath,1354 IShellLinkA_fnGetIDList,1355 IShellLinkA_fnSetIDList,1356 IShellLinkA_fnGetDescription,1357 IShellLinkA_fnSetDescription,1358 IShellLinkA_fnGetWorkingDirectory,1359 IShellLinkA_fnSetWorkingDirectory,1360 IShellLinkA_fnGetArguments,1361 IShellLinkA_fnSetArguments,1362 IShellLinkA_fnGetHotkey,1363 IShellLinkA_fnSetHotkey,1364 IShellLinkA_fnGetShowCmd,1365 IShellLinkA_fnSetShowCmd,1366 IShellLinkA_fnGetIconLocation,1367 IShellLinkA_fnSetIconLocation,1368 IShellLinkA_fnSetRelativePath,1369 IShellLinkA_fnResolve,1370 IShellLinkA_fnSetPath1348 static ICOM_VTABLE(IShellLinkA) slvt = 1349 { 1350 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 1351 IShellLinkA_fnQueryInterface, 1352 IShellLinkA_fnAddRef, 1353 IShellLinkA_fnRelease, 1354 IShellLinkA_fnGetPath, 1355 IShellLinkA_fnGetIDList, 1356 IShellLinkA_fnSetIDList, 1357 IShellLinkA_fnGetDescription, 1358 IShellLinkA_fnSetDescription, 1359 IShellLinkA_fnGetWorkingDirectory, 1360 IShellLinkA_fnSetWorkingDirectory, 1361 IShellLinkA_fnGetArguments, 1362 IShellLinkA_fnSetArguments, 1363 IShellLinkA_fnGetHotkey, 1364 IShellLinkA_fnSetHotkey, 1365 IShellLinkA_fnGetShowCmd, 1366 IShellLinkA_fnSetShowCmd, 1367 IShellLinkA_fnGetIconLocation, 1368 IShellLinkA_fnSetIconLocation, 1369 IShellLinkA_fnSetRelativePath, 1370 IShellLinkA_fnResolve, 1371 IShellLinkA_fnSetPath 1371 1372 }; 1372 1373 … … 1378 1379 IShellLinkW * iface, REFIID riid, LPVOID *ppvObj) 1379 1380 { 1380 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);1381 1382 return IShellLinkA_QueryInterface((IShellLinkA*)This, riid, ppvObj);1381 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); 1382 1383 return IShellLinkA_QueryInterface((IShellLinkA*)This, riid, ppvObj); 1383 1384 } 1384 1385 … … 1388 1389 static ULONG WINAPI IShellLinkW_fnAddRef(IShellLinkW * iface) 1389 1390 { 1390 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);1391 1392 TRACE("(%p)->(count=%lu)\n",This,This->ref);1393 1394 return IShellLinkA_AddRef((IShellLinkA*)This);1391 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); 1392 1393 TRACE("(%p)->(count=%lu)\n",This,This->ref); 1394 1395 return IShellLinkA_AddRef((IShellLinkA*)This); 1395 1396 } 1396 1397 /****************************************************************************** … … 1400 1401 static ULONG WINAPI IShellLinkW_fnRelease(IShellLinkW * iface) 1401 1402 { 1402 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);1403 1404 TRACE("(%p)->(count=%lu)\n",This,This->ref);1405 1406 return IShellLinkA_Release((IShellLinkA*)This);1403 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); 1404 1405 TRACE("(%p)->(count=%lu)\n",This,This->ref); 1406 1407 return IShellLinkA_Release((IShellLinkA*)This); 1407 1408 } 1408 1409 1409 1410 static HRESULT WINAPI IShellLinkW_fnGetPath(IShellLinkW * iface, LPWSTR pszFile,INT cchMaxPath, WIN32_FIND_DATAA *pfd, DWORD fFlags) 1410 1411 { 1411 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);1412 1413 FIXME("(%p)->(pfile=%p len=%u find_data=%p flags=%lu)\n",This, pszFile, cchMaxPath, pfd, fFlags);1412 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); 1413 1414 FIXME("(%p)->(pfile=%p len=%u find_data=%p flags=%lu)\n",This, pszFile, cchMaxPath, pfd, fFlags); 1414 1415 MultiByteToWideChar( CP_ACP, 0, "c:\\foo.bar", -1, pszFile, cchMaxPath ); 1415 return NOERROR;1416 return NOERROR; 1416 1417 } 1417 1418 1418 1419 static HRESULT WINAPI IShellLinkW_fnGetIDList(IShellLinkW * iface, LPITEMIDLIST * ppidl) 1419 1420 { 1420 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);1421 1422 FIXME("(%p)->(ppidl=%p)\n",This, ppidl);1423 *ppidl = _ILCreateDesktop();1424 return NOERROR;1421 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); 1422 1423 FIXME("(%p)->(ppidl=%p)\n",This, ppidl); 1424 *ppidl = _ILCreateDesktop(); 1425 return NOERROR; 1425 1426 } 1426 1427 1427 1428 static HRESULT WINAPI IShellLinkW_fnSetIDList(IShellLinkW * iface, LPCITEMIDLIST pidl) 1428 1429 { 1429 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);1430 1431 FIXME("(%p)->(pidl=%p)\n",This, pidl);1432 return NOERROR;1430 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); 1431 1432 FIXME("(%p)->(pidl=%p)\n",This, pidl); 1433 return NOERROR; 1433 1434 } 1434 1435 1435 1436 static HRESULT WINAPI IShellLinkW_fnGetDescription(IShellLinkW * iface, LPWSTR pszName,INT cchMaxName) 1436 1437 { 1437 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);1438 1439 FIXME("(%p)->(%p len=%u)\n",This, pszName, cchMaxName);1438 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); 1439 1440 FIXME("(%p)->(%p len=%u)\n",This, pszName, cchMaxName); 1440 1441 MultiByteToWideChar( CP_ACP, 0, "Description, FIXME", -1, pszName, cchMaxName ); 1441 return NOERROR;1442 return NOERROR; 1442 1443 } 1443 1444 1444 1445 static HRESULT WINAPI IShellLinkW_fnSetDescription(IShellLinkW * iface, LPCWSTR pszName) 1445 1446 { 1446 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);1447 1448 TRACE("(%p)->(desc=%s)\n",This, debugstr_w(pszName));1449 1450 if (This->sDescription)1451 HeapFree(GetProcessHeap(), 0, This->sDescription);1452 if (!(This->sDescription = HEAP_strdupWtoA(GetProcessHeap(), 0, pszName)))1453 return E_OUTOFMEMORY;1454 1455 return NOERROR;1447 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); 1448 1449 TRACE("(%p)->(desc=%s)\n",This, debugstr_w(pszName)); 1450 1451 if (This->sDescription) 1452 HeapFree(GetProcessHeap(), 0, This->sDescription); 1453 if (!(This->sDescription = HEAP_strdupWtoA(GetProcessHeap(), 0, pszName))) 1454 return E_OUTOFMEMORY; 1455 1456 return NOERROR; 1456 1457 } 1457 1458 1458 1459 static HRESULT WINAPI IShellLinkW_fnGetWorkingDirectory(IShellLinkW * iface, LPWSTR pszDir,INT cchMaxPath) 1459 1460 { 1460 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);1461 1462 TRACE("(%p)->(%p len %u)\n", This, pszDir, cchMaxPath);1463 1464 MultiByteToWideChar( CP_ACP, 0, This->sWorkDir ? This->sWorkDir : "", -1, pszDir, cchMaxPath );1465 1466 return NOERROR;1461 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); 1462 1463 TRACE("(%p)->(%p len %u)\n", This, pszDir, cchMaxPath); 1464 1465 MultiByteToWideChar( CP_ACP, 0, This->sWorkDir ? This->sWorkDir : "", -1, pszDir, cchMaxPath ); 1466 1467 return NOERROR; 1467 1468 } 1468 1469 1469 1470 static HRESULT WINAPI IShellLinkW_fnSetWorkingDirectory(IShellLinkW * iface, LPCWSTR pszDir) 1470 1471 { 1471 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);1472 1473 TRACE("(%p)->(dir=%s)\n",This, debugstr_w(pszDir));1474 1475 if (This->sWorkDir)1476 HeapFree(GetProcessHeap(), 0, This->sWorkDir);1477 if (!(This->sWorkDir = HEAP_strdupWtoA(GetProcessHeap(), 0, pszDir)))1478 return E_OUTOFMEMORY;1479 1480 return NOERROR;1472 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); 1473 1474 TRACE("(%p)->(dir=%s)\n",This, debugstr_w(pszDir)); 1475 1476 if (This->sWorkDir) 1477 HeapFree(GetProcessHeap(), 0, This->sWorkDir); 1478 if (!(This->sWorkDir = HEAP_strdupWtoA(GetProcessHeap(), 0, pszDir))) 1479 return E_OUTOFMEMORY; 1480 1481 return NOERROR; 1481 1482 } 1482 1483 1483 1484 static HRESULT WINAPI IShellLinkW_fnGetArguments(IShellLinkW * iface, LPWSTR pszArgs,INT cchMaxPath) 1484 1485 { 1485 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);1486 1487 TRACE("(%p)->(%p len=%u)\n", This, pszArgs, cchMaxPath);1488 1489 MultiByteToWideChar( CP_ACP, 0, This->sArgs ? This->sArgs : "", -1, pszArgs, cchMaxPath );1490 1491 return NOERROR;1486 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); 1487 1488 TRACE("(%p)->(%p len=%u)\n", This, pszArgs, cchMaxPath); 1489 1490 MultiByteToWideChar( CP_ACP, 0, This->sArgs ? This->sArgs : "", -1, pszArgs, cchMaxPath ); 1491 1492 return NOERROR; 1492 1493 } 1493 1494 1494 1495 static HRESULT WINAPI IShellLinkW_fnSetArguments(IShellLinkW * iface, LPCWSTR pszArgs) 1495 1496 { 1496 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);1497 1498 TRACE("(%p)->(args=%s)\n",This, debugstr_w(pszArgs));1499 1500 if (This->sArgs)1501 HeapFree(GetProcessHeap(), 0, This->sArgs);1502 if (!(This->sArgs = HEAP_strdupWtoA(GetProcessHeap(), 0, pszArgs)))1503 return E_OUTOFMEMORY;1504 1505 return NOERROR;1497 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); 1498 1499 TRACE("(%p)->(args=%s)\n",This, debugstr_w(pszArgs)); 1500 1501 if (This->sArgs) 1502 HeapFree(GetProcessHeap(), 0, This->sArgs); 1503 if (!(This->sArgs = HEAP_strdupWtoA(GetProcessHeap(), 0, pszArgs))) 1504 return E_OUTOFMEMORY; 1505 1506 return NOERROR; 1506 1507 } 1507 1508 1508 1509 static HRESULT WINAPI IShellLinkW_fnGetHotkey(IShellLinkW * iface, WORD *pwHotkey) 1509 1510 { 1510 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);1511 1512 FIXME("(%p)->(%p)\n",This, pwHotkey);1513 *pwHotkey=0x0;1514 return NOERROR;1511 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); 1512 1513 FIXME("(%p)->(%p)\n",This, pwHotkey); 1514 *pwHotkey=0x0; 1515 return NOERROR; 1515 1516 } 1516 1517 1517 1518 static HRESULT WINAPI IShellLinkW_fnSetHotkey(IShellLinkW * iface, WORD wHotkey) 1518 1519 { 1519 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);1520 1521 FIXME("(%p)->(hotkey=%x)\n",This, wHotkey);1522 return NOERROR;1520 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); 1521 1522 FIXME("(%p)->(hotkey=%x)\n",This, wHotkey); 1523 return NOERROR; 1523 1524 } 1524 1525 1525 1526 static HRESULT WINAPI IShellLinkW_fnGetShowCmd(IShellLinkW * iface, INT *piShowCmd) 1526 1527 { 1527 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);1528 1529 FIXME("(%p)->(%p)\n",This, piShowCmd);1530 *piShowCmd=0;1531 return NOERROR;1528 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); 1529 1530 FIXME("(%p)->(%p)\n",This, piShowCmd); 1531 *piShowCmd=0; 1532 return NOERROR; 1532 1533 } 1533 1534 1534 1535 static HRESULT WINAPI IShellLinkW_fnSetShowCmd(IShellLinkW * iface, INT iShowCmd) 1535 1536 { 1536 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);1537 1538 FIXME("(%p)->(showcmd=%x)\n",This, iShowCmd);1539 return NOERROR;1537 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); 1538 1539 FIXME("(%p)->(showcmd=%x)\n",This, iShowCmd); 1540 return NOERROR; 1540 1541 } 1541 1542 1542 1543 static HRESULT WINAPI IShellLinkW_fnGetIconLocation(IShellLinkW * iface, LPWSTR pszIconPath,INT cchIconPath,INT *piIcon) 1543 1544 { 1544 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);1545 1546 TRACE("(%p)->(%p len=%u iicon=%p)\n", This, pszIconPath, cchIconPath, piIcon);1545 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); 1546 1547 TRACE("(%p)->(%p len=%u iicon=%p)\n", This, pszIconPath, cchIconPath, piIcon); 1547 1548 1548 1549 MultiByteToWideChar( CP_ACP, 0, This->sIcoPath ? This->sIcoPath : "", -1, pszIconPath, cchIconPath ); 1549 *piIcon = This->iIcoNdx;1550 1551 return NOERROR;1550 *piIcon = This->iIcoNdx; 1551 1552 return NOERROR; 1552 1553 } 1553 1554 1554 1555 static HRESULT WINAPI IShellLinkW_fnSetIconLocation(IShellLinkW * iface, LPCWSTR pszIconPath,INT iIcon) 1555 1556 { 1556 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);1557 1558 TRACE("(%p)->(path=%s iicon=%u)\n",This, debugstr_w(pszIconPath), iIcon);1559 1560 if (This->sIcoPath)1561 HeapFree(GetProcessHeap(), 0, This->sIcoPath);1562 if (!(This->sIcoPath = HEAP_strdupWtoA(GetProcessHeap(), 0, pszIconPath)))1563 return E_OUTOFMEMORY; 1564 This->iIcoNdx = iIcon;1565 1566 return NOERROR;1557 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); 1558 1559 TRACE("(%p)->(path=%s iicon=%u)\n",This, debugstr_w(pszIconPath), iIcon); 1560 1561 if (This->sIcoPath) 1562 HeapFree(GetProcessHeap(), 0, This->sIcoPath); 1563 if (!(This->sIcoPath = HEAP_strdupWtoA(GetProcessHeap(), 0, pszIconPath))) 1564 return E_OUTOFMEMORY; 1565 This->iIcoNdx = iIcon; 1566 1567 return NOERROR; 1567 1568 } 1568 1569 1569 1570 static HRESULT WINAPI IShellLinkW_fnSetRelativePath(IShellLinkW * iface, LPCWSTR pszPathRel, DWORD dwReserved) 1570 1571 { 1571 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);1572 1573 FIXME("(%p)->(path=%s %lx)\n",This, debugstr_w(pszPathRel), dwReserved);1574 return NOERROR;1572 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); 1573 1574 FIXME("(%p)->(path=%s %lx)\n",This, debugstr_w(pszPathRel), dwReserved); 1575 return NOERROR; 1575 1576 } 1576 1577 1577 1578 static HRESULT WINAPI IShellLinkW_fnResolve(IShellLinkW * iface, HWND hwnd, DWORD fFlags) 1578 1579 { 1579 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);1580 1581 FIXME("(%p)->(hwnd=%x flags=%lx)\n",This, hwnd, fFlags);1582 return NOERROR;1580 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); 1581 1582 FIXME("(%p)->(hwnd=%x flags=%lx)\n",This, hwnd, fFlags); 1583 return NOERROR; 1583 1584 } 1584 1585 1585 1586 static HRESULT WINAPI IShellLinkW_fnSetPath(IShellLinkW * iface, LPCWSTR pszFile) 1586 1587 { 1587 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);1588 1589 TRACE("(%p)->(path=%s)\n",This, debugstr_w(pszFile));1590 1591 if (This->sPath)1592 HeapFree(GetProcessHeap(), 0, This->sPath);1593 if (!(This->sPath = HEAP_strdupWtoA(GetProcessHeap(), 0, pszFile)))1594 return E_OUTOFMEMORY; 1595 1596 return NOERROR;1588 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); 1589 1590 TRACE("(%p)->(path=%s)\n",This, debugstr_w(pszFile)); 1591 1592 if (This->sPath) 1593 HeapFree(GetProcessHeap(), 0, This->sPath); 1594 if (!(This->sPath = HEAP_strdupWtoA(GetProcessHeap(), 0, pszFile))) 1595 return E_OUTOFMEMORY; 1596 1597 return NOERROR; 1597 1598 } 1598 1599 … … 1601 1602 */ 1602 1603 1603 static ICOM_VTABLE(IShellLinkW) slvtw = 1604 { 1605 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE1606 IShellLinkW_fnQueryInterface,1607 IShellLinkW_fnAddRef,1608 IShellLinkW_fnRelease,1609 IShellLinkW_fnGetPath,1610 IShellLinkW_fnGetIDList,1611 IShellLinkW_fnSetIDList,1612 IShellLinkW_fnGetDescription,1613 IShellLinkW_fnSetDescription,1614 IShellLinkW_fnGetWorkingDirectory,1615 IShellLinkW_fnSetWorkingDirectory,1616 IShellLinkW_fnGetArguments,1617 IShellLinkW_fnSetArguments,1618 IShellLinkW_fnGetHotkey,1619 IShellLinkW_fnSetHotkey,1620 IShellLinkW_fnGetShowCmd,1621 IShellLinkW_fnSetShowCmd,1622 IShellLinkW_fnGetIconLocation,1623 IShellLinkW_fnSetIconLocation,1624 IShellLinkW_fnSetRelativePath,1625 IShellLinkW_fnResolve,1626 IShellLinkW_fnSetPath1604 static ICOM_VTABLE(IShellLinkW) slvtw = 1605 { 1606 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 1607 IShellLinkW_fnQueryInterface, 1608 IShellLinkW_fnAddRef, 1609 IShellLinkW_fnRelease, 1610 IShellLinkW_fnGetPath, 1611 IShellLinkW_fnGetIDList, 1612 IShellLinkW_fnSetIDList, 1613 IShellLinkW_fnGetDescription, 1614 IShellLinkW_fnSetDescription, 1615 IShellLinkW_fnGetWorkingDirectory, 1616 IShellLinkW_fnSetWorkingDirectory, 1617 IShellLinkW_fnGetArguments, 1618 IShellLinkW_fnSetArguments, 1619 IShellLinkW_fnGetHotkey, 1620 IShellLinkW_fnSetHotkey, 1621 IShellLinkW_fnGetShowCmd, 1622 IShellLinkW_fnSetShowCmd, 1623 IShellLinkW_fnGetIconLocation, 1624 IShellLinkW_fnSetIconLocation, 1625 IShellLinkW_fnSetRelativePath, 1626 IShellLinkW_fnResolve, 1627 IShellLinkW_fnSetPath 1627 1628 }; 1628 1629 -
trunk/src/shell32/shellole.c
r5618 r6650 1 /* $Id: shellole.c,v 1.3 2001-09-05 13:46:57 bird Exp $ */ 1 2 /* 2 * handling of SHELL32.DLL OLE-Objects3 * handling of SHELL32.DLL OLE-Objects 3 4 * 4 * Copyright 1997Marcus Meissner5 * Copyright 1998Juergen Schmied <juergen.schmied@metronet.de>5 * Copyright 1997 Marcus Meissner 6 * Copyright 1998 Juergen Schmied <juergen.schmied@metronet.de> 6 7 * 7 8 */ … … 24 25 DWORD WINAPI SHCLSIDFromStringA (LPSTR clsid, CLSID *id); 25 26 extern IShellFolder * IShellFolder_Constructor( 26 IShellFolder * psf,27 LPITEMIDLIST pidl);27 IShellFolder * psf, 28 LPITEMIDLIST pidl); 28 29 extern HRESULT IFSFolder_Constructor( 29 IUnknown * pUnkOuter,30 REFIID riid,31 LPVOID * ppv);30 IUnknown * pUnkOuter, 31 REFIID riid, 32 LPVOID * ppv); 32 33 33 34 /************************************************************************* 34 35 * SHCoCreateInstance [SHELL32.102] 35 * 36 * 36 37 * NOTES 37 38 * exported by ordinal 38 39 */ 39 40 LRESULT WINAPI SHCoCreateInstance( 40 LPSTR aclsid,41 REFCLSID clsid,42 IUnknown * unknownouter,43 REFIID refiid,44 LPVOID *ppv)45 { 46 DWORDhres;47 IIDiid;48 CLSID * myclsid = (CLSID*)clsid;49 50 if (!clsid)51 {52 if (!aclsid) return REGDB_E_CLASSNOTREG;53 SHCLSIDFromStringA(aclsid, &iid);54 myclsid = &iid;55 }56 57 TRACE("(%p,\n\tCLSID:\t%s, unk:%p\n\tIID:\t%s,%p)\n",58 aclsid,debugstr_guid(myclsid),unknownouter,debugstr_guid(refiid),ppv);59 60 if IsEqualCLSID(myclsid, &CLSID_ShellFSFolder)61 {62 hres = IFSFolder_Constructor(unknownouter, refiid, ppv);63 }64 else65 {66 hres = CoCreateInstance(myclsid, unknownouter, CLSCTX_INPROC_SERVER, refiid, ppv);67 }68 69 if(hres!=S_OK)70 {71 ERR("failed (0x%08lx) to create \n\tCLSID:\t%s\n\tIID:\t%s\n",41 LPSTR aclsid, 42 REFCLSID clsid, 43 IUnknown * unknownouter, 44 REFIID refiid, 45 LPVOID *ppv) 46 { 47 DWORD hres; 48 IID iid; 49 CLSID * myclsid = (CLSID*)clsid; 50 51 if (!clsid) 52 { 53 if (!aclsid) return REGDB_E_CLASSNOTREG; 54 SHCLSIDFromStringA(aclsid, &iid); 55 myclsid = &iid; 56 } 57 58 TRACE("(%p,\n\tCLSID:\t%s, unk:%p\n\tIID:\t%s,%p)\n", 59 aclsid,debugstr_guid(myclsid),unknownouter,debugstr_guid(refiid),ppv); 60 61 if IsEqualCLSID(myclsid, &CLSID_ShellFSFolder) 62 { 63 hres = IFSFolder_Constructor(unknownouter, refiid, ppv); 64 } 65 else 66 { 67 hres = CoCreateInstance(myclsid, unknownouter, CLSCTX_INPROC_SERVER, refiid, ppv); 68 } 69 70 if(hres!=S_OK) 71 { 72 ERR("failed (0x%08lx) to create \n\tCLSID:\t%s\n\tIID:\t%s\n", 72 73 hres, debugstr_guid(myclsid), debugstr_guid(refiid)); 73 ERR("class not found in registry\n");74 }75 76 TRACE("-- instance: %p\n",*ppv);77 return hres;74 ERR("class not found in registry\n"); 75 } 76 77 TRACE("-- instance: %p\n",*ppv); 78 return hres; 78 79 } 79 80 … … 82 83 */ 83 84 HRESULT WINAPI SHELL32_DllGetClassObject(REFCLSID rclsid, REFIID iid,LPVOID *ppv) 84 { HRESULThres = E_OUTOFMEMORY;85 LPCLASSFACTORY lpclf;86 87 TRACE("\n\tCLSID:\t%s,\n\tIID:\t%s\n",debugstr_guid(rclsid),debugstr_guid(iid));88 89 *ppv = NULL;90 91 if(IsEqualCLSID(rclsid, &CLSID_ShellDesktop)|| 92 IsEqualCLSID(rclsid, &CLSID_ShellLink))93 {94 lpclf = IClassFactory_Constructor( rclsid );95 96 if(lpclf) 97 {98 hres = IClassFactory_QueryInterface(lpclf,iid, ppv);99 IClassFactory_Release(lpclf);100 }101 }102 else103 {104 WARN("-- CLSID not found\n");105 hres = CLASS_E_CLASSNOTAVAILABLE;106 }107 TRACE("-- pointer to class factory: %p\n",*ppv);108 return hres;109 } 110 111 /************************************************************************* 112 * SHCLSIDFromString [SHELL32.147]85 { HRESULT hres = E_OUTOFMEMORY; 86 LPCLASSFACTORY lpclf; 87 88 TRACE("\n\tCLSID:\t%s,\n\tIID:\t%s\n",debugstr_guid(rclsid),debugstr_guid(iid)); 89 90 *ppv = NULL; 91 92 if(IsEqualCLSID(rclsid, &CLSID_ShellDesktop)|| 93 IsEqualCLSID(rclsid, &CLSID_ShellLink)) 94 { 95 lpclf = IClassFactory_Constructor( rclsid ); 96 97 if(lpclf) 98 { 99 hres = IClassFactory_QueryInterface(lpclf,iid, ppv); 100 IClassFactory_Release(lpclf); 101 } 102 } 103 else 104 { 105 WARN("-- CLSID not found\n"); 106 hres = CLASS_E_CLASSNOTAVAILABLE; 107 } 108 TRACE("-- pointer to class factory: %p\n",*ppv); 109 return hres; 110 } 111 112 /************************************************************************* 113 * SHCLSIDFromString [SHELL32.147] 113 114 * 114 115 * NOTES … … 125 126 DWORD WINAPI SHCLSIDFromStringW (LPWSTR clsid, CLSID *id) 126 127 { 127 TRACE("(%p(%s) %p)\n", clsid, debugstr_w(clsid), id);128 return CLSIDFromString(clsid, id); 128 TRACE("(%p(%s) %p)\n", clsid, debugstr_w(clsid), id); 129 return CLSIDFromString(clsid, id); 129 130 } 130 131 DWORD WINAPI SHCLSIDFromStringAW (LPVOID clsid, CLSID *id) 131 132 { 132 if (SHELL_OsIsUnicode())133 return SHCLSIDFromStringW (clsid, id);134 return SHCLSIDFromStringA (clsid, id);135 } 136 137 /************************************************************************* 138 * SHGetMalloc[SHELL32.220]133 if (SHELL_OsIsUnicode()) 134 return SHCLSIDFromStringW (clsid, id); 135 return SHCLSIDFromStringA (clsid, id); 136 } 137 138 /************************************************************************* 139 * SHGetMalloc [SHELL32.220] 139 140 * returns the interface to shell malloc. 140 141 * … … 145 146 * heap (ProcessHeap). 146 147 */ 147 DWORD WINAPI SHGetMalloc(LPMALLOC *lpmal) 148 { 149 TRACE("(%p)\n", lpmal);150 return CoGetMalloc(MEMCTX_TASK, lpmal);151 } 152 153 /************************************************************************* 154 * SHGetDesktopFolder [SHELL32.216]148 DWORD WINAPI SHGetMalloc(LPMALLOC *lpmal) 149 { 150 TRACE("(%p)\n", lpmal); 151 return CoGetMalloc(MEMCTX_TASK, lpmal); 152 } 153 154 /************************************************************************* 155 * SHGetDesktopFolder [SHELL32.216] 155 156 */ 156 157 LPSHELLFOLDER pdesktopfolder=NULL; … … 158 159 DWORD WINAPI SHGetDesktopFolder(IShellFolder **psf) 159 160 { 160 HRESULThres = S_OK;161 LPCLASSFACTORY lpclf;162 TRACE("%p->(%p)\n",psf,*psf);163 164 *psf=NULL;165 166 if (!pdesktopfolder) 167 {168 lpclf = IClassFactory_Constructor(&CLSID_ShellDesktop);169 if(lpclf) 170 {171 hres = IClassFactory_CreateInstance(lpclf,NULL,(REFIID)&IID_IShellFolder, (void*)&pdesktopfolder);172 IClassFactory_Release(lpclf);173 } 174 }175 176 if (pdesktopfolder) 177 {178 /* even if we create the folder, add a ref so the application canŽt destroy the folder*/179 IShellFolder_AddRef(pdesktopfolder);180 *psf = pdesktopfolder;181 }182 183 TRACE("-- %p->(%p)\n",psf, *psf);184 return hres;161 HRESULT hres = S_OK; 162 LPCLASSFACTORY lpclf; 163 TRACE("%p->(%p)\n",psf,*psf); 164 165 *psf=NULL; 166 167 if (!pdesktopfolder) 168 { 169 lpclf = IClassFactory_Constructor(&CLSID_ShellDesktop); 170 if(lpclf) 171 { 172 hres = IClassFactory_CreateInstance(lpclf,NULL,(REFIID)&IID_IShellFolder, (void*)&pdesktopfolder); 173 IClassFactory_Release(lpclf); 174 } 175 } 176 177 if (pdesktopfolder) 178 { 179 /* even if we create the folder, add a ref so the application canŽt destroy the folder*/ 180 IShellFolder_AddRef(pdesktopfolder); 181 *psf = pdesktopfolder; 182 } 183 184 TRACE("-- %p->(%p)\n",psf, *psf); 185 return hres; 185 186 } 186 187 … … 194 195 ICOM_VFIELD(IClassFactory); 195 196 DWORD ref; 196 CLSID *rclsid;197 CLSID *rclsid; 197 198 } IClassFactoryImpl; 198 199 … … 205 206 LPCLASSFACTORY IClassFactory_Constructor(REFCLSID rclsid) 206 207 { 207 IClassFactoryImpl* lpclf;208 209 lpclf= (IClassFactoryImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IClassFactoryImpl));210 lpclf->ref = 1;211 ICOM_VTBL(lpclf) = &clfvt;212 lpclf->rclsid = (CLSID*)rclsid;213 214 TRACE("(%p)->()\n",lpclf);215 InterlockedIncrement(&shell32_ObjCount);216 return (LPCLASSFACTORY)lpclf;208 IClassFactoryImpl* lpclf; 209 210 lpclf= (IClassFactoryImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IClassFactoryImpl)); 211 lpclf->ref = 1; 212 ICOM_VTBL(lpclf) = &clfvt; 213 lpclf->rclsid = (CLSID*)rclsid; 214 215 TRACE("(%p)->()\n",lpclf); 216 InterlockedIncrement(&shell32_ObjCount); 217 return (LPCLASSFACTORY)lpclf; 217 218 } 218 219 /************************************************************************** … … 222 223 LPCLASSFACTORY iface, REFIID riid, LPVOID *ppvObj) 223 224 { 224 ICOM_THIS(IClassFactoryImpl,iface);225 TRACE("(%p)->(\n\tIID:\t%s)\n",This,debugstr_guid(riid));226 227 *ppvObj = NULL;228 229 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/230 { *ppvObj = This; 231 }232 else if(IsEqualIID(riid, &IID_IClassFactory)) /*IClassFactory*/233 { *ppvObj = (IClassFactory*)This;234 } 235 236 if(*ppvObj)237 { IUnknown_AddRef((LPUNKNOWN)*ppvObj); 238 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);239 return S_OK;240 }241 TRACE("-- Interface: %s E_NOINTERFACE\n", debugstr_guid(riid));242 return E_NOINTERFACE;243 } 225 ICOM_THIS(IClassFactoryImpl,iface); 226 TRACE("(%p)->(\n\tIID:\t%s)\n",This,debugstr_guid(riid)); 227 228 *ppvObj = NULL; 229 230 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/ 231 { *ppvObj = This; 232 } 233 else if(IsEqualIID(riid, &IID_IClassFactory)) /*IClassFactory*/ 234 { *ppvObj = (IClassFactory*)This; 235 } 236 237 if(*ppvObj) 238 { IUnknown_AddRef((LPUNKNOWN)*ppvObj); 239 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj); 240 return S_OK; 241 } 242 TRACE("-- Interface: %s E_NOINTERFACE\n", debugstr_guid(riid)); 243 return E_NOINTERFACE; 244 } 244 245 /****************************************************************************** 245 246 * IClassFactory_AddRef … … 247 248 static ULONG WINAPI IClassFactory_fnAddRef(LPCLASSFACTORY iface) 248 249 { 249 ICOM_THIS(IClassFactoryImpl,iface);250 TRACE("(%p)->(count=%lu)\n",This,This->ref);251 252 InterlockedIncrement(&shell32_ObjCount);253 return InterlockedIncrement(&This->ref);250 ICOM_THIS(IClassFactoryImpl,iface); 251 TRACE("(%p)->(count=%lu)\n",This,This->ref); 252 253 InterlockedIncrement(&shell32_ObjCount); 254 return InterlockedIncrement(&This->ref); 254 255 } 255 256 /****************************************************************************** … … 258 259 static ULONG WINAPI IClassFactory_fnRelease(LPCLASSFACTORY iface) 259 260 { 260 ICOM_THIS(IClassFactoryImpl,iface);261 TRACE("(%p)->(count=%lu)\n",This,This->ref);262 263 InterlockedDecrement(&shell32_ObjCount);264 if (!InterlockedDecrement(&This->ref)) 265 {266 TRACE("-- destroying IClassFactory(%p)\n",This);267 HeapFree(GetProcessHeap(),0,This);268 return 0;269 }270 return This->ref;261 ICOM_THIS(IClassFactoryImpl,iface); 262 TRACE("(%p)->(count=%lu)\n",This,This->ref); 263 264 InterlockedDecrement(&shell32_ObjCount); 265 if (!InterlockedDecrement(&This->ref)) 266 { 267 TRACE("-- destroying IClassFactory(%p)\n",This); 268 HeapFree(GetProcessHeap(),0,This); 269 return 0; 270 } 271 return This->ref; 271 272 } 272 273 /****************************************************************************** … … 276 277 LPCLASSFACTORY iface, LPUNKNOWN pUnknown, REFIID riid, LPVOID *ppObject) 277 278 { 278 ICOM_THIS(IClassFactoryImpl,iface);279 IUnknown *pObj = NULL;280 HRESULT hres;281 282 TRACE("%p->(%p,\n\tIID:\t%s,%p)\n",This,pUnknown,debugstr_guid(riid),ppObject);283 284 *ppObject = NULL;285 286 if(pUnknown)287 {288 return(CLASS_E_NOAGGREGATION);289 }290 291 if (IsEqualCLSID(This->rclsid, &CLSID_ShellDesktop))292 {293 pObj = (IUnknown *)ISF_Desktop_Constructor();294 }295 else if (IsEqualCLSID(This->rclsid, &CLSID_ShellLink))296 {297 pObj = (IUnknown *)IShellLink_Constructor(FALSE);298 } 299 else300 {301 ERR("unknown IID requested\n\tIID:\t%s\n",debugstr_guid(riid));302 return(E_NOINTERFACE);303 }304 305 if (!pObj)306 {307 return(E_OUTOFMEMORY);308 }309 310 hres = IUnknown_QueryInterface(pObj,riid, ppObject);311 IUnknown_Release(pObj);312 313 TRACE("-- Object created: (%p)->%p\n",This,*ppObject);314 315 return hres;279 ICOM_THIS(IClassFactoryImpl,iface); 280 IUnknown *pObj = NULL; 281 HRESULT hres; 282 283 TRACE("%p->(%p,\n\tIID:\t%s,%p)\n",This,pUnknown,debugstr_guid(riid),ppObject); 284 285 *ppObject = NULL; 286 287 if(pUnknown) 288 { 289 return(CLASS_E_NOAGGREGATION); 290 } 291 292 if (IsEqualCLSID(This->rclsid, &CLSID_ShellDesktop)) 293 { 294 pObj = (IUnknown *)ISF_Desktop_Constructor(); 295 } 296 else if (IsEqualCLSID(This->rclsid, &CLSID_ShellLink)) 297 { 298 pObj = (IUnknown *)IShellLink_Constructor(FALSE); 299 } 300 else 301 { 302 ERR("unknown IID requested\n\tIID:\t%s\n",debugstr_guid(riid)); 303 return(E_NOINTERFACE); 304 } 305 306 if (!pObj) 307 { 308 return(E_OUTOFMEMORY); 309 } 310 311 hres = IUnknown_QueryInterface(pObj,riid, ppObject); 312 IUnknown_Release(pObj); 313 314 TRACE("-- Object created: (%p)->%p\n",This,*ppObject); 315 316 return hres; 316 317 } 317 318 /****************************************************************************** … … 320 321 static HRESULT WINAPI IClassFactory_fnLockServer(LPCLASSFACTORY iface, BOOL fLock) 321 322 { 322 ICOM_THIS(IClassFactoryImpl,iface);323 TRACE("%p->(0x%x), not implemented\n",This, fLock);324 return E_NOTIMPL;325 } 326 327 static ICOM_VTABLE(IClassFactory) clfvt = 323 ICOM_THIS(IClassFactoryImpl,iface); 324 TRACE("%p->(0x%x), not implemented\n",This, fLock); 325 return E_NOTIMPL; 326 } 327 328 static ICOM_VTABLE(IClassFactory) clfvt = 328 329 { 329 330 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE … … 355 356 ICOM_VFIELD(IClassFactory); 356 357 DWORD ref; 357 CLSID *rclsid;358 LPFNCREATEINSTANCE lpfnCI;359 const IID * riidInst;360 ULONG * pcRefDll; /* pointer to refcounter in external dll (ugrrr...) */358 CLSID *rclsid; 359 LPFNCREATEINSTANCE lpfnCI; 360 const IID * riidInst; 361 ULONG * pcRefDll; /* pointer to refcounter in external dll (ugrrr...) */ 361 362 } IDefClFImpl; 362 363 … … 369 370 IClassFactory * IDefClF_fnConstructor(LPFNCREATEINSTANCE lpfnCI, PLONG pcRefDll, REFIID riidInst) 370 371 { 371 IDefClFImpl* lpclf;372 373 lpclf = (IDefClFImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDefClFImpl));374 lpclf->ref = 1;375 ICOM_VTBL(lpclf) = &dclfvt;376 lpclf->lpfnCI = lpfnCI;377 lpclf->pcRefDll = pcRefDll;378 379 if (pcRefDll) InterlockedIncrement(pcRefDll);380 lpclf->riidInst = riidInst;381 382 TRACE("(%p)\n\tIID:\t%s\n",lpclf, debugstr_guid(riidInst));383 InterlockedIncrement(&shell32_ObjCount);384 return (LPCLASSFACTORY)lpclf;372 IDefClFImpl* lpclf; 373 374 lpclf = (IDefClFImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDefClFImpl)); 375 lpclf->ref = 1; 376 ICOM_VTBL(lpclf) = &dclfvt; 377 lpclf->lpfnCI = lpfnCI; 378 lpclf->pcRefDll = pcRefDll; 379 380 if (pcRefDll) InterlockedIncrement(pcRefDll); 381 lpclf->riidInst = riidInst; 382 383 TRACE("(%p)\n\tIID:\t%s\n",lpclf, debugstr_guid(riidInst)); 384 InterlockedIncrement(&shell32_ObjCount); 385 return (LPCLASSFACTORY)lpclf; 385 386 } 386 387 /************************************************************************** … … 390 391 LPCLASSFACTORY iface, REFIID riid, LPVOID *ppvObj) 391 392 { 392 ICOM_THIS(IDefClFImpl,iface);393 394 TRACE("(%p)->(\n\tIID:\t%s)\n",This,debugstr_guid(riid));395 396 *ppvObj = NULL;397 398 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/399 { *ppvObj = This; 400 }401 else if(IsEqualIID(riid, &IID_IClassFactory)) /*IClassFactory*/402 { *ppvObj = (IClassFactory*)This;403 } 404 405 if(*ppvObj)406 { IUnknown_AddRef((LPUNKNOWN)*ppvObj); 407 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);408 return S_OK;409 }410 TRACE("-- Interface: %s E_NOINTERFACE\n", debugstr_guid(riid));411 return E_NOINTERFACE;412 } 393 ICOM_THIS(IDefClFImpl,iface); 394 395 TRACE("(%p)->(\n\tIID:\t%s)\n",This,debugstr_guid(riid)); 396 397 *ppvObj = NULL; 398 399 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/ 400 { *ppvObj = This; 401 } 402 else if(IsEqualIID(riid, &IID_IClassFactory)) /*IClassFactory*/ 403 { *ppvObj = (IClassFactory*)This; 404 } 405 406 if(*ppvObj) 407 { IUnknown_AddRef((LPUNKNOWN)*ppvObj); 408 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj); 409 return S_OK; 410 } 411 TRACE("-- Interface: %s E_NOINTERFACE\n", debugstr_guid(riid)); 412 return E_NOINTERFACE; 413 } 413 414 /****************************************************************************** 414 415 * IDefClF_fnAddRef … … 416 417 static ULONG WINAPI IDefClF_fnAddRef(LPCLASSFACTORY iface) 417 418 { 418 ICOM_THIS(IDefClFImpl,iface);419 TRACE("(%p)->(count=%lu)\n",This,This->ref);420 421 InterlockedIncrement(&shell32_ObjCount);422 return InterlockedIncrement(&This->ref);419 ICOM_THIS(IDefClFImpl,iface); 420 TRACE("(%p)->(count=%lu)\n",This,This->ref); 421 422 InterlockedIncrement(&shell32_ObjCount); 423 return InterlockedIncrement(&This->ref); 423 424 } 424 425 /****************************************************************************** … … 427 428 static ULONG WINAPI IDefClF_fnRelease(LPCLASSFACTORY iface) 428 429 { 429 ICOM_THIS(IDefClFImpl,iface);430 TRACE("(%p)->(count=%lu)\n",This,This->ref);431 432 InterlockedDecrement(&shell32_ObjCount);433 434 if (!InterlockedDecrement(&This->ref)) 435 { 436 if (This->pcRefDll) InterlockedDecrement(This->pcRefDll);437 438 TRACE("-- destroying IClassFactory(%p)\n",This);439 HeapFree(GetProcessHeap(),0,This);440 return 0;441 }442 return This->ref;430 ICOM_THIS(IDefClFImpl,iface); 431 TRACE("(%p)->(count=%lu)\n",This,This->ref); 432 433 InterlockedDecrement(&shell32_ObjCount); 434 435 if (!InterlockedDecrement(&This->ref)) 436 { 437 if (This->pcRefDll) InterlockedDecrement(This->pcRefDll); 438 439 TRACE("-- destroying IClassFactory(%p)\n",This); 440 HeapFree(GetProcessHeap(),0,This); 441 return 0; 442 } 443 return This->ref; 443 444 } 444 445 /****************************************************************************** … … 448 449 LPCLASSFACTORY iface, LPUNKNOWN pUnkOuter, REFIID riid, LPVOID *ppvObject) 449 450 { 450 ICOM_THIS(IDefClFImpl,iface);451 452 TRACE("%p->(%p,\n\tIID:\t%s,%p)\n",This,pUnkOuter,debugstr_guid(riid),ppvObject);453 454 *ppvObject = NULL;455 456 if(pUnkOuter)457 return(CLASS_E_NOAGGREGATION);458 459 if ( This->riidInst==NULL ||460 IsEqualCLSID(riid, This->riidInst) ||461 IsEqualCLSID(riid, &IID_IUnknown) )462 {463 return This->lpfnCI(pUnkOuter, riid, ppvObject);464 }465 466 ERR("unknown IID requested\n\tIID:\t%s\n",debugstr_guid(riid));467 return E_NOINTERFACE;451 ICOM_THIS(IDefClFImpl,iface); 452 453 TRACE("%p->(%p,\n\tIID:\t%s,%p)\n",This,pUnkOuter,debugstr_guid(riid),ppvObject); 454 455 *ppvObject = NULL; 456 457 if(pUnkOuter) 458 return(CLASS_E_NOAGGREGATION); 459 460 if ( This->riidInst==NULL || 461 IsEqualCLSID(riid, This->riidInst) || 462 IsEqualCLSID(riid, &IID_IUnknown) ) 463 { 464 return This->lpfnCI(pUnkOuter, riid, ppvObject); 465 } 466 467 ERR("unknown IID requested\n\tIID:\t%s\n",debugstr_guid(riid)); 468 return E_NOINTERFACE; 468 469 } 469 470 /****************************************************************************** … … 472 473 static HRESULT WINAPI IDefClF_fnLockServer(LPCLASSFACTORY iface, BOOL fLock) 473 474 { 474 ICOM_THIS(IDefClFImpl,iface);475 TRACE("%p->(0x%x), not implemented\n",This, fLock);476 return E_NOTIMPL;477 } 478 479 static ICOM_VTABLE(IClassFactory) dclfvt = 475 ICOM_THIS(IDefClFImpl,iface); 476 TRACE("%p->(0x%x), not implemented\n",This, fLock); 477 return E_NOTIMPL; 478 } 479 480 static ICOM_VTABLE(IClassFactory) dclfvt = 480 481 { 481 482 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE … … 488 489 489 490 /****************************************************************************** 490 * SHCreateDefClassObject [SHELL32.70]491 * SHCreateDefClassObject [SHELL32.70] 491 492 */ 492 493 HRESULT WINAPI SHCreateDefClassObject( 493 REFIID riid, 494 LPVOID* ppv, 495 LPFNCREATEINSTANCE lpfnCI,/* [in] create instance callback entry */496 PLONG pcRefDll,/* [in/out] ref count of the dll */497 REFIID riidInst)/* [in] optional interface to the instance */498 { 499 TRACE("\n\tIID:\t%s %p %p %p \n\tIIDIns:\t%s\n",494 REFIID riid, 495 LPVOID* ppv, 496 LPFNCREATEINSTANCE lpfnCI, /* [in] create instance callback entry */ 497 PLONG pcRefDll, /* [in/out] ref count of the dll */ 498 REFIID riidInst) /* [in] optional interface to the instance */ 499 { 500 TRACE("\n\tIID:\t%s %p %p %p \n\tIIDIns:\t%s\n", 500 501 debugstr_guid(riid), ppv, lpfnCI, pcRefDll, debugstr_guid(riidInst)); 501 502 502 if ( IsEqualCLSID(riid, &IID_IClassFactory) )503 {504 IClassFactory * pcf = IDefClF_fnConstructor(lpfnCI, pcRefDll, riidInst);505 if (pcf)506 {507 *ppv = pcf;508 return NOERROR;509 }510 return E_OUTOFMEMORY;511 }512 return E_NOINTERFACE;513 } 514 515 /************************************************************************* 516 * DragAcceptFiles [SHELL32.54]503 if ( IsEqualCLSID(riid, &IID_IClassFactory) ) 504 { 505 IClassFactory * pcf = IDefClF_fnConstructor(lpfnCI, pcRefDll, riidInst); 506 if (pcf) 507 { 508 *ppv = pcf; 509 return NOERROR; 510 } 511 return E_OUTOFMEMORY; 512 } 513 return E_NOINTERFACE; 514 } 515 516 /************************************************************************* 517 * DragAcceptFiles [SHELL32.54] 517 518 */ 518 519 void WINAPI DragAcceptFiles(HWND hWnd, BOOL b) 519 520 { 520 LONG exstyle;521 522 if( !IsWindow(hWnd) ) return;523 exstyle = GetWindowLongA(hWnd,GWL_EXSTYLE);524 if (b)525 exstyle |= WS_EX_ACCEPTFILES;526 else527 exstyle &= ~WS_EX_ACCEPTFILES;528 SetWindowLongA(hWnd,GWL_EXSTYLE,exstyle);529 } 530 531 /************************************************************************* 532 * DragFinish [SHELL32.80]521 LONG exstyle; 522 523 if( !IsWindow(hWnd) ) return; 524 exstyle = GetWindowLongA(hWnd,GWL_EXSTYLE); 525 if (b) 526 exstyle |= WS_EX_ACCEPTFILES; 527 else 528 exstyle &= ~WS_EX_ACCEPTFILES; 529 SetWindowLongA(hWnd,GWL_EXSTYLE,exstyle); 530 } 531 532 /************************************************************************* 533 * DragFinish [SHELL32.80] 533 534 */ 534 535 void WINAPI DragFinish(HDROP h) 535 536 { 536 TRACE("\n");537 GlobalFree((HGLOBAL)h);538 } 539 540 /************************************************************************* 541 * DragQueryPoint [SHELL32.135]537 TRACE("\n"); 538 GlobalFree((HGLOBAL)h); 539 } 540 541 /************************************************************************* 542 * DragQueryPoint [SHELL32.135] 542 543 */ 543 544 BOOL WINAPI DragQueryPoint(HDROP hDrop, POINT *p) 544 545 { 545 546 DROPFILES *lpDropFileStruct; 546 BOOL bRet;547 548 TRACE("\n");549 550 lpDropFileStruct = (DROPFILES *) GlobalLock(hDrop);547 BOOL bRet; 548 549 TRACE("\n"); 550 551 lpDropFileStruct = (DROPFILES *) GlobalLock(hDrop); 551 552 552 553 *p = lpDropFileStruct->pt; 553 bRet = lpDropFileStruct->fNC;554 555 GlobalUnlock(hDrop);556 return bRet;557 } 558 559 /************************************************************************* 560 * DragQueryFileA [SHELL32.81] [shell32.82]554 bRet = lpDropFileStruct->fNC; 555 556 GlobalUnlock(hDrop); 557 return bRet; 558 } 559 560 /************************************************************************* 561 * DragQueryFileA [SHELL32.81] [shell32.82] 561 562 */ 562 563 UINT WINAPI DragQueryFileA( 563 HDROP hDrop,564 UINT lFile,565 LPSTR lpszFile,566 UINT lLength)567 { 568 LPSTR lpDrop;569 UINT i = 0;570 DROPFILES *lpDropFileStruct = (DROPFILES *) GlobalLock(hDrop);571 572 TRACE("(%08x, %x, %p, %u)\n",hDrop,lFile,lpszFile,lLength);573 574 if(!lpDropFileStruct) goto end;575 576 lpDrop = (LPSTR) lpDropFileStruct + lpDropFileStruct->pFiles;577 578 while (i++ < lFile)579 {580 while (*lpDrop++); /* skip filename */581 if (!*lpDrop) 582 {583 i = (lFile == 0xFFFFFFFF) ? i : 0; 584 goto end;585 }586 }587 588 i = strlen(lpDrop);589 i++;590 if (!lpszFile ) goto end; /* needed buffer size */591 i = (lLength > i) ? i : lLength;592 lstrcpynA (lpszFile, lpDrop, i);564 HDROP hDrop, 565 UINT lFile, 566 LPSTR lpszFile, 567 UINT lLength) 568 { 569 LPSTR lpDrop; 570 UINT i = 0; 571 DROPFILES *lpDropFileStruct = (DROPFILES *) GlobalLock(hDrop); 572 573 TRACE("(%08x, %x, %p, %u)\n", hDrop,lFile,lpszFile,lLength); 574 575 if(!lpDropFileStruct) goto end; 576 577 lpDrop = (LPSTR) lpDropFileStruct + lpDropFileStruct->pFiles; 578 579 while (i++ < lFile) 580 { 581 while (*lpDrop++); /* skip filename */ 582 if (!*lpDrop) 583 { 584 i = (lFile == 0xFFFFFFFF) ? i : 0; 585 goto end; 586 } 587 } 588 589 i = strlen(lpDrop); 590 i++; 591 if (!lpszFile ) goto end; /* needed buffer size */ 592 i = (lLength > i) ? i : lLength; 593 lstrcpynA (lpszFile, lpDrop, i); 593 594 end: 594 GlobalUnlock(hDrop);595 return i;596 } 597 598 /************************************************************************* 599 * DragQueryFileW [shell32.133]595 GlobalUnlock(hDrop); 596 return i; 597 } 598 599 /************************************************************************* 600 * DragQueryFileW [shell32.133] 600 601 */ 601 602 UINT WINAPI DragQueryFileW( 602 HDROP hDrop,603 UINT lFile,604 LPWSTR lpszwFile,605 UINT lLength)606 { 607 LPWSTR lpwDrop;608 UINT i = 0;609 DROPFILES *lpDropFileStruct = (DROPFILES *) GlobalLock(hDrop);610 611 TRACE("(%08x, %x, %p, %u)\n", hDrop,lFile,lpszwFile,lLength);612 613 if(!lpDropFileStruct) goto end;614 615 lpwDrop = (LPWSTR) lpDropFileStruct + lpDropFileStruct->pFiles;616 617 i = 0;618 while (i++ < lFile)619 {620 while (*lpwDrop++); /* skip filename */621 if (!*lpwDrop) 622 {623 i = (lFile == 0xFFFFFFFF) ? i : 0; 624 goto end;625 }626 }627 628 i = strlenW(lpwDrop);629 i++;630 if ( !lpszwFile) goto end; /* needed buffer size */631 632 i = (lLength > i) ? i : lLength;633 lstrcpynW (lpszwFile, lpwDrop, i);603 HDROP hDrop, 604 UINT lFile, 605 LPWSTR lpszwFile, 606 UINT lLength) 607 { 608 LPWSTR lpwDrop; 609 UINT i = 0; 610 DROPFILES *lpDropFileStruct = (DROPFILES *) GlobalLock(hDrop); 611 612 TRACE("(%08x, %x, %p, %u)\n", hDrop,lFile,lpszwFile,lLength); 613 614 if(!lpDropFileStruct) goto end; 615 616 lpwDrop = (LPWSTR) lpDropFileStruct + lpDropFileStruct->pFiles; 617 618 i = 0; 619 while (i++ < lFile) 620 { 621 while (*lpwDrop++); /* skip filename */ 622 if (!*lpwDrop) 623 { 624 i = (lFile == 0xFFFFFFFF) ? i : 0; 625 goto end; 626 } 627 } 628 629 i = strlenW(lpwDrop); 630 i++; 631 if ( !lpszwFile) goto end; /* needed buffer size */ 632 633 i = (lLength > i) ? i : lLength; 634 lstrcpynW (lpszwFile, lpwDrop, i); 634 635 end: 635 GlobalUnlock(hDrop);636 return i;637 } 636 GlobalUnlock(hDrop); 637 return i; 638 } -
trunk/src/shell32/shellord.c
r5618 r6650 1 /* $Id: shellord.c,v 1.4 2001-09-05 13:46:57 bird Exp $ */ 1 2 /* 2 3 * The parameters of many functions changes between different OS versions 3 4 * (NT uses Unicode strings, 95 uses ASCII strings) 4 * 5 * 5 6 * Copyright 1997 Marcus Meissner 6 7 * 1998 Jürgen Schmied … … 23 24 24 25 /************************************************************************* 25 * ParseFieldA [internal]26 * ParseFieldA [internal] 26 27 * 27 28 * copys a field from a ',' delimited string 28 * 29 * 29 30 * first field is nField = 1 30 31 */ 31 32 DWORD WINAPI ParseFieldA( 32 LPCSTR src,33 DWORD nField,34 LPSTR dst,35 DWORD len) 36 { 37 WARN("('%s',0x%08lx,%p,%ld) semi-stub.\n",src,nField,dst,len);38 39 if (!src || !src[0] || !dst || !len)40 return 0;41 42 /* skip n fields delimited by ',' */43 while (nField > 1)44 {45 if (*src=='\0') return FALSE;46 if (*(src++)==',') nField--;47 }48 49 /* copy part till the next ',' to dst */50 while ( *src!='\0' && *src!=',' && (len--)>0 ) *(dst++)=*(src++);51 52 /* finalize the string */53 *dst=0x0;54 55 return TRUE;56 } 57 58 /************************************************************************* 59 * ParseFieldW [internal]33 LPCSTR src, 34 DWORD nField, 35 LPSTR dst, 36 DWORD len) 37 { 38 WARN("('%s',0x%08lx,%p,%ld) semi-stub.\n",src,nField,dst,len); 39 40 if (!src || !src[0] || !dst || !len) 41 return 0; 42 43 /* skip n fields delimited by ',' */ 44 while (nField > 1) 45 { 46 if (*src=='\0') return FALSE; 47 if (*(src++)==',') nField--; 48 } 49 50 /* copy part till the next ',' to dst */ 51 while ( *src!='\0' && *src!=',' && (len--)>0 ) *(dst++)=*(src++); 52 53 /* finalize the string */ 54 *dst=0x0; 55 56 return TRUE; 57 } 58 59 /************************************************************************* 60 * ParseFieldW [internal] 60 61 * 61 62 * copys a field from a ',' delimited string 62 * 63 * 63 64 * first field is nField = 1 64 65 */ 65 DWORD WINAPI ParseFieldW(LPCWSTR src, DWORD nField, LPWSTR dst, DWORD len) 66 { 67 FIXME("('%s',0x%08lx,%p,%ld) stub.\n",68 debugstr_w(src), nField, dst, len);69 return FALSE;70 } 71 72 /************************************************************************* 73 * ParseFieldAW [SHELL32.58]74 */ 75 DWORD WINAPI ParseFieldAW(LPCVOID src, DWORD nField, LPVOID dst, DWORD len) 76 { 77 if (SHELL_OsIsUnicode())78 return ParseFieldW(src, nField, dst, len);79 return ParseFieldA(src, nField, dst, len);80 } 81 82 /************************************************************************* 83 * GetFileNameFromBrowse [SHELL32.63]84 * 66 DWORD WINAPI ParseFieldW(LPCWSTR src, DWORD nField, LPWSTR dst, DWORD len) 67 { 68 FIXME("('%s',0x%08lx,%p,%ld) stub.\n", 69 debugstr_w(src), nField, dst, len); 70 return FALSE; 71 } 72 73 /************************************************************************* 74 * ParseFieldAW [SHELL32.58] 75 */ 76 DWORD WINAPI ParseFieldAW(LPCVOID src, DWORD nField, LPVOID dst, DWORD len) 77 { 78 if (SHELL_OsIsUnicode()) 79 return ParseFieldW(src, nField, dst, len); 80 return ParseFieldA(src, nField, dst, len); 81 } 82 83 /************************************************************************* 84 * GetFileNameFromBrowse [SHELL32.63] 85 * 85 86 */ 86 87 BOOL WINAPI GetFileNameFromBrowse( 87 HWND hwndOwner,88 LPSTR lpstrFile,89 DWORD nMaxFile,90 LPCSTR lpstrInitialDir,91 LPCSTR lpstrDefExt,92 LPCSTR lpstrFilter,93 LPCSTR lpstrTitle)94 { 95 FIXME("(%04x,%s,%ld,%s,%s,%s,%s):stub.\n",96 hwndOwner, lpstrFile, nMaxFile, lpstrInitialDir, lpstrDefExt,97 lpstrFilter, lpstrTitle);88 HWND hwndOwner, 89 LPSTR lpstrFile, 90 DWORD nMaxFile, 91 LPCSTR lpstrInitialDir, 92 LPCSTR lpstrDefExt, 93 LPCSTR lpstrFilter, 94 LPCSTR lpstrTitle) 95 { 96 FIXME("(%04x,%s,%ld,%s,%s,%s,%s):stub.\n", 97 hwndOwner, lpstrFile, nMaxFile, lpstrInitialDir, lpstrDefExt, 98 lpstrFilter, lpstrTitle); 98 99 99 100 /* puts up a Open Dialog and requests input into targetbuf */ … … 104 105 105 106 /************************************************************************* 106 * SHGetSetSettings [SHELL32.68]107 * SHGetSetSettings [SHELL32.68] 107 108 */ 108 109 VOID WINAPI SHGetSetSettings(DWORD x, DWORD y, DWORD z) 109 110 { 110 FIXME("0x%08lx 0x%08lx 0x%08lx\n", x, y, z);111 } 112 113 /************************************************************************* 114 * SHGetSettings [SHELL32.@]115 * 111 FIXME("0x%08lx 0x%08lx 0x%08lx\n", x, y, z); 112 } 113 114 /************************************************************************* 115 * SHGetSettings [SHELL32.@] 116 * 116 117 * NOTES 117 118 * the registry path are for win98 (tested) … … 121 122 VOID WINAPI SHGetSettings(LPSHELLFLAGSTATE lpsfs, DWORD dwMask) 122 123 { 123 HKEYhKey;124 DWORDdwData;125 DWORDdwDataSize = sizeof (DWORD);126 127 TRACE("(%p 0x%08lx)\n",lpsfs,dwMask);128 129 if (RegCreateKeyExA(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",130 0, 0, 0, KEY_ALL_ACCESS, 0, &hKey, 0))131 return;132 133 if ( (SSF_SHOWEXTENSIONS & dwMask) && !RegQueryValueExA(hKey, "HideFileExt", 0, 0, (LPBYTE)&dwData, &dwDataSize))134 lpsfs->fShowExtensions = ((dwData == 0) ? 0 : 1);135 136 if ( (SSF_SHOWINFOTIP & dwMask) && !RegQueryValueExA(hKey, "ShowInfoTip", 0, 0, (LPBYTE)&dwData, &dwDataSize))137 lpsfs->fShowInfoTip = ((dwData == 0) ? 0 : 1);138 139 if ( (SSF_DONTPRETTYPATH & dwMask) && !RegQueryValueExA(hKey, "DontPrettyPath", 0, 0, (LPBYTE)&dwData, &dwDataSize))140 lpsfs->fDontPrettyPath = ((dwData == 0) ? 0 : 1);141 142 if ( (SSF_HIDEICONS & dwMask) && !RegQueryValueExA(hKey, "HideIcons", 0, 0, (LPBYTE)&dwData, &dwDataSize))143 lpsfs->fHideIcons = ((dwData == 0) ? 0 : 1);144 145 if ( (SSF_MAPNETDRVBUTTON & dwMask) && !RegQueryValueExA(hKey, "MapNetDrvBtn", 0, 0, (LPBYTE)&dwData, &dwDataSize))146 lpsfs->fMapNetDrvBtn = ((dwData == 0) ? 0 : 1);147 148 if ( (SSF_SHOWATTRIBCOL & dwMask) && !RegQueryValueExA(hKey, "ShowAttribCol", 0, 0, (LPBYTE)&dwData, &dwDataSize))149 lpsfs->fShowAttribCol = ((dwData == 0) ? 0 : 1);150 151 if (((SSF_SHOWALLOBJECTS | SSF_SHOWSYSFILES) & dwMask) && !RegQueryValueExA(hKey, "Hidden", 0, 0, (LPBYTE)&dwData, &dwDataSize))152 { if (dwData == 0)153 { if (SSF_SHOWALLOBJECTS & dwMask)lpsfs->fShowAllObjects = 0;154 if (SSF_SHOWSYSFILES & dwMask)lpsfs->fShowSysFiles = 0;155 }156 else if (dwData == 1)157 { if (SSF_SHOWALLOBJECTS & dwMask)lpsfs->fShowAllObjects = 1;158 if (SSF_SHOWSYSFILES & dwMask)lpsfs->fShowSysFiles = 0;159 }160 else if (dwData == 2)161 { if (SSF_SHOWALLOBJECTS & dwMask)lpsfs->fShowAllObjects = 0;162 if (SSF_SHOWSYSFILES & dwMask)lpsfs->fShowSysFiles = 1;163 }164 }165 RegCloseKey (hKey);166 167 TRACE("-- 0x%04x\n", *(WORD*)lpsfs);168 } 169 170 /************************************************************************* 171 * SHShellFolderView_Message [SHELL32.73]124 HKEY hKey; 125 DWORD dwData; 126 DWORD dwDataSize = sizeof (DWORD); 127 128 TRACE("(%p 0x%08lx)\n",lpsfs,dwMask); 129 130 if (RegCreateKeyExA(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced", 131 0, 0, 0, KEY_ALL_ACCESS, 0, &hKey, 0)) 132 return; 133 134 if ( (SSF_SHOWEXTENSIONS & dwMask) && !RegQueryValueExA(hKey, "HideFileExt", 0, 0, (LPBYTE)&dwData, &dwDataSize)) 135 lpsfs->fShowExtensions = ((dwData == 0) ? 0 : 1); 136 137 if ( (SSF_SHOWINFOTIP & dwMask) && !RegQueryValueExA(hKey, "ShowInfoTip", 0, 0, (LPBYTE)&dwData, &dwDataSize)) 138 lpsfs->fShowInfoTip = ((dwData == 0) ? 0 : 1); 139 140 if ( (SSF_DONTPRETTYPATH & dwMask) && !RegQueryValueExA(hKey, "DontPrettyPath", 0, 0, (LPBYTE)&dwData, &dwDataSize)) 141 lpsfs->fDontPrettyPath = ((dwData == 0) ? 0 : 1); 142 143 if ( (SSF_HIDEICONS & dwMask) && !RegQueryValueExA(hKey, "HideIcons", 0, 0, (LPBYTE)&dwData, &dwDataSize)) 144 lpsfs->fHideIcons = ((dwData == 0) ? 0 : 1); 145 146 if ( (SSF_MAPNETDRVBUTTON & dwMask) && !RegQueryValueExA(hKey, "MapNetDrvBtn", 0, 0, (LPBYTE)&dwData, &dwDataSize)) 147 lpsfs->fMapNetDrvBtn = ((dwData == 0) ? 0 : 1); 148 149 if ( (SSF_SHOWATTRIBCOL & dwMask) && !RegQueryValueExA(hKey, "ShowAttribCol", 0, 0, (LPBYTE)&dwData, &dwDataSize)) 150 lpsfs->fShowAttribCol = ((dwData == 0) ? 0 : 1); 151 152 if (((SSF_SHOWALLOBJECTS | SSF_SHOWSYSFILES) & dwMask) && !RegQueryValueExA(hKey, "Hidden", 0, 0, (LPBYTE)&dwData, &dwDataSize)) 153 { if (dwData == 0) 154 { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 0; 155 if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 0; 156 } 157 else if (dwData == 1) 158 { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 1; 159 if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 0; 160 } 161 else if (dwData == 2) 162 { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 0; 163 if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 1; 164 } 165 } 166 RegCloseKey (hKey); 167 168 TRACE("-- 0x%04x\n", *(WORD*)lpsfs); 169 } 170 171 /************************************************************************* 172 * SHShellFolderView_Message [SHELL32.73] 172 173 * 173 174 * PARAMETERS 174 * hwndCabinet defines the explorer cabinet window that contains the 175 * hwndCabinet defines the explorer cabinet window that contains the 175 176 * shellview you need to communicate with 176 177 * uMsg identifying the SFVM enum to perform … … 184 185 */ 185 186 int WINAPI SHShellFolderView_Message( 186 HWND hwndCabinet, 187 DWORD dwMessage,188 DWORD dwParam)189 { 190 FIXME("%04x %08lx %08lx stub\n",hwndCabinet, dwMessage, dwParam);191 return 0;192 } 193 194 /************************************************************************* 195 * RegisterShellHook [SHELL32.181]187 HWND hwndCabinet, 188 DWORD dwMessage, 189 DWORD dwParam) 190 { 191 FIXME("%04x %08lx %08lx stub\n",hwndCabinet, dwMessage, dwParam); 192 return 0; 193 } 194 195 /************************************************************************* 196 * RegisterShellHook [SHELL32.181] 196 197 * 197 198 * PARAMS 198 199 * hwnd [I] window handle 199 200 * y [I] flag ???? 200 * 201 * 201 202 * NOTES 202 203 * exported by ordinal 203 204 */ 204 205 BOOL WINAPI RegisterShellHook( 205 HWND hWnd,206 DWORD dwType)207 { 208 FIXME("(0x%08x,0x%08lx):stub.\n",hWnd, dwType);209 return TRUE;210 } 211 /************************************************************************* 212 * ShellMessageBoxW [SHELL32.182]206 HWND hWnd, 207 DWORD dwType) 208 { 209 FIXME("(0x%08x,0x%08lx):stub.\n",hWnd, dwType); 210 return TRUE; 211 } 212 /************************************************************************* 213 * ShellMessageBoxW [SHELL32.182] 213 214 * 214 215 * Format and output errormessage. 215 216 * 216 * idText resource ID of title or LPSTR217 * idTitle resource ID of title or LPSTR217 * idText resource ID of title or LPSTR 218 * idTitle resource ID of title or LPSTR 218 219 * 219 220 * NOTES … … 221 222 */ 222 223 int WINAPIV ShellMessageBoxW( 223 HINSTANCE hInstance,224 HWND hWnd,225 LPCWSTR lpText,226 LPCWSTR lpCaption,227 UINT uType,228 ...)229 { 230 WCHARszText[100],szTitle[100];231 LPCWSTR pszText = szText, pszTitle = szTitle, pszTemp;232 va_list args;233 intret;234 235 va_start(args, uType);236 /* wvsprintfA(buf,fmt, args); */237 238 TRACE("(%08lx,%08lx,%p,%p,%08x)\n",239 (DWORD)hInstance,(DWORD)hWnd,lpText,lpCaption,uType);240 241 if (!HIWORD(lpCaption))242 LoadStringW(hInstance, (DWORD)lpCaption, szTitle, sizeof(szTitle)/sizeof(szTitle[0]));243 else244 pszTitle = lpCaption;245 246 if (!HIWORD(lpText))247 LoadStringW(hInstance, (DWORD)lpText, szText, sizeof(szText)/sizeof(szText[0]));248 else249 pszText = lpText;250 251 FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING, 252 pszText, 0, 0, (LPWSTR)&pszTemp, 0, &args);253 254 va_end(args);255 256 ret = MessageBoxW(hWnd,pszTemp,pszTitle,uType);257 LocalFree((HLOCAL)pszTemp);258 return ret;259 } 260 261 /************************************************************************* 262 * ShellMessageBoxA [SHELL32.183]224 HINSTANCE hInstance, 225 HWND hWnd, 226 LPCWSTR lpText, 227 LPCWSTR lpCaption, 228 UINT uType, 229 ...) 230 { 231 WCHAR szText[100],szTitle[100]; 232 LPCWSTR pszText = szText, pszTitle = szTitle, pszTemp; 233 va_list args; 234 int ret; 235 236 va_start(args, uType); 237 /* wvsprintfA(buf,fmt, args); */ 238 239 TRACE("(%08lx,%08lx,%p,%p,%08x)\n", 240 (DWORD)hInstance,(DWORD)hWnd,lpText,lpCaption,uType); 241 242 if (!HIWORD(lpCaption)) 243 LoadStringW(hInstance, (DWORD)lpCaption, szTitle, sizeof(szTitle)/sizeof(szTitle[0])); 244 else 245 pszTitle = lpCaption; 246 247 if (!HIWORD(lpText)) 248 LoadStringW(hInstance, (DWORD)lpText, szText, sizeof(szText)/sizeof(szText[0])); 249 else 250 pszText = lpText; 251 252 FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING, 253 pszText, 0, 0, (LPWSTR)&pszTemp, 0, &args); 254 255 va_end(args); 256 257 ret = MessageBoxW(hWnd,pszTemp,pszTitle,uType); 258 LocalFree((HLOCAL)pszTemp); 259 return ret; 260 } 261 262 /************************************************************************* 263 * ShellMessageBoxA [SHELL32.183] 263 264 */ 264 265 int WINAPIV ShellMessageBoxA( 265 HINSTANCE hInstance,266 HWND hWnd,267 LPCSTR lpText,268 LPCSTR lpCaption,269 UINT uType,270 ...)271 { 272 charszText[100],szTitle[100];273 LPCSTR pszText = szText, pszTitle = szTitle, pszTemp;274 va_list args;275 intret;276 277 va_start(args, uType);278 /* wvsprintfA(buf,fmt, args); */279 280 TRACE("(%08lx,%08lx,%p,%p,%08x)\n",281 (DWORD)hInstance,(DWORD)hWnd,lpText,lpCaption,uType);282 283 if (!HIWORD(lpCaption))284 LoadStringA(hInstance, (DWORD)lpCaption, szTitle, sizeof(szTitle));285 else286 pszTitle = lpCaption;287 288 if (!HIWORD(lpText))289 LoadStringA(hInstance, (DWORD)lpText, szText, sizeof(szText));290 else291 pszText = lpText;292 293 FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING, 294 pszText, 0, 0, (LPSTR)&pszTemp, 0, &args);295 296 va_end(args);297 298 ret = MessageBoxA(hWnd,pszTemp,pszTitle,uType);299 LocalFree((HLOCAL)pszTemp);300 return ret;301 } 302 303 /************************************************************************* 304 * SHFree [SHELL32.195]266 HINSTANCE hInstance, 267 HWND hWnd, 268 LPCSTR lpText, 269 LPCSTR lpCaption, 270 UINT uType, 271 ...) 272 { 273 char szText[100],szTitle[100]; 274 LPCSTR pszText = szText, pszTitle = szTitle, pszTemp; 275 va_list args; 276 int ret; 277 278 va_start(args, uType); 279 /* wvsprintfA(buf,fmt, args); */ 280 281 TRACE("(%08lx,%08lx,%p,%p,%08x)\n", 282 (DWORD)hInstance,(DWORD)hWnd,lpText,lpCaption,uType); 283 284 if (!HIWORD(lpCaption)) 285 LoadStringA(hInstance, (DWORD)lpCaption, szTitle, sizeof(szTitle)); 286 else 287 pszTitle = lpCaption; 288 289 if (!HIWORD(lpText)) 290 LoadStringA(hInstance, (DWORD)lpText, szText, sizeof(szText)); 291 else 292 pszText = lpText; 293 294 FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING, 295 pszText, 0, 0, (LPSTR)&pszTemp, 0, &args); 296 297 va_end(args); 298 299 ret = MessageBoxA(hWnd,pszTemp,pszTitle,uType); 300 LocalFree((HLOCAL)pszTemp); 301 return ret; 302 } 303 304 /************************************************************************* 305 * SHFree [SHELL32.195] 305 306 * 306 307 * NOTES … … 309 310 */ 310 311 #define MEM_DEBUG 0 311 void WINAPI SHFree(LPVOID x) 312 void WINAPI SHFree(LPVOID x) 312 313 { 313 314 #if MEM_DEBUG 314 WORD len = *(LPWORD)((LPBYTE)x-2);315 316 if ( *(LPWORD)((LPBYTE)x+len) != 0x7384)317 ERR("MAGIC2!\n");318 319 if ( (*(LPWORD)((LPBYTE)x-4)) != 0x8271)320 ERR("MAGIC1!\n");321 else322 memset((LPBYTE)x-4, 0xde, len+6);323 324 TRACE("%p len=%u\n",x, len);325 326 x = (LPBYTE) x - 4;315 WORD len = *(LPWORD)((LPBYTE)x-2); 316 317 if ( *(LPWORD)((LPBYTE)x+len) != 0x7384) 318 ERR("MAGIC2!\n"); 319 320 if ( (*(LPWORD)((LPBYTE)x-4)) != 0x8271) 321 ERR("MAGIC1!\n"); 322 else 323 memset((LPBYTE)x-4, 0xde, len+6); 324 325 TRACE("%p len=%u\n",x, len); 326 327 x = (LPBYTE) x - 4; 327 328 #else 328 TRACE("%p\n",x);329 TRACE("%p\n",x); 329 330 #endif 330 HeapFree(GetProcessHeap(), 0, x);331 } 332 333 /************************************************************************* 334 * SHAlloc [SHELL32.196]331 HeapFree(GetProcessHeap(), 0, x); 332 } 333 334 /************************************************************************* 335 * SHAlloc [SHELL32.196] 335 336 * 336 337 * NOTES … … 338 339 * exported by ordinal 339 340 */ 340 LPVOID WINAPI SHAlloc(DWORD len) 341 { 342 LPBYTE ret;341 LPVOID WINAPI SHAlloc(DWORD len) 342 { 343 LPBYTE ret; 343 344 344 345 #if MEM_DEBUG 345 ret = (LPVOID) HeapAlloc(GetProcessHeap(),0,len+6);346 ret = (LPVOID) HeapAlloc(GetProcessHeap(),0,len+6); 346 347 #else 347 ret = (LPVOID) HeapAlloc(GetProcessHeap(),0,len);348 ret = (LPVOID) HeapAlloc(GetProcessHeap(),0,len); 348 349 #endif 349 350 350 351 #if MEM_DEBUG 351 *(LPWORD)(ret) = 0x8271;352 *(LPWORD)(ret+2) = (WORD)len;353 *(LPWORD)(ret+4+len) = 0x7384;354 ret += 4;355 memset(ret, 0xdf, len);352 *(LPWORD)(ret) = 0x8271; 353 *(LPWORD)(ret+2) = (WORD)len; 354 *(LPWORD)(ret+4+len) = 0x7384; 355 ret += 4; 356 memset(ret, 0xdf, len); 356 357 #endif 357 TRACE("%lu bytes at %p\n",len, ret);358 return (LPVOID)ret;359 } 360 361 /************************************************************************* 362 * SHRegisterDragDrop [SHELL32.86]358 TRACE("%lu bytes at %p\n",len, ret); 359 return (LPVOID)ret; 360 } 361 362 /************************************************************************* 363 * SHRegisterDragDrop [SHELL32.86] 363 364 * 364 365 * NOTES … … 366 367 */ 367 368 HRESULT WINAPI SHRegisterDragDrop( 368 HWND hWnd,369 LPDROPTARGET pDropTarget)370 { 371 FIXME("(0x%08x,%p):stub.\n", hWnd, pDropTarget);372 if (GetShellOle()) return pRegisterDragDrop(hWnd, pDropTarget);369 HWND hWnd, 370 LPDROPTARGET pDropTarget) 371 { 372 FIXME("(0x%08x,%p):stub.\n", hWnd, pDropTarget); 373 if (GetShellOle()) return pRegisterDragDrop(hWnd, pDropTarget); 373 374 return 0; 374 375 } 375 376 376 377 /************************************************************************* 377 * SHRevokeDragDrop [SHELL32.87]378 * SHRevokeDragDrop [SHELL32.87] 378 379 * 379 380 * NOTES … … 387 388 388 389 /************************************************************************* 389 * SHDoDragDrop [SHELL32.88]390 * SHDoDragDrop [SHELL32.88] 390 391 * 391 392 * NOTES … … 393 394 */ 394 395 HRESULT WINAPI SHDoDragDrop( 395 HWND hWnd,396 LPDATAOBJECT lpDataObject,397 LPDROPSOURCE lpDropSource,398 DWORD dwOKEffect,399 LPDWORD pdwEffect)396 HWND hWnd, 397 LPDATAOBJECT lpDataObject, 398 LPDROPSOURCE lpDropSource, 399 DWORD dwOKEffect, 400 LPDWORD pdwEffect) 400 401 { 401 402 FIXME("(0x%04x %p %p 0x%08lx %p):stub.\n", … … 405 406 406 407 /************************************************************************* 407 * ArrangeWindows [SHELL32.184]408 * 408 * ArrangeWindows [SHELL32.184] 409 * 409 410 */ 410 411 WORD WINAPI ArrangeWindows( 411 HWND hwndParent,412 DWORD dwReserved,413 LPCRECT lpRect,414 WORD cKids,415 CONST HWND * lpKids)412 HWND hwndParent, 413 DWORD dwReserved, 414 LPCRECT lpRect, 415 WORD cKids, 416 CONST HWND * lpKids) 416 417 { 417 418 FIXME("(0x%08x 0x%08lx %p 0x%04x %p):stub.\n", 418 hwndParent, dwReserved, lpRect, cKids, lpKids);419 return 0; 420 } 421 422 /************************************************************************* 423 * SignalFileOpen [SHELL32.103]419 hwndParent, dwReserved, lpRect, cKids, lpKids); 420 return 0; 421 } 422 423 /************************************************************************* 424 * SignalFileOpen [SHELL32.103] 424 425 * 425 426 * NOTES … … 435 436 436 437 /************************************************************************* 437 * SHAddToRecentDocs [SHELL32.234]438 * SHAddToRecentDocs [SHELL32.234] 438 439 * 439 440 * PARAMETERS … … 444 445 * exported by name 445 446 */ 446 DWORD WINAPI SHAddToRecentDocs (UINT uFlags,LPCVOID pv) 447 DWORD WINAPI SHAddToRecentDocs (UINT uFlags,LPCVOID pv) 447 448 { if (SHARD_PIDL==uFlags) 448 449 { FIXME("(0x%08x,pidl=%p):stub.\n", uFlags,pv); 449 }450 else451 { FIXME("(0x%08x,%s):stub.\n", uFlags,(char*)pv);452 }450 } 451 else 452 { FIXME("(0x%08x,%s):stub.\n", uFlags,(char*)pv); 453 } 453 454 return 0; 454 455 } 455 456 /************************************************************************* 456 * SHCreateShellFolderViewEx [SHELL32.174]457 * SHCreateShellFolderViewEx [SHELL32.174] 457 458 * 458 459 * NOTES … … 460 461 */ 461 462 HRESULT WINAPI SHCreateShellFolderViewEx( 462 LPCSHELLFOLDERVIEWINFO psvcbi, /* [in] shelltemplate struct */463 LPSHELLVIEW* ppv) /* [out] IShellView pointer */464 { 465 IShellView * psf;466 HRESULT hRes;467 468 TRACE("sf=%p pidl=%p cb=%p mode=0x%08x parm=0x%08lx\n", 469 psvcbi->pshf, psvcbi->pidlFolder, psvcbi->lpfnCallback,470 psvcbi->uViewMode, psvcbi->dwUser);471 472 psf = IShellView_Constructor(psvcbi->pshf);473 474 if (!psf)475 return E_OUTOFMEMORY;476 477 IShellView_AddRef(psf);478 hRes = IShellView_QueryInterface(psf, &IID_IShellView, (LPVOID *)ppv);479 IShellView_Release(psf);480 481 return hRes;482 } 483 /************************************************************************* 484 * SHWinHelp [SHELL32.127]463 LPCSHELLFOLDERVIEWINFO psvcbi, /* [in] shelltemplate struct */ 464 LPSHELLVIEW* ppv) /* [out] IShellView pointer */ 465 { 466 IShellView * psf; 467 HRESULT hRes; 468 469 TRACE("sf=%p pidl=%p cb=%p mode=0x%08x parm=0x%08lx\n", 470 psvcbi->pshf, psvcbi->pidlFolder, psvcbi->lpfnCallback, 471 psvcbi->uViewMode, psvcbi->dwUser); 472 473 psf = IShellView_Constructor(psvcbi->pshf); 474 475 if (!psf) 476 return E_OUTOFMEMORY; 477 478 IShellView_AddRef(psf); 479 hRes = IShellView_QueryInterface(psf, &IID_IShellView, (LPVOID *)ppv); 480 IShellView_Release(psf); 481 482 return hRes; 483 } 484 /************************************************************************* 485 * SHWinHelp [SHELL32.127] 485 486 * 486 487 */ 487 488 HRESULT WINAPI SHWinHelp (DWORD v, DWORD w, DWORD x, DWORD z) 488 { FIXME("0x%08lx 0x%08lx 0x%08lx 0x%08lx stub\n",v,w,x,z);489 return 0;489 { FIXME("0x%08lx 0x%08lx 0x%08lx 0x%08lx stub\n",v,w,x,z); 490 return 0; 490 491 } 491 492 /************************************************************************* … … 494 495 */ 495 496 HRESULT WINAPI SHRunControlPanel (DWORD x, DWORD z) 496 { FIXME("0x%08lx 0x%08lx stub\n",x,z);497 return 0;498 } 499 /************************************************************************* 500 * ShellExecuteEx [SHELL32.291]497 { FIXME("0x%08lx 0x%08lx stub\n",x,z); 498 return 0; 499 } 500 /************************************************************************* 501 * ShellExecuteEx [SHELL32.291] 501 502 * 502 503 */ 503 504 BOOL WINAPI ShellExecuteExAW (LPVOID sei) 504 { if (SHELL_OsIsUnicode())505 return ShellExecuteExW (sei);506 return ShellExecuteExA (sei);507 } 508 /************************************************************************* 509 * ShellExecuteExA [SHELL32.292]505 { if (SHELL_OsIsUnicode()) 506 return ShellExecuteExW (sei); 507 return ShellExecuteExA (sei); 508 } 509 /************************************************************************* 510 * ShellExecuteExA [SHELL32.292] 510 511 * 511 512 * placeholder in the commandline: 512 * %1 file513 * %2 printer514 * %3 driver515 * %4 port516 * %I adress of a global item ID (explorer switch /idlist)517 * %L ??? path/url/current file ???518 * %S ???519 * %* all following parameters (see batfile)513 * %1 file 514 * %2 printer 515 * %3 driver 516 * %4 port 517 * %I adress of a global item ID (explorer switch /idlist) 518 * %L ??? path/url/current file ??? 519 * %S ??? 520 * %* all following parameters (see batfile) 520 521 */ 521 522 BOOL WINAPI ShellExecuteExA (LPSHELLEXECUTEINFOA sei) 522 { CHAR szApplicationName[MAX_PATH],szCommandline[MAX_PATH],szPidl[20];523 LPSTR pos;524 int gap, len;525 STARTUPINFOA startup;526 PROCESS_INFORMATION info;527 528 WARN("mask=0x%08lx hwnd=0x%04x verb=%s file=%s parm=%s dir=%s show=0x%08x class=%s incomplete\n",529 sei->fMask, sei->hwnd, sei->lpVerb, sei->lpFile,530 sei->lpParameters, sei->lpDirectory, sei->nShow, 531 (sei->fMask & SEE_MASK_CLASSNAME) ? sei->lpClass : "not used");532 533 ZeroMemory(szApplicationName,MAX_PATH);534 if (sei->lpFile)535 strcpy(szApplicationName, sei->lpFile);536 537 ZeroMemory(szCommandline,MAX_PATH);538 if (sei->lpParameters)539 strcpy(szCommandline, sei->lpParameters);540 541 if (sei->fMask & (SEE_MASK_CLASSKEY | SEE_MASK_INVOKEIDLIST | SEE_MASK_ICON | SEE_MASK_HOTKEY |542 SEE_MASK_CONNECTNETDRV | SEE_MASK_FLAG_DDEWAIT |543 SEE_MASK_DOENVSUBST | SEE_MASK_FLAG_NO_UI | SEE_MASK_UNICODE | 544 SEE_MASK_NO_CONSOLE | SEE_MASK_ASYNCOK | SEE_MASK_HMONITOR ))545 {546 FIXME("flags ignored: 0x%08lx\n", sei->fMask);547 }548 549 /* launch a document by fileclass like 'Wordpad.Document.1' */550 if (sei->fMask & SEE_MASK_CLASSNAME)551 {552 /* the commandline contains 'c:\Path\wordpad.exe "%1"' */553 HCR_GetExecuteCommand(sei->lpClass, (sei->lpVerb) ? sei->lpVerb : "open", szCommandline, 256);554 /* fixme: get the extension of lpFile, check if it fits to the lpClass */555 TRACE("SEE_MASK_CLASSNAME->'%s'\n", szCommandline);556 }557 558 /* process the IDList */559 if ( (sei->fMask & SEE_MASK_INVOKEIDLIST) == SEE_MASK_INVOKEIDLIST) /*0x0c*/560 {561 SHGetPathFromIDListA (sei->lpIDList,szApplicationName);562 TRACE("-- idlist=%p (%s)\n", sei->lpIDList, szApplicationName);563 }564 else565 {566 if (sei->fMask & SEE_MASK_IDLIST )567 {568 pos = strstr(szCommandline, "%I");569 if (pos)570 {571 LPVOID pv;572 HGLOBAL hmem = SHAllocShared ( sei->lpIDList, ILGetSize(sei->lpIDList), 0);573 pv = SHLockShared(hmem,0);574 sprintf(szPidl,":%p",pv );575 SHUnlockShared(pv);576 577 gap = strlen(szPidl);578 len = strlen(pos)-2;579 memmove(pos+gap,pos+2,len);580 memcpy(pos,szPidl,gap);581 582 }583 }584 }585 586 TRACE("execute:'%s','%s'\n",szApplicationName, szCommandline);587 588 strcat(szApplicationName, " ");589 strcat(szApplicationName, szCommandline);590 591 ZeroMemory(&startup,sizeof(STARTUPINFOA));592 startup.cb = sizeof(STARTUPINFOA);593 594 if (! CreateProcessA(NULL, szApplicationName,595 NULL, NULL, FALSE, 0, 596 NULL, NULL, &startup, &info))597 {598 sei->hInstApp = GetLastError();599 return FALSE;600 }523 { CHAR szApplicationName[MAX_PATH],szCommandline[MAX_PATH],szPidl[20]; 524 LPSTR pos; 525 int gap, len; 526 STARTUPINFOA startup; 527 PROCESS_INFORMATION info; 528 529 WARN("mask=0x%08lx hwnd=0x%04x verb=%s file=%s parm=%s dir=%s show=0x%08x class=%s incomplete\n", 530 sei->fMask, sei->hwnd, sei->lpVerb, sei->lpFile, 531 sei->lpParameters, sei->lpDirectory, sei->nShow, 532 (sei->fMask & SEE_MASK_CLASSNAME) ? sei->lpClass : "not used"); 533 534 ZeroMemory(szApplicationName,MAX_PATH); 535 if (sei->lpFile) 536 strcpy(szApplicationName, sei->lpFile); 537 538 ZeroMemory(szCommandline,MAX_PATH); 539 if (sei->lpParameters) 540 strcpy(szCommandline, sei->lpParameters); 541 542 if (sei->fMask & (SEE_MASK_CLASSKEY | SEE_MASK_INVOKEIDLIST | SEE_MASK_ICON | SEE_MASK_HOTKEY | 543 SEE_MASK_CONNECTNETDRV | SEE_MASK_FLAG_DDEWAIT | 544 SEE_MASK_DOENVSUBST | SEE_MASK_FLAG_NO_UI | SEE_MASK_UNICODE | 545 SEE_MASK_NO_CONSOLE | SEE_MASK_ASYNCOK | SEE_MASK_HMONITOR )) 546 { 547 FIXME("flags ignored: 0x%08lx\n", sei->fMask); 548 } 549 550 /* launch a document by fileclass like 'Wordpad.Document.1' */ 551 if (sei->fMask & SEE_MASK_CLASSNAME) 552 { 553 /* the commandline contains 'c:\Path\wordpad.exe "%1"' */ 554 HCR_GetExecuteCommand(sei->lpClass, (sei->lpVerb) ? sei->lpVerb : "open", szCommandline, 256); 555 /* fixme: get the extension of lpFile, check if it fits to the lpClass */ 556 TRACE("SEE_MASK_CLASSNAME->'%s'\n", szCommandline); 557 } 558 559 /* process the IDList */ 560 if ( (sei->fMask & SEE_MASK_INVOKEIDLIST) == SEE_MASK_INVOKEIDLIST) /*0x0c*/ 561 { 562 SHGetPathFromIDListA (sei->lpIDList,szApplicationName); 563 TRACE("-- idlist=%p (%s)\n", sei->lpIDList, szApplicationName); 564 } 565 else 566 { 567 if (sei->fMask & SEE_MASK_IDLIST ) 568 { 569 pos = strstr(szCommandline, "%I"); 570 if (pos) 571 { 572 LPVOID pv; 573 HGLOBAL hmem = SHAllocShared ( sei->lpIDList, ILGetSize(sei->lpIDList), 0); 574 pv = SHLockShared(hmem,0); 575 sprintf(szPidl,":%p",pv ); 576 SHUnlockShared(pv); 577 578 gap = strlen(szPidl); 579 len = strlen(pos)-2; 580 memmove(pos+gap,pos+2,len); 581 memcpy(pos,szPidl,gap); 582 583 } 584 } 585 } 586 587 TRACE("execute:'%s','%s'\n",szApplicationName, szCommandline); 588 589 strcat(szApplicationName, " "); 590 strcat(szApplicationName, szCommandline); 591 592 ZeroMemory(&startup,sizeof(STARTUPINFOA)); 593 startup.cb = sizeof(STARTUPINFOA); 594 595 if (! CreateProcessA(NULL, szApplicationName, 596 NULL, NULL, FALSE, 0, 597 NULL, NULL, &startup, &info)) 598 { 599 sei->hInstApp = GetLastError(); 600 return FALSE; 601 } 601 602 602 603 sei->hInstApp = 33; 603 604 /* Give 30 seconds to the app to come up */605 if ( WaitForInputIdle ( info.hProcess, 30000 ) == 0xFFFFFFFF )606 ERR("WaitForInputIdle failed: Error %ld\n", GetLastError() );607 608 if(sei->fMask & SEE_MASK_NOCLOSEPROCESS)609 sei->hProcess = info.hProcess; 604 605 /* Give 30 seconds to the app to come up */ 606 if ( WaitForInputIdle ( info.hProcess, 30000 ) == 0xFFFFFFFF ) 607 ERR("WaitForInputIdle failed: Error %ld\n", GetLastError() ); 608 609 if(sei->fMask & SEE_MASK_NOCLOSEPROCESS) 610 sei->hProcess = info.hProcess; 610 611 else 611 612 CloseHandle( info.hProcess ); 612 613 CloseHandle( info.hThread ); 613 return TRUE;614 } 615 /************************************************************************* 616 * ShellExecuteExW [SHELL32.293]614 return TRUE; 615 } 616 /************************************************************************* 617 * ShellExecuteExW [SHELL32.293] 617 618 * 618 619 */ 619 620 BOOL WINAPI ShellExecuteExW (LPSHELLEXECUTEINFOW sei) 620 { SHELLEXECUTEINFOA seiA;621 DWORD ret;622 623 TRACE("%p\n", sei);624 625 memcpy(&seiA, sei, sizeof(SHELLEXECUTEINFOA));626 621 { SHELLEXECUTEINFOA seiA; 622 DWORD ret; 623 624 TRACE("%p\n", sei); 625 626 memcpy(&seiA, sei, sizeof(SHELLEXECUTEINFOA)); 627 627 628 if (sei->lpVerb) 628 seiA.lpVerb = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpVerb);629 seiA.lpVerb = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpVerb); 629 630 630 631 if (sei->lpFile) 631 seiA.lpFile = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpFile);632 seiA.lpFile = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpFile); 632 633 633 634 if (sei->lpParameters) 634 seiA.lpParameters = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpParameters);635 636 if (sei->lpDirectory)637 seiA.lpDirectory = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpDirectory);635 seiA.lpParameters = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpParameters); 636 637 if (sei->lpDirectory) 638 seiA.lpDirectory = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpDirectory); 638 639 639 640 if ((sei->fMask & SEE_MASK_CLASSNAME) && sei->lpClass) 640 seiA.lpClass = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpClass);641 else642 seiA.lpClass = NULL;643 644 ret = ShellExecuteExA(&seiA);645 646 if (seiA.lpVerb) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpVerb );647 if (seiA.lpFile)HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpFile );648 if (seiA.lpParameters)HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpParameters );649 if (seiA.lpDirectory)HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpDirectory );650 if (seiA.lpClass)HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpClass );651 652 return ret;641 seiA.lpClass = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpClass); 642 else 643 seiA.lpClass = NULL; 644 645 ret = ShellExecuteExA(&seiA); 646 647 if (seiA.lpVerb) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpVerb ); 648 if (seiA.lpFile) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpFile ); 649 if (seiA.lpParameters) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpParameters ); 650 if (seiA.lpDirectory) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpDirectory ); 651 if (seiA.lpClass) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpClass ); 652 653 return ret; 653 654 } 654 655 655 656 static LPUNKNOWN SHELL32_IExplorerInterface=0; 656 657 /************************************************************************* 657 * SHSetInstanceExplorer [SHELL32.176]658 * SHSetInstanceExplorer [SHELL32.176] 658 659 * 659 660 * NOTES … … 661 662 */ 662 663 HRESULT WINAPI SHSetInstanceExplorer (LPUNKNOWN lpUnknown) 663 { TRACE("%p\n", lpUnknown);664 SHELL32_IExplorerInterface = lpUnknown;665 return (HRESULT) lpUnknown;666 } 667 /************************************************************************* 668 * SHGetInstanceExplorer [SHELL32.256]664 { TRACE("%p\n", lpUnknown); 665 SHELL32_IExplorerInterface = lpUnknown; 666 return (HRESULT) lpUnknown; 667 } 668 /************************************************************************* 669 * SHGetInstanceExplorer [SHELL32.256] 669 670 * 670 671 * NOTES … … 672 673 */ 673 674 HRESULT WINAPI SHGetInstanceExplorer (LPUNKNOWN * lpUnknown) 674 { TRACE("%p\n", lpUnknown);675 676 *lpUnknown = SHELL32_IExplorerInterface;677 678 if (!SHELL32_IExplorerInterface)679 return E_FAIL;680 681 IUnknown_AddRef(SHELL32_IExplorerInterface);682 return NOERROR;683 } 684 /************************************************************************* 685 * SHFreeUnusedLibraries [SHELL32.123]675 { TRACE("%p\n", lpUnknown); 676 677 *lpUnknown = SHELL32_IExplorerInterface; 678 679 if (!SHELL32_IExplorerInterface) 680 return E_FAIL; 681 682 IUnknown_AddRef(SHELL32_IExplorerInterface); 683 return NOERROR; 684 } 685 /************************************************************************* 686 * SHFreeUnusedLibraries [SHELL32.123] 686 687 * 687 688 * NOTES … … 690 691 void WINAPI SHFreeUnusedLibraries (void) 691 692 { 692 FIXME("stub\n");693 } 694 /************************************************************************* 695 * DAD_SetDragImage [SHELL32.136]693 FIXME("stub\n"); 694 } 695 /************************************************************************* 696 * DAD_SetDragImage [SHELL32.136] 696 697 * 697 698 * NOTES … … 699 700 */ 700 701 BOOL WINAPI DAD_SetDragImage( 701 HIMAGELIST himlTrack,702 LPPOINT lppt)703 { 704 FIXME("%p %p stub\n",himlTrack, lppt);702 HIMAGELIST himlTrack, 703 LPPOINT lppt) 704 { 705 FIXME("%p %p stub\n",himlTrack, lppt); 705 706 return 0; 706 707 } 707 708 /************************************************************************* 708 * DAD_ShowDragImage [SHELL32.137]709 * DAD_ShowDragImage [SHELL32.137] 709 710 * 710 711 * NOTES … … 713 714 BOOL WINAPI DAD_ShowDragImage(BOOL bShow) 714 715 { 715 FIXME("0x%08x stub\n",bShow);716 return 0;717 } 718 /************************************************************************* 719 * ReadCabinetState [NT 4.0:SHELL32.651]716 FIXME("0x%08x stub\n",bShow); 717 return 0; 718 } 719 /************************************************************************* 720 * ReadCabinetState [NT 4.0:SHELL32.651] 720 721 * 721 722 */ 722 723 HRESULT WINAPI ReadCabinetState(DWORD u, DWORD v) 723 { FIXME("0x%04lx 0x%04lx stub\n",u,v);724 return 0;725 } 726 /************************************************************************* 727 * WriteCabinetState [NT 4.0:SHELL32.652]724 { FIXME("0x%04lx 0x%04lx stub\n",u,v); 725 return 0; 726 } 727 /************************************************************************* 728 * WriteCabinetState [NT 4.0:SHELL32.652] 728 729 * 729 730 */ 730 731 HRESULT WINAPI WriteCabinetState(DWORD u) 731 { FIXME("0x%04lx stub\n",u);732 return 0;733 } 734 /************************************************************************* 735 * FileIconInit [SHELL32.660]732 { FIXME("0x%04lx stub\n",u); 733 return 0; 734 } 735 /************************************************************************* 736 * FileIconInit [SHELL32.660] 736 737 * 737 738 */ 738 739 BOOL WINAPI FileIconInit(BOOL bFullInit) 739 { FIXME("(%s)\n", bFullInit ? "true" : "false");740 return 0;741 } 742 /************************************************************************* 743 * IsUserAdmin [NT 4.0:SHELL32.680]740 { FIXME("(%s)\n", bFullInit ? "true" : "false"); 741 return 0; 742 } 743 /************************************************************************* 744 * IsUserAdmin [NT 4.0:SHELL32.680] 744 745 * 745 746 */ 746 747 HRESULT WINAPI IsUserAdmin(void) 747 { FIXME("stub\n");748 return TRUE;749 } 750 751 /************************************************************************* 752 * SHAllocShared [SHELL32.520]748 { FIXME("stub\n"); 749 return TRUE; 750 } 751 752 /************************************************************************* 753 * SHAllocShared [SHELL32.520] 753 754 * 754 755 * NOTES … … 762 763 */ 763 764 HGLOBAL WINAPI SHAllocShared(LPVOID psrc, DWORD size, DWORD procID) 764 { HGLOBAL hmem;765 LPVOID pmem;766 767 TRACE("ptr=%p size=0x%04lx procID=0x%04lx\n",psrc,size,procID);768 hmem = GlobalAlloc(GMEM_FIXED, size);769 if (!hmem)770 return 0;771 772 pmem = GlobalLock (hmem);773 774 if (! pmem)775 return 0;776 777 memcpy (pmem, psrc, size);778 GlobalUnlock(hmem); 779 return hmem;780 } 781 /************************************************************************* 782 * SHLockShared [SHELL32.521]765 { HGLOBAL hmem; 766 LPVOID pmem; 767 768 TRACE("ptr=%p size=0x%04lx procID=0x%04lx\n",psrc,size,procID); 769 hmem = GlobalAlloc(GMEM_FIXED, size); 770 if (!hmem) 771 return 0; 772 773 pmem = GlobalLock (hmem); 774 775 if (! pmem) 776 return 0; 777 778 memcpy (pmem, psrc, size); 779 GlobalUnlock(hmem); 780 return hmem; 781 } 782 /************************************************************************* 783 * SHLockShared [SHELL32.521] 783 784 * 784 785 * NOTES 785 786 * parameter1 is return value from SHAllocShared 786 787 * parameter2 is return value from GetCurrentProcessId 787 * the receiver of (WM_USER+2) trys to lock the HANDLE (?) 788 * the receiver of (WM_USER+2) trys to lock the HANDLE (?) 788 789 * the returnvalue seems to be a memoryadress 789 790 */ 790 791 LPVOID WINAPI SHLockShared(HANDLE hmem, DWORD procID) 791 { TRACE("handle=0x%04x procID=0x%04lx\n",hmem,procID);792 return GlobalLock(hmem);793 } 794 /************************************************************************* 795 * SHUnlockShared [SHELL32.522]792 { TRACE("handle=0x%04x procID=0x%04lx\n",hmem,procID); 793 return GlobalLock(hmem); 794 } 795 /************************************************************************* 796 * SHUnlockShared [SHELL32.522] 796 797 * 797 798 * NOTES … … 800 801 BOOL WINAPI SHUnlockShared(LPVOID pv) 801 802 { 802 TRACE("%p\n",pv);803 return GlobalUnlock((HANDLE)pv); 804 } 805 /************************************************************************* 806 * SHFreeShared [SHELL32.523]803 TRACE("%p\n",pv); 804 return GlobalUnlock((HANDLE)pv); 805 } 806 /************************************************************************* 807 * SHFreeShared [SHELL32.523] 807 808 * 808 809 * NOTES … … 811 812 */ 812 813 BOOL WINAPI SHFreeShared( 813 HANDLE hMem,814 DWORD pid)815 { 816 TRACE("handle=0x%04x 0x%04lx\n",hMem,pid);817 return GlobalFree(hMem);818 } 819 820 /************************************************************************* 821 * SetAppStartingCursor [SHELL32.99]814 HANDLE hMem, 815 DWORD pid) 816 { 817 TRACE("handle=0x%04x 0x%04lx\n",hMem,pid); 818 return GlobalFree(hMem); 819 } 820 821 /************************************************************************* 822 * SetAppStartingCursor [SHELL32.99] 822 823 */ 823 824 HRESULT WINAPI SetAppStartingCursor(HWND u, DWORD v) 824 { FIXME("hwnd=0x%04x 0x%04lx stub\n",u,v );825 return 0;826 } 827 /************************************************************************* 828 * SHLoadOLE [SHELL32.151]825 { FIXME("hwnd=0x%04x 0x%04lx stub\n",u,v ); 826 return 0; 827 } 828 /************************************************************************* 829 * SHLoadOLE [SHELL32.151] 829 830 * 830 831 */ 831 832 HRESULT WINAPI SHLoadOLE(DWORD u) 832 { FIXME("0x%04lx stub\n",u);833 return S_OK;834 } 835 /************************************************************************* 836 * DriveType [SHELL32.64]833 { FIXME("0x%04lx stub\n",u); 834 return S_OK; 835 } 836 /************************************************************************* 837 * DriveType [SHELL32.64] 837 838 * 838 839 */ 839 840 HRESULT WINAPI DriveType(DWORD u) 840 { FIXME("0x%04lx stub\n",u);841 return 0;842 } 843 /************************************************************************* 844 * SHAbortInvokeCommand [SHELL32.198]841 { FIXME("0x%04lx stub\n",u); 842 return 0; 843 } 844 /************************************************************************* 845 * SHAbortInvokeCommand [SHELL32.198] 845 846 * 846 847 */ 847 848 HRESULT WINAPI SHAbortInvokeCommand(void) 848 { FIXME("stub\n");849 return 1;850 } 851 /************************************************************************* 852 * SHOutOfMemoryMessageBox [SHELL32.126]849 { FIXME("stub\n"); 850 return 1; 851 } 852 /************************************************************************* 853 * SHOutOfMemoryMessageBox [SHELL32.126] 853 854 * 854 855 */ 855 856 int WINAPI SHOutOfMemoryMessageBox( 856 HWND hwndOwner,857 LPCSTR lpCaption,858 UINT uType)859 { 860 FIXME("0x%04x %s 0x%08x stub\n",hwndOwner, lpCaption, uType);861 return 0;862 } 863 /************************************************************************* 864 * SHFlushClipboard [SHELL32.121]857 HWND hwndOwner, 858 LPCSTR lpCaption, 859 UINT uType) 860 { 861 FIXME("0x%04x %s 0x%08x stub\n",hwndOwner, lpCaption, uType); 862 return 0; 863 } 864 /************************************************************************* 865 * SHFlushClipboard [SHELL32.121] 865 866 * 866 867 */ 867 868 HRESULT WINAPI SHFlushClipboard(void) 868 { FIXME("stub\n");869 return 1;870 } 871 872 /************************************************************************* 873 * SHWaitForFileToOpen [SHELL32.97]869 { FIXME("stub\n"); 870 return 1; 871 } 872 873 /************************************************************************* 874 * SHWaitForFileToOpen [SHELL32.97] 874 875 * 875 876 */ 876 877 BOOL WINAPI SHWaitForFileToOpen( 877 LPCITEMIDLIST pidl, 878 DWORD dwFlags,879 DWORD dwTimeout)880 { 881 FIXME("%p 0x%08lx 0x%08lx stub\n", pidl, dwFlags, dwTimeout);882 return 0;878 LPCITEMIDLIST pidl, 879 DWORD dwFlags, 880 DWORD dwTimeout) 881 { 882 FIXME("%p 0x%08lx 0x%08lx stub\n", pidl, dwFlags, dwTimeout); 883 return 0; 883 884 } 884 885 885 886 /************************************************************************ 886 * shell32_654[SHELL32.654]887 * shell32_654 [SHELL32.654] 887 888 * 888 889 * NOTES: first parameter seems to be a pointer (same as passed to WriteCabinetState) … … 892 893 */ 893 894 HRESULT WINAPI shell32_654 (DWORD x, DWORD y) 894 { FIXME("0x%08lx 0x%08lx stub\n",x,y);895 return 0;895 { FIXME("0x%08lx 0x%08lx stub\n",x,y); 896 return 0; 896 897 } 897 898 898 899 /************************************************************************ 899 * RLBuildListOfPaths[SHELL32.146]900 * RLBuildListOfPaths [SHELL32.146] 900 901 * 901 902 * NOTES … … 903 904 */ 904 905 DWORD WINAPI RLBuildListOfPaths (void) 905 { FIXME("stub\n");906 return 0;906 { FIXME("stub\n"); 907 return 0; 907 908 } 908 909 /************************************************************************ 909 * SHValidateUNC[SHELL32.173]910 * SHValidateUNC [SHELL32.173] 910 911 * 911 912 */ 912 913 HRESULT WINAPI SHValidateUNC (DWORD x, DWORD y, DWORD z) 913 914 { 914 FIXME("0x%08lx 0x%08lx 0x%08lx stub\n",x,y,z);915 return 0;915 FIXME("0x%08lx 0x%08lx 0x%08lx stub\n",x,y,z); 916 return 0; 916 917 } 917 918 918 919 /************************************************************************ 919 * DoEnvironmentSubstA[SHELL32.1222]920 * DoEnvironmentSubstA [SHELL32.1222] 920 921 * 921 922 */ 922 923 HRESULT WINAPI DoEnvironmentSubstA(LPSTR x, LPSTR y) 923 924 { 924 FIXME("(%s, %s) stub\n", debugstr_a(x), debugstr_a(y));925 return 0;925 FIXME("(%s, %s) stub\n", debugstr_a(x), debugstr_a(y)); 926 return 0; 926 927 } 927 928 928 929 /************************************************************************ 929 * DoEnvironmentSubstW[SHELL32.1223]930 * DoEnvironmentSubstW [SHELL32.1223] 930 931 * 931 932 */ 932 933 HRESULT WINAPI DoEnvironmentSubstW(LPWSTR x, LPWSTR y) 933 934 { 934 FIXME("(%s, %s): stub\n", debugstr_w(x), debugstr_w(y));935 return 0;935 FIXME("(%s, %s): stub\n", debugstr_w(x), debugstr_w(y)); 936 return 0; 936 937 } 937 938 938 939 /************************************************************************ 939 * DoEnvironmentSubst[SHELL32.53]940 * DoEnvironmentSubst [SHELL32.53] 940 941 * 941 942 */ 942 943 HRESULT WINAPI DoEnvironmentSubstAW(LPVOID x, LPVOID y) 943 944 { 944 if (SHELL_OsIsUnicode())945 return DoEnvironmentSubstW(x, y);946 return DoEnvironmentSubstA(x, y);945 if (SHELL_OsIsUnicode()) 946 return DoEnvironmentSubstW(x, y); 947 return DoEnvironmentSubstA(x, y); 947 948 } 948 949 949 950 /************************************************************************* 950 951 * shell32_243 [SHELL32.243] 951 * 952 * 952 953 * Win98+ by-ordinal routine. In Win98 this routine returns zero and 953 954 * does nothing else. Possibly this does something in NT or SHELL32 5.0? … … 955 956 */ 956 957 957 BOOL WINAPI shell32_243(DWORD a, DWORD b) 958 { 959 return FALSE; 960 } 961 962 /************************************************************************* 963 * SHELL32_714 [SHELL32]958 BOOL WINAPI shell32_243(DWORD a, DWORD b) 959 { 960 return FALSE; 961 } 962 963 /************************************************************************* 964 * SHELL32_714 [SHELL32] 964 965 */ 965 966 DWORD WINAPI SHELL32_714(LPVOID x) 966 967 { 967 FIXME("(%s)stub\n", debugstr_w(x));968 return 0;969 } 970 971 /************************************************************************* 972 * SHAddFromPropSheetExtArray [SHELL32]968 FIXME("(%s)stub\n", debugstr_w(x)); 969 return 0; 970 } 971 972 /************************************************************************* 973 * SHAddFromPropSheetExtArray [SHELL32] 973 974 */ 974 975 DWORD WINAPI SHAddFromPropSheetExtArray(DWORD a, DWORD b, DWORD c) 975 976 { 976 FIXME("(%08lx,%08lx,%08lx)stub\n", a, b, c);977 return 0;978 } 979 980 /************************************************************************* 981 * SHCreatePropSheetExtArray [SHELL32]977 FIXME("(%08lx,%08lx,%08lx)stub\n", a, b, c); 978 return 0; 979 } 980 981 /************************************************************************* 982 * SHCreatePropSheetExtArray [SHELL32] 982 983 */ 983 984 DWORD WINAPI SHCreatePropSheetExtArray(DWORD a, LPCSTR b, DWORD c) 984 985 { 985 FIXME("(%08lx,%s,%08lx)stub\n", a, debugstr_a(b), c);986 return 0;987 } 988 989 /************************************************************************* 990 * SHReplaceFromPropSheetExtArray [SHELL]986 FIXME("(%08lx,%s,%08lx)stub\n", a, debugstr_a(b), c); 987 return 0; 988 } 989 990 /************************************************************************* 991 * SHReplaceFromPropSheetExtArray [SHELL] 991 992 */ 992 993 DWORD WINAPI SHReplaceFromPropSheetExtArray(DWORD a, DWORD b, DWORD c, DWORD d) 993 994 { 994 FIXME("(%08lx,%08lx,%08lx,%08lx)stub\n", a, b, c, d);995 return 0;996 } 997 998 /************************************************************************* 999 * SHDestroyPropSheetExtArray [SHELL32]995 FIXME("(%08lx,%08lx,%08lx,%08lx)stub\n", a, b, c, d); 996 return 0; 997 } 998 999 /************************************************************************* 1000 * SHDestroyPropSheetExtArray [SHELL32] 1000 1001 */ 1001 1002 DWORD WINAPI SHDestroyPropSheetExtArray(DWORD a) 1002 1003 { 1003 FIXME("(%08lx)stub\n", a);1004 return 0;1005 } 1004 FIXME("(%08lx)stub\n", a); 1005 return 0; 1006 } -
trunk/src/shell32/shellpath.c
r5618 r6650 1 /* $Id: shellpath.c,v 1.6 2001-09-05 13:46:58 bird Exp $ */ 1 2 /* 2 3 * Path Functions … … 21 22 22 23 /* 23 ########## Combining and Constructing paths ##########24 ########## Combining and Constructing paths ########## 24 25 */ 25 26 26 27 /************************************************************************* 27 * PathAppendAW [SHELL32.36]28 * PathAppendAW [SHELL32.36] 28 29 */ 29 30 BOOL WINAPI PathAppendAW( 30 LPVOID lpszPath1,31 LPCVOID lpszPath2)32 { 33 if (SHELL_OsIsUnicode())34 return PathAppendW(lpszPath1, lpszPath2);35 return PathAppendA(lpszPath1, lpszPath2);36 } 37 38 /************************************************************************* 39 * PathCombineAW [SHELL32.37]31 LPVOID lpszPath1, 32 LPCVOID lpszPath2) 33 { 34 if (SHELL_OsIsUnicode()) 35 return PathAppendW(lpszPath1, lpszPath2); 36 return PathAppendA(lpszPath1, lpszPath2); 37 } 38 39 /************************************************************************* 40 * PathCombineAW [SHELL32.37] 40 41 */ 41 42 LPVOID WINAPI PathCombineAW( 42 LPVOID szDest,43 LPCVOID lpszDir,44 LPCVOID lpszFile) 45 { 46 if (SHELL_OsIsUnicode())47 return PathCombineW( szDest, lpszDir, lpszFile );48 return PathCombineA( szDest, lpszDir, lpszFile );49 } 50 51 /************************************************************************* 52 * PathAddBackslashAW [SHELL32.32]43 LPVOID szDest, 44 LPCVOID lpszDir, 45 LPCVOID lpszFile) 46 { 47 if (SHELL_OsIsUnicode()) 48 return PathCombineW( szDest, lpszDir, lpszFile ); 49 return PathCombineA( szDest, lpszDir, lpszFile ); 50 } 51 52 /************************************************************************* 53 * PathAddBackslashAW [SHELL32.32] 53 54 */ 54 55 LPVOID WINAPI PathAddBackslashAW(LPVOID lpszPath) 55 56 { 56 if(SHELL_OsIsUnicode())57 return PathAddBackslashW(lpszPath);58 return PathAddBackslashA(lpszPath);59 } 60 61 /************************************************************************* 62 * PathBuildRootAW [SHELL32.30]57 if(SHELL_OsIsUnicode()) 58 return PathAddBackslashW(lpszPath); 59 return PathAddBackslashA(lpszPath); 60 } 61 62 /************************************************************************* 63 * PathBuildRootAW [SHELL32.30] 63 64 */ 64 65 LPVOID WINAPI PathBuildRootAW(LPVOID lpszPath, int drive) 65 66 { 66 if(SHELL_OsIsUnicode())67 return PathBuildRootW(lpszPath, drive);68 return PathBuildRootA(lpszPath, drive);67 if(SHELL_OsIsUnicode()) 68 return PathBuildRootW(lpszPath, drive); 69 return PathBuildRootA(lpszPath, drive); 69 70 } 70 71 71 72 /* 72 Extracting Component Parts73 Extracting Component Parts 73 74 */ 74 75 75 76 /************************************************************************* 76 * PathFindFileNameAW [SHELL32.34]77 * PathFindFileNameAW [SHELL32.34] 77 78 */ 78 79 LPVOID WINAPI PathFindFileNameAW(LPCVOID lpszPath) 79 80 { 80 if(SHELL_OsIsUnicode())81 return PathFindFileNameW(lpszPath);82 return PathFindFileNameA(lpszPath);83 } 84 85 /************************************************************************* 86 * PathFindExtensionAW [SHELL32.31]87 */ 88 LPVOID WINAPI PathFindExtensionAW(LPCVOID lpszPath) 89 { 90 if (SHELL_OsIsUnicode())91 return PathFindExtensionW(lpszPath);92 return PathFindExtensionA(lpszPath);93 94 } 95 96 /************************************************************************* 97 * PathGetExtensionA [internal]81 if(SHELL_OsIsUnicode()) 82 return PathFindFileNameW(lpszPath); 83 return PathFindFileNameA(lpszPath); 84 } 85 86 /************************************************************************* 87 * PathFindExtensionAW [SHELL32.31] 88 */ 89 LPVOID WINAPI PathFindExtensionAW(LPCVOID lpszPath) 90 { 91 if (SHELL_OsIsUnicode()) 92 return PathFindExtensionW(lpszPath); 93 return PathFindExtensionA(lpszPath); 94 95 } 96 97 /************************************************************************* 98 * PathGetExtensionA [internal] 98 99 * 99 100 * NOTES … … 103 104 static LPSTR PathGetExtensionA(LPCSTR lpszPath) 104 105 { 105 TRACE("(%s)\n",lpszPath);106 107 lpszPath = PathFindExtensionA(lpszPath);108 return (LPSTR)(*lpszPath?(lpszPath+1):lpszPath);109 } 110 111 /************************************************************************* 112 * PathGetExtensionW [internal]106 TRACE("(%s)\n",lpszPath); 107 108 lpszPath = PathFindExtensionA(lpszPath); 109 return (LPSTR)(*lpszPath?(lpszPath+1):lpszPath); 110 } 111 112 /************************************************************************* 113 * PathGetExtensionW [internal] 113 114 */ 114 115 static LPWSTR PathGetExtensionW(LPCWSTR lpszPath) 115 116 { 116 TRACE("(%s)\n",debugstr_w(lpszPath));117 118 lpszPath = PathFindExtensionW(lpszPath);119 return (LPWSTR)(*lpszPath?(lpszPath+1):lpszPath);120 } 121 122 /************************************************************************* 123 * PathGetExtensionAW [SHELL32.158]124 */ 125 LPVOID WINAPI PathGetExtensionAW(LPCVOID lpszPath) 126 { 127 if (SHELL_OsIsUnicode())128 return PathGetExtensionW(lpszPath);129 return PathGetExtensionA(lpszPath);130 } 131 132 /************************************************************************* 133 * PathGetArgsAW [SHELL32.52]134 */ 135 LPVOID WINAPI PathGetArgsAW(LPVOID lpszPath) 136 { 137 if (SHELL_OsIsUnicode())138 return PathGetArgsW(lpszPath);139 return PathGetArgsA(lpszPath);140 } 141 142 /************************************************************************* 143 * PathGetDriveNumber [SHELL32.57]144 */ 145 int WINAPI PathGetDriveNumberAW(LPVOID lpszPath) 146 { 147 if (SHELL_OsIsUnicode())148 return PathGetDriveNumberW(lpszPath);149 return PathGetDriveNumberA(lpszPath);117 TRACE("(%s)\n",debugstr_w(lpszPath)); 118 119 lpszPath = PathFindExtensionW(lpszPath); 120 return (LPWSTR)(*lpszPath?(lpszPath+1):lpszPath); 121 } 122 123 /************************************************************************* 124 * PathGetExtensionAW [SHELL32.158] 125 */ 126 LPVOID WINAPI PathGetExtensionAW(LPCVOID lpszPath) 127 { 128 if (SHELL_OsIsUnicode()) 129 return PathGetExtensionW(lpszPath); 130 return PathGetExtensionA(lpszPath); 131 } 132 133 /************************************************************************* 134 * PathGetArgsAW [SHELL32.52] 135 */ 136 LPVOID WINAPI PathGetArgsAW(LPVOID lpszPath) 137 { 138 if (SHELL_OsIsUnicode()) 139 return PathGetArgsW(lpszPath); 140 return PathGetArgsA(lpszPath); 141 } 142 143 /************************************************************************* 144 * PathGetDriveNumber [SHELL32.57] 145 */ 146 int WINAPI PathGetDriveNumberAW(LPVOID lpszPath) 147 { 148 if (SHELL_OsIsUnicode()) 149 return PathGetDriveNumberW(lpszPath); 150 return PathGetDriveNumberA(lpszPath); 150 151 } 151 152 … … 153 154 * PathRemoveFileSpec [SHELL32.35] 154 155 */ 155 BOOL WINAPI PathRemoveFileSpecAW(LPVOID lpszPath) 156 { 157 if (SHELL_OsIsUnicode())158 return PathRemoveFileSpecW(lpszPath);159 return PathRemoveFileSpecA(lpszPath);160 } 161 162 /************************************************************************* 163 * PathStripPathAW [SHELL32.38]164 */ 165 void WINAPI PathStripPathAW(LPVOID lpszPath) 166 { 167 if (SHELL_OsIsUnicode())168 return PathStripPathW(lpszPath);169 return PathStripPathA(lpszPath);170 } 171 172 /************************************************************************* 173 * PathStripToRootAW [SHELL32.50]174 */ 175 BOOL WINAPI PathStripToRootAW(LPVOID lpszPath) 176 { 177 if (SHELL_OsIsUnicode())178 return PathStripToRootW(lpszPath);179 return PathStripToRootA(lpszPath);180 } 181 182 /************************************************************************* 183 * PathRemoveArgsAW [SHELL32.251]184 */ 185 void WINAPI PathRemoveArgsAW(LPVOID lpszPath) 186 { 187 if (SHELL_OsIsUnicode())188 PathRemoveArgsW(lpszPath);189 PathRemoveArgsA(lpszPath);190 } 191 192 /************************************************************************* 193 * PathRemoveExtensionAW [SHELL32.250]194 */ 195 void WINAPI PathRemoveExtensionAW(LPVOID lpszPath) 196 { 197 if (SHELL_OsIsUnicode())198 return PathRemoveExtensionW(lpszPath);199 return PathRemoveExtensionA(lpszPath);156 BOOL WINAPI PathRemoveFileSpecAW(LPVOID lpszPath) 157 { 158 if (SHELL_OsIsUnicode()) 159 return PathRemoveFileSpecW(lpszPath); 160 return PathRemoveFileSpecA(lpszPath); 161 } 162 163 /************************************************************************* 164 * PathStripPathAW [SHELL32.38] 165 */ 166 void WINAPI PathStripPathAW(LPVOID lpszPath) 167 { 168 if (SHELL_OsIsUnicode()) 169 return PathStripPathW(lpszPath); 170 return PathStripPathA(lpszPath); 171 } 172 173 /************************************************************************* 174 * PathStripToRootAW [SHELL32.50] 175 */ 176 BOOL WINAPI PathStripToRootAW(LPVOID lpszPath) 177 { 178 if (SHELL_OsIsUnicode()) 179 return PathStripToRootW(lpszPath); 180 return PathStripToRootA(lpszPath); 181 } 182 183 /************************************************************************* 184 * PathRemoveArgsAW [SHELL32.251] 185 */ 186 void WINAPI PathRemoveArgsAW(LPVOID lpszPath) 187 { 188 if (SHELL_OsIsUnicode()) 189 PathRemoveArgsW(lpszPath); 190 PathRemoveArgsA(lpszPath); 191 } 192 193 /************************************************************************* 194 * PathRemoveExtensionAW [SHELL32.250] 195 */ 196 void WINAPI PathRemoveExtensionAW(LPVOID lpszPath) 197 { 198 if (SHELL_OsIsUnicode()) 199 return PathRemoveExtensionW(lpszPath); 200 return PathRemoveExtensionA(lpszPath); 200 201 } 201 202 202 203 203 204 /* 204 Path Manipulations205 Path Manipulations 205 206 */ 206 207 … … 210 211 LPSTR WINAPI PathGetShortPathA(LPSTR lpszPath) 211 212 { 212 FIXME("%s stub\n", lpszPath);213 return NULL;213 FIXME("%s stub\n", lpszPath); 214 return NULL; 214 215 } 215 216 … … 219 220 LPWSTR WINAPI PathGetShortPathW(LPWSTR lpszPath) 220 221 { 221 FIXME("%s stub\n", debugstr_w(lpszPath));222 return NULL;222 FIXME("%s stub\n", debugstr_w(lpszPath)); 223 return NULL; 223 224 } 224 225 … … 228 229 LPVOID WINAPI PathGetShortPathAW(LPVOID lpszPath) 229 230 { 230 if(SHELL_OsIsUnicode())231 return PathGetShortPathW(lpszPath);232 return PathGetShortPathA(lpszPath);231 if(SHELL_OsIsUnicode()) 232 return PathGetShortPathW(lpszPath); 233 return PathGetShortPathA(lpszPath); 233 234 } 234 235 … … 238 239 void WINAPI PathRemoveBlanksAW(LPVOID str) 239 240 { 240 if(SHELL_OsIsUnicode())241 PathRemoveBlanksW(str);242 PathRemoveBlanksA(str);241 if(SHELL_OsIsUnicode()) 242 PathRemoveBlanksW(str); 243 PathRemoveBlanksA(str); 243 244 } 244 245 … … 248 249 LPVOID WINAPI PathQuoteSpacesAW (LPVOID lpszPath) 249 250 { 250 if(SHELL_OsIsUnicode())251 return PathQuoteSpacesW(lpszPath);252 return PathQuoteSpacesA(lpszPath);251 if(SHELL_OsIsUnicode()) 252 return PathQuoteSpacesW(lpszPath); 253 return PathQuoteSpacesA(lpszPath); 253 254 } 254 255 … … 256 257 * PathUnquoteSpacesAW [SHELL32.56] 257 258 */ 258 VOID WINAPI PathUnquoteSpacesAW(LPVOID str) 259 { 260 if(SHELL_OsIsUnicode())261 PathUnquoteSpacesW(str);262 else263 PathUnquoteSpacesA(str);264 } 265 266 /************************************************************************* 267 * PathParseIconLocationAW [SHELL32.249]259 VOID WINAPI PathUnquoteSpacesAW(LPVOID str) 260 { 261 if(SHELL_OsIsUnicode()) 262 PathUnquoteSpacesW(str); 263 else 264 PathUnquoteSpacesA(str); 265 } 266 267 /************************************************************************* 268 * PathParseIconLocationAW [SHELL32.249] 268 269 */ 269 270 int WINAPI PathParseIconLocationAW (LPVOID lpszPath) 270 271 { 271 if(SHELL_OsIsUnicode())272 return PathParseIconLocationW(lpszPath);273 return PathParseIconLocationA(lpszPath);272 if(SHELL_OsIsUnicode()) 273 return PathParseIconLocationW(lpszPath); 274 return PathParseIconLocationA(lpszPath); 274 275 } 275 276 276 277 /* 277 ########## Path Testing ##########278 ########## Path Testing ########## 278 279 */ 279 280 /************************************************************************* 280 * PathIsUNCAW [SHELL32.39]281 * PathIsUNCAW [SHELL32.39] 281 282 */ 282 283 BOOL WINAPI PathIsUNCAW (LPCVOID lpszPath) 283 284 { 284 if (SHELL_OsIsUnicode())285 return PathIsUNCW( lpszPath );286 return PathIsUNCA( lpszPath ); 287 } 288 289 /************************************************************************* 290 * PathIsRelativeAW [SHELL32.40]285 if (SHELL_OsIsUnicode()) 286 return PathIsUNCW( lpszPath ); 287 return PathIsUNCA( lpszPath ); 288 } 289 290 /************************************************************************* 291 * PathIsRelativeAW [SHELL32.40] 291 292 */ 292 293 BOOL WINAPI PathIsRelativeAW (LPCVOID lpszPath) 293 294 { 294 if (SHELL_OsIsUnicode())295 return PathIsRelativeW( lpszPath );296 return PathIsRelativeA( lpszPath ); 297 } 298 299 /************************************************************************* 300 * PathIsRootAW [SHELL32.29]301 */ 302 BOOL WINAPI PathIsRootAW(LPCVOID lpszPath) 303 { 304 if (SHELL_OsIsUnicode())305 return PathIsRootW(lpszPath);306 return PathIsRootA(lpszPath);307 } 308 309 /************************************************************************* 310 * PathIsExeA [internal]295 if (SHELL_OsIsUnicode()) 296 return PathIsRelativeW( lpszPath ); 297 return PathIsRelativeA( lpszPath ); 298 } 299 300 /************************************************************************* 301 * PathIsRootAW [SHELL32.29] 302 */ 303 BOOL WINAPI PathIsRootAW(LPCVOID lpszPath) 304 { 305 if (SHELL_OsIsUnicode()) 306 return PathIsRootW(lpszPath); 307 return PathIsRootA(lpszPath); 308 } 309 310 /************************************************************************* 311 * PathIsExeA [internal] 311 312 */ 312 313 static BOOL PathIsExeA (LPCSTR lpszPath) 313 314 { 314 LPCSTR lpszExtension = PathGetExtensionA(lpszPath);315 int i = 0;316 static char * lpszExtensions[6] = {"exe", "com", "pid", "cmd", "bat", NULL };317 318 TRACE("path=%s\n",lpszPath);319 320 for(i=0; lpszExtensions[i]; i++)321 if (!strcasecmp(lpszExtension,lpszExtensions[i])) return TRUE;322 323 return FALSE;324 } 325 326 /************************************************************************* 327 * PathIsExeW [internal]315 LPCSTR lpszExtension = PathGetExtensionA(lpszPath); 316 int i = 0; 317 static char * lpszExtensions[6] = {"exe", "com", "pid", "cmd", "bat", NULL }; 318 319 TRACE("path=%s\n",lpszPath); 320 321 for(i=0; lpszExtensions[i]; i++) 322 if (!strcasecmp(lpszExtension,lpszExtensions[i])) return TRUE; 323 324 return FALSE; 325 } 326 327 /************************************************************************* 328 * PathIsExeW [internal] 328 329 */ 329 330 static BOOL PathIsExeW (LPCWSTR lpszPath) 330 331 { 331 LPCWSTR lpszExtension = PathGetExtensionW(lpszPath);332 int i = 0;333 static WCHAR lpszExtensions[6][4] =334 {{'e','x','e','\0'}, {'c','o','m','\0'}, {'p','i','d','\0'},335 {'c','m','d','\0'}, {'b','a','t','\0'}, {'\0'} };336 337 TRACE("path=%s\n",debugstr_w(lpszPath));338 339 for(i=0; lpszExtensions[i]; i++)332 LPCWSTR lpszExtension = PathGetExtensionW(lpszPath); 333 int i = 0; 334 static WCHAR lpszExtensions[6][4] = 335 {{'e','x','e','\0'}, {'c','o','m','\0'}, {'p','i','d','\0'}, 336 {'c','m','d','\0'}, {'b','a','t','\0'}, {'\0'} }; 337 338 TRACE("path=%s\n",debugstr_w(lpszPath)); 339 340 for(i=0; lpszExtensions[i]; i++) 340 341 #ifdef __WIN32OS2__ 341 if (!lstrcmpiW(lpszExtension,lpszExtensions[i])) return TRUE;342 if (!lstrcmpiW(lpszExtension,lpszExtensions[i])) return TRUE; 342 343 #else 343 if (!strcmpiW(lpszExtension,lpszExtensions[i])) return TRUE;344 #endif 345 return FALSE;346 } 347 348 /************************************************************************* 349 * PathIsExeAW [SHELL32.43]344 if (!strcmpiW(lpszExtension,lpszExtensions[i])) return TRUE; 345 #endif 346 return FALSE; 347 } 348 349 /************************************************************************* 350 * PathIsExeAW [SHELL32.43] 350 351 */ 351 352 BOOL WINAPI PathIsExeAW (LPCVOID path) 352 353 { 353 if (SHELL_OsIsUnicode())354 return PathIsExeW (path);355 return PathIsExeA(path);356 } 357 358 /************************************************************************* 359 * PathIsDirectoryAW [SHELL32.159]354 if (SHELL_OsIsUnicode()) 355 return PathIsExeW (path); 356 return PathIsExeA(path); 357 } 358 359 /************************************************************************* 360 * PathIsDirectoryAW [SHELL32.159] 360 361 */ 361 362 BOOL WINAPI PathIsDirectoryAW (LPCVOID lpszPath) 362 363 { 363 if (SHELL_OsIsUnicode())364 return PathIsDirectoryW (lpszPath);365 return PathIsDirectoryA (lpszPath);366 } 367 368 /************************************************************************* 369 * PathFileExistsAW [SHELL32.45]370 */ 364 if (SHELL_OsIsUnicode()) 365 return PathIsDirectoryW (lpszPath); 366 return PathIsDirectoryA (lpszPath); 367 } 368 369 /************************************************************************* 370 * PathFileExistsAW [SHELL32.45] 371 */ 371 372 BOOL WINAPI PathFileExistsAW (LPCVOID lpszPath) 372 373 { 373 if (SHELL_OsIsUnicode())374 return PathFileExistsW (lpszPath);375 return PathFileExistsA (lpszPath);376 } 377 378 /************************************************************************* 379 * PathMatchSpecAW [SHELL32.46]380 */ 381 BOOL WINAPI PathMatchSpecAW(LPVOID name, LPVOID mask) 382 { 383 if (SHELL_OsIsUnicode())384 return PathMatchSpecW( name, mask );385 return PathMatchSpecA( name, mask );386 } 387 388 /************************************************************************* 389 * PathIsSameRootAW [SHELL32.650]374 if (SHELL_OsIsUnicode()) 375 return PathFileExistsW (lpszPath); 376 return PathFileExistsA (lpszPath); 377 } 378 379 /************************************************************************* 380 * PathMatchSpecAW [SHELL32.46] 381 */ 382 BOOL WINAPI PathMatchSpecAW(LPVOID name, LPVOID mask) 383 { 384 if (SHELL_OsIsUnicode()) 385 return PathMatchSpecW( name, mask ); 386 return PathMatchSpecA( name, mask ); 387 } 388 389 /************************************************************************* 390 * PathIsSameRootAW [SHELL32.650] 390 391 */ 391 392 BOOL WINAPI PathIsSameRootAW(LPCVOID lpszPath1, LPCVOID lpszPath2) 392 393 { 393 if (SHELL_OsIsUnicode())394 return PathIsSameRootW(lpszPath1, lpszPath2);395 return PathIsSameRootA(lpszPath1, lpszPath2);396 } 397 398 /************************************************************************* 399 * IsLFNDriveA [SHELL32.119]400 * 394 if (SHELL_OsIsUnicode()) 395 return PathIsSameRootW(lpszPath1, lpszPath2); 396 return PathIsSameRootA(lpszPath1, lpszPath2); 397 } 398 399 /************************************************************************* 400 * IsLFNDriveA [SHELL32.119] 401 * 401 402 * NOTES 402 403 * exported by ordinal Name 403 404 */ 404 BOOL WINAPI IsLFNDriveA(LPCSTR lpszPath) 405 { 406 DWORD fnlen;405 BOOL WINAPI IsLFNDriveA(LPCSTR lpszPath) 406 { 407 DWORD fnlen; 407 408 408 409 if (!GetVolumeInformationA(lpszPath,NULL,0,NULL,&fnlen,NULL,NULL,0)) 409 return FALSE;410 return FALSE; 410 411 return fnlen>12; 411 412 } 412 413 413 414 /* 414 ########## Creating Something Unique ##########415 ########## Creating Something Unique ########## 415 416 */ 416 417 /************************************************************************* 417 * PathMakeUniqueNameA [internal]418 * PathMakeUniqueNameA [internal] 418 419 */ 419 420 BOOL WINAPI PathMakeUniqueNameA( 420 LPSTR lpszBuffer,421 DWORD dwBuffSize, 422 LPCSTR lpszShortName,423 LPCSTR lpszLongName,424 LPCSTR lpszPathName)425 { 426 FIXME("%p %lu %s %s %s stub\n",427 lpszBuffer, dwBuffSize, debugstr_a(lpszShortName),428 debugstr_a(lpszLongName), debugstr_a(lpszPathName));429 return TRUE;430 } 431 432 /************************************************************************* 433 * PathMakeUniqueNameW [internal]421 LPSTR lpszBuffer, 422 DWORD dwBuffSize, 423 LPCSTR lpszShortName, 424 LPCSTR lpszLongName, 425 LPCSTR lpszPathName) 426 { 427 FIXME("%p %lu %s %s %s stub\n", 428 lpszBuffer, dwBuffSize, debugstr_a(lpszShortName), 429 debugstr_a(lpszLongName), debugstr_a(lpszPathName)); 430 return TRUE; 431 } 432 433 /************************************************************************* 434 * PathMakeUniqueNameW [internal] 434 435 */ 435 436 BOOL WINAPI PathMakeUniqueNameW( 436 LPWSTR lpszBuffer,437 DWORD dwBuffSize, 438 LPCWSTR lpszShortName,439 LPCWSTR lpszLongName,440 LPCWSTR lpszPathName)441 { 442 FIXME("%p %lu %s %s %s stub\n",443 lpszBuffer, dwBuffSize, debugstr_w(lpszShortName),444 debugstr_w(lpszLongName), debugstr_w(lpszPathName));445 return TRUE;446 } 447 448 /************************************************************************* 449 * PathMakeUniqueNameAW [SHELL32.47]437 LPWSTR lpszBuffer, 438 DWORD dwBuffSize, 439 LPCWSTR lpszShortName, 440 LPCWSTR lpszLongName, 441 LPCWSTR lpszPathName) 442 { 443 FIXME("%p %lu %s %s %s stub\n", 444 lpszBuffer, dwBuffSize, debugstr_w(lpszShortName), 445 debugstr_w(lpszLongName), debugstr_w(lpszPathName)); 446 return TRUE; 447 } 448 449 /************************************************************************* 450 * PathMakeUniqueNameAW [SHELL32.47] 450 451 */ 451 452 BOOL WINAPI PathMakeUniqueNameAW( 452 LPVOID lpszBuffer,453 DWORD dwBuffSize, 454 LPCVOID lpszShortName,455 LPCVOID lpszLongName,456 LPCVOID lpszPathName)457 { 458 if (SHELL_OsIsUnicode())459 return PathMakeUniqueNameW(lpszBuffer,dwBuffSize, lpszShortName,lpszLongName,lpszPathName);460 return PathMakeUniqueNameA(lpszBuffer,dwBuffSize, lpszShortName,lpszLongName,lpszPathName);453 LPVOID lpszBuffer, 454 DWORD dwBuffSize, 455 LPCVOID lpszShortName, 456 LPCVOID lpszLongName, 457 LPCVOID lpszPathName) 458 { 459 if (SHELL_OsIsUnicode()) 460 return PathMakeUniqueNameW(lpszBuffer,dwBuffSize, lpszShortName,lpszLongName,lpszPathName); 461 return PathMakeUniqueNameA(lpszBuffer,dwBuffSize, lpszShortName,lpszLongName,lpszPathName); 461 462 } 462 463 463 464 /************************************************************************* 464 465 * PathYetAnotherMakeUniqueNameA [SHELL32.75] 465 * 466 * 466 467 * NOTES 467 468 * exported by ordinal 468 469 */ 469 470 BOOL WINAPI PathYetAnotherMakeUniqueNameA( 470 LPSTR lpszBuffer,471 LPCSTR lpszPathName,472 LPCSTR lpszShortName,473 LPCSTR lpszLongName)471 LPSTR lpszBuffer, 472 LPCSTR lpszPathName, 473 LPCSTR lpszShortName, 474 LPCSTR lpszLongName) 474 475 { 475 476 FIXME("(%p,%p, %p ,%p):stub.\n", … … 481 482 482 483 BOOL WINAPI PathYetAnotherMakeUniqueNameW( 483 LPWSTR lpszBuffer,484 LPCWSTR lpszPathName,485 LPCWSTR lpszShortName,486 LPCWSTR lpszLongName)484 LPWSTR lpszBuffer, 485 LPCWSTR lpszPathName, 486 LPCWSTR lpszShortName, 487 LPCWSTR lpszLongName) 487 488 { 488 489 FIXME("PathYetAnotherMakeUniqueNameW (%p,%p, %p ,%p):stub.\n", … … 492 493 493 494 BOOL WINAPI PathYetAnotherMakeUniqueNameAW( 494 LPSTR lpszBuffer,495 LPCSTR lpszPathName,496 LPCSTR lpszShortName,497 LPCSTR lpszLongName)498 { 499 if (SHELL_OsIsUnicode())500 return PathYetAnotherMakeUniqueNameW((LPWSTR)lpszBuffer,(LPCWSTR)lpszPathName, (LPCWSTR)lpszShortName,(LPCWSTR)lpszLongName);501 return PathYetAnotherMakeUniqueNameA(lpszBuffer, lpszPathName, lpszShortName,lpszLongName);495 LPSTR lpszBuffer, 496 LPCSTR lpszPathName, 497 LPCSTR lpszShortName, 498 LPCSTR lpszLongName) 499 { 500 if (SHELL_OsIsUnicode()) 501 return PathYetAnotherMakeUniqueNameW((LPWSTR)lpszBuffer,(LPCWSTR)lpszPathName, (LPCWSTR)lpszShortName,(LPCWSTR)lpszLongName); 502 return PathYetAnotherMakeUniqueNameA(lpszBuffer, lpszPathName, lpszShortName,lpszLongName); 502 503 } 503 504 #endif … … 505 506 506 507 /* 507 ########## cleaning and resolving paths ##########508 */ 509 510 /************************************************************************* 511 * PathFindOnPathAW [SHELL32]508 ########## cleaning and resolving paths ########## 509 */ 510 511 /************************************************************************* 512 * PathFindOnPathAW [SHELL32] 512 513 */ 513 514 BOOL WINAPI PathFindOnPathAW(LPVOID sFile, LPCVOID sOtherDirs) 514 515 { 515 if (SHELL_OsIsUnicode())516 return PathFindOnPathW(sFile, sOtherDirs);517 return PathFindOnPathA(sFile, sOtherDirs);518 } 519 520 /************************************************************************* 521 * PathCleanupSpecAW [SHELL32]516 if (SHELL_OsIsUnicode()) 517 return PathFindOnPathW(sFile, sOtherDirs); 518 return PathFindOnPathA(sFile, sOtherDirs); 519 } 520 521 /************************************************************************* 522 * PathCleanupSpecAW [SHELL32] 522 523 */ 523 524 DWORD WINAPI PathCleanupSpecAW (LPCVOID x, LPVOID y) … … 528 529 529 530 /************************************************************************* 530 * PathQualifyA [SHELL32]531 */ 532 BOOL WINAPI PathQualifyA(LPCSTR pszPath) 533 { 534 FIXME("%s\n",pszPath);535 return 0;536 } 537 538 /************************************************************************* 539 * PathQualifyW [SHELL32]540 */ 541 BOOL WINAPI PathQualifyW(LPCWSTR pszPath) 542 { 543 FIXME("%s\n",debugstr_w(pszPath));544 return 0;545 } 546 547 /************************************************************************* 548 * PathQualifyAW [SHELL32]549 */ 550 BOOL WINAPI PathQualifyAW(LPCVOID pszPath) 551 { 552 if (SHELL_OsIsUnicode())553 return PathQualifyW(pszPath);554 return PathQualifyA(pszPath);531 * PathQualifyA [SHELL32] 532 */ 533 BOOL WINAPI PathQualifyA(LPCSTR pszPath) 534 { 535 FIXME("%s\n",pszPath); 536 return 0; 537 } 538 539 /************************************************************************* 540 * PathQualifyW [SHELL32] 541 */ 542 BOOL WINAPI PathQualifyW(LPCWSTR pszPath) 543 { 544 FIXME("%s\n",debugstr_w(pszPath)); 545 return 0; 546 } 547 548 /************************************************************************* 549 * PathQualifyAW [SHELL32] 550 */ 551 BOOL WINAPI PathQualifyAW(LPCVOID pszPath) 552 { 553 if (SHELL_OsIsUnicode()) 554 return PathQualifyW(pszPath); 555 return PathQualifyA(pszPath); 555 556 } 556 557 … … 559 560 */ 560 561 BOOL WINAPI PathResolveA( 561 LPSTR lpszPath,562 LPCSTR *alpszPaths, 563 DWORD dwFlags)564 { 565 FIXME("(%s,%p,0x%08lx),stub!\n",566 lpszPath, *alpszPaths, dwFlags);567 return 0;562 LPSTR lpszPath, 563 LPCSTR *alpszPaths, 564 DWORD dwFlags) 565 { 566 FIXME("(%s,%p,0x%08lx),stub!\n", 567 lpszPath, *alpszPaths, dwFlags); 568 return 0; 568 569 } 569 570 … … 572 573 */ 573 574 BOOL WINAPI PathResolveW( 574 LPWSTR lpszPath,575 LPCWSTR *alpszPaths, 576 DWORD dwFlags)577 { 578 FIXME("(%s,%p,0x%08lx),stub!\n",579 debugstr_w(lpszPath), debugstr_w(*alpszPaths), dwFlags);580 return 0;575 LPWSTR lpszPath, 576 LPCWSTR *alpszPaths, 577 DWORD dwFlags) 578 { 579 FIXME("(%s,%p,0x%08lx),stub!\n", 580 debugstr_w(lpszPath), debugstr_w(*alpszPaths), dwFlags); 581 return 0; 581 582 } 582 583 … … 585 586 */ 586 587 BOOL WINAPI PathResolveAW( 587 LPVOID lpszPath,588 LPCVOID *alpszPaths, 589 DWORD dwFlags)590 { 591 if (SHELL_OsIsUnicode())592 return PathResolveW(lpszPath, (LPCWSTR*)alpszPaths, dwFlags);593 return PathResolveA(lpszPath, (LPCSTR*)alpszPaths, dwFlags);594 } 595 596 /************************************************************************* 597 * PathProcessCommandA[SHELL32.653]588 LPVOID lpszPath, 589 LPCVOID *alpszPaths, 590 DWORD dwFlags) 591 { 592 if (SHELL_OsIsUnicode()) 593 return PathResolveW(lpszPath, (LPCWSTR*)alpszPaths, dwFlags); 594 return PathResolveA(lpszPath, (LPCSTR*)alpszPaths, dwFlags); 595 } 596 597 /************************************************************************* 598 * PathProcessCommandA [SHELL32.653] 598 599 */ 599 600 HRESULT WINAPI PathProcessCommandA ( 600 LPCSTR lpszPath,601 LPSTR lpszBuff,602 DWORD dwBuffSize,603 DWORD dwFlags)604 { 605 FIXME("%s %p 0x%04lx 0x%04lx stub\n",606 lpszPath, lpszBuff, dwBuffSize, dwFlags);607 strcpy(lpszBuff, lpszPath);608 return 0;609 } 610 611 /************************************************************************* 612 * PathProcessCommandW601 LPCSTR lpszPath, 602 LPSTR lpszBuff, 603 DWORD dwBuffSize, 604 DWORD dwFlags) 605 { 606 FIXME("%s %p 0x%04lx 0x%04lx stub\n", 607 lpszPath, lpszBuff, dwBuffSize, dwFlags); 608 strcpy(lpszBuff, lpszPath); 609 return 0; 610 } 611 612 /************************************************************************* 613 * PathProcessCommandW 613 614 */ 614 615 HRESULT WINAPI PathProcessCommandW ( 615 LPCWSTR lpszPath,616 LPWSTR lpszBuff,617 DWORD dwBuffSize,618 DWORD dwFlags)619 { 620 FIXME("(%s, %p, 0x%04lx, 0x%04lx) stub\n",621 debugstr_w(lpszPath), lpszBuff, dwBuffSize, dwFlags);622 strcpyW(lpszBuff, lpszPath);623 return 0;624 } 625 626 /************************************************************************* 627 * PathProcessCommandAW616 LPCWSTR lpszPath, 617 LPWSTR lpszBuff, 618 DWORD dwBuffSize, 619 DWORD dwFlags) 620 { 621 FIXME("(%s, %p, 0x%04lx, 0x%04lx) stub\n", 622 debugstr_w(lpszPath), lpszBuff, dwBuffSize, dwFlags); 623 strcpyW(lpszBuff, lpszPath); 624 return 0; 625 } 626 627 /************************************************************************* 628 * PathProcessCommandAW 628 629 */ 629 630 HRESULT WINAPI PathProcessCommandAW ( 630 LPCVOID lpszPath,631 LPVOID lpszBuff,632 DWORD dwBuffSize,633 DWORD dwFlags)634 { 635 if (SHELL_OsIsUnicode())636 return PathProcessCommandW(lpszPath, lpszBuff, dwBuffSize, dwFlags);637 return PathProcessCommandA(lpszPath, lpszBuff, dwBuffSize, dwFlags);631 LPCVOID lpszPath, 632 LPVOID lpszBuff, 633 DWORD dwBuffSize, 634 DWORD dwFlags) 635 { 636 if (SHELL_OsIsUnicode()) 637 return PathProcessCommandW(lpszPath, lpszBuff, dwBuffSize, dwFlags); 638 return PathProcessCommandA(lpszPath, lpszBuff, dwBuffSize, dwFlags); 638 639 } 639 640 640 641 /* 641 ########## special ##########642 ########## special ########## 642 643 */ 643 644 … … 645 646 * PathSetDlgItemPathAW 646 647 */ 647 BOOL WINAPI PathSetDlgItemPathAW(HWND hDlg, int id, LPCVOID pszPath) 648 { if (SHELL_OsIsUnicode())649 return PathSetDlgItemPathW(hDlg, id, pszPath);650 return PathSetDlgItemPathA(hDlg, id, pszPath);648 BOOL WINAPI PathSetDlgItemPathAW(HWND hDlg, int id, LPCVOID pszPath) 649 { if (SHELL_OsIsUnicode()) 650 return PathSetDlgItemPathW(hDlg, id, pszPath); 651 return PathSetDlgItemPathA(hDlg, id, pszPath); 651 652 } 652 653 … … 654 655 /************************************************************************* 655 656 * SHGetSpecialFolderPathA [SHELL32.175] 656 * 657 * 657 658 * converts csidl to path 658 659 */ 659 660 660 661 static const char * const szSHFolders = "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders"; 661 662 static const char * const szSHUserFolders = "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders"; … … 675 676 } CSIDL_DATA; 676 677 677 #define CSIDL_MYFLAG_SHFOLDER 1678 #define CSIDL_MYFLAG_SETUP 2679 #define CSIDL_MYFLAG_CURRVER 4680 #define CSIDL_MYFLAG_RELATIVE 8678 #define CSIDL_MYFLAG_SHFOLDER 1 679 #define CSIDL_MYFLAG_SETUP 2 680 #define CSIDL_MYFLAG_CURRVER 4 681 #define CSIDL_MYFLAG_RELATIVE 8 681 682 682 683 #define HKLM HKEY_LOCAL_MACHINE … … 685 686 { 686 687 { /* CSIDL_DESKTOP */ 687 9, HKCU,688 "Desktop",689 "Desktop"688 9, HKCU, 689 "Desktop", 690 "Desktop" 690 691 }, 691 692 { /* CSIDL_INTERNET (??) */ 692 0, 1, /* FIXME */693 NULL,694 NULL,693 0, 1, /* FIXME */ 694 NULL, 695 NULL, 695 696 }, 696 697 { /* CSIDL_PROGRAMS */ 697 9, HKCU,698 "Programs",699 "Start Menu\\Programs"698 9, HKCU, 699 "Programs", 700 "Start Menu\\Programs" 700 701 }, 701 702 { /* CSIDL_CONTROLS (.CPL files) */ 702 10, HKLM,703 "SysDir",704 "SYSTEM"703 10, HKLM, 704 "SysDir", 705 "SYSTEM" 705 706 }, 706 707 { /* CSIDL_PRINTERS */ 707 10, HKLM,708 "SysDir",709 "SYSTEM"708 10, HKLM, 709 "SysDir", 710 "SYSTEM" 710 711 }, 711 712 { /* CSIDL_PERSONAL */ 712 1, HKCU,713 "Personal",714 "My Documents"713 1, HKCU, 714 "Personal", 715 "My Documents" 715 716 }, 716 717 { /* CSIDL_FAVORITES */ 717 9, HKCU,718 "Favorites",719 "Favorites"718 9, HKCU, 719 "Favorites", 720 "Favorites" 720 721 }, 721 722 { /* CSIDL_STARTUP */ 722 9, HKCU,723 "StartUp",724 "Start Menu\\Programs\\StartUp"723 9, HKCU, 724 "StartUp", 725 "Start Menu\\Programs\\StartUp" 725 726 }, 726 727 { /* CSIDL_RECENT */ 727 9, HKCU,728 "Recent",729 "Recent"728 9, HKCU, 729 "Recent", 730 "Recent" 730 731 }, 731 732 { /* CSIDL_SENDTO */ 732 9, HKCU,733 "SendTo",734 "SendTo"733 9, HKCU, 734 "SendTo", 735 "SendTo" 735 736 }, 736 737 { /* CSIDL_BITBUCKET (is this c:\recycled ?) */ 737 0, 1, /* FIXME */738 NULL,739 "recycled"738 0, 1, /* FIXME */ 739 NULL, 740 "recycled" 740 741 }, 741 742 { /* CSIDL_STARTMENU */ 742 9, HKCU,743 "Start Menu",744 "Start Menu"743 9, HKCU, 744 "Start Menu", 745 "Start Menu" 745 746 }, 746 747 { /* not known */ 747 0, 0,748 NULL,749 NULL,748 0, 0, 749 NULL, 750 NULL, 750 751 }, 751 752 { /* not known */ 752 0, 0,753 NULL,754 NULL,753 0, 0, 754 NULL, 755 NULL, 755 756 }, 756 757 { /* not known */ 757 0, 0,758 NULL,759 NULL,758 0, 0, 759 NULL, 760 NULL, 760 761 }, 761 762 { /* not known */ 762 0, 0,763 NULL,764 NULL,763 0, 0, 764 NULL, 765 NULL, 765 766 }, 766 767 { /* CSIDL_DESKTOPDIRECTORY */ 767 9, HKCU,768 "Desktop",769 "Desktop"768 9, HKCU, 769 "Desktop", 770 "Desktop" 770 771 }, 771 772 { /* CSIDL_DRIVES */ 772 0, 1, /* FIXME */773 NULL,774 "My Computer"773 0, 1, /* FIXME */ 774 NULL, 775 "My Computer" 775 776 }, 776 777 { /* CSIDL_NETWORK */ 777 0, 1, /* FIXME */778 NULL,779 "Network Neighborhood"778 0, 1, /* FIXME */ 779 NULL, 780 "Network Neighborhood" 780 781 }, 781 782 { /* CSIDL_NETHOOD */ 782 9, HKCU,783 "NetHood",784 "NetHood"783 9, HKCU, 784 "NetHood", 785 "NetHood" 785 786 }, 786 787 { /* CSIDL_FONTS */ 787 9, HKCU,788 "Fonts",789 "Fonts"788 9, HKCU, 789 "Fonts", 790 "Fonts" 790 791 }, 791 792 { /* CSIDL_TEMPLATES */ 792 9, HKCU,793 "Templates",794 "ShellNew"793 9, HKCU, 794 "Templates", 795 "ShellNew" 795 796 }, 796 797 { /* CSIDL_COMMON_STARTMENU */ 797 9, HKLM,798 "Common Start Menu",799 "Start Menu"798 9, HKLM, 799 "Common Start Menu", 800 "Start Menu" 800 801 }, 801 802 { /* CSIDL_COMMON_PROGRAMS */ 802 9, HKLM,803 "Common Programs",804 ""803 9, HKLM, 804 "Common Programs", 805 "" 805 806 }, 806 807 { /* CSIDL_COMMON_STARTUP */ 807 9, HKLM,808 "Common StartUp",809 "All Users\\Start Menu\\Programs\\StartUp"808 9, HKLM, 809 "Common StartUp", 810 "All Users\\Start Menu\\Programs\\StartUp" 810 811 }, 811 812 { /* CSIDL_COMMON_DESKTOPDIRECTORY */ 812 9, HKLM,813 "Common Desktop",814 "Desktop"813 9, HKLM, 814 "Common Desktop", 815 "Desktop" 815 816 }, 816 817 { /* CSIDL_APPDATA */ 817 9, HKCU,818 "AppData",819 "Application Data"818 9, HKCU, 819 "AppData", 820 "Application Data" 820 821 }, 821 822 { /* CSIDL_PRINTHOOD */ 822 9, HKCU,823 "PrintHood",824 "PrintHood"823 9, HKCU, 824 "PrintHood", 825 "PrintHood" 825 826 }, 826 827 { /* not known */ 827 0, 0,828 NULL,829 NULL,828 0, 0, 829 NULL, 830 NULL, 830 831 }, 831 832 { /* CSIDL_ALTSTARTUP */ 832 0, 1, /* FIXME */833 NULL,834 NULL833 0, 1, /* FIXME */ 834 NULL, 835 NULL 835 836 }, 836 837 { /* CSIDL_COMMON_ALTSTARTUP */ 837 0, 1, /* FIXME */838 NULL,839 NULL838 0, 1, /* FIXME */ 839 NULL, 840 NULL 840 841 }, 841 842 { /* CSIDL_COMMON_FAVORITES */ 842 9, HKCU,843 "Favorites",844 "Favorites"843 9, HKCU, 844 "Favorites", 845 "Favorites" 845 846 }, 846 847 { /* CSIDL_INTERNET_CACHE */ 847 9, HKCU,848 "Cache",849 "Temporary Internet Files"848 9, HKCU, 849 "Cache", 850 "Temporary Internet Files" 850 851 }, 851 852 { /* CSIDL_COOKIES */ 852 9, HKCU,853 "Cookies",854 "Cookies"853 9, HKCU, 854 "Cookies", 855 "Cookies" 855 856 }, 856 857 { /* CSIDL_HISTORY */ 857 9, HKCU,858 "History",859 "History"858 9, HKCU, 859 "History", 860 "History" 860 861 }, 861 862 { /* CSIDL_COMMON_APPDATA */ 862 9, HKLM,863 "Common AppData",864 "All Users\\Application Data"863 9, HKLM, 864 "Common AppData", 865 "All Users\\Application Data" 865 866 }, 866 867 { /* CSIDL_WINDOWS */ 867 2, HKLM,868 "WinDir",869 "Windows"868 2, HKLM, 869 "WinDir", 870 "Windows" 870 871 }, 871 872 { /* CSIDL_SYSTEM */ 872 10, HKLM,873 "SysDir",874 "SYSTEM"873 10, HKLM, 874 "SysDir", 875 "SYSTEM" 875 876 }, 876 877 { /* CSIDL_PROGRAM_FILES */ 877 4, HKLM,878 "ProgramFilesDir",879 "Program Files"878 4, HKLM, 879 "ProgramFilesDir", 880 "Program Files" 880 881 }, 881 882 { /* CSIDL_MYPICTURES */ 882 1, HKCU,883 "My Pictures",884 "My Documents\\My Pictures"883 1, HKCU, 884 "My Pictures", 885 "My Documents\\My Pictures" 885 886 }, 886 887 { /* CSIDL_PROFILE */ 887 10, HKLM,888 "WinDir", /* correct ? */889 ""888 10, HKLM, 889 "WinDir", /* correct ? */ 890 "" 890 891 }, 891 892 { /* CSIDL_SYSTEMX86 */ 892 10, HKLM,893 "SysDir",894 "SYSTEM"893 10, HKLM, 894 "SysDir", 895 "SYSTEM" 895 896 }, 896 897 { /* CSIDL_PROGRAM_FILESX86 */ 897 4, HKLM,898 "ProgramFilesDir",899 "Program Files"898 4, HKLM, 899 "ProgramFilesDir", 900 "Program Files" 900 901 }, 901 902 { /* CSIDL_PROGRAM_FILES_COMMON */ 902 4, HKLM,903 "CommonFilesDir", 904 "Program Files\\Common Files" /* ? */903 4, HKLM, 904 "CommonFilesDir", 905 "Program Files\\Common Files" /* ? */ 905 906 }, 906 907 { /* CSIDL_PROGRAM_FILES_COMMONX86 */ 907 4, HKLM,908 "CommonFilesDir",909 "Program Files\\Common Files" /* ? */908 4, HKLM, 909 "CommonFilesDir", 910 "Program Files\\Common Files" /* ? */ 910 911 }, 911 912 { /* CSIDL_COMMON_TEMPLATES */ 912 0, 1, /* FIXME */913 NULL,914 NULL913 0, 1, /* FIXME */ 914 NULL, 915 NULL 915 916 }, 916 917 { /* CSIDL_COMMON_DOCUMENTS */ 917 0, 1, /* FIXME */918 NULL,919 NULL918 0, 1, /* FIXME */ 919 NULL, 920 NULL 920 921 }, 921 922 { /* CSIDL_COMMON_ADMINTOOLS */ 922 0, 1, /* FIXME */923 NULL,924 NULL923 0, 1, /* FIXME */ 924 NULL, 925 NULL 925 926 }, 926 927 { /* CSIDL_ADMINTOOLS */ 927 9, HKCU,928 "Administrative Tools",929 "Start Menu\\Programs\\Administrative Tools"928 9, HKCU, 929 "Administrative Tools", 930 "Start Menu\\Programs\\Administrative Tools" 930 931 }, 931 932 { /* CSIDL_CONNECTIONS */ 932 0, 1, /* FIXME */933 NULL,934 NULL933 0, 1, /* FIXME */ 934 NULL, 935 NULL 935 936 } 936 937 }; … … 941 942 942 943 BOOL WINAPI SHGetSpecialFolderPathA ( 943 HWND hwndOwner, 944 LPSTR szPath, 945 DWORD csidl, 946 BOOL bCreate) 947 { 948 CHAR szValueName[MAX_PATH], szDefaultPath[MAX_PATH], szBuildPath[MAX_PATH]; 949 HKEY hRootKey, hKey; 950 DWORD dwFlags; 951 DWORD dwType, dwDisp, dwPathLen = MAX_PATH; 952 DWORD folder = csidl & CSIDL_FOLDER_MASK; 953 CHAR *p; 954 955 TRACE("0x%04x,%p,csidl=%lu,0x%04x\n", hwndOwner,szPath,csidl,bCreate); 956 957 if ((folder > CSIDL_CONNECTIONS) || (CSIDL_Data[folder].hRootKey == 0)) 958 { 959 ERR("folder unknown or not allowed\n"); 960 return FALSE; 961 } 962 if (CSIDL_Data[folder].hRootKey == 1) 963 { 964 FIXME("folder unknown, please add.\n"); 965 return FALSE; 966 } 967 968 dwFlags = CSIDL_Data[folder].dwFlags; 969 hRootKey = CSIDL_Data[folder].hRootKey; 970 strcpy(szValueName, CSIDL_Data[folder].szValueName); 971 strcpy(szDefaultPath, CSIDL_Data[folder].szDefaultPath); 972 973 if (dwFlags & CSIDL_MYFLAG_SHFOLDER) 974 { 975 /* user shell folders */ 976 if (RegCreateKeyExA(hRootKey,szSHUserFolders,0,NULL,0,KEY_ALL_ACCESS,NULL,&hKey,&dwDisp)) return FALSE; 977 978 if (RegQueryValueExA(hKey,szValueName,NULL,&dwType,(LPBYTE)szPath,&dwPathLen)) 979 { 980 RegCloseKey(hKey); 981 982 /* shell folders */ 983 if (RegCreateKeyExA(hRootKey,szSHFolders,0,NULL,0,KEY_ALL_ACCESS,NULL,&hKey,&dwDisp)) return FALSE; 984 985 if (RegQueryValueExA(hKey,szValueName,NULL,&dwType,(LPBYTE)szPath,&dwPathLen)) 986 { 987 988 /* value not existing */ 989 if (dwFlags & CSIDL_MYFLAG_RELATIVE) 990 { 991 GetWindowsDirectoryA(szPath, MAX_PATH); 992 PathAddBackslashA(szPath); 993 strcat(szPath, szDefaultPath); 994 } 995 else 996 { 997 strcpy(szPath, "C:\\"); /* FIXME ??? */ 998 strcat(szPath, szDefaultPath); 999 } 1000 RegSetValueExA(hKey,szValueName,0,REG_SZ,(LPBYTE)szPath,strlen(szPath)+1); 1001 } 1002 } 1003 RegCloseKey(hKey); 944 HWND hwndOwner, 945 LPSTR szPath, 946 DWORD csidl, 947 BOOL bCreate) 948 { 949 CHAR szValueName[MAX_PATH], szDefaultPath[MAX_PATH], szBuildPath[MAX_PATH]; 950 HKEY hRootKey, hKey; 951 DWORD dwFlags; 952 DWORD dwType, dwDisp, dwPathLen = MAX_PATH; 953 DWORD folder = csidl & CSIDL_FOLDER_MASK; 954 CHAR *p; 955 956 TRACE("0x%04x,%p,csidl=%lu,0x%04x\n", hwndOwner,szPath,csidl,bCreate); 957 958 if ((folder > CSIDL_CONNECTIONS) || (CSIDL_Data[folder].hRootKey == 0)) 959 { 960 ERR("folder unknown or not allowed\n"); 961 return FALSE; 962 } 963 if (CSIDL_Data[folder].hRootKey == 1) 964 { 965 FIXME("folder unknown, please add.\n"); 966 return FALSE; 967 } 968 969 dwFlags = CSIDL_Data[folder].dwFlags; 970 hRootKey = CSIDL_Data[folder].hRootKey; 971 strcpy(szValueName, CSIDL_Data[folder].szValueName); 972 strcpy(szDefaultPath, CSIDL_Data[folder].szDefaultPath); 973 974 if (dwFlags & CSIDL_MYFLAG_SHFOLDER) 975 { 976 /* user shell folders */ 977 if (RegCreateKeyExA(hRootKey,szSHUserFolders,0,NULL,0,KEY_ALL_ACCESS,NULL,&hKey,&dwDisp)) return FALSE; 978 979 if (RegQueryValueExA(hKey,szValueName,NULL,&dwType,(LPBYTE)szPath,&dwPathLen)) 980 { 981 RegCloseKey(hKey); 982 983 /* shell folders */ 984 if (RegCreateKeyExA(hRootKey,szSHFolders,0,NULL,0,KEY_ALL_ACCESS,NULL,&hKey,&dwDisp)) return FALSE; 985 986 if (RegQueryValueExA(hKey,szValueName,NULL,&dwType,(LPBYTE)szPath,&dwPathLen)) 987 { 988 989 /* value not existing */ 990 if (dwFlags & CSIDL_MYFLAG_RELATIVE) 991 { 992 GetWindowsDirectoryA(szPath, MAX_PATH); 993 PathAddBackslashA(szPath); 994 strcat(szPath, szDefaultPath); 995 } 996 else 997 { 998 strcpy(szPath, "C:\\"); /* FIXME ??? */ 999 strcat(szPath, szDefaultPath); 1000 } 1001 RegSetValueExA(hKey,szValueName,0,REG_SZ,(LPBYTE)szPath,strlen(szPath)+1); 1004 1002 } 1005 else 1006 { 1007 LPCSTR pRegPath; 1008 1009 if (dwFlags & CSIDL_MYFLAG_SETUP) 1010 pRegPath = szSetup; 1011 else 1012 if (dwFlags & CSIDL_MYFLAG_CURRVER) 1013 pRegPath = szCurrentVersion; 1014 else 1015 { 1016 ERR("folder settings broken, please correct !\n"); 1017 return FALSE; 1018 } 1019 1020 if (RegCreateKeyExA(hRootKey,pRegPath,0,NULL,0,KEY_ALL_ACCESS,NULL,&hKey,&dwDisp)) return FALSE; 1021 1022 if (RegQueryValueExA(hKey,szValueName,NULL,&dwType,(LPBYTE)szPath,&dwPathLen)) 1023 { 1024 /* value not existing */ 1025 if (dwFlags & CSIDL_MYFLAG_RELATIVE) 1026 { 1027 GetWindowsDirectoryA(szPath, MAX_PATH); 1028 PathAddBackslashA(szPath); 1029 strcat(szPath, szDefaultPath); 1030 } 1031 else 1032 { 1033 strcpy(szPath, "C:\\"); /* FIXME ??? */ 1034 strcat(szPath, szDefaultPath); 1035 } 1036 RegSetValueExA(hKey,szValueName,0,REG_SZ,(LPBYTE)szPath,strlen(szPath)+1); 1037 } 1038 RegCloseKey(hKey); 1039 } 1040 1041 /* expand paths like %USERPROFILE% */ 1042 if (dwType == REG_EXPAND_SZ) 1043 { 1044 ExpandEnvironmentStringsA(szPath, szDefaultPath, MAX_PATH); 1045 strcpy(szPath, szDefaultPath); 1046 } 1047 1048 /* if we don't care about existing directories we are ready */ 1049 if(csidl & CSIDL_FLAG_DONT_VERIFY) return TRUE; 1050 1051 if (PathFileExistsA(szPath)) return TRUE; 1052 1053 /* not existing but we are not allowed to create it */ 1054 if (!bCreate) return FALSE; 1055 1056 /* create directory/directories */ 1057 strcpy(szBuildPath, szPath); 1058 p = strchr(szBuildPath, '\\'); 1059 while (p) 1060 { 1061 *p = 0; 1062 if (!PathFileExistsA(szBuildPath)) 1063 { 1064 if (!CreateDirectoryA(szBuildPath,NULL)) 1065 { 1066 ERR("Failed to create directory '%s'.\n", szPath); 1067 return FALSE; 1068 } 1069 } 1070 *p = '\\'; 1071 p = strchr(p+1, '\\'); 1072 } 1073 1074 MESSAGE("Created not existing system directory '%s'\n", szPath); 1075 return TRUE; 1003 } 1004 RegCloseKey(hKey); 1005 } 1006 else 1007 { 1008 LPCSTR pRegPath; 1009 1010 if (dwFlags & CSIDL_MYFLAG_SETUP) 1011 pRegPath = szSetup; 1012 else 1013 if (dwFlags & CSIDL_MYFLAG_CURRVER) 1014 pRegPath = szCurrentVersion; 1015 else 1016 { 1017 ERR("folder settings broken, please correct !\n"); 1018 return FALSE; 1019 } 1020 1021 if (RegCreateKeyExA(hRootKey,pRegPath,0,NULL,0,KEY_ALL_ACCESS,NULL,&hKey,&dwDisp)) return FALSE; 1022 1023 if (RegQueryValueExA(hKey,szValueName,NULL,&dwType,(LPBYTE)szPath,&dwPathLen)) 1024 { 1025 /* value not existing */ 1026 if (dwFlags & CSIDL_MYFLAG_RELATIVE) 1027 { 1028 GetWindowsDirectoryA(szPath, MAX_PATH); 1029 PathAddBackslashA(szPath); 1030 strcat(szPath, szDefaultPath); 1031 } 1032 else 1033 { 1034 strcpy(szPath, "C:\\"); /* FIXME ??? */ 1035 strcat(szPath, szDefaultPath); 1036 } 1037 RegSetValueExA(hKey,szValueName,0,REG_SZ,(LPBYTE)szPath,strlen(szPath)+1); 1038 } 1039 RegCloseKey(hKey); 1040 } 1041 1042 /* expand paths like %USERPROFILE% */ 1043 if (dwType == REG_EXPAND_SZ) 1044 { 1045 ExpandEnvironmentStringsA(szPath, szDefaultPath, MAX_PATH); 1046 strcpy(szPath, szDefaultPath); 1047 } 1048 1049 /* if we don't care about existing directories we are ready */ 1050 if(csidl & CSIDL_FLAG_DONT_VERIFY) return TRUE; 1051 1052 if (PathFileExistsA(szPath)) return TRUE; 1053 1054 /* not existing but we are not allowed to create it */ 1055 if (!bCreate) return FALSE; 1056 1057 /* create directory/directories */ 1058 strcpy(szBuildPath, szPath); 1059 p = strchr(szBuildPath, '\\'); 1060 while (p) 1061 { 1062 *p = 0; 1063 if (!PathFileExistsA(szBuildPath)) 1064 { 1065 if (!CreateDirectoryA(szBuildPath,NULL)) 1066 { 1067 ERR("Failed to create directory '%s'.\n", szPath); 1068 return FALSE; 1069 } 1070 } 1071 *p = '\\'; 1072 p = strchr(p+1, '\\'); 1073 } 1074 1075 MESSAGE("Created not existing system directory '%s'\n", szPath); 1076 return TRUE; 1076 1077 } 1077 1078 … … 1080 1081 */ 1081 1082 BOOL WINAPI SHGetSpecialFolderPathW ( 1082 HWND hwndOwner,1083 LPWSTR szPath,1084 DWORD csidl,1085 BOOL bCreate)1086 { 1087 char szTemp[MAX_PATH];1088 1089 if (SHGetSpecialFolderPathA(hwndOwner, szTemp, csidl, bCreate))1090 {1083 HWND hwndOwner, 1084 LPWSTR szPath, 1085 DWORD csidl, 1086 BOOL bCreate) 1087 { 1088 char szTemp[MAX_PATH]; 1089 1090 if (SHGetSpecialFolderPathA(hwndOwner, szTemp, csidl, bCreate)) 1091 { 1091 1092 if (!MultiByteToWideChar( CP_ACP, 0, szTemp, -1, szPath, MAX_PATH )) 1092 1093 szPath[MAX_PATH-1] = 0; 1093 1094 } 1094 1095 1095 TRACE("0x%04x,%p,csidl=%lu,0x%04x\n", hwndOwner,szPath,csidl,bCreate);1096 1097 return TRUE;1096 TRACE("0x%04x,%p,csidl=%lu,0x%04x\n", hwndOwner,szPath,csidl,bCreate); 1097 1098 return TRUE; 1098 1099 } 1099 1100 … … 1102 1103 */ 1103 1104 BOOL WINAPI SHGetSpecialFolderPathAW ( 1104 HWND hwndOwner,1105 LPVOID szPath,1106 DWORD csidl,1107 BOOL bCreate)1108 1109 { 1110 if (SHELL_OsIsUnicode())1111 return SHGetSpecialFolderPathW (hwndOwner, szPath, csidl, bCreate);1112 return SHGetSpecialFolderPathA (hwndOwner, szPath, csidl, bCreate);1113 } 1114 1115 /************************************************************************* 1116 * SHGetFolderPathA [SHFOLDER.@]1105 HWND hwndOwner, 1106 LPVOID szPath, 1107 DWORD csidl, 1108 BOOL bCreate) 1109 1110 { 1111 if (SHELL_OsIsUnicode()) 1112 return SHGetSpecialFolderPathW (hwndOwner, szPath, csidl, bCreate); 1113 return SHGetSpecialFolderPathA (hwndOwner, szPath, csidl, bCreate); 1114 } 1115 1116 /************************************************************************* 1117 * SHGetFolderPathA [SHFOLDER.@] 1117 1118 */ 1118 1119 HRESULT WINAPI SHGetFolderPathA( 1119 HWND hwndOwner,1120 int nFolder,1121 HANDLE hToken,/* [in] FIXME: get paths for specific user */1122 DWORD dwFlags,/* [in] FIXME: SHGFP_TYPE_CURRENT|SHGFP_TYPE_DEFAULT */1123 LPSTR pszPath)1124 { 1125 return (SHGetSpecialFolderPathA(1126 hwndOwner,1127 pszPath,1128 CSIDL_FOLDER_MASK & nFolder,1129 CSIDL_FLAG_CREATE & nFolder )) ? S_OK : E_FAIL;1130 } 1131 1132 /************************************************************************* 1133 * SHGetFolderPathW [SHFOLDER.@]1120 HWND hwndOwner, 1121 int nFolder, 1122 HANDLE hToken, /* [in] FIXME: get paths for specific user */ 1123 DWORD dwFlags, /* [in] FIXME: SHGFP_TYPE_CURRENT|SHGFP_TYPE_DEFAULT */ 1124 LPSTR pszPath) 1125 { 1126 return (SHGetSpecialFolderPathA( 1127 hwndOwner, 1128 pszPath, 1129 CSIDL_FOLDER_MASK & nFolder, 1130 CSIDL_FLAG_CREATE & nFolder )) ? S_OK : E_FAIL; 1131 } 1132 1133 /************************************************************************* 1134 * SHGetFolderPathW [SHFOLDER.@] 1134 1135 */ 1135 1136 HRESULT WINAPI SHGetFolderPathW( 1136 HWND hwndOwner,1137 int nFolder,1138 HANDLE hToken,1139 DWORD dwFlags,1140 LPWSTR pszPath)1141 { 1142 return (SHGetSpecialFolderPathW(1143 hwndOwner,1144 pszPath,1145 CSIDL_FOLDER_MASK & nFolder,1146 CSIDL_FLAG_CREATE & nFolder )) ? S_OK : E_FAIL;1147 } 1137 HWND hwndOwner, 1138 int nFolder, 1139 HANDLE hToken, 1140 DWORD dwFlags, 1141 LPWSTR pszPath) 1142 { 1143 return (SHGetSpecialFolderPathW( 1144 hwndOwner, 1145 pszPath, 1146 CSIDL_FOLDER_MASK & nFolder, 1147 CSIDL_FLAG_CREATE & nFolder )) ? S_OK : E_FAIL; 1148 } -
trunk/src/shell32/shellreg.c
r5618 r6650 1 /* $Id: shellreg.c,v 1.3 2001-09-05 13:46:58 bird Exp $ */ 1 2 /* 2 Shell Registry Access3 Shell Registry Access 3 4 */ 4 5 #include <string.h> … … 17 18 18 19 /************************************************************************* 19 * SHRegOpenKeyA [SHELL32.506]20 * SHRegOpenKeyA [SHELL32.506] 20 21 * 21 22 */ 22 23 HRESULT WINAPI SHRegOpenKeyA( 23 HKEY hKey,24 LPSTR lpSubKey,25 LPHKEY phkResult)26 { 27 TRACE("(0x%08x, %s, %p)\n", hKey, debugstr_a(lpSubKey), phkResult);28 return RegOpenKeyA(hKey, lpSubKey, phkResult);29 } 30 31 /************************************************************************* 32 * SHRegOpenKeyW [NT4.0:SHELL32.507]24 HKEY hKey, 25 LPSTR lpSubKey, 26 LPHKEY phkResult) 27 { 28 TRACE("(0x%08x, %s, %p)\n", hKey, debugstr_a(lpSubKey), phkResult); 29 return RegOpenKeyA(hKey, lpSubKey, phkResult); 30 } 31 32 /************************************************************************* 33 * SHRegOpenKeyW [NT4.0:SHELL32.507] 33 34 * 34 35 */ 35 36 HRESULT WINAPI SHRegOpenKeyW ( 36 HKEY hkey,37 LPCWSTR lpszSubKey,38 LPHKEY retkey)39 { 40 WARN("0x%04x %s %p\n",hkey,debugstr_w(lpszSubKey),retkey);41 return RegOpenKeyW( hkey, lpszSubKey, retkey );37 HKEY hkey, 38 LPCWSTR lpszSubKey, 39 LPHKEY retkey) 40 { 41 WARN("0x%04x %s %p\n",hkey,debugstr_w(lpszSubKey),retkey); 42 return RegOpenKeyW( hkey, lpszSubKey, retkey ); 42 43 } 43 44 … … 47 48 */ 48 49 HRESULT WINAPI SHRegQueryValueExA( 49 HKEY hkey,50 LPSTR lpValueName,51 LPDWORD lpReserved,52 LPDWORD lpType,53 LPBYTE lpData,54 LPDWORD lpcbData)55 { 56 TRACE("0x%04x %s %p %p %p %p\n", hkey, lpValueName, lpReserved, lpType, lpData, lpcbData);57 return RegQueryValueExA (hkey, lpValueName, lpReserved, lpType, lpData, lpcbData);58 } 59 60 /************************************************************************* 61 * SHRegQueryValueW [NT4.0:SHELL32.510]50 HKEY hkey, 51 LPSTR lpValueName, 52 LPDWORD lpReserved, 53 LPDWORD lpType, 54 LPBYTE lpData, 55 LPDWORD lpcbData) 56 { 57 TRACE("0x%04x %s %p %p %p %p\n", hkey, lpValueName, lpReserved, lpType, lpData, lpcbData); 58 return RegQueryValueExA (hkey, lpValueName, lpReserved, lpType, lpData, lpcbData); 59 } 60 61 /************************************************************************* 62 * SHRegQueryValueW [NT4.0:SHELL32.510] 62 63 * 63 64 */ 64 65 HRESULT WINAPI SHRegQueryValueW( 65 HKEY hkey,66 LPWSTR lpszSubKey,67 LPWSTR lpszData,68 LPDWORD lpcbData )69 { 70 WARN("0x%04x %s %p %p semi-stub\n",71 hkey, debugstr_w(lpszSubKey), lpszData, lpcbData);72 return RegQueryValueW( hkey, lpszSubKey, lpszData, lpcbData );73 } 74 75 /************************************************************************* 76 * SHRegQueryValueExW [NT4.0:SHELL32.511]77 * 78 * FIXME 66 HKEY hkey, 67 LPWSTR lpszSubKey, 68 LPWSTR lpszData, 69 LPDWORD lpcbData ) 70 { 71 WARN("0x%04x %s %p %p semi-stub\n", 72 hkey, debugstr_w(lpszSubKey), lpszData, lpcbData); 73 return RegQueryValueW( hkey, lpszSubKey, lpszData, lpcbData ); 74 } 75 76 /************************************************************************* 77 * SHRegQueryValueExW [NT4.0:SHELL32.511] 78 * 79 * FIXME 79 80 * if the datatype REG_EXPAND_SZ then expand the string and change 80 * *pdwType to REG_SZ. 81 * *pdwType to REG_SZ. 81 82 */ 82 83 HRESULT WINAPI SHRegQueryValueExW ( 83 HKEY hkey,84 LPWSTR pszValue,85 LPDWORD pdwReserved,86 LPDWORD pdwType,87 LPVOID pvData,88 LPDWORD pcbData)89 { 90 DWORD ret;91 WARN("0x%04x %s %p %p %p %p semi-stub\n",92 hkey, debugstr_w(pszValue), pdwReserved, pdwType, pvData, pcbData);93 ret = RegQueryValueExW ( hkey, pszValue, pdwReserved, pdwType, pvData, pcbData);94 return ret;84 HKEY hkey, 85 LPWSTR pszValue, 86 LPDWORD pdwReserved, 87 LPDWORD pdwType, 88 LPVOID pvData, 89 LPDWORD pcbData) 90 { 91 DWORD ret; 92 WARN("0x%04x %s %p %p %p %p semi-stub\n", 93 hkey, debugstr_w(pszValue), pdwReserved, pdwType, pvData, pcbData); 94 ret = RegQueryValueExW ( hkey, pszValue, pdwReserved, pdwType, pvData, pcbData); 95 return ret; 95 96 } 96 97 … … 99 100 */ 100 101 HRESULT WINAPI SHRegDeleteKeyA( 101 HKEY hkey,102 LPCSTR pszSubKey)103 { 104 FIXME("hkey=0x%08x, %s\n", hkey, debugstr_a(pszSubKey));102 HKEY hkey, 103 LPCSTR pszSubKey) 104 { 105 FIXME("hkey=0x%08x, %s\n", hkey, debugstr_a(pszSubKey)); 105 106 #ifdef __WIN32OS2__ 106 107 return RegDeleteKeyA(hkey,pszSubKey); 107 108 #else 108 return 0;109 return 0; 109 110 #endif 110 111 } … … 114 115 */ 115 116 HRESULT WINAPI SHRegDeleteKeyW( 116 HKEY hkey,117 LPCWSTR pszSubKey)118 { 119 FIXME("hkey=0x%08x, %s\n", hkey, debugstr_w(pszSubKey));117 HKEY hkey, 118 LPCWSTR pszSubKey) 119 { 120 FIXME("hkey=0x%08x, %s\n", hkey, debugstr_w(pszSubKey)); 120 121 #ifdef __WIN32OS2__ 121 122 return RegDeleteKeyW(hkey,pszSubKey); 122 123 #else 123 return 0;124 return 0; 124 125 #endif 125 126 } 126 127 127 128 /************************************************************************* 128 * SHRegCloseKey [NT4.0:SHELL32.505]129 * SHRegCloseKey [NT4.0:SHELL32.505] 129 130 * 130 131 */ 131 132 HRESULT WINAPI SHRegCloseKey (HKEY hkey) 132 133 { 133 TRACE("0x%04x\n",hkey);134 return RegCloseKey( hkey );134 TRACE("0x%04x\n",hkey); 135 return RegCloseKey( hkey ); 135 136 } 136 137 -
trunk/src/shell32/shellstring.c
r5618 r6650 1 /* $Id: shellstring.c,v 1.3 2001-09-05 13:46:58 bird Exp $ */ 1 2 #include <string.h> 2 3 #include <stdio.h> 3 4 #include <ctype.h> 4 #include <stdlib.h> 5 #include <stdlib.h> 5 6 6 7 #include "winnls.h" … … 21 22 22 23 /************************************************************************* 23 * StrRetToStrN [SHELL32.96]24 * 24 * StrRetToStrN [SHELL32.96] 25 * 25 26 * converts a STRRET to a normal string 26 27 * … … 40 41 HRESULT WINAPI StrRetToStrNAW (LPVOID dest, DWORD len, LPSTRRET src, const ITEMIDLIST *pidl) 41 42 { 42 if(SHELL_OsIsUnicode())43 return StrRetToStrNW (dest, len, src, pidl);44 return StrRetToStrNA (dest, len, src, pidl);43 if(SHELL_OsIsUnicode()) 44 return StrRetToStrNW (dest, len, src, pidl); 45 return StrRetToStrNA (dest, len, src, pidl); 45 46 } 46 47 … … 48 49 49 50 /************************************************************************ 50 * StrToOleStr[SHELL32.163]51 * StrToOleStr [SHELL32.163] 51 52 * 52 53 */ 53 54 int WINAPI StrToOleStrA (LPWSTR lpWideCharStr, LPCSTR lpMultiByteString) 54 55 { 55 TRACE("(%p, %p %s)\n",56 lpWideCharStr, lpMultiByteString, debugstr_a(lpMultiByteString));56 TRACE("(%p, %p %s)\n", 57 lpWideCharStr, lpMultiByteString, debugstr_a(lpMultiByteString)); 57 58 58 return MultiByteToWideChar(0, 0, lpMultiByteString, -1, lpWideCharStr, MAX_PATH);59 return MultiByteToWideChar(0, 0, lpMultiByteString, -1, lpWideCharStr, MAX_PATH); 59 60 60 61 } 61 62 int WINAPI StrToOleStrW (LPWSTR lpWideCharStr, LPCWSTR lpWString) 62 63 { 63 TRACE("(%p, %p %s)\n",64 lpWideCharStr, lpWString, debugstr_w(lpWString));64 TRACE("(%p, %p %s)\n", 65 lpWideCharStr, lpWString, debugstr_w(lpWString)); 65 66 66 strcpyW (lpWideCharStr, lpWString );67 return strlenW(lpWideCharStr);67 strcpyW (lpWideCharStr, lpWString ); 68 return strlenW(lpWideCharStr); 68 69 } 69 70 70 71 BOOL WINAPI StrToOleStrAW (LPWSTR lpWideCharStr, LPCVOID lpString) 71 72 { 72 if (SHELL_OsIsUnicode())73 return StrToOleStrW (lpWideCharStr, lpString);74 return StrToOleStrA (lpWideCharStr, lpString);73 if (SHELL_OsIsUnicode()) 74 return StrToOleStrW (lpWideCharStr, lpString); 75 return StrToOleStrA (lpWideCharStr, lpString); 75 76 } 76 77 77 78 /************************************************************************* 78 * StrToOleStrN [SHELL32.79]79 * StrToOleStrN [SHELL32.79] 79 80 * lpMulti, nMulti, nWide [IN] 80 81 * lpWide [OUT] 81 82 */ 82 BOOL WINAPI StrToOleStrNA (LPWSTR lpWide, INT nWide, LPCSTR lpStrA, INT nStr) 83 BOOL WINAPI StrToOleStrNA (LPWSTR lpWide, INT nWide, LPCSTR lpStrA, INT nStr) 83 84 { 84 TRACE("(%p, %x, %s, %x)\n", lpWide, nWide, debugstr_an(lpStrA,nStr), nStr);85 return MultiByteToWideChar (0, 0, lpStrA, nStr, lpWide, nWide);85 TRACE("(%p, %x, %s, %x)\n", lpWide, nWide, debugstr_an(lpStrA,nStr), nStr); 86 return MultiByteToWideChar (0, 0, lpStrA, nStr, lpWide, nWide); 86 87 } 87 BOOL WINAPI StrToOleStrNW (LPWSTR lpWide, INT nWide, LPCWSTR lpStrW, INT nStr) 88 BOOL WINAPI StrToOleStrNW (LPWSTR lpWide, INT nWide, LPCWSTR lpStrW, INT nStr) 88 89 { 89 TRACE("(%p, %x, %s, %x)\n", lpWide, nWide, debugstr_wn(lpStrW, nStr), nStr);90 TRACE("(%p, %x, %s, %x)\n", lpWide, nWide, debugstr_wn(lpStrW, nStr), nStr); 90 91 91 if (lstrcpynW (lpWide, lpStrW, nWide))92 { return lstrlenW (lpWide);93 }94 return 0;92 if (lstrcpynW (lpWide, lpStrW, nWide)) 93 { return lstrlenW (lpWide); 94 } 95 return 0; 95 96 } 96 97 97 BOOL WINAPI StrToOleStrNAW (LPWSTR lpWide, INT nWide, LPCVOID lpStr, INT nStr) 98 BOOL WINAPI StrToOleStrNAW (LPWSTR lpWide, INT nWide, LPCVOID lpStr, INT nStr) 98 99 { 99 if (SHELL_OsIsUnicode())100 return StrToOleStrNW (lpWide, nWide, lpStr, nStr);101 return StrToOleStrNA (lpWide, nWide, lpStr, nStr);100 if (SHELL_OsIsUnicode()) 101 return StrToOleStrNW (lpWide, nWide, lpStr, nStr); 102 return StrToOleStrNA (lpWide, nWide, lpStr, nStr); 102 103 } 103 104 104 105 /************************************************************************* 105 * OleStrToStrN [SHELL32.78]106 * OleStrToStrN [SHELL32.78] 106 107 */ 107 BOOL WINAPI OleStrToStrNA (LPSTR lpStr, INT nStr, LPCWSTR lpOle, INT nOle) 108 BOOL WINAPI OleStrToStrNA (LPSTR lpStr, INT nStr, LPCWSTR lpOle, INT nOle) 108 109 { 109 TRACE("(%p, %x, %s, %x)\n", lpStr, nStr, debugstr_wn(lpOle,nOle), nOle);110 return WideCharToMultiByte (0, 0, lpOle, nOle, lpStr, nStr, NULL, NULL);110 TRACE("(%p, %x, %s, %x)\n", lpStr, nStr, debugstr_wn(lpOle,nOle), nOle); 111 return WideCharToMultiByte (0, 0, lpOle, nOle, lpStr, nStr, NULL, NULL); 111 112 } 112 113 113 BOOL WINAPI OleStrToStrNW (LPWSTR lpwStr, INT nwStr, LPCWSTR lpOle, INT nOle) 114 BOOL WINAPI OleStrToStrNW (LPWSTR lpwStr, INT nwStr, LPCWSTR lpOle, INT nOle) 114 115 { 115 TRACE("(%p, %x, %s, %x)\n", lpwStr, nwStr, debugstr_wn(lpOle,nOle), nOle);116 TRACE("(%p, %x, %s, %x)\n", lpwStr, nwStr, debugstr_wn(lpOle,nOle), nOle); 116 117 117 if (lstrcpynW ( lpwStr, lpOle, nwStr))118 { return lstrlenW (lpwStr);119 }120 return 0;118 if (lstrcpynW ( lpwStr, lpOle, nwStr)) 119 { return lstrlenW (lpwStr); 120 } 121 return 0; 121 122 } 122 123 123 BOOL WINAPI OleStrToStrNAW (LPVOID lpOut, INT nOut, LPCVOID lpIn, INT nIn) 124 BOOL WINAPI OleStrToStrNAW (LPVOID lpOut, INT nOut, LPCVOID lpIn, INT nIn) 124 125 { 125 if (SHELL_OsIsUnicode())126 return OleStrToStrNW (lpOut, nOut, lpIn, nIn);127 return OleStrToStrNA (lpOut, nOut, lpIn, nIn);126 if (SHELL_OsIsUnicode()) 127 return OleStrToStrNW (lpOut, nOut, lpIn, nIn); 128 return OleStrToStrNA (lpOut, nOut, lpIn, nIn); 128 129 } -
trunk/src/shell32/shlfileop.c
r5661 r6650 1 /* $Id: shlfileop.c,v 1.9 2001-09-05 13:46:58 bird Exp $ */ 1 2 /* 2 3 * SHFileOperation … … 23 24 BOOL SHELL_ConfirmDialog (int nKindOfDialog, LPCSTR szDir) 24 25 { 25 char szCaption[255], szText[255], szBuffer[MAX_PATH + 256];26 char szCaption[255], szText[255], szBuffer[MAX_PATH + 256]; 26 27 UINT caption_resource_id, text_resource_id; 27 28 28 switch(nKindOfDialog) {29 30 case ASK_DELETE_FILE:31 caption_resource_id= IDS_DELETEITEM_CAPTION;32 text_resource_id= IDS_DELETEITEM_TEXT;33 break;34 case ASK_DELETE_FOLDER:35 caption_resource_id= IDS_DELETEFOLDER_CAPTION;36 text_resource_id= IDS_DELETEITEM_TEXT;37 break;38 case ASK_DELETE_MULTIPLE_ITEM:39 caption_resource_id= IDS_DELETEITEM_CAPTION;40 text_resource_id= IDS_DELETEMULTIPLE_TEXT;41 break;42 case ASK_OVERWRITE_FILE:43 caption_resource_id= IDS_OVERWRITEFILE_CAPTION;44 text_resource_id= IDS_OVERWRITEFILE_TEXT;45 break;46 default:47 FIXME(__FUNCTION__" Unhandled nKindOfDialog %d stub\n", nKindOfDialog);48 return FALSE;49 }50 51 LoadStringA(shell32_hInstance, caption_resource_id, szCaption, sizeof(szCaption));52 LoadStringA(shell32_hInstance, text_resource_id, szText, sizeof(szText));29 switch(nKindOfDialog) { 30 31 case ASK_DELETE_FILE: 32 caption_resource_id = IDS_DELETEITEM_CAPTION; 33 text_resource_id = IDS_DELETEITEM_TEXT; 34 break; 35 case ASK_DELETE_FOLDER: 36 caption_resource_id = IDS_DELETEFOLDER_CAPTION; 37 text_resource_id = IDS_DELETEITEM_TEXT; 38 break; 39 case ASK_DELETE_MULTIPLE_ITEM: 40 caption_resource_id = IDS_DELETEITEM_CAPTION; 41 text_resource_id = IDS_DELETEMULTIPLE_TEXT; 42 break; 43 case ASK_OVERWRITE_FILE: 44 caption_resource_id = IDS_OVERWRITEFILE_CAPTION; 45 text_resource_id = IDS_OVERWRITEFILE_TEXT; 46 break; 47 default: 48 FIXME(__FUNCTION__" Unhandled nKindOfDialog %d stub\n", nKindOfDialog); 49 return FALSE; 50 } 51 52 LoadStringA(shell32_hInstance, caption_resource_id, szCaption, sizeof(szCaption)); 53 LoadStringA(shell32_hInstance, text_resource_id, szText, sizeof(szText)); 53 54 #else 54 55 BOOL SHELL_WarnItemDelete (int nKindOfDialog, LPCSTR szDir) 55 56 { 56 char szCaption[255], szText[255], szBuffer[MAX_PATH + 256];57 char szCaption[255], szText[255], szBuffer[MAX_PATH + 256]; 57 58 58 59 if(nKindOfDialog == ASK_DELETE_FILE) 59 60 { 60 LoadStringA(shell32_hInstance, IDS_DELETEITEM_TEXT, szText, 61 sizeof(szText));62 LoadStringA(shell32_hInstance, IDS_DELETEITEM_CAPTION, 63 szCaption, sizeof(szCaption));64 }61 LoadStringA(shell32_hInstance, IDS_DELETEITEM_TEXT, szText, 62 sizeof(szText)); 63 LoadStringA(shell32_hInstance, IDS_DELETEITEM_CAPTION, 64 szCaption, sizeof(szCaption)); 65 } 65 66 else if(nKindOfDialog == ASK_DELETE_FOLDER) 66 67 { 67 LoadStringA(shell32_hInstance, IDS_DELETEITEM_TEXT, szText, 68 sizeof(szText));69 LoadStringA(shell32_hInstance, IDS_DELETEFOLDER_CAPTION, 70 szCaption, sizeof(szCaption));68 LoadStringA(shell32_hInstance, IDS_DELETEITEM_TEXT, szText, 69 sizeof(szText)); 70 LoadStringA(shell32_hInstance, IDS_DELETEFOLDER_CAPTION, 71 szCaption, sizeof(szCaption)); 71 72 } 72 73 else if(nKindOfDialog == ASK_DELETE_MULTIPLE_ITEM) 73 74 { 74 LoadStringA(shell32_hInstance, IDS_DELETEMULTIPLE_TEXT, szText, 75 sizeof(szText));76 LoadStringA(shell32_hInstance, IDS_DELETEITEM_CAPTION, 77 szCaption, sizeof(szCaption));75 LoadStringA(shell32_hInstance, IDS_DELETEMULTIPLE_TEXT, szText, 76 sizeof(szText)); 77 LoadStringA(shell32_hInstance, IDS_DELETEITEM_CAPTION, 78 szCaption, sizeof(szCaption)); 78 79 } 79 else {80 else { 80 81 FIXME("Called without a valid nKindOfDialog specified!"); 81 LoadStringA(shell32_hInstance, IDS_DELETEITEM_TEXT, szText, 82 sizeof(szText));83 LoadStringA(shell32_hInstance, IDS_DELETEITEM_CAPTION, 84 szCaption, sizeof(szCaption));85 } 86 #endif 87 FormatMessageA(FORMAT_MESSAGE_FROM_STRING|FORMAT_MESSAGE_ARGUMENT_ARRAY,88 szText, 0, 0, szBuffer, sizeof(szBuffer), (va_list*)&szDir);89 90 return (IDOK == MessageBoxA(GetActiveWindow(), szBuffer, szCaption, MB_OKCANCEL | MB_ICONEXCLAMATION));82 LoadStringA(shell32_hInstance, IDS_DELETEITEM_TEXT, szText, 83 sizeof(szText)); 84 LoadStringA(shell32_hInstance, IDS_DELETEITEM_CAPTION, 85 szCaption, sizeof(szCaption)); 86 } 87 #endif 88 FormatMessageA(FORMAT_MESSAGE_FROM_STRING|FORMAT_MESSAGE_ARGUMENT_ARRAY, 89 szText, 0, 0, szBuffer, sizeof(szBuffer), (va_list*)&szDir); 90 91 return (IDOK == MessageBoxA(GetActiveWindow(), szBuffer, szCaption, MB_OKCANCEL | MB_ICONEXCLAMATION)); 91 92 } 92 93 93 94 /************************************************************************** 94 * SHELL_DeleteDirectoryA()95 * SHELL_DeleteDirectoryA() 95 96 * 96 97 * like rm -r … … 99 100 BOOL SHELL_DeleteDirectoryA(LPCSTR pszDir, BOOL bShowUI) 100 101 { 101 BOOLret = FALSE;102 HANDLEhFind;103 WIN32_FIND_DATAA wfd;104 charszTemp[MAX_PATH];105 106 strcpy(szTemp, pszDir);107 PathAddBackslashA(szTemp);108 strcat(szTemp, "*.*");109 110 if (bShowUI && !SHELL_WarnItemDelete(ASK_DELETE_FOLDER, pszDir))111 return FALSE;112 113 if(INVALID_HANDLE_VALUE != (hFind = FindFirstFileA(szTemp, &wfd)))114 {115 do116 {117 if(strcasecmp(wfd.cFileName, ".") && strcasecmp(wfd.cFileName, ".."))118 {119 strcpy(szTemp, pszDir);120 PathAddBackslashA(szTemp);121 strcat(szTemp, wfd.cFileName);122 123 if(FILE_ATTRIBUTE_DIRECTORY & wfd.dwFileAttributes)124 SHELL_DeleteDirectoryA(szTemp, FALSE);125 else126 DeleteFileA(szTemp);127 }128 } while(FindNextFileA(hFind, &wfd));129 130 FindClose(hFind);131 ret = RemoveDirectoryA(pszDir);132 }133 134 return ret;102 BOOL ret = FALSE; 103 HANDLE hFind; 104 WIN32_FIND_DATAA wfd; 105 char szTemp[MAX_PATH]; 106 107 strcpy(szTemp, pszDir); 108 PathAddBackslashA(szTemp); 109 strcat(szTemp, "*.*"); 110 111 if (bShowUI && !SHELL_WarnItemDelete(ASK_DELETE_FOLDER, pszDir)) 112 return FALSE; 113 114 if(INVALID_HANDLE_VALUE != (hFind = FindFirstFileA(szTemp, &wfd))) 115 { 116 do 117 { 118 if(strcasecmp(wfd.cFileName, ".") && strcasecmp(wfd.cFileName, "..")) 119 { 120 strcpy(szTemp, pszDir); 121 PathAddBackslashA(szTemp); 122 strcat(szTemp, wfd.cFileName); 123 124 if(FILE_ATTRIBUTE_DIRECTORY & wfd.dwFileAttributes) 125 SHELL_DeleteDirectoryA(szTemp, FALSE); 126 else 127 DeleteFileA(szTemp); 128 } 129 } while(FindNextFileA(hFind, &wfd)); 130 131 FindClose(hFind); 132 ret = RemoveDirectoryA(pszDir); 133 } 134 135 return ret; 135 136 } 136 137 137 138 /************************************************************************** 138 * SHELL_DeleteFileA()139 * SHELL_DeleteFileA() 139 140 */ 140 141 141 142 BOOL SHELL_DeleteFileA(LPCSTR pszFile, BOOL bShowUI) 142 143 { 143 if (bShowUI && !SHELL_WarnItemDelete(ASK_DELETE_FILE, pszFile))144 return FALSE;145 144 if (bShowUI && !SHELL_WarnItemDelete(ASK_DELETE_FILE, pszFile)) 145 return FALSE; 146 146 147 return DeleteFileA(pszFile); 147 148 } 148 149 149 150 /************************************************************************* 150 * SHCreateDirectory [SHELL32.165]151 * SHCreateDirectory [SHELL32.165] 151 152 * 152 153 * NOTES … … 156 157 DWORD WINAPI SHCreateDirectory(LPSECURITY_ATTRIBUTES sec,LPCSTR path) 157 158 { 158 DWORD ret;159 TRACE("(%p,%s)\n",sec,path);160 if ((ret = CreateDirectoryA(path,sec)))161 {162 SHChangeNotifyA(SHCNE_MKDIR, SHCNF_PATHA, path, NULL);163 }164 return ret;159 DWORD ret; 160 TRACE("(%p,%s)\n",sec,path); 161 if ((ret = CreateDirectoryA(path,sec))) 162 { 163 SHChangeNotifyA(SHCNE_MKDIR, SHCNF_PATHA, path, NULL); 164 } 165 return ret; 165 166 } 166 167 167 168 /************************************************************************ 168 * Win32DeleteFile [SHELL32.164] 169 * Win32DeleteFile [SHELL32.164] 169 170 * 170 171 * Deletes a file. Also triggers a change notify if one exists. … … 178 179 BOOL WINAPI Win32DeleteFile(LPSTR fName) 179 180 { 180 TRACE("%p(%s)\n", fName, fName);181 182 DeleteFileA(fName);183 SHChangeNotifyA(SHCNE_DELETE, SHCNF_PATHA, fName, NULL);184 return TRUE;181 TRACE("%p(%s)\n", fName, fName); 182 183 DeleteFileA(fName); 184 SHChangeNotifyA(SHCNE_DELETE, SHCNF_PATHA, fName, NULL); 185 return TRUE; 185 186 } 186 187 187 188 /************************************************************************* 188 * SHFileOperationA [SHELL32.243]189 * SHFileOperationA [SHELL32.243] 189 190 * 190 191 * NOTES 191 192 * exported by name 192 193 */ 193 DWORD WINAPI SHFileOperationA (LPSHFILEOPSTRUCTA lpFileOp) 194 { 195 LPSTR pFrom = (LPSTR)lpFileOp->pFrom;196 LPSTR pTo = (LPSTR)lpFileOp->pTo;194 DWORD WINAPI SHFileOperationA (LPSHFILEOPSTRUCTA lpFileOp) 195 { 196 LPSTR pFrom = (LPSTR)lpFileOp->pFrom; 197 LPSTR pTo = (LPSTR)lpFileOp->pTo; 197 198 #ifdef __WIN32OS2__ 198 199 DWORD FromAttr; … … 223 224 /* default no error 224 225 */ 225 lpFileOp->fAnyOperationsAborted=FALSE;226 nlpFileOp.fAnyOperationsAborted=FALSE;226 lpFileOp->fAnyOperationsAborted=FALSE; 227 nlpFileOp.fAnyOperationsAborted=FALSE; 227 228 #else 228 LPSTR pTempTo;229 #endif 230 231 switch(lpFileOp->wFunc) {232 case FO_COPY:233 TRACE("File Copy:\n");229 LPSTR pTempTo; 230 #endif 231 232 switch(lpFileOp->wFunc) { 233 case FO_COPY: 234 TRACE("File Copy:\n"); 234 235 #ifdef __WIN32OS2__ 235 236 pTempFrom = HeapAlloc(GetProcessHeap(), 0, 3 * MAX_PATH+6); 236 237 pTempTo = &pTempFrom[MAX_PATH+4]; 237 /* 238 * FOF_MULTIDESTFILES, FOF_NOCONFIRMATION, FOF_FILESONLY areimplemented238 /* 239 * FOF_MULTIDESTFILES, FOF_NOCONFIRMATION, FOF_FILESONLY are implemented 239 240 * FOF_CONFIRMMOUSE, FOF_SILENT, FOF_NOCONFIRMMKDIR, FOF_SIMPLEPROGRESS are not implemented and ignored 240 241 * if any other flag set, an error occurs 241 */ 242 */ 242 243 OFl = (OFl & (-1 - (FOF_MULTIDESTFILES | FOF_FILESONLY))); 243 244 OFl = (OFl ^ (FOF_SILENT | FOF_NOCONFIRMATION | FOF_SIMPLEPROGRESS | FOF_NOCONFIRMMKDIR)); … … 249 250 // not FOF_SILENT, not FOF_SIMPLEPROGRESS, not FOF_NOCONFIRMMKDIR 250 251 FIXME(__FUNCTION__" FO_COPY with this lpFileOp->fFlags not full implemented:0x%x ,stub\n",lpFileOp->fFlags); 251 } /* endif */ 252 } /* endif */ 252 253 } /* endif */ 253 254 254 255 not_overwrite = (!(lpFileOp->fFlags & FOF_NOCONFIRMATION)); 255 256 256 // fix for more then one source for one target 257 // fix for more then one source for one target 257 258 pToFile = pTempTo; 258 259 … … 274 275 TRACE(" From='%s' To='%s'\n", pFrom, pTo); 275 276 276 // fix for more then one source for one target 277 // fix for more then one source for one target 277 278 pToFile[0] = '\0'; 278 279 nlpFileOp.pTo = pTo; … … 292 293 strcpy(pTempTo,pTo); 293 294 PathRemoveBackslashA(pTempTo); 294 ToWithoutBackSlash = (strlen(pTempTo)==lenTo); 295 ToWithoutBackSlash = (strlen(pTempTo)==lenTo); 295 296 ToAttr = GetFileAttributesA(pTempTo); 296 297 297 298 BothDir = (Multi && 298 299 ToWithoutBackSlash && 299 (-1 != (FromAttr | ToAttr)) && 300 (-1 != (FromAttr | ToAttr)) && 300 301 (ToAttr & FromAttr & FILE_ATTRIBUTE_DIRECTORY)); 301 302 … … 315 316 where = 201; 316 317 break; 317 } 318 } 318 319 lenTempTo = strlen(pTempTo); 319 320 withFileName = (((lenTempTo + 1) < lenTo) || (PathIsRootA(pTo) && lenTempTo < lenTo)); … … 353 354 nlpFileOp.pFrom = pTempFrom; 354 355 // single copy never with FOF_MULTIDESTFILES, I can use lpFileOp->pTo as nlpFileOp.pTo, 355 // I need no different targetarea for the name 356 // I need no different targetarea for the name 356 357 nlpFileOp.fFlags = (nlpFileOp.fFlags & (-1 - (FOF_MULTIDESTFILES))); 357 358 … … 399 400 } /* endif */ 400 401 } else { 401 // Multi Target 402 // Multi Target 402 403 if (!Multi || !(pFrom[lenFrom+1]=='\0') || 403 404 // only target+\, target without \ has 0x402 … … 492 493 break; 493 494 #else 494 while(1) {495 if(!pFrom[0]) break;496 if(!pTo[0]) break;497 TRACE(" From='%s' To='%s'\n", pFrom, pTo);495 while(1) { 496 if(!pFrom[0]) break; 497 if(!pTo[0]) break; 498 TRACE(" From='%s' To='%s'\n", pFrom, pTo); 498 499 499 500 pTempTo = HeapAlloc(GetProcessHeap(), 0, strlen(pTo)+1); … … 508 509 CopyFileA(pFrom, pTo, FALSE); 509 510 510 pFrom += strlen(pFrom) + 1;511 pTo += strlen(pTo) + 1;512 }513 TRACE("Setting AnyOpsAborted=FALSE\n");514 lpFileOp->fAnyOperationsAborted=FALSE;515 return 0;516 #endif 517 518 case FO_DELETE:519 TRACE("File Delete:\n");511 pFrom += strlen(pFrom) + 1; 512 pTo += strlen(pTo) + 1; 513 } 514 TRACE("Setting AnyOpsAborted=FALSE\n"); 515 lpFileOp->fAnyOperationsAborted=FALSE; 516 return 0; 517 #endif 518 519 case FO_DELETE: 520 TRACE("File Delete:\n"); 520 521 #ifdef __WIN32OS2__ 521 522 // need break at error before change sourcepointer … … 587 588 nlpFileOp.pFrom = pTempFrom; 588 589 // single copy never with FOF_MULTIDESTFILES, I can use lpFileOp->pTo as nlpFileOp.pTo, 589 // I need no different targetarea for the name 590 // I need no different targetarea for the name 590 591 nlpFileOp.fFlags = (nlpFileOp.fFlags & (-1 - (FOF_MULTIDESTFILES))); 591 592 … … 614 615 } 615 616 break; 616 case FO_MOVE:617 TRACE("File\\Tree Move: simply (Copy/Delete)\n");617 case FO_MOVE: 618 TRACE("File\\Tree Move: simply (Copy/Delete)\n"); 618 619 nlpFileOp.wFunc = FO_COPY; 619 620 // not delete at error from copy … … 633 634 TempretCode = SHFileOperationA (&nlpFileOp); 634 635 635 case 0:636 case 0: 636 637 break; 637 638 #else 638 while(1) {639 if(!pFrom[0]) break;640 TRACE(" File='%s'\n", pFrom);641 DeleteFileA(pFrom);642 pFrom += strlen(pFrom) + 1;643 }644 TRACE("Setting AnyOpsAborted=FALSE\n");645 lpFileOp->fAnyOperationsAborted=FALSE;646 return 0;647 #endif 648 649 default:650 #ifdef __WIN32OS2__ 651 FIXME(__FUNCTION__" Unhandled shell file operation %d stub\n", lpFileOp->wFunc);639 while(1) { 640 if(!pFrom[0]) break; 641 TRACE(" File='%s'\n", pFrom); 642 DeleteFileA(pFrom); 643 pFrom += strlen(pFrom) + 1; 644 } 645 TRACE("Setting AnyOpsAborted=FALSE\n"); 646 lpFileOp->fAnyOperationsAborted=FALSE; 647 return 0; 648 #endif 649 650 default: 651 #ifdef __WIN32OS2__ 652 FIXME(__FUNCTION__" Unhandled shell file operation %d stub\n", lpFileOp->wFunc); 652 653 #else 653 FIXME("Unhandled shell file operation %d\n", lpFileOp->wFunc);654 }655 #endif 656 return 1;657 658 #ifdef __WIN32OS2__ 659 }654 FIXME("Unhandled shell file operation %d\n", lpFileOp->wFunc); 655 } 656 #endif 657 return 1; 658 659 #ifdef __WIN32OS2__ 660 } 660 661 if (pTempFrom) HeapFree(GetProcessHeap(), 0, pTempFrom); 661 662 … … 675 676 } /* endif */ 676 677 TRACE(__FUNCTION__" Setting AnyOpsAborted=FALSE\n"); 677 return 0; 678 return 0; 678 679 679 680 #endif … … 681 682 682 683 /************************************************************************* 683 * SHFileOperationW [SHELL32.244]684 * SHFileOperationW [SHELL32.244] 684 685 * 685 686 * NOTES 686 687 * exported by name 687 688 */ 688 DWORD WINAPI SHFileOperationW (LPSHFILEOPSTRUCTW lpFileOp) 689 { 690 #ifdef __WIN32OS2__ 691 FIXME(__FUNCTION__"(%p) ,stub\n", lpFileOp);689 DWORD WINAPI SHFileOperationW (LPSHFILEOPSTRUCTW lpFileOp) 690 { 691 #ifdef __WIN32OS2__ 692 FIXME(__FUNCTION__"(%p) ,stub\n", lpFileOp); 692 693 #else 693 FIXME("(%p):stub.\n", lpFileOp);694 #endif 695 return 1;694 FIXME("(%p):stub.\n", lpFileOp); 695 #endif 696 return 1; 696 697 } 697 698 698 699 /************************************************************************* 699 * SHFileOperation [SHELL32.242]700 * SHFileOperation [SHELL32.242] 700 701 * 701 702 */ 702 703 DWORD WINAPI SHFileOperationAW(LPVOID lpFileOp) 703 704 { 704 if (SHELL_OsIsUnicode())705 return SHFileOperationW(lpFileOp);706 return SHFileOperationA(lpFileOp);705 if (SHELL_OsIsUnicode()) 706 return SHFileOperationW(lpFileOp); 707 return SHFileOperationA(lpFileOp); 707 708 } 708 709 … … 713 714 HRESULT WINAPI SheGetDirW(LPWSTR u, LPWSTR v) 714 715 #ifdef __WIN32OS2__ 715 { FIXME(__FUNCTION__"(%p, %p) ,stub\n",u,v);716 { FIXME(__FUNCTION__"(%p, %p) ,stub\n",u,v); 716 717 #else 717 { FIXME("%p %p stub\n",u,v);718 #endif 719 return 0;718 { FIXME("%p %p stub\n",u,v); 719 #endif 720 return 0; 720 721 } 721 722 … … 726 727 HRESULT WINAPI SheChangeDirW(LPWSTR u) 727 728 #ifdef __WIN32OS2__ 728 { FIXME(__FUNCTION__"(%s),stub\n",debugstr_w(u));729 { FIXME(__FUNCTION__"(%s),stub\n",debugstr_w(u)); 729 730 #else 730 { FIXME("(%s),stub\n",debugstr_w(u));731 #endif 732 return 0;731 { FIXME("(%s),stub\n",debugstr_w(u)); 732 #endif 733 return 0; 733 734 } 734 735 735 736 /************************************************************************* 736 * IsNetDrive [SHELL32.66]737 * IsNetDrive [SHELL32.66] 737 738 */ 738 739 BOOL WINAPI IsNetDrive(DWORD drive) 739 740 { 740 char root[4];741 strcpy(root, "A:\\");742 root[0] += drive;743 return (GetDriveTypeA(root) == DRIVE_REMOTE);744 } 745 746 741 char root[4]; 742 strcpy(root, "A:\\"); 743 root[0] += drive; 744 return (GetDriveTypeA(root) == DRIVE_REMOTE); 745 } 746 747 -
trunk/src/shell32/shlfolder.c
r5618 r6650 1 /* $Id: shlfolder.c,v 1.3 2001-09-05 13:46:59 bird Exp $ */ 1 2 /* 2 * Shell Folder stuff3 * Shell Folder stuff 3 4 * 4 * Copyright 1997Marcus Meissner5 * Copyright 1998, 1999Juergen Schmied6 * 7 * IShellFolder2 and related interfaces5 * Copyright 1997 Marcus Meissner 6 * Copyright 1998, 1999 Juergen Schmied 7 * 8 * IShellFolder2 and related interfaces 8 9 * 9 10 */ 10 11 #ifdef __WIN32OS2__ 11 12 #define WINE_LARGE_INTEGER 12 #define snprintf(a,b,c,d) sprintf(a,c,d)13 #define snprintf(a,b,c,d) sprintf(a,c,d) 13 14 #endif 14 15 #include <stdlib.h> … … 50 51 typedef struct 51 52 { 52 intcolnameid;53 intpcsFlags;54 intfmt;55 intcxChar;56 53 int colnameid; 54 int pcsFlags; 55 int fmt; 56 int cxChar; 57 57 58 } shvheader; 58 59 … … 72 73 73 74 static LPCWSTR GetNextElementW(LPCWSTR pszNext,LPWSTR pszOut,DWORD dwOut) 74 { LPCWSTR pszTail = pszNext;75 DWORD dwCopy;76 TRACE("(%s %p 0x%08lx)\n",debugstr_w(pszNext),pszOut,dwOut);77 78 *pszOut=0x0000;79 80 if(!pszNext || !*pszNext)81 return NULL;82 83 while(*pszTail && (*pszTail != (WCHAR)'\\'))84 pszTail++;85 86 dwCopy = (WCHAR*)pszTail - (WCHAR*)pszNext + 1;87 lstrcpynW(pszOut, pszNext, (dwOut<dwCopy)? dwOut : dwCopy);88 89 if(*pszTail)90 pszTail++;91 else92 pszTail = NULL;93 94 TRACE("--(%s %s 0x%08lx %p)\n",debugstr_w(pszNext),debugstr_w(pszOut),dwOut,pszTail);95 return pszTail;75 { LPCWSTR pszTail = pszNext; 76 DWORD dwCopy; 77 TRACE("(%s %p 0x%08lx)\n",debugstr_w(pszNext),pszOut,dwOut); 78 79 *pszOut=0x0000; 80 81 if(!pszNext || !*pszNext) 82 return NULL; 83 84 while(*pszTail && (*pszTail != (WCHAR)'\\')) 85 pszTail++; 86 87 dwCopy = (WCHAR*)pszTail - (WCHAR*)pszNext + 1; 88 lstrcpynW(pszOut, pszNext, (dwOut<dwCopy)? dwOut : dwCopy); 89 90 if(*pszTail) 91 pszTail++; 92 else 93 pszTail = NULL; 94 95 TRACE("--(%s %s 0x%08lx %p)\n",debugstr_w(pszNext),debugstr_w(pszOut),dwOut,pszTail); 96 return pszTail; 96 97 } 97 98 98 99 static HRESULT SHELL32_ParseNextElement( 99 HWND hwndOwner,100 IShellFolder2 * psf,101 LPITEMIDLIST * pidlInOut,102 LPOLESTR szNext,103 DWORD *pEaten,104 DWORD *pdwAttributes)105 { 106 HRESULThr = E_OUTOFMEMORY;107 LPITEMIDLISTpidlOut, pidlTemp = NULL;108 IShellFolder*psfChild;109 110 TRACE("(%p, %p, %s)\n",psf, pidlInOut ? *pidlInOut : NULL, debugstr_w(szNext));111 112 113 /* get the shellfolder for the child pidl and let it analyse further */114 hr = IShellFolder_BindToObject(psf, *pidlInOut, NULL, &IID_IShellFolder, (LPVOID*)&psfChild);115 116 if (psfChild)117 {118 hr = IShellFolder_ParseDisplayName(psfChild, hwndOwner, NULL, szNext, pEaten, &pidlOut, pdwAttributes);119 IShellFolder_Release(psfChild);120 121 pidlTemp = ILCombine(*pidlInOut, pidlOut);122 123 if (pidlOut) 124 ILFree(pidlOut);125 }126 127 ILFree(*pidlInOut);128 *pidlInOut = pidlTemp;129 130 TRACE("-- pidl=%p ret=0x%08lx\n", pidlInOut? *pidlInOut: NULL, hr);131 return hr; 100 HWND hwndOwner, 101 IShellFolder2 * psf, 102 LPITEMIDLIST * pidlInOut, 103 LPOLESTR szNext, 104 DWORD *pEaten, 105 DWORD *pdwAttributes) 106 { 107 HRESULT hr = E_OUTOFMEMORY; 108 LPITEMIDLIST pidlOut, pidlTemp = NULL; 109 IShellFolder *psfChild; 110 111 TRACE("(%p, %p, %s)\n",psf, pidlInOut ? *pidlInOut : NULL, debugstr_w(szNext)); 112 113 114 /* get the shellfolder for the child pidl and let it analyse further */ 115 hr = IShellFolder_BindToObject(psf, *pidlInOut, NULL, &IID_IShellFolder, (LPVOID*)&psfChild); 116 117 if (psfChild) 118 { 119 hr = IShellFolder_ParseDisplayName(psfChild, hwndOwner, NULL, szNext, pEaten, &pidlOut, pdwAttributes); 120 IShellFolder_Release(psfChild); 121 122 pidlTemp = ILCombine(*pidlInOut, pidlOut); 123 124 if (pidlOut) 125 ILFree(pidlOut); 126 } 127 128 ILFree(*pidlInOut); 129 *pidlInOut = pidlTemp; 130 131 TRACE("-- pidl=%p ret=0x%08lx\n", pidlInOut? *pidlInOut: NULL, hr); 132 return hr; 132 133 } 133 134 134 135 /*********************************************************************** 135 * SHELL32_CoCreateInitSF136 * SHELL32_CoCreateInitSF 136 137 * 137 * creates a initialized shell folder138 * creates a initialized shell folder 138 139 */ 139 140 static HRESULT SHELL32_CoCreateInitSF ( 140 LPITEMIDLIST pidlRoot,141 LPITEMIDLIST pidlChild,142 REFCLSID clsid,143 REFIID iid,144 LPVOID * ppvOut)145 { 146 HRESULT hr;147 LPITEMIDLISTabsPidl;148 IShellFolder2*pShellFolder;149 IPersistFolder*pPersistFolder;150 151 TRACE("%p %p\n", pidlRoot, pidlChild);152 153 *ppvOut = NULL;154 155 /* we have to ask first for IPersistFolder, some special folders are expecting this */156 hr = SHCoCreateInstance(NULL, clsid, NULL, &IID_IPersistFolder, (LPVOID*)&pPersistFolder);157 if (SUCCEEDED(hr))158 {159 hr = IPersistFolder_QueryInterface(pPersistFolder, iid, (LPVOID*)&pShellFolder);160 if (SUCCEEDED(hr))161 {162 absPidl = ILCombine (pidlRoot, pidlChild);163 hr = IPersistFolder_Initialize(pPersistFolder, absPidl);164 IPersistFolder_Release(pPersistFolder);165 SHFree(absPidl);166 *ppvOut = pShellFolder;167 }168 }169 170 TRACE("-- ret=0x%08lx\n", hr);171 return hr;141 LPITEMIDLIST pidlRoot, 142 LPITEMIDLIST pidlChild, 143 REFCLSID clsid, 144 REFIID iid, 145 LPVOID * ppvOut) 146 { 147 HRESULT hr; 148 LPITEMIDLIST absPidl; 149 IShellFolder2 *pShellFolder; 150 IPersistFolder *pPersistFolder; 151 152 TRACE("%p %p\n", pidlRoot, pidlChild); 153 154 *ppvOut = NULL; 155 156 /* we have to ask first for IPersistFolder, some special folders are expecting this */ 157 hr = SHCoCreateInstance(NULL, clsid, NULL, &IID_IPersistFolder, (LPVOID*)&pPersistFolder); 158 if (SUCCEEDED(hr)) 159 { 160 hr = IPersistFolder_QueryInterface(pPersistFolder, iid, (LPVOID*)&pShellFolder); 161 if (SUCCEEDED(hr)) 162 { 163 absPidl = ILCombine (pidlRoot, pidlChild); 164 hr = IPersistFolder_Initialize(pPersistFolder, absPidl); 165 IPersistFolder_Release(pPersistFolder); 166 SHFree(absPidl); 167 *ppvOut = pShellFolder; 168 } 169 } 170 171 TRACE("-- ret=0x%08lx\n", hr); 172 return hr; 172 173 } 173 174 174 175 static HRESULT SHELL32_GetDisplayNameOfChild( 175 IShellFolder2 * psf,176 LPCITEMIDLIST pidl,177 DWORD dwFlags,178 LPSTR szOut,179 DWORD dwOutLen)180 { 181 LPITEMIDLISTpidlFirst, pidlNext;182 IShellFolder2 *psfChild;183 HRESULThr = E_OUTOFMEMORY;184 STRRET strTemp;185 186 TRACE("(%p)->(pidl=%p 0x%08lx %p 0x%08lx)\n",psf,pidl,dwFlags,szOut, dwOutLen);187 pdump(pidl);188 189 if ((pidlFirst = ILCloneFirst(pidl)))190 { 191 hr = IShellFolder_BindToObject(psf, pidlFirst, NULL, &IID_IShellFolder, (LPVOID*)&psfChild);192 if (SUCCEEDED(hr))193 {194 pidlNext = ILGetNext(pidl);195 196 hr = IShellFolder_GetDisplayNameOf(psfChild, pidlNext, dwFlags | SHGDN_INFOLDER, &strTemp);197 if (SUCCEEDED(hr))198 {199 hr = StrRetToStrNA(szOut, dwOutLen, &strTemp, pidlNext);200 }201 202 IShellFolder_Release(psfChild);203 }204 ILFree(pidlFirst);205 }206 207 TRACE("-- ret=0x%08lx %s\n", hr, szOut);208 209 return hr;176 IShellFolder2 * psf, 177 LPCITEMIDLIST pidl, 178 DWORD dwFlags, 179 LPSTR szOut, 180 DWORD dwOutLen) 181 { 182 LPITEMIDLIST pidlFirst, pidlNext; 183 IShellFolder2 * psfChild; 184 HRESULT hr = E_OUTOFMEMORY; 185 STRRET strTemp; 186 187 TRACE("(%p)->(pidl=%p 0x%08lx %p 0x%08lx)\n",psf,pidl,dwFlags,szOut, dwOutLen); 188 pdump(pidl); 189 190 if ((pidlFirst = ILCloneFirst(pidl))) 191 { 192 hr = IShellFolder_BindToObject(psf, pidlFirst, NULL, &IID_IShellFolder, (LPVOID*)&psfChild); 193 if (SUCCEEDED(hr)) 194 { 195 pidlNext = ILGetNext(pidl); 196 197 hr = IShellFolder_GetDisplayNameOf(psfChild, pidlNext, dwFlags | SHGDN_INFOLDER, &strTemp); 198 if (SUCCEEDED(hr)) 199 { 200 hr = StrRetToStrNA(szOut, dwOutLen, &strTemp, pidlNext); 201 } 202 203 IShellFolder_Release(psfChild); 204 } 205 ILFree(pidlFirst); 206 } 207 208 TRACE("-- ret=0x%08lx %s\n", hr, szOut); 209 210 return hr; 210 211 } 211 212 … … 215 216 * NOTES 216 217 * observerd values: 217 * folder: 0xE0000177FILESYSTEM | HASSUBFOLDER | FOLDER218 * file: 0x40000177FILESYSTEM219 * drive: 0xf0000144FILESYSTEM | HASSUBFOLDER | FOLDER | FILESYSANCESTOR220 * mycomputer: 0xb0000154HASSUBFOLDER | FOLDER | FILESYSANCESTOR218 * folder: 0xE0000177 FILESYSTEM | HASSUBFOLDER | FOLDER 219 * file: 0x40000177 FILESYSTEM 220 * drive: 0xf0000144 FILESYSTEM | HASSUBFOLDER | FOLDER | FILESYSANCESTOR 221 * mycomputer: 0xb0000154 HASSUBFOLDER | FOLDER | FILESYSANCESTOR 221 222 * (seems to be default for shell extensions if no registry entry exists) 222 223 * … … 224 225 */ 225 226 static HRESULT SHELL32_GetItemAttributes( 226 IShellFolder * psf,227 LPITEMIDLIST pidl,228 LPDWORD pdwAttributes)227 IShellFolder * psf, 228 LPITEMIDLIST pidl, 229 LPDWORD pdwAttributes) 229 230 { 230 231 GUID const * clsid; 231 DWORD dwAttributes;232 233 TRACE("0x%08lx\n", *pdwAttributes);234 235 if (*pdwAttributes & (0xcff3fe88))236 WARN("attribute 0x%08lx not implemented\n", *pdwAttributes);237 *pdwAttributes &= ~SFGAO_LINK; /* FIXME: for native filedialogs */238 239 if (_ILIsDrive(pidl))240 {241 *pdwAttributes &= 0xf0000144;242 }243 else if ((clsid=_ILGetGUIDPointer(pidl)))244 {245 if (HCR_GetFolderAttributes(clsid, &dwAttributes))246 {247 *pdwAttributes &= dwAttributes;248 }249 else250 {251 *pdwAttributes &= 0xb0000154;252 } 253 }254 else if (_ILGetDataPointer(pidl))255 {256 dwAttributes = _ILGetFileAttributes(pidl, NULL, 0);257 *pdwAttributes &= ~SFGAO_FILESYSANCESTOR;258 259 if(( SFGAO_FOLDER & *pdwAttributes) && !(dwAttributes & FILE_ATTRIBUTE_DIRECTORY))260 *pdwAttributes &= ~(SFGAO_FOLDER|SFGAO_HASSUBFOLDER);261 262 if(( SFGAO_HIDDEN & *pdwAttributes) && !(dwAttributes & FILE_ATTRIBUTE_HIDDEN))263 *pdwAttributes &= ~SFGAO_HIDDEN;264 265 if(( SFGAO_READONLY & *pdwAttributes) && !(dwAttributes & FILE_ATTRIBUTE_READONLY))266 *pdwAttributes &= ~SFGAO_READONLY;267 }268 else269 {270 *pdwAttributes &= 0xb0000154;271 }272 TRACE("-- 0x%08lx\n", *pdwAttributes);273 return S_OK;232 DWORD dwAttributes; 233 234 TRACE("0x%08lx\n", *pdwAttributes); 235 236 if (*pdwAttributes & (0xcff3fe88)) 237 WARN("attribute 0x%08lx not implemented\n", *pdwAttributes); 238 *pdwAttributes &= ~SFGAO_LINK; /* FIXME: for native filedialogs */ 239 240 if (_ILIsDrive(pidl)) 241 { 242 *pdwAttributes &= 0xf0000144; 243 } 244 else if ((clsid=_ILGetGUIDPointer(pidl))) 245 { 246 if (HCR_GetFolderAttributes(clsid, &dwAttributes)) 247 { 248 *pdwAttributes &= dwAttributes; 249 } 250 else 251 { 252 *pdwAttributes &= 0xb0000154; 253 } 254 } 255 else if (_ILGetDataPointer(pidl)) 256 { 257 dwAttributes = _ILGetFileAttributes(pidl, NULL, 0); 258 *pdwAttributes &= ~SFGAO_FILESYSANCESTOR; 259 260 if(( SFGAO_FOLDER & *pdwAttributes) && !(dwAttributes & FILE_ATTRIBUTE_DIRECTORY)) 261 *pdwAttributes &= ~(SFGAO_FOLDER|SFGAO_HASSUBFOLDER); 262 263 if(( SFGAO_HIDDEN & *pdwAttributes) && !(dwAttributes & FILE_ATTRIBUTE_HIDDEN)) 264 *pdwAttributes &= ~SFGAO_HIDDEN; 265 266 if(( SFGAO_READONLY & *pdwAttributes) && !(dwAttributes & FILE_ATTRIBUTE_READONLY)) 267 *pdwAttributes &= ~SFGAO_READONLY; 268 } 269 else 270 { 271 *pdwAttributes &= 0xb0000154; 272 } 273 TRACE("-- 0x%08lx\n", *pdwAttributes); 274 return S_OK; 274 275 } 275 276 … … 278 279 */ 279 280 280 typedef struct 281 { 282 ICOM_VFIELD(IUnknown);283 DWORDref;284 ICOM_VTABLE(IShellFolder2)*lpvtblShellFolder;285 ICOM_VTABLE(IPersistFolder2)*lpvtblPersistFolder2;286 ICOM_VTABLE(IDropTarget)*lpvtblDropTarget;287 ICOM_VTABLE(ISFHelper)*lpvtblSFHelper;288 289 IUnknown *pUnkOuter;/* used for aggregation */290 291 CLSID*pclsid;292 293 LPSTRsMyPath;294 LPITEMIDLIST absPidl;/* complete pidl */295 296 UINT cfShellIDList;/* clipboardformat for IDropTarget */297 BOOL fAcceptFmt;/* flag for pending Drop */281 typedef struct 282 { 283 ICOM_VFIELD(IUnknown); 284 DWORD ref; 285 ICOM_VTABLE(IShellFolder2)* lpvtblShellFolder; 286 ICOM_VTABLE(IPersistFolder2)* lpvtblPersistFolder2; 287 ICOM_VTABLE(IDropTarget)* lpvtblDropTarget; 288 ICOM_VTABLE(ISFHelper)* lpvtblSFHelper; 289 290 IUnknown *pUnkOuter; /* used for aggregation */ 291 292 CLSID* pclsid; 293 294 LPSTR sMyPath; 295 LPITEMIDLIST absPidl; /* complete pidl */ 296 297 UINT cfShellIDList; /* clipboardformat for IDropTarget */ 298 BOOL fAcceptFmt; /* flag for pending Drop */ 298 299 } IGenericSFImpl; 299 300 … … 306 307 static IShellFolder * ISF_MyComputer_Constructor(void); 307 308 308 #define _IShellFolder2_Offset ((int)(&(((IGenericSFImpl*)0)->lpvtblShellFolder))) 309 #define _ICOM_THIS_From_IShellFolder2(class, name) class* This = (class*)(((char*)name)-_IShellFolder2_Offset); 310 311 #define _IPersistFolder_Offset ((int)(&(((IGenericSFImpl*)0)->lpvtblPersistFolder2))) 312 #define _ICOM_THIS_From_IPersistFolder2(class, name) class* This = (class*)(((char*)name)-_IPersistFolder_Offset); 313 314 #define _IDropTarget_Offset ((int)(&(((IGenericSFImpl*)0)->lpvtblDropTarget))) 315 #define _ICOM_THIS_From_IDropTarget(class, name) class* This = (class*)(((char*)name)-_IDropTarget_Offset); 316 317 #define _ISFHelper_Offset ((int)(&(((IGenericSFImpl*)0)->lpvtblSFHelper))) 318 #define _ICOM_THIS_From_ISFHelper(class, name) class* This = (class*)(((char*)name)-_ISFHelper_Offset); 309 #define _IShellFolder2_Offset ((int)(&(((IGenericSFImpl*)0)->lpvtblShellFolder))) 310 #define _ICOM_THIS_From_IShellFolder2(class, name) class* This = (class*)(((char*)name)-_IShellFolder2_Offset); 311 312 #define _IPersistFolder_Offset ((int)(&(((IGenericSFImpl*)0)->lpvtblPersistFolder2))) 313 #define _ICOM_THIS_From_IPersistFolder2(class, name) class* This = (class*)(((char*)name)-_IPersistFolder_Offset); 314 315 #define _IDropTarget_Offset ((int)(&(((IGenericSFImpl*)0)->lpvtblDropTarget))) 316 #define _ICOM_THIS_From_IDropTarget(class, name) class* This = (class*)(((char*)name)-_IDropTarget_Offset); 317 318 #define _ISFHelper_Offset ((int)(&(((IGenericSFImpl*)0)->lpvtblSFHelper))) 319 #define _ICOM_THIS_From_ISFHelper(class, name) class* This = (class*)(((char*)name)-_ISFHelper_Offset); 319 320 /* 320 321 converts This to a interface pointer 321 322 */ 322 #define _IUnknown_(This) (IUnknown*)&(This->lpVtbl)323 #define _IShellFolder_(This) (IShellFolder*)&(This->lpvtblShellFolder)324 #define _IShellFolder2_(This) (IShellFolder2*)&(This->lpvtblShellFolder)325 #define _IPersist_(This) (IPersist*)&(This->lpvtblPersistFolder2)326 #define _IPersistFolder_(This) (IPersistFolder*)&(This->lpvtblPersistFolder2)327 #define _IPersistFolder2_(This) (IPersistFolder2*)&(This->lpvtblPersistFolder2)328 #define _IDropTarget_(This) (IDropTarget*)&(This->lpvtblDropTarget)329 #define _ISFHelper_(This) (ISFHelper*)&(This->lpvtblSFHelper)330 /************************************************************************** 331 * registers clipboardformat once323 #define _IUnknown_(This) (IUnknown*)&(This->lpVtbl) 324 #define _IShellFolder_(This) (IShellFolder*)&(This->lpvtblShellFolder) 325 #define _IShellFolder2_(This) (IShellFolder2*)&(This->lpvtblShellFolder) 326 #define _IPersist_(This) (IPersist*)&(This->lpvtblPersistFolder2) 327 #define _IPersistFolder_(This) (IPersistFolder*)&(This->lpvtblPersistFolder2) 328 #define _IPersistFolder2_(This) (IPersistFolder2*)&(This->lpvtblPersistFolder2) 329 #define _IDropTarget_(This) (IDropTarget*)&(This->lpvtblDropTarget) 330 #define _ISFHelper_(This) (ISFHelper*)&(This->lpvtblSFHelper) 331 /************************************************************************** 332 * registers clipboardformat once 332 333 */ 333 334 static void SF_RegisterClipFmt (IGenericSFImpl * This) 334 335 { 335 TRACE("(%p)\n", This);336 337 if (!This->cfShellIDList)338 {339 This->cfShellIDList = RegisterClipboardFormatA(CFSTR_SHELLIDLIST);340 }341 } 342 343 /************************************************************************** 344 * we need a separate IUnknown to handle aggregation345 * (inner IUnknown)336 TRACE("(%p)\n", This); 337 338 if (!This->cfShellIDList) 339 { 340 This->cfShellIDList = RegisterClipboardFormatA(CFSTR_SHELLIDLIST); 341 } 342 } 343 344 /************************************************************************** 345 * we need a separate IUnknown to handle aggregation 346 * (inner IUnknown) 346 347 */ 347 348 static HRESULT WINAPI IUnknown_fnQueryInterface( 348 IUnknown * iface,349 REFIID riid,350 LPVOID *ppvObj)351 { 352 ICOM_THIS(IGenericSFImpl, iface);353 354 _CALL_TRACE355 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj);356 357 *ppvObj = NULL;358 359 if(IsEqualIID(riid, &IID_IUnknown)) *ppvObj = _IUnknown_(This); 360 else if(IsEqualIID(riid, &IID_IShellFolder))*ppvObj = _IShellFolder_(This);361 else if(IsEqualIID(riid, &IID_IShellFolder2))*ppvObj = _IShellFolder_(This);362 else if(IsEqualIID(riid, &IID_IPersist))*ppvObj = _IPersist_(This);363 else if(IsEqualIID(riid, &IID_IPersistFolder))*ppvObj = _IPersistFolder_(This);364 else if(IsEqualIID(riid, &IID_IPersistFolder2))*ppvObj = _IPersistFolder2_(This);365 else if(IsEqualIID(riid, &IID_ISFHelper))*ppvObj = _ISFHelper_(This);366 else if(IsEqualIID(riid, &IID_IDropTarget))367 {368 *ppvObj = _IDropTarget_(This);369 SF_RegisterClipFmt(This);370 }371 372 if(*ppvObj)373 {374 IUnknown_AddRef((IUnknown*)(*ppvObj));375 TRACE("-- Interface = %p\n", *ppvObj);376 return S_OK;377 }378 TRACE("-- Interface: E_NOINTERFACE\n");379 return E_NOINTERFACE;349 IUnknown * iface, 350 REFIID riid, 351 LPVOID *ppvObj) 352 { 353 ICOM_THIS(IGenericSFImpl, iface); 354 355 _CALL_TRACE 356 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj); 357 358 *ppvObj = NULL; 359 360 if(IsEqualIID(riid, &IID_IUnknown)) *ppvObj = _IUnknown_(This); 361 else if(IsEqualIID(riid, &IID_IShellFolder)) *ppvObj = _IShellFolder_(This); 362 else if(IsEqualIID(riid, &IID_IShellFolder2)) *ppvObj = _IShellFolder_(This); 363 else if(IsEqualIID(riid, &IID_IPersist)) *ppvObj = _IPersist_(This); 364 else if(IsEqualIID(riid, &IID_IPersistFolder)) *ppvObj = _IPersistFolder_(This); 365 else if(IsEqualIID(riid, &IID_IPersistFolder2)) *ppvObj = _IPersistFolder2_(This); 366 else if(IsEqualIID(riid, &IID_ISFHelper)) *ppvObj = _ISFHelper_(This); 367 else if(IsEqualIID(riid, &IID_IDropTarget)) 368 { 369 *ppvObj = _IDropTarget_(This); 370 SF_RegisterClipFmt(This); 371 } 372 373 if(*ppvObj) 374 { 375 IUnknown_AddRef((IUnknown*)(*ppvObj)); 376 TRACE("-- Interface = %p\n", *ppvObj); 377 return S_OK; 378 } 379 TRACE("-- Interface: E_NOINTERFACE\n"); 380 return E_NOINTERFACE; 380 381 } 381 382 382 383 static ULONG WINAPI IUnknown_fnAddRef(IUnknown * iface) 383 384 { 384 ICOM_THIS(IGenericSFImpl, iface);385 386 _CALL_TRACE387 TRACE("(%p)->(count=%lu)\n",This,This->ref);388 389 shell32_ObjCount++;390 return ++(This->ref);391 } 392 393 static ULONG WINAPI IUnknown_fnRelease(IUnknown * iface) 394 { 395 ICOM_THIS(IGenericSFImpl, iface);396 397 _CALL_TRACE398 TRACE("(%p)->(count=%lu)\n",This,This->ref);399 400 shell32_ObjCount--;401 if (!--(This->ref)) 402 {403 TRACE("-- destroying IShellFolder(%p)\n",This);404 405 if (pdesktopfolder == _IShellFolder_(This))406 {407 pdesktopfolder=NULL;408 TRACE("-- destroyed IShellFolder(%p) was Desktopfolder\n",This);409 }410 if(This->absPidl) SHFree(This->absPidl);411 if(This->sMyPath) SHFree(This->sMyPath);412 HeapFree(GetProcessHeap(),0,This);413 return 0;414 }415 return This->ref;416 } 417 418 static ICOM_VTABLE(IUnknown) unkvt = 419 { 420 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE421 IUnknown_fnQueryInterface,422 IUnknown_fnAddRef,423 IUnknown_fnRelease,385 ICOM_THIS(IGenericSFImpl, iface); 386 387 _CALL_TRACE 388 TRACE("(%p)->(count=%lu)\n",This,This->ref); 389 390 shell32_ObjCount++; 391 return ++(This->ref); 392 } 393 394 static ULONG WINAPI IUnknown_fnRelease(IUnknown * iface) 395 { 396 ICOM_THIS(IGenericSFImpl, iface); 397 398 _CALL_TRACE 399 TRACE("(%p)->(count=%lu)\n",This,This->ref); 400 401 shell32_ObjCount--; 402 if (!--(This->ref)) 403 { 404 TRACE("-- destroying IShellFolder(%p)\n",This); 405 406 if (pdesktopfolder == _IShellFolder_(This)) 407 { 408 pdesktopfolder=NULL; 409 TRACE("-- destroyed IShellFolder(%p) was Desktopfolder\n",This); 410 } 411 if(This->absPidl) SHFree(This->absPidl); 412 if(This->sMyPath) SHFree(This->sMyPath); 413 HeapFree(GetProcessHeap(),0,This); 414 return 0; 415 } 416 return This->ref; 417 } 418 419 static ICOM_VTABLE(IUnknown) unkvt = 420 { 421 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 422 IUnknown_fnQueryInterface, 423 IUnknown_fnAddRef, 424 IUnknown_fnRelease, 424 425 }; 425 426 … … 435 436 436 437 /************************************************************************** 437 * IShellFolder_Constructor438 * IShellFolder_Constructor 438 439 * 439 440 * NOTES … … 442 443 * 443 444 * FIXME 444 * when pUnkOuter = 0 then rrid = IID_IShellFolder is returned445 * when pUnkOuter = 0 then rrid = IID_IShellFolder is returned 445 446 */ 446 447 HRESULT IFSFolder_Constructor( 447 IUnknown * pUnkOuter,448 REFIID riid,449 LPVOID * ppv)450 { 451 IGenericSFImpl *sf;452 HRESULT hr = S_OK;453 454 TRACE("unkOut=%p riid=%s\n",pUnkOuter, debugstr_guid(riid));455 456 if(pUnkOuter && ! IsEqualIID(riid, &IID_IUnknown))457 {458 hr = CLASS_E_NOAGGREGATION;/* forbidden by definition */459 }460 else461 {462 sf=(IGenericSFImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IGenericSFImpl));463 if (sf)464 {465 sf->ref=1;466 ICOM_VTBL(sf)=&unkvt;467 sf->lpvtblShellFolder=&sfvt;468 sf->lpvtblPersistFolder2=&psfvt;469 sf->lpvtblDropTarget=&dtvt;470 sf->lpvtblSFHelper=&shvt;471 472 sf->pclsid = (CLSID*)&CLSID_SFFile;473 sf->pUnkOuter = pUnkOuter ? pUnkOuter : _IUnknown_(sf);474 *ppv = _IUnknown_(sf);475 hr = S_OK;476 shell32_ObjCount++;477 }478 else479 {480 hr = E_OUTOFMEMORY;481 }482 }483 return hr;484 } 485 /************************************************************************** 486 * IShellFolder_Constructor448 IUnknown * pUnkOuter, 449 REFIID riid, 450 LPVOID * ppv) 451 { 452 IGenericSFImpl * sf; 453 HRESULT hr = S_OK; 454 455 TRACE("unkOut=%p riid=%s\n",pUnkOuter, debugstr_guid(riid)); 456 457 if(pUnkOuter && ! IsEqualIID(riid, &IID_IUnknown)) 458 { 459 hr = CLASS_E_NOAGGREGATION; /* forbidden by definition */ 460 } 461 else 462 { 463 sf=(IGenericSFImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IGenericSFImpl)); 464 if (sf) 465 { 466 sf->ref=1; 467 ICOM_VTBL(sf)=&unkvt; 468 sf->lpvtblShellFolder=&sfvt; 469 sf->lpvtblPersistFolder2=&psfvt; 470 sf->lpvtblDropTarget=&dtvt; 471 sf->lpvtblSFHelper=&shvt; 472 473 sf->pclsid = (CLSID*)&CLSID_SFFile; 474 sf->pUnkOuter = pUnkOuter ? pUnkOuter : _IUnknown_(sf); 475 *ppv = _IUnknown_(sf); 476 hr = S_OK; 477 shell32_ObjCount++; 478 } 479 else 480 { 481 hr = E_OUTOFMEMORY; 482 } 483 } 484 return hr; 485 } 486 /************************************************************************** 487 * IShellFolder_Constructor 487 488 * 488 489 * NOTES 489 * THIS points to the parent folder490 * THIS points to the parent folder 490 491 */ 491 492 492 493 IShellFolder * IShellFolder_Constructor( 493 IShellFolder2 * iface,494 LPITEMIDLIST pidl)495 { 496 IGenericSFImpl *sf;497 DWORDdwSize=0;498 499 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)500 501 sf=(IGenericSFImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IGenericSFImpl));502 sf->ref=1;503 504 ICOM_VTBL(sf)=&unkvt;505 sf->lpvtblShellFolder=&sfvt;506 sf->lpvtblPersistFolder2=&psfvt;507 sf->lpvtblDropTarget=&dtvt;508 sf->lpvtblSFHelper=&shvt;509 510 sf->pclsid = (CLSID*)&CLSID_SFFile;511 sf->pUnkOuter = _IUnknown_(sf);512 513 TRACE("(%p)->(parent=%p, pidl=%p)\n",sf,This, pidl);514 pdump(pidl);515 516 if(pidl && iface)/* do we have a pidl? */517 {518 int len;519 520 sf->absPidl = ILCombine(This->absPidl, pidl);/* build a absolute pidl */521 522 if (!_ILIsSpecialFolder(pidl))/* only file system paths */523 {524 if(This->sMyPath)/* get the size of the parents path */525 {526 dwSize += strlen(This->sMyPath) ;527 TRACE("-- (%p)->(parent's path=%s)\n",sf, debugstr_a(This->sMyPath));528 } 529 530 dwSize += _ILSimpleGetText(pidl,NULL,0);/* add the size of our name*/531 sf->sMyPath = SHAlloc(dwSize + 2);/* '\0' and backslash */532 533 if(!sf->sMyPath) return NULL;534 *(sf->sMyPath)=0x00;535 536 if(This->sMyPath)/* if the parent has a path, get it*/537 {538 strcpy(sf->sMyPath, This->sMyPath);539 PathAddBackslashA (sf->sMyPath);540 }541 542 len = strlen(sf->sMyPath);543 _ILSimpleGetText(pidl, sf->sMyPath + len, dwSize+2 - len);544 }545 546 TRACE("-- (%p)->(my pidl=%p, my path=%s)\n",sf, sf->absPidl,debugstr_a(sf->sMyPath));547 548 pdump (sf->absPidl);549 }550 551 shell32_ObjCount++;552 return _IShellFolder_(sf);494 IShellFolder2 * iface, 495 LPITEMIDLIST pidl) 496 { 497 IGenericSFImpl * sf; 498 DWORD dwSize=0; 499 500 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 501 502 sf=(IGenericSFImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IGenericSFImpl)); 503 sf->ref=1; 504 505 ICOM_VTBL(sf)=&unkvt; 506 sf->lpvtblShellFolder=&sfvt; 507 sf->lpvtblPersistFolder2=&psfvt; 508 sf->lpvtblDropTarget=&dtvt; 509 sf->lpvtblSFHelper=&shvt; 510 511 sf->pclsid = (CLSID*)&CLSID_SFFile; 512 sf->pUnkOuter = _IUnknown_(sf); 513 514 TRACE("(%p)->(parent=%p, pidl=%p)\n",sf,This, pidl); 515 pdump(pidl); 516 517 if(pidl && iface) /* do we have a pidl? */ 518 { 519 int len; 520 521 sf->absPidl = ILCombine(This->absPidl, pidl); /* build a absolute pidl */ 522 523 if (!_ILIsSpecialFolder(pidl)) /* only file system paths */ 524 { 525 if(This->sMyPath) /* get the size of the parents path */ 526 { 527 dwSize += strlen(This->sMyPath) ; 528 TRACE("-- (%p)->(parent's path=%s)\n",sf, debugstr_a(This->sMyPath)); 529 } 530 531 dwSize += _ILSimpleGetText(pidl,NULL,0); /* add the size of our name*/ 532 sf->sMyPath = SHAlloc(dwSize + 2); /* '\0' and backslash */ 533 534 if(!sf->sMyPath) return NULL; 535 *(sf->sMyPath)=0x00; 536 537 if(This->sMyPath) /* if the parent has a path, get it*/ 538 { 539 strcpy(sf->sMyPath, This->sMyPath); 540 PathAddBackslashA (sf->sMyPath); 541 } 542 543 len = strlen(sf->sMyPath); 544 _ILSimpleGetText(pidl, sf->sMyPath + len, dwSize+2 - len); 545 } 546 547 TRACE("-- (%p)->(my pidl=%p, my path=%s)\n",sf, sf->absPidl,debugstr_a(sf->sMyPath)); 548 549 pdump (sf->absPidl); 550 } 551 552 shell32_ObjCount++; 553 return _IShellFolder_(sf); 553 554 } 554 555 … … 557 558 * 558 559 * PARAMETERS 559 * REFIID riid [in ] Requested InterfaceID560 * LPVOID* ppvObject [out] Interface* to hold the result560 * REFIID riid [in ] Requested InterfaceID 561 * LPVOID* ppvObject [out] Interface* to hold the result 561 562 */ 562 563 static HRESULT WINAPI IShellFolder_fnQueryInterface( 563 IShellFolder2 * iface,564 REFIID riid,565 LPVOID *ppvObj)566 { 567 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)568 569 _CALL_TRACE570 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj);571 572 return IUnknown_QueryInterface(This->pUnkOuter, riid, ppvObj);564 IShellFolder2 * iface, 565 REFIID riid, 566 LPVOID *ppvObj) 567 { 568 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 569 570 _CALL_TRACE 571 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj); 572 573 return IUnknown_QueryInterface(This->pUnkOuter, riid, ppvObj); 573 574 } 574 575 … … 579 580 static ULONG WINAPI IShellFolder_fnAddRef(IShellFolder2 * iface) 580 581 { 581 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)582 583 _CALL_TRACE584 TRACE("(%p)->(count=%lu)\n",This,This->ref);585 586 return IUnknown_AddRef(This->pUnkOuter);582 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 583 584 _CALL_TRACE 585 TRACE("(%p)->(count=%lu)\n",This,This->ref); 586 587 return IUnknown_AddRef(This->pUnkOuter); 587 588 } 588 589 … … 590 591 * IShellFolder_fnRelease 591 592 */ 592 static ULONG WINAPI IShellFolder_fnRelease(IShellFolder2 * iface) 593 { 594 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)595 596 _CALL_TRACE597 TRACE("(%p)->(count=%lu)\n",This,This->ref);598 599 return IUnknown_Release(This->pUnkOuter);600 } 601 602 /************************************************************************** 603 * IShellFolder_fnParseDisplayName593 static ULONG WINAPI IShellFolder_fnRelease(IShellFolder2 * iface) 594 { 595 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 596 597 _CALL_TRACE 598 TRACE("(%p)->(count=%lu)\n",This,This->ref); 599 600 return IUnknown_Release(This->pUnkOuter); 601 } 602 603 /************************************************************************** 604 * IShellFolder_fnParseDisplayName 604 605 * PARAMETERS 605 606 * HWND hwndOwner, //[in ] Parent window for any message's … … 611 612 * 612 613 * NOTES 613 * every folder tries to parse only its own (the leftmost) pidl and creates a 614 * every folder tries to parse only its own (the leftmost) pidl and creates a 614 615 * subfolder to evaluate the remaining parts 615 616 * now we can parse into namespaces implemented by shell extensions 616 617 * 617 * behaviour on win98: lpszDisplayName=NULL -> chrash618 * lpszDisplayName="" -> returns mycoputer-pidl618 * behaviour on win98: lpszDisplayName=NULL -> chrash 619 * lpszDisplayName="" -> returns mycoputer-pidl 619 620 * 620 * FIXME: 621 * FIXME: 621 622 * pdwAttributes: not set 622 623 * pchEaten: not set like in windows 623 624 */ 624 625 static HRESULT WINAPI IShellFolder_fnParseDisplayName( 625 IShellFolder2 * iface,626 HWND hwndOwner,627 LPBC pbcReserved,628 LPOLESTR lpszDisplayName,629 DWORD *pchEaten,630 LPITEMIDLIST *ppidl,631 DWORD *pdwAttributes)632 { 633 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)634 635 HRESULThr = E_OUTOFMEMORY;636 LPCWSTRszNext=NULL;637 WCHARszElement[MAX_PATH];638 CHARszTempA[MAX_PATH], szPath[MAX_PATH];639 LPITEMIDLISTpidlTemp=NULL;640 641 TRACE("(%p)->(HWND=0x%08x,%p,%p=%s,%p,pidl=%p,%p)\n",642 This,hwndOwner,pbcReserved,lpszDisplayName,643 debugstr_w(lpszDisplayName),pchEaten,ppidl,pdwAttributes);644 645 if (!lpszDisplayName || !ppidl) return E_INVALIDARG;646 647 if (pchEaten) *pchEaten = 0;/* strange but like the original */648 649 if (*lpszDisplayName)650 { 651 /* get the next element */652 szNext = GetNextElementW(lpszDisplayName, szElement, MAX_PATH);653 654 /* build the full pathname to the element */626 IShellFolder2 * iface, 627 HWND hwndOwner, 628 LPBC pbcReserved, 629 LPOLESTR lpszDisplayName, 630 DWORD *pchEaten, 631 LPITEMIDLIST *ppidl, 632 DWORD *pdwAttributes) 633 { 634 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 635 636 HRESULT hr = E_OUTOFMEMORY; 637 LPCWSTR szNext=NULL; 638 WCHAR szElement[MAX_PATH]; 639 CHAR szTempA[MAX_PATH], szPath[MAX_PATH]; 640 LPITEMIDLIST pidlTemp=NULL; 641 642 TRACE("(%p)->(HWND=0x%08x,%p,%p=%s,%p,pidl=%p,%p)\n", 643 This,hwndOwner,pbcReserved,lpszDisplayName, 644 debugstr_w(lpszDisplayName),pchEaten,ppidl,pdwAttributes); 645 646 if (!lpszDisplayName || !ppidl) return E_INVALIDARG; 647 648 if (pchEaten) *pchEaten = 0; /* strange but like the original */ 649 650 if (*lpszDisplayName) 651 { 652 /* get the next element */ 653 szNext = GetNextElementW(lpszDisplayName, szElement, MAX_PATH); 654 655 /* build the full pathname to the element */ 655 656 WideCharToMultiByte( CP_ACP, 0, szElement, -1, szTempA, MAX_PATH, NULL, NULL ); 656 strcpy(szPath, This->sMyPath);657 PathAddBackslashA(szPath);658 strcat(szPath, szTempA);659 660 /* get the pidl */661 pidlTemp = SHSimpleIDListFromPathA(szPath);662 663 if (pidlTemp)664 {665 /* try to analyse the next element */666 if (szNext && *szNext)667 {668 hr = SHELL32_ParseNextElement(hwndOwner, iface, &pidlTemp, (LPOLESTR)szNext, pchEaten, pdwAttributes);669 }670 else671 {672 if (pdwAttributes && *pdwAttributes)673 {674 SHELL32_GetItemAttributes(_IShellFolder_(This), pidlTemp, pdwAttributes);675 /* WIN32_FIND_DATAA fd;676 SHGetDataFromIDListA(_IShellFolder_(This), pidlTemp, SHGDFIL_FINDDATA, &fd, sizeof(fd));677 if (!(FILE_ATTRIBUTE_DIRECTORY & fd.dwFileAttributes))678 *pdwAttributes &= ~SFGAO_FOLDER;679 if (FILE_ATTRIBUTE_READONLY & fd.dwFileAttributes)680 *pdwAttributes &= ~(SFGAO_CANDELETE|SFGAO_CANMOVE|SFGAO_CANRENAME );681 */ 682 }683 hr = S_OK;684 }685 }686 }657 strcpy(szPath, This->sMyPath); 658 PathAddBackslashA(szPath); 659 strcat(szPath, szTempA); 660 661 /* get the pidl */ 662 pidlTemp = SHSimpleIDListFromPathA(szPath); 663 664 if (pidlTemp) 665 { 666 /* try to analyse the next element */ 667 if (szNext && *szNext) 668 { 669 hr = SHELL32_ParseNextElement(hwndOwner, iface, &pidlTemp, (LPOLESTR)szNext, pchEaten, pdwAttributes); 670 } 671 else 672 { 673 if (pdwAttributes && *pdwAttributes) 674 { 675 SHELL32_GetItemAttributes(_IShellFolder_(This), pidlTemp, pdwAttributes); 676 /* WIN32_FIND_DATAA fd; 677 SHGetDataFromIDListA(_IShellFolder_(This), pidlTemp, SHGDFIL_FINDDATA, &fd, sizeof(fd)); 678 if (!(FILE_ATTRIBUTE_DIRECTORY & fd.dwFileAttributes)) 679 *pdwAttributes &= ~SFGAO_FOLDER; 680 if (FILE_ATTRIBUTE_READONLY & fd.dwFileAttributes) 681 *pdwAttributes &= ~(SFGAO_CANDELETE|SFGAO_CANMOVE|SFGAO_CANRENAME ); 682 */ 683 } 684 hr = S_OK; 685 } 686 } 687 } 687 688 688 689 if (!hr) 689 *ppidl = pidlTemp;690 else691 *ppidl = NULL;692 693 TRACE("(%p)->(-- pidl=%p ret=0x%08lx)\n", This, ppidl? *ppidl:0, hr);694 695 return hr; 696 } 697 698 /************************************************************************** 699 * IShellFolder_fnEnumObjects690 *ppidl = pidlTemp; 691 else 692 *ppidl = NULL; 693 694 TRACE("(%p)->(-- pidl=%p ret=0x%08lx)\n", This, ppidl? *ppidl:0, hr); 695 696 return hr; 697 } 698 699 /************************************************************************** 700 * IShellFolder_fnEnumObjects 700 701 * PARAMETERS 701 702 * HWND hwndOwner, //[in ] Parent Window … … 704 705 */ 705 706 static HRESULT WINAPI IShellFolder_fnEnumObjects( 706 IShellFolder2 * iface,707 HWND hwndOwner,708 DWORD dwFlags,709 LPENUMIDLIST* ppEnumIDList)710 { 711 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)712 713 TRACE("(%p)->(HWND=0x%08x flags=0x%08lx pplist=%p)\n",This,hwndOwner,dwFlags,ppEnumIDList);714 715 *ppEnumIDList = NULL;716 *ppEnumIDList = IEnumIDList_Constructor (This->sMyPath, dwFlags, EIDL_FILE);717 718 TRACE("-- (%p)->(new ID List: %p)\n",This,*ppEnumIDList);719 720 if(!*ppEnumIDList) return E_OUTOFMEMORY;721 722 return S_OK; 723 } 724 725 /************************************************************************** 726 * IShellFolder_fnBindToObject707 IShellFolder2 * iface, 708 HWND hwndOwner, 709 DWORD dwFlags, 710 LPENUMIDLIST* ppEnumIDList) 711 { 712 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 713 714 TRACE("(%p)->(HWND=0x%08x flags=0x%08lx pplist=%p)\n",This,hwndOwner,dwFlags,ppEnumIDList); 715 716 *ppEnumIDList = NULL; 717 *ppEnumIDList = IEnumIDList_Constructor (This->sMyPath, dwFlags, EIDL_FILE); 718 719 TRACE("-- (%p)->(new ID List: %p)\n",This,*ppEnumIDList); 720 721 if(!*ppEnumIDList) return E_OUTOFMEMORY; 722 723 return S_OK; 724 } 725 726 /************************************************************************** 727 * IShellFolder_fnBindToObject 727 728 * PARAMETERS 728 729 * LPCITEMIDLIST pidl, //[in ] relative pidl to open … … 732 733 */ 733 734 static HRESULT WINAPI IShellFolder_fnBindToObject( IShellFolder2 * iface, LPCITEMIDLIST pidl, 734 LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)735 { 736 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)737 GUIDconst * iid;738 IShellFolder*pShellFolder, *pSubFolder;739 IPersistFolder*pPersistFolder;740 LPITEMIDLISTabsPidl;741 742 TRACE("(%p)->(pidl=%p,%p,\n\tIID:\t%s,%p)\n",This,pidl,pbcReserved,debugstr_guid(riid),ppvOut);743 744 if(!pidl || !ppvOut) return E_INVALIDARG;745 746 *ppvOut = NULL;747 748 if ((iid=_ILGetGUIDPointer(pidl)))749 {750 /* we have to create a alien folder */751 if ( SUCCEEDED(SHCoCreateInstance(NULL, iid, NULL, riid, (LPVOID*)&pShellFolder))752 && SUCCEEDED(IShellFolder_QueryInterface(pShellFolder, &IID_IPersistFolder, (LPVOID*)&pPersistFolder)))753 {754 absPidl = ILCombine (This->absPidl, pidl);755 IPersistFolder_Initialize(pPersistFolder, absPidl);756 IPersistFolder_Release(pPersistFolder);757 SHFree(absPidl);758 }759 else760 {761 return E_FAIL;762 }763 }764 else if(_ILIsFolder(pidl))765 {766 LPITEMIDLIST pidltemp = ILCloneFirst(pidl);767 pShellFolder = IShellFolder_Constructor(iface, pidltemp);768 ILFree(pidltemp);769 }770 else771 {772 ERR("can't bind to a file\n");773 return E_FAIL;774 }775 776 if (_ILIsPidlSimple(pidl))777 {778 *ppvOut = pShellFolder;779 }780 else781 {782 IShellFolder_BindToObject(pShellFolder, ILGetNext(pidl), NULL, &IID_IShellFolder, (LPVOID)&pSubFolder);783 IShellFolder_Release(pShellFolder);784 *ppvOut = pSubFolder;785 }786 787 TRACE("-- (%p) returning (%p)\n",This, *ppvOut);788 789 return S_OK;735 LPBC pbcReserved, REFIID riid, LPVOID * ppvOut) 736 { 737 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 738 GUID const * iid; 739 IShellFolder *pShellFolder, *pSubFolder; 740 IPersistFolder *pPersistFolder; 741 LPITEMIDLIST absPidl; 742 743 TRACE("(%p)->(pidl=%p,%p,\n\tIID:\t%s,%p)\n",This,pidl,pbcReserved,debugstr_guid(riid),ppvOut); 744 745 if(!pidl || !ppvOut) return E_INVALIDARG; 746 747 *ppvOut = NULL; 748 749 if ((iid=_ILGetGUIDPointer(pidl))) 750 { 751 /* we have to create a alien folder */ 752 if ( SUCCEEDED(SHCoCreateInstance(NULL, iid, NULL, riid, (LPVOID*)&pShellFolder)) 753 && SUCCEEDED(IShellFolder_QueryInterface(pShellFolder, &IID_IPersistFolder, (LPVOID*)&pPersistFolder))) 754 { 755 absPidl = ILCombine (This->absPidl, pidl); 756 IPersistFolder_Initialize(pPersistFolder, absPidl); 757 IPersistFolder_Release(pPersistFolder); 758 SHFree(absPidl); 759 } 760 else 761 { 762 return E_FAIL; 763 } 764 } 765 else if(_ILIsFolder(pidl)) 766 { 767 LPITEMIDLIST pidltemp = ILCloneFirst(pidl); 768 pShellFolder = IShellFolder_Constructor(iface, pidltemp); 769 ILFree(pidltemp); 770 } 771 else 772 { 773 ERR("can't bind to a file\n"); 774 return E_FAIL; 775 } 776 777 if (_ILIsPidlSimple(pidl)) 778 { 779 *ppvOut = pShellFolder; 780 } 781 else 782 { 783 IShellFolder_BindToObject(pShellFolder, ILGetNext(pidl), NULL, &IID_IShellFolder, (LPVOID)&pSubFolder); 784 IShellFolder_Release(pShellFolder); 785 *ppvOut = pSubFolder; 786 } 787 788 TRACE("-- (%p) returning (%p)\n",This, *ppvOut); 789 790 return S_OK; 790 791 } 791 792 … … 795 796 * LPCITEMIDLIST pidl, //[in ] complex pidl to store 796 797 * LPBC pbc, //[in ] reserved 797 * REFIID riid, //[in ] Initial storage interface 798 * REFIID riid, //[in ] Initial storage interface 798 799 * LPVOID* ppvObject //[out] Interface* returned 799 800 */ 800 801 static HRESULT WINAPI IShellFolder_fnBindToStorage( 801 IShellFolder2 * iface,802 LPCITEMIDLIST pidl,803 LPBC pbcReserved,804 REFIID riid,805 LPVOID *ppvOut)806 { 807 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)808 809 FIXME("(%p)->(pidl=%p,%p,\n\tIID:%s,%p) stub\n",802 IShellFolder2 * iface, 803 LPCITEMIDLIST pidl, 804 LPBC pbcReserved, 805 REFIID riid, 806 LPVOID *ppvOut) 807 { 808 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 809 810 FIXME("(%p)->(pidl=%p,%p,\n\tIID:%s,%p) stub\n", 810 811 This,pidl,pbcReserved,debugstr_guid(riid),ppvOut); 811 812 812 *ppvOut = NULL;813 return E_NOTIMPL;813 *ppvOut = NULL; 814 return E_NOTIMPL; 814 815 } 815 816 … … 826 827 * always make the Path come before the File. 827 828 * 828 * NOTES 829 * NOTES 829 830 * use SCODE_CODE() on the return value to get the result 830 831 */ 831 832 832 833 static HRESULT WINAPI IShellFolder_fnCompareIDs( 833 IShellFolder2 * iface,834 LPARAM lParam,835 LPCITEMIDLIST pidl1,836 LPCITEMIDLIST pidl2)837 { 838 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)839 840 CHAR szTemp1[MAX_PATH];841 CHAR szTemp2[MAX_PATH];842 int nReturn;843 IShellFolder * psf;844 HRESULT hr = E_OUTOFMEMORY;845 LPCITEMIDLIST pidlTemp;846 PIDLTYPE pt1, pt2;847 848 TRACE("(%p)->(0x%08lx,pidl1=%p,pidl2=%p)\n",This,lParam,pidl1,pidl2);849 pdump (pidl1);850 pdump (pidl2);851 852 if (!pidl1 && !pidl2)853 {854 hr = ResultFromShort(0);855 }856 else if (!pidl1)857 {858 hr = ResultFromShort(-1);859 }860 else if (!pidl2)861 {862 hr = ResultFromShort(1);863 }864 else865 {866 LPPIDLDATA pd1, pd2;867 pd1 = _ILGetDataPointer(pidl1);868 pd2 = _ILGetDataPointer(pidl2);869 870 /* compate the types. sort order is the PT_* constant */871 pt1 = ( pd1 ? pd1->type: PT_DESKTOP);872 pt2 = ( pd2 ? pd2->type: PT_DESKTOP);873 874 if (pt1 != pt2)875 {876 hr = ResultFromShort(pt1-pt2);877 }878 else/* same type of pidl */879 {880 _ILSimpleGetText(pidl1, szTemp1, MAX_PATH);881 _ILSimpleGetText(pidl2, szTemp2, MAX_PATH);882 nReturn = strcasecmp(szTemp1, szTemp2);883 884 if (nReturn == 0)/* first pidl different ? */885 {886 pidl1 = ILGetNext(pidl1);887 888 if (pidl1 && pidl1->mkid.cb) /* go deeper? */ 889 {890 pidlTemp = ILCloneFirst(pidl1);891 pidl2 = ILGetNext(pidl2);892 893 hr = IShellFolder_BindToObject(iface, pidlTemp, NULL, &IID_IShellFolder, (LPVOID*)&psf);894 if (SUCCEEDED(hr))895 { 896 nReturn = IShellFolder_CompareIDs(psf, 0, pidl1, pidl2);897 IShellFolder_Release(psf);898 hr = ResultFromShort(nReturn);899 }900 ILFree(pidlTemp);901 }902 else903 {904 hr = ResultFromShort(nReturn);/* two equal simple pidls */905 }906 }907 else908 {909 hr = ResultFromShort(nReturn);/* two different simple pidls */910 }911 }912 }913 914 TRACE("-- res=0x%08lx\n", hr);915 return hr;916 } 917 918 /************************************************************************** 919 * IShellFolder_fnCreateViewObject834 IShellFolder2 * iface, 835 LPARAM lParam, 836 LPCITEMIDLIST pidl1, 837 LPCITEMIDLIST pidl2) 838 { 839 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 840 841 CHAR szTemp1[MAX_PATH]; 842 CHAR szTemp2[MAX_PATH]; 843 int nReturn; 844 IShellFolder * psf; 845 HRESULT hr = E_OUTOFMEMORY; 846 LPCITEMIDLIST pidlTemp; 847 PIDLTYPE pt1, pt2; 848 849 TRACE("(%p)->(0x%08lx,pidl1=%p,pidl2=%p)\n",This,lParam,pidl1,pidl2); 850 pdump (pidl1); 851 pdump (pidl2); 852 853 if (!pidl1 && !pidl2) 854 { 855 hr = ResultFromShort(0); 856 } 857 else if (!pidl1) 858 { 859 hr = ResultFromShort(-1); 860 } 861 else if (!pidl2) 862 { 863 hr = ResultFromShort(1); 864 } 865 else 866 { 867 LPPIDLDATA pd1, pd2; 868 pd1 = _ILGetDataPointer(pidl1); 869 pd2 = _ILGetDataPointer(pidl2); 870 871 /* compate the types. sort order is the PT_* constant */ 872 pt1 = ( pd1 ? pd1->type: PT_DESKTOP); 873 pt2 = ( pd2 ? pd2->type: PT_DESKTOP); 874 875 if (pt1 != pt2) 876 { 877 hr = ResultFromShort(pt1-pt2); 878 } 879 else /* same type of pidl */ 880 { 881 _ILSimpleGetText(pidl1, szTemp1, MAX_PATH); 882 _ILSimpleGetText(pidl2, szTemp2, MAX_PATH); 883 nReturn = strcasecmp(szTemp1, szTemp2); 884 885 if (nReturn == 0) /* first pidl different ? */ 886 { 887 pidl1 = ILGetNext(pidl1); 888 889 if (pidl1 && pidl1->mkid.cb) /* go deeper? */ 890 { 891 pidlTemp = ILCloneFirst(pidl1); 892 pidl2 = ILGetNext(pidl2); 893 894 hr = IShellFolder_BindToObject(iface, pidlTemp, NULL, &IID_IShellFolder, (LPVOID*)&psf); 895 if (SUCCEEDED(hr)) 896 { 897 nReturn = IShellFolder_CompareIDs(psf, 0, pidl1, pidl2); 898 IShellFolder_Release(psf); 899 hr = ResultFromShort(nReturn); 900 } 901 ILFree(pidlTemp); 902 } 903 else 904 { 905 hr = ResultFromShort(nReturn); /* two equal simple pidls */ 906 } 907 } 908 else 909 { 910 hr = ResultFromShort(nReturn); /* two different simple pidls */ 911 } 912 } 913 } 914 915 TRACE("-- res=0x%08lx\n", hr); 916 return hr; 917 } 918 919 /************************************************************************** 920 * IShellFolder_fnCreateViewObject 920 921 */ 921 922 static HRESULT WINAPI IShellFolder_fnCreateViewObject( 922 IShellFolder2 * iface,923 HWND hwndOwner,924 REFIID riid,925 LPVOID *ppvOut)926 { 927 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)928 929 LPSHELLVIEWpShellView;930 HRESULThr = E_INVALIDARG;931 932 TRACE("(%p)->(hwnd=0x%x,\n\tIID:\t%s,%p)\n",This,hwndOwner,debugstr_guid(riid),ppvOut);933 934 if(ppvOut)935 {936 *ppvOut = NULL;937 938 if(IsEqualIID(riid, &IID_IDropTarget))939 {940 hr = IShellFolder_QueryInterface(iface, &IID_IDropTarget, ppvOut);941 }942 else if(IsEqualIID(riid, &IID_IContextMenu))943 {944 FIXME("IContextMenu not implemented\n");945 hr = E_NOTIMPL;946 }947 else if(IsEqualIID(riid, &IID_IShellView))948 {949 pShellView = IShellView_Constructor((IShellFolder*)iface);950 if(pShellView)951 {952 hr = IShellView_QueryInterface(pShellView, riid, ppvOut);953 IShellView_Release(pShellView);954 }955 }956 }957 TRACE("-- (%p)->(interface=%p)\n",This, ppvOut);958 return hr; 923 IShellFolder2 * iface, 924 HWND hwndOwner, 925 REFIID riid, 926 LPVOID *ppvOut) 927 { 928 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 929 930 LPSHELLVIEW pShellView; 931 HRESULT hr = E_INVALIDARG; 932 933 TRACE("(%p)->(hwnd=0x%x,\n\tIID:\t%s,%p)\n",This,hwndOwner,debugstr_guid(riid),ppvOut); 934 935 if(ppvOut) 936 { 937 *ppvOut = NULL; 938 939 if(IsEqualIID(riid, &IID_IDropTarget)) 940 { 941 hr = IShellFolder_QueryInterface(iface, &IID_IDropTarget, ppvOut); 942 } 943 else if(IsEqualIID(riid, &IID_IContextMenu)) 944 { 945 FIXME("IContextMenu not implemented\n"); 946 hr = E_NOTIMPL; 947 } 948 else if(IsEqualIID(riid, &IID_IShellView)) 949 { 950 pShellView = IShellView_Constructor((IShellFolder*)iface); 951 if(pShellView) 952 { 953 hr = IShellView_QueryInterface(pShellView, riid, ppvOut); 954 IShellView_Release(pShellView); 955 } 956 } 957 } 958 TRACE("-- (%p)->(interface=%p)\n",This, ppvOut); 959 return hr; 959 960 } 960 961 … … 964 965 * PARAMETERS 965 966 * UINT cidl, //[in ] num elements in pidl array 966 * LPCITEMIDLIST* apidl, //[in ] simple pidl array 967 * ULONG* rgfInOut) //[out] result array 967 * LPCITEMIDLIST* apidl, //[in ] simple pidl array 968 * ULONG* rgfInOut) //[out] result array 968 969 * 969 970 */ 970 971 static HRESULT WINAPI IShellFolder_fnGetAttributesOf( 971 IShellFolder2 * iface,972 UINT cidl,973 LPCITEMIDLIST *apidl,974 DWORD *rgfInOut)975 { 976 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)977 978 HRESULT hr = S_OK;979 980 TRACE("(%p)->(cidl=%d apidl=%p mask=0x%08lx)\n",This,cidl,apidl,*rgfInOut);981 982 if ( (!cidl) || (!apidl) || (!rgfInOut))983 return E_INVALIDARG;984 985 while (cidl > 0 && *apidl)986 {987 pdump (*apidl);988 SHELL32_GetItemAttributes(_IShellFolder_(This), *apidl, rgfInOut);989 apidl++;990 cidl--;991 } 992 993 TRACE("-- result=0x%08lx\n",*rgfInOut);994 995 return hr;972 IShellFolder2 * iface, 973 UINT cidl, 974 LPCITEMIDLIST *apidl, 975 DWORD *rgfInOut) 976 { 977 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 978 979 HRESULT hr = S_OK; 980 981 TRACE("(%p)->(cidl=%d apidl=%p mask=0x%08lx)\n",This,cidl,apidl,*rgfInOut); 982 983 if ( (!cidl) || (!apidl) || (!rgfInOut)) 984 return E_INVALIDARG; 985 986 while (cidl > 0 && *apidl) 987 { 988 pdump (*apidl); 989 SHELL32_GetItemAttributes(_IShellFolder_(This), *apidl, rgfInOut); 990 apidl++; 991 cidl--; 992 } 993 994 TRACE("-- result=0x%08lx\n",*rgfInOut); 995 996 return hr; 996 997 } 997 998 /************************************************************************** … … 1003 1004 * LPCITEMIDLIST* apidl, //[in ] simple pidl array 1004 1005 * REFIID riid, //[in ] Requested Interface 1005 * UINT* prgfInOut, //[ ] reserved 1006 * UINT* prgfInOut, //[ ] reserved 1006 1007 * LPVOID* ppvObject) //[out] Resulting Interface 1007 1008 * … … 1016 1017 * and GetData's it if the drop is in another explorer window that needs the positions. 1017 1018 */ 1018 static HRESULT WINAPI IShellFolder_fnGetUIObjectOf( 1019 IShellFolder2 *iface,1020 HWNDhwndOwner,1021 UINTcidl,1022 LPCITEMIDLIST * apidl, 1023 REFIID riid, 1024 UINT *prgfInOut,1025 LPVOID *ppvOut)1026 { 1027 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)1028 1029 LPITEMIDLISTpidl;1030 IUnknown* pObj = NULL; 1031 HRESULThr = E_INVALIDARG;1032 1033 TRACE("(%p)->(0x%04x,%u,apidl=%p,\n\tIID:%s,%p,%p)\n",1034 This,hwndOwner,cidl,apidl,debugstr_guid(riid),prgfInOut,ppvOut);1035 1036 if (ppvOut)1037 {1038 *ppvOut = NULL;1039 1040 if(IsEqualIID(riid, &IID_IContextMenu) && (cidl >= 1))1041 {1042 pObj = (LPUNKNOWN)ISvItemCm_Constructor((IShellFolder*)iface, This->absPidl, apidl, cidl);1043 hr = S_OK;1044 }1045 else if (IsEqualIID(riid, &IID_IDataObject) &&(cidl >= 1))1046 {1047 pObj = (LPUNKNOWN)IDataObject_Constructor (hwndOwner, This->absPidl, apidl, cidl);1048 hr = S_OK;1049 }1050 else if (IsEqualIID(riid, &IID_IExtractIconA) && (cidl == 1))1051 {1052 pidl = ILCombine(This->absPidl,apidl[0]);1053 pObj = (LPUNKNOWN)IExtractIconA_Constructor( pidl );1054 SHFree(pidl);1055 hr = S_OK;1056 } 1057 else if (IsEqualIID(riid, &IID_IDropTarget) && (cidl >= 1))1058 {1059 hr = IShellFolder_QueryInterface(iface, &IID_IDropTarget, (LPVOID*)&pObj);1060 }1061 else1062 { 1063 hr = E_NOINTERFACE;1064 }1065 1066 if(!pObj)1067 hr = E_OUTOFMEMORY;1068 1069 *ppvOut = pObj;1070 }1071 TRACE("(%p)->hr=0x%08lx\n",This, hr);1072 return hr;1019 static HRESULT WINAPI IShellFolder_fnGetUIObjectOf( 1020 IShellFolder2 * iface, 1021 HWND hwndOwner, 1022 UINT cidl, 1023 LPCITEMIDLIST * apidl, 1024 REFIID riid, 1025 UINT * prgfInOut, 1026 LPVOID * ppvOut) 1027 { 1028 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 1029 1030 LPITEMIDLIST pidl; 1031 IUnknown* pObj = NULL; 1032 HRESULT hr = E_INVALIDARG; 1033 1034 TRACE("(%p)->(0x%04x,%u,apidl=%p,\n\tIID:%s,%p,%p)\n", 1035 This,hwndOwner,cidl,apidl,debugstr_guid(riid),prgfInOut,ppvOut); 1036 1037 if (ppvOut) 1038 { 1039 *ppvOut = NULL; 1040 1041 if(IsEqualIID(riid, &IID_IContextMenu) && (cidl >= 1)) 1042 { 1043 pObj = (LPUNKNOWN)ISvItemCm_Constructor((IShellFolder*)iface, This->absPidl, apidl, cidl); 1044 hr = S_OK; 1045 } 1046 else if (IsEqualIID(riid, &IID_IDataObject) &&(cidl >= 1)) 1047 { 1048 pObj = (LPUNKNOWN)IDataObject_Constructor (hwndOwner, This->absPidl, apidl, cidl); 1049 hr = S_OK; 1050 } 1051 else if (IsEqualIID(riid, &IID_IExtractIconA) && (cidl == 1)) 1052 { 1053 pidl = ILCombine(This->absPidl,apidl[0]); 1054 pObj = (LPUNKNOWN)IExtractIconA_Constructor( pidl ); 1055 SHFree(pidl); 1056 hr = S_OK; 1057 } 1058 else if (IsEqualIID(riid, &IID_IDropTarget) && (cidl >= 1)) 1059 { 1060 hr = IShellFolder_QueryInterface(iface, &IID_IDropTarget, (LPVOID*)&pObj); 1061 } 1062 else 1063 { 1064 hr = E_NOINTERFACE; 1065 } 1066 1067 if(!pObj) 1068 hr = E_OUTOFMEMORY; 1069 1070 *ppvOut = pObj; 1071 } 1072 TRACE("(%p)->hr=0x%08lx\n",This, hr); 1073 return hr; 1073 1074 } 1074 1075 … … 1089 1090 1090 1091 static HRESULT WINAPI IShellFolder_fnGetDisplayNameOf( 1091 IShellFolder2 * iface,1092 LPCITEMIDLIST pidl,1093 DWORD dwFlags,1094 LPSTRRET strRet)1095 { 1096 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)1097 1098 CHARszPath[MAX_PATH]= "";1099 intlen = 0;1100 BOOLbSimplePidl;1101 1102 TRACE("(%p)->(pidl=%p,0x%08lx,%p)\n",This,pidl,dwFlags,strRet);1103 pdump(pidl);1104 1105 if(!pidl || !strRet) return E_INVALIDARG;1106 1107 bSimplePidl = _ILIsPidlSimple(pidl);1108 1109 /* take names of special folders only if its only this folder */1110 if (_ILIsSpecialFolder(pidl))1111 {1112 if ( bSimplePidl)1113 {1114 _ILSimpleGetText(pidl, szPath, MAX_PATH); /* append my own path */1115 }1116 }1117 else1118 {1119 if (!(dwFlags & SHGDN_INFOLDER) && (dwFlags & SHGDN_FORPARSING) && This->sMyPath)1120 {1121 strcpy (szPath, This->sMyPath);/* get path to root*/1122 PathAddBackslashA(szPath);1123 len = strlen(szPath);1124 }1125 _ILSimpleGetText(pidl, szPath + len, MAX_PATH - len);/* append my own path */1126 }1127 1128 if ( (dwFlags & SHGDN_FORPARSING) && !bSimplePidl)/* go deeper if needed */1129 {1130 PathAddBackslashA(szPath);1131 len = strlen(szPath);1132 1133 if (!SUCCEEDED(SHELL32_GetDisplayNameOfChild(iface, pidl, dwFlags, szPath + len, MAX_PATH - len)))1134 return E_OUTOFMEMORY;1135 }1136 strRet->uType = STRRET_CSTRA;1137 lstrcpynA(strRet->u.cStr, szPath, MAX_PATH);1138 1139 TRACE("-- (%p)->(%s)\n", This, szPath);1140 return S_OK;1092 IShellFolder2 * iface, 1093 LPCITEMIDLIST pidl, 1094 DWORD dwFlags, 1095 LPSTRRET strRet) 1096 { 1097 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 1098 1099 CHAR szPath[MAX_PATH]= ""; 1100 int len = 0; 1101 BOOL bSimplePidl; 1102 1103 TRACE("(%p)->(pidl=%p,0x%08lx,%p)\n",This,pidl,dwFlags,strRet); 1104 pdump(pidl); 1105 1106 if(!pidl || !strRet) return E_INVALIDARG; 1107 1108 bSimplePidl = _ILIsPidlSimple(pidl); 1109 1110 /* take names of special folders only if its only this folder */ 1111 if (_ILIsSpecialFolder(pidl)) 1112 { 1113 if ( bSimplePidl) 1114 { 1115 _ILSimpleGetText(pidl, szPath, MAX_PATH); /* append my own path */ 1116 } 1117 } 1118 else 1119 { 1120 if (!(dwFlags & SHGDN_INFOLDER) && (dwFlags & SHGDN_FORPARSING) && This->sMyPath) 1121 { 1122 strcpy (szPath, This->sMyPath); /* get path to root*/ 1123 PathAddBackslashA(szPath); 1124 len = strlen(szPath); 1125 } 1126 _ILSimpleGetText(pidl, szPath + len, MAX_PATH - len); /* append my own path */ 1127 } 1128 1129 if ( (dwFlags & SHGDN_FORPARSING) && !bSimplePidl) /* go deeper if needed */ 1130 { 1131 PathAddBackslashA(szPath); 1132 len = strlen(szPath); 1133 1134 if (!SUCCEEDED(SHELL32_GetDisplayNameOfChild(iface, pidl, dwFlags, szPath + len, MAX_PATH - len))) 1135 return E_OUTOFMEMORY; 1136 } 1137 strRet->uType = STRRET_CSTRA; 1138 lstrcpynA(strRet->u.cStr, szPath, MAX_PATH); 1139 1140 TRACE("-- (%p)->(%s)\n", This, szPath); 1141 return S_OK; 1141 1142 } 1142 1143 … … 1154 1155 */ 1155 1156 static HRESULT WINAPI IShellFolder_fnSetNameOf( 1156 IShellFolder2 * iface,1157 HWND hwndOwner, 1158 LPCITEMIDLIST pidl, /*simple pidl*/1159 LPCOLESTR lpName, 1160 DWORD dwFlags, 1161 LPITEMIDLIST *pPidlOut)1162 { 1163 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)1164 char szSrc[MAX_PATH], szDest[MAX_PATH];1165 int len;1166 BOOL bIsFolder = _ILIsFolder(ILFindLastID(pidl));1167 1168 TRACE("(%p)->(%u,pidl=%p,%s,%lu,%p)\n",1169 This,hwndOwner,pidl,debugstr_w(lpName),dwFlags,pPidlOut);1170 1171 /* build source path */1172 if (dwFlags & SHGDN_INFOLDER)1173 {1174 strcpy(szSrc, This->sMyPath);1175 PathAddBackslashA(szSrc);1176 len = strlen (szSrc);1177 _ILSimpleGetText(pidl, szSrc+len, MAX_PATH-len);1178 }1179 else 1180 {1181 SHGetPathFromIDListA(pidl, szSrc);1182 }1183 1184 /* build destination path */1185 strcpy(szDest, This->sMyPath);1186 PathAddBackslashA(szDest);1187 len = strlen (szDest);1157 IShellFolder2 * iface, 1158 HWND hwndOwner, 1159 LPCITEMIDLIST pidl, /*simple pidl*/ 1160 LPCOLESTR lpName, 1161 DWORD dwFlags, 1162 LPITEMIDLIST *pPidlOut) 1163 { 1164 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 1165 char szSrc[MAX_PATH], szDest[MAX_PATH]; 1166 int len; 1167 BOOL bIsFolder = _ILIsFolder(ILFindLastID(pidl)); 1168 1169 TRACE("(%p)->(%u,pidl=%p,%s,%lu,%p)\n", 1170 This,hwndOwner,pidl,debugstr_w(lpName),dwFlags,pPidlOut); 1171 1172 /* build source path */ 1173 if (dwFlags & SHGDN_INFOLDER) 1174 { 1175 strcpy(szSrc, This->sMyPath); 1176 PathAddBackslashA(szSrc); 1177 len = strlen (szSrc); 1178 _ILSimpleGetText(pidl, szSrc+len, MAX_PATH-len); 1179 } 1180 else 1181 { 1182 SHGetPathFromIDListA(pidl, szSrc); 1183 } 1184 1185 /* build destination path */ 1186 strcpy(szDest, This->sMyPath); 1187 PathAddBackslashA(szDest); 1188 len = strlen (szDest); 1188 1189 WideCharToMultiByte( CP_ACP, 0, lpName, -1, szDest+len, MAX_PATH-len, NULL, NULL ); 1189 1190 szDest[MAX_PATH-1] = 0; 1190 TRACE("src=%s dest=%s\n", szSrc, szDest);1191 if ( MoveFileA(szSrc, szDest) )1192 {1193 if (pPidlOut) *pPidlOut = SHSimpleIDListFromPathA(szDest);1194 SHChangeNotifyA( bIsFolder?SHCNE_RENAMEFOLDER:SHCNE_RENAMEITEM, SHCNF_PATHA, szSrc, szDest);1195 return S_OK;1196 }1197 return E_FAIL;1191 TRACE("src=%s dest=%s\n", szSrc, szDest); 1192 if ( MoveFileA(szSrc, szDest) ) 1193 { 1194 if (pPidlOut) *pPidlOut = SHSimpleIDListFromPathA(szDest); 1195 SHChangeNotifyA( bIsFolder?SHCNE_RENAMEFOLDER:SHCNE_RENAMEITEM, SHCNF_PATHA, szSrc, szDest); 1196 return S_OK; 1197 } 1198 return E_FAIL; 1198 1199 } 1199 1200 1200 1201 static HRESULT WINAPI IShellFolder_fnGetDefaultSearchGUID( 1201 IShellFolder2 * iface,1202 GUID *pguid)1203 { 1204 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)1205 FIXME("(%p)\n",This);1206 return E_NOTIMPL;1207 } 1202 IShellFolder2 * iface, 1203 GUID *pguid) 1204 { 1205 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 1206 FIXME("(%p)\n",This); 1207 return E_NOTIMPL; 1208 } 1208 1209 static HRESULT WINAPI IShellFolder_fnEnumSearches( 1209 IShellFolder2 * iface,1210 IEnumExtraSearch **ppenum)1211 { 1212 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)1213 FIXME("(%p)\n",This);1214 return E_NOTIMPL;1215 } 1210 IShellFolder2 * iface, 1211 IEnumExtraSearch **ppenum) 1212 { 1213 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 1214 FIXME("(%p)\n",This); 1215 return E_NOTIMPL; 1216 } 1216 1217 static HRESULT WINAPI IShellFolder_fnGetDefaultColumn( 1217 IShellFolder2 * iface,1218 DWORD dwRes,1219 ULONG *pSort,1220 ULONG *pDisplay)1221 { 1222 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)1223 1224 TRACE("(%p)\n",This);1225 1226 if (pSort) *pSort = 0;1227 if (pDisplay) *pDisplay = 0;1228 1229 return S_OK;1230 } 1218 IShellFolder2 * iface, 1219 DWORD dwRes, 1220 ULONG *pSort, 1221 ULONG *pDisplay) 1222 { 1223 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 1224 1225 TRACE("(%p)\n",This); 1226 1227 if (pSort) *pSort = 0; 1228 if (pDisplay) *pDisplay = 0; 1229 1230 return S_OK; 1231 } 1231 1232 static HRESULT WINAPI IShellFolder_fnGetDefaultColumnState( 1232 IShellFolder2 * iface,1233 UINT iColumn,1234 DWORD *pcsFlags)1235 { 1236 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)1237 1238 TRACE("(%p)\n",This);1239 1240 if (!pcsFlags || iColumn >= GENERICSHELLVIEWCOLUMNS ) return E_INVALIDARG;1241 1242 *pcsFlags = GenericSFHeader[iColumn].pcsFlags;1243 1244 return S_OK;1245 } 1233 IShellFolder2 * iface, 1234 UINT iColumn, 1235 DWORD *pcsFlags) 1236 { 1237 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 1238 1239 TRACE("(%p)\n",This); 1240 1241 if (!pcsFlags || iColumn >= GENERICSHELLVIEWCOLUMNS ) return E_INVALIDARG; 1242 1243 *pcsFlags = GenericSFHeader[iColumn].pcsFlags; 1244 1245 return S_OK; 1246 } 1246 1247 static HRESULT WINAPI IShellFolder_fnGetDetailsEx( 1247 IShellFolder2 * iface,1248 LPCITEMIDLIST pidl,1249 const SHCOLUMNID *pscid,1250 VARIANT *pv)1251 { 1252 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)1253 FIXME("(%p)\n",This);1254 1255 return E_NOTIMPL;1256 } 1248 IShellFolder2 * iface, 1249 LPCITEMIDLIST pidl, 1250 const SHCOLUMNID *pscid, 1251 VARIANT *pv) 1252 { 1253 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 1254 FIXME("(%p)\n",This); 1255 1256 return E_NOTIMPL; 1257 } 1257 1258 static HRESULT WINAPI IShellFolder_fnGetDetailsOf( 1258 IShellFolder2 * iface,1259 LPCITEMIDLIST pidl,1260 UINT iColumn,1261 SHELLDETAILS *psd)1262 { 1263 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)1264 HRESULT hr = E_FAIL;1265 1266 TRACE("(%p)->(%p %i %p)\n",This, pidl, iColumn, psd);1267 1268 if (!psd || iColumn >= GENERICSHELLVIEWCOLUMNS ) return E_INVALIDARG;1269 1270 if (!pidl)1271 {1272 /* the header titles */1273 psd->fmt = GenericSFHeader[iColumn].fmt;1274 psd->cxChar = GenericSFHeader[iColumn].cxChar;1275 psd->str.uType = STRRET_CSTRA;1276 LoadStringA(shell32_hInstance, GenericSFHeader[iColumn].colnameid, psd->str.u.cStr, MAX_PATH);1277 return S_OK;1278 }1279 else1280 {1281 /* the data from the pidl */1282 switch(iColumn)1283 {1284 case 0:/* name */1285 hr = IShellFolder_GetDisplayNameOf(iface, pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str);1286 break;1287 case 1:/* size */1288 _ILGetFileSize (pidl, psd->str.u.cStr, MAX_PATH);1289 break;1290 case 2:/* type */1291 _ILGetFileType(pidl, psd->str.u.cStr, MAX_PATH);1292 break;1293 case 3:/* date */1294 _ILGetFileDate(pidl, psd->str.u.cStr, MAX_PATH);1295 break;1296 case 4:/* attributes */1297 _ILGetFileAttributes(pidl, psd->str.u.cStr, MAX_PATH);1298 break;1299 }1300 hr = S_OK;1301 psd->str.uType = STRRET_CSTRA;1302 }1303 1304 return hr;1305 } 1259 IShellFolder2 * iface, 1260 LPCITEMIDLIST pidl, 1261 UINT iColumn, 1262 SHELLDETAILS *psd) 1263 { 1264 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 1265 HRESULT hr = E_FAIL; 1266 1267 TRACE("(%p)->(%p %i %p)\n",This, pidl, iColumn, psd); 1268 1269 if (!psd || iColumn >= GENERICSHELLVIEWCOLUMNS ) return E_INVALIDARG; 1270 1271 if (!pidl) 1272 { 1273 /* the header titles */ 1274 psd->fmt = GenericSFHeader[iColumn].fmt; 1275 psd->cxChar = GenericSFHeader[iColumn].cxChar; 1276 psd->str.uType = STRRET_CSTRA; 1277 LoadStringA(shell32_hInstance, GenericSFHeader[iColumn].colnameid, psd->str.u.cStr, MAX_PATH); 1278 return S_OK; 1279 } 1280 else 1281 { 1282 /* the data from the pidl */ 1283 switch(iColumn) 1284 { 1285 case 0: /* name */ 1286 hr = IShellFolder_GetDisplayNameOf(iface, pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str); 1287 break; 1288 case 1: /* size */ 1289 _ILGetFileSize (pidl, psd->str.u.cStr, MAX_PATH); 1290 break; 1291 case 2: /* type */ 1292 _ILGetFileType(pidl, psd->str.u.cStr, MAX_PATH); 1293 break; 1294 case 3: /* date */ 1295 _ILGetFileDate(pidl, psd->str.u.cStr, MAX_PATH); 1296 break; 1297 case 4: /* attributes */ 1298 _ILGetFileAttributes(pidl, psd->str.u.cStr, MAX_PATH); 1299 break; 1300 } 1301 hr = S_OK; 1302 psd->str.uType = STRRET_CSTRA; 1303 } 1304 1305 return hr; 1306 } 1306 1307 static HRESULT WINAPI IShellFolder_fnMapNameToSCID( 1307 IShellFolder2 * iface,1308 LPCWSTR pwszName,1309 SHCOLUMNID *pscid)1310 { 1311 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)1312 FIXME("(%p)\n",This);1313 return E_NOTIMPL;1314 } 1315 1316 static ICOM_VTABLE(IShellFolder2) sfvt = 1317 { 1318 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE1319 IShellFolder_fnQueryInterface,1320 IShellFolder_fnAddRef,1321 IShellFolder_fnRelease,1322 IShellFolder_fnParseDisplayName,1323 IShellFolder_fnEnumObjects,1324 IShellFolder_fnBindToObject,1325 IShellFolder_fnBindToStorage,1326 IShellFolder_fnCompareIDs,1327 IShellFolder_fnCreateViewObject,1328 IShellFolder_fnGetAttributesOf,1329 IShellFolder_fnGetUIObjectOf,1330 IShellFolder_fnGetDisplayNameOf,1331 IShellFolder_fnSetNameOf,1332 1333 /* ShellFolder2 */1334 IShellFolder_fnGetDefaultSearchGUID,1335 IShellFolder_fnEnumSearches,1336 IShellFolder_fnGetDefaultColumn,1337 IShellFolder_fnGetDefaultColumnState,1338 IShellFolder_fnGetDetailsEx,1339 IShellFolder_fnGetDetailsOf,1340 IShellFolder_fnMapNameToSCID1308 IShellFolder2 * iface, 1309 LPCWSTR pwszName, 1310 SHCOLUMNID *pscid) 1311 { 1312 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 1313 FIXME("(%p)\n",This); 1314 return E_NOTIMPL; 1315 } 1316 1317 static ICOM_VTABLE(IShellFolder2) sfvt = 1318 { 1319 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 1320 IShellFolder_fnQueryInterface, 1321 IShellFolder_fnAddRef, 1322 IShellFolder_fnRelease, 1323 IShellFolder_fnParseDisplayName, 1324 IShellFolder_fnEnumObjects, 1325 IShellFolder_fnBindToObject, 1326 IShellFolder_fnBindToStorage, 1327 IShellFolder_fnCompareIDs, 1328 IShellFolder_fnCreateViewObject, 1329 IShellFolder_fnGetAttributesOf, 1330 IShellFolder_fnGetUIObjectOf, 1331 IShellFolder_fnGetDisplayNameOf, 1332 IShellFolder_fnSetNameOf, 1333 1334 /* ShellFolder2 */ 1335 IShellFolder_fnGetDefaultSearchGUID, 1336 IShellFolder_fnEnumSearches, 1337 IShellFolder_fnGetDefaultColumn, 1338 IShellFolder_fnGetDefaultColumnState, 1339 IShellFolder_fnGetDetailsEx, 1340 IShellFolder_fnGetDetailsOf, 1341 IShellFolder_fnMapNameToSCID 1341 1342 }; 1342 1343 … … 1346 1347 1347 1348 static HRESULT WINAPI ISFHelper_fnQueryInterface( 1348 ISFHelper *iface,1349 REFIID riid,1350 LPVOID *ppvObj)1351 { 1352 _ICOM_THIS_From_ISFHelper(IGenericSFImpl,iface);1353 1354 TRACE("(%p)\n", This);1355 1356 return IUnknown_QueryInterface(This->pUnkOuter, riid, ppvObj);1349 ISFHelper *iface, 1350 REFIID riid, 1351 LPVOID *ppvObj) 1352 { 1353 _ICOM_THIS_From_ISFHelper(IGenericSFImpl,iface); 1354 1355 TRACE("(%p)\n", This); 1356 1357 return IUnknown_QueryInterface(This->pUnkOuter, riid, ppvObj); 1357 1358 } 1358 1359 1359 1360 static ULONG WINAPI ISFHelper_fnAddRef( 1360 ISFHelper *iface)1361 { 1362 _ICOM_THIS_From_ISFHelper(IGenericSFImpl,iface);1363 1364 TRACE("(%p)\n", This);1365 1366 return IUnknown_AddRef(This->pUnkOuter);1361 ISFHelper *iface) 1362 { 1363 _ICOM_THIS_From_ISFHelper(IGenericSFImpl,iface); 1364 1365 TRACE("(%p)\n", This); 1366 1367 return IUnknown_AddRef(This->pUnkOuter); 1367 1368 } 1368 1369 1369 1370 static ULONG WINAPI ISFHelper_fnRelease( 1370 ISFHelper *iface)1371 { 1372 _ICOM_THIS_From_ISFHelper(IGenericSFImpl,iface);1373 1374 TRACE("(%p)\n", This);1375 1376 return IUnknown_Release(This->pUnkOuter);1371 ISFHelper *iface) 1372 { 1373 _ICOM_THIS_From_ISFHelper(IGenericSFImpl,iface); 1374 1375 TRACE("(%p)\n", This); 1376 1377 return IUnknown_Release(This->pUnkOuter); 1377 1378 } 1378 1379 … … 1385 1386 1386 1387 static HRESULT WINAPI ISFHelper_fnGetUniqueName( 1387 ISFHelper *iface,1388 LPSTR lpName,1389 UINT uLen)1390 { 1391 _ICOM_THIS_From_ISFHelper(IGenericSFImpl,iface)1392 IEnumIDList * penum;1393 HRESULT hr;1394 char szText[MAX_PATH];1395 char * szNewFolder = "New Folder";1396 1397 TRACE("(%p)(%s %u)\n", This, lpName, uLen);1398 1399 if (uLen < strlen(szNewFolder) + 4) return E_POINTER;1400 1401 strcpy(lpName, szNewFolder);1402 1403 hr = IShellFolder_fnEnumObjects(_IShellFolder2_(This), 0, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS | SHCONTF_INCLUDEHIDDEN, &penum);1404 if (penum)1405 {1406 LPITEMIDLIST pidl;1407 DWORD dwFetched;1408 int i=1;1409 1388 ISFHelper *iface, 1389 LPSTR lpName, 1390 UINT uLen) 1391 { 1392 _ICOM_THIS_From_ISFHelper(IGenericSFImpl,iface) 1393 IEnumIDList * penum; 1394 HRESULT hr; 1395 char szText[MAX_PATH]; 1396 char * szNewFolder = "New Folder"; 1397 1398 TRACE("(%p)(%s %u)\n", This, lpName, uLen); 1399 1400 if (uLen < strlen(szNewFolder) + 4) return E_POINTER; 1401 1402 strcpy(lpName, szNewFolder); 1403 1404 hr = IShellFolder_fnEnumObjects(_IShellFolder2_(This), 0, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS | SHCONTF_INCLUDEHIDDEN, &penum); 1405 if (penum) 1406 { 1407 LPITEMIDLIST pidl; 1408 DWORD dwFetched; 1409 int i=1; 1410 1410 1411 next: IEnumIDList_Reset(penum); 1411 while(S_OK == IEnumIDList_Next(penum, 1, &pidl, &dwFetched) && dwFetched)1412 {1413 _ILSimpleGetText(pidl, szText, MAX_PATH);1414 if (0 == strcasecmp(szText, lpName))1415 {1416 sprintf(lpName, "%s %d", szNewFolder, i++);1417 if (i > 99) 1418 {1419 hr = E_FAIL;1420 break;1421 }1422 goto next;1423 }1424 }1425 1426 IEnumIDList_Release(penum);1427 }1428 return hr;1429 } 1430 1412 while(S_OK == IEnumIDList_Next(penum, 1, &pidl, &dwFetched) && dwFetched) 1413 { 1414 _ILSimpleGetText(pidl, szText, MAX_PATH); 1415 if (0 == strcasecmp(szText, lpName)) 1416 { 1417 sprintf(lpName, "%s %d", szNewFolder, i++); 1418 if (i > 99) 1419 { 1420 hr = E_FAIL; 1421 break; 1422 } 1423 goto next; 1424 } 1425 } 1426 1427 IEnumIDList_Release(penum); 1428 } 1429 return hr; 1430 } 1431 1431 1432 /**************************************************************************** 1432 1433 * ISFHelper_fnAddFolder … … 1436 1437 1437 1438 static HRESULT WINAPI ISFHelper_fnAddFolder( 1438 ISFHelper *iface,1439 HWND hwnd,1440 LPCSTR lpName,1441 LPITEMIDLIST* ppidlOut)1442 { 1443 _ICOM_THIS_From_ISFHelper(IGenericSFImpl,iface)1444 char lpstrNewDir[MAX_PATH];1445 DWORD bRes;1446 HRESULT hres = E_FAIL;1447 1448 TRACE("(%p)(%s %p)\n", This, lpName, ppidlOut);1449 1450 strcpy(lpstrNewDir, This->sMyPath);1451 PathAddBackslashA(lpstrNewDir);1452 strcat(lpstrNewDir, lpName);1453 1454 bRes = CreateDirectoryA(lpstrNewDir, NULL);1455 1456 if (bRes)1457 {1458 LPITEMIDLIST pidl, pidlitem;1459 1460 pidlitem = SHSimpleIDListFromPathA(lpstrNewDir);1461 1462 pidl = ILCombine(This->absPidl, pidlitem);1463 SHChangeNotifyA(SHCNE_MKDIR, SHCNF_IDLIST, pidl, NULL);1464 SHFree(pidl); 1465 1466 if (ppidlOut) *ppidlOut = pidlitem;1467 hres = S_OK;1468 }1469 else1470 {1471 char lpstrText[128+MAX_PATH];1472 char lpstrTempText[128];1473 char lpstrCaption[256];1474 1475 /* Cannot Create folder because of permissions */1476 LoadStringA(shell32_hInstance, IDS_CREATEFOLDER_DENIED, lpstrTempText, sizeof(lpstrTempText));1477 LoadStringA(shell32_hInstance, IDS_CREATEFOLDER_CAPTION, lpstrCaption, sizeof(lpstrCaption));1478 sprintf(lpstrText,lpstrTempText, lpstrNewDir);1479 MessageBoxA(hwnd,lpstrText, lpstrCaption, MB_OK | MB_ICONEXCLAMATION);1480 }1481 1482 return hres;1439 ISFHelper *iface, 1440 HWND hwnd, 1441 LPCSTR lpName, 1442 LPITEMIDLIST* ppidlOut) 1443 { 1444 _ICOM_THIS_From_ISFHelper(IGenericSFImpl,iface) 1445 char lpstrNewDir[MAX_PATH]; 1446 DWORD bRes; 1447 HRESULT hres = E_FAIL; 1448 1449 TRACE("(%p)(%s %p)\n", This, lpName, ppidlOut); 1450 1451 strcpy(lpstrNewDir, This->sMyPath); 1452 PathAddBackslashA(lpstrNewDir); 1453 strcat(lpstrNewDir, lpName); 1454 1455 bRes = CreateDirectoryA(lpstrNewDir, NULL); 1456 1457 if (bRes) 1458 { 1459 LPITEMIDLIST pidl, pidlitem; 1460 1461 pidlitem = SHSimpleIDListFromPathA(lpstrNewDir); 1462 1463 pidl = ILCombine(This->absPidl, pidlitem); 1464 SHChangeNotifyA(SHCNE_MKDIR, SHCNF_IDLIST, pidl, NULL); 1465 SHFree(pidl); 1466 1467 if (ppidlOut) *ppidlOut = pidlitem; 1468 hres = S_OK; 1469 } 1470 else 1471 { 1472 char lpstrText[128+MAX_PATH]; 1473 char lpstrTempText[128]; 1474 char lpstrCaption[256]; 1475 1476 /* Cannot Create folder because of permissions */ 1477 LoadStringA(shell32_hInstance, IDS_CREATEFOLDER_DENIED, lpstrTempText, sizeof(lpstrTempText)); 1478 LoadStringA(shell32_hInstance, IDS_CREATEFOLDER_CAPTION, lpstrCaption, sizeof(lpstrCaption)); 1479 sprintf(lpstrText,lpstrTempText, lpstrNewDir); 1480 MessageBoxA(hwnd,lpstrText, lpstrCaption, MB_OK | MB_ICONEXCLAMATION); 1481 } 1482 1483 return hres; 1483 1484 } 1484 1485 … … 1489 1490 */ 1490 1491 static HRESULT WINAPI ISFHelper_fnDeleteItems( 1491 ISFHelper *iface,1492 UINT cidl,1493 LPCITEMIDLIST* apidl)1494 { 1495 _ICOM_THIS_From_ISFHelper(IGenericSFImpl,iface)1496 int i;1497 char szPath[MAX_PATH];1492 ISFHelper *iface, 1493 UINT cidl, 1494 LPCITEMIDLIST* apidl) 1495 { 1496 _ICOM_THIS_From_ISFHelper(IGenericSFImpl,iface) 1497 int i; 1498 char szPath[MAX_PATH]; 1498 1499 BOOL bConfirm = TRUE; 1499 1500 1500 TRACE("(%p)(%u %p)\n", This, cidl, apidl);1501 1502 /* deleting multiple items so give a slightly different warning */1503 if(cidl != 1)1504 {1505 char tmp[8]; 1501 TRACE("(%p)(%u %p)\n", This, cidl, apidl); 1502 1503 /* deleting multiple items so give a slightly different warning */ 1504 if(cidl != 1) 1505 { 1506 char tmp[8]; 1506 1507 snprintf(tmp, sizeof(tmp), "%d", cidl); 1507 if(!SHELL_WarnItemDelete(ASK_DELETE_MULTIPLE_ITEM, tmp))1508 if(!SHELL_WarnItemDelete(ASK_DELETE_MULTIPLE_ITEM, tmp)) 1508 1509 return E_FAIL; 1509 1510 bConfirm = FALSE; 1510 }1511 1512 for(i=0; i< cidl; i++)1513 {1514 strcpy(szPath, This->sMyPath);1515 PathAddBackslashA(szPath);1516 _ILSimpleGetText(apidl[i], szPath+strlen(szPath), MAX_PATH);1517 1518 if (_ILIsFolder(apidl[i]))1519 {1520 LPITEMIDLIST pidl;1521 TRACE("delete %s\n", szPath);1522 if (! SHELL_DeleteDirectoryA(szPath, bConfirm))1523 {1511 } 1512 1513 for(i=0; i< cidl; i++) 1514 { 1515 strcpy(szPath, This->sMyPath); 1516 PathAddBackslashA(szPath); 1517 _ILSimpleGetText(apidl[i], szPath+strlen(szPath), MAX_PATH); 1518 1519 if (_ILIsFolder(apidl[i])) 1520 { 1521 LPITEMIDLIST pidl; 1522 TRACE("delete %s\n", szPath); 1523 if (! SHELL_DeleteDirectoryA(szPath, bConfirm)) 1524 { 1524 1525 TRACE("delete %s failed, bConfirm=%d", szPath, bConfirm); 1525 return E_FAIL;1526 }1527 pidl = ILCombine(This->absPidl, apidl[i]);1528 SHChangeNotifyA(SHCNE_RMDIR, SHCNF_IDLIST, pidl, NULL);1529 SHFree(pidl); 1530 }1531 else if (_ILIsValue(apidl[i]))1532 {1533 LPITEMIDLIST pidl;1534 1535 TRACE("delete %s\n", szPath);1536 if (! SHELL_DeleteFileA(szPath, bConfirm))1537 {1526 return E_FAIL; 1527 } 1528 pidl = ILCombine(This->absPidl, apidl[i]); 1529 SHChangeNotifyA(SHCNE_RMDIR, SHCNF_IDLIST, pidl, NULL); 1530 SHFree(pidl); 1531 } 1532 else if (_ILIsValue(apidl[i])) 1533 { 1534 LPITEMIDLIST pidl; 1535 1536 TRACE("delete %s\n", szPath); 1537 if (! SHELL_DeleteFileA(szPath, bConfirm)) 1538 { 1538 1539 TRACE("delete %s failed, bConfirm=%d", szPath, bConfirm); 1539 return E_FAIL;1540 }1541 pidl = ILCombine(This->absPidl, apidl[i]);1542 SHChangeNotifyA(SHCNE_DELETE, SHCNF_IDLIST, pidl, NULL);1543 SHFree(pidl); 1544 }1545 1546 }1547 return S_OK;1540 return E_FAIL; 1541 } 1542 pidl = ILCombine(This->absPidl, apidl[i]); 1543 SHChangeNotifyA(SHCNE_DELETE, SHCNF_IDLIST, pidl, NULL); 1544 SHFree(pidl); 1545 } 1546 1547 } 1548 return S_OK; 1548 1549 } 1549 1550 … … 1554 1555 */ 1555 1556 static HRESULT WINAPI ISFHelper_fnCopyItems( 1556 ISFHelper *iface,1557 IShellFolder* pSFFrom,1558 UINT cidl,1559 LPCITEMIDLIST *apidl)1560 { 1561 int i;1562 IPersistFolder2 * ppf2=NULL;1563 char szSrcPath[MAX_PATH], szDstPath[MAX_PATH];1564 _ICOM_THIS_From_ISFHelper(IGenericSFImpl,iface);1565 1566 TRACE("(%p)->(%p,%u,%p)\n", This, pSFFrom, cidl, apidl);1567 1568 IShellFolder_QueryInterface(pSFFrom, &IID_IPersistFolder2, (LPVOID*)&ppf2);1569 if (ppf2)1570 {1571 LPITEMIDLIST pidl;1572 if (SUCCEEDED(IPersistFolder2_GetCurFolder(ppf2, &pidl)))1573 {1574 for (i=0; i<cidl; i++)1575 {1576 SHGetPathFromIDListA(pidl, szSrcPath);1577 PathAddBackslashA(szSrcPath);1578 _ILSimpleGetText(apidl[i], szSrcPath+strlen(szSrcPath), MAX_PATH);1579 1580 strcpy(szDstPath, This->sMyPath);1581 PathAddBackslashA(szDstPath);1582 _ILSimpleGetText(apidl[i], szDstPath+strlen(szDstPath), MAX_PATH);1583 MESSAGE("would copy %s to %s\n", szSrcPath, szDstPath);1584 }1585 SHFree(pidl);1586 }1587 IPersistFolder2_Release(ppf2);1588 }1589 return S_OK;1590 } 1591 1592 static ICOM_VTABLE(ISFHelper) shvt = 1593 { 1594 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE1595 ISFHelper_fnQueryInterface,1596 ISFHelper_fnAddRef,1597 ISFHelper_fnRelease,1598 ISFHelper_fnGetUniqueName,1599 ISFHelper_fnAddFolder,1600 ISFHelper_fnDeleteItems,1601 ISFHelper_fnCopyItems,1557 ISFHelper *iface, 1558 IShellFolder* pSFFrom, 1559 UINT cidl, 1560 LPCITEMIDLIST *apidl) 1561 { 1562 int i; 1563 IPersistFolder2 * ppf2=NULL; 1564 char szSrcPath[MAX_PATH], szDstPath[MAX_PATH]; 1565 _ICOM_THIS_From_ISFHelper(IGenericSFImpl,iface); 1566 1567 TRACE("(%p)->(%p,%u,%p)\n", This, pSFFrom, cidl, apidl); 1568 1569 IShellFolder_QueryInterface(pSFFrom, &IID_IPersistFolder2, (LPVOID*)&ppf2); 1570 if (ppf2) 1571 { 1572 LPITEMIDLIST pidl; 1573 if (SUCCEEDED(IPersistFolder2_GetCurFolder(ppf2, &pidl))) 1574 { 1575 for (i=0; i<cidl; i++) 1576 { 1577 SHGetPathFromIDListA(pidl, szSrcPath); 1578 PathAddBackslashA(szSrcPath); 1579 _ILSimpleGetText(apidl[i], szSrcPath+strlen(szSrcPath), MAX_PATH); 1580 1581 strcpy(szDstPath, This->sMyPath); 1582 PathAddBackslashA(szDstPath); 1583 _ILSimpleGetText(apidl[i], szDstPath+strlen(szDstPath), MAX_PATH); 1584 MESSAGE("would copy %s to %s\n", szSrcPath, szDstPath); 1585 } 1586 SHFree(pidl); 1587 } 1588 IPersistFolder2_Release(ppf2); 1589 } 1590 return S_OK; 1591 } 1592 1593 static ICOM_VTABLE(ISFHelper) shvt = 1594 { 1595 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 1596 ISFHelper_fnQueryInterface, 1597 ISFHelper_fnAddRef, 1598 ISFHelper_fnRelease, 1599 ISFHelper_fnGetUniqueName, 1600 ISFHelper_fnAddFolder, 1601 ISFHelper_fnDeleteItems, 1602 ISFHelper_fnCopyItems, 1602 1603 }; 1603 1604 1604 1605 /*********************************************************************** 1605 * [Desktopfolder]IShellFolder implementation1606 * [Desktopfolder] IShellFolder implementation 1606 1607 */ 1607 1608 static struct ICOM_VTABLE(IShellFolder2) sfdvt; … … 1618 1619 1619 1620 /************************************************************************** 1620 * ISF_Desktop_Constructor1621 * ISF_Desktop_Constructor 1621 1622 * 1622 1623 */ 1623 1624 IShellFolder * ISF_Desktop_Constructor() 1624 1625 { 1625 IGenericSFImpl *sf;1626 1627 sf=(IGenericSFImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IGenericSFImpl));1628 sf->ref=1;1629 ICOM_VTBL(sf)=&unkvt;1630 sf->lpvtblShellFolder=&sfdvt;1631 sf->absPidl=_ILCreateDesktop();/* my qualified pidl */1632 sf->pUnkOuter = (IUnknown *) &sf->lpVtbl;1633 1634 TRACE("(%p)\n",sf);1635 1636 shell32_ObjCount++;1637 return _IShellFolder_(sf);1638 } 1639 1640 /************************************************************************** 1641 * ISF_Desktop_fnQueryInterface1626 IGenericSFImpl * sf; 1627 1628 sf=(IGenericSFImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IGenericSFImpl)); 1629 sf->ref=1; 1630 ICOM_VTBL(sf)=&unkvt; 1631 sf->lpvtblShellFolder=&sfdvt; 1632 sf->absPidl=_ILCreateDesktop(); /* my qualified pidl */ 1633 sf->pUnkOuter = (IUnknown *) &sf->lpVtbl; 1634 1635 TRACE("(%p)\n",sf); 1636 1637 shell32_ObjCount++; 1638 return _IShellFolder_(sf); 1639 } 1640 1641 /************************************************************************** 1642 * ISF_Desktop_fnQueryInterface 1642 1643 * 1643 1644 * NOTES supports not IPersist/IPersistFolder 1644 1645 */ 1645 1646 static HRESULT WINAPI ISF_Desktop_fnQueryInterface( 1646 IShellFolder2 * iface,1647 REFIID riid,1648 LPVOID *ppvObj)1649 { 1650 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)1651 1652 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj);1653 1654 *ppvObj = NULL;1655 1656 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/1657 {1658 *ppvObj = _IUnknown_(This); 1659 }1660 else if(IsEqualIID(riid, &IID_IShellFolder)) /*IShellFolder*/1661 {1662 *ppvObj = _IShellFolder_(This);1663 } 1664 else if(IsEqualIID(riid, &IID_IShellFolder2)) /*IShellFolder2*/1665 {1666 *ppvObj = _IShellFolder_(This);1667 } 1668 1669 if(*ppvObj)1670 {1671 IUnknown_AddRef((IUnknown*)(*ppvObj));1672 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);1673 return S_OK;1674 }1675 TRACE("-- Interface: E_NOINTERFACE\n");1676 return E_NOINTERFACE;1677 } 1678 1679 /************************************************************************** 1680 * ISF_Desktop_fnParseDisplayName1647 IShellFolder2 * iface, 1648 REFIID riid, 1649 LPVOID *ppvObj) 1650 { 1651 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 1652 1653 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj); 1654 1655 *ppvObj = NULL; 1656 1657 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/ 1658 { 1659 *ppvObj = _IUnknown_(This); 1660 } 1661 else if(IsEqualIID(riid, &IID_IShellFolder)) /*IShellFolder*/ 1662 { 1663 *ppvObj = _IShellFolder_(This); 1664 } 1665 else if(IsEqualIID(riid, &IID_IShellFolder2)) /*IShellFolder2*/ 1666 { 1667 *ppvObj = _IShellFolder_(This); 1668 } 1669 1670 if(*ppvObj) 1671 { 1672 IUnknown_AddRef((IUnknown*)(*ppvObj)); 1673 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj); 1674 return S_OK; 1675 } 1676 TRACE("-- Interface: E_NOINTERFACE\n"); 1677 return E_NOINTERFACE; 1678 } 1679 1680 /************************************************************************** 1681 * ISF_Desktop_fnParseDisplayName 1681 1682 * 1682 1683 * NOTES 1683 * "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}" and "" binds1684 * to MyComputer1684 * "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}" and "" binds 1685 * to MyComputer 1685 1686 */ 1686 1687 static HRESULT WINAPI ISF_Desktop_fnParseDisplayName( 1687 IShellFolder2 * iface,1688 HWND hwndOwner,1689 LPBC pbcReserved,1690 LPOLESTR lpszDisplayName,1691 DWORD *pchEaten,1692 LPITEMIDLIST *ppidl,1693 DWORD *pdwAttributes)1694 { 1695 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)1696 1697 LPCWSTRszNext=NULL;1698 LPITEMIDLISTpidlTemp=NULL;1699 HRESULThr=E_OUTOFMEMORY;1700 1701 TRACE("(%p)->(HWND=0x%08x,%p,%p=%s,%p,pidl=%p,%p)\n",1702 This,hwndOwner,pbcReserved,lpszDisplayName,1703 debugstr_w(lpszDisplayName),pchEaten,ppidl,pdwAttributes);1704 1705 *ppidl = 0;1706 if (pchEaten) *pchEaten = 0;/* strange but like the original */1707 1708 /* fixme no real parsing implemented */1709 pidlTemp = _ILCreateMyComputer();1710 szNext = lpszDisplayName;1711 1712 if (szNext && *szNext)1713 {1714 hr = SHELL32_ParseNextElement(hwndOwner, iface, &pidlTemp, (LPOLESTR)szNext, pchEaten, pdwAttributes);1715 }1716 else1717 {1718 hr = S_OK;1719 1720 if (pdwAttributes && *pdwAttributes)1721 {1722 SHELL32_GetItemAttributes(_IShellFolder_(This), pidlTemp, pdwAttributes);1723 }1724 }1725 1726 *ppidl = pidlTemp;1727 1728 TRACE("(%p)->(-- ret=0x%08lx)\n", This, hr);1729 1730 return hr; 1731 } 1732 1733 /************************************************************************** 1734 * ISF_Desktop_fnEnumObjects1688 IShellFolder2 * iface, 1689 HWND hwndOwner, 1690 LPBC pbcReserved, 1691 LPOLESTR lpszDisplayName, 1692 DWORD *pchEaten, 1693 LPITEMIDLIST *ppidl, 1694 DWORD *pdwAttributes) 1695 { 1696 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 1697 1698 LPCWSTR szNext=NULL; 1699 LPITEMIDLIST pidlTemp=NULL; 1700 HRESULT hr=E_OUTOFMEMORY; 1701 1702 TRACE("(%p)->(HWND=0x%08x,%p,%p=%s,%p,pidl=%p,%p)\n", 1703 This,hwndOwner,pbcReserved,lpszDisplayName, 1704 debugstr_w(lpszDisplayName),pchEaten,ppidl,pdwAttributes); 1705 1706 *ppidl = 0; 1707 if (pchEaten) *pchEaten = 0; /* strange but like the original */ 1708 1709 /* fixme no real parsing implemented */ 1710 pidlTemp = _ILCreateMyComputer(); 1711 szNext = lpszDisplayName; 1712 1713 if (szNext && *szNext) 1714 { 1715 hr = SHELL32_ParseNextElement(hwndOwner, iface, &pidlTemp, (LPOLESTR)szNext, pchEaten, pdwAttributes); 1716 } 1717 else 1718 { 1719 hr = S_OK; 1720 1721 if (pdwAttributes && *pdwAttributes) 1722 { 1723 SHELL32_GetItemAttributes(_IShellFolder_(This), pidlTemp, pdwAttributes); 1724 } 1725 } 1726 1727 *ppidl = pidlTemp; 1728 1729 TRACE("(%p)->(-- ret=0x%08lx)\n", This, hr); 1730 1731 return hr; 1732 } 1733 1734 /************************************************************************** 1735 * ISF_Desktop_fnEnumObjects 1735 1736 */ 1736 1737 static HRESULT WINAPI ISF_Desktop_fnEnumObjects( 1737 IShellFolder2 * iface,1738 HWND hwndOwner,1739 DWORD dwFlags,1740 LPENUMIDLIST* ppEnumIDList)1741 { 1742 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)1743 1744 TRACE("(%p)->(HWND=0x%08x flags=0x%08lx pplist=%p)\n",This,hwndOwner,dwFlags,ppEnumIDList);1745 1746 *ppEnumIDList = NULL;1747 *ppEnumIDList = IEnumIDList_Constructor (NULL, dwFlags, EIDL_DESK);1748 1749 TRACE("-- (%p)->(new ID List: %p)\n",This,*ppEnumIDList);1750 1751 if(!*ppEnumIDList) return E_OUTOFMEMORY;1752 1753 return S_OK; 1754 } 1755 1756 /************************************************************************** 1757 * ISF_Desktop_fnBindToObject1738 IShellFolder2 * iface, 1739 HWND hwndOwner, 1740 DWORD dwFlags, 1741 LPENUMIDLIST* ppEnumIDList) 1742 { 1743 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 1744 1745 TRACE("(%p)->(HWND=0x%08x flags=0x%08lx pplist=%p)\n",This,hwndOwner,dwFlags,ppEnumIDList); 1746 1747 *ppEnumIDList = NULL; 1748 *ppEnumIDList = IEnumIDList_Constructor (NULL, dwFlags, EIDL_DESK); 1749 1750 TRACE("-- (%p)->(new ID List: %p)\n",This,*ppEnumIDList); 1751 1752 if(!*ppEnumIDList) return E_OUTOFMEMORY; 1753 1754 return S_OK; 1755 } 1756 1757 /************************************************************************** 1758 * ISF_Desktop_fnBindToObject 1758 1759 */ 1759 1760 static HRESULT WINAPI ISF_Desktop_fnBindToObject( IShellFolder2 * iface, LPCITEMIDLIST pidl, 1760 LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)1761 { 1762 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)1763 GUIDconst * clsid;1764 IShellFolder*pShellFolder, *pSubFolder;1765 1766 TRACE("(%p)->(pidl=%p,%p,\n\tIID:\t%s,%p)\n",1761 LPBC pbcReserved, REFIID riid, LPVOID * ppvOut) 1762 { 1763 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 1764 GUID const * clsid; 1765 IShellFolder *pShellFolder, *pSubFolder; 1766 1767 TRACE("(%p)->(pidl=%p,%p,\n\tIID:\t%s,%p)\n", 1767 1768 This,pidl,pbcReserved,debugstr_guid(riid),ppvOut); 1768 1769 1769 *ppvOut = NULL;1770 1771 if ((clsid=_ILGetGUIDPointer(pidl)))1772 {1773 if ( IsEqualIID(clsid, &CLSID_MyComputer))1774 {1775 pShellFolder = ISF_MyComputer_Constructor();1776 }1777 else 1778 {1779 /* shell extension */1780 if (!SUCCEEDED(SHELL32_CoCreateInitSF (This->absPidl, pidl, clsid, riid, (LPVOID*)&pShellFolder)))1781 {1782 return E_INVALIDARG;1783 }1784 }1785 } 1786 else1787 {1788 /* file system folder on the desktop */1789 LPITEMIDLIST deskpidl, firstpidl, completepidl;1790 IPersistFolder * ppf;1791 1792 /* combine pidls */1793 SHGetSpecialFolderLocation(0, CSIDL_DESKTOPDIRECTORY, &deskpidl);1794 firstpidl = ILCloneFirst(pidl);1795 completepidl = ILCombine(deskpidl, firstpidl);1796 1797 pShellFolder = IShellFolder_Constructor(NULL, NULL);1798 if (SUCCEEDED(IShellFolder_QueryInterface(pShellFolder, &IID_IPersistFolder, (LPVOID*)&ppf)))1799 {1800 IPersistFolder_Initialize(ppf, completepidl);1801 IPersistFolder_Release(ppf);1802 }1803 ILFree(completepidl);1804 ILFree(deskpidl);1805 ILFree(firstpidl);1806 }1807 1808 if (_ILIsPidlSimple(pidl))/* no sub folders */1809 {1810 *ppvOut = pShellFolder;1811 }1812 else/* go deeper */1813 {1814 IShellFolder_BindToObject(pShellFolder, ILGetNext(pidl), NULL, riid, (LPVOID)&pSubFolder);1815 IShellFolder_Release(pShellFolder);1816 *ppvOut = pSubFolder;1817 }1818 1819 TRACE("-- (%p) returning (%p)\n",This, *ppvOut);1820 1821 return S_OK;1822 } 1823 1824 /************************************************************************** 1825 * ISF_Desktop_fnCreateViewObject1770 *ppvOut = NULL; 1771 1772 if ((clsid=_ILGetGUIDPointer(pidl))) 1773 { 1774 if ( IsEqualIID(clsid, &CLSID_MyComputer)) 1775 { 1776 pShellFolder = ISF_MyComputer_Constructor(); 1777 } 1778 else 1779 { 1780 /* shell extension */ 1781 if (!SUCCEEDED(SHELL32_CoCreateInitSF (This->absPidl, pidl, clsid, riid, (LPVOID*)&pShellFolder))) 1782 { 1783 return E_INVALIDARG; 1784 } 1785 } 1786 } 1787 else 1788 { 1789 /* file system folder on the desktop */ 1790 LPITEMIDLIST deskpidl, firstpidl, completepidl; 1791 IPersistFolder * ppf; 1792 1793 /* combine pidls */ 1794 SHGetSpecialFolderLocation(0, CSIDL_DESKTOPDIRECTORY, &deskpidl); 1795 firstpidl = ILCloneFirst(pidl); 1796 completepidl = ILCombine(deskpidl, firstpidl); 1797 1798 pShellFolder = IShellFolder_Constructor(NULL, NULL); 1799 if (SUCCEEDED(IShellFolder_QueryInterface(pShellFolder, &IID_IPersistFolder, (LPVOID*)&ppf))) 1800 { 1801 IPersistFolder_Initialize(ppf, completepidl); 1802 IPersistFolder_Release(ppf); 1803 } 1804 ILFree(completepidl); 1805 ILFree(deskpidl); 1806 ILFree(firstpidl); 1807 } 1808 1809 if (_ILIsPidlSimple(pidl)) /* no sub folders */ 1810 { 1811 *ppvOut = pShellFolder; 1812 } 1813 else /* go deeper */ 1814 { 1815 IShellFolder_BindToObject(pShellFolder, ILGetNext(pidl), NULL, riid, (LPVOID)&pSubFolder); 1816 IShellFolder_Release(pShellFolder); 1817 *ppvOut = pSubFolder; 1818 } 1819 1820 TRACE("-- (%p) returning (%p)\n",This, *ppvOut); 1821 1822 return S_OK; 1823 } 1824 1825 /************************************************************************** 1826 * ISF_Desktop_fnCreateViewObject 1826 1827 */ 1827 1828 static HRESULT WINAPI ISF_Desktop_fnCreateViewObject( IShellFolder2 * iface, 1828 HWND hwndOwner, REFIID riid, LPVOID *ppvOut)1829 { 1830 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)1831 1832 LPSHELLVIEWpShellView;1833 HRESULThr = E_INVALIDARG;1834 1835 TRACE("(%p)->(hwnd=0x%x,\n\tIID:\t%s,%p)\n",This,hwndOwner,debugstr_guid(riid),ppvOut);1836 1837 if(ppvOut)1838 {1839 *ppvOut = NULL;1840 1841 if(IsEqualIID(riid, &IID_IDropTarget))1842 {1843 WARN("IDropTarget not implemented\n");1844 hr = E_NOTIMPL;1845 }1846 else if(IsEqualIID(riid, &IID_IContextMenu))1847 {1848 WARN("IContextMenu not implemented\n");1849 hr = E_NOTIMPL;1850 }1851 else if(IsEqualIID(riid, &IID_IShellView))1852 {1853 pShellView = IShellView_Constructor((IShellFolder*)iface);1854 if(pShellView)1855 {1856 hr = IShellView_QueryInterface(pShellView, riid, ppvOut);1857 IShellView_Release(pShellView);1858 }1859 }1860 }1861 TRACE("-- (%p)->(interface=%p)\n",This, ppvOut);1862 return hr; 1829 HWND hwndOwner, REFIID riid, LPVOID *ppvOut) 1830 { 1831 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 1832 1833 LPSHELLVIEW pShellView; 1834 HRESULT hr = E_INVALIDARG; 1835 1836 TRACE("(%p)->(hwnd=0x%x,\n\tIID:\t%s,%p)\n",This,hwndOwner,debugstr_guid(riid),ppvOut); 1837 1838 if(ppvOut) 1839 { 1840 *ppvOut = NULL; 1841 1842 if(IsEqualIID(riid, &IID_IDropTarget)) 1843 { 1844 WARN("IDropTarget not implemented\n"); 1845 hr = E_NOTIMPL; 1846 } 1847 else if(IsEqualIID(riid, &IID_IContextMenu)) 1848 { 1849 WARN("IContextMenu not implemented\n"); 1850 hr = E_NOTIMPL; 1851 } 1852 else if(IsEqualIID(riid, &IID_IShellView)) 1853 { 1854 pShellView = IShellView_Constructor((IShellFolder*)iface); 1855 if(pShellView) 1856 { 1857 hr = IShellView_QueryInterface(pShellView, riid, ppvOut); 1858 IShellView_Release(pShellView); 1859 } 1860 } 1861 } 1862 TRACE("-- (%p)->(interface=%p)\n",This, ppvOut); 1863 return hr; 1863 1864 } 1864 1865 … … 1867 1868 */ 1868 1869 static HRESULT WINAPI ISF_Desktop_fnGetAttributesOf( 1869 IShellFolder2 * iface,1870 UINT cidl,1871 LPCITEMIDLIST *apidl,1872 DWORD *rgfInOut)1873 { 1874 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)1875 1876 HRESULThr = S_OK;1877 1878 TRACE("(%p)->(cidl=%d apidl=%p mask=0x%08lx)\n",This,cidl,apidl, *rgfInOut);1879 1880 if ( (!cidl) || (!apidl) || (!rgfInOut))1881 return E_INVALIDARG;1882 1883 while (cidl > 0 && *apidl)1884 {1885 pdump (*apidl);1886 SHELL32_GetItemAttributes(_IShellFolder_(This), *apidl, rgfInOut);1887 apidl++;1888 cidl--;1889 }1890 1891 TRACE("-- result=0x%08lx\n",*rgfInOut);1892 1893 return hr;1894 } 1895 1896 /************************************************************************** 1897 * ISF_Desktop_fnGetDisplayNameOf1870 IShellFolder2 * iface, 1871 UINT cidl, 1872 LPCITEMIDLIST *apidl, 1873 DWORD *rgfInOut) 1874 { 1875 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 1876 1877 HRESULT hr = S_OK; 1878 1879 TRACE("(%p)->(cidl=%d apidl=%p mask=0x%08lx)\n",This,cidl,apidl, *rgfInOut); 1880 1881 if ( (!cidl) || (!apidl) || (!rgfInOut)) 1882 return E_INVALIDARG; 1883 1884 while (cidl > 0 && *apidl) 1885 { 1886 pdump (*apidl); 1887 SHELL32_GetItemAttributes(_IShellFolder_(This), *apidl, rgfInOut); 1888 apidl++; 1889 cidl--; 1890 } 1891 1892 TRACE("-- result=0x%08lx\n",*rgfInOut); 1893 1894 return hr; 1895 } 1896 1897 /************************************************************************** 1898 * ISF_Desktop_fnGetDisplayNameOf 1898 1899 * 1899 1900 * NOTES 1900 * special case: pidl = null gives desktop-name back1901 * special case: pidl = null gives desktop-name back 1901 1902 */ 1902 1903 static HRESULT WINAPI ISF_Desktop_fnGetDisplayNameOf( 1903 IShellFolder2 * iface,1904 LPCITEMIDLIST pidl,1905 DWORD dwFlags,1906 LPSTRRET strRet)1907 { 1908 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)1909 1910 CHARszPath[MAX_PATH]= "";1911 1912 TRACE("(%p)->(pidl=%p,0x%08lx,%p)\n",This,pidl,dwFlags,strRet);1913 pdump(pidl);1914 1915 if(!strRet) return E_INVALIDARG;1916 1917 if(!pidl)1918 {1919 HCR_GetClassName(&CLSID_ShellDesktop, szPath, MAX_PATH);1920 }1921 else if ( _ILIsPidlSimple(pidl) )1922 {1923 _ILSimpleGetText(pidl, szPath, MAX_PATH);1924 }1925 else1926 { 1927 if (!SUCCEEDED(SHELL32_GetDisplayNameOfChild(iface, pidl, dwFlags, szPath, MAX_PATH)))1928 return E_OUTOFMEMORY;1929 }1930 strRet->uType = STRRET_CSTRA;1931 lstrcpynA(strRet->u.cStr, szPath, MAX_PATH);1932 1933 1934 TRACE("-- (%p)->(%s)\n", This, szPath);1935 return S_OK;1904 IShellFolder2 * iface, 1905 LPCITEMIDLIST pidl, 1906 DWORD dwFlags, 1907 LPSTRRET strRet) 1908 { 1909 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 1910 1911 CHAR szPath[MAX_PATH]= ""; 1912 1913 TRACE("(%p)->(pidl=%p,0x%08lx,%p)\n",This,pidl,dwFlags,strRet); 1914 pdump(pidl); 1915 1916 if(!strRet) return E_INVALIDARG; 1917 1918 if(!pidl) 1919 { 1920 HCR_GetClassName(&CLSID_ShellDesktop, szPath, MAX_PATH); 1921 } 1922 else if ( _ILIsPidlSimple(pidl) ) 1923 { 1924 _ILSimpleGetText(pidl, szPath, MAX_PATH); 1925 } 1926 else 1927 { 1928 if (!SUCCEEDED(SHELL32_GetDisplayNameOfChild(iface, pidl, dwFlags, szPath, MAX_PATH))) 1929 return E_OUTOFMEMORY; 1930 } 1931 strRet->uType = STRRET_CSTRA; 1932 lstrcpynA(strRet->u.cStr, szPath, MAX_PATH); 1933 1934 1935 TRACE("-- (%p)->(%s)\n", This, szPath); 1936 return S_OK; 1936 1937 } 1937 1938 1938 1939 static HRESULT WINAPI ISF_Desktop_fnGetDefaultSearchGUID( 1939 IShellFolder2 * iface,1940 GUID *pguid)1941 { 1942 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)1943 FIXME("(%p)\n",This);1944 return E_NOTIMPL;1945 } 1940 IShellFolder2 * iface, 1941 GUID *pguid) 1942 { 1943 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 1944 FIXME("(%p)\n",This); 1945 return E_NOTIMPL; 1946 } 1946 1947 static HRESULT WINAPI ISF_Desktop_fnEnumSearches( 1947 IShellFolder2 * iface,1948 IEnumExtraSearch **ppenum)1949 { 1950 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)1951 FIXME("(%p)\n",This);1952 return E_NOTIMPL;1953 } 1948 IShellFolder2 * iface, 1949 IEnumExtraSearch **ppenum) 1950 { 1951 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 1952 FIXME("(%p)\n",This); 1953 return E_NOTIMPL; 1954 } 1954 1955 static HRESULT WINAPI ISF_Desktop_fnGetDefaultColumn( 1955 IShellFolder2 * iface,1956 DWORD dwRes,1957 ULONG *pSort,1958 ULONG *pDisplay)1959 { 1960 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)1961 1962 TRACE("(%p)\n",This);1963 1964 if (pSort) *pSort = 0;1965 if (pDisplay) *pDisplay = 0;1966 1967 return S_OK;1968 } 1956 IShellFolder2 * iface, 1957 DWORD dwRes, 1958 ULONG *pSort, 1959 ULONG *pDisplay) 1960 { 1961 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 1962 1963 TRACE("(%p)\n",This); 1964 1965 if (pSort) *pSort = 0; 1966 if (pDisplay) *pDisplay = 0; 1967 1968 return S_OK; 1969 } 1969 1970 static HRESULT WINAPI ISF_Desktop_fnGetDefaultColumnState( 1970 IShellFolder2 * iface,1971 UINT iColumn,1972 DWORD *pcsFlags)1973 { 1974 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)1975 1976 TRACE("(%p)\n",This);1977 1978 if (!pcsFlags || iColumn >= DESKTOPSHELLVIEWCOLUMNS ) return E_INVALIDARG;1979 1980 *pcsFlags = DesktopSFHeader[iColumn].pcsFlags;1981 1982 return S_OK;1983 } 1971 IShellFolder2 * iface, 1972 UINT iColumn, 1973 DWORD *pcsFlags) 1974 { 1975 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 1976 1977 TRACE("(%p)\n",This); 1978 1979 if (!pcsFlags || iColumn >= DESKTOPSHELLVIEWCOLUMNS ) return E_INVALIDARG; 1980 1981 *pcsFlags = DesktopSFHeader[iColumn].pcsFlags; 1982 1983 return S_OK; 1984 } 1984 1985 static HRESULT WINAPI ISF_Desktop_fnGetDetailsEx( 1985 IShellFolder2 * iface,1986 LPCITEMIDLIST pidl,1987 const SHCOLUMNID *pscid,1988 VARIANT *pv)1989 { 1990 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)1991 FIXME("(%p)\n",This);1992 1993 return E_NOTIMPL;1994 } 1986 IShellFolder2 * iface, 1987 LPCITEMIDLIST pidl, 1988 const SHCOLUMNID *pscid, 1989 VARIANT *pv) 1990 { 1991 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 1992 FIXME("(%p)\n",This); 1993 1994 return E_NOTIMPL; 1995 } 1995 1996 static HRESULT WINAPI ISF_Desktop_fnGetDetailsOf( 1996 IShellFolder2 * iface,1997 LPCITEMIDLIST pidl,1998 UINT iColumn,1999 SHELLDETAILS *psd)2000 { 2001 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)2002 HRESULT hr = E_FAIL;;2003 2004 TRACE("(%p)->(%p %i %p)\n",This, pidl, iColumn, psd);2005 2006 if (!psd || iColumn >= DESKTOPSHELLVIEWCOLUMNS ) return E_INVALIDARG;2007 2008 if (!pidl)2009 {2010 psd->fmt = DesktopSFHeader[iColumn].fmt;2011 psd->cxChar = DesktopSFHeader[iColumn].cxChar;2012 psd->str.uType = STRRET_CSTRA;2013 LoadStringA(shell32_hInstance, DesktopSFHeader[iColumn].colnameid, psd->str.u.cStr, MAX_PATH);2014 return S_OK;2015 }2016 else2017 {2018 /* the data from the pidl */2019 switch(iColumn)2020 {2021 case 0:/* name */2022 hr = IShellFolder_GetDisplayNameOf(iface, pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str);2023 break;2024 case 1:/* size */2025 _ILGetFileSize (pidl, psd->str.u.cStr, MAX_PATH);2026 break;2027 case 2:/* type */2028 _ILGetFileType(pidl, psd->str.u.cStr, MAX_PATH);2029 break;2030 case 3:/* date */2031 _ILGetFileDate(pidl, psd->str.u.cStr, MAX_PATH);2032 break;2033 case 4:/* attributes */2034 _ILGetFileAttributes(pidl, psd->str.u.cStr, MAX_PATH);2035 break;2036 }2037 hr = S_OK;2038 psd->str.uType = STRRET_CSTRA;2039 }2040 2041 return hr;2042 } 1997 IShellFolder2 * iface, 1998 LPCITEMIDLIST pidl, 1999 UINT iColumn, 2000 SHELLDETAILS *psd) 2001 { 2002 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 2003 HRESULT hr = E_FAIL;; 2004 2005 TRACE("(%p)->(%p %i %p)\n",This, pidl, iColumn, psd); 2006 2007 if (!psd || iColumn >= DESKTOPSHELLVIEWCOLUMNS ) return E_INVALIDARG; 2008 2009 if (!pidl) 2010 { 2011 psd->fmt = DesktopSFHeader[iColumn].fmt; 2012 psd->cxChar = DesktopSFHeader[iColumn].cxChar; 2013 psd->str.uType = STRRET_CSTRA; 2014 LoadStringA(shell32_hInstance, DesktopSFHeader[iColumn].colnameid, psd->str.u.cStr, MAX_PATH); 2015 return S_OK; 2016 } 2017 else 2018 { 2019 /* the data from the pidl */ 2020 switch(iColumn) 2021 { 2022 case 0: /* name */ 2023 hr = IShellFolder_GetDisplayNameOf(iface, pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str); 2024 break; 2025 case 1: /* size */ 2026 _ILGetFileSize (pidl, psd->str.u.cStr, MAX_PATH); 2027 break; 2028 case 2: /* type */ 2029 _ILGetFileType(pidl, psd->str.u.cStr, MAX_PATH); 2030 break; 2031 case 3: /* date */ 2032 _ILGetFileDate(pidl, psd->str.u.cStr, MAX_PATH); 2033 break; 2034 case 4: /* attributes */ 2035 _ILGetFileAttributes(pidl, psd->str.u.cStr, MAX_PATH); 2036 break; 2037 } 2038 hr = S_OK; 2039 psd->str.uType = STRRET_CSTRA; 2040 } 2041 2042 return hr; 2043 } 2043 2044 static HRESULT WINAPI ISF_Desktop_fnMapNameToSCID( 2044 IShellFolder2 * iface,2045 LPCWSTR pwszName,2046 SHCOLUMNID *pscid)2047 { 2048 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)2049 FIXME("(%p)\n",This);2050 return E_NOTIMPL;2051 } 2052 2053 static ICOM_VTABLE(IShellFolder2) sfdvt = 2054 { 2055 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE2056 ISF_Desktop_fnQueryInterface,2057 IShellFolder_fnAddRef,2058 IShellFolder_fnRelease,2059 ISF_Desktop_fnParseDisplayName,2060 ISF_Desktop_fnEnumObjects,2061 ISF_Desktop_fnBindToObject,2062 IShellFolder_fnBindToStorage,2063 IShellFolder_fnCompareIDs,2064 ISF_Desktop_fnCreateViewObject,2065 ISF_Desktop_fnGetAttributesOf,2066 IShellFolder_fnGetUIObjectOf,2067 ISF_Desktop_fnGetDisplayNameOf,2068 IShellFolder_fnSetNameOf,2069 2070 /* ShellFolder2 */2071 ISF_Desktop_fnGetDefaultSearchGUID,2072 ISF_Desktop_fnEnumSearches,2073 ISF_Desktop_fnGetDefaultColumn,2074 ISF_Desktop_fnGetDefaultColumnState,2075 ISF_Desktop_fnGetDetailsEx,2076 ISF_Desktop_fnGetDetailsOf,2077 ISF_Desktop_fnMapNameToSCID2045 IShellFolder2 * iface, 2046 LPCWSTR pwszName, 2047 SHCOLUMNID *pscid) 2048 { 2049 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 2050 FIXME("(%p)\n",This); 2051 return E_NOTIMPL; 2052 } 2053 2054 static ICOM_VTABLE(IShellFolder2) sfdvt = 2055 { 2056 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 2057 ISF_Desktop_fnQueryInterface, 2058 IShellFolder_fnAddRef, 2059 IShellFolder_fnRelease, 2060 ISF_Desktop_fnParseDisplayName, 2061 ISF_Desktop_fnEnumObjects, 2062 ISF_Desktop_fnBindToObject, 2063 IShellFolder_fnBindToStorage, 2064 IShellFolder_fnCompareIDs, 2065 ISF_Desktop_fnCreateViewObject, 2066 ISF_Desktop_fnGetAttributesOf, 2067 IShellFolder_fnGetUIObjectOf, 2068 ISF_Desktop_fnGetDisplayNameOf, 2069 IShellFolder_fnSetNameOf, 2070 2071 /* ShellFolder2 */ 2072 ISF_Desktop_fnGetDefaultSearchGUID, 2073 ISF_Desktop_fnEnumSearches, 2074 ISF_Desktop_fnGetDefaultColumn, 2075 ISF_Desktop_fnGetDefaultColumnState, 2076 ISF_Desktop_fnGetDetailsEx, 2077 ISF_Desktop_fnGetDetailsOf, 2078 ISF_Desktop_fnMapNameToSCID 2078 2079 }; 2079 2080 … … 2095 2096 2096 2097 /************************************************************************** 2097 * ISF_MyComputer_Constructor2098 * ISF_MyComputer_Constructor 2098 2099 */ 2099 2100 static IShellFolder * ISF_MyComputer_Constructor(void) 2100 2101 { 2101 IGenericSFImpl *sf;2102 2103 sf=(IGenericSFImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IGenericSFImpl));2104 sf->ref=1;2105 2106 ICOM_VTBL(sf)=&unkvt;2107 sf->lpvtblShellFolder=&sfmcvt;2108 sf->lpvtblPersistFolder2 = &psfvt;2109 sf->pclsid = (CLSID*)&CLSID_SFMyComp;2110 sf->absPidl=_ILCreateMyComputer();/* my qualified pidl */2111 sf->pUnkOuter = (IUnknown *) &sf->lpVtbl;2112 2113 TRACE("(%p)\n",sf);2114 2115 shell32_ObjCount++;2116 return _IShellFolder_(sf);2117 } 2118 2119 /************************************************************************** 2120 * ISF_MyComputer_fnParseDisplayName2102 IGenericSFImpl * sf; 2103 2104 sf=(IGenericSFImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IGenericSFImpl)); 2105 sf->ref=1; 2106 2107 ICOM_VTBL(sf)=&unkvt; 2108 sf->lpvtblShellFolder=&sfmcvt; 2109 sf->lpvtblPersistFolder2 = &psfvt; 2110 sf->pclsid = (CLSID*)&CLSID_SFMyComp; 2111 sf->absPidl=_ILCreateMyComputer(); /* my qualified pidl */ 2112 sf->pUnkOuter = (IUnknown *) &sf->lpVtbl; 2113 2114 TRACE("(%p)\n",sf); 2115 2116 shell32_ObjCount++; 2117 return _IShellFolder_(sf); 2118 } 2119 2120 /************************************************************************** 2121 * ISF_MyComputer_fnParseDisplayName 2121 2122 */ 2122 2123 static HRESULT WINAPI ISF_MyComputer_fnParseDisplayName( 2123 IShellFolder2 * iface,2124 HWND hwndOwner,2125 LPBC pbcReserved,2126 LPOLESTR lpszDisplayName,2127 DWORD *pchEaten,2128 LPITEMIDLIST *ppidl,2129 DWORD *pdwAttributes)2130 { 2131 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)2132 2133 HRESULThr = E_OUTOFMEMORY;2134 LPCWSTRszNext=NULL;2135 WCHARszElement[MAX_PATH];2136 CHARszTempA[MAX_PATH];2137 LPITEMIDLISTpidlTemp;2138 2139 TRACE("(%p)->(HWND=0x%08x,%p,%p=%s,%p,pidl=%p,%p)\n",2140 This,hwndOwner,pbcReserved,lpszDisplayName,2141 debugstr_w(lpszDisplayName),pchEaten,ppidl,pdwAttributes);2142 2143 *ppidl = 0;2144 if (pchEaten) *pchEaten = 0;/* strange but like the original */2145 2146 /* do we have an absolute path name ? */2147 if (PathGetDriveNumberW(lpszDisplayName) >= 0 &&2148 lpszDisplayName[2] == (WCHAR)'\\')2149 {2150 szNext = GetNextElementW(lpszDisplayName, szElement, MAX_PATH);2124 IShellFolder2 * iface, 2125 HWND hwndOwner, 2126 LPBC pbcReserved, 2127 LPOLESTR lpszDisplayName, 2128 DWORD *pchEaten, 2129 LPITEMIDLIST *ppidl, 2130 DWORD *pdwAttributes) 2131 { 2132 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 2133 2134 HRESULT hr = E_OUTOFMEMORY; 2135 LPCWSTR szNext=NULL; 2136 WCHAR szElement[MAX_PATH]; 2137 CHAR szTempA[MAX_PATH]; 2138 LPITEMIDLIST pidlTemp; 2139 2140 TRACE("(%p)->(HWND=0x%08x,%p,%p=%s,%p,pidl=%p,%p)\n", 2141 This,hwndOwner,pbcReserved,lpszDisplayName, 2142 debugstr_w(lpszDisplayName),pchEaten,ppidl,pdwAttributes); 2143 2144 *ppidl = 0; 2145 if (pchEaten) *pchEaten = 0; /* strange but like the original */ 2146 2147 /* do we have an absolute path name ? */ 2148 if (PathGetDriveNumberW(lpszDisplayName) >= 0 && 2149 lpszDisplayName[2] == (WCHAR)'\\') 2150 { 2151 szNext = GetNextElementW(lpszDisplayName, szElement, MAX_PATH); 2151 2152 WideCharToMultiByte( CP_ACP, 0, szElement, -1, szTempA, MAX_PATH, NULL, NULL ); 2152 pidlTemp = _ILCreateDrive(szTempA);2153 2154 if (szNext && *szNext)2155 {2156 hr = SHELL32_ParseNextElement(hwndOwner, iface, &pidlTemp, (LPOLESTR)szNext, pchEaten, pdwAttributes);2157 }2158 else2159 {2160 if (pdwAttributes && *pdwAttributes)2161 {2162 SHELL32_GetItemAttributes(_IShellFolder_(This), pidlTemp, pdwAttributes);2163 }2164 hr = S_OK;2165 }2166 *ppidl = pidlTemp;2167 }2168 2169 TRACE("(%p)->(-- ret=0x%08lx)\n", This, hr);2170 2171 return hr; 2172 } 2173 2174 /************************************************************************** 2175 * ISF_MyComputer_fnEnumObjects2153 pidlTemp = _ILCreateDrive(szTempA); 2154 2155 if (szNext && *szNext) 2156 { 2157 hr = SHELL32_ParseNextElement(hwndOwner, iface, &pidlTemp, (LPOLESTR)szNext, pchEaten, pdwAttributes); 2158 } 2159 else 2160 { 2161 if (pdwAttributes && *pdwAttributes) 2162 { 2163 SHELL32_GetItemAttributes(_IShellFolder_(This), pidlTemp, pdwAttributes); 2164 } 2165 hr = S_OK; 2166 } 2167 *ppidl = pidlTemp; 2168 } 2169 2170 TRACE("(%p)->(-- ret=0x%08lx)\n", This, hr); 2171 2172 return hr; 2173 } 2174 2175 /************************************************************************** 2176 * ISF_MyComputer_fnEnumObjects 2176 2177 */ 2177 2178 static HRESULT WINAPI ISF_MyComputer_fnEnumObjects( 2178 IShellFolder2 * iface,2179 HWND hwndOwner,2180 DWORD dwFlags,2181 LPENUMIDLIST* ppEnumIDList)2182 { 2183 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)2184 2185 TRACE("(%p)->(HWND=0x%08x flags=0x%08lx pplist=%p)\n",This,hwndOwner,dwFlags,ppEnumIDList);2186 2187 *ppEnumIDList = NULL;2188 *ppEnumIDList = IEnumIDList_Constructor (NULL, dwFlags, EIDL_MYCOMP);2189 2190 TRACE("-- (%p)->(new ID List: %p)\n",This,*ppEnumIDList);2191 2192 if(!*ppEnumIDList) return E_OUTOFMEMORY;2193 2194 return S_OK; 2195 } 2196 2197 /************************************************************************** 2198 * ISF_MyComputer_fnBindToObject2179 IShellFolder2 * iface, 2180 HWND hwndOwner, 2181 DWORD dwFlags, 2182 LPENUMIDLIST* ppEnumIDList) 2183 { 2184 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 2185 2186 TRACE("(%p)->(HWND=0x%08x flags=0x%08lx pplist=%p)\n",This,hwndOwner,dwFlags,ppEnumIDList); 2187 2188 *ppEnumIDList = NULL; 2189 *ppEnumIDList = IEnumIDList_Constructor (NULL, dwFlags, EIDL_MYCOMP); 2190 2191 TRACE("-- (%p)->(new ID List: %p)\n",This,*ppEnumIDList); 2192 2193 if(!*ppEnumIDList) return E_OUTOFMEMORY; 2194 2195 return S_OK; 2196 } 2197 2198 /************************************************************************** 2199 * ISF_MyComputer_fnBindToObject 2199 2200 */ 2200 2201 static HRESULT WINAPI ISF_MyComputer_fnBindToObject( IShellFolder2 * iface, LPCITEMIDLIST pidl, 2201 LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)2202 { 2203 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)2204 GUIDconst * clsid;2205 IShellFolder*pShellFolder, *pSubFolder;2206 LPITEMIDLISTpidltemp;2207 2208 TRACE("(%p)->(pidl=%p,%p,\n\tIID:\t%s,%p)\n",2202 LPBC pbcReserved, REFIID riid, LPVOID * ppvOut) 2203 { 2204 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 2205 GUID const * clsid; 2206 IShellFolder *pShellFolder, *pSubFolder; 2207 LPITEMIDLIST pidltemp; 2208 2209 TRACE("(%p)->(pidl=%p,%p,\n\tIID:\t%s,%p)\n", 2209 2210 This,pidl,pbcReserved,debugstr_guid(riid),ppvOut); 2210 2211 2211 if(!pidl || !ppvOut) return E_INVALIDARG;2212 2213 *ppvOut = NULL;2214 2215 if ((clsid=_ILGetGUIDPointer(pidl)) && !IsEqualIID(clsid, &CLSID_MyComputer))2216 {2217 if (!SUCCEEDED(SHELL32_CoCreateInitSF (This->absPidl, pidl, clsid, riid, (LPVOID*)&pShellFolder)))2218 {2219 return E_FAIL;2220 }2221 }2222 else2223 {2224 if (!_ILIsDrive(pidl)) return E_INVALIDARG;2225 2226 pidltemp = ILCloneFirst(pidl);2227 pShellFolder = IShellFolder_Constructor(iface, pidltemp);2228 ILFree(pidltemp);2229 }2230 2231 if (_ILIsPidlSimple(pidl))/* no sub folders */2232 {2233 *ppvOut = pShellFolder;2234 }2235 else/* go deeper */2236 {2237 IShellFolder_BindToObject(pShellFolder, ILGetNext(pidl), NULL, &IID_IShellFolder, (LPVOID)&pSubFolder);2238 IShellFolder_Release(pShellFolder);2239 *ppvOut = pSubFolder;2240 }2241 2242 TRACE("-- (%p) returning (%p)\n",This, *ppvOut);2243 2244 return S_OK;2245 } 2246 2247 /************************************************************************** 2248 * ISF_MyComputer_fnCreateViewObject2212 if(!pidl || !ppvOut) return E_INVALIDARG; 2213 2214 *ppvOut = NULL; 2215 2216 if ((clsid=_ILGetGUIDPointer(pidl)) && !IsEqualIID(clsid, &CLSID_MyComputer)) 2217 { 2218 if (!SUCCEEDED(SHELL32_CoCreateInitSF (This->absPidl, pidl, clsid, riid, (LPVOID*)&pShellFolder))) 2219 { 2220 return E_FAIL; 2221 } 2222 } 2223 else 2224 { 2225 if (!_ILIsDrive(pidl)) return E_INVALIDARG; 2226 2227 pidltemp = ILCloneFirst(pidl); 2228 pShellFolder = IShellFolder_Constructor(iface, pidltemp); 2229 ILFree(pidltemp); 2230 } 2231 2232 if (_ILIsPidlSimple(pidl)) /* no sub folders */ 2233 { 2234 *ppvOut = pShellFolder; 2235 } 2236 else /* go deeper */ 2237 { 2238 IShellFolder_BindToObject(pShellFolder, ILGetNext(pidl), NULL, &IID_IShellFolder, (LPVOID)&pSubFolder); 2239 IShellFolder_Release(pShellFolder); 2240 *ppvOut = pSubFolder; 2241 } 2242 2243 TRACE("-- (%p) returning (%p)\n",This, *ppvOut); 2244 2245 return S_OK; 2246 } 2247 2248 /************************************************************************** 2249 * ISF_MyComputer_fnCreateViewObject 2249 2250 */ 2250 2251 static HRESULT WINAPI ISF_MyComputer_fnCreateViewObject( IShellFolder2 * iface, 2251 HWND hwndOwner, REFIID riid, LPVOID *ppvOut)2252 { 2253 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)2254 2255 LPSHELLVIEWpShellView;2256 HRESULThr = E_INVALIDARG;2257 2258 TRACE("(%p)->(hwnd=0x%x,\n\tIID:\t%s,%p)\n",This,hwndOwner,debugstr_guid(riid),ppvOut);2259 2260 if(ppvOut)2261 {2262 *ppvOut = NULL;2263 2264 if(IsEqualIID(riid, &IID_IDropTarget))2265 {2266 WARN("IDropTarget not implemented\n");2267 hr = E_NOTIMPL;2268 }2269 else if(IsEqualIID(riid, &IID_IContextMenu))2270 {2271 WARN("IContextMenu not implemented\n");2272 hr = E_NOTIMPL;2273 }2274 else if(IsEqualIID(riid, &IID_IShellView))2275 {2276 pShellView = IShellView_Constructor((IShellFolder*)iface);2277 if(pShellView)2278 {2279 hr = IShellView_QueryInterface(pShellView, riid, ppvOut);2280 IShellView_Release(pShellView);2281 }2282 }2283 }2284 TRACE("-- (%p)->(interface=%p)\n",This, ppvOut);2285 return hr; 2252 HWND hwndOwner, REFIID riid, LPVOID *ppvOut) 2253 { 2254 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 2255 2256 LPSHELLVIEW pShellView; 2257 HRESULT hr = E_INVALIDARG; 2258 2259 TRACE("(%p)->(hwnd=0x%x,\n\tIID:\t%s,%p)\n",This,hwndOwner,debugstr_guid(riid),ppvOut); 2260 2261 if(ppvOut) 2262 { 2263 *ppvOut = NULL; 2264 2265 if(IsEqualIID(riid, &IID_IDropTarget)) 2266 { 2267 WARN("IDropTarget not implemented\n"); 2268 hr = E_NOTIMPL; 2269 } 2270 else if(IsEqualIID(riid, &IID_IContextMenu)) 2271 { 2272 WARN("IContextMenu not implemented\n"); 2273 hr = E_NOTIMPL; 2274 } 2275 else if(IsEqualIID(riid, &IID_IShellView)) 2276 { 2277 pShellView = IShellView_Constructor((IShellFolder*)iface); 2278 if(pShellView) 2279 { 2280 hr = IShellView_QueryInterface(pShellView, riid, ppvOut); 2281 IShellView_Release(pShellView); 2282 } 2283 } 2284 } 2285 TRACE("-- (%p)->(interface=%p)\n",This, ppvOut); 2286 return hr; 2286 2287 } 2287 2288 … … 2290 2291 */ 2291 2292 static HRESULT WINAPI ISF_MyComputer_fnGetAttributesOf( 2292 IShellFolder2 * iface,2293 UINT cidl,2294 LPCITEMIDLIST *apidl,2295 DWORD *rgfInOut)2296 { 2297 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)2298 2299 HRESULThr = S_OK;2300 2301 TRACE("(%p)->(cidl=%d apidl=%p mask=0x%08lx)\n",This,cidl,apidl,*rgfInOut);2302 2303 if ( (!cidl) || (!apidl) || (!rgfInOut))2304 return E_INVALIDARG;2305 2306 while (cidl > 0 && *apidl)2307 {2308 pdump (*apidl);2309 SHELL32_GetItemAttributes(_IShellFolder_(This), *apidl, rgfInOut);2310 apidl++;2311 cidl--;2312 }2313 2314 TRACE("-- result=0x%08lx\n",*rgfInOut);2315 return hr;2316 } 2317 2318 /************************************************************************** 2319 * ISF_MyComputer_fnGetDisplayNameOf2293 IShellFolder2 * iface, 2294 UINT cidl, 2295 LPCITEMIDLIST *apidl, 2296 DWORD *rgfInOut) 2297 { 2298 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 2299 2300 HRESULT hr = S_OK; 2301 2302 TRACE("(%p)->(cidl=%d apidl=%p mask=0x%08lx)\n",This,cidl,apidl,*rgfInOut); 2303 2304 if ( (!cidl) || (!apidl) || (!rgfInOut)) 2305 return E_INVALIDARG; 2306 2307 while (cidl > 0 && *apidl) 2308 { 2309 pdump (*apidl); 2310 SHELL32_GetItemAttributes(_IShellFolder_(This), *apidl, rgfInOut); 2311 apidl++; 2312 cidl--; 2313 } 2314 2315 TRACE("-- result=0x%08lx\n",*rgfInOut); 2316 return hr; 2317 } 2318 2319 /************************************************************************** 2320 * ISF_MyComputer_fnGetDisplayNameOf 2320 2321 * 2321 2322 * NOTES 2322 * The desktopfolder creates only complete paths (SHGDN_FORPARSING).2323 * SHGDN_INFOLDER makes no sense.2323 * The desktopfolder creates only complete paths (SHGDN_FORPARSING). 2324 * SHGDN_INFOLDER makes no sense. 2324 2325 */ 2325 2326 static HRESULT WINAPI ISF_MyComputer_fnGetDisplayNameOf( 2326 IShellFolder2 * iface,2327 LPCITEMIDLIST pidl,2328 DWORD dwFlags,2329 LPSTRRET strRet)2330 { 2331 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)2332 2333 charszPath[MAX_PATH], szDrive[18];2334 intlen = 0;2335 BOOLbSimplePidl;2336 2337 TRACE("(%p)->(pidl=%p,0x%08lx,%p)\n",This,pidl,dwFlags,strRet);2338 pdump(pidl);2339 2340 if(!strRet) return E_INVALIDARG;2341 2342 szPath[0]=0x00; szDrive[0]=0x00;2343 2344 2345 bSimplePidl = _ILIsPidlSimple(pidl);2346 2347 if (_ILIsSpecialFolder(pidl))2348 {2349 /* take names of special folders only if its only this folder */2350 if ( bSimplePidl )2351 {2352 _ILSimpleGetText(pidl, szPath, MAX_PATH); /* append my own path */2353 }2354 }2355 else2356 {2357 if (!_ILIsDrive(pidl))2358 {2359 ERR("Wrong pidl type\n");2360 return E_INVALIDARG;2361 }2362 2363 _ILSimpleGetText(pidl, szPath, MAX_PATH);/* append my own path */2364 2365 /* long view "lw_name (C:)" */2366 if ( bSimplePidl && !(dwFlags & SHGDN_FORPARSING))2367 {2368 DWORD dwVolumeSerialNumber,dwMaximumComponetLength,dwFileSystemFlags;2327 IShellFolder2 * iface, 2328 LPCITEMIDLIST pidl, 2329 DWORD dwFlags, 2330 LPSTRRET strRet) 2331 { 2332 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 2333 2334 char szPath[MAX_PATH], szDrive[18]; 2335 int len = 0; 2336 BOOL bSimplePidl; 2337 2338 TRACE("(%p)->(pidl=%p,0x%08lx,%p)\n",This,pidl,dwFlags,strRet); 2339 pdump(pidl); 2340 2341 if(!strRet) return E_INVALIDARG; 2342 2343 szPath[0]=0x00; szDrive[0]=0x00; 2344 2345 2346 bSimplePidl = _ILIsPidlSimple(pidl); 2347 2348 if (_ILIsSpecialFolder(pidl)) 2349 { 2350 /* take names of special folders only if its only this folder */ 2351 if ( bSimplePidl ) 2352 { 2353 _ILSimpleGetText(pidl, szPath, MAX_PATH); /* append my own path */ 2354 } 2355 } 2356 else 2357 { 2358 if (!_ILIsDrive(pidl)) 2359 { 2360 ERR("Wrong pidl type\n"); 2361 return E_INVALIDARG; 2362 } 2363 2364 _ILSimpleGetText(pidl, szPath, MAX_PATH); /* append my own path */ 2365 2366 /* long view "lw_name (C:)" */ 2367 if ( bSimplePidl && !(dwFlags & SHGDN_FORPARSING)) 2368 { 2369 DWORD dwVolumeSerialNumber,dwMaximumComponetLength,dwFileSystemFlags; 2369 2370 2370 2371 #ifdef __WIN32OS2__ … … 2389 2390 } 2390 2391 #else 2391 GetVolumeInformationA(szPath,szDrive,12,&dwVolumeSerialNumber,&dwMaximumComponetLength,&dwFileSystemFlags,NULL,0);2392 strcat (szDrive," (");2393 strncat (szDrive, szPath, 2);2394 strcat (szDrive,")");2395 strcpy (szPath, szDrive);2392 GetVolumeInformationA(szPath,szDrive,12,&dwVolumeSerialNumber,&dwMaximumComponetLength,&dwFileSystemFlags,NULL,0); 2393 strcat (szDrive," ("); 2394 strncat (szDrive, szPath, 2); 2395 strcat (szDrive,")"); 2396 strcpy (szPath, szDrive); 2396 2397 #endif 2397 }2398 }2399 2400 if (!bSimplePidl)/* go deeper if needed */2401 { 2402 PathAddBackslashA(szPath);2403 len = strlen(szPath);2404 2405 if (!SUCCEEDED(SHELL32_GetDisplayNameOfChild(iface, pidl, dwFlags | SHGDN_FORPARSING, szPath + len, MAX_PATH - len)))2406 return E_OUTOFMEMORY;2407 }2408 strRet->uType = STRRET_CSTRA;2409 lstrcpynA(strRet->u.cStr, szPath, MAX_PATH);2410 2411 2412 TRACE("-- (%p)->(%s)\n", This, szPath);2413 return S_OK;2398 } 2399 } 2400 2401 if (!bSimplePidl) /* go deeper if needed */ 2402 { 2403 PathAddBackslashA(szPath); 2404 len = strlen(szPath); 2405 2406 if (!SUCCEEDED(SHELL32_GetDisplayNameOfChild(iface, pidl, dwFlags | SHGDN_FORPARSING, szPath + len, MAX_PATH - len))) 2407 return E_OUTOFMEMORY; 2408 } 2409 strRet->uType = STRRET_CSTRA; 2410 lstrcpynA(strRet->u.cStr, szPath, MAX_PATH); 2411 2412 2413 TRACE("-- (%p)->(%s)\n", This, szPath); 2414 return S_OK; 2414 2415 } 2415 2416 2416 2417 static HRESULT WINAPI ISF_MyComputer_fnGetDefaultSearchGUID( 2417 IShellFolder2 * iface,2418 GUID *pguid)2419 { 2420 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)2421 FIXME("(%p)\n",This);2422 return E_NOTIMPL;2423 } 2418 IShellFolder2 * iface, 2419 GUID *pguid) 2420 { 2421 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 2422 FIXME("(%p)\n",This); 2423 return E_NOTIMPL; 2424 } 2424 2425 static HRESULT WINAPI ISF_MyComputer_fnEnumSearches( 2425 IShellFolder2 * iface,2426 IEnumExtraSearch **ppenum)2427 { 2428 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)2429 FIXME("(%p)\n",This);2430 return E_NOTIMPL;2431 } 2426 IShellFolder2 * iface, 2427 IEnumExtraSearch **ppenum) 2428 { 2429 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 2430 FIXME("(%p)\n",This); 2431 return E_NOTIMPL; 2432 } 2432 2433 static HRESULT WINAPI ISF_MyComputer_fnGetDefaultColumn( 2433 IShellFolder2 * iface,2434 DWORD dwRes,2435 ULONG *pSort,2436 ULONG *pDisplay)2437 { 2438 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)2439 2440 TRACE("(%p)\n",This);2441 2442 if (pSort) *pSort = 0;2443 if (pDisplay) *pDisplay = 0;2444 2445 return S_OK;2446 } 2434 IShellFolder2 * iface, 2435 DWORD dwRes, 2436 ULONG *pSort, 2437 ULONG *pDisplay) 2438 { 2439 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 2440 2441 TRACE("(%p)\n",This); 2442 2443 if (pSort) *pSort = 0; 2444 if (pDisplay) *pDisplay = 0; 2445 2446 return S_OK; 2447 } 2447 2448 static HRESULT WINAPI ISF_MyComputer_fnGetDefaultColumnState( 2448 IShellFolder2 * iface,2449 UINT iColumn,2450 DWORD *pcsFlags)2451 { 2452 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)2453 2454 TRACE("(%p)\n",This);2455 2456 if (!pcsFlags || iColumn >= MYCOMPUTERSHELLVIEWCOLUMNS ) return E_INVALIDARG;2457 2458 *pcsFlags = MyComputerSFHeader[iColumn].pcsFlags;2459 2460 return S_OK;2461 } 2449 IShellFolder2 * iface, 2450 UINT iColumn, 2451 DWORD *pcsFlags) 2452 { 2453 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 2454 2455 TRACE("(%p)\n",This); 2456 2457 if (!pcsFlags || iColumn >= MYCOMPUTERSHELLVIEWCOLUMNS ) return E_INVALIDARG; 2458 2459 *pcsFlags = MyComputerSFHeader[iColumn].pcsFlags; 2460 2461 return S_OK; 2462 } 2462 2463 static HRESULT WINAPI ISF_MyComputer_fnGetDetailsEx( 2463 IShellFolder2 * iface,2464 LPCITEMIDLIST pidl,2465 const SHCOLUMNID *pscid,2466 VARIANT *pv)2467 { 2468 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)2469 FIXME("(%p)\n",This);2470 2471 return E_NOTIMPL;2472 } 2464 IShellFolder2 * iface, 2465 LPCITEMIDLIST pidl, 2466 const SHCOLUMNID *pscid, 2467 VARIANT *pv) 2468 { 2469 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 2470 FIXME("(%p)\n",This); 2471 2472 return E_NOTIMPL; 2473 } 2473 2474 2474 2475 /* fixme: drive size >4GB is rolling over */ 2475 2476 static HRESULT WINAPI ISF_MyComputer_fnGetDetailsOf( 2476 IShellFolder2 * iface,2477 LPCITEMIDLIST pidl,2478 UINT iColumn,2479 SHELLDETAILS *psd)2480 { 2481 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)2482 HRESULT hr;2483 2484 TRACE("(%p)->(%p %i %p)\n",This, pidl, iColumn, psd);2485 2486 if (!psd || iColumn >= MYCOMPUTERSHELLVIEWCOLUMNS ) return E_INVALIDARG;2487 2488 if (!pidl)2489 {2490 psd->fmt = MyComputerSFHeader[iColumn].fmt;2491 psd->cxChar = MyComputerSFHeader[iColumn].cxChar;2492 psd->str.uType = STRRET_CSTRA;2493 LoadStringA(shell32_hInstance, MyComputerSFHeader[iColumn].colnameid, psd->str.u.cStr, MAX_PATH);2494 return S_OK;2495 }2496 else2497 {2498 char szPath[MAX_PATH];2499 ULARGE_INTEGER ulBytes;2500 2501 psd->str.u.cStr[0] = 0x00;2502 psd->str.uType = STRRET_CSTRA;2503 switch(iColumn)2504 {2505 case 0:/* name */2506 hr = IShellFolder_GetDisplayNameOf(iface, pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str);2507 break;2508 case 1:/* type */2509 _ILGetFileType(pidl, psd->str.u.cStr, MAX_PATH);2510 break;2511 case 2:/* total size */2512 if (_ILIsDrive(pidl))2513 {2514 _ILSimpleGetText(pidl, szPath, MAX_PATH);2515 GetDiskFreeSpaceExA(szPath, NULL, &ulBytes, NULL);2516 StrFormatByteSizeA(ulBytes.s.LowPart, psd->str.u.cStr, MAX_PATH);2517 }2518 break;2519 case 3:/* free size */2520 if (_ILIsDrive(pidl))2521 {2522 _ILSimpleGetText(pidl, szPath, MAX_PATH);2523 GetDiskFreeSpaceExA(szPath, &ulBytes, NULL, NULL);2524 StrFormatByteSizeA(ulBytes.s.LowPart, psd->str.u.cStr, MAX_PATH);2525 }2526 break;2527 }2528 hr = S_OK;2529 }2530 2531 return hr;2532 } 2477 IShellFolder2 * iface, 2478 LPCITEMIDLIST pidl, 2479 UINT iColumn, 2480 SHELLDETAILS *psd) 2481 { 2482 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 2483 HRESULT hr; 2484 2485 TRACE("(%p)->(%p %i %p)\n",This, pidl, iColumn, psd); 2486 2487 if (!psd || iColumn >= MYCOMPUTERSHELLVIEWCOLUMNS ) return E_INVALIDARG; 2488 2489 if (!pidl) 2490 { 2491 psd->fmt = MyComputerSFHeader[iColumn].fmt; 2492 psd->cxChar = MyComputerSFHeader[iColumn].cxChar; 2493 psd->str.uType = STRRET_CSTRA; 2494 LoadStringA(shell32_hInstance, MyComputerSFHeader[iColumn].colnameid, psd->str.u.cStr, MAX_PATH); 2495 return S_OK; 2496 } 2497 else 2498 { 2499 char szPath[MAX_PATH]; 2500 ULARGE_INTEGER ulBytes; 2501 2502 psd->str.u.cStr[0] = 0x00; 2503 psd->str.uType = STRRET_CSTRA; 2504 switch(iColumn) 2505 { 2506 case 0: /* name */ 2507 hr = IShellFolder_GetDisplayNameOf(iface, pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str); 2508 break; 2509 case 1: /* type */ 2510 _ILGetFileType(pidl, psd->str.u.cStr, MAX_PATH); 2511 break; 2512 case 2: /* total size */ 2513 if (_ILIsDrive(pidl)) 2514 { 2515 _ILSimpleGetText(pidl, szPath, MAX_PATH); 2516 GetDiskFreeSpaceExA(szPath, NULL, &ulBytes, NULL); 2517 StrFormatByteSizeA(ulBytes.s.LowPart, psd->str.u.cStr, MAX_PATH); 2518 } 2519 break; 2520 case 3: /* free size */ 2521 if (_ILIsDrive(pidl)) 2522 { 2523 _ILSimpleGetText(pidl, szPath, MAX_PATH); 2524 GetDiskFreeSpaceExA(szPath, &ulBytes, NULL, NULL); 2525 StrFormatByteSizeA(ulBytes.s.LowPart, psd->str.u.cStr, MAX_PATH); 2526 } 2527 break; 2528 } 2529 hr = S_OK; 2530 } 2531 2532 return hr; 2533 } 2533 2534 static HRESULT WINAPI ISF_MyComputer_fnMapNameToSCID( 2534 IShellFolder2 * iface,2535 LPCWSTR pwszName,2536 SHCOLUMNID *pscid)2537 { 2538 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface)2539 FIXME("(%p)\n",This);2540 return E_NOTIMPL;2541 } 2542 2543 static ICOM_VTABLE(IShellFolder2) sfmcvt = 2544 { 2545 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE2546 IShellFolder_fnQueryInterface,2547 IShellFolder_fnAddRef,2548 IShellFolder_fnRelease,2549 ISF_MyComputer_fnParseDisplayName,2550 ISF_MyComputer_fnEnumObjects,2551 ISF_MyComputer_fnBindToObject,2552 IShellFolder_fnBindToStorage,2553 IShellFolder_fnCompareIDs,2554 ISF_MyComputer_fnCreateViewObject,2555 ISF_MyComputer_fnGetAttributesOf,2556 IShellFolder_fnGetUIObjectOf,2557 ISF_MyComputer_fnGetDisplayNameOf,2558 IShellFolder_fnSetNameOf,2559 2560 /* ShellFolder2 */2561 ISF_MyComputer_fnGetDefaultSearchGUID,2562 ISF_MyComputer_fnEnumSearches,2563 ISF_MyComputer_fnGetDefaultColumn,2564 ISF_MyComputer_fnGetDefaultColumnState,2565 ISF_MyComputer_fnGetDetailsEx,2566 ISF_MyComputer_fnGetDetailsOf,2567 ISF_MyComputer_fnMapNameToSCID2535 IShellFolder2 * iface, 2536 LPCWSTR pwszName, 2537 SHCOLUMNID *pscid) 2538 { 2539 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 2540 FIXME("(%p)\n",This); 2541 return E_NOTIMPL; 2542 } 2543 2544 static ICOM_VTABLE(IShellFolder2) sfmcvt = 2545 { 2546 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 2547 IShellFolder_fnQueryInterface, 2548 IShellFolder_fnAddRef, 2549 IShellFolder_fnRelease, 2550 ISF_MyComputer_fnParseDisplayName, 2551 ISF_MyComputer_fnEnumObjects, 2552 ISF_MyComputer_fnBindToObject, 2553 IShellFolder_fnBindToStorage, 2554 IShellFolder_fnCompareIDs, 2555 ISF_MyComputer_fnCreateViewObject, 2556 ISF_MyComputer_fnGetAttributesOf, 2557 IShellFolder_fnGetUIObjectOf, 2558 ISF_MyComputer_fnGetDisplayNameOf, 2559 IShellFolder_fnSetNameOf, 2560 2561 /* ShellFolder2 */ 2562 ISF_MyComputer_fnGetDefaultSearchGUID, 2563 ISF_MyComputer_fnEnumSearches, 2564 ISF_MyComputer_fnGetDefaultColumn, 2565 ISF_MyComputer_fnGetDefaultColumnState, 2566 ISF_MyComputer_fnGetDetailsEx, 2567 ISF_MyComputer_fnGetDetailsOf, 2568 ISF_MyComputer_fnMapNameToSCID 2568 2569 }; 2569 2570 … … 2574 2575 */ 2575 2576 static HRESULT WINAPI ISFPersistFolder2_QueryInterface( 2576 IPersistFolder2 *iface,2577 REFIIDiid,2578 LPVOID*ppvObj)2579 { 2580 _ICOM_THIS_From_IPersistFolder2(IGenericSFImpl, iface);2581 2582 TRACE("(%p)\n", This);2583 2584 return IUnknown_QueryInterface(This->pUnkOuter, iid, ppvObj);2577 IPersistFolder2 * iface, 2578 REFIID iid, 2579 LPVOID* ppvObj) 2580 { 2581 _ICOM_THIS_From_IPersistFolder2(IGenericSFImpl, iface); 2582 2583 TRACE("(%p)\n", This); 2584 2585 return IUnknown_QueryInterface(This->pUnkOuter, iid, ppvObj); 2585 2586 } 2586 2587 … … 2590 2591 */ 2591 2592 static ULONG WINAPI ISFPersistFolder2_AddRef( 2592 IPersistFolder2 *iface)2593 { 2594 _ICOM_THIS_From_IPersistFolder2(IGenericSFImpl, iface);2595 2596 TRACE("(%p)\n", This);2597 2598 return IUnknown_AddRef(This->pUnkOuter);2593 IPersistFolder2 * iface) 2594 { 2595 _ICOM_THIS_From_IPersistFolder2(IGenericSFImpl, iface); 2596 2597 TRACE("(%p)\n", This); 2598 2599 return IUnknown_AddRef(This->pUnkOuter); 2599 2600 } 2600 2601 … … 2604 2605 */ 2605 2606 static ULONG WINAPI ISFPersistFolder2_Release( 2606 IPersistFolder2 *iface)2607 { 2608 _ICOM_THIS_From_IPersistFolder2(IGenericSFImpl, iface);2609 2610 TRACE("(%p)\n", This);2611 2612 return IUnknown_Release(This->pUnkOuter);2607 IPersistFolder2 * iface) 2608 { 2609 _ICOM_THIS_From_IPersistFolder2(IGenericSFImpl, iface); 2610 2611 TRACE("(%p)\n", This); 2612 2613 return IUnknown_Release(This->pUnkOuter); 2613 2614 } 2614 2615 … … 2617 2618 */ 2618 2619 static HRESULT WINAPI ISFPersistFolder2_GetClassID( 2619 IPersistFolder2 *iface,2620 CLSID *lpClassId)2621 { 2622 _ICOM_THIS_From_IPersistFolder2(IGenericSFImpl, iface);2623 2624 TRACE("(%p)\n", This);2625 2626 if (!lpClassId) return E_POINTER;2627 *lpClassId = *This->pclsid;2628 2629 return S_OK;2620 IPersistFolder2 * iface, 2621 CLSID * lpClassId) 2622 { 2623 _ICOM_THIS_From_IPersistFolder2(IGenericSFImpl, iface); 2624 2625 TRACE("(%p)\n", This); 2626 2627 if (!lpClassId) return E_POINTER; 2628 *lpClassId = *This->pclsid; 2629 2630 return S_OK; 2630 2631 } 2631 2632 … … 2637 2638 */ 2638 2639 static HRESULT WINAPI ISFPersistFolder2_Initialize( 2639 IPersistFolder2 *iface,2640 LPCITEMIDLISTpidl)2641 { 2642 char sTemp[MAX_PATH];2643 _ICOM_THIS_From_IPersistFolder2(IGenericSFImpl, iface);2644 2645 TRACE("(%p)->(%p)\n", This, pidl);2646 2647 /* free the old stuff */2648 if(This->absPidl)2649 {2650 SHFree(This->absPidl);2651 This->absPidl = NULL;2652 }2653 if(This->sMyPath)2654 {2655 SHFree(This->sMyPath);2656 This->sMyPath = NULL;2657 }2658 2659 /* set my pidl */2660 This->absPidl = ILClone(pidl);2661 2662 /* set my path */2663 if (SHGetPathFromIDListA(pidl, sTemp))2664 {2665 This->sMyPath = SHAlloc(strlen(sTemp)+1);2666 strcpy(This->sMyPath, sTemp);2667 }2668 2669 TRACE("--(%p)->(%s)\n", This, This->sMyPath);2670 2671 return S_OK;2640 IPersistFolder2 * iface, 2641 LPCITEMIDLIST pidl) 2642 { 2643 char sTemp[MAX_PATH]; 2644 _ICOM_THIS_From_IPersistFolder2(IGenericSFImpl, iface); 2645 2646 TRACE("(%p)->(%p)\n", This, pidl); 2647 2648 /* free the old stuff */ 2649 if(This->absPidl) 2650 { 2651 SHFree(This->absPidl); 2652 This->absPidl = NULL; 2653 } 2654 if(This->sMyPath) 2655 { 2656 SHFree(This->sMyPath); 2657 This->sMyPath = NULL; 2658 } 2659 2660 /* set my pidl */ 2661 This->absPidl = ILClone(pidl); 2662 2663 /* set my path */ 2664 if (SHGetPathFromIDListA(pidl, sTemp)) 2665 { 2666 This->sMyPath = SHAlloc(strlen(sTemp)+1); 2667 strcpy(This->sMyPath, sTemp); 2668 } 2669 2670 TRACE("--(%p)->(%s)\n", This, This->sMyPath); 2671 2672 return S_OK; 2672 2673 } 2673 2674 … … 2676 2677 */ 2677 2678 static HRESULT WINAPI ISFPersistFolder2_fnGetCurFolder( 2678 IPersistFolder2 *iface,2679 LPITEMIDLIST * pidl)2680 { 2681 _ICOM_THIS_From_IPersistFolder2(IGenericSFImpl, iface);2682 2683 TRACE("(%p)->(%p)\n",This, pidl);2684 2685 if (!pidl) return E_POINTER;2686 2687 *pidl = ILClone(This->absPidl);2688 2689 return S_OK;2690 } 2691 2692 static ICOM_VTABLE(IPersistFolder2) psfvt = 2693 { 2694 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE2695 ISFPersistFolder2_QueryInterface,2696 ISFPersistFolder2_AddRef,2697 ISFPersistFolder2_Release,2698 ISFPersistFolder2_GetClassID,2699 ISFPersistFolder2_Initialize,2700 ISFPersistFolder2_fnGetCurFolder2679 IPersistFolder2 * iface, 2680 LPITEMIDLIST * pidl) 2681 { 2682 _ICOM_THIS_From_IPersistFolder2(IGenericSFImpl, iface); 2683 2684 TRACE("(%p)->(%p)\n",This, pidl); 2685 2686 if (!pidl) return E_POINTER; 2687 2688 *pidl = ILClone(This->absPidl); 2689 2690 return S_OK; 2691 } 2692 2693 static ICOM_VTABLE(IPersistFolder2) psfvt = 2694 { 2695 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 2696 ISFPersistFolder2_QueryInterface, 2697 ISFPersistFolder2_AddRef, 2698 ISFPersistFolder2_Release, 2699 ISFPersistFolder2_GetClassID, 2700 ISFPersistFolder2_Initialize, 2701 ISFPersistFolder2_fnGetCurFolder 2701 2702 }; 2702 2703 … … 2705 2706 */ 2706 2707 static BOOL ISFDropTarget_QueryDrop( 2707 IDropTarget *iface,2708 DWORD dwKeyState,2709 LPDWORD pdwEffect)2710 { 2711 DWORD dwEffect = *pdwEffect;2712 2713 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface);2714 2715 *pdwEffect = DROPEFFECT_NONE;2716 2717 if (This->fAcceptFmt)2718 { /* Does our interpretation of the keystate ... */2719 *pdwEffect = KeyStateToDropEffect(dwKeyState);2720 2721 /* ... matches the desired effect ? */2722 if (dwEffect & *pdwEffect)2723 {2724 return TRUE;2725 }2726 }2727 return FALSE;2708 IDropTarget *iface, 2709 DWORD dwKeyState, 2710 LPDWORD pdwEffect) 2711 { 2712 DWORD dwEffect = *pdwEffect; 2713 2714 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface); 2715 2716 *pdwEffect = DROPEFFECT_NONE; 2717 2718 if (This->fAcceptFmt) 2719 { /* Does our interpretation of the keystate ... */ 2720 *pdwEffect = KeyStateToDropEffect(dwKeyState); 2721 2722 /* ... matches the desired effect ? */ 2723 if (dwEffect & *pdwEffect) 2724 { 2725 return TRUE; 2726 } 2727 } 2728 return FALSE; 2728 2729 } 2729 2730 2730 2731 static HRESULT WINAPI ISFDropTarget_QueryInterface( 2731 IDropTarget *iface,2732 REFIID riid,2733 LPVOID *ppvObj)2734 { 2735 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface);2736 2737 TRACE("(%p)\n", This);2738 2739 return IUnknown_QueryInterface(This->pUnkOuter, riid, ppvObj);2732 IDropTarget *iface, 2733 REFIID riid, 2734 LPVOID *ppvObj) 2735 { 2736 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface); 2737 2738 TRACE("(%p)\n", This); 2739 2740 return IUnknown_QueryInterface(This->pUnkOuter, riid, ppvObj); 2740 2741 } 2741 2742 2742 2743 static ULONG WINAPI ISFDropTarget_AddRef( IDropTarget *iface) 2743 2744 { 2744 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface);2745 2746 TRACE("(%p)\n", This);2747 2748 return IUnknown_AddRef(This->pUnkOuter);2745 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface); 2746 2747 TRACE("(%p)\n", This); 2748 2749 return IUnknown_AddRef(This->pUnkOuter); 2749 2750 } 2750 2751 2751 2752 static ULONG WINAPI ISFDropTarget_Release( IDropTarget *iface) 2752 2753 { 2753 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface);2754 2755 TRACE("(%p)\n", This);2756 2757 return IUnknown_Release(This->pUnkOuter);2754 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface); 2755 2756 TRACE("(%p)\n", This); 2757 2758 return IUnknown_Release(This->pUnkOuter); 2758 2759 } 2759 2760 2760 2761 static HRESULT WINAPI ISFDropTarget_DragEnter( 2761 IDropTarget*iface,2762 IDataObject*pDataObject,2763 DWORDdwKeyState,2764 POINTLpt,2765 DWORD*pdwEffect)2766 { 2767 FORMATETCfmt;2768 2769 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface);2770 2771 TRACE("(%p)->(DataObject=%p)\n",This,pDataObject);2772 2773 InitFormatEtc(fmt, This->cfShellIDList, TYMED_HGLOBAL);2774 2775 This->fAcceptFmt = (S_OK == IDataObject_QueryGetData(pDataObject, &fmt)) ? TRUE : FALSE;2776 2777 ISFDropTarget_QueryDrop(iface, dwKeyState, pdwEffect);2778 2779 return S_OK;2762 IDropTarget *iface, 2763 IDataObject *pDataObject, 2764 DWORD dwKeyState, 2765 POINTL pt, 2766 DWORD *pdwEffect) 2767 { 2768 FORMATETC fmt; 2769 2770 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface); 2771 2772 TRACE("(%p)->(DataObject=%p)\n",This,pDataObject); 2773 2774 InitFormatEtc(fmt, This->cfShellIDList, TYMED_HGLOBAL); 2775 2776 This->fAcceptFmt = (S_OK == IDataObject_QueryGetData(pDataObject, &fmt)) ? TRUE : FALSE; 2777 2778 ISFDropTarget_QueryDrop(iface, dwKeyState, pdwEffect); 2779 2780 return S_OK; 2780 2781 } 2781 2782 2782 2783 static HRESULT WINAPI ISFDropTarget_DragOver( 2783 IDropTarget*iface,2784 DWORDdwKeyState,2785 POINTLpt,2786 DWORD*pdwEffect)2787 { 2788 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface);2789 2790 TRACE("(%p)\n",This);2791 2792 if(!pdwEffect) return E_INVALIDARG;2793 2794 ISFDropTarget_QueryDrop(iface, dwKeyState, pdwEffect);2795 2796 return S_OK;2784 IDropTarget *iface, 2785 DWORD dwKeyState, 2786 POINTL pt, 2787 DWORD *pdwEffect) 2788 { 2789 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface); 2790 2791 TRACE("(%p)\n",This); 2792 2793 if(!pdwEffect) return E_INVALIDARG; 2794 2795 ISFDropTarget_QueryDrop(iface, dwKeyState, pdwEffect); 2796 2797 return S_OK; 2797 2798 } 2798 2799 2799 2800 static HRESULT WINAPI ISFDropTarget_DragLeave( 2800 IDropTarget*iface)2801 { 2802 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface);2803 2804 TRACE("(%p)\n",This);2805 2806 This->fAcceptFmt = FALSE;2807 2808 return S_OK;2801 IDropTarget *iface) 2802 { 2803 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface); 2804 2805 TRACE("(%p)\n",This); 2806 2807 This->fAcceptFmt = FALSE; 2808 2809 return S_OK; 2809 2810 } 2810 2811 2811 2812 static HRESULT WINAPI ISFDropTarget_Drop( 2812 IDropTarget*iface,2813 IDataObject*pDataObject,2814 DWORDdwKeyState,2815 POINTLpt,2816 DWORD*pdwEffect)2817 { 2818 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface);2819 2820 FIXME("(%p) object dropped\n",This);2821 2822 return E_NOTIMPL;2823 } 2824 2825 static struct ICOM_VTABLE(IDropTarget) dtvt = 2826 { 2827 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE2828 ISFDropTarget_QueryInterface,2829 ISFDropTarget_AddRef,2830 ISFDropTarget_Release,2831 ISFDropTarget_DragEnter,2832 ISFDropTarget_DragOver,2833 ISFDropTarget_DragLeave,2834 ISFDropTarget_Drop2813 IDropTarget *iface, 2814 IDataObject* pDataObject, 2815 DWORD dwKeyState, 2816 POINTL pt, 2817 DWORD *pdwEffect) 2818 { 2819 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface); 2820 2821 FIXME("(%p) object dropped\n",This); 2822 2823 return E_NOTIMPL; 2824 } 2825 2826 static struct ICOM_VTABLE(IDropTarget) dtvt = 2827 { 2828 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 2829 ISFDropTarget_QueryInterface, 2830 ISFDropTarget_AddRef, 2831 ISFDropTarget_Release, 2832 ISFDropTarget_DragEnter, 2833 ISFDropTarget_DragOver, 2834 ISFDropTarget_DragLeave, 2835 ISFDropTarget_Drop 2835 2836 }; -
trunk/src/shell32/shlmenu.c
r5618 r6650 1 /* $Id: shlmenu.c,v 1.3 2001-09-05 13:46:59 bird Exp $ */ 1 2 /* 2 3 * see www.geocities.com/SiliconValley/4942/filemenu.html … … 22 23 typedef struct 23 24 { 24 BOOLbInitialized;25 BOOLbFixedItems;26 /* create */27 COLORREFcrBorderColor;28 intnBorderWidth;29 HBITMAPhBorderBmp;30 31 /* insert using pidl */32 LPITEMIDLISTpidl;33 UINTuID;34 UINTuFlags;35 UINTuEnumFlags;36 LPFNFMCALLBACK lpfnCallback;25 BOOL bInitialized; 26 BOOL bFixedItems; 27 /* create */ 28 COLORREF crBorderColor; 29 int nBorderWidth; 30 HBITMAP hBorderBmp; 31 32 /* insert using pidl */ 33 LPITEMIDLIST pidl; 34 UINT uID; 35 UINT uFlags; 36 UINT uEnumFlags; 37 LPFNFMCALLBACK lpfnCallback; 37 38 } FMINFO, *LPFMINFO; 38 39 39 40 typedef struct 40 { intcchItemText;41 intiIconIndex;42 HMENUhMenu;43 charszItemText[1];41 { int cchItemText; 42 int iIconIndex; 43 HMENU hMenu; 44 char szItemText[1]; 44 45 } FMITEM, * LPFMITEM; 45 46 46 47 static BOOL bAbortInit; 47 48 48 #define CCH_MAXITEMTEXT 25649 #define CCH_MAXITEMTEXT 256 49 50 50 51 DEFAULT_DEBUG_CHANNEL(shell); 51 52 52 53 LPFMINFO FM_GetMenuInfo(HMENU hmenu) 53 { MENUINFOMenuInfo;54 LPFMINFOmenudata;55 56 MenuInfo.cbSize = sizeof(MENUINFO);57 MenuInfo.fMask = MIM_MENUDATA;58 59 if (! GetMenuInfo(hmenu, &MenuInfo))60 return NULL;61 62 menudata = (LPFMINFO)MenuInfo.dwMenuData;63 64 if ((menudata == 0) || (MenuInfo.cbSize != sizeof(MENUINFO)))65 {66 ERR("menudata corrupt: %p %lu\n", menudata, MenuInfo.cbSize);67 return 0;68 }69 70 return menudata;71 72 } 73 /************************************************************************* 74 * FM_SetMenuParameter [internal]54 { MENUINFO MenuInfo; 55 LPFMINFO menudata; 56 57 MenuInfo.cbSize = sizeof(MENUINFO); 58 MenuInfo.fMask = MIM_MENUDATA; 59 60 if (! GetMenuInfo(hmenu, &MenuInfo)) 61 return NULL; 62 63 menudata = (LPFMINFO)MenuInfo.dwMenuData; 64 65 if ((menudata == 0) || (MenuInfo.cbSize != sizeof(MENUINFO))) 66 { 67 ERR("menudata corrupt: %p %lu\n", menudata, MenuInfo.cbSize); 68 return 0; 69 } 70 71 return menudata; 72 73 } 74 /************************************************************************* 75 * FM_SetMenuParameter [internal] 75 76 * 76 77 */ 77 78 static LPFMINFO FM_SetMenuParameter( 78 HMENU hmenu,79 UINT uID,80 LPCITEMIDLIST pidl,81 UINT uFlags,82 UINT uEnumFlags,83 LPFNFMCALLBACK lpfnCallback)84 { 85 LPFMINFOmenudata;86 87 TRACE("\n");88 89 menudata = FM_GetMenuInfo(hmenu);90 91 if ( menudata->pidl)92 { SHFree(menudata->pidl);93 }94 95 menudata->uID = uID;96 menudata->pidl = ILClone(pidl);97 menudata->uFlags = uFlags;98 menudata->uEnumFlags = uEnumFlags;99 menudata->lpfnCallback = lpfnCallback;100 101 return menudata;102 } 103 104 /************************************************************************* 105 * FM_InitMenuPopup [internal]79 HMENU hmenu, 80 UINT uID, 81 LPCITEMIDLIST pidl, 82 UINT uFlags, 83 UINT uEnumFlags, 84 LPFNFMCALLBACK lpfnCallback) 85 { 86 LPFMINFO menudata; 87 88 TRACE("\n"); 89 90 menudata = FM_GetMenuInfo(hmenu); 91 92 if ( menudata->pidl) 93 { SHFree(menudata->pidl); 94 } 95 96 menudata->uID = uID; 97 menudata->pidl = ILClone(pidl); 98 menudata->uFlags = uFlags; 99 menudata->uEnumFlags = uEnumFlags; 100 menudata->lpfnCallback = lpfnCallback; 101 102 return menudata; 103 } 104 105 /************************************************************************* 106 * FM_InitMenuPopup [internal] 106 107 * 107 108 */ 108 109 static int FM_InitMenuPopup(HMENU hmenu, LPITEMIDLIST pAlternatePidl) 109 { IShellFolder*lpsf, *lpsf2;110 ULONGulItemAttr = SFGAO_FOLDER;111 UINTuID, uFlags, uEnumFlags;112 LPFNFMCALLBACKlpfnCallback;113 LPITEMIDLISTpidl;114 charsTemp[MAX_PATH];115 intNumberOfItems = 0, iIcon;116 MENUINFOMenuInfo;117 LPFMINFOmenudata;118 119 TRACE("0x%04x %p\n", hmenu, pAlternatePidl);120 121 MenuInfo.cbSize = sizeof(MENUINFO);122 MenuInfo.fMask = MIM_MENUDATA;123 124 if (! GetMenuInfo(hmenu, &MenuInfo))125 return FALSE;126 127 menudata = (LPFMINFO)MenuInfo.dwMenuData;128 129 if ((menudata == 0) || (MenuInfo.cbSize != sizeof(MENUINFO)))130 {131 ERR("menudata corrupt: %p %lu\n", menudata, MenuInfo.cbSize);132 return 0;133 }134 135 if (menudata->bInitialized)136 return 0;137 138 pidl = ((pAlternatePidl) ? pAlternatePidl : menudata->pidl);139 if (!pidl)140 return 0;141 142 uID = menudata->uID;143 uFlags = menudata->uFlags;144 uEnumFlags = menudata->uEnumFlags;145 lpfnCallback = menudata->lpfnCallback;146 menudata->bInitialized = FALSE;147 148 SetMenuInfo(hmenu, &MenuInfo);149 150 if (SUCCEEDED (SHGetDesktopFolder(&lpsf)))151 {152 if (SUCCEEDED(IShellFolder_BindToObject(lpsf, pidl,0,(REFIID)&IID_IShellFolder,(LPVOID *)&lpsf2)))153 {154 IEnumIDList*lpe = NULL;155 156 if (SUCCEEDED (IShellFolder_EnumObjects(lpsf2, 0, uEnumFlags, &lpe )))157 {158 159 LPITEMIDLIST pidlTemp = NULL;160 ULONG ulFetched;161 162 while ((!bAbortInit) && (NOERROR == IEnumIDList_Next(lpe,1,&pidlTemp,&ulFetched)))163 {164 if (SUCCEEDED (IShellFolder_GetAttributesOf(lpsf, 1, &pidlTemp, &ulItemAttr)))165 {166 ILGetDisplayName( pidlTemp, sTemp);167 if (! (PidlToSicIndex(lpsf, pidlTemp, FALSE, 0, &iIcon)))168 iIcon = FM_BLANK_ICON;169 if ( SFGAO_FOLDER & ulItemAttr)170 {171 LPFMINFO lpFmMi;172 MENUINFO MenuInfo;173 HMENU hMenuPopup = CreatePopupMenu();174 175 lpFmMi = (LPFMINFO) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(FMINFO));176 177 lpFmMi->pidl = ILCombine(pidl, pidlTemp);178 lpFmMi->uEnumFlags = SHCONTF_FOLDERS | SHCONTF_NONFOLDERS;179 180 MenuInfo.cbSize = sizeof(MENUINFO);181 MenuInfo.fMask = MIM_MENUDATA;182 MenuInfo.dwMenuData = (DWORD) lpFmMi;183 SetMenuInfo (hMenuPopup, &MenuInfo);184 185 FileMenu_AppendItemA (hmenu, sTemp, uID, iIcon, hMenuPopup, FM_DEFAULT_HEIGHT);186 }187 else188 {189 ((LPSTR)PathFindExtensionA(sTemp))[0] = 0x00;190 FileMenu_AppendItemA (hmenu, sTemp, uID, iIcon, 0, FM_DEFAULT_HEIGHT);191 }192 }193 194 if (lpfnCallback)195 {196 TRACE("enter callback\n");197 lpfnCallback ( pidl, pidlTemp);198 TRACE("leave callback\n");199 }200 201 NumberOfItems++;202 }203 IEnumIDList_Release (lpe);204 }205 IShellFolder_Release(lpsf2);206 }207 IShellFolder_Release(lpsf);208 }209 210 if ( GetMenuItemCount (hmenu) == 0 )211 { FileMenu_AppendItemA (hmenu, "(empty)", uID, FM_BLANK_ICON, 0, FM_DEFAULT_HEIGHT);212 NumberOfItems++;213 }214 215 menudata->bInitialized = TRUE;216 SetMenuInfo(hmenu, &MenuInfo);217 218 return NumberOfItems;219 } 220 /************************************************************************* 221 * FileMenu_Create [SHELL32.114]110 { IShellFolder *lpsf, *lpsf2; 111 ULONG ulItemAttr = SFGAO_FOLDER; 112 UINT uID, uFlags, uEnumFlags; 113 LPFNFMCALLBACK lpfnCallback; 114 LPITEMIDLIST pidl; 115 char sTemp[MAX_PATH]; 116 int NumberOfItems = 0, iIcon; 117 MENUINFO MenuInfo; 118 LPFMINFO menudata; 119 120 TRACE("0x%04x %p\n", hmenu, pAlternatePidl); 121 122 MenuInfo.cbSize = sizeof(MENUINFO); 123 MenuInfo.fMask = MIM_MENUDATA; 124 125 if (! GetMenuInfo(hmenu, &MenuInfo)) 126 return FALSE; 127 128 menudata = (LPFMINFO)MenuInfo.dwMenuData; 129 130 if ((menudata == 0) || (MenuInfo.cbSize != sizeof(MENUINFO))) 131 { 132 ERR("menudata corrupt: %p %lu\n", menudata, MenuInfo.cbSize); 133 return 0; 134 } 135 136 if (menudata->bInitialized) 137 return 0; 138 139 pidl = ((pAlternatePidl) ? pAlternatePidl : menudata->pidl); 140 if (!pidl) 141 return 0; 142 143 uID = menudata->uID; 144 uFlags = menudata->uFlags; 145 uEnumFlags = menudata->uEnumFlags; 146 lpfnCallback = menudata->lpfnCallback; 147 menudata->bInitialized = FALSE; 148 149 SetMenuInfo(hmenu, &MenuInfo); 150 151 if (SUCCEEDED (SHGetDesktopFolder(&lpsf))) 152 { 153 if (SUCCEEDED(IShellFolder_BindToObject(lpsf, pidl,0,(REFIID)&IID_IShellFolder,(LPVOID *)&lpsf2))) 154 { 155 IEnumIDList *lpe = NULL; 156 157 if (SUCCEEDED (IShellFolder_EnumObjects(lpsf2, 0, uEnumFlags, &lpe ))) 158 { 159 160 LPITEMIDLIST pidlTemp = NULL; 161 ULONG ulFetched; 162 163 while ((!bAbortInit) && (NOERROR == IEnumIDList_Next(lpe,1,&pidlTemp,&ulFetched))) 164 { 165 if (SUCCEEDED (IShellFolder_GetAttributesOf(lpsf, 1, &pidlTemp, &ulItemAttr))) 166 { 167 ILGetDisplayName( pidlTemp, sTemp); 168 if (! (PidlToSicIndex(lpsf, pidlTemp, FALSE, 0, &iIcon))) 169 iIcon = FM_BLANK_ICON; 170 if ( SFGAO_FOLDER & ulItemAttr) 171 { 172 LPFMINFO lpFmMi; 173 MENUINFO MenuInfo; 174 HMENU hMenuPopup = CreatePopupMenu(); 175 176 lpFmMi = (LPFMINFO) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(FMINFO)); 177 178 lpFmMi->pidl = ILCombine(pidl, pidlTemp); 179 lpFmMi->uEnumFlags = SHCONTF_FOLDERS | SHCONTF_NONFOLDERS; 180 181 MenuInfo.cbSize = sizeof(MENUINFO); 182 MenuInfo.fMask = MIM_MENUDATA; 183 MenuInfo.dwMenuData = (DWORD) lpFmMi; 184 SetMenuInfo (hMenuPopup, &MenuInfo); 185 186 FileMenu_AppendItemA (hmenu, sTemp, uID, iIcon, hMenuPopup, FM_DEFAULT_HEIGHT); 187 } 188 else 189 { 190 ((LPSTR)PathFindExtensionA(sTemp))[0] = 0x00; 191 FileMenu_AppendItemA (hmenu, sTemp, uID, iIcon, 0, FM_DEFAULT_HEIGHT); 192 } 193 } 194 195 if (lpfnCallback) 196 { 197 TRACE("enter callback\n"); 198 lpfnCallback ( pidl, pidlTemp); 199 TRACE("leave callback\n"); 200 } 201 202 NumberOfItems++; 203 } 204 IEnumIDList_Release (lpe); 205 } 206 IShellFolder_Release(lpsf2); 207 } 208 IShellFolder_Release(lpsf); 209 } 210 211 if ( GetMenuItemCount (hmenu) == 0 ) 212 { FileMenu_AppendItemA (hmenu, "(empty)", uID, FM_BLANK_ICON, 0, FM_DEFAULT_HEIGHT); 213 NumberOfItems++; 214 } 215 216 menudata->bInitialized = TRUE; 217 SetMenuInfo(hmenu, &MenuInfo); 218 219 return NumberOfItems; 220 } 221 /************************************************************************* 222 * FileMenu_Create [SHELL32.114] 222 223 * 223 224 * NOTES 224 225 * for non-root menus values are 225 * (ffffffff,00000000,00000000,00000000,00000000) 226 * (ffffffff,00000000,00000000,00000000,00000000) 226 227 */ 227 228 HMENU WINAPI FileMenu_Create ( 228 COLORREF crBorderColor,229 int nBorderWidth,230 HBITMAP hBorderBmp,231 int nSelHeight,232 UINT uFlags)233 { 234 MENUINFOMenuInfo;235 LPFMINFOmenudata;236 237 HMENU hMenu = CreatePopupMenu();238 239 TRACE("0x%08lx 0x%08x 0x%08x 0x%08x 0x%08x hMenu=0x%08x\n",240 crBorderColor, nBorderWidth, hBorderBmp, nSelHeight, uFlags, hMenu);241 242 menudata = (LPFMINFO)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(FMINFO));243 menudata->crBorderColor = crBorderColor;244 menudata->nBorderWidth = nBorderWidth;245 menudata->hBorderBmp = hBorderBmp;246 247 MenuInfo.cbSize = sizeof(MENUINFO);248 MenuInfo.fMask = MIM_MENUDATA;249 MenuInfo.dwMenuData = (DWORD) menudata;250 SetMenuInfo (hMenu, &MenuInfo);251 252 return hMenu;253 } 254 255 /************************************************************************* 256 * FileMenu_Destroy [SHELL32.118]229 COLORREF crBorderColor, 230 int nBorderWidth, 231 HBITMAP hBorderBmp, 232 int nSelHeight, 233 UINT uFlags) 234 { 235 MENUINFO MenuInfo; 236 LPFMINFO menudata; 237 238 HMENU hMenu = CreatePopupMenu(); 239 240 TRACE("0x%08lx 0x%08x 0x%08x 0x%08x 0x%08x hMenu=0x%08x\n", 241 crBorderColor, nBorderWidth, hBorderBmp, nSelHeight, uFlags, hMenu); 242 243 menudata = (LPFMINFO)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(FMINFO)); 244 menudata->crBorderColor = crBorderColor; 245 menudata->nBorderWidth = nBorderWidth; 246 menudata->hBorderBmp = hBorderBmp; 247 248 MenuInfo.cbSize = sizeof(MENUINFO); 249 MenuInfo.fMask = MIM_MENUDATA; 250 MenuInfo.dwMenuData = (DWORD) menudata; 251 SetMenuInfo (hMenu, &MenuInfo); 252 253 return hMenu; 254 } 255 256 /************************************************************************* 257 * FileMenu_Destroy [SHELL32.118] 257 258 * 258 259 * NOTES … … 261 262 void WINAPI FileMenu_Destroy (HMENU hmenu) 262 263 { 263 LPFMINFOmenudata;264 265 TRACE("0x%08x\n", hmenu);266 267 FileMenu_DeleteAllItems (hmenu);268 269 menudata = FM_GetMenuInfo(hmenu);270 271 if ( menudata->pidl)272 { SHFree( menudata->pidl);273 }274 HeapFree(GetProcessHeap(), 0, menudata);275 276 DestroyMenu (hmenu);277 } 278 279 /************************************************************************* 280 * FileMenu_AppendItemAW [SHELL32.115]264 LPFMINFO menudata; 265 266 TRACE("0x%08x\n", hmenu); 267 268 FileMenu_DeleteAllItems (hmenu); 269 270 menudata = FM_GetMenuInfo(hmenu); 271 272 if ( menudata->pidl) 273 { SHFree( menudata->pidl); 274 } 275 HeapFree(GetProcessHeap(), 0, menudata); 276 277 DestroyMenu (hmenu); 278 } 279 280 /************************************************************************* 281 * FileMenu_AppendItemAW [SHELL32.115] 281 282 * 282 283 */ 283 284 BOOL WINAPI FileMenu_AppendItemA( 284 HMENU hMenu,285 LPCSTR lpText,286 UINT uID,287 int icon,288 HMENU hMenuPopup,289 int nItemHeight)290 { 291 LPSTR lpszText = (LPSTR)lpText;292 MENUITEMINFOAmii;293 LPFMITEMmyItem;294 LPFMINFOmenudata;295 MENUINFO MenuInfo;296 297 298 TRACE("0x%08x %s 0x%08x 0x%08x 0x%08x 0x%08x\n",299 hMenu, (lpszText!=FM_SEPARATOR) ? lpText: NULL,300 uID, icon, hMenuPopup, nItemHeight);301 302 ZeroMemory (&mii, sizeof(MENUITEMINFOA));303 304 mii.cbSize = sizeof(MENUITEMINFOA);305 306 if (lpText != FM_SEPARATOR)307 { int len = strlen (lpText);308 myItem = (LPFMITEM) SHAlloc( sizeof(FMITEM) + len);309 strcpy (myItem->szItemText, lpText);310 myItem->cchItemText = len;311 myItem->iIconIndex = icon;312 myItem->hMenu = hMenu;313 mii.fMask = MIIM_DATA;314 mii.dwItemData = (DWORD) myItem;315 }316 317 if ( hMenuPopup )318 { /* sub menu */319 mii.fMask |= MIIM_TYPE | MIIM_SUBMENU;320 mii.fType = MFT_OWNERDRAW;321 mii.hSubMenu = hMenuPopup;322 }323 else if (lpText == FM_SEPARATOR )324 { mii.fMask |= MIIM_ID | MIIM_TYPE;325 mii.fType = MFT_SEPARATOR;326 }327 else328 { /* normal item */329 mii.fMask |= MIIM_ID | MIIM_TYPE | MIIM_STATE;330 mii.fState = MFS_ENABLED | MFS_DEFAULT;331 mii.fType = MFT_OWNERDRAW;332 }333 mii.wID = uID;334 335 InsertMenuItemA (hMenu, (UINT)-1, TRUE, &mii);336 337 /* set bFixedItems to true */338 MenuInfo.cbSize = sizeof(MENUINFO);339 MenuInfo.fMask = MIM_MENUDATA;340 341 if (! GetMenuInfo(hMenu, &MenuInfo))342 return FALSE;343 344 menudata = (LPFMINFO)MenuInfo.dwMenuData;345 if ((menudata == 0) || (MenuInfo.cbSize != sizeof(MENUINFO)))346 {347 ERR("menudata corrupt: %p %lu\n", menudata, MenuInfo.cbSize);348 return 0;349 }350 351 menudata->bFixedItems = TRUE;352 SetMenuInfo(hMenu, &MenuInfo);353 354 return TRUE;285 HMENU hMenu, 286 LPCSTR lpText, 287 UINT uID, 288 int icon, 289 HMENU hMenuPopup, 290 int nItemHeight) 291 { 292 LPSTR lpszText = (LPSTR)lpText; 293 MENUITEMINFOA mii; 294 LPFMITEM myItem; 295 LPFMINFO menudata; 296 MENUINFO MenuInfo; 297 298 299 TRACE("0x%08x %s 0x%08x 0x%08x 0x%08x 0x%08x\n", 300 hMenu, (lpszText!=FM_SEPARATOR) ? lpText: NULL, 301 uID, icon, hMenuPopup, nItemHeight); 302 303 ZeroMemory (&mii, sizeof(MENUITEMINFOA)); 304 305 mii.cbSize = sizeof(MENUITEMINFOA); 306 307 if (lpText != FM_SEPARATOR) 308 { int len = strlen (lpText); 309 myItem = (LPFMITEM) SHAlloc( sizeof(FMITEM) + len); 310 strcpy (myItem->szItemText, lpText); 311 myItem->cchItemText = len; 312 myItem->iIconIndex = icon; 313 myItem->hMenu = hMenu; 314 mii.fMask = MIIM_DATA; 315 mii.dwItemData = (DWORD) myItem; 316 } 317 318 if ( hMenuPopup ) 319 { /* sub menu */ 320 mii.fMask |= MIIM_TYPE | MIIM_SUBMENU; 321 mii.fType = MFT_OWNERDRAW; 322 mii.hSubMenu = hMenuPopup; 323 } 324 else if (lpText == FM_SEPARATOR ) 325 { mii.fMask |= MIIM_ID | MIIM_TYPE; 326 mii.fType = MFT_SEPARATOR; 327 } 328 else 329 { /* normal item */ 330 mii.fMask |= MIIM_ID | MIIM_TYPE | MIIM_STATE; 331 mii.fState = MFS_ENABLED | MFS_DEFAULT; 332 mii.fType = MFT_OWNERDRAW; 333 } 334 mii.wID = uID; 335 336 InsertMenuItemA (hMenu, (UINT)-1, TRUE, &mii); 337 338 /* set bFixedItems to true */ 339 MenuInfo.cbSize = sizeof(MENUINFO); 340 MenuInfo.fMask = MIM_MENUDATA; 341 342 if (! GetMenuInfo(hMenu, &MenuInfo)) 343 return FALSE; 344 345 menudata = (LPFMINFO)MenuInfo.dwMenuData; 346 if ((menudata == 0) || (MenuInfo.cbSize != sizeof(MENUINFO))) 347 { 348 ERR("menudata corrupt: %p %lu\n", menudata, MenuInfo.cbSize); 349 return 0; 350 } 351 352 menudata->bFixedItems = TRUE; 353 SetMenuInfo(hMenu, &MenuInfo); 354 355 return TRUE; 355 356 356 357 } … … 359 360 360 361 BOOL WINAPI FileMenu_AppendItemAW( 361 HMENU hMenu,362 LPCVOID lpText,363 UINT uID,364 int icon,365 HMENU hMenuPopup,366 int nItemHeight)367 { 368 BOOL ret;369 LPSTR lpszText=NULL;370 371 if (SHELL_OsIsUnicode() && (lpText!=FM_SEPARATOR))372 lpszText = HEAP_strdupWtoA ( GetProcessHeap(),0, lpText);373 374 ret = FileMenu_AppendItemA(hMenu, (lpszText) ? lpszText : lpText, uID, icon, hMenuPopup, nItemHeight);375 376 if (lpszText)377 HeapFree( GetProcessHeap(), 0, lpszText );378 379 return ret;380 } 381 /************************************************************************* 382 * FileMenu_InsertUsingPidl [SHELL32.110]362 HMENU hMenu, 363 LPCVOID lpText, 364 UINT uID, 365 int icon, 366 HMENU hMenuPopup, 367 int nItemHeight) 368 { 369 BOOL ret; 370 LPSTR lpszText=NULL; 371 372 if (SHELL_OsIsUnicode() && (lpText!=FM_SEPARATOR)) 373 lpszText = HEAP_strdupWtoA ( GetProcessHeap(),0, lpText); 374 375 ret = FileMenu_AppendItemA(hMenu, (lpszText) ? lpszText : lpText, uID, icon, hMenuPopup, nItemHeight); 376 377 if (lpszText) 378 HeapFree( GetProcessHeap(), 0, lpszText ); 379 380 return ret; 381 } 382 /************************************************************************* 383 * FileMenu_InsertUsingPidl [SHELL32.110] 383 384 * 384 385 * NOTES 385 * uEnumFlagsany SHCONTF flag386 * uEnumFlags any SHCONTF flag 386 387 */ 387 388 int WINAPI FileMenu_InsertUsingPidl ( 388 HMENU hmenu,389 UINT uID,390 LPCITEMIDLIST pidl,391 UINT uFlags,392 UINT uEnumFlags,393 LPFNFMCALLBACK lpfnCallback)394 { 395 TRACE("0x%08x 0x%08x %p 0x%08x 0x%08x %p\n",396 hmenu, uID, pidl, uFlags, uEnumFlags, lpfnCallback);397 398 pdump (pidl);399 400 bAbortInit = FALSE;401 402 FM_SetMenuParameter(hmenu, uID, pidl, uFlags, uEnumFlags, lpfnCallback); 403 404 return FM_InitMenuPopup(hmenu, NULL);405 } 406 407 /************************************************************************* 408 * FileMenu_ReplaceUsingPidl [SHELL32.113]389 HMENU hmenu, 390 UINT uID, 391 LPCITEMIDLIST pidl, 392 UINT uFlags, 393 UINT uEnumFlags, 394 LPFNFMCALLBACK lpfnCallback) 395 { 396 TRACE("0x%08x 0x%08x %p 0x%08x 0x%08x %p\n", 397 hmenu, uID, pidl, uFlags, uEnumFlags, lpfnCallback); 398 399 pdump (pidl); 400 401 bAbortInit = FALSE; 402 403 FM_SetMenuParameter(hmenu, uID, pidl, uFlags, uEnumFlags, lpfnCallback); 404 405 return FM_InitMenuPopup(hmenu, NULL); 406 } 407 408 /************************************************************************* 409 * FileMenu_ReplaceUsingPidl [SHELL32.113] 409 410 * 410 411 * FIXME: the static items are deleted but wont be refreshed 411 412 */ 412 413 int WINAPI FileMenu_ReplaceUsingPidl( 413 HMENUhmenu,414 UINTuID,415 LPCITEMIDLISTpidl,416 UINTuEnumFlags,417 LPFNFMCALLBACK lpfnCallback)418 { 419 TRACE("0x%08x 0x%08x %p 0x%08x %p\n",420 hmenu, uID, pidl, uEnumFlags, lpfnCallback);421 422 FileMenu_DeleteAllItems (hmenu);423 424 FM_SetMenuParameter(hmenu, uID, pidl, 0, uEnumFlags, lpfnCallback); 425 426 return FM_InitMenuPopup(hmenu, NULL);427 } 428 429 /************************************************************************* 430 * FileMenu_Invalidate [SHELL32.111]414 HMENU hmenu, 415 UINT uID, 416 LPCITEMIDLIST pidl, 417 UINT uEnumFlags, 418 LPFNFMCALLBACK lpfnCallback) 419 { 420 TRACE("0x%08x 0x%08x %p 0x%08x %p\n", 421 hmenu, uID, pidl, uEnumFlags, lpfnCallback); 422 423 FileMenu_DeleteAllItems (hmenu); 424 425 FM_SetMenuParameter(hmenu, uID, pidl, 0, uEnumFlags, lpfnCallback); 426 427 return FM_InitMenuPopup(hmenu, NULL); 428 } 429 430 /************************************************************************* 431 * FileMenu_Invalidate [SHELL32.111] 431 432 */ 432 433 void WINAPI FileMenu_Invalidate (HMENU hMenu) 433 434 { 434 FIXME("0x%08x\n",hMenu); 435 } 436 437 /************************************************************************* 438 * FileMenu_FindSubMenuByPidl [SHELL32.106]435 FIXME("0x%08x\n",hMenu); 436 } 437 438 /************************************************************************* 439 * FileMenu_FindSubMenuByPidl [SHELL32.106] 439 440 */ 440 441 HMENU WINAPI FileMenu_FindSubMenuByPidl( 441 HMENUhMenu,442 LPCITEMIDLISTpidl)443 { 444 FIXME("0x%08x %p\n",hMenu, pidl); 445 return 0;446 } 447 448 /************************************************************************* 449 * FileMenu_AppendFilesForPidl [SHELL32.124]442 HMENU hMenu, 443 LPCITEMIDLIST pidl) 444 { 445 FIXME("0x%08x %p\n",hMenu, pidl); 446 return 0; 447 } 448 449 /************************************************************************* 450 * FileMenu_AppendFilesForPidl [SHELL32.124] 450 451 */ 451 452 int WINAPI FileMenu_AppendFilesForPidl( 452 HMENUhmenu,453 LPCITEMIDLISTpidl,454 BOOLbAddSeperator)455 { 456 LPFMINFOmenudata;457 458 menudata = FM_GetMenuInfo(hmenu);459 460 menudata->bInitialized = FALSE;461 462 FM_InitMenuPopup(hmenu, pidl);463 464 if (bAddSeperator)465 FileMenu_AppendItemA (hmenu, FM_SEPARATOR, 0, 0, 0, FM_DEFAULT_HEIGHT);466 467 TRACE("0x%08x %p 0x%08x\n",hmenu, pidl,bAddSeperator); 468 469 return 0;470 } 471 /************************************************************************* 472 * FileMenu_AddFilesForPidl [SHELL32.125]453 HMENU hmenu, 454 LPCITEMIDLIST pidl, 455 BOOL bAddSeperator) 456 { 457 LPFMINFO menudata; 458 459 menudata = FM_GetMenuInfo(hmenu); 460 461 menudata->bInitialized = FALSE; 462 463 FM_InitMenuPopup(hmenu, pidl); 464 465 if (bAddSeperator) 466 FileMenu_AppendItemA (hmenu, FM_SEPARATOR, 0, 0, 0, FM_DEFAULT_HEIGHT); 467 468 TRACE("0x%08x %p 0x%08x\n",hmenu, pidl,bAddSeperator); 469 470 return 0; 471 } 472 /************************************************************************* 473 * FileMenu_AddFilesForPidl [SHELL32.125] 473 474 * 474 475 * NOTES 475 * uEnumFlagsany SHCONTF flag476 * uEnumFlags any SHCONTF flag 476 477 */ 477 478 int WINAPI FileMenu_AddFilesForPidl ( 478 HMENUhmenu,479 UINTuReserved,480 UINTuID,481 LPCITEMIDLISTpidl,482 UINTuFlags,483 UINTuEnumFlags,484 LPFNFMCALLBACKlpfnCallback)485 { 486 TRACE("0x%08x 0x%08x 0x%08x %p 0x%08x 0x%08x %p\n",487 hmenu, uReserved, uID, pidl, uFlags, uEnumFlags, lpfnCallback);488 489 return FileMenu_InsertUsingPidl ( hmenu, uID, pidl, uFlags, uEnumFlags, lpfnCallback);490 491 } 492 493 494 /************************************************************************* 495 * FileMenu_TrackPopupMenuEx [SHELL32.116]479 HMENU hmenu, 480 UINT uReserved, 481 UINT uID, 482 LPCITEMIDLIST pidl, 483 UINT uFlags, 484 UINT uEnumFlags, 485 LPFNFMCALLBACK lpfnCallback) 486 { 487 TRACE("0x%08x 0x%08x 0x%08x %p 0x%08x 0x%08x %p\n", 488 hmenu, uReserved, uID, pidl, uFlags, uEnumFlags, lpfnCallback); 489 490 return FileMenu_InsertUsingPidl ( hmenu, uID, pidl, uFlags, uEnumFlags, lpfnCallback); 491 492 } 493 494 495 /************************************************************************* 496 * FileMenu_TrackPopupMenuEx [SHELL32.116] 496 497 */ 497 498 BOOL WINAPI FileMenu_TrackPopupMenuEx ( 498 HMENU hMenu,499 UINT uFlags,500 int x,501 int y,502 HWND hWnd,503 LPTPMPARAMS lptpm)504 { 505 TRACE("0x%08x 0x%08x 0x%x 0x%x 0x%08x %p\n",506 hMenu, uFlags, x, y, hWnd, lptpm);507 return TrackPopupMenuEx(hMenu, uFlags, x, y, hWnd, lptpm);508 } 509 510 /************************************************************************* 511 * FileMenu_GetLastSelectedItemPidls [SHELL32.107]499 HMENU hMenu, 500 UINT uFlags, 501 int x, 502 int y, 503 HWND hWnd, 504 LPTPMPARAMS lptpm) 505 { 506 TRACE("0x%08x 0x%08x 0x%x 0x%x 0x%08x %p\n", 507 hMenu, uFlags, x, y, hWnd, lptpm); 508 return TrackPopupMenuEx(hMenu, uFlags, x, y, hWnd, lptpm); 509 } 510 511 /************************************************************************* 512 * FileMenu_GetLastSelectedItemPidls [SHELL32.107] 512 513 */ 513 514 BOOL WINAPI FileMenu_GetLastSelectedItemPidls( 514 UINTuReserved,515 LPCITEMIDLIST*ppidlFolder,516 LPCITEMIDLIST*ppidlItem)517 { 518 FIXME("0x%08x %p %p\n",uReserved, ppidlFolder, ppidlItem);519 return 0;520 } 521 522 #define FM_ICON_SIZE 16523 #define FM_Y_SPACE 4524 #define FM_SPACE1 4525 #define FM_SPACE2 2526 #define FM_LEFTBORDER 2527 #define FM_RIGHTBORDER 8528 /************************************************************************* 529 * FileMenu_MeasureItem [SHELL32.112]515 UINT uReserved, 516 LPCITEMIDLIST *ppidlFolder, 517 LPCITEMIDLIST *ppidlItem) 518 { 519 FIXME("0x%08x %p %p\n",uReserved, ppidlFolder, ppidlItem); 520 return 0; 521 } 522 523 #define FM_ICON_SIZE 16 524 #define FM_Y_SPACE 4 525 #define FM_SPACE1 4 526 #define FM_SPACE2 2 527 #define FM_LEFTBORDER 2 528 #define FM_RIGHTBORDER 8 529 /************************************************************************* 530 * FileMenu_MeasureItem [SHELL32.112] 530 531 */ 531 532 LRESULT WINAPI FileMenu_MeasureItem( 532 HWNDhWnd,533 LPMEASUREITEMSTRUCTlpmis)534 { 535 LPFMITEM pMyItem = (LPFMITEM)(lpmis->itemData);536 HDC hdc = GetDC(hWnd);537 SIZE size;538 LPFMINFO menuinfo;539 540 TRACE("0x%08x %p %s\n", hWnd, lpmis, pMyItem->szItemText);541 542 GetTextExtentPoint32A(hdc, pMyItem->szItemText, pMyItem->cchItemText, &size);543 544 lpmis->itemWidth = size.cx + FM_LEFTBORDER + FM_ICON_SIZE + FM_SPACE1 + FM_SPACE2 + FM_RIGHTBORDER;545 lpmis->itemHeight = (size.cy > (FM_ICON_SIZE + FM_Y_SPACE)) ? size.cy : (FM_ICON_SIZE + FM_Y_SPACE);546 547 /* add the menubitmap */548 menuinfo = FM_GetMenuInfo(pMyItem->hMenu);549 if (menuinfo->nBorderWidth)550 lpmis->itemWidth += menuinfo->nBorderWidth;551 552 TRACE("-- 0x%04x 0x%04x\n", lpmis->itemWidth, lpmis->itemHeight);553 ReleaseDC (hWnd, hdc);554 return 0;555 } 556 /************************************************************************* 557 * FileMenu_DrawItem [SHELL32.105]533 HWND hWnd, 534 LPMEASUREITEMSTRUCT lpmis) 535 { 536 LPFMITEM pMyItem = (LPFMITEM)(lpmis->itemData); 537 HDC hdc = GetDC(hWnd); 538 SIZE size; 539 LPFMINFO menuinfo; 540 541 TRACE("0x%08x %p %s\n", hWnd, lpmis, pMyItem->szItemText); 542 543 GetTextExtentPoint32A(hdc, pMyItem->szItemText, pMyItem->cchItemText, &size); 544 545 lpmis->itemWidth = size.cx + FM_LEFTBORDER + FM_ICON_SIZE + FM_SPACE1 + FM_SPACE2 + FM_RIGHTBORDER; 546 lpmis->itemHeight = (size.cy > (FM_ICON_SIZE + FM_Y_SPACE)) ? size.cy : (FM_ICON_SIZE + FM_Y_SPACE); 547 548 /* add the menubitmap */ 549 menuinfo = FM_GetMenuInfo(pMyItem->hMenu); 550 if (menuinfo->nBorderWidth) 551 lpmis->itemWidth += menuinfo->nBorderWidth; 552 553 TRACE("-- 0x%04x 0x%04x\n", lpmis->itemWidth, lpmis->itemHeight); 554 ReleaseDC (hWnd, hdc); 555 return 0; 556 } 557 /************************************************************************* 558 * FileMenu_DrawItem [SHELL32.105] 558 559 */ 559 560 LRESULT WINAPI FileMenu_DrawItem( 560 HWNDhWnd,561 LPDRAWITEMSTRUCTlpdis)562 { 563 LPFMITEM pMyItem = (LPFMITEM)(lpdis->itemData);564 COLORREF clrPrevText, clrPrevBkgnd;565 int xi,yi,xt,yt;566 HIMAGELIST hImageList;567 RECT TextRect, BorderRect;568 LPFMINFO menuinfo;569 570 TRACE("0x%08x %p %s\n", hWnd, lpdis, pMyItem->szItemText);571 572 if (lpdis->itemState & ODS_SELECTED)573 {574 clrPrevText = SetTextColor(lpdis->hDC, GetSysColor (COLOR_HIGHLIGHTTEXT));575 clrPrevBkgnd = SetBkColor(lpdis->hDC, GetSysColor (COLOR_HIGHLIGHT));576 }577 else578 {579 clrPrevText = SetTextColor(lpdis->hDC, GetSysColor (COLOR_MENUTEXT));580 clrPrevBkgnd = SetBkColor(lpdis->hDC, GetSysColor (COLOR_MENU));581 }582 583 CopyRect(&TextRect, &(lpdis->rcItem));584 585 /* add the menubitmap */586 menuinfo = FM_GetMenuInfo(pMyItem->hMenu);587 if (menuinfo->nBorderWidth)588 TextRect.left += menuinfo->nBorderWidth;589 590 BorderRect.right = menuinfo->nBorderWidth;591 /* FillRect(lpdis->hDC, &BorderRect, CreateSolidBrush( menuinfo->crBorderColor));561 HWND hWnd, 562 LPDRAWITEMSTRUCT lpdis) 563 { 564 LPFMITEM pMyItem = (LPFMITEM)(lpdis->itemData); 565 COLORREF clrPrevText, clrPrevBkgnd; 566 int xi,yi,xt,yt; 567 HIMAGELIST hImageList; 568 RECT TextRect, BorderRect; 569 LPFMINFO menuinfo; 570 571 TRACE("0x%08x %p %s\n", hWnd, lpdis, pMyItem->szItemText); 572 573 if (lpdis->itemState & ODS_SELECTED) 574 { 575 clrPrevText = SetTextColor(lpdis->hDC, GetSysColor (COLOR_HIGHLIGHTTEXT)); 576 clrPrevBkgnd = SetBkColor(lpdis->hDC, GetSysColor (COLOR_HIGHLIGHT)); 577 } 578 else 579 { 580 clrPrevText = SetTextColor(lpdis->hDC, GetSysColor (COLOR_MENUTEXT)); 581 clrPrevBkgnd = SetBkColor(lpdis->hDC, GetSysColor (COLOR_MENU)); 582 } 583 584 CopyRect(&TextRect, &(lpdis->rcItem)); 585 586 /* add the menubitmap */ 587 menuinfo = FM_GetMenuInfo(pMyItem->hMenu); 588 if (menuinfo->nBorderWidth) 589 TextRect.left += menuinfo->nBorderWidth; 590 591 BorderRect.right = menuinfo->nBorderWidth; 592 /* FillRect(lpdis->hDC, &BorderRect, CreateSolidBrush( menuinfo->crBorderColor)); 592 593 */ 593 TextRect.left += FM_LEFTBORDER;594 xi = TextRect.left + FM_SPACE1;595 yi = TextRect.top + FM_Y_SPACE/2;596 TextRect.bottom -= FM_Y_SPACE/2;597 598 xt = xi + FM_ICON_SIZE + FM_SPACE2;599 yt = yi;600 601 ExtTextOutA (lpdis->hDC, xt , yt, ETO_OPAQUE, &TextRect, pMyItem->szItemText, pMyItem->cchItemText, NULL);602 603 Shell_GetImageList(0, &hImageList);604 ImageList_Draw(hImageList, pMyItem->iIconIndex, lpdis->hDC, xi, yi, ILD_NORMAL);605 606 TRACE("-- 0x%04x 0x%04x 0x%04x 0x%04x\n", TextRect.left, TextRect.top, TextRect.right, TextRect.bottom);607 608 SetTextColor(lpdis->hDC, clrPrevText);609 SetBkColor(lpdis->hDC, clrPrevBkgnd);610 611 return TRUE;612 } 613 614 /************************************************************************* 615 * FileMenu_InitMenuPopup [SHELL32.109]594 TextRect.left += FM_LEFTBORDER; 595 xi = TextRect.left + FM_SPACE1; 596 yi = TextRect.top + FM_Y_SPACE/2; 597 TextRect.bottom -= FM_Y_SPACE/2; 598 599 xt = xi + FM_ICON_SIZE + FM_SPACE2; 600 yt = yi; 601 602 ExtTextOutA (lpdis->hDC, xt , yt, ETO_OPAQUE, &TextRect, pMyItem->szItemText, pMyItem->cchItemText, NULL); 603 604 Shell_GetImageList(0, &hImageList); 605 ImageList_Draw(hImageList, pMyItem->iIconIndex, lpdis->hDC, xi, yi, ILD_NORMAL); 606 607 TRACE("-- 0x%04x 0x%04x 0x%04x 0x%04x\n", TextRect.left, TextRect.top, TextRect.right, TextRect.bottom); 608 609 SetTextColor(lpdis->hDC, clrPrevText); 610 SetBkColor(lpdis->hDC, clrPrevBkgnd); 611 612 return TRUE; 613 } 614 615 /************************************************************************* 616 * FileMenu_InitMenuPopup [SHELL32.109] 616 617 * 617 618 * NOTES 618 * The filemenu is a ownerdrawn menu. Call this function responding to 619 * The filemenu is a ownerdrawn menu. Call this function responding to 619 620 * WM_INITPOPUPMENU 620 621 * … … 622 623 BOOL WINAPI FileMenu_InitMenuPopup (HMENU hmenu) 623 624 { 624 FM_InitMenuPopup(hmenu, NULL);625 return TRUE;626 } 627 628 /************************************************************************* 629 * FileMenu_HandleMenuChar [SHELL32.108]625 FM_InitMenuPopup(hmenu, NULL); 626 return TRUE; 627 } 628 629 /************************************************************************* 630 * FileMenu_HandleMenuChar [SHELL32.108] 630 631 */ 631 632 LRESULT WINAPI FileMenu_HandleMenuChar( 632 HMENUhMenu,633 WPARAMwParam)634 { 635 FIXME("0x%08x 0x%08x\n",hMenu,wParam);636 return 0;637 } 638 639 /************************************************************************* 640 * FileMenu_DeleteAllItems [SHELL32.104]633 HMENU hMenu, 634 WPARAM wParam) 635 { 636 FIXME("0x%08x 0x%08x\n",hMenu,wParam); 637 return 0; 638 } 639 640 /************************************************************************* 641 * FileMenu_DeleteAllItems [SHELL32.104] 641 642 * 642 643 * NOTES … … 644 645 */ 645 646 BOOL WINAPI FileMenu_DeleteAllItems (HMENU hmenu) 646 { 647 MENUITEMINFOAmii;648 LPFMINFOmenudata;649 650 int i;651 652 TRACE("0x%08x\n", hmenu);653 654 ZeroMemory ( &mii, sizeof(MENUITEMINFOA));655 mii.cbSize = sizeof(MENUITEMINFOA);656 mii.fMask = MIIM_SUBMENU|MIIM_DATA;657 658 for (i = 0; i < GetMenuItemCount( hmenu ); i++)659 { GetMenuItemInfoA(hmenu, i, TRUE, &mii );660 661 if (mii.dwItemData)662 SHFree((LPFMINFO)mii.dwItemData);663 664 if (mii.hSubMenu)665 FileMenu_Destroy(mii.hSubMenu);666 }667 668 while (DeleteMenu (hmenu, 0, MF_BYPOSITION)){};669 670 menudata = FM_GetMenuInfo(hmenu);671 672 menudata->bInitialized = FALSE;673 674 return TRUE;675 } 676 677 /************************************************************************* 678 * FileMenu_DeleteItemByCmd [SHELL32.]647 { 648 MENUITEMINFOA mii; 649 LPFMINFO menudata; 650 651 int i; 652 653 TRACE("0x%08x\n", hmenu); 654 655 ZeroMemory ( &mii, sizeof(MENUITEMINFOA)); 656 mii.cbSize = sizeof(MENUITEMINFOA); 657 mii.fMask = MIIM_SUBMENU|MIIM_DATA; 658 659 for (i = 0; i < GetMenuItemCount( hmenu ); i++) 660 { GetMenuItemInfoA(hmenu, i, TRUE, &mii ); 661 662 if (mii.dwItemData) 663 SHFree((LPFMINFO)mii.dwItemData); 664 665 if (mii.hSubMenu) 666 FileMenu_Destroy(mii.hSubMenu); 667 } 668 669 while (DeleteMenu (hmenu, 0, MF_BYPOSITION)){}; 670 671 menudata = FM_GetMenuInfo(hmenu); 672 673 menudata->bInitialized = FALSE; 674 675 return TRUE; 676 } 677 678 /************************************************************************* 679 * FileMenu_DeleteItemByCmd [SHELL32.] 679 680 * 680 681 */ 681 682 BOOL WINAPI FileMenu_DeleteItemByCmd (HMENU hMenu, UINT uID) 682 683 { 683 MENUITEMINFOA mii;684 685 TRACE("0x%08x 0x%08x\n", hMenu, uID);686 687 ZeroMemory ( &mii, sizeof(MENUITEMINFOA));688 mii.cbSize = sizeof(MENUITEMINFOA);689 mii.fMask = MIIM_SUBMENU;690 691 GetMenuItemInfoA(hMenu, uID, FALSE, &mii );692 if ( mii.hSubMenu )693 {694 /* FIXME: Do what? */695 }696 697 DeleteMenu(hMenu, MF_BYCOMMAND, uID);698 return TRUE;699 } 700 701 /************************************************************************* 702 * FileMenu_DeleteItemByIndex [SHELL32.140]684 MENUITEMINFOA mii; 685 686 TRACE("0x%08x 0x%08x\n", hMenu, uID); 687 688 ZeroMemory ( &mii, sizeof(MENUITEMINFOA)); 689 mii.cbSize = sizeof(MENUITEMINFOA); 690 mii.fMask = MIIM_SUBMENU; 691 692 GetMenuItemInfoA(hMenu, uID, FALSE, &mii ); 693 if ( mii.hSubMenu ) 694 { 695 /* FIXME: Do what? */ 696 } 697 698 DeleteMenu(hMenu, MF_BYCOMMAND, uID); 699 return TRUE; 700 } 701 702 /************************************************************************* 703 * FileMenu_DeleteItemByIndex [SHELL32.140] 703 704 */ 704 705 BOOL WINAPI FileMenu_DeleteItemByIndex ( HMENU hMenu, UINT uPos) 705 706 { 706 MENUITEMINFOA mii;707 708 TRACE("0x%08x 0x%08x\n", hMenu, uPos);709 710 ZeroMemory ( &mii, sizeof(MENUITEMINFOA));711 mii.cbSize = sizeof(MENUITEMINFOA);712 mii.fMask = MIIM_SUBMENU;713 714 GetMenuItemInfoA(hMenu, uPos, TRUE, &mii );715 if ( mii.hSubMenu )716 {717 /* FIXME: Do what? */718 }719 720 DeleteMenu(hMenu, MF_BYPOSITION, uPos);721 return TRUE;722 } 723 724 /************************************************************************* 725 * FileMenu_DeleteItemByFirstID [SHELL32.141]707 MENUITEMINFOA mii; 708 709 TRACE("0x%08x 0x%08x\n", hMenu, uPos); 710 711 ZeroMemory ( &mii, sizeof(MENUITEMINFOA)); 712 mii.cbSize = sizeof(MENUITEMINFOA); 713 mii.fMask = MIIM_SUBMENU; 714 715 GetMenuItemInfoA(hMenu, uPos, TRUE, &mii ); 716 if ( mii.hSubMenu ) 717 { 718 /* FIXME: Do what? */ 719 } 720 721 DeleteMenu(hMenu, MF_BYPOSITION, uPos); 722 return TRUE; 723 } 724 725 /************************************************************************* 726 * FileMenu_DeleteItemByFirstID [SHELL32.141] 726 727 */ 727 728 BOOL WINAPI FileMenu_DeleteItemByFirstID( 728 HMENUhMenu,729 UINTuID)730 { 731 TRACE("0x%08x 0x%08x\n", hMenu, uID);732 return 0;733 } 734 735 /************************************************************************* 736 * FileMenu_DeleteSeparator [SHELL32.142]729 HMENU hMenu, 730 UINT uID) 731 { 732 TRACE("0x%08x 0x%08x\n", hMenu, uID); 733 return 0; 734 } 735 736 /************************************************************************* 737 * FileMenu_DeleteSeparator [SHELL32.142] 737 738 */ 738 739 BOOL WINAPI FileMenu_DeleteSeparator(HMENU hMenu) 739 740 { 740 TRACE("0x%08x\n", hMenu);741 return 0;742 } 743 744 /************************************************************************* 745 * FileMenu_EnableItemByCmd [SHELL32.143]741 TRACE("0x%08x\n", hMenu); 742 return 0; 743 } 744 745 /************************************************************************* 746 * FileMenu_EnableItemByCmd [SHELL32.143] 746 747 */ 747 748 BOOL WINAPI FileMenu_EnableItemByCmd( 748 HMENUhMenu,749 UINTuID,750 BOOLbEnable)751 { 752 TRACE("0x%08x 0x%08x 0x%08x\n", hMenu, uID,bEnable);753 return 0;754 } 755 756 /************************************************************************* 757 * FileMenu_GetItemExtent [SHELL32.144]758 * 749 HMENU hMenu, 750 UINT uID, 751 BOOL bEnable) 752 { 753 TRACE("0x%08x 0x%08x 0x%08x\n", hMenu, uID,bEnable); 754 return 0; 755 } 756 757 /************************************************************************* 758 * FileMenu_GetItemExtent [SHELL32.144] 759 * 759 760 * NOTES 760 761 * if the menu is to big, entrys are getting cut away!! 761 762 */ 762 763 DWORD WINAPI FileMenu_GetItemExtent (HMENU hMenu, UINT uPos) 763 { RECT rect;764 765 FIXME("0x%08x 0x%08x\n", hMenu, uPos);766 767 if (GetMenuItemRect(0, hMenu, uPos, &rect))768 { FIXME("0x%04x 0x%04x 0x%04x 0x%04x\n",769 rect.right, rect.left, rect.top, rect.bottom);770 return ((rect.right-rect.left)<<16) + (rect.top-rect.bottom);771 }772 return 0x00100010; /*fixme*/773 } 774 775 /************************************************************************* 776 * FileMenu_AbortInitMenu [SHELL32.120]764 { RECT rect; 765 766 FIXME("0x%08x 0x%08x\n", hMenu, uPos); 767 768 if (GetMenuItemRect(0, hMenu, uPos, &rect)) 769 { FIXME("0x%04x 0x%04x 0x%04x 0x%04x\n", 770 rect.right, rect.left, rect.top, rect.bottom); 771 return ((rect.right-rect.left)<<16) + (rect.top-rect.bottom); 772 } 773 return 0x00100010; /*fixme*/ 774 } 775 776 /************************************************************************* 777 * FileMenu_AbortInitMenu [SHELL32.120] 777 778 * 778 779 */ 779 780 void WINAPI FileMenu_AbortInitMenu (void) 780 { TRACE("\n");781 bAbortInit = TRUE;782 } 783 784 /************************************************************************* 785 * SHFind_InitMenuPopup [SHELL32.149]781 { TRACE("\n"); 782 bAbortInit = TRUE; 783 } 784 785 /************************************************************************* 786 * SHFind_InitMenuPopup [SHELL32.149] 786 787 * 787 788 * 788 789 * PARAMETERS 789 * hMenu [in] handle of menu previously created790 * hWndParent [in] parent window791 * w [in] no pointer (0x209 over here) perhaps menu IDs ???792 * x [in] no pointer (0x226 over here)790 * hMenu [in] handle of menu previously created 791 * hWndParent [in] parent window 792 * w [in] no pointer (0x209 over here) perhaps menu IDs ??? 793 * x [in] no pointer (0x226 over here) 793 794 * 794 795 * RETURNS 795 * LPXXXXX pointer to struct containing a func addr at offset 8796 * or NULL at failure.796 * LPXXXXX pointer to struct containing a func addr at offset 8 797 * or NULL at failure. 797 798 */ 798 799 LPVOID WINAPI SHFind_InitMenuPopup (HMENU hMenu, HWND hWndParent, DWORD w, DWORD x) 799 { FIXME("hmenu=0x%08x hwnd=0x%08x 0x%08lx 0x%08lx stub\n",800 hMenu,hWndParent,w,x);801 return NULL; /* this is supposed to be a pointer */802 } 803 804 /************************************************************************* 805 * Shell_MergeMenus [SHELL32.67]800 { FIXME("hmenu=0x%08x hwnd=0x%08x 0x%08lx 0x%08lx stub\n", 801 hMenu,hWndParent,w,x); 802 return NULL; /* this is supposed to be a pointer */ 803 } 804 805 /************************************************************************* 806 * Shell_MergeMenus [SHELL32.67] 806 807 * 807 808 */ 808 809 BOOL _SHIsMenuSeparator(HMENU hm, int i) 809 810 { 810 MENUITEMINFOA mii;811 812 mii.cbSize = sizeof(MENUITEMINFOA);813 mii.fMask = MIIM_TYPE;814 mii.cch = 0; /* WARNING: We MUST initialize it to 0*/815 if (!GetMenuItemInfoA(hm, i, TRUE, &mii))816 {817 return(FALSE);818 }819 820 if (mii.fType & MFT_SEPARATOR)821 {822 return(TRUE);823 }824 825 return(FALSE);811 MENUITEMINFOA mii; 812 813 mii.cbSize = sizeof(MENUITEMINFOA); 814 mii.fMask = MIIM_TYPE; 815 mii.cch = 0; /* WARNING: We MUST initialize it to 0*/ 816 if (!GetMenuItemInfoA(hm, i, TRUE, &mii)) 817 { 818 return(FALSE); 819 } 820 821 if (mii.fType & MFT_SEPARATOR) 822 { 823 return(TRUE); 824 } 825 826 return(FALSE); 826 827 } 827 828 … … 829 830 830 831 HRESULT WINAPI Shell_MergeMenus (HMENU hmDst, HMENU hmSrc, UINT uInsert, UINT uIDAdjust, UINT uIDAdjustMax, ULONG uFlags) 831 { intnItem;832 HMENUhmSubMenu;833 BOOLbAlreadySeparated;834 MENUITEMINFOAmiiSrc;835 charszName[256];836 UINTuTemp, uIDMax = uIDAdjust;837 838 TRACE("hmenu1=0x%04x hmenu2=0x%04x 0x%04x 0x%04x 0x%04x 0x%04lx\n",839 hmDst, hmSrc, uInsert, uIDAdjust, uIDAdjustMax, uFlags);840 841 if (!hmDst || !hmSrc)842 { return uIDMax;843 }844 845 nItem = GetMenuItemCount(hmDst);846 847 if (uInsert >= (UINT)nItem)/* insert position inside menu? */848 {849 uInsert = (UINT)nItem;/* append on the end */850 bAlreadySeparated = TRUE;851 }852 else853 {854 bAlreadySeparated = _SHIsMenuSeparator(hmDst, uInsert);;855 }856 857 if ((uFlags & MM_ADDSEPARATOR) && !bAlreadySeparated)858 {859 /* Add a separator between the menus */860 InsertMenuA(hmDst, uInsert, MF_BYPOSITION | MF_SEPARATOR, 0, NULL);861 bAlreadySeparated = TRUE;862 }863 864 865 /* Go through the menu items and clone them*/866 for (nItem = GetMenuItemCount(hmSrc) - 1; nItem >= 0; nItem--)867 {868 miiSrc.cbSize = sizeof(MENUITEMINFOA);869 miiSrc.fMask = MIIM_STATE | MIIM_ID | MIIM_SUBMENU | MIIM_CHECKMARKS | MIIM_TYPE | MIIM_DATA;870 871 /* We need to reset this every time through the loop in case menus DON'T have IDs*/872 miiSrc.fType = MFT_STRING;873 miiSrc.dwTypeData = szName;874 miiSrc.dwItemData = 0;875 miiSrc.cch = sizeof(szName);876 877 if (!GetMenuItemInfoA(hmSrc, nItem, TRUE, &miiSrc))878 {879 continue;880 }881 882 /* TRACE("found menu=0x%04x %s id=0x%04x mask=0x%08x smenu=0x%04x\n", hmSrc, debugstr_a(miiSrc.dwTypeData), miiSrc.wID, miiSrc.fMask, miiSrc.hSubMenu);832 { int nItem; 833 HMENU hmSubMenu; 834 BOOL bAlreadySeparated; 835 MENUITEMINFOA miiSrc; 836 char szName[256]; 837 UINT uTemp, uIDMax = uIDAdjust; 838 839 TRACE("hmenu1=0x%04x hmenu2=0x%04x 0x%04x 0x%04x 0x%04x 0x%04lx\n", 840 hmDst, hmSrc, uInsert, uIDAdjust, uIDAdjustMax, uFlags); 841 842 if (!hmDst || !hmSrc) 843 { return uIDMax; 844 } 845 846 nItem = GetMenuItemCount(hmDst); 847 848 if (uInsert >= (UINT)nItem) /* insert position inside menu? */ 849 { 850 uInsert = (UINT)nItem; /* append on the end */ 851 bAlreadySeparated = TRUE; 852 } 853 else 854 { 855 bAlreadySeparated = _SHIsMenuSeparator(hmDst, uInsert);; 856 } 857 858 if ((uFlags & MM_ADDSEPARATOR) && !bAlreadySeparated) 859 { 860 /* Add a separator between the menus */ 861 InsertMenuA(hmDst, uInsert, MF_BYPOSITION | MF_SEPARATOR, 0, NULL); 862 bAlreadySeparated = TRUE; 863 } 864 865 866 /* Go through the menu items and clone them*/ 867 for (nItem = GetMenuItemCount(hmSrc) - 1; nItem >= 0; nItem--) 868 { 869 miiSrc.cbSize = sizeof(MENUITEMINFOA); 870 miiSrc.fMask = MIIM_STATE | MIIM_ID | MIIM_SUBMENU | MIIM_CHECKMARKS | MIIM_TYPE | MIIM_DATA; 871 872 /* We need to reset this every time through the loop in case menus DON'T have IDs*/ 873 miiSrc.fType = MFT_STRING; 874 miiSrc.dwTypeData = szName; 875 miiSrc.dwItemData = 0; 876 miiSrc.cch = sizeof(szName); 877 878 if (!GetMenuItemInfoA(hmSrc, nItem, TRUE, &miiSrc)) 879 { 880 continue; 881 } 882 883 /* TRACE("found menu=0x%04x %s id=0x%04x mask=0x%08x smenu=0x%04x\n", hmSrc, debugstr_a(miiSrc.dwTypeData), miiSrc.wID, miiSrc.fMask, miiSrc.hSubMenu); 883 884 */ 884 if (miiSrc.fType & MFT_SEPARATOR)885 {886 /* This is a separator; don't put two of them in a row */887 if (bAlreadySeparated)888 continue;889 890 bAlreadySeparated = TRUE;891 }892 else if (miiSrc.hSubMenu)893 {894 if (uFlags & MM_SUBMENUSHAVEIDS)895 {896 miiSrc.wID += uIDAdjust;/* add uIDAdjust to the ID */897 898 if (miiSrc.wID > uIDAdjustMax)/* skip ID's higher uIDAdjustMax */899 continue;900 901 if (uIDMax <= miiSrc.wID)/* remember the highest ID */902 uIDMax = miiSrc.wID + 1;903 }904 else905 {906 miiSrc.fMask &= ~MIIM_ID;/* Don't set IDs for submenus that didn't have them already */907 }908 hmSubMenu = miiSrc.hSubMenu;909 910 miiSrc.hSubMenu = CreatePopupMenu();911 912 if (!miiSrc.hSubMenu) return(uIDMax);913 914 uTemp = Shell_MergeMenus(miiSrc.hSubMenu, hmSubMenu, 0, uIDAdjust, uIDAdjustMax, uFlags & MM_SUBMENUSHAVEIDS);915 916 if (uIDMax <= uTemp)917 uIDMax = uTemp;918 919 bAlreadySeparated = FALSE;920 }921 else/* normal menu item */922 {923 miiSrc.wID += uIDAdjust;/* add uIDAdjust to the ID */924 925 if (miiSrc.wID > uIDAdjustMax)/* skip ID's higher uIDAdjustMax */926 continue;927 928 if (uIDMax <= miiSrc.wID)/* remember the highest ID */929 uIDMax = miiSrc.wID + 1;930 931 bAlreadySeparated = FALSE;932 }933 934 /* TRACE("inserting menu=0x%04x %s id=0x%04x mask=0x%08x smenu=0x%04x\n", hmDst, debugstr_a(miiSrc.dwTypeData), miiSrc.wID, miiSrc.fMask, miiSrc.hSubMenu);885 if (miiSrc.fType & MFT_SEPARATOR) 886 { 887 /* This is a separator; don't put two of them in a row */ 888 if (bAlreadySeparated) 889 continue; 890 891 bAlreadySeparated = TRUE; 892 } 893 else if (miiSrc.hSubMenu) 894 { 895 if (uFlags & MM_SUBMENUSHAVEIDS) 896 { 897 miiSrc.wID += uIDAdjust; /* add uIDAdjust to the ID */ 898 899 if (miiSrc.wID > uIDAdjustMax) /* skip ID's higher uIDAdjustMax */ 900 continue; 901 902 if (uIDMax <= miiSrc.wID) /* remember the highest ID */ 903 uIDMax = miiSrc.wID + 1; 904 } 905 else 906 { 907 miiSrc.fMask &= ~MIIM_ID; /* Don't set IDs for submenus that didn't have them already */ 908 } 909 hmSubMenu = miiSrc.hSubMenu; 910 911 miiSrc.hSubMenu = CreatePopupMenu(); 912 913 if (!miiSrc.hSubMenu) return(uIDMax); 914 915 uTemp = Shell_MergeMenus(miiSrc.hSubMenu, hmSubMenu, 0, uIDAdjust, uIDAdjustMax, uFlags & MM_SUBMENUSHAVEIDS); 916 917 if (uIDMax <= uTemp) 918 uIDMax = uTemp; 919 920 bAlreadySeparated = FALSE; 921 } 922 else /* normal menu item */ 923 { 924 miiSrc.wID += uIDAdjust; /* add uIDAdjust to the ID */ 925 926 if (miiSrc.wID > uIDAdjustMax) /* skip ID's higher uIDAdjustMax */ 927 continue; 928 929 if (uIDMax <= miiSrc.wID) /* remember the highest ID */ 930 uIDMax = miiSrc.wID + 1; 931 932 bAlreadySeparated = FALSE; 933 } 934 935 /* TRACE("inserting menu=0x%04x %s id=0x%04x mask=0x%08x smenu=0x%04x\n", hmDst, debugstr_a(miiSrc.dwTypeData), miiSrc.wID, miiSrc.fMask, miiSrc.hSubMenu); 935 936 */ 936 if (!InsertMenuItemA(hmDst, uInsert, TRUE, &miiSrc))937 {938 return(uIDMax);939 }940 }941 942 /* Ensure the correct number of separators at the beginning of the943 inserted menu items*/944 if (uInsert == 0)945 {946 if (bAlreadySeparated)947 {948 DeleteMenu(hmDst, uInsert, MF_BYPOSITION);949 }950 }951 else952 {953 if (_SHIsMenuSeparator(hmDst, uInsert-1))954 {955 if (bAlreadySeparated)956 {957 DeleteMenu(hmDst, uInsert, MF_BYPOSITION);958 }959 }960 else961 {962 if ((uFlags & MM_ADDSEPARATOR) && !bAlreadySeparated)963 {964 /* Add a separator between the menus*/965 InsertMenuA(hmDst, uInsert, MF_BYPOSITION | MF_SEPARATOR, 0, NULL);966 }967 }968 }969 return(uIDMax);970 } 971 937 if (!InsertMenuItemA(hmDst, uInsert, TRUE, &miiSrc)) 938 { 939 return(uIDMax); 940 } 941 } 942 943 /* Ensure the correct number of separators at the beginning of the 944 inserted menu items*/ 945 if (uInsert == 0) 946 { 947 if (bAlreadySeparated) 948 { 949 DeleteMenu(hmDst, uInsert, MF_BYPOSITION); 950 } 951 } 952 else 953 { 954 if (_SHIsMenuSeparator(hmDst, uInsert-1)) 955 { 956 if (bAlreadySeparated) 957 { 958 DeleteMenu(hmDst, uInsert, MF_BYPOSITION); 959 } 960 } 961 else 962 { 963 if ((uFlags & MM_ADDSEPARATOR) && !bAlreadySeparated) 964 { 965 /* Add a separator between the menus*/ 966 InsertMenuA(hmDst, uInsert, MF_BYPOSITION | MF_SEPARATOR, 0, NULL); 967 } 968 } 969 } 970 return(uIDMax); 971 } 972 -
trunk/src/shell32/shlview.c
r5618 r6650 1 /* $Id: shlview.c,v 1.3 2001-09-05 13:46:59 bird Exp $ */ 1 2 /* 2 * ShellView3 * ShellView 3 4 * 4 * Copyright 1998,1999<juergen.schmied@debitel.net>5 * Copyright 1998,1999 <juergen.schmied@debitel.net> 5 6 * 6 7 * This is the view visualizing the data provied by the shellfolder. 7 * No direct access to data from pidls should be done from here. 8 * 8 * No direct access to data from pidls should be done from here. 9 * 9 10 * FIXME: The order by part of the background context menu should be 10 11 * buily according to the columns shown. … … 20 21 * 21 22 * FIXME: when the ShellView_WndProc gets a WM_NCDESTROY should we do a 22 * Release() ??? 23 * Release() ??? 23 24 */ 24 25 … … 49 50 }LISTVIEW_SORT_INFO, *LPLISTVIEW_SORT_INFO; 50 51 51 typedef struct 52 { ICOM_VFIELD(IShellView);53 DWORDref;54 ICOM_VTABLE(IOleCommandTarget)*lpvtblOleCommandTarget;55 ICOM_VTABLE(IDropTarget)*lpvtblDropTarget;56 ICOM_VTABLE(IDropSource)*lpvtblDropSource;57 ICOM_VTABLE(IViewObject)*lpvtblViewObject;58 IShellFolder*pSFParent;59 IShellFolder2*pSF2Parent;60 IShellBrowser*pShellBrowser;61 ICommDlgBrowser*pCommDlgBrowser;62 HWND hWnd;/* SHELLDLL_DefView */63 HWND hWndList;/* ListView control */64 HWNDhWndParent;65 FOLDERSETTINGSFolderSettings;66 HMENUhMenu;67 UINTuState;68 UINTcidl;69 LPITEMIDLIST*apidl;52 typedef struct 53 { ICOM_VFIELD(IShellView); 54 DWORD ref; 55 ICOM_VTABLE(IOleCommandTarget)* lpvtblOleCommandTarget; 56 ICOM_VTABLE(IDropTarget)* lpvtblDropTarget; 57 ICOM_VTABLE(IDropSource)* lpvtblDropSource; 58 ICOM_VTABLE(IViewObject)* lpvtblViewObject; 59 IShellFolder* pSFParent; 60 IShellFolder2* pSF2Parent; 61 IShellBrowser* pShellBrowser; 62 ICommDlgBrowser* pCommDlgBrowser; 63 HWND hWnd; /* SHELLDLL_DefView */ 64 HWND hWndList; /* ListView control */ 65 HWND hWndParent; 66 FOLDERSETTINGS FolderSettings; 67 HMENU hMenu; 68 UINT uState; 69 UINT cidl; 70 LPITEMIDLIST *apidl; 70 71 LISTVIEW_SORT_INFO ListViewSortInfo; 71 HANDLE hNotify;/* change notification handle */72 HANDLEhAccel;72 HANDLE hNotify; /* change notification handle */ 73 HANDLE hAccel; 73 74 } IShellViewImpl; 74 75 … … 76 77 77 78 static struct ICOM_VTABLE(IOleCommandTarget) ctvt; 78 #define _IOleCommandTarget_Offset ((int)(&(((IShellViewImpl*)0)->lpvtblOleCommandTarget))) 79 #define _ICOM_THIS_From_IOleCommandTarget(class, name) class* This = (class*)(((char*)name)-_IOleCommandTarget_Offset); 79 #define _IOleCommandTarget_Offset ((int)(&(((IShellViewImpl*)0)->lpvtblOleCommandTarget))) 80 #define _ICOM_THIS_From_IOleCommandTarget(class, name) class* This = (class*)(((char*)name)-_IOleCommandTarget_Offset); 80 81 81 82 static struct ICOM_VTABLE(IDropTarget) dtvt; 82 #define _IDropTarget_Offset ((int)(&(((IShellViewImpl*)0)->lpvtblDropTarget))) 83 #define _ICOM_THIS_From_IDropTarget(class, name) class* This = (class*)(((char*)name)-_IDropTarget_Offset); 83 #define _IDropTarget_Offset ((int)(&(((IShellViewImpl*)0)->lpvtblDropTarget))) 84 #define _ICOM_THIS_From_IDropTarget(class, name) class* This = (class*)(((char*)name)-_IDropTarget_Offset); 84 85 85 86 static struct ICOM_VTABLE(IDropSource) dsvt; 86 #define _IDropSource_Offset ((int)(&(((IShellViewImpl*)0)->lpvtblDropSource))) 87 #define _ICOM_THIS_From_IDropSource(class, name) class* This = (class*)(((char*)name)-_IDropSource_Offset); 87 #define _IDropSource_Offset ((int)(&(((IShellViewImpl*)0)->lpvtblDropSource))) 88 #define _ICOM_THIS_From_IDropSource(class, name) class* This = (class*)(((char*)name)-_IDropSource_Offset); 88 89 89 90 static struct ICOM_VTABLE(IViewObject) vovt; 90 #define _IViewObject_Offset ((int)(&(((IShellViewImpl*)0)->lpvtblViewObject))) 91 #define _ICOM_THIS_From_IViewObject(class, name) class* This = (class*)(((char*)name)-_IViewObject_Offset); 91 #define _IViewObject_Offset ((int)(&(((IShellViewImpl*)0)->lpvtblViewObject))) 92 #define _ICOM_THIS_From_IViewObject(class, name) class* This = (class*)(((char*)name)-_IViewObject_Offset); 92 93 93 94 /* ListView Header ID's */ … … 112 113 #define GET_WM_COMMAND_CMD(wp, lp) HIWORD(wp) 113 114 114 extern void WINAPI _InsertMenuItem (HMENU hmenu, UINT indexMenu, BOOL fByPosition, 115 UINT wID, UINT fType, LPSTR dwTypeData, UINT fState);115 extern void WINAPI _InsertMenuItem (HMENU hmenu, UINT indexMenu, BOOL fByPosition, 116 UINT wID, UINT fType, LPSTR dwTypeData, UINT fState); 116 117 117 118 /* … … 127 128 } MYTOOLINFO, *LPMYTOOLINFO; 128 129 129 MYTOOLINFO Tools[] = 130 MYTOOLINFO Tools[] = 130 131 { 131 132 { FCIDM_SHVIEW_BIGICON, 0, 0, IDS_VIEW_LARGE, TBSTATE_ENABLED, TBSTYLE_BUTTON }, … … 143 144 144 145 /********************************************************** 145 * IShellView_Constructor146 * IShellView_Constructor 146 147 */ 147 148 IShellView * IShellView_Constructor( IShellFolder * pFolder) 148 { IShellViewImpl * sv;149 sv=(IShellViewImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IShellViewImpl));150 sv->ref=1;151 ICOM_VTBL(sv)=&svvt;152 sv->lpvtblOleCommandTarget=&ctvt;153 sv->lpvtblDropTarget=&dtvt;154 sv->lpvtblDropSource=&dsvt;155 sv->lpvtblViewObject=&vovt;156 157 sv->pSFParent = pFolder;158 if(pFolder) IShellFolder_AddRef(pFolder);159 IShellFolder_QueryInterface(sv->pSFParent, &IID_IShellFolder2, (LPVOID*)&sv->pSF2Parent);160 161 TRACE("(%p)->(%p)\n",sv, pFolder);162 shell32_ObjCount++;163 return (IShellView *) sv;149 { IShellViewImpl * sv; 150 sv=(IShellViewImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IShellViewImpl)); 151 sv->ref=1; 152 ICOM_VTBL(sv)=&svvt; 153 sv->lpvtblOleCommandTarget=&ctvt; 154 sv->lpvtblDropTarget=&dtvt; 155 sv->lpvtblDropSource=&dsvt; 156 sv->lpvtblViewObject=&vovt; 157 158 sv->pSFParent = pFolder; 159 if(pFolder) IShellFolder_AddRef(pFolder); 160 IShellFolder_QueryInterface(sv->pSFParent, &IID_IShellFolder2, (LPVOID*)&sv->pSF2Parent); 161 162 TRACE("(%p)->(%p)\n",sv, pFolder); 163 shell32_ObjCount++; 164 return (IShellView *) sv; 164 165 } 165 166 … … 169 170 */ 170 171 static BOOL IsInCommDlg(IShellViewImpl * This) 171 { return(This->pCommDlgBrowser != NULL);172 { return(This->pCommDlgBrowser != NULL); 172 173 } 173 174 174 175 static HRESULT IncludeObject(IShellViewImpl * This, LPCITEMIDLIST pidl) 175 176 { 176 HRESULT ret = S_OK;177 178 if ( IsInCommDlg(This) )179 {180 TRACE("ICommDlgBrowser::IncludeObject pidl=%p\n", pidl);181 ret = ICommDlgBrowser_IncludeObject(This->pCommDlgBrowser, (IShellView*)This, pidl);182 TRACE("--0x%08lx\n", ret);183 }184 return ret;177 HRESULT ret = S_OK; 178 179 if ( IsInCommDlg(This) ) 180 { 181 TRACE("ICommDlgBrowser::IncludeObject pidl=%p\n", pidl); 182 ret = ICommDlgBrowser_IncludeObject(This->pCommDlgBrowser, (IShellView*)This, pidl); 183 TRACE("--0x%08lx\n", ret); 184 } 185 return ret; 185 186 } 186 187 187 188 static HRESULT OnDefaultCommand(IShellViewImpl * This) 188 189 { 189 HRESULT ret = S_FALSE;190 191 if (IsInCommDlg(This))192 {193 TRACE("ICommDlgBrowser::OnDefaultCommand\n");194 ret = ICommDlgBrowser_OnDefaultCommand(This->pCommDlgBrowser, (IShellView*)This);195 TRACE("--\n");196 }197 return ret;190 HRESULT ret = S_FALSE; 191 192 if (IsInCommDlg(This)) 193 { 194 TRACE("ICommDlgBrowser::OnDefaultCommand\n"); 195 ret = ICommDlgBrowser_OnDefaultCommand(This->pCommDlgBrowser, (IShellView*)This); 196 TRACE("--\n"); 197 } 198 return ret; 198 199 } 199 200 200 201 static HRESULT OnStateChange(IShellViewImpl * This, UINT uFlags) 201 202 { 202 HRESULT ret = S_FALSE;203 204 if (IsInCommDlg(This))205 {206 TRACE("ICommDlgBrowser::OnStateChange flags=%x\n", uFlags);207 ret = ICommDlgBrowser_OnStateChange(This->pCommDlgBrowser, (IShellView*)This, uFlags);208 TRACE("--\n");209 }210 return ret;211 } 212 /********************************************************** 213 * set the toolbar of the filedialog buttons203 HRESULT ret = S_FALSE; 204 205 if (IsInCommDlg(This)) 206 { 207 TRACE("ICommDlgBrowser::OnStateChange flags=%x\n", uFlags); 208 ret = ICommDlgBrowser_OnStateChange(This->pCommDlgBrowser, (IShellView*)This, uFlags); 209 TRACE("--\n"); 210 } 211 return ret; 212 } 213 /********************************************************** 214 * set the toolbar of the filedialog buttons 214 215 * 215 * - activates the buttons from the shellbrowser according to 216 * - activates the buttons from the shellbrowser according to 216 217 * the view state 217 218 */ 218 219 static void CheckToolbar(IShellViewImpl * This) 219 220 { 220 LRESULT result;221 222 TRACE("\n");223 224 if (IsInCommDlg(This))225 {226 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_TOOLBAR, TB_CHECKBUTTON,227 FCIDM_TB_SMALLICON, (This->FolderSettings.ViewMode==FVM_LIST)? TRUE : FALSE, &result);228 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_TOOLBAR, TB_CHECKBUTTON,229 FCIDM_TB_REPORTVIEW, (This->FolderSettings.ViewMode==FVM_DETAILS)? TRUE : FALSE, &result);230 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_TOOLBAR, TB_ENABLEBUTTON,231 FCIDM_TB_SMALLICON, TRUE, &result);232 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_TOOLBAR, TB_ENABLEBUTTON,233 FCIDM_TB_REPORTVIEW, TRUE, &result);234 }221 LRESULT result; 222 223 TRACE("\n"); 224 225 if (IsInCommDlg(This)) 226 { 227 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_TOOLBAR, TB_CHECKBUTTON, 228 FCIDM_TB_SMALLICON, (This->FolderSettings.ViewMode==FVM_LIST)? TRUE : FALSE, &result); 229 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_TOOLBAR, TB_CHECKBUTTON, 230 FCIDM_TB_REPORTVIEW, (This->FolderSettings.ViewMode==FVM_DETAILS)? TRUE : FALSE, &result); 231 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_TOOLBAR, TB_ENABLEBUTTON, 232 FCIDM_TB_SMALLICON, TRUE, &result); 233 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_TOOLBAR, TB_ENABLEBUTTON, 234 FCIDM_TB_REPORTVIEW, TRUE, &result); 235 } 235 236 } 236 237 … … 240 241 */ 241 242 /********************************************************** 242 * change the style of the listview control243 * change the style of the listview control 243 244 */ 244 245 static void SetStyle(IShellViewImpl * This, DWORD dwAdd, DWORD dwRemove) 245 246 { 246 DWORD tmpstyle;247 248 TRACE("(%p)\n", This);249 250 tmpstyle = GetWindowLongA(This->hWndList, GWL_STYLE);251 SetWindowLongA(This->hWndList, GWL_STYLE, dwAdd | (tmpstyle & ~dwRemove));247 DWORD tmpstyle; 248 249 TRACE("(%p)\n", This); 250 251 tmpstyle = GetWindowLongA(This->hWndList, GWL_STYLE); 252 SetWindowLongA(This->hWndList, GWL_STYLE, dwAdd | (tmpstyle & ~dwRemove)); 252 253 } 253 254 … … 258 259 */ 259 260 static BOOL ShellView_CreateList (IShellViewImpl * This) 260 { DWORD dwStyle;261 262 TRACE("%p\n",This);263 264 dwStyle = WS_TABSTOP | WS_VISIBLE | WS_CHILDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN |265 LVS_SHAREIMAGELISTS | LVS_EDITLABELS | LVS_ALIGNLEFT | LVS_AUTOARRANGE;266 267 switch (This->FolderSettings.ViewMode)268 {269 case FVM_ICON: dwStyle |= LVS_ICON;break;270 case FVM_DETAILS: dwStyle |= LVS_REPORT;break;271 case FVM_SMALLICON: dwStyle |= LVS_SMALLICON;break;272 case FVM_LIST: dwStyle |= LVS_LIST;break;273 default: dwStyle |= LVS_LIST;break;274 }275 276 if (This->FolderSettings.fFlags & FWF_AUTOARRANGE)dwStyle |= LVS_AUTOARRANGE;277 /*if (This->FolderSettings.fFlags && FWF_DESKTOP); used from explorer*/278 if (This->FolderSettings.fFlags & FWF_SINGLESEL)dwStyle |= LVS_SINGLESEL;279 280 This->hWndList=CreateWindowExA( WS_EX_CLIENTEDGE,281 WC_LISTVIEWA,282 NULL,283 dwStyle,284 0,0,0,0,285 This->hWnd,286 (HMENU)ID_LISTVIEW,287 shell32_hInstance,288 NULL);289 290 if(!This->hWndList)291 return FALSE;261 { DWORD dwStyle; 262 263 TRACE("%p\n",This); 264 265 dwStyle = WS_TABSTOP | WS_VISIBLE | WS_CHILDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | 266 LVS_SHAREIMAGELISTS | LVS_EDITLABELS | LVS_ALIGNLEFT | LVS_AUTOARRANGE; 267 268 switch (This->FolderSettings.ViewMode) 269 { 270 case FVM_ICON: dwStyle |= LVS_ICON; break; 271 case FVM_DETAILS: dwStyle |= LVS_REPORT; break; 272 case FVM_SMALLICON: dwStyle |= LVS_SMALLICON; break; 273 case FVM_LIST: dwStyle |= LVS_LIST; break; 274 default: dwStyle |= LVS_LIST; break; 275 } 276 277 if (This->FolderSettings.fFlags & FWF_AUTOARRANGE) dwStyle |= LVS_AUTOARRANGE; 278 /*if (This->FolderSettings.fFlags && FWF_DESKTOP); used from explorer*/ 279 if (This->FolderSettings.fFlags & FWF_SINGLESEL) dwStyle |= LVS_SINGLESEL; 280 281 This->hWndList=CreateWindowExA( WS_EX_CLIENTEDGE, 282 WC_LISTVIEWA, 283 NULL, 284 dwStyle, 285 0,0,0,0, 286 This->hWnd, 287 (HMENU)ID_LISTVIEW, 288 shell32_hInstance, 289 NULL); 290 291 if(!This->hWndList) 292 return FALSE; 292 293 293 294 This->ListViewSortInfo.bIsAscending = TRUE; … … 296 297 297 298 /* UpdateShellSettings(); */ 298 return TRUE;299 return TRUE; 299 300 } 300 301 … … 306 307 static BOOL ShellView_InitList(IShellViewImpl * This) 307 308 { 308 LVCOLUMNAlvColumn;309 SHELLDETAILSsd;310 inti;311 charszTemp[50];312 313 TRACE("%p\n",This);314 315 ListView_DeleteAllItems(This->hWndList);316 317 lvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT;318 lvColumn.pszText = szTemp;319 320 if (This->pSF2Parent)321 {322 for (i=0; 1; i++)323 {324 if (!SUCCEEDED(IShellFolder2_GetDetailsOf(This->pSF2Parent, NULL, i, &sd)))325 break;326 lvColumn.fmt = sd.fmt;327 lvColumn.cx = sd.cxChar*8; /* chars->pixel */328 StrRetToStrNA( szTemp, 50, &sd.str, NULL);329 ListView_InsertColumnA(This->hWndList, i, &lvColumn);330 }331 }332 else333 {334 FIXME("no SF2\n");335 }336 337 ListView_SetImageList(This->hWndList, ShellSmallIconList, LVSIL_SMALL);338 ListView_SetImageList(This->hWndList, ShellBigIconList, LVSIL_NORMAL);339 340 return TRUE;341 } 342 /********************************************************** 343 * ShellView_CompareItems() 309 LVCOLUMNA lvColumn; 310 SHELLDETAILS sd; 311 int i; 312 char szTemp[50]; 313 314 TRACE("%p\n",This); 315 316 ListView_DeleteAllItems(This->hWndList); 317 318 lvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT; 319 lvColumn.pszText = szTemp; 320 321 if (This->pSF2Parent) 322 { 323 for (i=0; 1; i++) 324 { 325 if (!SUCCEEDED(IShellFolder2_GetDetailsOf(This->pSF2Parent, NULL, i, &sd))) 326 break; 327 lvColumn.fmt = sd.fmt; 328 lvColumn.cx = sd.cxChar*8; /* chars->pixel */ 329 StrRetToStrNA( szTemp, 50, &sd.str, NULL); 330 ListView_InsertColumnA(This->hWndList, i, &lvColumn); 331 } 332 } 333 else 334 { 335 FIXME("no SF2\n"); 336 } 337 338 ListView_SetImageList(This->hWndList, ShellSmallIconList, LVSIL_SMALL); 339 ListView_SetImageList(This->hWndList, ShellBigIconList, LVSIL_NORMAL); 340 341 return TRUE; 342 } 343 /********************************************************** 344 * ShellView_CompareItems() 344 345 * 345 346 * NOTES 346 347 * internal, CALLBACK for DSA_Sort 347 */ 348 */ 348 349 static INT CALLBACK ShellView_CompareItems(LPVOID lParam1, LPVOID lParam2, LPARAM lpData) 349 350 { 350 int ret;351 TRACE("pidl1=%p pidl2=%p lpsf=%p\n", lParam1, lParam2, (LPVOID) lpData);352 353 if(!lpData) return 0;354 355 ret = (SHORT) SCODE_CODE(IShellFolder_CompareIDs((LPSHELLFOLDER)lpData, 0, (LPITEMIDLIST)lParam1, (LPITEMIDLIST)lParam2)); 356 TRACE("ret=%i\n",ret);357 return ret;351 int ret; 352 TRACE("pidl1=%p pidl2=%p lpsf=%p\n", lParam1, lParam2, (LPVOID) lpData); 353 354 if(!lpData) return 0; 355 356 ret = (SHORT) SCODE_CODE(IShellFolder_CompareIDs((LPSHELLFOLDER)lpData, 0, (LPITEMIDLIST)lParam1, (LPITEMIDLIST)lParam2)); 357 TRACE("ret=%i\n",ret); 358 return ret; 358 359 } 359 360 … … 369 370 * 370 371 * RETURNS 371 * A negative value if the first item should precede the second, 372 * a positive value if the first item should follow the second, 372 * A negative value if the first item should precede the second, 373 * a positive value if the first item should follow the second, 373 374 * or zero if the two items are equivalent 374 375 * 375 376 * NOTES 376 * FIXME: function does what ShellView_CompareItems is supposed to do.377 * unify it and figure out how to use the undocumented first parameter378 * of IShellFolder_CompareIDs to do the job this function does and379 * move this code to IShellFolder.380 * make LISTVIEW_SORT_INFO obsolete381 * the way this function works is only usable if we had only382 * filesystemfolders (25/10/99 jsch)377 * FIXME: function does what ShellView_CompareItems is supposed to do. 378 * unify it and figure out how to use the undocumented first parameter 379 * of IShellFolder_CompareIDs to do the job this function does and 380 * move this code to IShellFolder. 381 * make LISTVIEW_SORT_INFO obsolete 382 * the way this function works is only usable if we had only 383 * filesystemfolders (25/10/99 jsch) 383 384 */ 384 385 static INT CALLBACK ShellView_ListViewCompareItems(LPVOID lParam1, LPVOID lParam2, LPARAM lpData) … … 403 404 } 404 405 else 405 { 406 { 406 407 /* Sort by Time: Folders or Files can be sorted */ 407 408 408 409 if(pSortInfo->nHeaderID == LISTVIEW_COLUMN_TIME) 409 410 { … … 442 443 } 443 444 /* If the Date, FileSize, FileType, Attrib was the same, sort by FileName */ 444 445 445 446 if(nDiff == 0) 446 447 { … … 461 462 /********************************************************** 462 463 * LV_FindItemByPidl() 463 */ 464 */ 464 465 static int LV_FindItemByPidl( 465 IShellViewImpl * This,466 LPCITEMIDLIST pidl)467 { 468 LVITEMA lvItem;469 ZeroMemory(&lvItem, sizeof(LVITEMA));470 lvItem.mask = LVIF_PARAM;471 for(lvItem.iItem = 0; ListView_GetItemA(This->hWndList, &lvItem); lvItem.iItem++)472 {473 LPITEMIDLIST currentpidl = (LPITEMIDLIST) lvItem.lParam;474 HRESULT hr = IShellFolder_CompareIDs(This->pSFParent, 0, pidl, currentpidl);475 if(SUCCEEDED(hr) && !HRESULT_CODE(hr))476 {477 return lvItem.iItem;478 }479 }480 return -1;466 IShellViewImpl * This, 467 LPCITEMIDLIST pidl) 468 { 469 LVITEMA lvItem; 470 ZeroMemory(&lvItem, sizeof(LVITEMA)); 471 lvItem.mask = LVIF_PARAM; 472 for(lvItem.iItem = 0; ListView_GetItemA(This->hWndList, &lvItem); lvItem.iItem++) 473 { 474 LPITEMIDLIST currentpidl = (LPITEMIDLIST) lvItem.lParam; 475 HRESULT hr = IShellFolder_CompareIDs(This->pSFParent, 0, pidl, currentpidl); 476 if(SUCCEEDED(hr) && !HRESULT_CODE(hr)) 477 { 478 return lvItem.iItem; 479 } 480 } 481 return -1; 481 482 } 482 483 … … 486 487 static BOOLEAN LV_AddItem(IShellViewImpl * This, LPCITEMIDLIST pidl) 487 488 { 488 LVITEMAlvItem;489 490 TRACE("(%p)(pidl=%p)\n", This, pidl);491 492 ZeroMemory(&lvItem, sizeof(lvItem));/* create the listview item*/493 lvItem.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;/*set the mask*/494 lvItem.iItem = ListView_GetItemCount(This->hWndList);/*add the item to the end of the list*/495 lvItem.lParam = (LPARAM) ILClone(ILFindLastID(pidl));/*set the item's data*/496 lvItem.pszText = LPSTR_TEXTCALLBACKA;/*get text on a callback basis*/497 lvItem.iImage = I_IMAGECALLBACK;/*get the image on a callback basis*/498 return (-1==ListView_InsertItemA(This->hWndList, &lvItem))? FALSE: TRUE;489 LVITEMA lvItem; 490 491 TRACE("(%p)(pidl=%p)\n", This, pidl); 492 493 ZeroMemory(&lvItem, sizeof(lvItem)); /* create the listview item*/ 494 lvItem.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM; /*set the mask*/ 495 lvItem.iItem = ListView_GetItemCount(This->hWndList); /*add the item to the end of the list*/ 496 lvItem.lParam = (LPARAM) ILClone(ILFindLastID(pidl)); /*set the item's data*/ 497 lvItem.pszText = LPSTR_TEXTCALLBACKA; /*get text on a callback basis*/ 498 lvItem.iImage = I_IMAGECALLBACK; /*get the image on a callback basis*/ 499 return (-1==ListView_InsertItemA(This->hWndList, &lvItem))? FALSE: TRUE; 499 500 } 500 501 … … 504 505 static BOOLEAN LV_DeleteItem(IShellViewImpl * This, LPCITEMIDLIST pidl) 505 506 { 506 int nIndex;507 508 TRACE("(%p)(pidl=%p)\n", This, pidl);509 510 nIndex = LV_FindItemByPidl(This, ILFindLastID(pidl));511 return (-1==ListView_DeleteItem(This->hWndList, nIndex))? FALSE: TRUE;507 int nIndex; 508 509 TRACE("(%p)(pidl=%p)\n", This, pidl); 510 511 nIndex = LV_FindItemByPidl(This, ILFindLastID(pidl)); 512 return (-1==ListView_DeleteItem(This->hWndList, nIndex))? FALSE: TRUE; 512 513 } 513 514 … … 517 518 static BOOLEAN LV_RenameItem(IShellViewImpl * This, LPCITEMIDLIST pidlOld, LPCITEMIDLIST pidlNew ) 518 519 { 519 int nItem;520 LVITEMA lvItem;521 522 TRACE("(%p)(pidlold=%p pidlnew=%p)\n", This, pidlOld, pidlNew);523 524 nItem = LV_FindItemByPidl(This, ILFindLastID(pidlOld));525 if ( -1 != nItem )526 {527 ZeroMemory(&lvItem, sizeof(lvItem));/* create the listview item*/528 lvItem.mask = LVIF_PARAM;/* only the pidl */529 lvItem.iItem = nItem;530 ListView_GetItemA(This->hWndList, &lvItem);531 532 SHFree((LPITEMIDLIST)lvItem.lParam);533 lvItem.mask = LVIF_PARAM;534 lvItem.iItem = nItem;535 lvItem.lParam = (LPARAM) ILClone(ILFindLastID(pidlNew));/* set the item's data */536 ListView_SetItemA(This->hWndList, &lvItem);537 ListView_Update(This->hWndList, nItem);538 return TRUE;/* fixme: better handling */539 }540 return FALSE;520 int nItem; 521 LVITEMA lvItem; 522 523 TRACE("(%p)(pidlold=%p pidlnew=%p)\n", This, pidlOld, pidlNew); 524 525 nItem = LV_FindItemByPidl(This, ILFindLastID(pidlOld)); 526 if ( -1 != nItem ) 527 { 528 ZeroMemory(&lvItem, sizeof(lvItem)); /* create the listview item*/ 529 lvItem.mask = LVIF_PARAM; /* only the pidl */ 530 lvItem.iItem = nItem; 531 ListView_GetItemA(This->hWndList, &lvItem); 532 533 SHFree((LPITEMIDLIST)lvItem.lParam); 534 lvItem.mask = LVIF_PARAM; 535 lvItem.iItem = nItem; 536 lvItem.lParam = (LPARAM) ILClone(ILFindLastID(pidlNew)); /* set the item's data */ 537 ListView_SetItemA(This->hWndList, &lvItem); 538 ListView_Update(This->hWndList, nItem); 539 return TRUE; /* fixme: better handling */ 540 } 541 return FALSE; 541 542 } 542 543 /********************************************************** … … 546 547 * - sorts the list 547 548 * - fills the list into the view 548 */ 549 */ 549 550 550 551 static HRESULT ShellView_FillList(IShellViewImpl * This) 551 552 { 552 LPENUMIDLISTpEnumIDList;553 LPITEMIDLISTpidl;554 DWORDdwFetched;555 UINTi;556 HRESULThRes;557 HDPAhdpa;558 559 TRACE("%p\n",This);560 561 /* get the itemlist from the shfolder*/ 562 hRes = IShellFolder_EnumObjects(This->pSFParent,This->hWnd, SHCONTF_NONFOLDERS | SHCONTF_FOLDERS, &pEnumIDList);563 if (hRes != S_OK)564 {565 if (hRes==S_FALSE)566 return(NOERROR);567 return(hRes);568 }569 570 /* create a pointer array */ 571 hdpa = pDPA_Create(16);572 if (!hdpa)573 {574 return(E_OUTOFMEMORY);575 }576 577 /* copy the items into the array*/578 while((S_OK == IEnumIDList_Next(pEnumIDList,1, &pidl, &dwFetched)) && dwFetched)579 {580 if (pDPA_InsertPtr(hdpa, 0x7fff, pidl) == -1)581 {582 SHFree(pidl);583 } 584 }585 586 /* sort the array */587 pDPA_Sort(hdpa, ShellView_CompareItems, (LPARAM)This->pSFParent);588 589 /*turn the listview's redrawing off*/590 SendMessageA(This->hWndList, WM_SETREDRAW, FALSE, 0); 591 592 for (i=0; i < DPA_GetPtrCount(hdpa); ++i)/* DPA_GetPtrCount is a macro*/593 {594 pidl = (LPITEMIDLIST)pDPA_GetPtr(hdpa, i);595 596 /* in a commdlg This works as a filemask*/597 if ( IncludeObject(This, pidl)==S_OK )598 LV_AddItem(This, pidl);599 SHFree(pidl);600 }601 602 /*turn the listview's redrawing back on and force it to draw*/603 SendMessageA(This->hWndList, WM_SETREDRAW, TRUE, 0);604 605 IEnumIDList_Release(pEnumIDList); /* destroy the list*/606 pDPA_Destroy(hdpa);607 608 return S_OK;553 LPENUMIDLIST pEnumIDList; 554 LPITEMIDLIST pidl; 555 DWORD dwFetched; 556 UINT i; 557 HRESULT hRes; 558 HDPA hdpa; 559 560 TRACE("%p\n",This); 561 562 /* get the itemlist from the shfolder*/ 563 hRes = IShellFolder_EnumObjects(This->pSFParent,This->hWnd, SHCONTF_NONFOLDERS | SHCONTF_FOLDERS, &pEnumIDList); 564 if (hRes != S_OK) 565 { 566 if (hRes==S_FALSE) 567 return(NOERROR); 568 return(hRes); 569 } 570 571 /* create a pointer array */ 572 hdpa = pDPA_Create(16); 573 if (!hdpa) 574 { 575 return(E_OUTOFMEMORY); 576 } 577 578 /* copy the items into the array*/ 579 while((S_OK == IEnumIDList_Next(pEnumIDList,1, &pidl, &dwFetched)) && dwFetched) 580 { 581 if (pDPA_InsertPtr(hdpa, 0x7fff, pidl) == -1) 582 { 583 SHFree(pidl); 584 } 585 } 586 587 /* sort the array */ 588 pDPA_Sort(hdpa, ShellView_CompareItems, (LPARAM)This->pSFParent); 589 590 /*turn the listview's redrawing off*/ 591 SendMessageA(This->hWndList, WM_SETREDRAW, FALSE, 0); 592 593 for (i=0; i < DPA_GetPtrCount(hdpa); ++i) /* DPA_GetPtrCount is a macro*/ 594 { 595 pidl = (LPITEMIDLIST)pDPA_GetPtr(hdpa, i); 596 597 /* in a commdlg This works as a filemask*/ 598 if ( IncludeObject(This, pidl)==S_OK ) 599 LV_AddItem(This, pidl); 600 SHFree(pidl); 601 } 602 603 /*turn the listview's redrawing back on and force it to draw*/ 604 SendMessageA(This->hWndList, WM_SETREDRAW, TRUE, 0); 605 606 IEnumIDList_Release(pEnumIDList); /* destroy the list*/ 607 pDPA_Destroy(hdpa); 608 609 return S_OK; 609 610 } 610 611 611 612 /********************************************************** 612 613 * ShellView_OnCreate() 613 */ 614 */ 614 615 static LRESULT ShellView_OnCreate(IShellViewImpl * This) 615 616 { 616 IDropTarget* pdt;617 NOTIFYREGISTER ntreg;618 IPersistFolder2 * ppf2 = NULL;619 620 TRACE("%p\n",This);621 622 if(ShellView_CreateList(This))623 {624 if(ShellView_InitList(This))625 {626 ShellView_FillList(This);627 }628 }629 630 if(GetShellOle())631 {632 if (SUCCEEDED(IShellFolder_CreateViewObject(This->pSFParent, This->hWnd, &IID_IDropTarget, (LPVOID*)&pdt)))633 {634 pRegisterDragDrop(This->hWnd, pdt);635 IDropTarget_Release(pdt);636 }637 }638 639 /* register for receiving notifications */640 IShellFolder_QueryInterface(This->pSFParent, &IID_IPersistFolder2, (LPVOID*)&ppf2);641 if (ppf2)642 {643 IPersistFolder2_GetCurFolder(ppf2, &ntreg.pidlPath);644 ntreg.bWatchSubtree = FALSE;645 This->hNotify = SHChangeNotifyRegister(This->hWnd, SHCNF_IDLIST, SHCNE_ALLEVENTS, SHV_CHANGE_NOTIFY, 1, &ntreg);646 SHFree(ntreg.pidlPath);647 IPersistFolder2_Release(ppf2);648 }649 650 This->hAccel = LoadAcceleratorsA(shell32_hInstance, "shv_accel");651 652 return S_OK;653 } 654 655 /********************************************************** 656 * #### Handling of the menus ####617 IDropTarget* pdt; 618 NOTIFYREGISTER ntreg; 619 IPersistFolder2 * ppf2 = NULL; 620 621 TRACE("%p\n",This); 622 623 if(ShellView_CreateList(This)) 624 { 625 if(ShellView_InitList(This)) 626 { 627 ShellView_FillList(This); 628 } 629 } 630 631 if(GetShellOle()) 632 { 633 if (SUCCEEDED(IShellFolder_CreateViewObject(This->pSFParent, This->hWnd, &IID_IDropTarget, (LPVOID*)&pdt))) 634 { 635 pRegisterDragDrop(This->hWnd, pdt); 636 IDropTarget_Release(pdt); 637 } 638 } 639 640 /* register for receiving notifications */ 641 IShellFolder_QueryInterface(This->pSFParent, &IID_IPersistFolder2, (LPVOID*)&ppf2); 642 if (ppf2) 643 { 644 IPersistFolder2_GetCurFolder(ppf2, &ntreg.pidlPath); 645 ntreg.bWatchSubtree = FALSE; 646 This->hNotify = SHChangeNotifyRegister(This->hWnd, SHCNF_IDLIST, SHCNE_ALLEVENTS, SHV_CHANGE_NOTIFY, 1, &ntreg); 647 SHFree(ntreg.pidlPath); 648 IPersistFolder2_Release(ppf2); 649 } 650 651 This->hAccel = LoadAcceleratorsA(shell32_hInstance, "shv_accel"); 652 653 return S_OK; 654 } 655 656 /********************************************************** 657 * #### Handling of the menus #### 657 658 */ 658 659 … … 661 662 */ 662 663 static HMENU ShellView_BuildFileMenu(IShellViewImpl * This) 663 { CHARszText[MAX_PATH];664 MENUITEMINFOAmii;665 intnTools,i;666 HMENUhSubMenu;667 668 TRACE("(%p)\n",This);669 670 hSubMenu = CreatePopupMenu();671 if(hSubMenu)672 { /*get the number of items in our global array*/673 for(nTools = 0; Tools[nTools].idCommand != -1; nTools++){}674 675 /*add the menu items*/676 for(i = 0; i < nTools; i++)677 { 678 LoadStringA(shell32_hInstance, Tools[i].idMenuString, szText, MAX_PATH);679 680 ZeroMemory(&mii, sizeof(mii));681 mii.cbSize = sizeof(mii);682 mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE;683 684 if(TBSTYLE_SEP != Tools[i].bStyle) /* no seperator*/685 {686 mii.fType = MFT_STRING;687 mii.fState = MFS_ENABLED;688 mii.dwTypeData = szText;689 mii.wID = Tools[i].idCommand;690 }691 else692 {693 mii.fType = MFT_SEPARATOR;694 }695 /* tack This item onto the end of the menu */696 InsertMenuItemA(hSubMenu, (UINT)-1, TRUE, &mii);697 }698 }699 TRACE("-- return (menu=0x%x)\n",hSubMenu);700 return hSubMenu;664 { CHAR szText[MAX_PATH]; 665 MENUITEMINFOA mii; 666 int nTools,i; 667 HMENU hSubMenu; 668 669 TRACE("(%p)\n",This); 670 671 hSubMenu = CreatePopupMenu(); 672 if(hSubMenu) 673 { /*get the number of items in our global array*/ 674 for(nTools = 0; Tools[nTools].idCommand != -1; nTools++){} 675 676 /*add the menu items*/ 677 for(i = 0; i < nTools; i++) 678 { 679 LoadStringA(shell32_hInstance, Tools[i].idMenuString, szText, MAX_PATH); 680 681 ZeroMemory(&mii, sizeof(mii)); 682 mii.cbSize = sizeof(mii); 683 mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE; 684 685 if(TBSTYLE_SEP != Tools[i].bStyle) /* no seperator*/ 686 { 687 mii.fType = MFT_STRING; 688 mii.fState = MFS_ENABLED; 689 mii.dwTypeData = szText; 690 mii.wID = Tools[i].idCommand; 691 } 692 else 693 { 694 mii.fType = MFT_SEPARATOR; 695 } 696 /* tack This item onto the end of the menu */ 697 InsertMenuItemA(hSubMenu, (UINT)-1, TRUE, &mii); 698 } 699 } 700 TRACE("-- return (menu=0x%x)\n",hSubMenu); 701 return hSubMenu; 701 702 } 702 703 /********************************************************** … … 704 705 */ 705 706 static void ShellView_MergeFileMenu(IShellViewImpl * This, HMENU hSubMenu) 706 { TRACE("(%p)->(submenu=0x%08x) stub\n",This,hSubMenu);707 708 if(hSubMenu)709 { /*insert This item at the beginning of the menu */710 _InsertMenuItem(hSubMenu, 0, TRUE, 0, MFT_SEPARATOR, NULL, MFS_ENABLED);711 _InsertMenuItem(hSubMenu, 0, TRUE, IDM_MYFILEITEM, MFT_STRING, "dummy45", MFS_ENABLED);712 713 }714 TRACE("--\n"); 707 { TRACE("(%p)->(submenu=0x%08x) stub\n",This,hSubMenu); 708 709 if(hSubMenu) 710 { /*insert This item at the beginning of the menu */ 711 _InsertMenuItem(hSubMenu, 0, TRUE, 0, MFT_SEPARATOR, NULL, MFS_ENABLED); 712 _InsertMenuItem(hSubMenu, 0, TRUE, IDM_MYFILEITEM, MFT_STRING, "dummy45", MFS_ENABLED); 713 714 } 715 TRACE("--\n"); 715 716 } 716 717 … … 720 721 721 722 static void ShellView_MergeViewMenu(IShellViewImpl * This, HMENU hSubMenu) 722 { MENUITEMINFOAmii;723 724 TRACE("(%p)->(submenu=0x%08x)\n",This,hSubMenu);725 726 if(hSubMenu)727 { /*add a separator at the correct position in the menu*/728 _InsertMenuItem(hSubMenu, FCIDM_MENU_VIEW_SEP_OPTIONS, FALSE, 0, MFT_SEPARATOR, NULL, MFS_ENABLED);729 730 ZeroMemory(&mii, sizeof(mii));731 mii.cbSize = sizeof(mii);732 mii.fMask = MIIM_SUBMENU | MIIM_TYPE | MIIM_DATA;;733 mii.fType = MFT_STRING;734 mii.dwTypeData = "View";735 mii.hSubMenu = LoadMenuA(shell32_hInstance, "MENU_001");736 InsertMenuItemA(hSubMenu, FCIDM_MENU_VIEW_SEP_OPTIONS, FALSE, &mii);737 }723 { MENUITEMINFOA mii; 724 725 TRACE("(%p)->(submenu=0x%08x)\n",This,hSubMenu); 726 727 if(hSubMenu) 728 { /*add a separator at the correct position in the menu*/ 729 _InsertMenuItem(hSubMenu, FCIDM_MENU_VIEW_SEP_OPTIONS, FALSE, 0, MFT_SEPARATOR, NULL, MFS_ENABLED); 730 731 ZeroMemory(&mii, sizeof(mii)); 732 mii.cbSize = sizeof(mii); 733 mii.fMask = MIIM_SUBMENU | MIIM_TYPE | MIIM_DATA;; 734 mii.fType = MFT_STRING; 735 mii.dwTypeData = "View"; 736 mii.hSubMenu = LoadMenuA(shell32_hInstance, "MENU_001"); 737 InsertMenuItemA(hSubMenu, FCIDM_MENU_VIEW_SEP_OPTIONS, FALSE, &mii); 738 } 738 739 } 739 740 … … 745 746 * RETURNS 746 747 * number of selected items 747 */ 748 */ 748 749 static UINT ShellView_GetSelections(IShellViewImpl * This) 749 750 { 750 LVITEMAlvItem;751 UINTi = 0;752 753 if (This->apidl)754 {755 SHFree(This->apidl);756 }757 758 This->cidl = ListView_GetSelectedCount(This->hWndList);759 This->apidl = (LPITEMIDLIST*)SHAlloc(This->cidl * sizeof(LPITEMIDLIST));760 761 TRACE("selected=%i\n", This->cidl);762 763 if(This->apidl)764 {765 TRACE("-- Items selected =%u\n", This->cidl);766 767 ZeroMemory(&lvItem, sizeof(lvItem));768 lvItem.mask = LVIF_STATE | LVIF_PARAM;769 lvItem.stateMask = LVIS_SELECTED;770 771 while(ListView_GetItemA(This->hWndList, &lvItem) && (i < This->cidl))772 {773 if(lvItem.state & LVIS_SELECTED)774 {775 This->apidl[i] = (LPITEMIDLIST)lvItem.lParam;776 i++;777 TRACE("-- selected Item found\n");778 }779 lvItem.iItem++;780 }781 }782 return This->cidl;783 784 } 785 /********************************************************** 786 * ShellView_DoContextMenu()751 LVITEMA lvItem; 752 UINT i = 0; 753 754 if (This->apidl) 755 { 756 SHFree(This->apidl); 757 } 758 759 This->cidl = ListView_GetSelectedCount(This->hWndList); 760 This->apidl = (LPITEMIDLIST*)SHAlloc(This->cidl * sizeof(LPITEMIDLIST)); 761 762 TRACE("selected=%i\n", This->cidl); 763 764 if(This->apidl) 765 { 766 TRACE("-- Items selected =%u\n", This->cidl); 767 768 ZeroMemory(&lvItem, sizeof(lvItem)); 769 lvItem.mask = LVIF_STATE | LVIF_PARAM; 770 lvItem.stateMask = LVIS_SELECTED; 771 772 while(ListView_GetItemA(This->hWndList, &lvItem) && (i < This->cidl)) 773 { 774 if(lvItem.state & LVIS_SELECTED) 775 { 776 This->apidl[i] = (LPITEMIDLIST)lvItem.lParam; 777 i++; 778 TRACE("-- selected Item found\n"); 779 } 780 lvItem.iItem++; 781 } 782 } 783 return This->cidl; 784 785 } 786 /********************************************************** 787 * ShellView_DoContextMenu() 787 788 */ 788 789 static void ShellView_DoContextMenu(IShellViewImpl * This, WORD x, WORD y, BOOL bDefault) 789 { UINTuCommand;790 DWORDwFlags;791 HMENUhMenu;792 BOOLfExplore = FALSE;793 HWNDhwndTree = 0;794 LPCONTEXTMENUpContextMenu = NULL;795 IContextMenu *pCM = NULL;796 CMINVOKECOMMANDINFOcmi;797 798 TRACE("(%p)->(0x%08x 0x%08x 0x%08x) stub\n",This, x, y, bDefault);799 800 /* look, what's selected and create a context menu object of it*/801 if( ShellView_GetSelections(This) )802 {803 IShellFolder_GetUIObjectOf( This->pSFParent, This->hWndParent, This->cidl, This->apidl, 804 (REFIID)&IID_IContextMenu, NULL, (LPVOID *)&pContextMenu);805 806 if(pContextMenu)807 {808 TRACE("-- pContextMenu\n");809 hMenu = CreatePopupMenu();810 811 if( hMenu )812 {813 /* See if we are in Explore or Open mode. If the browser's tree is present, we are in Explore mode.*/814 if(SUCCEEDED(IShellBrowser_GetControlWindow(This->pShellBrowser,FCW_TREE, &hwndTree)) && hwndTree)815 {816 TRACE("-- explore mode\n");817 fExplore = TRUE;818 }819 820 /* build the flags depending on what we can do with the selected item */821 wFlags = CMF_NORMAL | (This->cidl != 1 ? 0 : CMF_CANRENAME) | (fExplore ? CMF_EXPLORE : 0);822 823 /* let the ContextMenu merge its items in */824 if (SUCCEEDED(IContextMenu_QueryContextMenu( pContextMenu, hMenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, wFlags )))825 {826 if( bDefault )827 {828 TRACE("-- get menu default command\n");829 uCommand = GetMenuDefaultItem(hMenu, FALSE, GMDI_GOINTOPOPUPS);830 }831 else832 {833 TRACE("-- track popup\n");834 uCommand = TrackPopupMenu( hMenu,TPM_LEFTALIGN | TPM_RETURNCMD,x,y,0,This->hWnd,NULL);835 } 836 837 if(uCommand > 0)838 {839 TRACE("-- uCommand=%u\n", uCommand);840 if (IsInCommDlg(This) && ((uCommand==FCIDM_SHVIEW_EXPLORE) || (uCommand==FCIDM_SHVIEW_OPEN)))841 {842 TRACE("-- dlg: OnDefaultCommand\n");843 OnDefaultCommand(This);844 }845 else846 {847 TRACE("-- explore -- invoke command\n");848 ZeroMemory(&cmi, sizeof(cmi));849 cmi.cbSize = sizeof(cmi);850 cmi.hwnd = This->hWndParent; /* this window has to answer CWM_GETISHELLBROWSER */851 cmi.lpVerb = (LPCSTR)MAKEINTRESOURCEA(uCommand);852 IContextMenu_InvokeCommand(pContextMenu, &cmi);853 }854 }855 DestroyMenu(hMenu);856 }857 }858 if (pContextMenu)859 IContextMenu_Release(pContextMenu);860 }861 }862 else/* background context menu */863 { 864 hMenu = CreatePopupMenu();865 866 pCM = ISvBgCm_Constructor(This->pSFParent);867 IContextMenu_QueryContextMenu(pCM, hMenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, 0);868 869 uCommand = TrackPopupMenu( hMenu, TPM_LEFTALIGN | TPM_RETURNCMD,x,y,0,This->hWnd,NULL);870 DestroyMenu(hMenu);871 872 TRACE("-- (%p)->(uCommand=0x%08x )\n",This, uCommand);873 874 ZeroMemory(&cmi, sizeof(cmi));875 cmi.cbSize = sizeof(cmi);876 cmi.lpVerb = (LPCSTR)MAKEINTRESOURCEA(uCommand);877 cmi.hwnd = This->hWndParent;878 IContextMenu_InvokeCommand(pCM, &cmi);879 880 IContextMenu_Release(pCM);881 }882 } 883 884 /********************************************************** 885 * ##### message handling #####790 { UINT uCommand; 791 DWORD wFlags; 792 HMENU hMenu; 793 BOOL fExplore = FALSE; 794 HWND hwndTree = 0; 795 LPCONTEXTMENU pContextMenu = NULL; 796 IContextMenu * pCM = NULL; 797 CMINVOKECOMMANDINFO cmi; 798 799 TRACE("(%p)->(0x%08x 0x%08x 0x%08x) stub\n",This, x, y, bDefault); 800 801 /* look, what's selected and create a context menu object of it*/ 802 if( ShellView_GetSelections(This) ) 803 { 804 IShellFolder_GetUIObjectOf( This->pSFParent, This->hWndParent, This->cidl, This->apidl, 805 (REFIID)&IID_IContextMenu, NULL, (LPVOID *)&pContextMenu); 806 807 if(pContextMenu) 808 { 809 TRACE("-- pContextMenu\n"); 810 hMenu = CreatePopupMenu(); 811 812 if( hMenu ) 813 { 814 /* See if we are in Explore or Open mode. If the browser's tree is present, we are in Explore mode.*/ 815 if(SUCCEEDED(IShellBrowser_GetControlWindow(This->pShellBrowser,FCW_TREE, &hwndTree)) && hwndTree) 816 { 817 TRACE("-- explore mode\n"); 818 fExplore = TRUE; 819 } 820 821 /* build the flags depending on what we can do with the selected item */ 822 wFlags = CMF_NORMAL | (This->cidl != 1 ? 0 : CMF_CANRENAME) | (fExplore ? CMF_EXPLORE : 0); 823 824 /* let the ContextMenu merge its items in */ 825 if (SUCCEEDED(IContextMenu_QueryContextMenu( pContextMenu, hMenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, wFlags ))) 826 { 827 if( bDefault ) 828 { 829 TRACE("-- get menu default command\n"); 830 uCommand = GetMenuDefaultItem(hMenu, FALSE, GMDI_GOINTOPOPUPS); 831 } 832 else 833 { 834 TRACE("-- track popup\n"); 835 uCommand = TrackPopupMenu( hMenu,TPM_LEFTALIGN | TPM_RETURNCMD,x,y,0,This->hWnd,NULL); 836 } 837 838 if(uCommand > 0) 839 { 840 TRACE("-- uCommand=%u\n", uCommand); 841 if (IsInCommDlg(This) && ((uCommand==FCIDM_SHVIEW_EXPLORE) || (uCommand==FCIDM_SHVIEW_OPEN))) 842 { 843 TRACE("-- dlg: OnDefaultCommand\n"); 844 OnDefaultCommand(This); 845 } 846 else 847 { 848 TRACE("-- explore -- invoke command\n"); 849 ZeroMemory(&cmi, sizeof(cmi)); 850 cmi.cbSize = sizeof(cmi); 851 cmi.hwnd = This->hWndParent; /* this window has to answer CWM_GETISHELLBROWSER */ 852 cmi.lpVerb = (LPCSTR)MAKEINTRESOURCEA(uCommand); 853 IContextMenu_InvokeCommand(pContextMenu, &cmi); 854 } 855 } 856 DestroyMenu(hMenu); 857 } 858 } 859 if (pContextMenu) 860 IContextMenu_Release(pContextMenu); 861 } 862 } 863 else /* background context menu */ 864 { 865 hMenu = CreatePopupMenu(); 866 867 pCM = ISvBgCm_Constructor(This->pSFParent); 868 IContextMenu_QueryContextMenu(pCM, hMenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, 0); 869 870 uCommand = TrackPopupMenu( hMenu, TPM_LEFTALIGN | TPM_RETURNCMD,x,y,0,This->hWnd,NULL); 871 DestroyMenu(hMenu); 872 873 TRACE("-- (%p)->(uCommand=0x%08x )\n",This, uCommand); 874 875 ZeroMemory(&cmi, sizeof(cmi)); 876 cmi.cbSize = sizeof(cmi); 877 cmi.lpVerb = (LPCSTR)MAKEINTRESOURCEA(uCommand); 878 cmi.hwnd = This->hWndParent; 879 IContextMenu_InvokeCommand(pCM, &cmi); 880 881 IContextMenu_Release(pCM); 882 } 883 } 884 885 /********************************************************** 886 * ##### message handling ##### 886 887 */ 887 888 … … 891 892 static LRESULT ShellView_OnSize(IShellViewImpl * This, WORD wWidth, WORD wHeight) 892 893 { 893 TRACE("%p width=%u height=%u\n",This, wWidth,wHeight);894 895 /*resize the ListView to fit our window*/896 if(This->hWndList)897 {898 MoveWindow(This->hWndList, 0, 0, wWidth, wHeight, TRUE);899 }900 901 return S_OK;894 TRACE("%p width=%u height=%u\n",This, wWidth,wHeight); 895 896 /*resize the ListView to fit our window*/ 897 if(This->hWndList) 898 { 899 MoveWindow(This->hWndList, 0, 0, wWidth, wHeight, TRUE); 900 } 901 902 return S_OK; 902 903 } 903 904 /********************************************************** … … 906 907 * NOTES 907 908 * internal 908 */ 909 */ 909 910 static void ShellView_OnDeactivate(IShellViewImpl * This) 910 911 { 911 TRACE("%p\n",This);912 913 if(This->uState != SVUIA_DEACTIVATE)914 {915 if(This->hMenu)916 {917 IShellBrowser_SetMenuSB(This->pShellBrowser,0, 0, 0);918 IShellBrowser_RemoveMenusSB(This->pShellBrowser,This->hMenu);919 DestroyMenu(This->hMenu);920 This->hMenu = 0;921 }922 923 This->uState = SVUIA_DEACTIVATE;924 }912 TRACE("%p\n",This); 913 914 if(This->uState != SVUIA_DEACTIVATE) 915 { 916 if(This->hMenu) 917 { 918 IShellBrowser_SetMenuSB(This->pShellBrowser,0, 0, 0); 919 IShellBrowser_RemoveMenusSB(This->pShellBrowser,This->hMenu); 920 DestroyMenu(This->hMenu); 921 This->hMenu = 0; 922 } 923 924 This->uState = SVUIA_DEACTIVATE; 925 } 925 926 } 926 927 927 928 /********************************************************** 928 929 * ShellView_OnActivate() 929 */ 930 */ 930 931 static LRESULT ShellView_OnActivate(IShellViewImpl * This, UINT uState) 931 { OLEMENUGROUPWIDTHS omw = { {0, 0, 0, 0, 0, 0} };932 MENUITEMINFOA mii;933 CHAR szText[MAX_PATH];934 935 TRACE("%p uState=%x\n",This,uState); 936 937 /*don't do anything if the state isn't really changing */938 if(This->uState == uState)939 {940 return S_OK;941 }942 943 ShellView_OnDeactivate(This);944 945 /*only do This if we are active */946 if(uState != SVUIA_DEACTIVATE)947 {948 /*merge the menus */949 This->hMenu = CreateMenu();950 951 if(This->hMenu)952 {953 IShellBrowser_InsertMenusSB(This->pShellBrowser, This->hMenu, &omw);954 TRACE("-- after fnInsertMenusSB\n"); 955 956 /*build the top level menu get the menu item's text*/957 strcpy(szText,"dummy 31");958 959 ZeroMemory(&mii, sizeof(mii));960 mii.cbSize = sizeof(mii);961 mii.fMask = MIIM_SUBMENU | MIIM_TYPE | MIIM_STATE;962 mii.fType = MFT_STRING;963 mii.fState = MFS_ENABLED;964 mii.dwTypeData = szText;965 mii.hSubMenu = ShellView_BuildFileMenu(This);966 967 /*insert our menu into the menu bar*/968 if(mii.hSubMenu)969 {970 InsertMenuItemA(This->hMenu, FCIDM_MENU_HELP, FALSE, &mii);971 }972 973 /*get the view menu so we can merge with it*/974 ZeroMemory(&mii, sizeof(mii));975 mii.cbSize = sizeof(mii);976 mii.fMask = MIIM_SUBMENU;977 978 if(GetMenuItemInfoA(This->hMenu, FCIDM_MENU_VIEW, FALSE, &mii))979 {980 ShellView_MergeViewMenu(This, mii.hSubMenu);981 }982 983 /*add the items that should only be added if we have the focus*/984 if(SVUIA_ACTIVATE_FOCUS == uState)985 {986 /*get the file menu so we can merge with it */987 ZeroMemory(&mii, sizeof(mii));988 mii.cbSize = sizeof(mii);989 mii.fMask = MIIM_SUBMENU;990 991 if(GetMenuItemInfoA(This->hMenu, FCIDM_MENU_FILE, FALSE, &mii))992 {993 ShellView_MergeFileMenu(This, mii.hSubMenu);994 }995 }996 TRACE("-- before fnSetMenuSB\n"); 997 IShellBrowser_SetMenuSB(This->pShellBrowser, This->hMenu, 0, This->hWnd);998 }999 }1000 This->uState = uState;1001 TRACE("--\n"); 1002 return S_OK;932 { OLEMENUGROUPWIDTHS omw = { {0, 0, 0, 0, 0, 0} }; 933 MENUITEMINFOA mii; 934 CHAR szText[MAX_PATH]; 935 936 TRACE("%p uState=%x\n",This,uState); 937 938 /*don't do anything if the state isn't really changing */ 939 if(This->uState == uState) 940 { 941 return S_OK; 942 } 943 944 ShellView_OnDeactivate(This); 945 946 /*only do This if we are active */ 947 if(uState != SVUIA_DEACTIVATE) 948 { 949 /*merge the menus */ 950 This->hMenu = CreateMenu(); 951 952 if(This->hMenu) 953 { 954 IShellBrowser_InsertMenusSB(This->pShellBrowser, This->hMenu, &omw); 955 TRACE("-- after fnInsertMenusSB\n"); 956 957 /*build the top level menu get the menu item's text*/ 958 strcpy(szText,"dummy 31"); 959 960 ZeroMemory(&mii, sizeof(mii)); 961 mii.cbSize = sizeof(mii); 962 mii.fMask = MIIM_SUBMENU | MIIM_TYPE | MIIM_STATE; 963 mii.fType = MFT_STRING; 964 mii.fState = MFS_ENABLED; 965 mii.dwTypeData = szText; 966 mii.hSubMenu = ShellView_BuildFileMenu(This); 967 968 /*insert our menu into the menu bar*/ 969 if(mii.hSubMenu) 970 { 971 InsertMenuItemA(This->hMenu, FCIDM_MENU_HELP, FALSE, &mii); 972 } 973 974 /*get the view menu so we can merge with it*/ 975 ZeroMemory(&mii, sizeof(mii)); 976 mii.cbSize = sizeof(mii); 977 mii.fMask = MIIM_SUBMENU; 978 979 if(GetMenuItemInfoA(This->hMenu, FCIDM_MENU_VIEW, FALSE, &mii)) 980 { 981 ShellView_MergeViewMenu(This, mii.hSubMenu); 982 } 983 984 /*add the items that should only be added if we have the focus*/ 985 if(SVUIA_ACTIVATE_FOCUS == uState) 986 { 987 /*get the file menu so we can merge with it */ 988 ZeroMemory(&mii, sizeof(mii)); 989 mii.cbSize = sizeof(mii); 990 mii.fMask = MIIM_SUBMENU; 991 992 if(GetMenuItemInfoA(This->hMenu, FCIDM_MENU_FILE, FALSE, &mii)) 993 { 994 ShellView_MergeFileMenu(This, mii.hSubMenu); 995 } 996 } 997 TRACE("-- before fnSetMenuSB\n"); 998 IShellBrowser_SetMenuSB(This->pShellBrowser, This->hMenu, 0, This->hWnd); 999 } 1000 } 1001 This->uState = uState; 1002 TRACE("--\n"); 1003 return S_OK; 1003 1004 } 1004 1005 … … 1009 1010 static LRESULT ShellView_OnSetFocus(IShellViewImpl * This) 1010 1011 { 1011 TRACE("%p\n",This);1012 1013 /* Tell the browser one of our windows has received the focus. This1014 should always be done before merging menus (OnActivate merges the 1015 menus) if one of our windows has the focus.*/1016 1017 IShellBrowser_OnViewWindowActive(This->pShellBrowser,(IShellView*) This);1018 ShellView_OnActivate(This, SVUIA_ACTIVATE_FOCUS);1019 1020 /* Set the focus to the listview */1021 SetFocus(This->hWndList);1022 1023 /* Notify the ICommDlgBrowser interface */1024 OnStateChange(This,CDBOSC_SETFOCUS);1025 1026 return 0;1012 TRACE("%p\n",This); 1013 1014 /* Tell the browser one of our windows has received the focus. This 1015 should always be done before merging menus (OnActivate merges the 1016 menus) if one of our windows has the focus.*/ 1017 1018 IShellBrowser_OnViewWindowActive(This->pShellBrowser,(IShellView*) This); 1019 ShellView_OnActivate(This, SVUIA_ACTIVATE_FOCUS); 1020 1021 /* Set the focus to the listview */ 1022 SetFocus(This->hWndList); 1023 1024 /* Notify the ICommDlgBrowser interface */ 1025 OnStateChange(This,CDBOSC_SETFOCUS); 1026 1027 return 0; 1027 1028 } 1028 1029 1029 1030 /********************************************************** 1030 1031 * ShellView_OnKillFocus() 1031 */ 1032 */ 1032 1033 static LRESULT ShellView_OnKillFocus(IShellViewImpl * This) 1033 1034 { 1034 TRACE("(%p) stub\n",This);1035 1036 ShellView_OnActivate(This, SVUIA_ACTIVATE_NOFOCUS);1037 /* Notify the ICommDlgBrowser */1038 OnStateChange(This,CDBOSC_KILLFOCUS);1039 1040 return 0;1035 TRACE("(%p) stub\n",This); 1036 1037 ShellView_OnActivate(This, SVUIA_ACTIVATE_NOFOCUS); 1038 /* Notify the ICommDlgBrowser */ 1039 OnStateChange(This,CDBOSC_KILLFOCUS); 1040 1041 return 0; 1041 1042 } 1042 1043 … … 1045 1046 * 1046 1047 * NOTES 1047 * the CmdID's are the ones from the context menu1048 */ 1048 * the CmdID's are the ones from the context menu 1049 */ 1049 1050 static LRESULT ShellView_OnCommand(IShellViewImpl * This,DWORD dwCmdID, DWORD dwCmd, HWND hwndCmd) 1050 1051 { 1051 TRACE("(%p)->(0x%08lx 0x%08lx 0x%08x) stub\n",This, dwCmdID, dwCmd, hwndCmd);1052 1053 switch(dwCmdID)1054 {1055 case FCIDM_SHVIEW_SMALLICON:1056 This->FolderSettings.ViewMode = FVM_SMALLICON;1057 SetStyle (This, LVS_SMALLICON, LVS_TYPEMASK);1058 CheckToolbar(This);1059 break;1060 1061 case FCIDM_SHVIEW_BIGICON:1062 This->FolderSettings.ViewMode = FVM_ICON;1063 SetStyle (This, LVS_ICON, LVS_TYPEMASK);1064 CheckToolbar(This);1065 break;1066 1067 case FCIDM_SHVIEW_LISTVIEW:1068 This->FolderSettings.ViewMode = FVM_LIST;1069 SetStyle (This, LVS_LIST, LVS_TYPEMASK);1070 CheckToolbar(This);1071 break;1072 1073 case FCIDM_SHVIEW_REPORTVIEW:1074 This->FolderSettings.ViewMode = FVM_DETAILS;1075 SetStyle (This, LVS_REPORT, LVS_TYPEMASK);1076 CheckToolbar(This);1077 break;1078 1079 /* the menu-ID's for sorting are 0x30... see shrec.rc */1080 case 0x30:1081 case 0x31:1082 case 0x32:1083 case 0x33:1084 This->ListViewSortInfo.nHeaderID = (LPARAM) (dwCmdID - 0x30);1085 This->ListViewSortInfo.bIsAscending = TRUE;1086 This->ListViewSortInfo.nLastHeaderID = This->ListViewSortInfo.nHeaderID;1087 ListView_SortItems(This->hWndList, ShellView_ListViewCompareItems, (LPARAM) (&(This->ListViewSortInfo)));1088 break;1089 1090 default:1091 TRACE("-- COMMAND 0x%04lx unhandled\n", dwCmdID);1092 }1093 return 0;1052 TRACE("(%p)->(0x%08lx 0x%08lx 0x%08x) stub\n",This, dwCmdID, dwCmd, hwndCmd); 1053 1054 switch(dwCmdID) 1055 { 1056 case FCIDM_SHVIEW_SMALLICON: 1057 This->FolderSettings.ViewMode = FVM_SMALLICON; 1058 SetStyle (This, LVS_SMALLICON, LVS_TYPEMASK); 1059 CheckToolbar(This); 1060 break; 1061 1062 case FCIDM_SHVIEW_BIGICON: 1063 This->FolderSettings.ViewMode = FVM_ICON; 1064 SetStyle (This, LVS_ICON, LVS_TYPEMASK); 1065 CheckToolbar(This); 1066 break; 1067 1068 case FCIDM_SHVIEW_LISTVIEW: 1069 This->FolderSettings.ViewMode = FVM_LIST; 1070 SetStyle (This, LVS_LIST, LVS_TYPEMASK); 1071 CheckToolbar(This); 1072 break; 1073 1074 case FCIDM_SHVIEW_REPORTVIEW: 1075 This->FolderSettings.ViewMode = FVM_DETAILS; 1076 SetStyle (This, LVS_REPORT, LVS_TYPEMASK); 1077 CheckToolbar(This); 1078 break; 1079 1080 /* the menu-ID's for sorting are 0x30... see shrec.rc */ 1081 case 0x30: 1082 case 0x31: 1083 case 0x32: 1084 case 0x33: 1085 This->ListViewSortInfo.nHeaderID = (LPARAM) (dwCmdID - 0x30); 1086 This->ListViewSortInfo.bIsAscending = TRUE; 1087 This->ListViewSortInfo.nLastHeaderID = This->ListViewSortInfo.nHeaderID; 1088 ListView_SortItems(This->hWndList, ShellView_ListViewCompareItems, (LPARAM) (&(This->ListViewSortInfo))); 1089 break; 1090 1091 default: 1092 TRACE("-- COMMAND 0x%04lx unhandled\n", dwCmdID); 1093 } 1094 return 0; 1094 1095 } 1095 1096 … … 1097 1098 * ShellView_OnNotify() 1098 1099 */ 1099 1100 1100 1101 static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpnmh) 1101 { LPNMLISTVIEW lpnmlv = (LPNMLISTVIEW)lpnmh;1102 NMLVDISPINFOA *lpdi = (NMLVDISPINFOA *)lpnmh;1103 LPITEMIDLIST pidl;1104 1105 TRACE("%p CtlID=%u lpnmh->code=%x\n",This,CtlID,lpnmh->code);1106 1107 switch(lpnmh->code)1108 {1109 case NM_SETFOCUS:1110 TRACE("-- NM_SETFOCUS %p\n",This);1111 ShellView_OnSetFocus(This);1112 break;1113 1114 case NM_KILLFOCUS:1115 TRACE("-- NM_KILLFOCUS %p\n",This);1116 ShellView_OnDeactivate(This);1117 /* Notify the ICommDlgBrowser interface */1118 OnStateChange(This,CDBOSC_KILLFOCUS);1119 break;1120 1121 case HDN_ENDTRACKA:1122 TRACE("-- HDN_ENDTRACKA %p\n",This);1123 /*nColumn1 = ListView_GetColumnWidth(This->hWndList, 0);1124 nColumn2 = ListView_GetColumnWidth(This->hWndList, 1);*/1125 break;1126 1127 case LVN_DELETEITEM:1128 TRACE("-- LVN_DELETEITEM %p\n",This);1129 SHFree((LPITEMIDLIST)lpnmlv->lParam); /*delete the pidl because we made a copy of it*/1130 break;1131 1132 case LVN_ITEMACTIVATE:1133 TRACE("-- LVN_ITEMACTIVATE %p\n",This);1134 OnStateChange(This, CDBOSC_SELCHANGE); /* the browser will get the IDataObject now */1135 ShellView_DoContextMenu(This, 0, 0, TRUE);1136 break;1137 1138 case LVN_COLUMNCLICK:1139 This->ListViewSortInfo.nHeaderID = lpnmlv->iSubItem;1140 if(This->ListViewSortInfo.nLastHeaderID == This->ListViewSortInfo.nHeaderID)1141 {1142 This->ListViewSortInfo.bIsAscending = !This->ListViewSortInfo.bIsAscending;1143 }1144 else1145 {1146 This->ListViewSortInfo.bIsAscending = TRUE;1147 }1148 This->ListViewSortInfo.nLastHeaderID = This->ListViewSortInfo.nHeaderID;1149 1150 ListView_SortItems(lpnmlv->hdr.hwndFrom, ShellView_ListViewCompareItems, (LPARAM) (&(This->ListViewSortInfo)));1151 break;1152 1153 case LVN_GETDISPINFOA:1154 TRACE("-- LVN_GETDISPINFOA %p\n",This);1155 pidl = (LPITEMIDLIST)lpdi->item.lParam;1156 1157 if(lpdi->item.mask & LVIF_TEXT)/* text requested */1158 {1159 if (This->pSF2Parent)1160 {1161 SHELLDETAILS sd;1162 IShellFolder2_GetDetailsOf(This->pSF2Parent, pidl, lpdi->item.iSubItem, &sd);1163 StrRetToStrNA( lpdi->item.pszText, lpdi->item.cchTextMax, &sd.str, NULL);1164 TRACE("-- text=%s\n",lpdi->item.pszText); 1165 }1166 else1167 {1168 FIXME("no SF2\n");1169 }1170 }1171 if(lpdi->item.mask & LVIF_IMAGE)/* image requested */1172 {1173 lpdi->item.iImage = SHMapPIDLToSystemImageListIndex(This->pSFParent, pidl, 0);1174 }1175 break;1176 1177 case LVN_ITEMCHANGED:1178 TRACE("-- LVN_ITEMCHANGED %p\n",This);1179 OnStateChange(This, CDBOSC_SELCHANGE); /* the browser will get the IDataObject now */1180 break;1181 1182 case LVN_BEGINDRAG:1183 case LVN_BEGINRDRAG:1184 TRACE("-- LVN_BEGINDRAG\n");1185 1186 if (ShellView_GetSelections(This))1187 { 1188 IDataObject * pda;1189 DWORD dwAttributes = SFGAO_CANLINK;1190 DWORD dwEffect = DROPEFFECT_COPY | DROPEFFECT_MOVE;1191 1192 if(GetShellOle())1193 {1194 if (SUCCEEDED(IShellFolder_GetUIObjectOf(This->pSFParent, This->hWnd, This->cidl, This->apidl, &IID_IDataObject,0,(LPVOID *)&pda)))1195 {1196 IDropSource * pds = (IDropSource*)&(This->lpvtblDropSource);/* own DropSource interface */1197 1198 if (SUCCEEDED(IShellFolder_GetAttributesOf(This->pSFParent, This->cidl, This->apidl, &dwAttributes)))1199 {1200 if (dwAttributes & SFGAO_CANLINK)1201 {1202 dwEffect |= DROPEFFECT_LINK;1203 }1204 }1205 1206 if (pds)1207 {1208 DWORD dwEffect;1209 pDoDragDrop(pda, pds, dwEffect, &dwEffect);1210 }1211 IDataObject_Release(pda);1212 }1213 }1214 }1215 break;1216 1217 case LVN_BEGINLABELEDITA:1218 {1219 DWORD dwAttr = SFGAO_CANRENAME;1220 pidl = (LPITEMIDLIST)lpdi->item.lParam;1221 1222 TRACE("-- LVN_BEGINLABELEDITA %p\n",This);1223 1224 IShellFolder_GetAttributesOf(This->pSFParent, 1, &pidl, &dwAttr);1225 if (SFGAO_CANRENAME & dwAttr)1226 {1227 return FALSE;1228 }1229 return TRUE;1230 }1231 break;1232 1233 case LVN_ENDLABELEDITA:1234 {1235 TRACE("-- LVN_ENDLABELEDITA %p\n",This);1236 if (lpdi->item.pszText)1237 {1238 HRESULT hr;1239 WCHAR wszNewName[MAX_PATH];1240 LVITEMA lvItem;1241 1242 ZeroMemory(&lvItem, sizeof(LVITEMA));1243 lvItem.iItem = lpdi->item.iItem;1244 lvItem.mask = LVIF_PARAM;1245 ListView_GetItemA(This->hWndList, &lvItem);1246 1247 pidl = (LPITEMIDLIST)lpdi->item.lParam;1102 { LPNMLISTVIEW lpnmlv = (LPNMLISTVIEW)lpnmh; 1103 NMLVDISPINFOA *lpdi = (NMLVDISPINFOA *)lpnmh; 1104 LPITEMIDLIST pidl; 1105 1106 TRACE("%p CtlID=%u lpnmh->code=%x\n",This,CtlID,lpnmh->code); 1107 1108 switch(lpnmh->code) 1109 { 1110 case NM_SETFOCUS: 1111 TRACE("-- NM_SETFOCUS %p\n",This); 1112 ShellView_OnSetFocus(This); 1113 break; 1114 1115 case NM_KILLFOCUS: 1116 TRACE("-- NM_KILLFOCUS %p\n",This); 1117 ShellView_OnDeactivate(This); 1118 /* Notify the ICommDlgBrowser interface */ 1119 OnStateChange(This,CDBOSC_KILLFOCUS); 1120 break; 1121 1122 case HDN_ENDTRACKA: 1123 TRACE("-- HDN_ENDTRACKA %p\n",This); 1124 /*nColumn1 = ListView_GetColumnWidth(This->hWndList, 0); 1125 nColumn2 = ListView_GetColumnWidth(This->hWndList, 1);*/ 1126 break; 1127 1128 case LVN_DELETEITEM: 1129 TRACE("-- LVN_DELETEITEM %p\n",This); 1130 SHFree((LPITEMIDLIST)lpnmlv->lParam); /*delete the pidl because we made a copy of it*/ 1131 break; 1132 1133 case LVN_ITEMACTIVATE: 1134 TRACE("-- LVN_ITEMACTIVATE %p\n",This); 1135 OnStateChange(This, CDBOSC_SELCHANGE); /* the browser will get the IDataObject now */ 1136 ShellView_DoContextMenu(This, 0, 0, TRUE); 1137 break; 1138 1139 case LVN_COLUMNCLICK: 1140 This->ListViewSortInfo.nHeaderID = lpnmlv->iSubItem; 1141 if(This->ListViewSortInfo.nLastHeaderID == This->ListViewSortInfo.nHeaderID) 1142 { 1143 This->ListViewSortInfo.bIsAscending = !This->ListViewSortInfo.bIsAscending; 1144 } 1145 else 1146 { 1147 This->ListViewSortInfo.bIsAscending = TRUE; 1148 } 1149 This->ListViewSortInfo.nLastHeaderID = This->ListViewSortInfo.nHeaderID; 1150 1151 ListView_SortItems(lpnmlv->hdr.hwndFrom, ShellView_ListViewCompareItems, (LPARAM) (&(This->ListViewSortInfo))); 1152 break; 1153 1154 case LVN_GETDISPINFOA: 1155 TRACE("-- LVN_GETDISPINFOA %p\n",This); 1156 pidl = (LPITEMIDLIST)lpdi->item.lParam; 1157 1158 if(lpdi->item.mask & LVIF_TEXT) /* text requested */ 1159 { 1160 if (This->pSF2Parent) 1161 { 1162 SHELLDETAILS sd; 1163 IShellFolder2_GetDetailsOf(This->pSF2Parent, pidl, lpdi->item.iSubItem, &sd); 1164 StrRetToStrNA( lpdi->item.pszText, lpdi->item.cchTextMax, &sd.str, NULL); 1165 TRACE("-- text=%s\n",lpdi->item.pszText); 1166 } 1167 else 1168 { 1169 FIXME("no SF2\n"); 1170 } 1171 } 1172 if(lpdi->item.mask & LVIF_IMAGE) /* image requested */ 1173 { 1174 lpdi->item.iImage = SHMapPIDLToSystemImageListIndex(This->pSFParent, pidl, 0); 1175 } 1176 break; 1177 1178 case LVN_ITEMCHANGED: 1179 TRACE("-- LVN_ITEMCHANGED %p\n",This); 1180 OnStateChange(This, CDBOSC_SELCHANGE); /* the browser will get the IDataObject now */ 1181 break; 1182 1183 case LVN_BEGINDRAG: 1184 case LVN_BEGINRDRAG: 1185 TRACE("-- LVN_BEGINDRAG\n"); 1186 1187 if (ShellView_GetSelections(This)) 1188 { 1189 IDataObject * pda; 1190 DWORD dwAttributes = SFGAO_CANLINK; 1191 DWORD dwEffect = DROPEFFECT_COPY | DROPEFFECT_MOVE; 1192 1193 if(GetShellOle()) 1194 { 1195 if (SUCCEEDED(IShellFolder_GetUIObjectOf(This->pSFParent, This->hWnd, This->cidl, This->apidl, &IID_IDataObject,0,(LPVOID *)&pda))) 1196 { 1197 IDropSource * pds = (IDropSource*)&(This->lpvtblDropSource); /* own DropSource interface */ 1198 1199 if (SUCCEEDED(IShellFolder_GetAttributesOf(This->pSFParent, This->cidl, This->apidl, &dwAttributes))) 1200 { 1201 if (dwAttributes & SFGAO_CANLINK) 1202 { 1203 dwEffect |= DROPEFFECT_LINK; 1204 } 1205 } 1206 1207 if (pds) 1208 { 1209 DWORD dwEffect; 1210 pDoDragDrop(pda, pds, dwEffect, &dwEffect); 1211 } 1212 IDataObject_Release(pda); 1213 } 1214 } 1215 } 1216 break; 1217 1218 case LVN_BEGINLABELEDITA: 1219 { 1220 DWORD dwAttr = SFGAO_CANRENAME; 1221 pidl = (LPITEMIDLIST)lpdi->item.lParam; 1222 1223 TRACE("-- LVN_BEGINLABELEDITA %p\n",This); 1224 1225 IShellFolder_GetAttributesOf(This->pSFParent, 1, &pidl, &dwAttr); 1226 if (SFGAO_CANRENAME & dwAttr) 1227 { 1228 return FALSE; 1229 } 1230 return TRUE; 1231 } 1232 break; 1233 1234 case LVN_ENDLABELEDITA: 1235 { 1236 TRACE("-- LVN_ENDLABELEDITA %p\n",This); 1237 if (lpdi->item.pszText) 1238 { 1239 HRESULT hr; 1240 WCHAR wszNewName[MAX_PATH]; 1241 LVITEMA lvItem; 1242 1243 ZeroMemory(&lvItem, sizeof(LVITEMA)); 1244 lvItem.iItem = lpdi->item.iItem; 1245 lvItem.mask = LVIF_PARAM; 1246 ListView_GetItemA(This->hWndList, &lvItem); 1247 1248 pidl = (LPITEMIDLIST)lpdi->item.lParam; 1248 1249 if (!MultiByteToWideChar( CP_ACP, 0, lpdi->item.pszText, -1, wszNewName, MAX_PATH )) 1249 1250 wszNewName[MAX_PATH-1] = 0; 1250 hr = IShellFolder_SetNameOf(This->pSFParent, 0, pidl, wszNewName, SHGDN_INFOLDER, &pidl);1251 1252 if(SUCCEEDED(hr) && pidl)1253 {1254 lvItem.mask = LVIF_PARAM;1255 lvItem.lParam = (LPARAM)pidl;1256 ListView_SetItemA(This->hWndList, &lvItem);1257 return TRUE;1258 }1259 }1260 return FALSE;1261 }1262 break;1263 1264 case LVN_KEYDOWN:1265 {1266 /* MSG msg;1267 msg.hwnd = This->hWnd;1268 msg.message = WM_KEYDOWN;1269 msg.wParam = plvKeyDown->wVKey;1270 msg.lParam = 0;1271 msg.time = 0;1272 msg.pt = 0;*/1273 1274 LPNMLVKEYDOWN plvKeyDown = (LPNMLVKEYDOWN) lpnmh;1251 hr = IShellFolder_SetNameOf(This->pSFParent, 0, pidl, wszNewName, SHGDN_INFOLDER, &pidl); 1252 1253 if(SUCCEEDED(hr) && pidl) 1254 { 1255 lvItem.mask = LVIF_PARAM; 1256 lvItem.lParam = (LPARAM)pidl; 1257 ListView_SetItemA(This->hWndList, &lvItem); 1258 return TRUE; 1259 } 1260 } 1261 return FALSE; 1262 } 1263 break; 1264 1265 case LVN_KEYDOWN: 1266 { 1267 /* MSG msg; 1268 msg.hwnd = This->hWnd; 1269 msg.message = WM_KEYDOWN; 1270 msg.wParam = plvKeyDown->wVKey; 1271 msg.lParam = 0; 1272 msg.time = 0; 1273 msg.pt = 0;*/ 1274 1275 LPNMLVKEYDOWN plvKeyDown = (LPNMLVKEYDOWN) lpnmh; 1275 1276 1276 1277 /* initiate a rename of the selected file or directory */ … … 1285 1286 /* get selected item */ 1286 1287 i = ListView_GetNextItem(This->hWndList, -1, 1287 LVNI_SELECTED);1288 1288 LVNI_SELECTED); 1289 1289 1290 ListView_EnsureVisible(This->hWndList, i, 0); 1290 1291 ListView_EditLabelA(This->hWndList, i); … … 1292 1293 } 1293 1294 #if 0 1294 TranslateAccelerator(This->hWnd, This->hAccel, &msg)1295 TranslateAccelerator(This->hWnd, This->hAccel, &msg) 1295 1296 #endif 1296 else if(plvKeyDown->wVKey == VK_DELETE)1297 else if(plvKeyDown->wVKey == VK_DELETE) 1297 1298 { 1298 int i, item_index;1299 LVITEMA item;1300 LPITEMIDLIST* pItems;1301 ISFHelper *psfhlp;1302 1303 IShellFolder_QueryInterface(This->pSFParent, &IID_ISFHelper,1304 (LPVOID*)&psfhlp);1305 1306 if(!(i = ListView_GetSelectedCount(This->hWndList)))1307 break;1308 1309 /* allocate memory for the pidl array */1310 pItems = HeapAlloc(GetProcessHeap(), 0, 1311 sizeof(LPITEMIDLIST) * i);1312 1313 /* retrieve all selected items */1314 i = 0;1315 item_index = -1;1316 while(ListView_GetSelectedCount(This->hWndList) > i)1317 {1318 /* get selected item */1319 item_index = ListView_GetNextItem(This->hWndList, 1320 item_index, LVNI_SELECTED);1321 item.iItem = item_index;1322 ListView_GetItemA(This->hWndList, &item);1323 1324 /* get item pidl */1325 pItems[i] = (LPITEMIDLIST)item.lParam;1326 1327 i++;1328 }1329 1330 /* perform the item deletion */1331 ISFHelper_DeleteItems(psfhlp, i, pItems);1332 1333 /* free pidl array memory */1334 HeapFree(GetProcessHeap(), 0, pItems);1299 int i, item_index; 1300 LVITEMA item; 1301 LPITEMIDLIST* pItems; 1302 ISFHelper *psfhlp; 1303 1304 IShellFolder_QueryInterface(This->pSFParent, &IID_ISFHelper, 1305 (LPVOID*)&psfhlp); 1306 1307 if(!(i = ListView_GetSelectedCount(This->hWndList))) 1308 break; 1309 1310 /* allocate memory for the pidl array */ 1311 pItems = HeapAlloc(GetProcessHeap(), 0, 1312 sizeof(LPITEMIDLIST) * i); 1313 1314 /* retrieve all selected items */ 1315 i = 0; 1316 item_index = -1; 1317 while(ListView_GetSelectedCount(This->hWndList) > i) 1318 { 1319 /* get selected item */ 1320 item_index = ListView_GetNextItem(This->hWndList, 1321 item_index, LVNI_SELECTED); 1322 item.iItem = item_index; 1323 ListView_GetItemA(This->hWndList, &item); 1324 1325 /* get item pidl */ 1326 pItems[i] = (LPITEMIDLIST)item.lParam; 1327 1328 i++; 1329 } 1330 1331 /* perform the item deletion */ 1332 ISFHelper_DeleteItems(psfhlp, i, pItems); 1333 1334 /* free pidl array memory */ 1335 HeapFree(GetProcessHeap(), 0, pItems); 1335 1336 } 1336 1337 else 1337 FIXME("LVN_KEYDOWN key=0x%08x\n",plvKeyDown->wVKey);1338 }1339 break;1340 1341 default:1342 TRACE("-- %p WM_COMMAND %x unhandled\n", This, lpnmh->code);1343 break;;1344 }1345 return 0;1338 FIXME("LVN_KEYDOWN key=0x%08x\n",plvKeyDown->wVKey); 1339 } 1340 break; 1341 1342 default: 1343 TRACE("-- %p WM_COMMAND %x unhandled\n", This, lpnmh->code); 1344 break;; 1345 } 1346 return 0; 1346 1347 } 1347 1348 … … 1353 1354 { 1354 1355 1355 TRACE("(%p)(%p,%p,0x%08lx)\n", This, Pidls[0], Pidls[1], wEventId);1356 switch(wEventId)1357 { 1358 case SHCNE_MKDIR:1359 case SHCNE_CREATE:1360 LV_AddItem(This, Pidls[0]);1361 break;1362 case SHCNE_RMDIR:1363 case SHCNE_DELETE:1364 LV_DeleteItem(This, Pidls[0]);1365 break;1366 case SHCNE_RENAMEFOLDER:1367 case SHCNE_RENAMEITEM:1368 LV_RenameItem(This, Pidls[0], Pidls[1]);1369 break;1370 case SHCNE_UPDATEITEM:1371 break;1372 }1373 return TRUE;1356 TRACE("(%p)(%p,%p,0x%08lx)\n", This, Pidls[0], Pidls[1], wEventId); 1357 switch(wEventId) 1358 { 1359 case SHCNE_MKDIR: 1360 case SHCNE_CREATE: 1361 LV_AddItem(This, Pidls[0]); 1362 break; 1363 case SHCNE_RMDIR: 1364 case SHCNE_DELETE: 1365 LV_DeleteItem(This, Pidls[0]); 1366 break; 1367 case SHCNE_RENAMEFOLDER: 1368 case SHCNE_RENAMEITEM: 1369 LV_RenameItem(This, Pidls[0], Pidls[1]); 1370 break; 1371 case SHCNE_UPDATEITEM: 1372 break; 1373 } 1374 return TRUE; 1374 1375 } 1375 1376 /********************************************************** … … 1379 1380 static LRESULT CALLBACK ShellView_WndProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam) 1380 1381 { 1381 IShellViewImpl * pThis = (IShellViewImpl*)GetWindowLongA(hWnd, GWL_USERDATA);1382 LPCREATESTRUCTA lpcs;1383 1384 TRACE("(hwnd=%x msg=%x wparm=%x lparm=%lx)\n",hWnd, uMessage, wParam, lParam);1385 1386 switch (uMessage)1387 {1388 case WM_NCCREATE:1389 lpcs = (LPCREATESTRUCTA)lParam;1390 pThis = (IShellViewImpl*)(lpcs->lpCreateParams);1391 SetWindowLongA(hWnd, GWL_USERDATA, (LONG)pThis);1392 pThis->hWnd = hWnd; /*set the window handle*/1393 break;1394 1395 case WM_SIZE:return ShellView_OnSize(pThis,LOWORD(lParam), HIWORD(lParam));1396 case WM_SETFOCUS:return ShellView_OnSetFocus(pThis);1397 case WM_KILLFOCUS:return ShellView_OnKillFocus(pThis);1398 case WM_CREATE:return ShellView_OnCreate(pThis);1399 case WM_ACTIVATE:return ShellView_OnActivate(pThis, SVUIA_ACTIVATE_FOCUS);1400 case WM_NOTIFY:return ShellView_OnNotify(pThis,(UINT)wParam, (LPNMHDR)lParam);1401 case WM_COMMAND: return ShellView_OnCommand(pThis, 1402 GET_WM_COMMAND_ID(wParam, lParam), 1403 GET_WM_COMMAND_CMD(wParam, lParam), 1404 GET_WM_COMMAND_HWND(wParam, lParam));1405 case SHV_CHANGE_NOTIFY: return ShellView_OnChange(pThis, (LPITEMIDLIST*)wParam, (LONG)lParam);1406 1407 case WM_CONTEXTMENU: ShellView_DoContextMenu(pThis, LOWORD(lParam), HIWORD(lParam), FALSE);1408 return 0;1409 1410 case WM_SHOWWINDOW:UpdateWindow(pThis->hWndList);1411 break;1412 1413 case WM_GETDLGCODE: return SendMessageA(pThis->hWndList,uMessage,0,0);1414 1415 case WM_DESTROY:if(GetShellOle())1416 {1417 pRevokeDragDrop(pThis->hWnd);1418 }1419 SHChangeNotifyDeregister(pThis->hNotify);1420 break;1421 }1422 1423 return DefWindowProcA (hWnd, uMessage, wParam, lParam);1382 IShellViewImpl * pThis = (IShellViewImpl*)GetWindowLongA(hWnd, GWL_USERDATA); 1383 LPCREATESTRUCTA lpcs; 1384 1385 TRACE("(hwnd=%x msg=%x wparm=%x lparm=%lx)\n",hWnd, uMessage, wParam, lParam); 1386 1387 switch (uMessage) 1388 { 1389 case WM_NCCREATE: 1390 lpcs = (LPCREATESTRUCTA)lParam; 1391 pThis = (IShellViewImpl*)(lpcs->lpCreateParams); 1392 SetWindowLongA(hWnd, GWL_USERDATA, (LONG)pThis); 1393 pThis->hWnd = hWnd; /*set the window handle*/ 1394 break; 1395 1396 case WM_SIZE: return ShellView_OnSize(pThis,LOWORD(lParam), HIWORD(lParam)); 1397 case WM_SETFOCUS: return ShellView_OnSetFocus(pThis); 1398 case WM_KILLFOCUS: return ShellView_OnKillFocus(pThis); 1399 case WM_CREATE: return ShellView_OnCreate(pThis); 1400 case WM_ACTIVATE: return ShellView_OnActivate(pThis, SVUIA_ACTIVATE_FOCUS); 1401 case WM_NOTIFY: return ShellView_OnNotify(pThis,(UINT)wParam, (LPNMHDR)lParam); 1402 case WM_COMMAND: return ShellView_OnCommand(pThis, 1403 GET_WM_COMMAND_ID(wParam, lParam), 1404 GET_WM_COMMAND_CMD(wParam, lParam), 1405 GET_WM_COMMAND_HWND(wParam, lParam)); 1406 case SHV_CHANGE_NOTIFY: return ShellView_OnChange(pThis, (LPITEMIDLIST*)wParam, (LONG)lParam); 1407 1408 case WM_CONTEXTMENU: ShellView_DoContextMenu(pThis, LOWORD(lParam), HIWORD(lParam), FALSE); 1409 return 0; 1410 1411 case WM_SHOWWINDOW: UpdateWindow(pThis->hWndList); 1412 break; 1413 1414 case WM_GETDLGCODE: return SendMessageA(pThis->hWndList,uMessage,0,0); 1415 1416 case WM_DESTROY: if(GetShellOle()) 1417 { 1418 pRevokeDragDrop(pThis->hWnd); 1419 } 1420 SHChangeNotifyDeregister(pThis->hNotify); 1421 break; 1422 } 1423 1424 return DefWindowProcA (hWnd, uMessage, wParam, lParam); 1424 1425 } 1425 1426 /********************************************************** … … 1434 1435 static HRESULT WINAPI IShellView_fnQueryInterface(IShellView * iface,REFIID riid, LPVOID *ppvObj) 1435 1436 { 1436 ICOM_THIS(IShellViewImpl, iface);1437 1438 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj);1439 1440 *ppvObj = NULL;1441 1442 if(IsEqualIID(riid, &IID_IUnknown))1443 {1444 *ppvObj = This; 1445 }1446 else if(IsEqualIID(riid, &IID_IShellView))1447 {1448 *ppvObj = (IShellView*)This;1449 }1450 else if(IsEqualIID(riid, &IID_IOleCommandTarget))1451 {1452 *ppvObj = (IOleCommandTarget*)&(This->lpvtblOleCommandTarget);1453 }1454 else if(IsEqualIID(riid, &IID_IDropTarget))1455 {1456 *ppvObj = (IDropTarget*)&(This->lpvtblDropTarget);1457 }1458 else if(IsEqualIID(riid, &IID_IDropSource))1459 {1460 *ppvObj = (IDropSource*)&(This->lpvtblDropSource);1461 }1462 else if(IsEqualIID(riid, &IID_IViewObject))1463 {1464 *ppvObj = (IViewObject*)&(This->lpvtblViewObject);1465 }1466 1467 if(*ppvObj)1468 {1469 IUnknown_AddRef( (IUnknown*)*ppvObj );1470 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);1471 return S_OK;1472 }1473 TRACE("-- Interface: E_NOINTERFACE\n");1474 return E_NOINTERFACE;1437 ICOM_THIS(IShellViewImpl, iface); 1438 1439 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj); 1440 1441 *ppvObj = NULL; 1442 1443 if(IsEqualIID(riid, &IID_IUnknown)) 1444 { 1445 *ppvObj = This; 1446 } 1447 else if(IsEqualIID(riid, &IID_IShellView)) 1448 { 1449 *ppvObj = (IShellView*)This; 1450 } 1451 else if(IsEqualIID(riid, &IID_IOleCommandTarget)) 1452 { 1453 *ppvObj = (IOleCommandTarget*)&(This->lpvtblOleCommandTarget); 1454 } 1455 else if(IsEqualIID(riid, &IID_IDropTarget)) 1456 { 1457 *ppvObj = (IDropTarget*)&(This->lpvtblDropTarget); 1458 } 1459 else if(IsEqualIID(riid, &IID_IDropSource)) 1460 { 1461 *ppvObj = (IDropSource*)&(This->lpvtblDropSource); 1462 } 1463 else if(IsEqualIID(riid, &IID_IViewObject)) 1464 { 1465 *ppvObj = (IViewObject*)&(This->lpvtblViewObject); 1466 } 1467 1468 if(*ppvObj) 1469 { 1470 IUnknown_AddRef( (IUnknown*)*ppvObj ); 1471 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj); 1472 return S_OK; 1473 } 1474 TRACE("-- Interface: E_NOINTERFACE\n"); 1475 return E_NOINTERFACE; 1475 1476 } 1476 1477 … … 1480 1481 static ULONG WINAPI IShellView_fnAddRef(IShellView * iface) 1481 1482 { 1482 ICOM_THIS(IShellViewImpl, iface);1483 1484 TRACE("(%p)->(count=%lu)\n",This,This->ref);1485 1486 shell32_ObjCount++;1487 return ++(This->ref);1483 ICOM_THIS(IShellViewImpl, iface); 1484 1485 TRACE("(%p)->(count=%lu)\n",This,This->ref); 1486 1487 shell32_ObjCount++; 1488 return ++(This->ref); 1488 1489 } 1489 1490 /********************************************************** … … 1492 1493 static ULONG WINAPI IShellView_fnRelease(IShellView * iface) 1493 1494 { 1494 ICOM_THIS(IShellViewImpl, iface);1495 1496 TRACE("(%p)->()\n",This);1497 1498 shell32_ObjCount--;1499 1500 if (!--(This->ref)) 1501 {1502 TRACE(" destroying IShellView(%p)\n",This);1503 1504 if(This->pSFParent)1505 IShellFolder_Release(This->pSFParent);1506 1507 if(This->pSF2Parent)1508 IShellFolder2_Release(This->pSF2Parent);1509 1510 if (This->apidl)1511 SHFree(This->apidl);1512 1513 if (This->pCommDlgBrowser)1514 ICommDlgBrowser_Release(This->pCommDlgBrowser);1515 1516 HeapFree(GetProcessHeap(),0,This);1517 return 0;1518 }1519 return This->ref;1495 ICOM_THIS(IShellViewImpl, iface); 1496 1497 TRACE("(%p)->()\n",This); 1498 1499 shell32_ObjCount--; 1500 1501 if (!--(This->ref)) 1502 { 1503 TRACE(" destroying IShellView(%p)\n",This); 1504 1505 if(This->pSFParent) 1506 IShellFolder_Release(This->pSFParent); 1507 1508 if(This->pSF2Parent) 1509 IShellFolder2_Release(This->pSF2Parent); 1510 1511 if (This->apidl) 1512 SHFree(This->apidl); 1513 1514 if (This->pCommDlgBrowser) 1515 ICommDlgBrowser_Release(This->pCommDlgBrowser); 1516 1517 HeapFree(GetProcessHeap(),0,This); 1518 return 0; 1519 } 1520 return This->ref; 1520 1521 } 1521 1522 … … 1525 1526 static HRESULT WINAPI IShellView_fnGetWindow(IShellView * iface,HWND * phWnd) 1526 1527 { 1527 ICOM_THIS(IShellViewImpl, iface);1528 1529 TRACE("(%p)\n",This);1530 1531 *phWnd = This->hWnd;1532 1533 return S_OK;1528 ICOM_THIS(IShellViewImpl, iface); 1529 1530 TRACE("(%p)\n",This); 1531 1532 *phWnd = This->hWnd; 1533 1534 return S_OK; 1534 1535 } 1535 1536 1536 1537 static HRESULT WINAPI IShellView_fnContextSensitiveHelp(IShellView * iface,BOOL fEnterMode) 1537 1538 { 1538 ICOM_THIS(IShellViewImpl, iface);1539 1540 FIXME("(%p) stub\n",This);1541 1542 return E_NOTIMPL;1539 ICOM_THIS(IShellViewImpl, iface); 1540 1541 FIXME("(%p) stub\n",This); 1542 1543 return E_NOTIMPL; 1543 1544 } 1544 1545 … … 1552 1553 { 1553 1554 #if 0 1554 ICOM_THIS(IShellViewImpl, iface);1555 1556 FIXME("(%p)->(%p: hwnd=%x msg=%x lp=%lx wp=%x) stub\n",This,lpmsg, lpmsg->hwnd, lpmsg->message, lpmsg->lParam, lpmsg->wParam);1555 ICOM_THIS(IShellViewImpl, iface); 1556 1557 FIXME("(%p)->(%p: hwnd=%x msg=%x lp=%lx wp=%x) stub\n",This,lpmsg, lpmsg->hwnd, lpmsg->message, lpmsg->lParam, lpmsg->wParam); 1557 1558 #endif 1558 1559 if ((lpmsg->message>=WM_KEYFIRST) && (lpmsg->message>=WM_KEYLAST))1560 {1561 TRACE("-- key=0x04%x",lpmsg->wParam) ;1562 }1563 return S_FALSE; /* not handled */1559 1560 if ((lpmsg->message>=WM_KEYFIRST) && (lpmsg->message>=WM_KEYLAST)) 1561 { 1562 TRACE("-- key=0x04%x",lpmsg->wParam) ; 1563 } 1564 return S_FALSE; /* not handled */ 1564 1565 } 1565 1566 1566 1567 static HRESULT WINAPI IShellView_fnEnableModeless(IShellView * iface,BOOL fEnable) 1567 1568 { 1568 ICOM_THIS(IShellViewImpl, iface);1569 1570 FIXME("(%p) stub\n",This);1571 1572 return E_NOTIMPL;1569 ICOM_THIS(IShellViewImpl, iface); 1570 1571 FIXME("(%p) stub\n",This); 1572 1573 return E_NOTIMPL; 1573 1574 } 1574 1575 1575 1576 static HRESULT WINAPI IShellView_fnUIActivate(IShellView * iface,UINT uState) 1576 1577 { 1577 ICOM_THIS(IShellViewImpl, iface);1578 ICOM_THIS(IShellViewImpl, iface); 1578 1579 1579 1580 /* 1580 CHARszName[MAX_PATH];1581 */ 1582 LRESULTlResult;1583 intnPartArray[1] = {-1};1584 1585 TRACE("(%p)->(state=%x) stub\n",This, uState);1586 1587 /*don't do anything if the state isn't really changing*/1588 if(This->uState == uState)1589 {1590 return S_OK;1591 }1592 1593 /*OnActivate handles the menu merging and internal state*/1594 ShellView_OnActivate(This, uState);1595 1596 /*only do This if we are active*/1597 if(uState != SVUIA_DEACTIVATE)1598 {1581 CHAR szName[MAX_PATH]; 1582 */ 1583 LRESULT lResult; 1584 int nPartArray[1] = {-1}; 1585 1586 TRACE("(%p)->(state=%x) stub\n",This, uState); 1587 1588 /*don't do anything if the state isn't really changing*/ 1589 if(This->uState == uState) 1590 { 1591 return S_OK; 1592 } 1593 1594 /*OnActivate handles the menu merging and internal state*/ 1595 ShellView_OnActivate(This, uState); 1596 1597 /*only do This if we are active*/ 1598 if(uState != SVUIA_DEACTIVATE) 1599 { 1599 1600 1600 1601 /* 1601 GetFolderPath is not a method of IShellFolder1602 IShellFolder_GetFolderPath( This->pSFParent, szName, sizeof(szName) );1603 */ 1604 /* set the number of parts */1605 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_STATUS, SB_SETPARTS, 1,1606 (LPARAM)nPartArray, &lResult);1607 1608 /* set the text for the parts */1602 GetFolderPath is not a method of IShellFolder 1603 IShellFolder_GetFolderPath( This->pSFParent, szName, sizeof(szName) ); 1604 */ 1605 /* set the number of parts */ 1606 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_STATUS, SB_SETPARTS, 1, 1607 (LPARAM)nPartArray, &lResult); 1608 1609 /* set the text for the parts */ 1609 1610 /* 1610 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_STATUS, SB_SETTEXTA,1611 0, (LPARAM)szName, &lResult);1612 */ 1613 }1614 1615 return S_OK;1611 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_STATUS, SB_SETTEXTA, 1612 0, (LPARAM)szName, &lResult); 1613 */ 1614 } 1615 1616 return S_OK; 1616 1617 } 1617 1618 1618 1619 static HRESULT WINAPI IShellView_fnRefresh(IShellView * iface) 1619 1620 { 1620 ICOM_THIS(IShellViewImpl, iface);1621 1622 TRACE("(%p)\n",This);1623 1624 ListView_DeleteAllItems(This->hWndList);1625 ShellView_FillList(This);1626 1627 return S_OK;1621 ICOM_THIS(IShellViewImpl, iface); 1622 1623 TRACE("(%p)\n",This); 1624 1625 ListView_DeleteAllItems(This->hWndList); 1626 ShellView_FillList(This); 1627 1628 return S_OK; 1628 1629 } 1629 1630 1630 1631 static HRESULT WINAPI IShellView_fnCreateViewWindow( 1631 IShellView * iface,1632 IShellView *lpPrevView,1633 LPCFOLDERSETTINGS lpfs,1634 IShellBrowser * psb,1635 RECT * prcView,1636 HWND *phWnd)1637 { 1638 ICOM_THIS(IShellViewImpl, iface);1639 1640 WNDCLASSA wc;1641 *phWnd = 0;1642 1643 1644 TRACE("(%p)->(shlview=%p set=%p shlbrs=%p rec=%p hwnd=%p) incomplete\n",This, lpPrevView,lpfs, psb, prcView, phWnd);1645 TRACE("-- vmode=%x flags=%x left=%i top=%i right=%i bottom=%i\n",lpfs->ViewMode, lpfs->fFlags ,prcView->left,prcView->top, prcView->right, prcView->bottom);1646 1647 /*set up the member variables*/1648 This->pShellBrowser = psb;1649 This->FolderSettings = *lpfs;1650 1651 /*get our parent window*/1652 IShellBrowser_AddRef(This->pShellBrowser);1653 IShellBrowser_GetWindow(This->pShellBrowser, &(This->hWndParent));1654 1655 /* try to get the ICommDlgBrowserInterface, adds a reference !!! */1656 This->pCommDlgBrowser=NULL;1657 if ( SUCCEEDED (IShellBrowser_QueryInterface( This->pShellBrowser, 1658 (REFIID)&IID_ICommDlgBrowser, (LPVOID*) &This->pCommDlgBrowser)))1659 {1660 TRACE("-- CommDlgBrowser\n");1661 }1662 1663 /*if our window class has not been registered, then do so*/1664 if(!GetClassInfoA(shell32_hInstance, SV_CLASS_NAME, &wc))1665 {1666 ZeroMemory(&wc, sizeof(wc));1667 wc.style= CS_HREDRAW | CS_VREDRAW;1668 wc.lpfnWndProc= (WNDPROC) ShellView_WndProc;1669 wc.cbClsExtra= 0;1670 wc.cbWndExtra= 0;1671 wc.hInstance= shell32_hInstance;1672 wc.hIcon= 0;1673 wc.hCursor= LoadCursorA (0, IDC_ARROWA);1674 wc.hbrBackground= (HBRUSH) (COLOR_WINDOW + 1);1675 wc.lpszMenuName= NULL;1676 wc.lpszClassName= SV_CLASS_NAME;1677 1678 if(!RegisterClassA(&wc))1679 return E_FAIL;1680 }1681 1682 *phWnd = CreateWindowExA(0,1683 SV_CLASS_NAME,1684 NULL,1685 WS_CHILD | WS_VISIBLE | WS_TABSTOP,1686 prcView->left,1687 prcView->top,1688 prcView->right - prcView->left,1689 prcView->bottom - prcView->top,1690 This->hWndParent,1691 0,1692 shell32_hInstance,1693 (LPVOID)This);1694 1695 CheckToolbar(This);1696 1697 if(!*phWnd) return E_FAIL;1698 1699 return S_OK;1632 IShellView * iface, 1633 IShellView *lpPrevView, 1634 LPCFOLDERSETTINGS lpfs, 1635 IShellBrowser * psb, 1636 RECT * prcView, 1637 HWND *phWnd) 1638 { 1639 ICOM_THIS(IShellViewImpl, iface); 1640 1641 WNDCLASSA wc; 1642 *phWnd = 0; 1643 1644 1645 TRACE("(%p)->(shlview=%p set=%p shlbrs=%p rec=%p hwnd=%p) incomplete\n",This, lpPrevView,lpfs, psb, prcView, phWnd); 1646 TRACE("-- vmode=%x flags=%x left=%i top=%i right=%i bottom=%i\n",lpfs->ViewMode, lpfs->fFlags ,prcView->left,prcView->top, prcView->right, prcView->bottom); 1647 1648 /*set up the member variables*/ 1649 This->pShellBrowser = psb; 1650 This->FolderSettings = *lpfs; 1651 1652 /*get our parent window*/ 1653 IShellBrowser_AddRef(This->pShellBrowser); 1654 IShellBrowser_GetWindow(This->pShellBrowser, &(This->hWndParent)); 1655 1656 /* try to get the ICommDlgBrowserInterface, adds a reference !!! */ 1657 This->pCommDlgBrowser=NULL; 1658 if ( SUCCEEDED (IShellBrowser_QueryInterface( This->pShellBrowser, 1659 (REFIID)&IID_ICommDlgBrowser, (LPVOID*) &This->pCommDlgBrowser))) 1660 { 1661 TRACE("-- CommDlgBrowser\n"); 1662 } 1663 1664 /*if our window class has not been registered, then do so*/ 1665 if(!GetClassInfoA(shell32_hInstance, SV_CLASS_NAME, &wc)) 1666 { 1667 ZeroMemory(&wc, sizeof(wc)); 1668 wc.style = CS_HREDRAW | CS_VREDRAW; 1669 wc.lpfnWndProc = (WNDPROC) ShellView_WndProc; 1670 wc.cbClsExtra = 0; 1671 wc.cbWndExtra = 0; 1672 wc.hInstance = shell32_hInstance; 1673 wc.hIcon = 0; 1674 wc.hCursor = LoadCursorA (0, IDC_ARROWA); 1675 wc.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1); 1676 wc.lpszMenuName = NULL; 1677 wc.lpszClassName = SV_CLASS_NAME; 1678 1679 if(!RegisterClassA(&wc)) 1680 return E_FAIL; 1681 } 1682 1683 *phWnd = CreateWindowExA(0, 1684 SV_CLASS_NAME, 1685 NULL, 1686 WS_CHILD | WS_VISIBLE | WS_TABSTOP, 1687 prcView->left, 1688 prcView->top, 1689 prcView->right - prcView->left, 1690 prcView->bottom - prcView->top, 1691 This->hWndParent, 1692 0, 1693 shell32_hInstance, 1694 (LPVOID)This); 1695 1696 CheckToolbar(This); 1697 1698 if(!*phWnd) return E_FAIL; 1699 1700 return S_OK; 1700 1701 } 1701 1702 1702 1703 static HRESULT WINAPI IShellView_fnDestroyViewWindow(IShellView * iface) 1703 1704 { 1704 ICOM_THIS(IShellViewImpl, iface);1705 1706 TRACE("(%p)\n",This);1707 1708 /*Make absolutely sure all our UI is cleaned up.*/1709 IShellView_UIActivate((IShellView*)This, SVUIA_DEACTIVATE);1710 1711 if(This->hMenu)1712 {1713 DestroyMenu(This->hMenu);1714 }1715 1716 DestroyWindow(This->hWnd);1717 IShellBrowser_Release(This->pShellBrowser);1718 1719 return S_OK;1705 ICOM_THIS(IShellViewImpl, iface); 1706 1707 TRACE("(%p)\n",This); 1708 1709 /*Make absolutely sure all our UI is cleaned up.*/ 1710 IShellView_UIActivate((IShellView*)This, SVUIA_DEACTIVATE); 1711 1712 if(This->hMenu) 1713 { 1714 DestroyMenu(This->hMenu); 1715 } 1716 1717 DestroyWindow(This->hWnd); 1718 IShellBrowser_Release(This->pShellBrowser); 1719 1720 return S_OK; 1720 1721 } 1721 1722 1722 1723 static HRESULT WINAPI IShellView_fnGetCurrentInfo(IShellView * iface, LPFOLDERSETTINGS lpfs) 1723 1724 { 1724 ICOM_THIS(IShellViewImpl, iface);1725 1726 TRACE("(%p)->(%p) vmode=%x flags=%x\n",This, lpfs, 1727 This->FolderSettings.ViewMode, This->FolderSettings.fFlags);1728 1729 if (!lpfs) return E_INVALIDARG;1730 1731 *lpfs = This->FolderSettings;1732 return NOERROR;1725 ICOM_THIS(IShellViewImpl, iface); 1726 1727 TRACE("(%p)->(%p) vmode=%x flags=%x\n",This, lpfs, 1728 This->FolderSettings.ViewMode, This->FolderSettings.fFlags); 1729 1730 if (!lpfs) return E_INVALIDARG; 1731 1732 *lpfs = This->FolderSettings; 1733 return NOERROR; 1733 1734 } 1734 1735 1735 1736 static HRESULT WINAPI IShellView_fnAddPropertySheetPages(IShellView * iface, DWORD dwReserved,LPFNADDPROPSHEETPAGE lpfn, LPARAM lparam) 1736 1737 { 1737 ICOM_THIS(IShellViewImpl, iface);1738 1739 FIXME("(%p) stub\n",This);1740 1741 return E_NOTIMPL;1738 ICOM_THIS(IShellViewImpl, iface); 1739 1740 FIXME("(%p) stub\n",This); 1741 1742 return E_NOTIMPL; 1742 1743 } 1743 1744 1744 1745 static HRESULT WINAPI IShellView_fnSaveViewState(IShellView * iface) 1745 1746 { 1746 ICOM_THIS(IShellViewImpl, iface);1747 1748 FIXME("(%p) stub\n",This);1749 1750 return S_OK;1747 ICOM_THIS(IShellViewImpl, iface); 1748 1749 FIXME("(%p) stub\n",This); 1750 1751 return S_OK; 1751 1752 } 1752 1753 1753 1754 static HRESULT WINAPI IShellView_fnSelectItem( 1754 IShellView * iface,1755 LPCITEMIDLIST pidl,1756 UINT uFlags)1757 { 1758 ICOM_THIS(IShellViewImpl, iface);1759 int i;1760 1761 TRACE("(%p)->(pidl=%p, 0x%08x) stub\n",This, pidl, uFlags);1762 1763 i = LV_FindItemByPidl(This, pidl);1764 1765 if (i != -1)1766 {1767 LVITEMA lvItem;1768 1769 if(uFlags & SVSI_ENSUREVISIBLE)1770 ListView_EnsureVisible(This->hWndList, i, 0);1755 IShellView * iface, 1756 LPCITEMIDLIST pidl, 1757 UINT uFlags) 1758 { 1759 ICOM_THIS(IShellViewImpl, iface); 1760 int i; 1761 1762 TRACE("(%p)->(pidl=%p, 0x%08x) stub\n",This, pidl, uFlags); 1763 1764 i = LV_FindItemByPidl(This, pidl); 1765 1766 if (i != -1) 1767 { 1768 LVITEMA lvItem; 1769 1770 if(uFlags & SVSI_ENSUREVISIBLE) 1771 ListView_EnsureVisible(This->hWndList, i, 0); 1771 1772 1772 1773 ZeroMemory(&lvItem, sizeof(LVITEMA)); 1773 lvItem.mask = LVIF_STATE;1774 lvItem.iItem = 0;1774 lvItem.mask = LVIF_STATE; 1775 lvItem.iItem = 0; 1775 1776 1776 1777 while(ListView_GetItemA(This->hWndList, &lvItem)) 1777 {1778 if (lvItem.iItem == i)1779 {1780 if (uFlags & SVSI_SELECT)1781 lvItem.state |= LVIS_SELECTED;1782 else1783 lvItem.state &= ~LVIS_SELECTED;1784 1785 if(uFlags & SVSI_FOCUSED)1786 lvItem.state &= ~LVIS_FOCUSED;1787 }1788 else1789 {1790 if (uFlags & SVSI_DESELECTOTHERS)1791 lvItem.state &= ~LVIS_SELECTED;1792 }1793 ListView_SetItemA(This->hWndList, &lvItem);1794 lvItem.iItem++;1795 }1796 1797 1798 if(uFlags & SVSI_EDIT)1799 ListView_EditLabelA(This->hWndList, i);1800 1801 }1802 return S_OK;1778 { 1779 if (lvItem.iItem == i) 1780 { 1781 if (uFlags & SVSI_SELECT) 1782 lvItem.state |= LVIS_SELECTED; 1783 else 1784 lvItem.state &= ~LVIS_SELECTED; 1785 1786 if(uFlags & SVSI_FOCUSED) 1787 lvItem.state &= ~LVIS_FOCUSED; 1788 } 1789 else 1790 { 1791 if (uFlags & SVSI_DESELECTOTHERS) 1792 lvItem.state &= ~LVIS_SELECTED; 1793 } 1794 ListView_SetItemA(This->hWndList, &lvItem); 1795 lvItem.iItem++; 1796 } 1797 1798 1799 if(uFlags & SVSI_EDIT) 1800 ListView_EditLabelA(This->hWndList, i); 1801 1802 } 1803 return S_OK; 1803 1804 } 1804 1805 1805 1806 static HRESULT WINAPI IShellView_fnGetItemObject(IShellView * iface, UINT uItem, REFIID riid, LPVOID *ppvOut) 1806 1807 { 1807 ICOM_THIS(IShellViewImpl, iface);1808 1809 TRACE("(%p)->(uItem=0x%08x,\n\tIID=%s, ppv=%p)\n",This, uItem, debugstr_guid(riid), ppvOut);1810 1811 *ppvOut = NULL;1812 1813 switch(uItem)1814 {1815 case SVGIO_BACKGROUND:1816 *ppvOut = ISvBgCm_Constructor(This->pSFParent);1817 break;1818 1819 case SVGIO_SELECTION:1820 ShellView_GetSelections(This);1821 IShellFolder_GetUIObjectOf(This->pSFParent, This->hWnd, This->cidl, This->apidl, riid, 0, ppvOut);1822 break;1823 }1824 TRACE("-- (%p)->(interface=%p)\n",This, *ppvOut);1825 1826 if(!*ppvOut) return E_OUTOFMEMORY;1827 1828 return S_OK;1808 ICOM_THIS(IShellViewImpl, iface); 1809 1810 TRACE("(%p)->(uItem=0x%08x,\n\tIID=%s, ppv=%p)\n",This, uItem, debugstr_guid(riid), ppvOut); 1811 1812 *ppvOut = NULL; 1813 1814 switch(uItem) 1815 { 1816 case SVGIO_BACKGROUND: 1817 *ppvOut = ISvBgCm_Constructor(This->pSFParent); 1818 break; 1819 1820 case SVGIO_SELECTION: 1821 ShellView_GetSelections(This); 1822 IShellFolder_GetUIObjectOf(This->pSFParent, This->hWnd, This->cidl, This->apidl, riid, 0, ppvOut); 1823 break; 1824 } 1825 TRACE("-- (%p)->(interface=%p)\n",This, *ppvOut); 1826 1827 if(!*ppvOut) return E_OUTOFMEMORY; 1828 1829 return S_OK; 1829 1830 } 1830 1831 1831 1832 static HRESULT WINAPI IShellView_fnEditItem( 1832 IShellView * iface,1833 LPITEMIDLIST pidl)1834 { 1835 ICOM_THIS(IShellViewImpl, iface);1836 int i;1837 1838 TRACE("(%p)->(pidl=%p)\n",This, pidl);1839 1840 i = LV_FindItemByPidl(This, pidl);1841 if (i != -1)1842 {1843 SetFocus(This->hWndList);1844 ListView_EditLabelA(This->hWndList, i);1845 }1846 return S_OK;1847 } 1848 1849 static struct ICOM_VTABLE(IShellView) svvt = 1850 { 1851 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE1852 IShellView_fnQueryInterface,1853 IShellView_fnAddRef,1854 IShellView_fnRelease,1855 IShellView_fnGetWindow,1856 IShellView_fnContextSensitiveHelp,1857 IShellView_fnTranslateAccelerator,1858 IShellView_fnEnableModeless,1859 IShellView_fnUIActivate,1860 IShellView_fnRefresh,1861 IShellView_fnCreateViewWindow,1862 IShellView_fnDestroyViewWindow,1863 IShellView_fnGetCurrentInfo,1864 IShellView_fnAddPropertySheetPages,1865 IShellView_fnSaveViewState,1866 IShellView_fnSelectItem,1867 IShellView_fnGetItemObject,1868 IShellView_fnEditItem1833 IShellView * iface, 1834 LPITEMIDLIST pidl) 1835 { 1836 ICOM_THIS(IShellViewImpl, iface); 1837 int i; 1838 1839 TRACE("(%p)->(pidl=%p)\n",This, pidl); 1840 1841 i = LV_FindItemByPidl(This, pidl); 1842 if (i != -1) 1843 { 1844 SetFocus(This->hWndList); 1845 ListView_EditLabelA(This->hWndList, i); 1846 } 1847 return S_OK; 1848 } 1849 1850 static struct ICOM_VTABLE(IShellView) svvt = 1851 { 1852 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 1853 IShellView_fnQueryInterface, 1854 IShellView_fnAddRef, 1855 IShellView_fnRelease, 1856 IShellView_fnGetWindow, 1857 IShellView_fnContextSensitiveHelp, 1858 IShellView_fnTranslateAccelerator, 1859 IShellView_fnEnableModeless, 1860 IShellView_fnUIActivate, 1861 IShellView_fnRefresh, 1862 IShellView_fnCreateViewWindow, 1863 IShellView_fnDestroyViewWindow, 1864 IShellView_fnGetCurrentInfo, 1865 IShellView_fnAddPropertySheetPages, 1866 IShellView_fnSaveViewState, 1867 IShellView_fnSelectItem, 1868 IShellView_fnGetItemObject, 1869 IShellView_fnEditItem 1869 1870 }; 1870 1871 … … 1874 1875 */ 1875 1876 static HRESULT WINAPI ISVOleCmdTarget_QueryInterface( 1876 IOleCommandTarget *iface,1877 REFIIDiid,1878 LPVOID*ppvObj)1879 { 1880 _ICOM_THIS_From_IOleCommandTarget(IShellViewImpl, iface);1881 1882 return IShellFolder_QueryInterface((IShellFolder*)This, iid, ppvObj);1877 IOleCommandTarget * iface, 1878 REFIID iid, 1879 LPVOID* ppvObj) 1880 { 1881 _ICOM_THIS_From_IOleCommandTarget(IShellViewImpl, iface); 1882 1883 return IShellFolder_QueryInterface((IShellFolder*)This, iid, ppvObj); 1883 1884 } 1884 1885 … … 1887 1888 */ 1888 1889 static ULONG WINAPI ISVOleCmdTarget_AddRef( 1889 IOleCommandTarget *iface)1890 { 1891 _ICOM_THIS_From_IOleCommandTarget(IShellFolder, iface);1892 1893 return IShellFolder_AddRef((IShellFolder*)This);1890 IOleCommandTarget * iface) 1891 { 1892 _ICOM_THIS_From_IOleCommandTarget(IShellFolder, iface); 1893 1894 return IShellFolder_AddRef((IShellFolder*)This); 1894 1895 } 1895 1896 … … 1898 1899 */ 1899 1900 static ULONG WINAPI ISVOleCmdTarget_Release( 1900 IOleCommandTarget *iface)1901 { 1902 _ICOM_THIS_From_IOleCommandTarget(IShellViewImpl, iface);1903 1904 return IShellFolder_Release((IShellFolder*)This);1901 IOleCommandTarget * iface) 1902 { 1903 _ICOM_THIS_From_IOleCommandTarget(IShellViewImpl, iface); 1904 1905 return IShellFolder_Release((IShellFolder*)This); 1905 1906 } 1906 1907 … … 1909 1910 */ 1910 1911 static HRESULT WINAPI ISVOleCmdTarget_QueryStatus( 1911 IOleCommandTarget *iface,1912 const GUID* pguidCmdGroup,1913 ULONG cCmds, 1914 OLECMD * prgCmds,1915 OLECMDTEXT* pCmdText)1916 { 1917 _ICOM_THIS_From_IOleCommandTarget(IShellViewImpl, iface);1918 1919 FIXME("(%p)->(%p(%s) 0x%08lx %p %p\n",1912 IOleCommandTarget *iface, 1913 const GUID* pguidCmdGroup, 1914 ULONG cCmds, 1915 OLECMD * prgCmds, 1916 OLECMDTEXT* pCmdText) 1917 { 1918 _ICOM_THIS_From_IOleCommandTarget(IShellViewImpl, iface); 1919 1920 FIXME("(%p)->(%p(%s) 0x%08lx %p %p\n", 1920 1921 This, pguidCmdGroup, debugstr_guid(pguidCmdGroup), cCmds, prgCmds, pCmdText); 1921 return E_NOTIMPL;1922 return E_NOTIMPL; 1922 1923 } 1923 1924 … … 1928 1929 */ 1929 1930 static HRESULT WINAPI ISVOleCmdTarget_Exec( 1930 IOleCommandTarget *iface,1931 const GUID* pguidCmdGroup,1932 DWORD nCmdID,1933 DWORD nCmdexecopt,1934 VARIANT* pvaIn,1935 VARIANT* pvaOut)1936 { 1937 _ICOM_THIS_From_IOleCommandTarget(IShellViewImpl, iface);1938 1939 FIXME("(%p)->(\n\tTarget GUID:%s Command:0x%08lx Opt:0x%08lx %p %p)\n",1931 IOleCommandTarget *iface, 1932 const GUID* pguidCmdGroup, 1933 DWORD nCmdID, 1934 DWORD nCmdexecopt, 1935 VARIANT* pvaIn, 1936 VARIANT* pvaOut) 1937 { 1938 _ICOM_THIS_From_IOleCommandTarget(IShellViewImpl, iface); 1939 1940 FIXME("(%p)->(\n\tTarget GUID:%s Command:0x%08lx Opt:0x%08lx %p %p)\n", 1940 1941 This, debugstr_guid(pguidCmdGroup), nCmdID, nCmdexecopt, pvaIn, pvaOut); 1941 return E_NOTIMPL;1942 } 1943 1944 static ICOM_VTABLE(IOleCommandTarget) ctvt = 1945 { 1946 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE1947 ISVOleCmdTarget_QueryInterface,1948 ISVOleCmdTarget_AddRef,1949 ISVOleCmdTarget_Release,1950 ISVOleCmdTarget_QueryStatus,1951 ISVOleCmdTarget_Exec1942 return E_NOTIMPL; 1943 } 1944 1945 static ICOM_VTABLE(IOleCommandTarget) ctvt = 1946 { 1947 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 1948 ISVOleCmdTarget_QueryInterface, 1949 ISVOleCmdTarget_AddRef, 1950 ISVOleCmdTarget_Release, 1951 ISVOleCmdTarget_QueryStatus, 1952 ISVOleCmdTarget_Exec 1952 1953 }; 1953 1954 … … 1957 1958 1958 1959 static HRESULT WINAPI ISVDropTarget_QueryInterface( 1959 IDropTarget *iface,1960 REFIID riid,1961 LPVOID *ppvObj)1962 { 1963 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface);1964 1965 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj);1966 1967 return IShellFolder_QueryInterface((IShellFolder*)This, riid, ppvObj);1960 IDropTarget *iface, 1961 REFIID riid, 1962 LPVOID *ppvObj) 1963 { 1964 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface); 1965 1966 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj); 1967 1968 return IShellFolder_QueryInterface((IShellFolder*)This, riid, ppvObj); 1968 1969 } 1969 1970 1970 1971 static ULONG WINAPI ISVDropTarget_AddRef( IDropTarget *iface) 1971 1972 { 1972 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface);1973 1974 TRACE("(%p)->(count=%lu)\n",This,This->ref);1975 1976 return IShellFolder_AddRef((IShellFolder*)This);1973 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface); 1974 1975 TRACE("(%p)->(count=%lu)\n",This,This->ref); 1976 1977 return IShellFolder_AddRef((IShellFolder*)This); 1977 1978 } 1978 1979 1979 1980 static ULONG WINAPI ISVDropTarget_Release( IDropTarget *iface) 1980 1981 { 1981 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface);1982 1983 TRACE("(%p)->(count=%lu)\n",This,This->ref);1984 1985 return IShellFolder_Release((IShellFolder*)This);1982 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface); 1983 1984 TRACE("(%p)->(count=%lu)\n",This,This->ref); 1985 1986 return IShellFolder_Release((IShellFolder*)This); 1986 1987 } 1987 1988 1988 1989 static HRESULT WINAPI ISVDropTarget_DragEnter( 1989 IDropTarget*iface,1990 IDataObject*pDataObject,1991 DWORDgrfKeyState,1992 POINTLpt,1993 DWORD*pdwEffect)1994 { 1995 1996 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface);1997 1998 FIXME("Stub: This=%p, DataObject=%p\n",This,pDataObject);1999 2000 return E_NOTIMPL;1990 IDropTarget *iface, 1991 IDataObject *pDataObject, 1992 DWORD grfKeyState, 1993 POINTL pt, 1994 DWORD *pdwEffect) 1995 { 1996 1997 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface); 1998 1999 FIXME("Stub: This=%p, DataObject=%p\n",This,pDataObject); 2000 2001 return E_NOTIMPL; 2001 2002 } 2002 2003 2003 2004 static HRESULT WINAPI ISVDropTarget_DragOver( 2004 IDropTarget*iface,2005 DWORDgrfKeyState,2006 POINTLpt,2007 DWORD*pdwEffect)2008 { 2009 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface);2010 2011 FIXME("Stub: This=%p\n",This);2012 2013 return E_NOTIMPL;2005 IDropTarget *iface, 2006 DWORD grfKeyState, 2007 POINTL pt, 2008 DWORD *pdwEffect) 2009 { 2010 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface); 2011 2012 FIXME("Stub: This=%p\n",This); 2013 2014 return E_NOTIMPL; 2014 2015 } 2015 2016 2016 2017 static HRESULT WINAPI ISVDropTarget_DragLeave( 2017 IDropTarget*iface)2018 { 2019 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface);2020 2021 FIXME("Stub: This=%p\n",This);2022 2023 return E_NOTIMPL;2018 IDropTarget *iface) 2019 { 2020 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface); 2021 2022 FIXME("Stub: This=%p\n",This); 2023 2024 return E_NOTIMPL; 2024 2025 } 2025 2026 2026 2027 static HRESULT WINAPI ISVDropTarget_Drop( 2027 IDropTarget*iface,2028 IDataObject*pDataObject,2029 DWORDgrfKeyState,2030 POINTLpt,2031 DWORD*pdwEffect)2032 { 2033 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface);2034 2035 FIXME("Stub: This=%p\n",This);2036 2037 return E_NOTIMPL;2038 } 2039 2040 static struct ICOM_VTABLE(IDropTarget) dtvt = 2041 { 2042 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE2043 ISVDropTarget_QueryInterface,2044 ISVDropTarget_AddRef,2045 ISVDropTarget_Release,2046 ISVDropTarget_DragEnter,2047 ISVDropTarget_DragOver,2048 ISVDropTarget_DragLeave,2049 ISVDropTarget_Drop2028 IDropTarget *iface, 2029 IDataObject* pDataObject, 2030 DWORD grfKeyState, 2031 POINTL pt, 2032 DWORD *pdwEffect) 2033 { 2034 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface); 2035 2036 FIXME("Stub: This=%p\n",This); 2037 2038 return E_NOTIMPL; 2039 } 2040 2041 static struct ICOM_VTABLE(IDropTarget) dtvt = 2042 { 2043 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 2044 ISVDropTarget_QueryInterface, 2045 ISVDropTarget_AddRef, 2046 ISVDropTarget_Release, 2047 ISVDropTarget_DragEnter, 2048 ISVDropTarget_DragOver, 2049 ISVDropTarget_DragLeave, 2050 ISVDropTarget_Drop 2050 2051 }; 2051 2052 … … 2055 2056 2056 2057 static HRESULT WINAPI ISVDropSource_QueryInterface( 2057 IDropSource *iface,2058 REFIID riid,2059 LPVOID *ppvObj)2060 { 2061 _ICOM_THIS_From_IDropSource(IShellViewImpl, iface);2062 2063 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj);2064 2065 return IShellFolder_QueryInterface((IShellFolder*)This, riid, ppvObj);2058 IDropSource *iface, 2059 REFIID riid, 2060 LPVOID *ppvObj) 2061 { 2062 _ICOM_THIS_From_IDropSource(IShellViewImpl, iface); 2063 2064 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj); 2065 2066 return IShellFolder_QueryInterface((IShellFolder*)This, riid, ppvObj); 2066 2067 } 2067 2068 2068 2069 static ULONG WINAPI ISVDropSource_AddRef( IDropSource *iface) 2069 2070 { 2070 _ICOM_THIS_From_IDropSource(IShellViewImpl, iface);2071 2072 TRACE("(%p)->(count=%lu)\n",This,This->ref);2073 2074 return IShellFolder_AddRef((IShellFolder*)This);2071 _ICOM_THIS_From_IDropSource(IShellViewImpl, iface); 2072 2073 TRACE("(%p)->(count=%lu)\n",This,This->ref); 2074 2075 return IShellFolder_AddRef((IShellFolder*)This); 2075 2076 } 2076 2077 2077 2078 static ULONG WINAPI ISVDropSource_Release( IDropSource *iface) 2078 2079 { 2079 _ICOM_THIS_From_IDropSource(IShellViewImpl, iface);2080 2081 TRACE("(%p)->(count=%lu)\n",This,This->ref);2082 2083 return IShellFolder_Release((IShellFolder*)This);2080 _ICOM_THIS_From_IDropSource(IShellViewImpl, iface); 2081 2082 TRACE("(%p)->(count=%lu)\n",This,This->ref); 2083 2084 return IShellFolder_Release((IShellFolder*)This); 2084 2085 } 2085 2086 static HRESULT WINAPI ISVDropSource_QueryContinueDrag( 2086 IDropSource *iface,2087 BOOL fEscapePressed,2088 DWORD grfKeyState)2089 { 2090 _ICOM_THIS_From_IDropSource(IShellViewImpl, iface);2091 TRACE("(%p)\n",This);2092 2093 if (fEscapePressed)2094 return DRAGDROP_S_CANCEL;2095 else if (!(grfKeyState & MK_LBUTTON) && !(grfKeyState & MK_RBUTTON))2096 return DRAGDROP_S_DROP;2097 else2098 return NOERROR;2087 IDropSource *iface, 2088 BOOL fEscapePressed, 2089 DWORD grfKeyState) 2090 { 2091 _ICOM_THIS_From_IDropSource(IShellViewImpl, iface); 2092 TRACE("(%p)\n",This); 2093 2094 if (fEscapePressed) 2095 return DRAGDROP_S_CANCEL; 2096 else if (!(grfKeyState & MK_LBUTTON) && !(grfKeyState & MK_RBUTTON)) 2097 return DRAGDROP_S_DROP; 2098 else 2099 return NOERROR; 2099 2100 } 2100 2101 2101 2102 static HRESULT WINAPI ISVDropSource_GiveFeedback( 2102 IDropSource *iface,2103 DWORD dwEffect)2104 { 2105 _ICOM_THIS_From_IDropSource(IShellViewImpl, iface);2106 TRACE("(%p)\n",This);2107 2108 return DRAGDROP_S_USEDEFAULTCURSORS;2103 IDropSource *iface, 2104 DWORD dwEffect) 2105 { 2106 _ICOM_THIS_From_IDropSource(IShellViewImpl, iface); 2107 TRACE("(%p)\n",This); 2108 2109 return DRAGDROP_S_USEDEFAULTCURSORS; 2109 2110 } 2110 2111 2111 2112 static struct ICOM_VTABLE(IDropSource) dsvt = 2112 2113 { 2113 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE2114 ISVDropSource_QueryInterface,2115 ISVDropSource_AddRef,2116 ISVDropSource_Release,2117 ISVDropSource_QueryContinueDrag,2118 ISVDropSource_GiveFeedback2114 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 2115 ISVDropSource_QueryInterface, 2116 ISVDropSource_AddRef, 2117 ISVDropSource_Release, 2118 ISVDropSource_QueryContinueDrag, 2119 ISVDropSource_GiveFeedback 2119 2120 }; 2120 2121 /********************************************************** … … 2123 2124 2124 2125 static HRESULT WINAPI ISVViewObject_QueryInterface( 2125 IViewObject *iface,2126 REFIID riid,2127 LPVOID *ppvObj)2128 { 2129 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);2130 2131 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj);2132 2133 return IShellFolder_QueryInterface((IShellFolder*)This, riid, ppvObj);2126 IViewObject *iface, 2127 REFIID riid, 2128 LPVOID *ppvObj) 2129 { 2130 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface); 2131 2132 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj); 2133 2134 return IShellFolder_QueryInterface((IShellFolder*)This, riid, ppvObj); 2134 2135 } 2135 2136 2136 2137 static ULONG WINAPI ISVViewObject_AddRef( IViewObject *iface) 2137 2138 { 2138 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);2139 2140 TRACE("(%p)->(count=%lu)\n",This,This->ref);2141 2142 return IShellFolder_AddRef((IShellFolder*)This);2139 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface); 2140 2141 TRACE("(%p)->(count=%lu)\n",This,This->ref); 2142 2143 return IShellFolder_AddRef((IShellFolder*)This); 2143 2144 } 2144 2145 2145 2146 static ULONG WINAPI ISVViewObject_Release( IViewObject *iface) 2146 2147 { 2147 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);2148 2149 TRACE("(%p)->(count=%lu)\n",This,This->ref);2150 2151 return IShellFolder_Release((IShellFolder*)This);2148 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface); 2149 2150 TRACE("(%p)->(count=%lu)\n",This,This->ref); 2151 2152 return IShellFolder_Release((IShellFolder*)This); 2152 2153 } 2153 2154 2154 2155 static HRESULT WINAPI ISVViewObject_Draw( 2155 IViewObject*iface,2156 DWORD dwDrawAspect,2157 LONG lindex,2158 void* pvAspect,2159 DVTARGETDEVICE* ptd,2160 HDC hdcTargetDev,2161 HDC hdcDraw,2162 LPCRECTL lprcBounds,2163 LPCRECTL lprcWBounds, 2164 IVO_ContCallback pfnContinue,2165 DWORD dwContinue)2166 { 2167 2168 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);2169 2170 FIXME("Stub: This=%p\n",This);2171 2172 return E_NOTIMPL;2156 IViewObject *iface, 2157 DWORD dwDrawAspect, 2158 LONG lindex, 2159 void* pvAspect, 2160 DVTARGETDEVICE* ptd, 2161 HDC hdcTargetDev, 2162 HDC hdcDraw, 2163 LPCRECTL lprcBounds, 2164 LPCRECTL lprcWBounds, 2165 IVO_ContCallback pfnContinue, 2166 DWORD dwContinue) 2167 { 2168 2169 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface); 2170 2171 FIXME("Stub: This=%p\n",This); 2172 2173 return E_NOTIMPL; 2173 2174 } 2174 2175 static HRESULT WINAPI ISVViewObject_GetColorSet( 2175 IViewObject*iface,2176 DWORD dwDrawAspect,2177 LONG lindex,2178 void *pvAspect,2179 DVTARGETDEVICE* ptd,2180 HDC hicTargetDevice,2181 LOGPALETTE** ppColorSet)2182 { 2183 2184 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);2185 2186 FIXME("Stub: This=%p\n",This);2187 2188 return E_NOTIMPL;2176 IViewObject *iface, 2177 DWORD dwDrawAspect, 2178 LONG lindex, 2179 void *pvAspect, 2180 DVTARGETDEVICE* ptd, 2181 HDC hicTargetDevice, 2182 LOGPALETTE** ppColorSet) 2183 { 2184 2185 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface); 2186 2187 FIXME("Stub: This=%p\n",This); 2188 2189 return E_NOTIMPL; 2189 2190 } 2190 2191 static HRESULT WINAPI ISVViewObject_Freeze( 2191 IViewObject*iface,2192 DWORD dwDrawAspect,2193 LONG lindex,2194 void* pvAspect,2195 DWORD* pdwFreeze)2196 { 2197 2198 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);2199 2200 FIXME("Stub: This=%p\n",This);2201 2202 return E_NOTIMPL;2192 IViewObject *iface, 2193 DWORD dwDrawAspect, 2194 LONG lindex, 2195 void* pvAspect, 2196 DWORD* pdwFreeze) 2197 { 2198 2199 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface); 2200 2201 FIXME("Stub: This=%p\n",This); 2202 2203 return E_NOTIMPL; 2203 2204 } 2204 2205 static HRESULT WINAPI ISVViewObject_Unfreeze( 2205 IViewObject*iface,2206 DWORD dwFreeze)2207 { 2208 2209 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);2210 2211 FIXME("Stub: This=%p\n",This);2212 2213 return E_NOTIMPL;2206 IViewObject *iface, 2207 DWORD dwFreeze) 2208 { 2209 2210 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface); 2211 2212 FIXME("Stub: This=%p\n",This); 2213 2214 return E_NOTIMPL; 2214 2215 } 2215 2216 static HRESULT WINAPI ISVViewObject_SetAdvise( 2216 IViewObject*iface,2217 DWORD aspects,2218 DWORD advf,2219 IAdviseSink* pAdvSink)2220 { 2221 2222 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);2223 2224 FIXME("Stub: This=%p\n",This);2225 2226 return E_NOTIMPL;2217 IViewObject *iface, 2218 DWORD aspects, 2219 DWORD advf, 2220 IAdviseSink* pAdvSink) 2221 { 2222 2223 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface); 2224 2225 FIXME("Stub: This=%p\n",This); 2226 2227 return E_NOTIMPL; 2227 2228 } 2228 2229 static HRESULT WINAPI ISVViewObject_GetAdvise( 2229 IViewObject*iface,2230 DWORD* pAspects,2231 DWORD* pAdvf,2232 IAdviseSink** ppAdvSink)2233 { 2234 2235 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface);2236 2237 FIXME("Stub: This=%p\n",This);2238 2239 return E_NOTIMPL;2240 } 2241 2242 2243 static struct ICOM_VTABLE(IViewObject) vovt = 2244 { 2245 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE2246 ISVViewObject_QueryInterface,2247 ISVViewObject_AddRef,2248 ISVViewObject_Release,2249 ISVViewObject_Draw,2250 ISVViewObject_GetColorSet,2251 ISVViewObject_Freeze,2252 ISVViewObject_Unfreeze,2253 ISVViewObject_SetAdvise,2254 ISVViewObject_GetAdvise2230 IViewObject *iface, 2231 DWORD* pAspects, 2232 DWORD* pAdvf, 2233 IAdviseSink** ppAdvSink) 2234 { 2235 2236 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface); 2237 2238 FIXME("Stub: This=%p\n",This); 2239 2240 return E_NOTIMPL; 2241 } 2242 2243 2244 static struct ICOM_VTABLE(IViewObject) vovt = 2245 { 2246 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 2247 ISVViewObject_QueryInterface, 2248 ISVViewObject_AddRef, 2249 ISVViewObject_Release, 2250 ISVViewObject_Draw, 2251 ISVViewObject_GetColorSet, 2252 ISVViewObject_Freeze, 2253 ISVViewObject_Unfreeze, 2254 ISVViewObject_SetAdvise, 2255 ISVViewObject_GetAdvise 2255 2256 }; 2256 2257 -
trunk/src/shell32/shpolicy.c
r5618 r6650 1 /* $Id: shpolicy.c,v 1.3 2001-09-05 13:47:00 bird Exp $ */ 1 2 /* 2 3 * shpolicy.c - Data for shell/system policies. … … 8 9 * there doesn't appear to be an updated Win98 version that 9 10 * would handle the many new policies introduced since then. 10 * You could easily write one with the information in 11 * You could easily write one with the information in 11 12 * this file... 12 * 13 * 13 14 * Up to date as of SHELL32 v4.72 (Win98, Win95 with MSIE 5) 14 15 */ … … 108 109 /* policy data array */ 109 110 110 POLICYDATA sh32_policy_table[] = 111 POLICYDATA sh32_policy_table[] = 111 112 { 112 113 { … … 455 456 456 457 /************************************************************************* 457 * SHRestricted [SHELL32.100]458 * 459 * walks through policy table, queries <app> key, <type> value, returns 458 * SHRestricted [SHELL32.100] 459 * 460 * walks through policy table, queries <app> key, <type> value, returns 460 461 * queried (DWORD) value, and caches it between called to SHInitRestricted 461 462 * to prevent unnecessary registry access. … … 464 465 * exported by ordinal 465 466 * 466 * REFERENCES: 467 * REFERENCES: 467 468 * MS System Policy Editor 468 469 * 98Lite 2.0 (which uses many of these policy keys) http://www.98lite.net/ … … 471 472 DWORD WINAPI SHRestricted (DWORD pol) { 472 473 char regstr[256]; 473 HKEYxhkey;474 DWORD retval, polidx, i, datsize = 4;475 476 TRACE("(%08lx)\n",pol);477 478 polidx = -1;479 480 /* scan to see if we know this policy ID */481 for (i = 0; i < SHELL_MAX_POLICIES; i++)482 {483 if (pol == sh32_policy_table[i].polflags)484 {485 polidx = i;486 break;487 }488 }489 490 if (polidx == -1)491 {492 /* we don't know this policy, return 0 */493 TRACE("unknown policy: (%08lx)\n", pol);494 return 0;495 }496 497 /* we have a known policy */498 strcpy(regstr, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\");499 strcat(regstr, sh32_policy_table[polidx].appstr);500 501 /* first check if this policy has been cached, return it if so */502 if (sh32_policy_table[polidx].cache != SHELL_NO_POLICY)503 {504 return sh32_policy_table[polidx].cache;505 }506 507 /* return 0 and don't set the cache if any registry errors occur */508 retval = 0;509 if (RegOpenKeyA(HKEY_CURRENT_USER, regstr, &xhkey) == ERROR_SUCCESS)510 {511 if (RegQueryValueExA(xhkey, sh32_policy_table[polidx].keystr, NULL, NULL, (LPBYTE)&retval, &datsize) == ERROR_SUCCESS)512 {513 sh32_policy_table[polidx].cache = retval;514 }515 516 RegCloseKey(xhkey);474 HKEY xhkey; 475 DWORD retval, polidx, i, datsize = 4; 476 477 TRACE("(%08lx)\n",pol); 478 479 polidx = -1; 480 481 /* scan to see if we know this policy ID */ 482 for (i = 0; i < SHELL_MAX_POLICIES; i++) 483 { 484 if (pol == sh32_policy_table[i].polflags) 485 { 486 polidx = i; 487 break; 488 } 489 } 490 491 if (polidx == -1) 492 { 493 /* we don't know this policy, return 0 */ 494 TRACE("unknown policy: (%08lx)\n", pol); 495 return 0; 496 } 497 498 /* we have a known policy */ 499 strcpy(regstr, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\"); 500 strcat(regstr, sh32_policy_table[polidx].appstr); 501 502 /* first check if this policy has been cached, return it if so */ 503 if (sh32_policy_table[polidx].cache != SHELL_NO_POLICY) 504 { 505 return sh32_policy_table[polidx].cache; 506 } 507 508 /* return 0 and don't set the cache if any registry errors occur */ 509 retval = 0; 510 if (RegOpenKeyA(HKEY_CURRENT_USER, regstr, &xhkey) == ERROR_SUCCESS) 511 { 512 if (RegQueryValueExA(xhkey, sh32_policy_table[polidx].keystr, NULL, NULL, (LPBYTE)&retval, &datsize) == ERROR_SUCCESS) 513 { 514 sh32_policy_table[polidx].cache = retval; 515 } 516 517 RegCloseKey(xhkey); 517 518 } 518 519 519 return retval;520 return retval; 520 521 } 521 522 … … 558 559 { 559 560 if (lstrcmpiA(inpRegKey, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies")) 560 {561 /* doesn't match, fail */562 return 0;563 }564 } 561 { 562 /* doesn't match, fail */ 563 return 0; 564 } 565 } 565 566 566 567 /* check passed, init all policy cache entries with SHELL_NO_POLICY */ -
trunk/src/shell32/shv_bg_cmenu.c
r5618 r6650 1 /* $Id: shv_bg_cmenu.c,v 1.3 2001-09-05 13:47:00 bird Exp $ */ 1 2 /* 2 * IContextMenu3 * ShellView Background Context Menu (shv_bg_cm)3 * IContextMenu 4 * ShellView Background Context Menu (shv_bg_cm) 4 5 * 5 * Copyright 1999Juergen Schmied <juergen.schmied@metronet.de>6 * Copyright 1999 Juergen Schmied <juergen.schmied@metronet.de> 6 7 */ 7 8 #include <string.h> … … 24 25 * IContextMenu Implementation 25 26 */ 26 typedef struct 27 { 28 ICOM_VFIELD(IContextMenu);29 IShellFolder*pSFParent;30 DWORDref;27 typedef struct 28 { 29 ICOM_VFIELD(IContextMenu); 30 IShellFolder* pSFParent; 31 DWORD ref; 31 32 } BgCmImpl; 32 33 … … 37 38 * ISVBgCm_Constructor() 38 39 */ 39 IContextMenu *ISvBgCm_Constructor(IShellFolder* pSFParent)40 { 41 BgCmImpl* cm;42 43 cm = (BgCmImpl*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(BgCmImpl));44 ICOM_VTBL(cm)=&cmvt;45 cm->ref = 1;46 cm->pSFParent = pSFParent;47 if(pSFParent) IShellFolder_AddRef(pSFParent);48 49 TRACE("(%p)->()\n",cm);50 shell32_ObjCount++;51 return (IContextMenu*)cm;40 IContextMenu *ISvBgCm_Constructor(IShellFolder* pSFParent) 41 { 42 BgCmImpl* cm; 43 44 cm = (BgCmImpl*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(BgCmImpl)); 45 ICOM_VTBL(cm)=&cmvt; 46 cm->ref = 1; 47 cm->pSFParent = pSFParent; 48 if(pSFParent) IShellFolder_AddRef(pSFParent); 49 50 TRACE("(%p)->()\n",cm); 51 shell32_ObjCount++; 52 return (IContextMenu*)cm; 52 53 } 53 54 … … 57 58 static HRESULT WINAPI ISVBgCm_fnQueryInterface(IContextMenu *iface, REFIID riid, LPVOID *ppvObj) 58 59 { 59 ICOM_THIS(BgCmImpl, iface);60 61 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj);62 63 *ppvObj = NULL;64 65 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/66 {67 *ppvObj = This; 68 }69 else if(IsEqualIID(riid, &IID_IContextMenu)) /*IContextMenu*/70 {71 *ppvObj = This;72 } 73 else if(IsEqualIID(riid, &IID_IShellExtInit)) /*IShellExtInit*/74 {75 FIXME("-- LPSHELLEXTINIT pointer requested\n");76 }77 78 if(*ppvObj)79 { 80 IUnknown_AddRef((IUnknown*)*ppvObj); 81 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);82 return S_OK;83 }84 TRACE("-- Interface: E_NOINTERFACE\n");85 return E_NOINTERFACE;60 ICOM_THIS(BgCmImpl, iface); 61 62 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj); 63 64 *ppvObj = NULL; 65 66 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/ 67 { 68 *ppvObj = This; 69 } 70 else if(IsEqualIID(riid, &IID_IContextMenu)) /*IContextMenu*/ 71 { 72 *ppvObj = This; 73 } 74 else if(IsEqualIID(riid, &IID_IShellExtInit)) /*IShellExtInit*/ 75 { 76 FIXME("-- LPSHELLEXTINIT pointer requested\n"); 77 } 78 79 if(*ppvObj) 80 { 81 IUnknown_AddRef((IUnknown*)*ppvObj); 82 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj); 83 return S_OK; 84 } 85 TRACE("-- Interface: E_NOINTERFACE\n"); 86 return E_NOINTERFACE; 86 87 } 87 88 … … 91 92 static ULONG WINAPI ISVBgCm_fnAddRef(IContextMenu *iface) 92 93 { 93 ICOM_THIS(BgCmImpl, iface);94 95 TRACE("(%p)->(count=%lu)\n",This, This->ref);96 97 shell32_ObjCount++;98 return ++(This->ref);94 ICOM_THIS(BgCmImpl, iface); 95 96 TRACE("(%p)->(count=%lu)\n",This, This->ref); 97 98 shell32_ObjCount++; 99 return ++(This->ref); 99 100 } 100 101 … … 104 105 static ULONG WINAPI ISVBgCm_fnRelease(IContextMenu *iface) 105 106 { 106 ICOM_THIS(BgCmImpl, iface);107 108 TRACE("(%p)->()\n",This);109 110 if (!--(This->ref)) 111 {112 TRACE(" destroying IContextMenu(%p)\n",This);113 114 if(This->pSFParent)115 IShellFolder_Release(This->pSFParent);116 117 HeapFree(GetProcessHeap(),0,This);118 return 0;119 }120 121 shell32_ObjCount--;122 123 return This->ref;107 ICOM_THIS(BgCmImpl, iface); 108 109 TRACE("(%p)->()\n",This); 110 111 if (!--(This->ref)) 112 { 113 TRACE(" destroying IContextMenu(%p)\n",This); 114 115 if(This->pSFParent) 116 IShellFolder_Release(This->pSFParent); 117 118 HeapFree(GetProcessHeap(),0,This); 119 return 0; 120 } 121 122 shell32_ObjCount--; 123 124 return This->ref; 124 125 } 125 126 … … 129 130 130 131 static HRESULT WINAPI ISVBgCm_fnQueryContextMenu( 131 IContextMenu *iface,132 HMENU hMenu,133 UINT indexMenu,134 UINT idCmdFirst,135 UINT idCmdLast,136 UINT uFlags)137 { 138 HMENUhMyMenu;139 UINTidMax;140 141 ICOM_THIS(BgCmImpl, iface);142 143 TRACE("(%p)->(hmenu=%x indexmenu=%x cmdfirst=%x cmdlast=%x flags=%x )\n",This, hMenu, indexMenu, idCmdFirst, idCmdLast, uFlags);144 145 hMyMenu = LoadMenuA(shell32_hInstance, "MENU_002");146 147 idMax = Shell_MergeMenus (hMenu, GetSubMenu(hMyMenu,0), indexMenu, idCmdFirst, idCmdLast, MM_SUBMENUSHAVEIDS);148 149 DestroyMenu(hMyMenu);150 151 return ResultFromShort(idMax - idCmdFirst);132 IContextMenu *iface, 133 HMENU hMenu, 134 UINT indexMenu, 135 UINT idCmdFirst, 136 UINT idCmdLast, 137 UINT uFlags) 138 { 139 HMENU hMyMenu; 140 UINT idMax; 141 142 ICOM_THIS(BgCmImpl, iface); 143 144 TRACE("(%p)->(hmenu=%x indexmenu=%x cmdfirst=%x cmdlast=%x flags=%x )\n",This, hMenu, indexMenu, idCmdFirst, idCmdLast, uFlags); 145 146 hMyMenu = LoadMenuA(shell32_hInstance, "MENU_002"); 147 148 idMax = Shell_MergeMenus (hMenu, GetSubMenu(hMyMenu,0), indexMenu, idCmdFirst, idCmdLast, MM_SUBMENUSHAVEIDS); 149 150 DestroyMenu(hMyMenu); 151 152 return ResultFromShort(idMax - idCmdFirst); 152 153 } 153 154 … … 156 157 */ 157 158 static void DoNewFolder( 158 IContextMenu *iface,159 IShellView *psv)160 { 161 ICOM_THIS(BgCmImpl, iface);162 ISFHelper * psfhlp;163 char szName[MAX_PATH];164 165 IShellFolder_QueryInterface(This->pSFParent, &IID_ISFHelper, (LPVOID*)&psfhlp);166 if (psfhlp)167 {168 LPITEMIDLIST pidl;169 ISFHelper_GetUniqueName(psfhlp, szName, MAX_PATH);170 ISFHelper_AddFolder(psfhlp, 0, szName, &pidl);171 172 if(psv)173 {174 /* if we are in a shellview do labeledit */175 IShellView_SelectItem(psv,159 IContextMenu *iface, 160 IShellView *psv) 161 { 162 ICOM_THIS(BgCmImpl, iface); 163 ISFHelper * psfhlp; 164 char szName[MAX_PATH]; 165 166 IShellFolder_QueryInterface(This->pSFParent, &IID_ISFHelper, (LPVOID*)&psfhlp); 167 if (psfhlp) 168 { 169 LPITEMIDLIST pidl; 170 ISFHelper_GetUniqueName(psfhlp, szName, MAX_PATH); 171 ISFHelper_AddFolder(psfhlp, 0, szName, &pidl); 172 173 if(psv) 174 { 175 /* if we are in a shellview do labeledit */ 176 IShellView_SelectItem(psv, 176 177 pidl,(SVSI_DESELECTOTHERS | SVSI_EDIT | SVSI_ENSUREVISIBLE 177 178 |SVSI_FOCUSED|SVSI_SELECT)); 178 }179 SHFree(pidl);180 181 ISFHelper_Release(psfhlp);182 }179 } 180 SHFree(pidl); 181 182 ISFHelper_Release(psfhlp); 183 } 183 184 } 184 185 … … 187 188 */ 188 189 static BOOL DoPaste( 189 IContextMenu *iface)190 { 191 ICOM_THIS(BgCmImpl, iface);192 BOOL bSuccess = FALSE;193 IDataObject * pda;194 195 TRACE("\n");196 197 if(SUCCEEDED(pOleGetClipboard(&pda)))198 {199 STGMEDIUM medium;200 FORMATETC formatetc;201 202 TRACE("pda=%p\n", pda);203 204 /* Set the FORMATETC structure*/205 InitFormatEtc(formatetc, RegisterClipboardFormatA(CFSTR_SHELLIDLIST), TYMED_HGLOBAL);206 207 /* Get the pidls from IDataObject */208 if(SUCCEEDED(IDataObject_GetData(pda,&formatetc,&medium)))190 IContextMenu *iface) 191 { 192 ICOM_THIS(BgCmImpl, iface); 193 BOOL bSuccess = FALSE; 194 IDataObject * pda; 195 196 TRACE("\n"); 197 198 if(SUCCEEDED(pOleGetClipboard(&pda))) 199 { 200 STGMEDIUM medium; 201 FORMATETC formatetc; 202 203 TRACE("pda=%p\n", pda); 204 205 /* Set the FORMATETC structure*/ 206 InitFormatEtc(formatetc, RegisterClipboardFormatA(CFSTR_SHELLIDLIST), TYMED_HGLOBAL); 207 208 /* Get the pidls from IDataObject */ 209 if(SUCCEEDED(IDataObject_GetData(pda,&formatetc,&medium))) 209 210 { 210 LPITEMIDLIST * apidl;211 LPITEMIDLIST pidl;212 IShellFolder *psfFrom = NULL, *psfDesktop;213 214 LPCIDA lpcida = GlobalLock(medium.u.hGlobal);215 TRACE("cida=%p\n", lpcida);216 217 apidl = _ILCopyCidaToaPidl(&pidl, lpcida);218 219 /* bind to the source shellfolder */220 SHGetDesktopFolder(&psfDesktop);221 if(psfDesktop)222 {223 IShellFolder_BindToObject(psfDesktop, pidl, NULL, &IID_IShellFolder, (LPVOID*)&psfFrom);224 IShellFolder_Release(psfDesktop);225 }226 227 if (psfFrom)228 {229 /* get source and destination shellfolder */230 ISFHelper *psfhlpdst, *psfhlpsrc;231 IShellFolder_QueryInterface(This->pSFParent, &IID_ISFHelper, (LPVOID*)&psfhlpdst);232 IShellFolder_QueryInterface(psfFrom, &IID_ISFHelper, (LPVOID*)&psfhlpsrc);233 234 /* do the copy/move */235 if (psfhlpdst && psfhlpsrc)236 {237 ISFHelper_CopyItems(psfhlpdst, psfFrom, lpcida->cidl, apidl);238 /* fixme handle move 239 ISFHelper_DeleteItems(psfhlpsrc, lpcida->cidl, apidl);240 */241 }242 if(psfhlpdst) ISFHelper_Release(psfhlpdst);243 if(psfhlpsrc) ISFHelper_Release(psfhlpsrc);244 IShellFolder_Release(psfFrom);245 }246 247 _ILFreeaPidl(apidl, lpcida->cidl);248 SHFree(pidl);249 250 /* release the medium*/251 pReleaseStgMedium(&medium);252 }253 IDataObject_Release(pda);254 }211 LPITEMIDLIST * apidl; 212 LPITEMIDLIST pidl; 213 IShellFolder *psfFrom = NULL, *psfDesktop; 214 215 LPCIDA lpcida = GlobalLock(medium.u.hGlobal); 216 TRACE("cida=%p\n", lpcida); 217 218 apidl = _ILCopyCidaToaPidl(&pidl, lpcida); 219 220 /* bind to the source shellfolder */ 221 SHGetDesktopFolder(&psfDesktop); 222 if(psfDesktop) 223 { 224 IShellFolder_BindToObject(psfDesktop, pidl, NULL, &IID_IShellFolder, (LPVOID*)&psfFrom); 225 IShellFolder_Release(psfDesktop); 226 } 227 228 if (psfFrom) 229 { 230 /* get source and destination shellfolder */ 231 ISFHelper *psfhlpdst, *psfhlpsrc; 232 IShellFolder_QueryInterface(This->pSFParent, &IID_ISFHelper, (LPVOID*)&psfhlpdst); 233 IShellFolder_QueryInterface(psfFrom, &IID_ISFHelper, (LPVOID*)&psfhlpsrc); 234 235 /* do the copy/move */ 236 if (psfhlpdst && psfhlpsrc) 237 { 238 ISFHelper_CopyItems(psfhlpdst, psfFrom, lpcida->cidl, apidl); 239 /* fixme handle move 240 ISFHelper_DeleteItems(psfhlpsrc, lpcida->cidl, apidl); 241 */ 242 } 243 if(psfhlpdst) ISFHelper_Release(psfhlpdst); 244 if(psfhlpsrc) ISFHelper_Release(psfhlpsrc); 245 IShellFolder_Release(psfFrom); 246 } 247 248 _ILFreeaPidl(apidl, lpcida->cidl); 249 SHFree(pidl); 250 251 /* release the medium*/ 252 pReleaseStgMedium(&medium); 253 } 254 IDataObject_Release(pda); 255 } 255 256 #if 0 256 HGLOBAL hMem;257 258 OpenClipboard(NULL);259 hMem = GetClipboardData(CF_HDROP);260 261 if(hMem)262 {263 char * pDropFiles = (char *)GlobalLock(hMem);264 if(pDropFiles)265 {266 int len, offset = sizeof(DROPFILESTRUCT);267 268 while( pDropFiles[offset] != 0)269 {270 len = strlen(pDropFiles + offset);271 TRACE("%s\n", pDropFiles + offset);272 offset += len+1;273 }274 }275 GlobalUnlock(hMem);276 }277 CloseClipboard();257 HGLOBAL hMem; 258 259 OpenClipboard(NULL); 260 hMem = GetClipboardData(CF_HDROP); 261 262 if(hMem) 263 { 264 char * pDropFiles = (char *)GlobalLock(hMem); 265 if(pDropFiles) 266 { 267 int len, offset = sizeof(DROPFILESTRUCT); 268 269 while( pDropFiles[offset] != 0) 270 { 271 len = strlen(pDropFiles + offset); 272 TRACE("%s\n", pDropFiles + offset); 273 offset += len+1; 274 } 275 } 276 GlobalUnlock(hMem); 277 } 278 CloseClipboard(); 278 279 #endif 279 return bSuccess;280 return bSuccess; 280 281 } 281 282 /************************************************************************** … … 283 284 */ 284 285 static HRESULT WINAPI ISVBgCm_fnInvokeCommand( 285 IContextMenu *iface,286 LPCMINVOKECOMMANDINFO lpcmi)287 { 288 ICOM_THIS(BgCmImpl, iface);289 290 LPSHELLBROWSERlpSB;291 LPSHELLVIEWlpSV;292 HWNDhWndSV;293 294 TRACE("(%p)->(invcom=%p verb=%p wnd=%x)\n",This,lpcmi,lpcmi->lpVerb, lpcmi->hwnd); 295 296 /* get the active IShellView */297 if((lpSB = (LPSHELLBROWSER)SendMessageA(lpcmi->hwnd, CWM_GETISHELLBROWSER,0,0)))298 {299 if(SUCCEEDED(IShellBrowser_QueryActiveShellView(lpSB, &lpSV)))300 {301 IShellView_GetWindow(lpSV, &hWndSV);302 }303 }304 305 if(lpSV)306 {307 if(HIWORD(lpcmi->lpVerb))308 {309 TRACE("%s\n",lpcmi->lpVerb);310 311 if (! strcmp(lpcmi->lpVerb,CMDSTR_NEWFOLDERA))312 {313 if(lpSV) DoNewFolder(iface, lpSV);314 }315 else if (! strcmp(lpcmi->lpVerb,CMDSTR_VIEWLISTA))316 {317 if(hWndSV) SendMessageA(hWndSV, WM_COMMAND, MAKEWPARAM(FCIDM_SHVIEW_LISTVIEW,0),0 );318 }319 else if (! strcmp(lpcmi->lpVerb,CMDSTR_VIEWDETAILSA))320 {321 if(hWndSV) SendMessageA(hWndSV, WM_COMMAND, MAKEWPARAM(FCIDM_SHVIEW_REPORTVIEW,0),0 );322 } 323 else324 {325 FIXME("please report: unknown verb %s\n",lpcmi->lpVerb);326 }327 }328 else329 {330 switch(LOWORD(lpcmi->lpVerb))331 {332 case FCIDM_SHVIEW_NEWFOLDER:333 DoNewFolder(iface, lpSV);334 break;335 case FCIDM_SHVIEW_INSERT:336 DoPaste(iface);337 break;338 default:339 /* if it's a id just pass it to the parent shv */340 SendMessageA(hWndSV, WM_COMMAND, MAKEWPARAM(LOWORD(lpcmi->lpVerb), 0),0 );341 break;342 }343 }344 345 IShellView_Release(lpSV);/* QueryActiveShellView does AddRef*/346 }347 return NOERROR;286 IContextMenu *iface, 287 LPCMINVOKECOMMANDINFO lpcmi) 288 { 289 ICOM_THIS(BgCmImpl, iface); 290 291 LPSHELLBROWSER lpSB; 292 LPSHELLVIEW lpSV; 293 HWND hWndSV; 294 295 TRACE("(%p)->(invcom=%p verb=%p wnd=%x)\n",This,lpcmi,lpcmi->lpVerb, lpcmi->hwnd); 296 297 /* get the active IShellView */ 298 if((lpSB = (LPSHELLBROWSER)SendMessageA(lpcmi->hwnd, CWM_GETISHELLBROWSER,0,0))) 299 { 300 if(SUCCEEDED(IShellBrowser_QueryActiveShellView(lpSB, &lpSV))) 301 { 302 IShellView_GetWindow(lpSV, &hWndSV); 303 } 304 } 305 306 if(lpSV) 307 { 308 if(HIWORD(lpcmi->lpVerb)) 309 { 310 TRACE("%s\n",lpcmi->lpVerb); 311 312 if (! strcmp(lpcmi->lpVerb,CMDSTR_NEWFOLDERA)) 313 { 314 if(lpSV) DoNewFolder(iface, lpSV); 315 } 316 else if (! strcmp(lpcmi->lpVerb,CMDSTR_VIEWLISTA)) 317 { 318 if(hWndSV) SendMessageA(hWndSV, WM_COMMAND, MAKEWPARAM(FCIDM_SHVIEW_LISTVIEW,0),0 ); 319 } 320 else if (! strcmp(lpcmi->lpVerb,CMDSTR_VIEWDETAILSA)) 321 { 322 if(hWndSV) SendMessageA(hWndSV, WM_COMMAND, MAKEWPARAM(FCIDM_SHVIEW_REPORTVIEW,0),0 ); 323 } 324 else 325 { 326 FIXME("please report: unknown verb %s\n",lpcmi->lpVerb); 327 } 328 } 329 else 330 { 331 switch(LOWORD(lpcmi->lpVerb)) 332 { 333 case FCIDM_SHVIEW_NEWFOLDER: 334 DoNewFolder(iface, lpSV); 335 break; 336 case FCIDM_SHVIEW_INSERT: 337 DoPaste(iface); 338 break; 339 default: 340 /* if it's a id just pass it to the parent shv */ 341 SendMessageA(hWndSV, WM_COMMAND, MAKEWPARAM(LOWORD(lpcmi->lpVerb), 0),0 ); 342 break; 343 } 344 } 345 346 IShellView_Release(lpSV); /* QueryActiveShellView does AddRef*/ 347 } 348 return NOERROR; 348 349 } 349 350 … … 353 354 */ 354 355 static HRESULT WINAPI ISVBgCm_fnGetCommandString( 355 IContextMenu *iface,356 UINT idCommand,357 UINT uFlags,358 LPUINT lpReserved,359 LPSTR lpszName,360 UINT uMaxNameLen)361 { 362 ICOM_THIS(BgCmImpl, iface);363 364 TRACE("(%p)->(idcom=%x flags=%x %p name=%p len=%x)\n",This, idCommand, uFlags, lpReserved, lpszName, uMaxNameLen);365 366 /* test the existence of the menu items, the file dialog enables 367 the buttons according to this */368 if (uFlags == GCS_VALIDATEA)369 {370 if(HIWORD(idCommand))371 {372 if (!strcmp((LPSTR)idCommand, CMDSTR_VIEWLISTA) ||373 !strcmp((LPSTR)idCommand, CMDSTR_VIEWDETAILSA) ||374 !strcmp((LPSTR)idCommand, CMDSTR_NEWFOLDERA))375 { 376 return NOERROR;377 }378 }379 }380 381 FIXME("unknown command string\n");382 return E_FAIL;356 IContextMenu *iface, 357 UINT idCommand, 358 UINT uFlags, 359 LPUINT lpReserved, 360 LPSTR lpszName, 361 UINT uMaxNameLen) 362 { 363 ICOM_THIS(BgCmImpl, iface); 364 365 TRACE("(%p)->(idcom=%x flags=%x %p name=%p len=%x)\n",This, idCommand, uFlags, lpReserved, lpszName, uMaxNameLen); 366 367 /* test the existence of the menu items, the file dialog enables 368 the buttons according to this */ 369 if (uFlags == GCS_VALIDATEA) 370 { 371 if(HIWORD(idCommand)) 372 { 373 if (!strcmp((LPSTR)idCommand, CMDSTR_VIEWLISTA) || 374 !strcmp((LPSTR)idCommand, CMDSTR_VIEWDETAILSA) || 375 !strcmp((LPSTR)idCommand, CMDSTR_NEWFOLDERA)) 376 { 377 return NOERROR; 378 } 379 } 380 } 381 382 FIXME("unknown command string\n"); 383 return E_FAIL; 383 384 } 384 385 … … 387 388 */ 388 389 static HRESULT WINAPI ISVBgCm_fnHandleMenuMsg( 389 IContextMenu *iface,390 UINT uMsg,391 WPARAM wParam,392 LPARAM lParam)393 { 394 ICOM_THIS(BgCmImpl, iface);395 396 FIXME("(%p)->(msg=%x wp=%x lp=%lx)\n",This, uMsg, wParam, lParam);397 398 return E_NOTIMPL;390 IContextMenu *iface, 391 UINT uMsg, 392 WPARAM wParam, 393 LPARAM lParam) 394 { 395 ICOM_THIS(BgCmImpl, iface); 396 397 FIXME("(%p)->(msg=%x wp=%x lp=%lx)\n",This, uMsg, wParam, lParam); 398 399 return E_NOTIMPL; 399 400 } 400 401 401 402 /************************************************************************** 402 403 * IContextMenu VTable 403 * 404 */ 405 static struct ICOM_VTABLE(IContextMenu) cmvt = 406 { 407 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE408 ISVBgCm_fnQueryInterface,409 ISVBgCm_fnAddRef,410 ISVBgCm_fnRelease,411 ISVBgCm_fnQueryContextMenu,412 ISVBgCm_fnInvokeCommand,413 ISVBgCm_fnGetCommandString,414 ISVBgCm_fnHandleMenuMsg,415 (void *) 0xdeadbabe/* just paranoia (IContextMenu3) */404 * 405 */ 406 static struct ICOM_VTABLE(IContextMenu) cmvt = 407 { 408 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 409 ISVBgCm_fnQueryInterface, 410 ISVBgCm_fnAddRef, 411 ISVBgCm_fnRelease, 412 ISVBgCm_fnQueryContextMenu, 413 ISVBgCm_fnInvokeCommand, 414 ISVBgCm_fnGetCommandString, 415 ISVBgCm_fnHandleMenuMsg, 416 (void *) 0xdeadbabe /* just paranoia (IContextMenu3) */ 416 417 }; 417 418 -
trunk/src/shell32/shv_item_cmenu.c
r5618 r6650 1 /* $Id: shv_item_cmenu.c,v 1.3 2001-09-05 13:47:00 bird Exp $ */ 1 2 /* 2 * IContextMenu for items in the shellview3 * IContextMenu for items in the shellview 3 4 * 4 * 1998, 2000Juergen Schmied <juergen.schmied@debitel.net>5 * 1998, 2000 Juergen Schmied <juergen.schmied@debitel.net> 5 6 */ 6 7 #include <string.h> … … 25 26 * IContextMenu Implementation 26 27 */ 27 typedef struct 28 { ICOM_VFIELD(IContextMenu);29 DWORDref;30 IShellFolder*pSFParent;31 LPITEMIDLIST pidl;/* root pidl */32 LPITEMIDLIST *apidl;/* array of child pidls */33 UINTcidl;34 BOOLbAllValues;28 typedef struct 29 { ICOM_VFIELD(IContextMenu); 30 DWORD ref; 31 IShellFolder* pSFParent; 32 LPITEMIDLIST pidl; /* root pidl */ 33 LPITEMIDLIST *apidl; /* array of child pidls */ 34 UINT cidl; 35 BOOL bAllValues; 35 36 } ItemCmImpl; 36 37 … … 42 43 */ 43 44 static BOOL ISvItemCm_CanRenameItems(ItemCmImpl *This) 44 { UINT i;45 DWORD dwAttributes;46 47 TRACE("(%p)->()\n",This);48 49 if(This->apidl)50 {51 for(i = 0; i < This->cidl; i++){}52 if(i > 1) return FALSE;/* can't rename more than one item at a time*/53 dwAttributes = SFGAO_CANRENAME;54 IShellFolder_GetAttributesOf(This->pSFParent, 1, This->apidl, &dwAttributes);55 return dwAttributes & SFGAO_CANRENAME;56 }57 return FALSE;45 { UINT i; 46 DWORD dwAttributes; 47 48 TRACE("(%p)->()\n",This); 49 50 if(This->apidl) 51 { 52 for(i = 0; i < This->cidl; i++){} 53 if(i > 1) return FALSE; /* can't rename more than one item at a time*/ 54 dwAttributes = SFGAO_CANRENAME; 55 IShellFolder_GetAttributesOf(This->pSFParent, 1, This->apidl, &dwAttributes); 56 return dwAttributes & SFGAO_CANRENAME; 57 } 58 return FALSE; 58 59 } 59 60 … … 62 63 */ 63 64 IContextMenu *ISvItemCm_Constructor(LPSHELLFOLDER pSFParent, LPCITEMIDLIST pidl, LPCITEMIDLIST *apidl, UINT cidl) 64 { ItemCmImpl* cm;65 UINT u;66 67 cm = (ItemCmImpl*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(ItemCmImpl));68 ICOM_VTBL(cm)=&cmvt;69 cm->ref = 1;70 cm->pidl = ILClone(pidl);71 cm->pSFParent = pSFParent;72 73 if(pSFParent) IShellFolder_AddRef(pSFParent);74 75 cm->apidl = _ILCopyaPidl(apidl, cidl);76 cm->cidl = cidl;77 78 cm->bAllValues = 1;79 for(u = 0; u < cidl; u++)80 {81 cm->bAllValues &= (_ILIsValue(apidl[u]) ? 1 : 0);82 }83 84 TRACE("(%p)->()\n",cm);85 86 shell32_ObjCount++;87 return (IContextMenu*)cm;65 { ItemCmImpl* cm; 66 UINT u; 67 68 cm = (ItemCmImpl*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(ItemCmImpl)); 69 ICOM_VTBL(cm)=&cmvt; 70 cm->ref = 1; 71 cm->pidl = ILClone(pidl); 72 cm->pSFParent = pSFParent; 73 74 if(pSFParent) IShellFolder_AddRef(pSFParent); 75 76 cm->apidl = _ILCopyaPidl(apidl, cidl); 77 cm->cidl = cidl; 78 79 cm->bAllValues = 1; 80 for(u = 0; u < cidl; u++) 81 { 82 cm->bAllValues &= (_ILIsValue(apidl[u]) ? 1 : 0); 83 } 84 85 TRACE("(%p)->()\n",cm); 86 87 shell32_ObjCount++; 88 return (IContextMenu*)cm; 88 89 } 89 90 … … 93 94 static HRESULT WINAPI ISvItemCm_fnQueryInterface(IContextMenu *iface, REFIID riid, LPVOID *ppvObj) 94 95 { 95 ICOM_THIS(ItemCmImpl, iface);96 97 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj);98 99 *ppvObj = NULL;100 101 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/102 {103 *ppvObj = This; 104 }105 else if(IsEqualIID(riid, &IID_IContextMenu)) /*IContextMenu*/106 {107 *ppvObj = This;108 } 109 else if(IsEqualIID(riid, &IID_IShellExtInit)) /*IShellExtInit*/110 {111 FIXME("-- LPSHELLEXTINIT pointer requested\n");112 }113 114 if(*ppvObj)115 { 116 IUnknown_AddRef((IUnknown*)*ppvObj); 117 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);118 return S_OK;119 }120 TRACE("-- Interface: E_NOINTERFACE\n");121 return E_NOINTERFACE;96 ICOM_THIS(ItemCmImpl, iface); 97 98 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj); 99 100 *ppvObj = NULL; 101 102 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/ 103 { 104 *ppvObj = This; 105 } 106 else if(IsEqualIID(riid, &IID_IContextMenu)) /*IContextMenu*/ 107 { 108 *ppvObj = This; 109 } 110 else if(IsEqualIID(riid, &IID_IShellExtInit)) /*IShellExtInit*/ 111 { 112 FIXME("-- LPSHELLEXTINIT pointer requested\n"); 113 } 114 115 if(*ppvObj) 116 { 117 IUnknown_AddRef((IUnknown*)*ppvObj); 118 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj); 119 return S_OK; 120 } 121 TRACE("-- Interface: E_NOINTERFACE\n"); 122 return E_NOINTERFACE; 122 123 } 123 124 … … 127 128 static ULONG WINAPI ISvItemCm_fnAddRef(IContextMenu *iface) 128 129 { 129 ICOM_THIS(ItemCmImpl, iface);130 131 TRACE("(%p)->(count=%lu)\n",This, This->ref);132 133 shell32_ObjCount++;134 return ++(This->ref);130 ICOM_THIS(ItemCmImpl, iface); 131 132 TRACE("(%p)->(count=%lu)\n",This, This->ref); 133 134 shell32_ObjCount++; 135 return ++(This->ref); 135 136 } 136 137 … … 140 141 static ULONG WINAPI ISvItemCm_fnRelease(IContextMenu *iface) 141 142 { 142 ICOM_THIS(ItemCmImpl, iface);143 144 TRACE("(%p)->()\n",This);145 146 shell32_ObjCount--;147 148 if (!--(This->ref)) 149 {150 TRACE(" destroying IContextMenu(%p)\n",This);151 152 if(This->pSFParent)153 IShellFolder_Release(This->pSFParent);154 155 if(This->pidl)156 SHFree(This->pidl);157 158 /*make sure the pidl is freed*/159 _ILFreeaPidl(This->apidl, This->cidl);160 161 HeapFree(GetProcessHeap(),0,This);162 return 0;163 }164 return This->ref;143 ICOM_THIS(ItemCmImpl, iface); 144 145 TRACE("(%p)->()\n",This); 146 147 shell32_ObjCount--; 148 149 if (!--(This->ref)) 150 { 151 TRACE(" destroying IContextMenu(%p)\n",This); 152 153 if(This->pSFParent) 154 IShellFolder_Release(This->pSFParent); 155 156 if(This->pidl) 157 SHFree(This->pidl); 158 159 /*make sure the pidl is freed*/ 160 _ILFreeaPidl(This->apidl, This->cidl); 161 162 HeapFree(GetProcessHeap(),0,This); 163 return 0; 164 } 165 return This->ref; 165 166 } 166 167 167 168 /************************************************************************** 168 169 * ICM_InsertItem() 169 */ 170 */ 170 171 void WINAPI _InsertMenuItem ( 171 HMENU hmenu,172 UINT indexMenu,173 BOOL fByPosition,174 UINT wID,175 UINT fType,176 LPSTR dwTypeData,177 UINT fState)178 { 179 MENUITEMINFOAmii;180 181 ZeroMemory(&mii, sizeof(mii));182 mii.cbSize = sizeof(mii);183 if (fType == MFT_SEPARATOR)184 {185 mii.fMask = MIIM_ID | MIIM_TYPE;186 }187 else188 {189 mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE;190 mii.dwTypeData = dwTypeData;191 mii.fState = fState;192 }193 mii.wID = wID;194 mii.fType = fType;195 InsertMenuItemA( hmenu, indexMenu, fByPosition, &mii);172 HMENU hmenu, 173 UINT indexMenu, 174 BOOL fByPosition, 175 UINT wID, 176 UINT fType, 177 LPSTR dwTypeData, 178 UINT fState) 179 { 180 MENUITEMINFOA mii; 181 182 ZeroMemory(&mii, sizeof(mii)); 183 mii.cbSize = sizeof(mii); 184 if (fType == MFT_SEPARATOR) 185 { 186 mii.fMask = MIIM_ID | MIIM_TYPE; 187 } 188 else 189 { 190 mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE; 191 mii.dwTypeData = dwTypeData; 192 mii.fState = fState; 193 } 194 mii.wID = wID; 195 mii.fType = fType; 196 InsertMenuItemA( hmenu, indexMenu, fByPosition, &mii); 196 197 } 197 198 /************************************************************************** … … 200 201 201 202 static HRESULT WINAPI ISvItemCm_fnQueryContextMenu( 202 IContextMenu *iface,203 HMENU hmenu,204 UINT indexMenu,205 UINT idCmdFirst,206 UINT idCmdLast,207 UINT uFlags)208 { 209 ICOM_THIS(ItemCmImpl, iface);210 211 TRACE("(%p)->(hmenu=%x indexmenu=%x cmdfirst=%x cmdlast=%x flags=%x )\n",This, hmenu, indexMenu, idCmdFirst, idCmdLast, uFlags);212 213 if(!(CMF_DEFAULTONLY & uFlags))214 {215 if(uFlags & CMF_EXPLORE)216 {217 if(This->bAllValues)218 {219 _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_OPEN, MFT_STRING, "&Open", MFS_ENABLED);220 _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_EXPLORE, MFT_STRING, "&Explore", MFS_ENABLED|MFS_DEFAULT);221 }222 else223 {224 _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_EXPLORE, MFT_STRING, "&Explore", MFS_ENABLED|MFS_DEFAULT);225 _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_OPEN, MFT_STRING, "&Open", MFS_ENABLED);226 }227 }228 else229 {230 _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_OPEN, MFT_STRING, "&Select", MFS_ENABLED|MFS_DEFAULT);231 }232 _InsertMenuItem(hmenu, indexMenu++, TRUE, 0, MFT_SEPARATOR, NULL, 0);233 _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_COPY, MFT_STRING, "&Copy", MFS_ENABLED);234 _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_CUT, MFT_STRING, "&Cut", MFS_ENABLED);235 236 _InsertMenuItem(hmenu, indexMenu++, TRUE, 0, MFT_SEPARATOR, NULL, 0);237 _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_DELETE, MFT_STRING, "&Delete", MFS_ENABLED);238 239 if(uFlags & CMF_CANRENAME)240 _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_RENAME, MFT_STRING, "&Rename", ISvItemCm_CanRenameItems(This) ? MFS_ENABLED : MFS_DISABLED);241 242 return MAKE_HRESULT(SEVERITY_SUCCESS, 0, (FCIDM_SHVIEWLAST));243 }244 return MAKE_HRESULT(SEVERITY_SUCCESS, 0, 0);203 IContextMenu *iface, 204 HMENU hmenu, 205 UINT indexMenu, 206 UINT idCmdFirst, 207 UINT idCmdLast, 208 UINT uFlags) 209 { 210 ICOM_THIS(ItemCmImpl, iface); 211 212 TRACE("(%p)->(hmenu=%x indexmenu=%x cmdfirst=%x cmdlast=%x flags=%x )\n",This, hmenu, indexMenu, idCmdFirst, idCmdLast, uFlags); 213 214 if(!(CMF_DEFAULTONLY & uFlags)) 215 { 216 if(uFlags & CMF_EXPLORE) 217 { 218 if(This->bAllValues) 219 { 220 _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_OPEN, MFT_STRING, "&Open", MFS_ENABLED); 221 _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_EXPLORE, MFT_STRING, "&Explore", MFS_ENABLED|MFS_DEFAULT); 222 } 223 else 224 { 225 _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_EXPLORE, MFT_STRING, "&Explore", MFS_ENABLED|MFS_DEFAULT); 226 _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_OPEN, MFT_STRING, "&Open", MFS_ENABLED); 227 } 228 } 229 else 230 { 231 _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_OPEN, MFT_STRING, "&Select", MFS_ENABLED|MFS_DEFAULT); 232 } 233 _InsertMenuItem(hmenu, indexMenu++, TRUE, 0, MFT_SEPARATOR, NULL, 0); 234 _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_COPY, MFT_STRING, "&Copy", MFS_ENABLED); 235 _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_CUT, MFT_STRING, "&Cut", MFS_ENABLED); 236 237 _InsertMenuItem(hmenu, indexMenu++, TRUE, 0, MFT_SEPARATOR, NULL, 0); 238 _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_DELETE, MFT_STRING, "&Delete", MFS_ENABLED); 239 240 if(uFlags & CMF_CANRENAME) 241 _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_RENAME, MFT_STRING, "&Rename", ISvItemCm_CanRenameItems(This) ? MFS_ENABLED : MFS_DISABLED); 242 243 return MAKE_HRESULT(SEVERITY_SUCCESS, 0, (FCIDM_SHVIEWLAST)); 244 } 245 return MAKE_HRESULT(SEVERITY_SUCCESS, 0, 0); 245 246 } 246 247 … … 252 253 253 254 static void DoOpenExplore( 254 IContextMenu *iface,255 HWND hwnd,256 LPCSTR verb)257 { 258 ICOM_THIS(ItemCmImpl, iface);259 260 int i, bFolderFound = FALSE;261 LPITEMIDLISTpidlFQ;262 SHELLEXECUTEINFOAsei;263 264 /* Find the first item in the list that is not a value. These commands 265 should never be invoked if there isn't at least one folder item in the list.*/266 267 for(i = 0; i<This->cidl; i++)268 {269 if(!_ILIsValue(This->apidl[i]))270 {271 bFolderFound = TRUE;272 break;273 }274 }275 276 if (!bFolderFound) return;277 278 pidlFQ = ILCombine(This->pidl, This->apidl[i]);279 280 ZeroMemory(&sei, sizeof(sei));281 sei.cbSize = sizeof(sei);282 sei.fMask = SEE_MASK_IDLIST | SEE_MASK_CLASSNAME;283 sei.lpIDList = pidlFQ;284 sei.lpClass = "folder";285 sei.hwnd = hwnd;286 sei.nShow = SW_SHOWNORMAL;287 sei.lpVerb = verb;288 ShellExecuteExA(&sei);289 SHFree(pidlFQ);255 IContextMenu *iface, 256 HWND hwnd, 257 LPCSTR verb) 258 { 259 ICOM_THIS(ItemCmImpl, iface); 260 261 int i, bFolderFound = FALSE; 262 LPITEMIDLIST pidlFQ; 263 SHELLEXECUTEINFOA sei; 264 265 /* Find the first item in the list that is not a value. These commands 266 should never be invoked if there isn't at least one folder item in the list.*/ 267 268 for(i = 0; i<This->cidl; i++) 269 { 270 if(!_ILIsValue(This->apidl[i])) 271 { 272 bFolderFound = TRUE; 273 break; 274 } 275 } 276 277 if (!bFolderFound) return; 278 279 pidlFQ = ILCombine(This->pidl, This->apidl[i]); 280 281 ZeroMemory(&sei, sizeof(sei)); 282 sei.cbSize = sizeof(sei); 283 sei.fMask = SEE_MASK_IDLIST | SEE_MASK_CLASSNAME; 284 sei.lpIDList = pidlFQ; 285 sei.lpClass = "folder"; 286 sei.hwnd = hwnd; 287 sei.nShow = SW_SHOWNORMAL; 288 sei.lpVerb = verb; 289 ShellExecuteExA(&sei); 290 SHFree(pidlFQ); 290 291 } 291 292 … … 294 295 */ 295 296 static void DoRename( 296 IContextMenu *iface,297 HWND hwnd)298 { 299 ICOM_THIS(ItemCmImpl, iface);300 301 LPSHELLBROWSERlpSB;302 LPSHELLVIEWlpSV;303 304 TRACE("(%p)->(wnd=%x)\n",This, hwnd); 305 306 /* get the active IShellView */307 if ((lpSB = (LPSHELLBROWSER)SendMessageA(hwnd, CWM_GETISHELLBROWSER,0,0)))308 {309 if(SUCCEEDED(IShellBrowser_QueryActiveShellView(lpSB, &lpSV)))310 {311 TRACE("(sv=%p)\n",lpSV); 312 IShellView_SelectItem(lpSV, This->apidl[0],297 IContextMenu *iface, 298 HWND hwnd) 299 { 300 ICOM_THIS(ItemCmImpl, iface); 301 302 LPSHELLBROWSER lpSB; 303 LPSHELLVIEW lpSV; 304 305 TRACE("(%p)->(wnd=%x)\n",This, hwnd); 306 307 /* get the active IShellView */ 308 if ((lpSB = (LPSHELLBROWSER)SendMessageA(hwnd, CWM_GETISHELLBROWSER,0,0))) 309 { 310 if(SUCCEEDED(IShellBrowser_QueryActiveShellView(lpSB, &lpSV))) 311 { 312 TRACE("(sv=%p)\n",lpSV); 313 IShellView_SelectItem(lpSV, This->apidl[0], 313 314 SVSI_DESELECTOTHERS|SVSI_EDIT|SVSI_ENSUREVISIBLE|SVSI_FOCUSED|SVSI_SELECT); 314 IShellView_Release(lpSV);315 }316 }315 IShellView_Release(lpSV); 316 } 317 } 317 318 } 318 319 … … 324 325 static void DoDelete(IContextMenu *iface) 325 326 { 326 ICOM_THIS(ItemCmImpl, iface);327 ISFHelper * psfhlp;328 329 IShellFolder_QueryInterface(This->pSFParent, &IID_ISFHelper, (LPVOID*)&psfhlp);330 if (psfhlp)331 {332 ISFHelper_DeleteItems(psfhlp, This->cidl, This->apidl);333 ISFHelper_Release(psfhlp);334 }327 ICOM_THIS(ItemCmImpl, iface); 328 ISFHelper * psfhlp; 329 330 IShellFolder_QueryInterface(This->pSFParent, &IID_ISFHelper, (LPVOID*)&psfhlp); 331 if (psfhlp) 332 { 333 ISFHelper_DeleteItems(psfhlp, This->cidl, This->apidl); 334 ISFHelper_Release(psfhlp); 335 } 335 336 } 336 337 … … 341 342 */ 342 343 static BOOL DoCopyOrCut( 343 IContextMenu *iface,344 HWND hwnd,345 BOOL bCut)346 { 347 ICOM_THIS(ItemCmImpl, iface);348 349 LPSHELLBROWSERlpSB;350 LPSHELLVIEWlpSV;351 LPDATAOBJECT lpDo;352 353 TRACE("(%p)->(wnd=0x%04x,bCut=0x%08x)\n",This, hwnd, bCut);354 355 if(GetShellOle())356 {357 /* get the active IShellView */358 if ((lpSB = (LPSHELLBROWSER)SendMessageA(hwnd, CWM_GETISHELLBROWSER,0,0)))359 {360 if (SUCCEEDED(IShellBrowser_QueryActiveShellView(lpSB, &lpSV)))361 {362 if (SUCCEEDED(IShellView_GetItemObject(lpSV, SVGIO_SELECTION, &IID_IDataObject, (LPVOID*)&lpDo)))363 {364 pOleSetClipboard(lpDo);365 IDataObject_Release(lpDo);366 }367 IShellView_Release(lpSV);368 }369 }370 }371 return TRUE;344 IContextMenu *iface, 345 HWND hwnd, 346 BOOL bCut) 347 { 348 ICOM_THIS(ItemCmImpl, iface); 349 350 LPSHELLBROWSER lpSB; 351 LPSHELLVIEW lpSV; 352 LPDATAOBJECT lpDo; 353 354 TRACE("(%p)->(wnd=0x%04x,bCut=0x%08x)\n",This, hwnd, bCut); 355 356 if(GetShellOle()) 357 { 358 /* get the active IShellView */ 359 if ((lpSB = (LPSHELLBROWSER)SendMessageA(hwnd, CWM_GETISHELLBROWSER,0,0))) 360 { 361 if (SUCCEEDED(IShellBrowser_QueryActiveShellView(lpSB, &lpSV))) 362 { 363 if (SUCCEEDED(IShellView_GetItemObject(lpSV, SVGIO_SELECTION, &IID_IDataObject, (LPVOID*)&lpDo))) 364 { 365 pOleSetClipboard(lpDo); 366 IDataObject_Release(lpDo); 367 } 368 IShellView_Release(lpSV); 369 } 370 } 371 } 372 return TRUE; 372 373 #if 0 373 374 /* … … 375 376 we might need this possibility too (js) 376 377 */ 377 BOOL bSuccess = FALSE;378 379 TRACE("(%p)\n", iface);380 381 if(OpenClipboard(NULL))382 {383 if(EmptyClipboard())384 {385 IPersistFolder2 * ppf2;386 IShellFolder_QueryInterface(This->pSFParent, &IID_IPersistFolder2, (LPVOID*)&ppf2);387 if (ppf2)388 {389 LPITEMIDLIST pidl;390 IPersistFolder2_GetCurFolder(ppf2, &pidl);391 if(pidl)392 {393 HGLOBAL hMem;394 395 hMem = RenderHDROP(pidl, This->apidl, This->cidl);396 397 if(SetClipboardData(CF_HDROP, hMem))398 {399 bSuccess = TRUE;400 }401 SHFree(pidl);402 }403 IPersistFolder2_Release(ppf2);404 }405 406 }407 CloseClipboard();408 }409 return bSuccess;378 BOOL bSuccess = FALSE; 379 380 TRACE("(%p)\n", iface); 381 382 if(OpenClipboard(NULL)) 383 { 384 if(EmptyClipboard()) 385 { 386 IPersistFolder2 * ppf2; 387 IShellFolder_QueryInterface(This->pSFParent, &IID_IPersistFolder2, (LPVOID*)&ppf2); 388 if (ppf2) 389 { 390 LPITEMIDLIST pidl; 391 IPersistFolder2_GetCurFolder(ppf2, &pidl); 392 if(pidl) 393 { 394 HGLOBAL hMem; 395 396 hMem = RenderHDROP(pidl, This->apidl, This->cidl); 397 398 if(SetClipboardData(CF_HDROP, hMem)) 399 { 400 bSuccess = TRUE; 401 } 402 SHFree(pidl); 403 } 404 IPersistFolder2_Release(ppf2); 405 } 406 407 } 408 CloseClipboard(); 409 } 410 return bSuccess; 410 411 #endif 411 412 } … … 414 415 */ 415 416 static HRESULT WINAPI ISvItemCm_fnInvokeCommand( 416 IContextMenu *iface,417 LPCMINVOKECOMMANDINFO lpcmi)418 { 419 ICOM_THIS(ItemCmImpl, iface);420 421 TRACE("(%p)->(invcom=%p verb=%p wnd=%x)\n",This,lpcmi,lpcmi->lpVerb, lpcmi->hwnd); 422 423 if(LOWORD(lpcmi->lpVerb) > FCIDM_SHVIEWLAST) return E_INVALIDARG;424 425 switch(LOWORD(lpcmi->lpVerb))426 {427 case FCIDM_SHVIEW_EXPLORE:428 DoOpenExplore(iface, lpcmi->hwnd, "explore");429 break;430 case FCIDM_SHVIEW_OPEN:431 DoOpenExplore(iface, lpcmi->hwnd, "open");432 break;433 case FCIDM_SHVIEW_RENAME:434 DoRename(iface, lpcmi->hwnd);435 break; 436 case FCIDM_SHVIEW_DELETE:437 DoDelete(iface);438 break; 439 case FCIDM_SHVIEW_COPY:440 DoCopyOrCut(iface, lpcmi->hwnd, FALSE);441 break;442 case FCIDM_SHVIEW_CUT:443 DoCopyOrCut(iface, lpcmi->hwnd, TRUE);444 break;445 }446 return NOERROR;417 IContextMenu *iface, 418 LPCMINVOKECOMMANDINFO lpcmi) 419 { 420 ICOM_THIS(ItemCmImpl, iface); 421 422 TRACE("(%p)->(invcom=%p verb=%p wnd=%x)\n",This,lpcmi,lpcmi->lpVerb, lpcmi->hwnd); 423 424 if(LOWORD(lpcmi->lpVerb) > FCIDM_SHVIEWLAST) return E_INVALIDARG; 425 426 switch(LOWORD(lpcmi->lpVerb)) 427 { 428 case FCIDM_SHVIEW_EXPLORE: 429 DoOpenExplore(iface, lpcmi->hwnd, "explore"); 430 break; 431 case FCIDM_SHVIEW_OPEN: 432 DoOpenExplore(iface, lpcmi->hwnd, "open"); 433 break; 434 case FCIDM_SHVIEW_RENAME: 435 DoRename(iface, lpcmi->hwnd); 436 break; 437 case FCIDM_SHVIEW_DELETE: 438 DoDelete(iface); 439 break; 440 case FCIDM_SHVIEW_COPY: 441 DoCopyOrCut(iface, lpcmi->hwnd, FALSE); 442 break; 443 case FCIDM_SHVIEW_CUT: 444 DoCopyOrCut(iface, lpcmi->hwnd, TRUE); 445 break; 446 } 447 return NOERROR; 447 448 } 448 449 … … 451 452 */ 452 453 static HRESULT WINAPI ISvItemCm_fnGetCommandString( 453 IContextMenu *iface,454 UINT idCommand,455 UINT uFlags,456 LPUINT lpReserved,457 LPSTR lpszName,458 UINT uMaxNameLen)459 { 460 ICOM_THIS(ItemCmImpl, iface);461 462 HRESULT hr = E_INVALIDARG;463 464 TRACE("(%p)->(idcom=%x flags=%x %p name=%p len=%x)\n",This, idCommand, uFlags, lpReserved, lpszName, uMaxNameLen);465 466 switch(uFlags)467 {468 case GCS_HELPTEXT:469 hr = E_NOTIMPL;470 break;471 472 case GCS_VERBA:473 switch(idCommand)474 {475 case FCIDM_SHVIEW_RENAME:476 strcpy((LPSTR)lpszName, "rename");477 hr = NOERROR;478 break;479 }480 break;481 482 /* NT 4.0 with IE 3.0x or no IE will always call This with GCS_VERBW. In This 483 case, you need to do the lstrcpyW to the pointer passed.*/484 case GCS_VERBW:485 switch(idCommand)486 { case FCIDM_SHVIEW_RENAME:454 IContextMenu *iface, 455 UINT idCommand, 456 UINT uFlags, 457 LPUINT lpReserved, 458 LPSTR lpszName, 459 UINT uMaxNameLen) 460 { 461 ICOM_THIS(ItemCmImpl, iface); 462 463 HRESULT hr = E_INVALIDARG; 464 465 TRACE("(%p)->(idcom=%x flags=%x %p name=%p len=%x)\n",This, idCommand, uFlags, lpReserved, lpszName, uMaxNameLen); 466 467 switch(uFlags) 468 { 469 case GCS_HELPTEXT: 470 hr = E_NOTIMPL; 471 break; 472 473 case GCS_VERBA: 474 switch(idCommand) 475 { 476 case FCIDM_SHVIEW_RENAME: 477 strcpy((LPSTR)lpszName, "rename"); 478 hr = NOERROR; 479 break; 480 } 481 break; 482 483 /* NT 4.0 with IE 3.0x or no IE will always call This with GCS_VERBW. In This 484 case, you need to do the lstrcpyW to the pointer passed.*/ 485 case GCS_VERBW: 486 switch(idCommand) 487 { case FCIDM_SHVIEW_RENAME: 487 488 MultiByteToWideChar( CP_ACP, 0, "rename", -1, (LPWSTR)lpszName, uMaxNameLen ); 488 hr = NOERROR;489 break;490 }491 break;492 493 case GCS_VALIDATE:494 hr = NOERROR;495 break;496 }497 TRACE("-- (%p)->(name=%s)\n",This, lpszName);498 return hr;489 hr = NOERROR; 490 break; 491 } 492 break; 493 494 case GCS_VALIDATE: 495 hr = NOERROR; 496 break; 497 } 498 TRACE("-- (%p)->(name=%s)\n",This, lpszName); 499 return hr; 499 500 } 500 501 … … 506 507 */ 507 508 static HRESULT WINAPI ISvItemCm_fnHandleMenuMsg( 508 IContextMenu *iface,509 UINT uMsg,510 WPARAM wParam,511 LPARAM lParam)512 { 513 ICOM_THIS(ItemCmImpl, iface);514 515 TRACE("(%p)->(msg=%x wp=%x lp=%lx)\n",This, uMsg, wParam, lParam);516 517 return E_NOTIMPL;518 } 519 520 static struct ICOM_VTABLE(IContextMenu) cmvt = 521 { 522 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE523 ISvItemCm_fnQueryInterface,524 ISvItemCm_fnAddRef,525 ISvItemCm_fnRelease,526 ISvItemCm_fnQueryContextMenu,527 ISvItemCm_fnInvokeCommand,528 ISvItemCm_fnGetCommandString,529 ISvItemCm_fnHandleMenuMsg,530 (void *) 0xdeadbabe/* just paranoia */509 IContextMenu *iface, 510 UINT uMsg, 511 WPARAM wParam, 512 LPARAM lParam) 513 { 514 ICOM_THIS(ItemCmImpl, iface); 515 516 TRACE("(%p)->(msg=%x wp=%x lp=%lx)\n",This, uMsg, wParam, lParam); 517 518 return E_NOTIMPL; 519 } 520 521 static struct ICOM_VTABLE(IContextMenu) cmvt = 522 { 523 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 524 ISvItemCm_fnQueryInterface, 525 ISvItemCm_fnAddRef, 526 ISvItemCm_fnRelease, 527 ISvItemCm_fnQueryContextMenu, 528 ISvItemCm_fnInvokeCommand, 529 ISvItemCm_fnGetCommandString, 530 ISvItemCm_fnHandleMenuMsg, 531 (void *) 0xdeadbabe /* just paranoia */ 531 532 }; -
trunk/src/shell32/systray.c
r5618 r6650 1 /* $Id: systray.c,v 1.3 2001-09-05 13:47:01 bird Exp $ */ 1 2 /* 2 * Systray3 * Systray 3 4 * 4 * Copyright 1999 Kai Morich<kai.morich@bigfoot.de>5 * Copyright 1999 Kai Morich <kai.morich@bigfoot.de> 5 6 * 6 7 * Manage the systray window. That it actually appears in the docking … … 66 67 while (ptrayItem) { 67 68 if (ptrayItem->hWnd==hWnd) { 68 if (ptrayItem->notifyIcon.hIcon) {69 hdc = BeginPaint(hWnd, &ps);70 GetClientRect(hWnd, &rc);71 if (!DrawIconEx(hdc, rc.left+ICON_BORDER, rc.top+ICON_BORDER, ptrayItem->notifyIcon.hIcon,72 ICON_SIZE, ICON_SIZE, 0, 0, DI_DEFAULTSIZE|DI_NORMAL)) {73 ERR("Paint(SystrayWindow 0x%08x) failed -> removing SystrayItem %p\n", hWnd, ptrayItem);74 SYSTRAY_Delete(&ptrayItem->notifyIcon);75 }76 }77 break;69 if (ptrayItem->notifyIcon.hIcon) { 70 hdc = BeginPaint(hWnd, &ps); 71 GetClientRect(hWnd, &rc); 72 if (!DrawIconEx(hdc, rc.left+ICON_BORDER, rc.top+ICON_BORDER, ptrayItem->notifyIcon.hIcon, 73 ICON_SIZE, ICON_SIZE, 0, 0, DI_DEFAULTSIZE|DI_NORMAL)) { 74 ERR("Paint(SystrayWindow 0x%08x) failed -> removing SystrayItem %p\n", hWnd, ptrayItem); 75 SYSTRAY_Delete(&ptrayItem->notifyIcon); 76 } 77 } 78 break; 78 79 } 79 80 ptrayItem = ptrayItem->nextTrayItem; … … 119 120 while (ptrayItem) { 120 121 if (ptrayItem->hWnd == hWnd) { 121 if (ptrayItem->notifyIcon.hWnd && ptrayItem->notifyIcon.uCallbackMessage) {122 if (ptrayItem->notifyIcon.hWnd && ptrayItem->notifyIcon.uCallbackMessage) { 122 123 if (!PostMessageA(ptrayItem->notifyIcon.hWnd, ptrayItem->notifyIcon.uCallbackMessage, 123 124 (WPARAM)ptrayItem->notifyIcon.uID, (LPARAM)message)) { 124 ERR("PostMessage(SystrayWindow 0x%08x) failed -> removing SystrayItem %p\n", hWnd, ptrayItem); 125 SYSTRAY_Delete(&ptrayItem->notifyIcon); 126 } 125 ERR("PostMessage(SystrayWindow 0x%08x) failed -> removing SystrayItem %p\n", hWnd, ptrayItem); 126 SYSTRAY_Delete(&ptrayItem->notifyIcon); 127 127 } 128 break; 128 } 129 break; 129 130 } 130 131 ptrayItem = ptrayItem->nextTrayItem; … … 219 220 { 220 221 if(ptrayItem->notifyIcon.hIcon) 221 DestroyIcon(ptrayItem->notifyIcon.hIcon); 222 DestroyIcon(ptrayItem->notifyIcon.hIcon); 222 223 if(ptrayItem->hWndToolTip) 223 224 DestroyWindow(ptrayItem->hWndToolTip); … … 345 346 346 347 /************************************************************************* 347 * Shell_NotifyIconA [SHELL32.297][SHELL32.296]348 * Shell_NotifyIconA [SHELL32.297][SHELL32.296] 348 349 */ 349 350 BOOL WINAPI Shell_NotifyIconA(DWORD dwMessage, PNOTIFYICONDATAA pnid ) … … 367 368 368 369 /************************************************************************* 369 * Shell_NotifyIconW [SHELL32.298]370 * Shell_NotifyIconW [SHELL32.298] 370 371 */ 371 372 BOOL WINAPI Shell_NotifyIconW (DWORD dwMessage, PNOTIFYICONDATAW pnid ) 372 373 { 373 BOOL ret;374 375 PNOTIFYICONDATAA p = HeapAlloc(GetProcessHeap(),0,sizeof(NOTIFYICONDATAA));376 memcpy(p, pnid, sizeof(NOTIFYICONDATAA));374 BOOL ret; 375 376 PNOTIFYICONDATAA p = HeapAlloc(GetProcessHeap(),0,sizeof(NOTIFYICONDATAA)); 377 memcpy(p, pnid, sizeof(NOTIFYICONDATAA)); 377 378 WideCharToMultiByte( CP_ACP, 0, pnid->szTip, -1, p->szTip, sizeof(p->szTip), NULL, NULL ); 378 379 p->szTip[sizeof(p->szTip)-1] = 0; 379 380 380 ret = Shell_NotifyIconA(dwMessage, p );381 382 HeapFree(GetProcessHeap(),0,p);383 return ret;384 } 381 ret = Shell_NotifyIconA(dwMessage, p ); 382 383 HeapFree(GetProcessHeap(),0,p); 384 return ret; 385 }
Note:
See TracChangeset
for help on using the changeset viewer.
