shell32.odin 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. // +build windows
  2. package sys_windows
  3. foreign import shell32 "system:Shell32.lib"
  4. @(default_calling_convention="system")
  5. foreign shell32 {
  6. CommandLineToArgvW :: proc(cmd_list: wstring, num_args: ^c_int) -> ^wstring ---
  7. ShellExecuteW :: proc(
  8. hwnd: HWND,
  9. lpOperation: LPCWSTR,
  10. lpFile: LPCWSTR,
  11. lpParameters: LPCWSTR,
  12. lpDirectory: LPCWSTR,
  13. nShowCmd: INT,
  14. ) -> HINSTANCE ---
  15. ShellExecuteExW :: proc(pExecInfo: ^SHELLEXECUTEINFOW) -> BOOL ---
  16. SHCreateDirectoryExW :: proc(
  17. hwnd: HWND,
  18. pszPath: LPCWSTR,
  19. psa: ^SECURITY_ATTRIBUTES,
  20. ) -> c_int ---
  21. SHFileOperationW :: proc(lpFileOp: LPSHFILEOPSTRUCTW) -> c_int ---
  22. SHGetFolderPathW :: proc(hwnd: HWND, csidl: c_int, hToken: HANDLE, dwFlags: DWORD, pszPath: LPWSTR) -> HRESULT ---
  23. SHAppBarMessage :: proc(dwMessage: DWORD, pData: PAPPBARDATA) -> UINT_PTR ---
  24. Shell_NotifyIconW :: proc(dwMessage: DWORD, lpData: ^NOTIFYICONDATAW) -> BOOL ---
  25. SHChangeNotify :: proc(wEventId: LONG, uFlags: UINT, dwItem1: LPCVOID, dwItem2: LPCVOID) ---
  26. SHGetKnownFolderIDList :: proc(rfid: REFKNOWNFOLDERID, dwFlags: /* KNOWN_FOLDER_FLAG */ DWORD, hToken: HANDLE, ppidl: rawptr) -> HRESULT ---
  27. SHSetKnownFolderPath :: proc(rfid: REFKNOWNFOLDERID, dwFlags: /* KNOWN_FOLDER_FLAG */ DWORD, hToken: HANDLE, pszPath: PCWSTR ) -> HRESULT ---
  28. SHGetKnownFolderPath :: proc(rfid: REFKNOWNFOLDERID, dwFlags: /* KNOWN_FOLDER_FLAG */ DWORD, hToken: HANDLE, ppszPath: ^LPWSTR) -> HRESULT ---
  29. }
  30. APPBARDATA :: struct {
  31. cbSize: DWORD,
  32. hWnd: HWND,
  33. uCallbackMessage: UINT,
  34. uEdge: UINT,
  35. rc: RECT,
  36. lParam: LPARAM,
  37. }
  38. PAPPBARDATA :: ^APPBARDATA
  39. ABM_NEW :: 0x00000000
  40. ABM_REMOVE :: 0x00000001
  41. ABM_QUERYPOS :: 0x00000002
  42. ABM_SETPOS :: 0x00000003
  43. ABM_GETSTATE :: 0x00000004
  44. ABM_GETTASKBARPOS :: 0x00000005
  45. ABM_ACTIVATE :: 0x00000006
  46. ABM_GETAUTOHIDEBAR :: 0x00000007
  47. ABM_SETAUTOHIDEBAR :: 0x00000008
  48. ABM_WINDOWPOSCHANGED :: 0x0000009
  49. ABM_SETSTATE :: 0x0000000a
  50. ABN_STATECHANGE :: 0x0000000
  51. ABN_POSCHANGED :: 0x0000001
  52. ABN_FULLSCREENAPP :: 0x0000002
  53. ABN_WINDOWARRANGE :: 0x0000003
  54. ABS_AUTOHIDE :: 0x0000001
  55. ABS_ALWAYSONTOP :: 0x0000002
  56. ABE_LEFT :: 0
  57. ABE_TOP :: 1
  58. ABE_RIGHT :: 2
  59. ABE_BOTTOM :: 3
  60. KNOWNFOLDERID :: GUID
  61. REFKNOWNFOLDERID :: ^KNOWNFOLDERID
  62. KNOWN_FOLDER_FLAG :: enum u32 {
  63. DEFAULT = 0x00000000,
  64. // if NTDDI_VERSION >= NTDDI_WIN10_RS3
  65. FORCE_APP_DATA_REDIRECTION = 0x00080000,
  66. // if NTDDI_VERSION >= NTDDI_WIN10_RS2
  67. RETURN_FILTER_REDIRECTION_TARGET = 0x00040000,
  68. FORCE_PACKAGE_REDIRECTION = 0x00020000,
  69. NO_PACKAGE_REDIRECTION = 0x00010000,
  70. FORCE_APPCONTAINER_REDIRECTION = 0x00020000,
  71. // if NTDDI_VERSION >= NTDDI_WIN7
  72. NO_APPCONTAINER_REDIRECTION = 0x00010000,
  73. CREATE = 0x00008000,
  74. DONT_VERIFY = 0x00004000,
  75. DONT_UNEXPAND = 0x00002000,
  76. NO_ALIAS = 0x00001000,
  77. INIT = 0x00000800,
  78. DEFAULT_PATH = 0x00000400,
  79. NOT_PARENT_RELATIVE = 0x00000200,
  80. SIMPLE_IDLIST = 0x00000100,
  81. ALIAS_ONLY = 0x80000000,
  82. }
  83. SHCNRF_InterruptLevel :: 0x0001
  84. SHCNRF_ShellLevel :: 0x0002
  85. SHCNRF_RecursiveInterrupt :: 0x1000
  86. SHCNRF_NewDelivery :: 0x8000
  87. SHCNE_RENAMEITEM :: 0x00000001
  88. SHCNE_CREATE :: 0x00000002
  89. SHCNE_DELETE :: 0x00000004
  90. SHCNE_MKDIR :: 0x00000008
  91. SHCNE_RMDIR :: 0x00000010
  92. SHCNE_MEDIAINSERTED :: 0x00000020
  93. SHCNE_MEDIAREMOVED :: 0x00000040
  94. SHCNE_DRIVEREMOVED :: 0x00000080
  95. SHCNE_DRIVEADD :: 0x00000100
  96. SHCNE_NETSHARE :: 0x00000200
  97. SHCNE_NETUNSHARE :: 0x00000400
  98. SHCNE_ATTRIBUTES :: 0x00000800
  99. SHCNE_UPDATEDIR :: 0x00001000
  100. SHCNE_UPDATEITEM :: 0x00002000
  101. SHCNE_SERVERDISCONNECT :: 0x00004000
  102. SHCNE_UPDATEIMAGE :: 0x00008000
  103. SHCNE_DRIVEADDGUI :: 0x00010000
  104. SHCNE_RENAMEFOLDER :: 0x00020000
  105. SHCNE_FREESPACE :: 0x00040000
  106. SHCNE_EXTENDED_EVENT :: 0x04000000
  107. SHCNE_ASSOCCHANGED :: 0x08000000
  108. SHCNE_DISKEVENTS :: 0x0002381F
  109. SHCNE_GLOBALEVENTS :: 0x0C0581E0
  110. SHCNE_ALLEVENTS :: 0x7FFFFFFF
  111. SHCNE_INTERRUPT :: 0x80000000
  112. SHCNEE_ORDERCHANGED :: 2
  113. SHCNEE_MSI_CHANGE :: 4
  114. SHCNEE_MSI_UNINSTALL :: 5
  115. SHCNF_IDLIST :: 0x0000
  116. SHCNF_PATHA :: 0x0001
  117. SHCNF_PRINTERA :: 0x0002
  118. SHCNF_DWORD :: 0x0003
  119. SHCNF_PATHW :: 0x0005
  120. SHCNF_PRINTERW :: 0x0006
  121. SHCNF_TYPE :: 0x00FF
  122. SHCNF_FLUSH :: 0x1000
  123. SHCNF_FLUSHNOWAIT :: 0x3000
  124. SHCNF_NOTIFYRECURSIVE :: 0x10000