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