Changeset 6709 for trunk/src/shell32
- Timestamp:
- Sep 15, 2001, 11:26:26 AM (24 years ago)
- Location:
- trunk/src/shell32
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/shell32/brsfolder.c
r6650 r6709 1 /* $Id: brsfolder.c,v 1.4 2001-09-05 13:46:55 bird Exp $ */2 1 #include <stdlib.h> 3 2 #include <string.h> … … 13 12 DEFAULT_DEBUG_CHANNEL(shell); 14 13 15 static HWND 16 static LPBROWSEINFOA 17 static LPITEMIDLIST 14 static HWND hwndTreeView; 15 static LPBROWSEINFOA lpBrowseInfo; 16 static LPITEMIDLIST pidlRet; 18 17 19 18 static void FillTreeView(LPSHELLFOLDER lpsf, LPITEMIDLIST lpifq, HTREEITEM hParent); … … 21 20 static void InitializeTreeView(HWND hwndParent, LPCITEMIDLIST root) 22 21 { 23 HIMAGELISThImageList;24 IShellFolder *lpsf;25 HRESULThr;26 27 28 29 30 31 32 33 34 35 36 22 HIMAGELIST hImageList; 23 IShellFolder * lpsf; 24 HRESULT hr; 25 26 hwndTreeView = GetDlgItem (hwndParent, IDD_TREEVIEW); 27 Shell_GetImageList(NULL, &hImageList); 28 29 TRACE("dlg=%x tree=%x\n", hwndParent, hwndTreeView ); 30 31 if (hImageList && hwndTreeView) 32 { TreeView_SetImageList(hwndTreeView, hImageList, 0); 33 } 34 35 /* so far, this method doesn't work (still missing the upper level), keep the old way */ 37 36 #if 0 38 39 40 41 IShellFolder *lpsfdesktop;42 43 44 45 46 47 48 37 if (root == NULL) { 38 hr = SHGetDesktopFolder(&lpsf); 39 } else { 40 IShellFolder * lpsfdesktop; 41 42 hr = SHGetDesktopFolder(&lpsfdesktop); 43 if (SUCCEEDED(hr)) { 44 hr = IShellFolder_BindToObject(lpsfdesktop, root, 0,(REFIID)&IID_IShellFolder,(LPVOID *)&lpsf); 45 IShellFolder_Release(lpsfdesktop); 46 } 47 } 49 48 #else 50 49 hr = SHGetDesktopFolder(&lpsf); 51 50 #endif 52 51 53 54 55 56 57 58 59 60 61 52 if (SUCCEEDED(hr) && hwndTreeView) 53 { TreeView_DeleteAllItems(hwndTreeView); 54 FillTreeView(lpsf, NULL, TVI_ROOT); 55 } 56 57 if (SUCCEEDED(hr)) 58 { IShellFolder_Release(lpsf); 59 } 60 TRACE("done\n"); 62 61 } 63 62 64 63 static int GetIcon(LPITEMIDLIST lpi, UINT uFlags) 65 { 66 67 64 { SHFILEINFOA sfi; 65 SHGetFileInfoA((LPCSTR)lpi,0,&sfi, sizeof(SHFILEINFOA), uFlags); 66 return sfi.iIcon; 68 67 } 69 68 70 69 static void GetNormalAndSelectedIcons(LPITEMIDLIST lpifq,LPTVITEMA lpTV_ITEM) 71 { 72 73 74 75 76 70 { TRACE("%p %p\n",lpifq, lpTV_ITEM); 71 72 lpTV_ITEM->iImage = GetIcon(lpifq, SHGFI_PIDL | SHGFI_SYSICONINDEX | SHGFI_SMALLICON); 73 lpTV_ITEM->iSelectedImage = GetIcon(lpifq, SHGFI_PIDL | SHGFI_SYSICONINDEX | SHGFI_SMALLICON | SHGFI_OPENICON); 74 75 return; 77 76 } 78 77 … … 86 85 static BOOL GetName(LPSHELLFOLDER lpsf, LPITEMIDLIST lpi, DWORD dwFlags, LPSTR lpFriendlyName) 87 86 { 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 87 BOOL bSuccess=TRUE; 88 STRRET str; 89 90 TRACE("%p %p %lx %p\n", lpsf, lpi, dwFlags, lpFriendlyName); 91 if (SUCCEEDED(IShellFolder_GetDisplayNameOf(lpsf, lpi, dwFlags, &str))) 92 { 93 if(FAILED(StrRetToStrNA (lpFriendlyName, MAX_PATH, &str, lpi))) 94 { 95 bSuccess = FALSE; 96 } 97 } 98 else 99 bSuccess = FALSE; 100 101 TRACE("-- %s\n",lpFriendlyName); 102 return bSuccess; 104 103 } 105 104 106 105 static void FillTreeView(IShellFolder * lpsf, LPITEMIDLIST pidl, HTREEITEM hParent) 107 106 { 108 TVITEMAtvi;109 TVINSERTSTRUCTAtvins;110 HTREEITEMhPrev = 0;111 LPENUMIDLISTlpe=0;112 LPITEMIDLISTpidlTemp=0;113 LPTV_ITEMDATAlptvid=0;114 ULONGulFetched;115 HRESULThr;116 charszBuff[256];117 HWNDhwnd=GetParent(hwndTreeView);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 lptvid->lpi= ILClone(pidlTemp);151 lptvid->lpifq= ILCombine(pidl, pidlTemp);152 153 154 155 156 157 158 159 160 161 162 163 164 165 107 TVITEMA tvi; 108 TVINSERTSTRUCTA tvins; 109 HTREEITEM hPrev = 0; 110 LPENUMIDLIST lpe=0; 111 LPITEMIDLIST pidlTemp=0; 112 LPTV_ITEMDATA lptvid=0; 113 ULONG ulFetched; 114 HRESULT hr; 115 char szBuff[256]; 116 HWND hwnd=GetParent(hwndTreeView); 117 118 TRACE("%p %p %x\n",lpsf, pidl, (INT)hParent); 119 SetCapture(GetParent(hwndTreeView)); 120 SetCursor(LoadCursorA(0, IDC_WAITA)); 121 122 hr=IShellFolder_EnumObjects(lpsf,hwnd, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS,&lpe); 123 124 if (SUCCEEDED(hr)) 125 { while (NOERROR == IEnumIDList_Next(lpe,1,&pidlTemp,&ulFetched)) 126 { ULONG ulAttrs = SFGAO_HASSUBFOLDER | SFGAO_FOLDER; 127 IShellFolder_GetAttributesOf(lpsf, 1, &pidlTemp, &ulAttrs); 128 if (ulAttrs & (SFGAO_HASSUBFOLDER | SFGAO_FOLDER)) 129 { if (ulAttrs & SFGAO_FOLDER) 130 { tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM; 131 132 if (ulAttrs & SFGAO_HASSUBFOLDER) 133 { tvi.cChildren=1; 134 tvi.mask |= TVIF_CHILDREN; 135 } 136 137 if (!( lptvid = (LPTV_ITEMDATA)SHAlloc(sizeof(TV_ITEMDATA)))) 138 goto Done; 139 140 if (!GetName(lpsf, pidlTemp, SHGDN_NORMAL, szBuff)) 141 goto Done; 142 143 tvi.pszText = szBuff; 144 tvi.cchTextMax = MAX_PATH; 145 tvi.lParam = (LPARAM)lptvid; 146 147 IShellFolder_AddRef(lpsf); 148 lptvid->lpsfParent = lpsf; 149 lptvid->lpi = ILClone(pidlTemp); 150 lptvid->lpifq = ILCombine(pidl, pidlTemp); 151 GetNormalAndSelectedIcons(lptvid->lpifq, &tvi); 152 153 tvins.DUMMYUNIONNAME.item = tvi; 154 tvins.hInsertAfter = hPrev; 155 tvins.hParent = hParent; 156 157 hPrev = (HTREEITEM)TreeView_InsertItemA (hwndTreeView, &tvins); 158 159 } 160 } 161 SHFree(pidlTemp); /* Finally, free the pidl that the shell gave us... */ 162 pidlTemp=0; 163 } 164 } 166 165 167 166 Done: 168 169 170 171 172 173 174 167 ReleaseCapture(); 168 SetCursor(LoadCursorA(0, IDC_ARROWA)); 169 170 if (lpe) 171 IEnumIDList_Release(lpe); 172 if (pidlTemp ) 173 SHFree(pidlTemp); 175 174 } 176 175 177 176 static LRESULT MsgNotify(HWND hWnd, UINT CtlID, LPNMHDR lpnmh) 178 { 179 NMTREEVIEWA*pnmtv = (NMTREEVIEWA *)lpnmh;180 LPTV_ITEMDATAlptvid; /* Long pointer to TreeView item data */181 IShellFolder *lpsf2=0;182 183 184 185 186 187 188 switch (pnmtv->hdr.code) 189 190 191 192 193 SHFree(lptvid->lpi); 194 SHFree(lptvid->lpifq); 195 SHFree(lptvid); 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 228 177 { 178 NMTREEVIEWA *pnmtv = (NMTREEVIEWA *)lpnmh; 179 LPTV_ITEMDATA lptvid; /* Long pointer to TreeView item data */ 180 IShellFolder * lpsf2=0; 181 182 183 TRACE("%x %x %p msg=%x\n", hWnd, CtlID, lpnmh, pnmtv->hdr.code); 184 185 switch (pnmtv->hdr.idFrom) 186 { case IDD_TREEVIEW: 187 switch (pnmtv->hdr.code) 188 { case TVN_DELETEITEMA: 189 { FIXME("TVN_DELETEITEMA\n"); 190 lptvid=(LPTV_ITEMDATA)pnmtv->itemOld.lParam; 191 IShellFolder_Release(lptvid->lpsfParent); 192 SHFree(lptvid->lpi); 193 SHFree(lptvid->lpifq); 194 SHFree(lptvid); 195 } 196 break; 197 198 case TVN_ITEMEXPANDINGA: 199 { FIXME("TVN_ITEMEXPANDINGA\n"); 200 if ((pnmtv->itemNew.state & TVIS_EXPANDEDONCE)) 201 break; 202 203 lptvid=(LPTV_ITEMDATA)pnmtv->itemNew.lParam; 204 if (SUCCEEDED(IShellFolder_BindToObject(lptvid->lpsfParent, lptvid->lpi,0,(REFIID)&IID_IShellFolder,(LPVOID *)&lpsf2))) 205 { FillTreeView( lpsf2, lptvid->lpifq, pnmtv->itemNew.hItem ); 206 } 207 TreeView_SortChildren(hwndTreeView, pnmtv->itemNew.hItem, FALSE); 208 } 209 break; 210 case TVN_SELCHANGEDA: 211 lptvid=(LPTV_ITEMDATA)pnmtv->itemNew.lParam; 212 pidlRet = lptvid->lpifq; 213 if (lpBrowseInfo->lpfn) 214 (lpBrowseInfo->lpfn)(hWnd, BFFM_SELCHANGED, (LPARAM)pidlRet, lpBrowseInfo->lParam); 215 break; 216 217 default: 218 FIXME("unhandled (%d)\n", pnmtv->hdr.code); 219 break; 220 } 221 break; 222 223 default: 224 break; 225 } 226 227 return 0; 229 228 } 230 229 … … 234 233 */ 235 234 static BOOL WINAPI BrsFolderDlgProc( HWND hWnd, UINT msg, WPARAM wParam, 236 235 LPARAM lParam ) 237 236 { TRACE("hwnd=%i msg=%i 0x%08x 0x%08lx\n", hWnd, msg, wParam, lParam ); 238 237 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 238 switch(msg) 239 { case WM_INITDIALOG: 240 pidlRet = NULL; 241 lpBrowseInfo = (LPBROWSEINFOA) lParam; 242 if (lpBrowseInfo->ulFlags & ~(BIF_STATUSTEXT)) 243 FIXME("flags %x not implemented\n", lpBrowseInfo->ulFlags & ~(BIF_STATUSTEXT)); 244 if (lpBrowseInfo->lpszTitle) { 245 SetWindowTextA(GetDlgItem(hWnd, IDD_TITLE), lpBrowseInfo->lpszTitle); 246 } else { 247 ShowWindow(GetDlgItem(hWnd, IDD_TITLE), SW_HIDE); 248 } 249 if (!(lpBrowseInfo->ulFlags & BIF_STATUSTEXT)) 250 ShowWindow(GetDlgItem(hWnd, IDD_STATUS), SW_HIDE); 251 252 if ( lpBrowseInfo->pidlRoot ) 253 FIXME("root is desktop\n"); 254 255 InitializeTreeView( hWnd, lpBrowseInfo->pidlRoot ); 256 257 if (lpBrowseInfo->lpfn) { 258 (lpBrowseInfo->lpfn)(hWnd, BFFM_INITIALIZED, 0, lpBrowseInfo->lParam); 260 259 #ifndef __WIN32OS2__ 261 260 (lpBrowseInfo->lpfn)(hWnd, BFFM_SELCHANGED, 0/*FIXME*/, lpBrowseInfo->lParam); 262 261 #endif 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; 262 } 263 264 return TRUE; 265 266 case WM_NOTIFY: 267 MsgNotify( hWnd, (UINT)wParam, (LPNMHDR)lParam); 268 break; 269 270 case WM_COMMAND: 271 switch (wParam) 272 { case IDOK: 273 pdump ( pidlRet ); 274 SHGetPathFromIDListA(pidlRet, lpBrowseInfo->pszDisplayName); 275 EndDialog(hWnd, (DWORD) ILClone(pidlRet)); 276 return TRUE; 277 278 case IDCANCEL: 279 EndDialog(hWnd, 0); 280 return TRUE; 281 break; 282 } 283 break; 284 case BFFM_SETSTATUSTEXTA: 285 TRACE("Set status %s\n", debugstr_a((LPSTR)lParam)); 286 SetWindowTextA(GetDlgItem(hWnd, IDD_STATUS), (LPSTR)lParam); 287 break; 288 case BFFM_SETSTATUSTEXTW: 289 TRACE("Set status %s\n", debugstr_w((LPWSTR)lParam)); 290 SetWindowTextW(GetDlgItem(hWnd, IDD_STATUS), (LPWSTR)lParam); 291 break; 292 case BFFM_ENABLEOK: 293 TRACE("Enable %ld\n", lParam); 294 EnableWindow(GetDlgItem(hWnd, 1), (lParam)?TRUE:FALSE); 295 break; 296 case BFFM_SETSELECTIONA: 297 if (wParam) { 298 TRACE("Set selection %s\n", debugstr_a((LPSTR)lParam)); 299 } 300 else { 301 TRACE("Set selection %p\n", (void*)lParam); 302 } 303 break; 304 case BFFM_SETSELECTIONW: 305 if (wParam) { 306 TRACE("Set selection %s\n", debugstr_w((LPWSTR)lParam)); 307 } 308 else { 309 TRACE("Set selection %p\n", (void*)lParam); 310 } 311 break; 312 } 313 return FALSE; 311 314 } 312 315 … … 317 320 LPITEMIDLIST WINAPI SHBrowseForFolderA (LPBROWSEINFOA lpbi) 318 321 { 319 TRACE("(%p{lpszTitle=%s,owner=%i})\n", 320 321 322 323 "SHBRSFORFOLDER_MSGBOX", 324 325 326 } 322 TRACE("(%p{lpszTitle=%s,owner=%i})\n", 323 lpbi, debugstr_a(lpbi->lpszTitle), lpbi->hwndOwner); 324 325 return (LPITEMIDLIST) DialogBoxParamA( shell32_hInstance, 326 "SHBRSFORFOLDER_MSGBOX", 327 lpbi->hwndOwner, 328 BrsFolderDlgProc, (INT)lpbi ); 329 } -
trunk/src/shell32/control.c
r6650 r6709 1 /* $Id: control.c,v 1.2 2001-09-05 13:46:56 bird Exp $ */2 1 /* Control Panel management */ 3 2 /* Eric Pouech 2001 */ … … 17 16 18 17 typedef struct CPlApplet { 19 struct CPlApplet* next; 20 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 18 struct CPlApplet* next; /* linked list */ 19 HWND hWnd; 20 unsigned count; /* number of subprograms */ 21 HMODULE hModule; /* module of loaded applet */ 22 APPLET_PROC proc; /* entry point address */ 23 NEWCPLINFOA info[1]; /* array of count information. 24 * dwSize field is 0 if entry is invalid */ 26 25 } CPlApplet; 27 26 28 27 typedef struct CPanel { 29 CPlApplet* first;/* linked list */30 HWND 28 CPlApplet* first; /* linked list */ 29 HWND hWnd; 31 30 unsigned status; 32 CPlApplet* 31 CPlApplet* clkApplet; 33 32 unsigned clkSP; 34 33 } CPanel; 35 34 36 static CPlApplet*Control_UnloadApplet(CPlApplet* applet)37 { 38 unsigned 39 CPlApplet* 35 static CPlApplet* Control_UnloadApplet(CPlApplet* applet) 36 { 37 unsigned i; 38 CPlApplet* next; 40 39 41 40 for (i = 0; i < applet->count; i++) { … … 50 49 } 51 50 52 static CPlApplet* 53 { 54 CPlApplet* 55 unsigned 56 CPLINFO 51 static CPlApplet* Control_LoadApplet(HWND hWnd, LPCSTR cmd, CPanel* panel) 52 { 53 CPlApplet* applet; 54 unsigned i; 55 CPLINFO info; 57 56 58 57 if (!(applet = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*applet)))) … … 63 62 if (!(applet->hModule = LoadLibraryA(cmd))) { 64 63 WARN("Cannot load control panel applet %s\n", cmd); 65 64 goto theError; 66 65 } 67 66 if (!(applet->proc = (APPLET_PROC)GetProcAddress(applet->hModule, "CPlApplet"))) { 68 67 WARN("Not a valid control panel applet %s\n", cmd); 69 68 goto theError; 70 69 } 71 70 if (!applet->proc(hWnd, CPL_INIT, 0L, 0L)) { 72 71 WARN("Init of applet has failed\n"); 73 72 goto theError; 74 73 } 75 74 if ((applet->count = applet->proc(hWnd, CPL_GETCOUNT, 0L, 0L)) == 0) { 76 75 WARN("No subprogram in applet\n"); 77 78 } 79 80 applet = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, applet, 81 82 76 goto theError; 77 } 78 79 applet = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, applet, 80 sizeof(*applet) + (applet->count - 1) * sizeof(NEWCPLINFOA)); 81 83 82 for (i = 0; i < applet->count; i++) { 84 83 applet->info[i].dwSize = sizeof(NEWCPLINFOA); 85 84 /* proc is supposed to return a null value upon success for 86 87 88 89 85 * CPL_INQUIRE and CPL_NEWINQUIRE 86 * However, real drivers don't seem to behave like this 87 * So, use introspection rather than return value 88 */ 90 89 applet->proc(hWnd, CPL_NEWINQUIRE, i, (LPARAM)&applet->info[i]); 91 90 if (applet->info[i].hIcon == 0) { 92 93 94 95 96 97 98 99 100 101 applet->info[i].hIcon = LoadIconA(applet->hModule, 102 103 LoadStringA(applet->hModule, info.idName, 104 105 LoadStringA(applet->hModule, info.idInfo, 106 107 108 91 applet->proc(hWnd, CPL_INQUIRE, i, (LPARAM)&info); 92 if (info.idIcon == 0 || info.idName == 0) { 93 WARN("Couldn't get info from sp %u\n", i); 94 applet->info[i].dwSize = 0; 95 } else { 96 /* convert the old data into the new structure */ 97 applet->info[i].dwFlags = 0; 98 applet->info[i].dwHelpContext = 0; 99 applet->info[i].lData = info.lData; 100 applet->info[i].hIcon = LoadIconA(applet->hModule, 101 MAKEINTRESOURCEA(info.idIcon)); 102 LoadStringA(applet->hModule, info.idName, 103 applet->info[i].szName, sizeof(applet->info[i].szName)); 104 LoadStringA(applet->hModule, info.idInfo, 105 applet->info[i].szInfo, sizeof(applet->info[i].szInfo)); 106 applet->info[i].szHelpFile[0] = '\0'; 107 } 109 108 } 110 109 } … … 120 119 } 121 120 122 static void 123 { 124 CPanel* 121 static void Control_WndProc_Create(HWND hWnd, const CREATESTRUCTA* cs) 122 { 123 CPanel* panel = (CPanel*)cs->lpCreateParams; 125 124 126 125 SetWindowLongA(hWnd, 0, (LPARAM)panel); … … 129 128 } 130 129 131 #define XICON32132 #define XSTEP 133 #define YICON32134 #define YSTEP 135 136 static BOOL 137 138 { 139 unsigned 140 CPlApplet* 141 RECT 142 130 #define XICON 32 131 #define XSTEP 128 132 #define YICON 32 133 #define YSTEP 64 134 135 static BOOL Control_Localize(const CPanel* panel, unsigned cx, unsigned cy, 136 CPlApplet** papplet, unsigned* psp) 137 { 138 unsigned i, x = (XSTEP-XICON)/2, y = 0; 139 CPlApplet* applet; 140 RECT rc; 141 143 142 GetClientRect(panel->hWnd, &rc); 144 143 for (applet = panel->first; applet; applet = applet = applet->next) { 145 144 for (i = 0; i < applet->count; i++) { 146 147 148 149 150 151 152 153 154 155 156 157 145 if (!applet->info[i].dwSize) continue; 146 if (x + XSTEP >= rc.right - rc.left) { 147 x = (XSTEP-XICON)/2; 148 y += YSTEP; 149 } 150 if (cx >= x && cx < x + XICON && cy >= y && cy < y + YSTEP) { 151 *papplet = applet; 152 *psp = i; 153 return TRUE; 154 } 155 x += XSTEP; 156 } 158 157 } 159 158 return FALSE; … … 162 161 static LRESULT Control_WndProc_Paint(const CPanel* panel, WPARAM wParam) 163 162 { 164 HDC 165 PAINTSTRUCT 166 RECT 167 unsigned 168 CPlApplet* 169 HGDIOBJ 163 HDC hdc; 164 PAINTSTRUCT ps; 165 RECT rc, txtRect; 166 unsigned i, x = 0, y = 0; 167 CPlApplet* applet; 168 HGDIOBJ hOldFont; 170 169 171 170 hdc = (wParam) ? (HDC)wParam : BeginPaint(panel->hWnd, &ps); … … 174 173 for (applet = panel->first; applet; applet = applet = applet->next) { 175 174 for (i = 0; i < applet->count; i++) { 176 177 178 179 180 181 182 183 184 185 186 DrawTextA(hdc, applet->info[i].szName, -1, &txtRect, 187 188 189 175 if (x + XSTEP >= rc.right - rc.left) { 176 x = 0; 177 y += YSTEP; 178 } 179 if (!applet->info[i].dwSize) continue; 180 DrawIcon(hdc, x + (XSTEP-XICON)/2, y, applet->info[i].hIcon); 181 txtRect.left = x; 182 txtRect.right = x + XSTEP; 183 txtRect.top = y + YICON; 184 txtRect.bottom = y + YSTEP; 185 DrawTextA(hdc, applet->info[i].szName, -1, &txtRect, 186 DT_CENTER | DT_VCENTER); 187 x += XSTEP; 188 } 190 189 } 191 190 SelectObject(hdc, hOldFont); … … 196 195 static LRESULT Control_WndProc_LButton(CPanel* panel, LPARAM lParam, BOOL up) 197 196 { 198 unsigned 199 CPlApplet* 200 197 unsigned i; 198 CPlApplet* applet; 199 201 200 if (Control_Localize(panel, LOWORD(lParam), HIWORD(lParam), &applet, &i)) { 202 201 if (up) { 203 if (panel->clkApplet == applet && panel->clkSP == i) { 204 applet->proc(applet->hWnd, CPL_DBLCLK, i, applet->info[i].lData); 202 if (panel->clkApplet == applet && panel->clkSP == i) { 203 applet->proc(applet->hWnd, CPL_DBLCLK, i, applet->info[i].lData); 204 } 205 } else { 206 panel->clkApplet = applet; 207 panel->clkSP = i; 205 208 } 206 } else {207 panel->clkApplet = applet;208 panel->clkSP = i;209 }210 209 } 211 210 return 0; 212 211 } 213 212 214 static LRESULT WINAPI Control_WndProc(HWND hWnd, UINT wMsg,215 216 { 217 CPanel* 213 static LRESULT WINAPI Control_WndProc(HWND hWnd, UINT wMsg, 214 WPARAM lParam1, LPARAM lParam2) 215 { 216 CPanel* panel = (CPanel*)GetWindowLongA(hWnd, 0); 218 217 219 218 if (panel || wMsg == WM_CREATE) { 220 219 switch (wMsg) { 221 220 case WM_CREATE: 222 223 221 Control_WndProc_Create(hWnd, (CREATESTRUCTA*)lParam2); 222 return 0; 224 223 case WM_DESTROY: 225 226 224 while ((panel->first = Control_UnloadApplet(panel->first))); 225 break; 227 226 case WM_PAINT: 228 227 return Control_WndProc_Paint(panel, lParam1); 229 228 case WM_LBUTTONUP: 230 229 return Control_WndProc_LButton(panel, lParam2, TRUE); 231 230 case WM_LBUTTONDOWN: 232 231 return Control_WndProc_LButton(panel, lParam2, FALSE); 233 232 /* EPP case WM_COMMAND: */ 234 /* EPP 233 /* EPP return Control_WndProc_Command(mwi, lParam1, lParam2); */ 235 234 } 236 235 } … … 241 240 static void Control_DoInterface(CPanel* panel, HWND hWnd, HINSTANCE hInst) 242 241 { 243 WNDCLASSA 244 MSG 242 WNDCLASSA wc; 243 MSG msg; 245 244 246 245 wc.style = CS_HREDRAW|CS_VREDRAW; … … 257 256 if (!RegisterClassA(&wc)) return; 258 257 259 CreateWindowExA(0, wc.lpszClassName, "Wine Control Panel", 260 WS_OVERLAPPEDWINDOW | WS_VISIBLE, 261 CW_USEDEFAULT, CW_USEDEFAULT, 262 CW_USEDEFAULT, CW_USEDEFAULT, 263 258 CreateWindowExA(0, wc.lpszClassName, "Wine Control Panel", 259 WS_OVERLAPPEDWINDOW | WS_VISIBLE, 260 CW_USEDEFAULT, CW_USEDEFAULT, 261 CW_USEDEFAULT, CW_USEDEFAULT, 262 hWnd, (HMENU)0, hInst, panel); 264 263 if (!panel->hWnd) return; 265 264 while (GetMessageA(&msg, panel->hWnd, 0, 0)) { 266 265 TranslateMessage(&msg); 267 266 DispatchMessageA(&msg); 268 269 } 270 } 271 272 static voidControl_DoWindow(CPanel* panel, HWND hWnd, HINSTANCE hInst)273 { 274 HANDLE 275 WIN32_FIND_DATAA 276 char 267 if (!panel->first) break; 268 } 269 } 270 271 static void Control_DoWindow(CPanel* panel, HWND hWnd, HINSTANCE hInst) 272 { 273 HANDLE h; 274 WIN32_FIND_DATAA fd; 275 char buffer[MAX_PATH]; 277 276 278 277 /* FIXME: should grab path somewhere from configuration */ 279 278 if ((h = FindFirstFileA("c:\\windows\\system\\*.cpl", &fd)) != 0) { 280 279 do { 281 282 283 284 280 sprintf(buffer, "c:\\windows\\system\\%s", fd.cFileName); 281 Control_LoadApplet(hWnd, buffer, panel); 282 } while (FindNextFileA(h, &fd)); 283 FindClose(h); 285 284 } 286 285 … … 288 287 } 289 288 290 static voidControl_DoLaunch(CPanel* panel, HWND hWnd, LPCSTR cmd)289 static void Control_DoLaunch(CPanel* panel, HWND hWnd, LPCSTR cmd) 291 290 /* forms to parse: 292 * 293 * 294 * 295 * 296 * 291 * foo.cpl,@sp,str 292 * foo.cpl,@sp 293 * foo.cpl,,str 294 * foo.cpl @sp 295 * foo.cpl str 297 296 */ 298 297 { 299 char* 300 char* 301 char* 302 char 303 unsigned 304 char* 298 char* buffer; 299 char* beg = NULL; 300 char* end; 301 char ch; 302 unsigned sp = 0; 303 char* extraPmts = NULL; 305 304 306 305 buffer = HeapAlloc(GetProcessHeap(), 0, strlen(cmd) + 1); … … 310 309 311 310 for (;;) { 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 311 ch = *end; 312 if (ch == ' ' || ch == ',' || ch == '\0') { 313 *end = '\0'; 314 if (beg) { 315 if (*beg == '@') { 316 sp = atoi(beg + 1); 317 } else if (*beg == '\0') { 318 sp = 0; 319 } else { 320 extraPmts = beg; 321 } 322 } 323 if (ch == '\0') break; 324 beg = end + 1; 325 if (ch == ' ') while (end[1] == ' ') end++; 326 } 327 end++; 329 328 } 330 329 Control_LoadApplet(hWnd, buffer, panel); … … 335 334 assert(applet && applet->next == NULL); 336 335 if (sp >= applet->count) { 337 338 336 WARN("Out of bounds (%u >= %u), setting to 0\n", sp, applet->count); 337 sp = 0; 339 338 } 340 339 if (applet->info[sp].dwSize) { 341 342 340 if (!applet->proc(applet->hWnd, CPL_STARTWPARMSA, sp, (LPARAM)extraPmts)) 341 applet->proc(applet->hWnd, CPL_DBLCLK, sp, applet->info[sp].lData); 343 342 } 344 343 Control_UnloadApplet(applet); … … 348 347 349 348 /************************************************************************* 350 * Control_RunDLL 349 * Control_RunDLL [SHELL32.12] 351 350 * 352 351 */ 353 352 void WINAPI Control_RunDLL(HWND hWnd, HINSTANCE hInst, LPCSTR cmd, DWORD nCmdShow) 354 353 { 355 CPanel 356 357 TRACE("(0x%08x, 0x%08lx, %s, 0x%08lx)\n", 358 354 CPanel panel; 355 356 TRACE("(0x%08x, 0x%08lx, %s, 0x%08lx)\n", 357 hWnd, (DWORD)hInst, debugstr_a(cmd), nCmdShow); 359 358 360 359 memset(&panel, 0, sizeof(panel)); … … 368 367 369 368 /************************************************************************* 370 * Control_FillCache_RunDLL 369 * Control_FillCache_RunDLL [SHELL32.8] 371 370 * 372 371 */ … … 378 377 379 378 /************************************************************************* 380 * RunDLL_CallEntry16 379 * RunDLL_CallEntry16 [SHELL32.122] 381 380 * the name is propably wrong 382 381 */ -
trunk/src/shell32/initshell32.cpp
r6650 r6709 1 /* $Id: initshell32.cpp,v 1.3 2001-09-05 13:46:56 bird Exp $ */2 1 /* 3 2 * DLL entry point … … 56 55 case DLL_THREAD_ATTACH: 57 56 case DLL_THREAD_DETACH: 58 57 return Shell32LibMain(hinstDLL, fdwReason, fImpLoad); 59 58 60 59 case DLL_PROCESS_DETACH: 61 62 60 ret = Shell32LibMain(hinstDLL, fdwReason, fImpLoad); 61 return ret; 63 62 } 64 63 return FALSE; … … 89 88 CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/ 90 89 91 dllHandle = RegisterLxDll(hModule, OdinLibMain, (PVOID)&shell32_PEResTab, 90 dllHandle = RegisterLxDll(hModule, OdinLibMain, (PVOID)&shell32_PEResTab, 92 91 SHELL32_MAJORIMAGE_VERSION, SHELL32_MINORIMAGE_VERSION, 93 92 IMAGE_SUBSYSTEM_WINDOWS_GUI); 94 if(dllHandle == 0) 95 93 if(dllHandle == 0) 94 return 0UL; 96 95 97 96 break; 98 97 case 1 : 99 98 if(dllHandle) { 100 99 UnregisterLxDll(dllHandle); 101 100 } 102 101 break; -
trunk/src/shell32/initterm.cpp
r6650 r6709 1 /* $Id: initterm.cpp,v 1.16 2001-09-05 13:46:56 bird Exp $ */2 1 /* 3 2 * DLL entry point … … 65 64 case 1 : 66 65 inittermShell32(hModule, ulFlag); 67 66 ctordtorTerm(); 68 67 break; 69 68 default : -
trunk/src/shell32/memorystream.c
r6650 r6709 1 /* $Id: memorystream.c,v 1.3 2001-09-05 13:46:56 bird Exp $ */2 1 /* 3 * 4 * 2 * this class implements a pure IStream object 3 * and can be used for many purposes 5 4 * 6 * 7 * 8 * 9 * 10 * 5 * the main reason for implementing this was 6 * a cleaner implementation of IShellLink which 7 * needs to be able to load lnk's from a IStream 8 * interface so it was obvious to capsule the file 9 * access in a IStream to. 11 10 */ 12 11 … … 37 36 static HRESULT WINAPI IStream_fnClone (IStream * iface, IStream** ppstm); 38 37 39 static ICOM_VTABLE(IStream) stvt = 40 { 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 38 static ICOM_VTABLE(IStream) stvt = 39 { 40 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 41 IStream_fnQueryInterface, 42 IStream_fnAddRef, 43 IStream_fnRelease, 44 IStream_fnRead, 45 IStream_fnWrite, 46 IStream_fnSeek, 47 IStream_fnSetSize, 48 IStream_fnCopyTo, 49 IStream_fnCommit, 50 IStream_fnRevert, 51 IStream_fnLockRegion, 52 IStream_fnUnlockRegion, 53 IStream_fnStat, 54 IStream_fnClone 55 57 56 }; 58 57 59 typedef struct 60 { ICOM_VTABLE(IStream)*lpvtst;61 DWORDref;62 LPBYTEpImage;63 HANDLEhMapping;64 DWORDdwLength;65 DWORDdwPos;58 typedef struct 59 { ICOM_VTABLE(IStream) *lpvtst; 60 DWORD ref; 61 LPBYTE pImage; 62 HANDLE hMapping; 63 DWORD dwLength; 64 DWORD dwPos; 66 65 } ISHFileStream; 67 66 … … 73 72 HRESULT CreateStreamOnFile (LPCSTR pszFilename, IStream ** ppstm) 74 73 { 75 ISHFileStream*fstr;76 OFSTRUCTofs;77 HFILEhFile = OpenFile( pszFilename, &ofs, OF_READ );78 HRESULTret = E_FAIL;79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 end_3: 103 end_2: 104 105 106 end_1: 107 108 74 ISHFileStream* fstr; 75 OFSTRUCT ofs; 76 HFILE hFile = OpenFile( pszFilename, &ofs, OF_READ ); 77 HRESULT ret = E_FAIL; 78 79 fstr = (ISHFileStream*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(ISHFileStream)); 80 fstr->lpvtst=&stvt; 81 fstr->ref = 1; 82 fstr->dwLength = GetFileSize (hFile, NULL); 83 84 shell32_ObjCount++; 85 86 if (!(fstr->hMapping = CreateFileMappingA(hFile,NULL,PAGE_READONLY|SEC_COMMIT,0,0,NULL))) 87 { 88 WARN("failed to create filemap.\n"); 89 goto end_2; 90 } 91 92 if (!(fstr->pImage = MapViewOfFile(fstr->hMapping,FILE_MAP_READ,0,0,0))) 93 { 94 WARN("failed to mmap filemap.\n"); 95 goto end_3; 96 } 97 98 ret = S_OK; 99 goto end_1; 100 101 end_3: CloseHandle(fstr->hMapping); 102 end_2: HeapFree(GetProcessHeap(), 0, fstr); 103 fstr = NULL; 104 105 end_1: _lclose(hFile); 106 (*ppstm) = (IStream*)fstr; 107 return ret; 109 108 } 110 109 … … 114 113 static HRESULT WINAPI IStream_fnQueryInterface(IStream *iface, REFIID riid, LPVOID *ppvObj) 115 114 { 116 117 118 119 120 121 122 123 124 125 126 127 128 129 { 130 IStream_AddRef((IStream*)*ppvObj); 131 132 133 134 135 115 ICOM_THIS(ISHFileStream, iface); 116 117 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj); 118 119 *ppvObj = NULL; 120 121 if(IsEqualIID(riid, &IID_IUnknown) || 122 IsEqualIID(riid, &IID_IStream)) 123 { 124 *ppvObj = This; 125 } 126 127 if(*ppvObj) 128 { 129 IStream_AddRef((IStream*)*ppvObj); 130 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj); 131 return S_OK; 132 } 133 TRACE("-- Interface: E_NOINTERFACE\n"); 134 return E_NOINTERFACE; 136 135 } 137 136 … … 141 140 static ULONG WINAPI IStream_fnAddRef(IStream *iface) 142 141 { 143 144 145 146 147 148 142 ICOM_THIS(ISHFileStream, iface); 143 144 TRACE("(%p)->(count=%lu)\n",This, This->ref); 145 146 shell32_ObjCount++; 147 return ++(This->ref); 149 148 } 150 149 … … 154 153 static ULONG WINAPI IStream_fnRelease(IStream *iface) 155 154 { 156 157 158 159 160 161 162 if (!--(This->ref)) 163 164 165 166 167 168 169 170 171 155 ICOM_THIS(ISHFileStream, iface); 156 157 TRACE("(%p)->()\n",This); 158 159 shell32_ObjCount--; 160 161 if (!--(This->ref)) 162 { TRACE(" destroying SHFileStream (%p)\n",This); 163 164 UnmapViewOfFile(This->pImage); 165 CloseHandle(This->hMapping); 166 167 HeapFree(GetProcessHeap(),0,This); 168 return 0; 169 } 170 return This->ref; 172 171 } 173 172 174 173 static HRESULT WINAPI IStream_fnRead (IStream * iface, void* pv, ULONG cb, ULONG* pcbRead) 175 174 { 176 177 178 179 180 181 182 183 184 185 186 187 if ( 0 >= dwBytesLeft )/* end of buffer */188 189 190 191 192 193 194 This->dwPos += dwBytesToRead;/* adjust pointer */195 196 197 198 199 175 ICOM_THIS(ISHFileStream, iface); 176 177 DWORD dwBytesToRead, dwBytesLeft; 178 179 TRACE("(%p)->(%p,0x%08lx,%p)\n",This, pv, cb, pcbRead); 180 181 if ( !pv ) 182 return STG_E_INVALIDPOINTER; 183 184 dwBytesLeft = This->dwLength - This->dwPos; 185 186 if ( 0 >= dwBytesLeft ) /* end of buffer */ 187 return S_FALSE; 188 189 dwBytesToRead = ( cb > dwBytesLeft) ? dwBytesLeft : cb; 190 191 memmove ( pv, (This->pImage) + (This->dwPos), dwBytesToRead); 192 193 This->dwPos += dwBytesToRead; /* adjust pointer */ 194 195 if (pcbRead) 196 *pcbRead = dwBytesToRead; 197 198 return S_OK; 200 199 } 201 200 static HRESULT WINAPI IStream_fnWrite (IStream * iface, const void* pv, ULONG cb, ULONG* pcbWritten) 202 201 { 203 204 205 206 207 202 ICOM_THIS(ISHFileStream, iface); 203 204 TRACE("(%p)\n",This); 205 206 return E_NOTIMPL; 208 207 } 209 208 static HRESULT WINAPI IStream_fnSeek (IStream * iface, LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER* plibNewPosition) 210 209 { 211 212 213 214 215 210 ICOM_THIS(ISHFileStream, iface); 211 212 TRACE("(%p)\n",This); 213 214 return E_NOTIMPL; 216 215 } 217 216 static HRESULT WINAPI IStream_fnSetSize (IStream * iface, ULARGE_INTEGER libNewSize) 218 217 { 219 220 221 222 223 218 ICOM_THIS(ISHFileStream, iface); 219 220 TRACE("(%p)\n",This); 221 222 return E_NOTIMPL; 224 223 } 225 224 static HRESULT WINAPI IStream_fnCopyTo (IStream * iface, IStream* pstm, ULARGE_INTEGER cb, ULARGE_INTEGER* pcbRead, ULARGE_INTEGER* pcbWritten) 226 225 { 227 228 229 230 231 226 ICOM_THIS(ISHFileStream, iface); 227 228 TRACE("(%p)\n",This); 229 230 return E_NOTIMPL; 232 231 } 233 232 static HRESULT WINAPI IStream_fnCommit (IStream * iface, DWORD grfCommitFlags) 234 233 { 235 236 237 238 239 234 ICOM_THIS(ISHFileStream, iface); 235 236 TRACE("(%p)\n",This); 237 238 return E_NOTIMPL; 240 239 } 241 240 static HRESULT WINAPI IStream_fnRevert (IStream * iface) 242 241 { 243 244 245 246 247 242 ICOM_THIS(ISHFileStream, iface); 243 244 TRACE("(%p)\n",This); 245 246 return E_NOTIMPL; 248 247 } 249 248 static HRESULT WINAPI IStream_fnLockRegion (IStream * iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) 250 249 { 251 252 253 254 255 250 ICOM_THIS(ISHFileStream, iface); 251 252 TRACE("(%p)\n",This); 253 254 return E_NOTIMPL; 256 255 } 257 256 static HRESULT WINAPI IStream_fnUnlockRegion (IStream * iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) 258 257 { 259 260 261 262 263 258 ICOM_THIS(ISHFileStream, iface); 259 260 TRACE("(%p)\n",This); 261 262 return E_NOTIMPL; 264 263 } 265 264 static HRESULT WINAPI IStream_fnStat (IStream * iface, STATSTG* pstatstg, DWORD grfStatFlag) 266 265 { 267 268 269 270 271 266 ICOM_THIS(ISHFileStream, iface); 267 268 TRACE("(%p)\n",This); 269 270 return E_NOTIMPL; 272 271 } 273 272 static HRESULT WINAPI IStream_fnClone (IStream * iface, IStream** ppstm) 274 273 { 275 276 277 278 279 280 } 274 ICOM_THIS(ISHFileStream, iface); 275 276 TRACE("(%p)\n",This); 277 278 return E_NOTIMPL; 279 } -
trunk/src/shell32/pidl.c
r6650 r6709 1 /* $Id: pidl.c,v 1.4 2001-09-05 13:46:56 bird Exp $ */2 1 /* 3 * 4 * 5 * Copyright 1998Juergen Schmied2 * pidl Handling 3 * 4 * Copyright 1998 Juergen Schmied 6 5 * 7 6 * NOTES … … 31 30 void pdump (LPCITEMIDLIST pidl) 32 31 { 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 83 32 BOOL bIsShellDebug; 33 34 LPITEMIDLIST pidltemp = pidl; 35 if (!TRACE_ON(pidl)) 36 return; 37 38 /* silence the sub-functions */ 39 bIsShellDebug = TRACE_ON(shell); 40 __SET_DEBUGGING(__DBCL_TRACE, __wine_dbch_shell, FALSE); 41 __SET_DEBUGGING(__DBCL_TRACE, __wine_dbch_pidl, FALSE); 42 43 if (! pidltemp) 44 { 45 MESSAGE ("-------- pidl=NULL (Desktop)\n"); 46 } 47 else 48 { 49 MESSAGE ("-------- pidl=%p\n", pidl); 50 if (pidltemp->mkid.cb) 51 { 52 do 53 { 54 DWORD dwAttrib = 0; 55 LPPIDLDATA pData = _ILGetDataPointer(pidltemp); 56 DWORD type = pData->type; 57 LPSTR szLongName = _ILGetTextPointer(pidltemp); 58 LPSTR szShortName = _ILGetSTextPointer(pidltemp); 59 char szName[MAX_PATH]; 60 61 _ILSimpleGetText(pidltemp, szName, MAX_PATH); 62 if( PT_FOLDER == type) 63 dwAttrib = pData->u.folder.uFileAttribs; 64 else if( PT_VALUE == type) 65 dwAttrib = pData->u.file.uFileAttribs; 66 67 MESSAGE ("-- pidl=%p size=%u type=%lx attr=0x%08lx name=%s (%s,%s)\n", 68 pidltemp, pidltemp->mkid.cb,type,dwAttrib,szName,debugstr_a(szLongName), debugstr_a(szShortName)); 69 70 pidltemp = ILGetNext(pidltemp); 71 72 } while (pidltemp->mkid.cb); 73 } 74 else 75 { 76 MESSAGE ("empty pidl (Desktop)\n"); 77 } 78 pcheck(pidl); 79 } 80 81 __SET_DEBUGGING(__DBCL_TRACE, __wine_dbch_shell, bIsShellDebug); 82 __SET_DEBUGGING(__DBCL_TRACE, __wine_dbch_pidl, TRUE); 84 83 85 84 } … … 88 87 BOOL pcheck (LPCITEMIDLIST pidl) 89 88 { DWORD type, ret=TRUE; 90 89 BOOL bIsPidlDebug; 91 90 92 91 LPITEMIDLIST pidltemp = pidl; 93 92 94 95 93 bIsPidlDebug = TRACE_ON(shell); 94 __SET_DEBUGGING(__DBCL_TRACE, __wine_dbch_pidl, FALSE); 96 95 97 96 if (pidltemp && pidltemp->mkid.cb) … … 99 98 { type = _ILGetDataPointer(pidltemp)->type; 100 99 switch (type) 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 /************************************************************************* 147 * ILGetDisplayName 100 { case PT_DESKTOP: 101 case PT_MYCOMP: 102 case PT_SPECIAL: 103 case PT_DRIVE: 104 case PT_DRIVE1: 105 case PT_DRIVE2: 106 case PT_DRIVE3: 107 case PT_FOLDER: 108 case PT_VALUE: 109 case PT_FOLDER1: 110 case PT_WORKGRP: 111 case PT_COMP: 112 case PT_NETWORK: 113 case PT_IESPECIAL1: 114 case PT_IESPECIAL2: 115 case PT_SHARE: 116 break; 117 default: 118 { 119 char szTemp[BYTES_PRINTED*4 + 1]; 120 int i; 121 unsigned char c; 122 123 memset(szTemp, ' ', BYTES_PRINTED*4 + 1); 124 for ( i = 0; (i<pidltemp->mkid.cb) && (i<BYTES_PRINTED); i++) 125 { 126 c = ((unsigned char *)pidltemp)[i]; 127 128 szTemp[i*3+0] = ((c>>4)>9)? (c>>4)+55 : (c>>4)+48; 129 szTemp[i*3+1] = ((0x0F&c)>9)? (0x0F&c)+55 : (0x0F&c)+48; 130 szTemp[i*3+2] = ' '; 131 szTemp[i+BYTES_PRINTED*3] = (c>=0x20 && c <=0x80) ? c : '.'; 132 } 133 szTemp[BYTES_PRINTED*4] = 0x00; 134 ERR("unknown IDLIST type size=%u type=%lx\n%s\n",pidltemp->mkid.cb,type, szTemp); 135 ret = FALSE; 136 } 137 } 138 pidltemp = ILGetNext(pidltemp); 139 } while (pidltemp->mkid.cb); 140 } 141 __SET_DEBUGGING(__DBCL_TRACE, __wine_dbch_pidl, bIsPidlDebug); 142 return ret; 143 } 144 145 /************************************************************************* 146 * ILGetDisplayName [SHELL32.15] 148 147 */ 149 148 BOOL WINAPI ILGetDisplayName(LPCITEMIDLIST pidl,LPSTR path) 150 149 { 151 152 150 TRACE_(shell)("pidl=%p %p semi-stub\n",pidl,path); 151 return SHGetPathFromIDListA(pidl, path); 153 152 } 154 153 /************************************************************************* … … 158 157 * observed: pidl=Desktop return=pidl 159 158 */ 160 LPITEMIDLIST WINAPI ILFindLastID(LPITEMIDLIST pidl) 161 { 162 163 164 165 166 167 168 169 170 return pidlLast; 159 LPITEMIDLIST WINAPI ILFindLastID(LPITEMIDLIST pidl) 160 { LPITEMIDLIST pidlLast = pidl; 161 162 TRACE("(pidl=%p)\n",pidl); 163 164 while (pidl->mkid.cb) 165 { 166 pidlLast = pidl; 167 pidl = ILGetNext(pidl); 168 } 169 return pidlLast; 171 170 } 172 171 /************************************************************************* … … 178 177 BOOL WINAPI ILRemoveLastID(LPCITEMIDLIST pidl) 179 178 { 180 181 182 183 184 185 179 TRACE_(shell)("pidl=%p\n",pidl); 180 181 if (!pidl || !pidl->mkid.cb) 182 return 0; 183 ILFindLastID(pidl)->mkid.cb = 0; 184 return 1; 186 185 } 187 186 … … 198 197 if (!pidl) 199 198 return NULL; 200 199 201 200 len = ILGetSize(pidl); 202 201 newpidl = (LPITEMIDLIST)SHAlloc(len); … … 216 215 */ 217 216 LPITEMIDLIST WINAPI ILCloneFirst(LPCITEMIDLIST pidl) 218 { 219 220 221 222 223 224 225 226 len = pidl->mkid.cb; 227 228 229 230 memcpy(pidlNew,pidl,len+2);/* 2 -> mind a desktop pidl */231 232 233 234 235 236 237 238 217 { DWORD len; 218 LPITEMIDLIST pidlNew = NULL; 219 220 TRACE("pidl=%p \n",pidl); 221 pdump(pidl); 222 223 if (pidl) 224 { 225 len = pidl->mkid.cb; 226 pidlNew = (LPITEMIDLIST) SHAlloc (len+2); 227 if (pidlNew) 228 { 229 memcpy(pidlNew,pidl,len+2); /* 2 -> mind a desktop pidl */ 230 231 if (len) 232 ILGetNext(pidlNew)->mkid.cb = 0x00; 233 } 234 } 235 TRACE("-- newpidl=%p\n",pidlNew); 236 237 return pidlNew; 239 238 } 240 239 … … 246 245 */ 247 246 HRESULT WINAPI ILLoadFromStream (IStream * pStream, LPITEMIDLIST * ppPidl) 248 { WORDwLen = 0;249 DWORDdwBytesRead;250 HRESULTret = E_FAIL;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 282 247 { WORD wLen = 0; 248 DWORD dwBytesRead; 249 HRESULT ret = E_FAIL; 250 251 252 TRACE_(shell)("%p %p\n", pStream , ppPidl); 253 254 if (*ppPidl) 255 { SHFree(*ppPidl); 256 *ppPidl = NULL; 257 } 258 259 IStream_AddRef (pStream); 260 261 if (SUCCEEDED(IStream_Read(pStream, (LPVOID)&wLen, 2, &dwBytesRead))) 262 { *ppPidl = SHAlloc (wLen); 263 if (SUCCEEDED(IStream_Read(pStream, *ppPidl , wLen, &dwBytesRead))) 264 { ret = S_OK; 265 } 266 else 267 { SHFree(*ppPidl); 268 *ppPidl = NULL; 269 } 270 } 271 272 /* we are not yet fully compatible */ 273 if (!pcheck(*ppPidl)) 274 { SHFree(*ppPidl); 275 *ppPidl = NULL; 276 } 277 278 279 IStream_Release (pStream); 280 281 return ret; 283 282 } 284 283 … … 291 290 HRESULT WINAPI ILSaveToStream (IStream * pStream, LPCITEMIDLIST pPidl) 292 291 { 293 LPITEMIDLISTpidl;294 WORDwLen = 0;295 HRESULTret = E_FAIL;296 297 298 299 300 301 292 LPITEMIDLIST pidl; 293 WORD wLen = 0; 294 HRESULT ret = E_FAIL; 295 296 TRACE_(shell)("%p %p\n", pStream, pPidl); 297 298 IStream_AddRef (pStream); 299 300 pidl = pPidl; 302 301 while (pidl->mkid.cb) 303 302 { … … 306 305 } 307 306 308 309 310 311 312 313 314 315 316 317 318 319 } 320 321 /************************************************************************* 322 * SHILCreateFromPath 307 if (SUCCEEDED(IStream_Write(pStream, (LPVOID)&wLen, 2, NULL))) 308 { 309 if (SUCCEEDED(IStream_Write(pStream, pPidl, wLen, NULL))) 310 { ret = S_OK; 311 } 312 } 313 314 315 IStream_Release (pStream); 316 317 return ret; 318 } 319 320 /************************************************************************* 321 * SHILCreateFromPath [SHELL32.28] 323 322 * 324 323 * NOTES … … 326 325 */ 327 326 HRESULT WINAPI SHILCreateFromPathA (LPCSTR path, LPITEMIDLIST * ppidl, DWORD * attributes) 328 { 329 330 331 332 333 327 { LPSHELLFOLDER sf; 328 WCHAR lpszDisplayName[MAX_PATH]; 329 DWORD pchEaten; 330 HRESULT ret = E_FAIL; 331 332 TRACE_(shell)("%s %p 0x%08lx\n",path,ppidl,attributes?*attributes:0); 334 333 335 334 if (!MultiByteToWideChar( CP_ACP, 0, path, -1, lpszDisplayName, MAX_PATH )) 336 335 lpszDisplayName[MAX_PATH-1] = 0; 337 336 338 339 340 341 342 343 337 if (SUCCEEDED (SHGetDesktopFolder(&sf))) 338 { 339 ret = IShellFolder_ParseDisplayName(sf,0, NULL,lpszDisplayName,&pchEaten,ppidl,attributes); 340 IShellFolder_Release(sf); 341 } 342 return ret; 344 343 } 345 344 HRESULT WINAPI SHILCreateFromPathW (LPCWSTR path, LPITEMIDLIST * ppidl, DWORD * attributes) 346 { 347 348 349 350 351 352 353 354 355 356 357 345 { LPSHELLFOLDER sf; 346 DWORD pchEaten; 347 HRESULT ret = E_FAIL; 348 349 TRACE_(shell)("%s %p 0x%08lx\n",debugstr_w(path),ppidl,attributes?*attributes:0); 350 351 if (SUCCEEDED (SHGetDesktopFolder(&sf))) 352 { 353 ret = IShellFolder_ParseDisplayName(sf,0, NULL, (LPWSTR) path, &pchEaten, ppidl, attributes); 354 IShellFolder_Release(sf); 355 } 356 return ret; 358 357 } 359 358 HRESULT WINAPI SHILCreateFromPathAW (LPCVOID path, LPITEMIDLIST * ppidl, DWORD * attributes) 360 359 { 361 362 363 360 if ( SHELL_OsIsUnicode()) 361 return SHILCreateFromPathW (path, ppidl, attributes); 362 return SHILCreateFromPathA (path, ppidl, attributes); 364 363 } 365 364 366 365 /************************************************************************* 367 366 * SHCloneSpecialIDList [SHELL32.89] 368 * 367 * 369 368 * PARAMETERS 370 * hwndOwner [in]371 * nFolder [in]CSIDL_xxxxx ??369 * hwndOwner [in] 370 * nFolder [in] CSIDL_xxxxx ?? 372 371 * 373 372 * RETURNS … … 377 376 */ 378 377 LPITEMIDLIST WINAPI SHCloneSpecialIDList(HWND hwndOwner,DWORD nFolder,DWORD x3) 379 { 380 381 382 383 384 385 378 { LPITEMIDLIST ppidl; 379 WARN_(shell)("(hwnd=0x%x,csidl=0x%lx,0x%lx):semi-stub.\n", 380 hwndOwner,nFolder,x3); 381 382 SHGetSpecialFolderLocation(hwndOwner, nFolder, &ppidl); 383 384 return ppidl; 386 385 } 387 386 … … 391 390 */ 392 391 LPITEMIDLIST WINAPI ILGlobalClone(LPCITEMIDLIST pidl) 393 { 394 395 396 397 398 399 400 401 402 403 404 405 406 407 392 { DWORD len; 393 LPITEMIDLIST newpidl; 394 395 if (!pidl) 396 return NULL; 397 398 len = ILGetSize(pidl); 399 newpidl = (LPITEMIDLIST)pCOMCTL32_Alloc(len); 400 if (newpidl) 401 memcpy(newpidl,pidl,len); 402 403 TRACE("pidl=%p newpidl=%p\n",pidl, newpidl); 404 pdump(pidl); 405 406 return newpidl; 408 407 } 409 408 … … 414 413 BOOL WINAPI ILIsEqual(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2) 415 414 { 416 charszData1[MAX_PATH];417 charszData2[MAX_PATH];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 450 415 char szData1[MAX_PATH]; 416 char szData2[MAX_PATH]; 417 418 LPITEMIDLIST pidltemp1 = pidl1; 419 LPITEMIDLIST pidltemp2 = pidl2; 420 421 TRACE("pidl1=%p pidl2=%p\n",pidl1, pidl2); 422 423 /* explorer reads from registry directly (StreamMRU), 424 so we can only check here */ 425 if ((!pcheck (pidl1)) || (!pcheck (pidl2))) return FALSE; 426 427 pdump (pidl1); 428 pdump (pidl2); 429 430 if ( (!pidl1) || (!pidl2) ) return FALSE; 431 432 while (pidltemp1->mkid.cb && pidltemp2->mkid.cb) 433 { 434 _ILSimpleGetText(pidltemp1, szData1, MAX_PATH); 435 _ILSimpleGetText(pidltemp2, szData2, MAX_PATH); 436 437 if (strcasecmp ( szData1, szData2 )!=0 ) 438 return FALSE; 439 440 pidltemp1 = ILGetNext(pidltemp1); 441 pidltemp2 = ILGetNext(pidltemp2); 442 } 443 444 if (!pidltemp1->mkid.cb && !pidltemp2->mkid.cb) 445 { 446 return TRUE; 447 } 448 449 return FALSE; 451 450 } 452 451 /************************************************************************* 453 452 * ILIsParent [SHELL32.23] 454 453 * 455 * parent=a/b 456 * 457 * 454 * parent=a/b child=a/b/c -> true, c is in folder a/b 455 * child=a/b/c/d -> false if bImmediate is true, d is not in folder a/b 456 * child=a/b/c/d -> true if bImmediate is false, d is in a subfolder of a/b 458 457 */ 459 458 BOOL WINAPI ILIsParent( LPCITEMIDLIST pidlParent, LPCITEMIDLIST pidlChild, BOOL bImmediate) 460 459 { 461 charszData1[MAX_PATH];462 charszData2[MAX_PATH];463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 } 480 481 if ( pParent->mkid.cb || ! pChild->mkid.cb)/* child shorter or has equal length to parent */482 483 484 if ( ILGetNext(pChild)->mkid.cb && bImmediate)/* not immediate descent */485 486 487 460 char szData1[MAX_PATH]; 461 char szData2[MAX_PATH]; 462 463 LPITEMIDLIST pParent = pidlParent; 464 LPITEMIDLIST pChild = pidlChild; 465 466 TRACE("%p %p %x\n", pidlParent, pidlChild, bImmediate); 467 468 while (pParent->mkid.cb && pChild->mkid.cb) 469 { 470 _ILSimpleGetText(pParent, szData1, MAX_PATH); 471 _ILSimpleGetText(pChild, szData2, MAX_PATH); 472 473 if (strcasecmp ( szData1, szData2 )!=0 ) 474 return FALSE; 475 476 pParent = ILGetNext(pParent); 477 pChild = ILGetNext(pChild); 478 } 479 480 if ( pParent->mkid.cb || ! pChild->mkid.cb) /* child shorter or has equal length to parent */ 481 return FALSE; 482 483 if ( ILGetNext(pChild)->mkid.cb && bImmediate) /* not immediate descent */ 484 return FALSE; 485 486 return TRUE; 488 487 } 489 488 … … 494 493 * Compares elements from pidl1 and pidl2. 495 494 * 496 * pidl1 is desktop 497 * pidl1 shorter pidl2 498 * 499 * pidl2 shorter pidl1 500 * pidl2 equal pidl1 495 * pidl1 is desktop pidl2 496 * pidl1 shorter pidl2 pointer to first different element of pidl2 497 * if there was at least one equal element 498 * pidl2 shorter pidl1 0 499 * pidl2 equal pidl1 pointer to last 0x00-element of pidl2 501 500 */ 502 501 LPITEMIDLIST WINAPI ILFindChild(LPCITEMIDLIST pidl1,LPCITEMIDLIST pidl2) 503 502 { 504 charszData1[MAX_PATH];505 charszData2[MAX_PATH];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 537 ret = pidltemp2; 538 539 540 541 542 543 544 545 546 503 char szData1[MAX_PATH]; 504 char szData2[MAX_PATH]; 505 506 LPITEMIDLIST pidltemp1 = pidl1; 507 LPITEMIDLIST pidltemp2 = pidl2; 508 LPITEMIDLIST ret=NULL; 509 510 TRACE("pidl1=%p pidl2=%p\n",pidl1, pidl2); 511 512 /* explorer reads from registry directly (StreamMRU), 513 so we can only check here */ 514 if ((!pcheck (pidl1)) || (!pcheck (pidl2))) 515 return FALSE; 516 517 pdump (pidl1); 518 pdump (pidl2); 519 520 if ( _ILIsDesktop(pidl1) ) 521 { 522 ret = pidl2; 523 } 524 else 525 { 526 while (pidltemp1->mkid.cb && pidltemp2->mkid.cb) 527 { 528 _ILSimpleGetText(pidltemp1, szData1, MAX_PATH); 529 _ILSimpleGetText(pidltemp2, szData2, MAX_PATH); 530 531 if (strcasecmp(szData1,szData2)) 532 break; 533 534 pidltemp1 = ILGetNext(pidltemp1); 535 pidltemp2 = ILGetNext(pidltemp2); 536 ret = pidltemp2; 537 } 538 539 if (pidltemp1->mkid.cb) 540 { 541 ret = NULL; /* elements of pidl1 left*/ 542 } 543 } 544 TRACE_(shell)("--- %p\n", ret); 545 return ret; /* pidl 1 is shorter */ 547 546 } 548 547 … … 557 556 LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1,LPCITEMIDLIST pidl2) 558 557 { 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 558 DWORD len1,len2; 559 LPITEMIDLIST pidlNew; 560 561 TRACE("pidl=%p pidl=%p\n",pidl1,pidl2); 562 563 if(!pidl1 && !pidl2) return NULL; 564 565 pdump (pidl1); 566 pdump (pidl2); 567 568 if(!pidl1) 569 { 570 pidlNew = ILClone(pidl2); 571 return pidlNew; 572 } 573 574 if(!pidl2) 575 { 576 pidlNew = ILClone(pidl1); 577 return pidlNew; 578 } 579 580 len1 = ILGetSize(pidl1)-2; 581 len2 = ILGetSize(pidl2); 582 pidlNew = SHAlloc(len1+len2); 583 584 if (pidlNew) 585 { 586 memcpy(pidlNew,pidl1,len1); 587 memcpy(((BYTE *)pidlNew)+len1,pidl2,len2); 588 } 589 590 /* TRACE(pidl,"--new pidl=%p\n",pidlNew);*/ 591 return pidlNew; 593 592 } 594 593 /************************************************************************* … … 599 598 LPITEMIDLIST WINAPI SHGetRealIDL(LPSHELLFOLDER lpsf, LPITEMIDLIST pidl, DWORD z) 600 599 { 601 602 603 604 600 FIXME("sf=%p pidl=%p 0x%04lx\n",lpsf,pidl,z); 601 602 pdump (pidl); 603 return 0; 605 604 } 606 605 … … 609 608 * 610 609 * NOTES 611 * pild = CSIDL_DESKTOP 612 * pild = CSIDL_DRIVES 610 * pild = CSIDL_DESKTOP ret = 0 611 * pild = CSIDL_DRIVES ret = 0 613 612 */ 614 613 LPITEMIDLIST WINAPI SHLogILFromFSIL(LPITEMIDLIST pidl) 615 614 { 616 617 618 619 620 615 FIXME("(pidl=%p)\n",pidl); 616 617 pdump(pidl); 618 619 return 0; 621 620 } 622 621 … … 636 635 DWORD WINAPI ILGetSize(LPITEMIDLIST pidl) 637 636 { 638 639 640 641 642 { while (si->cb) 643 644 645 646 647 648 649 637 LPSHITEMID si = &(pidl->mkid); 638 DWORD len=0; 639 640 if (pidl) 641 { while (si->cb) 642 { len += si->cb; 643 si = (LPSHITEMID)(((LPBYTE)si)+si->cb); 644 } 645 len += 2; 646 } 647 TRACE("pidl=%p size=%lu\n",pidl, len); 648 return len; 650 649 } 651 650 … … 662 661 LPITEMIDLIST WINAPI ILGetNext(LPITEMIDLIST pidl) 663 662 { 664 665 666 667 668 669 670 671 672 673 674 675 676 677 663 WORD len; 664 665 TRACE("(pidl=%p)\n",pidl); 666 667 if(pidl) 668 { 669 len = pidl->mkid.cb; 670 if (len) 671 { 672 pidl = (LPITEMIDLIST) (((LPBYTE)pidl)+len); 673 return pidl; 674 } 675 } 676 return NULL; 678 677 } 679 678 /************************************************************************* … … 688 687 LPITEMIDLIST WINAPI ILAppend(LPITEMIDLIST pidl,LPCITEMIDLIST item,BOOL bEnd) 689 688 { 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 715 689 LPITEMIDLIST idlRet; 690 691 WARN("(pidl=%p,pidl=%p,%08u)semi-stub\n",pidl,item,bEnd); 692 693 pdump (pidl); 694 pdump (item); 695 696 if (_ILIsDesktop(pidl)) 697 { 698 idlRet = ILClone(item); 699 if (pidl) 700 SHFree (pidl); 701 return idlRet; 702 } 703 704 if (bEnd) 705 { 706 idlRet=ILCombine(pidl,item); 707 } 708 else 709 { 710 idlRet=ILCombine(item,pidl); 711 } 712 713 SHFree(pidl); 714 return idlRet; 716 715 } 717 716 /************************************************************************* … … 723 722 * exported by ordinal 724 723 */ 725 DWORD WINAPI ILFree(LPITEMIDLIST pidl) 726 { 727 728 729 730 731 724 DWORD WINAPI ILFree(LPITEMIDLIST pidl) 725 { 726 TRACE("(pidl=0x%08lx)\n",(DWORD)pidl); 727 728 if(!pidl) return FALSE; 729 SHFree(pidl); 730 return TRUE; 732 731 } 733 732 /************************************************************************* … … 737 736 void WINAPI ILGlobalFree( LPCITEMIDLIST pidl) 738 737 { 739 740 741 742 738 TRACE("%p\n",pidl); 739 740 if(!pidl) return; 741 pCOMCTL32_Free(pidl); 743 742 } 744 743 /************************************************************************* … … 746 745 * 747 746 */ 748 LPITEMIDLIST WINAPI ILCreateFromPathA (LPCSTR path) 749 { 750 751 752 753 754 755 756 757 758 } 759 LPITEMIDLIST WINAPI ILCreateFromPathW (LPCWSTR path) 760 { 761 762 763 764 765 766 767 768 769 } 770 LPITEMIDLIST WINAPI ILCreateFromPathAW (LPCVOID path) 771 { 772 773 774 747 LPITEMIDLIST WINAPI ILCreateFromPathA (LPCSTR path) 748 { 749 LPITEMIDLIST pidlnew; 750 DWORD attributes = 0; 751 752 TRACE_(shell)("%s\n",path); 753 754 if (SUCCEEDED (SHILCreateFromPathA (path, &pidlnew, &attributes))) 755 return pidlnew; 756 return FALSE; 757 } 758 LPITEMIDLIST WINAPI ILCreateFromPathW (LPCWSTR path) 759 { 760 LPITEMIDLIST pidlnew; 761 DWORD attributes = 0; 762 763 TRACE_(shell)("%s\n",debugstr_w(path)); 764 765 if (SUCCEEDED (SHILCreateFromPathW (path, &pidlnew, &attributes))) 766 return pidlnew; 767 return FALSE; 768 } 769 LPITEMIDLIST WINAPI ILCreateFromPathAW (LPCVOID path) 770 { 771 if ( SHELL_OsIsUnicode()) 772 return ILCreateFromPathW (path); 773 return ILCreateFromPathA (path); 775 774 } 776 775 /************************************************************************* … … 779 778 LPITEMIDLIST WINAPI SHSimpleIDListFromPathA (LPCSTR lpszPath) 780 779 { 781 LPITEMIDLISTpidl=NULL;782 HANDLEhFile;783 WIN32_FIND_DATAAstffile;784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 780 LPITEMIDLIST pidl=NULL; 781 HANDLE hFile; 782 WIN32_FIND_DATAA stffile; 783 784 TRACE("path=%s\n", lpszPath); 785 786 if (!lpszPath) return NULL; 787 788 hFile = FindFirstFileA(lpszPath, &stffile); 789 790 if ( hFile != INVALID_HANDLE_VALUE ) 791 { 792 if (stffile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) 793 { 794 pidl = _ILCreateFolder (&stffile); 795 } 796 else 797 { 798 pidl = _ILCreateValue (&stffile); 799 } 800 FindClose (hFile); 801 } 802 return pidl; 804 803 } 805 804 LPITEMIDLIST WINAPI SHSimpleIDListFromPathW (LPCWSTR lpszPath) 806 805 { 807 charlpszTemp[MAX_PATH];808 806 char lpszTemp[MAX_PATH]; 807 TRACE("path=%s\n",debugstr_w(lpszPath)); 809 808 810 809 if (!WideCharToMultiByte( CP_ACP, 0, lpszPath, -1, lpszTemp, sizeof(lpszTemp), NULL, NULL )) 811 810 lpszTemp[sizeof(lpszTemp)-1] = 0; 812 811 813 812 return SHSimpleIDListFromPathA (lpszTemp); 814 813 } 815 814 816 815 LPITEMIDLIST WINAPI SHSimpleIDListFromPathAW (LPCVOID lpszPath) 817 816 { 818 819 820 821 } 822 823 /************************************************************************* 824 * SHGetSpecialFolderLocation 817 if ( SHELL_OsIsUnicode()) 818 return SHSimpleIDListFromPathW (lpszPath); 819 return SHSimpleIDListFromPathA (lpszPath); 820 } 821 822 /************************************************************************* 823 * SHGetSpecialFolderLocation [SHELL32.223] 825 824 * 826 825 * gets the folder locations from the registry and creates a pidl 827 826 * creates missing reg keys and directorys 828 * 827 * 829 828 * PARAMS 830 829 * hwndOwner [I] … … 834 833 */ 835 834 HRESULT WINAPI SHGetSpecialFolderLocation( 836 837 838 839 { 840 CHARszPath[MAX_PATH];841 HRESULThr = E_INVALIDARG;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 886 835 HWND hwndOwner, 836 INT nFolder, 837 LPITEMIDLIST * ppidl) 838 { 839 CHAR szPath[MAX_PATH]; 840 HRESULT hr = E_INVALIDARG; 841 842 TRACE_(shell)("(%04x,0x%x,%p)\n", hwndOwner,nFolder,ppidl); 843 844 if (ppidl) 845 { 846 *ppidl = NULL; 847 switch (nFolder) 848 { 849 case CSIDL_DESKTOP: 850 *ppidl = _ILCreateDesktop(); 851 break; 852 853 case CSIDL_DRIVES: 854 *ppidl = _ILCreateMyComputer(); 855 break; 856 857 case CSIDL_NETWORK: 858 *ppidl = _ILCreateNetwork (); 859 break; 860 861 case CSIDL_CONTROLS: 862 *ppidl = _ILCreateControl (); 863 break; 864 865 case CSIDL_PRINTERS: 866 *ppidl = _ILCreatePrinter (); 867 break; 868 869 case CSIDL_BITBUCKET: 870 *ppidl = _ILCreateBitBucket (); 871 break; 872 873 default: 874 if (SHGetSpecialFolderPathA(hwndOwner, szPath, nFolder, TRUE)) 875 { 876 DWORD attributes=0; 877 TRACE_(shell)("Value=%s\n",szPath); 878 hr = SHILCreateFromPathA(szPath, ppidl, &attributes); 879 } 880 } 881 if(*ppidl) hr = NOERROR; 882 } 883 884 TRACE_(shell)("-- (new pidl %p)\n",*ppidl); 885 return hr; 887 886 } 888 887 … … 895 894 */ 896 895 HRESULT WINAPI SHGetFolderLocation( 897 898 899 900 901 902 { 903 904 905 896 HWND hwnd, 897 int csidl, 898 HANDLE hToken, 899 DWORD dwFlags, 900 LPITEMIDLIST *ppidl) 901 { 902 FIXME("0x%04x 0x%08x 0x%08x 0x%08lx %p\n", 903 hwnd, csidl, hToken, dwFlags, ppidl); 904 return SHGetSpecialFolderLocation(hwnd, csidl, ppidl); 906 905 } 907 906 … … 915 914 HRESULT WINAPI SHGetDataFromIDListA(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, int nFormat, LPVOID dest, int len) 916 915 { 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 948 916 TRACE_(shell)("sf=%p pidl=%p 0x%04x %p 0x%04x stub\n",psf,pidl,nFormat,dest,len); 917 918 pdump(pidl); 919 if (!psf || !dest ) return E_INVALIDARG; 920 921 switch (nFormat) 922 { 923 case SHGDFIL_FINDDATA: 924 { 925 WIN32_FIND_DATAA * pfd = dest; 926 927 if ( len < sizeof (WIN32_FIND_DATAA)) return E_INVALIDARG; 928 929 ZeroMemory(pfd, sizeof (WIN32_FIND_DATAA)); 930 _ILGetFileDateTime( pidl, &(pfd->ftLastWriteTime)); 931 pfd->dwFileAttributes = _ILGetFileAttributes(pidl, NULL, 0); 932 pfd->nFileSizeLow = _ILGetFileSize ( pidl, NULL, 0); 933 lstrcpynA(pfd->cFileName,_ILGetTextPointer(pidl), MAX_PATH); 934 lstrcpynA(pfd->cAlternateFileName,_ILGetSTextPointer(pidl), 14); 935 } 936 return NOERROR; 937 938 case SHGDFIL_NETRESOURCE: 939 case SHGDFIL_DESCRIPTIONID: 940 FIXME_(shell)("SHGDFIL %i stub\n", nFormat); 941 break; 942 943 default: 944 ERR_(shell)("Unknown SHGDFIL %i, please report\n", nFormat); 945 } 946 947 return E_INVALIDARG; 949 948 } 950 949 /************************************************************************* … … 954 953 HRESULT WINAPI SHGetDataFromIDListW(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, int nFormat, LPVOID dest, int len) 955 954 { 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 955 TRACE_(shell)("sf=%p pidl=%p 0x%04x %p 0x%04x stub\n",psf,pidl,nFormat,dest,len); 956 957 pdump(pidl); 958 959 if (! psf || !dest ) return E_INVALIDARG; 960 961 switch (nFormat) 962 { 963 case SHGDFIL_FINDDATA: 964 { 965 WIN32_FIND_DATAW * pfd = dest; 966 967 if ( len < sizeof (WIN32_FIND_DATAW)) return E_INVALIDARG; 968 969 ZeroMemory(pfd, sizeof (WIN32_FIND_DATAA)); 970 _ILGetFileDateTime( pidl, &(pfd->ftLastWriteTime)); 971 pfd->dwFileAttributes = _ILGetFileAttributes(pidl, NULL, 0); 972 pfd->nFileSizeLow = _ILGetFileSize ( pidl, NULL, 0); 974 973 if (!MultiByteToWideChar( CP_ACP, 0, _ILGetTextPointer(pidl), -1, 975 974 pfd->cFileName, MAX_PATH )) … … 978 977 pfd->cAlternateFileName, 14 )) 979 978 pfd->cFileName[13] = 0; 980 981 982 983 984 985 986 987 988 989 990 991 992 } 993 994 /************************************************************************* 995 * SHGetPathFromIDListA 979 } 980 return NOERROR; 981 case SHGDFIL_NETRESOURCE: 982 case SHGDFIL_DESCRIPTIONID: 983 FIXME_(shell)("SHGDFIL %i stub\n", nFormat); 984 break; 985 986 default: 987 ERR_(shell)("Unknown SHGDFIL %i, please report\n", nFormat); 988 } 989 990 return E_INVALIDARG; 991 } 992 993 /************************************************************************* 994 * SHGetPathFromIDListA [SHELL32.261][NT 4.0: SHELL32.220] 996 995 * 997 996 * PARAMETERS 998 * pidl, [IN] pidl 997 * pidl, [IN] pidl 999 998 * pszPath [OUT] path 1000 999 * 1001 * RETURNS 1000 * RETURNS 1002 1001 * path from a passed PIDL. 1003 1002 * 1004 1003 * NOTES 1005 * 1006 * 1007 * 1004 * NULL returns FALSE 1005 * desktop pidl gives path to desktopdirectory back 1006 * special pidls returning FALSE 1008 1007 * 1009 1008 * FIXME … … 1011 1010 */ 1012 1011 BOOL WINAPI SHGetPathFromIDListA (LPCITEMIDLIST pidl,LPSTR pszPath) 1013 { 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 SHGetSpecialFolderPathA(0, pszPath, CSIDL_DESKTOPDIRECTORY, FALSE); 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 } 1044 /************************************************************************* 1045 * SHGetPathFromIDListW 1012 { STRRET str; 1013 LPSHELLFOLDER shellfolder; 1014 1015 TRACE_(shell)("(pidl=%p,%p)\n",pidl,pszPath); 1016 1017 if (!pidl) return FALSE; 1018 1019 pdump(pidl); 1020 1021 if(_ILIsDesktop(pidl)) 1022 { 1023 SHGetSpecialFolderPathA(0, pszPath, CSIDL_DESKTOPDIRECTORY, FALSE); 1024 } 1025 else if (_ILIsSpecialFolder(ILFindLastID(pidl))) 1026 { 1027 /* we are somewhere in a special folder */ 1028 return FALSE; 1029 } 1030 else 1031 { 1032 if (SHGetDesktopFolder(&shellfolder)==S_OK) 1033 { 1034 IShellFolder_GetDisplayNameOf(shellfolder,pidl,SHGDN_FORPARSING,&str); 1035 StrRetToStrNA (pszPath, MAX_PATH, &str, pidl); 1036 IShellFolder_Release(shellfolder); 1037 } 1038 } 1039 TRACE_(shell)("-- (%s)\n",pszPath); 1040 1041 return TRUE; 1042 } 1043 /************************************************************************* 1044 * SHGetPathFromIDListW [SHELL32.262] 1046 1045 */ 1047 1046 BOOL WINAPI SHGetPathFromIDListW (LPCITEMIDLIST pidl,LPWSTR pszPath) 1048 { 1049 1050 1051 1052 1047 { char sTemp[MAX_PATH]; 1048 1049 TRACE_(shell)("(pidl=%p)\n", pidl); 1050 1051 SHGetPathFromIDListA (pidl, sTemp); 1053 1052 MultiByteToWideChar( CP_ACP, 0, sTemp, -1, pszPath, MAX_PATH ); 1054 1053 1055 1056 1057 1058 } 1059 1060 /************************************************************************* 1061 * SHBindToParent[shell version 5.0]1054 TRACE_(shell)("-- (%s)\n",debugstr_w(pszPath)); 1055 1056 return TRUE; 1057 } 1058 1059 /************************************************************************* 1060 * SHBindToParent [shell version 5.0] 1062 1061 */ 1063 1062 HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast) 1064 1063 { 1065 IShellFolder* psf;1066 LPITEMIDLISTpidlChild, pidlParent;1067 HRESULThr=E_FAIL;1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 if (ppidlLast) 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 /************************************************************************* 1108 * SHGetPathFromIDListAW 1064 IShellFolder * psf; 1065 LPITEMIDLIST pidlChild, pidlParent; 1066 HRESULT hr=E_FAIL; 1067 1068 TRACE_(shell)("pidl=%p\n", pidl); 1069 pdump(pidl); 1070 1071 *ppv = NULL; 1072 if (ppidlLast) *ppidlLast = NULL; 1073 1074 if (_ILIsPidlSimple(pidl)) 1075 { 1076 /* we are on desktop level */ 1077 if (ppidlLast) 1078 *ppidlLast = ILClone(pidl); 1079 hr = SHGetDesktopFolder((IShellFolder**)ppv); 1080 } 1081 else 1082 { 1083 pidlChild = ILClone(ILFindLastID(pidl)); 1084 pidlParent = ILClone(pidl); 1085 ILRemoveLastID(pidlParent); 1086 1087 hr = SHGetDesktopFolder(&psf); 1088 1089 if (SUCCEEDED(hr)) 1090 hr = IShellFolder_BindToObject(psf, pidlParent, NULL, riid, ppv); 1091 1092 if (SUCCEEDED(hr) && ppidlLast) 1093 *ppidlLast = pidlChild; 1094 else 1095 ILFree (pidlChild); 1096 1097 SHFree (pidlParent); 1098 if (psf) IShellFolder_Release(psf); 1099 } 1100 1101 1102 TRACE_(shell)("-- psf=%p pidl=%p ret=0x%08lx\n", *ppv, (ppidlLast)?*ppidlLast:NULL, hr); 1103 return hr; 1104 } 1105 1106 /************************************************************************* 1107 * SHGetPathFromIDListAW [SHELL32.221][NT 4.0: SHELL32.219] 1109 1108 */ 1110 1109 BOOL WINAPI SHGetPathFromIDListAW(LPCITEMIDLIST pidl,LPVOID pszPath) 1111 1110 { 1112 1113 1114 1115 1116 1111 TRACE_(shell)("(pidl=%p,%p)\n",pidl,pszPath); 1112 1113 if (SHELL_OsIsUnicode()) 1114 return SHGetPathFromIDListW(pidl,pszPath); 1115 return SHGetPathFromIDListA(pidl,pszPath); 1117 1116 } 1118 1117 1119 1118 /************************************************************************** 1120 1119 * 1121 * 1122 * 1123 * 1120 * internal functions 1121 * 1122 * ### 1. section creating pidls ### 1124 1123 * 1125 1124 ************************************************************************* … … 1128 1127 * _ILCreateMyComputer() 1129 1128 * _ILCreateDrive() 1130 * _ILCreateFolder() 1129 * _ILCreateFolder() 1131 1130 * _ILCreateValue() 1132 1131 */ 1133 1132 LPITEMIDLIST _ILCreateDesktop() 1134 { 1135 1133 { TRACE("()\n"); 1134 return _ILCreate(PT_DESKTOP, NULL, 0); 1136 1135 } 1137 1136 1138 1137 LPITEMIDLIST _ILCreateMyComputer() 1139 { 1140 1138 { TRACE("()\n"); 1139 return _ILCreate(PT_MYCOMP, &CLSID_MyComputer, sizeof(GUID)); 1141 1140 } 1142 1141 1143 1142 LPITEMIDLIST _ILCreateIExplore() 1144 { 1145 1143 { TRACE("()\n"); 1144 return _ILCreate(PT_MYCOMP, &CLSID_Internet, sizeof(GUID)); 1146 1145 } 1147 1146 1148 1147 LPITEMIDLIST _ILCreateControl() 1149 { 1150 1148 { TRACE("()\n"); 1149 return _ILCreate(PT_SPECIAL, &CLSID_ControlPanel, sizeof(GUID)); 1151 1150 } 1152 1151 1153 1152 LPITEMIDLIST _ILCreatePrinter() 1154 { 1155 1153 { TRACE("()\n"); 1154 return _ILCreate(PT_SPECIAL, &CLSID_Printers, sizeof(GUID)); 1156 1155 } 1157 1156 1158 1157 LPITEMIDLIST _ILCreateNetwork() 1159 { 1160 1158 { TRACE("()\n"); 1159 return _ILCreate(PT_MYCOMP, &CLSID_NetworkPlaces, sizeof(GUID)); 1161 1160 } 1162 1161 1163 1162 LPITEMIDLIST _ILCreateBitBucket() 1164 { 1165 1163 { TRACE("()\n"); 1164 return _ILCreate(PT_MYCOMP, &CLSID_RecycleBin, sizeof(GUID)); 1166 1165 } 1167 1166 1168 1167 LPITEMIDLIST _ILCreateDrive( LPCSTR lpszNew) 1169 { 1170 1171 1172 1173 1174 1168 { char sTemp[4]; 1169 lstrcpynA (sTemp,lpszNew,4); 1170 sTemp[2]='\\'; 1171 sTemp[3]=0x00; 1172 TRACE("(%s)\n",sTemp); 1173 return _ILCreate(PT_DRIVE,(LPVOID)&sTemp[0],4); 1175 1174 } 1176 1175 1177 1176 LPITEMIDLIST _ILCreateFolder( WIN32_FIND_DATAA * stffile ) 1178 1177 { 1179 charbuff[MAX_PATH + 14 +1]; /* see WIN32_FIND_DATA */1180 char *pbuff = buff;1181 ULONGlen, len1;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 1214 1178 char buff[MAX_PATH + 14 +1]; /* see WIN32_FIND_DATA */ 1179 char * pbuff = buff; 1180 ULONG len, len1; 1181 LPITEMIDLIST pidl; 1182 1183 TRACE("(%s, %s)\n",stffile->cAlternateFileName, stffile->cFileName); 1184 1185 /* prepare buffer with both names */ 1186 len = strlen (stffile->cFileName) + 1; 1187 memcpy (pbuff, stffile->cFileName, len); 1188 pbuff += len; 1189 1190 if (stffile->cAlternateFileName) 1191 { 1192 len1 = strlen (stffile->cAlternateFileName)+1; 1193 memcpy (pbuff, stffile->cAlternateFileName, len1); 1194 } 1195 else 1196 { 1197 len1 = 1; 1198 *pbuff = 0x00; 1199 } 1200 1201 pidl = _ILCreate(PT_FOLDER, (LPVOID)buff, len + len1); 1202 1203 /* set attributes */ 1204 if (pidl) 1205 { 1206 LPPIDLDATA pData; 1207 pData = _ILGetDataPointer(pidl); 1208 FileTimeToDosDateTime(&(stffile->ftLastWriteTime),&pData->u.folder.uFileDate,&pData->u.folder.uFileTime); 1209 pData->u.folder.dwFileSize = stffile->nFileSizeLow; 1210 pData->u.folder.uFileAttribs=stffile->dwFileAttributes; 1211 } 1212 1213 return pidl; 1215 1214 } 1216 1215 1217 1216 LPITEMIDLIST _ILCreateValue(WIN32_FIND_DATAA * stffile) 1218 1217 { 1219 charbuff[MAX_PATH + 14 +1]; /* see WIN32_FIND_DATA */1220 char *pbuff = buff;1221 ULONGlen, len1;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 1254 1218 char buff[MAX_PATH + 14 +1]; /* see WIN32_FIND_DATA */ 1219 char * pbuff = buff; 1220 ULONG len, len1; 1221 LPITEMIDLIST pidl; 1222 1223 TRACE("(%s, %s)\n",stffile->cAlternateFileName, stffile->cFileName); 1224 1225 /* prepare buffer with both names */ 1226 len = strlen (stffile->cFileName) + 1; 1227 memcpy (pbuff, stffile->cFileName, len); 1228 pbuff += len; 1229 1230 if (stffile->cAlternateFileName) 1231 { 1232 len1 = strlen (stffile->cAlternateFileName)+1; 1233 memcpy (pbuff, stffile->cAlternateFileName, len1); 1234 } 1235 else 1236 { 1237 len1 = 1; 1238 *pbuff = 0x00; 1239 } 1240 1241 pidl = _ILCreate(PT_VALUE, (LPVOID)buff, len + len1); 1242 1243 /* set attributes */ 1244 if (pidl) 1245 { 1246 LPPIDLDATA pData; 1247 pData = _ILGetDataPointer(pidl); 1248 FileTimeToDosDateTime(&(stffile->ftLastWriteTime),&pData->u.folder.uFileDate,&pData->u.folder.uFileTime); 1249 pData->u.folder.dwFileSize = stffile->nFileSizeLow; 1250 pData->u.folder.uFileAttribs=stffile->dwFileAttributes; 1251 } 1252 1253 return pidl; 1255 1254 } 1256 1255 … … 1276 1275 LPITEMIDLIST _ILCreate(PIDLTYPE type, LPCVOID pIn, UINT uInSize) 1277 1276 { 1278 1279 1280 1281 LPSTRpszDest;1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 case PT_VALUE: 1299 1300 1301 1302 FIXME("can't create type: 0x%08x\n",type); 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 1333 case PT_VALUE: 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1277 LPITEMIDLIST pidlOut = NULL, pidlTemp = NULL; 1278 LPPIDLDATA pData; 1279 UINT uSize = 0; 1280 LPSTR pszDest; 1281 1282 TRACE("(0x%02x %p %i)\n",type,pIn,uInSize); 1283 1284 switch (type) 1285 { 1286 case PT_DESKTOP: 1287 uSize = 0; 1288 break; 1289 case PT_SPECIAL: 1290 case PT_MYCOMP: 1291 uSize = 2 + 2 + sizeof(GUID); 1292 break; 1293 case PT_DRIVE: 1294 uSize = 2 + 23; 1295 break; 1296 case PT_FOLDER: 1297 case PT_VALUE: 1298 uSize = 2 + 12 + uInSize; 1299 break; 1300 default: 1301 FIXME("can't create type: 0x%08x\n",type); 1302 return NULL; 1303 } 1304 1305 if(!(pidlOut = SHAlloc(uSize + 2))) return NULL; 1306 ZeroMemory(pidlOut, uSize + 2); 1307 pidlOut->mkid.cb = uSize; 1308 1309 switch (type) 1310 { 1311 case PT_DESKTOP: 1312 TRACE("- create Desktop\n"); 1313 break; 1314 1315 case PT_SPECIAL: 1316 case PT_MYCOMP: 1317 pData =_ILGetDataPointer(pidlOut); 1318 pData->type = type; 1319 memcpy(&(pData->u.mycomp.guid), pIn, uInSize); 1320 TRACE("- create GUID-pidl\n"); 1321 break; 1322 1323 case PT_DRIVE: 1324 pData =_ILGetDataPointer(pidlOut); 1325 pData->type = type; 1326 pszDest = _ILGetTextPointer(pidlOut); 1327 memcpy(pszDest, pIn, uInSize); 1328 TRACE("- create Drive: %s\n",debugstr_a(pszDest)); 1329 break; 1330 1331 case PT_FOLDER: 1332 case PT_VALUE: 1333 pData =_ILGetDataPointer(pidlOut); 1334 pData->type = type; 1335 pszDest = _ILGetTextPointer(pidlOut); 1336 memcpy(pszDest, pIn, uInSize); 1337 TRACE("- create Value: %s\n",debugstr_a(pszDest)); 1338 break; 1339 } 1340 1341 pidlTemp = ILGetNext(pidlOut); 1342 if (pidlTemp) 1343 pidlTemp->mkid.cb = 0x00; 1344 1345 TRACE("-- (pidl=%p, size=%u)\n", pidlOut, uSize); 1346 return pidlOut; 1348 1347 } 1349 1348 … … 1357 1356 */ 1358 1357 DWORD _ILGetDrive(LPCITEMIDLIST pidl,LPSTR pOut, UINT uSize) 1359 { 1360 1361 1362 1363 1364 1365 1366 1367 1358 { TRACE("(%p,%p,%u)\n",pidl,pOut,uSize); 1359 1360 if(_ILIsMyComputer(pidl)) 1361 pidl = ILGetNext(pidl); 1362 1363 if (pidl && _ILIsDrive(pidl)) 1364 return _ILSimpleGetText(pidl, pOut, uSize); 1365 1366 return 0; 1368 1367 } 1369 1368 1370 1369 /************************************************************************** 1371 1370 * 1372 * 1371 * ### 2. section testing pidls ### 1373 1372 * 1374 1373 ************************************************************************** … … 1382 1381 */ 1383 1382 BOOL _ILIsDesktop(LPCITEMIDLIST pidl) 1384 { 1385 1383 { TRACE("(%p)\n",pidl); 1384 return ( !pidl || (pidl && pidl->mkid.cb == 0x00) ); 1386 1385 } 1387 1386 1388 1387 BOOL _ILIsMyComputer(LPCITEMIDLIST pidl) 1389 1388 { 1390 1391 1392 1393 1394 1395 1396 1389 REFIID iid = _ILGetGUIDPointer(pidl); 1390 1391 TRACE("(%p)\n",pidl); 1392 1393 if (iid) 1394 return IsEqualIID(iid, &CLSID_MyComputer); 1395 return FALSE; 1397 1396 } 1398 1397 1399 1398 BOOL _ILIsSpecialFolder (LPCITEMIDLIST pidl) 1400 1399 { 1401 1402 1403 return (pidl && ( (lpPData && (PT_MYCOMP== lpPData->type || PT_SPECIAL== lpPData->type)) || 1404 1405 1400 LPPIDLDATA lpPData = _ILGetDataPointer(pidl); 1401 TRACE("(%p)\n",pidl); 1402 return (pidl && ( (lpPData && (PT_MYCOMP== lpPData->type || PT_SPECIAL== lpPData->type)) || 1403 (pidl && pidl->mkid.cb == 0x00) 1404 )); 1406 1405 } 1407 1406 1408 1407 BOOL _ILIsDrive(LPCITEMIDLIST pidl) 1409 { 1410 1411 1412 1413 1414 1408 { LPPIDLDATA lpPData = _ILGetDataPointer(pidl); 1409 TRACE("(%p)\n",pidl); 1410 return (pidl && lpPData && (PT_DRIVE == lpPData->type || 1411 PT_DRIVE1 == lpPData->type || 1412 PT_DRIVE2 == lpPData->type || 1413 PT_DRIVE3 == lpPData->type)); 1415 1414 } 1416 1415 1417 1416 BOOL _ILIsFolder(LPCITEMIDLIST pidl) 1418 { 1419 1420 1417 { LPPIDLDATA lpPData = _ILGetDataPointer(pidl); 1418 TRACE("(%p)\n",pidl); 1419 return (pidl && lpPData && (PT_FOLDER == lpPData->type || PT_FOLDER1 == lpPData->type)); 1421 1420 } 1422 1421 1423 1422 BOOL _ILIsValue(LPCITEMIDLIST pidl) 1424 { 1425 1426 1423 { LPPIDLDATA lpPData = _ILGetDataPointer(pidl); 1424 TRACE("(%p)\n",pidl); 1425 return (pidl && lpPData && PT_VALUE == lpPData->type); 1427 1426 } 1428 1427 1429 1428 /************************************************************************** 1430 * 1429 * _ILIsPidlSimple 1431 1430 */ 1432 1431 BOOL _ILIsPidlSimple ( LPCITEMIDLIST pidl) 1433 1432 { 1434 1435 1436 if(! _ILIsDesktop(pidl))/* pidl=NULL or mkid.cb=0 */1437 1438 1439 1440 1441 1442 1443 1444 1445 1433 BOOL ret = TRUE; 1434 1435 if(! _ILIsDesktop(pidl)) /* pidl=NULL or mkid.cb=0 */ 1436 { 1437 WORD len = pidl->mkid.cb; 1438 LPCITEMIDLIST pidlnext = (LPCITEMIDLIST) (((LPBYTE)pidl) + len ); 1439 if (pidlnext->mkid.cb) 1440 ret = FALSE; 1441 } 1442 1443 TRACE("%s\n", ret ? "Yes" : "No"); 1444 return ret; 1446 1445 } 1447 1446 1448 1447 /************************************************************************** 1449 1448 * 1450 * 1449 * ### 3. section getting values from pidls ### 1451 1450 */ 1452 1451 … … 1460 1459 DWORD _ILSimpleGetText (LPCITEMIDLIST pidl, LPSTR szOut, UINT uOutSize) 1461 1460 { 1462 DWORD dwReturn=0; 1463 LPSTRszSrc;1464 GUID const *riid;1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 if (_ILIsDesktop(pidl)) 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 1510 1461 DWORD dwReturn=0; 1462 LPSTR szSrc; 1463 GUID const * riid; 1464 char szTemp[MAX_PATH]; 1465 1466 TRACE("(%p %p %x)\n",pidl,szOut,uOutSize); 1467 1468 if (!pidl) return 0; 1469 1470 if (szOut) 1471 *szOut = 0; 1472 1473 if (_ILIsDesktop(pidl)) 1474 { 1475 /* desktop */ 1476 if (HCR_GetClassName(&CLSID_ShellDesktop, szTemp, MAX_PATH)) 1477 { 1478 if (szOut) 1479 lstrcpynA(szOut, szTemp, uOutSize); 1480 1481 dwReturn = strlen (szTemp); 1482 } 1483 } 1484 else if (( szSrc = _ILGetTextPointer(pidl) )) 1485 { 1486 /* filesystem */ 1487 if (szOut) 1488 lstrcpynA(szOut, szSrc, uOutSize); 1489 1490 dwReturn = strlen(szSrc); 1491 } 1492 else if (( riid = _ILGetGUIDPointer(pidl) )) 1493 { 1494 /* special folder */ 1495 if ( HCR_GetClassName(riid, szTemp, MAX_PATH) ) 1496 { 1497 if (szOut) 1498 lstrcpynA(szOut, szTemp, uOutSize); 1499 1500 dwReturn = strlen (szTemp); 1501 } 1502 } 1503 else 1504 { 1505 ERR("-- no text\n"); 1506 } 1507 1508 TRACE("-- (%p=%s 0x%08lx)\n",szOut,(char*)szOut,dwReturn); 1509 return dwReturn; 1511 1510 } 1512 1511 1513 1512 /************************************************************************** 1514 1513 * 1515 * 1514 * ### 4. getting pointers to parts of pidls ### 1516 1515 * 1517 1516 ************************************************************************** … … 1520 1519 LPPIDLDATA _ILGetDataPointer(LPITEMIDLIST pidl) 1521 1520 { 1522 1523 1524 1521 if(pidl && pidl->mkid.cb != 0x00) 1522 return (LPPIDLDATA) &(pidl->mkid.abID); 1523 return NULL; 1525 1524 } 1526 1525 … … 1530 1529 */ 1531 1530 LPSTR _ILGetTextPointer(LPCITEMIDLIST pidl) 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 1564 1531 {/* TRACE(pidl,"(pidl%p)\n", pidl);*/ 1532 1533 LPPIDLDATA pdata =_ILGetDataPointer(pidl); 1534 1535 if (pdata) 1536 { 1537 switch (pdata->type) 1538 { 1539 case PT_MYCOMP: 1540 case PT_SPECIAL: 1541 return NULL; 1542 1543 case PT_DRIVE: 1544 case PT_DRIVE1: 1545 case PT_DRIVE2: 1546 case PT_DRIVE3: 1547 return (LPSTR)&(pdata->u.drive.szDriveName); 1548 1549 case PT_FOLDER: 1550 case PT_FOLDER1: 1551 case PT_VALUE: 1552 case PT_IESPECIAL1: 1553 case PT_IESPECIAL2: 1554 return (LPSTR)&(pdata->u.file.szNames); 1555 1556 case PT_WORKGRP: 1557 case PT_COMP: 1558 case PT_NETWORK: 1559 case PT_SHARE: 1560 return (LPSTR)&(pdata->u.network.szNames); 1561 } 1562 } 1563 return NULL; 1565 1564 } 1566 1565 … … 1570 1569 */ 1571 1570 LPSTR _ILGetSTextPointer(LPCITEMIDLIST pidl) 1572 {/* 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1571 {/* TRACE(pidl,"(pidl%p)\n", pidl);*/ 1572 1573 LPPIDLDATA pdata =_ILGetDataPointer(pidl); 1574 1575 if (pdata) 1576 { 1577 switch (pdata->type) 1578 { 1579 case PT_FOLDER: 1580 case PT_VALUE: 1581 case PT_IESPECIAL1: 1582 case PT_IESPECIAL2: 1583 return (LPSTR)(pdata->u.file.szNames + strlen (pdata->u.file.szNames) + 1); 1584 1585 case PT_WORKGRP: 1586 return (LPSTR)(pdata->u.network.szNames + strlen (pdata->u.network.szNames) + 1); 1587 } 1588 } 1589 return NULL; 1591 1590 } 1592 1591 … … 1598 1597 REFIID _ILGetGUIDPointer(LPCITEMIDLIST pidl) 1599 1598 { 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1599 LPPIDLDATA pdata =_ILGetDataPointer(pidl); 1600 1601 if (pdata) 1602 { 1603 switch (pdata->type) 1604 { 1605 case PT_SPECIAL: 1606 case PT_MYCOMP: 1607 return (REFIID) &(pdata->u.mycomp.guid); 1608 } 1609 } 1610 return NULL; 1612 1611 } 1613 1612 … … 1625 1624 * 1626 1625 * NOTES 1627 * 1626 * 1628 1627 */ 1629 1628 BOOL _ILGetFileDateTime(LPCITEMIDLIST pidl, FILETIME *pFt) … … 1634 1633 1635 1634 switch (pdata->type) 1636 { 1635 { 1637 1636 case PT_FOLDER: 1638 1637 DosDateTimeToFileTime(pdata->u.folder.uFileDate, pdata->u.folder.uFileTime, pFt); 1639 break; 1638 break; 1640 1639 case PT_VALUE: 1641 1640 DosDateTimeToFileTime(pdata->u.file.uFileDate, pdata->u.file.uFileTime, pFt); … … 1648 1647 1649 1648 BOOL _ILGetFileDate (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize) 1650 { 1651 1652 1653 1654 1655 1656 1657 1658 1649 { 1650 FILETIME ft,lft; 1651 SYSTEMTIME time; 1652 1653 if (! _ILGetFileDateTime( pidl, &ft )) return FALSE; 1654 1655 FileTimeToLocalFileTime(&ft, &lft); 1656 FileTimeToSystemTime (&lft, &time); 1657 return GetDateFormatA(LOCALE_USER_DEFAULT,DATE_SHORTDATE,&time, NULL, pOut, uOutSize); 1659 1658 } 1660 1659 … … 1666 1665 * PARAMS 1667 1666 * pidl [I] The ItemIDList 1668 * pOut[I] The buffer to save the result1667 * pOut [I] The buffer to save the result 1669 1668 * uOutsize [I] The size of the buffer 1670 1669 * … … 1673 1672 * 1674 1673 * NOTES 1675 * 1676 * 1674 * pOut can be null when no string is needed 1675 * 1677 1676 */ 1678 1677 DWORD _ILGetFileSize (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize) 1679 1678 { 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1679 LPPIDLDATA pdata =_ILGetDataPointer(pidl); 1680 DWORD dwSize; 1681 1682 if(! pdata) return 0; 1683 1684 switch (pdata->type) 1685 { 1686 case PT_VALUE: 1687 dwSize = pdata->u.file.dwFileSize; 1688 if (pOut) StrFormatByteSizeA(dwSize, pOut, uOutSize); 1689 return dwSize; 1690 } 1691 if (pOut) *pOut = 0x00; 1692 return 0; 1694 1693 } 1695 1694 1696 1695 BOOL _ILGetExtension (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize) 1697 1696 { 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1697 char szTemp[MAX_PATH]; 1698 const char * pPoint; 1699 LPITEMIDLIST pidlTemp=pidl; 1700 1701 TRACE("pidl=%p\n",pidl); 1702 1703 if (!pidl) return FALSE; 1704 1705 pidlTemp = ILFindLastID(pidl); 1706 1707 if (!_ILIsValue(pidlTemp)) return FALSE; 1708 if (!_ILSimpleGetText(pidlTemp, szTemp, MAX_PATH)) return FALSE; 1709 1710 pPoint = PathFindExtensionA(szTemp); 1711 1712 if (! *pPoint) return FALSE; 1713 1714 pPoint++; 1715 lstrcpynA(pOut, pPoint, uOutSize); 1716 TRACE("%s\n",pOut); 1717 1718 return TRUE; 1720 1719 } 1721 1720 … … 1731 1730 * 1732 1731 * RETURNS 1733 * 1734 * 1735 * NOTES 1736 * This function copies as much as possible into the buffer.1732 * nothing 1733 * 1734 * NOTES 1735 * This function copies as much as possible into the buffer. 1737 1736 */ 1738 1737 void _ILGetFileType(LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize) 1739 1738 { 1740 1741 1742 1739 if(_ILIsValue(pidl)) 1740 { 1741 char sTemp[64]; 1743 1742 if(uOutSize > 0) 1744 1743 { 1745 1744 pOut[0] = 0; 1746 1745 } 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1746 if (_ILGetExtension (pidl, sTemp, 64)) 1747 { 1748 if (!( HCR_MapTypeToValue(sTemp, sTemp, 64, TRUE) 1749 && HCR_MapTypeToValue(sTemp, pOut, uOutSize, FALSE ))) 1750 { 1751 lstrcpynA (pOut, sTemp, uOutSize - 6); 1752 strcat (pOut, "-file"); 1753 } 1754 } 1755 } 1756 else 1757 { 1758 lstrcpynA(pOut, "Folder", uOutSize); 1759 } 1761 1760 } 1762 1761 … … 1776 1775 * FIXME 1777 1776 * return value 0 in case of error is a valid return value 1778 * 1777 * 1779 1778 */ 1780 1779 DWORD _ILGetFileAttributes(LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize) 1781 1780 { 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 1823 1781 LPPIDLDATA pData =_ILGetDataPointer(pidl); 1782 WORD wAttrib = 0; 1783 int i; 1784 1785 if(! pData) return 0; 1786 1787 switch(pData->type) 1788 { 1789 case PT_FOLDER: 1790 wAttrib = pData->u.folder.uFileAttribs; 1791 break; 1792 case PT_VALUE: 1793 wAttrib = pData->u.file.uFileAttribs; 1794 break; 1795 } 1796 1797 if(uOutSize >= 6) 1798 { 1799 i=0; 1800 if(wAttrib & FILE_ATTRIBUTE_READONLY) 1801 { 1802 pOut[i++] = 'R'; 1803 } 1804 if(wAttrib & FILE_ATTRIBUTE_HIDDEN) 1805 { 1806 pOut[i++] = 'H'; 1807 } 1808 if(wAttrib & FILE_ATTRIBUTE_SYSTEM) 1809 { 1810 pOut[i++] = 'S'; 1811 } 1812 if(wAttrib & FILE_ATTRIBUTE_ARCHIVE) 1813 { 1814 pOut[i++] = 'A'; 1815 } 1816 if(wAttrib & FILE_ATTRIBUTE_COMPRESSED) 1817 { 1818 pOut[i++] = 'C'; 1819 } 1820 pOut[i] = 0x00; 1821 } 1822 return wAttrib; 1824 1823 } 1825 1824 … … 1831 1830 void _ILFreeaPidl(LPITEMIDLIST * apidl, UINT cidl) 1832 1831 { 1833 1834 1835 1836 1837 1838 1839 1832 int i; 1833 1834 if(apidl) 1835 { 1836 for(i = 0; i < cidl; i++) SHFree(apidl[i]); 1837 SHFree(apidl); 1838 } 1840 1839 } 1841 1840 … … 1847 1846 LPITEMIDLIST * _ILCopyaPidl(LPITEMIDLIST * apidlsrc, UINT cidl) 1848 1847 { 1849 1850 1851 1852 1853 1854 1855 1856 1848 int i; 1849 LPITEMIDLIST * apidldest = (LPITEMIDLIST*)SHAlloc(cidl * sizeof(LPITEMIDLIST)); 1850 if(!apidlsrc) return NULL; 1851 1852 for(i = 0; i < cidl; i++) 1853 apidldest[i] = ILClone(apidlsrc[i]); 1854 1855 return apidldest; 1857 1856 } 1858 1857 … … 1864 1863 LPITEMIDLIST * _ILCopyCidaToaPidl(LPITEMIDLIST* pidl, LPCIDA cida) 1865 1864 { 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 } 1865 int i; 1866 LPITEMIDLIST * dst = (LPITEMIDLIST*)SHAlloc(cida->cidl * sizeof(LPITEMIDLIST)); 1867 1868 if(!dst) return NULL; 1869 1870 if (pidl) 1871 *pidl = ILClone((LPITEMIDLIST)(&((LPBYTE)cida)[cida->aoffset[0]])); 1872 1873 for(i = 0; i < cida->cidl; i++) 1874 dst[i] = ILClone((LPITEMIDLIST)(&((LPBYTE)cida)[cida->aoffset[i + 1]])); 1875 1876 return dst; 1877 } -
trunk/src/shell32/shell32_main.h
r5618 r6709 1 /* $Id: shell32_main.h,v 1. 9 2001-04-28 13:33:45sandervl Exp $ */1 /* $Id: shell32_main.h,v 1.10 2001-09-15 09:26:23 sandervl Exp $ */ 2 2 /* 3 3 * internal Shell32 Library definitions … … 20 20 #ifdef __WIN32OS2__ 21 21 #include <heapstring.h> 22 23 #undef FIXME 24 #undef TRACE 25 #ifdef DEBUG 26 #define TRACE WriteLog("SHELL32: %s", __FUNCTION__); WriteLog 27 #define FIXME WriteLog("SHELL32: FIXME %s", __FUNCTION__); WriteLog 28 #else 29 #define TRACE 1 ? (void)0 : (void)((int (*)(char *, ...)) NULL) 30 #define FIXME 1 ? (void)0 : (void)((int (*)(char *, ...)) NULL) 31 #endif 32 22 33 #endif 23 34 /******************************************* -
trunk/src/shell32/shelllink.c
r6650 r6709 1 /* $Id: shelllink.c,v 1.8 2001-09-05 13:46:57 bird Exp $ */2 1 /* 3 2 * 4 * Copyright 1997Marcus Meissner5 * Copyright 1998Juergen Schmied3 * Copyright 1997 Marcus Meissner 4 * Copyright 1998 Juergen Schmied 6 5 * 7 6 */ … … 58 57 59 58 /* flag1: lnk elements: simple link has 0x0B */ 60 #define WORKDIR0x1061 #define ARGUMENT0x2062 #define ICON0x4063 #define UNC 59 #define WORKDIR 0x10 60 #define ARGUMENT 0x20 61 #define ICON 0x40 62 #define UNC 0x80 64 63 65 64 /* fStartup */ 66 #define NORMAL0x0167 #define MAXIMIZED0x0368 #define MINIMIZED0x0769 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 */65 #define NORMAL 0x01 66 #define MAXIMIZED 0x03 67 #define MINIMIZED 0x07 68 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 */ 86 85 } LINK_HEADER, * PLINK_HEADER; 87 86 … … 90 89 typedef struct 91 90 { 92 93 94 95 96 97 98 99 91 BYTE bWidth; 92 BYTE bHeight; 93 BYTE bColorCount; 94 BYTE bReserved; 95 WORD wPlanes; 96 WORD wBitCount; 97 DWORD dwBytesInRes; 98 WORD nID; 100 99 } GRPICONDIRENTRY; 101 100 102 101 typedef struct 103 102 { 104 105 106 107 103 WORD idReserved; 104 WORD idType; 105 WORD idCount; 106 GRPICONDIRENTRY idEntries[1]; 108 107 } GRPICONDIR; 109 108 110 109 typedef struct 111 110 { 112 113 114 115 116 117 118 119 111 BYTE bWidth; 112 BYTE bHeight; 113 BYTE bColorCount; 114 BYTE bReserved; 115 WORD wPlanes; 116 WORD wBitCount; 117 DWORD dwBytesInRes; 118 DWORD dwImageOffset; 120 119 } ICONDIRENTRY; 121 120 122 121 typedef struct 123 122 { 124 125 126 123 WORD idReserved; 124 WORD idType; 125 WORD idCount; 127 126 } ICONDIR; 128 127 … … 131 130 132 131 133 static ICOM_VTABLE(IShellLinkA) 134 static ICOM_VTABLE(IShellLinkW) 135 static ICOM_VTABLE(IPersistFile) 136 static ICOM_VTABLE(IPersistStream) 132 static ICOM_VTABLE(IShellLinkA) slvt; 133 static ICOM_VTABLE(IShellLinkW) slvtw; 134 static ICOM_VTABLE(IPersistFile) pfvt; 135 static ICOM_VTABLE(IPersistStream) psvt; 137 136 138 137 /* IShellLink Implementation */ … … 140 139 typedef struct 141 140 { 142 143 DWORDref;144 145 ICOM_VTABLE(IShellLinkW)*lpvtblw;146 ICOM_VTABLE(IPersistFile)*lpvtblPersistFile;147 ICOM_VTABLE(IPersistStream)*lpvtblPersistStream;148 149 150 IStream*lpFileStream;151 152 153 LPSTRsPath;154 LPITEMIDLISTpPidl;155 WORDwHotKey;156 SYSTEMTIMEtime1;157 SYSTEMTIMEtime2;158 SYSTEMTIMEtime3;159 160 LPSTRsIcoPath;161 INTiIcoNdx;162 LPSTRsArgs;163 LPSTRsWorkDir;164 LPSTRsDescription;141 ICOM_VFIELD(IShellLinkA); 142 DWORD ref; 143 144 ICOM_VTABLE(IShellLinkW)* lpvtblw; 145 ICOM_VTABLE(IPersistFile)* lpvtblPersistFile; 146 ICOM_VTABLE(IPersistStream)* lpvtblPersistStream; 147 148 /* internal stream of the IPersistFile interface */ 149 IStream* lpFileStream; 150 151 /* data structures according to the informations in the lnk */ 152 LPSTR sPath; 153 LPITEMIDLIST pPidl; 154 WORD wHotKey; 155 SYSTEMTIME time1; 156 SYSTEMTIME time2; 157 SYSTEMTIME time3; 158 159 LPSTR sIcoPath; 160 INT iIcoNdx; 161 LPSTR sArgs; 162 LPSTR sWorkDir; 163 LPSTR sDescription; 165 164 } IShellLinkImpl; 166 165 … … 179 178 */ 180 179 static HRESULT WINAPI IPersistFile_fnQueryInterface( 181 182 183 184 { 185 186 187 188 189 180 IPersistFile* iface, 181 REFIID riid, 182 LPVOID *ppvObj) 183 { 184 _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface) 185 186 TRACE("(%p)\n",This); 187 188 return IShellLinkA_QueryInterface((IShellLinkA*)This, riid, ppvObj); 190 189 } 191 190 … … 195 194 static ULONG WINAPI IPersistFile_fnAddRef(IPersistFile* iface) 196 195 { 197 198 199 200 201 196 _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface) 197 198 TRACE("(%p)->(count=%lu)\n",This,This->ref); 199 200 return IShellLinkA_AddRef((IShellLinkA*)This); 202 201 } 203 202 /****************************************************************************** … … 206 205 static ULONG WINAPI IPersistFile_fnRelease(IPersistFile* iface) 207 206 { 208 209 210 211 212 207 _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface) 208 209 TRACE("(%p)->(count=%lu)\n",This,This->ref); 210 211 return IShellLinkA_Release((IShellLinkA*)This); 213 212 } 214 213 215 214 static HRESULT WINAPI IPersistFile_fnGetClassID(IPersistFile* iface, CLSID *pClassID) 216 215 { 217 218 219 216 _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface) 217 FIXME("(%p)\n",This); 218 return NOERROR; 220 219 } 221 220 static HRESULT WINAPI IPersistFile_fnIsDirty(IPersistFile* iface) 222 221 { 223 224 225 222 _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface) 223 FIXME("(%p)\n",This); 224 return NOERROR; 226 225 } 227 226 static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile* iface, LPCOLESTR pszFileName, DWORD dwMode) 228 227 { 229 230 231 232 LPSTRsFile = HEAP_strdupWtoA ( GetProcessHeap(), 0, pszFileName);233 HRESULThRet = E_FAIL;234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 228 _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface) 229 _IPersistStream_From_ICOM_THIS(IPersistStream, This) 230 231 LPSTR sFile = HEAP_strdupWtoA ( GetProcessHeap(), 0, pszFileName); 232 HRESULT hRet = E_FAIL; 233 234 TRACE("(%p, %s)\n",This, sFile); 235 236 237 if (This->lpFileStream) 238 IStream_Release(This->lpFileStream); 239 240 if SUCCEEDED(CreateStreamOnFile(sFile, &(This->lpFileStream))) 241 { 242 if SUCCEEDED (IPersistStream_Load(StreamThis, This->lpFileStream)) 243 { 244 return NOERROR; 245 } 246 } 247 248 return hRet; 250 249 } 251 250 252 251 253 252 #ifdef __WIN32OS2__ 254 static BOOL SaveIconResAsOS2ICO(GRPICONDIR *pIconDir, HINSTANCE hInstance, 253 static BOOL SaveIconResAsOS2ICO(GRPICONDIR *pIconDir, HINSTANCE hInstance, 255 254 const char *szXPMFileName) 256 255 { … … 395 394 #ifdef __WIN32OS2__ 396 395 if(!hResInfo) { 397 hResInfo = FindResourceA(hModule, MAKEINTRESOURCEA(nIndex), RT_ICONA); 396 hResInfo = FindResourceA(hModule, MAKEINTRESOURCEA(nIndex), RT_ICONA); 398 397 if(hResInfo) { 399 398 GRPICONDIR icondir = {0}; 400 399 BITMAPINFO *bmi; 401 400 402 401 bmi = (BITMAPINFO *)LockResource(LoadResource(hModule, hResInfo)); 403 402 404 403 icondir.idReserved = 0; … … 685 684 tmp[3] = 'O'; 686 685 /* extract the icon */ 687 if (!extract_icon( This->sIcoPath && strlen(This->sIcoPath) ? 686 if (!extract_icon( This->sIcoPath && strlen(This->sIcoPath) ? 688 687 This->sIcoPath : This->sPath, 689 688 icon_name, This->iIcoNdx)) goto done; … … 691 690 if(OSLibWinCreateObject(This->sPath, This->sArgs, This->sWorkDir, filename, 692 691 This->sDescription, icon_name, 693 This->iIcoNdx, bDesktop) == FALSE) 692 This->iIcoNdx, bDesktop) == FALSE) 694 693 { 695 694 ret = E_ACCESSDENIED; 696 695 } 697 696 698 697 done: 699 698 if(shell_link_app) HeapFree( GetProcessHeap(), 0, shell_link_app ); … … 761 760 762 761 /* extract the icon */ 763 if (!(icon_name = extract_icon( This->sIcoPath && strlen(This->sIcoPath) ? 762 if (!(icon_name = extract_icon( This->sIcoPath && strlen(This->sIcoPath) ? 764 763 This->sIcoPath : This->sPath, 765 764 This->iIcoNdx ))) goto done; … … 830 829 static HRESULT WINAPI IPersistFile_fnSaveCompleted(IPersistFile* iface, LPCOLESTR pszFileName) 831 830 { 832 833 834 831 _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface); 832 FIXME("(%p)->(%s)\n",This,debugstr_w(pszFileName)); 833 return NOERROR; 835 834 } 836 835 static HRESULT WINAPI IPersistFile_fnGetCurFile(IPersistFile* iface, LPOLESTR *ppszFileName) 837 836 { 838 839 840 841 } 842 843 static ICOM_VTABLE(IPersistFile) pfvt = 844 { 845 846 847 848 849 850 851 852 853 854 837 _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface); 838 FIXME("(%p)\n",This); 839 return NOERROR; 840 } 841 842 static ICOM_VTABLE(IPersistFile) pfvt = 843 { 844 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 845 IPersistFile_fnQueryInterface, 846 IPersistFile_fnAddRef, 847 IPersistFile_fnRelease, 848 IPersistFile_fnGetClassID, 849 IPersistFile_fnIsDirty, 850 IPersistFile_fnLoad, 851 IPersistFile_fnSave, 852 IPersistFile_fnSaveCompleted, 853 IPersistFile_fnGetCurFile 855 854 }; 856 855 … … 859 858 */ 860 859 static HRESULT WINAPI IPersistStream_fnQueryInterface( 861 862 863 864 { 865 866 867 868 869 860 IPersistStream* iface, 861 REFIID riid, 862 VOID** ppvoid) 863 { 864 _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface); 865 866 TRACE("(%p)\n",This); 867 868 return IShellLinkA_QueryInterface((IShellLinkA*)This, riid, ppvoid); 870 869 } 871 870 … … 874 873 */ 875 874 static ULONG WINAPI IPersistStream_fnRelease( 876 877 { 878 879 880 881 882 875 IPersistStream* iface) 876 { 877 _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface); 878 879 TRACE("(%p)\n",This); 880 881 return IShellLinkA_Release((IShellLinkA*)This); 883 882 } 884 883 … … 887 886 */ 888 887 static ULONG WINAPI IPersistStream_fnAddRef( 889 890 { 891 892 893 894 895 896 } 888 IPersistStream* iface) 889 { 890 _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface); 891 892 TRACE("(%p)\n",This); 893 894 return IShellLinkA_AddRef((IShellLinkA*)This); 895 } 897 896 898 897 /************************************************************************ … … 901 900 */ 902 901 static HRESULT WINAPI IPersistStream_fnGetClassID( 903 904 905 { 906 907 908 909 910 911 912 913 /* 914 915 902 IPersistStream* iface, 903 CLSID* pClassID) 904 { 905 _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface); 906 907 TRACE("(%p)\n", This); 908 909 if (pClassID==0) 910 return E_POINTER; 911 912 /* memcpy(pClassID, &CLSID_???, sizeof(CLSID_???)); */ 913 914 return S_OK; 916 915 } 917 916 … … 920 919 */ 921 920 static HRESULT WINAPI IPersistStream_fnIsDirty( 922 923 { 924 925 926 927 928 921 IPersistStream* iface) 922 { 923 _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface); 924 925 TRACE("(%p)\n", This); 926 927 return S_OK; 929 928 } 930 929 /************************************************************************ … … 933 932 934 933 static HRESULT WINAPI IPersistStream_fnLoad( 935 936 937 { 938 939 ULONGdwBytesRead;940 DWORDret = E_FAIL;941 charsTemp[MAX_PATH];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 974 934 IPersistStream* iface, 935 IStream* pLoadStream) 936 { 937 PLINK_HEADER lpLinkHeader = HeapAlloc(GetProcessHeap(), 0, LINK_HEADER_SIZE); 938 ULONG dwBytesRead; 939 DWORD ret = E_FAIL; 940 char sTemp[MAX_PATH]; 941 942 _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface); 943 944 TRACE("(%p)(%p)\n", This, pLoadStream); 945 946 if ( ! pLoadStream) 947 { 948 return STG_E_INVALIDPOINTER; 949 } 950 951 IStream_AddRef (pLoadStream); 952 if(lpLinkHeader) 953 { 954 if (SUCCEEDED(IStream_Read(pLoadStream, lpLinkHeader, LINK_HEADER_SIZE, &dwBytesRead))) 955 { 956 if ((lpLinkHeader->MagicStr == 0x0000004CL) && IsEqualIID(&lpLinkHeader->MagicGuid, &CLSID_ShellLink)) 957 { 958 lpLinkHeader = HeapReAlloc(GetProcessHeap(), 0, lpLinkHeader, LINK_HEADER_SIZE+lpLinkHeader->PidlSize); 959 if (lpLinkHeader) 960 { 961 if (SUCCEEDED(IStream_Read(pLoadStream, &(lpLinkHeader->Pidl), lpLinkHeader->PidlSize, &dwBytesRead))) 962 { 963 if (pcheck (&lpLinkHeader->Pidl)) 964 { 965 This->pPidl = ILClone (&lpLinkHeader->Pidl); 966 967 SHGetPathFromIDListA(&lpLinkHeader->Pidl, sTemp); 968 This->sPath = HEAP_strdupA ( GetProcessHeap(), 0, sTemp); 969 } 970 This->wHotKey = lpLinkHeader->wHotKey; 971 FileTimeToSystemTime (&lpLinkHeader->Time1, &This->time1); 972 FileTimeToSystemTime (&lpLinkHeader->Time2, &This->time2); 973 FileTimeToSystemTime (&lpLinkHeader->Time3, &This->time3); 975 974 #if 1 976 977 978 979 980 981 982 983 #endif 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 975 GetDateFormatA(LOCALE_USER_DEFAULT,DATE_SHORTDATE,&This->time1, NULL, sTemp, 256); 976 TRACE("-- time1: %s\n", sTemp); 977 GetDateFormatA(LOCALE_USER_DEFAULT,DATE_SHORTDATE,&This->time2, NULL, sTemp, 256); 978 TRACE("-- time1: %s\n", sTemp); 979 GetDateFormatA(LOCALE_USER_DEFAULT,DATE_SHORTDATE,&This->time3, NULL, sTemp, 256); 980 TRACE("-- time1: %s\n", sTemp); 981 pdump (This->pPidl); 982 #endif 983 ret = S_OK; 984 } 985 } 986 } 987 else 988 { 989 WARN("stream contains no link!\n"); 990 } 991 } 992 } 993 994 IStream_Release (pLoadStream); 995 996 pdump(This->pPidl); 997 998 HeapFree(GetProcessHeap(), 0, lpLinkHeader); 999 1000 return ret; 1002 1001 } 1003 1002 … … 1006 1005 */ 1007 1006 static HRESULT WINAPI IPersistStream_fnSave( 1008 1009 1010 1011 { 1012 1013 1014 1015 1016 1007 IPersistStream* iface, 1008 IStream* pOutStream, 1009 BOOL fClearDirty) 1010 { 1011 _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface); 1012 1013 TRACE("(%p) %p %x\n", This, pOutStream, fClearDirty); 1014 1015 return E_NOTIMPL; 1017 1016 } 1018 1017 … … 1021 1020 */ 1022 1021 static HRESULT WINAPI IPersistStream_fnGetSizeMax( 1023 1024 1025 { 1026 1027 1028 1029 1030 1022 IPersistStream* iface, 1023 ULARGE_INTEGER* pcbSize) 1024 { 1025 _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface); 1026 1027 TRACE("(%p)\n", This); 1028 1029 return E_NOTIMPL; 1031 1030 } 1032 1031 1033 1032 static ICOM_VTABLE(IPersistStream) psvt = 1034 1033 { 1035 1036 1037 1038 1039 1040 1041 1042 1043 1034 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 1035 IPersistStream_fnQueryInterface, 1036 IPersistStream_fnAddRef, 1037 IPersistStream_fnRelease, 1038 IPersistStream_fnGetClassID, 1039 IPersistStream_fnIsDirty, 1040 IPersistStream_fnLoad, 1041 IPersistStream_fnSave, 1042 IPersistStream_fnGetSizeMax 1044 1043 }; 1045 1044 1046 1045 /************************************************************************** 1047 * 1048 */ 1049 IShellLinkA * IShellLink_Constructor(BOOL bUnicode) 1050 { 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1046 * IShellLink_Constructor 1047 */ 1048 IShellLinkA * IShellLink_Constructor(BOOL bUnicode) 1049 { IShellLinkImpl * sl; 1050 1051 sl = (IShellLinkImpl *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IShellLinkImpl)); 1052 sl->ref = 1; 1053 ICOM_VTBL(sl) = &slvt; 1054 sl->lpvtblw = &slvtw; 1055 sl->lpvtblPersistFile = &pfvt; 1056 sl->lpvtblPersistStream = &psvt; 1057 1058 TRACE("(%p)->()\n",sl); 1059 shell32_ObjCount++; 1060 return bUnicode ? (IShellLinkA *) &(sl->lpvtblw) : (IShellLinkA *)sl; 1062 1061 } 1063 1062 … … 1067 1066 static HRESULT WINAPI IShellLinkA_fnQueryInterface( IShellLinkA * iface, REFIID riid, LPVOID *ppvObj) 1068 1067 { 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 1101 } 1068 ICOM_THIS(IShellLinkImpl, iface); 1069 1070 TRACE("(%p)->(\n\tIID:\t%s)\n",This,debugstr_guid(riid)); 1071 1072 *ppvObj = NULL; 1073 1074 if(IsEqualIID(riid, &IID_IUnknown) || 1075 IsEqualIID(riid, &IID_IShellLinkA)) 1076 { 1077 *ppvObj = This; 1078 } 1079 else if(IsEqualIID(riid, &IID_IShellLinkW)) 1080 { 1081 *ppvObj = (IShellLinkW *)&(This->lpvtblw); 1082 } 1083 else if(IsEqualIID(riid, &IID_IPersistFile)) 1084 { 1085 *ppvObj = (IPersistFile *)&(This->lpvtblPersistFile); 1086 } 1087 else if(IsEqualIID(riid, &IID_IPersistStream)) 1088 { 1089 *ppvObj = (IPersistStream *)&(This->lpvtblPersistStream); 1090 } 1091 1092 if(*ppvObj) 1093 { 1094 IUnknown_AddRef((IUnknown*)(*ppvObj)); 1095 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj); 1096 return S_OK; 1097 } 1098 TRACE("-- Interface: E_NOINTERFACE\n"); 1099 return E_NOINTERFACE; 1100 } 1102 1101 /****************************************************************************** 1103 1102 * IShellLinkA_AddRef … … 1105 1104 static ULONG WINAPI IShellLinkA_fnAddRef(IShellLinkA * iface) 1106 1105 { 1107 1108 1109 1110 1111 1112 1106 ICOM_THIS(IShellLinkImpl, iface); 1107 1108 TRACE("(%p)->(count=%lu)\n",This,This->ref); 1109 1110 shell32_ObjCount++; 1111 return ++(This->ref); 1113 1112 } 1114 1113 /****************************************************************************** 1115 * 1114 * IShellLinkA_Release 1116 1115 */ 1117 1116 static ULONG WINAPI IShellLinkA_fnRelease(IShellLinkA * iface) 1118 1117 { 1119 1120 1121 1122 1123 1124 if (!--(This->ref)) 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 1118 ICOM_THIS(IShellLinkImpl, iface); 1119 1120 TRACE("(%p)->(count=%lu)\n",This,This->ref); 1121 1122 shell32_ObjCount--; 1123 if (!--(This->ref)) 1124 { TRACE("-- destroying IShellLink(%p)\n",This); 1125 1126 if (This->sIcoPath) 1127 HeapFree(GetProcessHeap(), 0, This->sIcoPath); 1128 1129 if (This->sArgs) 1130 HeapFree(GetProcessHeap(), 0, This->sArgs); 1131 1132 if (This->sWorkDir) 1133 HeapFree(GetProcessHeap(), 0, This->sWorkDir); 1134 1135 if (This->sDescription) 1136 HeapFree(GetProcessHeap(), 0, This->sDescription); 1137 1138 if (This->sPath) 1139 HeapFree(GetProcessHeap(),0,This->sPath); 1140 1141 if (This->pPidl) 1142 SHFree(This->pPidl); 1143 1144 if (This->lpFileStream) 1145 IStream_Release(This->lpFileStream); 1146 1147 This->iIcoNdx = 0; 1148 1149 HeapFree(GetProcessHeap(),0,This); 1150 return 0; 1151 } 1152 return This->ref; 1154 1153 } 1155 1154 1156 1155 static HRESULT WINAPI IShellLinkA_fnGetPath(IShellLinkA * iface, LPSTR pszFile,INT cchMaxPath, WIN32_FIND_DATAA *pfd, DWORD fFlags) 1157 1156 { 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1157 ICOM_THIS(IShellLinkImpl, iface); 1158 1159 TRACE("(%p)->(pfile=%p len=%u find_data=%p flags=%lu)(%s)\n",This, pszFile, cchMaxPath, pfd, fFlags, debugstr_a(This->sPath)); 1160 1161 if (This->sPath) 1162 lstrcpynA(pszFile,This->sPath, cchMaxPath); 1163 else 1164 return E_FAIL; 1165 1166 return NOERROR; 1168 1167 } 1169 1168 static HRESULT WINAPI IShellLinkA_fnGetIDList(IShellLinkA * iface, LPITEMIDLIST * ppidl) 1170 1169 { 1171 1172 1173 1174 1175 1176 1170 ICOM_THIS(IShellLinkImpl, iface); 1171 1172 TRACE("(%p)->(ppidl=%p)\n",This, ppidl); 1173 1174 *ppidl = ILClone(This->pPidl); 1175 return NOERROR; 1177 1176 } 1178 1177 static HRESULT WINAPI IShellLinkA_fnSetIDList(IShellLinkA * iface, LPCITEMIDLIST pidl) 1179 1178 { 1180 1181 1182 1183 1184 1185 1186 1187 1179 ICOM_THIS(IShellLinkImpl, iface); 1180 1181 TRACE("(%p)->(pidl=%p)\n",This, pidl); 1182 1183 if (This->pPidl) 1184 SHFree(This->pPidl); 1185 This->pPidl = ILClone (pidl); 1186 return NOERROR; 1188 1187 } 1189 1188 static HRESULT WINAPI IShellLinkA_fnGetDescription(IShellLinkA * iface, LPSTR pszName,INT cchMaxName) 1190 1189 { 1191 1192 1193 1194 1195 1190 ICOM_THIS(IShellLinkImpl, iface); 1191 1192 FIXME("(%p)->(%p len=%u)\n",This, pszName, cchMaxName); 1193 lstrcpynA(pszName,"Description, FIXME",cchMaxName); 1194 return NOERROR; 1196 1195 } 1197 1196 static HRESULT WINAPI IShellLinkA_fnSetDescription(IShellLinkA * iface, LPCSTR pszName) 1198 1197 { 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1198 ICOM_THIS(IShellLinkImpl, iface); 1199 1200 TRACE("(%p)->(pName=%s)\n", This, pszName); 1201 1202 if (This->sDescription) 1203 HeapFree(GetProcessHeap(), 0, This->sDescription); 1204 if (!(This->sDescription = HEAP_strdupA(GetProcessHeap(), 0, pszName))) 1205 return E_OUTOFMEMORY; 1206 1207 return NOERROR; 1209 1208 } 1210 1209 static HRESULT WINAPI IShellLinkA_fnGetWorkingDirectory(IShellLinkA * iface, LPSTR pszDir,INT cchMaxPath) 1211 1210 { 1212 1213 1214 1215 1216 1217 1218 1211 ICOM_THIS(IShellLinkImpl, iface); 1212 1213 TRACE("(%p)->(%p len=%u)\n", This, pszDir, cchMaxPath); 1214 1215 lstrcpynA( pszDir, This->sWorkDir ? This->sWorkDir : "", cchMaxPath ); 1216 1217 return NOERROR; 1219 1218 } 1220 1219 static HRESULT WINAPI IShellLinkA_fnSetWorkingDirectory(IShellLinkA * iface, LPCSTR pszDir) 1221 1220 { 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1221 ICOM_THIS(IShellLinkImpl, iface); 1222 1223 TRACE("(%p)->(dir=%s)\n",This, pszDir); 1224 1225 if (This->sWorkDir) 1226 HeapFree(GetProcessHeap(), 0, This->sWorkDir); 1227 if (!(This->sWorkDir = HEAP_strdupA(GetProcessHeap(), 0, pszDir))) 1228 return E_OUTOFMEMORY; 1229 1230 return NOERROR; 1232 1231 } 1233 1232 static HRESULT WINAPI IShellLinkA_fnGetArguments(IShellLinkA * iface, LPSTR pszArgs,INT cchMaxPath) 1234 1233 { 1235 1236 1237 1238 1239 1240 1241 1234 ICOM_THIS(IShellLinkImpl, iface); 1235 1236 TRACE("(%p)->(%p len=%u)\n", This, pszArgs, cchMaxPath); 1237 1238 lstrcpynA( pszArgs, This->sArgs ? This->sArgs : "", cchMaxPath ); 1239 1240 return NOERROR; 1242 1241 } 1243 1242 static HRESULT WINAPI IShellLinkA_fnSetArguments(IShellLinkA * iface, LPCSTR pszArgs) 1244 1243 { 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1244 ICOM_THIS(IShellLinkImpl, iface); 1245 1246 TRACE("(%p)->(args=%s)\n",This, pszArgs); 1247 1248 if (This->sArgs) 1249 HeapFree(GetProcessHeap(), 0, This->sArgs); 1250 if (!(This->sArgs = HEAP_strdupA(GetProcessHeap(), 0, pszArgs))) 1251 return E_OUTOFMEMORY; 1252 1253 return NOERROR; 1255 1254 } 1256 1255 static HRESULT WINAPI IShellLinkA_fnGetHotkey(IShellLinkA * iface, WORD *pwHotkey) 1257 1256 { 1258 1259 1260 1261 1262 1263 1264 1257 ICOM_THIS(IShellLinkImpl, iface); 1258 1259 TRACE("(%p)->(%p)(0x%08x)\n",This, pwHotkey, This->wHotKey); 1260 1261 *pwHotkey = This->wHotKey; 1262 1263 return NOERROR; 1265 1264 } 1266 1265 static HRESULT WINAPI IShellLinkA_fnSetHotkey(IShellLinkA * iface, WORD wHotkey) 1267 1266 { 1268 1269 1270 1271 1272 1273 1274 1267 ICOM_THIS(IShellLinkImpl, iface); 1268 1269 TRACE("(%p)->(hotkey=%x)\n",This, wHotkey); 1270 1271 This->wHotKey = wHotkey; 1272 1273 return NOERROR; 1275 1274 } 1276 1275 static HRESULT WINAPI IShellLinkA_fnGetShowCmd(IShellLinkA * iface, INT *piShowCmd) 1277 1276 { 1278 1279 1280 1281 1282 1277 ICOM_THIS(IShellLinkImpl, iface); 1278 1279 FIXME("(%p)->(%p)\n",This, piShowCmd); 1280 *piShowCmd=0; 1281 return NOERROR; 1283 1282 } 1284 1283 static HRESULT WINAPI IShellLinkA_fnSetShowCmd(IShellLinkA * iface, INT iShowCmd) 1285 1284 { 1286 1287 1288 1289 1285 ICOM_THIS(IShellLinkImpl, iface); 1286 1287 FIXME("(%p)->(showcmd=%x)\n",This, iShowCmd); 1288 return NOERROR; 1290 1289 } 1291 1290 static HRESULT WINAPI IShellLinkA_fnGetIconLocation(IShellLinkA * iface, LPSTR pszIconPath,INT cchIconPath,INT *piIcon) 1292 1291 { 1293 1294 1295 1296 1297 1298 1299 1300 1292 ICOM_THIS(IShellLinkImpl, iface); 1293 1294 TRACE("(%p)->(%p len=%u iicon=%p)\n", This, pszIconPath, cchIconPath, piIcon); 1295 1296 lstrcpynA( pszIconPath, This->sIcoPath ? This->sIcoPath : "", cchIconPath ); 1297 *piIcon = This->iIcoNdx; 1298 1299 return NOERROR; 1301 1300 } 1302 1301 static HRESULT WINAPI IShellLinkA_fnSetIconLocation(IShellLinkA * iface, LPCSTR pszIconPath,INT iIcon) 1303 1302 { 1304 1305 1306 1307 1308 1309 1310 1311 return E_OUTOFMEMORY; 1312 1313 1314 1303 ICOM_THIS(IShellLinkImpl, iface); 1304 1305 TRACE("(%p)->(path=%s iicon=%u)\n",This, pszIconPath, iIcon); 1306 1307 if (This->sIcoPath) 1308 HeapFree(GetProcessHeap(), 0, This->sIcoPath); 1309 if (!(This->sIcoPath = HEAP_strdupA(GetProcessHeap(), 0, pszIconPath))) 1310 return E_OUTOFMEMORY; 1311 This->iIcoNdx = iIcon; 1312 1313 return NOERROR; 1315 1314 } 1316 1315 static HRESULT WINAPI IShellLinkA_fnSetRelativePath(IShellLinkA * iface, LPCSTR pszPathRel, DWORD dwReserved) 1317 1316 { 1318 1319 1320 1321 1317 ICOM_THIS(IShellLinkImpl, iface); 1318 1319 FIXME("(%p)->(path=%s %lx)\n",This, pszPathRel, dwReserved); 1320 return NOERROR; 1322 1321 } 1323 1322 static HRESULT WINAPI IShellLinkA_fnResolve(IShellLinkA * iface, HWND hwnd, DWORD fFlags) 1324 1323 { 1325 1326 1327 1328 1324 ICOM_THIS(IShellLinkImpl, iface); 1325 1326 FIXME("(%p)->(hwnd=%x flags=%lx)\n",This, hwnd, fFlags); 1327 return NOERROR; 1329 1328 } 1330 1329 static HRESULT WINAPI IShellLinkA_fnSetPath(IShellLinkA * iface, LPCSTR pszFile) 1331 1330 { 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1331 ICOM_THIS(IShellLinkImpl, iface); 1332 1333 TRACE("(%p)->(path=%s)\n",This, pszFile); 1334 1335 if (This->sPath) 1336 HeapFree(GetProcessHeap(), 0, This->sPath); 1337 if (!(This->sPath = HEAP_strdupA(GetProcessHeap(), 0, pszFile))) 1338 return E_OUTOFMEMORY; 1339 1340 return NOERROR; 1342 1341 } 1343 1342 … … 1346 1345 */ 1347 1346 1348 static ICOM_VTABLE(IShellLinkA) slvt = 1349 { 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1347 static ICOM_VTABLE(IShellLinkA) slvt = 1348 { 1349 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 1350 IShellLinkA_fnQueryInterface, 1351 IShellLinkA_fnAddRef, 1352 IShellLinkA_fnRelease, 1353 IShellLinkA_fnGetPath, 1354 IShellLinkA_fnGetIDList, 1355 IShellLinkA_fnSetIDList, 1356 IShellLinkA_fnGetDescription, 1357 IShellLinkA_fnSetDescription, 1358 IShellLinkA_fnGetWorkingDirectory, 1359 IShellLinkA_fnSetWorkingDirectory, 1360 IShellLinkA_fnGetArguments, 1361 IShellLinkA_fnSetArguments, 1362 IShellLinkA_fnGetHotkey, 1363 IShellLinkA_fnSetHotkey, 1364 IShellLinkA_fnGetShowCmd, 1365 IShellLinkA_fnSetShowCmd, 1366 IShellLinkA_fnGetIconLocation, 1367 IShellLinkA_fnSetIconLocation, 1368 IShellLinkA_fnSetRelativePath, 1369 IShellLinkA_fnResolve, 1370 IShellLinkA_fnSetPath 1372 1371 }; 1373 1372 … … 1379 1378 IShellLinkW * iface, REFIID riid, LPVOID *ppvObj) 1380 1379 { 1381 1382 1383 1380 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); 1381 1382 return IShellLinkA_QueryInterface((IShellLinkA*)This, riid, ppvObj); 1384 1383 } 1385 1384 … … 1389 1388 static ULONG WINAPI IShellLinkW_fnAddRef(IShellLinkW * iface) 1390 1389 { 1391 1392 1393 1394 1395 1390 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); 1391 1392 TRACE("(%p)->(count=%lu)\n",This,This->ref); 1393 1394 return IShellLinkA_AddRef((IShellLinkA*)This); 1396 1395 } 1397 1396 /****************************************************************************** … … 1401 1400 static ULONG WINAPI IShellLinkW_fnRelease(IShellLinkW * iface) 1402 1401 { 1403 1404 1405 1406 1407 1402 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); 1403 1404 TRACE("(%p)->(count=%lu)\n",This,This->ref); 1405 1406 return IShellLinkA_Release((IShellLinkA*)This); 1408 1407 } 1409 1408 1410 1409 static HRESULT WINAPI IShellLinkW_fnGetPath(IShellLinkW * iface, LPWSTR pszFile,INT cchMaxPath, WIN32_FIND_DATAA *pfd, DWORD fFlags) 1411 1410 { 1412 1413 1414 1411 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); 1412 1413 FIXME("(%p)->(pfile=%p len=%u find_data=%p flags=%lu)\n",This, pszFile, cchMaxPath, pfd, fFlags); 1415 1414 MultiByteToWideChar( CP_ACP, 0, "c:\\foo.bar", -1, pszFile, cchMaxPath ); 1416 1415 return NOERROR; 1417 1416 } 1418 1417 1419 1418 static HRESULT WINAPI IShellLinkW_fnGetIDList(IShellLinkW * iface, LPITEMIDLIST * ppidl) 1420 1419 { 1421 1422 1423 1424 1425 1420 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); 1421 1422 FIXME("(%p)->(ppidl=%p)\n",This, ppidl); 1423 *ppidl = _ILCreateDesktop(); 1424 return NOERROR; 1426 1425 } 1427 1426 1428 1427 static HRESULT WINAPI IShellLinkW_fnSetIDList(IShellLinkW * iface, LPCITEMIDLIST pidl) 1429 1428 { 1430 1431 1432 1433 1429 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); 1430 1431 FIXME("(%p)->(pidl=%p)\n",This, pidl); 1432 return NOERROR; 1434 1433 } 1435 1434 1436 1435 static HRESULT WINAPI IShellLinkW_fnGetDescription(IShellLinkW * iface, LPWSTR pszName,INT cchMaxName) 1437 1436 { 1438 1439 1440 1437 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); 1438 1439 FIXME("(%p)->(%p len=%u)\n",This, pszName, cchMaxName); 1441 1440 MultiByteToWideChar( CP_ACP, 0, "Description, FIXME", -1, pszName, cchMaxName ); 1442 1441 return NOERROR; 1443 1442 } 1444 1443 1445 1444 static HRESULT WINAPI IShellLinkW_fnSetDescription(IShellLinkW * iface, LPCWSTR pszName) 1446 1445 { 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1446 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); 1447 1448 TRACE("(%p)->(desc=%s)\n",This, debugstr_w(pszName)); 1449 1450 if (This->sDescription) 1451 HeapFree(GetProcessHeap(), 0, This->sDescription); 1452 if (!(This->sDescription = HEAP_strdupWtoA(GetProcessHeap(), 0, pszName))) 1453 return E_OUTOFMEMORY; 1454 1455 return NOERROR; 1457 1456 } 1458 1457 1459 1458 static HRESULT WINAPI IShellLinkW_fnGetWorkingDirectory(IShellLinkW * iface, LPWSTR pszDir,INT cchMaxPath) 1460 1459 { 1461 1462 1463 1464 1465 1466 1467 1460 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); 1461 1462 TRACE("(%p)->(%p len %u)\n", This, pszDir, cchMaxPath); 1463 1464 MultiByteToWideChar( CP_ACP, 0, This->sWorkDir ? This->sWorkDir : "", -1, pszDir, cchMaxPath ); 1465 1466 return NOERROR; 1468 1467 } 1469 1468 1470 1469 static HRESULT WINAPI IShellLinkW_fnSetWorkingDirectory(IShellLinkW * iface, LPCWSTR pszDir) 1471 1470 { 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1471 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); 1472 1473 TRACE("(%p)->(dir=%s)\n",This, debugstr_w(pszDir)); 1474 1475 if (This->sWorkDir) 1476 HeapFree(GetProcessHeap(), 0, This->sWorkDir); 1477 if (!(This->sWorkDir = HEAP_strdupWtoA(GetProcessHeap(), 0, pszDir))) 1478 return E_OUTOFMEMORY; 1479 1480 return NOERROR; 1482 1481 } 1483 1482 1484 1483 static HRESULT WINAPI IShellLinkW_fnGetArguments(IShellLinkW * iface, LPWSTR pszArgs,INT cchMaxPath) 1485 1484 { 1486 1487 1488 1489 1490 1491 1492 1485 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); 1486 1487 TRACE("(%p)->(%p len=%u)\n", This, pszArgs, cchMaxPath); 1488 1489 MultiByteToWideChar( CP_ACP, 0, This->sArgs ? This->sArgs : "", -1, pszArgs, cchMaxPath ); 1490 1491 return NOERROR; 1493 1492 } 1494 1493 1495 1494 static HRESULT WINAPI IShellLinkW_fnSetArguments(IShellLinkW * iface, LPCWSTR pszArgs) 1496 1495 { 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1496 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); 1497 1498 TRACE("(%p)->(args=%s)\n",This, debugstr_w(pszArgs)); 1499 1500 if (This->sArgs) 1501 HeapFree(GetProcessHeap(), 0, This->sArgs); 1502 if (!(This->sArgs = HEAP_strdupWtoA(GetProcessHeap(), 0, pszArgs))) 1503 return E_OUTOFMEMORY; 1504 1505 return NOERROR; 1507 1506 } 1508 1507 1509 1508 static HRESULT WINAPI IShellLinkW_fnGetHotkey(IShellLinkW * iface, WORD *pwHotkey) 1510 1509 { 1511 1512 1513 1514 1515 1510 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); 1511 1512 FIXME("(%p)->(%p)\n",This, pwHotkey); 1513 *pwHotkey=0x0; 1514 return NOERROR; 1516 1515 } 1517 1516 1518 1517 static HRESULT WINAPI IShellLinkW_fnSetHotkey(IShellLinkW * iface, WORD wHotkey) 1519 1518 { 1520 1521 1522 1523 1519 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); 1520 1521 FIXME("(%p)->(hotkey=%x)\n",This, wHotkey); 1522 return NOERROR; 1524 1523 } 1525 1524 1526 1525 static HRESULT WINAPI IShellLinkW_fnGetShowCmd(IShellLinkW * iface, INT *piShowCmd) 1527 1526 { 1528 1529 1530 1531 1532 1527 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); 1528 1529 FIXME("(%p)->(%p)\n",This, piShowCmd); 1530 *piShowCmd=0; 1531 return NOERROR; 1533 1532 } 1534 1533 1535 1534 static HRESULT WINAPI IShellLinkW_fnSetShowCmd(IShellLinkW * iface, INT iShowCmd) 1536 1535 { 1537 1538 1539 1540 1536 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); 1537 1538 FIXME("(%p)->(showcmd=%x)\n",This, iShowCmd); 1539 return NOERROR; 1541 1540 } 1542 1541 1543 1542 static HRESULT WINAPI IShellLinkW_fnGetIconLocation(IShellLinkW * iface, LPWSTR pszIconPath,INT cchIconPath,INT *piIcon) 1544 1543 { 1545 1546 1547 1544 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); 1545 1546 TRACE("(%p)->(%p len=%u iicon=%p)\n", This, pszIconPath, cchIconPath, piIcon); 1548 1547 1549 1548 MultiByteToWideChar( CP_ACP, 0, This->sIcoPath ? This->sIcoPath : "", -1, pszIconPath, cchIconPath ); 1550 1551 1552 1549 *piIcon = This->iIcoNdx; 1550 1551 return NOERROR; 1553 1552 } 1554 1553 1555 1554 static HRESULT WINAPI IShellLinkW_fnSetIconLocation(IShellLinkW * iface, LPCWSTR pszIconPath,INT iIcon) 1556 1555 { 1557 1558 1559 1560 1561 1562 1563 1564 return E_OUTOFMEMORY; 1565 1566 1567 1556 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); 1557 1558 TRACE("(%p)->(path=%s iicon=%u)\n",This, debugstr_w(pszIconPath), iIcon); 1559 1560 if (This->sIcoPath) 1561 HeapFree(GetProcessHeap(), 0, This->sIcoPath); 1562 if (!(This->sIcoPath = HEAP_strdupWtoA(GetProcessHeap(), 0, pszIconPath))) 1563 return E_OUTOFMEMORY; 1564 This->iIcoNdx = iIcon; 1565 1566 return NOERROR; 1568 1567 } 1569 1568 1570 1569 static HRESULT WINAPI IShellLinkW_fnSetRelativePath(IShellLinkW * iface, LPCWSTR pszPathRel, DWORD dwReserved) 1571 1570 { 1572 1573 1574 1575 1571 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); 1572 1573 FIXME("(%p)->(path=%s %lx)\n",This, debugstr_w(pszPathRel), dwReserved); 1574 return NOERROR; 1576 1575 } 1577 1576 1578 1577 static HRESULT WINAPI IShellLinkW_fnResolve(IShellLinkW * iface, HWND hwnd, DWORD fFlags) 1579 1578 { 1580 1581 1582 1583 1579 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); 1580 1581 FIXME("(%p)->(hwnd=%x flags=%lx)\n",This, hwnd, fFlags); 1582 return NOERROR; 1584 1583 } 1585 1584 1586 1585 static HRESULT WINAPI IShellLinkW_fnSetPath(IShellLinkW * iface, LPCWSTR pszFile) 1587 1586 { 1588 1589 1590 1591 1592 1593 1594 1595 return E_OUTOFMEMORY; 1596 1597 1587 _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); 1588 1589 TRACE("(%p)->(path=%s)\n",This, debugstr_w(pszFile)); 1590 1591 if (This->sPath) 1592 HeapFree(GetProcessHeap(), 0, This->sPath); 1593 if (!(This->sPath = HEAP_strdupWtoA(GetProcessHeap(), 0, pszFile))) 1594 return E_OUTOFMEMORY; 1595 1596 return NOERROR; 1598 1597 } 1599 1598 … … 1602 1601 */ 1603 1602 1604 static ICOM_VTABLE(IShellLinkW) slvtw = 1605 { 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1603 static ICOM_VTABLE(IShellLinkW) slvtw = 1604 { 1605 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 1606 IShellLinkW_fnQueryInterface, 1607 IShellLinkW_fnAddRef, 1608 IShellLinkW_fnRelease, 1609 IShellLinkW_fnGetPath, 1610 IShellLinkW_fnGetIDList, 1611 IShellLinkW_fnSetIDList, 1612 IShellLinkW_fnGetDescription, 1613 IShellLinkW_fnSetDescription, 1614 IShellLinkW_fnGetWorkingDirectory, 1615 IShellLinkW_fnSetWorkingDirectory, 1616 IShellLinkW_fnGetArguments, 1617 IShellLinkW_fnSetArguments, 1618 IShellLinkW_fnGetHotkey, 1619 IShellLinkW_fnSetHotkey, 1620 IShellLinkW_fnGetShowCmd, 1621 IShellLinkW_fnSetShowCmd, 1622 IShellLinkW_fnGetIconLocation, 1623 IShellLinkW_fnSetIconLocation, 1624 IShellLinkW_fnSetRelativePath, 1625 IShellLinkW_fnResolve, 1626 IShellLinkW_fnSetPath 1628 1627 }; 1629 1628 -
trunk/src/shell32/shellole.c
r6650 r6709 1 /* $Id: shellole.c,v 1.3 2001-09-05 13:46:57 bird Exp $ */2 1 /* 3 * 2 * handling of SHELL32.DLL OLE-Objects 4 3 * 5 * Copyright 1997Marcus Meissner6 * Copyright 1998Juergen Schmied <juergen.schmied@metronet.de>4 * Copyright 1997 Marcus Meissner 5 * Copyright 1998 Juergen Schmied <juergen.schmied@metronet.de> 7 6 * 8 7 */ … … 25 24 DWORD WINAPI SHCLSIDFromStringA (LPSTR clsid, CLSID *id); 26 25 extern IShellFolder * IShellFolder_Constructor( 27 28 26 IShellFolder * psf, 27 LPITEMIDLIST pidl); 29 28 extern HRESULT IFSFolder_Constructor( 30 31 32 29 IUnknown * pUnkOuter, 30 REFIID riid, 31 LPVOID * ppv); 33 32 34 33 /************************************************************************* 35 34 * SHCoCreateInstance [SHELL32.102] 36 * 35 * 37 36 * NOTES 38 37 * exported by ordinal 39 38 */ 40 39 LRESULT WINAPI SHCoCreateInstance( 41 42 43 44 45 46 { 47 DWORDhres;48 IIDiid;49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 40 LPSTR aclsid, 41 REFCLSID clsid, 42 IUnknown * unknownouter, 43 REFIID refiid, 44 LPVOID *ppv) 45 { 46 DWORD hres; 47 IID iid; 48 CLSID * myclsid = (CLSID*)clsid; 49 50 if (!clsid) 51 { 52 if (!aclsid) return REGDB_E_CLASSNOTREG; 53 SHCLSIDFromStringA(aclsid, &iid); 54 myclsid = &iid; 55 } 56 57 TRACE("(%p,\n\tCLSID:\t%s, unk:%p\n\tIID:\t%s,%p)\n", 58 aclsid,debugstr_guid(myclsid),unknownouter,debugstr_guid(refiid),ppv); 59 60 if IsEqualCLSID(myclsid, &CLSID_ShellFSFolder) 61 { 62 hres = IFSFolder_Constructor(unknownouter, refiid, ppv); 63 } 64 else 65 { 66 hres = CoCreateInstance(myclsid, unknownouter, CLSCTX_INPROC_SERVER, refiid, ppv); 67 } 68 69 if(hres!=S_OK) 70 { 71 ERR("failed (0x%08lx) to create \n\tCLSID:\t%s\n\tIID:\t%s\n", 73 72 hres, debugstr_guid(myclsid), debugstr_guid(refiid)); 74 75 76 77 78 73 ERR("class not found in registry\n"); 74 } 75 76 TRACE("-- instance: %p\n",*ppv); 77 return hres; 79 78 } 80 79 … … 83 82 */ 84 83 HRESULT WINAPI SHELL32_DllGetClassObject(REFCLSID rclsid, REFIID iid,LPVOID *ppv) 85 { HRESULThres = E_OUTOFMEMORY;86 87 88 89 90 91 92 if(IsEqualCLSID(rclsid, &CLSID_ShellDesktop)|| 93 94 95 96 97 if(lpclf) 98 99 100 101 102 103 104 105 106 107 108 109 110 } 111 112 /************************************************************************* 113 * SHCLSIDFromString 84 { HRESULT hres = E_OUTOFMEMORY; 85 LPCLASSFACTORY lpclf; 86 87 TRACE("\n\tCLSID:\t%s,\n\tIID:\t%s\n",debugstr_guid(rclsid),debugstr_guid(iid)); 88 89 *ppv = NULL; 90 91 if(IsEqualCLSID(rclsid, &CLSID_ShellDesktop)|| 92 IsEqualCLSID(rclsid, &CLSID_ShellLink)) 93 { 94 lpclf = IClassFactory_Constructor( rclsid ); 95 96 if(lpclf) 97 { 98 hres = IClassFactory_QueryInterface(lpclf,iid, ppv); 99 IClassFactory_Release(lpclf); 100 } 101 } 102 else 103 { 104 WARN("-- CLSID not found\n"); 105 hres = CLASS_E_CLASSNOTAVAILABLE; 106 } 107 TRACE("-- pointer to class factory: %p\n",*ppv); 108 return hres; 109 } 110 111 /************************************************************************* 112 * SHCLSIDFromString [SHELL32.147] 114 113 * 115 114 * NOTES … … 126 125 DWORD WINAPI SHCLSIDFromStringW (LPWSTR clsid, CLSID *id) 127 126 { 128 129 return CLSIDFromString(clsid, id); 127 TRACE("(%p(%s) %p)\n", clsid, debugstr_w(clsid), id); 128 return CLSIDFromString(clsid, id); 130 129 } 131 130 DWORD WINAPI SHCLSIDFromStringAW (LPVOID clsid, CLSID *id) 132 131 { 133 134 135 136 } 137 138 /************************************************************************* 139 * SHGetMalloc[SHELL32.220]132 if (SHELL_OsIsUnicode()) 133 return SHCLSIDFromStringW (clsid, id); 134 return SHCLSIDFromStringA (clsid, id); 135 } 136 137 /************************************************************************* 138 * SHGetMalloc [SHELL32.220] 140 139 * returns the interface to shell malloc. 141 140 * … … 146 145 * heap (ProcessHeap). 147 146 */ 148 DWORD WINAPI SHGetMalloc(LPMALLOC *lpmal) 149 { 150 151 152 } 153 154 /************************************************************************* 155 * SHGetDesktopFolder 147 DWORD WINAPI SHGetMalloc(LPMALLOC *lpmal) 148 { 149 TRACE("(%p)\n", lpmal); 150 return CoGetMalloc(MEMCTX_TASK, lpmal); 151 } 152 153 /************************************************************************* 154 * SHGetDesktopFolder [SHELL32.216] 156 155 */ 157 156 LPSHELLFOLDER pdesktopfolder=NULL; … … 159 158 DWORD WINAPI SHGetDesktopFolder(IShellFolder **psf) 160 159 { 161 HRESULThres = S_OK;162 163 164 165 166 167 if (!pdesktopfolder) 168 169 170 if(lpclf) 171 172 173 174 } 175 176 177 if (pdesktopfolder) 178 179 180 181 182 183 184 185 160 HRESULT hres = S_OK; 161 LPCLASSFACTORY lpclf; 162 TRACE("%p->(%p)\n",psf,*psf); 163 164 *psf=NULL; 165 166 if (!pdesktopfolder) 167 { 168 lpclf = IClassFactory_Constructor(&CLSID_ShellDesktop); 169 if(lpclf) 170 { 171 hres = IClassFactory_CreateInstance(lpclf,NULL,(REFIID)&IID_IShellFolder, (void*)&pdesktopfolder); 172 IClassFactory_Release(lpclf); 173 } 174 } 175 176 if (pdesktopfolder) 177 { 178 /* even if we create the folder, add a ref so the application canŽt destroy the folder*/ 179 IShellFolder_AddRef(pdesktopfolder); 180 *psf = pdesktopfolder; 181 } 182 183 TRACE("-- %p->(%p)\n",psf, *psf); 184 return hres; 186 185 } 187 186 … … 195 194 ICOM_VFIELD(IClassFactory); 196 195 DWORD ref; 197 CLSID 196 CLSID *rclsid; 198 197 } IClassFactoryImpl; 199 198 … … 206 205 LPCLASSFACTORY IClassFactory_Constructor(REFCLSID rclsid) 207 206 { 208 209 210 211 212 213 214 215 216 217 207 IClassFactoryImpl* lpclf; 208 209 lpclf= (IClassFactoryImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IClassFactoryImpl)); 210 lpclf->ref = 1; 211 ICOM_VTBL(lpclf) = &clfvt; 212 lpclf->rclsid = (CLSID*)rclsid; 213 214 TRACE("(%p)->()\n",lpclf); 215 InterlockedIncrement(&shell32_ObjCount); 216 return (LPCLASSFACTORY)lpclf; 218 217 } 219 218 /************************************************************************** … … 223 222 LPCLASSFACTORY iface, REFIID riid, LPVOID *ppvObj) 224 223 { 225 226 227 228 229 230 231 { *ppvObj = This; 232 233 234 235 } 236 237 238 { IUnknown_AddRef((LPUNKNOWN)*ppvObj); 239 240 241 242 243 244 } 224 ICOM_THIS(IClassFactoryImpl,iface); 225 TRACE("(%p)->(\n\tIID:\t%s)\n",This,debugstr_guid(riid)); 226 227 *ppvObj = NULL; 228 229 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/ 230 { *ppvObj = This; 231 } 232 else if(IsEqualIID(riid, &IID_IClassFactory)) /*IClassFactory*/ 233 { *ppvObj = (IClassFactory*)This; 234 } 235 236 if(*ppvObj) 237 { IUnknown_AddRef((LPUNKNOWN)*ppvObj); 238 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj); 239 return S_OK; 240 } 241 TRACE("-- Interface: %s E_NOINTERFACE\n", debugstr_guid(riid)); 242 return E_NOINTERFACE; 243 } 245 244 /****************************************************************************** 246 245 * IClassFactory_AddRef … … 248 247 static ULONG WINAPI IClassFactory_fnAddRef(LPCLASSFACTORY iface) 249 248 { 250 251 252 253 254 249 ICOM_THIS(IClassFactoryImpl,iface); 250 TRACE("(%p)->(count=%lu)\n",This,This->ref); 251 252 InterlockedIncrement(&shell32_ObjCount); 253 return InterlockedIncrement(&This->ref); 255 254 } 256 255 /****************************************************************************** … … 259 258 static ULONG WINAPI IClassFactory_fnRelease(LPCLASSFACTORY iface) 260 259 { 261 262 263 264 265 if (!InterlockedDecrement(&This->ref)) 266 267 268 269 270 271 260 ICOM_THIS(IClassFactoryImpl,iface); 261 TRACE("(%p)->(count=%lu)\n",This,This->ref); 262 263 InterlockedDecrement(&shell32_ObjCount); 264 if (!InterlockedDecrement(&This->ref)) 265 { 266 TRACE("-- destroying IClassFactory(%p)\n",This); 267 HeapFree(GetProcessHeap(),0,This); 268 return 0; 269 } 270 return This->ref; 272 271 } 273 272 /****************************************************************************** … … 277 276 LPCLASSFACTORY iface, LPUNKNOWN pUnknown, REFIID riid, LPVOID *ppObject) 278 277 { 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 316 278 ICOM_THIS(IClassFactoryImpl,iface); 279 IUnknown *pObj = NULL; 280 HRESULT hres; 281 282 TRACE("%p->(%p,\n\tIID:\t%s,%p)\n",This,pUnknown,debugstr_guid(riid),ppObject); 283 284 *ppObject = NULL; 285 286 if(pUnknown) 287 { 288 return(CLASS_E_NOAGGREGATION); 289 } 290 291 if (IsEqualCLSID(This->rclsid, &CLSID_ShellDesktop)) 292 { 293 pObj = (IUnknown *)ISF_Desktop_Constructor(); 294 } 295 else if (IsEqualCLSID(This->rclsid, &CLSID_ShellLink)) 296 { 297 pObj = (IUnknown *)IShellLink_Constructor(FALSE); 298 } 299 else 300 { 301 ERR("unknown IID requested\n\tIID:\t%s\n",debugstr_guid(riid)); 302 return(E_NOINTERFACE); 303 } 304 305 if (!pObj) 306 { 307 return(E_OUTOFMEMORY); 308 } 309 310 hres = IUnknown_QueryInterface(pObj,riid, ppObject); 311 IUnknown_Release(pObj); 312 313 TRACE("-- Object created: (%p)->%p\n",This,*ppObject); 314 315 return hres; 317 316 } 318 317 /****************************************************************************** … … 321 320 static HRESULT WINAPI IClassFactory_fnLockServer(LPCLASSFACTORY iface, BOOL fLock) 322 321 { 323 324 325 326 } 327 328 static ICOM_VTABLE(IClassFactory) clfvt = 322 ICOM_THIS(IClassFactoryImpl,iface); 323 TRACE("%p->(0x%x), not implemented\n",This, fLock); 324 return E_NOTIMPL; 325 } 326 327 static ICOM_VTABLE(IClassFactory) clfvt = 329 328 { 330 329 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE … … 356 355 ICOM_VFIELD(IClassFactory); 357 356 DWORD ref; 358 CLSID 359 LPFNCREATEINSTANCE 360 const IID * 361 ULONG * 357 CLSID *rclsid; 358 LPFNCREATEINSTANCE lpfnCI; 359 const IID * riidInst; 360 ULONG * pcRefDll; /* pointer to refcounter in external dll (ugrrr...) */ 362 361 } IDefClFImpl; 363 362 … … 370 369 IClassFactory * IDefClF_fnConstructor(LPFNCREATEINSTANCE lpfnCI, PLONG pcRefDll, REFIID riidInst) 371 370 { 372 373 374 375 376 377 378 379 380 381 382 383 384 385 371 IDefClFImpl* lpclf; 372 373 lpclf = (IDefClFImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDefClFImpl)); 374 lpclf->ref = 1; 375 ICOM_VTBL(lpclf) = &dclfvt; 376 lpclf->lpfnCI = lpfnCI; 377 lpclf->pcRefDll = pcRefDll; 378 379 if (pcRefDll) InterlockedIncrement(pcRefDll); 380 lpclf->riidInst = riidInst; 381 382 TRACE("(%p)\n\tIID:\t%s\n",lpclf, debugstr_guid(riidInst)); 383 InterlockedIncrement(&shell32_ObjCount); 384 return (LPCLASSFACTORY)lpclf; 386 385 } 387 386 /************************************************************************** … … 391 390 LPCLASSFACTORY iface, REFIID riid, LPVOID *ppvObj) 392 391 { 393 394 395 396 397 398 399 400 { *ppvObj = This; 401 402 403 404 } 405 406 407 { IUnknown_AddRef((LPUNKNOWN)*ppvObj); 408 409 410 411 412 413 } 392 ICOM_THIS(IDefClFImpl,iface); 393 394 TRACE("(%p)->(\n\tIID:\t%s)\n",This,debugstr_guid(riid)); 395 396 *ppvObj = NULL; 397 398 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/ 399 { *ppvObj = This; 400 } 401 else if(IsEqualIID(riid, &IID_IClassFactory)) /*IClassFactory*/ 402 { *ppvObj = (IClassFactory*)This; 403 } 404 405 if(*ppvObj) 406 { IUnknown_AddRef((LPUNKNOWN)*ppvObj); 407 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj); 408 return S_OK; 409 } 410 TRACE("-- Interface: %s E_NOINTERFACE\n", debugstr_guid(riid)); 411 return E_NOINTERFACE; 412 } 414 413 /****************************************************************************** 415 414 * IDefClF_fnAddRef … … 417 416 static ULONG WINAPI IDefClF_fnAddRef(LPCLASSFACTORY iface) 418 417 { 419 420 421 422 423 418 ICOM_THIS(IDefClFImpl,iface); 419 TRACE("(%p)->(count=%lu)\n",This,This->ref); 420 421 InterlockedIncrement(&shell32_ObjCount); 422 return InterlockedIncrement(&This->ref); 424 423 } 425 424 /****************************************************************************** … … 428 427 static ULONG WINAPI IDefClF_fnRelease(LPCLASSFACTORY iface) 429 428 { 430 431 432 433 434 435 if (!InterlockedDecrement(&This->ref)) 436 { 437 438 439 440 441 442 443 429 ICOM_THIS(IDefClFImpl,iface); 430 TRACE("(%p)->(count=%lu)\n",This,This->ref); 431 432 InterlockedDecrement(&shell32_ObjCount); 433 434 if (!InterlockedDecrement(&This->ref)) 435 { 436 if (This->pcRefDll) InterlockedDecrement(This->pcRefDll); 437 438 TRACE("-- destroying IClassFactory(%p)\n",This); 439 HeapFree(GetProcessHeap(),0,This); 440 return 0; 441 } 442 return This->ref; 444 443 } 445 444 /****************************************************************************** … … 449 448 LPCLASSFACTORY iface, LPUNKNOWN pUnkOuter, REFIID riid, LPVOID *ppvObject) 450 449 { 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 450 ICOM_THIS(IDefClFImpl,iface); 451 452 TRACE("%p->(%p,\n\tIID:\t%s,%p)\n",This,pUnkOuter,debugstr_guid(riid),ppvObject); 453 454 *ppvObject = NULL; 455 456 if(pUnkOuter) 457 return(CLASS_E_NOAGGREGATION); 458 459 if ( This->riidInst==NULL || 460 IsEqualCLSID(riid, This->riidInst) || 461 IsEqualCLSID(riid, &IID_IUnknown) ) 462 { 463 return This->lpfnCI(pUnkOuter, riid, ppvObject); 464 } 465 466 ERR("unknown IID requested\n\tIID:\t%s\n",debugstr_guid(riid)); 467 return E_NOINTERFACE; 469 468 } 470 469 /****************************************************************************** … … 473 472 static HRESULT WINAPI IDefClF_fnLockServer(LPCLASSFACTORY iface, BOOL fLock) 474 473 { 475 476 477 478 } 479 480 static ICOM_VTABLE(IClassFactory) dclfvt = 474 ICOM_THIS(IDefClFImpl,iface); 475 TRACE("%p->(0x%x), not implemented\n",This, fLock); 476 return E_NOTIMPL; 477 } 478 479 static ICOM_VTABLE(IClassFactory) dclfvt = 481 480 { 482 481 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE … … 489 488 490 489 /****************************************************************************** 491 * SHCreateDefClassObject 490 * SHCreateDefClassObject [SHELL32.70] 492 491 */ 493 492 HRESULT WINAPI SHCreateDefClassObject( 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 493 REFIID riid, 494 LPVOID* ppv, 495 LPFNCREATEINSTANCE lpfnCI, /* [in] create instance callback entry */ 496 PLONG pcRefDll, /* [in/out] ref count of the dll */ 497 REFIID riidInst) /* [in] optional interface to the instance */ 498 { 499 TRACE("\n\tIID:\t%s %p %p %p \n\tIIDIns:\t%s\n", 501 500 debugstr_guid(riid), ppv, lpfnCI, pcRefDll, debugstr_guid(riidInst)); 502 501 503 504 505 506 507 508 509 510 511 512 513 514 } 515 516 /************************************************************************* 517 * DragAcceptFiles 502 if ( IsEqualCLSID(riid, &IID_IClassFactory) ) 503 { 504 IClassFactory * pcf = IDefClF_fnConstructor(lpfnCI, pcRefDll, riidInst); 505 if (pcf) 506 { 507 *ppv = pcf; 508 return NOERROR; 509 } 510 return E_OUTOFMEMORY; 511 } 512 return E_NOINTERFACE; 513 } 514 515 /************************************************************************* 516 * DragAcceptFiles [SHELL32.54] 518 517 */ 519 518 void WINAPI DragAcceptFiles(HWND hWnd, BOOL b) 520 519 { 521 522 523 524 525 526 527 528 529 530 } 531 532 /************************************************************************* 533 * DragFinish 520 LONG exstyle; 521 522 if( !IsWindow(hWnd) ) return; 523 exstyle = GetWindowLongA(hWnd,GWL_EXSTYLE); 524 if (b) 525 exstyle |= WS_EX_ACCEPTFILES; 526 else 527 exstyle &= ~WS_EX_ACCEPTFILES; 528 SetWindowLongA(hWnd,GWL_EXSTYLE,exstyle); 529 } 530 531 /************************************************************************* 532 * DragFinish [SHELL32.80] 534 533 */ 535 534 void WINAPI DragFinish(HDROP h) 536 535 { 537 538 539 } 540 541 /************************************************************************* 542 * DragQueryPoint 536 TRACE("\n"); 537 GlobalFree((HGLOBAL)h); 538 } 539 540 /************************************************************************* 541 * DragQueryPoint [SHELL32.135] 543 542 */ 544 543 BOOL WINAPI DragQueryPoint(HDROP hDrop, POINT *p) 545 544 { 546 545 DROPFILES *lpDropFileStruct; 547 548 549 550 551 546 BOOL bRet; 547 548 TRACE("\n"); 549 550 lpDropFileStruct = (DROPFILES *) GlobalLock(hDrop); 552 551 553 552 *p = lpDropFileStruct->pt; 554 555 556 557 558 } 559 560 /************************************************************************* 561 * DragQueryFileA 553 bRet = lpDropFileStruct->fNC; 554 555 GlobalUnlock(hDrop); 556 return bRet; 557 } 558 559 /************************************************************************* 560 * DragQueryFileA [SHELL32.81] [shell32.82] 562 561 */ 563 562 UINT WINAPI DragQueryFileA( 564 565 566 567 568 { 569 570 571 572 573 TRACE("(%08x, %x, %p, %u)\n",hDrop,lFile,lpszFile,lLength);574 575 576 577 578 579 580 581 582 if (!*lpDrop) 583 584 i = (lFile == 0xFFFFFFFF) ? i : 0; 585 586 587 588 589 590 591 592 593 563 HDROP hDrop, 564 UINT lFile, 565 LPSTR lpszFile, 566 UINT lLength) 567 { 568 LPSTR lpDrop; 569 UINT i = 0; 570 DROPFILES *lpDropFileStruct = (DROPFILES *) GlobalLock(hDrop); 571 572 TRACE("(%08x, %x, %p, %u)\n", hDrop,lFile,lpszFile,lLength); 573 574 if(!lpDropFileStruct) goto end; 575 576 lpDrop = (LPSTR) lpDropFileStruct + lpDropFileStruct->pFiles; 577 578 while (i++ < lFile) 579 { 580 while (*lpDrop++); /* skip filename */ 581 if (!*lpDrop) 582 { 583 i = (lFile == 0xFFFFFFFF) ? i : 0; 584 goto end; 585 } 586 } 587 588 i = strlen(lpDrop); 589 i++; 590 if (!lpszFile ) goto end; /* needed buffer size */ 591 i = (lLength > i) ? i : lLength; 592 lstrcpynA (lpszFile, lpDrop, i); 594 593 end: 595 596 597 } 598 599 /************************************************************************* 600 * DragQueryFileW 594 GlobalUnlock(hDrop); 595 return i; 596 } 597 598 /************************************************************************* 599 * DragQueryFileW [shell32.133] 601 600 */ 602 601 UINT WINAPI DragQueryFileW( 603 604 605 606 607 { 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 if (!*lpwDrop) 623 624 i = (lFile == 0xFFFFFFFF) ? i : 0; 625 626 627 628 629 630 631 632 633 634 602 HDROP hDrop, 603 UINT lFile, 604 LPWSTR lpszwFile, 605 UINT lLength) 606 { 607 LPWSTR lpwDrop; 608 UINT i = 0; 609 DROPFILES *lpDropFileStruct = (DROPFILES *) GlobalLock(hDrop); 610 611 TRACE("(%08x, %x, %p, %u)\n", hDrop,lFile,lpszwFile,lLength); 612 613 if(!lpDropFileStruct) goto end; 614 615 lpwDrop = (LPWSTR) lpDropFileStruct + lpDropFileStruct->pFiles; 616 617 i = 0; 618 while (i++ < lFile) 619 { 620 while (*lpwDrop++); /* skip filename */ 621 if (!*lpwDrop) 622 { 623 i = (lFile == 0xFFFFFFFF) ? i : 0; 624 goto end; 625 } 626 } 627 628 i = strlenW(lpwDrop); 629 i++; 630 if ( !lpszwFile) goto end; /* needed buffer size */ 631 632 i = (lLength > i) ? i : lLength; 633 lstrcpynW (lpszwFile, lpwDrop, i); 635 634 end: 636 637 638 } 635 GlobalUnlock(hDrop); 636 return i; 637 } -
trunk/src/shell32/shellord.c
r6650 r6709 1 /* $Id: shellord.c,v 1.4 2001-09-05 13:46:57 bird Exp $ */2 1 /* 3 2 * The parameters of many functions changes between different OS versions 4 3 * (NT uses Unicode strings, 95 uses ASCII strings) 5 * 4 * 6 5 * Copyright 1997 Marcus Meissner 7 6 * 1998 Jürgen Schmied … … 24 23 25 24 /************************************************************************* 26 * ParseFieldA 25 * ParseFieldA [internal] 27 26 * 28 27 * copys a field from a ',' delimited string 29 * 28 * 30 29 * first field is nField = 1 31 30 */ 32 31 DWORD WINAPI ParseFieldA( 33 34 35 36 DWORD len) 37 { 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 } 58 59 /************************************************************************* 60 * ParseFieldW 32 LPCSTR src, 33 DWORD nField, 34 LPSTR dst, 35 DWORD len) 36 { 37 WARN("('%s',0x%08lx,%p,%ld) semi-stub.\n",src,nField,dst,len); 38 39 if (!src || !src[0] || !dst || !len) 40 return 0; 41 42 /* skip n fields delimited by ',' */ 43 while (nField > 1) 44 { 45 if (*src=='\0') return FALSE; 46 if (*(src++)==',') nField--; 47 } 48 49 /* copy part till the next ',' to dst */ 50 while ( *src!='\0' && *src!=',' && (len--)>0 ) *(dst++)=*(src++); 51 52 /* finalize the string */ 53 *dst=0x0; 54 55 return TRUE; 56 } 57 58 /************************************************************************* 59 * ParseFieldW [internal] 61 60 * 62 61 * copys a field from a ',' delimited string 63 * 62 * 64 63 * first field is nField = 1 65 64 */ 66 DWORD WINAPI ParseFieldW(LPCWSTR src, DWORD nField, LPWSTR dst, DWORD len) 67 { 68 69 70 71 } 72 73 /************************************************************************* 74 * ParseFieldAW 75 */ 76 DWORD WINAPI ParseFieldAW(LPCVOID src, DWORD nField, LPVOID dst, DWORD len) 77 { 78 79 80 81 } 82 83 /************************************************************************* 84 * GetFileNameFromBrowse 85 * 65 DWORD WINAPI ParseFieldW(LPCWSTR src, DWORD nField, LPWSTR dst, DWORD len) 66 { 67 FIXME("('%s',0x%08lx,%p,%ld) stub.\n", 68 debugstr_w(src), nField, dst, len); 69 return FALSE; 70 } 71 72 /************************************************************************* 73 * ParseFieldAW [SHELL32.58] 74 */ 75 DWORD WINAPI ParseFieldAW(LPCVOID src, DWORD nField, LPVOID dst, DWORD len) 76 { 77 if (SHELL_OsIsUnicode()) 78 return ParseFieldW(src, nField, dst, len); 79 return ParseFieldA(src, nField, dst, len); 80 } 81 82 /************************************************************************* 83 * GetFileNameFromBrowse [SHELL32.63] 84 * 86 85 */ 87 86 BOOL WINAPI GetFileNameFromBrowse( 88 89 90 91 92 93 94 95 { 96 97 98 87 HWND hwndOwner, 88 LPSTR lpstrFile, 89 DWORD nMaxFile, 90 LPCSTR lpstrInitialDir, 91 LPCSTR lpstrDefExt, 92 LPCSTR lpstrFilter, 93 LPCSTR lpstrTitle) 94 { 95 FIXME("(%04x,%s,%ld,%s,%s,%s,%s):stub.\n", 96 hwndOwner, lpstrFile, nMaxFile, lpstrInitialDir, lpstrDefExt, 97 lpstrFilter, lpstrTitle); 99 98 100 99 /* puts up a Open Dialog and requests input into targetbuf */ … … 105 104 106 105 /************************************************************************* 107 * SHGetSetSettings 106 * SHGetSetSettings [SHELL32.68] 108 107 */ 109 108 VOID WINAPI SHGetSetSettings(DWORD x, DWORD y, DWORD z) 110 109 { 111 112 } 113 114 /************************************************************************* 115 * SHGetSettings 116 * 110 FIXME("0x%08lx 0x%08lx 0x%08lx\n", x, y, z); 111 } 112 113 /************************************************************************* 114 * SHGetSettings [SHELL32.@] 115 * 117 116 * NOTES 118 117 * the registry path are for win98 (tested) … … 122 121 VOID WINAPI SHGetSettings(LPSHELLFLAGSTATE lpsfs, DWORD dwMask) 123 122 { 124 HKEYhKey;125 DWORDdwData;126 DWORDdwDataSize = sizeof (DWORD);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 { if (SSF_SHOWALLOBJECTS & dwMask)lpsfs->fShowAllObjects = 0;155 if (SSF_SHOWSYSFILES & dwMask)lpsfs->fShowSysFiles = 0;156 157 158 { if (SSF_SHOWALLOBJECTS & dwMask)lpsfs->fShowAllObjects = 1;159 if (SSF_SHOWSYSFILES & dwMask)lpsfs->fShowSysFiles = 0;160 161 162 { if (SSF_SHOWALLOBJECTS & dwMask)lpsfs->fShowAllObjects = 0;163 if (SSF_SHOWSYSFILES & dwMask)lpsfs->fShowSysFiles = 1;164 165 166 167 168 169 } 170 171 /************************************************************************* 172 * SHShellFolderView_Message 123 HKEY hKey; 124 DWORD dwData; 125 DWORD dwDataSize = sizeof (DWORD); 126 127 TRACE("(%p 0x%08lx)\n",lpsfs,dwMask); 128 129 if (RegCreateKeyExA(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced", 130 0, 0, 0, KEY_ALL_ACCESS, 0, &hKey, 0)) 131 return; 132 133 if ( (SSF_SHOWEXTENSIONS & dwMask) && !RegQueryValueExA(hKey, "HideFileExt", 0, 0, (LPBYTE)&dwData, &dwDataSize)) 134 lpsfs->fShowExtensions = ((dwData == 0) ? 0 : 1); 135 136 if ( (SSF_SHOWINFOTIP & dwMask) && !RegQueryValueExA(hKey, "ShowInfoTip", 0, 0, (LPBYTE)&dwData, &dwDataSize)) 137 lpsfs->fShowInfoTip = ((dwData == 0) ? 0 : 1); 138 139 if ( (SSF_DONTPRETTYPATH & dwMask) && !RegQueryValueExA(hKey, "DontPrettyPath", 0, 0, (LPBYTE)&dwData, &dwDataSize)) 140 lpsfs->fDontPrettyPath = ((dwData == 0) ? 0 : 1); 141 142 if ( (SSF_HIDEICONS & dwMask) && !RegQueryValueExA(hKey, "HideIcons", 0, 0, (LPBYTE)&dwData, &dwDataSize)) 143 lpsfs->fHideIcons = ((dwData == 0) ? 0 : 1); 144 145 if ( (SSF_MAPNETDRVBUTTON & dwMask) && !RegQueryValueExA(hKey, "MapNetDrvBtn", 0, 0, (LPBYTE)&dwData, &dwDataSize)) 146 lpsfs->fMapNetDrvBtn = ((dwData == 0) ? 0 : 1); 147 148 if ( (SSF_SHOWATTRIBCOL & dwMask) && !RegQueryValueExA(hKey, "ShowAttribCol", 0, 0, (LPBYTE)&dwData, &dwDataSize)) 149 lpsfs->fShowAttribCol = ((dwData == 0) ? 0 : 1); 150 151 if (((SSF_SHOWALLOBJECTS | SSF_SHOWSYSFILES) & dwMask) && !RegQueryValueExA(hKey, "Hidden", 0, 0, (LPBYTE)&dwData, &dwDataSize)) 152 { if (dwData == 0) 153 { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 0; 154 if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 0; 155 } 156 else if (dwData == 1) 157 { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 1; 158 if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 0; 159 } 160 else if (dwData == 2) 161 { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 0; 162 if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 1; 163 } 164 } 165 RegCloseKey (hKey); 166 167 TRACE("-- 0x%04x\n", *(WORD*)lpsfs); 168 } 169 170 /************************************************************************* 171 * SHShellFolderView_Message [SHELL32.73] 173 172 * 174 173 * PARAMETERS 175 * hwndCabinet defines the explorer cabinet window that contains the 174 * hwndCabinet defines the explorer cabinet window that contains the 176 175 * shellview you need to communicate with 177 176 * uMsg identifying the SFVM enum to perform … … 185 184 */ 186 185 int WINAPI SHShellFolderView_Message( 187 HWND hwndCabinet, 188 189 190 { 191 192 193 } 194 195 /************************************************************************* 196 * RegisterShellHook 186 HWND hwndCabinet, 187 DWORD dwMessage, 188 DWORD dwParam) 189 { 190 FIXME("%04x %08lx %08lx stub\n",hwndCabinet, dwMessage, dwParam); 191 return 0; 192 } 193 194 /************************************************************************* 195 * RegisterShellHook [SHELL32.181] 197 196 * 198 197 * PARAMS 199 198 * hwnd [I] window handle 200 199 * y [I] flag ???? 201 * 200 * 202 201 * NOTES 203 202 * exported by ordinal 204 203 */ 205 204 BOOL WINAPI RegisterShellHook( 206 207 208 { 209 210 211 } 212 /************************************************************************* 213 * ShellMessageBoxW 205 HWND hWnd, 206 DWORD dwType) 207 { 208 FIXME("(0x%08x,0x%08lx):stub.\n",hWnd, dwType); 209 return TRUE; 210 } 211 /************************************************************************* 212 * ShellMessageBoxW [SHELL32.182] 214 213 * 215 214 * Format and output errormessage. 216 215 * 217 * idText 218 * idTitle 216 * idText resource ID of title or LPSTR 217 * idTitle resource ID of title or LPSTR 219 218 * 220 219 * NOTES … … 222 221 */ 223 222 int WINAPIV ShellMessageBoxW( 224 225 226 227 228 229 230 { 231 WCHARszText[100],szTitle[100];232 233 234 intret;235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING, 253 254 255 256 257 258 259 260 } 261 262 /************************************************************************* 263 * ShellMessageBoxA 223 HINSTANCE hInstance, 224 HWND hWnd, 225 LPCWSTR lpText, 226 LPCWSTR lpCaption, 227 UINT uType, 228 ...) 229 { 230 WCHAR szText[100],szTitle[100]; 231 LPCWSTR pszText = szText, pszTitle = szTitle, pszTemp; 232 va_list args; 233 int ret; 234 235 va_start(args, uType); 236 /* wvsprintfA(buf,fmt, args); */ 237 238 TRACE("(%08lx,%08lx,%p,%p,%08x)\n", 239 (DWORD)hInstance,(DWORD)hWnd,lpText,lpCaption,uType); 240 241 if (!HIWORD(lpCaption)) 242 LoadStringW(hInstance, (DWORD)lpCaption, szTitle, sizeof(szTitle)/sizeof(szTitle[0])); 243 else 244 pszTitle = lpCaption; 245 246 if (!HIWORD(lpText)) 247 LoadStringW(hInstance, (DWORD)lpText, szText, sizeof(szText)/sizeof(szText[0])); 248 else 249 pszText = lpText; 250 251 FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING, 252 pszText, 0, 0, (LPWSTR)&pszTemp, 0, &args); 253 254 va_end(args); 255 256 ret = MessageBoxW(hWnd,pszTemp,pszTitle,uType); 257 LocalFree((HLOCAL)pszTemp); 258 return ret; 259 } 260 261 /************************************************************************* 262 * ShellMessageBoxA [SHELL32.183] 264 263 */ 265 264 int WINAPIV ShellMessageBoxA( 266 267 268 269 270 271 272 { 273 charszText[100],szTitle[100];274 275 276 intret;277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING, 295 296 297 298 299 300 301 302 } 303 304 /************************************************************************* 305 * SHFree 265 HINSTANCE hInstance, 266 HWND hWnd, 267 LPCSTR lpText, 268 LPCSTR lpCaption, 269 UINT uType, 270 ...) 271 { 272 char szText[100],szTitle[100]; 273 LPCSTR pszText = szText, pszTitle = szTitle, pszTemp; 274 va_list args; 275 int ret; 276 277 va_start(args, uType); 278 /* wvsprintfA(buf,fmt, args); */ 279 280 TRACE("(%08lx,%08lx,%p,%p,%08x)\n", 281 (DWORD)hInstance,(DWORD)hWnd,lpText,lpCaption,uType); 282 283 if (!HIWORD(lpCaption)) 284 LoadStringA(hInstance, (DWORD)lpCaption, szTitle, sizeof(szTitle)); 285 else 286 pszTitle = lpCaption; 287 288 if (!HIWORD(lpText)) 289 LoadStringA(hInstance, (DWORD)lpText, szText, sizeof(szText)); 290 else 291 pszText = lpText; 292 293 FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING, 294 pszText, 0, 0, (LPSTR)&pszTemp, 0, &args); 295 296 va_end(args); 297 298 ret = MessageBoxA(hWnd,pszTemp,pszTitle,uType); 299 LocalFree((HLOCAL)pszTemp); 300 return ret; 301 } 302 303 /************************************************************************* 304 * SHFree [SHELL32.195] 306 305 * 307 306 * NOTES … … 310 309 */ 311 310 #define MEM_DEBUG 0 312 void WINAPI SHFree(LPVOID x) 311 void WINAPI SHFree(LPVOID x) 313 312 { 314 313 #if MEM_DEBUG 315 316 317 318 319 320 321 322 323 324 325 326 327 314 WORD len = *(LPWORD)((LPBYTE)x-2); 315 316 if ( *(LPWORD)((LPBYTE)x+len) != 0x7384) 317 ERR("MAGIC2!\n"); 318 319 if ( (*(LPWORD)((LPBYTE)x-4)) != 0x8271) 320 ERR("MAGIC1!\n"); 321 else 322 memset((LPBYTE)x-4, 0xde, len+6); 323 324 TRACE("%p len=%u\n",x, len); 325 326 x = (LPBYTE) x - 4; 328 327 #else 329 328 TRACE("%p\n",x); 330 329 #endif 331 332 } 333 334 /************************************************************************* 335 * SHAlloc 330 HeapFree(GetProcessHeap(), 0, x); 331 } 332 333 /************************************************************************* 334 * SHAlloc [SHELL32.196] 336 335 * 337 336 * NOTES … … 339 338 * exported by ordinal 340 339 */ 341 LPVOID WINAPI SHAlloc(DWORD len) 342 { 343 340 LPVOID WINAPI SHAlloc(DWORD len) 341 { 342 LPBYTE ret; 344 343 345 344 #if MEM_DEBUG 346 345 ret = (LPVOID) HeapAlloc(GetProcessHeap(),0,len+6); 347 346 #else 348 347 ret = (LPVOID) HeapAlloc(GetProcessHeap(),0,len); 349 348 #endif 350 349 351 350 #if MEM_DEBUG 352 353 354 355 356 351 *(LPWORD)(ret) = 0x8271; 352 *(LPWORD)(ret+2) = (WORD)len; 353 *(LPWORD)(ret+4+len) = 0x7384; 354 ret += 4; 355 memset(ret, 0xdf, len); 357 356 #endif 358 359 360 } 361 362 /************************************************************************* 363 * SHRegisterDragDrop 357 TRACE("%lu bytes at %p\n",len, ret); 358 return (LPVOID)ret; 359 } 360 361 /************************************************************************* 362 * SHRegisterDragDrop [SHELL32.86] 364 363 * 365 364 * NOTES … … 367 366 */ 368 367 HRESULT WINAPI SHRegisterDragDrop( 369 370 371 { 372 373 368 HWND hWnd, 369 LPDROPTARGET pDropTarget) 370 { 371 FIXME("(0x%08x,%p):stub.\n", hWnd, pDropTarget); 372 if (GetShellOle()) return pRegisterDragDrop(hWnd, pDropTarget); 374 373 return 0; 375 374 } 376 375 377 376 /************************************************************************* 378 * SHRevokeDragDrop 377 * SHRevokeDragDrop [SHELL32.87] 379 378 * 380 379 * NOTES … … 388 387 389 388 /************************************************************************* 390 * SHDoDragDrop 389 * SHDoDragDrop [SHELL32.88] 391 390 * 392 391 * NOTES … … 394 393 */ 395 394 HRESULT WINAPI SHDoDragDrop( 396 397 398 399 400 395 HWND hWnd, 396 LPDATAOBJECT lpDataObject, 397 LPDROPSOURCE lpDropSource, 398 DWORD dwOKEffect, 399 LPDWORD pdwEffect) 401 400 { 402 401 FIXME("(0x%04x %p %p 0x%08lx %p):stub.\n", … … 406 405 407 406 /************************************************************************* 408 * ArrangeWindows 409 * 407 * ArrangeWindows [SHELL32.184] 408 * 410 409 */ 411 410 WORD WINAPI ArrangeWindows( 412 413 414 415 416 411 HWND hwndParent, 412 DWORD dwReserved, 413 LPCRECT lpRect, 414 WORD cKids, 415 CONST HWND * lpKids) 417 416 { 418 417 FIXME("(0x%08x 0x%08lx %p 0x%04x %p):stub.\n", 419 418 hwndParent, dwReserved, lpRect, cKids, lpKids); 420 419 return 0; 421 420 } 422 421 423 422 /************************************************************************* 424 * SignalFileOpen 423 * SignalFileOpen [SHELL32.103] 425 424 * 426 425 * NOTES … … 436 435 437 436 /************************************************************************* 438 * SHAddToRecentDocs 437 * SHAddToRecentDocs [SHELL32.234] 439 438 * 440 439 * PARAMETERS … … 445 444 * exported by name 446 445 */ 447 DWORD WINAPI SHAddToRecentDocs (UINT uFlags,LPCVOID pv) 446 DWORD WINAPI SHAddToRecentDocs (UINT uFlags,LPCVOID pv) 448 447 { if (SHARD_PIDL==uFlags) 449 448 { FIXME("(0x%08x,pidl=%p):stub.\n", uFlags,pv); 450 451 452 453 449 } 450 else 451 { FIXME("(0x%08x,%s):stub.\n", uFlags,(char*)pv); 452 } 454 453 return 0; 455 454 } 456 455 /************************************************************************* 457 * SHCreateShellFolderViewEx 456 * SHCreateShellFolderViewEx [SHELL32.174] 458 457 * 459 458 * NOTES … … 461 460 */ 462 461 HRESULT WINAPI SHCreateShellFolderViewEx( 463 464 465 { 466 467 468 469 TRACE("sf=%p pidl=%p cb=%p mode=0x%08x parm=0x%08lx\n", 470 471 472 473 474 475 476 477 478 479 480 481 482 483 } 484 /************************************************************************* 485 * SHWinHelp 462 LPCSHELLFOLDERVIEWINFO psvcbi, /* [in] shelltemplate struct */ 463 LPSHELLVIEW* ppv) /* [out] IShellView pointer */ 464 { 465 IShellView * psf; 466 HRESULT hRes; 467 468 TRACE("sf=%p pidl=%p cb=%p mode=0x%08x parm=0x%08lx\n", 469 psvcbi->pshf, psvcbi->pidlFolder, psvcbi->lpfnCallback, 470 psvcbi->uViewMode, psvcbi->dwUser); 471 472 psf = IShellView_Constructor(psvcbi->pshf); 473 474 if (!psf) 475 return E_OUTOFMEMORY; 476 477 IShellView_AddRef(psf); 478 hRes = IShellView_QueryInterface(psf, &IID_IShellView, (LPVOID *)ppv); 479 IShellView_Release(psf); 480 481 return hRes; 482 } 483 /************************************************************************* 484 * SHWinHelp [SHELL32.127] 486 485 * 487 486 */ 488 487 HRESULT WINAPI SHWinHelp (DWORD v, DWORD w, DWORD x, DWORD z) 489 { 490 488 { FIXME("0x%08lx 0x%08lx 0x%08lx 0x%08lx stub\n",v,w,x,z); 489 return 0; 491 490 } 492 491 /************************************************************************* … … 495 494 */ 496 495 HRESULT WINAPI SHRunControlPanel (DWORD x, DWORD z) 497 { 498 499 } 500 /************************************************************************* 501 * ShellExecuteEx 496 { FIXME("0x%08lx 0x%08lx stub\n",x,z); 497 return 0; 498 } 499 /************************************************************************* 500 * ShellExecuteEx [SHELL32.291] 502 501 * 503 502 */ 504 503 BOOL WINAPI ShellExecuteExAW (LPVOID sei) 505 { 506 507 508 } 509 /************************************************************************* 510 * ShellExecuteExA 504 { if (SHELL_OsIsUnicode()) 505 return ShellExecuteExW (sei); 506 return ShellExecuteExA (sei); 507 } 508 /************************************************************************* 509 * ShellExecuteExA [SHELL32.292] 511 510 * 512 511 * placeholder in the commandline: 513 * 514 * 515 * 516 * 517 * 518 * 519 * 520 * 512 * %1 file 513 * %2 printer 514 * %3 driver 515 * %4 port 516 * %I adress of a global item ID (explorer switch /idlist) 517 * %L ??? path/url/current file ??? 518 * %S ??? 519 * %* all following parameters (see batfile) 521 520 */ 522 521 BOOL WINAPI ShellExecuteExA (LPSHELLEXECUTEINFOA sei) 523 { 524 525 526 527 528 529 530 531 sei->lpParameters, sei->lpDirectory, sei->nShow, 532 533 534 535 536 537 538 539 540 541 542 543 544 SEE_MASK_DOENVSUBST | SEE_MASK_FLAG_NO_UI | SEE_MASK_UNICODE | 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 596 NULL, NULL, FALSE, 0, 597 598 599 600 601 522 { CHAR szApplicationName[MAX_PATH],szCommandline[MAX_PATH],szPidl[20]; 523 LPSTR pos; 524 int gap, len; 525 STARTUPINFOA startup; 526 PROCESS_INFORMATION info; 527 528 WARN("mask=0x%08lx hwnd=0x%04x verb=%s file=%s parm=%s dir=%s show=0x%08x class=%s incomplete\n", 529 sei->fMask, sei->hwnd, sei->lpVerb, sei->lpFile, 530 sei->lpParameters, sei->lpDirectory, sei->nShow, 531 (sei->fMask & SEE_MASK_CLASSNAME) ? sei->lpClass : "not used"); 532 533 ZeroMemory(szApplicationName,MAX_PATH); 534 if (sei->lpFile) 535 strcpy(szApplicationName, sei->lpFile); 536 537 ZeroMemory(szCommandline,MAX_PATH); 538 if (sei->lpParameters) 539 strcpy(szCommandline, sei->lpParameters); 540 541 if (sei->fMask & (SEE_MASK_CLASSKEY | SEE_MASK_INVOKEIDLIST | SEE_MASK_ICON | SEE_MASK_HOTKEY | 542 SEE_MASK_CONNECTNETDRV | SEE_MASK_FLAG_DDEWAIT | 543 SEE_MASK_DOENVSUBST | SEE_MASK_FLAG_NO_UI | SEE_MASK_UNICODE | 544 SEE_MASK_NO_CONSOLE | SEE_MASK_ASYNCOK | SEE_MASK_HMONITOR )) 545 { 546 FIXME("flags ignored: 0x%08lx\n", sei->fMask); 547 } 548 549 /* launch a document by fileclass like 'Wordpad.Document.1' */ 550 if (sei->fMask & SEE_MASK_CLASSNAME) 551 { 552 /* the commandline contains 'c:\Path\wordpad.exe "%1"' */ 553 HCR_GetExecuteCommand(sei->lpClass, (sei->lpVerb) ? sei->lpVerb : "open", szCommandline, 256); 554 /* fixme: get the extension of lpFile, check if it fits to the lpClass */ 555 TRACE("SEE_MASK_CLASSNAME->'%s'\n", szCommandline); 556 } 557 558 /* process the IDList */ 559 if ( (sei->fMask & SEE_MASK_INVOKEIDLIST) == SEE_MASK_INVOKEIDLIST) /*0x0c*/ 560 { 561 SHGetPathFromIDListA (sei->lpIDList,szApplicationName); 562 TRACE("-- idlist=%p (%s)\n", sei->lpIDList, szApplicationName); 563 } 564 else 565 { 566 if (sei->fMask & SEE_MASK_IDLIST ) 567 { 568 pos = strstr(szCommandline, "%I"); 569 if (pos) 570 { 571 LPVOID pv; 572 HGLOBAL hmem = SHAllocShared ( sei->lpIDList, ILGetSize(sei->lpIDList), 0); 573 pv = SHLockShared(hmem,0); 574 sprintf(szPidl,":%p",pv ); 575 SHUnlockShared(pv); 576 577 gap = strlen(szPidl); 578 len = strlen(pos)-2; 579 memmove(pos+gap,pos+2,len); 580 memcpy(pos,szPidl,gap); 581 582 } 583 } 584 } 585 586 TRACE("execute:'%s','%s'\n",szApplicationName, szCommandline); 587 588 strcat(szApplicationName, " "); 589 strcat(szApplicationName, szCommandline); 590 591 ZeroMemory(&startup,sizeof(STARTUPINFOA)); 592 startup.cb = sizeof(STARTUPINFOA); 593 594 if (! CreateProcessA(NULL, szApplicationName, 595 NULL, NULL, FALSE, 0, 596 NULL, NULL, &startup, &info)) 597 { 598 sei->hInstApp = GetLastError(); 599 return FALSE; 600 } 602 601 603 602 sei->hInstApp = 33; 604 605 606 607 608 609 610 sei->hProcess = info.hProcess; 603 604 /* Give 30 seconds to the app to come up */ 605 if ( WaitForInputIdle ( info.hProcess, 30000 ) == 0xFFFFFFFF ) 606 ERR("WaitForInputIdle failed: Error %ld\n", GetLastError() ); 607 608 if(sei->fMask & SEE_MASK_NOCLOSEPROCESS) 609 sei->hProcess = info.hProcess; 611 610 else 612 611 CloseHandle( info.hProcess ); 613 612 CloseHandle( info.hThread ); 614 615 } 616 /************************************************************************* 617 * ShellExecuteExW 613 return TRUE; 614 } 615 /************************************************************************* 616 * ShellExecuteExW [SHELL32.293] 618 617 * 619 618 */ 620 619 BOOL WINAPI ShellExecuteExW (LPSHELLEXECUTEINFOW sei) 621 { 622 623 624 625 626 627 620 { SHELLEXECUTEINFOA seiA; 621 DWORD ret; 622 623 TRACE("%p\n", sei); 624 625 memcpy(&seiA, sei, sizeof(SHELLEXECUTEINFOA)); 626 628 627 if (sei->lpVerb) 629 628 seiA.lpVerb = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpVerb); 630 629 631 630 if (sei->lpFile) 632 631 seiA.lpFile = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpFile); 633 632 634 633 if (sei->lpParameters) 635 636 637 638 634 seiA.lpParameters = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpParameters); 635 636 if (sei->lpDirectory) 637 seiA.lpDirectory = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpDirectory); 639 638 640 639 if ((sei->fMask & SEE_MASK_CLASSNAME) && sei->lpClass) 641 642 643 644 645 646 647 if (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 640 seiA.lpClass = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpClass); 641 else 642 seiA.lpClass = NULL; 643 644 ret = ShellExecuteExA(&seiA); 645 646 if (seiA.lpVerb) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpVerb ); 647 if (seiA.lpFile) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpFile ); 648 if (seiA.lpParameters) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpParameters ); 649 if (seiA.lpDirectory) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpDirectory ); 650 if (seiA.lpClass) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpClass ); 651 652 return ret; 654 653 } 655 654 656 655 static LPUNKNOWN SHELL32_IExplorerInterface=0; 657 656 /************************************************************************* 658 * SHSetInstanceExplorer 657 * SHSetInstanceExplorer [SHELL32.176] 659 658 * 660 659 * NOTES … … 662 661 */ 663 662 HRESULT WINAPI SHSetInstanceExplorer (LPUNKNOWN lpUnknown) 664 { 665 666 667 } 668 /************************************************************************* 669 * SHGetInstanceExplorer 663 { TRACE("%p\n", lpUnknown); 664 SHELL32_IExplorerInterface = lpUnknown; 665 return (HRESULT) lpUnknown; 666 } 667 /************************************************************************* 668 * SHGetInstanceExplorer [SHELL32.256] 670 669 * 671 670 * NOTES … … 673 672 */ 674 673 HRESULT WINAPI SHGetInstanceExplorer (LPUNKNOWN * lpUnknown) 675 { 676 677 678 679 680 681 682 683 684 } 685 /************************************************************************* 686 * SHFreeUnusedLibraries 674 { TRACE("%p\n", lpUnknown); 675 676 *lpUnknown = SHELL32_IExplorerInterface; 677 678 if (!SHELL32_IExplorerInterface) 679 return E_FAIL; 680 681 IUnknown_AddRef(SHELL32_IExplorerInterface); 682 return NOERROR; 683 } 684 /************************************************************************* 685 * SHFreeUnusedLibraries [SHELL32.123] 687 686 * 688 687 * NOTES … … 691 690 void WINAPI SHFreeUnusedLibraries (void) 692 691 { 693 694 } 695 /************************************************************************* 696 * DAD_SetDragImage 692 FIXME("stub\n"); 693 } 694 /************************************************************************* 695 * DAD_SetDragImage [SHELL32.136] 697 696 * 698 697 * NOTES … … 700 699 */ 701 700 BOOL WINAPI DAD_SetDragImage( 702 703 704 { 705 701 HIMAGELIST himlTrack, 702 LPPOINT lppt) 703 { 704 FIXME("%p %p stub\n",himlTrack, lppt); 706 705 return 0; 707 706 } 708 707 /************************************************************************* 709 * DAD_ShowDragImage 708 * DAD_ShowDragImage [SHELL32.137] 710 709 * 711 710 * NOTES … … 714 713 BOOL WINAPI DAD_ShowDragImage(BOOL bShow) 715 714 { 716 717 718 } 719 /************************************************************************* 720 * ReadCabinetState 715 FIXME("0x%08x stub\n",bShow); 716 return 0; 717 } 718 /************************************************************************* 719 * ReadCabinetState [NT 4.0:SHELL32.651] 721 720 * 722 721 */ 723 722 HRESULT WINAPI ReadCabinetState(DWORD u, DWORD v) 724 { 725 726 } 727 /************************************************************************* 728 * WriteCabinetState 723 { FIXME("0x%04lx 0x%04lx stub\n",u,v); 724 return 0; 725 } 726 /************************************************************************* 727 * WriteCabinetState [NT 4.0:SHELL32.652] 729 728 * 730 729 */ 731 730 HRESULT WINAPI WriteCabinetState(DWORD u) 732 { 733 734 } 735 /************************************************************************* 736 * FileIconInit 731 { FIXME("0x%04lx stub\n",u); 732 return 0; 733 } 734 /************************************************************************* 735 * FileIconInit [SHELL32.660] 737 736 * 738 737 */ 739 738 BOOL WINAPI FileIconInit(BOOL bFullInit) 740 { 741 742 } 743 /************************************************************************* 744 * IsUserAdmin 739 { FIXME("(%s)\n", bFullInit ? "true" : "false"); 740 return 0; 741 } 742 /************************************************************************* 743 * IsUserAdmin [NT 4.0:SHELL32.680] 745 744 * 746 745 */ 747 746 HRESULT WINAPI IsUserAdmin(void) 748 { 749 750 } 751 752 /************************************************************************* 753 * SHAllocShared 747 { FIXME("stub\n"); 748 return TRUE; 749 } 750 751 /************************************************************************* 752 * SHAllocShared [SHELL32.520] 754 753 * 755 754 * NOTES … … 763 762 */ 764 763 HGLOBAL WINAPI SHAllocShared(LPVOID psrc, DWORD size, DWORD procID) 765 { 766 767 768 769 770 771 772 773 774 775 776 777 778 779 GlobalUnlock(hmem); 780 781 } 782 /************************************************************************* 783 * SHLockShared 764 { HGLOBAL hmem; 765 LPVOID pmem; 766 767 TRACE("ptr=%p size=0x%04lx procID=0x%04lx\n",psrc,size,procID); 768 hmem = GlobalAlloc(GMEM_FIXED, size); 769 if (!hmem) 770 return 0; 771 772 pmem = GlobalLock (hmem); 773 774 if (! pmem) 775 return 0; 776 777 memcpy (pmem, psrc, size); 778 GlobalUnlock(hmem); 779 return hmem; 780 } 781 /************************************************************************* 782 * SHLockShared [SHELL32.521] 784 783 * 785 784 * NOTES 786 785 * parameter1 is return value from SHAllocShared 787 786 * parameter2 is return value from GetCurrentProcessId 788 * the receiver of (WM_USER+2) trys to lock the HANDLE (?) 787 * the receiver of (WM_USER+2) trys to lock the HANDLE (?) 789 788 * the returnvalue seems to be a memoryadress 790 789 */ 791 790 LPVOID WINAPI SHLockShared(HANDLE hmem, DWORD procID) 792 { 793 794 } 795 /************************************************************************* 796 * SHUnlockShared 791 { TRACE("handle=0x%04x procID=0x%04lx\n",hmem,procID); 792 return GlobalLock(hmem); 793 } 794 /************************************************************************* 795 * SHUnlockShared [SHELL32.522] 797 796 * 798 797 * NOTES … … 801 800 BOOL WINAPI SHUnlockShared(LPVOID pv) 802 801 { 803 804 return GlobalUnlock((HANDLE)pv); 805 } 806 /************************************************************************* 807 * SHFreeShared 802 TRACE("%p\n",pv); 803 return GlobalUnlock((HANDLE)pv); 804 } 805 /************************************************************************* 806 * SHFreeShared [SHELL32.523] 808 807 * 809 808 * NOTES … … 812 811 */ 813 812 BOOL WINAPI SHFreeShared( 814 815 816 { 817 818 819 } 820 821 /************************************************************************* 822 * SetAppStartingCursor 813 HANDLE hMem, 814 DWORD pid) 815 { 816 TRACE("handle=0x%04x 0x%04lx\n",hMem,pid); 817 return GlobalFree(hMem); 818 } 819 820 /************************************************************************* 821 * SetAppStartingCursor [SHELL32.99] 823 822 */ 824 823 HRESULT WINAPI SetAppStartingCursor(HWND u, DWORD v) 825 { 826 827 } 828 /************************************************************************* 829 * SHLoadOLE 824 { FIXME("hwnd=0x%04x 0x%04lx stub\n",u,v ); 825 return 0; 826 } 827 /************************************************************************* 828 * SHLoadOLE [SHELL32.151] 830 829 * 831 830 */ 832 831 HRESULT WINAPI SHLoadOLE(DWORD u) 833 { 834 835 } 836 /************************************************************************* 837 * DriveType 832 { FIXME("0x%04lx stub\n",u); 833 return S_OK; 834 } 835 /************************************************************************* 836 * DriveType [SHELL32.64] 838 837 * 839 838 */ 840 839 HRESULT WINAPI DriveType(DWORD u) 841 { 842 843 } 844 /************************************************************************* 845 * SHAbortInvokeCommand 840 { FIXME("0x%04lx stub\n",u); 841 return 0; 842 } 843 /************************************************************************* 844 * SHAbortInvokeCommand [SHELL32.198] 846 845 * 847 846 */ 848 847 HRESULT WINAPI SHAbortInvokeCommand(void) 849 { 850 851 } 852 /************************************************************************* 853 * SHOutOfMemoryMessageBox 848 { FIXME("stub\n"); 849 return 1; 850 } 851 /************************************************************************* 852 * SHOutOfMemoryMessageBox [SHELL32.126] 854 853 * 855 854 */ 856 855 int WINAPI SHOutOfMemoryMessageBox( 857 858 859 860 { 861 862 863 } 864 /************************************************************************* 865 * SHFlushClipboard 856 HWND hwndOwner, 857 LPCSTR lpCaption, 858 UINT uType) 859 { 860 FIXME("0x%04x %s 0x%08x stub\n",hwndOwner, lpCaption, uType); 861 return 0; 862 } 863 /************************************************************************* 864 * SHFlushClipboard [SHELL32.121] 866 865 * 867 866 */ 868 867 HRESULT WINAPI SHFlushClipboard(void) 869 { 870 871 } 872 873 /************************************************************************* 874 * SHWaitForFileToOpen 868 { FIXME("stub\n"); 869 return 1; 870 } 871 872 /************************************************************************* 873 * SHWaitForFileToOpen [SHELL32.97] 875 874 * 876 875 */ 877 876 BOOL WINAPI SHWaitForFileToOpen( 878 LPCITEMIDLIST pidl, 879 880 881 { 882 883 877 LPCITEMIDLIST pidl, 878 DWORD dwFlags, 879 DWORD dwTimeout) 880 { 881 FIXME("%p 0x%08lx 0x%08lx stub\n", pidl, dwFlags, dwTimeout); 882 return 0; 884 883 } 885 884 886 885 /************************************************************************ 887 * shell32_654[SHELL32.654]886 * shell32_654 [SHELL32.654] 888 887 * 889 888 * NOTES: first parameter seems to be a pointer (same as passed to WriteCabinetState) … … 893 892 */ 894 893 HRESULT WINAPI shell32_654 (DWORD x, DWORD y) 895 { 896 894 { FIXME("0x%08lx 0x%08lx stub\n",x,y); 895 return 0; 897 896 } 898 897 899 898 /************************************************************************ 900 * RLBuildListOfPaths[SHELL32.146]899 * RLBuildListOfPaths [SHELL32.146] 901 900 * 902 901 * NOTES … … 904 903 */ 905 904 DWORD WINAPI RLBuildListOfPaths (void) 906 { 907 905 { FIXME("stub\n"); 906 return 0; 908 907 } 909 908 /************************************************************************ 910 * SHValidateUNC[SHELL32.173]909 * SHValidateUNC [SHELL32.173] 911 910 * 912 911 */ 913 912 HRESULT WINAPI SHValidateUNC (DWORD x, DWORD y, DWORD z) 914 913 { 915 916 914 FIXME("0x%08lx 0x%08lx 0x%08lx stub\n",x,y,z); 915 return 0; 917 916 } 918 917 919 918 /************************************************************************ 920 * DoEnvironmentSubstA[SHELL32.1222]919 * DoEnvironmentSubstA [SHELL32.1222] 921 920 * 922 921 */ 923 922 HRESULT WINAPI DoEnvironmentSubstA(LPSTR x, LPSTR y) 924 923 { 925 926 924 FIXME("(%s, %s) stub\n", debugstr_a(x), debugstr_a(y)); 925 return 0; 927 926 } 928 927 929 928 /************************************************************************ 930 * DoEnvironmentSubstW[SHELL32.1223]929 * DoEnvironmentSubstW [SHELL32.1223] 931 930 * 932 931 */ 933 932 HRESULT WINAPI DoEnvironmentSubstW(LPWSTR x, LPWSTR y) 934 933 { 935 936 934 FIXME("(%s, %s): stub\n", debugstr_w(x), debugstr_w(y)); 935 return 0; 937 936 } 938 937 939 938 /************************************************************************ 940 * DoEnvironmentSubst[SHELL32.53]939 * DoEnvironmentSubst [SHELL32.53] 941 940 * 942 941 */ 943 942 HRESULT WINAPI DoEnvironmentSubstAW(LPVOID x, LPVOID y) 944 943 { 945 946 947 944 if (SHELL_OsIsUnicode()) 945 return DoEnvironmentSubstW(x, y); 946 return DoEnvironmentSubstA(x, y); 948 947 } 949 948 950 949 /************************************************************************* 951 950 * shell32_243 [SHELL32.243] 952 * 951 * 953 952 * Win98+ by-ordinal routine. In Win98 this routine returns zero and 954 953 * does nothing else. Possibly this does something in NT or SHELL32 5.0? … … 956 955 */ 957 956 958 BOOL WINAPI shell32_243(DWORD a, DWORD b) 959 { 960 return FALSE; 961 } 962 963 /************************************************************************* 964 * SHELL32_714 957 BOOL WINAPI shell32_243(DWORD a, DWORD b) 958 { 959 return FALSE; 960 } 961 962 /************************************************************************* 963 * SHELL32_714 [SHELL32] 965 964 */ 966 965 DWORD WINAPI SHELL32_714(LPVOID x) 967 966 { 968 969 970 } 971 972 /************************************************************************* 973 * SHAddFromPropSheetExtArray 967 FIXME("(%s)stub\n", debugstr_w(x)); 968 return 0; 969 } 970 971 /************************************************************************* 972 * SHAddFromPropSheetExtArray [SHELL32] 974 973 */ 975 974 DWORD WINAPI SHAddFromPropSheetExtArray(DWORD a, DWORD b, DWORD c) 976 975 { 977 978 979 } 980 981 /************************************************************************* 982 * SHCreatePropSheetExtArray 976 FIXME("(%08lx,%08lx,%08lx)stub\n", a, b, c); 977 return 0; 978 } 979 980 /************************************************************************* 981 * SHCreatePropSheetExtArray [SHELL32] 983 982 */ 984 983 DWORD WINAPI SHCreatePropSheetExtArray(DWORD a, LPCSTR b, DWORD c) 985 984 { 986 987 988 } 989 990 /************************************************************************* 991 * SHReplaceFromPropSheetExtArray 985 FIXME("(%08lx,%s,%08lx)stub\n", a, debugstr_a(b), c); 986 return 0; 987 } 988 989 /************************************************************************* 990 * SHReplaceFromPropSheetExtArray [SHELL] 992 991 */ 993 992 DWORD WINAPI SHReplaceFromPropSheetExtArray(DWORD a, DWORD b, DWORD c, DWORD d) 994 993 { 995 996 997 } 998 999 /************************************************************************* 1000 * SHDestroyPropSheetExtArray 994 FIXME("(%08lx,%08lx,%08lx,%08lx)stub\n", a, b, c, d); 995 return 0; 996 } 997 998 /************************************************************************* 999 * SHDestroyPropSheetExtArray [SHELL32] 1001 1000 */ 1002 1001 DWORD WINAPI SHDestroyPropSheetExtArray(DWORD a) 1003 1002 { 1004 1005 1006 } 1003 FIXME("(%08lx)stub\n", a); 1004 return 0; 1005 } -
trunk/src/shell32/shellpath.c
r6650 r6709 1 /* $Id: shellpath.c,v 1.6 2001-09-05 13:46:58 bird Exp $ */2 1 /* 3 2 * Path Functions … … 22 21 23 22 /* 24 23 ########## Combining and Constructing paths ########## 25 24 */ 26 25 27 26 /************************************************************************* 28 * PathAppendAW 27 * PathAppendAW [SHELL32.36] 29 28 */ 30 29 BOOL WINAPI PathAppendAW( 31 32 33 { 34 35 36 37 } 38 39 /************************************************************************* 40 * PathCombineAW 30 LPVOID lpszPath1, 31 LPCVOID lpszPath2) 32 { 33 if (SHELL_OsIsUnicode()) 34 return PathAppendW(lpszPath1, lpszPath2); 35 return PathAppendA(lpszPath1, lpszPath2); 36 } 37 38 /************************************************************************* 39 * PathCombineAW [SHELL32.37] 41 40 */ 42 41 LPVOID WINAPI PathCombineAW( 43 44 45 LPCVOID lpszFile) 46 { 47 48 49 50 } 51 52 /************************************************************************* 53 * PathAddBackslashAW 42 LPVOID szDest, 43 LPCVOID lpszDir, 44 LPCVOID lpszFile) 45 { 46 if (SHELL_OsIsUnicode()) 47 return PathCombineW( szDest, lpszDir, lpszFile ); 48 return PathCombineA( szDest, lpszDir, lpszFile ); 49 } 50 51 /************************************************************************* 52 * PathAddBackslashAW [SHELL32.32] 54 53 */ 55 54 LPVOID WINAPI PathAddBackslashAW(LPVOID lpszPath) 56 55 { 57 58 59 60 } 61 62 /************************************************************************* 63 * PathBuildRootAW 56 if(SHELL_OsIsUnicode()) 57 return PathAddBackslashW(lpszPath); 58 return PathAddBackslashA(lpszPath); 59 } 60 61 /************************************************************************* 62 * PathBuildRootAW [SHELL32.30] 64 63 */ 65 64 LPVOID WINAPI PathBuildRootAW(LPVOID lpszPath, int drive) 66 65 { 67 68 69 66 if(SHELL_OsIsUnicode()) 67 return PathBuildRootW(lpszPath, drive); 68 return PathBuildRootA(lpszPath, drive); 70 69 } 71 70 72 71 /* 73 72 Extracting Component Parts 74 73 */ 75 74 76 75 /************************************************************************* 77 * PathFindFileNameAW 76 * PathFindFileNameAW [SHELL32.34] 78 77 */ 79 78 LPVOID WINAPI PathFindFileNameAW(LPCVOID lpszPath) 80 79 { 81 82 83 84 } 85 86 /************************************************************************* 87 * PathFindExtensionAW 88 */ 89 LPVOID WINAPI PathFindExtensionAW(LPCVOID lpszPath) 90 { 91 92 93 94 95 } 96 97 /************************************************************************* 98 * PathGetExtensionA 80 if(SHELL_OsIsUnicode()) 81 return PathFindFileNameW(lpszPath); 82 return PathFindFileNameA(lpszPath); 83 } 84 85 /************************************************************************* 86 * PathFindExtensionAW [SHELL32.31] 87 */ 88 LPVOID WINAPI PathFindExtensionAW(LPCVOID lpszPath) 89 { 90 if (SHELL_OsIsUnicode()) 91 return PathFindExtensionW(lpszPath); 92 return PathFindExtensionA(lpszPath); 93 94 } 95 96 /************************************************************************* 97 * PathGetExtensionA [internal] 99 98 * 100 99 * NOTES … … 104 103 static LPSTR PathGetExtensionA(LPCSTR lpszPath) 105 104 { 106 107 108 109 110 } 111 112 /************************************************************************* 113 * PathGetExtensionW 105 TRACE("(%s)\n",lpszPath); 106 107 lpszPath = PathFindExtensionA(lpszPath); 108 return (LPSTR)(*lpszPath?(lpszPath+1):lpszPath); 109 } 110 111 /************************************************************************* 112 * PathGetExtensionW [internal] 114 113 */ 115 114 static LPWSTR PathGetExtensionW(LPCWSTR lpszPath) 116 115 { 117 118 119 120 121 } 122 123 /************************************************************************* 124 * PathGetExtensionAW 125 */ 126 LPVOID WINAPI PathGetExtensionAW(LPCVOID lpszPath) 127 { 128 129 130 131 } 132 133 /************************************************************************* 134 * PathGetArgsAW 135 */ 136 LPVOID WINAPI PathGetArgsAW(LPVOID lpszPath) 137 { 138 139 140 141 } 142 143 /************************************************************************* 144 * PathGetDriveNumber 145 */ 146 int WINAPI PathGetDriveNumberAW(LPVOID lpszPath) 147 { 148 149 150 116 TRACE("(%s)\n",debugstr_w(lpszPath)); 117 118 lpszPath = PathFindExtensionW(lpszPath); 119 return (LPWSTR)(*lpszPath?(lpszPath+1):lpszPath); 120 } 121 122 /************************************************************************* 123 * PathGetExtensionAW [SHELL32.158] 124 */ 125 LPVOID WINAPI PathGetExtensionAW(LPCVOID lpszPath) 126 { 127 if (SHELL_OsIsUnicode()) 128 return PathGetExtensionW(lpszPath); 129 return PathGetExtensionA(lpszPath); 130 } 131 132 /************************************************************************* 133 * PathGetArgsAW [SHELL32.52] 134 */ 135 LPVOID WINAPI PathGetArgsAW(LPVOID lpszPath) 136 { 137 if (SHELL_OsIsUnicode()) 138 return PathGetArgsW(lpszPath); 139 return PathGetArgsA(lpszPath); 140 } 141 142 /************************************************************************* 143 * PathGetDriveNumber [SHELL32.57] 144 */ 145 int WINAPI PathGetDriveNumberAW(LPVOID lpszPath) 146 { 147 if (SHELL_OsIsUnicode()) 148 return PathGetDriveNumberW(lpszPath); 149 return PathGetDriveNumberA(lpszPath); 151 150 } 152 151 … … 154 153 * PathRemoveFileSpec [SHELL32.35] 155 154 */ 156 BOOL WINAPI PathRemoveFileSpecAW(LPVOID lpszPath) 157 { 158 159 160 161 } 162 163 /************************************************************************* 164 * PathStripPathAW 165 */ 166 void WINAPI PathStripPathAW(LPVOID lpszPath) 167 { 168 169 170 171 } 172 173 /************************************************************************* 174 * PathStripToRootAW 175 */ 176 BOOL WINAPI PathStripToRootAW(LPVOID lpszPath) 177 { 178 179 180 181 } 182 183 /************************************************************************* 184 * PathRemoveArgsAW 185 */ 186 void WINAPI PathRemoveArgsAW(LPVOID lpszPath) 187 { 188 189 190 191 } 192 193 /************************************************************************* 194 * PathRemoveExtensionAW 195 */ 196 void WINAPI PathRemoveExtensionAW(LPVOID lpszPath) 197 { 198 199 200 155 BOOL WINAPI PathRemoveFileSpecAW(LPVOID lpszPath) 156 { 157 if (SHELL_OsIsUnicode()) 158 return PathRemoveFileSpecW(lpszPath); 159 return PathRemoveFileSpecA(lpszPath); 160 } 161 162 /************************************************************************* 163 * PathStripPathAW [SHELL32.38] 164 */ 165 void WINAPI PathStripPathAW(LPVOID lpszPath) 166 { 167 if (SHELL_OsIsUnicode()) 168 return PathStripPathW(lpszPath); 169 return PathStripPathA(lpszPath); 170 } 171 172 /************************************************************************* 173 * PathStripToRootAW [SHELL32.50] 174 */ 175 BOOL WINAPI PathStripToRootAW(LPVOID lpszPath) 176 { 177 if (SHELL_OsIsUnicode()) 178 return PathStripToRootW(lpszPath); 179 return PathStripToRootA(lpszPath); 180 } 181 182 /************************************************************************* 183 * PathRemoveArgsAW [SHELL32.251] 184 */ 185 void WINAPI PathRemoveArgsAW(LPVOID lpszPath) 186 { 187 if (SHELL_OsIsUnicode()) 188 PathRemoveArgsW(lpszPath); 189 PathRemoveArgsA(lpszPath); 190 } 191 192 /************************************************************************* 193 * PathRemoveExtensionAW [SHELL32.250] 194 */ 195 void WINAPI PathRemoveExtensionAW(LPVOID lpszPath) 196 { 197 if (SHELL_OsIsUnicode()) 198 return PathRemoveExtensionW(lpszPath); 199 return PathRemoveExtensionA(lpszPath); 201 200 } 202 201 203 202 204 203 /* 205 204 Path Manipulations 206 205 */ 207 206 … … 211 210 LPSTR WINAPI PathGetShortPathA(LPSTR lpszPath) 212 211 { 213 214 212 FIXME("%s stub\n", lpszPath); 213 return NULL; 215 214 } 216 215 … … 220 219 LPWSTR WINAPI PathGetShortPathW(LPWSTR lpszPath) 221 220 { 222 223 221 FIXME("%s stub\n", debugstr_w(lpszPath)); 222 return NULL; 224 223 } 225 224 … … 229 228 LPVOID WINAPI PathGetShortPathAW(LPVOID lpszPath) 230 229 { 231 232 233 230 if(SHELL_OsIsUnicode()) 231 return PathGetShortPathW(lpszPath); 232 return PathGetShortPathA(lpszPath); 234 233 } 235 234 … … 239 238 void WINAPI PathRemoveBlanksAW(LPVOID str) 240 239 { 241 242 243 240 if(SHELL_OsIsUnicode()) 241 PathRemoveBlanksW(str); 242 PathRemoveBlanksA(str); 244 243 } 245 244 … … 249 248 LPVOID WINAPI PathQuoteSpacesAW (LPVOID lpszPath) 250 249 { 251 252 253 250 if(SHELL_OsIsUnicode()) 251 return PathQuoteSpacesW(lpszPath); 252 return PathQuoteSpacesA(lpszPath); 254 253 } 255 254 … … 257 256 * PathUnquoteSpacesAW [SHELL32.56] 258 257 */ 259 VOID WINAPI PathUnquoteSpacesAW(LPVOID str) 260 { 261 262 263 264 265 } 266 267 /************************************************************************* 268 * PathParseIconLocationAW 258 VOID WINAPI PathUnquoteSpacesAW(LPVOID str) 259 { 260 if(SHELL_OsIsUnicode()) 261 PathUnquoteSpacesW(str); 262 else 263 PathUnquoteSpacesA(str); 264 } 265 266 /************************************************************************* 267 * PathParseIconLocationAW [SHELL32.249] 269 268 */ 270 269 int WINAPI PathParseIconLocationAW (LPVOID lpszPath) 271 270 { 272 273 274 271 if(SHELL_OsIsUnicode()) 272 return PathParseIconLocationW(lpszPath); 273 return PathParseIconLocationA(lpszPath); 275 274 } 276 275 277 276 /* 278 277 ########## Path Testing ########## 279 278 */ 280 279 /************************************************************************* 281 * PathIsUNCAW 280 * PathIsUNCAW [SHELL32.39] 282 281 */ 283 282 BOOL WINAPI PathIsUNCAW (LPCVOID lpszPath) 284 283 { 285 286 287 return PathIsUNCA( lpszPath ); 288 } 289 290 /************************************************************************* 291 * PathIsRelativeAW 284 if (SHELL_OsIsUnicode()) 285 return PathIsUNCW( lpszPath ); 286 return PathIsUNCA( lpszPath ); 287 } 288 289 /************************************************************************* 290 * PathIsRelativeAW [SHELL32.40] 292 291 */ 293 292 BOOL WINAPI PathIsRelativeAW (LPCVOID lpszPath) 294 293 { 295 296 297 return PathIsRelativeA( lpszPath ); 298 } 299 300 /************************************************************************* 301 * PathIsRootAW 302 */ 303 BOOL WINAPI PathIsRootAW(LPCVOID lpszPath) 304 { 305 306 307 308 } 309 310 /************************************************************************* 311 * PathIsExeA 294 if (SHELL_OsIsUnicode()) 295 return PathIsRelativeW( lpszPath ); 296 return PathIsRelativeA( lpszPath ); 297 } 298 299 /************************************************************************* 300 * PathIsRootAW [SHELL32.29] 301 */ 302 BOOL WINAPI PathIsRootAW(LPCVOID lpszPath) 303 { 304 if (SHELL_OsIsUnicode()) 305 return PathIsRootW(lpszPath); 306 return PathIsRootA(lpszPath); 307 } 308 309 /************************************************************************* 310 * PathIsExeA [internal] 312 311 */ 313 312 static BOOL PathIsExeA (LPCSTR lpszPath) 314 313 { 315 316 317 318 319 320 321 322 323 324 325 } 326 327 /************************************************************************* 328 * PathIsExeW 314 LPCSTR lpszExtension = PathGetExtensionA(lpszPath); 315 int i = 0; 316 static char * lpszExtensions[6] = {"exe", "com", "pid", "cmd", "bat", NULL }; 317 318 TRACE("path=%s\n",lpszPath); 319 320 for(i=0; lpszExtensions[i]; i++) 321 if (!strcasecmp(lpszExtension,lpszExtensions[i])) return TRUE; 322 323 return FALSE; 324 } 325 326 /************************************************************************* 327 * PathIsExeW [internal] 329 328 */ 330 329 static BOOL PathIsExeW (LPCWSTR lpszPath) 331 330 { 332 333 334 335 336 337 338 339 340 331 LPCWSTR lpszExtension = PathGetExtensionW(lpszPath); 332 int i = 0; 333 static WCHAR lpszExtensions[6][4] = 334 {{'e','x','e','\0'}, {'c','o','m','\0'}, {'p','i','d','\0'}, 335 {'c','m','d','\0'}, {'b','a','t','\0'}, {'\0'} }; 336 337 TRACE("path=%s\n",debugstr_w(lpszPath)); 338 339 for(i=0; lpszExtensions[i]; i++) 341 340 #ifdef __WIN32OS2__ 342 341 if (!lstrcmpiW(lpszExtension,lpszExtensions[i])) return TRUE; 343 342 #else 344 345 #endif 346 347 } 348 349 /************************************************************************* 350 * PathIsExeAW 343 if (!strcmpiW(lpszExtension,lpszExtensions[i])) return TRUE; 344 #endif 345 return FALSE; 346 } 347 348 /************************************************************************* 349 * PathIsExeAW [SHELL32.43] 351 350 */ 352 351 BOOL WINAPI PathIsExeAW (LPCVOID path) 353 352 { 354 355 356 357 } 358 359 /************************************************************************* 360 * PathIsDirectoryAW 353 if (SHELL_OsIsUnicode()) 354 return PathIsExeW (path); 355 return PathIsExeA(path); 356 } 357 358 /************************************************************************* 359 * PathIsDirectoryAW [SHELL32.159] 361 360 */ 362 361 BOOL WINAPI PathIsDirectoryAW (LPCVOID lpszPath) 363 362 { 364 365 366 367 } 368 369 /************************************************************************* 370 * PathFileExistsAW 371 */ 363 if (SHELL_OsIsUnicode()) 364 return PathIsDirectoryW (lpszPath); 365 return PathIsDirectoryA (lpszPath); 366 } 367 368 /************************************************************************* 369 * PathFileExistsAW [SHELL32.45] 370 */ 372 371 BOOL WINAPI PathFileExistsAW (LPCVOID lpszPath) 373 372 { 374 375 376 377 } 378 379 /************************************************************************* 380 * PathMatchSpecAW 381 */ 382 BOOL WINAPI PathMatchSpecAW(LPVOID name, LPVOID mask) 383 { 384 385 386 387 } 388 389 /************************************************************************* 390 * PathIsSameRootAW 373 if (SHELL_OsIsUnicode()) 374 return PathFileExistsW (lpszPath); 375 return PathFileExistsA (lpszPath); 376 } 377 378 /************************************************************************* 379 * PathMatchSpecAW [SHELL32.46] 380 */ 381 BOOL WINAPI PathMatchSpecAW(LPVOID name, LPVOID mask) 382 { 383 if (SHELL_OsIsUnicode()) 384 return PathMatchSpecW( name, mask ); 385 return PathMatchSpecA( name, mask ); 386 } 387 388 /************************************************************************* 389 * PathIsSameRootAW [SHELL32.650] 391 390 */ 392 391 BOOL WINAPI PathIsSameRootAW(LPCVOID lpszPath1, LPCVOID lpszPath2) 393 392 { 394 395 396 397 } 398 399 /************************************************************************* 400 * IsLFNDriveA 401 * 393 if (SHELL_OsIsUnicode()) 394 return PathIsSameRootW(lpszPath1, lpszPath2); 395 return PathIsSameRootA(lpszPath1, lpszPath2); 396 } 397 398 /************************************************************************* 399 * IsLFNDriveA [SHELL32.119] 400 * 402 401 * NOTES 403 402 * exported by ordinal Name 404 403 */ 405 BOOL WINAPI IsLFNDriveA(LPCSTR lpszPath) 406 { 407 DWORD 404 BOOL WINAPI IsLFNDriveA(LPCSTR lpszPath) 405 { 406 DWORD fnlen; 408 407 409 408 if (!GetVolumeInformationA(lpszPath,NULL,0,NULL,&fnlen,NULL,NULL,0)) 410 409 return FALSE; 411 410 return fnlen>12; 412 411 } 413 412 414 413 /* 415 414 ########## Creating Something Unique ########## 416 415 */ 417 416 /************************************************************************* 418 * PathMakeUniqueNameA 417 * PathMakeUniqueNameA [internal] 419 418 */ 420 419 BOOL WINAPI PathMakeUniqueNameA( 421 422 DWORD dwBuffSize, 423 424 425 426 { 427 428 429 430 431 } 432 433 /************************************************************************* 434 * PathMakeUniqueNameW 420 LPSTR lpszBuffer, 421 DWORD dwBuffSize, 422 LPCSTR lpszShortName, 423 LPCSTR lpszLongName, 424 LPCSTR lpszPathName) 425 { 426 FIXME("%p %lu %s %s %s stub\n", 427 lpszBuffer, dwBuffSize, debugstr_a(lpszShortName), 428 debugstr_a(lpszLongName), debugstr_a(lpszPathName)); 429 return TRUE; 430 } 431 432 /************************************************************************* 433 * PathMakeUniqueNameW [internal] 435 434 */ 436 435 BOOL WINAPI PathMakeUniqueNameW( 437 438 DWORD dwBuffSize, 439 440 441 442 { 443 444 445 446 447 } 448 449 /************************************************************************* 450 * PathMakeUniqueNameAW 436 LPWSTR lpszBuffer, 437 DWORD dwBuffSize, 438 LPCWSTR lpszShortName, 439 LPCWSTR lpszLongName, 440 LPCWSTR lpszPathName) 441 { 442 FIXME("%p %lu %s %s %s stub\n", 443 lpszBuffer, dwBuffSize, debugstr_w(lpszShortName), 444 debugstr_w(lpszLongName), debugstr_w(lpszPathName)); 445 return TRUE; 446 } 447 448 /************************************************************************* 449 * PathMakeUniqueNameAW [SHELL32.47] 451 450 */ 452 451 BOOL WINAPI PathMakeUniqueNameAW( 453 454 DWORD dwBuffSize, 455 456 457 458 { 459 460 461 452 LPVOID lpszBuffer, 453 DWORD dwBuffSize, 454 LPCVOID lpszShortName, 455 LPCVOID lpszLongName, 456 LPCVOID lpszPathName) 457 { 458 if (SHELL_OsIsUnicode()) 459 return PathMakeUniqueNameW(lpszBuffer,dwBuffSize, lpszShortName,lpszLongName,lpszPathName); 460 return PathMakeUniqueNameA(lpszBuffer,dwBuffSize, lpszShortName,lpszLongName,lpszPathName); 462 461 } 463 462 464 463 /************************************************************************* 465 464 * PathYetAnotherMakeUniqueNameA [SHELL32.75] 466 * 465 * 467 466 * NOTES 468 467 * exported by ordinal 469 468 */ 470 469 BOOL WINAPI PathYetAnotherMakeUniqueNameA( 471 472 473 474 470 LPSTR lpszBuffer, 471 LPCSTR lpszPathName, 472 LPCSTR lpszShortName, 473 LPCSTR lpszLongName) 475 474 { 476 475 FIXME("(%p,%p, %p ,%p):stub.\n", … … 482 481 483 482 BOOL WINAPI PathYetAnotherMakeUniqueNameW( 484 485 486 487 483 LPWSTR lpszBuffer, 484 LPCWSTR lpszPathName, 485 LPCWSTR lpszShortName, 486 LPCWSTR lpszLongName) 488 487 { 489 488 FIXME("PathYetAnotherMakeUniqueNameW (%p,%p, %p ,%p):stub.\n", … … 493 492 494 493 BOOL WINAPI PathYetAnotherMakeUniqueNameAW( 495 496 497 498 499 { 500 501 502 494 LPSTR lpszBuffer, 495 LPCSTR lpszPathName, 496 LPCSTR lpszShortName, 497 LPCSTR lpszLongName) 498 { 499 if (SHELL_OsIsUnicode()) 500 return PathYetAnotherMakeUniqueNameW((LPWSTR)lpszBuffer,(LPCWSTR)lpszPathName, (LPCWSTR)lpszShortName,(LPCWSTR)lpszLongName); 501 return PathYetAnotherMakeUniqueNameA(lpszBuffer, lpszPathName, lpszShortName,lpszLongName); 503 502 } 504 503 #endif … … 506 505 507 506 /* 508 509 */ 510 511 /************************************************************************* 512 * PathFindOnPathAW 507 ########## cleaning and resolving paths ########## 508 */ 509 510 /************************************************************************* 511 * PathFindOnPathAW [SHELL32] 513 512 */ 514 513 BOOL WINAPI PathFindOnPathAW(LPVOID sFile, LPCVOID sOtherDirs) 515 514 { 516 517 518 519 } 520 521 /************************************************************************* 522 * PathCleanupSpecAW 515 if (SHELL_OsIsUnicode()) 516 return PathFindOnPathW(sFile, sOtherDirs); 517 return PathFindOnPathA(sFile, sOtherDirs); 518 } 519 520 /************************************************************************* 521 * PathCleanupSpecAW [SHELL32] 523 522 */ 524 523 DWORD WINAPI PathCleanupSpecAW (LPCVOID x, LPVOID y) … … 529 528 530 529 /************************************************************************* 531 * PathQualifyA 532 */ 533 BOOL WINAPI PathQualifyA(LPCSTR pszPath) 534 { 535 536 537 } 538 539 /************************************************************************* 540 * PathQualifyW 541 */ 542 BOOL WINAPI PathQualifyW(LPCWSTR pszPath) 543 { 544 545 546 } 547 548 /************************************************************************* 549 * PathQualifyAW 550 */ 551 BOOL WINAPI PathQualifyAW(LPCVOID pszPath) 552 { 553 554 555 530 * PathQualifyA [SHELL32] 531 */ 532 BOOL WINAPI PathQualifyA(LPCSTR pszPath) 533 { 534 FIXME("%s\n",pszPath); 535 return 0; 536 } 537 538 /************************************************************************* 539 * PathQualifyW [SHELL32] 540 */ 541 BOOL WINAPI PathQualifyW(LPCWSTR pszPath) 542 { 543 FIXME("%s\n",debugstr_w(pszPath)); 544 return 0; 545 } 546 547 /************************************************************************* 548 * PathQualifyAW [SHELL32] 549 */ 550 BOOL WINAPI PathQualifyAW(LPCVOID pszPath) 551 { 552 if (SHELL_OsIsUnicode()) 553 return PathQualifyW(pszPath); 554 return PathQualifyA(pszPath); 556 555 } 557 556 … … 560 559 */ 561 560 BOOL WINAPI PathResolveA( 562 563 LPCSTR *alpszPaths, 564 565 { 566 567 568 561 LPSTR lpszPath, 562 LPCSTR *alpszPaths, 563 DWORD dwFlags) 564 { 565 FIXME("(%s,%p,0x%08lx),stub!\n", 566 lpszPath, *alpszPaths, dwFlags); 567 return 0; 569 568 } 570 569 … … 573 572 */ 574 573 BOOL WINAPI PathResolveW( 575 576 LPCWSTR *alpszPaths, 577 578 { 579 580 581 574 LPWSTR lpszPath, 575 LPCWSTR *alpszPaths, 576 DWORD dwFlags) 577 { 578 FIXME("(%s,%p,0x%08lx),stub!\n", 579 debugstr_w(lpszPath), debugstr_w(*alpszPaths), dwFlags); 580 return 0; 582 581 } 583 582 … … 586 585 */ 587 586 BOOL WINAPI PathResolveAW( 588 589 LPCVOID *alpszPaths, 590 591 { 592 593 594 595 } 596 597 /************************************************************************* 598 * PathProcessCommandA[SHELL32.653]587 LPVOID lpszPath, 588 LPCVOID *alpszPaths, 589 DWORD dwFlags) 590 { 591 if (SHELL_OsIsUnicode()) 592 return PathResolveW(lpszPath, (LPCWSTR*)alpszPaths, dwFlags); 593 return PathResolveA(lpszPath, (LPCSTR*)alpszPaths, dwFlags); 594 } 595 596 /************************************************************************* 597 * PathProcessCommandA [SHELL32.653] 599 598 */ 600 599 HRESULT WINAPI PathProcessCommandA ( 601 602 603 604 605 { 606 607 608 609 610 } 611 612 /************************************************************************* 613 * 600 LPCSTR lpszPath, 601 LPSTR lpszBuff, 602 DWORD dwBuffSize, 603 DWORD dwFlags) 604 { 605 FIXME("%s %p 0x%04lx 0x%04lx stub\n", 606 lpszPath, lpszBuff, dwBuffSize, dwFlags); 607 strcpy(lpszBuff, lpszPath); 608 return 0; 609 } 610 611 /************************************************************************* 612 * PathProcessCommandW 614 613 */ 615 614 HRESULT WINAPI PathProcessCommandW ( 616 617 618 619 620 { 621 622 623 624 625 } 626 627 /************************************************************************* 628 * 615 LPCWSTR lpszPath, 616 LPWSTR lpszBuff, 617 DWORD dwBuffSize, 618 DWORD dwFlags) 619 { 620 FIXME("(%s, %p, 0x%04lx, 0x%04lx) stub\n", 621 debugstr_w(lpszPath), lpszBuff, dwBuffSize, dwFlags); 622 strcpyW(lpszBuff, lpszPath); 623 return 0; 624 } 625 626 /************************************************************************* 627 * PathProcessCommandAW 629 628 */ 630 629 HRESULT WINAPI PathProcessCommandAW ( 631 632 633 634 635 { 636 637 638 630 LPCVOID lpszPath, 631 LPVOID lpszBuff, 632 DWORD dwBuffSize, 633 DWORD dwFlags) 634 { 635 if (SHELL_OsIsUnicode()) 636 return PathProcessCommandW(lpszPath, lpszBuff, dwBuffSize, dwFlags); 637 return PathProcessCommandA(lpszPath, lpszBuff, dwBuffSize, dwFlags); 639 638 } 640 639 641 640 /* 642 641 ########## special ########## 643 642 */ 644 643 … … 646 645 * PathSetDlgItemPathAW 647 646 */ 648 BOOL WINAPI PathSetDlgItemPathAW(HWND hDlg, int id, LPCVOID pszPath) 649 { 650 651 647 BOOL WINAPI PathSetDlgItemPathAW(HWND hDlg, int id, LPCVOID pszPath) 648 { if (SHELL_OsIsUnicode()) 649 return PathSetDlgItemPathW(hDlg, id, pszPath); 650 return PathSetDlgItemPathA(hDlg, id, pszPath); 652 651 } 653 652 … … 655 654 /************************************************************************* 656 655 * SHGetSpecialFolderPathA [SHELL32.175] 657 * 656 * 658 657 * converts csidl to path 659 658 */ 660 659 661 660 static const char * const szSHFolders = "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders"; 662 661 static const char * const szSHUserFolders = "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders"; … … 676 675 } CSIDL_DATA; 677 676 678 #define CSIDL_MYFLAG_SHFOLDER 679 #define CSIDL_MYFLAG_SETUP 680 #define CSIDL_MYFLAG_CURRVER 681 #define CSIDL_MYFLAG_RELATIVE 677 #define CSIDL_MYFLAG_SHFOLDER 1 678 #define CSIDL_MYFLAG_SETUP 2 679 #define CSIDL_MYFLAG_CURRVER 4 680 #define CSIDL_MYFLAG_RELATIVE 8 682 681 683 682 #define HKLM HKEY_LOCAL_MACHINE … … 686 685 { 687 686 { /* CSIDL_DESKTOP */ 688 689 690 687 9, HKCU, 688 "Desktop", 689 "Desktop" 691 690 }, 692 691 { /* CSIDL_INTERNET (??) */ 693 694 695 692 0, 1, /* FIXME */ 693 NULL, 694 NULL, 696 695 }, 697 696 { /* CSIDL_PROGRAMS */ 698 699 700 697 9, HKCU, 698 "Programs", 699 "Start Menu\\Programs" 701 700 }, 702 701 { /* CSIDL_CONTROLS (.CPL files) */ 703 704 705 702 10, HKLM, 703 "SysDir", 704 "SYSTEM" 706 705 }, 707 706 { /* CSIDL_PRINTERS */ 708 709 710 707 10, HKLM, 708 "SysDir", 709 "SYSTEM" 711 710 }, 712 711 { /* CSIDL_PERSONAL */ 713 714 715 712 1, HKCU, 713 "Personal", 714 "My Documents" 716 715 }, 717 716 { /* CSIDL_FAVORITES */ 718 719 720 717 9, HKCU, 718 "Favorites", 719 "Favorites" 721 720 }, 722 721 { /* CSIDL_STARTUP */ 723 724 725 722 9, HKCU, 723 "StartUp", 724 "Start Menu\\Programs\\StartUp" 726 725 }, 727 726 { /* CSIDL_RECENT */ 728 729 730 727 9, HKCU, 728 "Recent", 729 "Recent" 731 730 }, 732 731 { /* CSIDL_SENDTO */ 733 734 735 732 9, HKCU, 733 "SendTo", 734 "SendTo" 736 735 }, 737 736 { /* CSIDL_BITBUCKET (is this c:\recycled ?) */ 738 739 740 737 0, 1, /* FIXME */ 738 NULL, 739 "recycled" 741 740 }, 742 741 { /* CSIDL_STARTMENU */ 743 744 745 742 9, HKCU, 743 "Start Menu", 744 "Start Menu" 746 745 }, 747 746 { /* not known */ 748 749 750 747 0, 0, 748 NULL, 749 NULL, 751 750 }, 752 751 { /* not known */ 753 754 755 752 0, 0, 753 NULL, 754 NULL, 756 755 }, 757 756 { /* not known */ 758 759 760 757 0, 0, 758 NULL, 759 NULL, 761 760 }, 762 761 { /* not known */ 763 764 765 762 0, 0, 763 NULL, 764 NULL, 766 765 }, 767 766 { /* CSIDL_DESKTOPDIRECTORY */ 768 769 770 767 9, HKCU, 768 "Desktop", 769 "Desktop" 771 770 }, 772 771 { /* CSIDL_DRIVES */ 773 774 775 772 0, 1, /* FIXME */ 773 NULL, 774 "My Computer" 776 775 }, 777 776 { /* CSIDL_NETWORK */ 778 779 780 777 0, 1, /* FIXME */ 778 NULL, 779 "Network Neighborhood" 781 780 }, 782 781 { /* CSIDL_NETHOOD */ 783 784 785 782 9, HKCU, 783 "NetHood", 784 "NetHood" 786 785 }, 787 786 { /* CSIDL_FONTS */ 788 789 790 787 9, HKCU, 788 "Fonts", 789 "Fonts" 791 790 }, 792 791 { /* CSIDL_TEMPLATES */ 793 794 795 792 9, HKCU, 793 "Templates", 794 "ShellNew" 796 795 }, 797 796 { /* CSIDL_COMMON_STARTMENU */ 798 799 800 797 9, HKLM, 798 "Common Start Menu", 799 "Start Menu" 801 800 }, 802 801 { /* CSIDL_COMMON_PROGRAMS */ 803 804 805 802 9, HKLM, 803 "Common Programs", 804 "" 806 805 }, 807 806 { /* CSIDL_COMMON_STARTUP */ 808 809 810 807 9, HKLM, 808 "Common StartUp", 809 "All Users\\Start Menu\\Programs\\StartUp" 811 810 }, 812 811 { /* CSIDL_COMMON_DESKTOPDIRECTORY */ 813 814 815 812 9, HKLM, 813 "Common Desktop", 814 "Desktop" 816 815 }, 817 816 { /* CSIDL_APPDATA */ 818 819 820 817 9, HKCU, 818 "AppData", 819 "Application Data" 821 820 }, 822 821 { /* CSIDL_PRINTHOOD */ 823 824 825 822 9, HKCU, 823 "PrintHood", 824 "PrintHood" 826 825 }, 827 826 { /* not known */ 828 829 830 827 0, 0, 828 NULL, 829 NULL, 831 830 }, 832 831 { /* CSIDL_ALTSTARTUP */ 833 834 835 832 0, 1, /* FIXME */ 833 NULL, 834 NULL 836 835 }, 837 836 { /* CSIDL_COMMON_ALTSTARTUP */ 838 839 840 837 0, 1, /* FIXME */ 838 NULL, 839 NULL 841 840 }, 842 841 { /* CSIDL_COMMON_FAVORITES */ 843 844 845 842 9, HKCU, 843 "Favorites", 844 "Favorites" 846 845 }, 847 846 { /* CSIDL_INTERNET_CACHE */ 848 849 850 847 9, HKCU, 848 "Cache", 849 "Temporary Internet Files" 851 850 }, 852 851 { /* CSIDL_COOKIES */ 853 854 855 852 9, HKCU, 853 "Cookies", 854 "Cookies" 856 855 }, 857 856 { /* CSIDL_HISTORY */ 858 859 860 857 9, HKCU, 858 "History", 859 "History" 861 860 }, 862 861 { /* CSIDL_COMMON_APPDATA */ 863 864 865 862 9, HKLM, 863 "Common AppData", 864 "All Users\\Application Data" 866 865 }, 867 866 { /* CSIDL_WINDOWS */ 868 869 870 867 2, HKLM, 868 "WinDir", 869 "Windows" 871 870 }, 872 871 { /* CSIDL_SYSTEM */ 873 874 875 872 10, HKLM, 873 "SysDir", 874 "SYSTEM" 876 875 }, 877 876 { /* CSIDL_PROGRAM_FILES */ 878 879 880 877 4, HKLM, 878 "ProgramFilesDir", 879 "Program Files" 881 880 }, 882 881 { /* CSIDL_MYPICTURES */ 883 884 885 882 1, HKCU, 883 "My Pictures", 884 "My Documents\\My Pictures" 886 885 }, 887 886 { /* CSIDL_PROFILE */ 888 889 890 887 10, HKLM, 888 "WinDir", /* correct ? */ 889 "" 891 890 }, 892 891 { /* CSIDL_SYSTEMX86 */ 893 894 895 892 10, HKLM, 893 "SysDir", 894 "SYSTEM" 896 895 }, 897 896 { /* CSIDL_PROGRAM_FILESX86 */ 898 899 900 897 4, HKLM, 898 "ProgramFilesDir", 899 "Program Files" 901 900 }, 902 901 { /* CSIDL_PROGRAM_FILES_COMMON */ 903 904 "CommonFilesDir", 905 902 4, HKLM, 903 "CommonFilesDir", 904 "Program Files\\Common Files" /* ? */ 906 905 }, 907 906 { /* CSIDL_PROGRAM_FILES_COMMONX86 */ 908 909 910 907 4, HKLM, 908 "CommonFilesDir", 909 "Program Files\\Common Files" /* ? */ 911 910 }, 912 911 { /* CSIDL_COMMON_TEMPLATES */ 913 914 915 912 0, 1, /* FIXME */ 913 NULL, 914 NULL 916 915 }, 917 916 { /* CSIDL_COMMON_DOCUMENTS */ 918 919 920 917 0, 1, /* FIXME */ 918 NULL, 919 NULL 921 920 }, 922 921 { /* CSIDL_COMMON_ADMINTOOLS */ 923 924 925 922 0, 1, /* FIXME */ 923 NULL, 924 NULL 926 925 }, 927 926 { /* CSIDL_ADMINTOOLS */ 928 929 930 927 9, HKCU, 928 "Administrative Tools", 929 "Start Menu\\Programs\\Administrative Tools" 931 930 }, 932 931 { /* CSIDL_CONNECTIONS */ 933 934 935 932 0, 1, /* FIXME */ 933 NULL, 934 NULL 936 935 } 937 936 }; … … 942 941 943 942 BOOL WINAPI SHGetSpecialFolderPathA ( 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); 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); 1002 1004 } 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; 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; 1077 1076 } 1078 1077 … … 1081 1080 */ 1082 1081 BOOL WINAPI SHGetSpecialFolderPathW ( 1083 1084 1085 1086 1087 { 1088 1089 1090 1091 1082 HWND hwndOwner, 1083 LPWSTR szPath, 1084 DWORD csidl, 1085 BOOL bCreate) 1086 { 1087 char szTemp[MAX_PATH]; 1088 1089 if (SHGetSpecialFolderPathA(hwndOwner, szTemp, csidl, bCreate)) 1090 { 1092 1091 if (!MultiByteToWideChar( CP_ACP, 0, szTemp, -1, szPath, MAX_PATH )) 1093 1092 szPath[MAX_PATH-1] = 0; 1094 1093 } 1095 1094 1096 1097 1098 1095 TRACE("0x%04x,%p,csidl=%lu,0x%04x\n", hwndOwner,szPath,csidl,bCreate); 1096 1097 return TRUE; 1099 1098 } 1100 1099 … … 1103 1102 */ 1104 1103 BOOL WINAPI SHGetSpecialFolderPathAW ( 1105 1106 1107 1108 1109 1110 { 1111 1112 1113 1114 } 1115 1116 /************************************************************************* 1117 * SHGetFolderPathA 1104 HWND hwndOwner, 1105 LPVOID szPath, 1106 DWORD csidl, 1107 BOOL bCreate) 1108 1109 { 1110 if (SHELL_OsIsUnicode()) 1111 return SHGetSpecialFolderPathW (hwndOwner, szPath, csidl, bCreate); 1112 return SHGetSpecialFolderPathA (hwndOwner, szPath, csidl, bCreate); 1113 } 1114 1115 /************************************************************************* 1116 * SHGetFolderPathA [SHFOLDER.@] 1118 1117 */ 1119 1118 HRESULT WINAPI SHGetFolderPathA( 1120 1121 1122 HANDLE hToken,/* [in] FIXME: get paths for specific user */1123 DWORD dwFlags,/* [in] FIXME: SHGFP_TYPE_CURRENT|SHGFP_TYPE_DEFAULT */1124 1125 { 1126 1127 1128 1129 1130 1131 } 1132 1133 /************************************************************************* 1134 * SHGetFolderPathW 1119 HWND hwndOwner, 1120 int nFolder, 1121 HANDLE hToken, /* [in] FIXME: get paths for specific user */ 1122 DWORD dwFlags, /* [in] FIXME: SHGFP_TYPE_CURRENT|SHGFP_TYPE_DEFAULT */ 1123 LPSTR pszPath) 1124 { 1125 return (SHGetSpecialFolderPathA( 1126 hwndOwner, 1127 pszPath, 1128 CSIDL_FOLDER_MASK & nFolder, 1129 CSIDL_FLAG_CREATE & nFolder )) ? S_OK : E_FAIL; 1130 } 1131 1132 /************************************************************************* 1133 * SHGetFolderPathW [SHFOLDER.@] 1135 1134 */ 1136 1135 HRESULT WINAPI SHGetFolderPathW( 1137 1138 1139 1140 1141 1142 { 1143 1144 1145 1146 1147 1148 } 1136 HWND hwndOwner, 1137 int nFolder, 1138 HANDLE hToken, 1139 DWORD dwFlags, 1140 LPWSTR pszPath) 1141 { 1142 return (SHGetSpecialFolderPathW( 1143 hwndOwner, 1144 pszPath, 1145 CSIDL_FOLDER_MASK & nFolder, 1146 CSIDL_FLAG_CREATE & nFolder )) ? S_OK : E_FAIL; 1147 } -
trunk/src/shell32/shellreg.c
r6650 r6709 1 /* $Id: shellreg.c,v 1.3 2001-09-05 13:46:58 bird Exp $ */2 1 /* 3 2 Shell Registry Access 4 3 */ 5 4 #include <string.h> … … 18 17 19 18 /************************************************************************* 20 * SHRegOpenKeyA 19 * SHRegOpenKeyA [SHELL32.506] 21 20 * 22 21 */ 23 22 HRESULT WINAPI SHRegOpenKeyA( 24 25 26 27 { 28 29 30 } 31 32 /************************************************************************* 33 * SHRegOpenKeyW 23 HKEY hKey, 24 LPSTR lpSubKey, 25 LPHKEY phkResult) 26 { 27 TRACE("(0x%08x, %s, %p)\n", hKey, debugstr_a(lpSubKey), phkResult); 28 return RegOpenKeyA(hKey, lpSubKey, phkResult); 29 } 30 31 /************************************************************************* 32 * SHRegOpenKeyW [NT4.0:SHELL32.507] 34 33 * 35 34 */ 36 35 HRESULT WINAPI SHRegOpenKeyW ( 37 38 39 40 { 41 42 36 HKEY hkey, 37 LPCWSTR lpszSubKey, 38 LPHKEY retkey) 39 { 40 WARN("0x%04x %s %p\n",hkey,debugstr_w(lpszSubKey),retkey); 41 return RegOpenKeyW( hkey, lpszSubKey, retkey ); 43 42 } 44 43 … … 48 47 */ 49 48 HRESULT WINAPI SHRegQueryValueExA( 50 51 52 53 54 55 56 { 57 58 59 } 60 61 /************************************************************************* 62 * SHRegQueryValueW 49 HKEY hkey, 50 LPSTR lpValueName, 51 LPDWORD lpReserved, 52 LPDWORD lpType, 53 LPBYTE lpData, 54 LPDWORD lpcbData) 55 { 56 TRACE("0x%04x %s %p %p %p %p\n", hkey, lpValueName, lpReserved, lpType, lpData, lpcbData); 57 return RegQueryValueExA (hkey, lpValueName, lpReserved, lpType, lpData, lpcbData); 58 } 59 60 /************************************************************************* 61 * SHRegQueryValueW [NT4.0:SHELL32.510] 63 62 * 64 63 */ 65 64 HRESULT WINAPI SHRegQueryValueW( 66 67 68 69 70 { 71 72 73 74 } 75 76 /************************************************************************* 77 * SHRegQueryValueExW 78 * 79 * FIXME 65 HKEY hkey, 66 LPWSTR lpszSubKey, 67 LPWSTR lpszData, 68 LPDWORD lpcbData ) 69 { 70 WARN("0x%04x %s %p %p semi-stub\n", 71 hkey, debugstr_w(lpszSubKey), lpszData, lpcbData); 72 return RegQueryValueW( hkey, lpszSubKey, lpszData, lpcbData ); 73 } 74 75 /************************************************************************* 76 * SHRegQueryValueExW [NT4.0:SHELL32.511] 77 * 78 * FIXME 80 79 * if the datatype REG_EXPAND_SZ then expand the string and change 81 * *pdwType to REG_SZ. 80 * *pdwType to REG_SZ. 82 81 */ 83 82 HRESULT WINAPI SHRegQueryValueExW ( 84 85 86 87 88 89 90 { 91 92 93 94 95 83 HKEY hkey, 84 LPWSTR pszValue, 85 LPDWORD pdwReserved, 86 LPDWORD pdwType, 87 LPVOID pvData, 88 LPDWORD pcbData) 89 { 90 DWORD ret; 91 WARN("0x%04x %s %p %p %p %p semi-stub\n", 92 hkey, debugstr_w(pszValue), pdwReserved, pdwType, pvData, pcbData); 93 ret = RegQueryValueExW ( hkey, pszValue, pdwReserved, pdwType, pvData, pcbData); 94 return ret; 96 95 } 97 96 … … 100 99 */ 101 100 HRESULT WINAPI SHRegDeleteKeyA( 102 103 104 { 105 101 HKEY hkey, 102 LPCSTR pszSubKey) 103 { 104 FIXME("hkey=0x%08x, %s\n", hkey, debugstr_a(pszSubKey)); 106 105 #ifdef __WIN32OS2__ 107 106 return RegDeleteKeyA(hkey,pszSubKey); 108 107 #else 109 108 return 0; 110 109 #endif 111 110 } … … 115 114 */ 116 115 HRESULT WINAPI SHRegDeleteKeyW( 117 118 119 { 120 116 HKEY hkey, 117 LPCWSTR pszSubKey) 118 { 119 FIXME("hkey=0x%08x, %s\n", hkey, debugstr_w(pszSubKey)); 121 120 #ifdef __WIN32OS2__ 122 121 return RegDeleteKeyW(hkey,pszSubKey); 123 122 #else 124 123 return 0; 125 124 #endif 126 125 } 127 126 128 127 /************************************************************************* 129 * SHRegCloseKey 128 * SHRegCloseKey [NT4.0:SHELL32.505] 130 129 * 131 130 */ 132 131 HRESULT WINAPI SHRegCloseKey (HKEY hkey) 133 132 { 134 135 133 TRACE("0x%04x\n",hkey); 134 return RegCloseKey( hkey ); 136 135 } 137 136 -
trunk/src/shell32/shellstring.c
r6650 r6709 1 /* $Id: shellstring.c,v 1.3 2001-09-05 13:46:58 bird Exp $ */2 1 #include <string.h> 3 2 #include <stdio.h> 4 3 #include <ctype.h> 5 #include <stdlib.h> 4 #include <stdlib.h> 6 5 7 6 #include "winnls.h" … … 22 21 23 22 /************************************************************************* 24 * StrRetToStrN 25 * 23 * StrRetToStrN [SHELL32.96] 24 * 26 25 * converts a STRRET to a normal string 27 26 * … … 41 40 HRESULT WINAPI StrRetToStrNAW (LPVOID dest, DWORD len, LPSTRRET src, const ITEMIDLIST *pidl) 42 41 { 43 44 45 42 if(SHELL_OsIsUnicode()) 43 return StrRetToStrNW (dest, len, src, pidl); 44 return StrRetToStrNA (dest, len, src, pidl); 46 45 } 47 46 … … 49 48 50 49 /************************************************************************ 51 * StrToOleStr[SHELL32.163]50 * StrToOleStr [SHELL32.163] 52 51 * 53 52 */ 54 53 int WINAPI StrToOleStrA (LPWSTR lpWideCharStr, LPCSTR lpMultiByteString) 55 54 { 56 57 55 TRACE("(%p, %p %s)\n", 56 lpWideCharStr, lpMultiByteString, debugstr_a(lpMultiByteString)); 58 57 59 58 return MultiByteToWideChar(0, 0, lpMultiByteString, -1, lpWideCharStr, MAX_PATH); 60 59 61 60 } 62 61 int WINAPI StrToOleStrW (LPWSTR lpWideCharStr, LPCWSTR lpWString) 63 62 { 64 65 63 TRACE("(%p, %p %s)\n", 64 lpWideCharStr, lpWString, debugstr_w(lpWString)); 66 65 67 68 66 strcpyW (lpWideCharStr, lpWString ); 67 return strlenW(lpWideCharStr); 69 68 } 70 69 71 70 BOOL WINAPI StrToOleStrAW (LPWSTR lpWideCharStr, LPCVOID lpString) 72 71 { 73 74 75 72 if (SHELL_OsIsUnicode()) 73 return StrToOleStrW (lpWideCharStr, lpString); 74 return StrToOleStrA (lpWideCharStr, lpString); 76 75 } 77 76 78 77 /************************************************************************* 79 * StrToOleStrN 78 * StrToOleStrN [SHELL32.79] 80 79 * lpMulti, nMulti, nWide [IN] 81 80 * lpWide [OUT] 82 81 */ 83 BOOL WINAPI StrToOleStrNA (LPWSTR lpWide, INT nWide, LPCSTR lpStrA, INT nStr) 82 BOOL WINAPI StrToOleStrNA (LPWSTR lpWide, INT nWide, LPCSTR lpStrA, INT nStr) 84 83 { 85 86 84 TRACE("(%p, %x, %s, %x)\n", lpWide, nWide, debugstr_an(lpStrA,nStr), nStr); 85 return MultiByteToWideChar (0, 0, lpStrA, nStr, lpWide, nWide); 87 86 } 88 BOOL WINAPI StrToOleStrNW (LPWSTR lpWide, INT nWide, LPCWSTR lpStrW, INT nStr) 87 BOOL WINAPI StrToOleStrNW (LPWSTR lpWide, INT nWide, LPCWSTR lpStrW, INT nStr) 89 88 { 90 89 TRACE("(%p, %x, %s, %x)\n", lpWide, nWide, debugstr_wn(lpStrW, nStr), nStr); 91 90 92 93 94 95 91 if (lstrcpynW (lpWide, lpStrW, nWide)) 92 { return lstrlenW (lpWide); 93 } 94 return 0; 96 95 } 97 96 98 BOOL WINAPI StrToOleStrNAW (LPWSTR lpWide, INT nWide, LPCVOID lpStr, INT nStr) 97 BOOL WINAPI StrToOleStrNAW (LPWSTR lpWide, INT nWide, LPCVOID lpStr, INT nStr) 99 98 { 100 101 102 99 if (SHELL_OsIsUnicode()) 100 return StrToOleStrNW (lpWide, nWide, lpStr, nStr); 101 return StrToOleStrNA (lpWide, nWide, lpStr, nStr); 103 102 } 104 103 105 104 /************************************************************************* 106 * OleStrToStrN 105 * OleStrToStrN [SHELL32.78] 107 106 */ 108 BOOL WINAPI OleStrToStrNA (LPSTR lpStr, INT nStr, LPCWSTR lpOle, INT nOle) 107 BOOL WINAPI OleStrToStrNA (LPSTR lpStr, INT nStr, LPCWSTR lpOle, INT nOle) 109 108 { 110 111 109 TRACE("(%p, %x, %s, %x)\n", lpStr, nStr, debugstr_wn(lpOle,nOle), nOle); 110 return WideCharToMultiByte (0, 0, lpOle, nOle, lpStr, nStr, NULL, NULL); 112 111 } 113 112 114 BOOL WINAPI OleStrToStrNW (LPWSTR lpwStr, INT nwStr, LPCWSTR lpOle, INT nOle) 113 BOOL WINAPI OleStrToStrNW (LPWSTR lpwStr, INT nwStr, LPCWSTR lpOle, INT nOle) 115 114 { 116 115 TRACE("(%p, %x, %s, %x)\n", lpwStr, nwStr, debugstr_wn(lpOle,nOle), nOle); 117 116 118 119 120 121 117 if (lstrcpynW ( lpwStr, lpOle, nwStr)) 118 { return lstrlenW (lpwStr); 119 } 120 return 0; 122 121 } 123 122 124 BOOL WINAPI OleStrToStrNAW (LPVOID lpOut, INT nOut, LPCVOID lpIn, INT nIn) 123 BOOL WINAPI OleStrToStrNAW (LPVOID lpOut, INT nOut, LPCVOID lpIn, INT nIn) 125 124 { 126 127 128 125 if (SHELL_OsIsUnicode()) 126 return OleStrToStrNW (lpOut, nOut, lpIn, nIn); 127 return OleStrToStrNA (lpOut, nOut, lpIn, nIn); 129 128 } -
trunk/src/shell32/shlfileop.c
r6650 r6709 1 /* $Id: shlfileop.c,v 1.9 2001-09-05 13:46:58 bird Exp $ */2 1 /* 3 2 * SHFileOperation … … 24 23 BOOL SHELL_ConfirmDialog (int nKindOfDialog, LPCSTR szDir) 25 24 { 26 25 char szCaption[255], szText[255], szBuffer[MAX_PATH + 256]; 27 26 UINT caption_resource_id, text_resource_id; 28 27 29 30 31 32 caption_resource_id= IDS_DELETEITEM_CAPTION;33 text_resource_id= IDS_DELETEITEM_TEXT;34 35 36 caption_resource_id= IDS_DELETEFOLDER_CAPTION;37 text_resource_id= IDS_DELETEITEM_TEXT;38 39 40 caption_resource_id= IDS_DELETEITEM_CAPTION;41 text_resource_id= IDS_DELETEMULTIPLE_TEXT;42 43 44 caption_resource_id= IDS_OVERWRITEFILE_CAPTION;45 text_resource_id= IDS_OVERWRITEFILE_TEXT;46 47 48 49 50 51 52 53 28 switch(nKindOfDialog) { 29 30 case ASK_DELETE_FILE: 31 caption_resource_id = IDS_DELETEITEM_CAPTION; 32 text_resource_id = IDS_DELETEITEM_TEXT; 33 break; 34 case ASK_DELETE_FOLDER: 35 caption_resource_id = IDS_DELETEFOLDER_CAPTION; 36 text_resource_id = IDS_DELETEITEM_TEXT; 37 break; 38 case ASK_DELETE_MULTIPLE_ITEM: 39 caption_resource_id = IDS_DELETEITEM_CAPTION; 40 text_resource_id = IDS_DELETEMULTIPLE_TEXT; 41 break; 42 case ASK_OVERWRITE_FILE: 43 caption_resource_id = IDS_OVERWRITEFILE_CAPTION; 44 text_resource_id = IDS_OVERWRITEFILE_TEXT; 45 break; 46 default: 47 FIXME(__FUNCTION__" Unhandled nKindOfDialog %d stub\n", nKindOfDialog); 48 return FALSE; 49 } 50 51 LoadStringA(shell32_hInstance, caption_resource_id, szCaption, sizeof(szCaption)); 52 LoadStringA(shell32_hInstance, text_resource_id, szText, sizeof(szText)); 54 53 #else 55 54 BOOL SHELL_WarnItemDelete (int nKindOfDialog, LPCSTR szDir) 56 55 { 57 56 char szCaption[255], szText[255], szBuffer[MAX_PATH + 256]; 58 57 59 58 if(nKindOfDialog == ASK_DELETE_FILE) 60 59 { 61 LoadStringA(shell32_hInstance, IDS_DELETEITEM_TEXT, szText, 62 63 LoadStringA(shell32_hInstance, IDS_DELETEITEM_CAPTION, 64 65 60 LoadStringA(shell32_hInstance, IDS_DELETEITEM_TEXT, szText, 61 sizeof(szText)); 62 LoadStringA(shell32_hInstance, IDS_DELETEITEM_CAPTION, 63 szCaption, sizeof(szCaption)); 64 } 66 65 else if(nKindOfDialog == ASK_DELETE_FOLDER) 67 66 { 68 LoadStringA(shell32_hInstance, IDS_DELETEITEM_TEXT, szText, 69 70 LoadStringA(shell32_hInstance, IDS_DELETEFOLDER_CAPTION, 71 67 LoadStringA(shell32_hInstance, IDS_DELETEITEM_TEXT, szText, 68 sizeof(szText)); 69 LoadStringA(shell32_hInstance, IDS_DELETEFOLDER_CAPTION, 70 szCaption, sizeof(szCaption)); 72 71 } 73 72 else if(nKindOfDialog == ASK_DELETE_MULTIPLE_ITEM) 74 73 { 75 LoadStringA(shell32_hInstance, IDS_DELETEMULTIPLE_TEXT, szText, 76 77 LoadStringA(shell32_hInstance, IDS_DELETEITEM_CAPTION, 78 74 LoadStringA(shell32_hInstance, IDS_DELETEMULTIPLE_TEXT, szText, 75 sizeof(szText)); 76 LoadStringA(shell32_hInstance, IDS_DELETEITEM_CAPTION, 77 szCaption, sizeof(szCaption)); 79 78 } 80 79 else { 81 80 FIXME("Called without a valid nKindOfDialog specified!"); 82 LoadStringA(shell32_hInstance, IDS_DELETEITEM_TEXT, szText, 83 84 LoadStringA(shell32_hInstance, IDS_DELETEITEM_CAPTION, 85 86 } 87 #endif 88 89 90 91 81 LoadStringA(shell32_hInstance, IDS_DELETEITEM_TEXT, szText, 82 sizeof(szText)); 83 LoadStringA(shell32_hInstance, IDS_DELETEITEM_CAPTION, 84 szCaption, sizeof(szCaption)); 85 } 86 #endif 87 FormatMessageA(FORMAT_MESSAGE_FROM_STRING|FORMAT_MESSAGE_ARGUMENT_ARRAY, 88 szText, 0, 0, szBuffer, sizeof(szBuffer), (va_list*)&szDir); 89 90 return (IDOK == MessageBoxA(GetActiveWindow(), szBuffer, szCaption, MB_OKCANCEL | MB_ICONEXCLAMATION)); 92 91 } 93 92 94 93 /************************************************************************** 95 * 94 * SHELL_DeleteDirectoryA() 96 95 * 97 96 * like rm -r … … 100 99 BOOL SHELL_DeleteDirectoryA(LPCSTR pszDir, BOOL bShowUI) 101 100 { 102 BOOLret = FALSE;103 HANDLEhFind;104 105 charszTemp[MAX_PATH];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 101 BOOL ret = FALSE; 102 HANDLE hFind; 103 WIN32_FIND_DATAA wfd; 104 char szTemp[MAX_PATH]; 105 106 strcpy(szTemp, pszDir); 107 PathAddBackslashA(szTemp); 108 strcat(szTemp, "*.*"); 109 110 if (bShowUI && !SHELL_WarnItemDelete(ASK_DELETE_FOLDER, pszDir)) 111 return FALSE; 112 113 if(INVALID_HANDLE_VALUE != (hFind = FindFirstFileA(szTemp, &wfd))) 114 { 115 do 116 { 117 if(strcasecmp(wfd.cFileName, ".") && strcasecmp(wfd.cFileName, "..")) 118 { 119 strcpy(szTemp, pszDir); 120 PathAddBackslashA(szTemp); 121 strcat(szTemp, wfd.cFileName); 122 123 if(FILE_ATTRIBUTE_DIRECTORY & wfd.dwFileAttributes) 124 SHELL_DeleteDirectoryA(szTemp, FALSE); 125 else 126 DeleteFileA(szTemp); 127 } 128 } while(FindNextFileA(hFind, &wfd)); 129 130 FindClose(hFind); 131 ret = RemoveDirectoryA(pszDir); 132 } 133 134 return ret; 136 135 } 137 136 138 137 /************************************************************************** 139 * 138 * SHELL_DeleteFileA() 140 139 */ 141 140 142 141 BOOL SHELL_DeleteFileA(LPCSTR pszFile, BOOL bShowUI) 143 142 { 144 145 146 143 if (bShowUI && !SHELL_WarnItemDelete(ASK_DELETE_FILE, pszFile)) 144 return FALSE; 145 147 146 return DeleteFileA(pszFile); 148 147 } 149 148 150 149 /************************************************************************* 151 * SHCreateDirectory 150 * SHCreateDirectory [SHELL32.165] 152 151 * 153 152 * NOTES … … 157 156 DWORD WINAPI SHCreateDirectory(LPSECURITY_ATTRIBUTES sec,LPCSTR path) 158 157 { 159 160 161 162 163 164 165 158 DWORD ret; 159 TRACE("(%p,%s)\n",sec,path); 160 if ((ret = CreateDirectoryA(path,sec))) 161 { 162 SHChangeNotifyA(SHCNE_MKDIR, SHCNF_PATHA, path, NULL); 163 } 164 return ret; 166 165 } 167 166 168 167 /************************************************************************ 169 * Win32DeleteFile [SHELL32.164] 168 * Win32DeleteFile [SHELL32.164] 170 169 * 171 170 * Deletes a file. Also triggers a change notify if one exists. … … 179 178 BOOL WINAPI Win32DeleteFile(LPSTR fName) 180 179 { 181 182 183 184 185 180 TRACE("%p(%s)\n", fName, fName); 181 182 DeleteFileA(fName); 183 SHChangeNotifyA(SHCNE_DELETE, SHCNF_PATHA, fName, NULL); 184 return TRUE; 186 185 } 187 186 188 187 /************************************************************************* 189 * SHFileOperationA 188 * SHFileOperationA [SHELL32.243] 190 189 * 191 190 * NOTES 192 191 * exported by name 193 192 */ 194 DWORD WINAPI SHFileOperationA (LPSHFILEOPSTRUCTA lpFileOp) 195 { 196 197 193 DWORD WINAPI SHFileOperationA (LPSHFILEOPSTRUCTA lpFileOp) 194 { 195 LPSTR pFrom = (LPSTR)lpFileOp->pFrom; 196 LPSTR pTo = (LPSTR)lpFileOp->pTo; 198 197 #ifdef __WIN32OS2__ 199 198 DWORD FromAttr; … … 224 223 /* default no error 225 224 */ 226 227 225 lpFileOp->fAnyOperationsAborted=FALSE; 226 nlpFileOp.fAnyOperationsAborted=FALSE; 228 227 #else 229 230 #endif 231 232 233 234 228 LPSTR pTempTo; 229 #endif 230 231 switch(lpFileOp->wFunc) { 232 case FO_COPY: 233 TRACE("File Copy:\n"); 235 234 #ifdef __WIN32OS2__ 236 235 pTempFrom = HeapAlloc(GetProcessHeap(), 0, 3 * MAX_PATH+6); 237 236 pTempTo = &pTempFrom[MAX_PATH+4]; 238 /* 239 * FOF_MULTIDESTFILES, FOF_NOCONFIRMATION, FOF_FILESONLY areimplemented237 /* 238 * FOF_MULTIDESTFILES, FOF_NOCONFIRMATION, FOF_FILESONLY are implemented 240 239 * FOF_CONFIRMMOUSE, FOF_SILENT, FOF_NOCONFIRMMKDIR, FOF_SIMPLEPROGRESS are not implemented and ignored 241 240 * if any other flag set, an error occurs 242 */ 241 */ 243 242 OFl = (OFl & (-1 - (FOF_MULTIDESTFILES | FOF_FILESONLY))); 244 243 OFl = (OFl ^ (FOF_SILENT | FOF_NOCONFIRMATION | FOF_SIMPLEPROGRESS | FOF_NOCONFIRMMKDIR)); … … 250 249 // not FOF_SILENT, not FOF_SIMPLEPROGRESS, not FOF_NOCONFIRMMKDIR 251 250 FIXME(__FUNCTION__" FO_COPY with this lpFileOp->fFlags not full implemented:0x%x ,stub\n",lpFileOp->fFlags); 252 } /* endif */ 251 } /* endif */ 253 252 } /* endif */ 254 253 255 254 not_overwrite = (!(lpFileOp->fFlags & FOF_NOCONFIRMATION)); 256 255 257 // fix for more then one source for one target 256 // fix for more then one source for one target 258 257 pToFile = pTempTo; 259 258 … … 275 274 TRACE(" From='%s' To='%s'\n", pFrom, pTo); 276 275 277 // fix for more then one source for one target 276 // fix for more then one source for one target 278 277 pToFile[0] = '\0'; 279 278 nlpFileOp.pTo = pTo; … … 293 292 strcpy(pTempTo,pTo); 294 293 PathRemoveBackslashA(pTempTo); 295 ToWithoutBackSlash = (strlen(pTempTo)==lenTo); 294 ToWithoutBackSlash = (strlen(pTempTo)==lenTo); 296 295 ToAttr = GetFileAttributesA(pTempTo); 297 296 298 297 BothDir = (Multi && 299 298 ToWithoutBackSlash && 300 (-1 != (FromAttr | ToAttr)) && 299 (-1 != (FromAttr | ToAttr)) && 301 300 (ToAttr & FromAttr & FILE_ATTRIBUTE_DIRECTORY)); 302 301 … … 316 315 where = 201; 317 316 break; 318 } 317 } 319 318 lenTempTo = strlen(pTempTo); 320 319 withFileName = (((lenTempTo + 1) < lenTo) || (PathIsRootA(pTo) && lenTempTo < lenTo)); … … 354 353 nlpFileOp.pFrom = pTempFrom; 355 354 // single copy never with FOF_MULTIDESTFILES, I can use lpFileOp->pTo as nlpFileOp.pTo, 356 // I need no different targetarea for the name 355 // I need no different targetarea for the name 357 356 nlpFileOp.fFlags = (nlpFileOp.fFlags & (-1 - (FOF_MULTIDESTFILES))); 358 357 … … 400 399 } /* endif */ 401 400 } else { 402 // Multi Target 401 // Multi Target 403 402 if (!Multi || !(pFrom[lenFrom+1]=='\0') || 404 403 // only target+\, target without \ has 0x402 … … 493 492 break; 494 493 #else 495 496 497 498 494 while(1) { 495 if(!pFrom[0]) break; 496 if(!pTo[0]) break; 497 TRACE(" From='%s' To='%s'\n", pFrom, pTo); 499 498 500 499 pTempTo = HeapAlloc(GetProcessHeap(), 0, strlen(pTo)+1); … … 509 508 CopyFileA(pFrom, pTo, FALSE); 510 509 511 512 513 514 515 516 517 #endif 518 519 520 510 pFrom += strlen(pFrom) + 1; 511 pTo += strlen(pTo) + 1; 512 } 513 TRACE("Setting AnyOpsAborted=FALSE\n"); 514 lpFileOp->fAnyOperationsAborted=FALSE; 515 return 0; 516 #endif 517 518 case FO_DELETE: 519 TRACE("File Delete:\n"); 521 520 #ifdef __WIN32OS2__ 522 521 // need break at error before change sourcepointer … … 588 587 nlpFileOp.pFrom = pTempFrom; 589 588 // single copy never with FOF_MULTIDESTFILES, I can use lpFileOp->pTo as nlpFileOp.pTo, 590 // I need no different targetarea for the name 589 // I need no different targetarea for the name 591 590 nlpFileOp.fFlags = (nlpFileOp.fFlags & (-1 - (FOF_MULTIDESTFILES))); 592 591 … … 615 614 } 616 615 break; 617 618 616 case FO_MOVE: 617 TRACE("File\\Tree Move: simply (Copy/Delete)\n"); 619 618 nlpFileOp.wFunc = FO_COPY; 620 619 // not delete at error from copy … … 634 633 TempretCode = SHFileOperationA (&nlpFileOp); 635 634 636 635 case 0: 637 636 break; 638 637 #else 639 640 641 642 643 644 645 646 647 648 #endif 649 650 651 #ifdef __WIN32OS2__ 652 638 while(1) { 639 if(!pFrom[0]) break; 640 TRACE(" File='%s'\n", pFrom); 641 DeleteFileA(pFrom); 642 pFrom += strlen(pFrom) + 1; 643 } 644 TRACE("Setting AnyOpsAborted=FALSE\n"); 645 lpFileOp->fAnyOperationsAborted=FALSE; 646 return 0; 647 #endif 648 649 default: 650 #ifdef __WIN32OS2__ 651 FIXME(__FUNCTION__" Unhandled shell file operation %d stub\n", lpFileOp->wFunc); 653 652 #else 654 655 656 #endif 657 658 659 #ifdef __WIN32OS2__ 660 653 FIXME("Unhandled shell file operation %d\n", lpFileOp->wFunc); 654 } 655 #endif 656 return 1; 657 658 #ifdef __WIN32OS2__ 659 } 661 660 if (pTempFrom) HeapFree(GetProcessHeap(), 0, pTempFrom); 662 661 … … 676 675 } /* endif */ 677 676 TRACE(__FUNCTION__" Setting AnyOpsAborted=FALSE\n"); 678 return 0; 677 return 0; 679 678 680 679 #endif … … 682 681 683 682 /************************************************************************* 684 * SHFileOperationW 683 * SHFileOperationW [SHELL32.244] 685 684 * 686 685 * NOTES 687 686 * exported by name 688 687 */ 689 DWORD WINAPI SHFileOperationW (LPSHFILEOPSTRUCTW lpFileOp) 690 { 691 #ifdef __WIN32OS2__ 692 688 DWORD WINAPI SHFileOperationW (LPSHFILEOPSTRUCTW lpFileOp) 689 { 690 #ifdef __WIN32OS2__ 691 FIXME(__FUNCTION__"(%p) ,stub\n", lpFileOp); 693 692 #else 694 695 #endif 696 693 FIXME("(%p):stub.\n", lpFileOp); 694 #endif 695 return 1; 697 696 } 698 697 699 698 /************************************************************************* 700 * SHFileOperation 699 * SHFileOperation [SHELL32.242] 701 700 * 702 701 */ 703 702 DWORD WINAPI SHFileOperationAW(LPVOID lpFileOp) 704 703 { 705 706 707 704 if (SHELL_OsIsUnicode()) 705 return SHFileOperationW(lpFileOp); 706 return SHFileOperationA(lpFileOp); 708 707 } 709 708 … … 714 713 HRESULT WINAPI SheGetDirW(LPWSTR u, LPWSTR v) 715 714 #ifdef __WIN32OS2__ 716 { 715 { FIXME(__FUNCTION__"(%p, %p) ,stub\n",u,v); 717 716 #else 718 { 719 #endif 720 717 { FIXME("%p %p stub\n",u,v); 718 #endif 719 return 0; 721 720 } 722 721 … … 727 726 HRESULT WINAPI SheChangeDirW(LPWSTR u) 728 727 #ifdef __WIN32OS2__ 729 { 728 { FIXME(__FUNCTION__"(%s),stub\n",debugstr_w(u)); 730 729 #else 731 { 732 #endif 733 730 { FIXME("(%s),stub\n",debugstr_w(u)); 731 #endif 732 return 0; 734 733 } 735 734 736 735 /************************************************************************* 737 * IsNetDrive 736 * IsNetDrive [SHELL32.66] 738 737 */ 739 738 BOOL WINAPI IsNetDrive(DWORD drive) 740 739 { 741 742 743 744 745 } 746 747 740 char root[4]; 741 strcpy(root, "A:\\"); 742 root[0] += drive; 743 return (GetDriveTypeA(root) == DRIVE_REMOTE); 744 } 745 746 -
trunk/src/shell32/shlfolder.c
r6650 r6709 1 /* $Id: shlfolder.c,v 1.3 2001-09-05 13:46:59 bird Exp $ */2 1 /* 3 * 2 * Shell Folder stuff 4 3 * 5 * Copyright 1997Marcus Meissner6 * Copyright 1998, 1999Juergen Schmied7 * 8 * 4 * Copyright 1997 Marcus Meissner 5 * Copyright 1998, 1999 Juergen Schmied 6 * 7 * IShellFolder2 and related interfaces 9 8 * 10 9 */ 11 10 #ifdef __WIN32OS2__ 12 11 #define WINE_LARGE_INTEGER 13 #define snprintf(a,b,c,d) 12 #define snprintf(a,b,c,d) sprintf(a,c,d) 14 13 #endif 15 14 #include <stdlib.h> … … 51 50 typedef struct 52 51 { 53 intcolnameid;54 intpcsFlags;55 intfmt;56 intcxChar;57 52 int colnameid; 53 int pcsFlags; 54 int fmt; 55 int cxChar; 56 58 57 } shvheader; 59 58 … … 73 72 74 73 static LPCWSTR GetNextElementW(LPCWSTR pszNext,LPWSTR pszOut,DWORD dwOut) 75 { 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 74 { LPCWSTR pszTail = pszNext; 75 DWORD dwCopy; 76 TRACE("(%s %p 0x%08lx)\n",debugstr_w(pszNext),pszOut,dwOut); 77 78 *pszOut=0x0000; 79 80 if(!pszNext || !*pszNext) 81 return NULL; 82 83 while(*pszTail && (*pszTail != (WCHAR)'\\')) 84 pszTail++; 85 86 dwCopy = (WCHAR*)pszTail - (WCHAR*)pszNext + 1; 87 lstrcpynW(pszOut, pszNext, (dwOut<dwCopy)? dwOut : dwCopy); 88 89 if(*pszTail) 90 pszTail++; 91 else 92 pszTail = NULL; 93 94 TRACE("--(%s %s 0x%08lx %p)\n",debugstr_w(pszNext),debugstr_w(pszOut),dwOut,pszTail); 95 return pszTail; 97 96 } 98 97 99 98 static HRESULT SHELL32_ParseNextElement( 100 101 102 103 104 105 106 { 107 HRESULThr = E_OUTOFMEMORY;108 LPITEMIDLISTpidlOut, pidlTemp = NULL;109 IShellFolder*psfChild;110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 if (pidlOut) 125 126 127 128 129 130 131 132 return hr; 99 HWND hwndOwner, 100 IShellFolder2 * psf, 101 LPITEMIDLIST * pidlInOut, 102 LPOLESTR szNext, 103 DWORD *pEaten, 104 DWORD *pdwAttributes) 105 { 106 HRESULT hr = E_OUTOFMEMORY; 107 LPITEMIDLIST pidlOut, pidlTemp = NULL; 108 IShellFolder *psfChild; 109 110 TRACE("(%p, %p, %s)\n",psf, pidlInOut ? *pidlInOut : NULL, debugstr_w(szNext)); 111 112 113 /* get the shellfolder for the child pidl and let it analyse further */ 114 hr = IShellFolder_BindToObject(psf, *pidlInOut, NULL, &IID_IShellFolder, (LPVOID*)&psfChild); 115 116 if (psfChild) 117 { 118 hr = IShellFolder_ParseDisplayName(psfChild, hwndOwner, NULL, szNext, pEaten, &pidlOut, pdwAttributes); 119 IShellFolder_Release(psfChild); 120 121 pidlTemp = ILCombine(*pidlInOut, pidlOut); 122 123 if (pidlOut) 124 ILFree(pidlOut); 125 } 126 127 ILFree(*pidlInOut); 128 *pidlInOut = pidlTemp; 129 130 TRACE("-- pidl=%p ret=0x%08lx\n", pidlInOut? *pidlInOut: NULL, hr); 131 return hr; 133 132 } 134 133 135 134 /*********************************************************************** 136 * 135 * SHELL32_CoCreateInitSF 137 136 * 138 * 137 * creates a initialized shell folder 139 138 */ 140 139 static HRESULT SHELL32_CoCreateInitSF ( 141 142 143 144 145 146 { 147 148 LPITEMIDLISTabsPidl;149 IShellFolder2*pShellFolder;150 IPersistFolder*pPersistFolder;151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 140 LPITEMIDLIST pidlRoot, 141 LPITEMIDLIST pidlChild, 142 REFCLSID clsid, 143 REFIID iid, 144 LPVOID * ppvOut) 145 { 146 HRESULT hr; 147 LPITEMIDLIST absPidl; 148 IShellFolder2 *pShellFolder; 149 IPersistFolder *pPersistFolder; 150 151 TRACE("%p %p\n", pidlRoot, pidlChild); 152 153 *ppvOut = NULL; 154 155 /* we have to ask first for IPersistFolder, some special folders are expecting this */ 156 hr = SHCoCreateInstance(NULL, clsid, NULL, &IID_IPersistFolder, (LPVOID*)&pPersistFolder); 157 if (SUCCEEDED(hr)) 158 { 159 hr = IPersistFolder_QueryInterface(pPersistFolder, iid, (LPVOID*)&pShellFolder); 160 if (SUCCEEDED(hr)) 161 { 162 absPidl = ILCombine (pidlRoot, pidlChild); 163 hr = IPersistFolder_Initialize(pPersistFolder, absPidl); 164 IPersistFolder_Release(pPersistFolder); 165 SHFree(absPidl); 166 *ppvOut = pShellFolder; 167 } 168 } 169 170 TRACE("-- ret=0x%08lx\n", hr); 171 return hr; 173 172 } 174 173 175 174 static HRESULT SHELL32_GetDisplayNameOfChild( 176 177 178 179 180 181 { 182 LPITEMIDLISTpidlFirst, pidlNext;183 IShellFolder2 *psfChild;184 HRESULThr = E_OUTOFMEMORY;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 175 IShellFolder2 * psf, 176 LPCITEMIDLIST pidl, 177 DWORD dwFlags, 178 LPSTR szOut, 179 DWORD dwOutLen) 180 { 181 LPITEMIDLIST pidlFirst, pidlNext; 182 IShellFolder2 * psfChild; 183 HRESULT hr = E_OUTOFMEMORY; 184 STRRET strTemp; 185 186 TRACE("(%p)->(pidl=%p 0x%08lx %p 0x%08lx)\n",psf,pidl,dwFlags,szOut, dwOutLen); 187 pdump(pidl); 188 189 if ((pidlFirst = ILCloneFirst(pidl))) 190 { 191 hr = IShellFolder_BindToObject(psf, pidlFirst, NULL, &IID_IShellFolder, (LPVOID*)&psfChild); 192 if (SUCCEEDED(hr)) 193 { 194 pidlNext = ILGetNext(pidl); 195 196 hr = IShellFolder_GetDisplayNameOf(psfChild, pidlNext, dwFlags | SHGDN_INFOLDER, &strTemp); 197 if (SUCCEEDED(hr)) 198 { 199 hr = StrRetToStrNA(szOut, dwOutLen, &strTemp, pidlNext); 200 } 201 202 IShellFolder_Release(psfChild); 203 } 204 ILFree(pidlFirst); 205 } 206 207 TRACE("-- ret=0x%08lx %s\n", hr, szOut); 208 209 return hr; 211 210 } 212 211 … … 216 215 * NOTES 217 216 * observerd values: 218 * folder: 0xE0000177FILESYSTEM | HASSUBFOLDER | FOLDER219 * file: 0x40000177FILESYSTEM220 * drive: 0xf0000144FILESYSTEM | HASSUBFOLDER | FOLDER | FILESYSANCESTOR221 * mycomputer: 0xb0000154HASSUBFOLDER | FOLDER | FILESYSANCESTOR217 * folder: 0xE0000177 FILESYSTEM | HASSUBFOLDER | FOLDER 218 * file: 0x40000177 FILESYSTEM 219 * drive: 0xf0000144 FILESYSTEM | HASSUBFOLDER | FOLDER | FILESYSANCESTOR 220 * mycomputer: 0xb0000154 HASSUBFOLDER | FOLDER | FILESYSANCESTOR 222 221 * (seems to be default for shell extensions if no registry entry exists) 223 222 * … … 225 224 */ 226 225 static HRESULT SHELL32_GetItemAttributes( 227 228 229 226 IShellFolder * psf, 227 LPITEMIDLIST pidl, 228 LPDWORD pdwAttributes) 230 229 { 231 230 GUID const * clsid; 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 274 231 DWORD dwAttributes; 232 233 TRACE("0x%08lx\n", *pdwAttributes); 234 235 if (*pdwAttributes & (0xcff3fe88)) 236 WARN("attribute 0x%08lx not implemented\n", *pdwAttributes); 237 *pdwAttributes &= ~SFGAO_LINK; /* FIXME: for native filedialogs */ 238 239 if (_ILIsDrive(pidl)) 240 { 241 *pdwAttributes &= 0xf0000144; 242 } 243 else if ((clsid=_ILGetGUIDPointer(pidl))) 244 { 245 if (HCR_GetFolderAttributes(clsid, &dwAttributes)) 246 { 247 *pdwAttributes &= dwAttributes; 248 } 249 else 250 { 251 *pdwAttributes &= 0xb0000154; 252 } 253 } 254 else if (_ILGetDataPointer(pidl)) 255 { 256 dwAttributes = _ILGetFileAttributes(pidl, NULL, 0); 257 *pdwAttributes &= ~SFGAO_FILESYSANCESTOR; 258 259 if(( SFGAO_FOLDER & *pdwAttributes) && !(dwAttributes & FILE_ATTRIBUTE_DIRECTORY)) 260 *pdwAttributes &= ~(SFGAO_FOLDER|SFGAO_HASSUBFOLDER); 261 262 if(( SFGAO_HIDDEN & *pdwAttributes) && !(dwAttributes & FILE_ATTRIBUTE_HIDDEN)) 263 *pdwAttributes &= ~SFGAO_HIDDEN; 264 265 if(( SFGAO_READONLY & *pdwAttributes) && !(dwAttributes & FILE_ATTRIBUTE_READONLY)) 266 *pdwAttributes &= ~SFGAO_READONLY; 267 } 268 else 269 { 270 *pdwAttributes &= 0xb0000154; 271 } 272 TRACE("-- 0x%08lx\n", *pdwAttributes); 273 return S_OK; 275 274 } 276 275 … … 279 278 */ 280 279 281 typedef struct 282 { 283 284 DWORDref;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 LPSTRsMyPath;295 LPITEMIDLIST absPidl;/* complete pidl */296 297 UINT cfShellIDList;/* clipboardformat for IDropTarget */298 BOOL fAcceptFmt;/* flag for pending Drop */280 typedef struct 281 { 282 ICOM_VFIELD(IUnknown); 283 DWORD ref; 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 LPSTR sMyPath; 294 LPITEMIDLIST absPidl; /* complete pidl */ 295 296 UINT cfShellIDList; /* clipboardformat for IDropTarget */ 297 BOOL fAcceptFmt; /* flag for pending Drop */ 299 298 } IGenericSFImpl; 300 299 … … 307 306 static IShellFolder * ISF_MyComputer_Constructor(void); 308 307 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); 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); 320 319 /* 321 320 converts This to a interface pointer 322 321 */ 323 #define _IUnknown_(This) 324 #define _IShellFolder_(This) 325 #define _IShellFolder2_(This) 326 #define _IPersist_(This) 327 #define _IPersistFolder_(This) 328 #define _IPersistFolder2_(This) 329 #define _IDropTarget_(This) 330 #define _ISFHelper_(This) 331 /************************************************************************** 332 * 322 #define _IUnknown_(This) (IUnknown*)&(This->lpVtbl) 323 #define _IShellFolder_(This) (IShellFolder*)&(This->lpvtblShellFolder) 324 #define _IShellFolder2_(This) (IShellFolder2*)&(This->lpvtblShellFolder) 325 #define _IPersist_(This) (IPersist*)&(This->lpvtblPersistFolder2) 326 #define _IPersistFolder_(This) (IPersistFolder*)&(This->lpvtblPersistFolder2) 327 #define _IPersistFolder2_(This) (IPersistFolder2*)&(This->lpvtblPersistFolder2) 328 #define _IDropTarget_(This) (IDropTarget*)&(This->lpvtblDropTarget) 329 #define _ISFHelper_(This) (ISFHelper*)&(This->lpvtblSFHelper) 330 /************************************************************************** 331 * registers clipboardformat once 333 332 */ 334 333 static void SF_RegisterClipFmt (IGenericSFImpl * This) 335 334 { 336 337 338 339 340 341 342 } 343 344 /************************************************************************** 345 * 346 * 335 TRACE("(%p)\n", This); 336 337 if (!This->cfShellIDList) 338 { 339 This->cfShellIDList = RegisterClipboardFormatA(CFSTR_SHELLIDLIST); 340 } 341 } 342 343 /************************************************************************** 344 * we need a separate IUnknown to handle aggregation 345 * (inner IUnknown) 347 346 */ 348 347 static HRESULT WINAPI IUnknown_fnQueryInterface( 349 350 351 352 { 353 354 355 356 357 358 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 368 369 370 371 372 373 374 375 376 377 378 379 380 348 IUnknown * iface, 349 REFIID riid, 350 LPVOID *ppvObj) 351 { 352 ICOM_THIS(IGenericSFImpl, iface); 353 354 _CALL_TRACE 355 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj); 356 357 *ppvObj = NULL; 358 359 if(IsEqualIID(riid, &IID_IUnknown)) *ppvObj = _IUnknown_(This); 360 else if(IsEqualIID(riid, &IID_IShellFolder)) *ppvObj = _IShellFolder_(This); 361 else if(IsEqualIID(riid, &IID_IShellFolder2)) *ppvObj = _IShellFolder_(This); 362 else if(IsEqualIID(riid, &IID_IPersist)) *ppvObj = _IPersist_(This); 363 else if(IsEqualIID(riid, &IID_IPersistFolder)) *ppvObj = _IPersistFolder_(This); 364 else if(IsEqualIID(riid, &IID_IPersistFolder2)) *ppvObj = _IPersistFolder2_(This); 365 else if(IsEqualIID(riid, &IID_ISFHelper)) *ppvObj = _ISFHelper_(This); 366 else if(IsEqualIID(riid, &IID_IDropTarget)) 367 { 368 *ppvObj = _IDropTarget_(This); 369 SF_RegisterClipFmt(This); 370 } 371 372 if(*ppvObj) 373 { 374 IUnknown_AddRef((IUnknown*)(*ppvObj)); 375 TRACE("-- Interface = %p\n", *ppvObj); 376 return S_OK; 377 } 378 TRACE("-- Interface: E_NOINTERFACE\n"); 379 return E_NOINTERFACE; 381 380 } 382 381 383 382 static ULONG WINAPI IUnknown_fnAddRef(IUnknown * iface) 384 383 { 385 386 387 388 389 390 391 392 } 393 394 static ULONG WINAPI IUnknown_fnRelease(IUnknown * iface) 395 { 396 397 398 399 400 401 402 if (!--(This->ref)) 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 } 418 419 static ICOM_VTABLE(IUnknown) unkvt = 420 { 421 422 423 424 384 ICOM_THIS(IGenericSFImpl, iface); 385 386 _CALL_TRACE 387 TRACE("(%p)->(count=%lu)\n",This,This->ref); 388 389 shell32_ObjCount++; 390 return ++(This->ref); 391 } 392 393 static ULONG WINAPI IUnknown_fnRelease(IUnknown * iface) 394 { 395 ICOM_THIS(IGenericSFImpl, iface); 396 397 _CALL_TRACE 398 TRACE("(%p)->(count=%lu)\n",This,This->ref); 399 400 shell32_ObjCount--; 401 if (!--(This->ref)) 402 { 403 TRACE("-- destroying IShellFolder(%p)\n",This); 404 405 if (pdesktopfolder == _IShellFolder_(This)) 406 { 407 pdesktopfolder=NULL; 408 TRACE("-- destroyed IShellFolder(%p) was Desktopfolder\n",This); 409 } 410 if(This->absPidl) SHFree(This->absPidl); 411 if(This->sMyPath) SHFree(This->sMyPath); 412 HeapFree(GetProcessHeap(),0,This); 413 return 0; 414 } 415 return This->ref; 416 } 417 418 static ICOM_VTABLE(IUnknown) unkvt = 419 { 420 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 421 IUnknown_fnQueryInterface, 422 IUnknown_fnAddRef, 423 IUnknown_fnRelease, 425 424 }; 426 425 … … 436 435 437 436 /************************************************************************** 438 * 437 * IShellFolder_Constructor 439 438 * 440 439 * NOTES … … 443 442 * 444 443 * FIXME 445 * 444 * when pUnkOuter = 0 then rrid = IID_IShellFolder is returned 446 445 */ 447 446 HRESULT IFSFolder_Constructor( 448 449 450 451 { 452 IGenericSFImpl *sf;453 454 455 456 457 458 459 hr = CLASS_E_NOAGGREGATION;/* forbidden by definition */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 /************************************************************************** 487 * 447 IUnknown * pUnkOuter, 448 REFIID riid, 449 LPVOID * ppv) 450 { 451 IGenericSFImpl * sf; 452 HRESULT hr = S_OK; 453 454 TRACE("unkOut=%p riid=%s\n",pUnkOuter, debugstr_guid(riid)); 455 456 if(pUnkOuter && ! IsEqualIID(riid, &IID_IUnknown)) 457 { 458 hr = CLASS_E_NOAGGREGATION; /* forbidden by definition */ 459 } 460 else 461 { 462 sf=(IGenericSFImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IGenericSFImpl)); 463 if (sf) 464 { 465 sf->ref=1; 466 ICOM_VTBL(sf)=&unkvt; 467 sf->lpvtblShellFolder=&sfvt; 468 sf->lpvtblPersistFolder2=&psfvt; 469 sf->lpvtblDropTarget=&dtvt; 470 sf->lpvtblSFHelper=&shvt; 471 472 sf->pclsid = (CLSID*)&CLSID_SFFile; 473 sf->pUnkOuter = pUnkOuter ? pUnkOuter : _IUnknown_(sf); 474 *ppv = _IUnknown_(sf); 475 hr = S_OK; 476 shell32_ObjCount++; 477 } 478 else 479 { 480 hr = E_OUTOFMEMORY; 481 } 482 } 483 return hr; 484 } 485 /************************************************************************** 486 * IShellFolder_Constructor 488 487 * 489 488 * NOTES 490 * 489 * THIS points to the parent folder 491 490 */ 492 491 493 492 IShellFolder * IShellFolder_Constructor( 494 495 496 { 497 IGenericSFImpl *sf;498 DWORDdwSize=0;499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 if(pidl && iface)/* do we have a pidl? */518 519 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 528 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 535 536 537 if(This->sMyPath)/* if the parent has a path, get it*/538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 493 IShellFolder2 * iface, 494 LPITEMIDLIST pidl) 495 { 496 IGenericSFImpl * sf; 497 DWORD dwSize=0; 498 499 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 500 501 sf=(IGenericSFImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IGenericSFImpl)); 502 sf->ref=1; 503 504 ICOM_VTBL(sf)=&unkvt; 505 sf->lpvtblShellFolder=&sfvt; 506 sf->lpvtblPersistFolder2=&psfvt; 507 sf->lpvtblDropTarget=&dtvt; 508 sf->lpvtblSFHelper=&shvt; 509 510 sf->pclsid = (CLSID*)&CLSID_SFFile; 511 sf->pUnkOuter = _IUnknown_(sf); 512 513 TRACE("(%p)->(parent=%p, pidl=%p)\n",sf,This, pidl); 514 pdump(pidl); 515 516 if(pidl && iface) /* do we have a pidl? */ 517 { 518 int len; 519 520 sf->absPidl = ILCombine(This->absPidl, pidl); /* build a absolute pidl */ 521 522 if (!_ILIsSpecialFolder(pidl)) /* only file system paths */ 523 { 524 if(This->sMyPath) /* get the size of the parents path */ 525 { 526 dwSize += strlen(This->sMyPath) ; 527 TRACE("-- (%p)->(parent's path=%s)\n",sf, debugstr_a(This->sMyPath)); 528 } 529 530 dwSize += _ILSimpleGetText(pidl,NULL,0); /* add the size of our name*/ 531 sf->sMyPath = SHAlloc(dwSize + 2); /* '\0' and backslash */ 532 533 if(!sf->sMyPath) return NULL; 534 *(sf->sMyPath)=0x00; 535 536 if(This->sMyPath) /* if the parent has a path, get it*/ 537 { 538 strcpy(sf->sMyPath, This->sMyPath); 539 PathAddBackslashA (sf->sMyPath); 540 } 541 542 len = strlen(sf->sMyPath); 543 _ILSimpleGetText(pidl, sf->sMyPath + len, dwSize+2 - len); 544 } 545 546 TRACE("-- (%p)->(my pidl=%p, my path=%s)\n",sf, sf->absPidl,debugstr_a(sf->sMyPath)); 547 548 pdump (sf->absPidl); 549 } 550 551 shell32_ObjCount++; 552 return _IShellFolder_(sf); 554 553 } 555 554 … … 558 557 * 559 558 * PARAMETERS 560 * REFIID riid 561 * LPVOID* ppvObject 559 * REFIID riid [in ] Requested InterfaceID 560 * LPVOID* ppvObject [out] Interface* to hold the result 562 561 */ 563 562 static HRESULT WINAPI IShellFolder_fnQueryInterface( 564 565 566 567 { 568 569 570 571 572 573 563 IShellFolder2 * iface, 564 REFIID riid, 565 LPVOID *ppvObj) 566 { 567 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 568 569 _CALL_TRACE 570 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj); 571 572 return IUnknown_QueryInterface(This->pUnkOuter, riid, ppvObj); 574 573 } 575 574 … … 580 579 static ULONG WINAPI IShellFolder_fnAddRef(IShellFolder2 * iface) 581 580 { 582 583 584 585 586 587 581 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 582 583 _CALL_TRACE 584 TRACE("(%p)->(count=%lu)\n",This,This->ref); 585 586 return IUnknown_AddRef(This->pUnkOuter); 588 587 } 589 588 … … 591 590 * IShellFolder_fnRelease 592 591 */ 593 static ULONG WINAPI IShellFolder_fnRelease(IShellFolder2 * iface) 594 { 595 596 597 598 599 600 601 } 602 603 /************************************************************************** 604 * 592 static ULONG WINAPI IShellFolder_fnRelease(IShellFolder2 * iface) 593 { 594 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 595 596 _CALL_TRACE 597 TRACE("(%p)->(count=%lu)\n",This,This->ref); 598 599 return IUnknown_Release(This->pUnkOuter); 600 } 601 602 /************************************************************************** 603 * IShellFolder_fnParseDisplayName 605 604 * PARAMETERS 606 605 * HWND hwndOwner, //[in ] Parent window for any message's … … 612 611 * 613 612 * NOTES 614 * every folder tries to parse only its own (the leftmost) pidl and creates a 613 * every folder tries to parse only its own (the leftmost) pidl and creates a 615 614 * subfolder to evaluate the remaining parts 616 615 * now we can parse into namespaces implemented by shell extensions 617 616 * 618 * behaviour on win98: 619 * 617 * behaviour on win98: lpszDisplayName=NULL -> chrash 618 * lpszDisplayName="" -> returns mycoputer-pidl 620 619 * 621 * FIXME: 620 * FIXME: 622 621 * pdwAttributes: not set 623 622 * pchEaten: not set like in windows 624 623 */ 625 624 static HRESULT WINAPI IShellFolder_fnParseDisplayName( 626 627 628 629 630 631 632 633 { 634 635 636 HRESULThr = E_OUTOFMEMORY;637 LPCWSTRszNext=NULL;638 WCHARszElement[MAX_PATH];639 CHARszTempA[MAX_PATH], szPath[MAX_PATH];640 LPITEMIDLISTpidlTemp=NULL;641 642 643 644 645 646 647 648 if (pchEaten) *pchEaten = 0;/* strange but like the original */649 650 651 { 652 653 654 655 625 IShellFolder2 * iface, 626 HWND hwndOwner, 627 LPBC pbcReserved, 628 LPOLESTR lpszDisplayName, 629 DWORD *pchEaten, 630 LPITEMIDLIST *ppidl, 631 DWORD *pdwAttributes) 632 { 633 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 634 635 HRESULT hr = E_OUTOFMEMORY; 636 LPCWSTR szNext=NULL; 637 WCHAR szElement[MAX_PATH]; 638 CHAR szTempA[MAX_PATH], szPath[MAX_PATH]; 639 LPITEMIDLIST pidlTemp=NULL; 640 641 TRACE("(%p)->(HWND=0x%08x,%p,%p=%s,%p,pidl=%p,%p)\n", 642 This,hwndOwner,pbcReserved,lpszDisplayName, 643 debugstr_w(lpszDisplayName),pchEaten,ppidl,pdwAttributes); 644 645 if (!lpszDisplayName || !ppidl) return E_INVALIDARG; 646 647 if (pchEaten) *pchEaten = 0; /* strange but like the original */ 648 649 if (*lpszDisplayName) 650 { 651 /* get the next element */ 652 szNext = GetNextElementW(lpszDisplayName, szElement, MAX_PATH); 653 654 /* build the full pathname to the element */ 656 655 WideCharToMultiByte( CP_ACP, 0, szElement, -1, szTempA, MAX_PATH, NULL, NULL ); 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 687 656 strcpy(szPath, This->sMyPath); 657 PathAddBackslashA(szPath); 658 strcat(szPath, szTempA); 659 660 /* get the pidl */ 661 pidlTemp = SHSimpleIDListFromPathA(szPath); 662 663 if (pidlTemp) 664 { 665 /* try to analyse the next element */ 666 if (szNext && *szNext) 667 { 668 hr = SHELL32_ParseNextElement(hwndOwner, iface, &pidlTemp, (LPOLESTR)szNext, pchEaten, pdwAttributes); 669 } 670 else 671 { 672 if (pdwAttributes && *pdwAttributes) 673 { 674 SHELL32_GetItemAttributes(_IShellFolder_(This), pidlTemp, pdwAttributes); 675 /* WIN32_FIND_DATAA fd; 676 SHGetDataFromIDListA(_IShellFolder_(This), pidlTemp, SHGDFIL_FINDDATA, &fd, sizeof(fd)); 677 if (!(FILE_ATTRIBUTE_DIRECTORY & fd.dwFileAttributes)) 678 *pdwAttributes &= ~SFGAO_FOLDER; 679 if (FILE_ATTRIBUTE_READONLY & fd.dwFileAttributes) 680 *pdwAttributes &= ~(SFGAO_CANDELETE|SFGAO_CANMOVE|SFGAO_CANRENAME ); 681 */ 682 } 683 hr = S_OK; 684 } 685 } 686 } 688 687 689 688 if (!hr) 690 691 692 693 694 695 696 return hr; 697 } 698 699 /************************************************************************** 700 * 689 *ppidl = pidlTemp; 690 else 691 *ppidl = NULL; 692 693 TRACE("(%p)->(-- pidl=%p ret=0x%08lx)\n", This, ppidl? *ppidl:0, hr); 694 695 return hr; 696 } 697 698 /************************************************************************** 699 * IShellFolder_fnEnumObjects 701 700 * PARAMETERS 702 701 * HWND hwndOwner, //[in ] Parent Window … … 705 704 */ 706 705 static HRESULT WINAPI IShellFolder_fnEnumObjects( 707 708 709 710 711 { 712 713 714 715 716 717 718 719 720 721 722 723 return S_OK; 724 } 725 726 /************************************************************************** 727 * 706 IShellFolder2 * iface, 707 HWND hwndOwner, 708 DWORD dwFlags, 709 LPENUMIDLIST* ppEnumIDList) 710 { 711 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 712 713 TRACE("(%p)->(HWND=0x%08x flags=0x%08lx pplist=%p)\n",This,hwndOwner,dwFlags,ppEnumIDList); 714 715 *ppEnumIDList = NULL; 716 *ppEnumIDList = IEnumIDList_Constructor (This->sMyPath, dwFlags, EIDL_FILE); 717 718 TRACE("-- (%p)->(new ID List: %p)\n",This,*ppEnumIDList); 719 720 if(!*ppEnumIDList) return E_OUTOFMEMORY; 721 722 return S_OK; 723 } 724 725 /************************************************************************** 726 * IShellFolder_fnBindToObject 728 727 * PARAMETERS 729 728 * LPCITEMIDLIST pidl, //[in ] relative pidl to open … … 733 732 */ 734 733 static HRESULT WINAPI IShellFolder_fnBindToObject( IShellFolder2 * iface, LPCITEMIDLIST pidl, 735 736 { 737 738 GUIDconst * iid;739 IShellFolder*pShellFolder, *pSubFolder;740 IPersistFolder*pPersistFolder;741 LPITEMIDLISTabsPidl;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 790 734 LPBC pbcReserved, REFIID riid, LPVOID * ppvOut) 735 { 736 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 737 GUID const * iid; 738 IShellFolder *pShellFolder, *pSubFolder; 739 IPersistFolder *pPersistFolder; 740 LPITEMIDLIST absPidl; 741 742 TRACE("(%p)->(pidl=%p,%p,\n\tIID:\t%s,%p)\n",This,pidl,pbcReserved,debugstr_guid(riid),ppvOut); 743 744 if(!pidl || !ppvOut) return E_INVALIDARG; 745 746 *ppvOut = NULL; 747 748 if ((iid=_ILGetGUIDPointer(pidl))) 749 { 750 /* we have to create a alien folder */ 751 if ( SUCCEEDED(SHCoCreateInstance(NULL, iid, NULL, riid, (LPVOID*)&pShellFolder)) 752 && SUCCEEDED(IShellFolder_QueryInterface(pShellFolder, &IID_IPersistFolder, (LPVOID*)&pPersistFolder))) 753 { 754 absPidl = ILCombine (This->absPidl, pidl); 755 IPersistFolder_Initialize(pPersistFolder, absPidl); 756 IPersistFolder_Release(pPersistFolder); 757 SHFree(absPidl); 758 } 759 else 760 { 761 return E_FAIL; 762 } 763 } 764 else if(_ILIsFolder(pidl)) 765 { 766 LPITEMIDLIST pidltemp = ILCloneFirst(pidl); 767 pShellFolder = IShellFolder_Constructor(iface, pidltemp); 768 ILFree(pidltemp); 769 } 770 else 771 { 772 ERR("can't bind to a file\n"); 773 return E_FAIL; 774 } 775 776 if (_ILIsPidlSimple(pidl)) 777 { 778 *ppvOut = pShellFolder; 779 } 780 else 781 { 782 IShellFolder_BindToObject(pShellFolder, ILGetNext(pidl), NULL, &IID_IShellFolder, (LPVOID)&pSubFolder); 783 IShellFolder_Release(pShellFolder); 784 *ppvOut = pSubFolder; 785 } 786 787 TRACE("-- (%p) returning (%p)\n",This, *ppvOut); 788 789 return S_OK; 791 790 } 792 791 … … 796 795 * LPCITEMIDLIST pidl, //[in ] complex pidl to store 797 796 * LPBC pbc, //[in ] reserved 798 * REFIID riid, //[in ] Initial storage interface 797 * REFIID riid, //[in ] Initial storage interface 799 798 * LPVOID* ppvObject //[out] Interface* returned 800 799 */ 801 800 static HRESULT WINAPI IShellFolder_fnBindToStorage( 802 803 804 805 806 807 { 808 809 810 801 IShellFolder2 * iface, 802 LPCITEMIDLIST pidl, 803 LPBC pbcReserved, 804 REFIID riid, 805 LPVOID *ppvOut) 806 { 807 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 808 809 FIXME("(%p)->(pidl=%p,%p,\n\tIID:%s,%p) stub\n", 811 810 This,pidl,pbcReserved,debugstr_guid(riid),ppvOut); 812 811 813 814 812 *ppvOut = NULL; 813 return E_NOTIMPL; 815 814 } 816 815 … … 827 826 * always make the Path come before the File. 828 827 * 829 * NOTES 828 * NOTES 830 829 * use SCODE_CODE() on the return value to get the result 831 830 */ 832 831 833 832 static HRESULT WINAPI IShellFolder_fnCompareIDs( 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 879 else/* same type of pidl */880 881 882 883 884 885 if (nReturn == 0)/* first pidl different ? */886 887 888 889 if (pidl1 && pidl1->mkid.cb) /* go deeper? */ 890 891 892 893 894 895 896 { 897 898 899 900 901 902 903 904 905 hr = ResultFromShort(nReturn);/* two equal simple pidls */906 907 908 909 910 hr = ResultFromShort(nReturn);/* two different simple pidls */911 912 913 914 915 916 917 } 918 919 /************************************************************************** 920 * 833 IShellFolder2 * iface, 834 LPARAM lParam, 835 LPCITEMIDLIST pidl1, 836 LPCITEMIDLIST pidl2) 837 { 838 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 839 840 CHAR szTemp1[MAX_PATH]; 841 CHAR szTemp2[MAX_PATH]; 842 int nReturn; 843 IShellFolder * psf; 844 HRESULT hr = E_OUTOFMEMORY; 845 LPCITEMIDLIST pidlTemp; 846 PIDLTYPE pt1, pt2; 847 848 TRACE("(%p)->(0x%08lx,pidl1=%p,pidl2=%p)\n",This,lParam,pidl1,pidl2); 849 pdump (pidl1); 850 pdump (pidl2); 851 852 if (!pidl1 && !pidl2) 853 { 854 hr = ResultFromShort(0); 855 } 856 else if (!pidl1) 857 { 858 hr = ResultFromShort(-1); 859 } 860 else if (!pidl2) 861 { 862 hr = ResultFromShort(1); 863 } 864 else 865 { 866 LPPIDLDATA pd1, pd2; 867 pd1 = _ILGetDataPointer(pidl1); 868 pd2 = _ILGetDataPointer(pidl2); 869 870 /* compate the types. sort order is the PT_* constant */ 871 pt1 = ( pd1 ? pd1->type: PT_DESKTOP); 872 pt2 = ( pd2 ? pd2->type: PT_DESKTOP); 873 874 if (pt1 != pt2) 875 { 876 hr = ResultFromShort(pt1-pt2); 877 } 878 else /* same type of pidl */ 879 { 880 _ILSimpleGetText(pidl1, szTemp1, MAX_PATH); 881 _ILSimpleGetText(pidl2, szTemp2, MAX_PATH); 882 nReturn = strcasecmp(szTemp1, szTemp2); 883 884 if (nReturn == 0) /* first pidl different ? */ 885 { 886 pidl1 = ILGetNext(pidl1); 887 888 if (pidl1 && pidl1->mkid.cb) /* go deeper? */ 889 { 890 pidlTemp = ILCloneFirst(pidl1); 891 pidl2 = ILGetNext(pidl2); 892 893 hr = IShellFolder_BindToObject(iface, pidlTemp, NULL, &IID_IShellFolder, (LPVOID*)&psf); 894 if (SUCCEEDED(hr)) 895 { 896 nReturn = IShellFolder_CompareIDs(psf, 0, pidl1, pidl2); 897 IShellFolder_Release(psf); 898 hr = ResultFromShort(nReturn); 899 } 900 ILFree(pidlTemp); 901 } 902 else 903 { 904 hr = ResultFromShort(nReturn); /* two equal simple pidls */ 905 } 906 } 907 else 908 { 909 hr = ResultFromShort(nReturn); /* two different simple pidls */ 910 } 911 } 912 } 913 914 TRACE("-- res=0x%08lx\n", hr); 915 return hr; 916 } 917 918 /************************************************************************** 919 * IShellFolder_fnCreateViewObject 921 920 */ 922 921 static HRESULT WINAPI IShellFolder_fnCreateViewObject( 923 924 925 926 927 { 928 929 930 LPSHELLVIEWpShellView;931 HRESULThr = E_INVALIDARG;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 959 return hr; 922 IShellFolder2 * iface, 923 HWND hwndOwner, 924 REFIID riid, 925 LPVOID *ppvOut) 926 { 927 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 928 929 LPSHELLVIEW pShellView; 930 HRESULT hr = E_INVALIDARG; 931 932 TRACE("(%p)->(hwnd=0x%x,\n\tIID:\t%s,%p)\n",This,hwndOwner,debugstr_guid(riid),ppvOut); 933 934 if(ppvOut) 935 { 936 *ppvOut = NULL; 937 938 if(IsEqualIID(riid, &IID_IDropTarget)) 939 { 940 hr = IShellFolder_QueryInterface(iface, &IID_IDropTarget, ppvOut); 941 } 942 else if(IsEqualIID(riid, &IID_IContextMenu)) 943 { 944 FIXME("IContextMenu not implemented\n"); 945 hr = E_NOTIMPL; 946 } 947 else if(IsEqualIID(riid, &IID_IShellView)) 948 { 949 pShellView = IShellView_Constructor((IShellFolder*)iface); 950 if(pShellView) 951 { 952 hr = IShellView_QueryInterface(pShellView, riid, ppvOut); 953 IShellView_Release(pShellView); 954 } 955 } 956 } 957 TRACE("-- (%p)->(interface=%p)\n",This, ppvOut); 958 return hr; 960 959 } 961 960 … … 965 964 * PARAMETERS 966 965 * UINT cidl, //[in ] num elements in pidl array 967 * LPCITEMIDLIST* apidl, //[in ] simple pidl array 968 * ULONG* rgfInOut) //[out] result array 966 * LPCITEMIDLIST* apidl, //[in ] simple pidl array 967 * ULONG* rgfInOut) //[out] result array 969 968 * 970 969 */ 971 970 static HRESULT WINAPI IShellFolder_fnGetAttributesOf( 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 971 IShellFolder2 * iface, 972 UINT cidl, 973 LPCITEMIDLIST *apidl, 974 DWORD *rgfInOut) 975 { 976 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 977 978 HRESULT hr = S_OK; 979 980 TRACE("(%p)->(cidl=%d apidl=%p mask=0x%08lx)\n",This,cidl,apidl,*rgfInOut); 981 982 if ( (!cidl) || (!apidl) || (!rgfInOut)) 983 return E_INVALIDARG; 984 985 while (cidl > 0 && *apidl) 986 { 987 pdump (*apidl); 988 SHELL32_GetItemAttributes(_IShellFolder_(This), *apidl, rgfInOut); 989 apidl++; 990 cidl--; 991 } 992 993 TRACE("-- result=0x%08lx\n",*rgfInOut); 994 995 return hr; 997 996 } 998 997 /************************************************************************** … … 1004 1003 * LPCITEMIDLIST* apidl, //[in ] simple pidl array 1005 1004 * REFIID riid, //[in ] Requested Interface 1006 * UINT* prgfInOut, //[ ] reserved 1005 * UINT* prgfInOut, //[ ] reserved 1007 1006 * LPVOID* ppvObject) //[out] Resulting Interface 1008 1007 * … … 1017 1016 * and GetData's it if the drop is in another explorer window that needs the positions. 1018 1017 */ 1019 static HRESULT WINAPI IShellFolder_fnGetUIObjectOf( 1020 IShellFolder2 *iface,1021 HWNDhwndOwner,1022 UINTcidl,1023 LPCITEMIDLIST * apidl, 1024 REFIID riid, 1025 UINT *prgfInOut,1026 LPVOID *ppvOut)1027 { 1028 1029 1030 LPITEMIDLISTpidl;1031 IUnknown* pObj = NULL; 1032 HRESULThr = E_INVALIDARG;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 1073 1018 static HRESULT WINAPI IShellFolder_fnGetUIObjectOf( 1019 IShellFolder2 * iface, 1020 HWND hwndOwner, 1021 UINT cidl, 1022 LPCITEMIDLIST * apidl, 1023 REFIID riid, 1024 UINT * prgfInOut, 1025 LPVOID * ppvOut) 1026 { 1027 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 1028 1029 LPITEMIDLIST pidl; 1030 IUnknown* pObj = NULL; 1031 HRESULT hr = E_INVALIDARG; 1032 1033 TRACE("(%p)->(0x%04x,%u,apidl=%p,\n\tIID:%s,%p,%p)\n", 1034 This,hwndOwner,cidl,apidl,debugstr_guid(riid),prgfInOut,ppvOut); 1035 1036 if (ppvOut) 1037 { 1038 *ppvOut = NULL; 1039 1040 if(IsEqualIID(riid, &IID_IContextMenu) && (cidl >= 1)) 1041 { 1042 pObj = (LPUNKNOWN)ISvItemCm_Constructor((IShellFolder*)iface, This->absPidl, apidl, cidl); 1043 hr = S_OK; 1044 } 1045 else if (IsEqualIID(riid, &IID_IDataObject) &&(cidl >= 1)) 1046 { 1047 pObj = (LPUNKNOWN)IDataObject_Constructor (hwndOwner, This->absPidl, apidl, cidl); 1048 hr = S_OK; 1049 } 1050 else if (IsEqualIID(riid, &IID_IExtractIconA) && (cidl == 1)) 1051 { 1052 pidl = ILCombine(This->absPidl,apidl[0]); 1053 pObj = (LPUNKNOWN)IExtractIconA_Constructor( pidl ); 1054 SHFree(pidl); 1055 hr = S_OK; 1056 } 1057 else if (IsEqualIID(riid, &IID_IDropTarget) && (cidl >= 1)) 1058 { 1059 hr = IShellFolder_QueryInterface(iface, &IID_IDropTarget, (LPVOID*)&pObj); 1060 } 1061 else 1062 { 1063 hr = E_NOINTERFACE; 1064 } 1065 1066 if(!pObj) 1067 hr = E_OUTOFMEMORY; 1068 1069 *ppvOut = pObj; 1070 } 1071 TRACE("(%p)->hr=0x%08lx\n",This, hr); 1072 return hr; 1074 1073 } 1075 1074 … … 1090 1089 1091 1090 static HRESULT WINAPI IShellFolder_fnGetDisplayNameOf( 1092 1093 1094 1095 1096 { 1097 1098 1099 CHARszPath[MAX_PATH]= "";1100 intlen = 0;1101 BOOLbSimplePidl;1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 strcpy (szPath, This->sMyPath);/* get path to root*/1123 1124 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 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1091 IShellFolder2 * iface, 1092 LPCITEMIDLIST pidl, 1093 DWORD dwFlags, 1094 LPSTRRET strRet) 1095 { 1096 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 1097 1098 CHAR szPath[MAX_PATH]= ""; 1099 int len = 0; 1100 BOOL bSimplePidl; 1101 1102 TRACE("(%p)->(pidl=%p,0x%08lx,%p)\n",This,pidl,dwFlags,strRet); 1103 pdump(pidl); 1104 1105 if(!pidl || !strRet) return E_INVALIDARG; 1106 1107 bSimplePidl = _ILIsPidlSimple(pidl); 1108 1109 /* take names of special folders only if its only this folder */ 1110 if (_ILIsSpecialFolder(pidl)) 1111 { 1112 if ( bSimplePidl) 1113 { 1114 _ILSimpleGetText(pidl, szPath, MAX_PATH); /* append my own path */ 1115 } 1116 } 1117 else 1118 { 1119 if (!(dwFlags & SHGDN_INFOLDER) && (dwFlags & SHGDN_FORPARSING) && This->sMyPath) 1120 { 1121 strcpy (szPath, This->sMyPath); /* get path to root*/ 1122 PathAddBackslashA(szPath); 1123 len = strlen(szPath); 1124 } 1125 _ILSimpleGetText(pidl, szPath + len, MAX_PATH - len); /* append my own path */ 1126 } 1127 1128 if ( (dwFlags & SHGDN_FORPARSING) && !bSimplePidl) /* go deeper if needed */ 1129 { 1130 PathAddBackslashA(szPath); 1131 len = strlen(szPath); 1132 1133 if (!SUCCEEDED(SHELL32_GetDisplayNameOfChild(iface, pidl, dwFlags, szPath + len, MAX_PATH - len))) 1134 return E_OUTOFMEMORY; 1135 } 1136 strRet->uType = STRRET_CSTRA; 1137 lstrcpynA(strRet->u.cStr, szPath, MAX_PATH); 1138 1139 TRACE("-- (%p)->(%s)\n", This, szPath); 1140 return S_OK; 1142 1141 } 1143 1142 … … 1155 1154 */ 1156 1155 static HRESULT WINAPI IShellFolder_fnSetNameOf( 1157 1158 HWND hwndOwner, 1159 1160 LPCOLESTR lpName, 1161 DWORD dwFlags, 1162 1163 { 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 else 1181 1182 1183 1184 1185 1186 1187 1188 1156 IShellFolder2 * iface, 1157 HWND hwndOwner, 1158 LPCITEMIDLIST pidl, /*simple pidl*/ 1159 LPCOLESTR lpName, 1160 DWORD dwFlags, 1161 LPITEMIDLIST *pPidlOut) 1162 { 1163 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 1164 char szSrc[MAX_PATH], szDest[MAX_PATH]; 1165 int len; 1166 BOOL bIsFolder = _ILIsFolder(ILFindLastID(pidl)); 1167 1168 TRACE("(%p)->(%u,pidl=%p,%s,%lu,%p)\n", 1169 This,hwndOwner,pidl,debugstr_w(lpName),dwFlags,pPidlOut); 1170 1171 /* build source path */ 1172 if (dwFlags & SHGDN_INFOLDER) 1173 { 1174 strcpy(szSrc, This->sMyPath); 1175 PathAddBackslashA(szSrc); 1176 len = strlen (szSrc); 1177 _ILSimpleGetText(pidl, szSrc+len, MAX_PATH-len); 1178 } 1179 else 1180 { 1181 SHGetPathFromIDListA(pidl, szSrc); 1182 } 1183 1184 /* build destination path */ 1185 strcpy(szDest, This->sMyPath); 1186 PathAddBackslashA(szDest); 1187 len = strlen (szDest); 1189 1188 WideCharToMultiByte( CP_ACP, 0, lpName, -1, szDest+len, MAX_PATH-len, NULL, NULL ); 1190 1189 szDest[MAX_PATH-1] = 0; 1191 1192 1193 1194 1195 1196 1197 1198 1190 TRACE("src=%s dest=%s\n", szSrc, szDest); 1191 if ( MoveFileA(szSrc, szDest) ) 1192 { 1193 if (pPidlOut) *pPidlOut = SHSimpleIDListFromPathA(szDest); 1194 SHChangeNotifyA( bIsFolder?SHCNE_RENAMEFOLDER:SHCNE_RENAMEITEM, SHCNF_PATHA, szSrc, szDest); 1195 return S_OK; 1196 } 1197 return E_FAIL; 1199 1198 } 1200 1199 1201 1200 static HRESULT WINAPI IShellFolder_fnGetDefaultSearchGUID( 1202 1203 1204 { 1205 1206 1207 1208 } 1201 IShellFolder2 * iface, 1202 GUID *pguid) 1203 { 1204 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 1205 FIXME("(%p)\n",This); 1206 return E_NOTIMPL; 1207 } 1209 1208 static HRESULT WINAPI IShellFolder_fnEnumSearches( 1210 1211 1212 { 1213 1214 1215 1216 } 1209 IShellFolder2 * iface, 1210 IEnumExtraSearch **ppenum) 1211 { 1212 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 1213 FIXME("(%p)\n",This); 1214 return E_NOTIMPL; 1215 } 1217 1216 static HRESULT WINAPI IShellFolder_fnGetDefaultColumn( 1218 1219 1220 1221 1222 { 1223 1224 1225 1226 1227 1228 1229 1230 1231 } 1217 IShellFolder2 * iface, 1218 DWORD dwRes, 1219 ULONG *pSort, 1220 ULONG *pDisplay) 1221 { 1222 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 1223 1224 TRACE("(%p)\n",This); 1225 1226 if (pSort) *pSort = 0; 1227 if (pDisplay) *pDisplay = 0; 1228 1229 return S_OK; 1230 } 1232 1231 static HRESULT WINAPI IShellFolder_fnGetDefaultColumnState( 1233 1234 1235 1236 { 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 } 1232 IShellFolder2 * iface, 1233 UINT iColumn, 1234 DWORD *pcsFlags) 1235 { 1236 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 1237 1238 TRACE("(%p)\n",This); 1239 1240 if (!pcsFlags || iColumn >= GENERICSHELLVIEWCOLUMNS ) return E_INVALIDARG; 1241 1242 *pcsFlags = GenericSFHeader[iColumn].pcsFlags; 1243 1244 return S_OK; 1245 } 1247 1246 static HRESULT WINAPI IShellFolder_fnGetDetailsEx( 1248 1249 1250 1251 1252 { 1253 1254 1255 1256 1257 } 1247 IShellFolder2 * iface, 1248 LPCITEMIDLIST pidl, 1249 const SHCOLUMNID *pscid, 1250 VARIANT *pv) 1251 { 1252 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 1253 FIXME("(%p)\n",This); 1254 1255 return E_NOTIMPL; 1256 } 1258 1257 static HRESULT WINAPI IShellFolder_fnGetDetailsOf( 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 1285 case 0:/* name */1286 1287 1288 case 1:/* size */1289 1290 1291 case 2:/* type */1292 1293 1294 case 3:/* date */1295 1296 1297 case 4:/* attributes */1298 1299 1300 1301 1302 1303 1304 1305 1306 } 1258 IShellFolder2 * iface, 1259 LPCITEMIDLIST pidl, 1260 UINT iColumn, 1261 SHELLDETAILS *psd) 1262 { 1263 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 1264 HRESULT hr = E_FAIL; 1265 1266 TRACE("(%p)->(%p %i %p)\n",This, pidl, iColumn, psd); 1267 1268 if (!psd || iColumn >= GENERICSHELLVIEWCOLUMNS ) return E_INVALIDARG; 1269 1270 if (!pidl) 1271 { 1272 /* the header titles */ 1273 psd->fmt = GenericSFHeader[iColumn].fmt; 1274 psd->cxChar = GenericSFHeader[iColumn].cxChar; 1275 psd->str.uType = STRRET_CSTRA; 1276 LoadStringA(shell32_hInstance, GenericSFHeader[iColumn].colnameid, psd->str.u.cStr, MAX_PATH); 1277 return S_OK; 1278 } 1279 else 1280 { 1281 /* the data from the pidl */ 1282 switch(iColumn) 1283 { 1284 case 0: /* name */ 1285 hr = IShellFolder_GetDisplayNameOf(iface, pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str); 1286 break; 1287 case 1: /* size */ 1288 _ILGetFileSize (pidl, psd->str.u.cStr, MAX_PATH); 1289 break; 1290 case 2: /* type */ 1291 _ILGetFileType(pidl, psd->str.u.cStr, MAX_PATH); 1292 break; 1293 case 3: /* date */ 1294 _ILGetFileDate(pidl, psd->str.u.cStr, MAX_PATH); 1295 break; 1296 case 4: /* attributes */ 1297 _ILGetFileAttributes(pidl, psd->str.u.cStr, MAX_PATH); 1298 break; 1299 } 1300 hr = S_OK; 1301 psd->str.uType = STRRET_CSTRA; 1302 } 1303 1304 return hr; 1305 } 1307 1306 static HRESULT WINAPI IShellFolder_fnMapNameToSCID( 1308 1309 1310 1311 { 1312 1313 1314 1315 } 1316 1317 static ICOM_VTABLE(IShellFolder2) sfvt = 1318 { 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1307 IShellFolder2 * iface, 1308 LPCWSTR pwszName, 1309 SHCOLUMNID *pscid) 1310 { 1311 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 1312 FIXME("(%p)\n",This); 1313 return E_NOTIMPL; 1314 } 1315 1316 static ICOM_VTABLE(IShellFolder2) sfvt = 1317 { 1318 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 1319 IShellFolder_fnQueryInterface, 1320 IShellFolder_fnAddRef, 1321 IShellFolder_fnRelease, 1322 IShellFolder_fnParseDisplayName, 1323 IShellFolder_fnEnumObjects, 1324 IShellFolder_fnBindToObject, 1325 IShellFolder_fnBindToStorage, 1326 IShellFolder_fnCompareIDs, 1327 IShellFolder_fnCreateViewObject, 1328 IShellFolder_fnGetAttributesOf, 1329 IShellFolder_fnGetUIObjectOf, 1330 IShellFolder_fnGetDisplayNameOf, 1331 IShellFolder_fnSetNameOf, 1332 1333 /* ShellFolder2 */ 1334 IShellFolder_fnGetDefaultSearchGUID, 1335 IShellFolder_fnEnumSearches, 1336 IShellFolder_fnGetDefaultColumn, 1337 IShellFolder_fnGetDefaultColumnState, 1338 IShellFolder_fnGetDetailsEx, 1339 IShellFolder_fnGetDetailsOf, 1340 IShellFolder_fnMapNameToSCID 1342 1341 }; 1343 1342 … … 1347 1346 1348 1347 static HRESULT WINAPI ISFHelper_fnQueryInterface( 1349 1350 1351 1352 { 1353 1354 1355 1356 1357 1348 ISFHelper *iface, 1349 REFIID riid, 1350 LPVOID *ppvObj) 1351 { 1352 _ICOM_THIS_From_ISFHelper(IGenericSFImpl,iface); 1353 1354 TRACE("(%p)\n", This); 1355 1356 return IUnknown_QueryInterface(This->pUnkOuter, riid, ppvObj); 1358 1357 } 1359 1358 1360 1359 static ULONG WINAPI ISFHelper_fnAddRef( 1361 1362 { 1363 1364 1365 1366 1367 1360 ISFHelper *iface) 1361 { 1362 _ICOM_THIS_From_ISFHelper(IGenericSFImpl,iface); 1363 1364 TRACE("(%p)\n", This); 1365 1366 return IUnknown_AddRef(This->pUnkOuter); 1368 1367 } 1369 1368 1370 1369 static ULONG WINAPI ISFHelper_fnRelease( 1371 1372 { 1373 1374 1375 1376 1377 1370 ISFHelper *iface) 1371 { 1372 _ICOM_THIS_From_ISFHelper(IGenericSFImpl,iface); 1373 1374 TRACE("(%p)\n", This); 1375 1376 return IUnknown_Release(This->pUnkOuter); 1378 1377 } 1379 1378 … … 1386 1385 1387 1386 static HRESULT WINAPI ISFHelper_fnGetUniqueName( 1388 1389 1390 1391 { 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1387 ISFHelper *iface, 1388 LPSTR lpName, 1389 UINT uLen) 1390 { 1391 _ICOM_THIS_From_ISFHelper(IGenericSFImpl,iface) 1392 IEnumIDList * penum; 1393 HRESULT hr; 1394 char szText[MAX_PATH]; 1395 char * szNewFolder = "New Folder"; 1396 1397 TRACE("(%p)(%s %u)\n", This, lpName, uLen); 1398 1399 if (uLen < strlen(szNewFolder) + 4) return E_POINTER; 1400 1401 strcpy(lpName, szNewFolder); 1402 1403 hr = IShellFolder_fnEnumObjects(_IShellFolder2_(This), 0, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS | SHCONTF_INCLUDEHIDDEN, &penum); 1404 if (penum) 1405 { 1406 LPITEMIDLIST pidl; 1407 DWORD dwFetched; 1408 int i=1; 1409 1411 1410 next: IEnumIDList_Reset(penum); 1412 1413 1414 1415 1416 1417 1418 if (i > 99) 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 } 1431 1411 while(S_OK == IEnumIDList_Next(penum, 1, &pidl, &dwFetched) && dwFetched) 1412 { 1413 _ILSimpleGetText(pidl, szText, MAX_PATH); 1414 if (0 == strcasecmp(szText, lpName)) 1415 { 1416 sprintf(lpName, "%s %d", szNewFolder, i++); 1417 if (i > 99) 1418 { 1419 hr = E_FAIL; 1420 break; 1421 } 1422 goto next; 1423 } 1424 } 1425 1426 IEnumIDList_Release(penum); 1427 } 1428 return hr; 1429 } 1430 1432 1431 /**************************************************************************** 1433 1432 * ISFHelper_fnAddFolder … … 1437 1436 1438 1437 static HRESULT WINAPI ISFHelper_fnAddFolder( 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 1465 SHFree(pidl); 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1438 ISFHelper *iface, 1439 HWND hwnd, 1440 LPCSTR lpName, 1441 LPITEMIDLIST* ppidlOut) 1442 { 1443 _ICOM_THIS_From_ISFHelper(IGenericSFImpl,iface) 1444 char lpstrNewDir[MAX_PATH]; 1445 DWORD bRes; 1446 HRESULT hres = E_FAIL; 1447 1448 TRACE("(%p)(%s %p)\n", This, lpName, ppidlOut); 1449 1450 strcpy(lpstrNewDir, This->sMyPath); 1451 PathAddBackslashA(lpstrNewDir); 1452 strcat(lpstrNewDir, lpName); 1453 1454 bRes = CreateDirectoryA(lpstrNewDir, NULL); 1455 1456 if (bRes) 1457 { 1458 LPITEMIDLIST pidl, pidlitem; 1459 1460 pidlitem = SHSimpleIDListFromPathA(lpstrNewDir); 1461 1462 pidl = ILCombine(This->absPidl, pidlitem); 1463 SHChangeNotifyA(SHCNE_MKDIR, SHCNF_IDLIST, pidl, NULL); 1464 SHFree(pidl); 1465 1466 if (ppidlOut) *ppidlOut = pidlitem; 1467 hres = S_OK; 1468 } 1469 else 1470 { 1471 char lpstrText[128+MAX_PATH]; 1472 char lpstrTempText[128]; 1473 char lpstrCaption[256]; 1474 1475 /* Cannot Create folder because of permissions */ 1476 LoadStringA(shell32_hInstance, IDS_CREATEFOLDER_DENIED, lpstrTempText, sizeof(lpstrTempText)); 1477 LoadStringA(shell32_hInstance, IDS_CREATEFOLDER_CAPTION, lpstrCaption, sizeof(lpstrCaption)); 1478 sprintf(lpstrText,lpstrTempText, lpstrNewDir); 1479 MessageBoxA(hwnd,lpstrText, lpstrCaption, MB_OK | MB_ICONEXCLAMATION); 1480 } 1481 1482 return hres; 1484 1483 } 1485 1484 … … 1490 1489 */ 1491 1490 static HRESULT WINAPI ISFHelper_fnDeleteItems( 1492 1493 1494 1495 { 1496 1497 1498 1491 ISFHelper *iface, 1492 UINT cidl, 1493 LPCITEMIDLIST* apidl) 1494 { 1495 _ICOM_THIS_From_ISFHelper(IGenericSFImpl,iface) 1496 int i; 1497 char szPath[MAX_PATH]; 1499 1498 BOOL bConfirm = TRUE; 1500 1499 1501 1502 1503 1504 1505 1506 char tmp[8]; 1500 TRACE("(%p)(%u %p)\n", This, cidl, apidl); 1501 1502 /* deleting multiple items so give a slightly different warning */ 1503 if(cidl != 1) 1504 { 1505 char tmp[8]; 1507 1506 snprintf(tmp, sizeof(tmp), "%d", cidl); 1508 1507 if(!SHELL_WarnItemDelete(ASK_DELETE_MULTIPLE_ITEM, tmp)) 1509 1508 return E_FAIL; 1510 1509 bConfirm = FALSE; 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1510 } 1511 1512 for(i=0; i< cidl; i++) 1513 { 1514 strcpy(szPath, This->sMyPath); 1515 PathAddBackslashA(szPath); 1516 _ILSimpleGetText(apidl[i], szPath+strlen(szPath), MAX_PATH); 1517 1518 if (_ILIsFolder(apidl[i])) 1519 { 1520 LPITEMIDLIST pidl; 1521 TRACE("delete %s\n", szPath); 1522 if (! SHELL_DeleteDirectoryA(szPath, bConfirm)) 1523 { 1525 1524 TRACE("delete %s failed, bConfirm=%d", szPath, bConfirm); 1526 1527 1528 1529 1530 SHFree(pidl); 1531 1532 1533 1534 1535 1536 1537 1538 1525 return E_FAIL; 1526 } 1527 pidl = ILCombine(This->absPidl, apidl[i]); 1528 SHChangeNotifyA(SHCNE_RMDIR, SHCNF_IDLIST, pidl, NULL); 1529 SHFree(pidl); 1530 } 1531 else if (_ILIsValue(apidl[i])) 1532 { 1533 LPITEMIDLIST pidl; 1534 1535 TRACE("delete %s\n", szPath); 1536 if (! SHELL_DeleteFileA(szPath, bConfirm)) 1537 { 1539 1538 TRACE("delete %s failed, bConfirm=%d", szPath, bConfirm); 1540 1541 1542 1543 1544 SHFree(pidl); 1545 1546 1547 1548 1539 return E_FAIL; 1540 } 1541 pidl = ILCombine(This->absPidl, apidl[i]); 1542 SHChangeNotifyA(SHCNE_DELETE, SHCNF_IDLIST, pidl, NULL); 1543 SHFree(pidl); 1544 } 1545 1546 } 1547 return S_OK; 1549 1548 } 1550 1549 … … 1555 1554 */ 1556 1555 static HRESULT WINAPI ISFHelper_fnCopyItems( 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 1593 static ICOM_VTABLE(ISFHelper) shvt = 1594 { 1595 1596 1597 1598 1599 1600 1601 1602 1556 ISFHelper *iface, 1557 IShellFolder* pSFFrom, 1558 UINT cidl, 1559 LPCITEMIDLIST *apidl) 1560 { 1561 int i; 1562 IPersistFolder2 * ppf2=NULL; 1563 char szSrcPath[MAX_PATH], szDstPath[MAX_PATH]; 1564 _ICOM_THIS_From_ISFHelper(IGenericSFImpl,iface); 1565 1566 TRACE("(%p)->(%p,%u,%p)\n", This, pSFFrom, cidl, apidl); 1567 1568 IShellFolder_QueryInterface(pSFFrom, &IID_IPersistFolder2, (LPVOID*)&ppf2); 1569 if (ppf2) 1570 { 1571 LPITEMIDLIST pidl; 1572 if (SUCCEEDED(IPersistFolder2_GetCurFolder(ppf2, &pidl))) 1573 { 1574 for (i=0; i<cidl; i++) 1575 { 1576 SHGetPathFromIDListA(pidl, szSrcPath); 1577 PathAddBackslashA(szSrcPath); 1578 _ILSimpleGetText(apidl[i], szSrcPath+strlen(szSrcPath), MAX_PATH); 1579 1580 strcpy(szDstPath, This->sMyPath); 1581 PathAddBackslashA(szDstPath); 1582 _ILSimpleGetText(apidl[i], szDstPath+strlen(szDstPath), MAX_PATH); 1583 MESSAGE("would copy %s to %s\n", szSrcPath, szDstPath); 1584 } 1585 SHFree(pidl); 1586 } 1587 IPersistFolder2_Release(ppf2); 1588 } 1589 return S_OK; 1590 } 1591 1592 static ICOM_VTABLE(ISFHelper) shvt = 1593 { 1594 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 1595 ISFHelper_fnQueryInterface, 1596 ISFHelper_fnAddRef, 1597 ISFHelper_fnRelease, 1598 ISFHelper_fnGetUniqueName, 1599 ISFHelper_fnAddFolder, 1600 ISFHelper_fnDeleteItems, 1601 ISFHelper_fnCopyItems, 1603 1602 }; 1604 1603 1605 1604 /*********************************************************************** 1606 * [Desktopfolder]IShellFolder implementation1605 * [Desktopfolder] IShellFolder implementation 1607 1606 */ 1608 1607 static struct ICOM_VTABLE(IShellFolder2) sfdvt; … … 1619 1618 1620 1619 /************************************************************************** 1621 * 1620 * ISF_Desktop_Constructor 1622 1621 * 1623 1622 */ 1624 1623 IShellFolder * ISF_Desktop_Constructor() 1625 1624 { 1626 IGenericSFImpl *sf;1627 1628 1629 1630 1631 1632 sf->absPidl=_ILCreateDesktop();/* my qualified pidl */1633 1634 1635 1636 1637 1638 1639 } 1640 1641 /************************************************************************** 1642 * 1625 IGenericSFImpl * sf; 1626 1627 sf=(IGenericSFImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IGenericSFImpl)); 1628 sf->ref=1; 1629 ICOM_VTBL(sf)=&unkvt; 1630 sf->lpvtblShellFolder=&sfdvt; 1631 sf->absPidl=_ILCreateDesktop(); /* my qualified pidl */ 1632 sf->pUnkOuter = (IUnknown *) &sf->lpVtbl; 1633 1634 TRACE("(%p)\n",sf); 1635 1636 shell32_ObjCount++; 1637 return _IShellFolder_(sf); 1638 } 1639 1640 /************************************************************************** 1641 * ISF_Desktop_fnQueryInterface 1643 1642 * 1644 1643 * NOTES supports not IPersist/IPersistFolder 1645 1644 */ 1646 1645 static HRESULT WINAPI ISF_Desktop_fnQueryInterface( 1647 1648 1649 1650 { 1651 1652 1653 1654 1655 1656 1657 1658 1659 *ppvObj = _IUnknown_(This); 1660 1661 1662 1663 1664 } 1665 1666 1667 1668 } 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 } 1679 1680 /************************************************************************** 1681 * 1646 IShellFolder2 * iface, 1647 REFIID riid, 1648 LPVOID *ppvObj) 1649 { 1650 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 1651 1652 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj); 1653 1654 *ppvObj = NULL; 1655 1656 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/ 1657 { 1658 *ppvObj = _IUnknown_(This); 1659 } 1660 else if(IsEqualIID(riid, &IID_IShellFolder)) /*IShellFolder*/ 1661 { 1662 *ppvObj = _IShellFolder_(This); 1663 } 1664 else if(IsEqualIID(riid, &IID_IShellFolder2)) /*IShellFolder2*/ 1665 { 1666 *ppvObj = _IShellFolder_(This); 1667 } 1668 1669 if(*ppvObj) 1670 { 1671 IUnknown_AddRef((IUnknown*)(*ppvObj)); 1672 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj); 1673 return S_OK; 1674 } 1675 TRACE("-- Interface: E_NOINTERFACE\n"); 1676 return E_NOINTERFACE; 1677 } 1678 1679 /************************************************************************** 1680 * ISF_Desktop_fnParseDisplayName 1682 1681 * 1683 1682 * NOTES 1684 * 1685 * 1683 * "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}" and "" binds 1684 * to MyComputer 1686 1685 */ 1687 1686 static HRESULT WINAPI ISF_Desktop_fnParseDisplayName( 1688 1689 1690 1691 1692 1693 1694 1695 { 1696 1697 1698 LPCWSTRszNext=NULL;1699 LPITEMIDLISTpidlTemp=NULL;1700 HRESULThr=E_OUTOFMEMORY;1701 1702 1703 1704 1705 1706 1707 if (pchEaten) *pchEaten = 0;/* strange but like the original */1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 return hr; 1732 } 1733 1734 /************************************************************************** 1735 * 1687 IShellFolder2 * iface, 1688 HWND hwndOwner, 1689 LPBC pbcReserved, 1690 LPOLESTR lpszDisplayName, 1691 DWORD *pchEaten, 1692 LPITEMIDLIST *ppidl, 1693 DWORD *pdwAttributes) 1694 { 1695 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 1696 1697 LPCWSTR szNext=NULL; 1698 LPITEMIDLIST pidlTemp=NULL; 1699 HRESULT hr=E_OUTOFMEMORY; 1700 1701 TRACE("(%p)->(HWND=0x%08x,%p,%p=%s,%p,pidl=%p,%p)\n", 1702 This,hwndOwner,pbcReserved,lpszDisplayName, 1703 debugstr_w(lpszDisplayName),pchEaten,ppidl,pdwAttributes); 1704 1705 *ppidl = 0; 1706 if (pchEaten) *pchEaten = 0; /* strange but like the original */ 1707 1708 /* fixme no real parsing implemented */ 1709 pidlTemp = _ILCreateMyComputer(); 1710 szNext = lpszDisplayName; 1711 1712 if (szNext && *szNext) 1713 { 1714 hr = SHELL32_ParseNextElement(hwndOwner, iface, &pidlTemp, (LPOLESTR)szNext, pchEaten, pdwAttributes); 1715 } 1716 else 1717 { 1718 hr = S_OK; 1719 1720 if (pdwAttributes && *pdwAttributes) 1721 { 1722 SHELL32_GetItemAttributes(_IShellFolder_(This), pidlTemp, pdwAttributes); 1723 } 1724 } 1725 1726 *ppidl = pidlTemp; 1727 1728 TRACE("(%p)->(-- ret=0x%08lx)\n", This, hr); 1729 1730 return hr; 1731 } 1732 1733 /************************************************************************** 1734 * ISF_Desktop_fnEnumObjects 1736 1735 */ 1737 1736 static HRESULT WINAPI ISF_Desktop_fnEnumObjects( 1738 1739 1740 1741 1742 { 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 return S_OK; 1755 } 1756 1757 /************************************************************************** 1758 * 1737 IShellFolder2 * iface, 1738 HWND hwndOwner, 1739 DWORD dwFlags, 1740 LPENUMIDLIST* ppEnumIDList) 1741 { 1742 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 1743 1744 TRACE("(%p)->(HWND=0x%08x flags=0x%08lx pplist=%p)\n",This,hwndOwner,dwFlags,ppEnumIDList); 1745 1746 *ppEnumIDList = NULL; 1747 *ppEnumIDList = IEnumIDList_Constructor (NULL, dwFlags, EIDL_DESK); 1748 1749 TRACE("-- (%p)->(new ID List: %p)\n",This,*ppEnumIDList); 1750 1751 if(!*ppEnumIDList) return E_OUTOFMEMORY; 1752 1753 return S_OK; 1754 } 1755 1756 /************************************************************************** 1757 * ISF_Desktop_fnBindToObject 1759 1758 */ 1760 1759 static HRESULT WINAPI ISF_Desktop_fnBindToObject( IShellFolder2 * iface, LPCITEMIDLIST pidl, 1761 1762 { 1763 1764 GUIDconst * clsid;1765 IShellFolder*pShellFolder, *pSubFolder;1766 1767 1760 LPBC pbcReserved, REFIID riid, LPVOID * ppvOut) 1761 { 1762 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 1763 GUID const * clsid; 1764 IShellFolder *pShellFolder, *pSubFolder; 1765 1766 TRACE("(%p)->(pidl=%p,%p,\n\tIID:\t%s,%p)\n", 1768 1767 This,pidl,pbcReserved,debugstr_guid(riid),ppvOut); 1769 1768 1770 1771 1772 1773 1774 1775 1776 1777 1778 else 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 1809 if (_ILIsPidlSimple(pidl))/* no sub folders */1810 1811 1812 1813 else/* go deeper */1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 } 1824 1825 /************************************************************************** 1826 * 1769 *ppvOut = NULL; 1770 1771 if ((clsid=_ILGetGUIDPointer(pidl))) 1772 { 1773 if ( IsEqualIID(clsid, &CLSID_MyComputer)) 1774 { 1775 pShellFolder = ISF_MyComputer_Constructor(); 1776 } 1777 else 1778 { 1779 /* shell extension */ 1780 if (!SUCCEEDED(SHELL32_CoCreateInitSF (This->absPidl, pidl, clsid, riid, (LPVOID*)&pShellFolder))) 1781 { 1782 return E_INVALIDARG; 1783 } 1784 } 1785 } 1786 else 1787 { 1788 /* file system folder on the desktop */ 1789 LPITEMIDLIST deskpidl, firstpidl, completepidl; 1790 IPersistFolder * ppf; 1791 1792 /* combine pidls */ 1793 SHGetSpecialFolderLocation(0, CSIDL_DESKTOPDIRECTORY, &deskpidl); 1794 firstpidl = ILCloneFirst(pidl); 1795 completepidl = ILCombine(deskpidl, firstpidl); 1796 1797 pShellFolder = IShellFolder_Constructor(NULL, NULL); 1798 if (SUCCEEDED(IShellFolder_QueryInterface(pShellFolder, &IID_IPersistFolder, (LPVOID*)&ppf))) 1799 { 1800 IPersistFolder_Initialize(ppf, completepidl); 1801 IPersistFolder_Release(ppf); 1802 } 1803 ILFree(completepidl); 1804 ILFree(deskpidl); 1805 ILFree(firstpidl); 1806 } 1807 1808 if (_ILIsPidlSimple(pidl)) /* no sub folders */ 1809 { 1810 *ppvOut = pShellFolder; 1811 } 1812 else /* go deeper */ 1813 { 1814 IShellFolder_BindToObject(pShellFolder, ILGetNext(pidl), NULL, riid, (LPVOID)&pSubFolder); 1815 IShellFolder_Release(pShellFolder); 1816 *ppvOut = pSubFolder; 1817 } 1818 1819 TRACE("-- (%p) returning (%p)\n",This, *ppvOut); 1820 1821 return S_OK; 1822 } 1823 1824 /************************************************************************** 1825 * ISF_Desktop_fnCreateViewObject 1827 1826 */ 1828 1827 static HRESULT WINAPI ISF_Desktop_fnCreateViewObject( IShellFolder2 * iface, 1829 1830 { 1831 1832 1833 LPSHELLVIEWpShellView;1834 HRESULThr = E_INVALIDARG;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 1863 return hr; 1828 HWND hwndOwner, REFIID riid, LPVOID *ppvOut) 1829 { 1830 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 1831 1832 LPSHELLVIEW pShellView; 1833 HRESULT hr = E_INVALIDARG; 1834 1835 TRACE("(%p)->(hwnd=0x%x,\n\tIID:\t%s,%p)\n",This,hwndOwner,debugstr_guid(riid),ppvOut); 1836 1837 if(ppvOut) 1838 { 1839 *ppvOut = NULL; 1840 1841 if(IsEqualIID(riid, &IID_IDropTarget)) 1842 { 1843 WARN("IDropTarget not implemented\n"); 1844 hr = E_NOTIMPL; 1845 } 1846 else if(IsEqualIID(riid, &IID_IContextMenu)) 1847 { 1848 WARN("IContextMenu not implemented\n"); 1849 hr = E_NOTIMPL; 1850 } 1851 else if(IsEqualIID(riid, &IID_IShellView)) 1852 { 1853 pShellView = IShellView_Constructor((IShellFolder*)iface); 1854 if(pShellView) 1855 { 1856 hr = IShellView_QueryInterface(pShellView, riid, ppvOut); 1857 IShellView_Release(pShellView); 1858 } 1859 } 1860 } 1861 TRACE("-- (%p)->(interface=%p)\n",This, ppvOut); 1862 return hr; 1864 1863 } 1865 1864 … … 1868 1867 */ 1869 1868 static HRESULT WINAPI ISF_Desktop_fnGetAttributesOf( 1870 1871 1872 1873 1874 { 1875 1876 1877 HRESULThr = S_OK;1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 } 1896 1897 /************************************************************************** 1898 * 1869 IShellFolder2 * iface, 1870 UINT cidl, 1871 LPCITEMIDLIST *apidl, 1872 DWORD *rgfInOut) 1873 { 1874 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 1875 1876 HRESULT hr = S_OK; 1877 1878 TRACE("(%p)->(cidl=%d apidl=%p mask=0x%08lx)\n",This,cidl,apidl, *rgfInOut); 1879 1880 if ( (!cidl) || (!apidl) || (!rgfInOut)) 1881 return E_INVALIDARG; 1882 1883 while (cidl > 0 && *apidl) 1884 { 1885 pdump (*apidl); 1886 SHELL32_GetItemAttributes(_IShellFolder_(This), *apidl, rgfInOut); 1887 apidl++; 1888 cidl--; 1889 } 1890 1891 TRACE("-- result=0x%08lx\n",*rgfInOut); 1892 1893 return hr; 1894 } 1895 1896 /************************************************************************** 1897 * ISF_Desktop_fnGetDisplayNameOf 1899 1898 * 1900 1899 * NOTES 1901 * 1900 * special case: pidl = null gives desktop-name back 1902 1901 */ 1903 1902 static HRESULT WINAPI ISF_Desktop_fnGetDisplayNameOf( 1904 1905 1906 1907 1908 { 1909 1910 1911 CHARszPath[MAX_PATH]= "";1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 { 1928 1929 1930 1931 1932 1933 1934 1935 1936 1903 IShellFolder2 * iface, 1904 LPCITEMIDLIST pidl, 1905 DWORD dwFlags, 1906 LPSTRRET strRet) 1907 { 1908 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 1909 1910 CHAR szPath[MAX_PATH]= ""; 1911 1912 TRACE("(%p)->(pidl=%p,0x%08lx,%p)\n",This,pidl,dwFlags,strRet); 1913 pdump(pidl); 1914 1915 if(!strRet) return E_INVALIDARG; 1916 1917 if(!pidl) 1918 { 1919 HCR_GetClassName(&CLSID_ShellDesktop, szPath, MAX_PATH); 1920 } 1921 else if ( _ILIsPidlSimple(pidl) ) 1922 { 1923 _ILSimpleGetText(pidl, szPath, MAX_PATH); 1924 } 1925 else 1926 { 1927 if (!SUCCEEDED(SHELL32_GetDisplayNameOfChild(iface, pidl, dwFlags, szPath, MAX_PATH))) 1928 return E_OUTOFMEMORY; 1929 } 1930 strRet->uType = STRRET_CSTRA; 1931 lstrcpynA(strRet->u.cStr, szPath, MAX_PATH); 1932 1933 1934 TRACE("-- (%p)->(%s)\n", This, szPath); 1935 return S_OK; 1937 1936 } 1938 1937 1939 1938 static HRESULT WINAPI ISF_Desktop_fnGetDefaultSearchGUID( 1940 1941 1942 { 1943 1944 1945 1946 } 1939 IShellFolder2 * iface, 1940 GUID *pguid) 1941 { 1942 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 1943 FIXME("(%p)\n",This); 1944 return E_NOTIMPL; 1945 } 1947 1946 static HRESULT WINAPI ISF_Desktop_fnEnumSearches( 1948 1949 1950 { 1951 1952 1953 1954 } 1947 IShellFolder2 * iface, 1948 IEnumExtraSearch **ppenum) 1949 { 1950 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 1951 FIXME("(%p)\n",This); 1952 return E_NOTIMPL; 1953 } 1955 1954 static HRESULT WINAPI ISF_Desktop_fnGetDefaultColumn( 1956 1957 1958 1959 1960 { 1961 1962 1963 1964 1965 1966 1967 1968 1969 } 1955 IShellFolder2 * iface, 1956 DWORD dwRes, 1957 ULONG *pSort, 1958 ULONG *pDisplay) 1959 { 1960 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 1961 1962 TRACE("(%p)\n",This); 1963 1964 if (pSort) *pSort = 0; 1965 if (pDisplay) *pDisplay = 0; 1966 1967 return S_OK; 1968 } 1970 1969 static HRESULT WINAPI ISF_Desktop_fnGetDefaultColumnState( 1971 1972 1973 1974 { 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 } 1970 IShellFolder2 * iface, 1971 UINT iColumn, 1972 DWORD *pcsFlags) 1973 { 1974 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 1975 1976 TRACE("(%p)\n",This); 1977 1978 if (!pcsFlags || iColumn >= DESKTOPSHELLVIEWCOLUMNS ) return E_INVALIDARG; 1979 1980 *pcsFlags = DesktopSFHeader[iColumn].pcsFlags; 1981 1982 return S_OK; 1983 } 1985 1984 static HRESULT WINAPI ISF_Desktop_fnGetDetailsEx( 1986 1987 1988 1989 1990 { 1991 1992 1993 1994 1995 } 1985 IShellFolder2 * iface, 1986 LPCITEMIDLIST pidl, 1987 const SHCOLUMNID *pscid, 1988 VARIANT *pv) 1989 { 1990 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 1991 FIXME("(%p)\n",This); 1992 1993 return E_NOTIMPL; 1994 } 1996 1995 static HRESULT WINAPI ISF_Desktop_fnGetDetailsOf( 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 2022 case 0:/* name */2023 2024 2025 case 1:/* size */2026 2027 2028 case 2:/* type */2029 2030 2031 case 3:/* date */2032 2033 2034 case 4:/* attributes */2035 2036 2037 2038 2039 2040 2041 2042 2043 } 1996 IShellFolder2 * iface, 1997 LPCITEMIDLIST pidl, 1998 UINT iColumn, 1999 SHELLDETAILS *psd) 2000 { 2001 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 2002 HRESULT hr = E_FAIL;; 2003 2004 TRACE("(%p)->(%p %i %p)\n",This, pidl, iColumn, psd); 2005 2006 if (!psd || iColumn >= DESKTOPSHELLVIEWCOLUMNS ) return E_INVALIDARG; 2007 2008 if (!pidl) 2009 { 2010 psd->fmt = DesktopSFHeader[iColumn].fmt; 2011 psd->cxChar = DesktopSFHeader[iColumn].cxChar; 2012 psd->str.uType = STRRET_CSTRA; 2013 LoadStringA(shell32_hInstance, DesktopSFHeader[iColumn].colnameid, psd->str.u.cStr, MAX_PATH); 2014 return S_OK; 2015 } 2016 else 2017 { 2018 /* the data from the pidl */ 2019 switch(iColumn) 2020 { 2021 case 0: /* name */ 2022 hr = IShellFolder_GetDisplayNameOf(iface, pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str); 2023 break; 2024 case 1: /* size */ 2025 _ILGetFileSize (pidl, psd->str.u.cStr, MAX_PATH); 2026 break; 2027 case 2: /* type */ 2028 _ILGetFileType(pidl, psd->str.u.cStr, MAX_PATH); 2029 break; 2030 case 3: /* date */ 2031 _ILGetFileDate(pidl, psd->str.u.cStr, MAX_PATH); 2032 break; 2033 case 4: /* attributes */ 2034 _ILGetFileAttributes(pidl, psd->str.u.cStr, MAX_PATH); 2035 break; 2036 } 2037 hr = S_OK; 2038 psd->str.uType = STRRET_CSTRA; 2039 } 2040 2041 return hr; 2042 } 2044 2043 static HRESULT WINAPI ISF_Desktop_fnMapNameToSCID( 2045 2046 2047 2048 { 2049 2050 2051 2052 } 2053 2054 static ICOM_VTABLE(IShellFolder2) sfdvt = 2055 { 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2044 IShellFolder2 * iface, 2045 LPCWSTR pwszName, 2046 SHCOLUMNID *pscid) 2047 { 2048 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 2049 FIXME("(%p)\n",This); 2050 return E_NOTIMPL; 2051 } 2052 2053 static ICOM_VTABLE(IShellFolder2) sfdvt = 2054 { 2055 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 2056 ISF_Desktop_fnQueryInterface, 2057 IShellFolder_fnAddRef, 2058 IShellFolder_fnRelease, 2059 ISF_Desktop_fnParseDisplayName, 2060 ISF_Desktop_fnEnumObjects, 2061 ISF_Desktop_fnBindToObject, 2062 IShellFolder_fnBindToStorage, 2063 IShellFolder_fnCompareIDs, 2064 ISF_Desktop_fnCreateViewObject, 2065 ISF_Desktop_fnGetAttributesOf, 2066 IShellFolder_fnGetUIObjectOf, 2067 ISF_Desktop_fnGetDisplayNameOf, 2068 IShellFolder_fnSetNameOf, 2069 2070 /* ShellFolder2 */ 2071 ISF_Desktop_fnGetDefaultSearchGUID, 2072 ISF_Desktop_fnEnumSearches, 2073 ISF_Desktop_fnGetDefaultColumn, 2074 ISF_Desktop_fnGetDefaultColumnState, 2075 ISF_Desktop_fnGetDetailsEx, 2076 ISF_Desktop_fnGetDetailsOf, 2077 ISF_Desktop_fnMapNameToSCID 2079 2078 }; 2080 2079 … … 2096 2095 2097 2096 /************************************************************************** 2098 * 2097 * ISF_MyComputer_Constructor 2099 2098 */ 2100 2099 static IShellFolder * ISF_MyComputer_Constructor(void) 2101 2100 { 2102 IGenericSFImpl *sf;2103 2104 2105 2106 2107 2108 2109 2110 2111 sf->absPidl=_ILCreateMyComputer();/* my qualified pidl */2112 2113 2114 2115 2116 2117 2118 } 2119 2120 /************************************************************************** 2121 * 2101 IGenericSFImpl * sf; 2102 2103 sf=(IGenericSFImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IGenericSFImpl)); 2104 sf->ref=1; 2105 2106 ICOM_VTBL(sf)=&unkvt; 2107 sf->lpvtblShellFolder=&sfmcvt; 2108 sf->lpvtblPersistFolder2 = &psfvt; 2109 sf->pclsid = (CLSID*)&CLSID_SFMyComp; 2110 sf->absPidl=_ILCreateMyComputer(); /* my qualified pidl */ 2111 sf->pUnkOuter = (IUnknown *) &sf->lpVtbl; 2112 2113 TRACE("(%p)\n",sf); 2114 2115 shell32_ObjCount++; 2116 return _IShellFolder_(sf); 2117 } 2118 2119 /************************************************************************** 2120 * ISF_MyComputer_fnParseDisplayName 2122 2121 */ 2123 2122 static HRESULT WINAPI ISF_MyComputer_fnParseDisplayName( 2124 2125 2126 2127 2128 2129 2130 2131 { 2132 2133 2134 HRESULThr = E_OUTOFMEMORY;2135 LPCWSTRszNext=NULL;2136 WCHARszElement[MAX_PATH];2137 CHARszTempA[MAX_PATH];2138 LPITEMIDLISTpidlTemp;2139 2140 2141 2142 2143 2144 2145 if (pchEaten) *pchEaten = 0;/* strange but like the original */2146 2147 2148 2149 2150 2151 2123 IShellFolder2 * iface, 2124 HWND hwndOwner, 2125 LPBC pbcReserved, 2126 LPOLESTR lpszDisplayName, 2127 DWORD *pchEaten, 2128 LPITEMIDLIST *ppidl, 2129 DWORD *pdwAttributes) 2130 { 2131 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 2132 2133 HRESULT hr = E_OUTOFMEMORY; 2134 LPCWSTR szNext=NULL; 2135 WCHAR szElement[MAX_PATH]; 2136 CHAR szTempA[MAX_PATH]; 2137 LPITEMIDLIST pidlTemp; 2138 2139 TRACE("(%p)->(HWND=0x%08x,%p,%p=%s,%p,pidl=%p,%p)\n", 2140 This,hwndOwner,pbcReserved,lpszDisplayName, 2141 debugstr_w(lpszDisplayName),pchEaten,ppidl,pdwAttributes); 2142 2143 *ppidl = 0; 2144 if (pchEaten) *pchEaten = 0; /* strange but like the original */ 2145 2146 /* do we have an absolute path name ? */ 2147 if (PathGetDriveNumberW(lpszDisplayName) >= 0 && 2148 lpszDisplayName[2] == (WCHAR)'\\') 2149 { 2150 szNext = GetNextElementW(lpszDisplayName, szElement, MAX_PATH); 2152 2151 WideCharToMultiByte( CP_ACP, 0, szElement, -1, szTempA, MAX_PATH, NULL, NULL ); 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 return hr; 2173 } 2174 2175 /************************************************************************** 2176 * 2152 pidlTemp = _ILCreateDrive(szTempA); 2153 2154 if (szNext && *szNext) 2155 { 2156 hr = SHELL32_ParseNextElement(hwndOwner, iface, &pidlTemp, (LPOLESTR)szNext, pchEaten, pdwAttributes); 2157 } 2158 else 2159 { 2160 if (pdwAttributes && *pdwAttributes) 2161 { 2162 SHELL32_GetItemAttributes(_IShellFolder_(This), pidlTemp, pdwAttributes); 2163 } 2164 hr = S_OK; 2165 } 2166 *ppidl = pidlTemp; 2167 } 2168 2169 TRACE("(%p)->(-- ret=0x%08lx)\n", This, hr); 2170 2171 return hr; 2172 } 2173 2174 /************************************************************************** 2175 * ISF_MyComputer_fnEnumObjects 2177 2176 */ 2178 2177 static HRESULT WINAPI ISF_MyComputer_fnEnumObjects( 2179 2180 2181 2182 2183 { 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 return S_OK; 2196 } 2197 2198 /************************************************************************** 2199 * 2178 IShellFolder2 * iface, 2179 HWND hwndOwner, 2180 DWORD dwFlags, 2181 LPENUMIDLIST* ppEnumIDList) 2182 { 2183 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 2184 2185 TRACE("(%p)->(HWND=0x%08x flags=0x%08lx pplist=%p)\n",This,hwndOwner,dwFlags,ppEnumIDList); 2186 2187 *ppEnumIDList = NULL; 2188 *ppEnumIDList = IEnumIDList_Constructor (NULL, dwFlags, EIDL_MYCOMP); 2189 2190 TRACE("-- (%p)->(new ID List: %p)\n",This,*ppEnumIDList); 2191 2192 if(!*ppEnumIDList) return E_OUTOFMEMORY; 2193 2194 return S_OK; 2195 } 2196 2197 /************************************************************************** 2198 * ISF_MyComputer_fnBindToObject 2200 2199 */ 2201 2200 static HRESULT WINAPI ISF_MyComputer_fnBindToObject( IShellFolder2 * iface, LPCITEMIDLIST pidl, 2202 2203 { 2204 2205 GUIDconst * clsid;2206 IShellFolder*pShellFolder, *pSubFolder;2207 LPITEMIDLISTpidltemp;2208 2209 2201 LPBC pbcReserved, REFIID riid, LPVOID * ppvOut) 2202 { 2203 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 2204 GUID const * clsid; 2205 IShellFolder *pShellFolder, *pSubFolder; 2206 LPITEMIDLIST pidltemp; 2207 2208 TRACE("(%p)->(pidl=%p,%p,\n\tIID:\t%s,%p)\n", 2210 2209 This,pidl,pbcReserved,debugstr_guid(riid),ppvOut); 2211 2210 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 if (_ILIsPidlSimple(pidl))/* no sub folders */2233 2234 2235 2236 else/* go deeper */2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 } 2247 2248 /************************************************************************** 2249 * 2211 if(!pidl || !ppvOut) return E_INVALIDARG; 2212 2213 *ppvOut = NULL; 2214 2215 if ((clsid=_ILGetGUIDPointer(pidl)) && !IsEqualIID(clsid, &CLSID_MyComputer)) 2216 { 2217 if (!SUCCEEDED(SHELL32_CoCreateInitSF (This->absPidl, pidl, clsid, riid, (LPVOID*)&pShellFolder))) 2218 { 2219 return E_FAIL; 2220 } 2221 } 2222 else 2223 { 2224 if (!_ILIsDrive(pidl)) return E_INVALIDARG; 2225 2226 pidltemp = ILCloneFirst(pidl); 2227 pShellFolder = IShellFolder_Constructor(iface, pidltemp); 2228 ILFree(pidltemp); 2229 } 2230 2231 if (_ILIsPidlSimple(pidl)) /* no sub folders */ 2232 { 2233 *ppvOut = pShellFolder; 2234 } 2235 else /* go deeper */ 2236 { 2237 IShellFolder_BindToObject(pShellFolder, ILGetNext(pidl), NULL, &IID_IShellFolder, (LPVOID)&pSubFolder); 2238 IShellFolder_Release(pShellFolder); 2239 *ppvOut = pSubFolder; 2240 } 2241 2242 TRACE("-- (%p) returning (%p)\n",This, *ppvOut); 2243 2244 return S_OK; 2245 } 2246 2247 /************************************************************************** 2248 * ISF_MyComputer_fnCreateViewObject 2250 2249 */ 2251 2250 static HRESULT WINAPI ISF_MyComputer_fnCreateViewObject( IShellFolder2 * iface, 2252 2253 { 2254 2255 2256 LPSHELLVIEWpShellView;2257 HRESULThr = E_INVALIDARG;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 2286 return hr; 2251 HWND hwndOwner, REFIID riid, LPVOID *ppvOut) 2252 { 2253 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 2254 2255 LPSHELLVIEW pShellView; 2256 HRESULT hr = E_INVALIDARG; 2257 2258 TRACE("(%p)->(hwnd=0x%x,\n\tIID:\t%s,%p)\n",This,hwndOwner,debugstr_guid(riid),ppvOut); 2259 2260 if(ppvOut) 2261 { 2262 *ppvOut = NULL; 2263 2264 if(IsEqualIID(riid, &IID_IDropTarget)) 2265 { 2266 WARN("IDropTarget not implemented\n"); 2267 hr = E_NOTIMPL; 2268 } 2269 else if(IsEqualIID(riid, &IID_IContextMenu)) 2270 { 2271 WARN("IContextMenu not implemented\n"); 2272 hr = E_NOTIMPL; 2273 } 2274 else if(IsEqualIID(riid, &IID_IShellView)) 2275 { 2276 pShellView = IShellView_Constructor((IShellFolder*)iface); 2277 if(pShellView) 2278 { 2279 hr = IShellView_QueryInterface(pShellView, riid, ppvOut); 2280 IShellView_Release(pShellView); 2281 } 2282 } 2283 } 2284 TRACE("-- (%p)->(interface=%p)\n",This, ppvOut); 2285 return hr; 2287 2286 } 2288 2287 … … 2291 2290 */ 2292 2291 static HRESULT WINAPI ISF_MyComputer_fnGetAttributesOf( 2293 2294 2295 2296 2297 { 2298 2299 2300 HRESULThr = S_OK;2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 } 2318 2319 /************************************************************************** 2320 * 2292 IShellFolder2 * iface, 2293 UINT cidl, 2294 LPCITEMIDLIST *apidl, 2295 DWORD *rgfInOut) 2296 { 2297 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 2298 2299 HRESULT hr = S_OK; 2300 2301 TRACE("(%p)->(cidl=%d apidl=%p mask=0x%08lx)\n",This,cidl,apidl,*rgfInOut); 2302 2303 if ( (!cidl) || (!apidl) || (!rgfInOut)) 2304 return E_INVALIDARG; 2305 2306 while (cidl > 0 && *apidl) 2307 { 2308 pdump (*apidl); 2309 SHELL32_GetItemAttributes(_IShellFolder_(This), *apidl, rgfInOut); 2310 apidl++; 2311 cidl--; 2312 } 2313 2314 TRACE("-- result=0x%08lx\n",*rgfInOut); 2315 return hr; 2316 } 2317 2318 /************************************************************************** 2319 * ISF_MyComputer_fnGetDisplayNameOf 2321 2320 * 2322 2321 * NOTES 2323 * 2324 * 2322 * The desktopfolder creates only complete paths (SHGDN_FORPARSING). 2323 * SHGDN_INFOLDER makes no sense. 2325 2324 */ 2326 2325 static HRESULT WINAPI ISF_MyComputer_fnGetDisplayNameOf( 2327 2328 2329 2330 2331 { 2332 2333 2334 charszPath[MAX_PATH], szDrive[18];2335 intlen = 0;2336 BOOLbSimplePidl;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 2364 _ILSimpleGetText(pidl, szPath, MAX_PATH);/* append my own path */2365 2366 2367 2368 2369 2326 IShellFolder2 * iface, 2327 LPCITEMIDLIST pidl, 2328 DWORD dwFlags, 2329 LPSTRRET strRet) 2330 { 2331 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 2332 2333 char szPath[MAX_PATH], szDrive[18]; 2334 int len = 0; 2335 BOOL bSimplePidl; 2336 2337 TRACE("(%p)->(pidl=%p,0x%08lx,%p)\n",This,pidl,dwFlags,strRet); 2338 pdump(pidl); 2339 2340 if(!strRet) return E_INVALIDARG; 2341 2342 szPath[0]=0x00; szDrive[0]=0x00; 2343 2344 2345 bSimplePidl = _ILIsPidlSimple(pidl); 2346 2347 if (_ILIsSpecialFolder(pidl)) 2348 { 2349 /* take names of special folders only if its only this folder */ 2350 if ( bSimplePidl ) 2351 { 2352 _ILSimpleGetText(pidl, szPath, MAX_PATH); /* append my own path */ 2353 } 2354 } 2355 else 2356 { 2357 if (!_ILIsDrive(pidl)) 2358 { 2359 ERR("Wrong pidl type\n"); 2360 return E_INVALIDARG; 2361 } 2362 2363 _ILSimpleGetText(pidl, szPath, MAX_PATH); /* append my own path */ 2364 2365 /* long view "lw_name (C:)" */ 2366 if ( bSimplePidl && !(dwFlags & SHGDN_FORPARSING)) 2367 { 2368 DWORD dwVolumeSerialNumber,dwMaximumComponetLength,dwFileSystemFlags; 2370 2369 2371 2370 #ifdef __WIN32OS2__ … … 2390 2389 } 2391 2390 #else 2392 2393 2394 2395 2396 2391 GetVolumeInformationA(szPath,szDrive,12,&dwVolumeSerialNumber,&dwMaximumComponetLength,&dwFileSystemFlags,NULL,0); 2392 strcat (szDrive," ("); 2393 strncat (szDrive, szPath, 2); 2394 strcat (szDrive,")"); 2395 strcpy (szPath, szDrive); 2397 2396 #endif 2398 2399 2400 2401 if (!bSimplePidl)/* go deeper if needed */2402 { 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2397 } 2398 } 2399 2400 if (!bSimplePidl) /* go deeper if needed */ 2401 { 2402 PathAddBackslashA(szPath); 2403 len = strlen(szPath); 2404 2405 if (!SUCCEEDED(SHELL32_GetDisplayNameOfChild(iface, pidl, dwFlags | SHGDN_FORPARSING, szPath + len, MAX_PATH - len))) 2406 return E_OUTOFMEMORY; 2407 } 2408 strRet->uType = STRRET_CSTRA; 2409 lstrcpynA(strRet->u.cStr, szPath, MAX_PATH); 2410 2411 2412 TRACE("-- (%p)->(%s)\n", This, szPath); 2413 return S_OK; 2415 2414 } 2416 2415 2417 2416 static HRESULT WINAPI ISF_MyComputer_fnGetDefaultSearchGUID( 2418 2419 2420 { 2421 2422 2423 2424 } 2417 IShellFolder2 * iface, 2418 GUID *pguid) 2419 { 2420 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 2421 FIXME("(%p)\n",This); 2422 return E_NOTIMPL; 2423 } 2425 2424 static HRESULT WINAPI ISF_MyComputer_fnEnumSearches( 2426 2427 2428 { 2429 2430 2431 2432 } 2425 IShellFolder2 * iface, 2426 IEnumExtraSearch **ppenum) 2427 { 2428 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 2429 FIXME("(%p)\n",This); 2430 return E_NOTIMPL; 2431 } 2433 2432 static HRESULT WINAPI ISF_MyComputer_fnGetDefaultColumn( 2434 2435 2436 2437 2438 { 2439 2440 2441 2442 2443 2444 2445 2446 2447 } 2433 IShellFolder2 * iface, 2434 DWORD dwRes, 2435 ULONG *pSort, 2436 ULONG *pDisplay) 2437 { 2438 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 2439 2440 TRACE("(%p)\n",This); 2441 2442 if (pSort) *pSort = 0; 2443 if (pDisplay) *pDisplay = 0; 2444 2445 return S_OK; 2446 } 2448 2447 static HRESULT WINAPI ISF_MyComputer_fnGetDefaultColumnState( 2449 2450 2451 2452 { 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 } 2448 IShellFolder2 * iface, 2449 UINT iColumn, 2450 DWORD *pcsFlags) 2451 { 2452 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 2453 2454 TRACE("(%p)\n",This); 2455 2456 if (!pcsFlags || iColumn >= MYCOMPUTERSHELLVIEWCOLUMNS ) return E_INVALIDARG; 2457 2458 *pcsFlags = MyComputerSFHeader[iColumn].pcsFlags; 2459 2460 return S_OK; 2461 } 2463 2462 static HRESULT WINAPI ISF_MyComputer_fnGetDetailsEx( 2464 2465 2466 2467 2468 { 2469 2470 2471 2472 2473 } 2463 IShellFolder2 * iface, 2464 LPCITEMIDLIST pidl, 2465 const SHCOLUMNID *pscid, 2466 VARIANT *pv) 2467 { 2468 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 2469 FIXME("(%p)\n",This); 2470 2471 return E_NOTIMPL; 2472 } 2474 2473 2475 2474 /* fixme: drive size >4GB is rolling over */ 2476 2475 static HRESULT WINAPI ISF_MyComputer_fnGetDetailsOf( 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 2506 case 0:/* name */2507 2508 2509 case 1:/* type */2510 2511 2512 case 2:/* total size */2513 2514 2515 2516 2517 2518 2519 2520 case 3:/* free size */2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 } 2476 IShellFolder2 * iface, 2477 LPCITEMIDLIST pidl, 2478 UINT iColumn, 2479 SHELLDETAILS *psd) 2480 { 2481 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 2482 HRESULT hr; 2483 2484 TRACE("(%p)->(%p %i %p)\n",This, pidl, iColumn, psd); 2485 2486 if (!psd || iColumn >= MYCOMPUTERSHELLVIEWCOLUMNS ) return E_INVALIDARG; 2487 2488 if (!pidl) 2489 { 2490 psd->fmt = MyComputerSFHeader[iColumn].fmt; 2491 psd->cxChar = MyComputerSFHeader[iColumn].cxChar; 2492 psd->str.uType = STRRET_CSTRA; 2493 LoadStringA(shell32_hInstance, MyComputerSFHeader[iColumn].colnameid, psd->str.u.cStr, MAX_PATH); 2494 return S_OK; 2495 } 2496 else 2497 { 2498 char szPath[MAX_PATH]; 2499 ULARGE_INTEGER ulBytes; 2500 2501 psd->str.u.cStr[0] = 0x00; 2502 psd->str.uType = STRRET_CSTRA; 2503 switch(iColumn) 2504 { 2505 case 0: /* name */ 2506 hr = IShellFolder_GetDisplayNameOf(iface, pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str); 2507 break; 2508 case 1: /* type */ 2509 _ILGetFileType(pidl, psd->str.u.cStr, MAX_PATH); 2510 break; 2511 case 2: /* total size */ 2512 if (_ILIsDrive(pidl)) 2513 { 2514 _ILSimpleGetText(pidl, szPath, MAX_PATH); 2515 GetDiskFreeSpaceExA(szPath, NULL, &ulBytes, NULL); 2516 StrFormatByteSizeA(ulBytes.s.LowPart, psd->str.u.cStr, MAX_PATH); 2517 } 2518 break; 2519 case 3: /* free size */ 2520 if (_ILIsDrive(pidl)) 2521 { 2522 _ILSimpleGetText(pidl, szPath, MAX_PATH); 2523 GetDiskFreeSpaceExA(szPath, &ulBytes, NULL, NULL); 2524 StrFormatByteSizeA(ulBytes.s.LowPart, psd->str.u.cStr, MAX_PATH); 2525 } 2526 break; 2527 } 2528 hr = S_OK; 2529 } 2530 2531 return hr; 2532 } 2534 2533 static HRESULT WINAPI ISF_MyComputer_fnMapNameToSCID( 2535 2536 2537 2538 { 2539 2540 2541 2542 } 2543 2544 static ICOM_VTABLE(IShellFolder2) sfmcvt = 2545 { 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2534 IShellFolder2 * iface, 2535 LPCWSTR pwszName, 2536 SHCOLUMNID *pscid) 2537 { 2538 _ICOM_THIS_From_IShellFolder2(IGenericSFImpl, iface) 2539 FIXME("(%p)\n",This); 2540 return E_NOTIMPL; 2541 } 2542 2543 static ICOM_VTABLE(IShellFolder2) sfmcvt = 2544 { 2545 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 2546 IShellFolder_fnQueryInterface, 2547 IShellFolder_fnAddRef, 2548 IShellFolder_fnRelease, 2549 ISF_MyComputer_fnParseDisplayName, 2550 ISF_MyComputer_fnEnumObjects, 2551 ISF_MyComputer_fnBindToObject, 2552 IShellFolder_fnBindToStorage, 2553 IShellFolder_fnCompareIDs, 2554 ISF_MyComputer_fnCreateViewObject, 2555 ISF_MyComputer_fnGetAttributesOf, 2556 IShellFolder_fnGetUIObjectOf, 2557 ISF_MyComputer_fnGetDisplayNameOf, 2558 IShellFolder_fnSetNameOf, 2559 2560 /* ShellFolder2 */ 2561 ISF_MyComputer_fnGetDefaultSearchGUID, 2562 ISF_MyComputer_fnEnumSearches, 2563 ISF_MyComputer_fnGetDefaultColumn, 2564 ISF_MyComputer_fnGetDefaultColumnState, 2565 ISF_MyComputer_fnGetDetailsEx, 2566 ISF_MyComputer_fnGetDetailsOf, 2567 ISF_MyComputer_fnMapNameToSCID 2569 2568 }; 2570 2569 … … 2575 2574 */ 2576 2575 static HRESULT WINAPI ISFPersistFolder2_QueryInterface( 2577 IPersistFolder2 *iface,2578 REFIIDiid,2579 LPVOID*ppvObj)2580 { 2581 2582 2583 2584 2585 2576 IPersistFolder2 * iface, 2577 REFIID iid, 2578 LPVOID* ppvObj) 2579 { 2580 _ICOM_THIS_From_IPersistFolder2(IGenericSFImpl, iface); 2581 2582 TRACE("(%p)\n", This); 2583 2584 return IUnknown_QueryInterface(This->pUnkOuter, iid, ppvObj); 2586 2585 } 2587 2586 … … 2591 2590 */ 2592 2591 static ULONG WINAPI ISFPersistFolder2_AddRef( 2593 IPersistFolder2 *iface)2594 { 2595 2596 2597 2598 2599 2592 IPersistFolder2 * iface) 2593 { 2594 _ICOM_THIS_From_IPersistFolder2(IGenericSFImpl, iface); 2595 2596 TRACE("(%p)\n", This); 2597 2598 return IUnknown_AddRef(This->pUnkOuter); 2600 2599 } 2601 2600 … … 2605 2604 */ 2606 2605 static ULONG WINAPI ISFPersistFolder2_Release( 2607 IPersistFolder2 *iface)2608 { 2609 2610 2611 2612 2613 2606 IPersistFolder2 * iface) 2607 { 2608 _ICOM_THIS_From_IPersistFolder2(IGenericSFImpl, iface); 2609 2610 TRACE("(%p)\n", This); 2611 2612 return IUnknown_Release(This->pUnkOuter); 2614 2613 } 2615 2614 … … 2618 2617 */ 2619 2618 static HRESULT WINAPI ISFPersistFolder2_GetClassID( 2620 IPersistFolder2 *iface,2621 CLSID *lpClassId)2622 { 2623 2624 2625 2626 2627 2628 2629 2630 2619 IPersistFolder2 * iface, 2620 CLSID * lpClassId) 2621 { 2622 _ICOM_THIS_From_IPersistFolder2(IGenericSFImpl, iface); 2623 2624 TRACE("(%p)\n", This); 2625 2626 if (!lpClassId) return E_POINTER; 2627 *lpClassId = *This->pclsid; 2628 2629 return S_OK; 2631 2630 } 2632 2631 … … 2638 2637 */ 2639 2638 static HRESULT WINAPI ISFPersistFolder2_Initialize( 2640 IPersistFolder2 *iface,2641 LPCITEMIDLISTpidl)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 2672 2639 IPersistFolder2 * iface, 2640 LPCITEMIDLIST pidl) 2641 { 2642 char sTemp[MAX_PATH]; 2643 _ICOM_THIS_From_IPersistFolder2(IGenericSFImpl, iface); 2644 2645 TRACE("(%p)->(%p)\n", This, pidl); 2646 2647 /* free the old stuff */ 2648 if(This->absPidl) 2649 { 2650 SHFree(This->absPidl); 2651 This->absPidl = NULL; 2652 } 2653 if(This->sMyPath) 2654 { 2655 SHFree(This->sMyPath); 2656 This->sMyPath = NULL; 2657 } 2658 2659 /* set my pidl */ 2660 This->absPidl = ILClone(pidl); 2661 2662 /* set my path */ 2663 if (SHGetPathFromIDListA(pidl, sTemp)) 2664 { 2665 This->sMyPath = SHAlloc(strlen(sTemp)+1); 2666 strcpy(This->sMyPath, sTemp); 2667 } 2668 2669 TRACE("--(%p)->(%s)\n", This, This->sMyPath); 2670 2671 return S_OK; 2673 2672 } 2674 2673 … … 2677 2676 */ 2678 2677 static HRESULT WINAPI ISFPersistFolder2_fnGetCurFolder( 2679 IPersistFolder2 *iface,2680 2681 { 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 } 2692 2693 static ICOM_VTABLE(IPersistFolder2) psfvt = 2694 { 2695 2696 2697 2698 2699 2700 2701 2678 IPersistFolder2 * iface, 2679 LPITEMIDLIST * pidl) 2680 { 2681 _ICOM_THIS_From_IPersistFolder2(IGenericSFImpl, iface); 2682 2683 TRACE("(%p)->(%p)\n",This, pidl); 2684 2685 if (!pidl) return E_POINTER; 2686 2687 *pidl = ILClone(This->absPidl); 2688 2689 return S_OK; 2690 } 2691 2692 static ICOM_VTABLE(IPersistFolder2) psfvt = 2693 { 2694 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 2695 ISFPersistFolder2_QueryInterface, 2696 ISFPersistFolder2_AddRef, 2697 ISFPersistFolder2_Release, 2698 ISFPersistFolder2_GetClassID, 2699 ISFPersistFolder2_Initialize, 2700 ISFPersistFolder2_fnGetCurFolder 2702 2701 }; 2703 2702 … … 2706 2705 */ 2707 2706 static BOOL ISFDropTarget_QueryDrop( 2708 2709 2710 2711 { 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2707 IDropTarget *iface, 2708 DWORD dwKeyState, 2709 LPDWORD pdwEffect) 2710 { 2711 DWORD dwEffect = *pdwEffect; 2712 2713 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface); 2714 2715 *pdwEffect = DROPEFFECT_NONE; 2716 2717 if (This->fAcceptFmt) 2718 { /* Does our interpretation of the keystate ... */ 2719 *pdwEffect = KeyStateToDropEffect(dwKeyState); 2720 2721 /* ... matches the desired effect ? */ 2722 if (dwEffect & *pdwEffect) 2723 { 2724 return TRUE; 2725 } 2726 } 2727 return FALSE; 2729 2728 } 2730 2729 2731 2730 static HRESULT WINAPI ISFDropTarget_QueryInterface( 2732 2733 2734 2735 { 2736 2737 2738 2739 2740 2731 IDropTarget *iface, 2732 REFIID riid, 2733 LPVOID *ppvObj) 2734 { 2735 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface); 2736 2737 TRACE("(%p)\n", This); 2738 2739 return IUnknown_QueryInterface(This->pUnkOuter, riid, ppvObj); 2741 2740 } 2742 2741 2743 2742 static ULONG WINAPI ISFDropTarget_AddRef( IDropTarget *iface) 2744 2743 { 2745 2746 2747 2748 2749 2744 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface); 2745 2746 TRACE("(%p)\n", This); 2747 2748 return IUnknown_AddRef(This->pUnkOuter); 2750 2749 } 2751 2750 2752 2751 static ULONG WINAPI ISFDropTarget_Release( IDropTarget *iface) 2753 2752 { 2754 2755 2756 2757 2758 2753 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface); 2754 2755 TRACE("(%p)\n", This); 2756 2757 return IUnknown_Release(This->pUnkOuter); 2759 2758 } 2760 2759 2761 2760 static HRESULT WINAPI ISFDropTarget_DragEnter( 2762 IDropTarget*iface,2763 IDataObject*pDataObject,2764 DWORDdwKeyState,2765 POINTLpt,2766 DWORD*pdwEffect)2767 { 2768 FORMATETCfmt;2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2761 IDropTarget *iface, 2762 IDataObject *pDataObject, 2763 DWORD dwKeyState, 2764 POINTL pt, 2765 DWORD *pdwEffect) 2766 { 2767 FORMATETC fmt; 2768 2769 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface); 2770 2771 TRACE("(%p)->(DataObject=%p)\n",This,pDataObject); 2772 2773 InitFormatEtc(fmt, This->cfShellIDList, TYMED_HGLOBAL); 2774 2775 This->fAcceptFmt = (S_OK == IDataObject_QueryGetData(pDataObject, &fmt)) ? TRUE : FALSE; 2776 2777 ISFDropTarget_QueryDrop(iface, dwKeyState, pdwEffect); 2778 2779 return S_OK; 2781 2780 } 2782 2781 2783 2782 static HRESULT WINAPI ISFDropTarget_DragOver( 2784 IDropTarget*iface,2785 DWORDdwKeyState,2786 POINTLpt,2787 DWORD*pdwEffect)2788 { 2789 2790 2791 2792 2793 2794 2795 2796 2797 2783 IDropTarget *iface, 2784 DWORD dwKeyState, 2785 POINTL pt, 2786 DWORD *pdwEffect) 2787 { 2788 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface); 2789 2790 TRACE("(%p)\n",This); 2791 2792 if(!pdwEffect) return E_INVALIDARG; 2793 2794 ISFDropTarget_QueryDrop(iface, dwKeyState, pdwEffect); 2795 2796 return S_OK; 2798 2797 } 2799 2798 2800 2799 static HRESULT WINAPI ISFDropTarget_DragLeave( 2801 IDropTarget*iface)2802 { 2803 2804 2805 2806 2807 2808 2809 2800 IDropTarget *iface) 2801 { 2802 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface); 2803 2804 TRACE("(%p)\n",This); 2805 2806 This->fAcceptFmt = FALSE; 2807 2808 return S_OK; 2810 2809 } 2811 2810 2812 2811 static HRESULT WINAPI ISFDropTarget_Drop( 2813 IDropTarget*iface,2814 IDataObject*pDataObject,2815 DWORDdwKeyState,2816 POINTLpt,2817 DWORD*pdwEffect)2818 { 2819 2820 2821 2822 2823 2824 } 2825 2826 static struct ICOM_VTABLE(IDropTarget) dtvt = 2827 { 2828 2829 2830 2831 2832 2833 2834 2835 2812 IDropTarget *iface, 2813 IDataObject* pDataObject, 2814 DWORD dwKeyState, 2815 POINTL pt, 2816 DWORD *pdwEffect) 2817 { 2818 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface); 2819 2820 FIXME("(%p) object dropped\n",This); 2821 2822 return E_NOTIMPL; 2823 } 2824 2825 static struct ICOM_VTABLE(IDropTarget) dtvt = 2826 { 2827 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 2828 ISFDropTarget_QueryInterface, 2829 ISFDropTarget_AddRef, 2830 ISFDropTarget_Release, 2831 ISFDropTarget_DragEnter, 2832 ISFDropTarget_DragOver, 2833 ISFDropTarget_DragLeave, 2834 ISFDropTarget_Drop 2836 2835 }; -
trunk/src/shell32/shlmenu.c
r6650 r6709 1 /* $Id: shlmenu.c,v 1.3 2001-09-05 13:46:59 bird Exp $ */2 1 /* 3 2 * see www.geocities.com/SiliconValley/4942/filemenu.html … … 23 22 typedef struct 24 23 { 25 BOOLbInitialized;26 BOOLbFixedItems;27 28 COLORREFcrBorderColor;29 intnBorderWidth;30 HBITMAPhBorderBmp;31 32 33 LPITEMIDLISTpidl;34 UINTuID;35 UINTuFlags;36 UINTuEnumFlags;37 24 BOOL bInitialized; 25 BOOL bFixedItems; 26 /* create */ 27 COLORREF crBorderColor; 28 int nBorderWidth; 29 HBITMAP hBorderBmp; 30 31 /* insert using pidl */ 32 LPITEMIDLIST pidl; 33 UINT uID; 34 UINT uFlags; 35 UINT uEnumFlags; 36 LPFNFMCALLBACK lpfnCallback; 38 37 } FMINFO, *LPFMINFO; 39 38 40 39 typedef struct 41 { intcchItemText;42 intiIconIndex;43 HMENUhMenu;44 charszItemText[1];40 { int cchItemText; 41 int iIconIndex; 42 HMENU hMenu; 43 char szItemText[1]; 45 44 } FMITEM, * LPFMITEM; 46 45 47 46 static BOOL bAbortInit; 48 47 49 #define 48 #define CCH_MAXITEMTEXT 256 50 49 51 50 DEFAULT_DEBUG_CHANNEL(shell); 52 51 53 52 LPFMINFO FM_GetMenuInfo(HMENU hmenu) 54 { MENUINFOMenuInfo;55 LPFMINFOmenudata;56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 } 74 /************************************************************************* 75 * FM_SetMenuParameter 53 { MENUINFO MenuInfo; 54 LPFMINFO menudata; 55 56 MenuInfo.cbSize = sizeof(MENUINFO); 57 MenuInfo.fMask = MIM_MENUDATA; 58 59 if (! GetMenuInfo(hmenu, &MenuInfo)) 60 return NULL; 61 62 menudata = (LPFMINFO)MenuInfo.dwMenuData; 63 64 if ((menudata == 0) || (MenuInfo.cbSize != sizeof(MENUINFO))) 65 { 66 ERR("menudata corrupt: %p %lu\n", menudata, MenuInfo.cbSize); 67 return 0; 68 } 69 70 return menudata; 71 72 } 73 /************************************************************************* 74 * FM_SetMenuParameter [internal] 76 75 * 77 76 */ 78 77 static LPFMINFO FM_SetMenuParameter( 79 80 81 82 83 84 85 { 86 LPFMINFOmenudata;87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 } 104 105 /************************************************************************* 106 * FM_InitMenuPopup 78 HMENU hmenu, 79 UINT uID, 80 LPCITEMIDLIST pidl, 81 UINT uFlags, 82 UINT uEnumFlags, 83 LPFNFMCALLBACK lpfnCallback) 84 { 85 LPFMINFO menudata; 86 87 TRACE("\n"); 88 89 menudata = FM_GetMenuInfo(hmenu); 90 91 if ( menudata->pidl) 92 { SHFree(menudata->pidl); 93 } 94 95 menudata->uID = uID; 96 menudata->pidl = ILClone(pidl); 97 menudata->uFlags = uFlags; 98 menudata->uEnumFlags = uEnumFlags; 99 menudata->lpfnCallback = lpfnCallback; 100 101 return menudata; 102 } 103 104 /************************************************************************* 105 * FM_InitMenuPopup [internal] 107 106 * 108 107 */ 109 108 static int FM_InitMenuPopup(HMENU hmenu, LPITEMIDLIST pAlternatePidl) 110 { IShellFolder*lpsf, *lpsf2;111 ULONGulItemAttr = SFGAO_FOLDER;112 UINTuID, uFlags, uEnumFlags;113 LPFNFMCALLBACKlpfnCallback;114 LPITEMIDLISTpidl;115 charsTemp[MAX_PATH];116 intNumberOfItems = 0, iIcon;117 MENUINFOMenuInfo;118 LPFMINFOmenudata;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 155 IEnumIDList*lpe = NULL;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 /************************************************************************* 222 * FileMenu_Create 109 { IShellFolder *lpsf, *lpsf2; 110 ULONG ulItemAttr = SFGAO_FOLDER; 111 UINT uID, uFlags, uEnumFlags; 112 LPFNFMCALLBACK lpfnCallback; 113 LPITEMIDLIST pidl; 114 char sTemp[MAX_PATH]; 115 int NumberOfItems = 0, iIcon; 116 MENUINFO MenuInfo; 117 LPFMINFO menudata; 118 119 TRACE("0x%04x %p\n", hmenu, pAlternatePidl); 120 121 MenuInfo.cbSize = sizeof(MENUINFO); 122 MenuInfo.fMask = MIM_MENUDATA; 123 124 if (! GetMenuInfo(hmenu, &MenuInfo)) 125 return FALSE; 126 127 menudata = (LPFMINFO)MenuInfo.dwMenuData; 128 129 if ((menudata == 0) || (MenuInfo.cbSize != sizeof(MENUINFO))) 130 { 131 ERR("menudata corrupt: %p %lu\n", menudata, MenuInfo.cbSize); 132 return 0; 133 } 134 135 if (menudata->bInitialized) 136 return 0; 137 138 pidl = ((pAlternatePidl) ? pAlternatePidl : menudata->pidl); 139 if (!pidl) 140 return 0; 141 142 uID = menudata->uID; 143 uFlags = menudata->uFlags; 144 uEnumFlags = menudata->uEnumFlags; 145 lpfnCallback = menudata->lpfnCallback; 146 menudata->bInitialized = FALSE; 147 148 SetMenuInfo(hmenu, &MenuInfo); 149 150 if (SUCCEEDED (SHGetDesktopFolder(&lpsf))) 151 { 152 if (SUCCEEDED(IShellFolder_BindToObject(lpsf, pidl,0,(REFIID)&IID_IShellFolder,(LPVOID *)&lpsf2))) 153 { 154 IEnumIDList *lpe = NULL; 155 156 if (SUCCEEDED (IShellFolder_EnumObjects(lpsf2, 0, uEnumFlags, &lpe ))) 157 { 158 159 LPITEMIDLIST pidlTemp = NULL; 160 ULONG ulFetched; 161 162 while ((!bAbortInit) && (NOERROR == IEnumIDList_Next(lpe,1,&pidlTemp,&ulFetched))) 163 { 164 if (SUCCEEDED (IShellFolder_GetAttributesOf(lpsf, 1, &pidlTemp, &ulItemAttr))) 165 { 166 ILGetDisplayName( pidlTemp, sTemp); 167 if (! (PidlToSicIndex(lpsf, pidlTemp, FALSE, 0, &iIcon))) 168 iIcon = FM_BLANK_ICON; 169 if ( SFGAO_FOLDER & ulItemAttr) 170 { 171 LPFMINFO lpFmMi; 172 MENUINFO MenuInfo; 173 HMENU hMenuPopup = CreatePopupMenu(); 174 175 lpFmMi = (LPFMINFO) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(FMINFO)); 176 177 lpFmMi->pidl = ILCombine(pidl, pidlTemp); 178 lpFmMi->uEnumFlags = SHCONTF_FOLDERS | SHCONTF_NONFOLDERS; 179 180 MenuInfo.cbSize = sizeof(MENUINFO); 181 MenuInfo.fMask = MIM_MENUDATA; 182 MenuInfo.dwMenuData = (DWORD) lpFmMi; 183 SetMenuInfo (hMenuPopup, &MenuInfo); 184 185 FileMenu_AppendItemA (hmenu, sTemp, uID, iIcon, hMenuPopup, FM_DEFAULT_HEIGHT); 186 } 187 else 188 { 189 ((LPSTR)PathFindExtensionA(sTemp))[0] = 0x00; 190 FileMenu_AppendItemA (hmenu, sTemp, uID, iIcon, 0, FM_DEFAULT_HEIGHT); 191 } 192 } 193 194 if (lpfnCallback) 195 { 196 TRACE("enter callback\n"); 197 lpfnCallback ( pidl, pidlTemp); 198 TRACE("leave callback\n"); 199 } 200 201 NumberOfItems++; 202 } 203 IEnumIDList_Release (lpe); 204 } 205 IShellFolder_Release(lpsf2); 206 } 207 IShellFolder_Release(lpsf); 208 } 209 210 if ( GetMenuItemCount (hmenu) == 0 ) 211 { FileMenu_AppendItemA (hmenu, "(empty)", uID, FM_BLANK_ICON, 0, FM_DEFAULT_HEIGHT); 212 NumberOfItems++; 213 } 214 215 menudata->bInitialized = TRUE; 216 SetMenuInfo(hmenu, &MenuInfo); 217 218 return NumberOfItems; 219 } 220 /************************************************************************* 221 * FileMenu_Create [SHELL32.114] 223 222 * 224 223 * NOTES 225 224 * for non-root menus values are 226 * (ffffffff,00000000,00000000,00000000,00000000) 225 * (ffffffff,00000000,00000000,00000000,00000000) 227 226 */ 228 227 HMENU WINAPI FileMenu_Create ( 229 230 231 232 233 234 { 235 MENUINFOMenuInfo;236 LPFMINFOmenudata;237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 } 255 256 /************************************************************************* 257 * FileMenu_Destroy 228 COLORREF crBorderColor, 229 int nBorderWidth, 230 HBITMAP hBorderBmp, 231 int nSelHeight, 232 UINT uFlags) 233 { 234 MENUINFO MenuInfo; 235 LPFMINFO menudata; 236 237 HMENU hMenu = CreatePopupMenu(); 238 239 TRACE("0x%08lx 0x%08x 0x%08x 0x%08x 0x%08x hMenu=0x%08x\n", 240 crBorderColor, nBorderWidth, hBorderBmp, nSelHeight, uFlags, hMenu); 241 242 menudata = (LPFMINFO)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(FMINFO)); 243 menudata->crBorderColor = crBorderColor; 244 menudata->nBorderWidth = nBorderWidth; 245 menudata->hBorderBmp = hBorderBmp; 246 247 MenuInfo.cbSize = sizeof(MENUINFO); 248 MenuInfo.fMask = MIM_MENUDATA; 249 MenuInfo.dwMenuData = (DWORD) menudata; 250 SetMenuInfo (hMenu, &MenuInfo); 251 252 return hMenu; 253 } 254 255 /************************************************************************* 256 * FileMenu_Destroy [SHELL32.118] 258 257 * 259 258 * NOTES … … 262 261 void WINAPI FileMenu_Destroy (HMENU hmenu) 263 262 { 264 LPFMINFOmenudata;265 266 267 268 269 270 271 272 273 274 275 276 277 278 } 279 280 /************************************************************************* 281 * FileMenu_AppendItemAW 263 LPFMINFO menudata; 264 265 TRACE("0x%08x\n", hmenu); 266 267 FileMenu_DeleteAllItems (hmenu); 268 269 menudata = FM_GetMenuInfo(hmenu); 270 271 if ( menudata->pidl) 272 { SHFree( menudata->pidl); 273 } 274 HeapFree(GetProcessHeap(), 0, menudata); 275 276 DestroyMenu (hmenu); 277 } 278 279 /************************************************************************* 280 * FileMenu_AppendItemAW [SHELL32.115] 282 281 * 283 282 */ 284 283 BOOL WINAPI FileMenu_AppendItemA( 285 286 287 288 289 290 291 { 292 293 MENUITEMINFOAmii;294 LPFMITEMmyItem;295 LPFMINFOmenudata;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 355 284 HMENU hMenu, 285 LPCSTR lpText, 286 UINT uID, 287 int icon, 288 HMENU hMenuPopup, 289 int nItemHeight) 290 { 291 LPSTR lpszText = (LPSTR)lpText; 292 MENUITEMINFOA mii; 293 LPFMITEM myItem; 294 LPFMINFO menudata; 295 MENUINFO MenuInfo; 296 297 298 TRACE("0x%08x %s 0x%08x 0x%08x 0x%08x 0x%08x\n", 299 hMenu, (lpszText!=FM_SEPARATOR) ? lpText: NULL, 300 uID, icon, hMenuPopup, nItemHeight); 301 302 ZeroMemory (&mii, sizeof(MENUITEMINFOA)); 303 304 mii.cbSize = sizeof(MENUITEMINFOA); 305 306 if (lpText != FM_SEPARATOR) 307 { int len = strlen (lpText); 308 myItem = (LPFMITEM) SHAlloc( sizeof(FMITEM) + len); 309 strcpy (myItem->szItemText, lpText); 310 myItem->cchItemText = len; 311 myItem->iIconIndex = icon; 312 myItem->hMenu = hMenu; 313 mii.fMask = MIIM_DATA; 314 mii.dwItemData = (DWORD) myItem; 315 } 316 317 if ( hMenuPopup ) 318 { /* sub menu */ 319 mii.fMask |= MIIM_TYPE | MIIM_SUBMENU; 320 mii.fType = MFT_OWNERDRAW; 321 mii.hSubMenu = hMenuPopup; 322 } 323 else if (lpText == FM_SEPARATOR ) 324 { mii.fMask |= MIIM_ID | MIIM_TYPE; 325 mii.fType = MFT_SEPARATOR; 326 } 327 else 328 { /* normal item */ 329 mii.fMask |= MIIM_ID | MIIM_TYPE | MIIM_STATE; 330 mii.fState = MFS_ENABLED | MFS_DEFAULT; 331 mii.fType = MFT_OWNERDRAW; 332 } 333 mii.wID = uID; 334 335 InsertMenuItemA (hMenu, (UINT)-1, TRUE, &mii); 336 337 /* set bFixedItems to true */ 338 MenuInfo.cbSize = sizeof(MENUINFO); 339 MenuInfo.fMask = MIM_MENUDATA; 340 341 if (! GetMenuInfo(hMenu, &MenuInfo)) 342 return FALSE; 343 344 menudata = (LPFMINFO)MenuInfo.dwMenuData; 345 if ((menudata == 0) || (MenuInfo.cbSize != sizeof(MENUINFO))) 346 { 347 ERR("menudata corrupt: %p %lu\n", menudata, MenuInfo.cbSize); 348 return 0; 349 } 350 351 menudata->bFixedItems = TRUE; 352 SetMenuInfo(hMenu, &MenuInfo); 353 354 return TRUE; 356 355 357 356 } … … 360 359 361 360 BOOL WINAPI FileMenu_AppendItemAW( 362 363 364 365 366 367 368 { 369 370 371 372 373 374 375 376 377 378 379 380 381 } 382 /************************************************************************* 383 * FileMenu_InsertUsingPidl 361 HMENU hMenu, 362 LPCVOID lpText, 363 UINT uID, 364 int icon, 365 HMENU hMenuPopup, 366 int nItemHeight) 367 { 368 BOOL ret; 369 LPSTR lpszText=NULL; 370 371 if (SHELL_OsIsUnicode() && (lpText!=FM_SEPARATOR)) 372 lpszText = HEAP_strdupWtoA ( GetProcessHeap(),0, lpText); 373 374 ret = FileMenu_AppendItemA(hMenu, (lpszText) ? lpszText : lpText, uID, icon, hMenuPopup, nItemHeight); 375 376 if (lpszText) 377 HeapFree( GetProcessHeap(), 0, lpszText ); 378 379 return ret; 380 } 381 /************************************************************************* 382 * FileMenu_InsertUsingPidl [SHELL32.110] 384 383 * 385 384 * NOTES 386 * uEnumFlagsany SHCONTF flag385 * uEnumFlags any SHCONTF flag 387 386 */ 388 387 int WINAPI FileMenu_InsertUsingPidl ( 389 390 391 392 393 394 395 { 396 397 398 399 400 401 402 403 FM_SetMenuParameter(hmenu, uID, pidl, uFlags, uEnumFlags, lpfnCallback); 404 405 406 } 407 408 /************************************************************************* 409 * FileMenu_ReplaceUsingPidl 388 HMENU hmenu, 389 UINT uID, 390 LPCITEMIDLIST pidl, 391 UINT uFlags, 392 UINT uEnumFlags, 393 LPFNFMCALLBACK lpfnCallback) 394 { 395 TRACE("0x%08x 0x%08x %p 0x%08x 0x%08x %p\n", 396 hmenu, uID, pidl, uFlags, uEnumFlags, lpfnCallback); 397 398 pdump (pidl); 399 400 bAbortInit = FALSE; 401 402 FM_SetMenuParameter(hmenu, uID, pidl, uFlags, uEnumFlags, lpfnCallback); 403 404 return FM_InitMenuPopup(hmenu, NULL); 405 } 406 407 /************************************************************************* 408 * FileMenu_ReplaceUsingPidl [SHELL32.113] 410 409 * 411 410 * FIXME: the static items are deleted but wont be refreshed 412 411 */ 413 412 int WINAPI FileMenu_ReplaceUsingPidl( 414 HMENUhmenu,415 UINTuID,416 LPCITEMIDLISTpidl,417 UINTuEnumFlags,418 419 { 420 421 422 423 424 425 FM_SetMenuParameter(hmenu, uID, pidl, 0, uEnumFlags, lpfnCallback); 426 427 428 } 429 430 /************************************************************************* 431 * FileMenu_Invalidate 413 HMENU hmenu, 414 UINT uID, 415 LPCITEMIDLIST pidl, 416 UINT uEnumFlags, 417 LPFNFMCALLBACK lpfnCallback) 418 { 419 TRACE("0x%08x 0x%08x %p 0x%08x %p\n", 420 hmenu, uID, pidl, uEnumFlags, lpfnCallback); 421 422 FileMenu_DeleteAllItems (hmenu); 423 424 FM_SetMenuParameter(hmenu, uID, pidl, 0, uEnumFlags, lpfnCallback); 425 426 return FM_InitMenuPopup(hmenu, NULL); 427 } 428 429 /************************************************************************* 430 * FileMenu_Invalidate [SHELL32.111] 432 431 */ 433 432 void WINAPI FileMenu_Invalidate (HMENU hMenu) 434 433 { 435 FIXME("0x%08x\n",hMenu); 436 } 437 438 /************************************************************************* 439 * FileMenu_FindSubMenuByPidl 434 FIXME("0x%08x\n",hMenu); 435 } 436 437 /************************************************************************* 438 * FileMenu_FindSubMenuByPidl [SHELL32.106] 440 439 */ 441 440 HMENU WINAPI FileMenu_FindSubMenuByPidl( 442 HMENUhMenu,443 LPCITEMIDLISTpidl)444 { 445 FIXME("0x%08x %p\n",hMenu, pidl); 446 447 } 448 449 /************************************************************************* 450 * FileMenu_AppendFilesForPidl 441 HMENU hMenu, 442 LPCITEMIDLIST pidl) 443 { 444 FIXME("0x%08x %p\n",hMenu, pidl); 445 return 0; 446 } 447 448 /************************************************************************* 449 * FileMenu_AppendFilesForPidl [SHELL32.124] 451 450 */ 452 451 int WINAPI FileMenu_AppendFilesForPidl( 453 HMENUhmenu,454 LPCITEMIDLISTpidl,455 BOOLbAddSeperator)456 { 457 LPFMINFOmenudata;458 459 460 461 462 463 464 465 466 467 468 TRACE("0x%08x %p 0x%08x\n",hmenu, pidl,bAddSeperator); 469 470 471 } 472 /************************************************************************* 473 * FileMenu_AddFilesForPidl 452 HMENU hmenu, 453 LPCITEMIDLIST pidl, 454 BOOL bAddSeperator) 455 { 456 LPFMINFO menudata; 457 458 menudata = FM_GetMenuInfo(hmenu); 459 460 menudata->bInitialized = FALSE; 461 462 FM_InitMenuPopup(hmenu, pidl); 463 464 if (bAddSeperator) 465 FileMenu_AppendItemA (hmenu, FM_SEPARATOR, 0, 0, 0, FM_DEFAULT_HEIGHT); 466 467 TRACE("0x%08x %p 0x%08x\n",hmenu, pidl,bAddSeperator); 468 469 return 0; 470 } 471 /************************************************************************* 472 * FileMenu_AddFilesForPidl [SHELL32.125] 474 473 * 475 474 * NOTES 476 * uEnumFlagsany SHCONTF flag475 * uEnumFlags any SHCONTF flag 477 476 */ 478 477 int WINAPI FileMenu_AddFilesForPidl ( 479 HMENUhmenu,480 UINTuReserved,481 UINTuID,482 LPCITEMIDLISTpidl,483 UINTuFlags,484 UINTuEnumFlags,485 LPFNFMCALLBACKlpfnCallback)486 { 487 488 489 490 491 492 } 493 494 495 /************************************************************************* 496 * FileMenu_TrackPopupMenuEx 478 HMENU hmenu, 479 UINT uReserved, 480 UINT uID, 481 LPCITEMIDLIST pidl, 482 UINT uFlags, 483 UINT uEnumFlags, 484 LPFNFMCALLBACK lpfnCallback) 485 { 486 TRACE("0x%08x 0x%08x 0x%08x %p 0x%08x 0x%08x %p\n", 487 hmenu, uReserved, uID, pidl, uFlags, uEnumFlags, lpfnCallback); 488 489 return FileMenu_InsertUsingPidl ( hmenu, uID, pidl, uFlags, uEnumFlags, lpfnCallback); 490 491 } 492 493 494 /************************************************************************* 495 * FileMenu_TrackPopupMenuEx [SHELL32.116] 497 496 */ 498 497 BOOL WINAPI FileMenu_TrackPopupMenuEx ( 499 500 501 502 503 504 505 { 506 507 508 509 } 510 511 /************************************************************************* 512 * FileMenu_GetLastSelectedItemPidls 498 HMENU hMenu, 499 UINT uFlags, 500 int x, 501 int y, 502 HWND hWnd, 503 LPTPMPARAMS lptpm) 504 { 505 TRACE("0x%08x 0x%08x 0x%x 0x%x 0x%08x %p\n", 506 hMenu, uFlags, x, y, hWnd, lptpm); 507 return TrackPopupMenuEx(hMenu, uFlags, x, y, hWnd, lptpm); 508 } 509 510 /************************************************************************* 511 * FileMenu_GetLastSelectedItemPidls [SHELL32.107] 513 512 */ 514 513 BOOL WINAPI FileMenu_GetLastSelectedItemPidls( 515 UINTuReserved,516 LPCITEMIDLIST*ppidlFolder,517 LPCITEMIDLIST*ppidlItem)518 { 519 520 521 } 522 523 #define FM_ICON_SIZE 524 #define FM_Y_SPACE 525 #define FM_SPACE1 526 #define FM_SPACE2 527 #define FM_LEFTBORDER 528 #define FM_RIGHTBORDER 529 /************************************************************************* 530 * FileMenu_MeasureItem 514 UINT uReserved, 515 LPCITEMIDLIST *ppidlFolder, 516 LPCITEMIDLIST *ppidlItem) 517 { 518 FIXME("0x%08x %p %p\n",uReserved, ppidlFolder, ppidlItem); 519 return 0; 520 } 521 522 #define FM_ICON_SIZE 16 523 #define FM_Y_SPACE 4 524 #define FM_SPACE1 4 525 #define FM_SPACE2 2 526 #define FM_LEFTBORDER 2 527 #define FM_RIGHTBORDER 8 528 /************************************************************************* 529 * FileMenu_MeasureItem [SHELL32.112] 531 530 */ 532 531 LRESULT WINAPI FileMenu_MeasureItem( 533 HWNDhWnd,534 LPMEASUREITEMSTRUCTlpmis)535 { 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 } 557 /************************************************************************* 558 * FileMenu_DrawItem 532 HWND hWnd, 533 LPMEASUREITEMSTRUCT lpmis) 534 { 535 LPFMITEM pMyItem = (LPFMITEM)(lpmis->itemData); 536 HDC hdc = GetDC(hWnd); 537 SIZE size; 538 LPFMINFO menuinfo; 539 540 TRACE("0x%08x %p %s\n", hWnd, lpmis, pMyItem->szItemText); 541 542 GetTextExtentPoint32A(hdc, pMyItem->szItemText, pMyItem->cchItemText, &size); 543 544 lpmis->itemWidth = size.cx + FM_LEFTBORDER + FM_ICON_SIZE + FM_SPACE1 + FM_SPACE2 + FM_RIGHTBORDER; 545 lpmis->itemHeight = (size.cy > (FM_ICON_SIZE + FM_Y_SPACE)) ? size.cy : (FM_ICON_SIZE + FM_Y_SPACE); 546 547 /* add the menubitmap */ 548 menuinfo = FM_GetMenuInfo(pMyItem->hMenu); 549 if (menuinfo->nBorderWidth) 550 lpmis->itemWidth += menuinfo->nBorderWidth; 551 552 TRACE("-- 0x%04x 0x%04x\n", lpmis->itemWidth, lpmis->itemHeight); 553 ReleaseDC (hWnd, hdc); 554 return 0; 555 } 556 /************************************************************************* 557 * FileMenu_DrawItem [SHELL32.105] 559 558 */ 560 559 LRESULT WINAPI FileMenu_DrawItem( 561 HWNDhWnd,562 LPDRAWITEMSTRUCTlpdis)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 /* 560 HWND hWnd, 561 LPDRAWITEMSTRUCT lpdis) 562 { 563 LPFMITEM pMyItem = (LPFMITEM)(lpdis->itemData); 564 COLORREF clrPrevText, clrPrevBkgnd; 565 int xi,yi,xt,yt; 566 HIMAGELIST hImageList; 567 RECT TextRect, BorderRect; 568 LPFMINFO menuinfo; 569 570 TRACE("0x%08x %p %s\n", hWnd, lpdis, pMyItem->szItemText); 571 572 if (lpdis->itemState & ODS_SELECTED) 573 { 574 clrPrevText = SetTextColor(lpdis->hDC, GetSysColor (COLOR_HIGHLIGHTTEXT)); 575 clrPrevBkgnd = SetBkColor(lpdis->hDC, GetSysColor (COLOR_HIGHLIGHT)); 576 } 577 else 578 { 579 clrPrevText = SetTextColor(lpdis->hDC, GetSysColor (COLOR_MENUTEXT)); 580 clrPrevBkgnd = SetBkColor(lpdis->hDC, GetSysColor (COLOR_MENU)); 581 } 582 583 CopyRect(&TextRect, &(lpdis->rcItem)); 584 585 /* add the menubitmap */ 586 menuinfo = FM_GetMenuInfo(pMyItem->hMenu); 587 if (menuinfo->nBorderWidth) 588 TextRect.left += menuinfo->nBorderWidth; 589 590 BorderRect.right = menuinfo->nBorderWidth; 591 /* FillRect(lpdis->hDC, &BorderRect, CreateSolidBrush( menuinfo->crBorderColor)); 593 592 */ 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 } 614 615 /************************************************************************* 616 * FileMenu_InitMenuPopup 593 TextRect.left += FM_LEFTBORDER; 594 xi = TextRect.left + FM_SPACE1; 595 yi = TextRect.top + FM_Y_SPACE/2; 596 TextRect.bottom -= FM_Y_SPACE/2; 597 598 xt = xi + FM_ICON_SIZE + FM_SPACE2; 599 yt = yi; 600 601 ExtTextOutA (lpdis->hDC, xt , yt, ETO_OPAQUE, &TextRect, pMyItem->szItemText, pMyItem->cchItemText, NULL); 602 603 Shell_GetImageList(0, &hImageList); 604 ImageList_Draw(hImageList, pMyItem->iIconIndex, lpdis->hDC, xi, yi, ILD_NORMAL); 605 606 TRACE("-- 0x%04x 0x%04x 0x%04x 0x%04x\n", TextRect.left, TextRect.top, TextRect.right, TextRect.bottom); 607 608 SetTextColor(lpdis->hDC, clrPrevText); 609 SetBkColor(lpdis->hDC, clrPrevBkgnd); 610 611 return TRUE; 612 } 613 614 /************************************************************************* 615 * FileMenu_InitMenuPopup [SHELL32.109] 617 616 * 618 617 * NOTES 619 * The filemenu is a ownerdrawn menu. Call this function responding to 618 * The filemenu is a ownerdrawn menu. Call this function responding to 620 619 * WM_INITPOPUPMENU 621 620 * … … 623 622 BOOL WINAPI FileMenu_InitMenuPopup (HMENU hmenu) 624 623 { 625 626 627 } 628 629 /************************************************************************* 630 * FileMenu_HandleMenuChar 624 FM_InitMenuPopup(hmenu, NULL); 625 return TRUE; 626 } 627 628 /************************************************************************* 629 * FileMenu_HandleMenuChar [SHELL32.108] 631 630 */ 632 631 LRESULT WINAPI FileMenu_HandleMenuChar( 633 HMENUhMenu,634 WPARAMwParam)635 { 636 637 638 } 639 640 /************************************************************************* 641 * FileMenu_DeleteAllItems 632 HMENU hMenu, 633 WPARAM wParam) 634 { 635 FIXME("0x%08x 0x%08x\n",hMenu,wParam); 636 return 0; 637 } 638 639 /************************************************************************* 640 * FileMenu_DeleteAllItems [SHELL32.104] 642 641 * 643 642 * NOTES … … 645 644 */ 646 645 BOOL WINAPI FileMenu_DeleteAllItems (HMENU hmenu) 647 { 648 MENUITEMINFOAmii;649 LPFMINFOmenudata;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 /************************************************************************* 679 * FileMenu_DeleteItemByCmd 646 { 647 MENUITEMINFOA mii; 648 LPFMINFO menudata; 649 650 int i; 651 652 TRACE("0x%08x\n", hmenu); 653 654 ZeroMemory ( &mii, sizeof(MENUITEMINFOA)); 655 mii.cbSize = sizeof(MENUITEMINFOA); 656 mii.fMask = MIIM_SUBMENU|MIIM_DATA; 657 658 for (i = 0; i < GetMenuItemCount( hmenu ); i++) 659 { GetMenuItemInfoA(hmenu, i, TRUE, &mii ); 660 661 if (mii.dwItemData) 662 SHFree((LPFMINFO)mii.dwItemData); 663 664 if (mii.hSubMenu) 665 FileMenu_Destroy(mii.hSubMenu); 666 } 667 668 while (DeleteMenu (hmenu, 0, MF_BYPOSITION)){}; 669 670 menudata = FM_GetMenuInfo(hmenu); 671 672 menudata->bInitialized = FALSE; 673 674 return TRUE; 675 } 676 677 /************************************************************************* 678 * FileMenu_DeleteItemByCmd [SHELL32.] 680 679 * 681 680 */ 682 681 BOOL WINAPI FileMenu_DeleteItemByCmd (HMENU hMenu, UINT uID) 683 682 { 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 } 701 702 /************************************************************************* 703 * FileMenu_DeleteItemByIndex 683 MENUITEMINFOA mii; 684 685 TRACE("0x%08x 0x%08x\n", hMenu, uID); 686 687 ZeroMemory ( &mii, sizeof(MENUITEMINFOA)); 688 mii.cbSize = sizeof(MENUITEMINFOA); 689 mii.fMask = MIIM_SUBMENU; 690 691 GetMenuItemInfoA(hMenu, uID, FALSE, &mii ); 692 if ( mii.hSubMenu ) 693 { 694 /* FIXME: Do what? */ 695 } 696 697 DeleteMenu(hMenu, MF_BYCOMMAND, uID); 698 return TRUE; 699 } 700 701 /************************************************************************* 702 * FileMenu_DeleteItemByIndex [SHELL32.140] 704 703 */ 705 704 BOOL WINAPI FileMenu_DeleteItemByIndex ( HMENU hMenu, UINT uPos) 706 705 { 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 } 724 725 /************************************************************************* 726 * FileMenu_DeleteItemByFirstID 706 MENUITEMINFOA mii; 707 708 TRACE("0x%08x 0x%08x\n", hMenu, uPos); 709 710 ZeroMemory ( &mii, sizeof(MENUITEMINFOA)); 711 mii.cbSize = sizeof(MENUITEMINFOA); 712 mii.fMask = MIIM_SUBMENU; 713 714 GetMenuItemInfoA(hMenu, uPos, TRUE, &mii ); 715 if ( mii.hSubMenu ) 716 { 717 /* FIXME: Do what? */ 718 } 719 720 DeleteMenu(hMenu, MF_BYPOSITION, uPos); 721 return TRUE; 722 } 723 724 /************************************************************************* 725 * FileMenu_DeleteItemByFirstID [SHELL32.141] 727 726 */ 728 727 BOOL WINAPI FileMenu_DeleteItemByFirstID( 729 HMENUhMenu,730 UINTuID)731 { 732 733 734 } 735 736 /************************************************************************* 737 * FileMenu_DeleteSeparator 728 HMENU hMenu, 729 UINT uID) 730 { 731 TRACE("0x%08x 0x%08x\n", hMenu, uID); 732 return 0; 733 } 734 735 /************************************************************************* 736 * FileMenu_DeleteSeparator [SHELL32.142] 738 737 */ 739 738 BOOL WINAPI FileMenu_DeleteSeparator(HMENU hMenu) 740 739 { 741 742 743 } 744 745 /************************************************************************* 746 * FileMenu_EnableItemByCmd 740 TRACE("0x%08x\n", hMenu); 741 return 0; 742 } 743 744 /************************************************************************* 745 * FileMenu_EnableItemByCmd [SHELL32.143] 747 746 */ 748 747 BOOL WINAPI FileMenu_EnableItemByCmd( 749 HMENUhMenu,750 UINTuID,751 BOOLbEnable)752 { 753 754 755 } 756 757 /************************************************************************* 758 * FileMenu_GetItemExtent 759 * 748 HMENU hMenu, 749 UINT uID, 750 BOOL bEnable) 751 { 752 TRACE("0x%08x 0x%08x 0x%08x\n", hMenu, uID,bEnable); 753 return 0; 754 } 755 756 /************************************************************************* 757 * FileMenu_GetItemExtent [SHELL32.144] 758 * 760 759 * NOTES 761 760 * if the menu is to big, entrys are getting cut away!! 762 761 */ 763 762 DWORD WINAPI FileMenu_GetItemExtent (HMENU hMenu, UINT uPos) 764 { 765 766 767 768 769 770 771 772 773 774 } 775 776 /************************************************************************* 777 * FileMenu_AbortInitMenu 763 { RECT rect; 764 765 FIXME("0x%08x 0x%08x\n", hMenu, uPos); 766 767 if (GetMenuItemRect(0, hMenu, uPos, &rect)) 768 { FIXME("0x%04x 0x%04x 0x%04x 0x%04x\n", 769 rect.right, rect.left, rect.top, rect.bottom); 770 return ((rect.right-rect.left)<<16) + (rect.top-rect.bottom); 771 } 772 return 0x00100010; /*fixme*/ 773 } 774 775 /************************************************************************* 776 * FileMenu_AbortInitMenu [SHELL32.120] 778 777 * 779 778 */ 780 779 void WINAPI FileMenu_AbortInitMenu (void) 781 { 782 783 } 784 785 /************************************************************************* 786 * SHFind_InitMenuPopup 780 { TRACE("\n"); 781 bAbortInit = TRUE; 782 } 783 784 /************************************************************************* 785 * SHFind_InitMenuPopup [SHELL32.149] 787 786 * 788 787 * 789 788 * PARAMETERS 790 * hMenu 791 * hWndParent 792 * w 793 * x 789 * hMenu [in] handle of menu previously created 790 * hWndParent [in] parent window 791 * w [in] no pointer (0x209 over here) perhaps menu IDs ??? 792 * x [in] no pointer (0x226 over here) 794 793 * 795 794 * RETURNS 796 * LPXXXXX 797 * 795 * LPXXXXX pointer to struct containing a func addr at offset 8 796 * or NULL at failure. 798 797 */ 799 798 LPVOID WINAPI SHFind_InitMenuPopup (HMENU hMenu, HWND hWndParent, DWORD w, DWORD x) 800 { 801 802 803 } 804 805 /************************************************************************* 806 * Shell_MergeMenus 799 { FIXME("hmenu=0x%08x hwnd=0x%08x 0x%08lx 0x%08lx stub\n", 800 hMenu,hWndParent,w,x); 801 return NULL; /* this is supposed to be a pointer */ 802 } 803 804 /************************************************************************* 805 * Shell_MergeMenus [SHELL32.67] 807 806 * 808 807 */ 809 808 BOOL _SHIsMenuSeparator(HMENU hm, int i) 810 809 { 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 810 MENUITEMINFOA mii; 811 812 mii.cbSize = sizeof(MENUITEMINFOA); 813 mii.fMask = MIIM_TYPE; 814 mii.cch = 0; /* WARNING: We MUST initialize it to 0*/ 815 if (!GetMenuItemInfoA(hm, i, TRUE, &mii)) 816 { 817 return(FALSE); 818 } 819 820 if (mii.fType & MFT_SEPARATOR) 821 { 822 return(TRUE); 823 } 824 825 return(FALSE); 827 826 } 828 827 … … 830 829 831 830 HRESULT WINAPI Shell_MergeMenus (HMENU hmDst, HMENU hmSrc, UINT uInsert, UINT uIDAdjust, UINT uIDAdjustMax, ULONG uFlags) 832 { intnItem;833 HMENUhmSubMenu;834 BOOLbAlreadySeparated;835 MENUITEMINFOAmiiSrc;836 charszName[256];837 UINTuTemp, uIDMax = uIDAdjust;838 839 840 841 842 843 844 845 846 847 848 if (uInsert >= (UINT)nItem)/* insert position inside menu? */849 850 uInsert = (UINT)nItem;/* append on the end */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 /* 831 { int nItem; 832 HMENU hmSubMenu; 833 BOOL bAlreadySeparated; 834 MENUITEMINFOA miiSrc; 835 char szName[256]; 836 UINT uTemp, uIDMax = uIDAdjust; 837 838 TRACE("hmenu1=0x%04x hmenu2=0x%04x 0x%04x 0x%04x 0x%04x 0x%04lx\n", 839 hmDst, hmSrc, uInsert, uIDAdjust, uIDAdjustMax, uFlags); 840 841 if (!hmDst || !hmSrc) 842 { return uIDMax; 843 } 844 845 nItem = GetMenuItemCount(hmDst); 846 847 if (uInsert >= (UINT)nItem) /* insert position inside menu? */ 848 { 849 uInsert = (UINT)nItem; /* append on the end */ 850 bAlreadySeparated = TRUE; 851 } 852 else 853 { 854 bAlreadySeparated = _SHIsMenuSeparator(hmDst, uInsert);; 855 } 856 857 if ((uFlags & MM_ADDSEPARATOR) && !bAlreadySeparated) 858 { 859 /* Add a separator between the menus */ 860 InsertMenuA(hmDst, uInsert, MF_BYPOSITION | MF_SEPARATOR, 0, NULL); 861 bAlreadySeparated = TRUE; 862 } 863 864 865 /* Go through the menu items and clone them*/ 866 for (nItem = GetMenuItemCount(hmSrc) - 1; nItem >= 0; nItem--) 867 { 868 miiSrc.cbSize = sizeof(MENUITEMINFOA); 869 miiSrc.fMask = MIIM_STATE | MIIM_ID | MIIM_SUBMENU | MIIM_CHECKMARKS | MIIM_TYPE | MIIM_DATA; 870 871 /* We need to reset this every time through the loop in case menus DON'T have IDs*/ 872 miiSrc.fType = MFT_STRING; 873 miiSrc.dwTypeData = szName; 874 miiSrc.dwItemData = 0; 875 miiSrc.cch = sizeof(szName); 876 877 if (!GetMenuItemInfoA(hmSrc, nItem, TRUE, &miiSrc)) 878 { 879 continue; 880 } 881 882 /* TRACE("found menu=0x%04x %s id=0x%04x mask=0x%08x smenu=0x%04x\n", hmSrc, debugstr_a(miiSrc.dwTypeData), miiSrc.wID, miiSrc.fMask, miiSrc.hSubMenu); 884 883 */ 885 886 887 888 889 890 891 892 893 894 895 896 897 miiSrc.wID += uIDAdjust;/* add uIDAdjust to the ID */898 899 if (miiSrc.wID > uIDAdjustMax)/* skip ID's higher uIDAdjustMax */900 901 902 if (uIDMax <= miiSrc.wID)/* remember the highest ID */903 904 905 906 907 miiSrc.fMask &= ~MIIM_ID;/* Don't set IDs for submenus that didn't have them already */908 909 910 911 912 913 914 915 916 917 918 919 920 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 928 929 if (uIDMax <= miiSrc.wID)/* remember the highest ID */930 931 932 933 934 935 /* 884 if (miiSrc.fType & MFT_SEPARATOR) 885 { 886 /* This is a separator; don't put two of them in a row */ 887 if (bAlreadySeparated) 888 continue; 889 890 bAlreadySeparated = TRUE; 891 } 892 else if (miiSrc.hSubMenu) 893 { 894 if (uFlags & MM_SUBMENUSHAVEIDS) 895 { 896 miiSrc.wID += uIDAdjust; /* add uIDAdjust to the ID */ 897 898 if (miiSrc.wID > uIDAdjustMax) /* skip ID's higher uIDAdjustMax */ 899 continue; 900 901 if (uIDMax <= miiSrc.wID) /* remember the highest ID */ 902 uIDMax = miiSrc.wID + 1; 903 } 904 else 905 { 906 miiSrc.fMask &= ~MIIM_ID; /* Don't set IDs for submenus that didn't have them already */ 907 } 908 hmSubMenu = miiSrc.hSubMenu; 909 910 miiSrc.hSubMenu = CreatePopupMenu(); 911 912 if (!miiSrc.hSubMenu) return(uIDMax); 913 914 uTemp = Shell_MergeMenus(miiSrc.hSubMenu, hmSubMenu, 0, uIDAdjust, uIDAdjustMax, uFlags & MM_SUBMENUSHAVEIDS); 915 916 if (uIDMax <= uTemp) 917 uIDMax = uTemp; 918 919 bAlreadySeparated = FALSE; 920 } 921 else /* normal menu item */ 922 { 923 miiSrc.wID += uIDAdjust; /* add uIDAdjust to the ID */ 924 925 if (miiSrc.wID > uIDAdjustMax) /* skip ID's higher uIDAdjustMax */ 926 continue; 927 928 if (uIDMax <= miiSrc.wID) /* remember the highest ID */ 929 uIDMax = miiSrc.wID + 1; 930 931 bAlreadySeparated = FALSE; 932 } 933 934 /* TRACE("inserting menu=0x%04x %s id=0x%04x mask=0x%08x smenu=0x%04x\n", hmDst, debugstr_a(miiSrc.dwTypeData), miiSrc.wID, miiSrc.fMask, miiSrc.hSubMenu); 936 935 */ 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 } 972 936 if (!InsertMenuItemA(hmDst, uInsert, TRUE, &miiSrc)) 937 { 938 return(uIDMax); 939 } 940 } 941 942 /* Ensure the correct number of separators at the beginning of the 943 inserted menu items*/ 944 if (uInsert == 0) 945 { 946 if (bAlreadySeparated) 947 { 948 DeleteMenu(hmDst, uInsert, MF_BYPOSITION); 949 } 950 } 951 else 952 { 953 if (_SHIsMenuSeparator(hmDst, uInsert-1)) 954 { 955 if (bAlreadySeparated) 956 { 957 DeleteMenu(hmDst, uInsert, MF_BYPOSITION); 958 } 959 } 960 else 961 { 962 if ((uFlags & MM_ADDSEPARATOR) && !bAlreadySeparated) 963 { 964 /* Add a separator between the menus*/ 965 InsertMenuA(hmDst, uInsert, MF_BYPOSITION | MF_SEPARATOR, 0, NULL); 966 } 967 } 968 } 969 return(uIDMax); 970 } 971 -
trunk/src/shell32/shlview.c
r6650 r6709 1 /* $Id: shlview.c,v 1.3 2001-09-05 13:46:59 bird Exp $ */2 1 /* 3 * 2 * ShellView 4 3 * 5 * Copyright 1998,1999<juergen.schmied@debitel.net>4 * Copyright 1998,1999 <juergen.schmied@debitel.net> 6 5 * 7 6 * This is the view visualizing the data provied by the shellfolder. 8 * No direct access to data from pidls should be done from here. 9 * 7 * No direct access to data from pidls should be done from here. 8 * 10 9 * FIXME: The order by part of the background context menu should be 11 10 * buily according to the columns shown. … … 21 20 * 22 21 * FIXME: when the ShellView_WndProc gets a WM_NCDESTROY should we do a 23 * Release() ??? 22 * Release() ??? 24 23 */ 25 24 … … 50 49 }LISTVIEW_SORT_INFO, *LPLISTVIEW_SORT_INFO; 51 50 52 typedef struct 53 { 54 DWORDref;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 HWNDhWndParent;66 FOLDERSETTINGSFolderSettings;67 HMENUhMenu;68 UINTuState;69 UINTcidl;70 LPITEMIDLIST*apidl;51 typedef struct 52 { ICOM_VFIELD(IShellView); 53 DWORD ref; 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 HWND hWndParent; 65 FOLDERSETTINGS FolderSettings; 66 HMENU hMenu; 67 UINT uState; 68 UINT cidl; 69 LPITEMIDLIST *apidl; 71 70 LISTVIEW_SORT_INFO ListViewSortInfo; 72 HANDLE hNotify;/* change notification handle */73 HANDLEhAccel;71 HANDLE hNotify; /* change notification handle */ 72 HANDLE hAccel; 74 73 } IShellViewImpl; 75 74 … … 77 76 78 77 static struct ICOM_VTABLE(IOleCommandTarget) ctvt; 79 #define _IOleCommandTarget_Offset ((int)(&(((IShellViewImpl*)0)->lpvtblOleCommandTarget))) 80 #define _ICOM_THIS_From_IOleCommandTarget(class, name) class* This = (class*)(((char*)name)-_IOleCommandTarget_Offset); 78 #define _IOleCommandTarget_Offset ((int)(&(((IShellViewImpl*)0)->lpvtblOleCommandTarget))) 79 #define _ICOM_THIS_From_IOleCommandTarget(class, name) class* This = (class*)(((char*)name)-_IOleCommandTarget_Offset); 81 80 82 81 static struct ICOM_VTABLE(IDropTarget) dtvt; 83 #define _IDropTarget_Offset ((int)(&(((IShellViewImpl*)0)->lpvtblDropTarget))) 84 #define _ICOM_THIS_From_IDropTarget(class, name) class* This = (class*)(((char*)name)-_IDropTarget_Offset); 82 #define _IDropTarget_Offset ((int)(&(((IShellViewImpl*)0)->lpvtblDropTarget))) 83 #define _ICOM_THIS_From_IDropTarget(class, name) class* This = (class*)(((char*)name)-_IDropTarget_Offset); 85 84 86 85 static struct ICOM_VTABLE(IDropSource) dsvt; 87 #define _IDropSource_Offset ((int)(&(((IShellViewImpl*)0)->lpvtblDropSource))) 88 #define _ICOM_THIS_From_IDropSource(class, name) class* This = (class*)(((char*)name)-_IDropSource_Offset); 86 #define _IDropSource_Offset ((int)(&(((IShellViewImpl*)0)->lpvtblDropSource))) 87 #define _ICOM_THIS_From_IDropSource(class, name) class* This = (class*)(((char*)name)-_IDropSource_Offset); 89 88 90 89 static struct ICOM_VTABLE(IViewObject) vovt; 91 #define _IViewObject_Offset ((int)(&(((IShellViewImpl*)0)->lpvtblViewObject))) 92 #define _ICOM_THIS_From_IViewObject(class, name) class* This = (class*)(((char*)name)-_IViewObject_Offset); 90 #define _IViewObject_Offset ((int)(&(((IShellViewImpl*)0)->lpvtblViewObject))) 91 #define _ICOM_THIS_From_IViewObject(class, name) class* This = (class*)(((char*)name)-_IViewObject_Offset); 93 92 94 93 /* ListView Header ID's */ … … 113 112 #define GET_WM_COMMAND_CMD(wp, lp) HIWORD(wp) 114 113 115 extern void WINAPI _InsertMenuItem (HMENU hmenu, UINT indexMenu, BOOL fByPosition, 116 114 extern void WINAPI _InsertMenuItem (HMENU hmenu, UINT indexMenu, BOOL fByPosition, 115 UINT wID, UINT fType, LPSTR dwTypeData, UINT fState); 117 116 118 117 /* … … 128 127 } MYTOOLINFO, *LPMYTOOLINFO; 129 128 130 MYTOOLINFO Tools[] = 129 MYTOOLINFO Tools[] = 131 130 { 132 131 { FCIDM_SHVIEW_BIGICON, 0, 0, IDS_VIEW_LARGE, TBSTATE_ENABLED, TBSTYLE_BUTTON }, … … 144 143 145 144 /********************************************************** 146 * 145 * IShellView_Constructor 147 146 */ 148 147 IShellView * IShellView_Constructor( IShellFolder * pFolder) 149 { 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 148 { IShellViewImpl * sv; 149 sv=(IShellViewImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IShellViewImpl)); 150 sv->ref=1; 151 ICOM_VTBL(sv)=&svvt; 152 sv->lpvtblOleCommandTarget=&ctvt; 153 sv->lpvtblDropTarget=&dtvt; 154 sv->lpvtblDropSource=&dsvt; 155 sv->lpvtblViewObject=&vovt; 156 157 sv->pSFParent = pFolder; 158 if(pFolder) IShellFolder_AddRef(pFolder); 159 IShellFolder_QueryInterface(sv->pSFParent, &IID_IShellFolder2, (LPVOID*)&sv->pSF2Parent); 160 161 TRACE("(%p)->(%p)\n",sv, pFolder); 162 shell32_ObjCount++; 163 return (IShellView *) sv; 165 164 } 166 165 … … 170 169 */ 171 170 static BOOL IsInCommDlg(IShellViewImpl * This) 172 { 171 { return(This->pCommDlgBrowser != NULL); 173 172 } 174 173 175 174 static HRESULT IncludeObject(IShellViewImpl * This, LPCITEMIDLIST pidl) 176 175 { 177 178 179 180 181 182 183 184 185 176 HRESULT ret = S_OK; 177 178 if ( IsInCommDlg(This) ) 179 { 180 TRACE("ICommDlgBrowser::IncludeObject pidl=%p\n", pidl); 181 ret = ICommDlgBrowser_IncludeObject(This->pCommDlgBrowser, (IShellView*)This, pidl); 182 TRACE("--0x%08lx\n", ret); 183 } 184 return ret; 186 185 } 187 186 188 187 static HRESULT OnDefaultCommand(IShellViewImpl * This) 189 188 { 190 191 192 193 194 195 196 197 198 189 HRESULT ret = S_FALSE; 190 191 if (IsInCommDlg(This)) 192 { 193 TRACE("ICommDlgBrowser::OnDefaultCommand\n"); 194 ret = ICommDlgBrowser_OnDefaultCommand(This->pCommDlgBrowser, (IShellView*)This); 195 TRACE("--\n"); 196 } 197 return ret; 199 198 } 200 199 201 200 static HRESULT OnStateChange(IShellViewImpl * This, UINT uFlags) 202 201 { 203 204 205 206 207 208 209 210 211 212 } 213 /********************************************************** 214 * 202 HRESULT ret = S_FALSE; 203 204 if (IsInCommDlg(This)) 205 { 206 TRACE("ICommDlgBrowser::OnStateChange flags=%x\n", uFlags); 207 ret = ICommDlgBrowser_OnStateChange(This->pCommDlgBrowser, (IShellView*)This, uFlags); 208 TRACE("--\n"); 209 } 210 return ret; 211 } 212 /********************************************************** 213 * set the toolbar of the filedialog buttons 215 214 * 216 * - activates the buttons from the shellbrowser according to 215 * - activates the buttons from the shellbrowser according to 217 216 * the view state 218 217 */ 219 218 static void CheckToolbar(IShellViewImpl * This) 220 219 { 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 220 LRESULT result; 221 222 TRACE("\n"); 223 224 if (IsInCommDlg(This)) 225 { 226 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_TOOLBAR, TB_CHECKBUTTON, 227 FCIDM_TB_SMALLICON, (This->FolderSettings.ViewMode==FVM_LIST)? TRUE : FALSE, &result); 228 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_TOOLBAR, TB_CHECKBUTTON, 229 FCIDM_TB_REPORTVIEW, (This->FolderSettings.ViewMode==FVM_DETAILS)? TRUE : FALSE, &result); 230 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_TOOLBAR, TB_ENABLEBUTTON, 231 FCIDM_TB_SMALLICON, TRUE, &result); 232 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_TOOLBAR, TB_ENABLEBUTTON, 233 FCIDM_TB_REPORTVIEW, TRUE, &result); 234 } 236 235 } 237 236 … … 241 240 */ 242 241 /********************************************************** 243 * 242 * change the style of the listview control 244 243 */ 245 244 static void SetStyle(IShellViewImpl * This, DWORD dwAdd, DWORD dwRemove) 246 245 { 247 248 249 250 251 252 246 DWORD tmpstyle; 247 248 TRACE("(%p)\n", This); 249 250 tmpstyle = GetWindowLongA(This->hWndList, GWL_STYLE); 251 SetWindowLongA(This->hWndList, GWL_STYLE, dwAdd | (tmpstyle & ~dwRemove)); 253 252 } 254 253 … … 259 258 */ 260 259 static BOOL ShellView_CreateList (IShellViewImpl * This) 261 { 262 263 264 265 266 267 268 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 279 if (This->FolderSettings.fFlags & FWF_SINGLESEL)dwStyle |= LVS_SINGLESEL;280 281 282 283 284 285 286 287 288 289 290 291 292 260 { DWORD dwStyle; 261 262 TRACE("%p\n",This); 263 264 dwStyle = WS_TABSTOP | WS_VISIBLE | WS_CHILDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | 265 LVS_SHAREIMAGELISTS | LVS_EDITLABELS | LVS_ALIGNLEFT | LVS_AUTOARRANGE; 266 267 switch (This->FolderSettings.ViewMode) 268 { 269 case FVM_ICON: dwStyle |= LVS_ICON; break; 270 case FVM_DETAILS: dwStyle |= LVS_REPORT; break; 271 case FVM_SMALLICON: dwStyle |= LVS_SMALLICON; break; 272 case FVM_LIST: dwStyle |= LVS_LIST; break; 273 default: dwStyle |= LVS_LIST; break; 274 } 275 276 if (This->FolderSettings.fFlags & FWF_AUTOARRANGE) dwStyle |= LVS_AUTOARRANGE; 277 /*if (This->FolderSettings.fFlags && FWF_DESKTOP); used from explorer*/ 278 if (This->FolderSettings.fFlags & FWF_SINGLESEL) dwStyle |= LVS_SINGLESEL; 279 280 This->hWndList=CreateWindowExA( WS_EX_CLIENTEDGE, 281 WC_LISTVIEWA, 282 NULL, 283 dwStyle, 284 0,0,0,0, 285 This->hWnd, 286 (HMENU)ID_LISTVIEW, 287 shell32_hInstance, 288 NULL); 289 290 if(!This->hWndList) 291 return FALSE; 293 292 294 293 This->ListViewSortInfo.bIsAscending = TRUE; … … 297 296 298 297 /* UpdateShellSettings(); */ 299 298 return TRUE; 300 299 } 301 300 … … 307 306 static BOOL ShellView_InitList(IShellViewImpl * This) 308 307 { 309 LVCOLUMNAlvColumn;310 SHELLDETAILSsd;311 inti;312 charszTemp[50];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 * ShellView_CompareItems() 308 LVCOLUMNA lvColumn; 309 SHELLDETAILS sd; 310 int i; 311 char szTemp[50]; 312 313 TRACE("%p\n",This); 314 315 ListView_DeleteAllItems(This->hWndList); 316 317 lvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT; 318 lvColumn.pszText = szTemp; 319 320 if (This->pSF2Parent) 321 { 322 for (i=0; 1; i++) 323 { 324 if (!SUCCEEDED(IShellFolder2_GetDetailsOf(This->pSF2Parent, NULL, i, &sd))) 325 break; 326 lvColumn.fmt = sd.fmt; 327 lvColumn.cx = sd.cxChar*8; /* chars->pixel */ 328 StrRetToStrNA( szTemp, 50, &sd.str, NULL); 329 ListView_InsertColumnA(This->hWndList, i, &lvColumn); 330 } 331 } 332 else 333 { 334 FIXME("no SF2\n"); 335 } 336 337 ListView_SetImageList(This->hWndList, ShellSmallIconList, LVSIL_SMALL); 338 ListView_SetImageList(This->hWndList, ShellBigIconList, LVSIL_NORMAL); 339 340 return TRUE; 341 } 342 /********************************************************** 343 * ShellView_CompareItems() 345 344 * 346 345 * NOTES 347 346 * internal, CALLBACK for DSA_Sort 348 */ 347 */ 349 348 static INT CALLBACK ShellView_CompareItems(LPVOID lParam1, LPVOID lParam2, LPARAM lpData) 350 349 { 351 352 353 354 355 356 ret = (SHORT) SCODE_CODE(IShellFolder_CompareIDs((LPSHELLFOLDER)lpData, 0, (LPITEMIDLIST)lParam1, (LPITEMIDLIST)lParam2)); 357 358 350 int ret; 351 TRACE("pidl1=%p pidl2=%p lpsf=%p\n", lParam1, lParam2, (LPVOID) lpData); 352 353 if(!lpData) return 0; 354 355 ret = (SHORT) SCODE_CODE(IShellFolder_CompareIDs((LPSHELLFOLDER)lpData, 0, (LPITEMIDLIST)lParam1, (LPITEMIDLIST)lParam2)); 356 TRACE("ret=%i\n",ret); 357 return ret; 359 358 } 360 359 … … 370 369 * 371 370 * RETURNS 372 * A negative value if the first item should precede the second, 373 * a positive value if the first item should follow the second, 371 * A negative value if the first item should precede the second, 372 * a positive value if the first item should follow the second, 374 373 * or zero if the two items are equivalent 375 374 * 376 375 * NOTES 377 * 378 * 379 * 380 * move this code to IShellFolder.381 * 382 * the way this function works is only usable if we had only383 * 376 * FIXME: function does what ShellView_CompareItems is supposed to do. 377 * unify it and figure out how to use the undocumented first parameter 378 * of IShellFolder_CompareIDs to do the job this function does and 379 * move this code to IShellFolder. 380 * make LISTVIEW_SORT_INFO obsolete 381 * the way this function works is only usable if we had only 382 * filesystemfolders (25/10/99 jsch) 384 383 */ 385 384 static INT CALLBACK ShellView_ListViewCompareItems(LPVOID lParam1, LPVOID lParam2, LPARAM lpData) … … 404 403 } 405 404 else 406 { 405 { 407 406 /* Sort by Time: Folders or Files can be sorted */ 408 407 409 408 if(pSortInfo->nHeaderID == LISTVIEW_COLUMN_TIME) 410 409 { … … 443 442 } 444 443 /* If the Date, FileSize, FileType, Attrib was the same, sort by FileName */ 445 444 446 445 if(nDiff == 0) 447 446 { … … 462 461 /********************************************************** 463 462 * LV_FindItemByPidl() 464 */ 463 */ 465 464 static int LV_FindItemByPidl( 466 467 468 { 469 470 471 472 473 474 475 476 477 478 479 480 481 465 IShellViewImpl * This, 466 LPCITEMIDLIST pidl) 467 { 468 LVITEMA lvItem; 469 ZeroMemory(&lvItem, sizeof(LVITEMA)); 470 lvItem.mask = LVIF_PARAM; 471 for(lvItem.iItem = 0; ListView_GetItemA(This->hWndList, &lvItem); lvItem.iItem++) 472 { 473 LPITEMIDLIST currentpidl = (LPITEMIDLIST) lvItem.lParam; 474 HRESULT hr = IShellFolder_CompareIDs(This->pSFParent, 0, pidl, currentpidl); 475 if(SUCCEEDED(hr) && !HRESULT_CODE(hr)) 476 { 477 return lvItem.iItem; 478 } 479 } 480 return -1; 482 481 } 483 482 … … 487 486 static BOOLEAN LV_AddItem(IShellViewImpl * This, LPCITEMIDLIST pidl) 488 487 { 489 LVITEMAlvItem;490 491 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 488 LVITEMA lvItem; 489 490 TRACE("(%p)(pidl=%p)\n", This, pidl); 491 492 ZeroMemory(&lvItem, sizeof(lvItem)); /* create the listview item*/ 493 lvItem.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM; /*set the mask*/ 494 lvItem.iItem = ListView_GetItemCount(This->hWndList); /*add the item to the end of the list*/ 495 lvItem.lParam = (LPARAM) ILClone(ILFindLastID(pidl)); /*set the item's data*/ 496 lvItem.pszText = LPSTR_TEXTCALLBACKA; /*get text on a callback basis*/ 497 lvItem.iImage = I_IMAGECALLBACK; /*get the image on a callback basis*/ 498 return (-1==ListView_InsertItemA(This->hWndList, &lvItem))? FALSE: TRUE; 500 499 } 501 500 … … 505 504 static BOOLEAN LV_DeleteItem(IShellViewImpl * This, LPCITEMIDLIST pidl) 506 505 { 507 508 509 510 511 512 506 int nIndex; 507 508 TRACE("(%p)(pidl=%p)\n", This, pidl); 509 510 nIndex = LV_FindItemByPidl(This, ILFindLastID(pidl)); 511 return (-1==ListView_DeleteItem(This->hWndList, nIndex))? FALSE: TRUE; 513 512 } 514 513 … … 518 517 static BOOLEAN LV_RenameItem(IShellViewImpl * This, LPCITEMIDLIST pidlOld, LPCITEMIDLIST pidlNew ) 519 518 { 520 521 522 523 524 525 526 527 528 ZeroMemory(&lvItem, sizeof(lvItem));/* create the listview item*/529 lvItem.mask = LVIF_PARAM;/* only the pidl */530 531 532 533 534 535 536 lvItem.lParam = (LPARAM) ILClone(ILFindLastID(pidlNew));/* set the item's data */537 538 539 return TRUE;/* fixme: better handling */540 541 519 int nItem; 520 LVITEMA lvItem; 521 522 TRACE("(%p)(pidlold=%p pidlnew=%p)\n", This, pidlOld, pidlNew); 523 524 nItem = LV_FindItemByPidl(This, ILFindLastID(pidlOld)); 525 if ( -1 != nItem ) 526 { 527 ZeroMemory(&lvItem, sizeof(lvItem)); /* create the listview item*/ 528 lvItem.mask = LVIF_PARAM; /* only the pidl */ 529 lvItem.iItem = nItem; 530 ListView_GetItemA(This->hWndList, &lvItem); 531 532 SHFree((LPITEMIDLIST)lvItem.lParam); 533 lvItem.mask = LVIF_PARAM; 534 lvItem.iItem = nItem; 535 lvItem.lParam = (LPARAM) ILClone(ILFindLastID(pidlNew)); /* set the item's data */ 536 ListView_SetItemA(This->hWndList, &lvItem); 537 ListView_Update(This->hWndList, nItem); 538 return TRUE; /* fixme: better handling */ 539 } 540 return FALSE; 542 541 } 543 542 /********************************************************** … … 547 546 * - sorts the list 548 547 * - fills the list into the view 549 */ 548 */ 550 549 551 550 static HRESULT ShellView_FillList(IShellViewImpl * This) 552 551 { 553 LPENUMIDLISTpEnumIDList;554 LPITEMIDLISTpidl;555 DWORDdwFetched;556 UINTi;557 HRESULThRes;558 HDPAhdpa;559 560 561 562 /* get the itemlist from the shfolder*/ 563 564 565 566 567 568 569 570 571 /* create a pointer array */ 572 573 574 575 576 577 578 579 580 581 582 583 584 } 585 586 587 588 589 590 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 596 597 598 599 600 601 602 603 604 605 606 607 608 609 552 LPENUMIDLIST pEnumIDList; 553 LPITEMIDLIST pidl; 554 DWORD dwFetched; 555 UINT i; 556 HRESULT hRes; 557 HDPA hdpa; 558 559 TRACE("%p\n",This); 560 561 /* get the itemlist from the shfolder*/ 562 hRes = IShellFolder_EnumObjects(This->pSFParent,This->hWnd, SHCONTF_NONFOLDERS | SHCONTF_FOLDERS, &pEnumIDList); 563 if (hRes != S_OK) 564 { 565 if (hRes==S_FALSE) 566 return(NOERROR); 567 return(hRes); 568 } 569 570 /* create a pointer array */ 571 hdpa = pDPA_Create(16); 572 if (!hdpa) 573 { 574 return(E_OUTOFMEMORY); 575 } 576 577 /* copy the items into the array*/ 578 while((S_OK == IEnumIDList_Next(pEnumIDList,1, &pidl, &dwFetched)) && dwFetched) 579 { 580 if (pDPA_InsertPtr(hdpa, 0x7fff, pidl) == -1) 581 { 582 SHFree(pidl); 583 } 584 } 585 586 /* sort the array */ 587 pDPA_Sort(hdpa, ShellView_CompareItems, (LPARAM)This->pSFParent); 588 589 /*turn the listview's redrawing off*/ 590 SendMessageA(This->hWndList, WM_SETREDRAW, FALSE, 0); 591 592 for (i=0; i < DPA_GetPtrCount(hdpa); ++i) /* DPA_GetPtrCount is a macro*/ 593 { 594 pidl = (LPITEMIDLIST)pDPA_GetPtr(hdpa, i); 595 596 /* in a commdlg This works as a filemask*/ 597 if ( IncludeObject(This, pidl)==S_OK ) 598 LV_AddItem(This, pidl); 599 SHFree(pidl); 600 } 601 602 /*turn the listview's redrawing back on and force it to draw*/ 603 SendMessageA(This->hWndList, WM_SETREDRAW, TRUE, 0); 604 605 IEnumIDList_Release(pEnumIDList); /* destroy the list*/ 606 pDPA_Destroy(hdpa); 607 608 return S_OK; 610 609 } 611 610 612 611 /********************************************************** 613 612 * ShellView_OnCreate() 614 */ 613 */ 615 614 static LRESULT ShellView_OnCreate(IShellViewImpl * This) 616 615 { 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 /********************************************************** 657 * 616 IDropTarget* pdt; 617 NOTIFYREGISTER ntreg; 618 IPersistFolder2 * ppf2 = NULL; 619 620 TRACE("%p\n",This); 621 622 if(ShellView_CreateList(This)) 623 { 624 if(ShellView_InitList(This)) 625 { 626 ShellView_FillList(This); 627 } 628 } 629 630 if(GetShellOle()) 631 { 632 if (SUCCEEDED(IShellFolder_CreateViewObject(This->pSFParent, This->hWnd, &IID_IDropTarget, (LPVOID*)&pdt))) 633 { 634 pRegisterDragDrop(This->hWnd, pdt); 635 IDropTarget_Release(pdt); 636 } 637 } 638 639 /* register for receiving notifications */ 640 IShellFolder_QueryInterface(This->pSFParent, &IID_IPersistFolder2, (LPVOID*)&ppf2); 641 if (ppf2) 642 { 643 IPersistFolder2_GetCurFolder(ppf2, &ntreg.pidlPath); 644 ntreg.bWatchSubtree = FALSE; 645 This->hNotify = SHChangeNotifyRegister(This->hWnd, SHCNF_IDLIST, SHCNE_ALLEVENTS, SHV_CHANGE_NOTIFY, 1, &ntreg); 646 SHFree(ntreg.pidlPath); 647 IPersistFolder2_Release(ppf2); 648 } 649 650 This->hAccel = LoadAcceleratorsA(shell32_hInstance, "shv_accel"); 651 652 return S_OK; 653 } 654 655 /********************************************************** 656 * #### Handling of the menus #### 658 657 */ 659 658 … … 662 661 */ 663 662 static HMENU ShellView_BuildFileMenu(IShellViewImpl * This) 664 { CHARszText[MAX_PATH];665 MENUITEMINFOAmii;666 intnTools,i;667 HMENUhSubMenu;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 701 663 { CHAR szText[MAX_PATH]; 664 MENUITEMINFOA mii; 665 int nTools,i; 666 HMENU hSubMenu; 667 668 TRACE("(%p)\n",This); 669 670 hSubMenu = CreatePopupMenu(); 671 if(hSubMenu) 672 { /*get the number of items in our global array*/ 673 for(nTools = 0; Tools[nTools].idCommand != -1; nTools++){} 674 675 /*add the menu items*/ 676 for(i = 0; i < nTools; i++) 677 { 678 LoadStringA(shell32_hInstance, Tools[i].idMenuString, szText, MAX_PATH); 679 680 ZeroMemory(&mii, sizeof(mii)); 681 mii.cbSize = sizeof(mii); 682 mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE; 683 684 if(TBSTYLE_SEP != Tools[i].bStyle) /* no seperator*/ 685 { 686 mii.fType = MFT_STRING; 687 mii.fState = MFS_ENABLED; 688 mii.dwTypeData = szText; 689 mii.wID = Tools[i].idCommand; 690 } 691 else 692 { 693 mii.fType = MFT_SEPARATOR; 694 } 695 /* tack This item onto the end of the menu */ 696 InsertMenuItemA(hSubMenu, (UINT)-1, TRUE, &mii); 697 } 698 } 699 TRACE("-- return (menu=0x%x)\n",hSubMenu); 700 return hSubMenu; 702 701 } 703 702 /********************************************************** … … 705 704 */ 706 705 static void ShellView_MergeFileMenu(IShellViewImpl * This, HMENU hSubMenu) 707 { 708 709 710 711 712 713 714 715 TRACE("--\n"); 706 { TRACE("(%p)->(submenu=0x%08x) stub\n",This,hSubMenu); 707 708 if(hSubMenu) 709 { /*insert This item at the beginning of the menu */ 710 _InsertMenuItem(hSubMenu, 0, TRUE, 0, MFT_SEPARATOR, NULL, MFS_ENABLED); 711 _InsertMenuItem(hSubMenu, 0, TRUE, IDM_MYFILEITEM, MFT_STRING, "dummy45", MFS_ENABLED); 712 713 } 714 TRACE("--\n"); 716 715 } 717 716 … … 721 720 722 721 static void ShellView_MergeViewMenu(IShellViewImpl * This, HMENU hSubMenu) 723 { MENUITEMINFOAmii;724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 722 { MENUITEMINFOA mii; 723 724 TRACE("(%p)->(submenu=0x%08x)\n",This,hSubMenu); 725 726 if(hSubMenu) 727 { /*add a separator at the correct position in the menu*/ 728 _InsertMenuItem(hSubMenu, FCIDM_MENU_VIEW_SEP_OPTIONS, FALSE, 0, MFT_SEPARATOR, NULL, MFS_ENABLED); 729 730 ZeroMemory(&mii, sizeof(mii)); 731 mii.cbSize = sizeof(mii); 732 mii.fMask = MIIM_SUBMENU | MIIM_TYPE | MIIM_DATA;; 733 mii.fType = MFT_STRING; 734 mii.dwTypeData = "View"; 735 mii.hSubMenu = LoadMenuA(shell32_hInstance, "MENU_001"); 736 InsertMenuItemA(hSubMenu, FCIDM_MENU_VIEW_SEP_OPTIONS, FALSE, &mii); 737 } 739 738 } 740 739 … … 746 745 * RETURNS 747 746 * number of selected items 748 */ 747 */ 749 748 static UINT ShellView_GetSelections(IShellViewImpl * This) 750 749 { 751 LVITEMAlvItem;752 UINTi = 0;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 * 750 LVITEMA lvItem; 751 UINT i = 0; 752 753 if (This->apidl) 754 { 755 SHFree(This->apidl); 756 } 757 758 This->cidl = ListView_GetSelectedCount(This->hWndList); 759 This->apidl = (LPITEMIDLIST*)SHAlloc(This->cidl * sizeof(LPITEMIDLIST)); 760 761 TRACE("selected=%i\n", This->cidl); 762 763 if(This->apidl) 764 { 765 TRACE("-- Items selected =%u\n", This->cidl); 766 767 ZeroMemory(&lvItem, sizeof(lvItem)); 768 lvItem.mask = LVIF_STATE | LVIF_PARAM; 769 lvItem.stateMask = LVIS_SELECTED; 770 771 while(ListView_GetItemA(This->hWndList, &lvItem) && (i < This->cidl)) 772 { 773 if(lvItem.state & LVIS_SELECTED) 774 { 775 This->apidl[i] = (LPITEMIDLIST)lvItem.lParam; 776 i++; 777 TRACE("-- selected Item found\n"); 778 } 779 lvItem.iItem++; 780 } 781 } 782 return This->cidl; 783 784 } 785 /********************************************************** 786 * ShellView_DoContextMenu() 788 787 */ 789 788 static void ShellView_DoContextMenu(IShellViewImpl * This, WORD x, WORD y, BOOL bDefault) 790 { UINTuCommand;791 DWORDwFlags;792 HMENUhMenu;793 BOOLfExplore = FALSE;794 HWNDhwndTree = 0;795 LPCONTEXTMENUpContextMenu = NULL;796 IContextMenu *pCM = NULL;797 CMINVOKECOMMANDINFOcmi;798 799 800 801 802 803 804 IShellFolder_GetUIObjectOf( This->pSFParent, This->hWndParent, This->cidl, This->apidl, 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 863 else/* background context menu */864 { 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 } 884 885 /********************************************************** 886 * 789 { UINT uCommand; 790 DWORD wFlags; 791 HMENU hMenu; 792 BOOL fExplore = FALSE; 793 HWND hwndTree = 0; 794 LPCONTEXTMENU pContextMenu = NULL; 795 IContextMenu * pCM = NULL; 796 CMINVOKECOMMANDINFO cmi; 797 798 TRACE("(%p)->(0x%08x 0x%08x 0x%08x) stub\n",This, x, y, bDefault); 799 800 /* look, what's selected and create a context menu object of it*/ 801 if( ShellView_GetSelections(This) ) 802 { 803 IShellFolder_GetUIObjectOf( This->pSFParent, This->hWndParent, This->cidl, This->apidl, 804 (REFIID)&IID_IContextMenu, NULL, (LPVOID *)&pContextMenu); 805 806 if(pContextMenu) 807 { 808 TRACE("-- pContextMenu\n"); 809 hMenu = CreatePopupMenu(); 810 811 if( hMenu ) 812 { 813 /* See if we are in Explore or Open mode. If the browser's tree is present, we are in Explore mode.*/ 814 if(SUCCEEDED(IShellBrowser_GetControlWindow(This->pShellBrowser,FCW_TREE, &hwndTree)) && hwndTree) 815 { 816 TRACE("-- explore mode\n"); 817 fExplore = TRUE; 818 } 819 820 /* build the flags depending on what we can do with the selected item */ 821 wFlags = CMF_NORMAL | (This->cidl != 1 ? 0 : CMF_CANRENAME) | (fExplore ? CMF_EXPLORE : 0); 822 823 /* let the ContextMenu merge its items in */ 824 if (SUCCEEDED(IContextMenu_QueryContextMenu( pContextMenu, hMenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, wFlags ))) 825 { 826 if( bDefault ) 827 { 828 TRACE("-- get menu default command\n"); 829 uCommand = GetMenuDefaultItem(hMenu, FALSE, GMDI_GOINTOPOPUPS); 830 } 831 else 832 { 833 TRACE("-- track popup\n"); 834 uCommand = TrackPopupMenu( hMenu,TPM_LEFTALIGN | TPM_RETURNCMD,x,y,0,This->hWnd,NULL); 835 } 836 837 if(uCommand > 0) 838 { 839 TRACE("-- uCommand=%u\n", uCommand); 840 if (IsInCommDlg(This) && ((uCommand==FCIDM_SHVIEW_EXPLORE) || (uCommand==FCIDM_SHVIEW_OPEN))) 841 { 842 TRACE("-- dlg: OnDefaultCommand\n"); 843 OnDefaultCommand(This); 844 } 845 else 846 { 847 TRACE("-- explore -- invoke command\n"); 848 ZeroMemory(&cmi, sizeof(cmi)); 849 cmi.cbSize = sizeof(cmi); 850 cmi.hwnd = This->hWndParent; /* this window has to answer CWM_GETISHELLBROWSER */ 851 cmi.lpVerb = (LPCSTR)MAKEINTRESOURCEA(uCommand); 852 IContextMenu_InvokeCommand(pContextMenu, &cmi); 853 } 854 } 855 DestroyMenu(hMenu); 856 } 857 } 858 if (pContextMenu) 859 IContextMenu_Release(pContextMenu); 860 } 861 } 862 else /* background context menu */ 863 { 864 hMenu = CreatePopupMenu(); 865 866 pCM = ISvBgCm_Constructor(This->pSFParent); 867 IContextMenu_QueryContextMenu(pCM, hMenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, 0); 868 869 uCommand = TrackPopupMenu( hMenu, TPM_LEFTALIGN | TPM_RETURNCMD,x,y,0,This->hWnd,NULL); 870 DestroyMenu(hMenu); 871 872 TRACE("-- (%p)->(uCommand=0x%08x )\n",This, uCommand); 873 874 ZeroMemory(&cmi, sizeof(cmi)); 875 cmi.cbSize = sizeof(cmi); 876 cmi.lpVerb = (LPCSTR)MAKEINTRESOURCEA(uCommand); 877 cmi.hwnd = This->hWndParent; 878 IContextMenu_InvokeCommand(pCM, &cmi); 879 880 IContextMenu_Release(pCM); 881 } 882 } 883 884 /********************************************************** 885 * ##### message handling ##### 887 886 */ 888 887 … … 892 891 static LRESULT ShellView_OnSize(IShellViewImpl * This, WORD wWidth, WORD wHeight) 893 892 { 894 895 896 897 898 899 900 901 902 893 TRACE("%p width=%u height=%u\n",This, wWidth,wHeight); 894 895 /*resize the ListView to fit our window*/ 896 if(This->hWndList) 897 { 898 MoveWindow(This->hWndList, 0, 0, wWidth, wHeight, TRUE); 899 } 900 901 return S_OK; 903 902 } 904 903 /********************************************************** … … 907 906 * NOTES 908 907 * internal 909 */ 908 */ 910 909 static void ShellView_OnDeactivate(IShellViewImpl * This) 911 910 { 912 913 914 915 916 917 918 919 920 921 922 923 924 925 911 TRACE("%p\n",This); 912 913 if(This->uState != SVUIA_DEACTIVATE) 914 { 915 if(This->hMenu) 916 { 917 IShellBrowser_SetMenuSB(This->pShellBrowser,0, 0, 0); 918 IShellBrowser_RemoveMenusSB(This->pShellBrowser,This->hMenu); 919 DestroyMenu(This->hMenu); 920 This->hMenu = 0; 921 } 922 923 This->uState = SVUIA_DEACTIVATE; 924 } 926 925 } 927 926 928 927 /********************************************************** 929 928 * ShellView_OnActivate() 930 */ 929 */ 931 930 static LRESULT ShellView_OnActivate(IShellViewImpl * This, UINT uState) 932 { 933 934 935 936 TRACE("%p uState=%x\n",This,uState); 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 TRACE("-- after fnInsertMenusSB\n"); 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 997 TRACE("-- before fnSetMenuSB\n"); 998 999 1000 1001 1002 TRACE("--\n"); 1003 931 { OLEMENUGROUPWIDTHS omw = { {0, 0, 0, 0, 0, 0} }; 932 MENUITEMINFOA mii; 933 CHAR szText[MAX_PATH]; 934 935 TRACE("%p uState=%x\n",This,uState); 936 937 /*don't do anything if the state isn't really changing */ 938 if(This->uState == uState) 939 { 940 return S_OK; 941 } 942 943 ShellView_OnDeactivate(This); 944 945 /*only do This if we are active */ 946 if(uState != SVUIA_DEACTIVATE) 947 { 948 /*merge the menus */ 949 This->hMenu = CreateMenu(); 950 951 if(This->hMenu) 952 { 953 IShellBrowser_InsertMenusSB(This->pShellBrowser, This->hMenu, &omw); 954 TRACE("-- after fnInsertMenusSB\n"); 955 956 /*build the top level menu get the menu item's text*/ 957 strcpy(szText,"dummy 31"); 958 959 ZeroMemory(&mii, sizeof(mii)); 960 mii.cbSize = sizeof(mii); 961 mii.fMask = MIIM_SUBMENU | MIIM_TYPE | MIIM_STATE; 962 mii.fType = MFT_STRING; 963 mii.fState = MFS_ENABLED; 964 mii.dwTypeData = szText; 965 mii.hSubMenu = ShellView_BuildFileMenu(This); 966 967 /*insert our menu into the menu bar*/ 968 if(mii.hSubMenu) 969 { 970 InsertMenuItemA(This->hMenu, FCIDM_MENU_HELP, FALSE, &mii); 971 } 972 973 /*get the view menu so we can merge with it*/ 974 ZeroMemory(&mii, sizeof(mii)); 975 mii.cbSize = sizeof(mii); 976 mii.fMask = MIIM_SUBMENU; 977 978 if(GetMenuItemInfoA(This->hMenu, FCIDM_MENU_VIEW, FALSE, &mii)) 979 { 980 ShellView_MergeViewMenu(This, mii.hSubMenu); 981 } 982 983 /*add the items that should only be added if we have the focus*/ 984 if(SVUIA_ACTIVATE_FOCUS == uState) 985 { 986 /*get the file menu so we can merge with it */ 987 ZeroMemory(&mii, sizeof(mii)); 988 mii.cbSize = sizeof(mii); 989 mii.fMask = MIIM_SUBMENU; 990 991 if(GetMenuItemInfoA(This->hMenu, FCIDM_MENU_FILE, FALSE, &mii)) 992 { 993 ShellView_MergeFileMenu(This, mii.hSubMenu); 994 } 995 } 996 TRACE("-- before fnSetMenuSB\n"); 997 IShellBrowser_SetMenuSB(This->pShellBrowser, This->hMenu, 0, This->hWnd); 998 } 999 } 1000 This->uState = uState; 1001 TRACE("--\n"); 1002 return S_OK; 1004 1003 } 1005 1004 … … 1010 1009 static LRESULT ShellView_OnSetFocus(IShellViewImpl * This) 1011 1010 { 1012 1013 1014 1015 should always be done before merging menus (OnActivate merges the 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1011 TRACE("%p\n",This); 1012 1013 /* Tell the browser one of our windows has received the focus. This 1014 should always be done before merging menus (OnActivate merges the 1015 menus) if one of our windows has the focus.*/ 1016 1017 IShellBrowser_OnViewWindowActive(This->pShellBrowser,(IShellView*) This); 1018 ShellView_OnActivate(This, SVUIA_ACTIVATE_FOCUS); 1019 1020 /* Set the focus to the listview */ 1021 SetFocus(This->hWndList); 1022 1023 /* Notify the ICommDlgBrowser interface */ 1024 OnStateChange(This,CDBOSC_SETFOCUS); 1025 1026 return 0; 1028 1027 } 1029 1028 1030 1029 /********************************************************** 1031 1030 * ShellView_OnKillFocus() 1032 */ 1031 */ 1033 1032 static LRESULT ShellView_OnKillFocus(IShellViewImpl * This) 1034 1033 { 1035 1036 1037 1038 1039 1040 1041 1034 TRACE("(%p) stub\n",This); 1035 1036 ShellView_OnActivate(This, SVUIA_ACTIVATE_NOFOCUS); 1037 /* Notify the ICommDlgBrowser */ 1038 OnStateChange(This,CDBOSC_KILLFOCUS); 1039 1040 return 0; 1042 1041 } 1043 1042 … … 1046 1045 * 1047 1046 * NOTES 1048 * 1049 */ 1047 * the CmdID's are the ones from the context menu 1048 */ 1050 1049 static LRESULT ShellView_OnCommand(IShellViewImpl * This,DWORD dwCmdID, DWORD dwCmd, HWND hwndCmd) 1051 1050 { 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 1094 1051 TRACE("(%p)->(0x%08lx 0x%08lx 0x%08x) stub\n",This, dwCmdID, dwCmd, hwndCmd); 1052 1053 switch(dwCmdID) 1054 { 1055 case FCIDM_SHVIEW_SMALLICON: 1056 This->FolderSettings.ViewMode = FVM_SMALLICON; 1057 SetStyle (This, LVS_SMALLICON, LVS_TYPEMASK); 1058 CheckToolbar(This); 1059 break; 1060 1061 case FCIDM_SHVIEW_BIGICON: 1062 This->FolderSettings.ViewMode = FVM_ICON; 1063 SetStyle (This, LVS_ICON, LVS_TYPEMASK); 1064 CheckToolbar(This); 1065 break; 1066 1067 case FCIDM_SHVIEW_LISTVIEW: 1068 This->FolderSettings.ViewMode = FVM_LIST; 1069 SetStyle (This, LVS_LIST, LVS_TYPEMASK); 1070 CheckToolbar(This); 1071 break; 1072 1073 case FCIDM_SHVIEW_REPORTVIEW: 1074 This->FolderSettings.ViewMode = FVM_DETAILS; 1075 SetStyle (This, LVS_REPORT, LVS_TYPEMASK); 1076 CheckToolbar(This); 1077 break; 1078 1079 /* the menu-ID's for sorting are 0x30... see shrec.rc */ 1080 case 0x30: 1081 case 0x31: 1082 case 0x32: 1083 case 0x33: 1084 This->ListViewSortInfo.nHeaderID = (LPARAM) (dwCmdID - 0x30); 1085 This->ListViewSortInfo.bIsAscending = TRUE; 1086 This->ListViewSortInfo.nLastHeaderID = This->ListViewSortInfo.nHeaderID; 1087 ListView_SortItems(This->hWndList, ShellView_ListViewCompareItems, (LPARAM) (&(This->ListViewSortInfo))); 1088 break; 1089 1090 default: 1091 TRACE("-- COMMAND 0x%04lx unhandled\n", dwCmdID); 1092 } 1093 return 0; 1095 1094 } 1096 1095 … … 1098 1097 * ShellView_OnNotify() 1099 1098 */ 1100 1099 1101 1100 static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpnmh) 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 1158 if(lpdi->item.mask & LVIF_TEXT)/* text requested */1159 1160 1161 1162 1163 1164 1165 TRACE("-- text=%s\n",lpdi->item.pszText); 1166 1167 1168 1169 1170 1171 1172 if(lpdi->item.mask & LVIF_IMAGE)/* image requested */1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 { 1189 1190 1191 1192 1193 1194 1195 1196 1197 IDropSource * pds = (IDropSource*)&(This->lpvtblDropSource);/* own DropSource interface */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 1248 1101 { LPNMLISTVIEW lpnmlv = (LPNMLISTVIEW)lpnmh; 1102 NMLVDISPINFOA *lpdi = (NMLVDISPINFOA *)lpnmh; 1103 LPITEMIDLIST pidl; 1104 1105 TRACE("%p CtlID=%u lpnmh->code=%x\n",This,CtlID,lpnmh->code); 1106 1107 switch(lpnmh->code) 1108 { 1109 case NM_SETFOCUS: 1110 TRACE("-- NM_SETFOCUS %p\n",This); 1111 ShellView_OnSetFocus(This); 1112 break; 1113 1114 case NM_KILLFOCUS: 1115 TRACE("-- NM_KILLFOCUS %p\n",This); 1116 ShellView_OnDeactivate(This); 1117 /* Notify the ICommDlgBrowser interface */ 1118 OnStateChange(This,CDBOSC_KILLFOCUS); 1119 break; 1120 1121 case HDN_ENDTRACKA: 1122 TRACE("-- HDN_ENDTRACKA %p\n",This); 1123 /*nColumn1 = ListView_GetColumnWidth(This->hWndList, 0); 1124 nColumn2 = ListView_GetColumnWidth(This->hWndList, 1);*/ 1125 break; 1126 1127 case LVN_DELETEITEM: 1128 TRACE("-- LVN_DELETEITEM %p\n",This); 1129 SHFree((LPITEMIDLIST)lpnmlv->lParam); /*delete the pidl because we made a copy of it*/ 1130 break; 1131 1132 case LVN_ITEMACTIVATE: 1133 TRACE("-- LVN_ITEMACTIVATE %p\n",This); 1134 OnStateChange(This, CDBOSC_SELCHANGE); /* the browser will get the IDataObject now */ 1135 ShellView_DoContextMenu(This, 0, 0, TRUE); 1136 break; 1137 1138 case LVN_COLUMNCLICK: 1139 This->ListViewSortInfo.nHeaderID = lpnmlv->iSubItem; 1140 if(This->ListViewSortInfo.nLastHeaderID == This->ListViewSortInfo.nHeaderID) 1141 { 1142 This->ListViewSortInfo.bIsAscending = !This->ListViewSortInfo.bIsAscending; 1143 } 1144 else 1145 { 1146 This->ListViewSortInfo.bIsAscending = TRUE; 1147 } 1148 This->ListViewSortInfo.nLastHeaderID = This->ListViewSortInfo.nHeaderID; 1149 1150 ListView_SortItems(lpnmlv->hdr.hwndFrom, ShellView_ListViewCompareItems, (LPARAM) (&(This->ListViewSortInfo))); 1151 break; 1152 1153 case LVN_GETDISPINFOA: 1154 TRACE("-- LVN_GETDISPINFOA %p\n",This); 1155 pidl = (LPITEMIDLIST)lpdi->item.lParam; 1156 1157 if(lpdi->item.mask & LVIF_TEXT) /* text requested */ 1158 { 1159 if (This->pSF2Parent) 1160 { 1161 SHELLDETAILS sd; 1162 IShellFolder2_GetDetailsOf(This->pSF2Parent, pidl, lpdi->item.iSubItem, &sd); 1163 StrRetToStrNA( lpdi->item.pszText, lpdi->item.cchTextMax, &sd.str, NULL); 1164 TRACE("-- text=%s\n",lpdi->item.pszText); 1165 } 1166 else 1167 { 1168 FIXME("no SF2\n"); 1169 } 1170 } 1171 if(lpdi->item.mask & LVIF_IMAGE) /* image requested */ 1172 { 1173 lpdi->item.iImage = SHMapPIDLToSystemImageListIndex(This->pSFParent, pidl, 0); 1174 } 1175 break; 1176 1177 case LVN_ITEMCHANGED: 1178 TRACE("-- LVN_ITEMCHANGED %p\n",This); 1179 OnStateChange(This, CDBOSC_SELCHANGE); /* the browser will get the IDataObject now */ 1180 break; 1181 1182 case LVN_BEGINDRAG: 1183 case LVN_BEGINRDRAG: 1184 TRACE("-- LVN_BEGINDRAG\n"); 1185 1186 if (ShellView_GetSelections(This)) 1187 { 1188 IDataObject * pda; 1189 DWORD dwAttributes = SFGAO_CANLINK; 1190 DWORD dwEffect = DROPEFFECT_COPY | DROPEFFECT_MOVE; 1191 1192 if(GetShellOle()) 1193 { 1194 if (SUCCEEDED(IShellFolder_GetUIObjectOf(This->pSFParent, This->hWnd, This->cidl, This->apidl, &IID_IDataObject,0,(LPVOID *)&pda))) 1195 { 1196 IDropSource * pds = (IDropSource*)&(This->lpvtblDropSource); /* own DropSource interface */ 1197 1198 if (SUCCEEDED(IShellFolder_GetAttributesOf(This->pSFParent, This->cidl, This->apidl, &dwAttributes))) 1199 { 1200 if (dwAttributes & SFGAO_CANLINK) 1201 { 1202 dwEffect |= DROPEFFECT_LINK; 1203 } 1204 } 1205 1206 if (pds) 1207 { 1208 DWORD dwEffect; 1209 pDoDragDrop(pda, pds, dwEffect, &dwEffect); 1210 } 1211 IDataObject_Release(pda); 1212 } 1213 } 1214 } 1215 break; 1216 1217 case LVN_BEGINLABELEDITA: 1218 { 1219 DWORD dwAttr = SFGAO_CANRENAME; 1220 pidl = (LPITEMIDLIST)lpdi->item.lParam; 1221 1222 TRACE("-- LVN_BEGINLABELEDITA %p\n",This); 1223 1224 IShellFolder_GetAttributesOf(This->pSFParent, 1, &pidl, &dwAttr); 1225 if (SFGAO_CANRENAME & dwAttr) 1226 { 1227 return FALSE; 1228 } 1229 return TRUE; 1230 } 1231 break; 1232 1233 case LVN_ENDLABELEDITA: 1234 { 1235 TRACE("-- LVN_ENDLABELEDITA %p\n",This); 1236 if (lpdi->item.pszText) 1237 { 1238 HRESULT hr; 1239 WCHAR wszNewName[MAX_PATH]; 1240 LVITEMA lvItem; 1241 1242 ZeroMemory(&lvItem, sizeof(LVITEMA)); 1243 lvItem.iItem = lpdi->item.iItem; 1244 lvItem.mask = LVIF_PARAM; 1245 ListView_GetItemA(This->hWndList, &lvItem); 1246 1247 pidl = (LPITEMIDLIST)lpdi->item.lParam; 1249 1248 if (!MultiByteToWideChar( CP_ACP, 0, lpdi->item.pszText, -1, wszNewName, MAX_PATH )) 1250 1249 wszNewName[MAX_PATH-1] = 0; 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1250 hr = IShellFolder_SetNameOf(This->pSFParent, 0, pidl, wszNewName, SHGDN_INFOLDER, &pidl); 1251 1252 if(SUCCEEDED(hr) && pidl) 1253 { 1254 lvItem.mask = LVIF_PARAM; 1255 lvItem.lParam = (LPARAM)pidl; 1256 ListView_SetItemA(This->hWndList, &lvItem); 1257 return TRUE; 1258 } 1259 } 1260 return FALSE; 1261 } 1262 break; 1263 1264 case LVN_KEYDOWN: 1265 { 1266 /* MSG msg; 1267 msg.hwnd = This->hWnd; 1268 msg.message = WM_KEYDOWN; 1269 msg.wParam = plvKeyDown->wVKey; 1270 msg.lParam = 0; 1271 msg.time = 0; 1272 msg.pt = 0;*/ 1273 1274 LPNMLVKEYDOWN plvKeyDown = (LPNMLVKEYDOWN) lpnmh; 1276 1275 1277 1276 /* initiate a rename of the selected file or directory */ … … 1286 1285 /* get selected item */ 1287 1286 i = ListView_GetNextItem(This->hWndList, -1, 1288 1289 1287 LVNI_SELECTED); 1288 1290 1289 ListView_EnsureVisible(This->hWndList, i, 0); 1291 1290 ListView_EditLabelA(This->hWndList, i); … … 1293 1292 } 1294 1293 #if 0 1295 1294 TranslateAccelerator(This->hWnd, This->hAccel, &msg) 1296 1295 #endif 1297 1296 else if(plvKeyDown->wVKey == VK_DELETE) 1298 1297 { 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 pItems = HeapAlloc(GetProcessHeap(), 0, 1312 1313 1314 1315 1316 1317 1318 1319 1320 item_index = ListView_GetNextItem(This->hWndList, 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1298 int i, item_index; 1299 LVITEMA item; 1300 LPITEMIDLIST* pItems; 1301 ISFHelper *psfhlp; 1302 1303 IShellFolder_QueryInterface(This->pSFParent, &IID_ISFHelper, 1304 (LPVOID*)&psfhlp); 1305 1306 if(!(i = ListView_GetSelectedCount(This->hWndList))) 1307 break; 1308 1309 /* allocate memory for the pidl array */ 1310 pItems = HeapAlloc(GetProcessHeap(), 0, 1311 sizeof(LPITEMIDLIST) * i); 1312 1313 /* retrieve all selected items */ 1314 i = 0; 1315 item_index = -1; 1316 while(ListView_GetSelectedCount(This->hWndList) > i) 1317 { 1318 /* get selected item */ 1319 item_index = ListView_GetNextItem(This->hWndList, 1320 item_index, LVNI_SELECTED); 1321 item.iItem = item_index; 1322 ListView_GetItemA(This->hWndList, &item); 1323 1324 /* get item pidl */ 1325 pItems[i] = (LPITEMIDLIST)item.lParam; 1326 1327 i++; 1328 } 1329 1330 /* perform the item deletion */ 1331 ISFHelper_DeleteItems(psfhlp, i, pItems); 1332 1333 /* free pidl array memory */ 1334 HeapFree(GetProcessHeap(), 0, pItems); 1336 1335 } 1337 1336 else 1338 1339 1340 1341 1342 1343 1344 1345 1346 1337 FIXME("LVN_KEYDOWN key=0x%08x\n",plvKeyDown->wVKey); 1338 } 1339 break; 1340 1341 default: 1342 TRACE("-- %p WM_COMMAND %x unhandled\n", This, lpnmh->code); 1343 break;; 1344 } 1345 return 0; 1347 1346 } 1348 1347 … … 1354 1353 { 1355 1354 1356 1357 1358 { 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1355 TRACE("(%p)(%p,%p,0x%08lx)\n", This, Pidls[0], Pidls[1], wEventId); 1356 switch(wEventId) 1357 { 1358 case SHCNE_MKDIR: 1359 case SHCNE_CREATE: 1360 LV_AddItem(This, Pidls[0]); 1361 break; 1362 case SHCNE_RMDIR: 1363 case SHCNE_DELETE: 1364 LV_DeleteItem(This, Pidls[0]); 1365 break; 1366 case SHCNE_RENAMEFOLDER: 1367 case SHCNE_RENAMEITEM: 1368 LV_RenameItem(This, Pidls[0], Pidls[1]); 1369 break; 1370 case SHCNE_UPDATEITEM: 1371 break; 1372 } 1373 return TRUE; 1375 1374 } 1376 1375 /********************************************************** … … 1380 1379 static LRESULT CALLBACK ShellView_WndProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam) 1381 1380 { 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 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 1406 1407 1408 1409 1410 1411 case WM_SHOWWINDOW:UpdateWindow(pThis->hWndList);1412 1413 1414 1415 1416 case WM_DESTROY:if(GetShellOle())1417 1418 1419 1420 1421 1422 1423 1424 1381 IShellViewImpl * pThis = (IShellViewImpl*)GetWindowLongA(hWnd, GWL_USERDATA); 1382 LPCREATESTRUCTA lpcs; 1383 1384 TRACE("(hwnd=%x msg=%x wparm=%x lparm=%lx)\n",hWnd, uMessage, wParam, lParam); 1385 1386 switch (uMessage) 1387 { 1388 case WM_NCCREATE: 1389 lpcs = (LPCREATESTRUCTA)lParam; 1390 pThis = (IShellViewImpl*)(lpcs->lpCreateParams); 1391 SetWindowLongA(hWnd, GWL_USERDATA, (LONG)pThis); 1392 pThis->hWnd = hWnd; /*set the window handle*/ 1393 break; 1394 1395 case WM_SIZE: return ShellView_OnSize(pThis,LOWORD(lParam), HIWORD(lParam)); 1396 case WM_SETFOCUS: return ShellView_OnSetFocus(pThis); 1397 case WM_KILLFOCUS: return ShellView_OnKillFocus(pThis); 1398 case WM_CREATE: return ShellView_OnCreate(pThis); 1399 case WM_ACTIVATE: return ShellView_OnActivate(pThis, SVUIA_ACTIVATE_FOCUS); 1400 case WM_NOTIFY: return ShellView_OnNotify(pThis,(UINT)wParam, (LPNMHDR)lParam); 1401 case WM_COMMAND: return ShellView_OnCommand(pThis, 1402 GET_WM_COMMAND_ID(wParam, lParam), 1403 GET_WM_COMMAND_CMD(wParam, lParam), 1404 GET_WM_COMMAND_HWND(wParam, lParam)); 1405 case SHV_CHANGE_NOTIFY: return ShellView_OnChange(pThis, (LPITEMIDLIST*)wParam, (LONG)lParam); 1406 1407 case WM_CONTEXTMENU: ShellView_DoContextMenu(pThis, LOWORD(lParam), HIWORD(lParam), FALSE); 1408 return 0; 1409 1410 case WM_SHOWWINDOW: UpdateWindow(pThis->hWndList); 1411 break; 1412 1413 case WM_GETDLGCODE: return SendMessageA(pThis->hWndList,uMessage,0,0); 1414 1415 case WM_DESTROY: if(GetShellOle()) 1416 { 1417 pRevokeDragDrop(pThis->hWnd); 1418 } 1419 SHChangeNotifyDeregister(pThis->hNotify); 1420 break; 1421 } 1422 1423 return DefWindowProcA (hWnd, uMessage, wParam, lParam); 1425 1424 } 1426 1425 /********************************************************** … … 1435 1434 static HRESULT WINAPI IShellView_fnQueryInterface(IShellView * iface,REFIID riid, LPVOID *ppvObj) 1436 1435 { 1437 1438 1439 1440 1441 1442 1443 1444 1445 *ppvObj = This; 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 1475 1436 ICOM_THIS(IShellViewImpl, iface); 1437 1438 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj); 1439 1440 *ppvObj = NULL; 1441 1442 if(IsEqualIID(riid, &IID_IUnknown)) 1443 { 1444 *ppvObj = This; 1445 } 1446 else if(IsEqualIID(riid, &IID_IShellView)) 1447 { 1448 *ppvObj = (IShellView*)This; 1449 } 1450 else if(IsEqualIID(riid, &IID_IOleCommandTarget)) 1451 { 1452 *ppvObj = (IOleCommandTarget*)&(This->lpvtblOleCommandTarget); 1453 } 1454 else if(IsEqualIID(riid, &IID_IDropTarget)) 1455 { 1456 *ppvObj = (IDropTarget*)&(This->lpvtblDropTarget); 1457 } 1458 else if(IsEqualIID(riid, &IID_IDropSource)) 1459 { 1460 *ppvObj = (IDropSource*)&(This->lpvtblDropSource); 1461 } 1462 else if(IsEqualIID(riid, &IID_IViewObject)) 1463 { 1464 *ppvObj = (IViewObject*)&(This->lpvtblViewObject); 1465 } 1466 1467 if(*ppvObj) 1468 { 1469 IUnknown_AddRef( (IUnknown*)*ppvObj ); 1470 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj); 1471 return S_OK; 1472 } 1473 TRACE("-- Interface: E_NOINTERFACE\n"); 1474 return E_NOINTERFACE; 1476 1475 } 1477 1476 … … 1481 1480 static ULONG WINAPI IShellView_fnAddRef(IShellView * iface) 1482 1481 { 1483 1484 1485 1486 1487 1488 1482 ICOM_THIS(IShellViewImpl, iface); 1483 1484 TRACE("(%p)->(count=%lu)\n",This,This->ref); 1485 1486 shell32_ObjCount++; 1487 return ++(This->ref); 1489 1488 } 1490 1489 /********************************************************** … … 1493 1492 static ULONG WINAPI IShellView_fnRelease(IShellView * iface) 1494 1493 { 1495 1496 1497 1498 1499 1500 1501 if (!--(This->ref)) 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1494 ICOM_THIS(IShellViewImpl, iface); 1495 1496 TRACE("(%p)->()\n",This); 1497 1498 shell32_ObjCount--; 1499 1500 if (!--(This->ref)) 1501 { 1502 TRACE(" destroying IShellView(%p)\n",This); 1503 1504 if(This->pSFParent) 1505 IShellFolder_Release(This->pSFParent); 1506 1507 if(This->pSF2Parent) 1508 IShellFolder2_Release(This->pSF2Parent); 1509 1510 if (This->apidl) 1511 SHFree(This->apidl); 1512 1513 if (This->pCommDlgBrowser) 1514 ICommDlgBrowser_Release(This->pCommDlgBrowser); 1515 1516 HeapFree(GetProcessHeap(),0,This); 1517 return 0; 1518 } 1519 return This->ref; 1521 1520 } 1522 1521 … … 1526 1525 static HRESULT WINAPI IShellView_fnGetWindow(IShellView * iface,HWND * phWnd) 1527 1526 { 1528 1529 1530 1531 1532 1533 1534 1527 ICOM_THIS(IShellViewImpl, iface); 1528 1529 TRACE("(%p)\n",This); 1530 1531 *phWnd = This->hWnd; 1532 1533 return S_OK; 1535 1534 } 1536 1535 1537 1536 static HRESULT WINAPI IShellView_fnContextSensitiveHelp(IShellView * iface,BOOL fEnterMode) 1538 1537 { 1539 1540 1541 1542 1543 1538 ICOM_THIS(IShellViewImpl, iface); 1539 1540 FIXME("(%p) stub\n",This); 1541 1542 return E_NOTIMPL; 1544 1543 } 1545 1544 … … 1553 1552 { 1554 1553 #if 0 1555 1556 1557 1554 ICOM_THIS(IShellViewImpl, iface); 1555 1556 FIXME("(%p)->(%p: hwnd=%x msg=%x lp=%lx wp=%x) stub\n",This,lpmsg, lpmsg->hwnd, lpmsg->message, lpmsg->lParam, lpmsg->wParam); 1558 1557 #endif 1559 1560 1561 1562 1563 1564 1558 1559 if ((lpmsg->message>=WM_KEYFIRST) && (lpmsg->message>=WM_KEYLAST)) 1560 { 1561 TRACE("-- key=0x04%x",lpmsg->wParam) ; 1562 } 1563 return S_FALSE; /* not handled */ 1565 1564 } 1566 1565 1567 1566 static HRESULT WINAPI IShellView_fnEnableModeless(IShellView * iface,BOOL fEnable) 1568 1567 { 1569 1570 1571 1572 1573 1568 ICOM_THIS(IShellViewImpl, iface); 1569 1570 FIXME("(%p) stub\n",This); 1571 1572 return E_NOTIMPL; 1574 1573 } 1575 1574 1576 1575 static HRESULT WINAPI IShellView_fnUIActivate(IShellView * iface,UINT uState) 1577 1576 { 1578 1577 ICOM_THIS(IShellViewImpl, iface); 1579 1578 1580 1579 /* 1581 CHARszName[MAX_PATH];1580 CHAR szName[MAX_PATH]; 1582 1581 */ 1583 LRESULTlResult;1584 intnPartArray[1] = {-1};1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1582 LRESULT lResult; 1583 int nPartArray[1] = {-1}; 1584 1585 TRACE("(%p)->(state=%x) stub\n",This, uState); 1586 1587 /*don't do anything if the state isn't really changing*/ 1588 if(This->uState == uState) 1589 { 1590 return S_OK; 1591 } 1592 1593 /*OnActivate handles the menu merging and internal state*/ 1594 ShellView_OnActivate(This, uState); 1595 1596 /*only do This if we are active*/ 1597 if(uState != SVUIA_DEACTIVATE) 1598 { 1600 1599 1601 1600 /* 1602 1603 1601 GetFolderPath is not a method of IShellFolder 1602 IShellFolder_GetFolderPath( This->pSFParent, szName, sizeof(szName) ); 1604 1603 */ 1605 1606 1607 1608 1609 1604 /* set the number of parts */ 1605 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_STATUS, SB_SETPARTS, 1, 1606 (LPARAM)nPartArray, &lResult); 1607 1608 /* set the text for the parts */ 1610 1609 /* 1611 1612 1613 */ 1614 1615 1616 1610 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_STATUS, SB_SETTEXTA, 1611 0, (LPARAM)szName, &lResult); 1612 */ 1613 } 1614 1615 return S_OK; 1617 1616 } 1618 1617 1619 1618 static HRESULT WINAPI IShellView_fnRefresh(IShellView * iface) 1620 1619 { 1621 1622 1623 1624 1625 1626 1627 1628 1620 ICOM_THIS(IShellViewImpl, iface); 1621 1622 TRACE("(%p)\n",This); 1623 1624 ListView_DeleteAllItems(This->hWndList); 1625 ShellView_FillList(This); 1626 1627 return S_OK; 1629 1628 } 1630 1629 1631 1630 static HRESULT WINAPI IShellView_fnCreateViewWindow( 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 1658 if ( SUCCEEDED (IShellBrowser_QueryInterface( This->pShellBrowser, 1659 1660 1661 1662 1663 1664 1665 1666 1667 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 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1631 IShellView * iface, 1632 IShellView *lpPrevView, 1633 LPCFOLDERSETTINGS lpfs, 1634 IShellBrowser * psb, 1635 RECT * prcView, 1636 HWND *phWnd) 1637 { 1638 ICOM_THIS(IShellViewImpl, iface); 1639 1640 WNDCLASSA wc; 1641 *phWnd = 0; 1642 1643 1644 TRACE("(%p)->(shlview=%p set=%p shlbrs=%p rec=%p hwnd=%p) incomplete\n",This, lpPrevView,lpfs, psb, prcView, phWnd); 1645 TRACE("-- vmode=%x flags=%x left=%i top=%i right=%i bottom=%i\n",lpfs->ViewMode, lpfs->fFlags ,prcView->left,prcView->top, prcView->right, prcView->bottom); 1646 1647 /*set up the member variables*/ 1648 This->pShellBrowser = psb; 1649 This->FolderSettings = *lpfs; 1650 1651 /*get our parent window*/ 1652 IShellBrowser_AddRef(This->pShellBrowser); 1653 IShellBrowser_GetWindow(This->pShellBrowser, &(This->hWndParent)); 1654 1655 /* try to get the ICommDlgBrowserInterface, adds a reference !!! */ 1656 This->pCommDlgBrowser=NULL; 1657 if ( SUCCEEDED (IShellBrowser_QueryInterface( This->pShellBrowser, 1658 (REFIID)&IID_ICommDlgBrowser, (LPVOID*) &This->pCommDlgBrowser))) 1659 { 1660 TRACE("-- CommDlgBrowser\n"); 1661 } 1662 1663 /*if our window class has not been registered, then do so*/ 1664 if(!GetClassInfoA(shell32_hInstance, SV_CLASS_NAME, &wc)) 1665 { 1666 ZeroMemory(&wc, sizeof(wc)); 1667 wc.style = CS_HREDRAW | CS_VREDRAW; 1668 wc.lpfnWndProc = (WNDPROC) ShellView_WndProc; 1669 wc.cbClsExtra = 0; 1670 wc.cbWndExtra = 0; 1671 wc.hInstance = shell32_hInstance; 1672 wc.hIcon = 0; 1673 wc.hCursor = LoadCursorA (0, IDC_ARROWA); 1674 wc.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1); 1675 wc.lpszMenuName = NULL; 1676 wc.lpszClassName = SV_CLASS_NAME; 1677 1678 if(!RegisterClassA(&wc)) 1679 return E_FAIL; 1680 } 1681 1682 *phWnd = CreateWindowExA(0, 1683 SV_CLASS_NAME, 1684 NULL, 1685 WS_CHILD | WS_VISIBLE | WS_TABSTOP, 1686 prcView->left, 1687 prcView->top, 1688 prcView->right - prcView->left, 1689 prcView->bottom - prcView->top, 1690 This->hWndParent, 1691 0, 1692 shell32_hInstance, 1693 (LPVOID)This); 1694 1695 CheckToolbar(This); 1696 1697 if(!*phWnd) return E_FAIL; 1698 1699 return S_OK; 1701 1700 } 1702 1701 1703 1702 static HRESULT WINAPI IShellView_fnDestroyViewWindow(IShellView * iface) 1704 1703 { 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1704 ICOM_THIS(IShellViewImpl, iface); 1705 1706 TRACE("(%p)\n",This); 1707 1708 /*Make absolutely sure all our UI is cleaned up.*/ 1709 IShellView_UIActivate((IShellView*)This, SVUIA_DEACTIVATE); 1710 1711 if(This->hMenu) 1712 { 1713 DestroyMenu(This->hMenu); 1714 } 1715 1716 DestroyWindow(This->hWnd); 1717 IShellBrowser_Release(This->pShellBrowser); 1718 1719 return S_OK; 1721 1720 } 1722 1721 1723 1722 static HRESULT WINAPI IShellView_fnGetCurrentInfo(IShellView * iface, LPFOLDERSETTINGS lpfs) 1724 1723 { 1725 1726 1727 TRACE("(%p)->(%p) vmode=%x flags=%x\n",This, lpfs, 1728 1729 1730 1731 1732 1733 1724 ICOM_THIS(IShellViewImpl, iface); 1725 1726 TRACE("(%p)->(%p) vmode=%x flags=%x\n",This, lpfs, 1727 This->FolderSettings.ViewMode, This->FolderSettings.fFlags); 1728 1729 if (!lpfs) return E_INVALIDARG; 1730 1731 *lpfs = This->FolderSettings; 1732 return NOERROR; 1734 1733 } 1735 1734 1736 1735 static HRESULT WINAPI IShellView_fnAddPropertySheetPages(IShellView * iface, DWORD dwReserved,LPFNADDPROPSHEETPAGE lpfn, LPARAM lparam) 1737 1736 { 1738 1739 1740 1741 1742 1737 ICOM_THIS(IShellViewImpl, iface); 1738 1739 FIXME("(%p) stub\n",This); 1740 1741 return E_NOTIMPL; 1743 1742 } 1744 1743 1745 1744 static HRESULT WINAPI IShellView_fnSaveViewState(IShellView * iface) 1746 1745 { 1747 1748 1749 1750 1751 1746 ICOM_THIS(IShellViewImpl, iface); 1747 1748 FIXME("(%p) stub\n",This); 1749 1750 return S_OK; 1752 1751 } 1753 1752 1754 1753 static HRESULT WINAPI IShellView_fnSelectItem( 1755 1756 1757 1758 { 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1754 IShellView * iface, 1755 LPCITEMIDLIST pidl, 1756 UINT uFlags) 1757 { 1758 ICOM_THIS(IShellViewImpl, iface); 1759 int i; 1760 1761 TRACE("(%p)->(pidl=%p, 0x%08x) stub\n",This, pidl, uFlags); 1762 1763 i = LV_FindItemByPidl(This, pidl); 1764 1765 if (i != -1) 1766 { 1767 LVITEMA lvItem; 1768 1769 if(uFlags & SVSI_ENSUREVISIBLE) 1770 ListView_EnsureVisible(This->hWndList, i, 0); 1772 1771 1773 1772 ZeroMemory(&lvItem, sizeof(LVITEMA)); 1774 1775 1773 lvItem.mask = LVIF_STATE; 1774 lvItem.iItem = 0; 1776 1775 1777 1776 while(ListView_GetItemA(This->hWndList, &lvItem)) 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 1777 { 1778 if (lvItem.iItem == i) 1779 { 1780 if (uFlags & SVSI_SELECT) 1781 lvItem.state |= LVIS_SELECTED; 1782 else 1783 lvItem.state &= ~LVIS_SELECTED; 1784 1785 if(uFlags & SVSI_FOCUSED) 1786 lvItem.state &= ~LVIS_FOCUSED; 1787 } 1788 else 1789 { 1790 if (uFlags & SVSI_DESELECTOTHERS) 1791 lvItem.state &= ~LVIS_SELECTED; 1792 } 1793 ListView_SetItemA(This->hWndList, &lvItem); 1794 lvItem.iItem++; 1795 } 1796 1797 1798 if(uFlags & SVSI_EDIT) 1799 ListView_EditLabelA(This->hWndList, i); 1800 1801 } 1802 return S_OK; 1804 1803 } 1805 1804 1806 1805 static HRESULT WINAPI IShellView_fnGetItemObject(IShellView * iface, UINT uItem, REFIID riid, LPVOID *ppvOut) 1807 1806 { 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1807 ICOM_THIS(IShellViewImpl, iface); 1808 1809 TRACE("(%p)->(uItem=0x%08x,\n\tIID=%s, ppv=%p)\n",This, uItem, debugstr_guid(riid), ppvOut); 1810 1811 *ppvOut = NULL; 1812 1813 switch(uItem) 1814 { 1815 case SVGIO_BACKGROUND: 1816 *ppvOut = ISvBgCm_Constructor(This->pSFParent); 1817 break; 1818 1819 case SVGIO_SELECTION: 1820 ShellView_GetSelections(This); 1821 IShellFolder_GetUIObjectOf(This->pSFParent, This->hWnd, This->cidl, This->apidl, riid, 0, ppvOut); 1822 break; 1823 } 1824 TRACE("-- (%p)->(interface=%p)\n",This, *ppvOut); 1825 1826 if(!*ppvOut) return E_OUTOFMEMORY; 1827 1828 return S_OK; 1830 1829 } 1831 1830 1832 1831 static HRESULT WINAPI IShellView_fnEditItem( 1833 1834 1835 { 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 } 1849 1850 static struct ICOM_VTABLE(IShellView) svvt = 1851 { 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1832 IShellView * iface, 1833 LPITEMIDLIST pidl) 1834 { 1835 ICOM_THIS(IShellViewImpl, iface); 1836 int i; 1837 1838 TRACE("(%p)->(pidl=%p)\n",This, pidl); 1839 1840 i = LV_FindItemByPidl(This, pidl); 1841 if (i != -1) 1842 { 1843 SetFocus(This->hWndList); 1844 ListView_EditLabelA(This->hWndList, i); 1845 } 1846 return S_OK; 1847 } 1848 1849 static struct ICOM_VTABLE(IShellView) svvt = 1850 { 1851 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 1852 IShellView_fnQueryInterface, 1853 IShellView_fnAddRef, 1854 IShellView_fnRelease, 1855 IShellView_fnGetWindow, 1856 IShellView_fnContextSensitiveHelp, 1857 IShellView_fnTranslateAccelerator, 1858 IShellView_fnEnableModeless, 1859 IShellView_fnUIActivate, 1860 IShellView_fnRefresh, 1861 IShellView_fnCreateViewWindow, 1862 IShellView_fnDestroyViewWindow, 1863 IShellView_fnGetCurrentInfo, 1864 IShellView_fnAddPropertySheetPages, 1865 IShellView_fnSaveViewState, 1866 IShellView_fnSelectItem, 1867 IShellView_fnGetItemObject, 1868 IShellView_fnEditItem 1870 1869 }; 1871 1870 … … 1875 1874 */ 1876 1875 static HRESULT WINAPI ISVOleCmdTarget_QueryInterface( 1877 IOleCommandTarget *iface,1878 REFIIDiid,1879 LPVOID*ppvObj)1880 { 1881 1882 1883 1876 IOleCommandTarget * iface, 1877 REFIID iid, 1878 LPVOID* ppvObj) 1879 { 1880 _ICOM_THIS_From_IOleCommandTarget(IShellViewImpl, iface); 1881 1882 return IShellFolder_QueryInterface((IShellFolder*)This, iid, ppvObj); 1884 1883 } 1885 1884 … … 1888 1887 */ 1889 1888 static ULONG WINAPI ISVOleCmdTarget_AddRef( 1890 IOleCommandTarget *iface)1891 { 1892 1893 1894 1889 IOleCommandTarget * iface) 1890 { 1891 _ICOM_THIS_From_IOleCommandTarget(IShellFolder, iface); 1892 1893 return IShellFolder_AddRef((IShellFolder*)This); 1895 1894 } 1896 1895 … … 1899 1898 */ 1900 1899 static ULONG WINAPI ISVOleCmdTarget_Release( 1901 IOleCommandTarget *iface)1902 { 1903 1904 1905 1900 IOleCommandTarget * iface) 1901 { 1902 _ICOM_THIS_From_IOleCommandTarget(IShellViewImpl, iface); 1903 1904 return IShellFolder_Release((IShellFolder*)This); 1906 1905 } 1907 1906 … … 1910 1909 */ 1911 1910 static HRESULT WINAPI ISVOleCmdTarget_QueryStatus( 1912 1913 1914 ULONG cCmds, 1915 1916 1917 { 1918 1919 1920 1911 IOleCommandTarget *iface, 1912 const GUID* pguidCmdGroup, 1913 ULONG cCmds, 1914 OLECMD * prgCmds, 1915 OLECMDTEXT* pCmdText) 1916 { 1917 _ICOM_THIS_From_IOleCommandTarget(IShellViewImpl, iface); 1918 1919 FIXME("(%p)->(%p(%s) 0x%08lx %p %p\n", 1921 1920 This, pguidCmdGroup, debugstr_guid(pguidCmdGroup), cCmds, prgCmds, pCmdText); 1922 1921 return E_NOTIMPL; 1923 1922 } 1924 1923 … … 1929 1928 */ 1930 1929 static HRESULT WINAPI ISVOleCmdTarget_Exec( 1931 1932 1933 1934 1935 1936 1937 { 1938 1939 1940 1930 IOleCommandTarget *iface, 1931 const GUID* pguidCmdGroup, 1932 DWORD nCmdID, 1933 DWORD nCmdexecopt, 1934 VARIANT* pvaIn, 1935 VARIANT* pvaOut) 1936 { 1937 _ICOM_THIS_From_IOleCommandTarget(IShellViewImpl, iface); 1938 1939 FIXME("(%p)->(\n\tTarget GUID:%s Command:0x%08lx Opt:0x%08lx %p %p)\n", 1941 1940 This, debugstr_guid(pguidCmdGroup), nCmdID, nCmdexecopt, pvaIn, pvaOut); 1942 1943 } 1944 1945 static ICOM_VTABLE(IOleCommandTarget) ctvt = 1946 { 1947 1948 1949 1950 1951 1952 1941 return E_NOTIMPL; 1942 } 1943 1944 static ICOM_VTABLE(IOleCommandTarget) ctvt = 1945 { 1946 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 1947 ISVOleCmdTarget_QueryInterface, 1948 ISVOleCmdTarget_AddRef, 1949 ISVOleCmdTarget_Release, 1950 ISVOleCmdTarget_QueryStatus, 1951 ISVOleCmdTarget_Exec 1953 1952 }; 1954 1953 … … 1958 1957 1959 1958 static HRESULT WINAPI ISVDropTarget_QueryInterface( 1960 1961 1962 1963 { 1964 1965 1966 1967 1968 1959 IDropTarget *iface, 1960 REFIID riid, 1961 LPVOID *ppvObj) 1962 { 1963 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface); 1964 1965 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj); 1966 1967 return IShellFolder_QueryInterface((IShellFolder*)This, riid, ppvObj); 1969 1968 } 1970 1969 1971 1970 static ULONG WINAPI ISVDropTarget_AddRef( IDropTarget *iface) 1972 1971 { 1973 1974 1975 1976 1977 1972 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface); 1973 1974 TRACE("(%p)->(count=%lu)\n",This,This->ref); 1975 1976 return IShellFolder_AddRef((IShellFolder*)This); 1978 1977 } 1979 1978 1980 1979 static ULONG WINAPI ISVDropTarget_Release( IDropTarget *iface) 1981 1980 { 1982 1983 1984 1985 1986 1981 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface); 1982 1983 TRACE("(%p)->(count=%lu)\n",This,This->ref); 1984 1985 return IShellFolder_Release((IShellFolder*)This); 1987 1986 } 1988 1987 1989 1988 static HRESULT WINAPI ISVDropTarget_DragEnter( 1990 IDropTarget*iface,1991 IDataObject*pDataObject,1992 DWORDgrfKeyState,1993 POINTLpt,1994 DWORD*pdwEffect)1995 { 1996 1997 1998 1999 2000 2001 1989 IDropTarget *iface, 1990 IDataObject *pDataObject, 1991 DWORD grfKeyState, 1992 POINTL pt, 1993 DWORD *pdwEffect) 1994 { 1995 1996 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface); 1997 1998 FIXME("Stub: This=%p, DataObject=%p\n",This,pDataObject); 1999 2000 return E_NOTIMPL; 2002 2001 } 2003 2002 2004 2003 static HRESULT WINAPI ISVDropTarget_DragOver( 2005 IDropTarget*iface,2006 DWORDgrfKeyState,2007 POINTLpt,2008 DWORD*pdwEffect)2009 { 2010 2011 2012 2013 2014 2004 IDropTarget *iface, 2005 DWORD grfKeyState, 2006 POINTL pt, 2007 DWORD *pdwEffect) 2008 { 2009 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface); 2010 2011 FIXME("Stub: This=%p\n",This); 2012 2013 return E_NOTIMPL; 2015 2014 } 2016 2015 2017 2016 static HRESULT WINAPI ISVDropTarget_DragLeave( 2018 IDropTarget*iface)2019 { 2020 2021 2022 2023 2024 2017 IDropTarget *iface) 2018 { 2019 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface); 2020 2021 FIXME("Stub: This=%p\n",This); 2022 2023 return E_NOTIMPL; 2025 2024 } 2026 2025 2027 2026 static HRESULT WINAPI ISVDropTarget_Drop( 2028 IDropTarget*iface,2029 IDataObject*pDataObject,2030 DWORDgrfKeyState,2031 POINTLpt,2032 DWORD*pdwEffect)2033 { 2034 2035 2036 2037 2038 2039 } 2040 2041 static struct ICOM_VTABLE(IDropTarget) dtvt = 2042 { 2043 2044 2045 2046 2047 2048 2049 2050 2027 IDropTarget *iface, 2028 IDataObject* pDataObject, 2029 DWORD grfKeyState, 2030 POINTL pt, 2031 DWORD *pdwEffect) 2032 { 2033 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface); 2034 2035 FIXME("Stub: This=%p\n",This); 2036 2037 return E_NOTIMPL; 2038 } 2039 2040 static struct ICOM_VTABLE(IDropTarget) dtvt = 2041 { 2042 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 2043 ISVDropTarget_QueryInterface, 2044 ISVDropTarget_AddRef, 2045 ISVDropTarget_Release, 2046 ISVDropTarget_DragEnter, 2047 ISVDropTarget_DragOver, 2048 ISVDropTarget_DragLeave, 2049 ISVDropTarget_Drop 2051 2050 }; 2052 2051 … … 2056 2055 2057 2056 static HRESULT WINAPI ISVDropSource_QueryInterface( 2058 2059 2060 2061 { 2062 2063 2064 2065 2066 2057 IDropSource *iface, 2058 REFIID riid, 2059 LPVOID *ppvObj) 2060 { 2061 _ICOM_THIS_From_IDropSource(IShellViewImpl, iface); 2062 2063 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj); 2064 2065 return IShellFolder_QueryInterface((IShellFolder*)This, riid, ppvObj); 2067 2066 } 2068 2067 2069 2068 static ULONG WINAPI ISVDropSource_AddRef( IDropSource *iface) 2070 2069 { 2071 2072 2073 2074 2075 2070 _ICOM_THIS_From_IDropSource(IShellViewImpl, iface); 2071 2072 TRACE("(%p)->(count=%lu)\n",This,This->ref); 2073 2074 return IShellFolder_AddRef((IShellFolder*)This); 2076 2075 } 2077 2076 2078 2077 static ULONG WINAPI ISVDropSource_Release( IDropSource *iface) 2079 2078 { 2080 2081 2082 2083 2084 2079 _ICOM_THIS_From_IDropSource(IShellViewImpl, iface); 2080 2081 TRACE("(%p)->(count=%lu)\n",This,This->ref); 2082 2083 return IShellFolder_Release((IShellFolder*)This); 2085 2084 } 2086 2085 static HRESULT WINAPI ISVDropSource_QueryContinueDrag( 2087 2088 2089 2090 { 2091 2092 2093 2094 2095 2096 2097 2098 2099 2086 IDropSource *iface, 2087 BOOL fEscapePressed, 2088 DWORD grfKeyState) 2089 { 2090 _ICOM_THIS_From_IDropSource(IShellViewImpl, iface); 2091 TRACE("(%p)\n",This); 2092 2093 if (fEscapePressed) 2094 return DRAGDROP_S_CANCEL; 2095 else if (!(grfKeyState & MK_LBUTTON) && !(grfKeyState & MK_RBUTTON)) 2096 return DRAGDROP_S_DROP; 2097 else 2098 return NOERROR; 2100 2099 } 2101 2100 2102 2101 static HRESULT WINAPI ISVDropSource_GiveFeedback( 2103 2104 2105 { 2106 2107 2108 2109 2102 IDropSource *iface, 2103 DWORD dwEffect) 2104 { 2105 _ICOM_THIS_From_IDropSource(IShellViewImpl, iface); 2106 TRACE("(%p)\n",This); 2107 2108 return DRAGDROP_S_USEDEFAULTCURSORS; 2110 2109 } 2111 2110 2112 2111 static struct ICOM_VTABLE(IDropSource) dsvt = 2113 2112 { 2114 2115 2116 2117 2118 2119 2113 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 2114 ISVDropSource_QueryInterface, 2115 ISVDropSource_AddRef, 2116 ISVDropSource_Release, 2117 ISVDropSource_QueryContinueDrag, 2118 ISVDropSource_GiveFeedback 2120 2119 }; 2121 2120 /********************************************************** … … 2124 2123 2125 2124 static HRESULT WINAPI ISVViewObject_QueryInterface( 2126 2127 2128 2129 { 2130 2131 2132 2133 2134 2125 IViewObject *iface, 2126 REFIID riid, 2127 LPVOID *ppvObj) 2128 { 2129 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface); 2130 2131 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj); 2132 2133 return IShellFolder_QueryInterface((IShellFolder*)This, riid, ppvObj); 2135 2134 } 2136 2135 2137 2136 static ULONG WINAPI ISVViewObject_AddRef( IViewObject *iface) 2138 2137 { 2139 2140 2141 2142 2143 2138 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface); 2139 2140 TRACE("(%p)->(count=%lu)\n",This,This->ref); 2141 2142 return IShellFolder_AddRef((IShellFolder*)This); 2144 2143 } 2145 2144 2146 2145 static ULONG WINAPI ISVViewObject_Release( IViewObject *iface) 2147 2146 { 2148 2149 2150 2151 2152 2147 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface); 2148 2149 TRACE("(%p)->(count=%lu)\n",This,This->ref); 2150 2151 return IShellFolder_Release((IShellFolder*)This); 2153 2152 } 2154 2153 2155 2154 static HRESULT WINAPI ISVViewObject_Draw( 2156 IViewObject*iface,2157 2158 2159 2160 2161 2162 2163 2164 LPCRECTL lprcWBounds, 2165 2166 2167 { 2168 2169 2170 2171 2172 2173 2155 IViewObject *iface, 2156 DWORD dwDrawAspect, 2157 LONG lindex, 2158 void* pvAspect, 2159 DVTARGETDEVICE* ptd, 2160 HDC hdcTargetDev, 2161 HDC hdcDraw, 2162 LPCRECTL lprcBounds, 2163 LPCRECTL lprcWBounds, 2164 IVO_ContCallback pfnContinue, 2165 DWORD dwContinue) 2166 { 2167 2168 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface); 2169 2170 FIXME("Stub: This=%p\n",This); 2171 2172 return E_NOTIMPL; 2174 2173 } 2175 2174 static HRESULT WINAPI ISVViewObject_GetColorSet( 2176 IViewObject*iface,2177 2178 2179 2180 2181 2182 2183 { 2184 2185 2186 2187 2188 2189 2175 IViewObject *iface, 2176 DWORD dwDrawAspect, 2177 LONG lindex, 2178 void *pvAspect, 2179 DVTARGETDEVICE* ptd, 2180 HDC hicTargetDevice, 2181 LOGPALETTE** ppColorSet) 2182 { 2183 2184 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface); 2185 2186 FIXME("Stub: This=%p\n",This); 2187 2188 return E_NOTIMPL; 2190 2189 } 2191 2190 static HRESULT WINAPI ISVViewObject_Freeze( 2192 IViewObject*iface,2193 2194 2195 2196 2197 { 2198 2199 2200 2201 2202 2203 2191 IViewObject *iface, 2192 DWORD dwDrawAspect, 2193 LONG lindex, 2194 void* pvAspect, 2195 DWORD* pdwFreeze) 2196 { 2197 2198 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface); 2199 2200 FIXME("Stub: This=%p\n",This); 2201 2202 return E_NOTIMPL; 2204 2203 } 2205 2204 static HRESULT WINAPI ISVViewObject_Unfreeze( 2206 IViewObject*iface,2207 2208 { 2209 2210 2211 2212 2213 2214 2205 IViewObject *iface, 2206 DWORD dwFreeze) 2207 { 2208 2209 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface); 2210 2211 FIXME("Stub: This=%p\n",This); 2212 2213 return E_NOTIMPL; 2215 2214 } 2216 2215 static HRESULT WINAPI ISVViewObject_SetAdvise( 2217 IViewObject*iface,2218 2219 2220 2221 { 2222 2223 2224 2225 2226 2227 2216 IViewObject *iface, 2217 DWORD aspects, 2218 DWORD advf, 2219 IAdviseSink* pAdvSink) 2220 { 2221 2222 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface); 2223 2224 FIXME("Stub: This=%p\n",This); 2225 2226 return E_NOTIMPL; 2228 2227 } 2229 2228 static HRESULT WINAPI ISVViewObject_GetAdvise( 2230 IViewObject*iface,2231 2232 2233 2234 { 2235 2236 2237 2238 2239 2240 2241 } 2242 2243 2244 static struct ICOM_VTABLE(IViewObject) vovt = 2245 { 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2229 IViewObject *iface, 2230 DWORD* pAspects, 2231 DWORD* pAdvf, 2232 IAdviseSink** ppAdvSink) 2233 { 2234 2235 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface); 2236 2237 FIXME("Stub: This=%p\n",This); 2238 2239 return E_NOTIMPL; 2240 } 2241 2242 2243 static struct ICOM_VTABLE(IViewObject) vovt = 2244 { 2245 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 2246 ISVViewObject_QueryInterface, 2247 ISVViewObject_AddRef, 2248 ISVViewObject_Release, 2249 ISVViewObject_Draw, 2250 ISVViewObject_GetColorSet, 2251 ISVViewObject_Freeze, 2252 ISVViewObject_Unfreeze, 2253 ISVViewObject_SetAdvise, 2254 ISVViewObject_GetAdvise 2256 2255 }; 2257 2256 -
trunk/src/shell32/shpolicy.c
r6650 r6709 1 /* $Id: shpolicy.c,v 1.3 2001-09-05 13:47:00 bird Exp $ */2 1 /* 3 2 * shpolicy.c - Data for shell/system policies. … … 9 8 * there doesn't appear to be an updated Win98 version that 10 9 * would handle the many new policies introduced since then. 11 * You could easily write one with the information in 10 * You could easily write one with the information in 12 11 * this file... 13 * 12 * 14 13 * Up to date as of SHELL32 v4.72 (Win98, Win95 with MSIE 5) 15 14 */ … … 109 108 /* policy data array */ 110 109 111 POLICYDATA sh32_policy_table[] = 110 POLICYDATA sh32_policy_table[] = 112 111 { 113 112 { … … 456 455 457 456 /************************************************************************* 458 * SHRestricted 459 * 460 * walks through policy table, queries <app> key, <type> value, returns 457 * SHRestricted [SHELL32.100] 458 * 459 * walks through policy table, queries <app> key, <type> value, returns 461 460 * queried (DWORD) value, and caches it between called to SHInitRestricted 462 461 * to prevent unnecessary registry access. … … 465 464 * exported by ordinal 466 465 * 467 * REFERENCES: 466 * REFERENCES: 468 467 * MS System Policy Editor 469 468 * 98Lite 2.0 (which uses many of these policy keys) http://www.98lite.net/ … … 472 471 DWORD WINAPI SHRestricted (DWORD pol) { 473 472 char regstr[256]; 474 HKEYxhkey;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 517 473 HKEY xhkey; 474 DWORD retval, polidx, i, datsize = 4; 475 476 TRACE("(%08lx)\n",pol); 477 478 polidx = -1; 479 480 /* scan to see if we know this policy ID */ 481 for (i = 0; i < SHELL_MAX_POLICIES; i++) 482 { 483 if (pol == sh32_policy_table[i].polflags) 484 { 485 polidx = i; 486 break; 487 } 488 } 489 490 if (polidx == -1) 491 { 492 /* we don't know this policy, return 0 */ 493 TRACE("unknown policy: (%08lx)\n", pol); 494 return 0; 495 } 496 497 /* we have a known policy */ 498 strcpy(regstr, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\"); 499 strcat(regstr, sh32_policy_table[polidx].appstr); 500 501 /* first check if this policy has been cached, return it if so */ 502 if (sh32_policy_table[polidx].cache != SHELL_NO_POLICY) 503 { 504 return sh32_policy_table[polidx].cache; 505 } 506 507 /* return 0 and don't set the cache if any registry errors occur */ 508 retval = 0; 509 if (RegOpenKeyA(HKEY_CURRENT_USER, regstr, &xhkey) == ERROR_SUCCESS) 510 { 511 if (RegQueryValueExA(xhkey, sh32_policy_table[polidx].keystr, NULL, NULL, (LPBYTE)&retval, &datsize) == ERROR_SUCCESS) 512 { 513 sh32_policy_table[polidx].cache = retval; 514 } 515 516 RegCloseKey(xhkey); 518 517 } 519 518 520 519 return retval; 521 520 } 522 521 … … 559 558 { 560 559 if (lstrcmpiA(inpRegKey, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies")) 561 562 563 564 565 } 560 { 561 /* doesn't match, fail */ 562 return 0; 563 } 564 } 566 565 567 566 /* check passed, init all policy cache entries with SHELL_NO_POLICY */ -
trunk/src/shell32/shv_bg_cmenu.c
r6650 r6709 1 /* $Id: shv_bg_cmenu.c,v 1.3 2001-09-05 13:47:00 bird Exp $ */2 1 /* 3 * 4 * 2 * IContextMenu 3 * ShellView Background Context Menu (shv_bg_cm) 5 4 * 6 * Copyright 1999Juergen Schmied <juergen.schmied@metronet.de>5 * Copyright 1999 Juergen Schmied <juergen.schmied@metronet.de> 7 6 */ 8 7 #include <string.h> … … 25 24 * IContextMenu Implementation 26 25 */ 27 typedef struct 28 { 29 30 IShellFolder*pSFParent;31 DWORDref;26 typedef struct 27 { 28 ICOM_VFIELD(IContextMenu); 29 IShellFolder* pSFParent; 30 DWORD ref; 32 31 } BgCmImpl; 33 32 … … 38 37 * ISVBgCm_Constructor() 39 38 */ 40 IContextMenu *ISvBgCm_Constructor(IShellFolder* 41 { 42 43 44 45 46 47 48 49 50 51 52 39 IContextMenu *ISvBgCm_Constructor(IShellFolder* pSFParent) 40 { 41 BgCmImpl* cm; 42 43 cm = (BgCmImpl*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(BgCmImpl)); 44 ICOM_VTBL(cm)=&cmvt; 45 cm->ref = 1; 46 cm->pSFParent = pSFParent; 47 if(pSFParent) IShellFolder_AddRef(pSFParent); 48 49 TRACE("(%p)->()\n",cm); 50 shell32_ObjCount++; 51 return (IContextMenu*)cm; 53 52 } 54 53 … … 58 57 static HRESULT WINAPI ISVBgCm_fnQueryInterface(IContextMenu *iface, REFIID riid, LPVOID *ppvObj) 59 58 { 60 61 62 63 64 65 66 67 68 *ppvObj = This; 69 70 71 72 73 } 74 75 76 77 78 79 80 { 81 IUnknown_AddRef((IUnknown*)*ppvObj); 82 83 84 85 86 59 ICOM_THIS(BgCmImpl, iface); 60 61 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj); 62 63 *ppvObj = NULL; 64 65 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/ 66 { 67 *ppvObj = This; 68 } 69 else if(IsEqualIID(riid, &IID_IContextMenu)) /*IContextMenu*/ 70 { 71 *ppvObj = This; 72 } 73 else if(IsEqualIID(riid, &IID_IShellExtInit)) /*IShellExtInit*/ 74 { 75 FIXME("-- LPSHELLEXTINIT pointer requested\n"); 76 } 77 78 if(*ppvObj) 79 { 80 IUnknown_AddRef((IUnknown*)*ppvObj); 81 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj); 82 return S_OK; 83 } 84 TRACE("-- Interface: E_NOINTERFACE\n"); 85 return E_NOINTERFACE; 87 86 } 88 87 … … 92 91 static ULONG WINAPI ISVBgCm_fnAddRef(IContextMenu *iface) 93 92 { 94 95 96 97 98 99 93 ICOM_THIS(BgCmImpl, iface); 94 95 TRACE("(%p)->(count=%lu)\n",This, This->ref); 96 97 shell32_ObjCount++; 98 return ++(This->ref); 100 99 } 101 100 … … 105 104 static ULONG WINAPI ISVBgCm_fnRelease(IContextMenu *iface) 106 105 { 107 108 109 110 111 if (!--(This->ref)) 112 113 114 115 116 117 118 119 120 121 122 123 124 106 ICOM_THIS(BgCmImpl, iface); 107 108 TRACE("(%p)->()\n",This); 109 110 if (!--(This->ref)) 111 { 112 TRACE(" destroying IContextMenu(%p)\n",This); 113 114 if(This->pSFParent) 115 IShellFolder_Release(This->pSFParent); 116 117 HeapFree(GetProcessHeap(),0,This); 118 return 0; 119 } 120 121 shell32_ObjCount--; 122 123 return This->ref; 125 124 } 126 125 … … 130 129 131 130 static HRESULT WINAPI ISVBgCm_fnQueryContextMenu( 132 133 134 135 136 137 138 { 139 HMENUhMyMenu;140 UINTidMax;141 142 143 144 145 146 147 148 149 150 151 152 131 IContextMenu *iface, 132 HMENU hMenu, 133 UINT indexMenu, 134 UINT idCmdFirst, 135 UINT idCmdLast, 136 UINT uFlags) 137 { 138 HMENU hMyMenu; 139 UINT idMax; 140 141 ICOM_THIS(BgCmImpl, iface); 142 143 TRACE("(%p)->(hmenu=%x indexmenu=%x cmdfirst=%x cmdlast=%x flags=%x )\n",This, hMenu, indexMenu, idCmdFirst, idCmdLast, uFlags); 144 145 hMyMenu = LoadMenuA(shell32_hInstance, "MENU_002"); 146 147 idMax = Shell_MergeMenus (hMenu, GetSubMenu(hMyMenu,0), indexMenu, idCmdFirst, idCmdLast, MM_SUBMENUSHAVEIDS); 148 149 DestroyMenu(hMyMenu); 150 151 return ResultFromShort(idMax - idCmdFirst); 153 152 } 154 153 … … 157 156 */ 158 157 static void DoNewFolder( 159 160 161 { 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 158 IContextMenu *iface, 159 IShellView *psv) 160 { 161 ICOM_THIS(BgCmImpl, iface); 162 ISFHelper * psfhlp; 163 char szName[MAX_PATH]; 164 165 IShellFolder_QueryInterface(This->pSFParent, &IID_ISFHelper, (LPVOID*)&psfhlp); 166 if (psfhlp) 167 { 168 LPITEMIDLIST pidl; 169 ISFHelper_GetUniqueName(psfhlp, szName, MAX_PATH); 170 ISFHelper_AddFolder(psfhlp, 0, szName, &pidl); 171 172 if(psv) 173 { 174 /* if we are in a shellview do labeledit */ 175 IShellView_SelectItem(psv, 177 176 pidl,(SVSI_DESELECTOTHERS | SVSI_EDIT | SVSI_ENSUREVISIBLE 178 177 |SVSI_FOCUSED|SVSI_SELECT)); 179 180 181 182 183 178 } 179 SHFree(pidl); 180 181 ISFHelper_Release(psfhlp); 182 } 184 183 } 185 184 … … 188 187 */ 189 188 static BOOL DoPaste( 190 191 { 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 189 IContextMenu *iface) 190 { 191 ICOM_THIS(BgCmImpl, iface); 192 BOOL bSuccess = FALSE; 193 IDataObject * pda; 194 195 TRACE("\n"); 196 197 if(SUCCEEDED(pOleGetClipboard(&pda))) 198 { 199 STGMEDIUM medium; 200 FORMATETC formatetc; 201 202 TRACE("pda=%p\n", pda); 203 204 /* Set the FORMATETC structure*/ 205 InitFormatEtc(formatetc, RegisterClipboardFormatA(CFSTR_SHELLIDLIST), TYMED_HGLOBAL); 206 207 /* Get the pidls from IDataObject */ 208 if(SUCCEEDED(IDataObject_GetData(pda,&formatetc,&medium))) 210 209 { 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 /* fixme handle move 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 210 LPITEMIDLIST * apidl; 211 LPITEMIDLIST pidl; 212 IShellFolder *psfFrom = NULL, *psfDesktop; 213 214 LPCIDA lpcida = GlobalLock(medium.u.hGlobal); 215 TRACE("cida=%p\n", lpcida); 216 217 apidl = _ILCopyCidaToaPidl(&pidl, lpcida); 218 219 /* bind to the source shellfolder */ 220 SHGetDesktopFolder(&psfDesktop); 221 if(psfDesktop) 222 { 223 IShellFolder_BindToObject(psfDesktop, pidl, NULL, &IID_IShellFolder, (LPVOID*)&psfFrom); 224 IShellFolder_Release(psfDesktop); 225 } 226 227 if (psfFrom) 228 { 229 /* get source and destination shellfolder */ 230 ISFHelper *psfhlpdst, *psfhlpsrc; 231 IShellFolder_QueryInterface(This->pSFParent, &IID_ISFHelper, (LPVOID*)&psfhlpdst); 232 IShellFolder_QueryInterface(psfFrom, &IID_ISFHelper, (LPVOID*)&psfhlpsrc); 233 234 /* do the copy/move */ 235 if (psfhlpdst && psfhlpsrc) 236 { 237 ISFHelper_CopyItems(psfhlpdst, psfFrom, lpcida->cidl, apidl); 238 /* fixme handle move 239 ISFHelper_DeleteItems(psfhlpsrc, lpcida->cidl, apidl); 240 */ 241 } 242 if(psfhlpdst) ISFHelper_Release(psfhlpdst); 243 if(psfhlpsrc) ISFHelper_Release(psfhlpsrc); 244 IShellFolder_Release(psfFrom); 245 } 246 247 _ILFreeaPidl(apidl, lpcida->cidl); 248 SHFree(pidl); 249 250 /* release the medium*/ 251 pReleaseStgMedium(&medium); 252 } 253 IDataObject_Release(pda); 254 } 256 255 #if 0 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 256 HGLOBAL hMem; 257 258 OpenClipboard(NULL); 259 hMem = GetClipboardData(CF_HDROP); 260 261 if(hMem) 262 { 263 char * pDropFiles = (char *)GlobalLock(hMem); 264 if(pDropFiles) 265 { 266 int len, offset = sizeof(DROPFILESTRUCT); 267 268 while( pDropFiles[offset] != 0) 269 { 270 len = strlen(pDropFiles + offset); 271 TRACE("%s\n", pDropFiles + offset); 272 offset += len+1; 273 } 274 } 275 GlobalUnlock(hMem); 276 } 277 CloseClipboard(); 279 278 #endif 280 279 return bSuccess; 281 280 } 282 281 /************************************************************************** … … 284 283 */ 285 284 static HRESULT WINAPI ISVBgCm_fnInvokeCommand( 286 287 288 { 289 290 291 LPSHELLBROWSERlpSB;292 LPSHELLVIEWlpSV;293 HWNDhWndSV;294 295 TRACE("(%p)->(invcom=%p verb=%p wnd=%x)\n",This,lpcmi,lpcmi->lpVerb, lpcmi->hwnd); 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 IShellView_Release(lpSV);/* QueryActiveShellView does AddRef*/347 348 285 IContextMenu *iface, 286 LPCMINVOKECOMMANDINFO lpcmi) 287 { 288 ICOM_THIS(BgCmImpl, iface); 289 290 LPSHELLBROWSER lpSB; 291 LPSHELLVIEW lpSV; 292 HWND hWndSV; 293 294 TRACE("(%p)->(invcom=%p verb=%p wnd=%x)\n",This,lpcmi,lpcmi->lpVerb, lpcmi->hwnd); 295 296 /* get the active IShellView */ 297 if((lpSB = (LPSHELLBROWSER)SendMessageA(lpcmi->hwnd, CWM_GETISHELLBROWSER,0,0))) 298 { 299 if(SUCCEEDED(IShellBrowser_QueryActiveShellView(lpSB, &lpSV))) 300 { 301 IShellView_GetWindow(lpSV, &hWndSV); 302 } 303 } 304 305 if(lpSV) 306 { 307 if(HIWORD(lpcmi->lpVerb)) 308 { 309 TRACE("%s\n",lpcmi->lpVerb); 310 311 if (! strcmp(lpcmi->lpVerb,CMDSTR_NEWFOLDERA)) 312 { 313 if(lpSV) DoNewFolder(iface, lpSV); 314 } 315 else if (! strcmp(lpcmi->lpVerb,CMDSTR_VIEWLISTA)) 316 { 317 if(hWndSV) SendMessageA(hWndSV, WM_COMMAND, MAKEWPARAM(FCIDM_SHVIEW_LISTVIEW,0),0 ); 318 } 319 else if (! strcmp(lpcmi->lpVerb,CMDSTR_VIEWDETAILSA)) 320 { 321 if(hWndSV) SendMessageA(hWndSV, WM_COMMAND, MAKEWPARAM(FCIDM_SHVIEW_REPORTVIEW,0),0 ); 322 } 323 else 324 { 325 FIXME("please report: unknown verb %s\n",lpcmi->lpVerb); 326 } 327 } 328 else 329 { 330 switch(LOWORD(lpcmi->lpVerb)) 331 { 332 case FCIDM_SHVIEW_NEWFOLDER: 333 DoNewFolder(iface, lpSV); 334 break; 335 case FCIDM_SHVIEW_INSERT: 336 DoPaste(iface); 337 break; 338 default: 339 /* if it's a id just pass it to the parent shv */ 340 SendMessageA(hWndSV, WM_COMMAND, MAKEWPARAM(LOWORD(lpcmi->lpVerb), 0),0 ); 341 break; 342 } 343 } 344 345 IShellView_Release(lpSV); /* QueryActiveShellView does AddRef*/ 346 } 347 return NOERROR; 349 348 } 350 349 … … 354 353 */ 355 354 static HRESULT WINAPI ISVBgCm_fnGetCommandString( 356 357 358 359 360 361 362 { 363 364 365 366 367 /* test the existence of the menu items, the file dialog enables 368 369 370 371 372 373 374 375 376 { 377 378 379 380 381 382 383 355 IContextMenu *iface, 356 UINT idCommand, 357 UINT uFlags, 358 LPUINT lpReserved, 359 LPSTR lpszName, 360 UINT uMaxNameLen) 361 { 362 ICOM_THIS(BgCmImpl, iface); 363 364 TRACE("(%p)->(idcom=%x flags=%x %p name=%p len=%x)\n",This, idCommand, uFlags, lpReserved, lpszName, uMaxNameLen); 365 366 /* test the existence of the menu items, the file dialog enables 367 the buttons according to this */ 368 if (uFlags == GCS_VALIDATEA) 369 { 370 if(HIWORD(idCommand)) 371 { 372 if (!strcmp((LPSTR)idCommand, CMDSTR_VIEWLISTA) || 373 !strcmp((LPSTR)idCommand, CMDSTR_VIEWDETAILSA) || 374 !strcmp((LPSTR)idCommand, CMDSTR_NEWFOLDERA)) 375 { 376 return NOERROR; 377 } 378 } 379 } 380 381 FIXME("unknown command string\n"); 382 return E_FAIL; 384 383 } 385 384 … … 388 387 */ 389 388 static HRESULT WINAPI ISVBgCm_fnHandleMenuMsg( 390 391 392 393 394 { 395 396 397 398 399 389 IContextMenu *iface, 390 UINT uMsg, 391 WPARAM wParam, 392 LPARAM lParam) 393 { 394 ICOM_THIS(BgCmImpl, iface); 395 396 FIXME("(%p)->(msg=%x wp=%x lp=%lx)\n",This, uMsg, wParam, lParam); 397 398 return E_NOTIMPL; 400 399 } 401 400 402 401 /************************************************************************** 403 402 * IContextMenu VTable 404 * 405 */ 406 static struct ICOM_VTABLE(IContextMenu) cmvt = 407 { 408 409 410 411 412 413 414 415 416 (void *) 0xdeadbabe/* just paranoia (IContextMenu3) */403 * 404 */ 405 static struct ICOM_VTABLE(IContextMenu) cmvt = 406 { 407 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 408 ISVBgCm_fnQueryInterface, 409 ISVBgCm_fnAddRef, 410 ISVBgCm_fnRelease, 411 ISVBgCm_fnQueryContextMenu, 412 ISVBgCm_fnInvokeCommand, 413 ISVBgCm_fnGetCommandString, 414 ISVBgCm_fnHandleMenuMsg, 415 (void *) 0xdeadbabe /* just paranoia (IContextMenu3) */ 417 416 }; 418 417 -
trunk/src/shell32/shv_item_cmenu.c
r6650 r6709 1 /* $Id: shv_item_cmenu.c,v 1.3 2001-09-05 13:47:00 bird Exp $ */2 1 /* 3 * 2 * IContextMenu for items in the shellview 4 3 * 5 * 1998, 2000Juergen Schmied <juergen.schmied@debitel.net>4 * 1998, 2000 Juergen Schmied <juergen.schmied@debitel.net> 6 5 */ 7 6 #include <string.h> … … 26 25 * IContextMenu Implementation 27 26 */ 28 typedef struct 29 { 30 DWORDref;31 IShellFolder*pSFParent;32 LPITEMIDLIST pidl;/* root pidl */33 LPITEMIDLIST *apidl;/* array of child pidls */34 UINTcidl;35 BOOLbAllValues;27 typedef struct 28 { ICOM_VFIELD(IContextMenu); 29 DWORD ref; 30 IShellFolder* pSFParent; 31 LPITEMIDLIST pidl; /* root pidl */ 32 LPITEMIDLIST *apidl; /* array of child pidls */ 33 UINT cidl; 34 BOOL bAllValues; 36 35 } ItemCmImpl; 37 36 … … 43 42 */ 44 43 static BOOL ISvItemCm_CanRenameItems(ItemCmImpl *This) 45 { 46 47 48 49 50 51 52 53 if(i > 1) return FALSE;/* can't rename more than one item at a time*/54 55 56 57 58 44 { UINT i; 45 DWORD dwAttributes; 46 47 TRACE("(%p)->()\n",This); 48 49 if(This->apidl) 50 { 51 for(i = 0; i < This->cidl; i++){} 52 if(i > 1) return FALSE; /* can't rename more than one item at a time*/ 53 dwAttributes = SFGAO_CANRENAME; 54 IShellFolder_GetAttributesOf(This->pSFParent, 1, This->apidl, &dwAttributes); 55 return dwAttributes & SFGAO_CANRENAME; 56 } 57 return FALSE; 59 58 } 60 59 … … 63 62 */ 64 63 IContextMenu *ISvItemCm_Constructor(LPSHELLFOLDER pSFParent, LPCITEMIDLIST pidl, LPCITEMIDLIST *apidl, UINT cidl) 65 { 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 64 { ItemCmImpl* cm; 65 UINT u; 66 67 cm = (ItemCmImpl*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(ItemCmImpl)); 68 ICOM_VTBL(cm)=&cmvt; 69 cm->ref = 1; 70 cm->pidl = ILClone(pidl); 71 cm->pSFParent = pSFParent; 72 73 if(pSFParent) IShellFolder_AddRef(pSFParent); 74 75 cm->apidl = _ILCopyaPidl(apidl, cidl); 76 cm->cidl = cidl; 77 78 cm->bAllValues = 1; 79 for(u = 0; u < cidl; u++) 80 { 81 cm->bAllValues &= (_ILIsValue(apidl[u]) ? 1 : 0); 82 } 83 84 TRACE("(%p)->()\n",cm); 85 86 shell32_ObjCount++; 87 return (IContextMenu*)cm; 89 88 } 90 89 … … 94 93 static HRESULT WINAPI ISvItemCm_fnQueryInterface(IContextMenu *iface, REFIID riid, LPVOID *ppvObj) 95 94 { 96 97 98 99 100 101 102 103 104 *ppvObj = This; 105 106 107 108 109 } 110 111 112 113 114 115 116 { 117 IUnknown_AddRef((IUnknown*)*ppvObj); 118 119 120 121 122 95 ICOM_THIS(ItemCmImpl, iface); 96 97 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj); 98 99 *ppvObj = NULL; 100 101 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/ 102 { 103 *ppvObj = This; 104 } 105 else if(IsEqualIID(riid, &IID_IContextMenu)) /*IContextMenu*/ 106 { 107 *ppvObj = This; 108 } 109 else if(IsEqualIID(riid, &IID_IShellExtInit)) /*IShellExtInit*/ 110 { 111 FIXME("-- LPSHELLEXTINIT pointer requested\n"); 112 } 113 114 if(*ppvObj) 115 { 116 IUnknown_AddRef((IUnknown*)*ppvObj); 117 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj); 118 return S_OK; 119 } 120 TRACE("-- Interface: E_NOINTERFACE\n"); 121 return E_NOINTERFACE; 123 122 } 124 123 … … 128 127 static ULONG WINAPI ISvItemCm_fnAddRef(IContextMenu *iface) 129 128 { 130 131 132 133 134 135 129 ICOM_THIS(ItemCmImpl, iface); 130 131 TRACE("(%p)->(count=%lu)\n",This, This->ref); 132 133 shell32_ObjCount++; 134 return ++(This->ref); 136 135 } 137 136 … … 141 140 static ULONG WINAPI ISvItemCm_fnRelease(IContextMenu *iface) 142 141 { 143 144 145 146 147 148 149 if (!--(This->ref)) 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 142 ICOM_THIS(ItemCmImpl, iface); 143 144 TRACE("(%p)->()\n",This); 145 146 shell32_ObjCount--; 147 148 if (!--(This->ref)) 149 { 150 TRACE(" destroying IContextMenu(%p)\n",This); 151 152 if(This->pSFParent) 153 IShellFolder_Release(This->pSFParent); 154 155 if(This->pidl) 156 SHFree(This->pidl); 157 158 /*make sure the pidl is freed*/ 159 _ILFreeaPidl(This->apidl, This->cidl); 160 161 HeapFree(GetProcessHeap(),0,This); 162 return 0; 163 } 164 return This->ref; 166 165 } 167 166 168 167 /************************************************************************** 169 168 * ICM_InsertItem() 170 */ 169 */ 171 170 void WINAPI _InsertMenuItem ( 172 173 174 175 176 177 178 179 { 180 MENUITEMINFOAmii;181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 171 HMENU hmenu, 172 UINT indexMenu, 173 BOOL fByPosition, 174 UINT wID, 175 UINT fType, 176 LPSTR dwTypeData, 177 UINT fState) 178 { 179 MENUITEMINFOA mii; 180 181 ZeroMemory(&mii, sizeof(mii)); 182 mii.cbSize = sizeof(mii); 183 if (fType == MFT_SEPARATOR) 184 { 185 mii.fMask = MIIM_ID | MIIM_TYPE; 186 } 187 else 188 { 189 mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE; 190 mii.dwTypeData = dwTypeData; 191 mii.fState = fState; 192 } 193 mii.wID = wID; 194 mii.fType = fType; 195 InsertMenuItemA( hmenu, indexMenu, fByPosition, &mii); 197 196 } 198 197 /************************************************************************** … … 201 200 202 201 static HRESULT WINAPI ISvItemCm_fnQueryContextMenu( 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 245 202 IContextMenu *iface, 203 HMENU hmenu, 204 UINT indexMenu, 205 UINT idCmdFirst, 206 UINT idCmdLast, 207 UINT uFlags) 208 { 209 ICOM_THIS(ItemCmImpl, iface); 210 211 TRACE("(%p)->(hmenu=%x indexmenu=%x cmdfirst=%x cmdlast=%x flags=%x )\n",This, hmenu, indexMenu, idCmdFirst, idCmdLast, uFlags); 212 213 if(!(CMF_DEFAULTONLY & uFlags)) 214 { 215 if(uFlags & CMF_EXPLORE) 216 { 217 if(This->bAllValues) 218 { 219 _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_OPEN, MFT_STRING, "&Open", MFS_ENABLED); 220 _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_EXPLORE, MFT_STRING, "&Explore", MFS_ENABLED|MFS_DEFAULT); 221 } 222 else 223 { 224 _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_EXPLORE, MFT_STRING, "&Explore", MFS_ENABLED|MFS_DEFAULT); 225 _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_OPEN, MFT_STRING, "&Open", MFS_ENABLED); 226 } 227 } 228 else 229 { 230 _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_OPEN, MFT_STRING, "&Select", MFS_ENABLED|MFS_DEFAULT); 231 } 232 _InsertMenuItem(hmenu, indexMenu++, TRUE, 0, MFT_SEPARATOR, NULL, 0); 233 _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_COPY, MFT_STRING, "&Copy", MFS_ENABLED); 234 _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_CUT, MFT_STRING, "&Cut", MFS_ENABLED); 235 236 _InsertMenuItem(hmenu, indexMenu++, TRUE, 0, MFT_SEPARATOR, NULL, 0); 237 _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_DELETE, MFT_STRING, "&Delete", MFS_ENABLED); 238 239 if(uFlags & CMF_CANRENAME) 240 _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_RENAME, MFT_STRING, "&Rename", ISvItemCm_CanRenameItems(This) ? MFS_ENABLED : MFS_DISABLED); 241 242 return MAKE_HRESULT(SEVERITY_SUCCESS, 0, (FCIDM_SHVIEWLAST)); 243 } 244 return MAKE_HRESULT(SEVERITY_SUCCESS, 0, 0); 246 245 } 247 246 … … 253 252 254 253 static void DoOpenExplore( 255 256 257 258 { 259 260 261 262 LPITEMIDLISTpidlFQ;263 SHELLEXECUTEINFOAsei;264 265 /* Find the first item in the list that is not a value. These commands 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 254 IContextMenu *iface, 255 HWND hwnd, 256 LPCSTR verb) 257 { 258 ICOM_THIS(ItemCmImpl, iface); 259 260 int i, bFolderFound = FALSE; 261 LPITEMIDLIST pidlFQ; 262 SHELLEXECUTEINFOA sei; 263 264 /* Find the first item in the list that is not a value. These commands 265 should never be invoked if there isn't at least one folder item in the list.*/ 266 267 for(i = 0; i<This->cidl; i++) 268 { 269 if(!_ILIsValue(This->apidl[i])) 270 { 271 bFolderFound = TRUE; 272 break; 273 } 274 } 275 276 if (!bFolderFound) return; 277 278 pidlFQ = ILCombine(This->pidl, This->apidl[i]); 279 280 ZeroMemory(&sei, sizeof(sei)); 281 sei.cbSize = sizeof(sei); 282 sei.fMask = SEE_MASK_IDLIST | SEE_MASK_CLASSNAME; 283 sei.lpIDList = pidlFQ; 284 sei.lpClass = "folder"; 285 sei.hwnd = hwnd; 286 sei.nShow = SW_SHOWNORMAL; 287 sei.lpVerb = verb; 288 ShellExecuteExA(&sei); 289 SHFree(pidlFQ); 291 290 } 292 291 … … 295 294 */ 296 295 static void DoRename( 297 298 299 { 300 301 302 LPSHELLBROWSERlpSB;303 LPSHELLVIEWlpSV;304 305 TRACE("(%p)->(wnd=%x)\n",This, hwnd); 306 307 308 309 310 311 312 TRACE("(sv=%p)\n",lpSV); 313 296 IContextMenu *iface, 297 HWND hwnd) 298 { 299 ICOM_THIS(ItemCmImpl, iface); 300 301 LPSHELLBROWSER lpSB; 302 LPSHELLVIEW lpSV; 303 304 TRACE("(%p)->(wnd=%x)\n",This, hwnd); 305 306 /* get the active IShellView */ 307 if ((lpSB = (LPSHELLBROWSER)SendMessageA(hwnd, CWM_GETISHELLBROWSER,0,0))) 308 { 309 if(SUCCEEDED(IShellBrowser_QueryActiveShellView(lpSB, &lpSV))) 310 { 311 TRACE("(sv=%p)\n",lpSV); 312 IShellView_SelectItem(lpSV, This->apidl[0], 314 313 SVSI_DESELECTOTHERS|SVSI_EDIT|SVSI_ENSUREVISIBLE|SVSI_FOCUSED|SVSI_SELECT); 315 316 317 314 IShellView_Release(lpSV); 315 } 316 } 318 317 } 319 318 … … 325 324 static void DoDelete(IContextMenu *iface) 326 325 { 327 328 329 330 331 332 333 334 335 326 ICOM_THIS(ItemCmImpl, iface); 327 ISFHelper * psfhlp; 328 329 IShellFolder_QueryInterface(This->pSFParent, &IID_ISFHelper, (LPVOID*)&psfhlp); 330 if (psfhlp) 331 { 332 ISFHelper_DeleteItems(psfhlp, This->cidl, This->apidl); 333 ISFHelper_Release(psfhlp); 334 } 336 335 } 337 336 … … 342 341 */ 343 342 static BOOL DoCopyOrCut( 344 345 346 347 { 348 349 350 LPSHELLBROWSERlpSB;351 LPSHELLVIEWlpSV;352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 343 IContextMenu *iface, 344 HWND hwnd, 345 BOOL bCut) 346 { 347 ICOM_THIS(ItemCmImpl, iface); 348 349 LPSHELLBROWSER lpSB; 350 LPSHELLVIEW lpSV; 351 LPDATAOBJECT lpDo; 352 353 TRACE("(%p)->(wnd=0x%04x,bCut=0x%08x)\n",This, hwnd, bCut); 354 355 if(GetShellOle()) 356 { 357 /* get the active IShellView */ 358 if ((lpSB = (LPSHELLBROWSER)SendMessageA(hwnd, CWM_GETISHELLBROWSER,0,0))) 359 { 360 if (SUCCEEDED(IShellBrowser_QueryActiveShellView(lpSB, &lpSV))) 361 { 362 if (SUCCEEDED(IShellView_GetItemObject(lpSV, SVGIO_SELECTION, &IID_IDataObject, (LPVOID*)&lpDo))) 363 { 364 pOleSetClipboard(lpDo); 365 IDataObject_Release(lpDo); 366 } 367 IShellView_Release(lpSV); 368 } 369 } 370 } 371 return TRUE; 373 372 #if 0 374 373 /* … … 376 375 we might need this possibility too (js) 377 376 */ 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 410 377 BOOL bSuccess = FALSE; 378 379 TRACE("(%p)\n", iface); 380 381 if(OpenClipboard(NULL)) 382 { 383 if(EmptyClipboard()) 384 { 385 IPersistFolder2 * ppf2; 386 IShellFolder_QueryInterface(This->pSFParent, &IID_IPersistFolder2, (LPVOID*)&ppf2); 387 if (ppf2) 388 { 389 LPITEMIDLIST pidl; 390 IPersistFolder2_GetCurFolder(ppf2, &pidl); 391 if(pidl) 392 { 393 HGLOBAL hMem; 394 395 hMem = RenderHDROP(pidl, This->apidl, This->cidl); 396 397 if(SetClipboardData(CF_HDROP, hMem)) 398 { 399 bSuccess = TRUE; 400 } 401 SHFree(pidl); 402 } 403 IPersistFolder2_Release(ppf2); 404 } 405 406 } 407 CloseClipboard(); 408 } 409 return bSuccess; 411 410 #endif 412 411 } … … 415 414 */ 416 415 static HRESULT WINAPI ISvItemCm_fnInvokeCommand( 417 418 419 { 420 421 422 TRACE("(%p)->(invcom=%p verb=%p wnd=%x)\n",This,lpcmi,lpcmi->lpVerb, lpcmi->hwnd); 423 424 425 426 427 428 429 430 431 432 433 434 435 436 break; 437 438 439 break; 440 441 442 443 444 445 446 447 416 IContextMenu *iface, 417 LPCMINVOKECOMMANDINFO lpcmi) 418 { 419 ICOM_THIS(ItemCmImpl, iface); 420 421 TRACE("(%p)->(invcom=%p verb=%p wnd=%x)\n",This,lpcmi,lpcmi->lpVerb, lpcmi->hwnd); 422 423 if(LOWORD(lpcmi->lpVerb) > FCIDM_SHVIEWLAST) return E_INVALIDARG; 424 425 switch(LOWORD(lpcmi->lpVerb)) 426 { 427 case FCIDM_SHVIEW_EXPLORE: 428 DoOpenExplore(iface, lpcmi->hwnd, "explore"); 429 break; 430 case FCIDM_SHVIEW_OPEN: 431 DoOpenExplore(iface, lpcmi->hwnd, "open"); 432 break; 433 case FCIDM_SHVIEW_RENAME: 434 DoRename(iface, lpcmi->hwnd); 435 break; 436 case FCIDM_SHVIEW_DELETE: 437 DoDelete(iface); 438 break; 439 case FCIDM_SHVIEW_COPY: 440 DoCopyOrCut(iface, lpcmi->hwnd, FALSE); 441 break; 442 case FCIDM_SHVIEW_CUT: 443 DoCopyOrCut(iface, lpcmi->hwnd, TRUE); 444 break; 445 } 446 return NOERROR; 448 447 } 449 448 … … 452 451 */ 453 452 static HRESULT WINAPI ISvItemCm_fnGetCommandString( 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 483 /* NT 4.0 with IE 3.0x or no IE will always call This with GCS_VERBW. In This 484 485 486 487 453 IContextMenu *iface, 454 UINT idCommand, 455 UINT uFlags, 456 LPUINT lpReserved, 457 LPSTR lpszName, 458 UINT uMaxNameLen) 459 { 460 ICOM_THIS(ItemCmImpl, iface); 461 462 HRESULT hr = E_INVALIDARG; 463 464 TRACE("(%p)->(idcom=%x flags=%x %p name=%p len=%x)\n",This, idCommand, uFlags, lpReserved, lpszName, uMaxNameLen); 465 466 switch(uFlags) 467 { 468 case GCS_HELPTEXT: 469 hr = E_NOTIMPL; 470 break; 471 472 case GCS_VERBA: 473 switch(idCommand) 474 { 475 case FCIDM_SHVIEW_RENAME: 476 strcpy((LPSTR)lpszName, "rename"); 477 hr = NOERROR; 478 break; 479 } 480 break; 481 482 /* NT 4.0 with IE 3.0x or no IE will always call This with GCS_VERBW. In This 483 case, you need to do the lstrcpyW to the pointer passed.*/ 484 case GCS_VERBW: 485 switch(idCommand) 486 { case FCIDM_SHVIEW_RENAME: 488 487 MultiByteToWideChar( CP_ACP, 0, "rename", -1, (LPWSTR)lpszName, uMaxNameLen ); 489 490 491 492 493 494 495 496 497 498 499 488 hr = NOERROR; 489 break; 490 } 491 break; 492 493 case GCS_VALIDATE: 494 hr = NOERROR; 495 break; 496 } 497 TRACE("-- (%p)->(name=%s)\n",This, lpszName); 498 return hr; 500 499 } 501 500 … … 507 506 */ 508 507 static HRESULT WINAPI ISvItemCm_fnHandleMenuMsg( 509 510 511 512 513 { 514 515 516 517 518 519 } 520 521 static struct ICOM_VTABLE(IContextMenu) cmvt = 522 { 523 524 525 526 527 528 529 530 531 (void *) 0xdeadbabe/* just paranoia */508 IContextMenu *iface, 509 UINT uMsg, 510 WPARAM wParam, 511 LPARAM lParam) 512 { 513 ICOM_THIS(ItemCmImpl, iface); 514 515 TRACE("(%p)->(msg=%x wp=%x lp=%lx)\n",This, uMsg, wParam, lParam); 516 517 return E_NOTIMPL; 518 } 519 520 static struct ICOM_VTABLE(IContextMenu) cmvt = 521 { 522 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 523 ISvItemCm_fnQueryInterface, 524 ISvItemCm_fnAddRef, 525 ISvItemCm_fnRelease, 526 ISvItemCm_fnQueryContextMenu, 527 ISvItemCm_fnInvokeCommand, 528 ISvItemCm_fnGetCommandString, 529 ISvItemCm_fnHandleMenuMsg, 530 (void *) 0xdeadbabe /* just paranoia */ 532 531 }; -
trunk/src/shell32/systray.c
r6650 r6709 1 /* $Id: systray.c,v 1.3 2001-09-05 13:47:01 bird Exp $ */2 1 /* 3 * 2 * Systray 4 3 * 5 * Copyright 1999 Kai Morich<kai.morich@bigfoot.de>4 * Copyright 1999 Kai Morich <kai.morich@bigfoot.de> 6 5 * 7 6 * Manage the systray window. That it actually appears in the docking … … 67 66 while (ptrayItem) { 68 67 if (ptrayItem->hWnd==hWnd) { 69 70 71 72 73 74 75 76 77 78 68 if (ptrayItem->notifyIcon.hIcon) { 69 hdc = BeginPaint(hWnd, &ps); 70 GetClientRect(hWnd, &rc); 71 if (!DrawIconEx(hdc, rc.left+ICON_BORDER, rc.top+ICON_BORDER, ptrayItem->notifyIcon.hIcon, 72 ICON_SIZE, ICON_SIZE, 0, 0, DI_DEFAULTSIZE|DI_NORMAL)) { 73 ERR("Paint(SystrayWindow 0x%08x) failed -> removing SystrayItem %p\n", hWnd, ptrayItem); 74 SYSTRAY_Delete(&ptrayItem->notifyIcon); 75 } 76 } 77 break; 79 78 } 80 79 ptrayItem = ptrayItem->nextTrayItem; … … 120 119 while (ptrayItem) { 121 120 if (ptrayItem->hWnd == hWnd) { 122 121 if (ptrayItem->notifyIcon.hWnd && ptrayItem->notifyIcon.uCallbackMessage) { 123 122 if (!PostMessageA(ptrayItem->notifyIcon.hWnd, ptrayItem->notifyIcon.uCallbackMessage, 124 123 (WPARAM)ptrayItem->notifyIcon.uID, (LPARAM)message)) { 125 ERR("PostMessage(SystrayWindow 0x%08x) failed -> removing SystrayItem %p\n", hWnd, ptrayItem); 126 SYSTRAY_Delete(&ptrayItem->notifyIcon); 124 ERR("PostMessage(SystrayWindow 0x%08x) failed -> removing SystrayItem %p\n", hWnd, ptrayItem); 125 SYSTRAY_Delete(&ptrayItem->notifyIcon); 126 } 127 127 } 128 } 129 break; 128 break; 130 129 } 131 130 ptrayItem = ptrayItem->nextTrayItem; … … 220 219 { 221 220 if(ptrayItem->notifyIcon.hIcon) 222 DestroyIcon(ptrayItem->notifyIcon.hIcon); 221 DestroyIcon(ptrayItem->notifyIcon.hIcon); 223 222 if(ptrayItem->hWndToolTip) 224 223 DestroyWindow(ptrayItem->hWndToolTip); … … 346 345 347 346 /************************************************************************* 348 * Shell_NotifyIconA 347 * Shell_NotifyIconA [SHELL32.297][SHELL32.296] 349 348 */ 350 349 BOOL WINAPI Shell_NotifyIconA(DWORD dwMessage, PNOTIFYICONDATAA pnid ) … … 368 367 369 368 /************************************************************************* 370 * Shell_NotifyIconW 369 * Shell_NotifyIconW [SHELL32.298] 371 370 */ 372 371 BOOL WINAPI Shell_NotifyIconW (DWORD dwMessage, PNOTIFYICONDATAW pnid ) 373 372 { 374 375 376 377 373 BOOL ret; 374 375 PNOTIFYICONDATAA p = HeapAlloc(GetProcessHeap(),0,sizeof(NOTIFYICONDATAA)); 376 memcpy(p, pnid, sizeof(NOTIFYICONDATAA)); 378 377 WideCharToMultiByte( CP_ACP, 0, pnid->szTip, -1, p->szTip, sizeof(p->szTip), NULL, NULL ); 379 378 p->szTip[sizeof(p->szTip)-1] = 0; 380 379 381 382 383 384 385 } 380 ret = Shell_NotifyIconA(dwMessage, p ); 381 382 HeapFree(GetProcessHeap(),0,p); 383 return ret; 384 }
Note:
See TracChangeset
for help on using the changeset viewer.