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.

499 lines
18 KiB

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