]> git.proxmox.com Git - rustc.git/blob - vendor/winapi/src/um/shellapi.rs
New upstream version 1.41.1+dfsg1
[rustc.git] / vendor / winapi / src / um / shellapi.rs
1 // Licensed under the Apache License, Version 2.0
2 // <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
3 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
4 // All files in the project carrying such notice may not be copied, modified, or distributed
5 // except according to those terms
6 //! SHELL.DLL functions, types, and definitions
7 use ctypes::{__int64, c_int, c_void};
8 use shared::basetsd::{DWORD_PTR, UINT_PTR};
9 use shared::guiddef::{GUID, REFIID};
10 use shared::minwindef::{
11 BOOL, DWORD, FILETIME, HINSTANCE, HKEY, INT, LPARAM, LPVOID, MAX_PATH, UINT, ULONG, WORD,
12 };
13 use shared::windef::{HICON, HWND, POINT, RECT};
14 use um::minwinbase::LPSECURITY_ATTRIBUTES;
15 use um::processthreadsapi::{LPPROCESS_INFORMATION, LPSTARTUPINFOW};
16 use um::winnt::{
17 CHAR, HANDLE, HRESULT, LPCSTR, LPCWSTR, LPSTR, LPWSTR, PCSTR, PCWSTR, PCZZSTR, PCZZWSTR, PWSTR,
18 PZZSTR, PZZWSTR, ULARGE_INTEGER, WCHAR,
19 };
20 use um::winuser::WM_USER;
21 DECLARE_HANDLE!{HDROP, HDROP__}
22 extern "system" {
23 pub fn DragQueryFileA(
24 hDrop: HDROP,
25 iFile: UINT,
26 lpszFile: LPSTR,
27 cch: UINT,
28 ) -> UINT;
29 pub fn DragQueryFileW(
30 hDrop: HDROP,
31 iFile: UINT,
32 lpszFile: LPWSTR,
33 cch: UINT,
34 ) -> UINT;
35 pub fn DragQueryPoint(
36 hDrop: HDROP,
37 lppt: *mut POINT,
38 ) -> BOOL;
39 pub fn DragFinish(
40 hDrop: HDROP,
41 );
42 pub fn DragAcceptFiles(
43 hWnd: HWND,
44 fAccept: BOOL,
45 );
46 pub fn ShellExecuteA(
47 hwnd: HWND,
48 lpOperation: LPCSTR,
49 lpFile: LPCSTR,
50 lpParameters: LPCSTR,
51 lpDirectory: LPCSTR,
52 nShowCmd: c_int,
53 ) -> HINSTANCE;
54 pub fn ShellExecuteW(
55 hwnd: HWND,
56 lpOperation: LPCWSTR,
57 lpFile: LPCWSTR,
58 lpParameters: LPCWSTR,
59 lpDirectory: LPCWSTR,
60 nShowCmd: c_int,
61 ) -> HINSTANCE;
62 pub fn FindExecutableA(
63 lpFile: LPCSTR,
64 lpDirectory: LPCSTR,
65 lpResult: LPSTR,
66 ) -> HINSTANCE;
67 pub fn FindExecutableW(
68 lpFile: LPCWSTR,
69 lpDirectory: LPCWSTR,
70 lpResult: LPWSTR,
71 ) -> HINSTANCE;
72 pub fn CommandLineToArgvW(
73 lpCmdLine: LPCWSTR,
74 pNumArgs: *mut c_int,
75 ) -> *mut LPWSTR;
76 pub fn ShellAboutA(
77 hWnd: HWND,
78 szApp: LPCSTR,
79 szOtherStuff: LPCSTR,
80 hIcon: HICON,
81 ) -> INT;
82 pub fn ShellAboutW(
83 hWnd: HWND,
84 szApp: LPCWSTR,
85 szOtherStuff: LPCWSTR,
86 hIcon: HICON,
87 ) -> INT;
88 pub fn DuplicateIcon(
89 hInst: HINSTANCE,
90 hIcon: HICON,
91 ) -> HICON;
92 pub fn ExtractAssociatedIconA(
93 hInst: HINSTANCE,
94 pszIconPath: LPSTR,
95 piIcon: *mut WORD,
96 ) -> HICON;
97 pub fn ExtractAssociatedIconW(
98 hInst: HINSTANCE,
99 pszIconPath: LPWSTR,
100 piIcon: *mut WORD,
101 ) -> HICON;
102 pub fn ExtractAssociatedIconExA(
103 hInst: HINSTANCE,
104 pszIconPath: LPSTR,
105 piIconIndex: *mut WORD,
106 piIconId: *mut WORD,
107 ) -> HICON;
108 pub fn ExtractAssociatedIconExW(
109 hInst: HINSTANCE,
110 pszIconPath: LPWSTR,
111 piIconIndex: *mut WORD,
112 piIconId: *mut WORD,
113 ) -> HICON;
114 pub fn ExtractIconA(
115 hInst: HINSTANCE,
116 pszExeFileName: LPCSTR,
117 nIconIndex: UINT,
118 ) -> HICON;
119 pub fn ExtractIconW(
120 hInst: HINSTANCE,
121 pszExeFileName: LPCWSTR,
122 nIconIndex: UINT,
123 ) -> HICON;
124 }
125 STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct DRAGINFOA {
126 uSize: UINT,
127 pt: POINT,
128 fNC: BOOL,
129 lpFileList: PZZSTR,
130 grfKeyState: DWORD,
131 }}
132 pub type LPDRAGINFOA = *mut DRAGINFOA;
133 STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct DRAGINFOW {
134 uSize: UINT,
135 pt: POINT,
136 fNC: BOOL,
137 lpFileList: PZZWSTR,
138 grfKeyState: DWORD,
139 }}
140 pub type LPDRAGINFOW = *mut DRAGINFOW;
141 pub const ABM_NEW: DWORD = 0x00000000;
142 pub const ABM_REMOVE: DWORD = 0x00000001;
143 pub const ABM_QUERYPOS: DWORD = 0x00000002;
144 pub const ABM_SETPOS: DWORD = 0x00000003;
145 pub const ABM_GETSTATE: DWORD = 0x00000004;
146 pub const ABM_GETTASKBARPOS: DWORD = 0x00000005;
147 pub const ABM_ACTIVATE: DWORD = 0x00000006;
148 pub const ABM_GETAUTOHIDEBAR: DWORD = 0x00000007;
149 pub const ABM_SETAUTOHIDEBAR: DWORD = 0x00000008;
150 pub const ABM_WINDOWPOSCHANGED: DWORD = 0x0000009;
151 pub const ABM_SETSTATE: DWORD = 0x0000000a;
152 pub const ABM_GETAUTOHIDEBAREX: DWORD = 0x0000000b;
153 pub const ABM_SETAUTOHIDEBAREX: DWORD = 0x0000000c;
154 pub const ABN_STATECHANGE: DWORD = 0x0000000;
155 pub const ABN_POSCHANGED: DWORD = 0x0000001;
156 pub const ABN_FULLSCREENAPP: DWORD = 0x0000002;
157 pub const ABN_WINDOWARRANGE: DWORD = 0x0000003;
158 pub const ABS_AUTOHIDE: UINT = 0x0000001;
159 pub const ABS_ALWAYSONTOP: UINT = 0x0000002;
160 pub const ABE_LEFT: UINT = 0;
161 pub const ABE_TOP: UINT = 1;
162 pub const ABE_RIGHT: UINT = 2;
163 pub const ABE_BOTTOM: UINT = 3;
164 STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct APPBARDATA {
165 cbSize: DWORD,
166 hWnd: HWND,
167 uCallbackMessage: UINT,
168 uEdge: UINT,
169 rc: RECT,
170 lParam: LPARAM,
171 }}
172 pub type PAPPBARDATA = *mut APPBARDATA;
173 extern "system" {
174 pub fn SHAppBarMessage(
175 dwMessage: DWORD,
176 pData: PAPPBARDATA,
177 ) -> UINT_PTR;
178 pub fn DoEnvironmentSubstA(
179 pszSrc: LPSTR,
180 cchSrc: UINT,
181 ) -> DWORD;
182 pub fn DoEnvironmentSubstW(
183 pszSrc: LPWSTR,
184 cchSrc: UINT,
185 ) -> DWORD;
186 pub fn ExtractIconExA(
187 lpszFile: LPCSTR,
188 nIconIndex: c_int,
189 phiconLarge: *mut HICON,
190 phiconSmall: *mut HICON,
191 nIcons: UINT,
192 ) -> UINT;
193 pub fn ExtractIconExW(
194 lpszFile: LPCWSTR,
195 nIconIndex: c_int,
196 phiconLarge: *mut HICON,
197 phiconSmall: *mut HICON,
198 nIcons: UINT,
199 ) -> UINT;
200 }
201 pub const FO_MOVE: WORD = 0x0001;
202 pub const FO_COPY: WORD = 0x0002;
203 pub const FO_DELETE: WORD = 0x0003;
204 pub const FO_RENAME: WORD = 0x0004;
205 pub const FOF_MULTIDESTFILES: WORD = 0x0001;
206 pub const FOF_CONFIRMMOUSE: WORD = 0x0002;
207 pub const FOF_SILENT: WORD = 0x0004;
208 pub const FOF_RENAMEONCOLLISION: WORD = 0x0008;
209 pub const FOF_NOCONFIRMATION: WORD = 0x0010;
210 pub const FOF_WANTMAPPINGHANDLE: WORD = 0x0020;
211 pub const FOF_ALLOWUNDO: WORD = 0x0040;
212 pub const FOF_FILESONLY: WORD = 0x0080;
213 pub const FOF_SIMPLEPROGRESS: WORD = 0x0100;
214 pub const FOF_NOCONFIRMMKDIR: WORD = 0x0200;
215 pub const FOF_NOERRORUI: WORD = 0x0400;
216 pub const FOF_NOCOPYSECURITYATTRIBS: WORD = 0x0800;
217 pub const FOF_NORECURSION: WORD = 0x1000;
218 pub const FOF_NO_CONNECTED_ELEMENTS: WORD = 0x2000;
219 pub const FOF_WANTNUKEWARNING: WORD = 0x4000;
220 pub const FOF_NORECURSEREPARSE: WORD = 0x8000;
221 pub const FOF_NO_UI: WORD = FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_NOCONFIRMMKDIR;
222 pub type FILEOP_FLAGS = WORD;
223 pub const PO_DELETE: WORD = 0x0013;
224 pub const PO_RENAME: WORD = 0x0014;
225 pub const PO_PORTCHANGE: WORD = 0x0020;
226 pub const PO_REN_PORT: WORD = 0x0034;
227 pub type PRINTEROP_FLAGS = WORD;
228 STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct SHFILEOPSTRUCTA {
229 hwnd: HWND,
230 wFunc: UINT,
231 pFrom: PCZZSTR,
232 pTo: PCZZSTR,
233 fFlags: FILEOP_FLAGS,
234 fAnyOperationsAborted: BOOL,
235 hNameMappings: LPVOID,
236 lpszProgressTitle: PCSTR,
237 }}
238 pub type LPSHFILEOPSTRUCTA = *mut SHFILEOPSTRUCTA;
239 STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct SHFILEOPSTRUCTW {
240 hwnd: HWND,
241 wFunc: UINT,
242 pFrom: PCZZWSTR,
243 pTo: PCZZWSTR,
244 fFlags: FILEOP_FLAGS,
245 fAnyOperationsAborted: BOOL,
246 hNameMappings: LPVOID,
247 lpszProgressTitle: PCWSTR,
248 }}
249 pub type LPSHFILEOPSTRUCTW = *mut SHFILEOPSTRUCTW;
250 extern "system" {
251 pub fn SHFileOperationA(
252 lpFileOp: LPSHFILEOPSTRUCTA,
253 ) -> c_int;
254 pub fn SHFileOperationW(
255 lpFileOp: LPSHFILEOPSTRUCTW,
256 ) -> c_int;
257 pub fn SHFreeNameMappings(
258 hNameMappings: HANDLE,
259 );
260 }
261 STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct SHNAMEMAPPINGA {
262 pszOldPath: LPSTR,
263 pszNewPath: LPSTR,
264 cchOldPath: c_int,
265 cchNewPath: c_int,
266 }}
267 pub type LPSHNAMEMAPPINGA = *mut SHNAMEMAPPINGA;
268 STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct SHNAMEMAPPINGW {
269 pszOldPath: LPWSTR,
270 pszNewPath: LPWSTR,
271 cchOldPath: c_int,
272 cchNewPath: c_int,
273 }}
274 pub type LPSHNAMEMAPPINGW = *mut SHNAMEMAPPINGW;
275 pub const SE_ERR_FNF: DWORD = 2;
276 pub const SE_ERR_PNF: DWORD = 3;
277 pub const SE_ERR_ACCESSDENIED: DWORD = 5;
278 pub const SE_ERR_OOM: DWORD = 8;
279 pub const SE_ERR_DLLNOTFOUND: DWORD = 32;
280 pub const SE_ERR_SHARE: DWORD = 26;
281 pub const SE_ERR_ASSOCINCOMPLETE: DWORD = 27;
282 pub const SE_ERR_DDETIMEOUT: DWORD = 28;
283 pub const SE_ERR_DDEFAIL: DWORD = 29;
284 pub const SE_ERR_DDEBUSY: DWORD = 30;
285 pub const SE_ERR_NOASSOC: DWORD = 31;
286 pub const SEE_MASK_DEFAULT: DWORD = 0x00000000;
287 pub const SEE_MASK_CLASSNAME: DWORD = 0x00000001;
288 pub const SEE_MASK_CLASSKEY: DWORD = 0x00000003;
289 pub const SEE_MASK_IDLIST: DWORD = 0x00000004;
290 pub const SEE_MASK_INVOKEIDLIST: DWORD = 0x0000000c;
291 pub const SEE_MASK_ICON: DWORD = 0x00000010;
292 pub const SEE_MASK_HOTKEY: DWORD = 0x00000020;
293 pub const SEE_MASK_NOCLOSEPROCESS: DWORD = 0x00000040;
294 pub const SEE_MASK_CONNECTNETDRV: DWORD = 0x00000080;
295 pub const SEE_MASK_NOASYNC: DWORD = 0x00000100;
296 pub const SEE_MASK_FLAG_DDEWAIT: DWORD = SEE_MASK_NOASYNC;
297 pub const SEE_MASK_DOENVSUBST: DWORD = 0x00000200;
298 pub const SEE_MASK_FLAG_NO_UI: DWORD = 0x00000400;
299 pub const SEE_MASK_UNICODE: DWORD = 0x00004000;
300 pub const SEE_MASK_NO_CONSOLE: DWORD = 0x00008000;
301 pub const SEE_MASK_ASYNCOK: DWORD = 0x00100000;
302 pub const SEE_MASK_HMONITOR: DWORD = 0x00200000;
303 pub const SEE_MASK_NOZONECHECKS: DWORD = 0x00800000;
304 pub const SEE_MASK_NOQUERYCLASSSTORE: DWORD = 0x01000000;
305 pub const SEE_MASK_WAITFORINPUTIDLE: DWORD = 0x02000000;
306 pub const SEE_MASK_FLAG_LOG_USAGE: DWORD = 0x04000000;
307 pub const SEE_MASK_FLAG_HINST_IS_SITE: DWORD = 0x08000000;
308 STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct SHELLEXECUTEINFOA {
309 cbSize: DWORD,
310 fMask: ULONG,
311 hwnd: HWND,
312 lpVerb: LPCSTR,
313 lpFile: LPCSTR,
314 lpParameters: LPCSTR,
315 lpDirectory: LPCSTR,
316 nShow: c_int,
317 hInstApp: HINSTANCE,
318 lpIDList: *mut c_void,
319 lpClass: LPCSTR,
320 hkeyClass: HKEY,
321 dwHotKey: DWORD,
322 hMonitor: HANDLE,
323 hProcess: HANDLE,
324 }}
325 pub type LPSHELLEXECUTEINFOA = *mut SHELLEXECUTEINFOA;
326 STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct SHELLEXECUTEINFOW {
327 cbSize: DWORD,
328 fMask: ULONG,
329 hwnd: HWND,
330 lpVerb: LPCWSTR,
331 lpFile: LPCWSTR,
332 lpParameters: LPCWSTR,
333 lpDirectory: LPCWSTR,
334 nShow: c_int,
335 hInstApp: HINSTANCE,
336 lpIDList: *mut c_void,
337 lpClass: LPCWSTR,
338 hkeyClass: HKEY,
339 dwHotKey: DWORD,
340 hMonitor: HANDLE,
341 hProcess: HANDLE,
342 }}
343 pub type LPSHELLEXECUTEINFOW = *mut SHELLEXECUTEINFOW;
344 extern "system" {
345 pub fn ShellExecuteExA(
346 pExecInfo: *mut SHELLEXECUTEINFOA,
347 ) -> BOOL;
348 pub fn ShellExecuteExW(
349 pExecInfo: *mut SHELLEXECUTEINFOW,
350 ) -> BOOL;
351 }
352 STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct SHCREATEPROCESSINFOW {
353 cbSize: DWORD,
354 fMask: ULONG,
355 hwnd: HWND,
356 pszFile: LPCWSTR,
357 pszParameters: LPCWSTR,
358 pszCurrentDirectory: LPCWSTR,
359 hUserToken: HANDLE,
360 lpProcessAttributes: LPSECURITY_ATTRIBUTES,
361 lpThreadAttributes: LPSECURITY_ATTRIBUTES,
362 bInheritHandles: BOOL,
363 dwCreationFlags: DWORD,
364 lpStartupInfo: LPSTARTUPINFOW,
365 lpProcessInformation: LPPROCESS_INFORMATION,
366 }}
367 pub type PSHCREATEPROCESSINFOW = *mut SHCREATEPROCESSINFOW;
368 extern "system" {
369 pub fn SHCreateProcessAsUserW(
370 pscpi: PSHCREATEPROCESSINFOW,
371 ) -> BOOL;
372 pub fn SHEvaluateSystemCommandTemplate(
373 pszCmdTemplate: PCWSTR,
374 ppszApplication: *mut PWSTR,
375 ppszCommandLine: *mut PWSTR,
376 ppszParameters: *mut PWSTR,
377 ) -> HRESULT;
378 }
379 ENUM!{enum ASSOCCLASS {
380 ASSOCCLASS_SHELL_KEY = 0,
381 ASSOCCLASS_PROGID_KEY,
382 ASSOCCLASS_PROGID_STR,
383 ASSOCCLASS_CLSID_KEY,
384 ASSOCCLASS_CLSID_STR,
385 ASSOCCLASS_APP_KEY,
386 ASSOCCLASS_APP_STR,
387 ASSOCCLASS_SYSTEM_STR,
388 ASSOCCLASS_FOLDER,
389 ASSOCCLASS_STAR,
390 ASSOCCLASS_FIXED_PROGID_STR,
391 ASSOCCLASS_PROTOCOL_STR,
392 }}
393 STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct ASSOCIATIONELEMENT {
394 ac: ASSOCCLASS,
395 hkClass: HKEY,
396 pszClass: PCWSTR,
397 }}
398 extern "system" {
399 pub fn AssocCreateForClasses(
400 rgClasses: *const ASSOCIATIONELEMENT,
401 cClasses: ULONG,
402 riid: REFIID,
403 ppv: *mut *mut c_void,
404 ) -> HRESULT;
405 }
406 STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct SHQUERYRBINFO {
407 cbSize: DWORD,
408 i64Size: __int64,
409 i64NumItems: __int64,
410 }}
411 pub type LPSHQUERYRBINFO = *mut SHQUERYRBINFO;
412 pub const SHERB_NOCONFIRMATION: DWORD = 0x00000001;
413 pub const SHERB_NOPROGRESSUI: DWORD = 0x00000002;
414 pub const SHERB_NOSOUND: DWORD = 0x00000004;
415 extern "system" {
416 pub fn SHQueryRecycleBinA(
417 pszRootPath: LPCSTR,
418 pSHQueryRBInfo: LPSHQUERYRBINFO,
419 ) -> HRESULT;
420 pub fn SHQueryRecycleBinW(
421 pszRootPath: LPCWSTR,
422 pSHQueryRBInfo: LPSHQUERYRBINFO,
423 ) -> HRESULT;
424 pub fn SHEmptyRecycleBinA(
425 hwnd: HWND,
426 pszRootPath: LPCSTR,
427 dwFlags: DWORD,
428 ) -> HRESULT;
429 pub fn SHEmptyRecycleBinW(
430 hwnd: HWND,
431 pszRootPath: LPCWSTR,
432 dwFlags: DWORD,
433 ) -> HRESULT;
434 }
435 ENUM!{enum QUERY_USER_NOTIFICATION_STATE {
436 QUNS_NOT_PRESENT = 1,
437 QUNS_BUSY = 2,
438 QUNS_RUNNING_D3D_FULL_SCREEN = 3,
439 QUNS_PRESENTATION_MODE = 4,
440 QUNS_ACCEPTS_NOTIFICATIONS = 5,
441 QUNS_QUIET_TIME = 6,
442 QUNS_APP = 7,
443 }}
444 extern "system" {
445 pub fn SHQueryUserNotificationState(
446 pquns: *mut QUERY_USER_NOTIFICATION_STATE,
447 ) -> HRESULT;
448 pub fn SHGetPropertyStoreForWindow(
449 hwnd: HWND,
450 riid: REFIID,
451 ppv: *mut *mut c_void,
452 ) -> HRESULT;
453 }
454 UNION!{#[cfg_attr(target_arch = "x86", repr(packed))] union NOTIFYICONDATAA_u {
455 [u32; 1],
456 uTimeout uTimeout_mut: UINT,
457 uVersion uVersion_mut: UINT,
458 }}
459 STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct NOTIFYICONDATAA {
460 cbSize: DWORD,
461 hWnd: HWND,
462 uID: UINT,
463 uFlags: UINT,
464 uCallbackMessage: UINT,
465 hIcon: HICON,
466 szTip: [CHAR; 128],
467 dwState: DWORD,
468 dwStateMask: DWORD,
469 szInfo: [CHAR; 256],
470 u: NOTIFYICONDATAA_u,
471 szInfoTitle: [CHAR; 64],
472 dwInfoFlags: DWORD,
473 guidItem: GUID,
474 hBalloonIcon: HICON,
475 }}
476 pub type PNOTIFYICONDATAA = *mut NOTIFYICONDATAA;
477 UNION!{#[cfg_attr(target_arch = "x86", repr(packed))] union NOTIFYICONDATAW_u {
478 [u32; 1],
479 uTimeout uTimeout_mut: UINT,
480 uVersion uVersion_mut: UINT,
481 }}
482 STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct NOTIFYICONDATAW {
483 cbSize: DWORD,
484 hWnd: HWND,
485 uID: UINT,
486 uFlags: UINT,
487 uCallbackMessage: UINT,
488 hIcon: HICON,
489 szTip: [WCHAR; 128],
490 dwState: DWORD,
491 dwStateMask: DWORD,
492 szInfo: [WCHAR; 256],
493 u: NOTIFYICONDATAW_u,
494 szInfoTitle: [WCHAR; 64],
495 dwInfoFlags: DWORD,
496 guidItem: GUID,
497 hBalloonIcon: HICON,
498 }}
499 pub type PNOTIFYICONDATAW = *mut NOTIFYICONDATAW;
500 pub const NIN_SELECT: DWORD = WM_USER + 0;
501 pub const NINF_KEY: DWORD = 0x1;
502 pub const NIN_KEYSELECT: DWORD = NIN_SELECT | NINF_KEY;
503 pub const NIN_BALLOONSHOW: DWORD = WM_USER + 2;
504 pub const NIN_BALLOONHIDE: DWORD = WM_USER + 3;
505 pub const NIN_BALLOONTIMEOUT: DWORD = WM_USER + 4;
506 pub const NIN_BALLOONUSERCLICK: DWORD = WM_USER + 5;
507 pub const NIN_POPUPOPEN: DWORD = WM_USER + 6;
508 pub const NIN_POPUPCLOSE: DWORD = WM_USER + 7;
509 pub const NIM_ADD: DWORD = 0x00000000;
510 pub const NIM_MODIFY: DWORD = 0x00000001;
511 pub const NIM_DELETE: DWORD = 0x00000002;
512 pub const NIM_SETFOCUS: DWORD = 0x00000003;
513 pub const NIM_SETVERSION: DWORD = 0x00000004;
514 pub const NOTIFYICON_VERSION: DWORD = 3;
515 pub const NOTIFYICON_VERSION_4: DWORD = 4;
516 pub const NIF_MESSAGE: DWORD = 0x00000001;
517 pub const NIF_ICON: DWORD = 0x00000002;
518 pub const NIF_TIP: DWORD = 0x00000004;
519 pub const NIF_STATE: DWORD = 0x00000008;
520 pub const NIF_INFO: DWORD = 0x00000010;
521 pub const NIF_GUID: DWORD = 0x00000020;
522 pub const NIF_REALTIME: DWORD = 0x00000040;
523 pub const NIF_SHOWTIP: DWORD = 0x00000080;
524 pub const NIS_HIDDEN: DWORD = 0x00000001;
525 pub const NIS_SHAREDICON: DWORD = 0x00000002;
526 pub const NIIF_NONE: DWORD = 0x00000000;
527 pub const NIIF_INFO: DWORD = 0x00000001;
528 pub const NIIF_WARNING: DWORD = 0x00000002;
529 pub const NIIF_ERROR: DWORD = 0x00000003;
530 pub const NIIF_USER: DWORD = 0x00000004;
531 pub const NIIF_ICON_MASK: DWORD = 0x0000000F;
532 pub const NIIF_NOSOUND: DWORD = 0x00000010;
533 pub const NIIF_LARGE_ICON: DWORD = 0x00000020;
534 pub const NIIF_RESPECT_QUIET_TIME: DWORD = 0x00000080;
535 STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct NOTIFYICONIDENTIFIER {
536 cbSize: DWORD,
537 hWnd: HWND,
538 uID: UINT,
539 guidItem: GUID,
540 }}
541 pub type PNOTIFYICONIDENTIFIER = *mut NOTIFYICONIDENTIFIER;
542 extern "system" {
543 pub fn Shell_NotifyIconA(
544 dwMessage: DWORD,
545 lpData: PNOTIFYICONDATAA,
546 ) -> BOOL;
547 pub fn Shell_NotifyIconW(
548 dwMessage: DWORD,
549 lpData: PNOTIFYICONDATAW,
550 ) -> BOOL;
551 pub fn Shell_NotifyIconGetRect(
552 identifier: *const NOTIFYICONIDENTIFIER,
553 iconLocation: *mut RECT,
554 ) -> HRESULT;
555 }
556 STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct SHFILEINFOA {
557 hIcon: HICON,
558 iIcon: c_int,
559 dwAttributes: DWORD,
560 szDisplayName: [CHAR; MAX_PATH],
561 szTypeName: [CHAR; 80],
562 }}
563 STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct SHFILEINFOW {
564 hIcon: HICON,
565 iIcon: c_int,
566 dwAttributes: DWORD,
567 szDisplayName: [WCHAR; MAX_PATH],
568 szTypeName: [WCHAR; 80],
569 }}
570 pub const SHGFI_ICON: DWORD = 0x000000100;
571 pub const SHGFI_DISPLAYNAME: DWORD = 0x000000200;
572 pub const SHGFI_TYPENAME: DWORD = 0x000000400;
573 pub const SHGFI_ATTRIBUTES: DWORD = 0x000000800;
574 pub const SHGFI_ICONLOCATION: DWORD = 0x000001000;
575 pub const SHGFI_EXETYPE: DWORD = 0x000002000;
576 pub const SHGFI_SYSICONINDEX: DWORD = 0x000004000;
577 pub const SHGFI_LINKOVERLAY: DWORD = 0x000008000;
578 pub const SHGFI_SELECTED: DWORD = 0x000010000;
579 pub const SHGFI_ATTR_SPECIFIED: DWORD = 0x000020000;
580 pub const SHGFI_LARGEICON: DWORD = 0x000000000;
581 pub const SHGFI_SMALLICON: DWORD = 0x000000001;
582 pub const SHGFI_OPENICON: DWORD = 0x000000002;
583 pub const SHGFI_SHELLICONSIZE: DWORD = 0x000000004;
584 pub const SHGFI_PIDL: DWORD = 0x000000008;
585 pub const SHGFI_USEFILEATTRIBUTES: DWORD = 0x000000010;
586 pub const SHGFI_ADDOVERLAYS: DWORD = 0x000000020;
587 pub const SHGFI_OVERLAYINDEX: DWORD = 0x000000040;
588 extern "system" {
589 pub fn SHGetFileInfoA(
590 pszPath: LPCSTR,
591 dwFileAttributes: DWORD,
592 psfi: *mut SHFILEINFOA,
593 cbFileInfo: UINT,
594 uFlags: UINT,
595 ) -> DWORD_PTR;
596 pub fn SHGetFileInfoW(
597 pszPath: LPCWSTR,
598 dwFileAttributes: DWORD,
599 psfi: *mut SHFILEINFOW,
600 cbFileInfo: UINT,
601 uFlags: UINT,
602 ) -> DWORD_PTR;
603 }
604 STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct SHSTOCKICONINFO {
605 cbSize: DWORD,
606 hIcon: HICON,
607 iSysImageIndex: c_int,
608 iIcon: c_int,
609 szPath: [WCHAR; MAX_PATH],
610 }}
611 pub const SHGSI_ICONLOCATION: DWORD = 0;
612 pub const SHGSI_ICON: DWORD = SHGFI_ICON;
613 pub const SHGSI_SYSICONINDEX: DWORD = SHGFI_SYSICONINDEX;
614 pub const SHGSI_LINKOVERLAY: DWORD = SHGFI_LINKOVERLAY;
615 pub const SHGSI_SELECTED: DWORD = SHGFI_SELECTED;
616 pub const SHGSI_LARGEICON: DWORD = SHGFI_LARGEICON;
617 pub const SHGSI_SMALLICON: DWORD = SHGFI_SMALLICON;
618 pub const SHGSI_SHELLICONSIZE: DWORD = SHGFI_SHELLICONSIZE;
619 ENUM!{enum SHSTOCKICONID {
620 SIID_DOCNOASSOC = 0,
621 SIID_DOCASSOC = 1,
622 SIID_APPLICATION = 2,
623 SIID_FOLDER = 3,
624 SIID_FOLDEROPEN = 4,
625 SIID_DRIVE525 = 5,
626 SIID_DRIVE35 = 6,
627 SIID_DRIVEREMOVE = 7,
628 SIID_DRIVEFIXED = 8,
629 SIID_DRIVENET = 9,
630 SIID_DRIVENETDISABLED = 10,
631 SIID_DRIVECD = 11,
632 SIID_DRIVERAM = 12,
633 SIID_WORLD = 13,
634 SIID_SERVER = 15,
635 SIID_PRINTER = 16,
636 SIID_MYNETWORK = 17,
637 SIID_FIND = 22,
638 SIID_HELP = 23,
639 SIID_SHARE = 28,
640 SIID_LINK = 29,
641 SIID_SLOWFILE = 30,
642 SIID_RECYCLER = 31,
643 SIID_RECYCLERFULL = 32,
644 SIID_MEDIACDAUDIO = 40,
645 SIID_LOCK = 47,
646 SIID_AUTOLIST = 49,
647 SIID_PRINTERNET = 50,
648 SIID_SERVERSHARE = 51,
649 SIID_PRINTERFAX = 52,
650 SIID_PRINTERFAXNET = 53,
651 SIID_PRINTERFILE = 54,
652 SIID_STACK = 55,
653 SIID_MEDIASVCD = 56,
654 SIID_STUFFEDFOLDER = 57,
655 SIID_DRIVEUNKNOWN = 58,
656 SIID_DRIVEDVD = 59,
657 SIID_MEDIADVD = 60,
658 SIID_MEDIADVDRAM = 61,
659 SIID_MEDIADVDRW = 62,
660 SIID_MEDIADVDR = 63,
661 SIID_MEDIADVDROM = 64,
662 SIID_MEDIACDAUDIOPLUS = 65,
663 SIID_MEDIACDRW = 66,
664 SIID_MEDIACDR = 67,
665 SIID_MEDIACDBURN = 68,
666 SIID_MEDIABLANKCD = 69,
667 SIID_MEDIACDROM = 70,
668 SIID_AUDIOFILES = 71,
669 SIID_IMAGEFILES = 72,
670 SIID_VIDEOFILES = 73,
671 SIID_MIXEDFILES = 74,
672 SIID_FOLDERBACK = 75,
673 SIID_FOLDERFRONT = 76,
674 SIID_SHIELD = 77,
675 SIID_WARNING = 78,
676 SIID_INFO = 79,
677 SIID_ERROR = 80,
678 SIID_KEY = 81,
679 SIID_SOFTWARE = 82,
680 SIID_RENAME = 83,
681 SIID_DELETE = 84,
682 SIID_MEDIAAUDIODVD = 85,
683 SIID_MEDIAMOVIEDVD = 86,
684 SIID_MEDIAENHANCEDCD = 87,
685 SIID_MEDIAENHANCEDDVD = 88,
686 SIID_MEDIAHDDVD = 89,
687 SIID_MEDIABLURAY = 90,
688 SIID_MEDIAVCD = 91,
689 SIID_MEDIADVDPLUSR = 92,
690 SIID_MEDIADVDPLUSRW = 93,
691 SIID_DESKTOPPC = 94,
692 SIID_MOBILEPC = 95,
693 SIID_USERS = 96,
694 SIID_MEDIASMARTMEDIA = 97,
695 SIID_MEDIACOMPACTFLASH = 98,
696 SIID_DEVICECELLPHONE = 99,
697 SIID_DEVICECAMERA = 100,
698 SIID_DEVICEVIDEOCAMERA = 101,
699 SIID_DEVICEAUDIOPLAYER = 102,
700 SIID_NETWORKCONNECT = 103,
701 SIID_INTERNET = 104,
702 SIID_ZIPFILE = 105,
703 SIID_SETTINGS = 106,
704 SIID_DRIVEHDDVD = 132,
705 SIID_DRIVEBD = 133,
706 SIID_MEDIAHDDVDROM = 134,
707 SIID_MEDIAHDDVDR = 135,
708 SIID_MEDIAHDDVDRAM = 136,
709 SIID_MEDIABDROM = 137,
710 SIID_MEDIABDR = 138,
711 SIID_MEDIABDRE = 139,
712 SIID_CLUSTEREDDRIVE = 140,
713 SIID_MAX_ICONS = 181,
714 }}
715 pub const SIID_INVALID: SHSTOCKICONID = -1i32 as u32;
716 extern "system" {
717 pub fn SHGetStockIconInfo(
718 siid: SHSTOCKICONID,
719 uFlags: UINT,
720 psii: *mut SHSTOCKICONINFO,
721 ) -> HRESULT;
722 pub fn SHGetDiskFreeSpaceExA(
723 pszDirectoryName: LPCSTR,
724 pulFreeBytesAvailableToCaller: *mut ULARGE_INTEGER,
725 pulTotalNumberOfBytes: *mut ULARGE_INTEGER,
726 pulTotalNumberOfFreeBytes: *mut ULARGE_INTEGER,
727 ) -> BOOL;
728 pub fn SHGetDiskFreeSpaceExW(
729 pszDirectoryName: LPCWSTR,
730 pulFreeBytesAvailableToCaller: *mut ULARGE_INTEGER,
731 pulTotalNumberOfBytes: *mut ULARGE_INTEGER,
732 pulTotalNumberOfFreeBytes: *mut ULARGE_INTEGER,
733 ) -> BOOL;
734 pub fn SHGetNewLinkInfoA(
735 pszLinkTo: LPCSTR,
736 pszDir: LPCSTR,
737 pszName: LPSTR,
738 pfMustCopy: *mut BOOL,
739 uFlags: UINT,
740 ) -> BOOL;
741 pub fn SHGetNewLinkInfoW(
742 pszLinkTo: LPCWSTR,
743 pszDir: LPCWSTR,
744 pszName: LPWSTR,
745 pfMustCopy: *mut BOOL,
746 uFlags: UINT,
747 ) -> BOOL;
748 }
749 pub const SHGNLI_PIDL: DWORD = 0x000000001;
750 pub const SHGNLI_PREFIXNAME: DWORD = 0x000000002;
751 pub const SHGNLI_NOUNIQUE: DWORD = 0x000000004;
752 pub const SHGNLI_NOLNK: DWORD = 0x000000008;
753 pub const SHGNLI_NOLOCNAME: DWORD = 0x000000010;
754 pub const SHGNLI_USEURLEXT: DWORD = 0x000000020;
755 pub const PRINTACTION_OPEN: DWORD = 0;
756 pub const PRINTACTION_PROPERTIES: DWORD = 1;
757 pub const PRINTACTION_NETINSTALL: DWORD = 2;
758 pub const PRINTACTION_NETINSTALLLINK: DWORD = 3;
759 pub const PRINTACTION_TESTPAGE: DWORD = 4;
760 pub const PRINTACTION_OPENNETPRN: DWORD = 5;
761 pub const PRINTACTION_DOCUMENTDEFAULTS: DWORD = 6;
762 pub const PRINTACTION_SERVERPROPERTIES: DWORD = 7;
763 extern "system" {
764 pub fn SHInvokePrinterCommandA(
765 hwnd: HWND,
766 uAction: UINT,
767 lpBuf1: LPCSTR,
768 lpBuf2: LPCSTR,
769 fModal: BOOL,
770 ) -> BOOL;
771 pub fn SHInvokePrinterCommandW(
772 hwnd: HWND,
773 uAction: UINT,
774 lpBuf1: LPCWSTR,
775 lpBuf2: LPCWSTR,
776 fModal: BOOL,
777 ) -> BOOL;
778 }
779 STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct OPEN_PRINTER_PROPS_INFOA {
780 dwSize: DWORD,
781 pszSheetName: LPSTR,
782 uSheetIndex: UINT,
783 dwFlags: DWORD,
784 bModal: BOOL,
785 }}
786 pub type POPEN_PRINTER_PROPS_INFOA = *mut OPEN_PRINTER_PROPS_INFOA;
787 STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct OPEN_PRINTER_PROPS_INFOW {
788 dwSize: DWORD,
789 pszSheetName: LPWSTR,
790 uSheetIndex: UINT,
791 dwFlags: DWORD,
792 bModal: BOOL,
793 }}
794 pub type POPEN_PRINTER_PROPS_INFOW = *mut OPEN_PRINTER_PROPS_INFOW;
795 pub const PRINT_PROP_FORCE_NAME: DWORD = 0x01;
796 extern "system" {
797 pub fn SHLoadNonloadedIconOverlayIdentifiers() -> HRESULT;
798 pub fn SHIsFileAvailableOffline(
799 pwszPath: PCWSTR,
800 pdwStatus: *mut DWORD,
801 ) -> HRESULT;
802 }
803 pub const OFFLINE_STATUS_LOCAL: DWORD = 0x0001;
804 pub const OFFLINE_STATUS_REMOTE: DWORD = 0x0002;
805 pub const OFFLINE_STATUS_INCOMPLETE: DWORD = 0x0004;
806 extern "system" {
807 pub fn SHSetLocalizedName(
808 pszPath: PCWSTR,
809 pszResModule: PCWSTR,
810 idsRes: c_int,
811 ) -> HRESULT;
812 pub fn SHRemoveLocalizedName(
813 pszPath: PCWSTR,
814 ) -> HRESULT;
815 pub fn SHGetLocalizedName(
816 pszPath: PCWSTR,
817 pszResModule: PWSTR,
818 cch: UINT,
819 pidsRes: *mut c_int,
820 ) -> HRESULT;
821 }
822 extern "C" {
823 pub fn ShellMessageBoxA(
824 hAppInst: HINSTANCE,
825 hWnd: HWND,
826 lpcText: LPCSTR,
827 lpcTitle: LPCSTR,
828 fuStyle: UINT,
829 ...
830 ) -> c_int;
831 pub fn ShellMessageBoxW(
832 hAppInst: HINSTANCE,
833 hWnd: HWND,
834 lpcText: LPCWSTR,
835 lpcTitle: LPCWSTR,
836 fuStyle: UINT,
837 ...
838 ) -> c_int;
839 }
840 extern "system" {
841 pub fn IsLFNDriveA(
842 pszPath: LPCSTR,
843 ) -> BOOL;
844 pub fn IsLFNDriveW(
845 pszPath: LPCWSTR,
846 ) -> BOOL;
847 pub fn SHEnumerateUnreadMailAccountsA(
848 hKeyUser: HKEY,
849 dwIndex: DWORD,
850 pszMailAddress: LPSTR,
851 cchMailAddress: c_int,
852 ) -> HRESULT;
853 pub fn SHEnumerateUnreadMailAccountsW(
854 hKeyUser: HKEY,
855 dwIndex: DWORD,
856 pszMailAddress: LPWSTR,
857 cchMailAddress: c_int,
858 ) -> HRESULT;
859 pub fn SHGetUnreadMailCountA(
860 hKeyUser: HKEY,
861 pszMailAddress: LPCSTR,
862 pdwCount: *mut DWORD,
863 pFileTime: *mut FILETIME,
864 pszShellExecuteCommand: LPSTR,
865 cchShellExecuteCommand: c_int,
866 ) -> HRESULT;
867 pub fn SHGetUnreadMailCountW(
868 hKeyUser: HKEY,
869 pszMailAddress: LPCWSTR,
870 pdwCount: *mut DWORD,
871 pFileTime: *mut FILETIME,
872 pszShellExecuteCommand: LPWSTR,
873 cchShellExecuteCommand: c_int,
874 ) -> HRESULT;
875 pub fn SHSetUnreadMailCountA(
876 pszMailAddress: LPCSTR,
877 dwCount: DWORD,
878 pszShellExecuteCommand: LPCSTR,
879 ) -> HRESULT;
880 pub fn SHSetUnreadMailCountW(
881 pszMailAddress: LPCWSTR,
882 dwCount: DWORD,
883 pszShellExecuteCommand: LPCWSTR,
884 ) -> HRESULT;
885 pub fn SHTestTokenMembership(
886 hToken: HANDLE,
887 ulRID: ULONG,
888 ) -> BOOL;
889 pub fn SHGetImageList(
890 iImageList: c_int,
891 riid: REFIID,
892 ppvObj: *mut *mut c_void,
893 ) -> HRESULT;
894 }
895 pub const SHIL_LARGE: DWORD = 0;
896 pub const SHIL_SMALL: DWORD = 1;
897 pub const SHIL_EXTRALARGE: DWORD = 2;
898 pub const SHIL_SYSSMALL: DWORD = 3;
899 pub const SHIL_JUMBO: DWORD = 4;
900 pub const SHIL_LAST: DWORD = SHIL_JUMBO;
901 FN!{stdcall PFNCANSHAREFOLDERW(
902 pszPath: PCWSTR,
903 ) -> HRESULT}
904 FN!{stdcall PFNSHOWSHAREFOLDERUIW(
905 hwndParent: HWND,
906 pszPath: PCWSTR,
907 ) -> HRESULT}
908 pub const WC_NETADDRESS: &'static str = "msctls_netaddress";
909 extern "system" {
910 pub fn InitNetworkAddressControl() -> BOOL;
911 }
912 // STRUCT!{struct NC_ADDRESS {
913 // pAddrInfo: *mut NET_ADDRESS_INFO,
914 // PortNumber: USHORT,
915 // PrefixLength: BYTE,
916 // }}
917 // pub type PNC_ADDRESS = *mut NC_ADDRESS;
918 extern "system" {
919 pub fn SHGetDriveMedia(
920 pszDrive: PCWSTR,
921 pdwMediaContent: *mut DWORD,
922 ) -> HRESULT;
923 }