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

#########################################################
#
# Copyright (c) 1998-1999 Microsoft Corporation
#
# Module Name:
#
# NTFRSCON.pl
#
# Abstract:
#
# This is the Perl Script that Generates the files:
# 1. NTFRSCON.h 2. NTFRSCON.ini 3. REPCONN.h 4. REPCONN.c
# It uses the file NTFRSCON.int to generate them
#
# Author:
#
# Rohan Kumar [rohank] 28-Aug-1998
#
# Environment:
#
# User Mode Service
#
# Revision History:
#
###########################################################
# Create the file NTFRSCON.h and write the header to it
open(HFILE, ">NTFRSCON.h"); # file creation
print HFILE "/*++\n\n";
print HFILE "WARNING!!!\n\n";
print HFILE "\tThis file is automatically generated and should never be changed.\n";
print HFILE "\tAll changes should be made to the NTFRSCON.int file.\n\n";
print HFILE "Copyright (c) 1998-1999 Microsoft Corporation\n\n";
print HFILE "Module Name:\n\n";
print HFILE "\tNTFRSCON.h\n\n";
print HFILE "Abstract\n\n";
print HFILE "\tThis is the offset definition file for the REPLICACONN Object.\n\n";
print HFILE "Environment:\n\n";
print HFILE "\tUser Mode Service\n\n";
print HFILE "Revision History:\n\n";
print HFILE "--*/\n\n\n";
print HFILE "#ifndef _NTFRSCON_H_\n";
print HFILE "#define _NTFRSCON_H_\n\n";
# Define the offset definitions
print HFILE "//\n";
print HFILE "// The offset definitions follow\n";
print HFILE "//\n";
print HFILE "#define OBJREPLICACONN 0 // REPLICACONN Object\n\n";
# Create the file NTFRSCON.ini and write the header to it
open(INIFILE, ">NTFRSCON.ini"); # file creation
print INIFILE "/*++\n\n";
print INIFILE "WARNING!!!\n\n";
print INIFILE "\tThis file is automatically generated and should never be changed.\n";
print INIFILE "\tAll changes should be made to the NTFRSCON.int file.\n\n";
print INIFILE "Copyright (c) 1998-1999 Microsoft Corporation\n\n";
print INIFILE "Module Name:\n\n";
print INIFILE "\tNTFRSCON.ini\n\n";
print INIFILE "Abstract\n\n";
print INIFILE "\tThis is the .ini file that defines the Object name, counter names and the\n";
print INIFILE "\tExplain text for the REPLICACONN Object.\n\n";
print INIFILE "Environment:\n\n";
print INIFILE "\tUser Mode Service\n\n";
print INIFILE "Revision History:\n\n";
print INIFILE "--*/\n\n";
# Add the static lines
print INIFILE "[info]\n";
print INIFILE "drivername=FileReplicaConn\n";
print INIFILE "symbolfile=NTFRSCON.h\n\n";
print INIFILE "[objects]\n";
print INIFILE "OBJREPLICACONN_009_NAME=FileReplicaConn\n\n";
print INIFILE "[languages]\n";
print INIFILE "009=English\n\n";
print INIFILE "[text]\n";
print INIFILE "OBJREPLICACONN_009_NAME=FileReplicaConn\n";
print INIFILE "OBJREPLICACONN_009_HELP=Displays Performance statistics of the REPLICACONN Object.\n\n";
# Create the file REPCONN.c and write the header to it
open(CFILE, ">..\\REPCONN.c"); # file creation
print CFILE "/*++\n\n";
print CFILE "WARNING!!!\n\n";
print CFILE "\tThis file is automatically generated and should never be changed.\n";
print CFILE "\tAll changes should be made to the NTFRSCON.int file.\n\n";
print CFILE "Copyright (c) 1998-1999 Microsoft Corporation\n\n";
print CFILE "Module Name:\n\n";
print CFILE "\tREPCONN.c\n\n";
print CFILE "Abstract\n\n";
print CFILE "\tThis is the file that conatins the initialization values of the PERF_COUNTER_DEFINITION\n";
print CFILE "\tarray which is initialized in the Open function of the REPLICACONN Object\n\n";
print CFILE "Environment:\n\n";
print CFILE "\tUser Mode Service\n\n";
print CFILE "Revision History:\n\n";
print CFILE "--*/\n\n";
print CFILE "#include \"..\\PERFDLL\\REPCONN.h\"\n\n";
# declare the array variable which contains the values
print CFILE "// Initialize the RepConnInitData structure used in the Open function\n\n";
print CFILE "ReplicaConnValues RepConnInitData[FRC_NUMOFCOUNTERS] = {\n\n";
# All the headers are now done. Open the NTFRSCON.int file and fill in the rest
# of the data in these files.
open(INTFLE, "<NTFRSCON.int") or die "Can't open NTFRSCON.int: $!\n";
# Set the initial values of variables
$HCount = 1;
$HValue = 2;
MAIN: while ($line = <INTFLE>) {
# skip the comments (which is a line
# whose very first character is a '#')
# and new lines
next MAIN if $line =~ /^#/;
if ($line eq "\n") {
next MAIN;
}
# remove the new line in the end
chop($line);
# Exit if EOF has been reached
if ($line eq "EOF") {
last MAIN;
}
# Set the appropriate fields from the line
($Flags, $VarName, $NameStr, $CtrType, $HelpStr) = split(":", $line);
# Set the NTFRSCON.h file
print HFILE "#define DEV_CTR_$HCount $HValue // $NameStr\n";
# Set the NTFRSCON.ini file
print INIFILE "DEV_CTR_";
print INIFILE $HCount;
print INIFILE "_009_NAME=$NameStr\n";
print INIFILE "DEV_CTR_";
print INIFILE $HCount;
print INIFILE "_009_HELP=$HelpStr\n\n";
# Set the REPCONN.c file
if ($HCount > 1) {
print CFILE "\t},\n\n";
}
print CFILE "\t{\n";
print CFILE "\t(PWCHAR)\"$NameStr\",\n";
print CFILE "\tSIZEOF(ReplicaConnCounters, $VarName),\n";
print CFILE "\tOFFSET(ReplicaConnCounters, $VarName),\n";
print CFILE "\tPERF_COUNTER_$CtrType, $Flags\n";
# Increment the HCount and HValue values
$HCount = $HCount + 1;
$HValue = $HValue + 2;
}
# Print the closing brace of REPCONN.c
print CFILE "\t}\n\n";
print CFILE "};\n";
# Print the endif for NTFRSCON.h
print HFILE "\n#endif\n";
# Make HCount equal to the number of counters
$HCount = $HCount - 1;
# Create the file REPCONN.h and write the header to it
open(RFILE, ">REPCONN.h"); # file creation
print RFILE "/*++\n\n";
print RFILE "WARNING!!!\n\n";
print RFILE "\tThis file is automatically generated and should never be changed.\n";
print RFILE "\tAll changes should be made to the NTFRSCON.int file.\n\n";
print RFILE "Copyright (c) 1998-1999 Microsoft Corporation\n\n";
print RFILE "Module Name:\n\n";
print RFILE "\tREPCONN.h\n\n";
print RFILE "Abstract\n\n";
print RFILE "\tThis is the header file for the REPLICACONN Object data definition.\n";
print RFILE "\tIt contains definitions to construct the dynamic data which is returned\n";
print RFILE "\tby the Configuration Registry.\n\n";
print RFILE "Environment:\n\n";
print RFILE "\tUser Mode Service\n\n";
print RFILE "Revision History:\n\n";
print RFILE "--*/\n\n\n";
print RFILE "#ifndef _REPCONN_H_\n";
print RFILE "#define _REPCONN_H_\n\n";
print RFILE "#include <perrepsr.h> // The counter structures header file\n";
print RFILE "#include <perffrs.h> // The RPC generated header file\n";
print RFILE "#include <winperf.h> // The PERFMON header file\n\n";
print RFILE "//\n";
print RFILE "// Number of objects being monitored\n";
print RFILE "//\n";
print RFILE "#define REPLICACONN_NUM_PERF_OBJECT_TYPES 1\n\n";
print RFILE "//\n";
print RFILE "// Size of DWORD\n";
print RFILE "//\n";
print RFILE "#define CSIZEOFDWORD sizeof(DWORD)\n\n";
print RFILE "//\n";
print RFILE "// Number of ReplicaConn Counters\n";
print RFILE "//\n";
print RFILE "#define FRC_NUMOFCOUNTERS ";
print RFILE $HCount;
print RFILE "\n\n";
print RFILE "//\n";
print RFILE "// Flag bit defs\n";
print RFILE "//\n";
print RFILE "#define PM_RS_FLAG_SVC_WIDE 0x00000001\n\n";
print RFILE "//\n";
print RFILE "// Structure which is used in the Open function Initialization\n";
print RFILE "//\n";
print RFILE "typedef struct _REPLICACONN_VALUES {\n";
print RFILE "\tPWCHAR name; // name of the counter\n";
print RFILE "\tDWORD size; // size of the counter type\n";
print RFILE "\tDWORD offset; // offset of the counter in the structure\n";
print RFILE "\tDWORD counterType; // Type of (PERFMON) counter\n";
print RFILE "\tDWORD Flags; // Flags. see def above.\n";
print RFILE "} ReplicaConnValues;\n\n";
print RFILE "//\n";
print RFILE "// Counter Structure returned by the REPLICACONN Object\n";
print RFILE "//\n";
print RFILE "typedef struct _REPLICACONN_DATA_DEFINITION {\n";
print RFILE "\tPERF_OBJECT_TYPE ReplicaConnObjectType; // ReplicaConn Object\n";
print RFILE "\tPERF_COUNTER_DEFINITION NumStat[FRC_NUMOFCOUNTERS]; // The array of PERF_COUNTER_DEFINITION structures\n";
print RFILE "} REPLICACONN_DATA_DEFINITION;\n\n\n";
print RFILE "#endif\n";
# Close all the Open file handles
close (HFILE);
close (INIFILE);
close (INTFLE);
close (CFILE);
close (RFILE);