1 /***********************************************************************\
2 *                                shlobj.d                               *
3 *                                                                       *
4 *                       Windows API header module                       *
5 *                                                                       *
6 *                 Translated from MinGW Windows headers                 *
7 *                                                                       *
8 *                       Placed into public domain                       *
9 \***********************************************************************/
10 module win32.shlobj;
11 pragma(lib, "shell32.lib");
12 
13 // TODO: fix bitfields
14 // TODO: CMIC_VALID_SEE_FLAGS
15 // SHGetFolderPath in shfolder.dll on W9x, NT4, also in shell32.dll on W2K
16 
17 import win32.commctrl, win32.ole2, win32.shlguid, win32.shellapi;
18 private import win32.prsht, win32.unknwn, win32.w32api, win32.winbase,
19   win32.winnt, win32.winuser, win32.wtypes, win32.objfwd, win32.objidl;
20 private import win32.winnetwk; // for NETRESOURCE
21 
22 
23 // FIXME: clean up Windows version support
24 
25 align(1):
26 
27 const BIF_RETURNONLYFSDIRS = 1;
28 const BIF_DONTGOBELOWDOMAIN = 2;
29 const BIF_STATUSTEXT = 4;
30 const BIF_RETURNFSANCESTORS = 8;
31 const BIF_EDITBOX = 16;
32 const BIF_VALIDATE = 32;
33 const BIF_NEWDIALOGSTYLE = 64;
34 const BIF_BROWSEINCLUDEURLS = 128;
35 const BIF_USENEWUI =  BIF_EDITBOX | BIF_NEWDIALOGSTYLE;
36 const BIF_BROWSEFORCOMPUTER = 0x1000;
37 const BIF_BROWSEFORPRINTER = 0x2000;
38 const BIF_BROWSEINCLUDEFILES = 0x4000;
39 const BIF_SHAREABLE = 0x8000;
40 const BFFM_INITIALIZED = 1;
41 const BFFM_SELCHANGED = 2;
42 const BFFM_VALIDATEFAILEDA = 3;
43 const BFFM_VALIDATEFAILEDW = 4;
44 const BFFM_SETSTATUSTEXTA = WM_USER + 100;
45 const BFFM_ENABLEOK = WM_USER + 101;
46 const BFFM_SETSELECTIONA = WM_USER + 102;
47 const BFFM_SETSELECTIONW = WM_USER + 103;
48 const BFFM_SETSTATUSTEXTW = WM_USER + 104;
49 const BFFM_SETOKTEXT = WM_USER + 105;
50 const BFFM_SETEXPANDED = WM_USER + 106;
51 
52 version(Unicode) {
53 	alias BFFM_SETSTATUSTEXTW BFFM_SETSTATUSTEXT;
54 	alias BFFM_SETSELECTIONW BFFM_SETSELECTION;
55 	alias BFFM_VALIDATEFAILEDW BFFM_VALIDATEFAILED;
56 } else {
57 	alias BFFM_SETSTATUSTEXTA BFFM_SETSTATUSTEXT;
58 	alias BFFM_SETSELECTIONA BFFM_SETSELECTION;
59 	alias BFFM_VALIDATEFAILEDA BFFM_VALIDATEFAILED;
60 }
61 
62 const DVASPECT_SHORTNAME = 2;
63 
64 const SHARD_PIDL = 1;
65 const SHARD_PATH = 2;
66 
67 const SHCNE_RENAMEITEM = 1;
68 const SHCNE_CREATE = 2;
69 const SHCNE_DELETE = 4;
70 const SHCNE_MKDIR = 8;
71 const SHCNE_RMDIR = 16;
72 const SHCNE_MEDIAINSERTED = 32;
73 const SHCNE_MEDIAREMOVED = 64;
74 const SHCNE_DRIVEREMOVED = 128;
75 const SHCNE_DRIVEADD = 256;
76 const SHCNE_NETSHARE = 512;
77 const SHCNE_NETUNSHARE = 1024;
78 const SHCNE_ATTRIBUTES = 2048;
79 const SHCNE_UPDATEDIR = 4096;
80 const SHCNE_UPDATEITEM = 8192;
81 const SHCNE_SERVERDISCONNECT = 16384;
82 const SHCNE_UPDATEIMAGE = 32768;
83 const SHCNE_DRIVEADDGUI = 65536;
84 const SHCNE_RENAMEFOLDER = 0x20000;
85 const SHCNE_FREESPACE = 0x40000;
86 const SHCNE_ASSOCCHANGED = 0x8000000;
87 const SHCNE_DISKEVENTS = 0x2381F;
88 const SHCNE_GLOBALEVENTS = 0xC0581E0;
89 const SHCNE_ALLEVENTS = 0x7FFFFFFF;
90 const SHCNE_INTERRUPT = 0x80000000;
91 
92 const SHCNF_IDLIST = 0;
93 const SHCNF_PATHA = 1;
94 const SHCNF_PRINTERA = 2;
95 const SHCNF_DWORD = 3;
96 const SHCNF_PATHW = 5;
97 const SHCNF_PRINTERW = 6;
98 const SHCNF_TYPE = 0xFF;
99 const SHCNF_FLUSH = 0x1000;
100 const SHCNF_FLUSHNOWAIT = 0x2000;
101 
102 version(Unicode) {
103 	alias SHCNF_PATHW SHCNF_PATH;
104 	alias SHCNF_PRINTERW SHCNF_PRINTER;
105 } else {
106 	alias SHCNF_PATHA SHCNF_PATH;
107 	alias SHCNF_PRINTERA SHCNF_PRINTER;
108 }
109 
110 const SFGAO_CANCOPY = DROPEFFECT.DROPEFFECT_COPY;
111 const SFGAO_CANMOVE = DROPEFFECT.DROPEFFECT_MOVE;
112 const SFGAO_CANLINK = DROPEFFECT.DROPEFFECT_LINK;
113 const SFGAO_CANRENAME = 0x00000010L;
114 const SFGAO_CANDELETE = 0x00000020L;
115 const SFGAO_HASPROPSHEET = 0x00000040L;
116 const SFGAO_DROPTARGET = 0x00000100L;
117 const SFGAO_CAPABILITYMASK = 0x00000177L;
118 const SFGAO_GHOSTED = 0x00008000L;
119 const SFGAO_LINK = 0x00010000L;
120 const SFGAO_SHARE = 0x00020000L;
121 const SFGAO_READONLY = 0x00040000L;
122 const SFGAO_HIDDEN = 0x00080000L;
123 const SFGAO_DISPLAYATTRMASK = 0x000F0000L;
124 const SFGAO_FILESYSANCESTOR = 0x10000000L;
125 const SFGAO_FOLDER = 0x20000000L;
126 const SFGAO_FILESYSTEM = 0x40000000L;
127 const SFGAO_HASSUBFOLDER = 0x80000000L;
128 const SFGAO_CONTENTSMASK = 0x80000000L;
129 const SFGAO_VALIDATE = 0x01000000L;
130 const SFGAO_REMOVABLE = 0x02000000L;
131 const SFGAO_COMPRESSED = 0x04000000L;
132 const STRRET_WSTR = 0;
133 const STRRET_OFFSET = 1;
134 const STRRET_CSTR = 2;
135 
136 enum {
137 	SHGDFIL_FINDDATA = 1,
138 	SHGDFIL_NETRESOURCE,
139 	SHGDFIL_DESCRIPTIONID
140 }
141 
142 enum {
143 	SHDID_ROOT_REGITEM = 1,
144 	SHDID_FS_FILE,
145 	SHDID_FS_DIRECTORY,
146 	SHDID_FS_OTHER,
147 	SHDID_COMPUTER_DRIVE35,
148 	SHDID_COMPUTER_DRIVE525,
149 	SHDID_COMPUTER_REMOVABLE,
150 	SHDID_COMPUTER_FIXED,
151 	SHDID_COMPUTER_NETDRIVE,
152 	SHDID_COMPUTER_CDROM,
153 	SHDID_COMPUTER_RAMDISK,
154 	SHDID_COMPUTER_OTHER,
155 	SHDID_NET_DOMAIN,
156 	SHDID_NET_SERVER,
157 	SHDID_NET_SHARE,
158 	SHDID_NET_RESTOFNET,
159 	SHDID_NET_OTHER
160 }
161 
162 const TCHAR[] REGSTR_PATH_EXPLORER = "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer";
163 const TCHAR[] REGSTR_PATH_SPECIAL_FOLDERS=REGSTR_PATH_EXPLORER ~ "\\Shell Folders";
164 
165 enum {
166 	CSIDL_DESKTOP = 0,
167 	CSIDL_INTERNET,
168 	CSIDL_PROGRAMS,
169 	CSIDL_CONTROLS,
170 	CSIDL_PRINTERS,
171 	CSIDL_PERSONAL,
172 	CSIDL_FAVORITES,
173 	CSIDL_STARTUP,
174 	CSIDL_RECENT,
175 	CSIDL_SENDTO,
176 	CSIDL_BITBUCKET,
177 	CSIDL_STARTMENU, // = 11
178 	CSIDL_DESKTOPDIRECTORY = 16,
179 	CSIDL_DRIVES,
180 	CSIDL_NETWORK,
181 	CSIDL_NETHOOD,
182 	CSIDL_FONTS,
183 	CSIDL_TEMPLATES,
184 	CSIDL_COMMON_STARTMENU,
185 	CSIDL_COMMON_PROGRAMS,
186 	CSIDL_COMMON_STARTUP,
187 	CSIDL_COMMON_DESKTOPDIRECTORY,
188 	CSIDL_APPDATA,
189 	CSIDL_PRINTHOOD,
190 	CSIDL_LOCAL_APPDATA,
191 	CSIDL_ALTSTARTUP,
192 	CSIDL_COMMON_ALTSTARTUP,
193 	CSIDL_COMMON_FAVORITES,
194 	CSIDL_INTERNET_CACHE,
195 	CSIDL_COOKIES,
196 	CSIDL_HISTORY,
197 	CSIDL_COMMON_APPDATA,
198 	CSIDL_WINDOWS,
199 	CSIDL_SYSTEM,
200 	CSIDL_PROGRAM_FILES,
201 	CSIDL_MYPICTURES,
202 	CSIDL_PROFILE,
203 	CSIDL_SYSTEMX86,
204 	CSIDL_PROGRAM_FILESX86,
205 	CSIDL_PROGRAM_FILES_COMMON,
206 	CSIDL_PROGRAM_FILES_COMMONX86,
207 	CSIDL_COMMON_TEMPLATES,
208 	CSIDL_COMMON_DOCUMENTS,
209 	CSIDL_COMMON_ADMINTOOLS,
210 	CSIDL_ADMINTOOLS,
211 	CSIDL_CONNECTIONS, // =49
212 	CSIDL_COMMON_MUSIC = 53,
213 	CSIDL_COMMON_PICTURES,
214 	CSIDL_COMMON_VIDEO,
215 	CSIDL_RESOURCES,
216 	CSIDL_RESOURCES_LOCALIZED,
217 	CSIDL_COMMON_OEM_LINKS,
218 	CSIDL_CDBURN_AREA, // = 59
219 	CSIDL_COMPUTERSNEARME = 61,
220 	CSIDL_FLAG_DONT_VERIFY = 0x4000,
221 	CSIDL_FLAG_CREATE = 0x8000,
222 	CSIDL_FLAG_MASK = 0xFF00
223 }
224 
225 const TCHAR[]
226 	CFSTR_SHELLIDLIST       = "Shell IDList Array",
227 	CFSTR_SHELLIDLISTOFFSET = "Shell Object Offsets",
228 	CFSTR_NETRESOURCES      = "Net Resource",
229 	CFSTR_FILECONTENTS      = "FileContents",
230 	CFSTR_FILENAMEA         = "FileName",
231 	CFSTR_FILENAMEMAPA      = "FileNameMap",
232 	CFSTR_FILEDESCRIPTORA   = "FileGroupDescriptor",
233 	CFSTR_INETURLA          = "UniformResourceLocator",
234 	CFSTR_SHELLURL          = CFSTR_INETURLA,
235 	CFSTR_FILENAMEW         = "FileNameW",
236 	CFSTR_FILENAMEMAPW      = "FileNameMapW",
237 	CFSTR_FILEDESCRIPTORW   = "FileGroupDescriptorW",
238 	CFSTR_INETURLW          = "UniformResourceLocatorW";
239 
240 version(Unicode) {
241 	alias CFSTR_FILENAMEW CFSTR_FILENAME;
242 	alias CFSTR_FILENAMEMAPW CFSTR_FILENAMEMAP;
243 	alias CFSTR_FILEDESCRIPTORW CFSTR_FILEDESCRIPTOR;
244 	alias CFSTR_INETURLW CFSTR_INETURL;
245 } else {
246 	alias CFSTR_FILENAMEA CFSTR_FILENAME;
247 	alias CFSTR_FILENAMEMAPA CFSTR_FILENAMEMAP;
248 	alias CFSTR_FILEDESCRIPTORA CFSTR_FILEDESCRIPTOR;
249 	alias CFSTR_INETURLA CFSTR_INETURL;
250 }
251 const TCHAR[]
252 	CFSTR_PRINTERGROUP        = "PrinterFriendlyName",
253 	CFSTR_INDRAGLOOP          = "InShellDragLoop",
254 	CFSTR_PASTESUCCEEDED      = "Paste Succeeded",
255 	CFSTR_PERFORMEDDROPEFFECT = "Performed DropEffect",
256 	CFSTR_PREFERREDDROPEFFECT = "Preferred DropEffect";
257 
258 const CMF_NORMAL=0;
259 const CMF_DEFAULTONLY=1;
260 const CMF_VERBSONLY=2;
261 const CMF_EXPLORE=4;
262 const CMF_NOVERBS=8;
263 const CMF_CANRENAME=16;
264 const CMF_NODEFAULT=32;
265 const CMF_INCLUDESTATIC=64;
266 const CMF_RESERVED=0xffff0000;
267 const GCS_VERBA=0;
268 const GCS_HELPTEXTA=1;
269 const GCS_VALIDATEA=2;
270 const GCS_VERBW=4;
271 const GCS_HELPTEXTW=5;
272 const GCS_VALIDATEW=6;
273 const GCS_UNICODE=4;
274 
275 version(Unicode) {
276 	alias GCS_VERBW GCS_VERB;
277 	alias GCS_HELPTEXTW GCS_HELPTEXT;
278 	alias GCS_VALIDATEW GCS_VALIDATE;
279 } else {
280 	alias GCS_VERBA GCS_VERB;
281 	alias GCS_HELPTEXTA GCS_HELPTEXT;
282 	alias GCS_VALIDATEA GCS_VALIDATE;
283 }
284 
285 const TCHAR[]
286 	CMDSTR_NEWFOLDER   = "NewFolder",
287 	CMDSTR_VIEWLIST    = "ViewList",
288 	CMDSTR_VIEWDETAILS = "ViewDetails";
289 
290 const CMIC_MASK_HOTKEY     = SEE_MASK_HOTKEY;
291 const CMIC_MASK_ICON       = SEE_MASK_ICON;
292 const CMIC_MASK_FLAG_NO_UI = SEE_MASK_FLAG_NO_UI;
293 const CMIC_MASK_MODAL      = 0x80000000;
294 // TODO: This isn't defined anywhere in MinGW.
295 //const CMIC_VALID_SEE_FLAGS=SEE_VALID_CMIC_FLAGS;
296 
297 const GIL_OPENICON = 1;
298 const GIL_FORSHELL = 2;
299 const GIL_SIMULATEDOC = 1;
300 const GIL_PERINSTANCE = 2;
301 const GIL_PERCLASS = 4;
302 const GIL_NOTFILENAME = 8;
303 const GIL_DONTCACHE = 16;
304 
305 const FVSIF_RECT = 1;
306 const FVSIF_PINNED = 2;
307 const FVSIF_NEWFAILED = 0x8000000;
308 const FVSIF_NEWFILE = 0x80000000;
309 const FVSIF_CANVIEWIT = 0x40000000;
310 
311 const CDBOSC_SETFOCUS = 0;
312 const CDBOSC_KILLFOCUS = 1;
313 const CDBOSC_SELCHANGE = 2;
314 const CDBOSC_RENAME = 3;
315 
316 const FCIDM_SHVIEWFIRST = 0;
317 const FCIDM_SHVIEWLAST = 0x7fff;
318 const FCIDM_BROWSERFIRST = 0xa000;
319 const FCIDM_BROWSERLAST = 0xbf00;
320 const FCIDM_GLOBALFIRST = 0x8000;
321 const FCIDM_GLOBALLAST = 0x9fff;
322 const FCIDM_MENU_FILE = FCIDM_GLOBALFIRST;
323 const FCIDM_MENU_EDIT = FCIDM_GLOBALFIRST+0x0040;
324 const FCIDM_MENU_VIEW = FCIDM_GLOBALFIRST+0x0080;
325 const FCIDM_MENU_VIEW_SEP_OPTIONS = FCIDM_GLOBALFIRST+0x0081;
326 const FCIDM_MENU_TOOLS = FCIDM_GLOBALFIRST+0x00c0;
327 const FCIDM_MENU_TOOLS_SEP_GOTO = FCIDM_GLOBALFIRST+0x00c1;
328 const FCIDM_MENU_HELP = FCIDM_GLOBALFIRST+0x0100;
329 const FCIDM_MENU_FIND = FCIDM_GLOBALFIRST+0x0140;
330 const FCIDM_MENU_EXPLORE = FCIDM_GLOBALFIRST+0x0150;
331 const FCIDM_MENU_FAVORITES = FCIDM_GLOBALFIRST+0x0170;
332 const FCIDM_TOOLBAR = FCIDM_BROWSERFIRST;
333 const FCIDM_STATUS = FCIDM_BROWSERFIRST+1;
334 
335 const SBSP_DEFBROWSER = 0;
336 const SBSP_SAMEBROWSER = 1;
337 const SBSP_NEWBROWSER = 2;
338 const SBSP_DEFMODE = 0;
339 const SBSP_OPENMODE = 16;
340 const SBSP_EXPLOREMODE = 32;
341 const SBSP_ABSOLUTE = 0;
342 const SBSP_RELATIVE = 0x1000;
343 const SBSP_PARENT = 0x2000;
344 const SBSP_INITIATEDBYHLINKFRAME = 0x80000000;
345 const SBSP_REDIRECT = 0x40000000;
346 
347 enum {
348 	FCW_STATUS=1,
349 	FCW_TOOLBAR,
350 	FCW_TREE
351 }
352 
353 const FCT_MERGE=1;
354 const FCT_CONFIGABLE=2;
355 const FCT_ADDTOEND=4;
356 
357 const SVSI_DESELECT=0;
358 const SVSI_SELECT=1;
359 const SVSI_EDIT=3;
360 const SVSI_DESELECTOTHERS=4;
361 const SVSI_ENSUREVISIBLE=8;
362 const SVSI_FOCUSED=16;
363 
364 const SVGIO_BACKGROUND=0;
365 const SVGIO_SELECTION=1;
366 const SVGIO_ALLVIEW=2;
367 
368 const UINT SV2GV_CURRENTVIEW=-1;
369 const UINT SV2GV_DEFAULTVIEW=-2;
370 
371 alias ULONG SFGAOF;
372 alias DWORD SHGDNF;
373 
374 struct CIDA {
375 	UINT    cidl;
376 	UINT[1] aoffset;
377 }
378 alias CIDA* LPIDA;
379 
380 struct SHITEMID {
381 	USHORT  cb;
382 	BYTE[1] abID;
383 }
384 alias SHITEMID*       LPSHITEMID;
385 alias CPtr!(SHITEMID) LPCSHITEMID;
386 
387 struct ITEMIDLIST {
388 	SHITEMID mkid;
389 }
390 alias ITEMIDLIST*       LPITEMIDLIST;
391 alias CPtr!(ITEMIDLIST) LPCITEMIDLIST;
392 
393 alias int function(HWND,UINT,LPARAM,LPARAM) BFFCALLBACK;
394 
395 struct BROWSEINFOA {
396 	HWND          hwndOwner;
397 	LPCITEMIDLIST pidlRoot;
398 	LPSTR         pszDisplayName;
399 	LPCSTR        lpszTitle;
400 	UINT          ulFlags;
401 	BFFCALLBACK   lpfn;
402 	LPARAM        lParam;
403 	int           iImage;
404 }
405 alias BROWSEINFOA* PBROWSEINFOA, LPBROWSEINFOA;
406 
407 struct BROWSEINFOW {
408 	HWND          hwndOwner;
409 	LPCITEMIDLIST pidlRoot;
410 	LPWSTR        pszDisplayName;
411 	LPCWSTR       lpszTitle;
412 	UINT          ulFlags;
413 	BFFCALLBACK   lpfn;
414 	LPARAM        lParam;
415 	int           iImage;
416 }
417 alias BROWSEINFOW* PBROWSEINFOW, LPBROWSEINFOW;
418 
419 struct CMINVOKECOMMANDINFO {
420 	DWORD cbSize = this.sizeof;
421 	DWORD fMask;
422 	HWND hwnd;
423 	LPCSTR lpVerb;
424 	LPCSTR lpParameters;
425 	LPCSTR lpDirectory;
426 	int nShow;
427 	DWORD dwHotKey;
428 	HANDLE hIcon;
429 }
430 alias CMINVOKECOMMANDINFO* LPCMINVOKECOMMANDINFO;
431 
432 struct DROPFILES {
433 	DWORD pFiles;
434 	POINT pt;
435 	BOOL fNC;
436 	BOOL fWide;
437 }
438 alias DROPFILES* LPDROPFILES;
439 
440 enum SHGNO {
441 	SHGDN_NORMAL             = 0,
442 	SHGDN_INFOLDER,
443 	SHGDN_FOREDITING         = 0x1000,
444 	SHGDN_INCLUDE_NONFILESYS = 0x2000,
445 	SHGDN_FORADDRESSBAR      = 0x4000,
446 	SHGDN_FORPARSING         = 0x8000
447 }
448 
449 enum SHCONTF {
450 	SHCONTF_FOLDERS            = 32,
451 	SHCONTF_NONFOLDERS         = 64,
452 	SHCONTF_INCLUDEHIDDEN      = 128,
453 	SHCONTF_INIT_ON_FIRST_NEXT = 256,
454 	SHCONTF_NETPRINTERSRCH     = 512,
455 	SHCONTF_SHAREABLE          = 1024,
456 	SHCONTF_STORAGE            = 2048
457 }
458 
459 struct STRRET {
460 	UINT uType;
461 	union {
462 		LPWSTR pOleStr;
463 		UINT uOffset;
464 		char cStr[MAX_PATH];
465 	}
466 }
467 alias STRRET* LPSTRRET;
468 
469 enum FD_FLAGS {
470 	FD_CLSID      = 1,
471 	FD_SIZEPOINT  = 2,
472 	FD_ATTRIBUTES = 4,
473 	FD_CREATETIME = 8,
474 	FD_ACCESSTIME = 16,
475 	FD_WRITESTIME = 32,
476 	FD_FILESIZE   = 64,
477 	FD_LINKUI     = 0x8000
478 }
479 
480 struct FILEDESCRIPTORA {
481 	DWORD dwFlags;
482 	CLSID clsid;
483 	SIZEL sizel;
484 	POINTL pointl;
485 	DWORD dwFileAttributes;
486 	FILETIME ftCreationTime;
487 	FILETIME ftLastAccessTime;
488 	FILETIME ftLastWriteTime;
489 	DWORD nFileSizeHigh;
490 	DWORD nFileSizeLow;
491 	CHAR cFileName[MAX_PATH];
492 }
493 alias FILEDESCRIPTORA* LPFILEDESCRIPTORA;
494 
495 struct FILEDESCRIPTORW {
496 	DWORD dwFlags;
497 	CLSID clsid;
498 	SIZEL sizel;
499 	POINTL pointl;
500 	DWORD dwFileAttributes;
501 	FILETIME ftCreationTime;
502 	FILETIME ftLastAccessTime;
503 	FILETIME ftLastWriteTime;
504 	DWORD nFileSizeHigh;
505 	DWORD nFileSizeLow;
506 	WCHAR cFileName[MAX_PATH];
507 }
508 alias FILEDESCRIPTORW* LPFILEDESCRIPTORW;
509 
510 struct FILEGROUPDESCRIPTORA {
511 	UINT cItems;
512 	FILEDESCRIPTORA fgd[1];
513 }
514 alias FILEGROUPDESCRIPTORA* LPFILEGROUPDESCRIPTORA;
515 
516 struct FILEGROUPDESCRIPTORW {
517 	UINT cItems;
518 	FILEDESCRIPTORW fgd[1];
519 }
520 alias FILEGROUPDESCRIPTORW* LPFILEGROUPDESCRIPTORW;
521 
522 enum SLR_FLAGS {
523 	SLR_NO_UI      = 1,
524 	SLR_ANY_MATCH  = 2,
525 	SLR_UPDATE     = 4,
526 	SLR_NOUPDATE   = 8,
527 	SLR_NOSEARCH   = 16,
528 	SLR_NOTRACK    = 32,
529 	SLR_NOLINKINFO = 64,
530 	SLR_INVOKE_MSI = 128
531 }
532 
533 enum SLGP_FLAGS {
534 	SLGP_SHORTPATH=1,
535 	SLGP_UNCPRIORITY=2,
536 	SLGP_RAWPATH=4
537 }
538 
539 alias PBYTE LPVIEWSETTINGS;
540 
541 enum FOLDERFLAGS {
542 	FWF_AUTOARRANGE         = 1,
543 	FWF_ABBREVIATEDNAMES    = 2,
544 	FWF_SNAPTOGRID          = 4,
545 	FWF_OWNERDATA           = 8,
546 	FWF_BESTFITWINDOW       = 16,
547 	FWF_DESKTOP             = 32,
548 	FWF_SINGLESEL           = 64,
549 	FWF_NOSUBFOLDERS        = 128,
550 	FWF_TRANSPARENT         = 256,
551 	FWF_NOCLIENTEDGE        = 512,
552 	FWF_NOSCROLL            = 0x400,
553 	FWF_ALIGNLEFT           = 0x800,
554 	FWF_SINGLECLICKACTIVATE = 0x8000
555 }
556 
557 enum FOLDERVIEWMODE {
558 	FVM_ICON      = 1,
559 	FVM_SMALLICON,
560 	FVM_LIST,
561 	FVM_DETAILS
562 }
563 
564 struct FOLDERSETTINGS {
565 	UINT ViewMode;
566 	UINT fFlags;
567 }
568 alias FOLDERSETTINGS*       LPFOLDERSETTINGS;
569 alias CPtr!(FOLDERSETTINGS) LPCFOLDERSETTINGS;
570 
571 struct FVSHOWINFO {
572 	DWORD cbSize = this.sizeof;
573 	HWND hwndOwner;
574 	int iShow;
575 	DWORD dwFlags;
576 	RECT rect;
577 	LPUNKNOWN punkRel;
578 	OLECHAR strNewFile[MAX_PATH];
579 }
580 alias FVSHOWINFO* LPFVSHOWINFO;
581 
582 struct NRESARRAY {
583 	UINT cItems;
584 	NETRESOURCE nr[1];
585 }
586 alias NRESARRAY* LPNRESARRAY;
587 
588 enum {
589 	SBSC_HIDE,
590 	SBSC_SHOW,
591 	SBSC_TOGGLE,
592 	SBSC_QUERY
593 }
594 
595 enum {
596 	SBCMDID_ENABLESHOWTREE,
597 	SBCMDID_SHOWCONTROL,
598 	SBCMDID_CANCELNAVIGATION,
599 	SBCMDID_MAYSAVECHANGES,
600 	SBCMDID_SETHLINKFRAME,
601 	SBCMDID_ENABLESTOP,
602 	SBCMDID_OPTIONS
603 }
604 enum SVUIA_STATUS {
605 	SVUIA_DEACTIVATE,
606 	SVUIA_ACTIVATE_NOFOCUS,
607 	SVUIA_ACTIVATE_FOCUS,
608 	SVUIA_INPLACEACTIVATE
609 }
610 
611 static if (_WIN32_IE >= 0x0500) {
612 
613 	struct EXTRASEARCH
614 	 {
615 		GUID guidSearch;
616 		WCHAR wszFriendlyName[80];
617 		WCHAR wszUrl[2084];
618 	}
619 	alias EXTRASEARCH* LPEXTRASEARCH;
620 
621 	alias DWORD SHCOLSTATEF;
622 
623 	struct SHCOLUMNID {
624 		GUID fmtid;
625 		DWORD pid;
626 	}
627 	alias SHCOLUMNID*       LPSHCOLUMNID;
628 	alias CPtr!(SHCOLUMNID) LPCSHCOLUMNID;
629 
630 	struct SHELLDETAILS {
631 		int fmt;
632 		int cxChar;
633 		STRRET str;
634 	}
635 	alias SHELLDETAILS* LPSHELLDETAILS;
636 
637 	struct PERSIST_FOLDER_TARGET_INFO
638 	 {
639 		LPITEMIDLIST pidlTargetFolder;
640 		WCHAR szTargetParsingName[MAX_PATH];
641 		WCHAR szNetworkProvider[MAX_PATH];
642 		DWORD dwAttributes;
643 		int csidl;
644 	}
645 
646 	enum SHGFP_TYPE {
647 		SHGFP_TYPE_CURRENT = 0,
648 		SHGFP_TYPE_DEFAULT = 1,
649 	}
650 
651 }
652 
653 interface IEnumIDList: IUnknown
654 {
655 	HRESULT QueryInterface(REFIID,PVOID*);
656 	ULONG AddRef();
657 	ULONG Release();
658 	HRESULT Next(ULONG,LPITEMIDLIST*,ULONG*);
659 	HRESULT Skip(ULONG);
660 	HRESULT Reset();
661 	HRESULT Clone(IEnumIDList**);
662 }
663 alias IEnumIDList *LPENUMIDLIST;
664 
665 interface IObjMgr : IUnknown
666 {
667 	HRESULT QueryInterface(REFIID,PVOID*);
668 	ULONG AddRef();
669 	ULONG Release();
670 	HRESULT Append(IUnknown*);
671 	HRESULT Remove(IUnknown*);
672 }
673 
674 interface IContextMenu : IUnknown
675 {
676 	HRESULT QueryInterface(REFIID,PVOID*);
677 	ULONG AddRef();
678 	ULONG Release();
679 	HRESULT QueryContextMenu(HMENU,UINT,UINT,UINT,UINT);
680 	HRESULT InvokeCommand(LPCMINVOKECOMMANDINFO);
681 	HRESULT GetCommandString(UINT,UINT,PUINT,LPSTR,UINT);
682 }
683 alias IContextMenu* LPCONTEXTMENU;
684 
685 interface IContextMenu2 : IContextMenu
686 {
687 	HRESULT QueryInterface(REFIID,PVOID*);
688 	ULONG AddRef();
689 	ULONG Release();
690 	HRESULT QueryContextMenu(HMENU,UINT,UINT,UINT,UINT);
691 	HRESULT InvokeCommand(LPCMINVOKECOMMANDINFO);
692 	HRESULT GetCommandString(UINT,UINT,PUINT,LPSTR,UINT);
693 	HRESULT HandleMenuMsg(UINT,WPARAM,LPARAM);
694 };
695 alias IContextMenu2* LPCONTEXTMENU2;
696 
697 static if (_WIN32_IE >= 0x0500) {
698 
699 	align(8):
700 	struct SHCOLUMNINIT {
701 		ULONG dwFlags;
702 		ULONG dwReserved;
703 		WCHAR wszFolder[MAX_PATH];
704 	}
705 	alias SHCOLUMNINIT*       LPSHCOLUMNINIT;
706 	alias CPtr!(SHCOLUMNINIT) LPCSHCOLUMNINIT;
707 
708 	struct SHCOLUMNDATA {
709 		ULONG dwFlags;
710 		DWORD dwFileAttributes;
711 		ULONG dwReserved;
712 		WCHAR *pwszExt;
713 		WCHAR wszFile[MAX_PATH];
714 	}
715 	alias SHCOLUMNDATA*       LPSHCOLUMNDATA;
716 	alias CPtr!(SHCOLUMNDATA) LPCSHCOLUMNDATA;
717 	align:
718 
719 	const MAX_COLUMN_NAME_LEN = 80;
720 	const MAX_COLUMN_DESC_LEN = 128;
721 
722 	align(1):
723 	struct SHCOLUMNINFO {
724 		SHCOLUMNID scid;
725 		VARTYPE vt;
726 		DWORD fmt;
727 		UINT cChars;
728 		DWORD csFlags;
729 		WCHAR wszTitle[MAX_COLUMN_NAME_LEN];
730 		WCHAR wszDescription[MAX_COLUMN_DESC_LEN];
731 	}
732 	alias SHCOLUMNINFO*       LPSHCOLUMNINFO;
733 	alias CPtr!(SHCOLUMNINFO) LPCSHCOLUMNINFO;
734 	align:
735 
736 	enum SHCOLSTATE {
737 		SHCOLSTATE_TYPE_STR      = 0x00000001,
738 		SHCOLSTATE_TYPE_INT      = 0x00000002,
739 		SHCOLSTATE_TYPE_DATE     = 0x00000003,
740 		SHCOLSTATE_TYPEMASK      = 0x0000000f,
741 		SHCOLSTATE_ONBYDEFAULT   = 0x00000010,
742 		SHCOLSTATE_SLOW          = 0x00000020,
743 		SHCOLSTATE_EXTENDED      = 0x00000040,
744 		SHCOLSTATE_SECONDARYUI   = 0x00000080,
745 		SHCOLSTATE_HIDDEN        = 0x00000100,
746 		SHCOLSTATE_PREFER_VARCMP = 0x00000200
747 	}
748 
749 	interface IColumnProvider : IUnknown
750 	 {
751 		HRESULT QueryInterface(REFIID,PVOID*);
752 		ULONG AddRef();
753 		ULONG Release();
754 		HRESULT Initialize(LPCSHCOLUMNINIT);
755 		HRESULT GetColumnInfo(DWORD,SHCOLUMNINFO*);
756 		HRESULT GetItemData(LPCSHCOLUMNID,LPCSHCOLUMNDATA,VARIANT*);
757 	}
758 }/* _WIN32_IE >= 0x0500 */
759 
760 interface IQueryInfo : IUnknown
761 {
762 	HRESULT QueryInterface(REFIID,PVOID*);
763 	ULONG AddRef();
764 	ULONG Release();
765 	HRESULT GetInfoTip(DWORD,WCHAR**);
766 	HRESULT GetInfoFlags(DWORD*);
767 }
768 
769 interface IShellExtInit : IUnknown
770 {
771 	HRESULT QueryInterface(REFIID,PVOID*);
772 	ULONG AddRef();
773 	ULONG Release();
774 	HRESULT Initialize(LPCITEMIDLIST,LPDATAOBJECT,HKEY);
775 }
776 alias IShellExtInit *LPSHELLEXTINIT;
777 
778 interface IShellPropSheetExt : IUnknown
779 {
780 	HRESULT QueryInterface(REFIID,PVOID*);
781 	ULONG AddRef();
782 	ULONG Release();
783 	HRESULT AddPages(LPFNADDPROPSHEETPAGE,LPARAM);
784 	HRESULT ReplacePage(UINT,LPFNADDPROPSHEETPAGE,LPARAM);
785 }
786 alias IShellPropSheetExt *LPSHELLPROPSHEETEXT;
787 
788 interface IExtractIconA : IUnknown
789 {
790 	HRESULT QueryInterface(REFIID,PVOID*);
791 	ULONG AddRef();
792 	ULONG Release();
793 	HRESULT GetIconLocation(UINT,LPSTR,UINT,int*,PUINT);
794 	HRESULT Extract(LPCSTR,UINT,HICON*,HICON*,UINT);
795 };
796 alias IExtractIconA *LPEXTRACTICONA;
797 
798 interface IExtractIconW : IUnknown
799 {
800 	HRESULT QueryInterface(REFIID,PVOID*);
801 	ULONG AddRef();
802 	ULONG Release();
803 	HRESULT GetIconLocation(UINT,LPWSTR,UINT,int*,PUINT);
804 	HRESULT Extract(LPCWSTR,UINT,HICON*,HICON*,UINT);
805 }
806 alias IExtractIconW *LPEXTRACTICONW;
807 
808 version(Unicode) {
809 	alias IExtractIconW IExtractIcon;
810 	alias LPEXTRACTICONW LPEXTRACTICON;
811 } else {
812 	alias IExtractIconA IExtractIcon;
813 	alias LPEXTRACTICONA LPEXTRACTICON;
814 }
815 
816 interface IShellLinkA : IUnknown
817 {
818 	HRESULT QueryInterface(REFIID,PVOID*);
819 	ULONG AddRef();
820 	ULONG Release();
821 	HRESULT GetPath(LPSTR,int,WIN32_FIND_DATAA*,DWORD);
822 	HRESULT GetIDList(LPITEMIDLIST*);
823 	HRESULT SetIDList(LPCITEMIDLIST);
824 	HRESULT GetDescription(LPSTR,int);
825 	HRESULT SetDescription(LPCSTR);
826 	HRESULT GetWorkingDirectory(LPSTR,int);
827 	HRESULT SetWorkingDirectory(LPCSTR);
828 	HRESULT GetArguments(LPSTR,int);
829 	HRESULT SetArguments(LPCSTR);
830 	HRESULT GetHotkey(PWORD);
831 	HRESULT SetHotkey(WORD);
832 	HRESULT GetShowCmd(int*);
833 	HRESULT SetShowCmd(int);
834 	HRESULT GetIconLocation(LPSTR,int,int*);
835 	HRESULT SetIconLocation(LPCSTR,int);
836 	HRESULT SetRelativePath(LPCSTR ,DWORD);
837 	HRESULT Resolve(HWND,DWORD);
838 	HRESULT SetPath(LPCSTR);
839 }
840 
841 interface IShellLinkW : IUnknown
842 {
843 	HRESULT QueryInterface(REFIID,PVOID*);
844 	ULONG AddRef();
845 	ULONG Release();
846 	HRESULT GetPath(LPWSTR,int,WIN32_FIND_DATAW*,DWORD);
847 	HRESULT GetIDList(LPITEMIDLIST*);
848 	HRESULT SetIDList(LPCITEMIDLIST);
849 	HRESULT GetDescription(LPWSTR,int);
850 	HRESULT SetDescription(LPCWSTR);
851 	HRESULT GetWorkingDirectory(LPWSTR,int);
852 	HRESULT SetWorkingDirectory(LPCWSTR);
853 	HRESULT GetArguments(LPWSTR,int);
854 	HRESULT SetArguments(LPCWSTR);
855 	HRESULT GetHotkey(PWORD);
856 	HRESULT SetHotkey(WORD);
857 	HRESULT GetShowCmd(int*);
858 	HRESULT SetShowCmd(int);
859 	HRESULT GetIconLocation(LPWSTR,int,int*);
860 	HRESULT SetIconLocation(LPCWSTR,int);
861 	HRESULT SetRelativePath(LPCWSTR ,DWORD);
862 	HRESULT Resolve(HWND,DWORD);
863 	HRESULT SetPath(LPCWSTR);
864 }
865 
866 
867 interface IShellFolder : IUnknown
868 {
869 	HRESULT QueryInterface(REFIID,PVOID*);
870 	ULONG AddRef();
871 	ULONG Release();
872 	HRESULT ParseDisplayName(HWND,LPBC,LPOLESTR,PULONG,LPITEMIDLIST*,PULONG);
873 	HRESULT EnumObjects(HWND,DWORD,LPENUMIDLIST*);
874 	HRESULT BindToObject(LPCITEMIDLIST,LPBC,REFIID,PVOID*);
875 	HRESULT BindToStorage(LPCITEMIDLIST,LPBC,REFIID,PVOID*);
876 	HRESULT CompareIDs(LPARAM,LPCITEMIDLIST,LPCITEMIDLIST);
877 	HRESULT CreateViewObject(HWND,REFIID,PVOID*);
878 	HRESULT GetAttributesOf(UINT,LPCITEMIDLIST*,PULONG);
879 	HRESULT GetUIObjectOf(HWND,UINT,LPCITEMIDLIST*,REFIID,PUINT,PVOID*);
880 	HRESULT GetDisplayNameOf(LPCITEMIDLIST,DWORD,LPSTRRET);
881 	HRESULT SetNameOf(HWND,LPCITEMIDLIST,LPCOLESTR,DWORD,LPITEMIDLIST*);
882 }
883 alias IShellFolder *LPSHELLFOLDER;
884 
885 static if (_WIN32_IE >= 0x0500) {
886 
887 interface IEnumExtraSearch: IUnknown
888 {
889 	HRESULT QueryInterface(REFIID,PVOID*);
890 	ULONG AddRef();
891 	ULONG Release();
892 	HRESULT Next(ULONG,LPEXTRASEARCH*,ULONG*);
893 	HRESULT Skip(ULONG);
894 	HRESULT Reset();
895 	HRESULT Clone(IEnumExtraSearch**);
896 }
897 alias IEnumExtraSearch *LPENUMEXTRASEARCH;
898 
899 interface IShellFolder2 : IShellFolder
900 {
901 	HRESULT QueryInterface(REFIID,PVOID*);
902 	ULONG AddRef();
903 	ULONG Release();
904 	HRESULT ParseDisplayName(HWND,LPBC,LPOLESTR,PULONG,LPITEMIDLIST*,PULONG);
905 	HRESULT EnumObjects(HWND,DWORD,LPENUMIDLIST*);
906 	HRESULT BindToObject(LPCITEMIDLIST,LPBC,REFIID,PVOID*);
907 	HRESULT BindToStorage(LPCITEMIDLIST,LPBC,REFIID,PVOID*);
908 	HRESULT CompareIDs(LPARAM,LPCITEMIDLIST,LPCITEMIDLIST);
909 	HRESULT CreateViewObject(HWND,REFIID,PVOID*);
910 	HRESULT GetAttributesOf(UINT,LPCITEMIDLIST*,PULONG);
911 	HRESULT GetUIObjectOf(HWND,UINT,LPCITEMIDLIST*,REFIID,PUINT,PVOID*);
912 	HRESULT GetDisplayNameOf(LPCITEMIDLIST,DWORD,LPSTRRET);
913 	HRESULT SetNameOf(HWND,LPCITEMIDLIST,LPCOLESTR,DWORD,LPITEMIDLIST*);
914 	HRESULT GetDefaultSearchGUID(GUID*);
915 	HRESULT EnumSearches(IEnumExtraSearch**);
916 	HRESULT GetDefaultColumn(DWORD,ULONG*,ULONG*);
917 	HRESULT GetDefaultColumnState(UINT,SHCOLSTATEF*);
918 	HRESULT GetDetailsEx(LPCITEMIDLIST, CPtr!(SHCOLUMNID),VARIANT*);
919 	HRESULT GetDetailsOf(LPCITEMIDLIST,UINT,SHELLDETAILS*);
920 	HRESULT MapColumnToSCID(UINT,SHCOLUMNID*);
921 }
922 alias IShellFolder2 *LPSHELLFOLDER2;
923 
924 } /* _WIN32_IE >= 0x0500 */
925 
926 interface ICopyHook : IUnknown
927 {
928 	HRESULT QueryInterface(REFIID,PVOID*);
929 	ULONG AddRef();
930 	ULONG Release();
931 	UINT CopyCallback(HWND,UINT,UINT,LPCSTR,DWORD,LPCSTR,DWORD);
932 }
933 alias ICopyHook *LPCOPYHOOK;
934 
935 interface IFileViewerSite : IUnknown
936 {
937 	HRESULT QueryInterface(REFIID,PVOID*);
938 	ULONG AddRef();
939 	ULONG Release();
940 	HRESULT SetPinnedWindow(HWND);
941 	HRESULT GetPinnedWindow(HWND*);
942 }
943 alias IFileViewerSite *LPFILEVIEWERSITE;
944 
945 interface IFileViewer : IUnknown
946 {
947 	HRESULT QueryInterface(REFIID,PVOID*);
948 	ULONG AddRef();
949 	ULONG Release();
950 	HRESULT ShowInitialize(LPFILEVIEWERSITE);
951 	HRESULT Show(LPFVSHOWINFO);
952 	HRESULT PrintTo(LPSTR,BOOL);
953 }
954 alias IFileViewer *LPFILEVIEWER;
955 
956 interface IFileSystemBindData : IUnknown
957 {
958 	HRESULT QueryInterface(REFIID,PVOID*);
959 	ULONG AddRef();
960 	ULONG Release();
961 	HRESULT SetFindData(CPtr!(WIN32_FIND_DATAW));
962 	HRESULT GetFindData(WIN32_FIND_DATAW*);
963 }
964 
965 interface IPersistFolder : IPersist
966 {
967 	HRESULT QueryInterface(REFIID,PVOID*);
968 	ULONG AddRef();
969 	ULONG Release();
970 	HRESULT GetClassID(CLSID*);
971 	HRESULT Initialize(LPCITEMIDLIST);
972 }
973 alias IPersistFolder *LPPERSISTFOLDER;
974 
975 static if (_WIN32_IE >= 0x0400 || _WIN32_WINNT >= 0x0500) {
976 
977 interface IPersistFolder2 : IPersistFolder
978 {
979 	HRESULT QueryInterface(REFIID,PVOID*);
980 	ULONG AddRef();
981 	ULONG Release();
982 	HRESULT GetClassID(CLSID*);
983 	HRESULT Initialize(LPCITEMIDLIST);
984 	HRESULT GetCurFolder(LPITEMIDLIST*);
985 }
986 alias IPersistFolder2 *LPPERSISTFOLDER2;
987 
988 }/* _WIN32_IE >= 0x0400 || _WIN32_WINNT >= 0x0500 */
989 
990 static if (_WIN32_IE >= 0x0500) {
991 
992 interface IPersistFolder3 : IPersistFolder2
993 {
994 	HRESULT QueryInterface(REFIID,PVOID*);
995 	ULONG AddRef();
996 	ULONG Release();
997 	HRESULT GetClassID(CLSID*);
998 	HRESULT Initialize(LPCITEMIDLIST);
999 	HRESULT GetCurFolder(LPITEMIDLIST*);
1000 	HRESULT InitializeEx(IBindCtx*,LPCITEMIDLIST, CPtr!(PERSIST_FOLDER_TARGET_INFO));
1001 	HRESULT GetFolderTargetInfo(PERSIST_FOLDER_TARGET_INFO*);
1002 }
1003 alias IPersistFolder3 *LPPERSISTFOLDER3;
1004 
1005 } /* _WIN32_IE >= 0x0500 */
1006 
1007 alias IShellBrowser* LPSHELLBROWSER;
1008 alias IShellView* LPSHELLVIEW;
1009 
1010 interface IShellBrowser : IOleWindow
1011 {
1012 	HRESULT QueryInterface(REFIID,PVOID*);
1013 	ULONG AddRef();
1014 	ULONG Release();
1015 	HRESULT GetWindow(HWND*);
1016 	HRESULT ContextSensitiveHelp(BOOL);
1017 	HRESULT InsertMenusSB(HMENU,LPOLEMENUGROUPWIDTHS);
1018 	HRESULT SetMenuSB(HMENU,HOLEMENU,HWND);
1019 	HRESULT RemoveMenusSB(HMENU);
1020 	HRESULT SetStatusTextSB(LPCOLESTR);
1021 	HRESULT EnableModelessSB(BOOL);
1022 	HRESULT TranslateAcceleratorSB(LPMSG,WORD);
1023 	HRESULT BrowseObject(LPCITEMIDLIST,UINT);
1024 	HRESULT GetViewStateStream(DWORD,LPSTREAM*);
1025 	HRESULT GetControlWindow(UINT,HWND*);
1026 	HRESULT SendControlMsg(UINT,UINT,WPARAM,LPARAM,LRESULT*);
1027 	HRESULT QueryActiveShellView(LPSHELLVIEW*);
1028 	HRESULT OnViewWindowActive(LPSHELLVIEW);
1029 	HRESULT SetToolbarItems(LPTBBUTTON,UINT,UINT);
1030 }
1031 
1032 interface IShellView : IOleWindow
1033 {
1034 	HRESULT QueryInterface(REFIID,PVOID*);
1035 	ULONG AddRef();
1036 	ULONG Release();
1037 	HRESULT GetWindow(HWND*);
1038 	HRESULT ContextSensitiveHelp(BOOL);
1039 	HRESULT TranslateAccelerator(LPMSG);
1040 //[No] #ifdef _FIX_ENABLEMODELESS_CONFLICT
1041 //[No] 	STDMETHOD(EnableModelessSV)(THIS_ BOOL) PURE;
1042 //[Yes] #else
1043 	HRESULT EnableModeless(BOOL);
1044 //[Yes] #endif
1045 	HRESULT UIActivate(UINT);
1046 	HRESULT Refresh();
1047 	HRESULT CreateViewWindow(IShellView*,LPCFOLDERSETTINGS,LPSHELLBROWSER,RECT*,HWND*);
1048 	HRESULT DestroyViewWindow();
1049 	HRESULT GetCurrentInfo(LPFOLDERSETTINGS);
1050 	HRESULT AddPropertySheetPages(DWORD,LPFNADDPROPSHEETPAGE,LPARAM);
1051 	HRESULT SaveViewState();
1052 	HRESULT SelectItem(LPCITEMIDLIST,UINT);
1053 	HRESULT GetItemObject(UINT,REFIID,PVOID*);
1054 }
1055 
1056 interface ICommDlgBrowser : IUnknown
1057 {
1058 	HRESULT QueryInterface(REFIID,PVOID*);
1059 	ULONG AddRef();
1060 	ULONG Release();
1061 	HRESULT OnDefaultCommand(IShellView*);
1062 	HRESULT OnStateChange(IShellView*,ULONG);
1063 	HRESULT IncludeObject(IShellView*,LPCITEMIDLIST);
1064 }
1065 alias ICommDlgBrowser *LPCOMMDLGBROWSER;
1066 
1067 alias GUID SHELLVIEWID;
1068 
1069 struct SV2CVW2_PARAMS {
1070 	DWORD cbSize = this.sizeof;
1071 	IShellView *psvPrev;
1072 	FOLDERSETTINGS  *pfs;
1073 	IShellBrowser *psbOwner;
1074 	RECT *prcView;
1075 	CPtr!(SHELLVIEWID) pvid;
1076 	HWND hwndView;
1077 }
1078 alias SV2CVW2_PARAMS* LPSV2CVW2_PARAMS;
1079 
1080 interface IShellView2 : IShellView
1081 {
1082 
1083 	HRESULT QueryInterface(REFIID,PVOID*);
1084 	ULONG AddRef();
1085 	ULONG Release();
1086 	HRESULT GetWindow(HWND*);
1087 	HRESULT ContextSensitiveHelp(BOOL);
1088 	HRESULT TranslateAccelerator(LPMSG);
1089 //[No] #ifdef _FIX_ENABLEMODELESS_CONFLICT
1090 //[No] 	STDMETHOD(EnableModelessSV)(THIS_ BOOL) PURE;
1091 //[Yes] #else
1092 	HRESULT EnableModeless(BOOL);
1093 //[Yes] #endif
1094 	HRESULT UIActivate(UINT);
1095 	HRESULT Refresh();
1096 	HRESULT CreateViewWindow(IShellView*,LPCFOLDERSETTINGS,LPSHELLBROWSER,RECT*,HWND*);
1097 	HRESULT DestroyViewWindow();
1098 	HRESULT GetCurrentInfo(LPFOLDERSETTINGS);
1099 	HRESULT AddPropertySheetPages(DWORD,LPFNADDPROPSHEETPAGE,LPARAM);
1100 	HRESULT SaveViewState();
1101 	HRESULT SelectItem(LPCITEMIDLIST,UINT);
1102 	HRESULT GetItemObject(UINT,REFIID,PVOID*);
1103 	HRESULT GetView(SHELLVIEWID*,ULONG);
1104 	HRESULT CreateViewWindow2(LPSV2CVW2_PARAMS);
1105 }
1106 
1107 interface IShellExecuteHookA : IUnknown
1108 {
1109 	HRESULT QueryInterface(REFIID,PVOID*);
1110 	ULONG AddRef();
1111 	ULONG Release();
1112 	HRESULT Execute(LPSHELLEXECUTEINFOA);
1113 }
1114 
1115 interface IShellExecuteHookW : IUnknown
1116 {
1117 	HRESULT QueryInterface(REFIID,PVOID*);
1118 	ULONG AddRef();
1119 	ULONG Release();
1120 	HRESULT Execute(LPSHELLEXECUTEINFOW);
1121 }
1122 
1123 interface IShellIcon : IUnknown
1124 {
1125 	HRESULT QueryInterface(REFIID,PVOID*);
1126 	ULONG AddRef();
1127 	ULONG Release();
1128 	HRESULT GetIconOf(LPCITEMIDLIST,UINT,PINT);
1129 }
1130 alias IShellIcon* LPSHELLICON;
1131 
1132 struct SHELLFLAGSTATE {
1133 // TODO
1134  short bitflags_; // for D.
1135  /*
1136 	BOOL fShowAllObjects : 1;
1137 	BOOL fShowExtensions : 1;
1138 	BOOL fNoConfirmRecycle : 1;
1139 	BOOL fShowSysFiles : 1;
1140 	BOOL fShowCompColor : 1;
1141 	BOOL fDoubleClickInWebView : 1;
1142 	BOOL fDesktopHTML : 1;
1143 	BOOL fWin95Classic : 1;
1144 	BOOL fDontPrettyPath : 1;
1145 	BOOL fShowAttribCol : 1;
1146 	BOOL fMapNetDrvBtn : 1;
1147 	BOOL fShowInfoTip : 1;
1148 	BOOL fHideIcons : 1;
1149 	UINT fRestFlags : 3;
1150 */
1151 }
1152 alias SHELLFLAGSTATE* LPSHELLFLAGSTATE;
1153 
1154 const SSF_SHOWALLOBJECTS = 0x1;
1155 const SSF_SHOWEXTENSIONS = 0x2;
1156 const SSF_SHOWCOMPCOLOR = 0x8;
1157 const SSF_SHOWSYSFILES = 0x20;
1158 const SSF_DOUBLECLICKINWEBVIEW = 0x80;
1159 const SSF_SHOWATTRIBCOL = 0x100;
1160 const SSF_DESKTOPHTML = 0x200;
1161 const SSF_WIN95CLASSIC = 0x400;
1162 const SSF_DONTPRETTYPATH = 0x800;
1163 const SSF_MAPNETDRVBUTTON = 0x1000;
1164 const SSF_SHOWINFOTIP = 0x2000;
1165 const SSF_HIDEICONS = 0x4000;
1166 const SSF_NOCONFIRMRECYCLE = 0x8000;
1167 
1168 interface IShellIconOverlayIdentifier : IUnknown
1169 {
1170 	HRESULT QueryInterface(REFIID,PVOID*);
1171 	ULONG AddRef();
1172 	ULONG Release();
1173 	HRESULT IsMemberOf(LPCWSTR,DWORD);
1174 	HRESULT GetOverlayInfo(LPWSTR,int,int*,DWORD*);
1175 	HRESULT GetPriority(int*);
1176 }
1177 
1178 const ISIOI_ICONFILE  = 0x00000001;
1179 const ISIOI_ICONINDEX = 0x00000002;
1180 
1181 static if (_WIN32_WINNT >= 0x0500) {/* W2K */
1182 	struct SHELLSTATE {
1183 	//TODO:
1184 	/*
1185 		BOOL fShowAllObjects : 1;
1186 		BOOL fShowExtensions : 1;
1187 		BOOL fNoConfirmRecycle : 1;
1188 		BOOL fShowSysFiles : 1;
1189 		BOOL fShowCompColor : 1;
1190 		BOOL fDoubleClickInWebView : 1;
1191 		BOOL fDesktopHTML : 1;
1192 		BOOL fWin95Classic : 1;
1193 		BOOL fDontPrettyPath : 1;
1194 		BOOL fShowAttribCol : 1;
1195 		BOOL fMapNetDrvBtn : 1;
1196 		BOOL fShowInfoTip : 1;
1197 		BOOL fHideIcons : 1;
1198 		BOOL fWebView : 1;
1199 		BOOL fFilter : 1;
1200 		BOOL fShowSuperHidden : 1;
1201 		BOOL fNoNetCrawling : 1;
1202 		DWORD dwWin95Unused;
1203 		UINT uWin95Unused;
1204 		LONG lParamSort;
1205 		int iSortDirection;
1206 		UINT version;
1207 		UINT uNotUsed;
1208 		BOOL fSepProcess : 1;
1209 		BOOL fStartPanelOn : 1;
1210 		BOOL fShowStartPage : 1;
1211 		UINT fSpareFlags : 13;
1212 */
1213 	}
1214 	alias SHELLSTATE* LPSHELLSTATE;
1215 }
1216 
1217 static if (_WIN32_IE >= 0x0500) {
1218 	align(8):
1219 	struct SHDRAGIMAGE {
1220 		SIZE sizeDragImage;
1221 		POINT ptOffset;
1222 		HBITMAP hbmpDragImage;
1223 		COLORREF crColorKey;
1224 	}
1225 	alias SHDRAGIMAGE* LPSHDRAGIMAGE;
1226 	align:
1227 
1228 	interface IDragSourceHelper : IUnknown
1229 	 {
1230 		HRESULT QueryInterface(REFIID riid, void **ppv);
1231 		ULONG AddRef();
1232 		ULONG Release();
1233 		HRESULT InitializeFromBitmap(LPSHDRAGIMAGE pshdi, IDataObject* pDataObject);
1234 		HRESULT InitializeFromWindow(HWND hwnd, POINT* ppt, IDataObject* pDataObject);
1235 	}
1236 
1237 	interface IDropTargetHelper : IUnknown
1238 	 {
1239 		HRESULT QueryInterface(REFIID riid, void** ppv);
1240 		ULONG AddRef();
1241 		ULONG Release();
1242 		HRESULT DragEnter(HWND hwndTarget, IDataObject* pDataObject, POINT* ppt, DWORD dwEffect);
1243 		HRESULT DragLeave();
1244 		HRESULT DragOver(POINT* ppt, DWORD dwEffect);
1245 		HRESULT Drop(IDataObject* pDataObject, POINT* ppt, DWORD dwEffect);
1246 		HRESULT Show(BOOL fShow);
1247 	}
1248 }
1249 
1250 extern (Windows):
1251 void SHAddToRecentDocs(UINT,PCVOID);
1252 LPITEMIDLIST SHBrowseForFolderA(PBROWSEINFOA);
1253 LPITEMIDLIST SHBrowseForFolderW(PBROWSEINFOW);
1254 void SHChangeNotify(LONG,UINT,PCVOID,PCVOID);
1255 HRESULT SHGetDataFromIDListA(LPSHELLFOLDER,LPCITEMIDLIST,int,PVOID,int);
1256 HRESULT SHGetDataFromIDListW(LPSHELLFOLDER,LPCITEMIDLIST,int,PVOID,int);
1257 HRESULT SHGetDesktopFolder(LPSHELLFOLDER*);
1258 HRESULT SHGetInstanceExplorer(IUnknown **);
1259 HRESULT SHGetMalloc(LPMALLOC*);
1260 BOOL SHGetPathFromIDListA(LPCITEMIDLIST,LPSTR);
1261 BOOL SHGetPathFromIDListW(LPCITEMIDLIST,LPWSTR);
1262 HRESULT SHGetSpecialFolderLocation(HWND,int,LPITEMIDLIST*);
1263 HRESULT SHLoadInProc(REFCLSID);
1264 
1265 static if (_WIN32_IE >= 0x0400) {
1266 	BOOL SHGetSpecialFolderPathA(HWND,LPSTR,int,BOOL);
1267 	BOOL SHGetSpecialFolderPathW(HWND,LPWSTR,int,BOOL);
1268 }
1269 
1270 /* SHGetFolderPath in shfolder.dll on W9x, NT4, also in shell32.dll on W2K */
1271 HRESULT SHGetFolderPathA(HWND,int,HANDLE,DWORD,LPSTR);
1272 HRESULT SHGetFolderPathW(HWND,int,HANDLE,DWORD,LPWSTR);
1273 
1274 static if ((_WIN32_WINDOWS >= 0x0490) || (_WIN32_WINNT >= 0x0500)) {/* ME or W2K */
1275 	HRESULT SHGetFolderLocation(HWND,int,HANDLE,DWORD,LPITEMIDLIST*);
1276 }
1277 
1278 static if (_WIN32_WINNT >= 0x0500) {
1279 	INT SHCreateDirectoryExA(HWND,LPCSTR,LPSECURITY_ATTRIBUTES);
1280 	INT SHCreateDirectoryExW(HWND,LPCWSTR,LPSECURITY_ATTRIBUTES);
1281 	HRESULT SHBindToParent(LPCITEMIDLIST,REFIID,VOID**,LPCITEMIDLIST*);
1282 }
1283 
1284 static if (_WIN32_WINNT >= 0x0501) {/* XP */
1285 	HRESULT SHGetFolderPathAndSubDirA(HWND,int,HANDLE,DWORD,LPCSTR,LPSTR);
1286 	HRESULT SHGetFolderPathAndSubDirW(HWND,int,HANDLE,DWORD,LPCWSTR,LPWSTR);
1287 }
1288 
1289 void SHGetSettings(LPSHELLFLAGSTATE,DWORD);
1290 
1291 static if (_WIN32_WINNT >= 0x0500) {/* W2K */
1292 	void SHGetSetSettings(LPSHELLSTATE,DWORD,BOOL);
1293 }
1294 
1295 static if (_WIN32_WINNT >= 0x0500) {/* W2K */
1296 	BOOL ILIsEqual(LPCITEMIDLIST, LPCITEMIDLIST);
1297 	BOOL ILIsParent(LPCITEMIDLIST, LPCITEMIDLIST, BOOL);
1298 	BOOL ILRemoveLastID(LPITEMIDLIST);
1299 	HRESULT ILLoadFromStream(IStream*, LPITEMIDLIST*);
1300 	HRESULT ILSaveToStream(IStream*, LPCITEMIDLIST);
1301 	LPITEMIDLIST ILAppendID(LPITEMIDLIST, LPCSHITEMID, BOOL);
1302 	LPITEMIDLIST ILClone(LPCITEMIDLIST);
1303 	LPITEMIDLIST ILCloneFirst(LPCITEMIDLIST);
1304 	LPITEMIDLIST ILCombine(LPCITEMIDLIST, LPCITEMIDLIST);
1305 	LPITEMIDLIST ILFindChild(LPCITEMIDLIST, LPCITEMIDLIST);
1306 	LPITEMIDLIST ILFindLastID(LPCITEMIDLIST);
1307 	LPITEMIDLIST ILGetNext(LPCITEMIDLIST);
1308 	UINT ILGetSize(LPCITEMIDLIST);
1309 	void ILFree(LPITEMIDLIST);
1310 
1311 	HRESULT SHCoCreateInstance(LPCWSTR,REFCLSID,IUnknown*,REFIID,void**);
1312 }
1313 
1314 version(Unicode) {
1315 	alias IShellExecuteHookW IShellExecuteHook;
1316 	alias IShellLinkW IShellLink;
1317 	alias BROWSEINFOW BROWSEINFO;
1318 	alias SHBrowseForFolderW SHBrowseForFolder;
1319 	alias SHGetDataFromIDListW SHGetDataFromIDList;
1320 	alias SHGetPathFromIDListW SHGetPathFromIDList;
1321 	static if (_WIN32_IE >= 0x0400) {
1322 		alias SHGetSpecialFolderPathW SHGetSpecialFolderPath;
1323 	}
1324 	alias SHGetFolderPathW SHGetFolderPath;
1325 	static if (_WIN32_WINNT >= 0x0500) {
1326 		alias SHCreateDirectoryExW SHCreateDirectoryEx;
1327 	}
1328 	static if (_WIN32_WINNT >= 0x0501) {
1329 		alias SHGetFolderPathAndSubDirW SHGetFolderPathAndSubDir;
1330 	}
1331 	alias FILEDESCRIPTORW FILEDESCRIPTOR;
1332 	alias LPFILEDESCRIPTORW LPFILEDESCRIPTOR;
1333 	alias FILEGROUPDESCRIPTORW FILEGROUPDESCRIPTOR;
1334 	alias LPFILEGROUPDESCRIPTORW LPFILEGROUPDESCRIPTOR;
1335 
1336 } else {
1337 	alias IShellExecuteHookA IShellExecuteHook;
1338 	alias IShellLinkA IShellLink;
1339 	alias BROWSEINFOA BROWSEINFO;
1340 	alias SHBrowseForFolderA SHBrowseForFolder;
1341 	alias SHGetDataFromIDListA SHGetDataFromIDList;
1342 	alias SHGetPathFromIDListA SHGetPathFromIDList;
1343 	static if (_WIN32_IE >= 0x0400) {
1344 		alias SHGetSpecialFolderPathA SHGetSpecialFolderPath;
1345 	}
1346 	alias SHGetFolderPathA SHGetFolderPath;
1347 	static if (_WIN32_WINNT >= 0x0500) {
1348 		alias SHCreateDirectoryExA SHCreateDirectoryEx;
1349 	}
1350 	static if (_WIN32_WINNT >= 0x0501) {
1351 		alias SHGetFolderPathAndSubDirA SHGetFolderPathAndSubDir;
1352 	}
1353 	alias FILEDESCRIPTORA FILEDESCRIPTOR;
1354 	alias LPFILEDESCRIPTORA LPFILEDESCRIPTOR;
1355 	alias FILEGROUPDESCRIPTORA FILEGROUPDESCRIPTOR;
1356 	alias LPFILEGROUPDESCRIPTORA LPFILEGROUPDESCRIPTOR;
1357 }
1358 alias BROWSEINFO* PBROWSEINFO, LPBROWSEINFO;