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.
 
 
 
 
 
 

233 lines
8.2 KiB

#########################################################
#
# Copyright (c) 1998-1999 Microsoft Corporation
#
# Module Name:
#
# NTFRSREP.prl
#
# Abstract:
#
# This is the Perl Script that Generates the files:
# 1. NTFRSREP.h 2. NTFRSREP.ini 3. REPSET.h 4. REPSET.c
# It uses the file NTFRSREP.int to generate them
#
# Author:
#
# Rohan Kumar [rohank] 10-Sept-1998
#
# Environment:
#
# User Mode Service
#
# Revision History:
#
###########################################################
# Create the file NTFRSREP.h and write the header to it
open(HFILE, ">NTFRSREP.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 NTFRSREP.int file.\n\n";
print HFILE "Copyright (c) 1998-1999 Microsoft Corporation\n\n";
print HFILE "Module Name:\n\n";
print HFILE "\tNTFRSREP.h\n\n";
print HFILE "Abstract\n\n";
print HFILE "\tThis is the offset definition file for the REPLICASET 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 _NTFRSREP_H_\n";
print HFILE "#define _NTFRSREP_H_\n\n";
# Define the offset definitions
print HFILE "//\n";
print HFILE "// The offset definitions follow\n";
print HFILE "//\n";
print HFILE "#define OBJREPLICASET 0 // REPLICASET Object\n\n";
# Create the file NTFRSREP.ini and write the header to it
open(INIFILE, ">NTFRSREP.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 NTFRSREP.int file.\n\n";
print INIFILE "Copyright (c) 1998-1999 Microsoft Corporation\n\n";
print INIFILE "Module Name:\n\n";
print INIFILE "\tNTFRSREP.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 REPLICASET 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=FileReplicaSet\n";
print INIFILE "symbolfile=NTFRSREP.h\n\n";
print INIFILE "[objects]\n";
print INIFILE "OBJREPLICASET_009_NAME=FileReplicaSet\n\n";
print INIFILE "[languages]\n";
print INIFILE "009=English\n\n";
print INIFILE "[text]\n";
print INIFILE "OBJREPLICASET_009_NAME=FileReplicaSet\n";
print INIFILE "OBJREPLICASET_009_HELP=Displays Performance statistics of the REPLICASET Object.\n\n";
# Create the file REPSET.c and write the header to it
open(CFILE, ">..\\REPSET.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 NTFRSREP.int file.\n\n";
print CFILE "Copyright (c) 1998-1999 Microsoft Corporation\n\n";
print CFILE "Module Name:\n\n";
print CFILE "\tREPSET.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 REPLICASET 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\\REPSET.h\"\n\n";
# declare the array variable which contains the values
print CFILE "// Initialize the RepSetInitData structure used in the Open function\n\n";
print CFILE "ReplicaSetValues RepSetInitData[FRS_NUMOFCOUNTERS] = {\n\n";
# All the headers are now done. Open the NTFRSREP.int file and fill in the rest
# of the data in these files.
open(INTFLE, "<NTFRSREP.int") or die "Can't open NTFRSREP.int: $!\n";
# Set the initial values of the 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 NTFRSREP.h file
print HFILE "#define DEV_CTR_$HCount $HValue // $NameStr\n";
# Set the NTFRSREP.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 REPSET.c file
if ($HCount > 1) {
print CFILE "\t},\n\n";
}
print CFILE "\t{\n";
print CFILE "\t(PWCHAR)\"$NameStr\",\n";
print CFILE "\tSIZEOF(ReplicaSetCounters, $VarName),\n";
print CFILE "\tOFFSET(ReplicaSetCounters, $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 REPSET.c
print CFILE "\t}\n\n";
print CFILE "};\n";
# Print the endif for NTFRSREP.h
print HFILE "\n#endif\n";
# Make HCount equal to the number of counters
$HCount = $HCount - 1;
# Create the file REPSET.h and write the header to it
open(RFILE, ">REPSET.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 NTFRSREP.int file.\n\n";
print RFILE "Copyright (c) 1998-1999 Microsoft Corporation\n\n";
print RFILE "Module Name:\n\n";
print RFILE "\tREPSET.h\n\n";
print RFILE "Abstract\n\n";
print RFILE "\tThis is the header file for the REPLICASET 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 _REPSET_H_\n";
print RFILE "#define _REPSET_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 REPLICASET_NUM_PERF_OBJECT_TYPES 1\n\n";
print RFILE "//\n";
print RFILE "// Size of DWORD\n";
print RFILE "//\n";
print RFILE "#define SSIZEOFDWORD sizeof(DWORD)\n\n";
print RFILE "//\n";
print RFILE "// Number of ReplicaSet Counters\n";
print RFILE "//\n";
print RFILE "#define FRS_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 _REPLICASET_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 "} ReplicaSetValues;\n\n";
print RFILE "//\n";
print RFILE "// Counter Structure returned by the REPLICASET Object\n";
print RFILE "//\n";
print RFILE "typedef struct _REPLICASET_DATA_DEFINITION {\n";
print RFILE "\tPERF_OBJECT_TYPE ReplicaSetObjectType; // ReplicaSet Object\n";
print RFILE "\tPERF_COUNTER_DEFINITION NumStat[FRS_NUMOFCOUNTERS]; // The array of PERF_COUNTER_DEFINITION structures\n";
print RFILE "} REPLICASET_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);