Changeset 6650 for trunk/src/shell32
- Timestamp:
- Sep 5, 2001, 3:54:53 PM (24 years ago)
- Location:
- trunk/src/shell32
- Files:
-
- 20 edited
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 15 static LPBROWSEINFOA 16 static LPITEMIDLIST 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 27 28 29 30 31 32 33 34 35 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 38 39 40 IShellFolder *lpsfdesktop;41 42 43 44 45 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 50 hr = SHGetDesktopFolder(&lpsf); 50 51 #endif 51 52 52 53 54 55 56 57 58 59 60 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 { 65 66 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 { 71 72 73 74 75 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 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 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 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 lptvid->lpi= ILClone(pidlTemp);150 lptvid->lpifq= ILCombine(pidl, pidlTemp);151 152 153 154 155 156 157 158 159 160 161 162 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 168 169 170 171 172 173 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 184 185 186 187 switch (pnmtv->hdr.code) 188 189 190 191 192 SHFree(lptvid->lpi); 193 SHFree(lptvid->lpifq); 194 SHFree(lptvid); 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 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 236 LPARAM lParam ) 236 237 { TRACE("hwnd=%i msg=%i 0x%08x 0x%08lx\n", hWnd, msg, wParam, lParam ); 237 238 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 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 261 (lpBrowseInfo->lpfn)(hWnd, BFFM_SELCHANGED, 0/*FIXME*/, lpBrowseInfo->lParam); 261 262 #endif 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 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 320 321 322 "SHBRSFORFOLDER_MSGBOX", 323 324 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; 19 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 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 29 CPlApplet* first; /* linked list */ 30 HWND hWnd; 30 31 unsigned status; 31 CPlApplet* 32 CPlApplet* clkApplet; 32 33 unsigned clkSP; 33 34 } CPanel; 34 35 35 static CPlApplet*Control_UnloadApplet(CPlApplet* applet)36 { 37 unsigned 38 CPlApplet* 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* 52 { 53 CPlApplet* 54 unsigned 55 CPLINFO 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 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 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 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 77 } 78 79 applet = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, applet, 80 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 86 87 88 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 92 93 94 95 96 97 98 99 100 applet->info[i].hIcon = LoadIconA(applet->hModule, 101 102 LoadStringA(applet->hModule, info.idName, 103 104 LoadStringA(applet->hModule, info.idInfo, 105 106 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 122 { 123 CPanel* 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 132 #define YICON32133 #define YSTEP 134 135 static BOOL 136 137 { 138 unsigned 139 CPlApplet* 140 RECT 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 146 147 148 149 150 151 152 153 154 155 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 164 PAINTSTRUCT 165 RECT 166 unsigned 167 CPlApplet* 168 HGDIOBJ 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 176 177 178 179 180 181 182 183 184 185 DrawTextA(hdc, applet->info[i].szName, -1, &txtRect, 186 187 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 198 CPlApplet* 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 203 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 207 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 215 { 216 CPanel* 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 222 222 Control_WndProc_Create(hWnd, (CREATESTRUCTA*)lParam2); 223 return 0; 223 224 case WM_DESTROY: 224 225 225 while ((panel->first = Control_UnloadApplet(panel->first))); 226 break; 226 227 case WM_PAINT: 227 228 return Control_WndProc_Paint(panel, lParam1); 228 229 case WM_LBUTTONUP: 229 230 return Control_WndProc_LButton(panel, lParam2, TRUE); 230 231 case WM_LBUTTONDOWN: 231 232 return Control_WndProc_LButton(panel, lParam2, FALSE); 232 233 /* EPP case WM_COMMAND: */ 233 /* EPP 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 243 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 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 268 } 269 } 270 271 static voidControl_DoWindow(CPanel* panel, HWND hWnd, HINSTANCE hInst)272 { 273 HANDLE 274 WIN32_FIND_DATAA 275 char 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 281 282 283 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 * 292 * 293 * 294 * 295 * 292 * 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* 299 char* 300 char* 301 char 302 unsigned 303 char* 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 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 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 337 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 341 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 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 355 356 TRACE("(0x%08x, 0x%08lx, %s, 0x%08lx)\n", 357 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 370 * Control_FillCache_RunDLL [SHELL32.8] 370 371 * 371 372 */ … … 377 378 378 379 /************************************************************************* 379 * RunDLL_CallEntry16 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 58 return Shell32LibMain(hinstDLL, fdwReason, fImpLoad); 58 59 59 60 case DLL_PROCESS_DETACH: 60 61 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 94 if(dllHandle == 0) 95 return 0UL; 95 96 96 97 break; 97 98 case 1 : 98 99 if(dllHandle) { 99 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 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 * 3 * 3 * this class implements a pure IStream object 4 * and can be used for many purposes 4 5 * 5 * 6 * 7 * 8 * 9 * 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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 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 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 end_3: 102 end_2: 103 104 105 end_1: 106 107 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 116 117 118 119 120 121 122 123 124 125 126 127 128 { 129 IStream_AddRef((IStream*)*ppvObj); 130 131 132 133 134 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 143 144 145 146 147 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 156 157 158 159 160 161 if (!--(This->ref)) 162 163 164 165 166 167 168 169 170 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 176 177 178 179 180 181 182 183 184 185 186 if ( 0 >= dwBytesLeft )/* end of buffer */187 188 189 190 191 192 193 This->dwPos += dwBytesToRead;/* adjust pointer */194 195 196 197 198 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 203 204 205 206 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 211 212 213 214 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 219 220 221 222 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 227 228 229 230 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 235 236 237 238 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 243 244 245 246 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 251 252 253 254 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 259 260 261 262 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 267 268 269 270 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 275 276 277 278 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 * 3 * 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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 { 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 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 90 BOOL bIsPidlDebug; 90 91 91 92 LPITEMIDLIST pidltemp = pidl; 92 93 93 94 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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 } 144 145 /************************************************************************* 146 * ILGetDisplayName 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 151 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 { 161 162 163 164 165 166 167 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 180 181 182 183 184 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 { 218 219 220 221 222 223 224 225 len = pidl->mkid.cb; 226 227 228 229 memcpy(pidlNew,pidl,len+2);/* 2 -> mind a desktop pidl */230 231 232 233 234 235 236 237 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 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 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 297 298 299 300 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 308 309 310 311 312 313 314 315 316 317 318 } 319 320 /************************************************************************* 321 * SHILCreateFromPath 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 { 328 329 330 331 332 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 338 339 340 341 342 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 { 346 347 348 349 350 351 352 353 354 355 356 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 361 362 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 { 379 380 381 382 383 384 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 { 393 394 395 396 397 398 399 400 401 402 403 404 405 406 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 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 } 443 444 445 446 447 448 449 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 455 * 456 * 455 * 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 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 } 479 480 if ( pParent->mkid.cb || ! pChild->mkid.cb)/* child shorter or has equal length to parent */481 482 483 if ( ILGetNext(pChild)->mkid.cb && bImmediate)/* not immediate descent */484 485 486 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 496 * pidl1 shorter pidl2 497 * 498 * pidl2 shorter pidl1 499 * pidl2 equal pidl1 496 * 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 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 ret = pidltemp2; 537 538 539 540 541 542 543 544 545 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 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 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 601 602 603 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 611 * pild = CSIDL_DRIVES 611 * pild = CSIDL_DESKTOP ret = 0 612 * pild = CSIDL_DRIVES ret = 0 612 613 */ 613 614 LPITEMIDLIST WINAPI SHLogILFromFSIL(LPITEMIDLIST pidl) 614 615 { 615 616 617 618 619 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 638 639 640 641 { while (si->cb) 642 643 644 645 646 647 648 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 664 665 666 667 668 669 670 671 672 673 674 675 676 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 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 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 727 728 729 730 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 739 740 741 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 750 751 752 753 754 755 756 757 } 758 LPITEMIDLIST WINAPI ILCreateFromPathW (LPCWSTR path) 759 { 760 761 762 763 764 765 766 767 768 } 769 LPITEMIDLIST WINAPI ILCreateFromPathAW (LPCVOID path) 770 { 771 772 773 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 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 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 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 813 return SHSimpleIDListFromPathA (lpszTemp); 813 814 } 814 815 815 816 LPITEMIDLIST WINAPI SHSimpleIDListFromPathAW (LPCVOID lpszPath) 816 817 { 817 818 819 820 } 821 822 /************************************************************************* 823 * SHGetSpecialFolderLocation 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 836 837 838 { 839 CHARszPath[MAX_PATH];840 HRESULThr = E_INVALIDARG;841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 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 897 898 899 900 901 { 902 903 904 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 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 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 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 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 981 982 983 984 985 986 987 988 989 990 991 } 992 993 /************************************************************************* 994 * SHGetPathFromIDListA 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 * 1005 * 1006 * 1005 * 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 { 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 SHGetSpecialFolderPathA(0, pszPath, CSIDL_DESKTOPDIRECTORY, FALSE); 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 } 1043 /************************************************************************* 1044 * SHGetPathFromIDListW 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 { 1048 1049 1050 1051 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 1055 1056 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 1069 1070 1071 1072 1073 1074 1075 1076 1077 if (ppidlLast) 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 } 1105 1106 /************************************************************************* 1107 * SHGetPathFromIDListAW 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 1112 1113 1114 1115 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 * 1121 * 1122 * 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 { 1134 1134 { TRACE("()\n"); 1135 return _ILCreate(PT_DESKTOP, NULL, 0); 1135 1136 } 1136 1137 1137 1138 LPITEMIDLIST _ILCreateMyComputer() 1138 { 1139 1139 { TRACE("()\n"); 1140 return _ILCreate(PT_MYCOMP, &CLSID_MyComputer, sizeof(GUID)); 1140 1141 } 1141 1142 1142 1143 LPITEMIDLIST _ILCreateIExplore() 1143 { 1144 1144 { TRACE("()\n"); 1145 return _ILCreate(PT_MYCOMP, &CLSID_Internet, sizeof(GUID)); 1145 1146 } 1146 1147 1147 1148 LPITEMIDLIST _ILCreateControl() 1148 { 1149 1149 { TRACE("()\n"); 1150 return _ILCreate(PT_SPECIAL, &CLSID_ControlPanel, sizeof(GUID)); 1150 1151 } 1151 1152 1152 1153 LPITEMIDLIST _ILCreatePrinter() 1153 { 1154 1154 { TRACE("()\n"); 1155 return _ILCreate(PT_SPECIAL, &CLSID_Printers, sizeof(GUID)); 1155 1156 } 1156 1157 1157 1158 LPITEMIDLIST _ILCreateNetwork() 1158 { 1159 1159 { TRACE("()\n"); 1160 return _ILCreate(PT_MYCOMP, &CLSID_NetworkPlaces, sizeof(GUID)); 1160 1161 } 1161 1162 1162 1163 LPITEMIDLIST _ILCreateBitBucket() 1163 { 1164 1164 { TRACE("()\n"); 1165 return _ILCreate(PT_MYCOMP, &CLSID_RecycleBin, sizeof(GUID)); 1165 1166 } 1166 1167 1167 1168 LPITEMIDLIST _ILCreateDrive( LPCSTR lpszNew) 1168 { 1169 1170 1171 1172 1173 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 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 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 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 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 1278 1279 1280 LPSTRpszDest;1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 case PT_VALUE: 1298 1299 1300 1301 FIXME("can't create type: 0x%08x\n",type); 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 case PT_VALUE: 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 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 { 1359 1360 1361 1362 1363 1364 1365 1366 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 * 1372 * ### 2. section testing pidls ### 1372 1373 * 1373 1374 ************************************************************************** … … 1381 1382 */ 1382 1383 BOOL _ILIsDesktop(LPCITEMIDLIST pidl) 1383 { 1384 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 1390 1391 1392 1393 1394 1395 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 1401 1402 return (pidl && ( (lpPData && (PT_MYCOMP== lpPData->type || PT_SPECIAL== lpPData->type)) || 1403 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 { 1409 1410 1411 1412 1413 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 { 1418 1419 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 { 1424 1425 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 * 1430 * _ILIsPidlSimple 1430 1431 */ 1431 1432 BOOL _ILIsPidlSimple ( LPCITEMIDLIST pidl) 1432 1433 { 1433 1434 1435 if(! _ILIsDesktop(pidl))/* pidl=NULL or mkid.cb=0 */1436 1437 1438 1439 1440 1441 1442 1443 1444 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 * 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 1465 1466 1467 1468 1469 1470 1471 1472 1473 if (_ILIsDesktop(pidl)) 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 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 * 1515 * ### 4. getting pointers to parts of pidls ### 1515 1516 * 1516 1517 ************************************************************************** … … 1519 1520 LPPIDLDATA _ILGetDataPointer(LPITEMIDLIST pidl) 1520 1521 { 1521 1522 1523 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 {/* 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 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 {/* 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 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 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 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 1651 1652 1653 1654 1655 1656 1657 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 * 1675 * 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 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 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 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 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 * 1733 * 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 1740 1741 1740 if(_ILIsValue(pidl)) 1741 { 1742 char sTemp[64]; 1742 1743 if(uOutSize > 0) 1743 1744 { 1744 1745 pOut[0] = 0; 1745 1746 } 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 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 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 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 1833 1834 1835 1836 1837 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 1849 1850 1851 1852 1853 1854 1855 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 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 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 60 #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 92 93 94 95 96 97 98 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 104 105 106 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 112 113 114 115 116 117 118 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 124 125 124 WORD idReserved; 125 WORD idType; 126 WORD idCount; 126 127 } ICONDIR; 127 128 … … 130 131 131 132 132 static ICOM_VTABLE(IShellLinkA) 133 static ICOM_VTABLE(IShellLinkW) 134 static ICOM_VTABLE(IPersistFile) 135 static ICOM_VTABLE(IPersistStream) 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 142 DWORDref;143 144 ICOM_VTABLE(IShellLinkW)*lpvtblw;145 ICOM_VTABLE(IPersistFile)*lpvtblPersistFile;146 ICOM_VTABLE(IPersistStream)*lpvtblPersistStream;147 148 149 IStream*lpFileStream;150 151 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 181 182 183 { 184 185 186 187 188 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 197 198 199 200 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 208 209 210 211 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 217 218 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 223 224 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 229 230 231 LPSTRsFile = HEAP_strdupWtoA ( GetProcessHeap(), 0, pszFileName);232 HRESULThRet = E_FAIL;233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 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 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 832 833 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 838 839 840 } 841 842 static ICOM_VTABLE(IPersistFile) pfvt = 843 { 844 845 846 847 848 849 850 851 852 853 838 _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 861 862 863 { 864 865 866 867 868 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 876 { 877 878 879 880 881 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 889 { 890 891 892 893 894 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 903 904 { 905 906 907 908 909 910 911 912 /* 913 914 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 922 { 923 924 925 926 927 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 935 936 { 937 938 ULONGdwBytesRead;939 DWORDret = E_FAIL;940 charsTemp[MAX_PATH];941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 { 965 966 967 968 969 970 971 972 973 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 976 977 978 979 980 981 982 #endif 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 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 1008 1009 1010 { 1011 1012 1013 1014 1015 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 1023 1024 { 1025 1026 1027 1028 1029 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 1035 1036 1037 1038 1039 1040 1041 1042 1035 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 * 1047 */ 1048 IShellLinkA * IShellLink_Constructor(BOOL bUnicode) 1049 { 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 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 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 } 1079 1080 1081 1082 } 1083 1084 1085 1086 1087 1088 1089 1090 } 1091 1092 1093 1094 1095 1096 1097 1098 1099 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 1107 1108 1109 1110 1111 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 * 1115 * IShellLinkA_Release 1115 1116 */ 1116 1117 static ULONG WINAPI IShellLinkA_fnRelease(IShellLinkA * iface) 1117 1118 { 1118 1119 1120 1121 1122 1123 if (!--(This->ref)) 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 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 1158 1159 1160 1161 1162 1163 1164 1165 1166 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 1171 1172 1173 1174 1175 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 1180 1181 1182 1183 1184 1185 1186 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 1191 1192 1193 1194 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 1199 1200 1201 1202 1203 1204 1205 1206 1207 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 1212 1213 1214 1215 1216 1217 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 1222 1223 1224 1225 1226 1227 1228 1229 1230 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 1235 1236 1237 1238 1239 1240 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 1245 1246 1247 1248 1249 1250 1251 1252 1253 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 1258 1259 1260 1261 1262 1263 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 1268 1269 1270 1271 1272 1273 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 1278 1279 1280 1281 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 1286 1287 1288 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 1293 1294 1295 1296 1297 1298 1299 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 1304 1305 1306 1307 1308 1309 1310 return E_OUTOFMEMORY; 1311 1312 1313 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 1318 1319 1320 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 1325 1326 1327 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 1332 1333 1334 1335 1336 1337 1338 1339 1340 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 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1348 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 1381 1382 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 1391 1392 1393 1394 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 1403 1404 1405 1406 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 1412 1413 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 1416 return NOERROR; 1416 1417 } 1417 1418 1418 1419 static HRESULT WINAPI IShellLinkW_fnGetIDList(IShellLinkW * iface, LPITEMIDLIST * ppidl) 1419 1420 { 1420 1421 1422 1423 1424 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 1430 1431 1432 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 1438 1439 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 1442 return NOERROR; 1442 1443 } 1443 1444 1444 1445 static HRESULT WINAPI IShellLinkW_fnSetDescription(IShellLinkW * iface, LPCWSTR pszName) 1445 1446 { 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 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 1461 1462 1463 1464 1465 1466 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 1472 1473 1474 1475 1476 1477 1478 1479 1480 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 1486 1487 1488 1489 1490 1491 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 1497 1498 1499 1500 1501 1502 1503 1504 1505 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 1511 1512 1513 1514 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 1520 1521 1522 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 1528 1529 1530 1531 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 1537 1538 1539 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 1545 1546 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 1550 1551 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 1557 1558 1559 1560 1561 1562 1563 return E_OUTOFMEMORY; 1564 1565 1566 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 1572 1573 1574 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 1580 1581 1582 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 1588 1589 1590 1591 1592 1593 1594 return E_OUTOFMEMORY; 1595 1596 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 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1604 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 * 3 * 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 27 27 IShellFolder * psf, 28 LPITEMIDLIST pidl); 28 29 extern HRESULT IFSFolder_Constructor( 29 30 31 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 41 42 43 44 45 { 46 DWORDhres;47 IIDiid;48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 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 74 75 76 77 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 86 87 88 89 90 91 if(IsEqualCLSID(rclsid, &CLSID_ShellDesktop)|| 92 93 94 95 96 if(lpclf) 97 98 99 100 101 102 103 104 105 106 107 108 109 } 110 111 /************************************************************************* 112 * SHCLSIDFromString 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 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 133 134 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 150 151 } 152 153 /************************************************************************* 154 * SHGetDesktopFolder 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 162 163 164 165 166 if (!pdesktopfolder) 167 168 169 if(lpclf) 170 171 172 173 } 174 175 176 if (pdesktopfolder) 177 178 179 180 181 182 183 184 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 197 CLSID *rclsid; 197 198 } IClassFactoryImpl; 198 199 … … 205 206 LPCLASSFACTORY IClassFactory_Constructor(REFCLSID rclsid) 206 207 { 207 208 209 210 211 212 213 214 215 216 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 225 226 227 228 229 230 { *ppvObj = This; 231 232 233 234 } 235 236 237 { IUnknown_AddRef((LPUNKNOWN)*ppvObj); 238 239 240 241 242 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 250 251 252 253 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 261 262 263 264 if (!InterlockedDecrement(&This->ref)) 265 266 267 268 269 270 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 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 } 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 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 323 324 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 358 LPFNCREATEINSTANCE 359 const IID * 360 ULONG * 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 372 373 374 375 376 377 378 379 380 381 382 383 384 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 393 394 395 396 397 398 399 { *ppvObj = This; 400 401 402 403 } 404 405 406 { IUnknown_AddRef((LPUNKNOWN)*ppvObj); 407 408 409 410 411 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 419 420 421 422 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 430 431 432 433 434 if (!InterlockedDecrement(&This->ref)) 435 { 436 437 438 439 440 441 442 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 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 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 475 476 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 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 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 503 504 505 506 507 508 509 510 511 512 513 } 514 515 /************************************************************************* 516 * DragAcceptFiles 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 521 522 523 524 525 526 527 528 529 } 530 531 /************************************************************************* 532 * DragFinish 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 537 538 } 539 540 /************************************************************************* 541 * DragQueryPoint 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 547 548 549 550 547 BOOL bRet; 548 549 TRACE("\n"); 550 551 lpDropFileStruct = (DROPFILES *) GlobalLock(hDrop); 551 552 552 553 *p = lpDropFileStruct->pt; 553 554 555 556 557 } 558 559 /************************************************************************* 560 * DragQueryFileA 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 564 565 566 567 { 568 569 570 571 572 TRACE("(%08x, %x, %p, %u)\n",hDrop,lFile,lpszFile,lLength);573 574 575 576 577 578 579 580 581 if (!*lpDrop) 582 583 i = (lFile == 0xFFFFFFFF) ? i : 0; 584 585 586 587 588 589 590 591 592 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 595 596 } 597 598 /************************************************************************* 599 * DragQueryFileW 595 GlobalUnlock(hDrop); 596 return i; 597 } 598 599 /************************************************************************* 600 * DragQueryFileW [shell32.133] 600 601 */ 601 602 UINT WINAPI DragQueryFileW( 602 603 604 605 606 { 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 if (!*lpwDrop) 622 623 i = (lFile == 0xFFFFFFFF) ? i : 0; 624 625 626 627 628 629 630 631 632 633 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 636 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 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 33 34 35 DWORD len) 36 { 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 } 57 58 /************************************************************************* 59 * ParseFieldW 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 68 69 70 } 71 72 /************************************************************************* 73 * ParseFieldAW 74 */ 75 DWORD WINAPI ParseFieldAW(LPCVOID src, DWORD nField, LPVOID dst, DWORD len) 76 { 77 78 79 80 } 81 82 /************************************************************************* 83 * GetFileNameFromBrowse 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 88 89 90 91 92 93 94 { 95 96 97 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 107 * SHGetSetSettings [SHELL32.68] 107 108 */ 108 109 VOID WINAPI SHGetSetSettings(DWORD x, DWORD y, DWORD z) 109 110 { 110 111 } 112 113 /************************************************************************* 114 * SHGetSettings 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 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 { if (SSF_SHOWALLOBJECTS & dwMask)lpsfs->fShowAllObjects = 0;154 if (SSF_SHOWSYSFILES & dwMask)lpsfs->fShowSysFiles = 0;155 156 157 { if (SSF_SHOWALLOBJECTS & dwMask)lpsfs->fShowAllObjects = 1;158 if (SSF_SHOWSYSFILES & dwMask)lpsfs->fShowSysFiles = 0;159 160 161 { if (SSF_SHOWALLOBJECTS & dwMask)lpsfs->fShowAllObjects = 0;162 if (SSF_SHOWSYSFILES & dwMask)lpsfs->fShowSysFiles = 1;163 164 165 166 167 168 } 169 170 /************************************************************************* 171 * SHShellFolderView_Message 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 188 189 { 190 191 192 } 193 194 /************************************************************************* 195 * RegisterShellHook 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 206 207 { 208 209 210 } 211 /************************************************************************* 212 * ShellMessageBoxW 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 217 * idTitle 217 * 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 224 225 226 227 228 229 { 230 WCHARszText[100],szTitle[100];231 232 233 intret;234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING, 252 253 254 255 256 257 258 259 } 260 261 /************************************************************************* 262 * ShellMessageBoxA 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 266 267 268 269 270 271 { 272 charszText[100],szTitle[100];273 274 275 intret;276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING, 294 295 296 297 298 299 300 301 } 302 303 /************************************************************************* 304 * SHFree 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 315 316 317 318 319 320 321 322 323 324 325 326 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 329 TRACE("%p\n",x); 329 330 #endif 330 331 } 332 333 /************************************************************************* 334 * SHAlloc 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 341 LPVOID WINAPI SHAlloc(DWORD len) 342 { 343 LPBYTE ret; 343 344 344 345 #if MEM_DEBUG 345 346 ret = (LPVOID) HeapAlloc(GetProcessHeap(),0,len+6); 346 347 #else 347 348 ret = (LPVOID) HeapAlloc(GetProcessHeap(),0,len); 348 349 #endif 349 350 350 351 #if MEM_DEBUG 351 352 353 354 355 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 358 359 } 360 361 /************************************************************************* 362 * SHRegisterDragDrop 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 369 370 { 371 372 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 378 * SHRevokeDragDrop [SHELL32.87] 378 379 * 379 380 * NOTES … … 387 388 388 389 /************************************************************************* 389 * SHDoDragDrop 390 * SHDoDragDrop [SHELL32.88] 390 391 * 391 392 * NOTES … … 393 394 */ 394 395 HRESULT WINAPI SHDoDragDrop( 395 396 397 398 399 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 408 * 408 * ArrangeWindows [SHELL32.184] 409 * 409 410 */ 410 411 WORD WINAPI ArrangeWindows( 411 412 413 414 415 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 419 return 0; 420 } 421 422 /************************************************************************* 423 * SignalFileOpen 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 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 451 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 457 * SHCreateShellFolderViewEx [SHELL32.174] 457 458 * 458 459 * NOTES … … 460 461 */ 461 462 HRESULT WINAPI SHCreateShellFolderViewEx( 462 463 464 { 465 466 467 468 TRACE("sf=%p pidl=%p cb=%p mode=0x%08x parm=0x%08lx\n", 469 470 471 472 473 474 475 476 477 478 479 480 481 482 } 483 /************************************************************************* 484 * SHWinHelp 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 { 489 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 { 497 498 } 499 /************************************************************************* 500 * ShellExecuteEx 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 { 505 506 507 } 508 /************************************************************************* 509 * ShellExecuteExA 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 * 513 * 514 * 515 * 516 * 517 * 518 * 519 * 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 { 523 524 525 526 527 528 529 530 sei->lpParameters, sei->lpDirectory, sei->nShow, 531 532 533 534 535 536 537 538 539 540 541 542 543 SEE_MASK_DOENVSUBST | SEE_MASK_FLAG_NO_UI | SEE_MASK_UNICODE | 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 NULL, NULL, FALSE, 0, 596 597 598 599 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 605 606 607 608 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 614 } 615 /************************************************************************* 616 * ShellExecuteExW 614 return TRUE; 615 } 616 /************************************************************************* 617 * ShellExecuteExW [SHELL32.293] 617 618 * 618 619 */ 619 620 BOOL WINAPI ShellExecuteExW (LPSHELLEXECUTEINFOW sei) 620 { 621 622 623 624 625 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 629 seiA.lpVerb = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpVerb); 629 630 630 631 if (sei->lpFile) 631 632 seiA.lpFile = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpFile); 632 633 633 634 if (sei->lpParameters) 634 635 636 637 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 641 642 643 644 645 646 if (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 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 658 * SHSetInstanceExplorer [SHELL32.176] 658 659 * 659 660 * NOTES … … 661 662 */ 662 663 HRESULT WINAPI SHSetInstanceExplorer (LPUNKNOWN lpUnknown) 663 { 664 665 666 } 667 /************************************************************************* 668 * SHGetInstanceExplorer 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 { 675 676 677 678 679 680 681 682 683 } 684 /************************************************************************* 685 * SHFreeUnusedLibraries 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 693 } 694 /************************************************************************* 695 * DAD_SetDragImage 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 702 703 { 704 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 709 * DAD_ShowDragImage [SHELL32.137] 709 710 * 710 711 * NOTES … … 713 714 BOOL WINAPI DAD_ShowDragImage(BOOL bShow) 714 715 { 715 716 717 } 718 /************************************************************************* 719 * ReadCabinetState 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 { 724 725 } 726 /************************************************************************* 727 * WriteCabinetState 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 { 732 733 } 734 /************************************************************************* 735 * FileIconInit 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 { 740 741 } 742 /************************************************************************* 743 * IsUserAdmin 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 { 748 749 } 750 751 /************************************************************************* 752 * SHAllocShared 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 { 765 766 767 768 769 770 771 772 773 774 775 776 777 778 GlobalUnlock(hmem); 779 780 } 781 /************************************************************************* 782 * SHLockShared 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 { 792 793 } 794 /************************************************************************* 795 * SHUnlockShared 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 803 return GlobalUnlock((HANDLE)pv); 804 } 805 /************************************************************************* 806 * SHFreeShared 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 814 815 { 816 817 818 } 819 820 /************************************************************************* 821 * SetAppStartingCursor 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 { 825 826 } 827 /************************************************************************* 828 * SHLoadOLE 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 { 833 834 } 835 /************************************************************************* 836 * DriveType 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 { 841 842 } 843 /************************************************************************* 844 * SHAbortInvokeCommand 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 { 849 850 } 851 /************************************************************************* 852 * SHOutOfMemoryMessageBox 849 { FIXME("stub\n"); 850 return 1; 851 } 852 /************************************************************************* 853 * SHOutOfMemoryMessageBox [SHELL32.126] 853 854 * 854 855 */ 855 856 int WINAPI SHOutOfMemoryMessageBox( 856 857 858 859 { 860 861 862 } 863 /************************************************************************* 864 * SHFlushClipboard 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 { 869 870 } 871 872 /************************************************************************* 873 * SHWaitForFileToOpen 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 879 880 { 881 882 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 { 895 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 { 906 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 915 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 925 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 935 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 945 946 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 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 968 969 } 970 971 /************************************************************************* 972 * SHAddFromPropSheetExtArray 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 977 978 } 979 980 /************************************************************************* 981 * SHCreatePropSheetExtArray 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 986 987 } 988 989 /************************************************************************* 990 * SHReplaceFromPropSheetExtArray 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 995 996 } 997 998 /************************************************************************* 999 * SHDestroyPropSheetExtArray 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 1004 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 24 ########## Combining and Constructing paths ########## 24 25 */ 25 26 26 27 /************************************************************************* 27 * PathAppendAW 28 * PathAppendAW [SHELL32.36] 28 29 */ 29 30 BOOL WINAPI PathAppendAW( 30 31 32 { 33 34 35 36 } 37 38 /************************************************************************* 39 * PathCombineAW 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 43 44 LPCVOID lpszFile) 45 { 46 47 48 49 } 50 51 /************************************************************************* 52 * PathAddBackslashAW 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 57 58 59 } 60 61 /************************************************************************* 62 * PathBuildRootAW 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 67 68 67 if(SHELL_OsIsUnicode()) 68 return PathBuildRootW(lpszPath, drive); 69 return PathBuildRootA(lpszPath, drive); 69 70 } 70 71 71 72 /* 72 73 Extracting Component Parts 73 74 */ 74 75 75 76 /************************************************************************* 76 * PathFindFileNameAW 77 * PathFindFileNameAW [SHELL32.34] 77 78 */ 78 79 LPVOID WINAPI PathFindFileNameAW(LPCVOID lpszPath) 79 80 { 80 81 82 83 } 84 85 /************************************************************************* 86 * PathFindExtensionAW 87 */ 88 LPVOID WINAPI PathFindExtensionAW(LPCVOID lpszPath) 89 { 90 91 92 93 94 } 95 96 /************************************************************************* 97 * PathGetExtensionA 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 106 107 108 109 } 110 111 /************************************************************************* 112 * PathGetExtensionW 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 117 118 119 120 } 121 122 /************************************************************************* 123 * PathGetExtensionAW 124 */ 125 LPVOID WINAPI PathGetExtensionAW(LPCVOID lpszPath) 126 { 127 128 129 130 } 131 132 /************************************************************************* 133 * PathGetArgsAW 134 */ 135 LPVOID WINAPI PathGetArgsAW(LPVOID lpszPath) 136 { 137 138 139 140 } 141 142 /************************************************************************* 143 * PathGetDriveNumber 144 */ 145 int WINAPI PathGetDriveNumberAW(LPVOID lpszPath) 146 { 147 148 149 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 158 159 160 } 161 162 /************************************************************************* 163 * PathStripPathAW 164 */ 165 void WINAPI PathStripPathAW(LPVOID lpszPath) 166 { 167 168 169 170 } 171 172 /************************************************************************* 173 * PathStripToRootAW 174 */ 175 BOOL WINAPI PathStripToRootAW(LPVOID lpszPath) 176 { 177 178 179 180 } 181 182 /************************************************************************* 183 * PathRemoveArgsAW 184 */ 185 void WINAPI PathRemoveArgsAW(LPVOID lpszPath) 186 { 187 188 189 190 } 191 192 /************************************************************************* 193 * PathRemoveExtensionAW 194 */ 195 void WINAPI PathRemoveExtensionAW(LPVOID lpszPath) 196 { 197 198 199 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 205 Path Manipulations 205 206 */ 206 207 … … 210 211 LPSTR WINAPI PathGetShortPathA(LPSTR lpszPath) 211 212 { 212 213 213 FIXME("%s stub\n", lpszPath); 214 return NULL; 214 215 } 215 216 … … 219 220 LPWSTR WINAPI PathGetShortPathW(LPWSTR lpszPath) 220 221 { 221 222 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 231 232 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 241 242 241 if(SHELL_OsIsUnicode()) 242 PathRemoveBlanksW(str); 243 PathRemoveBlanksA(str); 243 244 } 244 245 … … 248 249 LPVOID WINAPI PathQuoteSpacesAW (LPVOID lpszPath) 249 250 { 250 251 252 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 261 262 263 264 } 265 266 /************************************************************************* 267 * PathParseIconLocationAW 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 272 273 272 if(SHELL_OsIsUnicode()) 273 return PathParseIconLocationW(lpszPath); 274 return PathParseIconLocationA(lpszPath); 274 275 } 275 276 276 277 /* 277 278 ########## Path Testing ########## 278 279 */ 279 280 /************************************************************************* 280 * PathIsUNCAW 281 * PathIsUNCAW [SHELL32.39] 281 282 */ 282 283 BOOL WINAPI PathIsUNCAW (LPCVOID lpszPath) 283 284 { 284 285 286 return PathIsUNCA( lpszPath ); 287 } 288 289 /************************************************************************* 290 * PathIsRelativeAW 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 295 296 return PathIsRelativeA( lpszPath ); 297 } 298 299 /************************************************************************* 300 * PathIsRootAW 301 */ 302 BOOL WINAPI PathIsRootAW(LPCVOID lpszPath) 303 { 304 305 306 307 } 308 309 /************************************************************************* 310 * PathIsExeA 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 315 316 317 318 319 320 321 322 323 324 } 325 326 /************************************************************************* 327 * PathIsExeW 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 332 333 334 335 336 337 338 339 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 342 if (!lstrcmpiW(lpszExtension,lpszExtensions[i])) return TRUE; 342 343 #else 343 344 #endif 345 346 } 347 348 /************************************************************************* 349 * PathIsExeAW 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 354 355 356 } 357 358 /************************************************************************* 359 * PathIsDirectoryAW 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 364 365 366 } 367 368 /************************************************************************* 369 * PathFileExistsAW 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 374 375 376 } 377 378 /************************************************************************* 379 * PathMatchSpecAW 380 */ 381 BOOL WINAPI PathMatchSpecAW(LPVOID name, LPVOID mask) 382 { 383 384 385 386 } 387 388 /************************************************************************* 389 * PathIsSameRootAW 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 394 395 396 } 397 398 /************************************************************************* 399 * IsLFNDriveA 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 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 410 return FALSE; 410 411 return fnlen>12; 411 412 } 412 413 413 414 /* 414 415 ########## Creating Something Unique ########## 415 416 */ 416 417 /************************************************************************* 417 * PathMakeUniqueNameA 418 * PathMakeUniqueNameA [internal] 418 419 */ 419 420 BOOL WINAPI PathMakeUniqueNameA( 420 421 DWORD dwBuffSize, 422 423 424 425 { 426 427 428 429 430 } 431 432 /************************************************************************* 433 * PathMakeUniqueNameW 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 437 DWORD dwBuffSize, 438 439 440 441 { 442 443 444 445 446 } 447 448 /************************************************************************* 449 * PathMakeUniqueNameAW 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 453 DWORD dwBuffSize, 454 455 456 457 { 458 459 460 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 471 472 473 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 484 485 486 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 495 496 497 498 { 499 500 501 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 508 */ 509 510 /************************************************************************* 511 * PathFindOnPathAW 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 516 517 518 } 519 520 /************************************************************************* 521 * PathCleanupSpecAW 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 531 */ 532 BOOL WINAPI PathQualifyA(LPCSTR pszPath) 533 { 534 535 536 } 537 538 /************************************************************************* 539 * PathQualifyW 540 */ 541 BOOL WINAPI PathQualifyW(LPCWSTR pszPath) 542 { 543 544 545 } 546 547 /************************************************************************* 548 * PathQualifyAW 549 */ 550 BOOL WINAPI PathQualifyAW(LPCVOID pszPath) 551 { 552 553 554 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 562 LPCSTR *alpszPaths, 563 564 { 565 566 567 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 575 LPCWSTR *alpszPaths, 576 577 { 578 579 580 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 588 LPCVOID *alpszPaths, 589 590 { 591 592 593 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 601 602 603 604 { 605 606 607 608 609 } 610 611 /************************************************************************* 612 * 601 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 616 617 618 619 { 620 621 622 623 624 } 625 626 /************************************************************************* 627 * 616 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 631 632 633 634 { 635 636 637 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 642 ########## special ########## 642 643 */ 643 644 … … 645 646 * PathSetDlgItemPathAW 646 647 */ 647 BOOL WINAPI PathSetDlgItemPathAW(HWND hDlg, int id, LPCVOID pszPath) 648 { 649 650 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 678 #define CSIDL_MYFLAG_SETUP 679 #define CSIDL_MYFLAG_CURRVER 680 #define CSIDL_MYFLAG_RELATIVE 678 #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 688 689 688 9, HKCU, 689 "Desktop", 690 "Desktop" 690 691 }, 691 692 { /* CSIDL_INTERNET (??) */ 692 693 694 693 0, 1, /* FIXME */ 694 NULL, 695 NULL, 695 696 }, 696 697 { /* CSIDL_PROGRAMS */ 697 698 699 698 9, HKCU, 699 "Programs", 700 "Start Menu\\Programs" 700 701 }, 701 702 { /* CSIDL_CONTROLS (.CPL files) */ 702 703 704 703 10, HKLM, 704 "SysDir", 705 "SYSTEM" 705 706 }, 706 707 { /* CSIDL_PRINTERS */ 707 708 709 708 10, HKLM, 709 "SysDir", 710 "SYSTEM" 710 711 }, 711 712 { /* CSIDL_PERSONAL */ 712 713 714 713 1, HKCU, 714 "Personal", 715 "My Documents" 715 716 }, 716 717 { /* CSIDL_FAVORITES */ 717 718 719 718 9, HKCU, 719 "Favorites", 720 "Favorites" 720 721 }, 721 722 { /* CSIDL_STARTUP */ 722 723 724 723 9, HKCU, 724 "StartUp", 725 "Start Menu\\Programs\\StartUp" 725 726 }, 726 727 { /* CSIDL_RECENT */ 727 728 729 728 9, HKCU, 729 "Recent", 730 "Recent" 730 731 }, 731 732 { /* CSIDL_SENDTO */ 732 733 734 733 9, HKCU, 734 "SendTo", 735 "SendTo" 735 736 }, 736 737 { /* CSIDL_BITBUCKET (is this c:\recycled ?) */ 737 738 739 738 0, 1, /* FIXME */ 739 NULL, 740 "recycled" 740 741 }, 741 742 { /* CSIDL_STARTMENU */ 742 743 744 743 9, HKCU, 744 "Start Menu", 745 "Start Menu" 745 746 }, 746 747 { /* not known */ 747 748 749 748 0, 0, 749 NULL, 750 NULL, 750 751 }, 751 752 { /* not known */ 752 753 754 753 0, 0, 754 NULL, 755 NULL, 755 756 }, 756 757 { /* not known */ 757 758 759 758 0, 0, 759 NULL, 760 NULL, 760 761 }, 761 762 { /* not known */ 762 763 764 763 0, 0, 764 NULL, 765 NULL, 765 766 }, 766 767 { /* CSIDL_DESKTOPDIRECTORY */ 767 768 769 768 9, HKCU, 769 "Desktop", 770 "Desktop" 770 771 }, 771 772 { /* CSIDL_DRIVES */ 772 773 774 773 0, 1, /* FIXME */ 774 NULL, 775 "My Computer" 775 776 }, 776 777 { /* CSIDL_NETWORK */ 777 778 779 778 0, 1, /* FIXME */ 779 NULL, 780 "Network Neighborhood" 780 781 }, 781 782 { /* CSIDL_NETHOOD */ 782 783 784 783 9, HKCU, 784 "NetHood", 785 "NetHood" 785 786 }, 786 787 { /* CSIDL_FONTS */ 787 788 789 788 9, HKCU, 789 "Fonts", 790 "Fonts" 790 791 }, 791 792 { /* CSIDL_TEMPLATES */ 792 793 794 793 9, HKCU, 794 "Templates", 795 "ShellNew" 795 796 }, 796 797 { /* CSIDL_COMMON_STARTMENU */ 797 798 799 798 9, HKLM, 799 "Common Start Menu", 800 "Start Menu" 800 801 }, 801 802 { /* CSIDL_COMMON_PROGRAMS */ 802 803 804 803 9, HKLM, 804 "Common Programs", 805 "" 805 806 }, 806 807 { /* CSIDL_COMMON_STARTUP */ 807 808 809 808 9, HKLM, 809 "Common StartUp", 810 "All Users\\Start Menu\\Programs\\StartUp" 810 811 }, 811 812 { /* CSIDL_COMMON_DESKTOPDIRECTORY */ 812 813 814 813 9, HKLM, 814 "Common Desktop", 815 "Desktop" 815 816 }, 816 817 { /* CSIDL_APPDATA */ 817 818 819 818 9, HKCU, 819 "AppData", 820 "Application Data" 820 821 }, 821 822 { /* CSIDL_PRINTHOOD */ 822 823 824 823 9, HKCU, 824 "PrintHood", 825 "PrintHood" 825 826 }, 826 827 { /* not known */ 827 828 829 828 0, 0, 829 NULL, 830 NULL, 830 831 }, 831 832 { /* CSIDL_ALTSTARTUP */ 832 833 834 833 0, 1, /* FIXME */ 834 NULL, 835 NULL 835 836 }, 836 837 { /* CSIDL_COMMON_ALTSTARTUP */ 837 838 839 838 0, 1, /* FIXME */ 839 NULL, 840 NULL 840 841 }, 841 842 { /* CSIDL_COMMON_FAVORITES */ 842 843 844 843 9, HKCU, 844 "Favorites", 845 "Favorites" 845 846 }, 846 847 { /* CSIDL_INTERNET_CACHE */ 847 848 849 848 9, HKCU, 849 "Cache", 850 "Temporary Internet Files" 850 851 }, 851 852 { /* CSIDL_COOKIES */ 852 853 854 853 9, HKCU, 854 "Cookies", 855 "Cookies" 855 856 }, 856 857 { /* CSIDL_HISTORY */ 857 858 859 858 9, HKCU, 859 "History", 860 "History" 860 861 }, 861 862 { /* CSIDL_COMMON_APPDATA */ 862 863 864 863 9, HKLM, 864 "Common AppData", 865 "All Users\\Application Data" 865 866 }, 866 867 { /* CSIDL_WINDOWS */ 867 868 869 868 2, HKLM, 869 "WinDir", 870 "Windows" 870 871 }, 871 872 { /* CSIDL_SYSTEM */ 872 873 874 873 10, HKLM, 874 "SysDir", 875 "SYSTEM" 875 876 }, 876 877 { /* CSIDL_PROGRAM_FILES */ 877 878 879 878 4, HKLM, 879 "ProgramFilesDir", 880 "Program Files" 880 881 }, 881 882 { /* CSIDL_MYPICTURES */ 882 883 884 883 1, HKCU, 884 "My Pictures", 885 "My Documents\\My Pictures" 885 886 }, 886 887 { /* CSIDL_PROFILE */ 887 888 889 888 10, HKLM, 889 "WinDir", /* correct ? */ 890 "" 890 891 }, 891 892 { /* CSIDL_SYSTEMX86 */ 892 893 894 893 10, HKLM, 894 "SysDir", 895 "SYSTEM" 895 896 }, 896 897 { /* CSIDL_PROGRAM_FILESX86 */ 897 898 899 898 4, HKLM, 899 "ProgramFilesDir", 900 "Program Files" 900 901 }, 901 902 { /* CSIDL_PROGRAM_FILES_COMMON */ 902 903 "CommonFilesDir", 904 903 4, HKLM, 904 "CommonFilesDir", 905 "Program Files\\Common Files" /* ? */ 905 906 }, 906 907 { /* CSIDL_PROGRAM_FILES_COMMONX86 */ 907 908 909 908 4, HKLM, 909 "CommonFilesDir", 910 "Program Files\\Common Files" /* ? */ 910 911 }, 911 912 { /* CSIDL_COMMON_TEMPLATES */ 912 913 914 913 0, 1, /* FIXME */ 914 NULL, 915 NULL 915 916 }, 916 917 { /* CSIDL_COMMON_DOCUMENTS */ 917 918 919 918 0, 1, /* FIXME */ 919 NULL, 920 NULL 920 921 }, 921 922 { /* CSIDL_COMMON_ADMINTOOLS */ 922 923 924 923 0, 1, /* FIXME */ 924 NULL, 925 NULL 925 926 }, 926 927 { /* CSIDL_ADMINTOOLS */ 927 928 929 928 9, HKCU, 929 "Administrative Tools", 930 "Start Menu\\Programs\\Administrative Tools" 930 931 }, 931 932 { /* CSIDL_CONNECTIONS */ 932 933 934 933 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 1083 1084 1085 1086 { 1087 1088 1089 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 1096 1097 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 1105 1106 1107 1108 1109 { 1110 1111 1112 1113 } 1114 1115 /************************************************************************* 1116 * SHGetFolderPathA 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 1120 1121 HANDLE hToken,/* [in] FIXME: get paths for specific user */1122 DWORD dwFlags,/* [in] FIXME: SHGFP_TYPE_CURRENT|SHGFP_TYPE_DEFAULT */1123 1124 { 1125 1126 1127 1128 1129 1130 } 1131 1132 /************************************************************************* 1133 * SHGetFolderPathW 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 1137 1138 1139 1140 1141 { 1142 1143 1144 1145 1146 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 3 Shell Registry Access 3 4 */ 4 5 #include <string.h> … … 17 18 18 19 /************************************************************************* 19 * SHRegOpenKeyA 20 * SHRegOpenKeyA [SHELL32.506] 20 21 * 21 22 */ 22 23 HRESULT WINAPI SHRegOpenKeyA( 23 24 25 26 { 27 28 29 } 30 31 /************************************************************************* 32 * SHRegOpenKeyW 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 37 38 39 { 40 41 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 50 51 52 53 54 55 { 56 57 58 } 59 60 /************************************************************************* 61 * SHRegQueryValueW 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 66 67 68 69 { 70 71 72 73 } 74 75 /************************************************************************* 76 * SHRegQueryValueExW 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 84 85 86 87 88 89 { 90 91 92 93 94 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 102 103 { 104 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 109 return 0; 109 110 #endif 110 111 } … … 114 115 */ 115 116 HRESULT WINAPI SHRegDeleteKeyW( 116 117 118 { 119 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 124 return 0; 124 125 #endif 125 126 } 126 127 127 128 /************************************************************************* 128 * SHRegCloseKey 129 * SHRegCloseKey [NT4.0:SHELL32.505] 129 130 * 130 131 */ 131 132 HRESULT WINAPI SHRegCloseKey (HKEY hkey) 132 133 { 133 134 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 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 43 44 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 56 56 TRACE("(%p, %p %s)\n", 57 lpWideCharStr, lpMultiByteString, debugstr_a(lpMultiByteString)); 57 58 58 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 64 64 TRACE("(%p, %p %s)\n", 65 lpWideCharStr, lpWString, debugstr_w(lpWString)); 65 66 66 67 67 strcpyW (lpWideCharStr, lpWString ); 68 return strlenW(lpWideCharStr); 68 69 } 69 70 70 71 BOOL WINAPI StrToOleStrAW (LPWSTR lpWideCharStr, LPCVOID lpString) 71 72 { 72 73 74 73 if (SHELL_OsIsUnicode()) 74 return StrToOleStrW (lpWideCharStr, lpString); 75 return StrToOleStrA (lpWideCharStr, lpString); 75 76 } 76 77 77 78 /************************************************************************* 78 * StrToOleStrN 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 85 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 90 TRACE("(%p, %x, %s, %x)\n", lpWide, nWide, debugstr_wn(lpStrW, nStr), nStr); 90 91 91 92 93 94 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 100 101 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 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 110 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 116 TRACE("(%p, %x, %s, %x)\n", lpwStr, nwStr, debugstr_wn(lpOle,nOle), nOle); 116 117 117 118 119 120 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 126 127 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 26 char szCaption[255], szText[255], szBuffer[MAX_PATH + 256]; 26 27 UINT caption_resource_id, text_resource_id; 27 28 28 29 30 31 caption_resource_id= IDS_DELETEITEM_CAPTION;32 text_resource_id= IDS_DELETEITEM_TEXT;33 34 35 caption_resource_id= IDS_DELETEFOLDER_CAPTION;36 text_resource_id= IDS_DELETEITEM_TEXT;37 38 39 caption_resource_id= IDS_DELETEITEM_CAPTION;40 text_resource_id= IDS_DELETEMULTIPLE_TEXT;41 42 43 caption_resource_id= IDS_OVERWRITEFILE_CAPTION;44 text_resource_id= IDS_OVERWRITEFILE_TEXT;45 46 47 48 49 50 51 52 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 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 62 LoadStringA(shell32_hInstance, IDS_DELETEITEM_CAPTION, 63 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 69 LoadStringA(shell32_hInstance, IDS_DELETEFOLDER_CAPTION, 70 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 76 LoadStringA(shell32_hInstance, IDS_DELETEITEM_CAPTION, 77 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 80 else { 80 81 FIXME("Called without a valid nKindOfDialog specified!"); 81 LoadStringA(shell32_hInstance, IDS_DELETEITEM_TEXT, szText, 82 83 LoadStringA(shell32_hInstance, IDS_DELETEITEM_CAPTION, 84 85 } 86 #endif 87 88 89 90 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 * 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 104 charszTemp[MAX_PATH];105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 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 * 139 * SHELL_DeleteFileA() 139 140 */ 140 141 141 142 BOOL SHELL_DeleteFileA(LPCSTR pszFile, BOOL bShowUI) 142 143 { 143 144 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 151 * SHCreateDirectory [SHELL32.165] 151 152 * 152 153 * NOTES … … 156 157 DWORD WINAPI SHCreateDirectory(LPSECURITY_ATTRIBUTES sec,LPCSTR path) 157 158 { 158 159 160 161 162 163 164 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 181 182 183 184 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 189 * SHFileOperationA [SHELL32.243] 189 190 * 190 191 * NOTES 191 192 * exported by name 192 193 */ 193 DWORD WINAPI SHFileOperationA (LPSHFILEOPSTRUCTA lpFileOp) 194 { 195 196 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 226 226 lpFileOp->fAnyOperationsAborted=FALSE; 227 nlpFileOp.fAnyOperationsAborted=FALSE; 227 228 #else 228 229 #endif 230 231 232 233 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 495 496 497 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 511 512 513 514 515 516 #endif 517 518 519 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 617 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 636 case 0: 636 637 break; 637 638 #else 638 639 640 641 642 643 644 645 646 647 #endif 648 649 650 #ifdef __WIN32OS2__ 651 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 654 655 #endif 656 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 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 689 DWORD WINAPI SHFileOperationW (LPSHFILEOPSTRUCTW lpFileOp) 690 { 691 #ifdef __WIN32OS2__ 692 FIXME(__FUNCTION__"(%p) ,stub\n", lpFileOp); 692 693 #else 693 694 #endif 695 694 FIXME("(%p):stub.\n", lpFileOp); 695 #endif 696 return 1; 696 697 } 697 698 698 699 /************************************************************************* 699 * SHFileOperation 700 * SHFileOperation [SHELL32.242] 700 701 * 701 702 */ 702 703 DWORD WINAPI SHFileOperationAW(LPVOID lpFileOp) 703 704 { 704 705 706 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 { 716 { FIXME(__FUNCTION__"(%p, %p) ,stub\n",u,v); 716 717 #else 717 { 718 #endif 719 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 { 729 { FIXME(__FUNCTION__"(%s),stub\n",debugstr_w(u)); 729 730 #else 730 { 731 #endif 732 731 { FIXME("(%s),stub\n",debugstr_w(u)); 732 #endif 733 return 0; 733 734 } 734 735 735 736 /************************************************************************* 736 * IsNetDrive 737 * IsNetDrive [SHELL32.66] 737 738 */ 738 739 BOOL WINAPI IsNetDrive(DWORD drive) 739 740 { 740 741 742 743 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 * 3 * Shell Folder stuff 3 4 * 4 * Copyright 1997Marcus Meissner5 * Copyright 1998, 1999Juergen Schmied6 * 7 * 5 * 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) 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 { 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 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 100 101 102 103 104 105 { 106 HRESULThr = E_OUTOFMEMORY;107 LPITEMIDLISTpidlOut, pidlTemp = NULL;108 IShellFolder*psfChild;109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 if (pidlOut) 124 125 126 127 128 129 130 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 * 136 * SHELL32_CoCreateInitSF 136 137 * 137 * 138 * creates a initialized shell folder 138 139 */ 139 140 static HRESULT SHELL32_CoCreateInitSF ( 140 141 142 143 144 145 { 146 147 LPITEMIDLISTabsPidl;148 IShellFolder2*pShellFolder;149 IPersistFolder*pPersistFolder;150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 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 176 177 178 179 180 { 181 LPITEMIDLISTpidlFirst, pidlNext;182 IShellFolder2 *psfChild;183 HRESULThr = E_OUTOFMEMORY;184 185 186 187 188 189 190 { 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 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 227 228 227 IShellFolder * psf, 228 LPITEMIDLIST pidl, 229 LPDWORD pdwAttributes) 229 230 { 230 231 GUID const * clsid; 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 } 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 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 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) 323 #define _IShellFolder_(This) 324 #define _IShellFolder2_(This) 325 #define _IPersist_(This) 326 #define _IPersistFolder_(This) 327 #define _IPersistFolder2_(This) 328 #define _IDropTarget_(This) 329 #define _ISFHelper_(This) 330 /************************************************************************** 331 * 323 #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 336 337 338 339 340 341 } 342 343 /************************************************************************** 344 * 345 * 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 349 350 351 { 352 353 354 355 356 357 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 367 368 369 370 371 372 373 374 375 376 377 378 379 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 385 386 387 388 389 390 391 } 392 393 static ULONG WINAPI IUnknown_fnRelease(IUnknown * iface) 394 { 395 396 397 398 399 400 401 if (!--(This->ref)) 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 } 417 418 static ICOM_VTABLE(IUnknown) unkvt = 419 { 420 421 422 423 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 * 438 * IShellFolder_Constructor 438 439 * 439 440 * NOTES … … 442 443 * 443 444 * FIXME 444 * 445 * when pUnkOuter = 0 then rrid = IID_IShellFolder is returned 445 446 */ 446 447 HRESULT IFSFolder_Constructor( 447 448 449 450 { 451 IGenericSFImpl *sf;452 453 454 455 456 457 458 hr = CLASS_E_NOAGGREGATION;/* forbidden by definition */459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 } 485 /************************************************************************** 486 * 448 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 * 490 * THIS points to the parent folder 490 491 */ 491 492 492 493 IShellFolder * IShellFolder_Constructor( 493 494 495 { 496 IGenericSFImpl *sf;497 DWORDdwSize=0;498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 if(pidl && iface)/* do we have a pidl? */517 518 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 527 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 534 535 536 if(This->sMyPath)/* if the parent has a path, get it*/537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 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 560 * LPVOID* ppvObject 560 * REFIID riid [in ] Requested InterfaceID 561 * LPVOID* ppvObject [out] Interface* to hold the result 561 562 */ 562 563 static HRESULT WINAPI IShellFolder_fnQueryInterface( 563 564 565 566 { 567 568 569 570 571 572 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 582 583 584 585 586 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 595 596 597 598 599 600 } 601 602 /************************************************************************** 603 * 593 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: 618 * 618 * 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 626 627 628 629 630 631 632 { 633 634 635 HRESULThr = E_OUTOFMEMORY;636 LPCWSTRszNext=NULL;637 WCHARszElement[MAX_PATH];638 CHARszTempA[MAX_PATH], szPath[MAX_PATH];639 LPITEMIDLISTpidlTemp=NULL;640 641 642 643 644 645 646 647 if (pchEaten) *pchEaten = 0;/* strange but like the original */648 649 650 { 651 652 653 654 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 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 /* 676 677 678 679 680 681 */ 682 683 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 690 691 692 693 694 695 return hr; 696 } 697 698 /************************************************************************** 699 * 690 *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 707 708 709 710 { 711 712 713 714 715 716 717 718 719 720 721 722 return S_OK; 723 } 724 725 /************************************************************************** 726 * 707 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 735 { 736 737 GUIDconst * iid;738 IShellFolder*pShellFolder, *pSubFolder;739 IPersistFolder*pPersistFolder;740 LPITEMIDLISTabsPidl;741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 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 802 803 804 805 806 { 807 808 809 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 813 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 834 835 836 837 { 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 else/* same type of pidl */879 880 881 882 883 884 if (nReturn == 0)/* first pidl different ? */885 886 887 888 if (pidl1 && pidl1->mkid.cb) /* go deeper? */ 889 890 891 892 893 894 895 { 896 897 898 899 900 901 902 903 904 hr = ResultFromShort(nReturn);/* two equal simple pidls */905 906 907 908 909 hr = ResultFromShort(nReturn);/* two different simple pidls */910 911 912 913 914 915 916 } 917 918 /************************************************************************** 919 * 834 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 923 924 925 926 { 927 928 929 LPSHELLVIEWpShellView;930 HRESULThr = E_INVALIDARG;931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 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 972 973 974 975 { 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 } 992 993 994 995 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 1028 1029 LPITEMIDLISTpidl;1030 IUnknown* pObj = NULL; 1031 HRESULThr = E_INVALIDARG;1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 } 1057 1058 1059 1060 1061 1062 { 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 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 1092 1093 1094 1095 { 1096 1097 1098 CHARszPath[MAX_PATH]= "";1099 intlen = 0;1100 BOOLbSimplePidl;1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 strcpy (szPath, This->sMyPath);/* get path to root*/1122 1123 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 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 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 1157 HWND hwndOwner, 1158 1159 LPCOLESTR lpName, 1160 DWORD dwFlags, 1161 1162 { 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 else 1180 1181 1182 1183 1184 1185 1186 1187 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 1191 1192 1193 1194 1195 1196 1197 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 1202 1203 { 1204 1205 1206 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 1210 1211 { 1212 1213 1214 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 1218 1219 1220 1221 { 1222 1223 1224 1225 1226 1227 1228 1229 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 1233 1234 1235 { 1236 1237 1238 1239 1240 1241 1242 1243 1244 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 1248 1249 1250 1251 { 1252 1253 1254 1255 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 1259 1260 1261 1262 { 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 case 0:/* name */1285 1286 1287 case 1:/* size */1288 1289 1290 case 2:/* type */1291 1292 1293 case 3:/* date */1294 1295 1296 case 4:/* attributes */1297 1298 1299 1300 1301 1302 1303 1304 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 1308 1309 1310 { 1311 1312 1313 1314 } 1315 1316 static ICOM_VTABLE(IShellFolder2) sfvt = 1317 { 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1308 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 1349 1350 1351 { 1352 1353 1354 1355 1356 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 1361 { 1362 1363 1364 1365 1366 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 1371 { 1372 1373 1374 1375 1376 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 1388 1389 1390 { 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 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 1412 1413 1414 1415 1416 1417 if (i > 99) 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 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 1439 1440 1441 1442 { 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 SHFree(pidl); 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 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 1492 1493 1494 { 1495 1496 1497 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 1501 1502 1503 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 1508 if(!SHELL_WarnItemDelete(ASK_DELETE_MULTIPLE_ITEM, tmp)) 1508 1509 return E_FAIL; 1509 1510 bConfirm = FALSE; 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 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 1526 1527 1528 1529 SHFree(pidl); 1530 1531 1532 1533 1534 1535 1536 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 1540 1541 1542 1543 SHFree(pidl); 1544 1545 1546 1547 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 1557 1558 1559 1560 { 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 } 1591 1592 static ICOM_VTABLE(ISFHelper) shvt = 1593 { 1594 1595 1596 1597 1598 1599 1600 1601 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 * 1621 * ISF_Desktop_Constructor 1621 1622 * 1622 1623 */ 1623 1624 IShellFolder * ISF_Desktop_Constructor() 1624 1625 { 1625 IGenericSFImpl *sf;1626 1627 1628 1629 1630 1631 sf->absPidl=_ILCreateDesktop();/* my qualified pidl */1632 1633 1634 1635 1636 1637 1638 } 1639 1640 /************************************************************************** 1641 * 1626 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 1647 1648 1649 { 1650 1651 1652 1653 1654 1655 1656 1657 1658 *ppvObj = _IUnknown_(This); 1659 1660 1661 1662 1663 } 1664 1665 1666 1667 } 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 } 1678 1679 /************************************************************************** 1680 * 1647 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 * 1684 * 1684 * "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}" and "" binds 1685 * to MyComputer 1685 1686 */ 1686 1687 static HRESULT WINAPI ISF_Desktop_fnParseDisplayName( 1687 1688 1689 1690 1691 1692 1693 1694 { 1695 1696 1697 LPCWSTRszNext=NULL;1698 LPITEMIDLISTpidlTemp=NULL;1699 HRESULThr=E_OUTOFMEMORY;1700 1701 1702 1703 1704 1705 1706 if (pchEaten) *pchEaten = 0;/* strange but like the original */1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 return hr; 1731 } 1732 1733 /************************************************************************** 1734 * 1688 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 1738 1739 1740 1741 { 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 return S_OK; 1754 } 1755 1756 /************************************************************************** 1757 * 1738 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 1761 { 1762 1763 GUIDconst * clsid;1764 IShellFolder*pShellFolder, *pSubFolder;1765 1766 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 1770 1771 1772 1773 1774 1775 1776 1777 else 1778 1779 1780 1781 1782 1783 1784 1785 } 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 if (_ILIsPidlSimple(pidl))/* no sub folders */1809 1810 1811 1812 else/* go deeper */1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 } 1823 1824 /************************************************************************** 1825 * 1770 *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 1829 { 1830 1831 1832 LPSHELLVIEWpShellView;1833 HRESULThr = E_INVALIDARG;1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 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 1870 1871 1872 1873 { 1874 1875 1876 HRESULThr = S_OK;1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 } 1895 1896 /************************************************************************** 1897 * 1870 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 * 1901 * special case: pidl = null gives desktop-name back 1901 1902 */ 1902 1903 static HRESULT WINAPI ISF_Desktop_fnGetDisplayNameOf( 1903 1904 1905 1906 1907 { 1908 1909 1910 CHARszPath[MAX_PATH]= "";1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 { 1927 1928 1929 1930 1931 1932 1933 1934 1935 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 1940 1941 { 1942 1943 1944 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 1948 1949 { 1950 1951 1952 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 1956 1957 1958 1959 { 1960 1961 1962 1963 1964 1965 1966 1967 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 1971 1972 1973 { 1974 1975 1976 1977 1978 1979 1980 1981 1982 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 1986 1987 1988 1989 { 1990 1991 1992 1993 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 1997 1998 1999 2000 { 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 case 0:/* name */2022 2023 2024 case 1:/* size */2025 2026 2027 case 2:/* type */2028 2029 2030 case 3:/* date */2031 2032 2033 case 4:/* attributes */2034 2035 2036 2037 2038 2039 2040 2041 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 2045 2046 2047 { 2048 2049 2050 2051 } 2052 2053 static ICOM_VTABLE(IShellFolder2) sfdvt = 2054 { 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2045 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 * 2098 * ISF_MyComputer_Constructor 2098 2099 */ 2099 2100 static IShellFolder * ISF_MyComputer_Constructor(void) 2100 2101 { 2101 IGenericSFImpl *sf;2102 2103 2104 2105 2106 2107 2108 2109 2110 sf->absPidl=_ILCreateMyComputer();/* my qualified pidl */2111 2112 2113 2114 2115 2116 2117 } 2118 2119 /************************************************************************** 2120 * 2102 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 2124 2125 2126 2127 2128 2129 2130 { 2131 2132 2133 HRESULThr = E_OUTOFMEMORY;2134 LPCWSTRszNext=NULL;2135 WCHARszElement[MAX_PATH];2136 CHARszTempA[MAX_PATH];2137 LPITEMIDLISTpidlTemp;2138 2139 2140 2141 2142 2143 2144 if (pchEaten) *pchEaten = 0;/* strange but like the original */2145 2146 2147 2148 2149 2150 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 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 return hr; 2172 } 2173 2174 /************************************************************************** 2175 * 2153 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 2179 2180 2181 2182 { 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 return S_OK; 2195 } 2196 2197 /************************************************************************** 2198 * 2179 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 2202 { 2203 2204 GUIDconst * clsid;2205 IShellFolder*pShellFolder, *pSubFolder;2206 LPITEMIDLISTpidltemp;2207 2208 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 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 if (_ILIsPidlSimple(pidl))/* no sub folders */2232 2233 2234 2235 else/* go deeper */2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 } 2246 2247 /************************************************************************** 2248 * 2212 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 2252 { 2253 2254 2255 LPSHELLVIEWpShellView;2256 HRESULThr = E_INVALIDARG;2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 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 2293 2294 2295 2296 { 2297 2298 2299 HRESULThr = S_OK;2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 } 2317 2318 /************************************************************************** 2319 * 2293 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 * 2323 * 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 2327 2328 2329 2330 { 2331 2332 2333 charszPath[MAX_PATH], szDrive[18];2334 intlen = 0;2335 BOOLbSimplePidl;2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 _ILSimpleGetText(pidl, szPath, MAX_PATH);/* append my own path */2364 2365 2366 2367 2368 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 2392 2393 2394 2395 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 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 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 2418 2419 { 2420 2421 2422 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 2426 2427 { 2428 2429 2430 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 2434 2435 2436 2437 { 2438 2439 2440 2441 2442 2443 2444 2445 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 2449 2450 2451 { 2452 2453 2454 2455 2456 2457 2458 2459 2460 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 2464 2465 2466 2467 { 2468 2469 2470 2471 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 2477 2478 2479 2480 { 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 case 0:/* name */2506 2507 2508 case 1:/* type */2509 2510 2511 case 2:/* total size */2512 2513 2514 2515 2516 2517 2518 2519 case 3:/* free size */2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 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 2535 2536 2537 { 2538 2539 2540 2541 } 2542 2543 static ICOM_VTABLE(IShellFolder2) sfmcvt = 2544 { 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2535 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 2581 2582 2583 2584 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 2595 2596 2597 2598 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 2609 2610 2611 2612 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 2623 2624 2625 2626 2627 2628 2629 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 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 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 2680 { 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 } 2691 2692 static ICOM_VTABLE(IPersistFolder2) psfvt = 2693 { 2694 2695 2696 2697 2698 2699 2700 2679 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 2708 2709 2710 { 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 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 2732 2733 2734 { 2735 2736 2737 2738 2739 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 2745 2746 2747 2748 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 2754 2755 2756 2757 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 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 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 2789 2790 2791 2792 2793 2794 2795 2796 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 2803 2804 2805 2806 2807 2808 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 2819 2820 2821 2822 2823 } 2824 2825 static struct ICOM_VTABLE(IDropTarget) dtvt = 2826 { 2827 2828 2829 2830 2831 2832 2833 2834 2813 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 27 COLORREFcrBorderColor;28 intnBorderWidth;29 HBITMAPhBorderBmp;30 31 32 LPITEMIDLISTpidl;33 UINTuID;34 UINTuFlags;35 UINTuEnumFlags;36 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 49 #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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 } 73 /************************************************************************* 74 * FM_SetMenuParameter 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 79 80 81 82 83 84 { 85 LPFMINFOmenudata;86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 } 103 104 /************************************************************************* 105 * FM_InitMenuPopup 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 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 IEnumIDList*lpe = NULL;155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 } 220 /************************************************************************* 221 * FileMenu_Create 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 229 230 231 232 233 { 234 MENUINFOMenuInfo;235 LPFMINFOmenudata;236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 } 254 255 /************************************************************************* 256 * FileMenu_Destroy 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 266 267 268 269 270 271 272 273 274 275 276 277 } 278 279 /************************************************************************* 280 * FileMenu_AppendItemAW 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 285 286 287 288 289 290 { 291 292 MENUITEMINFOAmii;293 LPFMITEMmyItem;294 LPFMINFOmenudata;295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 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 362 363 364 365 366 367 { 368 369 370 371 372 373 374 375 376 377 378 379 380 } 381 /************************************************************************* 382 * FileMenu_InsertUsingPidl 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 389 390 391 392 393 394 { 395 396 397 398 399 400 401 402 FM_SetMenuParameter(hmenu, uID, pidl, uFlags, uEnumFlags, lpfnCallback); 403 404 405 } 406 407 /************************************************************************* 408 * FileMenu_ReplaceUsingPidl 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 418 { 419 420 421 422 423 424 FM_SetMenuParameter(hmenu, uID, pidl, 0, uEnumFlags, lpfnCallback); 425 426 427 } 428 429 /************************************************************************* 430 * FileMenu_Invalidate 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 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 446 } 447 448 /************************************************************************* 449 * FileMenu_AppendFilesForPidl 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 459 460 461 462 463 464 465 466 467 TRACE("0x%08x %p 0x%08x\n",hmenu, pidl,bAddSeperator); 468 469 470 } 471 /************************************************************************* 472 * FileMenu_AddFilesForPidl 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 487 488 489 490 491 } 492 493 494 /************************************************************************* 495 * FileMenu_TrackPopupMenuEx 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 499 500 501 502 503 504 { 505 506 507 508 } 509 510 /************************************************************************* 511 * FileMenu_GetLastSelectedItemPidls 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 519 520 } 521 522 #define FM_ICON_SIZE 523 #define FM_Y_SPACE 524 #define FM_SPACE1 525 #define FM_SPACE2 526 #define FM_LEFTBORDER 527 #define FM_RIGHTBORDER 528 /************************************************************************* 529 * FileMenu_MeasureItem 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 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 } 556 /************************************************************************* 557 * FileMenu_DrawItem 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 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 /* 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 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 } 613 614 /************************************************************************* 615 * FileMenu_InitMenuPopup 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 625 626 } 627 628 /************************************************************************* 629 * FileMenu_HandleMenuChar 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 636 637 } 638 639 /************************************************************************* 640 * FileMenu_DeleteAllItems 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 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 } 676 677 /************************************************************************* 678 * FileMenu_DeleteItemByCmd 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 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 } 700 701 /************************************************************************* 702 * FileMenu_DeleteItemByIndex 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 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 } 723 724 /************************************************************************* 725 * FileMenu_DeleteItemByFirstID 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 732 733 } 734 735 /************************************************************************* 736 * FileMenu_DeleteSeparator 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 741 742 } 743 744 /************************************************************************* 745 * FileMenu_EnableItemByCmd 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 753 754 } 755 756 /************************************************************************* 757 * FileMenu_GetItemExtent 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 { 764 765 766 767 768 769 770 771 772 773 } 774 775 /************************************************************************* 776 * FileMenu_AbortInitMenu 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 { 781 782 } 783 784 /************************************************************************* 785 * SHFind_InitMenuPopup 781 { TRACE("\n"); 782 bAbortInit = TRUE; 783 } 784 785 /************************************************************************* 786 * SHFind_InitMenuPopup [SHELL32.149] 786 787 * 787 788 * 788 789 * PARAMETERS 789 * hMenu 790 * hWndParent 791 * w 792 * x 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 796 * 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 { 800 801 802 } 803 804 /************************************************************************* 805 * Shell_MergeMenus 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 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 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 839 840 841 842 843 844 845 846 847 if (uInsert >= (UINT)nItem)/* insert position inside menu? */848 849 uInsert = (UINT)nItem;/* append on the end */850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 /* 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 885 886 887 888 889 890 891 892 893 894 895 896 miiSrc.wID += uIDAdjust;/* add uIDAdjust to the ID */897 898 if (miiSrc.wID > uIDAdjustMax)/* skip ID's higher uIDAdjustMax */899 900 901 if (uIDMax <= miiSrc.wID)/* remember the highest ID */902 903 904 905 906 miiSrc.fMask &= ~MIIM_ID;/* Don't set IDs for submenus that didn't have them already */907 908 909 910 911 912 913 914 915 916 917 918 919 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 927 928 if (uIDMax <= miiSrc.wID)/* remember the highest ID */929 930 931 932 933 934 /* 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 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 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 * 3 * 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 { 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 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 * 146 * IShellView_Constructor 146 147 */ 147 148 IShellView * IShellView_Constructor( IShellFolder * pFolder) 148 { 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 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 { 172 { return(This->pCommDlgBrowser != NULL); 172 173 } 173 174 174 175 static HRESULT IncludeObject(IShellViewImpl * This, LPCITEMIDLIST pidl) 175 176 { 176 177 178 179 180 181 182 183 184 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 190 191 192 193 194 195 196 197 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 203 204 205 206 207 208 209 210 211 } 212 /********************************************************** 213 * 203 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 221 222 223 224 225 226 227 228 229 230 231 232 233 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 * 243 * change the style of the listview control 243 244 */ 244 245 static void SetStyle(IShellViewImpl * This, DWORD dwAdd, DWORD dwRemove) 245 246 { 246 247 248 249 250 251 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 { 261 262 263 264 265 266 267 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 278 if (This->FolderSettings.fFlags & FWF_SINGLESEL)dwStyle |= LVS_SINGLESEL;279 280 281 282 283 284 285 286 287 288 289 290 291 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 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 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 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 351 352 353 354 355 ret = (SHORT) SCODE_CODE(IShellFolder_CompareIDs((LPSHELLFOLDER)lpData, 0, (LPITEMIDLIST)lParam1, (LPITEMIDLIST)lParam2)); 356 357 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 * 377 * 378 * 379 * move this code to IShellFolder.380 * 381 * the way this function works is only usable if we had only382 * 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 466 467 { 468 469 470 471 472 473 474 475 476 477 478 479 480 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 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 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 507 508 509 510 511 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 520 521 522 523 524 525 526 527 ZeroMemory(&lvItem, sizeof(lvItem));/* create the listview item*/528 lvItem.mask = LVIF_PARAM;/* only the pidl */529 530 531 532 533 534 535 lvItem.lParam = (LPARAM) ILClone(ILFindLastID(pidlNew));/* set the item's data */536 537 538 return TRUE;/* fixme: better handling */539 540 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 560 561 /* get the itemlist from the shfolder*/ 562 563 564 565 566 567 568 569 570 /* create a pointer array */ 571 572 573 574 575 576 577 578 579 580 581 582 583 } 584 585 586 587 588 589 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 595 596 597 598 599 600 601 602 603 604 605 606 607 608 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 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 } 654 655 /********************************************************** 656 * 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 669 670 671 672 673 674 675 676 677 { 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 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 { 707 708 709 710 711 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 725 726 727 728 729 730 731 732 733 734 735 736 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 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 } 785 /********************************************************** 786 * 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 799 800 801 802 803 IShellFolder_GetUIObjectOf( This->pSFParent, This->hWndParent, This->cidl, This->apidl, 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 } 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 else/* background context menu */863 { 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 } 883 884 /********************************************************** 885 * 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 894 895 896 897 898 899 900 901 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 912 913 914 915 916 917 918 919 920 921 922 923 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 { 932 933 934 935 TRACE("%p uState=%x\n",This,uState); 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 TRACE("-- after fnInsertMenusSB\n"); 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 TRACE("-- before fnSetMenuSB\n"); 997 998 999 1000 1001 TRACE("--\n"); 1002 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 1012 1013 1014 should always be done before merging menus (OnActivate merges the 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 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 1035 1036 1037 1038 1039 1040 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 * 1048 */ 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 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 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 { 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 if(lpdi->item.mask & LVIF_TEXT)/* text requested */1158 1159 1160 1161 1162 1163 1164 TRACE("-- text=%s\n",lpdi->item.pszText); 1165 1166 1167 1168 1169 1170 1171 if(lpdi->item.mask & LVIF_IMAGE)/* image requested */1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 { 1188 1189 1190 1191 1192 1193 1194 1195 1196 IDropSource * pds = (IDropSource*)&(This->lpvtblDropSource);/* own DropSource interface */1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 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 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 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 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 1295 TranslateAccelerator(This->hWnd, This->hAccel, &msg) 1295 1296 #endif 1296 1297 else if(plvKeyDown->wVKey == VK_DELETE) 1297 1298 { 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 pItems = HeapAlloc(GetProcessHeap(), 0, 1311 1312 1313 1314 1315 1316 1317 1318 1319 item_index = ListView_GetNextItem(This->hWndList, 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 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 1338 1339 1340 1341 1342 1343 1344 1345 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 1356 1357 { 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 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 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 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 1405 1406 1407 1408 1409 1410 case WM_SHOWWINDOW:UpdateWindow(pThis->hWndList);1411 1412 1413 1414 1415 case WM_DESTROY:if(GetShellOle())1416 1417 1418 1419 1420 1421 1422 1423 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 1437 1438 1439 1440 1441 1442 1443 1444 *ppvObj = This; 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 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 1483 1484 1485 1486 1487 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 1495 1496 1497 1498 1499 1500 if (!--(This->ref)) 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 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 1528 1529 1530 1531 1532 1533 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 1539 1540 1541 1542 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 1555 1556 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 1560 1561 1562 1563 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 1569 1570 1571 1572 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 1578 ICOM_THIS(IShellViewImpl, iface); 1578 1579 1579 1580 /* 1580 CHARszName[MAX_PATH];1581 */ 1582 LRESULTlResult;1583 intnPartArray[1] = {-1};1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 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 1602 1603 */ 1604 1605 1606 1607 1608 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 1611 1612 */ 1613 1614 1615 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 1621 1622 1623 1624 1625 1626 1627 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 1632 1633 1634 1635 1636 1637 { 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 if ( SUCCEEDED (IShellBrowser_QueryInterface( This->pShellBrowser, 1658 1659 1660 1661 1662 1663 1664 1665 1666 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 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 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 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 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 1725 1726 TRACE("(%p)->(%p) vmode=%x flags=%x\n",This, lpfs, 1727 1728 1729 1730 1731 1732 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 1738 1739 1740 1741 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 1747 1748 1749 1750 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 1755 1756 1757 { 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 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 1774 1774 lvItem.mask = LVIF_STATE; 1775 lvItem.iItem = 0; 1775 1776 1776 1777 while(ListView_GetItemA(This->hWndList, &lvItem)) 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 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 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 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 1833 1834 { 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 } 1848 1849 static struct ICOM_VTABLE(IShellView) svvt = 1850 { 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1833 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 1881 1882 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 1892 1893 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 1903 1904 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 1912 1913 ULONG cCmds, 1914 1915 1916 { 1917 1918 1919 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 1922 return E_NOTIMPL; 1922 1923 } 1923 1924 … … 1928 1929 */ 1929 1930 static HRESULT WINAPI ISVOleCmdTarget_Exec( 1930 1931 1932 1933 1934 1935 1936 { 1937 1938 1939 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 1942 } 1943 1944 static ICOM_VTABLE(IOleCommandTarget) ctvt = 1945 { 1946 1947 1948 1949 1950 1951 1942 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 1960 1961 1962 { 1963 1964 1965 1966 1967 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 1973 1974 1975 1976 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 1982 1983 1984 1985 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 1997 1998 1999 2000 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 2010 2011 2012 2013 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 2020 2021 2022 2023 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 2034 2035 2036 2037 2038 } 2039 2040 static struct ICOM_VTABLE(IDropTarget) dtvt = 2041 { 2042 2043 2044 2045 2046 2047 2048 2049 2028 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 2058 2059 2060 { 2061 2062 2063 2064 2065 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 2071 2072 2073 2074 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 2080 2081 2082 2083 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 2087 2088 2089 { 2090 2091 2092 2093 2094 2095 2096 2097 2098 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 2103 2104 { 2105 2106 2107 2108 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 2114 2115 2116 2117 2118 2114 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 2126 2127 2128 { 2129 2130 2131 2132 2133 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 2139 2140 2141 2142 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 2148 2149 2150 2151 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 2157 2158 2159 2160 2161 2162 2163 LPCRECTL lprcWBounds, 2164 2165 2166 { 2167 2168 2169 2170 2171 2172 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 2177 2178 2179 2180 2181 2182 { 2183 2184 2185 2186 2187 2188 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 2193 2194 2195 2196 { 2197 2198 2199 2200 2201 2202 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 2207 { 2208 2209 2210 2211 2212 2213 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 2218 2219 2220 { 2221 2222 2223 2224 2225 2226 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 2231 2232 2233 { 2234 2235 2236 2237 2238 2239 2240 } 2241 2242 2243 static struct ICOM_VTABLE(IViewObject) vovt = 2244 { 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2230 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 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 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 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 520 return retval; 520 521 } 521 522 … … 558 559 { 559 560 if (lstrcmpiA(inpRegKey, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies")) 560 561 562 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 * 3 * 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 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* 40 { 41 42 43 44 45 46 47 48 49 50 51 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 60 61 62 63 64 65 66 67 *ppvObj = This; 68 69 70 71 72 } 73 74 75 76 77 78 79 { 80 IUnknown_AddRef((IUnknown*)*ppvObj); 81 82 83 84 85 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 94 95 96 97 98 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 107 108 109 110 if (!--(This->ref)) 111 112 113 114 115 116 117 118 119 120 121 122 123 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 132 133 134 135 136 137 { 138 HMENUhMyMenu;139 UINTidMax;140 141 142 143 144 145 146 147 148 149 150 151 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 159 160 { 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 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 180 181 182 179 } 180 SHFree(pidl); 181 182 ISFHelper_Release(psfhlp); 183 } 183 184 } 184 185 … … 187 188 */ 188 189 static BOOL DoPaste( 189 190 { 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 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 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 /* fixme handle move 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 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 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 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 280 return bSuccess; 280 281 } 281 282 /************************************************************************** … … 283 284 */ 284 285 static HRESULT WINAPI ISVBgCm_fnInvokeCommand( 285 286 287 { 288 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 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 } 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 IShellView_Release(lpSV);/* QueryActiveShellView does AddRef*/346 347 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 356 357 358 359 360 361 { 362 363 364 365 366 /* test the existence of the menu items, the file dialog enables 367 368 369 370 371 372 373 374 375 { 376 377 378 379 380 381 382 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 390 391 392 393 { 394 395 396 397 398 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 408 409 410 411 412 413 414 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 * 3 * 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 { 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 { 45 46 47 48 49 50 51 52 if(i > 1) return FALSE;/* can't rename more than one item at a time*/53 54 55 56 57 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 { 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 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 96 97 98 99 100 101 102 103 *ppvObj = This; 104 105 106 107 108 } 109 110 111 112 113 114 115 { 116 IUnknown_AddRef((IUnknown*)*ppvObj); 117 118 119 120 121 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 130 131 132 133 134 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 143 144 145 146 147 148 if (!--(This->ref)) 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 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 172 173 174 175 176 177 178 { 179 MENUITEMINFOAmii;180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 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 203 204 205 206 207 208 { 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 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 255 256 257 { 258 259 260 261 LPITEMIDLISTpidlFQ;262 SHELLEXECUTEINFOAsei;263 264 /* Find the first item in the list that is not a value. These commands 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 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 297 298 { 299 300 301 LPSHELLBROWSERlpSB;302 LPSHELLVIEWlpSV;303 304 TRACE("(%p)->(wnd=%x)\n",This, hwnd); 305 306 307 308 309 310 311 TRACE("(sv=%p)\n",lpSV); 312 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 315 316 315 IShellView_Release(lpSV); 316 } 317 } 317 318 } 318 319 … … 324 325 static void DoDelete(IContextMenu *iface) 325 326 { 326 327 328 329 330 331 332 333 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 344 345 346 { 347 348 349 LPSHELLBROWSERlpSB;350 LPSHELLVIEWlpSV;351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 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 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 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 417 418 { 419 420 421 TRACE("(%p)->(invcom=%p verb=%p wnd=%x)\n",This,lpcmi,lpcmi->lpVerb, lpcmi->hwnd); 422 423 424 425 426 427 428 429 430 431 432 433 434 435 break; 436 437 438 break; 439 440 441 442 443 444 445 446 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 454 455 456 457 458 459 { 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 /* NT 4.0 with IE 3.0x or no IE will always call This with GCS_VERBW. In This 483 484 485 486 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 489 490 491 492 493 494 495 496 497 498 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 509 510 511 512 { 513 514 515 516 517 518 } 519 520 static struct ICOM_VTABLE(IContextMenu) cmvt = 521 { 522 523 524 525 526 527 528 529 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 * 3 * 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 69 70 71 72 73 74 75 76 77 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 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 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 370 * Shell_NotifyIconW [SHELL32.298] 370 371 */ 371 372 BOOL WINAPI Shell_NotifyIconW (DWORD dwMessage, PNOTIFYICONDATAW pnid ) 372 373 { 373 374 375 376 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 381 382 383 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.