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.

233 lines
6.5 KiB

  1. ;/*
  2. ; * Microsoft Confidential
  3. ; * Copyright (C) Microsoft Corporation 1988 - 1991
  4. ; * All Rights Reserved.
  5. ; */
  6. /* MEM.H - general equates and externals for the MEM command.
  7. * Extracted from the original MEM.C file.
  8. */
  9. /* Structure definitions */
  10. struct DEVICEHEADER {
  11. struct DEVICEHEADER far *NextDeviceHeader;
  12. unsigned Attributes;
  13. unsigned Strategy;
  14. unsigned Interrupt;
  15. char Name[8];
  16. };
  17. struct SYSIVAR {
  18. char far *DpbChain;
  19. char far *SftChain;
  20. char far *Clock;
  21. char far *Con;
  22. unsigned MaxSectorSize;
  23. char far *BufferChain;
  24. char far *CdsList;
  25. char far *FcbChain;
  26. unsigned FcbKeepCount;
  27. unsigned char BlockDeviceCount;
  28. char CdsCount;
  29. struct DEVICEHEADER far *DeviceDriverChain;
  30. unsigned NullDeviceAttributes;
  31. unsigned NullDeviceStrategyEntryPoint;
  32. unsigned NullDeviceInterruptEntryPoint;
  33. char NullDeviceName[8];
  34. char SpliceIndicator;
  35. unsigned DosParagraphs;
  36. char far *DosServiceRntryPoint;
  37. char far *IfsChain;
  38. unsigned BufferValues;
  39. unsigned LastDriveValue;
  40. char BootDrive;
  41. char MoveType;
  42. unsigned ExtendedMemory;
  43. };
  44. struct ARENA {
  45. char Signature;
  46. unsigned Owner;
  47. unsigned Paragraphs;
  48. char Dummy[3];
  49. char OwnerName[8];
  50. };
  51. struct sublistx {
  52. unsigned char size; /* sublist size */
  53. unsigned char reserved; /* reserved for future growth */
  54. unsigned far *value; /* pointer to replaceable parm */
  55. unsigned char id; /* type of replaceable parm */
  56. unsigned char flags; /* how parm is to be displayed */
  57. unsigned char max_width; /* max width of replaceable field */
  58. unsigned char min_width; /* min width of replaceable field */
  59. unsigned char pad_char; /* pad character for replaceable field */
  60. };
  61. struct mem_classif { /* M003 - struct for storing sizes */
  62. unsigned int psp_add; /* acc. to PSPs */
  63. unsigned int mem_conv; /* conv.mem for PSP */
  64. unsigned int mem_umb; /* umb mem for PSP */
  65. };
  66. /* miscellaneous defines */
  67. #define DA_TYPE 0x8000;
  68. #define DA_IOCTL 0x4000;
  69. #define a(fp) ((char) fp)
  70. /* relevant DOS functions */
  71. #define GET_VECT 0x35
  72. #define GET_UMB_LINK_STATE 0x5802
  73. #define SET_UMB_LINK_STATE 0x5803
  74. #define LINK_UMBS 1
  75. #define UNLINK_UMBS 0
  76. #define EMS 0x67
  77. #define CASSETTE 0x15 /* interrupt to get extended memory */
  78. #define DOSEMSVER 0x40 /* EMS version */
  79. #define EMSGetStat 0x4000 /* get stat */
  80. #define EMSGetVer 0x4600 /* get version */
  81. #define EMSGetFreePgs 0x4200 /* get free pages */
  82. #define GetExtended 0x8800 /* get extended memory size */
  83. /* defines used by total memory determination */
  84. #define GET_PSP (unsigned char ) 0x62 /* get PSP function call */
  85. #define MEMORY_DET 0x12 /* BIOS interrupt used to get total memory size */
  86. #define FALSE (char)(1==0)
  87. #define TRUE !(FALSE)
  88. #define CR '\x0d'
  89. #define LF '\x0a'
  90. #define NUL (char) '\0'
  91. #define TAB '\x09'
  92. #define BLANK ' '
  93. #define MAX_CLDATA_INDEX 100
  94. /* max index no for mem_table array */
  95. /* this is the max no of progs or free arenas that mem/c can used */
  96. /* to process ; if the memory is fragmented and too many progs are */
  97. /* loaded such that this no exceeds 100, we terminate with errmsg */
  98. /* external variables */
  99. extern unsigned DOS_TopOfMemory; /* PSP Top of memory from 'C' init code */ /* ;an005; */
  100. extern unsigned far *ArenaHeadPtr;
  101. extern struct SYSIVAR far *SysVarsPtr;
  102. extern unsigned UMB_Head;
  103. extern unsigned LastPSP;
  104. extern char OwnerName[128];
  105. extern char TypeText[128];
  106. extern char cmd_line[128];
  107. extern char far *cmdline;
  108. extern char UseArgvZero;
  109. extern char EMSInstalledFlag;
  110. extern union REGS InRegs;
  111. extern union REGS OutRegs;
  112. extern struct SREGS SegRegs;
  113. extern int DataLevel;
  114. extern int Classify;
  115. extern int i;
  116. extern int BlockDeviceNumber;
  117. extern char *Parse_Ptr; /* ;an003; dms; pointer to command */
  118. extern struct mem_classif mem_table[MAX_CLDATA_INDEX];
  119. extern int noof_progs;
  120. extern struct sublistx sublist[5];
  121. extern char *SingleDrive;
  122. extern char *MultipleDrives;
  123. extern char *UnOwned;
  124. extern char *Ibmbio;
  125. extern char *Ibmdos;
  126. /* function prototypes */
  127. int main(void);
  128. int printf();
  129. int sprintf();
  130. int strcmp(const char *, const char *);
  131. int sscanf();
  132. void exit(int);
  133. int kbhit();
  134. char *OwnerOf(struct ARENA far *);
  135. char *TypeOf(struct ARENA far *);
  136. unsigned long AddressOf(char far *);
  137. void CSwitch_init(void);
  138. char EMSInstalled(void);
  139. void DisplayEMSSummary(void);
  140. void DisplayEMSDetail(void);
  141. void DisplayBaseSummary(void);
  142. void DisplayExtendedSummary(void);
  143. unsigned CheckDOSHigh(void);
  144. unsigned CheckVDisk(void);
  145. unsigned int DisplayBaseDetail(void);
  146. void DisplayClassification(void); /* M003 */
  147. unsigned long DispMemClass(int); /* M003 */
  148. void DispBigFree(char,unsigned int); /* M003 */
  149. unsigned int AddMem_to_PSP(unsigned int,unsigned long,unsigned long); /* M003 */
  150. void GetFromArgvZero(unsigned,unsigned far *);
  151. void DisplayDeviceDriver(struct DEVICEHEADER far *,int);
  152. void parse_init(void);
  153. void Parse_Message(int,int,unsigned char,char far *);
  154. void Sub0_Message(int,int,unsigned char);
  155. void Sub1_Message(int,int,unsigned char,unsigned long int *);
  156. void Sub2_Message(int,int,unsigned char,char *,int);
  157. void Sub3_Message(int,int,unsigned char,
  158. char *,
  159. unsigned long int *,
  160. int);
  161. void Sub4_Message(int,int,unsigned char,
  162. unsigned long int *,
  163. int,
  164. unsigned long int *,
  165. int);
  166. void Sub4a_Message(int,int,unsigned char,
  167. unsigned long int *,
  168. char *,
  169. unsigned long int *,
  170. char *);
  171. void EMSPrint(int,int,unsigned char,
  172. int *,
  173. char *,
  174. unsigned long int *);
  175. void SubC2_Message(int,int,unsigned long int*,char*); /* M003 */
  176. void SubC4_Message(int,int,char *,int, /* M003 */
  177. unsigned long int *,
  178. char *);
  179. extern void sysloadmsg(union REGS *, union REGS *);
  180. extern void sysdispmsg(union REGS *, union REGS *);
  181. extern void sysgetmsg(union REGS *, struct SREGS *, union REGS *);
  182. extern void parse(union REGS *, union REGS *);
  183.