Source code of Windows XP (NT5)
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.

313 lines
11 KiB

  1. #pragma once
  2. class CFindFile
  3. {
  4. public:
  5. CFindFile() :
  6. m_hFind(INVALID_HANDLE_VALUE) {}
  7. ~CFindFile();
  8. public:
  9. BOOL First(PCTSTR pcszFileName);
  10. BOOL Next();
  11. PWIN32_FIND_DATA Found();
  12. protected:
  13. HANDLE m_hFind;
  14. WIN32_FIND_DATA m_FindData;
  15. };
  16. void xGetOverlappedResult(
  17. HANDLE hFile,
  18. LPOVERLAPPED lpOverlapped,
  19. LPDWORD lpNumberOfBytesTransferred,
  20. BOOL bWait);
  21. HANDLE xCreateFile(
  22. PCTSTR pcszFileName, // file name
  23. DWORD dwDesiredAccess, // access mode
  24. DWORD dwShareMode, // share mode
  25. PSECURITY_ATTRIBUTES pSecurityAttributes, // SD
  26. DWORD dwCreationDisposition, // how to create
  27. DWORD dwFlagsAndAttributes, // file attributes
  28. HANDLE hTemplateFile); // handle to template file
  29. void xCloseHandle(
  30. HANDLE hObject); // handle to object
  31. BOOL xReadFile(
  32. HANDLE hFile, // handle to file
  33. PVOID pBuffer, // data buffer
  34. DWORD dwNumberOfBytesToRead, // number of bytes to read
  35. PDWORD pdwNumberOfBytesRead, // number of bytes read
  36. LPOVERLAPPED pOverlapped); // overlapped buffer
  37. void xReadFileWithAbort(
  38. HANDLE hFile, // handle to file
  39. PVOID pBuffer, // data buffer
  40. DWORD dwNumberOfBytesToRead, // number of bytes to read
  41. PDWORD pdwNumberOfBytesRead, // number of bytes read
  42. LPOVERLAPPED pOverlapped, // overlapped buffer
  43. HANDLE hAbort); // Handle to manual reset abort event
  44. BOOL xWriteFile(
  45. HANDLE hFile, // handle to file
  46. LPCVOID pBuffer, // data buffer
  47. DWORD dwNumberOfBytesToWrite, // number of bytes to write
  48. PDWORD pdwNumberOfBytesWritten, // number of bytes written
  49. LPOVERLAPPED pOverlapped); // overlapped buffer
  50. void xWriteFileWithAbort(
  51. HANDLE hFile, // handle to file
  52. LPCVOID pBuffer, // data buffer
  53. DWORD dwNumberOfBytesToWrite, // number of bytes to write
  54. PDWORD pdwNumberOfBytesWritten, // number of bytes written
  55. LPOVERLAPPED pOverlapped, // overlapped buffer
  56. HANDLE hAbort); // Handle to manual reset abort event
  57. void xGetCommState(
  58. HANDLE hFile, // handle to communications device
  59. LPDCB pDCB); // device-control block
  60. void xSetCommState(
  61. HANDLE hFile, // handle to communications device
  62. LPDCB pDCB); // device-control block
  63. void xGetCommTimeouts(
  64. HANDLE hFile, // handle to comm device
  65. LPCOMMTIMEOUTS pCommTimeouts); // time-out values
  66. void xSetCommTimeouts(
  67. HANDLE hFile, // handle to comm device
  68. LPCOMMTIMEOUTS pCommTimeouts); // time-out values
  69. void xSetCommMask(
  70. HANDLE hFile, // handle to communications device
  71. DWORD dwEvtMask); // mask that identifies enabled events
  72. void xGetCommMask(
  73. HANDLE hFile, // handle to communications device
  74. PDWORD pdwEvtMask); // mask that identifies enabled events
  75. BOOL xWaitCommEvent(
  76. HANDLE hFile, // handle to comm device
  77. PDWORD pdwEvtMask, // event type
  78. LPOVERLAPPED pOverlapped); // overlapped structure
  79. void xWaitCommEventWithAbort(
  80. HANDLE hFile, // handle to comm device
  81. PDWORD pdwEvtMask, // event type
  82. LPOVERLAPPED pOverlapped, // overlapped structure
  83. HANDLE hAbort); // Manual reset abort event
  84. void xEscapeCommFunction(
  85. HANDLE hFile, // handle to communications device
  86. DWORD dwFunc); // extended function to perform
  87. void xClearCommBreak(
  88. HANDLE hFile); // handle to communications device
  89. void xClearCommError(
  90. HANDLE hFile, // handle to communications device
  91. PDWORD pdwErrors, // error codes
  92. LPCOMSTAT pStat); // communications status
  93. void xBuildCommDCB(
  94. PCTSTR pcszDef, // device-control string
  95. LPDCB lpDCB); // device-control block
  96. void xTransmitCommChar(
  97. HANDLE hFile,
  98. char cChar);
  99. HANDLE xCreateThread(
  100. LPSECURITY_ATTRIBUTES lpThreadAttributes, // SD
  101. DWORD dwStackSize, // initial stack size
  102. LPTHREAD_START_ROUTINE lpStartAddress, // thread function
  103. LPVOID lpParameter, // thread argument
  104. DWORD dwCreationFlags, // creation option
  105. LPDWORD lpThreadId); // thread identifier
  106. void xTerminateThread(
  107. HANDLE hThread, // handle to thread
  108. DWORD dwExitCode); // exit code
  109. UINT_PTR xSetTimer(
  110. HWND hWnd, // handle to window
  111. UINT_PTR nIDEvent, // timer identifier
  112. UINT uElapse, // time-out value
  113. TIMERPROC lpTimerFunc); // timer procedure
  114. void xKillTimer(
  115. HWND hWnd, // handle to window
  116. UINT_PTR uIDEvent); // timer identifier
  117. void xFillConsoleOutputAttribute(
  118. HANDLE hConsoleOutput, // handle to screen buffer
  119. WORD wAttribute, // color attribute
  120. DWORD nLength, // number of cells
  121. COORD dwWriteCoord, // first coordinates
  122. LPDWORD lpNumberOfAttrsWritten // number of cells written
  123. );
  124. void xFillConsoleOutputCharacter(
  125. HANDLE hConsoleOutput, // handle to screen buffer
  126. TCHAR cCharacter, // character
  127. DWORD nLength, // number of cells
  128. COORD dwWriteCoord, // first coordinates
  129. LPDWORD lpNumberOfCharsWritten // number of cells written
  130. );
  131. void xGetConsoleScreenBufferInfo(
  132. HANDLE hConsoleOutput, // handle to screen buffer
  133. PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo // screen buffer information
  134. );
  135. DWORD xGetConsoleTitle(
  136. LPTSTR lpConsoleTitle, // console title
  137. DWORD nSize // size of title buffer
  138. );
  139. COORD xGetLargestConsoleWindowSize(
  140. HANDLE hConsoleOutput // handle to screen buffer
  141. );
  142. HANDLE xGetStdHandle(
  143. DWORD nStdHandle = STD_OUTPUT_HANDLE);// Input, output or error device
  144. void xReadConsoleOutputAttribute(
  145. HANDLE hConsoleOutput, // handle to screen buffer
  146. LPWORD lpAttribute, // attributes buffer
  147. DWORD nLength, // number of cells to read
  148. COORD dwReadCoord, // coordinates of first cell
  149. LPDWORD lpNumberOfAttrsRead // number of cells read
  150. );
  151. void xReadConsoleOutputCharacter(
  152. HANDLE hConsoleOutput, // handle to screen buffer
  153. LPTSTR lpCharacter, // character buffer
  154. DWORD nLength, // number of cells to read
  155. COORD dwReadCoord, // coordinates of first cell
  156. LPDWORD lpNumberOfCharsRead // number of cells read
  157. );
  158. void xSetConsoleScreenBufferSize(
  159. HANDLE hConsoleOutput, // handle to screen buffer
  160. COORD dwSize // new screen buffer size
  161. );
  162. void xSetConsoleTextAttribute(
  163. HANDLE hConsoleOutput, // handle to screen buffer
  164. WORD wAttributes // text and background colors
  165. );
  166. void xSetConsoleTitle(
  167. LPCTSTR lpConsoleTitle // new console title
  168. );
  169. void xSetConsoleWindowInfo(
  170. HANDLE hConsoleOutput, // handle to screen buffer
  171. BOOL bAbsolute, // coordinate type
  172. CONST SMALL_RECT *lpConsoleWindow // window corners
  173. );
  174. void xWriteConsole(
  175. HANDLE hConsoleOutput, // handle to screen buffer
  176. CONST VOID *lpBuffer, // write buffer
  177. DWORD nNumberOfCharsToWrite, // number of characters to write
  178. LPDWORD lpNumberOfCharsWritten, // number of characters written
  179. LPVOID lpReserved // reserved
  180. );
  181. void xWriteConsoleOutputAttribute(
  182. HANDLE hConsoleOutput, // handle to screen buffer
  183. CONST WORD *lpAttribute, // write attributes
  184. DWORD nLength, // number of cells
  185. COORD dwWriteCoord, // first cell coordinates
  186. LPDWORD lpNumberOfAttrsWritten // number of cells written
  187. );
  188. void xWriteConsoleOutputCharacter(
  189. HANDLE hConsoleOutput, // handle to screen buffer
  190. LPCTSTR lpCharacter, // characters
  191. DWORD nLength, // number of characters to write
  192. COORD dwWriteCoord, // first cell coordinates
  193. LPDWORD lpNumberOfCharsWritten // number of cells written
  194. );
  195. HANDLE xCreateEvent(
  196. LPSECURITY_ATTRIBUTES lpEventAttributes, // SD
  197. BOOL bManualReset, // reset type
  198. BOOL bInitialState, // initial state
  199. LPCTSTR lpName); // object name
  200. void xSetEvent(
  201. HANDLE hEvent);
  202. void xResetEvent(
  203. HANDLE hEvent);
  204. DWORD xWaitForMultipleObjects(
  205. DWORD nCount, // number of handles in array
  206. CONST HANDLE *lpHandles, // object-handle array
  207. BOOL fWaitAll, // wait option
  208. DWORD dwMilliseconds); // time-out interval
  209. DWORD xWaitForSingleObject(
  210. HANDLE hHandle, // handle to object
  211. DWORD dwMilliseconds); // time-out interval
  212. PWSTR xMultiByteToWideChar(
  213. UINT CodePage, // code page
  214. DWORD dwFlags, // performance and mapping flags
  215. LPCSTR lpMultiByteStr); // wide-character string
  216. PSTR xWideCharToMultiByte(
  217. UINT CodePage, // code page
  218. DWORD dwFlags, // performance and mapping flags
  219. LPCWSTR lpWideCharStr); // wide-character string
  220. PWSTR xMakeWideChar(
  221. PTSTR pcszInput);
  222. PSTR xMakeMultiByte(
  223. PTSTR pcszInput);
  224. PTSTR xMakeDefaultChar(
  225. PWSTR pcszInput);
  226. PTSTR xMakeDefaultChar(
  227. PSTR pcszInput);
  228. DWORD xGetModuleFileName(
  229. HMODULE hModule, // handle to module
  230. LPTSTR lpFilename, // file name of module
  231. DWORD nSize // size of buffer
  232. );
  233. HANDLE xFindFirstFile(
  234. LPCTSTR lpFileName, // file name
  235. LPWIN32_FIND_DATA lpFindFileData);// data buffer
  236. BOOL xFindNextFile(
  237. HANDLE hFindFile, // search handle
  238. LPWIN32_FIND_DATA lpFindFileData);// data buffer
  239. HMODULE xLoadLibrary(
  240. LPCTSTR lpFileName); // file name of module
  241. FARPROC xGetProcAddress(
  242. HMODULE hModule,
  243. LPCSTR lpProcName);
  244. HANDLE xCreateMutex(
  245. LPSECURITY_ATTRIBUTES lpMutexAttributes, // SD
  246. BOOL bInitialOwner, // initial owner
  247. LPCTSTR lpName); // object name
  248. void xReleaseMutex(
  249. HANDLE hMutex);