[SHELL32] Rewrite the wrapping code for shell taskbar notifications.
[reactos.git] / sdk / include / reactos / undocshell.h
1 /*
2 * Copyright 1999, 2000 Juergen Schmied
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 */
18
19 #ifndef __WINE_UNDOCSHELL_H
20 #define __WINE_UNDOCSHELL_H
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif /* defined(__cplusplus) */
25
26
27 #if (NTDDI_VERSION < NTDDI_LONGHORN)
28 #define DBIMF_NOGRIPPER 0x0800
29 #define DBIMF_ALWAYSGRIPPER 0x1000
30 #define DBIMF_NOMARGINS 0x2000
31 #endif // NTDDI_LONGHORN
32
33 #if defined (_SHELLAPI_H) || defined (_INC_SHELLAPI)
34
35 /****************************************************************************
36 * Taskbar interface WM_COPYDATA structures
37 * See http://www.geoffchappell.com/studies/windows/shell/shell32/api/shlnot/copydata.htm
38 */
39 /* Data structure for Shell_NotifyIcon messages */
40 typedef struct _TRAYNOTIFYDATAW
41 {
42 DWORD dwSignature;
43 DWORD dwMessage;
44 NOTIFYICONDATAW nid; // Always use the latest NOTIFYICONDATAW structure version.
45 } TRAYNOTIFYDATAW, *PTRAYNOTIFYDATAW;
46 // Note: One could also introduce TRAYNOTIFYDATAA
47
48 #define NI_NOTIFY_SIG 0x34753423 /* TRAYNOTIFYDATA */
49
50 #endif /* defined (_SHELLAPI_H) || defined (_INC_SHELLAPI) */
51
52
53 /****************************************************************************
54 * Taskbar WM_COMMAND identifiers
55 */
56 #define TWM_DOEXITWINDOWS (WM_USER + 342)
57 #define TWM_CYCLEFOCUS (WM_USER + 348)
58
59
60 /****************************************************************************
61 * IDList Functions
62 */
63 BOOL WINAPI ILGetDisplayName(
64 LPCITEMIDLIST pidl,
65 LPVOID path);
66
67 /* type parameter for ILGetDisplayNameEx() */
68 #define ILGDN_FORPARSING 0
69 #define ILGDN_NORMAL 1
70 #define ILGDN_INFOLDER 2
71
72 BOOL WINAPI ILGetDisplayNameEx(
73 LPSHELLFOLDER psf,
74 LPCITEMIDLIST pidl,
75 LPVOID path,
76 DWORD type);
77
78 LPITEMIDLIST WINAPI ILGlobalClone(LPCITEMIDLIST pidl);
79 void WINAPI ILGlobalFree(LPITEMIDLIST pidl);
80 LPITEMIDLIST WINAPI SHSimpleIDListFromPathA (LPCSTR lpszPath); //FIXME
81 LPITEMIDLIST WINAPI SHSimpleIDListFromPathW (LPCWSTR lpszPath);
82
83 HRESULT WINAPI SHILCreateFromPathA (
84 LPCSTR path,
85 LPITEMIDLIST * ppidl,
86 DWORD *attributes);
87
88 HRESULT WINAPI SHILCreateFromPathW (
89 LPCWSTR path,
90 LPITEMIDLIST * ppidl,
91 DWORD *attributes);
92
93 /*
94 string functions
95 */
96 BOOL WINAPI StrRetToStrNA(LPSTR,DWORD,LPSTRRET,const ITEMIDLIST*);
97 BOOL WINAPI StrRetToStrNW(LPWSTR,DWORD,LPSTRRET,const ITEMIDLIST*);
98
99
100 /****************************************************************************
101 * SHChangeNotifyRegister API
102 */
103 #define SHCNRF_InterruptLevel 0x0001
104 #define SHCNRF_ShellLevel 0x0002
105 #define SHCNRF_RecursiveInterrupt 0x1000 /* Must be combined with SHCNRF_InterruptLevel */
106 #define SHCNRF_NewDelivery 0x8000 /* Messages use shared memory */
107
108
109 /****************************************************************************
110 * Shell Common Dialogs
111 */
112
113 /* RunFileDlg flags */
114 #define RFF_NOBROWSE 0x01 /* Removes the browse button */
115 #define RFF_NODEFAULT 0x02 /* No default item selected */
116 #define RFF_CALCDIRECTORY 0x04 /* Calculates the working directory from the file name */
117 #define RFF_NOLABEL 0x08 /* Removes the edit box label */
118 #define RFF_NOSEPARATEMEM 0x20 /* Removes the Separate Memory Space check box (Windows NT only) */
119
120 /* RunFileFlg notification value and structure */
121 #define RFN_VALIDATE (-510)
122 #if 0 // Deprecated ANSI structure
123 typedef struct _NMRUNFILEDLGA
124 {
125 NMHDR hdr;
126 LPCSTR lpFile;
127 LPCSTR lpDirectory;
128 UINT nShow;
129 } NMRUNFILEDLGA, *PNMRUNFILEDLGA, *LPNMRUNFILEDLGA;
130 #endif
131 typedef struct _NMRUNFILEDLGW
132 {
133 NMHDR hdr;
134 LPCWSTR lpFile;
135 LPCWSTR lpDirectory;
136 UINT nShow;
137 } NMRUNFILEDLGW, *PNMRUNFILEDLGW, *LPNMRUNFILEDLGW;
138
139 typedef NMRUNFILEDLGW NMRUNFILEDLG;
140 typedef PNMRUNFILEDLGW PNMRUNFILEDLG;
141 typedef LPNMRUNFILEDLGW LPNMRUNFILEDLG;
142
143 /* RunFileDlg notification return values */
144 #define RF_OK 0x00
145 #define RF_CANCEL 0x01
146 #define RF_RETRY 0x02
147
148 void WINAPI RunFileDlg(
149 HWND hWndOwner,
150 HICON hIcon,
151 LPCWSTR lpstrDirectory,
152 LPCWSTR lpstrTitle,
153 LPCWSTR lpstrDescription,
154 UINT uFlags);
155
156 int WINAPI LogoffWindowsDialog(HWND hWndOwner);
157 void WINAPI ExitWindowsDialog(HWND hWndOwner);
158
159 BOOL WINAPI SHFindComputer(
160 LPCITEMIDLIST pidlRoot,
161 LPCITEMIDLIST pidlSavedSearch);
162
163 void WINAPI SHHandleDiskFull(HWND hwndOwner,
164 UINT uDrive);
165
166 int WINAPI SHOutOfMemoryMessageBox(
167 HWND hwndOwner,
168 LPCSTR lpCaption,
169 UINT uType);
170
171 DWORD WINAPI SHNetConnectionDialog(
172 HWND hwndOwner,
173 LPCWSTR lpstrRemoteName,
174 DWORD dwType);
175
176 /****************************************************************************
177 * Cabinet Window Messages
178 */
179
180 #define CWM_SETPATH (WM_USER + 2)
181 #define CWM_WANTIDLE (WM_USER + 3)
182 #define CWM_GETSETCURRENTINFO (WM_USER + 4)
183 #define CWM_SELECTITEM (WM_USER + 5)
184 #define CWM_SELECTITEMSTR (WM_USER + 6)
185 #define CWM_GETISHELLBROWSER (WM_USER + 7)
186 #define CWM_TESTPATH (WM_USER + 9)
187 #define CWM_STATECHANGE (WM_USER + 10)
188 #define CWM_GETPATH (WM_USER + 12)
189
190 #define WM_GETISHELLBROWSER CWM_GETISHELLBROWSER
191
192 /* CWM_TESTPATH types */
193 #define CWTP_ISEQUAL 0
194 #define CWTP_ISCHILD 1
195
196 /* CWM_TESTPATH structure */
197 typedef struct
198 {
199 DWORD dwType;
200 ITEMIDLIST idl;
201 } CWTESTPATHSTRUCT,* LPCWTESTPATHSTRUCT;
202
203 /****************************************************************************
204 * System Imagelist Routines
205 */
206
207 int WINAPI Shell_GetCachedImageIndexA(
208 LPCSTR lpszFileName,
209 int nIconIndex,
210 UINT bSimulateDoc);
211
212 BOOL WINAPI Shell_GetImageLists(
213 HIMAGELIST *lphimlLarge,
214 HIMAGELIST *lphimlSmall);
215
216 HICON WINAPI SHGetFileIcon(
217 DWORD dwReserved,
218 LPCSTR lpszPath,
219 DWORD dwFileAttributes,
220 UINT uFlags);
221
222 BOOL WINAPI FileIconInit(BOOL bFullInit);
223
224 /****************************************************************************
225 * File Menu Routines
226 */
227 /* FileMenu_Create nSelHeight constants */
228 #define FM_DEFAULT_SELHEIGHT -1
229 #define FM_FULL_SELHEIGHT 0
230
231 /* FileMenu_Create flags */
232 #define FMF_SMALL_ICONS 0x00
233 #define FMF_LARGE_ICONS 0x08
234 #define FMF_NO_COLUMN_BREAK 0x10
235
236 HMENU WINAPI FileMenu_Create(
237 COLORREF crBorderColor,
238 int nBorderWidth,
239 HBITMAP hBorderBmp,
240 int nSelHeight,
241 UINT uFlags);
242
243 void WINAPI FileMenu_Destroy(HMENU hMenu);
244
245 /* FileMenu_AppendItem constants */
246 #define FM_SEPARATOR (LPCSTR)1
247 #define FM_BLANK_ICON -1
248 #define FM_DEFAULT_HEIGHT 0
249
250 BOOL WINAPI FileMenu_AppendItem(
251 HMENU hMenu,
252 LPCSTR lpszText,
253 UINT uID,
254 int iIcon,
255 HMENU hMenuPopup,
256 int nItemHeight);
257
258 /* FileMenu_InsertUsingPidl flags */
259 #define FMF_NO_EMPTY_ITEM 0x01
260 #define FMF_NO_PROGRAM_GROUPS 0x04
261
262 /* FileMenu_InsertUsingPidl callback function */
263 typedef void (CALLBACK *LPFNFMCALLBACK)(LPCITEMIDLIST pidlFolder, LPCITEMIDLIST pidlFile);
264
265 int WINAPI FileMenu_InsertUsingPidl(
266 HMENU hMenu,
267 UINT uID,
268 LPCITEMIDLIST pidl,
269 UINT uFlags,
270 UINT uEnumFlags,
271 LPFNFMCALLBACK lpfnCallback);
272
273 int WINAPI FileMenu_ReplaceUsingPidl(
274 HMENU hMenu,
275 UINT uID,
276 LPCITEMIDLIST pidl,
277 UINT uEnumFlags,
278 LPFNFMCALLBACK lpfnCallback);
279
280 void WINAPI FileMenu_Invalidate(HMENU hMenu);
281
282 HMENU WINAPI FileMenu_FindSubMenuByPidl(
283 HMENU hMenu,
284 LPCITEMIDLIST pidl);
285
286 BOOL WINAPI FileMenu_TrackPopupMenuEx(
287 HMENU hMenu,
288 UINT uFlags,
289 int x,
290 int y,
291 HWND hWnd,
292 LPTPMPARAMS lptpm);
293
294 BOOL WINAPI FileMenu_GetLastSelectedItemPidls(
295 UINT uReserved,
296 LPCITEMIDLIST *ppidlFolder,
297 LPCITEMIDLIST *ppidlItem);
298
299 LRESULT WINAPI FileMenu_MeasureItem(
300 HWND hWnd,
301 LPMEASUREITEMSTRUCT lpmis);
302
303 LRESULT WINAPI FileMenu_DrawItem(
304 HWND hWnd,
305 LPDRAWITEMSTRUCT lpdis);
306
307 BOOL WINAPI FileMenu_InitMenuPopup(HMENU hMenu);
308
309 void WINAPI FileMenu_AbortInitMenu(void);
310
311 LRESULT WINAPI FileMenu_HandleMenuChar(
312 HMENU hMenu,
313 WPARAM wParam);
314
315 BOOL WINAPI FileMenu_DeleteAllItems(HMENU hMenu);
316
317 BOOL WINAPI FileMenu_DeleteItemByCmd(
318 HMENU hMenu,
319 UINT uID);
320
321 BOOL WINAPI FileMenu_DeleteItemByIndex(
322 HMENU hMenu,
323 UINT uPos);
324
325 BOOL WINAPI FileMenu_DeleteMenuItemByFirstID(
326 HMENU hMenu,
327 UINT uID);
328
329 BOOL WINAPI FileMenu_DeleteSeparator(HMENU hMenu);
330
331 BOOL WINAPI FileMenu_EnableItemByCmd(
332 HMENU hMenu,
333 UINT uID,
334 BOOL bEnable);
335
336 DWORD WINAPI FileMenu_GetItemExtent(
337 HMENU hMenu,
338 UINT uPos);
339
340 int WINAPI FileMenu_AppendFilesForPidl(
341 HMENU hMenu,
342 LPCITEMIDLIST pidl,
343 BOOL bAddSeparator);
344
345 int WINAPI FileMenu_AddFilesForPidl(
346 HMENU hMenu,
347 UINT uReserved,
348 UINT uID,
349 LPCITEMIDLIST pidl,
350 UINT uFlags,
351 UINT uEnumFlags,
352 LPFNFMCALLBACK lpfnCallback);
353
354 /****************************************************************************
355 * Drag And Drop Routines
356 */
357
358 HRESULT WINAPI SHRegisterDragDrop(
359 HWND hWnd,
360 LPDROPTARGET lpDropTarget);
361
362 HRESULT WINAPI SHRevokeDragDrop(HWND hWnd);
363
364 BOOL WINAPI DAD_DragEnter(HWND hWnd);
365
366 BOOL WINAPI DAD_SetDragImageFromListView(
367 HWND hWnd,
368 POINT pt);
369
370 BOOL WINAPI DAD_ShowDragImage(BOOL bShow);
371
372 /****************************************************************************
373 * Path Manipulation Routines
374 */
375
376 BOOL WINAPI PathAppendAW(LPVOID lpszPath1, LPCVOID lpszPath2);
377
378 LPVOID WINAPI PathCombineAW(LPVOID szDest, LPCVOID lpszDir, LPCVOID lpszFile);
379
380 LPVOID WINAPI PathAddBackslashAW(LPVOID path);
381
382 LPVOID WINAPI PathBuildRootAW(LPVOID lpszPath, int drive);
383
384 LPVOID WINAPI PathFindExtensionAW(LPCVOID path);
385
386 LPVOID WINAPI PathFindFileNameAW(LPCVOID path);
387
388 LPVOID WINAPI PathGetExtensionAW(LPCVOID lpszPath, DWORD void1, DWORD void2);
389
390 LPVOID WINAPI PathGetArgsAW(LPVOID lpszPath);
391
392 BOOL WINAPI PathRemoveFileSpecAW(LPVOID lpszPath);
393
394 void WINAPI PathRemoveBlanksAW(LPVOID lpszPath);
395
396 VOID WINAPI PathQuoteSpacesAW(LPVOID path);
397
398 void WINAPI PathUnquoteSpacesAW(LPVOID lpszPath);
399
400 BOOL WINAPI PathIsUNCAW(LPCVOID lpszPath);
401
402 BOOL WINAPI PathIsRelativeAW(LPCVOID lpszPath);
403
404 BOOL WINAPI PathIsRootAW(LPCVOID x);
405
406 BOOL WINAPI PathIsExeAW(LPCVOID lpszPath);
407
408 BOOL WINAPI PathIsDirectoryAW(LPCVOID lpszPath);
409
410 BOOL WINAPI PathFileExistsAW(LPCVOID lpszPath);
411
412 BOOL WINAPI PathMatchSpecAW(LPVOID lpszPath, LPVOID lpszSpec);
413
414 BOOL WINAPI PathMakeUniqueNameAW(
415 LPVOID lpszBuffer,
416 DWORD dwBuffSize,
417 LPCVOID lpszShortName,
418 LPCVOID lpszLongName,
419 LPCVOID lpszPathName);
420
421 BOOL WINAPI PathYetAnotherMakeUniqueName(
422 LPWSTR lpszBuffer,
423 LPCWSTR lpszPathName,
424 LPCWSTR lpszShortName,
425 LPCWSTR lpszLongName);
426
427 BOOL WINAPI PathQualifyAW(LPCVOID path);
428
429
430 /* PathResolve flags */
431 #define PRF_CHECKEXISTANCE 0x01
432 #define PRF_EXECUTABLE 0x02
433 #define PRF_QUALIFYONPATH 0x04
434 #define PRF_WINDOWS31 0x08
435
436 BOOL WINAPI PathResolveAW(LPVOID lpszPath, LPCVOID *alpszPaths, DWORD dwFlags);
437
438 VOID WINAPI PathSetDlgItemPathAW(HWND hDlg, int nIDDlgItem, LPCVOID lpszPath);
439
440 /* PathProcessCommand flags */
441 #define PPCF_QUOTEPATH 0x01 /* implies PPCF_INCLUDEARGS */
442 #define PPCF_INCLUDEARGS 0x02
443 //#define PPCF_NODIRECTORIES 0x10 move to shlobj
444 #define PPCF_DONTRESOLVE 0x20
445 #define PPCF_PATHISRELATIVE 0x40
446
447 HRESULT WINAPI PathProcessCommandAW(LPCVOID lpszPath, LPVOID lpszBuff,
448 DWORD dwBuffSize, DWORD dwFlags);
449
450 void WINAPI PathStripPathAW(LPVOID lpszPath);
451
452 BOOL WINAPI PathStripToRootAW(LPVOID lpszPath);
453
454 void WINAPI PathRemoveArgsAW(LPVOID lpszPath);
455
456 void WINAPI PathRemoveExtensionAW(LPVOID lpszPath);
457
458 int WINAPI PathParseIconLocationAW(LPVOID lpszPath);
459
460 BOOL WINAPI PathIsSameRootAW(LPCVOID lpszPath1, LPCVOID lpszPath2);
461
462 BOOL WINAPI PathFindOnPathAW(LPVOID sFile, LPCVOID *sOtherDirs);
463
464 /****************************************************************************
465 * Shell File Operations error codes
466 */
467
468 /* Error codes could be pre-Win32 */
469 #define DE_SAMEFILE 0x71
470 #define DE_MANYSRC1DEST 0x72
471 #define DE_DIFFDIR 0x73
472 #define DE_OPCANCELLED 0x75
473 #define DE_DESTSUBTREE 0x76
474 #define DE_INVALIDFILES 0x7C
475 #define DE_DESTSAMETREE 0x7D
476 #define DE_FLDDESTISFILE 0x7E
477 #define DE_FILEDESTISFLD 0x80
478
479 /****************************************************************************
480 * Shell Namespace Routines
481 */
482
483 /* Generic structure used by several messages */
484 typedef struct
485 {
486 DWORD dwReserved;
487 DWORD dwReserved2;
488 LPCITEMIDLIST pidl;
489 LPDWORD lpdwUser;
490 } SFVCBINFO, * LPSFVCBINFO;
491 typedef const SFVCBINFO * LPCSFVCBINFO;
492
493 /* SFVCB_SELECTIONCHANGED structure */
494 typedef struct
495 {
496 UINT uOldState;
497 UINT uNewState;
498 LPCITEMIDLIST pidl;
499 LPDWORD lpdwUser;
500 } SFVSELECTSTATE, * LPSFVSELECTSTATE;
501 typedef const SFVSELECTSTATE * LPCSFVSELECTSTATE;
502
503 /* SFVCB_COPYHOOKCALLBACK structure */
504 typedef struct
505 {
506 HWND hwnd;
507 UINT wFunc;
508 UINT wFlags;
509 LPCSTR pszSrcFile;
510 DWORD dwSrcAttribs;
511 LPCSTR pszDestFile;
512 DWORD dwDestAttribs;
513 } SFVCOPYHOOKINFO, * LPSFVCOPYHOOKINFO;
514 typedef const SFVCOPYHOOKINFO * LPCSFVCOPYHOOKINFO;
515
516 /* SFVCB_GETDETAILSOF structure */
517 typedef struct
518 {
519 LPCITEMIDLIST pidl;
520 int fmt;
521 int cx;
522 STRRET lpText;
523 } SFVCOLUMNINFO, * LPSFVCOLUMNINFO;
524
525 /****************************************************************************
526 * Misc Stuff
527 */
528
529 /* SHWaitForFileToOpen flags */
530 #define SHWFF_ADD 0x01
531 #define SHWFF_REMOVE 0x02
532 #define SHWFF_WAIT 0x04
533
534 BOOL WINAPI SHWaitForFileToOpen(
535 LPCITEMIDLIST pidl,
536 DWORD dwFlags,
537 DWORD dwTimeout);
538
539 WORD WINAPI ArrangeWindows(
540 HWND hwndParent,
541 DWORD dwReserved,
542 LPCRECT lpRect,
543 WORD cKids,
544 CONST HWND * lpKids);
545
546 /* RegisterShellHook types */
547 #define RSH_DEREGISTER 0
548 #define RSH_REGISTER 1
549 #define RSH_REGISTER_PROGMAN 2
550 #define RSH_REGISTER_TASKMAN 3
551
552 BOOL WINAPI RegisterShellHook(
553 HWND hWnd,
554 DWORD dwType);
555
556 /* SHCreateDefClassObject callback function */
557 typedef HRESULT (CALLBACK *LPFNCDCOCALLBACK)(
558 LPUNKNOWN pUnkOuter,
559 REFIID riidObject,
560 LPVOID *ppvObject);
561
562 HRESULT WINAPI SHCreateDefClassObject(
563 REFIID riidFactory,
564 LPVOID *ppvFactory,
565 LPFNCDCOCALLBACK lpfnCallback,
566 LPDWORD lpdwUsage,
567 REFIID riidObject);
568
569 void WINAPI SHFreeUnusedLibraries(void);
570
571 /* SHCreateLinks flags */
572 #define SHCLF_PREFIXNAME 0x01
573 #define SHCLF_CREATEONDESKTOP 0x02
574
575 HRESULT WINAPI SHCreateLinks(
576 HWND hWnd,
577 LPCSTR lpszDir,
578 LPDATAOBJECT lpDataObject,
579 UINT uFlags,
580 LPITEMIDLIST *lppidlLinks);
581
582 DWORD WINAPI CheckEscapesA(LPSTR string, DWORD len);
583 DWORD WINAPI CheckEscapesW(LPWSTR string, DWORD len);
584
585 /* policy functions */
586 BOOL WINAPI SHInitRestricted(LPCVOID unused, LPCVOID inpRegKey);
587
588 #define CSIDL_FOLDER_MASK 0x00ff
589
590 /* Utility functions */
591 #include <stdio.h>
592
593 #define SMC_EXEC 4
594 INT WINAPI Shell_GetCachedImageIndex(LPCWSTR szPath, INT nIndex, UINT bSimulateDoc);
595
596 HRESULT WINAPI SHGetImageList(int iImageList, REFIID riid, void **ppv);
597
598 BOOL WINAPI GUIDFromStringW(
599 _In_ PCWSTR psz,
600 _Out_ LPGUID pguid
601 );
602
603 static inline ULONG
604 Win32DbgPrint(const char *filename, int line, const char *lpFormat, ...)
605 {
606 char szMsg[512];
607 char *szMsgStart;
608 const char *fname;
609 va_list vl;
610 ULONG uRet;
611
612 fname = strrchr(filename, '\\');
613 if (fname == NULL)
614 {
615 fname = strrchr(filename, '/');
616 if (fname != NULL)
617 fname++;
618 }
619 else
620 fname++;
621
622 if (fname == NULL)
623 fname = filename;
624
625 szMsgStart = szMsg + sprintf(szMsg, "%s:%d: ", fname, line);
626
627 va_start(vl, lpFormat);
628 uRet = (ULONG) vsprintf(szMsgStart, lpFormat, vl);
629 va_end(vl);
630
631 OutputDebugStringA(szMsg);
632
633 return uRet;
634 }
635
636 #define DbgPrint(fmt, ...) \
637 Win32DbgPrint(__FILE__, __LINE__, fmt, ##__VA_ARGS__)
638
639 static inline void DbgDumpMenuInternal(HMENU hmenu, char* padding, int padlevel)
640 {
641 WCHAR label[128];
642 int i;
643 int count = GetMenuItemCount(hmenu);
644
645 padding[padlevel] = '.';
646 padding[padlevel + 1] = '.';
647 padding[padlevel + 2] = 0;
648
649 for (i = 0; i < count; i++)
650 {
651 MENUITEMINFOW mii = { 0 };
652
653 mii.cbSize = sizeof(mii);
654 mii.fMask = MIIM_STRING | MIIM_FTYPE | MIIM_SUBMENU | MIIM_STATE | MIIM_ID;
655 mii.dwTypeData = label;
656 mii.cch = _countof(label);
657
658 GetMenuItemInfoW(hmenu, i, TRUE, &mii);
659
660 if (mii.fType & MFT_BITMAP)
661 DbgPrint("%s%2d - %08x: BITMAP %08p (state=%d, has submenu=%s)\n", padding, i, mii.wID, mii.hbmpItem, mii.fState, mii.hSubMenu ? "TRUE" : "FALSE");
662 else if (mii.fType & MFT_SEPARATOR)
663 DbgPrint("%s%2d - %08x ---SEPARATOR---\n", padding, i, mii.wID);
664 else
665 DbgPrint("%s%2d - %08x: %S (state=%d, has submenu=%s)\n", padding, i, mii.wID, mii.dwTypeData, mii.fState, mii.hSubMenu ? "TRUE" : "FALSE");
666
667 if (mii.hSubMenu)
668 DbgDumpMenuInternal(mii.hSubMenu, padding, padlevel + 2);
669
670 }
671
672 padding[padlevel] = 0;
673 }
674
675 static __inline void DbgDumpMenu(HMENU hmenu)
676 {
677 char padding[128];
678 DbgDumpMenuInternal(hmenu, padding, 0);
679 }
680
681
682 static inline
683 void DumpIdList(LPCITEMIDLIST pcidl)
684 {
685 DbgPrint("Begin IDList Dump\n");
686
687 for (; pcidl != NULL; pcidl = ILGetNext(pcidl))
688 {
689 int i;
690 int cb = pcidl->mkid.cb;
691 BYTE * sh = (BYTE*) &(pcidl->mkid);
692 if (cb == 0) // ITEMIDLISTs are terminatedwith a null SHITEMID.
693 break;
694 DbgPrint("Begin SHITEMID (cb=%d)\n", cb);
695 if ((cb & 3) != 0)
696 DbgPrint(" - WARNING: cb is not a multiple of 4\n");
697 for (i = 0; (i + 4) <= cb; i += 4)
698 {
699 DbgPrint(" - abID[%08x]: %02x %02x %02x %02x\n",
700 i,
701 sh[i + 0],
702 sh[i + 1],
703 sh[i + 2],
704 sh[i + 3]);
705 }
706 if (i < cb)
707 {
708 cb -= i;
709 if (cb == 3)
710 {
711 DbgPrint(" - abID[%08x]: %02x %02x %02x --\n",
712 i,
713 sh[i + 0],
714 sh[i + 1],
715 sh[i + 2]);
716 }
717 else if (cb == 2)
718 {
719 DbgPrint(" - abID[%08x]: %02x %02x -- --\n",
720 i,
721 sh[i + 0],
722 sh[i + 1]);
723 }
724 else if (cb == 1)
725 {
726 DbgPrint(" - abID[%08x]: %02x -- -- --\n",
727 i,
728 sh[i + 0]);
729 }
730 }
731 DbgPrint("End SHITEMID\n");
732 }
733 DbgPrint("End IDList Dump.\n");
734 }
735
736
737 /*****************************************************************************
738 * Shell32 resources
739 */
740 // these resources are in shell32.dll
741 #define IDB_GOBUTTON_NORMAL 0x0e6
742 #define IDB_GOBUTTON_HOT 0x0e7
743
744 // band ids in internet toolbar
745 #define ITBBID_MENUBAND 1
746 #define ITBBID_BRANDBAND 5
747 #define ITBBID_TOOLSBAND 2
748 #define ITBBID_ADDRESSBAND 4
749
750 // commands in the CGID_PrivCITCommands command group handled by the internet toolbar
751 // there seems to be some support for hiding the menubar and an auto hide feature that are
752 // unavailable in the UI
753 #define ITID_TEXTLABELS 3
754 #define ITID_TOOLBARBANDSHOWN 4
755 #define ITID_ADDRESSBANDSHOWN 5
756 #define ITID_LINKSBANDSHOWN 6
757 #define ITID_MENUBANDSHOWN 12
758 #define ITID_AUTOHIDEENABLED 13
759 #define ITID_CUSTOMIZEENABLED 20
760 #define ITID_TOOLBARLOCKED 27
761
762 // commands in the CGID_BrandCmdGroup command group handled by the brand band
763 #define BBID_STARTANIMATION 1
764 #define BBID_STOPANIMATION 2
765
766 // undocumented flags for IShellMenu::SetShellFolder
767 #define SMSET_UNKNOWN08 0x08
768 #define SMSET_UNKNOWN10 0x10
769
770 void WINAPI ShellDDEInit(BOOL bInit);
771 DWORD WINAPI WinList_Init(void);
772
773 IStream* WINAPI SHGetViewStream(LPCITEMIDLIST, DWORD, LPCTSTR, LPCTSTR, LPCTSTR);
774
775 EXTERN_C HRESULT WINAPI SHCreateSessionKey(REGSAM samDesired, PHKEY phKey);
776
777 /*****************************************************************************
778 * Shell Link
779 */
780 #include <pshpack1.h>
781
782 typedef struct tagSHELL_LINK_HEADER
783 {
784 /* The size of this structure (always 0x0000004C) */
785 DWORD dwSize;
786 /* CLSID = class identifier (always 00021401-0000-0000-C000-000000000046) */
787 CLSID clsid;
788 /* Flags (SHELL_LINK_DATA_FLAGS) */
789 DWORD dwFlags;
790 /* Informations about the link target: */
791 DWORD dwFileAttributes;
792 FILETIME ftCreationTime;
793 FILETIME ftLastAccessTime;
794 FILETIME ftLastWriteTime;
795 DWORD nFileSizeLow; /* only the least significant 32 bits */
796 /* The index of an icon (signed?) */
797 DWORD nIconIndex;
798 /* The expected window state of an application launched by the link */
799 DWORD nShowCommand;
800 /* The keystrokes used to launch the application */
801 WORD wHotKey;
802 /* Reserved (must be zero) */
803 WORD wReserved1;
804 DWORD dwReserved2;
805 DWORD dwReserved3;
806 } SHELL_LINK_HEADER, *LPSHELL_LINK_HEADER;
807
808 /*****************************************************************************
809 * SHELL_LINK_INFOA/W
810 * If cbHeaderSize == 0x0000001C then use SHELL_LINK_INFOA
811 * If cbHeaderSize >= 0x00000024 then use SHELL_LINK_INFOW
812 */
813 typedef struct tagSHELL_LINK_INFOA
814 {
815 /* Size of the link info data */
816 DWORD cbSize;
817 /* Size of this structure (ANSI: = 0x0000001C) */
818 DWORD cbHeaderSize;
819 /* Specifies which fields are present/populated (SLI_*) */
820 DWORD dwFlags;
821 /* Offset of the VolumeID field (SHELL_LINK_INFO_VOLUME_ID) */
822 DWORD cbVolumeIDOffset;
823 /* Offset of the LocalBasePath field (ANSI, NULL-terminated string) */
824 DWORD cbLocalBasePathOffset;
825 /* Offset of the CommonNetworkRelativeLink field (SHELL_LINK_INFO_CNR_LINK) */
826 DWORD cbCommonNetworkRelativeLinkOffset;
827 /* Offset of the CommonPathSuffix field (ANSI, NULL-terminated string) */
828 DWORD cbCommonPathSuffixOffset;
829 } SHELL_LINK_INFOA, *LPSHELL_LINK_INFOA;
830
831 typedef struct tagSHELL_LINK_INFOW
832 {
833 /* Size of the link info data */
834 DWORD cbSize;
835 /* Size of this structure (Unicode: >= 0x00000024) */
836 DWORD cbHeaderSize;
837 /* Specifies which fields are present/populated (SLI_*) */
838 DWORD dwFlags;
839 /* Offset of the VolumeID field (SHELL_LINK_INFO_VOLUME_ID) */
840 DWORD cbVolumeIDOffset;
841 /* Offset of the LocalBasePath field (ANSI, NULL-terminated string) */
842 DWORD cbLocalBasePathOffset;
843 /* Offset of the CommonNetworkRelativeLink field (SHELL_LINK_INFO_CNR_LINK) */
844 DWORD cbCommonNetworkRelativeLinkOffset;
845 /* Offset of the CommonPathSuffix field (ANSI, NULL-terminated string) */
846 DWORD cbCommonPathSuffixOffset;
847 /* Offset of the LocalBasePathUnicode field (Unicode, NULL-terminated string) */
848 DWORD cbLocalBasePathUnicodeOffset;
849 /* Offset of the CommonPathSuffixUnicode field (Unicode, NULL-terminated string) */
850 DWORD cbCommonPathSuffixUnicodeOffset;
851 } SHELL_LINK_INFOW, *LPSHELL_LINK_INFOW;
852
853 /* VolumeID, LocalBasePath, LocalBasePathUnicode(cbHeaderSize >= 0x24) are present */
854 #define SLI_VALID_LOCAL 0x00000001
855 /* CommonNetworkRelativeLink is present */
856 #define SLI_VALID_NETWORK 0x00000002
857
858 /*****************************************************************************
859 * SHELL_LINK_INFO_VOLUME_IDA/W
860 * If cbVolumeLabelOffset != 0x00000014 (should be 0x00000010) then use
861 * SHELL_LINK_INFO_VOLUME_IDA
862 * If cbVolumeLabelOffset == 0x00000014 then use SHELL_LINK_INFO_VOLUME_IDW
863 */
864 typedef struct tagSHELL_LINK_INFO_VOLUME_IDA
865 {
866 /* Size of the VolumeID field (> 0x00000010) */
867 DWORD cbSize;
868 /* Drive type of the drive the link target is stored on (DRIVE_*) */
869 DWORD dwDriveType;
870 /* Serial number of the volume the link target is stored on */
871 DWORD nDriveSerialNumber;
872 /* Offset of the volume label (ANSI, NULL-terminated string).
873 Must be != 0x00000014 (see tagSHELL_LINK_INFO_VOLUME_IDW) */
874 DWORD cbVolumeLabelOffset;
875 } SHELL_LINK_INFO_VOLUME_IDA, *LPSHELL_LINK_INFO_VOLUME_IDA;
876
877 typedef struct tagSHELL_LINK_INFO_VOLUME_IDW
878 {
879 /* Size of the VolumeID field (> 0x00000010) */
880 DWORD cbSize;
881 /* Drive type of the drive the link target is stored on (DRIVE_*) */
882 DWORD dwDriveType;
883 /* Serial number of the volume the link target is stored on */
884 DWORD nDriveSerialNumber;
885 /* Offset of the volume label (ANSI, NULL-terminated string).
886 If the value of this field is 0x00000014, ignore it and use
887 cbVolumeLabelUnicodeOffset! */
888 DWORD cbVolumeLabelOffset;
889 /* Offset of the volume label (Unicode, NULL-terminated string).
890 If the value of the VolumeLabelOffset field is not 0x00000014,
891 this field must be ignored (==> it doesn't exists ==> ANSI). */
892 DWORD cbVolumeLabelUnicodeOffset;
893 } SHELL_LINK_INFO_VOLUME_IDW, *LPSHELL_LINK_INFO_VOLUME_IDW;
894
895 /*****************************************************************************
896 * SHELL_LINK_INFO_CNR_LINKA/W (CNR = Common Network Relative)
897 * If cbNetNameOffset == 0x00000014 then use SHELL_LINK_INFO_CNR_LINKA
898 * If cbNetNameOffset > 0x00000014 then use SHELL_LINK_INFO_CNR_LINKW
899 */
900 typedef struct tagSHELL_LINK_INFO_CNR_LINKA
901 {
902 /* Size of the CommonNetworkRelativeLink field (>= 0x00000014) */
903 DWORD cbSize;
904 /* Specifies which fields are present/populated (SLI_CNR_*) */
905 DWORD dwFlags;
906 /* Offset of the NetName field (ANSI, NULL–terminated string) */
907 DWORD cbNetNameOffset;
908 /* Offset of the DeviceName field (ANSI, NULL–terminated string) */
909 DWORD cbDeviceNameOffset;
910 /* Type of the network provider (WNNC_NET_* defined in winnetwk.h) */
911 DWORD dwNetworkProviderType;
912 } SHELL_LINK_INFO_CNR_LINKA, *LPSHELL_LINK_INFO_CNR_LINKA;
913
914 typedef struct tagSHELL_LINK_INFO_CNR_LINKW
915 {
916 /* Size of the CommonNetworkRelativeLink field (>= 0x00000014) */
917 DWORD cbSize;
918 /* Specifies which fields are present/populated (SLI_CNR_*) */
919 DWORD dwFlags;
920 /* Offset of the NetName field (ANSI, NULL–terminated string) */
921 DWORD cbNetNameOffset;
922 /* Offset of the DeviceName field (ANSI, NULL–terminated string) */
923 DWORD cbDeviceNameOffset;
924 /* Type of the network provider (WNNC_NET_* defined in winnetwk.h) */
925 DWORD dwNetworkProviderType;
926 /* Offset of the NetNameUnicode field (Unicode, NULL–terminated string) */
927 DWORD cbNetNameUnicodeOffset;
928 /* Offset of the DeviceNameUnicode field (Unicode, NULL–terminated string) */
929 DWORD cbDeviceNameUnicodeOffset;
930 } SHELL_LINK_INFO_CNR_LINKW, *LPSHELL_LINK_INFO_CNR_LINKW;
931
932 /* DeviceName is present */
933 #define SLI_CNR_VALID_DEVICE 0x00000001
934 /* NetworkProviderType is present */
935 #define SLI_CNR_VALID_NET_TYPE 0x00000002
936
937 /*****************************************************************************
938 * Shell Link Extra Data (IShellLinkDataList)
939 */
940 typedef struct tagEXP_TRACKER
941 {
942 /* .cbSize = 0x00000060, .dwSignature = 0xa0000003 */
943 DATABLOCK_HEADER dbh;
944 /* Length >= 0x00000058 */
945 DWORD nLength;
946 /* Must be 0x00000000 */
947 DWORD nVersion;
948 /* NetBIOS name (ANSI, unused bytes are set to zero) */
949 CHAR szMachineID[16]; /* "variable" >= 16 (?) */
950 /* Some GUIDs for the Link Tracking service (from the FS?) */
951 GUID guidDroidVolume;
952 GUID guidDroidObject;
953 GUID guidDroidBirthVolume;
954 GUID guidDroidBirthObject;
955 } EXP_TRACKER, *LPEXP_TRACKER;
956
957 typedef struct tagEXP_SHIM
958 {
959 /* .cbSize >= 0x00000088, .dwSignature = 0xa0000008 */
960 DATABLOCK_HEADER dbh;
961 /* Name of a shim layer to apply (Unicode, unused bytes are set to zero) */
962 WCHAR szwLayerName[64]; /* "variable" >= 64 */
963 } EXP_SHIM, *LPEXP_SHIM;
964
965 typedef struct tagEXP_KNOWN_FOLDER
966 {
967 /* .cbSize = 0x0000001c, .dwSignature = 0xa000000b */
968 DATABLOCK_HEADER dbh;
969 /* A GUID value that identifies a known folder */
970 GUID guidKnownFolder;
971 /* Specifies the location of the ItemID of the first child
972 segment of the IDList specified by guidKnownFolder */
973 DWORD cbOffset;
974 } EXP_KNOWN_FOLDER, *LPEXP_KNOWN_FOLDER;
975
976 typedef struct tagEXP_VISTA_ID_LIST
977 {
978 /* .cbSize >= 0x0000000a, .dwSignature = 0xa000000c */
979 DATABLOCK_HEADER dbh;
980 /* Specifies an alternate IDList that can be used instead
981 of the "normal" IDList (SLDF_HAS_ID_LIST) */
982 /* LPITEMIDLIST pIDList; (variable) */
983 } EXP_VISTA_ID_LIST, *LPEXP_VISTA_ID_LIST;
984
985 #define EXP_TRACKER_SIG 0xa0000003
986 #define EXP_SHIM_SIG 0xa0000008
987 #define EXP_KNOWN_FOLDER_SIG 0xa000000b
988 #define EXP_VISTA_ID_LIST_SIG 0xa000000c
989
990 #include <poppack.h>
991
992 #ifdef __cplusplus
993 } /* extern "C" */
994 #endif /* defined(__cplusplus) */
995
996 #endif /* __WINE_UNDOCSHELL_H */