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.

232 lines
8.5 KiB

  1. #########################################################
  2. #
  3. # Copyright (c) 1998-1999 Microsoft Corporation
  4. #
  5. # Module Name:
  6. #
  7. # NTFRSCON.pl
  8. #
  9. # Abstract:
  10. #
  11. # This is the Perl Script that Generates the files:
  12. # 1. NTFRSCON.h 2. NTFRSCON.ini 3. REPCONN.h 4. REPCONN.c
  13. # It uses the file NTFRSCON.int to generate them
  14. #
  15. # Author:
  16. #
  17. # Rohan Kumar [rohank] 28-Aug-1998
  18. #
  19. # Environment:
  20. #
  21. # User Mode Service
  22. #
  23. # Revision History:
  24. #
  25. ###########################################################
  26. # Create the file NTFRSCON.h and write the header to it
  27. open(HFILE, ">NTFRSCON.h"); # file creation
  28. print HFILE "/*++\n\n";
  29. print HFILE "WARNING!!!\n\n";
  30. print HFILE "\tThis file is automatically generated and should never be changed.\n";
  31. print HFILE "\tAll changes should be made to the NTFRSCON.int file.\n\n";
  32. print HFILE "Copyright (c) 1998-1999 Microsoft Corporation\n\n";
  33. print HFILE "Module Name:\n\n";
  34. print HFILE "\tNTFRSCON.h\n\n";
  35. print HFILE "Abstract\n\n";
  36. print HFILE "\tThis is the offset definition file for the REPLICACONN Object.\n\n";
  37. print HFILE "Environment:\n\n";
  38. print HFILE "\tUser Mode Service\n\n";
  39. print HFILE "Revision History:\n\n";
  40. print HFILE "--*/\n\n\n";
  41. print HFILE "#ifndef _NTFRSCON_H_\n";
  42. print HFILE "#define _NTFRSCON_H_\n\n";
  43. # Define the offset definitions
  44. print HFILE "//\n";
  45. print HFILE "// The offset definitions follow\n";
  46. print HFILE "//\n";
  47. print HFILE "#define OBJREPLICACONN 0 // REPLICACONN Object\n\n";
  48. # Create the file NTFRSCON.ini and write the header to it
  49. open(INIFILE, ">NTFRSCON.ini"); # file creation
  50. print INIFILE "/*++\n\n";
  51. print INIFILE "WARNING!!!\n\n";
  52. print INIFILE "\tThis file is automatically generated and should never be changed.\n";
  53. print INIFILE "\tAll changes should be made to the NTFRSCON.int file.\n\n";
  54. print INIFILE "Copyright (c) 1998-1999 Microsoft Corporation\n\n";
  55. print INIFILE "Module Name:\n\n";
  56. print INIFILE "\tNTFRSCON.ini\n\n";
  57. print INIFILE "Abstract\n\n";
  58. print INIFILE "\tThis is the .ini file that defines the Object name, counter names and the\n";
  59. print INIFILE "\tExplain text for the REPLICACONN Object.\n\n";
  60. print INIFILE "Environment:\n\n";
  61. print INIFILE "\tUser Mode Service\n\n";
  62. print INIFILE "Revision History:\n\n";
  63. print INIFILE "--*/\n\n";
  64. # Add the static lines
  65. print INIFILE "[info]\n";
  66. print INIFILE "drivername=FileReplicaConn\n";
  67. print INIFILE "symbolfile=NTFRSCON.h\n\n";
  68. print INIFILE "[objects]\n";
  69. print INIFILE "OBJREPLICACONN_009_NAME=FileReplicaConn\n\n";
  70. print INIFILE "[languages]\n";
  71. print INIFILE "009=English\n\n";
  72. print INIFILE "[text]\n";
  73. print INIFILE "OBJREPLICACONN_009_NAME=FileReplicaConn\n";
  74. print INIFILE "OBJREPLICACONN_009_HELP=Displays Performance statistics of the REPLICACONN Object.\n\n";
  75. # Create the file REPCONN.c and write the header to it
  76. open(CFILE, ">..\\REPCONN.c"); # file creation
  77. print CFILE "/*++\n\n";
  78. print CFILE "WARNING!!!\n\n";
  79. print CFILE "\tThis file is automatically generated and should never be changed.\n";
  80. print CFILE "\tAll changes should be made to the NTFRSCON.int file.\n\n";
  81. print CFILE "Copyright (c) 1998-1999 Microsoft Corporation\n\n";
  82. print CFILE "Module Name:\n\n";
  83. print CFILE "\tREPCONN.c\n\n";
  84. print CFILE "Abstract\n\n";
  85. print CFILE "\tThis is the file that conatins the initialization values of the PERF_COUNTER_DEFINITION\n";
  86. print CFILE "\tarray which is initialized in the Open function of the REPLICACONN Object\n\n";
  87. print CFILE "Environment:\n\n";
  88. print CFILE "\tUser Mode Service\n\n";
  89. print CFILE "Revision History:\n\n";
  90. print CFILE "--*/\n\n";
  91. print CFILE "#include \"..\\PERFDLL\\REPCONN.h\"\n\n";
  92. # declare the array variable which contains the values
  93. print CFILE "// Initialize the RepConnInitData structure used in the Open function\n\n";
  94. print CFILE "ReplicaConnValues RepConnInitData[FRC_NUMOFCOUNTERS] = {\n\n";
  95. # All the headers are now done. Open the NTFRSCON.int file and fill in the rest
  96. # of the data in these files.
  97. open(INTFLE, "<NTFRSCON.int") or die "Can't open NTFRSCON.int: $!\n";
  98. # Set the initial values of variables
  99. $HCount = 1;
  100. $HValue = 2;
  101. MAIN: while ($line = <INTFLE>) {
  102. # skip the comments (which is a line
  103. # whose very first character is a '#')
  104. # and new lines
  105. next MAIN if $line =~ /^#/;
  106. if ($line eq "\n") {
  107. next MAIN;
  108. }
  109. # remove the new line in the end
  110. chop($line);
  111. # Exit if EOF has been reached
  112. if ($line eq "EOF") {
  113. last MAIN;
  114. }
  115. # Set the appropriate fields from the line
  116. ($Flags, $VarName, $NameStr, $CtrType, $HelpStr) = split(":", $line);
  117. # Set the NTFRSCON.h file
  118. print HFILE "#define DEV_CTR_$HCount $HValue // $NameStr\n";
  119. # Set the NTFRSCON.ini file
  120. print INIFILE "DEV_CTR_";
  121. print INIFILE $HCount;
  122. print INIFILE "_009_NAME=$NameStr\n";
  123. print INIFILE "DEV_CTR_";
  124. print INIFILE $HCount;
  125. print INIFILE "_009_HELP=$HelpStr\n\n";
  126. # Set the REPCONN.c file
  127. if ($HCount > 1) {
  128. print CFILE "\t},\n\n";
  129. }
  130. print CFILE "\t{\n";
  131. print CFILE "\t(PWCHAR)\"$NameStr\",\n";
  132. print CFILE "\tSIZEOF(ReplicaConnCounters, $VarName),\n";
  133. print CFILE "\tOFFSET(ReplicaConnCounters, $VarName),\n";
  134. print CFILE "\tPERF_COUNTER_$CtrType, $Flags\n";
  135. # Increment the HCount and HValue values
  136. $HCount = $HCount + 1;
  137. $HValue = $HValue + 2;
  138. }
  139. # Print the closing brace of REPCONN.c
  140. print CFILE "\t}\n\n";
  141. print CFILE "};\n";
  142. # Print the endif for NTFRSCON.h
  143. print HFILE "\n#endif\n";
  144. # Make HCount equal to the number of counters
  145. $HCount = $HCount - 1;
  146. # Create the file REPCONN.h and write the header to it
  147. open(RFILE, ">REPCONN.h"); # file creation
  148. print RFILE "/*++\n\n";
  149. print RFILE "WARNING!!!\n\n";
  150. print RFILE "\tThis file is automatically generated and should never be changed.\n";
  151. print RFILE "\tAll changes should be made to the NTFRSCON.int file.\n\n";
  152. print RFILE "Copyright (c) 1998-1999 Microsoft Corporation\n\n";
  153. print RFILE "Module Name:\n\n";
  154. print RFILE "\tREPCONN.h\n\n";
  155. print RFILE "Abstract\n\n";
  156. print RFILE "\tThis is the header file for the REPLICACONN Object data definition.\n";
  157. print RFILE "\tIt contains definitions to construct the dynamic data which is returned\n";
  158. print RFILE "\tby the Configuration Registry.\n\n";
  159. print RFILE "Environment:\n\n";
  160. print RFILE "\tUser Mode Service\n\n";
  161. print RFILE "Revision History:\n\n";
  162. print RFILE "--*/\n\n\n";
  163. print RFILE "#ifndef _REPCONN_H_\n";
  164. print RFILE "#define _REPCONN_H_\n\n";
  165. print RFILE "#include <perrepsr.h> // The counter structures header file\n";
  166. print RFILE "#include <perffrs.h> // The RPC generated header file\n";
  167. print RFILE "#include <winperf.h> // The PERFMON header file\n\n";
  168. print RFILE "//\n";
  169. print RFILE "// Number of objects being monitored\n";
  170. print RFILE "//\n";
  171. print RFILE "#define REPLICACONN_NUM_PERF_OBJECT_TYPES 1\n\n";
  172. print RFILE "//\n";
  173. print RFILE "// Size of DWORD\n";
  174. print RFILE "//\n";
  175. print RFILE "#define CSIZEOFDWORD sizeof(DWORD)\n\n";
  176. print RFILE "//\n";
  177. print RFILE "// Number of ReplicaConn Counters\n";
  178. print RFILE "//\n";
  179. print RFILE "#define FRC_NUMOFCOUNTERS ";
  180. print RFILE $HCount;
  181. print RFILE "\n\n";
  182. print RFILE "//\n";
  183. print RFILE "// Flag bit defs\n";
  184. print RFILE "//\n";
  185. print RFILE "#define PM_RS_FLAG_SVC_WIDE 0x00000001\n\n";
  186. print RFILE "//\n";
  187. print RFILE "// Structure which is used in the Open function Initialization\n";
  188. print RFILE "//\n";
  189. print RFILE "typedef struct _REPLICACONN_VALUES {\n";
  190. print RFILE "\tPWCHAR name; // name of the counter\n";
  191. print RFILE "\tDWORD size; // size of the counter type\n";
  192. print RFILE "\tDWORD offset; // offset of the counter in the structure\n";
  193. print RFILE "\tDWORD counterType; // Type of (PERFMON) counter\n";
  194. print RFILE "\tDWORD Flags; // Flags. see def above.\n";
  195. print RFILE "} ReplicaConnValues;\n\n";
  196. print RFILE "//\n";
  197. print RFILE "// Counter Structure returned by the REPLICACONN Object\n";
  198. print RFILE "//\n";
  199. print RFILE "typedef struct _REPLICACONN_DATA_DEFINITION {\n";
  200. print RFILE "\tPERF_OBJECT_TYPE ReplicaConnObjectType; // ReplicaConn Object\n";
  201. print RFILE "\tPERF_COUNTER_DEFINITION NumStat[FRC_NUMOFCOUNTERS]; // The array of PERF_COUNTER_DEFINITION structures\n";
  202. print RFILE "} REPLICACONN_DATA_DEFINITION;\n\n\n";
  203. print RFILE "#endif\n";
  204. # Close all the Open file handles
  205. close (HFILE);
  206. close (INIFILE);
  207. close (INTFLE);
  208. close (CFILE);
  209. close (RFILE);