NativeMethods.cs 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631
  1. using System;
  2. using System.IO;
  3. using System.Runtime.InteropServices;
  4. using System.Security;
  5. using System.Text;
  6. namespace MediaBrowser.Controller.IO
  7. {
  8. /// <summary>
  9. /// Class NativeMethods
  10. /// </summary>
  11. [SuppressUnmanagedCodeSecurity]
  12. public static class NativeMethods
  13. {
  14. //declare the Netapi32 : NetServerEnum method import
  15. /// <summary>
  16. /// Nets the server enum.
  17. /// </summary>
  18. /// <param name="ServerName">Name of the server.</param>
  19. /// <param name="dwLevel">The dw level.</param>
  20. /// <param name="pBuf">The p buf.</param>
  21. /// <param name="dwPrefMaxLen">The dw pref max len.</param>
  22. /// <param name="dwEntriesRead">The dw entries read.</param>
  23. /// <param name="dwTotalEntries">The dw total entries.</param>
  24. /// <param name="dwServerType">Type of the dw server.</param>
  25. /// <param name="domain">The domain.</param>
  26. /// <param name="dwResumeHandle">The dw resume handle.</param>
  27. /// <returns>System.Int32.</returns>
  28. [DllImport("Netapi32", CharSet = CharSet.Auto, SetLastError = true),
  29. SuppressUnmanagedCodeSecurityAttribute]
  30. public static extern int NetServerEnum(
  31. string ServerName, // must be null
  32. int dwLevel,
  33. ref IntPtr pBuf,
  34. int dwPrefMaxLen,
  35. out int dwEntriesRead,
  36. out int dwTotalEntries,
  37. int dwServerType,
  38. string domain, // null for login domain
  39. out int dwResumeHandle
  40. );
  41. //declare the Netapi32 : NetApiBufferFree method import
  42. /// <summary>
  43. /// Nets the API buffer free.
  44. /// </summary>
  45. /// <param name="pBuf">The p buf.</param>
  46. /// <returns>System.Int32.</returns>
  47. [DllImport("Netapi32", SetLastError = true),
  48. SuppressUnmanagedCodeSecurityAttribute]
  49. public static extern int NetApiBufferFree(
  50. IntPtr pBuf);
  51. /// <summary>
  52. /// The MA x_ PATH
  53. /// </summary>
  54. public const int MAX_PATH = 260;
  55. /// <summary>
  56. /// The MA x_ ALTERNATE
  57. /// </summary>
  58. public const int MAX_ALTERNATE = 14;
  59. /// <summary>
  60. /// The INVALI d_ HANDL e_ VALUE
  61. /// </summary>
  62. public static IntPtr INVALID_HANDLE_VALUE = new IntPtr(-1);
  63. /// <summary>
  64. /// The STG m_ READ
  65. /// </summary>
  66. public const uint STGM_READ = 0;
  67. /// <summary>
  68. /// Finds the first file ex.
  69. /// </summary>
  70. /// <param name="lpFileName">Name of the lp file.</param>
  71. /// <param name="fInfoLevelId">The f info level id.</param>
  72. /// <param name="lpFindFileData">The lp find file data.</param>
  73. /// <param name="fSearchOp">The f search op.</param>
  74. /// <param name="lpSearchFilter">The lp search filter.</param>
  75. /// <param name="dwAdditionalFlags">The dw additional flags.</param>
  76. /// <returns>IntPtr.</returns>
  77. [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
  78. public static extern IntPtr FindFirstFileEx(string lpFileName, FINDEX_INFO_LEVELS fInfoLevelId, out WIN32_FIND_DATA lpFindFileData, FINDEX_SEARCH_OPS fSearchOp, IntPtr lpSearchFilter, int dwAdditionalFlags);
  79. /// <summary>
  80. /// Finds the first file.
  81. /// </summary>
  82. /// <param name="fileName">Name of the file.</param>
  83. /// <param name="lpFindFileData">The lp find file data.</param>
  84. /// <returns>IntPtr.</returns>
  85. [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
  86. public static extern IntPtr FindFirstFile(string fileName, out WIN32_FIND_DATA lpFindFileData);
  87. /// <summary>
  88. /// Finds the next file.
  89. /// </summary>
  90. /// <param name="hFindFile">The h find file.</param>
  91. /// <param name="lpFindFileData">The lp find file data.</param>
  92. /// <returns>IntPtr.</returns>
  93. [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
  94. public static extern IntPtr FindNextFile(IntPtr hFindFile, out WIN32_FIND_DATA lpFindFileData);
  95. /// <summary>
  96. /// Finds the close.
  97. /// </summary>
  98. /// <param name="hFindFile">The h find file.</param>
  99. /// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
  100. [DllImport("kernel32")]
  101. public static extern bool FindClose(IntPtr hFindFile);
  102. }
  103. //create a _SERVER_INFO_100 STRUCTURE
  104. /// <summary>
  105. /// Struct _SERVER_INFO_100
  106. /// </summary>
  107. [StructLayout(LayoutKind.Sequential)]
  108. public struct _SERVER_INFO_100
  109. {
  110. /// <summary>
  111. /// The sv100_platform_id
  112. /// </summary>
  113. internal int sv100_platform_id;
  114. /// <summary>
  115. /// The sv100_name
  116. /// </summary>
  117. [MarshalAs(UnmanagedType.LPWStr)]
  118. internal string sv100_name;
  119. }
  120. /// <summary>
  121. /// Class FindFirstFileExFlags
  122. /// </summary>
  123. public class FindFirstFileExFlags
  124. {
  125. /// <summary>
  126. /// The NONE
  127. /// </summary>
  128. public const int NONE = 0;
  129. /// <summary>
  130. /// Searches are case-sensitive.Searches are case-sensitive.
  131. /// </summary>
  132. public const int FIND_FIRST_EX_CASE_SENSITIVE = 1;
  133. /// <summary>
  134. /// Uses a larger buffer for directory queries, which can increase performance of the find operation.
  135. /// </summary>
  136. public const int FIND_FIRST_EX_LARGE_FETCH = 2;
  137. }
  138. /// <summary>
  139. /// Enum FINDEX_INFO_LEVELS
  140. /// </summary>
  141. public enum FINDEX_INFO_LEVELS
  142. {
  143. /// <summary>
  144. /// The FindFirstFileEx function retrieves a standard set of attribute information. The data is returned in a WIN32_FIND_DATA structure.
  145. /// </summary>
  146. FindExInfoStandard = 0,
  147. /// <summary>
  148. /// The FindFirstFileEx function does not query the short file name, improving overall enumeration speed. The data is returned in a WIN32_FIND_DATA structure, and the cAlternateFileName member is always a NULL string.
  149. /// </summary>
  150. FindExInfoBasic = 1
  151. }
  152. /// <summary>
  153. /// Enum FINDEX_SEARCH_OPS
  154. /// </summary>
  155. public enum FINDEX_SEARCH_OPS
  156. {
  157. /// <summary>
  158. /// The search for a file that matches a specified file name.
  159. /// The lpSearchFilter parameter of FindFirstFileEx must be NULL when this search operation is used.
  160. /// </summary>
  161. FindExSearchNameMatch = 0,
  162. /// <summary>
  163. /// The find ex search limit to directories
  164. /// </summary>
  165. FindExSearchLimitToDirectories = 1,
  166. /// <summary>
  167. /// This filtering type is not available.
  168. /// </summary>
  169. FindExSearchLimitToDevices = 2
  170. }
  171. /// <summary>
  172. /// Struct FILETIME
  173. /// </summary>
  174. [StructLayout(LayoutKind.Sequential)]
  175. public struct FILETIME
  176. {
  177. /// <summary>
  178. /// The dw low date time
  179. /// </summary>
  180. public uint dwLowDateTime;
  181. /// <summary>
  182. /// The dw high date time
  183. /// </summary>
  184. public uint dwHighDateTime;
  185. }
  186. /// <summary>
  187. /// Struct WIN32_FIND_DATA
  188. /// </summary>
  189. [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
  190. public struct WIN32_FIND_DATA
  191. {
  192. /// <summary>
  193. /// The dw file attributes
  194. /// </summary>
  195. public FileAttributes dwFileAttributes;
  196. /// <summary>
  197. /// The ft creation time
  198. /// </summary>
  199. public FILETIME ftCreationTime;
  200. /// <summary>
  201. /// The ft last access time
  202. /// </summary>
  203. public FILETIME ftLastAccessTime;
  204. /// <summary>
  205. /// The ft last write time
  206. /// </summary>
  207. public FILETIME ftLastWriteTime;
  208. /// <summary>
  209. /// The n file size high
  210. /// </summary>
  211. public int nFileSizeHigh;
  212. /// <summary>
  213. /// The n file size low
  214. /// </summary>
  215. public int nFileSizeLow;
  216. /// <summary>
  217. /// The dw reserved0
  218. /// </summary>
  219. public int dwReserved0;
  220. /// <summary>
  221. /// The dw reserved1
  222. /// </summary>
  223. public int dwReserved1;
  224. /// <summary>
  225. /// The c file name
  226. /// </summary>
  227. [MarshalAs(UnmanagedType.ByValTStr, SizeConst = NativeMethods.MAX_PATH)]
  228. public string cFileName;
  229. /// <summary>
  230. /// This will always be null when FINDEX_INFO_LEVELS = basic
  231. /// </summary>
  232. [MarshalAs(UnmanagedType.ByValTStr, SizeConst = NativeMethods.MAX_ALTERNATE)]
  233. public string cAlternate;
  234. /// <summary>
  235. /// Gets a value indicating whether this instance is hidden.
  236. /// </summary>
  237. /// <value><c>true</c> if this instance is hidden; otherwise, <c>false</c>.</value>
  238. public bool IsHidden
  239. {
  240. get
  241. {
  242. return dwFileAttributes.HasFlag(FileAttributes.Hidden);
  243. }
  244. }
  245. /// <summary>
  246. /// Gets a value indicating whether this instance is system file.
  247. /// </summary>
  248. /// <value><c>true</c> if this instance is system file; otherwise, <c>false</c>.</value>
  249. public bool IsSystemFile
  250. {
  251. get
  252. {
  253. return dwFileAttributes.HasFlag(FileAttributes.System);
  254. }
  255. }
  256. /// <summary>
  257. /// Gets a value indicating whether this instance is directory.
  258. /// </summary>
  259. /// <value><c>true</c> if this instance is directory; otherwise, <c>false</c>.</value>
  260. public bool IsDirectory
  261. {
  262. get
  263. {
  264. return dwFileAttributes.HasFlag(FileAttributes.Directory);
  265. }
  266. }
  267. /// <summary>
  268. /// Gets the creation time UTC.
  269. /// </summary>
  270. /// <value>The creation time UTC.</value>
  271. public DateTime CreationTimeUtc
  272. {
  273. get
  274. {
  275. return ParseFileTime(ftCreationTime);
  276. }
  277. }
  278. /// <summary>
  279. /// Gets the last access time UTC.
  280. /// </summary>
  281. /// <value>The last access time UTC.</value>
  282. public DateTime LastAccessTimeUtc
  283. {
  284. get
  285. {
  286. return ParseFileTime(ftLastAccessTime);
  287. }
  288. }
  289. /// <summary>
  290. /// Gets the last write time UTC.
  291. /// </summary>
  292. /// <value>The last write time UTC.</value>
  293. public DateTime LastWriteTimeUtc
  294. {
  295. get
  296. {
  297. return ParseFileTime(ftLastWriteTime);
  298. }
  299. }
  300. /// <summary>
  301. /// Parses the file time.
  302. /// </summary>
  303. /// <param name="filetime">The filetime.</param>
  304. /// <returns>DateTime.</returns>
  305. private DateTime ParseFileTime(FILETIME filetime)
  306. {
  307. long highBits = filetime.dwHighDateTime;
  308. highBits = highBits << 32;
  309. var val = highBits + (long) filetime.dwLowDateTime;
  310. if (val < 0L)
  311. {
  312. return DateTime.MinValue;
  313. }
  314. if (val > 2650467743999999999L)
  315. {
  316. return DateTime.MaxValue;
  317. }
  318. return DateTime.FromFileTimeUtc(val);
  319. }
  320. /// <summary>
  321. /// Gets or sets the path.
  322. /// </summary>
  323. /// <value>The path.</value>
  324. public string Path { get; set; }
  325. /// <summary>
  326. /// Returns a <see cref="System.String" /> that represents this instance.
  327. /// </summary>
  328. /// <returns>A <see cref="System.String" /> that represents this instance.</returns>
  329. public override string ToString()
  330. {
  331. return Path ?? string.Empty;
  332. }
  333. }
  334. /// <summary>
  335. /// Enum SLGP_FLAGS
  336. /// </summary>
  337. [Flags]
  338. public enum SLGP_FLAGS
  339. {
  340. /// <summary>
  341. /// Retrieves the standard short (8.3 format) file name
  342. /// </summary>
  343. SLGP_SHORTPATH = 0x1,
  344. /// <summary>
  345. /// Retrieves the Universal Naming Convention (UNC) path name of the file
  346. /// </summary>
  347. SLGP_UNCPRIORITY = 0x2,
  348. /// <summary>
  349. /// Retrieves the raw path name. A raw path is something that might not exist and may include environment variables that need to be expanded
  350. /// </summary>
  351. SLGP_RAWPATH = 0x4
  352. }
  353. /// <summary>
  354. /// Enum SLR_FLAGS
  355. /// </summary>
  356. [Flags]
  357. public enum SLR_FLAGS
  358. {
  359. /// <summary>
  360. /// Do not display a dialog box if the link cannot be resolved. When SLR_NO_UI is set,
  361. /// the high-order word of fFlags can be set to a time-out value that specifies the
  362. /// maximum amount of time to be spent resolving the link. The function returns if the
  363. /// link cannot be resolved within the time-out duration. If the high-order word is set
  364. /// to zero, the time-out duration will be set to the default value of 3,000 milliseconds
  365. /// (3 seconds). To specify a value, set the high word of fFlags to the desired time-out
  366. /// duration, in milliseconds.
  367. /// </summary>
  368. SLR_NO_UI = 0x1,
  369. /// <summary>
  370. /// Obsolete and no longer used
  371. /// </summary>
  372. SLR_ANY_MATCH = 0x2,
  373. /// <summary>
  374. /// If the link object has changed, update its path and list of identifiers.
  375. /// If SLR_UPDATE is set, you do not need to call IPersistFile::IsDirty to determine
  376. /// whether or not the link object has changed.
  377. /// </summary>
  378. SLR_UPDATE = 0x4,
  379. /// <summary>
  380. /// Do not update the link information
  381. /// </summary>
  382. SLR_NOUPDATE = 0x8,
  383. /// <summary>
  384. /// Do not execute the search heuristics
  385. /// </summary>
  386. SLR_NOSEARCH = 0x10,
  387. /// <summary>
  388. /// Do not use distributed link tracking
  389. /// </summary>
  390. SLR_NOTRACK = 0x20,
  391. /// <summary>
  392. /// Disable distributed link tracking. By default, distributed link tracking tracks
  393. /// removable media across multiple devices based on the volume name. It also uses the
  394. /// Universal Naming Convention (UNC) path to track remote file systems whose drive letter
  395. /// has changed. Setting SLR_NOLINKINFO disables both types of tracking.
  396. /// </summary>
  397. SLR_NOLINKINFO = 0x40,
  398. /// <summary>
  399. /// Call the Microsoft Windows Installer
  400. /// </summary>
  401. SLR_INVOKE_MSI = 0x80
  402. }
  403. /// <summary>
  404. /// The IShellLink interface allows Shell links to be created, modified, and resolved
  405. /// </summary>
  406. [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("000214F9-0000-0000-C000-000000000046")]
  407. public interface IShellLinkW
  408. {
  409. /// <summary>
  410. /// Retrieves the path and file name of a Shell link object
  411. /// </summary>
  412. /// <param name="pszFile">The PSZ file.</param>
  413. /// <param name="cchMaxPath">The CCH max path.</param>
  414. /// <param name="pfd">The PFD.</param>
  415. /// <param name="fFlags">The f flags.</param>
  416. void GetPath([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszFile, int cchMaxPath, out WIN32_FIND_DATA pfd, SLGP_FLAGS fFlags);
  417. /// <summary>
  418. /// Retrieves the list of item identifiers for a Shell link object
  419. /// </summary>
  420. /// <param name="ppidl">The ppidl.</param>
  421. void GetIDList(out IntPtr ppidl);
  422. /// <summary>
  423. /// Sets the pointer to an item identifier list (PIDL) for a Shell link object.
  424. /// </summary>
  425. /// <param name="pidl">The pidl.</param>
  426. void SetIDList(IntPtr pidl);
  427. /// <summary>
  428. /// Retrieves the description string for a Shell link object
  429. /// </summary>
  430. /// <param name="pszName">Name of the PSZ.</param>
  431. /// <param name="cchMaxName">Name of the CCH max.</param>
  432. void GetDescription([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszName, int cchMaxName);
  433. /// <summary>
  434. /// Sets the description for a Shell link object. The description can be any application-defined string
  435. /// </summary>
  436. /// <param name="pszName">Name of the PSZ.</param>
  437. void SetDescription([MarshalAs(UnmanagedType.LPWStr)] string pszName);
  438. /// <summary>
  439. /// Retrieves the name of the working directory for a Shell link object
  440. /// </summary>
  441. /// <param name="pszDir">The PSZ dir.</param>
  442. /// <param name="cchMaxPath">The CCH max path.</param>
  443. void GetWorkingDirectory([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszDir, int cchMaxPath);
  444. /// <summary>
  445. /// Sets the name of the working directory for a Shell link object
  446. /// </summary>
  447. /// <param name="pszDir">The PSZ dir.</param>
  448. void SetWorkingDirectory([MarshalAs(UnmanagedType.LPWStr)] string pszDir);
  449. /// <summary>
  450. /// Retrieves the command-line arguments associated with a Shell link object
  451. /// </summary>
  452. /// <param name="pszArgs">The PSZ args.</param>
  453. /// <param name="cchMaxPath">The CCH max path.</param>
  454. void GetArguments([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszArgs, int cchMaxPath);
  455. /// <summary>
  456. /// Sets the command-line arguments for a Shell link object
  457. /// </summary>
  458. /// <param name="pszArgs">The PSZ args.</param>
  459. void SetArguments([MarshalAs(UnmanagedType.LPWStr)] string pszArgs);
  460. /// <summary>
  461. /// Retrieves the hot key for a Shell link object
  462. /// </summary>
  463. /// <param name="pwHotkey">The pw hotkey.</param>
  464. void GetHotkey(out short pwHotkey);
  465. /// <summary>
  466. /// Sets a hot key for a Shell link object
  467. /// </summary>
  468. /// <param name="wHotkey">The w hotkey.</param>
  469. void SetHotkey(short wHotkey);
  470. /// <summary>
  471. /// Retrieves the show command for a Shell link object
  472. /// </summary>
  473. /// <param name="piShowCmd">The pi show CMD.</param>
  474. void GetShowCmd(out int piShowCmd);
  475. /// <summary>
  476. /// Sets the show command for a Shell link object. The show command sets the initial show state of the window.
  477. /// </summary>
  478. /// <param name="iShowCmd">The i show CMD.</param>
  479. void SetShowCmd(int iShowCmd);
  480. /// <summary>
  481. /// Retrieves the location (path and index) of the icon for a Shell link object
  482. /// </summary>
  483. /// <param name="pszIconPath">The PSZ icon path.</param>
  484. /// <param name="cchIconPath">The CCH icon path.</param>
  485. /// <param name="piIcon">The pi icon.</param>
  486. void GetIconLocation([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszIconPath,
  487. int cchIconPath, out int piIcon);
  488. /// <summary>
  489. /// Sets the location (path and index) of the icon for a Shell link object
  490. /// </summary>
  491. /// <param name="pszIconPath">The PSZ icon path.</param>
  492. /// <param name="iIcon">The i icon.</param>
  493. void SetIconLocation([MarshalAs(UnmanagedType.LPWStr)] string pszIconPath, int iIcon);
  494. /// <summary>
  495. /// Sets the relative path to the Shell link object
  496. /// </summary>
  497. /// <param name="pszPathRel">The PSZ path rel.</param>
  498. /// <param name="dwReserved">The dw reserved.</param>
  499. void SetRelativePath([MarshalAs(UnmanagedType.LPWStr)] string pszPathRel, int dwReserved);
  500. /// <summary>
  501. /// Attempts to find the target of a Shell link, even if it has been moved or renamed
  502. /// </summary>
  503. /// <param name="hwnd">The HWND.</param>
  504. /// <param name="fFlags">The f flags.</param>
  505. void Resolve(IntPtr hwnd, SLR_FLAGS fFlags);
  506. /// <summary>
  507. /// Sets the path and file name of a Shell link object
  508. /// </summary>
  509. /// <param name="pszFile">The PSZ file.</param>
  510. void SetPath([MarshalAs(UnmanagedType.LPWStr)] string pszFile);
  511. }
  512. /// <summary>
  513. /// Interface IPersist
  514. /// </summary>
  515. [ComImport, Guid("0000010c-0000-0000-c000-000000000046"),
  516. InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
  517. public interface IPersist
  518. {
  519. /// <summary>
  520. /// Gets the class ID.
  521. /// </summary>
  522. /// <param name="pClassID">The p class ID.</param>
  523. [PreserveSig]
  524. void GetClassID(out Guid pClassID);
  525. }
  526. /// <summary>
  527. /// Interface IPersistFile
  528. /// </summary>
  529. [ComImport, Guid("0000010b-0000-0000-C000-000000000046"),
  530. InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
  531. public interface IPersistFile : IPersist
  532. {
  533. /// <summary>
  534. /// Gets the class ID.
  535. /// </summary>
  536. /// <param name="pClassID">The p class ID.</param>
  537. new void GetClassID(out Guid pClassID);
  538. /// <summary>
  539. /// Determines whether this instance is dirty.
  540. /// </summary>
  541. [PreserveSig]
  542. int IsDirty();
  543. /// <summary>
  544. /// Loads the specified PSZ file name.
  545. /// </summary>
  546. /// <param name="pszFileName">Name of the PSZ file.</param>
  547. /// <param name="dwMode">The dw mode.</param>
  548. [PreserveSig]
  549. void Load([In, MarshalAs(UnmanagedType.LPWStr)]
  550. string pszFileName, uint dwMode);
  551. /// <summary>
  552. /// Saves the specified PSZ file name.
  553. /// </summary>
  554. /// <param name="pszFileName">Name of the PSZ file.</param>
  555. /// <param name="remember">if set to <c>true</c> [remember].</param>
  556. [PreserveSig]
  557. void Save([In, MarshalAs(UnmanagedType.LPWStr)] string pszFileName,
  558. [In, MarshalAs(UnmanagedType.Bool)] bool remember);
  559. /// <summary>
  560. /// Saves the completed.
  561. /// </summary>
  562. /// <param name="pszFileName">Name of the PSZ file.</param>
  563. [PreserveSig]
  564. void SaveCompleted([In, MarshalAs(UnmanagedType.LPWStr)] string pszFileName);
  565. /// <summary>
  566. /// Gets the cur file.
  567. /// </summary>
  568. /// <param name="ppszFileName">Name of the PPSZ file.</param>
  569. [PreserveSig]
  570. void GetCurFile([In, MarshalAs(UnmanagedType.LPWStr)] string ppszFileName);
  571. }
  572. // CLSID_ShellLink from ShlGuid.h
  573. /// <summary>
  574. /// Class ShellLink
  575. /// </summary>
  576. [
  577. ComImport,
  578. Guid("00021401-0000-0000-C000-000000000046")
  579. ]
  580. public class ShellLink
  581. {
  582. }
  583. }