/trunk/xPlatform.x86.kernel32/kernel32.cs

# · C# · 4523 lines · 3276 code · 1245 blank · 2 comment · 0 complexity · aa90e90fe4541ff77d5ee0114ff89b7d MD5 · raw file

Large files are truncated click here to view the full file

  1. using System;
  2. using System.Text;
  3. using xPlatform.Flags;
  4. using System.Runtime.InteropServices;
  5. namespace xPlatform.x86.kernel32
  6. {
  7. [Serializable]
  8. public partial class kernel32 : ModuleBase
  9. {
  10. [NonSerialized]
  11. public const string ModuleName = "kernel32.dll";
  12. }
  13. #region Atom functions
  14. partial class kernel32
  15. {
  16. [DllImport(ModuleName), CLSCompliant(false)]
  17. public static extern ATOM AddAtomA(IntPtr lpString);
  18. [DllImport(ModuleName, CharSet = CharSet.Ansi), CLSCompliant(false)]
  19. public static extern ATOM AddAtomA(string lpString);
  20. [DllImport(ModuleName), CLSCompliant(false)]
  21. public static extern ATOM AddAtomW(IntPtr lpString);
  22. [DllImport(ModuleName, CharSet = CharSet.Unicode), CLSCompliant(false)]
  23. public static extern ATOM AddAtomW(string lpString);
  24. [DllImport(ModuleName), CLSCompliant(false)]
  25. public static extern ATOM DeleteAtom(ATOM nAtom);
  26. [DllImport(ModuleName), CLSCompliant(false)]
  27. public static extern ATOM FindAtomA(IntPtr lpString);
  28. [DllImport(ModuleName, CharSet = CharSet.Ansi), CLSCompliant(false)]
  29. public static extern ATOM FindAtomA(string lpString);
  30. [DllImport(ModuleName), CLSCompliant(false)]
  31. public static extern ATOM FindAtomW(IntPtr lpString);
  32. [DllImport(ModuleName, CharSet = CharSet.Unicode), CLSCompliant(false)]
  33. public static extern ATOM FindAtomW(string lpString);
  34. [DllImport(ModuleName), CLSCompliant(false)]
  35. public static extern uint GetAtomNameA(ATOM nAtom, IntPtr lpBuffer, int nSize);
  36. [DllImport(ModuleName, CharSet = CharSet.Ansi), CLSCompliant(false)]
  37. public static extern uint GetAtomNameA(ATOM nAtom, StringBuilder lpBuffer, int nSize);
  38. [DllImport(ModuleName), CLSCompliant(false)]
  39. public static extern uint GetAtomNameW(ATOM nAtom, IntPtr lpBuffer, int nSize);
  40. [DllImport(ModuleName, CharSet = CharSet.Unicode), CLSCompliant(false)]
  41. public static extern uint GetAtomNameW(ATOM nAtom, StringBuilder lpBuffer, int nSize);
  42. [DllImport(ModuleName), CLSCompliant(false)]
  43. public static extern ATOM GlobalAddAtomA(IntPtr lpString);
  44. [DllImport(ModuleName, CharSet = CharSet.Ansi), CLSCompliant(false)]
  45. public static extern ATOM GlobalAddAtomA(string lpString);
  46. [DllImport(ModuleName), CLSCompliant(false)]
  47. public static extern ATOM GlobalAddAtomW(IntPtr lpString);
  48. [DllImport(ModuleName, CharSet = CharSet.Unicode), CLSCompliant(false)]
  49. public static extern ATOM GlobalAddAtomW(string lpString);
  50. [DllImport(ModuleName), CLSCompliant(false)]
  51. public static extern ATOM GlobalDeleteAtom(ATOM nAtom);
  52. [DllImport(ModuleName), CLSCompliant(false)]
  53. public static extern ATOM GlobalFindAtomA(IntPtr lpString);
  54. [DllImport(ModuleName, CharSet = CharSet.Ansi), CLSCompliant(false)]
  55. public static extern ATOM GlobalFindAtomA(string lpString);
  56. [DllImport(ModuleName), CLSCompliant(false)]
  57. public static extern ATOM GlobalFindAtomW(IntPtr lpString);
  58. [DllImport(ModuleName, CharSet = CharSet.Unicode), CLSCompliant(false)]
  59. public static extern ATOM GlobalFindAtomW(string lpString);
  60. [DllImport(ModuleName), CLSCompliant(false)]
  61. public static extern uint GlobalGetAtomNameA(ATOM nAtom, IntPtr lpBuffer, int nSize);
  62. [DllImport(ModuleName, CharSet = CharSet.Ansi), CLSCompliant(false)]
  63. public static extern uint GlobalGetAtomNameA(ATOM nAtom, StringBuilder lpBuffer, int nSize);
  64. [DllImport(ModuleName), CLSCompliant(false)]
  65. public static extern uint GlobalGetAtomNameW(ATOM nAtom, IntPtr lpBuffer, int nSize);
  66. [DllImport(ModuleName, CharSet = CharSet.Unicode), CLSCompliant(false)]
  67. public static extern uint GlobalGetAtomNameW(ATOM nAtom, StringBuilder lpBuffer, int nSize);
  68. [DllImport(ModuleName), CLSCompliant(false)]
  69. public static extern int InitAtomTable(uint nSize);
  70. public static IntPtr MAKEINTATOM(int i)
  71. {
  72. return new IntPtr((uint)((ushort)i));
  73. }
  74. }
  75. #endregion // Atom functions
  76. #region Debugging functions
  77. partial class kernel32
  78. {
  79. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  80. public static extern int ContinueDebugEvent(uint dwProcessId, uint dwThreadId, uint dwContinueStatus);
  81. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  82. public static extern int DebugActiveProcess(uint dwProcessId);
  83. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  84. public static extern int DebugActiveProcessStop(uint dwProcessId);
  85. [DllImport(ModuleName)]
  86. public static extern void DebugBreak();
  87. [DllImport(ModuleName, SetLastError = true)]
  88. public static extern int DebugBreakProcess(IntPtr Process);
  89. [DllImport(ModuleName, SetLastError = true)]
  90. public static extern int DebugSetProcessKillOnExit(int KillOnExit);
  91. [DllImport(ModuleName)]
  92. public static extern void FatalExit(int ExitCode);
  93. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  94. public static extern int FlushInstructionCache(IntPtr hProcess, IntPtr lpBaseAddress, uint dwSize);
  95. [DllImport(ModuleName, SetLastError = true)]
  96. public static extern int GetThreadContext(IntPtr hThread, IntPtr lpContext);
  97. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  98. public static extern int GetThreadContext(IntPtr hThread, ref CONTEXT lpContext);
  99. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  100. public static extern int GetThreadSelectorEntry(IntPtr hThread, uint dwSelector, IntPtr lpSelectorEntry);
  101. [Todo("Test Required")]
  102. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  103. public static extern int GetThreadSelectorEntry(IntPtr hThread, uint dwSelector, ref LDT_ENTRY lpSelectorEntry);
  104. [DllImport(ModuleName)]
  105. public static extern int IsDebuggerPresent();
  106. [DllImport(ModuleName)]
  107. public static extern void OutputDebugStringA(IntPtr lpOutputString);
  108. [DllImport(ModuleName, CharSet = CharSet.Ansi)]
  109. public static extern void OutputDebugStringA(string lpOutputString);
  110. [DllImport(ModuleName)]
  111. public static extern void OutputDebugStringW(IntPtr lpOutputString);
  112. [DllImport(ModuleName, CharSet = CharSet.Unicode)]
  113. public static extern void OutputDebugStringW(string lpOutputString);
  114. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  115. public static extern int ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, IntPtr lpBuffer, uint nSize, IntPtr lpNumberOfBytesRead);
  116. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  117. public static extern int ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, IntPtr lpBuffer, uint nSize, ref uint lpNumberOfBytesRead);
  118. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  119. public static extern void SetDebugErrorLevel(uint dwLevel);
  120. [DllImport(ModuleName, SetLastError = true)]
  121. public static extern int SetThreadContext(IntPtr hThread, IntPtr lpContext);
  122. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  123. public static extern int SetThreadContext(IntPtr hThread, ref CONTEXT lpContext);
  124. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  125. public static extern int WaitForDebugEvent(IntPtr lpDebugEvent, uint dwMilliseconds);
  126. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  127. public static extern int WaitForDebugEvent(ref DEBUG_EVENT lpDebugEvent, uint dwMilliseconds);
  128. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  129. public static extern int WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, IntPtr lpBuffer, uint nSize, IntPtr lpNumberOfBytesWritten);
  130. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  131. public static extern int WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, IntPtr lpBuffer, uint nSize, ref uint lpNumberOfBytesWritten);
  132. }
  133. #endregion // Debugging functions
  134. #region Error functions
  135. partial class kernel32
  136. {
  137. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  138. public static extern int Beep(uint dwFreq, uint dwDuration);
  139. [DllImport(ModuleName), CLSCompliant(false)]
  140. public static extern void FatalAppExitA(uint uAction, IntPtr lpMessageText);
  141. [DllImport(ModuleName, CharSet = CharSet.Ansi), CLSCompliant(false)]
  142. public static extern void FatalAppExitA(uint uAction, string lpMessageText);
  143. [DllImport(ModuleName), CLSCompliant(false)]
  144. public static extern void FatalAppExitW(uint uAction, IntPtr lpMessageText);
  145. [DllImport(ModuleName, CharSet = CharSet.Unicode), CLSCompliant(false)]
  146. public static extern void FatalAppExitW(uint uAction, string lpMessageText);
  147. [DllImport(ModuleName, CharSet = CharSet.Ansi, SetLastError = true), CLSCompliant(false)]
  148. public static extern uint FormatMessageA(uint dwFlags, IntPtr lpSource, uint dwMessageId, uint dwLanguageId, IntPtr lpBuffer, uint nSize, IntPtr Arguments);
  149. [DllImport(ModuleName, CharSet = CharSet.Ansi, SetLastError = true), CLSCompliant(false)]
  150. public static extern uint FormatMessageA(uint dwFlags, IntPtr lpSource, uint dwMessageId, uint dwLanguageId, StringBuilder lpBuffer, uint nSize, IntPtr Arguments);
  151. [DllImport(ModuleName, CharSet = CharSet.Unicode, SetLastError = true), CLSCompliant(false)]
  152. public static extern uint FormatMessageW(uint dwFlags, IntPtr lpSource, uint dwMessageId, uint dwLanguageId, IntPtr lpBuffer, uint nSize, IntPtr Arguments);
  153. [DllImport(ModuleName, CharSet = CharSet.Unicode, SetLastError = true), CLSCompliant(false)]
  154. public static extern uint FormatMessageW(uint dwFlags, IntPtr lpSource, uint dwMessageId, uint dwLanguageId, StringBuilder lpBuffer, uint nSize, IntPtr Arguments);
  155. public static int GetLastError()
  156. {
  157. return Marshal.GetLastWin32Error();
  158. }
  159. [DllImport(ModuleName), CLSCompliant(false)]
  160. public static extern uint SetErrorMode(uint uMode);
  161. [DllImport(ModuleName), CLSCompliant(false)]
  162. public static extern void SetLastError(uint dwErrCode);
  163. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  164. public static extern void SetLastErrorEx(uint dwErrCode, uint dwType);
  165. }
  166. #endregion // Error functions
  167. #region Console functions
  168. partial class kernel32
  169. {
  170. [DllImport(ModuleName, CallingConvention = CallingConvention.Winapi)]
  171. public static extern int AddConsoleAliasA(
  172. [In] IntPtr Source,
  173. [In] IntPtr Target,
  174. [In] IntPtr ExeName);
  175. [DllImport(ModuleName, CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Ansi)]
  176. public static extern int AddConsoleAliasA(
  177. [In] string Source,
  178. [In] string Target,
  179. [In] string ExeName);
  180. [DllImport(ModuleName, CallingConvention = CallingConvention.Winapi)]
  181. public static extern int AddConsoleAliasW(
  182. [In] IntPtr Source,
  183. [In] IntPtr Target,
  184. [In] IntPtr ExeName);
  185. [DllImport(ModuleName, CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Unicode)]
  186. public static extern int AddConsoleAliasW(
  187. [In] string Source,
  188. [In] string Target,
  189. [In] string ExeName);
  190. [DllImport(ModuleName, SetLastError = true)]
  191. public static extern int AllocConsole();
  192. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  193. public static extern int AttachConsole(
  194. [In] uint dwProcessId);
  195. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  196. public static extern IntPtr CreateConsoleScreenBuffer(
  197. [In] uint dwDesiredAccess,
  198. [In] uint dwShareMode,
  199. [In] IntPtr lpSecurityAttributes,
  200. [In] uint dwFlags,
  201. [In] IntPtr lpScreenBufferData);
  202. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  203. public static extern IntPtr CreateConsoleScreenBuffer(
  204. [In] uint dwDesiredAccess,
  205. [In] uint dwShareMode,
  206. [In] ref SECURITY_ATTRIBUTES lpSecurityAttributes,
  207. [In] uint dwFlags,
  208. [In] IntPtr lpScreenBufferData);
  209. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  210. public static extern int FillConsoleOutputAttribute(
  211. [In] IntPtr hConsoleOutput,
  212. [In] ushort wAttribute,
  213. [In] uint nLength,
  214. [In] COORD dwWriteCoord,
  215. [Out] IntPtr lpNumberOfAttrsWritten);
  216. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  217. public static extern int FillConsoleOutputAttribute(
  218. [In] IntPtr hConsoleOutput,
  219. [In] ushort wAttribute,
  220. [In] uint nLength,
  221. [In] COORD dwWriteCoord,
  222. [Out] out uint lpNumberOfAttrsWritten);
  223. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  224. public static extern int FillConsoleOutputCharacterA(
  225. [In] IntPtr hConsoleOutput,
  226. [In] sbyte cCharacter,
  227. [In] uint nLength,
  228. [In] COORD dwWriteCoord,
  229. [Out] IntPtr lpNumberOfCharsWritten);
  230. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  231. public static extern int FillConsoleOutputCharacterA(
  232. [In] IntPtr hConsoleOutput,
  233. [In] sbyte cCharacter,
  234. [In] uint nLength,
  235. [In] COORD dwWriteCoord,
  236. [Out] out uint lpNumberOfCharsWritten);
  237. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  238. public static extern int FillConsoleOutputCharacterW(
  239. [In] IntPtr hConsoleOutput,
  240. [In] ushort cCharacter,
  241. [In] uint nLength,
  242. [In] COORD dwWriteCoord,
  243. [Out] IntPtr lpNumberOfCharsWritten);
  244. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  245. public static extern int FillConsoleOutputCharacterW(
  246. [In] IntPtr hConsoleOutput,
  247. [In] ushort cCharacter,
  248. [In] uint nLength,
  249. [In] COORD dwWriteCoord,
  250. [Out] out uint lpNumberOfCharsWritten);
  251. [DllImport(ModuleName, SetLastError = true)]
  252. public static extern int FlushConsoleInputBuffer(
  253. [In] IntPtr hConsoleInput);
  254. [DllImport(ModuleName, SetLastError = true)]
  255. public static extern int FreeConsole();
  256. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  257. public static extern int GenerateConsoleCtrlEvent(
  258. [In] uint dwCtrlEvent,
  259. [In] uint dwProcessGroupId);
  260. [DllImport(ModuleName, SetLastError = true, CallingConvention = CallingConvention.Winapi), CLSCompliant(false)]
  261. public static extern uint GetConsoleAliasA(
  262. [In] IntPtr lpSource,
  263. [Out] IntPtr lpTargetBuffer,
  264. [In] uint TargetBufferLength,
  265. [In] IntPtr lpExeName);
  266. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Winapi), CLSCompliant(false)]
  267. public static extern uint GetConsoleAliasA(
  268. [In] string lpSource,
  269. [Out] StringBuilder lpTargetBuffer,
  270. [In] uint TargetBufferLength,
  271. [In] string lpExeName);
  272. [DllImport(ModuleName, SetLastError = true, CallingConvention = CallingConvention.Winapi), CLSCompliant(false)]
  273. public static extern uint GetConsoleAliasW(
  274. [In] IntPtr lpSource,
  275. [Out] IntPtr lpTargetBuffer,
  276. [In] uint TargetBufferLength,
  277. [In] IntPtr lpExeName);
  278. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi), CLSCompliant(false)]
  279. public static extern uint GetConsoleAliasW(
  280. [In] string lpSource,
  281. [Out] StringBuilder lpTargetBuffer,
  282. [In] uint TargetBufferLength,
  283. [In] string lpExeName);
  284. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  285. public static extern uint GetConsoleAliasesA(
  286. [Out] IntPtr lpAliasBuffer,
  287. [In] uint AliasBufferLength,
  288. [In] IntPtr lpExeName);
  289. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Ansi), CLSCompliant(false)]
  290. public static extern uint GetConsoleAliasesA(
  291. [Out] IntPtr lpAliasBuffer,
  292. [In] uint AliasBufferLength,
  293. [In] string lpExeName);
  294. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  295. public static extern uint GetConsoleAliasesW(
  296. [Out] IntPtr lpAliasBuffer,
  297. [In] uint AliasBufferLength,
  298. [In] IntPtr lpExeName);
  299. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Unicode), CLSCompliant(false)]
  300. public static extern uint GetConsoleAliasesW(
  301. [Out] IntPtr lpAliasBuffer,
  302. [In] uint AliasBufferLength,
  303. [In] string lpExeName);
  304. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  305. public static extern uint GetConsoleAliasesLengthA(
  306. [In] IntPtr lpExeName);
  307. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Ansi), CLSCompliant(false)]
  308. public static extern uint GetConsoleAliasesLengthA(
  309. [In] string lpExeName);
  310. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  311. public static extern uint GetConsoleAliasesLengthW(
  312. [In] IntPtr lpExeName);
  313. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Unicode), CLSCompliant(false)]
  314. public static extern uint GetConsoleAliasesLengthW(
  315. [In] string lpExeName);
  316. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  317. public static extern uint GetConsoleAliasExesA(
  318. [Out] IntPtr lpExeNameBuffer,
  319. [In] uint ExeNameBufferLength);
  320. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Ansi), CLSCompliant(false)]
  321. public static extern uint GetConsoleAliasExesA(
  322. [Out] StringBuilder lpExeNameBuffer,
  323. [In] uint ExeNameBufferLength);
  324. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  325. public static extern uint GetConsoleAliasExesW(
  326. [Out] IntPtr lpExeNameBuffer,
  327. [In] uint ExeNameBufferLength);
  328. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Unicode), CLSCompliant(false)]
  329. public static extern uint GetConsoleAliasExesW(
  330. [Out] StringBuilder lpExeNameBuffer,
  331. [In] uint ExeNameBufferLength);
  332. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  333. public static extern uint GetConsoleAliasExesLength();
  334. [DllImport(ModuleName), CLSCompliant(false)]
  335. public static extern uint GetConsoleCP();
  336. [DllImport(ModuleName, SetLastError = true)]
  337. public static extern int GetConsoleCursorInfo(
  338. [In] IntPtr hConsoleOutput,
  339. [Out] IntPtr lpConsoleCursorInfo);
  340. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  341. public static extern int GetConsoleCursorInfo(
  342. [In] IntPtr hConsoleOutput,
  343. [Out] out CONSOLE_CURSOR_INFO lpConsoleCursorInfo);
  344. [DllImport(ModuleName, SetLastError = true)]
  345. public static extern int GetConsoleDisplayMode(
  346. [Out] IntPtr lpModeFlags);
  347. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  348. public static extern int GetConsoleDisplayMode(
  349. [Out] out uint lpModeFlags);
  350. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  351. public static extern COORD GetConsoleFontSize(
  352. [In] IntPtr hConsoleOutput,
  353. [In] uint nFont);
  354. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  355. public static extern int GetConsoleHistoryInfo(
  356. IntPtr lpConsoleHistoryInfo);
  357. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  358. public static extern int GetConsoleHistoryInfo(
  359. [Out] out CONSOLE_HISTORY_INFO lpConsoleHistoryInfo);
  360. [DllImport(ModuleName, SetLastError = true)]
  361. public static extern int GetConsoleMode(
  362. [In] IntPtr hConsoleOutput,
  363. [Out] IntPtr lpMode);
  364. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  365. public static extern int GetConsoleMode(
  366. [In] IntPtr hConsoleOutput,
  367. [Out] out uint lpMode);
  368. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  369. public static extern uint GetConsoleOriginalTitleA(
  370. [Out] IntPtr lpConsoleTitle,
  371. [In] uint nSize);
  372. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Ansi), CLSCompliant(false)]
  373. public static extern uint GetConsoleOriginalTitleA(
  374. [Out] StringBuilder lpConsoleTitle,
  375. [In] uint nSize);
  376. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  377. public static extern uint GetConsoleOriginalTitleW(
  378. [Out] IntPtr lpConsoleTitle,
  379. [In] uint nSize);
  380. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Unicode), CLSCompliant(false)]
  381. public static extern uint GetConsoleOriginalTitleW(
  382. [Out] StringBuilder lpConsoleTitle,
  383. [In] uint nSize);
  384. [DllImport(ModuleName), CLSCompliant(false)]
  385. public static extern uint GetConsoleOutputCP();
  386. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  387. public static extern uint GetConsoleProcessList(
  388. [Out] IntPtr lpdwProcessList,
  389. [In] uint dwProcessCount);
  390. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  391. public static extern uint GetConsoleProcessList(
  392. [Out] uint[] lpdwProcessList,
  393. [In] uint dwProcessCount);
  394. [DllImport(ModuleName, SetLastError = true)]
  395. public static extern int GetConsoleScreenBufferInfo(
  396. [In] IntPtr hConsoleOutput,
  397. [Out] IntPtr lpConsoleScreenBufferInfo);
  398. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  399. public static extern int GetConsoleScreenBufferInfo(
  400. [In] IntPtr hConsoleOutput,
  401. [Out] out CONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo);
  402. [DllImport(ModuleName, SetLastError = true)]
  403. public static extern int GetConsoleScreenBufferInfoEx(
  404. [In] IntPtr hConsoleOutput,
  405. [Out] IntPtr lpConsoleScreenBufferInfoEx);
  406. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  407. public static extern int GetConsoleScreenBufferInfoEx(
  408. [In] IntPtr hConsoleOutput,
  409. [Out] out CONSOLE_SCREEN_BUFFER_INFOEX lpConsoleScreenBufferInfoEx);
  410. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  411. public static extern int GetConsoleSelectionInfo(
  412. [Out] IntPtr lpConsoleSelectionInfo);
  413. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  414. public static extern int GetConsoleSelectionInfo(
  415. [Out] out CONSOLE_SELECTION_INFO lpConsoleSelectionInfo);
  416. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  417. public static extern uint GetConsoleTitleA(
  418. [Out] IntPtr lpConsoleTitle,
  419. [In] uint nSize);
  420. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Ansi), CLSCompliant(false)]
  421. public static extern uint GetConsoleTitleA(
  422. [Out] StringBuilder lpConsoleTitle,
  423. [In] uint nSize);
  424. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  425. public static extern uint GetConsoleTitleW(
  426. [Out] IntPtr lpConsoleTitle,
  427. [In] uint nSize);
  428. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Unicode), CLSCompliant(false)]
  429. public static extern uint GetConsoleTitleW(
  430. [Out] StringBuilder lpConsoleTitle,
  431. [In] uint nSize);
  432. [DllImport(ModuleName, SetLastError = true)]
  433. public static extern IntPtr GetConsoleWindow();
  434. [DllImport(ModuleName, SetLastError = true)]
  435. public static extern int GetCurrentConsoleFont(
  436. [In] IntPtr hConsoleOutput,
  437. [In] int bMaximumWindow,
  438. [Out] IntPtr lpConsoleCurrentFont);
  439. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  440. public static extern int GetCurrentConsoleFont(
  441. [In] IntPtr hConsoleOutput,
  442. [In] int bMaximumWindow,
  443. [Out] out CONSOLE_FONT_INFO lpConsoleCurrentFont);
  444. [DllImport(ModuleName, SetLastError = true)]
  445. public static extern int GetCurrentConsoleFontEx(
  446. [In] IntPtr hConsoleOutput,
  447. [In] int bMaximumWindow,
  448. [Out] IntPtr lpConsoleCurrentFontEx);
  449. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Unicode), CLSCompliant(false)]
  450. public static extern int GetCurrentConsoleFontEx(
  451. [In] IntPtr hConsoleOutput,
  452. [In] int bMaximumWindow,
  453. [Out] out CONSOLE_FONT_INFOEX lpConsoleCurrentFontEx);
  454. [DllImport(ModuleName, SetLastError = true)]
  455. public static extern COORD GetLargestConsoleWindowSize(
  456. [In] IntPtr hConsoleOutput);
  457. [DllImport(ModuleName, SetLastError = true)]
  458. public static extern int GetNumberOfConsoleInputEvents(
  459. [In] IntPtr hConsoleInput,
  460. [Out] IntPtr lpcNumberOfEvents);
  461. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  462. public static extern int GetNumberOfConsoleInputEvents(
  463. [In] IntPtr hConsoleInput,
  464. [Out] out uint lpcNumberOfEvents);
  465. [DllImport(ModuleName, SetLastError = true)]
  466. public static extern int GetNumberOfConsoleMouseButtons(
  467. [In] IntPtr hNumberOfMouseButtons);
  468. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  469. public static extern int GetNumberOfConsoleMouseButtons(
  470. [Out] out uint lpNumberOfMouseButtons);
  471. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  472. public static extern IntPtr GetStdHandle(
  473. [In] uint nStdHandle);
  474. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Ansi), CLSCompliant(false)]
  475. public static extern int PeekConsoleInputA(
  476. [In] IntPtr hConsoleInput,
  477. [Out] IntPtr lpBuffer,
  478. [In] uint nLength,
  479. [Out] IntPtr lpNumberOfEventsRead);
  480. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Ansi), CLSCompliant(false)]
  481. public static extern int PeekConsoleInputA(
  482. [In] IntPtr hConsoleInput,
  483. [Out] out INPUT_RECORD lpBuffer,
  484. [In] uint nLength,
  485. [Out] out uint lpNumberOfEventsRead);
  486. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Unicode), CLSCompliant(false)]
  487. public static extern int PeekConsoleInputW(
  488. [In] IntPtr hConsoleInput,
  489. [Out] IntPtr lpBuffer,
  490. [In] uint nLength,
  491. [Out] IntPtr lpNumberOfEventsRead);
  492. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Unicode), CLSCompliant(false)]
  493. public static extern int PeekConsoleInputW(
  494. [In] IntPtr hConsoleInput,
  495. [Out] out INPUT_RECORD lpBuffer,
  496. [In] uint nLength,
  497. [Out] out uint lpNumberOfEventsRead);
  498. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Ansi), CLSCompliant(false)]
  499. public static extern int ReadConsoleA(
  500. [In] IntPtr hConsoleInput,
  501. [Out] IntPtr lpBuffer,
  502. [In] uint nNumberOfCharsToRead,
  503. [Out] IntPtr lpNumberOfCharsRead,
  504. [In] IntPtr lpReserved);
  505. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Ansi), CLSCompliant(false)]
  506. public static extern int ReadConsoleA(
  507. [In] IntPtr hConsoleInput,
  508. [Out] IntPtr lpBuffer,
  509. [In] uint nNumberOfCharsToRead,
  510. [Out] out uint lpNumberOfCharsRead,
  511. [In] IntPtr lpReserved);
  512. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Ansi), CLSCompliant(false)]
  513. public static extern int ReadConsoleA(
  514. [In] IntPtr hConsoleInput,
  515. [Out] IntPtr lpBuffer,
  516. [In] uint nNumberOfCharsToRead,
  517. [Out] IntPtr lpNumberOfCharsRead,
  518. [In] ref CONSOLE_READCONSOLE_CONTROL lpReserved);
  519. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Ansi), CLSCompliant(false)]
  520. public static extern int ReadConsoleA(
  521. [In] IntPtr hConsoleInput,
  522. [Out] IntPtr lpBuffer,
  523. [In] uint nNumberOfCharsToRead,
  524. [Out] out uint lpNumberOfCharsRead,
  525. [In] ref CONSOLE_READCONSOLE_CONTROL lpReserved);
  526. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Unicode), CLSCompliant(false)]
  527. public static extern int ReadConsoleW(
  528. [In] IntPtr hConsoleInput,
  529. [Out] IntPtr lpBuffer,
  530. [In] uint nNumberOfCharsToRead,
  531. [Out] IntPtr lpNumberOfCharsRead,
  532. [In] IntPtr lpReserved);
  533. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Unicode), CLSCompliant(false)]
  534. public static extern int ReadConsoleW(
  535. [In] IntPtr hConsoleInput,
  536. [Out] IntPtr lpBuffer,
  537. [In] uint nNumberOfCharsToRead,
  538. [Out] out uint lpNumberOfCharsRead,
  539. [In] IntPtr lpReserved);
  540. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Unicode), CLSCompliant(false)]
  541. public static extern int ReadConsoleW(
  542. [In] IntPtr hConsoleInput,
  543. [Out] IntPtr lpBuffer,
  544. [In] uint nNumberOfCharsToRead,
  545. [Out] IntPtr lpNumberOfCharsRead,
  546. [In] ref CONSOLE_READCONSOLE_CONTROL lpReserved);
  547. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Unicode), CLSCompliant(false)]
  548. public static extern int ReadConsoleW(
  549. [In] IntPtr hConsoleInput,
  550. [Out] IntPtr lpBuffer,
  551. [In] uint nNumberOfCharsToRead,
  552. [Out] out uint lpNumberOfCharsRead,
  553. [In] ref CONSOLE_READCONSOLE_CONTROL lpReserved);
  554. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Ansi), CLSCompliant(false)]
  555. public static extern int ReadConsoleInputA(
  556. [In] IntPtr hConsoleInput,
  557. [Out] IntPtr lpBuffer,
  558. [In] uint nLength,
  559. [Out] IntPtr lpNumberOfEventsRead);
  560. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Ansi), CLSCompliant(false)]
  561. public static extern int ReadConsoleInputA(
  562. [In] IntPtr hConsoleInput,
  563. [Out] out INPUT_RECORD lpBuffer,
  564. [In] uint nLength,
  565. [Out] out uint lpNumberOfEventsRead);
  566. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Unicode), CLSCompliant(false)]
  567. public static extern int ReadConsoleInputW(
  568. [In] IntPtr hConsoleInput,
  569. [Out] IntPtr lpBuffer,
  570. [In] uint nLength,
  571. [Out] IntPtr lpNumberOfEventsRead);
  572. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Unicode), CLSCompliant(false)]
  573. public static extern int ReadConsoleInputW(
  574. [In] IntPtr hConsoleInput,
  575. [Out] out INPUT_RECORD lpBuffer,
  576. [In] uint nLength,
  577. [Out] out uint lpNumberOfEventsRead);
  578. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Ansi)]
  579. public static extern int ReadConsoleOutputA(
  580. [In] IntPtr hConsoleOutput,
  581. [Out] IntPtr lpBuffer,
  582. [In] COORD dwBufferSize,
  583. [In] COORD dwBufferCoord,
  584. [In, Out] IntPtr lpReadRegion);
  585. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Ansi), CLSCompliant(false)]
  586. public static extern int ReadConsoleOutputA(
  587. [In] IntPtr hConsoleOutput,
  588. [Out] out CHAR_INFO lpBuffer,
  589. [In] COORD dwBufferSize,
  590. [In] COORD dwBufferCoord,
  591. [In, Out] ref SMALL_RECT lpReadRegion);
  592. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Unicode)]
  593. public static extern int ReadConsoleOutputW(
  594. [In] IntPtr hConsoleOutput,
  595. [Out] IntPtr lpBuffer,
  596. [In] COORD dwBufferSize,
  597. [In] COORD dwBufferCoord,
  598. [In, Out] IntPtr lpReadRegion);
  599. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Unicode), CLSCompliant(false)]
  600. public static extern int ReadConsoleOutputW(
  601. [In] IntPtr hConsoleOutput,
  602. [Out] out CHAR_INFO lpBuffer,
  603. [In] COORD dwBufferSize,
  604. [In] COORD dwBufferCoord,
  605. [In, Out] ref SMALL_RECT lpReadRegion);
  606. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  607. public static extern int ReadConsoleOutputAttribute(
  608. [In] IntPtr hConsoleOutput,
  609. [Out] IntPtr lpAttribute,
  610. [In] uint nLength,
  611. [In] COORD dwReadCoord,
  612. [Out] IntPtr lpNumberOfAttrsRead);
  613. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  614. public static extern int ReadConsoleOutputAttribute(
  615. [In] IntPtr hConsoleOutput,
  616. [Out] out uint lpAttribute,
  617. [In] uint nLength,
  618. [In] COORD dwReadCoord,
  619. [Out] out uint lpNumberOfAttrsRead);
  620. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Ansi), CLSCompliant(false)]
  621. public static extern int ReadConsoleOutputCharacterA(
  622. [In] IntPtr hConsoleOutput,
  623. [Out] IntPtr lpCharacter,
  624. [In] uint nLength,
  625. [In] COORD dwReadCoord,
  626. [Out] IntPtr lpNumberOfCharsRead);
  627. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Ansi), CLSCompliant(false)]
  628. public static extern int ReadConsoleOutputCharacterA(
  629. [In] IntPtr hConsoleOutput,
  630. [Out] StringBuilder lpCharacter,
  631. [In] uint nLength,
  632. [In] COORD dwReadCoord,
  633. [Out] out uint lpNumberOfCharsRead);
  634. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Unicode), CLSCompliant(false)]
  635. public static extern int ReadConsoleOutputCharacterW(
  636. [In] IntPtr hConsoleOutput,
  637. [Out] IntPtr lpCharacter,
  638. [In] uint nLength,
  639. [In] COORD dwReadCoord,
  640. [Out] IntPtr lpNumberOfCharsRead);
  641. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Unicode), CLSCompliant(false)]
  642. public static extern int ReadConsoleOutputCharacterW(
  643. [In] IntPtr hConsoleOutput,
  644. [Out] StringBuilder lpCharacter,
  645. [In] uint nLength,
  646. [In] COORD dwReadCoord,
  647. [Out] out uint lpNumberOfCharsRead);
  648. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Ansi)]
  649. public static extern int ScrollConsoleScreenBufferA(
  650. [In] IntPtr hConsoleOutput,
  651. [In] IntPtr lpScrollRectangle,
  652. [In] IntPtr lpClipRectangle,
  653. [In] COORD dwDestinationOrigin,
  654. [In] IntPtr lpFill);
  655. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Ansi), CLSCompliant(false)]
  656. public static extern int ScrollConsoleScreenBufferA(
  657. [In] IntPtr hConsoleOutput,
  658. [In] ref SMALL_RECT lpScrollRectangle,
  659. [In] ref SMALL_RECT lpClipRectangle,
  660. [In] COORD dwDestinationOrigin,
  661. [In] ref CHAR_INFO lpFill);
  662. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Unicode)]
  663. public static extern int ScrollConsoleScreenBufferW(
  664. [In] IntPtr hConsoleOutput,
  665. [In] IntPtr lpScrollRectangle,
  666. [In] IntPtr lpClipRectangle,
  667. [In] COORD dwDestinationOrigin,
  668. [In] IntPtr lpFill);
  669. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Unicode), CLSCompliant(false)]
  670. public static extern int ScrollConsoleScreenBufferW(
  671. [In] IntPtr hConsoleOutput,
  672. [In] ref SMALL_RECT lpScrollRectangle,
  673. [In] ref SMALL_RECT lpClipRectangle,
  674. [In] COORD dwDestinationOrigin,
  675. [In] ref CHAR_INFO lpFill);
  676. [DllImport(ModuleName, SetLastError = true)]
  677. public static extern int SetConsoleActiveScreenBuffer(
  678. [In] IntPtr hConsoleOutput);
  679. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  680. public static extern int SetConsoleCP(
  681. [In] uint wCodePageID);
  682. [DllImport(ModuleName, SetLastError = true)]
  683. public static extern int SetConsoleCtrlHandler(
  684. [In] IntPtr HandlerRoutine,
  685. [In] int Add);
  686. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  687. public static extern int SetConsoleCtrlHandler(
  688. [In] HandlerRoutine HandlerRoutine,
  689. [In] int Add);
  690. [DllImport(ModuleName, SetLastError = true)]
  691. public static extern int SetConsoleCursorInfo(
  692. [In] IntPtr hConsoleOutput,
  693. [In] IntPtr lpConsoleCursorInfo);
  694. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  695. public static extern int SetConsoleCursorInfo(
  696. [In] IntPtr hConsoleOutput,
  697. [In] ref CONSOLE_CURSOR_INFO lpConsoleCursorInfo);
  698. [DllImport(ModuleName, SetLastError = true)]
  699. public static extern int SetConsoleCursorPosition(
  700. [In] IntPtr hConsoleOutput,
  701. [In] COORD dwCursorPosition);
  702. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  703. public static extern int SetConsoleDisplayMode(
  704. [In] IntPtr hConsoleOutput,
  705. [In] uint dwFlags,
  706. [In] IntPtr lpNewScreenBufferDimensions);
  707. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  708. public static extern int SetConsoleDisplayMode(
  709. [In] IntPtr hConsoleOutput,
  710. [In] uint dwFlags,
  711. [In] ref COORD lpNewScreenBufferDimensions);
  712. [DllImport(ModuleName, SetLastError = true)]
  713. public static extern int SetConsoleHistoryInfo(
  714. [In] IntPtr lpConsoleHistoryInfo);
  715. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  716. public static extern int SetConsoleHistoryInfo(
  717. [In] ref CONSOLE_HISTORY_INFO lpConsoleHistoryInfo);
  718. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  719. public static extern int SetConsoleMode(
  720. [In] IntPtr hConsoleHandle,
  721. [In] uint dwMode);
  722. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  723. public static extern int SetConsoleOutputCP(
  724. [In] uint wCodePageId);
  725. [DllImport(ModuleName, SetLastError = true)]
  726. public static extern int SetConsoleScreenBufferInfoEx(
  727. [In] IntPtr hConsoleOutput,
  728. [In] IntPtr lpConsoleScreenBufferInfoEx);
  729. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  730. public static extern int SetConsoleScreenBufferInfoEx(
  731. [In] IntPtr hConsoleOutput,
  732. [In] ref CONSOLE_SCREEN_BUFFER_INFOEX lpConsoleScreenBufferInfoEx);
  733. [DllImport(ModuleName, SetLastError = true)]
  734. public static extern int SetConsoleScreenBufferSize(
  735. [In] IntPtr hConsoleOutput,
  736. [In] COORD dwSize);
  737. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  738. public static extern int SetConsoleTextAttributes(
  739. [In] IntPtr hConsoleOutput,
  740. [In] ushort wAttributes);
  741. [DllImport(ModuleName, SetLastError = true)]
  742. public static extern int SetConsoleTitleA(
  743. [In] IntPtr lpConsoleTitle);
  744. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Ansi)]
  745. public static extern int SetConsoleTitleA(
  746. [In] string lpConsoleTitle);
  747. [DllImport(ModuleName, SetLastError = true)]
  748. public static extern int SetConsoleTitleW(
  749. [In] IntPtr lpConsoleTitle);
  750. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Unicode)]
  751. public static extern int SetConsoleTitleW(
  752. [In] string lpConsoleTitle);
  753. [DllImport(ModuleName, SetLastError = true)]
  754. public static extern int SetConsoleWindowInfo(
  755. [In] IntPtr hConsoleOutput,
  756. [In] int bAbsolute,
  757. [In] IntPtr lpConsoleWindow);
  758. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  759. public static extern int SetConsoleWindowInfo(
  760. [In] IntPtr hConsoleOutput,
  761. [In] int bAbsolute,
  762. [In] ref SMALL_RECT lpConsoleWindow);
  763. [DllImport(ModuleName, SetLastError = true)]
  764. public static extern int SetCurrentConsoleFontEx(
  765. [In] IntPtr hConsoleOutput,
  766. [In] int bMaximumWindow,
  767. [In] IntPtr lpConsoleCurrentFontEx);
  768. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  769. public static extern int SetCurrentConsoleFontEx(
  770. [In] IntPtr hConsoleOutput,
  771. [In] int bMaximumWindow,
  772. [In] ref CONSOLE_FONT_INFOEX lpConsoleCurrentFontEx);
  773. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  774. public static extern int SetStdHandle(
  775. [In] uint nStdHandle,
  776. [In] IntPtr hHandle);
  777. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Ansi), CLSCompliant(false)]
  778. public static extern int WriteConsoleA(
  779. [In] IntPtr hConsoleOutput,
  780. [In] IntPtr lpBuffer,
  781. [In] uint nNumberOfCharsToWrite,
  782. [Out] IntPtr lpNumberOfCharsWritten,
  783. IntPtr lpReserved);
  784. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Ansi), CLSCompliant(false)]
  785. public static extern int WriteConsoleA(
  786. [In] IntPtr hConsoleOutput,
  787. [In] IntPtr lpBuffer,
  788. [In] uint nNumberOfCharsToWrite,
  789. [Out] out uint lpNumberOfCharsWritten,
  790. IntPtr lpReserved);
  791. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Unicode), CLSCompliant(false)]
  792. public static extern int WriteConsoleW(
  793. [In] IntPtr hConsoleOutput,
  794. [In] IntPtr lpBuffer,
  795. [In] uint nNumberOfCharsToWrite,
  796. [Out] IntPtr lpNumberOfCharsWritten,
  797. IntPtr lpReserved);
  798. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Unicode), CLSCompliant(false)]
  799. public static extern int WriteConsoleW(
  800. [In] IntPtr hConsoleOutput,
  801. [In] IntPtr lpBuffer,
  802. [In] uint nNumberOfCharsToWrite,
  803. [Out] out uint lpNumberOfCharsWritten,
  804. IntPtr lpReserved);
  805. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Ansi), CLSCompliant(false)]
  806. public static extern int WriteConsoleInputA(
  807. [In] IntPtr hConsoleInput,
  808. [In] IntPtr lpBuffer,
  809. [In] uint nLength,
  810. [Out] IntPtr lpNumberOfEvnetsWritten);
  811. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Ansi), CLSCompliant(false)]
  812. public static extern int WriteConsoleInputA(
  813. [In] IntPtr hConsoleInput,
  814. [In] IntPtr lpBuffer,
  815. [In] uint nLength,
  816. [Out] out uint lpNumberOfEvnetsWritten);
  817. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Unicode), CLSCompliant(false)]
  818. public static extern int WriteConsoleInputW(
  819. [In] IntPtr hConsoleInput,
  820. [In] IntPtr lpBuffer,
  821. [In] uint nLength,
  822. [Out] IntPtr lpNumberOfEvnetsWritten);
  823. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Unicode), CLSCompliant(false)]
  824. public static extern int WriteConsoleInputW(
  825. [In] IntPtr hConsoleInput,
  826. [In] IntPtr lpBuffer,
  827. [In] uint nLength,
  828. [Out] out uint lpNumberOfEvnetsWritten);
  829. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Ansi)]
  830. public static extern int WriteConsoleOutputA(
  831. [In] IntPtr hConsoleOutput,
  832. [In] IntPtr lpBuffer,
  833. [In] COORD dwBufferSize,
  834. [In] COORD dwBufferCoord,
  835. [In, Out] IntPtr lpWriteRegion);
  836. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Ansi), CLSCompliant(false)]
  837. public static extern int WriteConsoleOutputA(
  838. [In] IntPtr hConsoleOutput,
  839. [In] ref CHAR_INFO lpBuffer,
  840. [In] COORD dwBufferSize,
  841. [In] COORD dwBufferCoord,
  842. [In, Out] ref SMALL_RECT lpWriteRegion);
  843. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Unicode)]
  844. public static extern int WriteConsoleOutputW(
  845. [In] IntPtr hConsoleOutput,
  846. [In] IntPtr lpBuffer,
  847. [In] COORD dwBufferSize,
  848. [In] COORD dwBufferCoord,
  849. [In, Out] IntPtr lpWriteRegion);
  850. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Unicode), CLSCompliant(false)]
  851. public static extern int WriteConsoleOutputW(
  852. [In] IntPtr hConsoleOutput,
  853. [In] ref CHAR_INFO lpBuffer,
  854. [In] COORD dwBufferSize,
  855. [In] COORD dwBufferCoord,
  856. [In, Out] ref SMALL_RECT lpWriteRegion);
  857. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  858. public static extern int WriteConsoleOutputAttribute(
  859. [In] IntPtr hConsoleOutput,
  860. [In] IntPtr lpAttribute,
  861. [In] uint nLength,
  862. [In] COORD dwWriteCoord,
  863. [Out] IntPtr lpNumberOfAttrsWritten);
  864. [DllImport(ModuleName, SetLastError = true), CLSCompliant(false)]
  865. public static extern int WriteConsoleOutputAttribute(
  866. [In] IntPtr hConsoleOutput,
  867. [In] ref ushort lpAttribute,
  868. [In] uint nLength,
  869. [In] COORD dwWriteCoord,
  870. [Out] out uint lpNumberOfAttrsWritten);
  871. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Ansi), CLSCompliant(false)]
  872. public static extern int WriteConsoleOutputCharacterA(
  873. [In] IntPtr hConsoleOutput,
  874. [In] IntPtr lpCharacter,
  875. [In] uint nLength,
  876. [In] COORD dwWriteCoord,
  877. [Out] IntPtr lpNumberOfCharsWritten);
  878. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Ansi), CLSCompliant(false)]
  879. public static extern int WriteConsoleOutputCharacterA(
  880. [In] IntPtr hConsoleOutput,
  881. [In] string lpCharacter,
  882. [In] uint nLength,
  883. [In] COORD dwWriteCoord,
  884. [Out] out uint lpNumberOfCharsWritten);
  885. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Unicode), CLSCompliant(false)]
  886. public static extern int WriteConsoleOutputCharacterW(
  887. [In] IntPtr hConsoleOutput,
  888. [In] IntPtr lpCharacter,
  889. [In] uint nLength,
  890. [In] COORD dwWriteCoord,
  891. [Out] IntPtr lpNumberOfCharsWritten);
  892. [DllImport(ModuleName, SetLastError = true, CharSet = CharSet.Unicode), CLSCompliant(false)]
  893. public static extern int WriteConsoleOutputCharacterW(
  894. [In] IntPtr hConsoleOutput,
  895. [In] string lpCharacter,
  896. [In] uint nLength,
  897. [In] COORD dwWriteCoord,
  898. [Out] out uint lpNumberOfCharsWr