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.

170 lines
5.7 KiB

  1. /**********************************************************************/
  2. /** Microsoft LAN Manager **/
  3. /** Copyright(c) Microsoft Corp., 1990, 1991 **/
  4. /**********************************************************************/
  5. /*
  6. uisys.hxx
  7. system related routines, like drive checking, etc.
  8. FILE HISTORY:
  9. ChuckC 18-Jan-1991 Created
  10. JonN 31-Jan-1991 Added File APIs
  11. JonN 22-Mar-1991 Coderev changes (2/20/91, JonN, RustanlL, ?)
  12. KeithMo 09-Oct-1991 Win32 Conversion.
  13. terryk 28-Feb-1992 Added more file io functions
  14. beng 29-Mar-1992 Remove odious PSZ type
  15. terryk 17-APr-1992 Added FileRead functions.
  16. JonN 19-May-1992 Added EnumAllDrives(), LPTs, Comms
  17. */
  18. /*
  19. * check for valid devices
  20. */
  21. DLL_BASED
  22. APIERR CheckLocalDrive( const TCHAR *DeviceName ) ;
  23. DLL_BASED
  24. APIERR CheckLocalLpt( const TCHAR * pszDeviceName ) ;
  25. DLL_BASED
  26. APIERR CheckLocalComm( const TCHAR * pszDeviceName ) ;
  27. /*
  28. * enumerate local devices
  29. */
  30. DLL_BASED
  31. ULONG EnumLocalDrives() ;
  32. DLL_BASED
  33. ULONG EnumLocalLPTs() ;
  34. DLL_BASED
  35. ULONG EnumLocalComms() ;
  36. /*
  37. * enumerate redirected devices
  38. */
  39. DLL_BASED
  40. ULONG EnumNetDrives() ;
  41. DLL_BASED
  42. ULONG EnumNetLPTs() ;
  43. DLL_BASED
  44. ULONG EnumNetComms() ;
  45. /*
  46. * check unavail devices
  47. */
  48. DLL_BASED
  49. APIERR CheckUnavailDevice(const TCHAR * pszDevice, TCHAR * pszRemote, INT *psType) ;
  50. /*
  51. * enumerate unavail devices
  52. */
  53. DLL_BASED
  54. ULONG EnumUnavailDrives() ;
  55. DLL_BASED
  56. ULONG EnumUnavailLPTs() ;
  57. DLL_BASED
  58. ULONG EnumUnavailComms() ;
  59. /*
  60. * enumerate all devices (all valid designations for a device of this type)
  61. */
  62. DLL_BASED
  63. ULONG EnumAllDrives() ;
  64. DLL_BASED
  65. ULONG EnumAllLPTs() ;
  66. DLL_BASED
  67. ULONG EnumAllComms() ;
  68. /****************************************************************************\
  69. *
  70. *NAME File APIs
  71. *
  72. *SYNOPSIS: These APIs are primitive File IO operations using ULONG as
  73. * a file handle. They provide line-oriented access to text
  74. * files. Equivalent functionality is available under both
  75. * Windows and DOS/OS2, although error reporting is more limited
  76. * under Windows.
  77. *
  78. *INTERFACE:
  79. *
  80. * APIERR FileOpenRead( PULONG pulFileHandle, const TCHAR * cpszFileName ) ;
  81. * Opens a file for reading only. Returns FAPI error code.
  82. * Windows returns only NO_ERROR or ERROR_FILE_NOT_FOUND.
  83. *
  84. * APIERR FileOpenWrite( PULONG pulFileHandle, const TCHAR * cpszFileName ) ;
  85. * Creates a new file, deleting any existing file. Returns
  86. * FAPI error code. Windows returns only NO_ERROR or
  87. * ERROR_WRITE_FAULT.
  88. *
  89. * APIERR FileClose( ULONG ulFileHandle ) ;
  90. * Closes a file opened by FileOpenRead or FileOpenWrite.
  91. * Returns FAPI error code. Windows returns only NO_ERROR
  92. * or ERROR_READ_FAULT (regardless of whether file was
  93. * opened for reading or writing). Do not close if file
  94. * was not successfully opened.
  95. *
  96. * APIERR FileReadLine( ULONG ulFileHandle, PSZ pszBuffer, UINT cbBuffer ) ;
  97. * Reads a single line from the file, where a line is
  98. * terminated by '\n'. Termination is left on the string.
  99. * Returns ERROR_INSUFFICIENT_BUFFER to indicate EOF as well
  100. * as a line longer than cbBuffer.
  101. *
  102. * APIERR FileWriteLine( ULONG ulFileHandle, const TCHAR * cpszBuffer ) ;
  103. * Writes a null-terminated string to the file. Be sure
  104. * that the string is "\r\n" terminated.
  105. *
  106. *
  107. *
  108. *CAVEATS: Windows cannot return as wide a variety of error codes as
  109. * OS2, so Windows programs should take return codes
  110. * other than NO_ERROR with a grain of salt.
  111. *
  112. * Treat the ULONG file handles as you would DosOpen file
  113. * handles, e.g.
  114. * - do not use before opening file
  115. * - do not read file opened with FileOpenWrite, or vice versa
  116. * - always close successfully opened files
  117. *
  118. *
  119. *NOTES:
  120. *
  121. *HISTORY: JonN 31-Jan-1991 Created
  122. * JonN 21-Mar-1991 Code review changes from 2/20/91 (attended
  123. * by JonN, RustanL, ?)
  124. * terryk 28-Feb-1992 Added
  125. * FileReadBuffer
  126. * FileWriteBuffer
  127. * FileSeekAbsolute
  128. * FileSeekRelative
  129. * FileSeekFromEnd
  130. * FileTell
  131. *
  132. \****************************************************************************/
  133. DLL_BASED
  134. APIERR FileOpenRead( ULONG * pulFileHandle, const TCHAR * cpszFileName ) ;
  135. DLL_BASED
  136. APIERR FileOpenWrite( ULONG * pulFileHandle, const TCHAR * cpszFileName ) ;
  137. DLL_BASED
  138. APIERR FileOpenReadWrite( ULONG *pulFileHandle, const TCHAR * cpszFileName ) ;
  139. DLL_BASED
  140. APIERR FileClose( ULONG ulFileHandle ) ;
  141. DLL_BASED
  142. APIERR FileReadLine( ULONG ulFileHandle, TCHAR * pszBuffer, UINT cbBuffer ) ;
  143. DLL_BASED
  144. APIERR FileWriteLine( ULONG ulFileHandle, const TCHAR * cpszBuffer ) ;
  145. DLL_BASED
  146. APIERR FileWriteLineAnsi( ULONG ulFileHandle, const CHAR * pszBuffer,
  147. UINT cbBuffer ) ;
  148. DLL_BASED
  149. APIERR FileReadBuffer( ULONG ulFileHandle, BYTE * pszBuffer, UINT cbBuffer, UINT *pcbReceived );
  150. DLL_BASED
  151. APIERR FileWriteBuffer( ULONG ulFileHandle, const BYTE * cpszBuffer, UINT cbBuffer, UINT *pcbSent );
  152. DLL_BASED
  153. APIERR FileSeekAbsolute( ULONG ulFileHandle, LONG lOffset );
  154. DLL_BASED
  155. APIERR FileSeekRelative( ULONG ulFileHandle, LONG lOffset );
  156. DLL_BASED
  157. APIERR FileSeekFromEnd( ULONG ulFileHanlde, LONG lOffset );
  158. DLL_BASED
  159. APIERR FileTell( ULONG ulFileHandle, LONG * pcbPosition );