Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

530 lines
18 KiB

  1. ;begin_both
  2. /*
  3. * intshcut.h - Internet Shortcut interface definitions.
  4. *
  5. * Copyright (c) Microsoft Corporation. All rights reserved.
  6. */
  7. ;end_both
  8. #ifndef __INTSHCUT_H__
  9. #define __INTSHCUT_H__
  10. #ifndef __INTSHCTP_H__ ;internal
  11. #define __INTSHCTP_H__ ;internal
  12. /* Headers
  13. **********/
  14. #include <isguids.h>
  15. #ifdef __cplusplus
  16. extern "C" { /* Assume C declarations for C++. */
  17. #endif /* __cplusplus */
  18. /* Constants
  19. ************/
  20. /* Define API decoration for direct import of DLL functions. */
  21. #ifdef _INTSHCUT_
  22. #define INTSHCUTAPI
  23. #else
  24. #define INTSHCUTAPI DECLSPEC_IMPORT
  25. #endif
  26. /* HRESULTs */
  27. //
  28. // MessageId: E_FLAGS
  29. //
  30. // MessageText:
  31. //
  32. // The flag combination is invalid.
  33. //
  34. #define E_FLAGS MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x1000)
  35. //
  36. // MessageId: IS_E_EXEC_FAILED
  37. //
  38. // MessageText:
  39. //
  40. // The URL's protocol handler failed to run.
  41. //
  42. #define IS_E_EXEC_FAILED MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x2002)
  43. //
  44. // MessageId: URL_E_INVALID_SYNTAX
  45. //
  46. // MessageText:
  47. //
  48. // The URL's syntax is invalid.
  49. //
  50. #define URL_E_INVALID_SYNTAX MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x1001)
  51. //
  52. // MessageId: URL_E_UNREGISTERED_PROTOCOL
  53. //
  54. // MessageText:
  55. //
  56. // The URL's protocol does not have a registered protocol handler.
  57. //
  58. #define URL_E_UNREGISTERED_PROTOCOL MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x1002)
  59. /* Interfaces
  60. *************/
  61. //
  62. // Input flags for IUniformResourceLocator::SetURL().
  63. //
  64. typedef enum iurl_seturl_flags
  65. {
  66. IURL_SETURL_FL_GUESS_PROTOCOL = 0x0001, // Guess protocol if missing
  67. IURL_SETURL_FL_USE_DEFAULT_PROTOCOL = 0x0002, // Use default protocol if missing
  68. }
  69. IURL_SETURL_FLAGS;
  70. ;begin_internal
  71. #define IURL_SETURL_FL_CANONICALIZE 0x0004
  72. #define ALL_IURL_SETURL_FLAGS 0x0007
  73. ;end_internal
  74. //
  75. // Input flags for IUniformResourceLocator()::InvokeCommand().
  76. //
  77. typedef enum iurl_invokecommand_flags
  78. {
  79. IURL_INVOKECOMMAND_FL_ALLOW_UI = 0x0001,
  80. IURL_INVOKECOMMAND_FL_USE_DEFAULT_VERB = 0x0002, // Ignore pcszVerb
  81. IURL_INVOKECOMMAND_FL_DDEWAIT = 0x0004, // pass DDEWAIT to ShellExec
  82. }
  83. IURL_INVOKECOMMAND_FLAGS;
  84. ;begin_internal
  85. #define ALL_IURL_INVOKECOMMAND_FLAGS (IURL_INVOKECOMMAND_FL_ALLOW_UI | IURL_INVOKECOMMAND_FL_USE_DEFAULT_VERB |IURL_INVOKECOMMAND_FL_DDEWAIT)
  86. ;end_internal
  87. //
  88. // Command info for IUniformResourceLocator::InvokeCommand().
  89. //
  90. typedef struct urlinvokecommandinfoA
  91. {
  92. DWORD dwcbSize; // Size of structure
  93. DWORD dwFlags; // Bit field of IURL_INVOKECOMMAND_FLAGS
  94. HWND hwndParent; // Parent window. Valid only if IURL_INVOKECOMMAND_FL_ALLOW_UI is set.
  95. LPCSTR pcszVerb; // Verb to invoke. Ignored if IURL_INVOKECOMMAND_FL_USE_DEFAULT_VERB is set.
  96. }
  97. URLINVOKECOMMANDINFOA;
  98. typedef URLINVOKECOMMANDINFOA *PURLINVOKECOMMANDINFOA;
  99. typedef const URLINVOKECOMMANDINFOA CURLINVOKECOMMANDINFOA;
  100. typedef const URLINVOKECOMMANDINFOA *PCURLINVOKECOMMANDINFOA;
  101. typedef struct urlinvokecommandinfoW
  102. {
  103. DWORD dwcbSize; // Size of structure
  104. DWORD dwFlags; // Bit field of IURL_INVOKECOMMAND_FLAGS
  105. HWND hwndParent; // Parent window. Valid only if IURL_INVOKECOMMAND_FL_ALLOW_UI is set.
  106. LPCWSTR pcszVerb; // Verb to invoke. Ignored if IURL_INVOKECOMMAND_FL_USE_DEFAULT_VERB is set.
  107. }
  108. URLINVOKECOMMANDINFOW;
  109. typedef URLINVOKECOMMANDINFOW *PURLINVOKECOMMANDINFOW;
  110. typedef const URLINVOKECOMMANDINFOW CURLINVOKECOMMANDINFOW;
  111. typedef const URLINVOKECOMMANDINFOW *PCURLINVOKECOMMANDINFOW;
  112. #ifdef UNICODE
  113. #define URLINVOKECOMMANDINFO URLINVOKECOMMANDINFOW
  114. #define PURLINVOKECOMMANDINFO PURLINVOKECOMMANDINFOW
  115. #define CURLINVOKECOMMANDINFO CURLINVOKECOMMANDINFOW
  116. #define PCURLINVOKECOMMANDINFO PCURLINVOKECOMMANDINFOW
  117. #else
  118. #define URLINVOKECOMMANDINFO URLINVOKECOMMANDINFOA
  119. #define PURLINVOKECOMMANDINFO PURLINVOKECOMMANDINFOA
  120. #define CURLINVOKECOMMANDINFO CURLINVOKECOMMANDINFOA
  121. #define PCURLINVOKECOMMANDINFO PCURLINVOKECOMMANDINFOA
  122. #endif
  123. //===========================================================================
  124. //
  125. // IUniformResourceLocator interface
  126. //
  127. // [OverView]
  128. //
  129. // Provides access to Internet Shortcuts.
  130. //
  131. // [Member functions]
  132. //
  133. // IUniformResourceLocator::SetURL
  134. //
  135. // This member function sets an object's URL.
  136. //
  137. // The dwInFlags parameter specifies the behavior:
  138. //
  139. // IURL_SETURL_FL_GUESS_PROTOCOL: The protocol scheme is guessed and added
  140. // to the URL, if it is not specified in pcszURL.
  141. //
  142. // IURL_SETURL_FL_USE_DEFAULT_PROTOCOL: The default protocol scheme is added
  143. // to the URL, if it is not specified in pcszURL.
  144. //
  145. // The function returns S_OK if the object's URL is set successfully.
  146. // Otherwise, an error code is returned:
  147. //
  148. // E_OUTOFMEMORY: There is not enough memory to complete the operation.
  149. //
  150. // IS_E_EXEC_FAILED: The URL's protocol handler failed to run.
  151. //
  152. // URL_E_INVALID_SYNTAX: The URL's syntax is invalid.
  153. //
  154. // URL_E_UNREGISTERED_PROTOCOL: The URL's protocol does not have a
  155. // registered protocol handler.
  156. //
  157. //
  158. // IUniformResourceLocator::GetURL
  159. //
  160. // This member function retrieves an object's URL. The ppszURL is a
  161. // pointer to a PSTR to be filled in which a pointer to the object's
  162. // URL. When finished, this string should be freed using IMalloc::Free().
  163. //
  164. // The function returns S_OK if the object's URL was retrieved
  165. // successfully. If the object does not have a URL associated with it,
  166. // then S_FALSE is returned and *ppszURL is set to NULL. Otherwise, an
  167. // error code is returned:
  168. //
  169. // E_OUTOFMEMORY: There is not enough memory to complete the operation.
  170. //
  171. // IS_E_EXEC_FAILED: The URL's protocol handler failed to run.
  172. //
  173. // URL_E_INVALID_SYNTAX: The URL's syntax is invalid.
  174. //
  175. // URL_E_UNREGISTERED_PROTOCOL: The URL's protocol does not have a
  176. // registered protocol handler.
  177. //
  178. //
  179. // IUniformResourceLocator::InvokeCommand
  180. //
  181. // This member function invokes a command on an object's URL. The purlici
  182. // parameter is a pointer to a URLINVOKECOMMANDINFO structure which
  183. // describes the command to be invoked.
  184. //
  185. // The function returns S_OK if the object's URL was opened successfully.
  186. // If the object does not have a URL associated with it, the function
  187. // returns S_FALSE. Otherwise, an error code is returned:
  188. //
  189. // E_OUTOFMEMORY: There is not enough memory to complete the operation.
  190. //
  191. // IS_E_EXEC_FAILED: The URL's protocol handler failed to run.
  192. //
  193. // URL_E_INVALID_SYNTAX: The URL's syntax is invalid.
  194. //
  195. // URL_E_UNREGISTERED_PROTOCOL: The URL's protocol does not have a
  196. // registered protocol handler.
  197. //
  198. //===========================================================================
  199. #undef INTERFACE
  200. #define INTERFACE IUniformResourceLocatorA
  201. DECLARE_INTERFACE_(IUniformResourceLocatorA, IUnknown)
  202. {
  203. /* IUnknown methods */
  204. STDMETHOD(QueryInterface)(THIS_
  205. REFIID riid,
  206. PVOID *ppvObject) PURE;
  207. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  208. STDMETHOD_(ULONG, Release)(THIS) PURE;
  209. /* IUniformResourceLocator methods */
  210. STDMETHOD(SetURL)(THIS_
  211. LPCSTR pcszURL,
  212. DWORD dwInFlags) PURE;
  213. STDMETHOD(GetURL)(THIS_
  214. LPSTR *ppszURL) PURE;
  215. STDMETHOD(InvokeCommand)(THIS_
  216. PURLINVOKECOMMANDINFOA purlici) PURE;
  217. };
  218. #undef INTERFACE
  219. #define INTERFACE IUniformResourceLocatorW
  220. DECLARE_INTERFACE_(IUniformResourceLocatorW, IUnknown)
  221. {
  222. /* IUnknown methods */
  223. STDMETHOD(QueryInterface)(THIS_
  224. REFIID riid,
  225. PVOID *ppvObject) PURE;
  226. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  227. STDMETHOD_(ULONG, Release)(THIS) PURE;
  228. /* IUniformResourceLocator methods */
  229. STDMETHOD(SetURL)(THIS_
  230. LPCWSTR pcszURL,
  231. DWORD dwInFlags) PURE;
  232. STDMETHOD(GetURL)(THIS_
  233. LPWSTR *ppszURL) PURE;
  234. STDMETHOD(InvokeCommand)(THIS_
  235. PURLINVOKECOMMANDINFOW purlici) PURE;
  236. };
  237. #ifdef UNICODE
  238. #define IUniformResourceLocator IUniformResourceLocatorW
  239. #define IUniformResourceLocatorVtbl IUniformResourceLocatorWVtbl
  240. #else
  241. #define IUniformResourceLocator IUniformResourceLocatorA
  242. #define IUniformResourceLocatorVtbl IUniformResourceLocatorAVtbl
  243. #endif
  244. typedef IUniformResourceLocator *PIUniformResourceLocator;
  245. typedef const IUniformResourceLocator CIUniformResourceLocator;
  246. typedef const IUniformResourceLocator *PCIUniformResourceLocator;
  247. /* Prototypes
  248. *************/
  249. //
  250. // Input flags for TranslateURL().
  251. //
  252. typedef enum translateurl_in_flags
  253. {
  254. TRANSLATEURL_FL_GUESS_PROTOCOL = 0x0001, // Guess protocol if missing
  255. TRANSLATEURL_FL_USE_DEFAULT_PROTOCOL = 0x0002, // Use default protocol if missing
  256. }
  257. TRANSLATEURL_IN_FLAGS;
  258. ;begin_internal
  259. #define TRANSLATEURL_FL_CANONICALIZE 0x0004 // Canonicalize URL
  260. #define ALL_TRANSLATEURL_FLAGS 0x0007
  261. ;end_internal
  262. //
  263. // TranslateURL(). This function applies common translations to a URL
  264. // string, creating a new URL string.
  265. //
  266. // This function does not perform any validation on the syntax of the input
  267. // URL string. A successful return value does not indicate that the input
  268. // or output URL strings are valid URLS.
  269. //
  270. // The function returns S_OK if the URL string is translated successfully
  271. // and *ppszTranslatedURL points to the translated URL string. S_FALSE
  272. // is returned if the URL string did not require translation. An error
  273. // code is returned if an error occurs.
  274. //
  275. // Parameters:
  276. // pcszURL -- A pointer to the URL string to be translated.
  277. // dwInFlags -- A bit field of TRANSLATEURL_IN_FLAGS.
  278. // ppszTranslatedURL -- A pointer to the newly created, translated URL
  279. // string, if any. *ppszTranslatedURL is only valid if S_OK is returned.
  280. // If valid, *ppszTranslatedURL should be freed by calling LocalFree().
  281. // *ppszTranslatedURL is NULL on error.
  282. //
  283. INTSHCUTAPI HRESULT WINAPI TranslateURLA(PCSTR pcszURL,
  284. DWORD dwInFlags,
  285. PSTR *ppszTranslatedURL);
  286. INTSHCUTAPI HRESULT WINAPI TranslateURLW(PCWSTR pcszURL,
  287. DWORD dwInFlags,
  288. PWSTR UNALIGNED *ppszTranslatedURL);
  289. #ifdef UNICODE
  290. #define TranslateURL TranslateURLW
  291. #else
  292. #define TranslateURL TranslateURLA
  293. #endif /* UNICODE */
  294. //
  295. // Input flags for URLAssociationDialog().
  296. //
  297. typedef enum urlassociationdialog_in_flags
  298. {
  299. URLASSOCDLG_FL_USE_DEFAULT_NAME = 0x0001,
  300. URLASSOCDLG_FL_REGISTER_ASSOC = 0x0002
  301. }
  302. URLASSOCIATIONDIALOG_IN_FLAGS;
  303. ;begin_internal
  304. #define ALL_URLASSOCDLG_FLAGS (URLASSOCDLG_FL_USE_DEFAULT_NAME | URLASSOCDLG_FL_REGISTER_ASSOC)
  305. ;end_internal
  306. //
  307. // URLAssocationDialog(). This function invokes the unregistered URL
  308. // protocol dialog box, providing a standard ui for choosing the handler for
  309. // an unregistered URL protocol.
  310. //
  311. // The functions returns S_OK if the application is registered with the
  312. // URL protocol. S_FALSE is returned if nothing is registered (a one-time
  313. // execution via the selected application is requested).
  314. //
  315. // Parameters:
  316. // hwndParent -- A handle to the window to be used as the parent
  317. // dwInFlags -- A bit field of URLASSOCIATIONDIALOG_IN_FLAGS. The
  318. // flags are:
  319. //
  320. // URLASSOCDLG_FL_USE_DEFAULT_NAME: Use the default Internet
  321. // Shortcut file name. Ignore pcszFile.
  322. //
  323. // URLASSOCDLG_FL_REGISTER_ASSOC: The application
  324. // selected is to be registered as the handler for URLs
  325. // of pcszURL's protocol. An application is only
  326. // registered if this flag is set, and the user indicates
  327. // that a persistent association is to be made.
  328. //
  329. // pcszFile -- The name of the Internet Shortcut file whose URL's protocol
  330. // requires a protocol handler. Before a verb, like "open", can
  331. // be invoked on an Internet Shortcut, a protocol handler must be
  332. // registered for its URL protocol. If
  333. // URLASSOCDLG_FL_USE_DEFAULT_NAME is set in dwInFlags, pcszFile
  334. // is ignored, and a default Internet Shortcut file name is used.
  335. // pcszFile is only used for ui.
  336. // pcszURL -- The URL whose unregistered protocol requires a handler.
  337. // pszAppBuf -- A buffer to be filled in on success with the path
  338. // of the application selected by the user. pszAppBuf's
  339. // buffer is filled in with the empty string on failure.
  340. // ucAppBufLen -- The length of pszAppBuf's buffer in characters.
  341. //
  342. INTSHCUTAPI HRESULT WINAPI URLAssociationDialogA(HWND hwndParent,
  343. DWORD dwInFlags,
  344. PCSTR pcszFile,
  345. PCSTR pcszURL,
  346. PSTR pszAppBuf,
  347. UINT ucAppBufLen);
  348. INTSHCUTAPI HRESULT WINAPI URLAssociationDialogW(HWND hwndParent,
  349. DWORD dwInFlags,
  350. PCWSTR pcszFile,
  351. PCWSTR pcszURL,
  352. PWSTR pszAppBuf,
  353. UINT ucAppBufLen);
  354. #ifdef UNICODE
  355. #define URLAssociationDialog URLAssociationDialogW
  356. #else
  357. #define URLAssociationDialog URLAssociationDialogA
  358. #endif /* UNICODE */
  359. //
  360. // Input flags for MIMEAssocationDialog().
  361. //
  362. typedef enum mimeassociationdialog_in_flags
  363. {
  364. MIMEASSOCDLG_FL_REGISTER_ASSOC = 0x0001
  365. }
  366. MIMEASSOCIATIONDIALOG_IN_FLAGS;
  367. ;begin_internal
  368. #define ALL_MIMEASSOCDLG_FLAGS MIMEASSOCDLG_FL_REGISTER_ASSOC
  369. ;end_internal
  370. //
  371. // MIMEAssociationDialog(). Invokes the unregistered MIME content
  372. // type dialog box.
  373. //
  374. // This function does not perform any validation on the syntax of the
  375. // input content type string. A successful return value does not indicate
  376. // that the input MIME content type string is a valid content type.
  377. //
  378. // The function returns S_OK if the MIME content type is associated
  379. // with the extension. The extension is associated as the default
  380. // extension for the content type. S_FALSE is returned if nothing is
  381. // registered. Otherwise, the function returns one of the following
  382. // errors:
  383. //
  384. // E_ABORT -- The user cancelled the operation.
  385. // E_FLAGS -- The flag combination passed in dwFlags is invalid.
  386. // E_OUTOFMEMORY -- Not enough memory to complete the operation.
  387. // E_POINTER -- One of the input pointers is invalid.
  388. //
  389. // Parameters:
  390. // hwndParent -- A handle to the window to be used as the parent
  391. // window of any posted child windows.
  392. // dwInFlags -- A bit field of MIMEASSOCIATIONDIALOG_IN_FLAGS. The
  393. // flags are:
  394. //
  395. // MIMEASSOCDLG_FL_REGISTER_ASSOC: If set, the application
  396. // selected is to be registered as the handler for files of
  397. // the given MIME type. If clear, no association is to be
  398. // registered. An application is only registered if this
  399. // flag is set, and the user indicates that a persistent
  400. // association is to be made. Registration is only possible
  401. // if pcszFile contains an extension.
  402. //
  403. // pcszFile -- A pointer to a string indicating the name of the file
  404. // containing data of pcszMIMEContentType's content type.
  405. // pcszMIMEContentType -- A pointer to a string indicating the content
  406. // type for which an application is sought.
  407. // pszAppBuf -- A buffer to be filled in on success with the path of
  408. // the application selected by the user. pszAppBuf's buffer
  409. // is filled in with the empty string on failure.
  410. // ucAppBufLen -- The length of pszAppBuf's buffer in characters.
  411. //
  412. INTSHCUTAPI HRESULT WINAPI MIMEAssociationDialogA(HWND hwndParent,
  413. DWORD dwInFlags,
  414. PCSTR pcszFile,
  415. PCSTR pcszMIMEContentType,
  416. PSTR pszAppBuf,
  417. UINT ucAppBufLen);
  418. INTSHCUTAPI HRESULT WINAPI MIMEAssociationDialogW(HWND hwndParent,
  419. DWORD dwInFlags,
  420. PCWSTR pcszFile,
  421. PCWSTR pcszMIMEContentType,
  422. PWSTR pszAppBuf,
  423. UINT ucAppBufLen);
  424. #ifdef UNICODE
  425. #define MIMEAssociationDialog MIMEAssociationDialogW
  426. #else
  427. #define MIMEAssociationDialog MIMEAssociationDialogA
  428. #endif /* UNICODE */
  429. //
  430. // InetIsOffline(). This function determines if the user wants to be
  431. // "offline" (get all information from the cache). The dwFlags must be
  432. // 0.
  433. //
  434. // The function returns TRUE to indicate that the local system is not
  435. // currently connected to the Internet. The function returns FALSE to
  436. // indicate that either the local system is connected to the Internet,
  437. // or no attempt has yet been made to connect the local system to the
  438. // Internet. Applications that wish to support an off-line mode should
  439. // do so if InetIsOffline() returns TRUE.
  440. //
  441. // Off-line mode begins when the user has been prompted to dial-in to
  442. // an Internet providor, but canceled the attempt.
  443. //
  444. INTSHCUTAPI
  445. BOOL
  446. WINAPI
  447. InetIsOffline(
  448. DWORD dwFlags);
  449. #ifdef __cplusplus
  450. } /* End of extern "C" {. */
  451. #endif /* __cplusplus */
  452. #endif // __INTSHCTP_H__ ;internal
  453. #endif /* ! __INTSHCUT_H__ */