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.

203 lines
6.5 KiB

  1. ;/*
  2. ; * Microsoft Confidential
  3. ; * Copyright (C) Microsoft Corporation 1991
  4. ; * All Rights Reserved.
  5. ; */
  6. /***************************************************************************/
  7. /* */
  8. /* SETVER.H */
  9. /* */
  10. /* Include file for MS-DOS set version program. */
  11. /* */
  12. /* johnhe 05-01-90 */
  13. /***************************************************************************/
  14. #pragma pack(1)
  15. /***************************************************************************/
  16. /* Normal variable typedefs. These type defs are compatible with OS2 */
  17. /* typedefs. */
  18. /***************************************************************************/
  19. typedef char CHAR;
  20. typedef unsigned char UCHAR;
  21. typedef int INT;
  22. typedef unsigned int UINT;
  23. typedef long LONG;
  24. typedef unsigned long UL;
  25. typedef float FLOAT;
  26. typedef double DOUBLE;
  27. /***************************************************************************/
  28. /* Standard global constants. */
  29. /* Don't change the TRUE define because some functions depend on it being */
  30. /* 1 instead of !FALSE. */
  31. /***************************************************************************/
  32. #ifndef FALSE
  33. #define FALSE 0
  34. #endif
  35. #ifndef TRUE
  36. #define TRUE 1
  37. #endif
  38. #define EOL '\0'
  39. #define HEX 16
  40. #define DECIMAL 10
  41. #define OCTAL 8
  42. /***************************************************************************/
  43. /* Module specific constants */
  44. /***************************************************************************/
  45. #define MAX_NAME_LEN 13
  46. #define MAX_ENTRY_SIZE (MAX_NAME_LEN + 1 + 2 + 1)
  47. #define MAX_PATH_LEN 68
  48. #define MAX_VERSION 0x0a00 /* Max version 9.99 */
  49. #define MIN_VERSION 0x020b /* Min version 2.11 */
  50. #define S_ERROR -1
  51. #define S_OK 0
  52. #define S_INVALID_SWITCH -1
  53. #define S_INVALID_FNAME -2
  54. #define S_MEMORY_ERROR -3
  55. #define S_BAD_VERSION_FMT -4
  56. #define S_ENTRY_NOT_FOUND -5
  57. #define S_FILE_NOT_FOUND -6
  58. #define S_BAD_DRV_SPEC -7
  59. #define S_TOO_MANY_PARMS -8
  60. #define S_MISSING_PARM -9 /* Missing version number or /d */
  61. #define S_FILE_READ_ERROR -10
  62. #define S_CORRUPT_TABLE -11
  63. #define S_INVALID_SIG -12
  64. #define S_NO_ROOM -13
  65. #define S_FILE_WRITE_ERROR -14
  66. #define S_INVALID_PATH -15
  67. #define DO_LIST 1
  68. #define DO_ADD_FILE 2
  69. #define DO_DELETE 3
  70. #define DO_HELP 4
  71. #define DO_QUIET 5
  72. #define VERSION_COLUMN 16 /* Screen column for version # */
  73. #define SIGNATURE_STR "PCMN" /* Signature string in MSDOS.SYS */
  74. #define SIGNATURE_LEN 4
  75. #define BUF_LEN 4096
  76. /***************************************************************************/
  77. /* Defines for possible command line switches. */
  78. /***************************************************************************/
  79. #define HELP_SWITCH "?"
  80. #define DEL_SWITCH "DELETE"
  81. #define SWITCH_CHAR '/'
  82. #define QUIET_SWITCH "QUIET"
  83. /***************************************************************************/
  84. struct TableEntry
  85. {
  86. char Drive;
  87. #ifdef JAPAN
  88. char Path[ MAX_PATH_LEN+10 ];
  89. #else
  90. char Path[ MAX_PATH_LEN ];
  91. #endif
  92. char szFileName[ MAX_NAME_LEN + 1 ];
  93. UCHAR MajorVer;
  94. UCHAR MinorVer;
  95. };
  96. struct ExeHeader
  97. {
  98. UINT Signature;
  99. UINT LastPageLen;
  100. UINT TotalFilePages;
  101. UINT NumRelocEntries;
  102. UINT HeaderParas;
  103. UINT MinEndParas;
  104. UINT MaxEndParas;
  105. UINT StackSeg;
  106. UINT StackPtr;
  107. UINT NegChkSum;
  108. UINT IndexPtr;
  109. UINT CodeSeg;
  110. UINT RelocTblOffset;
  111. UINT OverlayNum;
  112. };
  113. struct DevHeader
  114. {
  115. char far *NextDevice;
  116. unsigned DeviceAttrib;
  117. char near *Strategy;
  118. char near *Entry;
  119. char Name[ 8 ];
  120. char VersMinor;
  121. char VersMajor;
  122. long TblOffset;
  123. unsigned TblLen;
  124. };
  125. /***************************************************************************/
  126. /* Function prototypes for SETVER.C */
  127. /***************************************************************************/
  128. extern int main( int argc, char *argv[] );
  129. static int Error( int iErrCode );
  130. static int DoFunction( int iFunction );
  131. static void DisplayMsg( char *tbl[] );
  132. static int DeleteEntry( void );
  133. static int AddEntry( void );
  134. static int DisplayTable( void );
  135. static int MatchFile( char *pchStart, char *szFile );
  136. static int IsValidEntry( char *pchPtr );
  137. static char *GetNextFree( void );
  138. static int ReadVersionTable( void );
  139. static int WriteVersionTable( void );
  140. static int SeekRead( int iFile, void *Buf, long lOffset, unsigned uBytes );
  141. #ifdef BILINGUAL
  142. static int IsDBCSCodePage(void);
  143. #endif
  144. /***************************************************************************/
  145. /* Function prototypes for PARSE.C */
  146. /***************************************************************************/
  147. extern int ParseCmd( int argc, char *argv[], struct TableEntry *Entry );
  148. static int IsValidFile( char *szFileName );
  149. static UINT ParseVersion( char *szVersion );
  150. static int IsDigitStr( char *szStr );
  151. static char *SkipLeadingChr( char *szStr, char chChar );
  152. static void RemoveTrailing( char *szStr, char chChar );
  153. static int MatchSwitch( char *szCmdParm, char *szTestSwitch );
  154. static int IsValidFileName( char *szFile );
  155. static int IsReservedName( char *szFile );
  156. static int IsWildCards( char *szFile );
  157. static int ValidFileChar( char *szFile );
  158. static int IsValidFileChr( char Char );
  159. #ifdef DBCS
  160. static int IsDBCSLeadByte(unsigned char);
  161. static int CheckDBCSTailByte(unsigned char *,unsigned char *);
  162. #endif
  163. /***************************************************************************/
  164. /* Function prototypes for DOS.ASM */
  165. /***************************************************************************/
  166. extern int IsValidDrive( unsigned DrvLetter );
  167. extern void PutStr( char *String );
  168. extern long _dos_seek( int Handle, long lOffset, int Mode );
  169. extern int SetVerCheck ( void ); /* M001 */
  170.