JwaPdh.pas
上传用户:davidchvip
上传日期:2009-07-28
资源大小:1749k
文件大小:121k
源码类别:

Windows编程

开发平台:

Delphi

  1. {******************************************************************************}
  2. {                                                                       }
  3. { Performance Data Helper API interface Unit for Object Pascal                 }
  4. {                                                                       }
  5. { Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
  6. { Corporation. All Rights Reserved.                                            }
  7. {                 }
  8. { The original file is: pdh.h, released June 2000. The original Pascal         }
  9. { code is: Pdh.pas, released December 2000. The initial developer of the       }
  10. { Pascal code is Marcel van Brakel (brakelm@chello.nl).                        }
  11. {                                                                              }
  12. { Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
  13. { Marcel van Brakel. All Rights Reserved.                                      }
  14. {                 }
  15. { Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
  16. {                }
  17. { You may retrieve the latest version of this file at the Project JEDI home    }
  18. { page, located at http://delphi-jedi.org or my personal homepage located at   }
  19. { http://members.chello.nl/m.vanbrakel2                                        }
  20. {                }
  21. { The contents of this file are used with permission, subject to the Mozilla   }
  22. { Public License Version 1.1 (the "License"); you may not use this file except }
  23. { in compliance with the License. You may obtain a copy of the License at      }
  24. { http://www.mozilla.org/MPL/MPL-1.1.html                                      }
  25. {                                                                              }
  26. { Software distributed under the License is distributed on an "AS IS" basis,   }
  27. { WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
  28. { the specific language governing rights and limitations under the License.    }
  29. {                                                                              }
  30. { Alternatively, the contents of this file may be used under the terms of the  }
  31. { GNU Lesser General Public License (the  "LGPL License"), in which case the   }
  32. { provisions of the LGPL License are applicable instead of those above.        }
  33. { If you wish to allow use of your version of this file only under the terms   }
  34. { of the LGPL License and not to allow others to use your version of this file }
  35. { under the MPL, indicate your decision by deleting  the provisions above and  }
  36. { replace  them with the notice and other provisions required by the LGPL      }
  37. { License.  If you do not delete the provisions above, a recipient may use     }
  38. { your version of this file under either the MPL or the LGPL License.          }
  39. {                 }
  40. { For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
  41. {                 }
  42. {******************************************************************************}
  43. unit JwaPdh;
  44. {$WEAKPACKAGEUNIT}
  45. {$HPPEMIT ''}
  46. {$HPPEMIT '#include "pdh.h"'}
  47. {$HPPEMIT ''}
  48. {$I WINDEFINES.INC}
  49. interface
  50. uses
  51.   JwaWinBase, JwaWinType, JwaWinPerf;
  52. type
  53.   PDH_STATUS = DWORD;
  54.   {$EXTERNALSYM PDH_STATUS}
  55. const
  56. // version info
  57.   PDH_CVERSION_WIN40 = DWORD($0400);
  58.   {$EXTERNALSYM PDH_CVERSION_WIN40}
  59.   PDH_CVERSION_WIN50 = DWORD($0500);
  60.   {$EXTERNALSYM PDH_CVERSION_WIN50}
  61. // v1.1 revision of PDH -- basic log functions
  62. // v1.2 of the PDH -- adds variable instance counters
  63. // v1.3 of the PDH -- adds log service control & stubs for NT5/PDH v2 fn's
  64. // v2.0 of the PDH -- is the NT v 5.0 B2 version
  65.   PDH_VERSION        = DWORD((PDH_CVERSION_WIN50) + $0003);
  66.   {$EXTERNALSYM PDH_VERSION}
  67. // define severity masks
  68. function IsSuccessSeverity(ErrorCode: Longint): Boolean;
  69. {$EXTERNALSYM IsSuccessSeverity}
  70. function IsInformationalSeverity(ErrorCode: Longint): Boolean;
  71. {$EXTERNALSYM IsInformationalSeverity}
  72. function IsWarningSeverity(ErrorCode: Longint): Boolean;
  73. {$EXTERNALSYM IsWarningSeverity}
  74. function IsErrorSeverity(ErrorCode: Longint): Boolean;
  75. {$EXTERNALSYM IsErrorSeverity}
  76. const
  77.   MAX_COUNTER_PATH = 256;         // Maximum counter path length
  78.   {$EXTERNALSYM MAX_COUNTER_PATH}
  79.   PDH_MAX_COUNTER_NAME    = 1024;  // Maximum counter name length.
  80.   {$EXTERNALSYM PDH_MAX_COUNTER_NAME}
  81.   PDH_MAX_INSTANCE_NAME   = 1024;  // Maximum counter instance name length.
  82.   {$EXTERNALSYM PDH_MAX_INSTANCE_NAME}
  83.   PDH_MAX_COUNTER_PATH    = 2048;  // Maximum full counter path length.
  84.   {$EXTERNALSYM PDH_MAX_COUNTER_PATH}
  85.   PDH_MAX_DATASOURCE_PATH = 1024;  // MAximum full counter log name length.
  86.   {$EXTERNALSYM PDH_MAX_DATASOURCE_PATH}
  87. // data type definitions
  88. type
  89.   PDH_HCOUNTER = HANDLE;
  90.   {$EXTERNALSYM PDH_HCOUNTER}
  91.   PDH_HQUERY = HANDLE;
  92.   {$EXTERNALSYM PDH_HQUERY}
  93.   PDH_HLOG = HANDLE;
  94.   {$EXTERNALSYM PDH_HLOG}
  95.   HCOUNTER = PDH_HCOUNTER;
  96.   {$EXTERNALSYM HCOUNTER}
  97.   HQUERY = PDH_HQUERY;
  98.   {$EXTERNALSYM HQUERY}
  99.   HLOG = PDH_HLOG;
  100.   {$EXTERNALSYM HLOG}
  101. const
  102.   INVALID_HANDLE_VALUE = HANDLE(LONG_PTR(-1));
  103.   {$EXTERNALSYM INVALID_HANDLE_VALUE}
  104.   H_REALTIME_DATASOURCE = NULL;
  105.   {$EXTERNALSYM H_REALTIME_DATASOURCE}
  106.   H_WBEM_DATASOURCE     = INVALID_HANDLE_VALUE;
  107.   {$EXTERNALSYM H_WBEM_DATASOURCE}
  108. type
  109.   PPDH_RAW_COUNTER = ^PDH_RAW_COUNTER;
  110.   {$EXTERNALSYM PPDH_RAW_COUNTER}
  111.   _PDH_RAW_COUNTER = record
  112.     CStatus: DWORD;
  113.     TimeStamp: FILETIME;
  114.     FirstValue: LONGLONG;
  115.     SecondValue: LONGLONG;
  116.     MultiCount: DWORD;
  117.   end;
  118.   {$EXTERNALSYM _PDH_RAW_COUNTER}
  119.   PDH_RAW_COUNTER = _PDH_RAW_COUNTER;
  120.   {$EXTERNALSYM PDH_RAW_COUNTER}
  121.   TPdhRawCounter = PDH_RAW_COUNTER;
  122.   PPdhRawCounter = PPDH_RAW_COUNTER;
  123.   PPDH_RAW_COUNTER_ITEM_A = ^PDH_RAW_COUNTER_ITEM_A;
  124.   {$EXTERNALSYM PPDH_RAW_COUNTER_ITEM_A}
  125.   _PDH_RAW_COUNTER_ITEM_A = record
  126.     szName: LPSTR;
  127.     RawValue: PDH_RAW_COUNTER;
  128.   end;
  129.   {$EXTERNALSYM _PDH_RAW_COUNTER_ITEM_A}
  130.   PDH_RAW_COUNTER_ITEM_A = _PDH_RAW_COUNTER_ITEM_A;
  131.   {$EXTERNALSYM PDH_RAW_COUNTER_ITEM_A}
  132.   TPdhRawCounterItemA = PDH_RAW_COUNTER_ITEM_A;
  133.   PPdhRawCounterItemA = PPDH_RAW_COUNTER_ITEM_A;
  134.   PPDH_RAW_COUNTER_ITEM_W = ^PDH_RAW_COUNTER_ITEM_W;
  135.   {$EXTERNALSYM PPDH_RAW_COUNTER_ITEM_W}
  136.   _PDH_RAW_COUNTER_ITEM_W = record
  137.     szName: LPWSTR;
  138.     RawValue: PDH_RAW_COUNTER;
  139.   end;
  140.   {$EXTERNALSYM _PDH_RAW_COUNTER_ITEM_W}
  141.   PDH_RAW_COUNTER_ITEM_W = _PDH_RAW_COUNTER_ITEM_W;
  142.   {$EXTERNALSYM PDH_RAW_COUNTER_ITEM_W}
  143.   TPdhRawCounterItemW = PDH_RAW_COUNTER_ITEM_W;
  144.   PPdhRawCounterItemW = PPDH_RAW_COUNTER_ITEM_W;
  145. {$IFDEF UNICODE}
  146.   PPdhRawCounterItem = PPdhRawCounterItemW;
  147.   PDH_RAW_COUNTER_ITEM = _PDH_RAW_COUNTER_ITEM_W;
  148.   {$EXTERNALSYM PDH_RAW_COUNTER_ITEM}
  149.   PPDH_RAW_COUNTER_ITEM = PPDH_RAW_COUNTER_ITEM_W;
  150.   {$EXTERNALSYM PPDH_RAW_COUNTER_ITEM}
  151.   TPdhRawCounterItem = _PDH_RAW_COUNTER_ITEM_W;
  152. {$ELSE}
  153.   PPdhRawCounterItem = PPdhRawCounterItemA;
  154.   PDH_RAW_COUNTER_ITEM = _PDH_RAW_COUNTER_ITEM_A;
  155.   {$EXTERNALSYM PDH_RAW_COUNTER_ITEM}
  156.   PPDH_RAW_COUNTER_ITEM = PPDH_RAW_COUNTER_ITEM_A;
  157.   {$EXTERNALSYM PPDH_RAW_COUNTER_ITEM}
  158.   TPdhRawCounterItem = _PDH_RAW_COUNTER_ITEM_A;
  159. {$ENDIF}
  160.   PPDH_FMT_COUNTERVALUE = ^PDH_FMT_COUNTERVALUE;
  161.   {$EXTERNALSYM PPDH_FMT_COUNTERVALUE}
  162.   _PDH_FMT_COUNTERVALUE = record
  163.     CStatus: DWORD;
  164.     case Longint of
  165.       1: (longValue: LONG);
  166.       2: (doubleValue: Double);
  167.       3: (largeValue: LONGLONG);
  168.       4: (AnsiStringValue: LPSTR);
  169.       5: (WideStringValue: LPCWSTR);
  170.   end;
  171.   {$EXTERNALSYM _PDH_FMT_COUNTERVALUE}
  172.   PDH_FMT_COUNTERVALUE = _PDH_FMT_COUNTERVALUE;
  173.   {$EXTERNALSYM PDH_FMT_COUNTERVALUE}
  174.   TPdhFmtCounterValue = PDH_FMT_COUNTERVALUE;
  175.   PPdhFmtCounterValue = PPDH_FMT_COUNTERVALUE;
  176.   PPDH_FMT_COUNTERVALUE_ITEM_A = ^PDH_FMT_COUNTERVALUE_ITEM_A;
  177.   {$EXTERNALSYM PPDH_FMT_COUNTERVALUE_ITEM_A}
  178.   _PDH_FMT_COUNTERVALUE_ITEM_A = record
  179.     szName: LPSTR;
  180.     FmtValue: PDH_FMT_COUNTERVALUE;
  181.   end;
  182.   {$EXTERNALSYM _PDH_FMT_COUNTERVALUE_ITEM_A}
  183.   PDH_FMT_COUNTERVALUE_ITEM_A = _PDH_FMT_COUNTERVALUE_ITEM_A;
  184.   {$EXTERNALSYM PDH_FMT_COUNTERVALUE_ITEM_A}
  185.   TPdhFmtCounterValueItemA = PDH_FMT_COUNTERVALUE_ITEM_A;
  186.   PPdhFmtCounterValueItemA = PPDH_FMT_COUNTERVALUE_ITEM_A;
  187.   PPDH_FMT_COUNTERVALUE_ITEM_W = ^PDH_FMT_COUNTERVALUE_ITEM_W;
  188.   {$EXTERNALSYM PPDH_FMT_COUNTERVALUE_ITEM_W}
  189.   _PDH_FMT_COUNTERVALUE_ITEM_W = record
  190.     szName: LPWSTR;
  191.     FmtValue: PDH_FMT_COUNTERVALUE;
  192.   end;
  193.   {$EXTERNALSYM _PDH_FMT_COUNTERVALUE_ITEM_W}
  194.   PDH_FMT_COUNTERVALUE_ITEM_W = _PDH_FMT_COUNTERVALUE_ITEM_W;
  195.   {$EXTERNALSYM PDH_FMT_COUNTERVALUE_ITEM_W}
  196.   TPdhFmtCounterValueItemW = PDH_FMT_COUNTERVALUE_ITEM_W;
  197.   PPdhFmtCounterValueItemW = PPDH_FMT_COUNTERVALUE_ITEM_W;
  198. {$IFDEF UNICODE}
  199.   PPdhFmtCounterValueItem = PPdhFmtCounterValueItemW;
  200.   PDH_FMT_COUNTERVALUE_ITEM = _PDH_FMT_COUNTERVALUE_ITEM_W;
  201.   {$EXTERNALSYM PDH_FMT_COUNTERVALUE_ITEM}
  202.   PPDH_FMT_COUNTERVALUE_ITEM = PPDH_FMT_COUNTERVALUE_ITEM_W;
  203.   {$EXTERNALSYM PPDH_FMT_COUNTERVALUE_ITEM}
  204.   TPdhFmtCounterValueItem = _PDH_FMT_COUNTERVALUE_ITEM_W;
  205. {$ELSE}
  206.   PPdhFmtCounterValueItem = PPdhFmtCounterValueItemA;
  207.   PDH_FMT_COUNTERVALUE_ITEM = _PDH_FMT_COUNTERVALUE_ITEM_A;
  208.   {$EXTERNALSYM PDH_FMT_COUNTERVALUE_ITEM}
  209.   PPDH_FMT_COUNTERVALUE_ITEM = PPDH_FMT_COUNTERVALUE_ITEM_A;
  210.   {$EXTERNALSYM PPDH_FMT_COUNTERVALUE_ITEM}
  211.   TPdhFmtCounterValueItem = _PDH_FMT_COUNTERVALUE_ITEM_A;
  212. {$ENDIF}
  213.   PPDH_STATISTICS = ^PDH_STATISTICS;
  214.   {$EXTERNALSYM PPDH_STATISTICS}
  215.   _PDH_STATISTICS = record
  216.     dwFormat: DWORD;
  217.     Count: DWORD;
  218.     min: PDH_FMT_COUNTERVALUE;
  219.     max: PDH_FMT_COUNTERVALUE;
  220.     mean: PDH_FMT_COUNTERVALUE;
  221.   end;
  222.   {$EXTERNALSYM _PDH_STATISTICS}
  223.   PDH_STATISTICS = _PDH_STATISTICS;
  224.   {$EXTERNALSYM PDH_STATISTICS}
  225.   TPdhStatistics = PDH_STATISTICS;
  226.   PPdhStatistics = PPDH_STATISTICS;
  227.   PPDH_COUNTER_PATH_ELEMENTS_A = ^PDH_COUNTER_PATH_ELEMENTS_A;
  228.   {$EXTERNALSYM PPDH_COUNTER_PATH_ELEMENTS_A}
  229.   _PDH_COUNTER_PATH_ELEMENTS_A = record
  230.     szMachineName: LPSTR;
  231.     szObjectName: LPSTR;
  232.     szInstanceName: LPSTR;
  233.     szParentInstance: LPSTR;
  234.     dwInstanceIndex: DWORD;
  235.     szCounterName: LPSTR;
  236.   end;
  237.   {$EXTERNALSYM _PDH_COUNTER_PATH_ELEMENTS_A}
  238.   PDH_COUNTER_PATH_ELEMENTS_A = _PDH_COUNTER_PATH_ELEMENTS_A;
  239.   {$EXTERNALSYM PDH_COUNTER_PATH_ELEMENTS_A}
  240.   TPdhCounterPathElementsA = PDH_COUNTER_PATH_ELEMENTS_A;
  241.   PPdhCounterPathElementsA = PPDH_COUNTER_PATH_ELEMENTS_A;
  242.   PPDH_COUNTER_PATH_ELEMENTS_W = ^PDH_COUNTER_PATH_ELEMENTS_W;
  243.   {$EXTERNALSYM PPDH_COUNTER_PATH_ELEMENTS_W}
  244.   _PDH_COUNTER_PATH_ELEMENTS_W = record
  245.     szMachineName: LPWSTR;
  246.     szObjectName: LPWSTR;
  247.     szInstanceName: LPWSTR;
  248.     szParentInstance: LPWSTR;
  249.     dwInstanceIndex: DWORD;
  250.     szCounterName: LPWSTR;
  251.   end;
  252.   {$EXTERNALSYM _PDH_COUNTER_PATH_ELEMENTS_W}
  253.   PDH_COUNTER_PATH_ELEMENTS_W = _PDH_COUNTER_PATH_ELEMENTS_W;
  254.   {$EXTERNALSYM PDH_COUNTER_PATH_ELEMENTS_W}
  255.   TPdhCounterPathElementsW = PDH_COUNTER_PATH_ELEMENTS_W;
  256.   PPdhCounterPathElementsW = PPDH_COUNTER_PATH_ELEMENTS_W;
  257. {$IFDEF UNICODE}
  258.   PPdhCounterPathElements = PPdhCounterPathElementsW;
  259.   PDH_COUNTER_PATH_ELEMENTS = _PDH_COUNTER_PATH_ELEMENTS_W;
  260.   {$EXTERNALSYM PDH_COUNTER_PATH_ELEMENTS}
  261.   PPDH_COUNTER_PATH_ELEMENTS = PPDH_COUNTER_PATH_ELEMENTS_W;
  262.   {$EXTERNALSYM PPDH_COUNTER_PATH_ELEMENTS}
  263.   TPdhCounterPathElements = _PDH_COUNTER_PATH_ELEMENTS_W;
  264. {$ELSE}
  265.   PPdhCounterPathElements = PPdhCounterPathElementsA;
  266.   PDH_COUNTER_PATH_ELEMENTS = _PDH_COUNTER_PATH_ELEMENTS_A;
  267.   {$EXTERNALSYM PDH_COUNTER_PATH_ELEMENTS}
  268.   PPDH_COUNTER_PATH_ELEMENTS = PPDH_COUNTER_PATH_ELEMENTS_A;
  269.   {$EXTERNALSYM PPDH_COUNTER_PATH_ELEMENTS}
  270.   TPdhCounterPathElements = _PDH_COUNTER_PATH_ELEMENTS_A;
  271. {$ENDIF}
  272.   PPDH_DATA_ITEM_PATH_ELEMENTS_A = ^PDH_DATA_ITEM_PATH_ELEMENTS_A;
  273.   {$EXTERNALSYM PPDH_DATA_ITEM_PATH_ELEMENTS_A}
  274.   _PDH_DATA_ITEM_PATH_ELEMENTS_A = record
  275.     szMachineName: LPSTR;
  276.     ObjectGUID: GUID;
  277.     dwItemId: DWORD;
  278.     szInstanceName: LPSTR;
  279.   end;
  280.   {$EXTERNALSYM _PDH_DATA_ITEM_PATH_ELEMENTS_A}
  281.   PDH_DATA_ITEM_PATH_ELEMENTS_A = _PDH_DATA_ITEM_PATH_ELEMENTS_A;
  282.   {$EXTERNALSYM PDH_DATA_ITEM_PATH_ELEMENTS_A}
  283.   TPdhDataItemPathElementsA = PDH_DATA_ITEM_PATH_ELEMENTS_A;
  284.   PPdhDataItemPathElementsA = PPDH_DATA_ITEM_PATH_ELEMENTS_A;
  285.   PPDH_DATA_ITEM_PATH_ELEMENTS_W = ^PDH_DATA_ITEM_PATH_ELEMENTS_W;
  286.   {$EXTERNALSYM PPDH_DATA_ITEM_PATH_ELEMENTS_W}
  287.   _PDH_DATA_ITEM_PATH_ELEMENTS_W = record
  288.     szMachineName: LPWSTR;
  289.     ObjectGUID: GUID;
  290.     dwItemId: DWORD;
  291.     szInstanceName: LPWSTR;
  292.   end;
  293.   {$EXTERNALSYM _PDH_DATA_ITEM_PATH_ELEMENTS_W}
  294.   PDH_DATA_ITEM_PATH_ELEMENTS_W = _PDH_DATA_ITEM_PATH_ELEMENTS_W;
  295.   {$EXTERNALSYM PDH_DATA_ITEM_PATH_ELEMENTS_W}
  296.   TPdhDataItemPathElementsW = PDH_DATA_ITEM_PATH_ELEMENTS_W;
  297.   PPdhDataItemPathElementsW = PPDH_DATA_ITEM_PATH_ELEMENTS_W;
  298. {$IFDEF UNICODE}
  299.   PPdhDataItemPathElements = PPdhDataItemPathElementsW;
  300.   PDH_DATA_ITEM_PATH_ELEMENTS = _PDH_DATA_ITEM_PATH_ELEMENTS_W;
  301.   {$EXTERNALSYM PDH_DATA_ITEM_PATH_ELEMENTS}
  302.   PPDH_DATA_ITEM_PATH_ELEMENTS = PPDH_DATA_ITEM_PATH_ELEMENTS_W;
  303.   {$EXTERNALSYM PPDH_DATA_ITEM_PATH_ELEMENTS}
  304.   TPdhDataItemPathElements = _PDH_DATA_ITEM_PATH_ELEMENTS_W;
  305. {$ELSE}
  306.   PPdhDataItemPathElements = PPdhDataItemPathElementsA;
  307.   PDH_DATA_ITEM_PATH_ELEMENTS = _PDH_DATA_ITEM_PATH_ELEMENTS_A;
  308.   {$EXTERNALSYM PDH_DATA_ITEM_PATH_ELEMENTS}
  309.   PPDH_DATA_ITEM_PATH_ELEMENTS = PPDH_DATA_ITEM_PATH_ELEMENTS_A;
  310.   {$EXTERNALSYM PPDH_DATA_ITEM_PATH_ELEMENTS}
  311.   TPdhDataItemPathElements = _PDH_DATA_ITEM_PATH_ELEMENTS_A;
  312. {$ENDIF}
  313.   PPDH_COUNTER_INFO_A = ^PDH_COUNTER_INFO_A;
  314.   {$EXTERNALSYM PPDH_COUNTER_INFO_A}
  315.   _PDH_COUNTER_INFO_A = record
  316.     dwLength: DWORD;
  317.     dwType: DWORD;
  318.     CVersion: DWORD;
  319.     CStatus: DWORD;
  320.     lScale: LONG;
  321.     lDefaultScale: LONG;
  322.     dwUserData: DWORD_PTR;
  323.     dwQueryUserData: DWORD_PTR;
  324.     szFullPath: LPSTR;
  325.     Union: record
  326.       case Longint of
  327.         1: (DataItemPath: PDH_DATA_ITEM_PATH_ELEMENTS_A);
  328.         2: (CounterPath: PDH_COUNTER_PATH_ELEMENTS_A);
  329.         3: (szMachineName: LPSTR;
  330.             szObjectName: LPSTR;
  331.             szInstanceName: LPSTR;
  332.             szParentInstance: LPSTR;
  333.             dwInstanceIndex: DWORD;
  334.             szCounterName: LPSTR);
  335.     end;
  336.     szExplainText: LPSTR;
  337.     DataBuffer: array [0..0] of DWORD;
  338.   end;
  339.   {$EXTERNALSYM _PDH_COUNTER_INFO_A}
  340.   PDH_COUNTER_INFO_A = _PDH_COUNTER_INFO_A;
  341.   {$EXTERNALSYM PDH_COUNTER_INFO_A}
  342.   TPdhCounterInfoA = PDH_COUNTER_INFO_A;
  343.   PPdhCounterInfoA = PPDH_COUNTER_INFO_A;
  344.   PPDH_COUNTER_INFO_W = ^PDH_COUNTER_INFO_W;
  345.   {$EXTERNALSYM PPDH_COUNTER_INFO_W}
  346.   _PDH_COUNTER_INFO_W = record
  347.     dwLength: DWORD;
  348.     dwType: DWORD;
  349.     CVersion: DWORD;
  350.     CStatus: DWORD;
  351.     lScale: LONG;
  352.     lDefaultScale: LONG;
  353.     dwUserData: DWORD_PTR;
  354.     dwQueryUserData: DWORD_PTR;
  355.     szFullPath: LPWSTR;
  356.     Union: record
  357.       case Longint of
  358.         1: (DataItemPath: PDH_DATA_ITEM_PATH_ELEMENTS_W);
  359.         2: (CounterPath: PDH_COUNTER_PATH_ELEMENTS_W);
  360.         3: (szMachineName: LPWSTR;
  361.             szObjectName: LPWSTR;
  362.             szInstanceName: LPWSTR;
  363.             szParentInstance: LPWSTR;
  364.             dwInstanceIndex: DWORD;
  365.             szCounterName: LPWSTR);
  366.     end;
  367.     szExplainText: LPWSTR;
  368.     DataBuffer: array [0..0] of DWORD;
  369.   end;
  370.   {$EXTERNALSYM _PDH_COUNTER_INFO_W}
  371.   PDH_COUNTER_INFO_W = _PDH_COUNTER_INFO_W;
  372.   {$EXTERNALSYM PDH_COUNTER_INFO_W}
  373.   TPdhCounterInfoW = PDH_COUNTER_INFO_W;
  374.   PPdhCounterInfoW = PPDH_COUNTER_INFO_W;
  375. {$IFDEF UNICODE}
  376.   PPdhCounterInfo = PPdhCounterInfoW;
  377.   PDH_COUNTER_INFO = _PDH_COUNTER_INFO_W;
  378.   {$EXTERNALSYM PDH_COUNTER_INFO}
  379.   PPDH_COUNTER_INFO = PPDH_COUNTER_INFO_W;
  380.   {$EXTERNALSYM PPDH_COUNTER_INFO}
  381.   TPdhCounterInfo = _PDH_COUNTER_INFO_W;
  382. {$ELSE}
  383.   PPdhCounterInfo = PPdhCounterInfoA;
  384.   PDH_COUNTER_INFO = _PDH_COUNTER_INFO_A;
  385.   {$EXTERNALSYM PDH_COUNTER_INFO}
  386.   PPDH_COUNTER_INFO = PPDH_COUNTER_INFO_A;
  387.   {$EXTERNALSYM PPDH_COUNTER_INFO}
  388.   TPdhCounterInfo = _PDH_COUNTER_INFO_A;
  389. {$ENDIF}
  390.   PPDH_TIME_INFO = ^PDH_TIME_INFO;
  391.   {$EXTERNALSYM PPDH_TIME_INFO}
  392.   _PDH_TIME_INFO = record
  393.     StartTime: LONGLONG;
  394.     EndTime: LONGLONG;
  395.     SampleCount: DWORD;
  396.   end;
  397.   {$EXTERNALSYM _PDH_TIME_INFO}
  398.   PDH_TIME_INFO = _PDH_TIME_INFO;
  399.   {$EXTERNALSYM PDH_TIME_INFO}
  400.   TPdhTimeInfo = PDH_TIME_INFO;
  401.   PPdhTimeInfo = PPDH_TIME_INFO;
  402.   PPDH_RAW_LOG_RECORD = ^PDH_RAW_LOG_RECORD;
  403.   {$EXTERNALSYM PPDH_RAW_LOG_RECORD}
  404.   _PDH_RAW_LOG_RECORD = record
  405.     dwStructureSize: DWORD;
  406.     dwRecordType: DWORD;
  407.     dwItems: DWORD;
  408.     RawBytes: array [0..0] of UCHAR;
  409.   end;
  410.   {$EXTERNALSYM _PDH_RAW_LOG_RECORD}
  411.   PDH_RAW_LOG_RECORD = _PDH_RAW_LOG_RECORD;
  412.   {$EXTERNALSYM PDH_RAW_LOG_RECORD}
  413.   TPdhRawLogRecord = PDH_RAW_LOG_RECORD;
  414.   PPdhRawLogRecord = PPDH_RAW_LOG_RECORD;
  415.   PPDH_LOG_SERVICE_QUERY_INFO_A = ^PDH_LOG_SERVICE_QUERY_INFO_A;
  416.   {$EXTERNALSYM PPDH_LOG_SERVICE_QUERY_INFO_A}
  417.   _PDH_LOG_SERVICE_QUERY_INFO_A = record
  418.     dwSize: DWORD;
  419.     dwFlags: DWORD;
  420.     dwLogQuota: DWORD;
  421.     szLogFileCaption: LPSTR;
  422.     szDefaultDir: LPSTR;
  423.     szBaseFileName: LPSTR;
  424.     dwFileType: DWORD;
  425.     dwReserved: DWORD;
  426.     Union: record
  427.       case Longint of
  428.       1: (PdlAutoNameInterval: DWORD;
  429.           PdlAutoNameUnits: DWORD;
  430.           PdlCommandFilename: LPSTR;
  431.           PdlCounterList: LPSTR;
  432.           PdlAutoNameFormat: DWORD;
  433.           PdlSampleInterval: DWORD;
  434.           PdlLogStartTime: FILETIME;
  435.           PdlLogEndTime: FILETIME);
  436.       2: (TlNumberOfBuffers: DWORD;
  437.           TlMinimumBuffers: DWORD;
  438.           TlMaximumBuffers: DWORD;
  439.           TlFreeBuffers: DWORD;
  440.           TlBufferSize: DWORD;
  441.           TlEventsLost: DWORD;
  442.           TlLoggerThreadId: DWORD;
  443.           TlBuffersWritten: DWORD;
  444.           TlLogHandle: DWORD;
  445.           TlLogFileName: LPSTR);
  446.     end;
  447.   end;
  448.   {$EXTERNALSYM _PDH_LOG_SERVICE_QUERY_INFO_A}
  449.   PDH_LOG_SERVICE_QUERY_INFO_A = _PDH_LOG_SERVICE_QUERY_INFO_A;
  450.   {$EXTERNALSYM _PDH_LOG_SERVICE_QUERY_INFO_A}
  451.   TPdhLogServiceQueryInfoA = PDH_LOG_SERVICE_QUERY_INFO_A;
  452.   PPdhLogServiceQueryInfoA = PPDH_LOG_SERVICE_QUERY_INFO_A;
  453.   PPDH_LOG_SERVICE_QUERY_INFO_W = ^PDH_LOG_SERVICE_QUERY_INFO_W;
  454.   {$EXTERNALSYM PPDH_LOG_SERVICE_QUERY_INFO_W}
  455.   _PDH_LOG_SERVICE_QUERY_INFO_W = record
  456.     dwSize: DWORD;
  457.     dwFlags: DWORD;
  458.     dwLogQuota: DWORD;
  459.     szLogFileCaption: LPWSTR;
  460.     szDefaultDir: LPWSTR;
  461.     szBaseFileName: LPWSTR;
  462.     dwFileType: DWORD;
  463.     dwReserved: DWORD;
  464.     Union: record
  465.       case Longint of
  466.       1: (PdlAutoNameInterval: DWORD;
  467.           PdlAutoNameUnits: DWORD;
  468.           PdlCommandFilename: LPWSTR;
  469.           PdlCounterList: LPWSTR;
  470.           PdlAutoNameFormat: DWORD;
  471.           PdlSampleInterval: DWORD;
  472.           PdlLogStartTime: FILETIME;
  473.           PdlLogEndTime: FILETIME);
  474.       2: (TlNumberOfBuffers: DWORD;
  475.           TlMinimumBuffers: DWORD;
  476.           TlMaximumBuffers: DWORD;
  477.           TlFreeBuffers: DWORD;
  478.           TlBufferSize: DWORD;
  479.           TlEventsLost: DWORD;
  480.           TlLoggerThreadId: DWORD;
  481.           TlBuffersWritten: DWORD;
  482.           TlLogHandle: DWORD;
  483.           TlLogFileName: LPWSTR);
  484.     end;
  485.   end;
  486.   {$EXTERNALSYM _PDH_LOG_SERVICE_QUERY_INFO_W}
  487.   PDH_LOG_SERVICE_QUERY_INFO_W = _PDH_LOG_SERVICE_QUERY_INFO_W;
  488.   {$EXTERNALSYM PDH_LOG_SERVICE_QUERY_INFO_W}
  489.   TPdhLogServiceQueryInfoW = PDH_LOG_SERVICE_QUERY_INFO_W;
  490.   PPdhLogServiceQueryInfoW = PPDH_LOG_SERVICE_QUERY_INFO_W;
  491. {$IFDEF UNICODE}
  492.   PPdhLogServiceQueryInfo = PPdhLogServiceQueryInfoW;
  493.   PDH_LOG_SERVICE_QUERY_INFO = _PDH_LOG_SERVICE_QUERY_INFO_W;
  494.   {$EXTERNALSYM PDH_LOG_SERVICE_QUERY_INFO}
  495.   PPDH_LOG_SERVICE_QUERY_INFO = PPDH_LOG_SERVICE_QUERY_INFO_W;
  496.   {$EXTERNALSYM PPDH_LOG_SERVICE_QUERY_INFO}
  497.   TPdhLogServiceQueryInfo = _PDH_LOG_SERVICE_QUERY_INFO_W;
  498. {$ELSE}
  499.   PPdhLogServiceQueryInfo = PPdhLogServiceQueryInfoA;
  500.   PDH_LOG_SERVICE_QUERY_INFO = _PDH_LOG_SERVICE_QUERY_INFO_A;
  501.   {$EXTERNALSYM PDH_LOG_SERVICE_QUERY_INFO}
  502.   PPDH_LOG_SERVICE_QUERY_INFO = PPDH_LOG_SERVICE_QUERY_INFO_A;
  503.   {$EXTERNALSYM PPDH_LOG_SERVICE_QUERY_INFO}
  504.   TPdhLogServiceQueryInfo = _PDH_LOG_SERVICE_QUERY_INFO_A;
  505. {$ENDIF}
  506. //
  507. //  Time value constants
  508. //
  509. const
  510.   MAX_TIME_VALUE = LONGLONG($7FFFFFFFFFFFFFFF);
  511.   {$EXTERNALSYM MAX_TIME_VALUE}
  512.   MIN_TIME_VALUE = LONGLONG(0);
  513.   {$EXTERNALSYM MIN_TIME_VALUE}
  514. // function definitions
  515. function PdhGetDllVersion(var lpdwVersion: DWORD): PDH_STATUS; stdcall;
  516. {$EXTERNALSYM PdhGetDllVersion}
  517. //
  518. //  Query Functions
  519. //
  520. function PdhOpenQueryA(szDataSource: LPCSTR; dwUserData: DWORD_PTR;
  521.   var phQuery: PDH_HQUERY): PDH_STATUS; stdcall;
  522. {$EXTERNALSYM PdhOpenQueryA}
  523. function PdhOpenQueryW(szDataSource: LPCWSTR; dwUserData: DWORD_PTR;
  524.   var phQuery: PDH_HQUERY): PDH_STATUS; stdcall;
  525. {$EXTERNALSYM PdhOpenQueryW}
  526. {$IFDEF UNICODE}
  527. function PdhOpenQuery(szDataSource: LPCWSTR; dwUserData: DWORD_PTR;
  528.   var phQuery: PDH_HQUERY): PDH_STATUS; stdcall;
  529. {$EXTERNALSYM PdhOpenQuery}
  530. {$ELSE}
  531. function PdhOpenQuery(szDataSource: LPCSTR; dwUserData: DWORD_PTR;
  532.   var phQuery: PDH_HQUERY): PDH_STATUS; stdcall;
  533. {$EXTERNALSYM PdhOpenQuery}
  534. {$ENDIF}
  535. function PdhAddCounterA(hQuery: PDH_HQUERY; szFullCounterPath: LPCSTR;
  536.   dwUserData: DWORD_PTR; var phCounter: PDH_HCOUNTER): PDH_STATUS; stdcall;
  537. {$EXTERNALSYM PdhAddCounterA}
  538. function PdhAddCounterW(hQuery: PDH_HQUERY; szFullCounterPath: LPCWSTR;
  539.   dwUserData: DWORD_PTR; var phCounter: PDH_HCOUNTER): PDH_STATUS; stdcall;
  540. {$EXTERNALSYM PdhAddCounterW}
  541. {$IFDEF UNICODE}
  542. function PdhAddCounter(hQuery: PDH_HQUERY; szFullCounterPath: LPCWSTR;
  543.   dwUserData: DWORD_PTR; var phCounter: PDH_HCOUNTER): PDH_STATUS; stdcall;
  544. {$EXTERNALSYM PdhAddCounter}
  545. {$ELSE}
  546. function PdhAddCounter(hQuery: PDH_HQUERY; szFullCounterPath: LPCSTR;
  547.   dwUserData: DWORD_PTR; var phCounter: PDH_HCOUNTER): PDH_STATUS; stdcall;
  548. {$EXTERNALSYM PdhAddCounter}
  549. {$ENDIF}
  550. function PdhRemoveCounter(hCounter: PDH_HCOUNTER): PDH_STATUS; stdcall;
  551. {$EXTERNALSYM PdhRemoveCounter}
  552. function PdhCollectQueryData(hQuery: PDH_HQUERY): PDH_STATUS; stdcall;
  553. {$EXTERNALSYM PdhCollectQueryData}
  554. function PdhCloseQuery(hQuery: PDH_HQUERY): PDH_STATUS; stdcall;
  555. {$EXTERNALSYM PdhCloseQuery}
  556. //
  557. //  Counter Functions
  558. //
  559. function PdhGetFormattedCounterValue(hCounter: PDH_HCOUNTER; dwFormat: DWORD;
  560.   lpdwType: LPDWORD; var pValue: PDH_FMT_COUNTERVALUE): PDH_STATUS; stdcall;
  561. {$EXTERNALSYM PdhGetFormattedCounterValue}
  562. function PdhGetFormattedCounterArrayA(hCounter: PDH_HCOUNTER; dwFormat: DWORD;
  563.   var lpdwBufferSize, lpdwItemCount: DWORD;
  564.   var ItemBuffer: PDH_FMT_COUNTERVALUE_ITEM_A): PDH_STATUS; stdcall;
  565. {$EXTERNALSYM PdhGetFormattedCounterArrayA}
  566. function PdhGetFormattedCounterArrayW(hCounter: PDH_HCOUNTER; dwFormat: DWORD;
  567.   var lpdwBufferSize, lpdwItemCount: DWORD;
  568.   var ItemBuffer: PDH_FMT_COUNTERVALUE_ITEM_W): PDH_STATUS; stdcall;
  569. {$EXTERNALSYM PdhGetFormattedCounterArrayW}
  570. {$IFDEF UNICODE}
  571. function PdhGetFormattedCounterArray(hCounter: PDH_HCOUNTER; dwFormat: DWORD;
  572.   var lpdwBufferSize, lpdwItemCount: DWORD;
  573.   var ItemBuffer: PDH_FMT_COUNTERVALUE_ITEM_W): PDH_STATUS; stdcall;
  574. {$EXTERNALSYM PdhGetFormattedCounterArray}
  575. {$ELSE}
  576. function PdhGetFormattedCounterArray(hCounter: PDH_HCOUNTER; dwFormat: DWORD;
  577.   var lpdwBufferSize, lpdwItemCount: DWORD;
  578.   var ItemBuffer: PDH_FMT_COUNTERVALUE_ITEM_A): PDH_STATUS; stdcall;
  579. {$EXTERNALSYM PdhGetFormattedCounterArray}
  580. {$ENDIF}
  581. // dwFormat flag values
  582. const
  583.   PDH_FMT_RAW      = DWORD($00000010);
  584.   {$EXTERNALSYM PDH_FMT_RAW}
  585.   PDH_FMT_ANSI     = DWORD($00000020);
  586.   {$EXTERNALSYM PDH_FMT_ANSI}
  587.   PDH_FMT_UNICODE  = DWORD($00000040);
  588.   {$EXTERNALSYM PDH_FMT_UNICODE}
  589.   PDH_FMT_LONG     = DWORD($00000100);
  590.   {$EXTERNALSYM PDH_FMT_LONG}
  591.   PDH_FMT_DOUBLE   = DWORD($00000200);
  592.   {$EXTERNALSYM PDH_FMT_DOUBLE}
  593.   PDH_FMT_LARGE    = DWORD($00000400);
  594.   {$EXTERNALSYM PDH_FMT_LARGE}
  595.   PDH_FMT_NOSCALE  = DWORD($00001000);
  596.   {$EXTERNALSYM PDH_FMT_NOSCALE}
  597.   PDH_FMT_1000     = DWORD($00002000);
  598.   {$EXTERNALSYM PDH_FMT_1000}
  599.   PDH_FMT_NODATA   = DWORD($00004000);
  600.   {$EXTERNALSYM PDH_FMT_NODATA}
  601.   PDH_FMT_NOCAP100 = DWORD($00008000);
  602.   {$EXTERNALSYM PDH_FMT_NODATA}
  603.   PERF_DETAIL_COSTLY   = DWORD($00010000);
  604.   {$EXTERNALSYM PERF_DETAIL_COSTLY}
  605.   PERF_DETAIL_STANDARD = DWORD($0000FFFF);
  606.   {$EXTERNALSYM PERF_DETAIL_STANDARD}
  607. function PdhGetRawCounterValue(hCounter: PDH_HCOUNTER; lpdwType: LPDWORD;
  608.   var pValue: PDH_RAW_COUNTER): PDH_STATUS; stdcall;
  609. {$EXTERNALSYM PdhGetRawCounterValue}
  610. function PdhGetRawCounterArrayA(hCounter: PDH_HCOUNTER; var lpdwBufferSize,
  611.   lpdwItemCount: DWORD; var ItemBuffer: PDH_RAW_COUNTER_ITEM_A): PDH_STATUS; stdcall;
  612. {$EXTERNALSYM PdhGetRawCounterArrayA}
  613. function PdhGetRawCounterArrayW(hCounter: PDH_HCOUNTER; var lpdwBufferSize,
  614.   lpdwItemCount: DWORD; var ItemBuffer: PDH_RAW_COUNTER_ITEM_W): PDH_STATUS; stdcall;
  615. {$EXTERNALSYM PdhGetRawCounterArrayW}
  616. {$IFDEF UNICODE}
  617. function PdhGetRawCounterArray(hCounter: PDH_HCOUNTER; var lpdwBufferSize,
  618.   lpdwItemCount: DWORD; var ItemBuffer: PDH_RAW_COUNTER_ITEM_W): PDH_STATUS; stdcall;
  619. {$EXTERNALSYM PdhGetRawCounterArray}
  620. {$ELSE}
  621. function PdhGetRawCounterArray(hCounter: PDH_HCOUNTER; var lpdwBufferSize,
  622.   lpdwItemCount: DWORD; var ItemBuffer: PDH_RAW_COUNTER_ITEM_A): PDH_STATUS; stdcall;
  623. {$EXTERNALSYM PdhGetRawCounterArray}
  624. {$ENDIF}
  625. function PdhCalculateCounterFromRawValue(hCounter: PDH_HCOUNTER; dwFormat: DWORD;
  626.   rawValue1, rawValue2: PPDH_RAW_COUNTER; var fmtValue: PDH_FMT_COUNTERVALUE): PDH_STATUS; stdcall;
  627. {$EXTERNALSYM PdhCalculateCounterFromRawValue}
  628. function PdhComputeCounterStatistics(hCounter: PDH_HCOUNTER; dwFormat, dwFirstEntry,
  629.   dwNumEntries: DWORD; lpRawValueArray: PPDH_RAW_COUNTER; var data: PDH_STATISTICS): PDH_STATUS; stdcall;
  630. {$EXTERNALSYM PdhComputeCounterStatistics}
  631. function PdhGetCounterInfoA(hCounter: PDH_HCOUNTER; bRetrieveExplainText: Boolean;
  632.   var pdwBufferSize: DWORD; lpBuffer: PPDH_COUNTER_INFO_A): PDH_STATUS; stdcall;
  633. {$EXTERNALSYM PdhGetCounterInfoA}
  634. function PdhGetCounterInfoW(hCounter: PDH_HCOUNTER; bRetrieveExplainText: Boolean;
  635.   var pdwBufferSize: DWORD; lpBuffer: PPDH_COUNTER_INFO_W): PDH_STATUS; stdcall;
  636. {$EXTERNALSYM PdhGetCounterInfoW}
  637. {$IFDEF UNICODE}
  638. function PdhGetCounterInfo(hCounter: PDH_HCOUNTER; bRetrieveExplainText: Boolean;
  639.   var pdwBufferSize: DWORD; lpBuffer: PPDH_COUNTER_INFO_W): PDH_STATUS; stdcall;
  640. {$EXTERNALSYM PdhGetCounterInfo}
  641. {$ELSE}
  642. function PdhGetCounterInfo(hCounter: PDH_HCOUNTER; bRetrieveExplainText: Boolean;
  643.   var pdwBufferSize: DWORD; lpBuffer: PPDH_COUNTER_INFO_A): PDH_STATUS; stdcall;
  644. {$EXTERNALSYM PdhGetCounterInfo}
  645. {$ENDIF}
  646. const
  647.   PDH_MAX_SCALE = Longint(7);
  648.   {$EXTERNALSYM PDH_MAX_SCALE}
  649.   PDH_MIN_SCALE = Longint(-7);
  650.   {$EXTERNALSYM PDH_MIN_SCALE}
  651. function PdhSetCounterScaleFactor(hCounter: PDH_HCOUNTER; lFactor: LONG): PDH_STATUS; stdcall;
  652. {$EXTERNALSYM PdhSetCounterScaleFactor}
  653. //
  654. //   Browsing and enumeration functions
  655. //
  656. function PdhConnectMachineA(szMachineName: LPCSTR): PDH_STATUS; stdcall;
  657. {$EXTERNALSYM PdhConnectMachineA}
  658. function PdhConnectMachineW(szMachineName: LPCWSTR): PDH_STATUS; stdcall;
  659. {$EXTERNALSYM PdhConnectMachineW}
  660. {$IFDEF UNICODE}
  661. function PdhConnectMachine(szMachineName: LPCWSTR): PDH_STATUS; stdcall;
  662. {$EXTERNALSYM PdhConnectMachine}
  663. {$ELSE}
  664. function PdhConnectMachine(szMachineName: LPCSTR): PDH_STATUS; stdcall;
  665. {$EXTERNALSYM PdhConnectMachine}
  666. {$ENDIF}
  667. function PdhEnumMachinesA(szDataSource: LPCSTR; mszMachineList: LPSTR;
  668.   pcchBufferSize: LPDWORD): PDH_STATUS; stdcall;
  669. {$EXTERNALSYM PdhEnumMachinesA}
  670. function PdhEnumMachinesW(szDataSource: LPCWSTR; mszMachineList: LPWSTR;
  671.   pcchBufferSize: LPDWORD): PDH_STATUS; stdcall;
  672. {$EXTERNALSYM PdhEnumMachinesW}
  673. {$IFDEF UNICODE}
  674. function PdhEnumMachines(szDataSource: LPCWSTR; mszMachineList: LPWSTR;
  675.   pcchBufferSize: LPDWORD): PDH_STATUS; stdcall;
  676. {$EXTERNALSYM PdhEnumMachines}
  677. {$ELSE}
  678. function PdhEnumMachines(szDataSource: LPCSTR; mszMachineList: LPSTR;
  679.   pcchBufferSize: LPDWORD): PDH_STATUS; stdcall;
  680. {$EXTERNALSYM PdhEnumMachines}
  681. {$ENDIF}
  682. function PdhEnumObjectsA(szDataSource, szMachineName: LPCSTR; mszObjectList: LPSTR;
  683.   var pcchBufferSize: DWORD; dwDetailLevel: DWORD; bRefresh: BOOL): PDH_STATUS; stdcall;
  684. {$EXTERNALSYM PdhEnumObjectsA}
  685. function PdhEnumObjectsW(szDataSource, szMachineName: LPCWSTR; mszObjectList: LPWSTR;
  686.   var pcchBufferSize: DWORD; dwDetailLevel: DWORD; bRefresh: BOOL): PDH_STATUS; stdcall;
  687. {$EXTERNALSYM PdhEnumObjectsW}
  688. {$IFDEF UNICODE}
  689. function PdhEnumObjects(szDataSource, szMachineName: LPCWSTR; mszObjectList: LPWSTR;
  690.   var pcchBufferSize: DWORD; dwDetailLevel: DWORD; bRefresh: BOOL): PDH_STATUS; stdcall;
  691. {$EXTERNALSYM PdhEnumObjects}
  692. {$ELSE}
  693. function PdhEnumObjects(szDataSource, szMachineName: LPCSTR; mszObjectList: LPSTR;
  694.   var pcchBufferSize: DWORD; dwDetailLevel: DWORD; bRefresh: BOOL): PDH_STATUS; stdcall;
  695. {$EXTERNALSYM PdhEnumObjects}
  696. {$ENDIF}
  697. function PdhEnumObjectItemsA(szDataSource, szMachineName, szObjectName: LPCSTR;
  698.   mszCounterList: LPSTR; var pcchCounterListLength: DWORD; mszInstanceList: LPSTR;
  699.   var pcchInstanceListLength: DWORD; dwDetailLevel, dwFlags: DWORD): PDH_STATUS; stdcall;
  700. {$EXTERNALSYM PdhEnumObjectItemsA}
  701. function PdhEnumObjectItemsW(szDataSource, szMachineName, szObjectName: LPCWSTR;
  702.   mszCounterList: LPWSTR; var pcchCounterListLength: DWORD; mszInstanceList: LPWSTR;
  703.   var pcchInstanceListLength: DWORD; dwDetailLevel, dwFlags: DWORD): PDH_STATUS; stdcall;
  704. {$EXTERNALSYM PdhEnumObjectItemsW}
  705. {$IFDEF UNICODE}
  706. function PdhEnumObjectItems(szDataSource, szMachineName, szObjectName: LPCWSTR;
  707.   mszCounterList: LPWSTR; var pcchCounterListLength: DWORD; mszInstanceList: LPWSTR;
  708.   var pcchInstanceListLength: DWORD; dwDetailLevel, dwFlags: DWORD): PDH_STATUS; stdcall;
  709. {$EXTERNALSYM PdhEnumObjectItems}
  710. {$ELSE}
  711. function PdhEnumObjectItems(szDataSource, szMachineName, szObjectName: LPCSTR;
  712.   mszCounterList: LPSTR; var pcchCounterListLength: DWORD; mszInstanceList: LPSTR;
  713.   var pcchInstanceListLength: DWORD; dwDetailLevel, dwFlags: DWORD): PDH_STATUS; stdcall;
  714. {$EXTERNALSYM PdhEnumObjectItems}
  715. {$ENDIF}
  716. const
  717.   PDH_OBJECT_HAS_INSTANCES  = $00000001;
  718.   {$EXTERNALSYM PDH_OBJECT_HAS_INSTANCES}
  719. function PdhMakeCounterPathA(pCounterPathElements: PPDH_COUNTER_PATH_ELEMENTS_A;
  720.   szFullPathBuffer: LPSTR; var pcchBufferSize: DWORD; dwFlags: DWORD): PDH_STATUS; stdcall;
  721. {$EXTERNALSYM PdhMakeCounterPathA}
  722. function PdhMakeCounterPathW(pCounterPathElements: PPDH_COUNTER_PATH_ELEMENTS_W;
  723.   szFullPathBuffer: LPWSTR; var pcchBufferSize: DWORD; dwFlags: DWORD): PDH_STATUS; stdcall;
  724. {$EXTERNALSYM PdhMakeCounterPathW}
  725. {$IFDEF UNICODE}
  726. function PdhMakeCounterPath(pCounterPathElements: PPDH_COUNTER_PATH_ELEMENTS_W;
  727.   szFullPathBuffer: LPWSTR; var pcchBufferSize: DWORD; dwFlags: DWORD): PDH_STATUS; stdcall;
  728. {$EXTERNALSYM PdhMakeCounterPath}
  729. {$ELSE}
  730. function PdhMakeCounterPath(pCounterPathElements: PPDH_COUNTER_PATH_ELEMENTS_A;
  731.   szFullPathBuffer: LPSTR; var pcchBufferSize: DWORD; dwFlags: DWORD): PDH_STATUS; stdcall;
  732. {$EXTERNALSYM PdhMakeCounterPath}
  733. {$ENDIF}
  734. // todo shouldn't pCounterPathElements be a pointer to ...?
  735. function PdhParseCounterPathA(szFullPathBuffer: LPCSTR;
  736.   pCounterPathElements: PDH_COUNTER_PATH_ELEMENTS_A; var pdwBufferSize: DWORD;
  737.   dwFlags: DWORD): PDH_STATUS; stdcall;
  738. {$EXTERNALSYM PdhParseCounterPathA}
  739. function PdhParseCounterPathW(szFullPathBuffer: LPCWSTR;
  740.   pCounterPathElements: PDH_COUNTER_PATH_ELEMENTS_W; var pdwBufferSize: DWORD;
  741.   dwFlags: DWORD): PDH_STATUS; stdcall;
  742. {$EXTERNALSYM PdhParseCounterPathW}
  743. {$IFDEF UNICODE}
  744. function PdhParseCounterPath(szFullPathBuffer: LPCWSTR;
  745.   pCounterPathElements: PDH_COUNTER_PATH_ELEMENTS_W; var pdwBufferSize: DWORD;
  746.   dwFlags: DWORD): PDH_STATUS; stdcall;
  747. {$EXTERNALSYM PdhParseCounterPath}
  748. {$ELSE}
  749. function PdhParseCounterPath(szFullPathBuffer: LPCSTR;
  750.   pCounterPathElements: PDH_COUNTER_PATH_ELEMENTS_A; var pdwBufferSize: DWORD;
  751.   dwFlags: DWORD): PDH_STATUS; stdcall;
  752. {$EXTERNALSYM PdhParseCounterPath}
  753. {$ENDIF}
  754. const
  755.   PDH_PATH_WBEM_RESULT       = DWORD($00000001);
  756.   {$EXTERNALSYM PDH_PATH_WBEM_RESULT}
  757.   PDH_PATH_WBEM_INPUT        = DWORD($00000002);
  758.   {$EXTERNALSYM PDH_PATH_WBEM_INPUT}
  759. function PDH_PATH_LANG_FLAGS(LangId, Flags: DWORD): DWORD;
  760. {$EXTERNALSYM PDH_PATH_LANG_FLAGS}
  761. function PdhParseInstanceNameA(szInstanceString: LPSTR; szInstanceName: LPCSTR;
  762.   var pcchInstanceNameLength: DWORD; szParentName: LPSTR;
  763.   var pcchParentNameLength: DWORD; lpIndex: LPDWORD): PDH_STATUS; stdcall;
  764. {$EXTERNALSYM PdhParseInstanceNameA}
  765. function PdhParseInstanceNameW(szInstanceString: LPWSTR; szInstanceName: LPCWSTR;
  766.   var pcchInstanceNameLength: DWORD; szParentName: LPWSTR;
  767.   var pcchParentNameLength: DWORD; lpIndex: LPDWORD): PDH_STATUS; stdcall;
  768. {$EXTERNALSYM PdhParseInstanceNameW}
  769. {$IFDEF UNICODE}
  770. function PdhParseInstanceName(szInstanceString: LPWSTR; szInstanceName: LPCWSTR;
  771.   var pcchInstanceNameLength: DWORD; szParentName: LPWSTR;
  772.   var pcchParentNameLength: DWORD; lpIndex: LPDWORD): PDH_STATUS; stdcall;
  773. {$EXTERNALSYM PdhParseInstanceName}
  774. {$ELSE}
  775. function PdhParseInstanceName(szInstanceString: LPSTR; szInstanceName: LPCSTR;
  776.   var pcchInstanceNameLength: DWORD; szParentName: LPSTR;
  777.   var pcchParentNameLength: DWORD; lpIndex: LPDWORD): PDH_STATUS; stdcall;
  778. {$EXTERNALSYM PdhParseInstanceName}
  779. {$ENDIF}
  780. function PdhValidatePathA(szFullPathBuffer: LPCSTR): PDH_STATUS; stdcall;
  781. {$EXTERNALSYM PdhValidatePathA}
  782. function PdhValidatePathW(szFullPathBuffer: LPCWSTR): PDH_STATUS; stdcall;
  783. {$EXTERNALSYM PdhValidatePathW}
  784. {$IFDEF UNICODE}
  785. function PdhValidatePath(szFullPathBuffer: LPCWSTR): PDH_STATUS; stdcall;
  786. {$EXTERNALSYM PdhValidatePath}
  787. {$ELSE}
  788. function PdhValidatePath(szFullPathBuffer: LPCSTR): PDH_STATUS; stdcall;
  789. {$EXTERNALSYM PdhValidatePath}
  790. {$ENDIF}
  791. function PdhGetDefaultPerfObjectA(szDataSource, szMachineName: LPCSTR;
  792.   szDefaultObjectName: LPSTR; var pcchBufferSize: DWORD): PDH_STATUS; stdcall;
  793. {$EXTERNALSYM PdhGetDefaultPerfObjectA}
  794. function PdhGetDefaultPerfObjectW(szDataSource, szMachineName: LPCWSTR;
  795.   szDefaultObjectName: LPWSTR; var pcchBufferSize: DWORD): PDH_STATUS; stdcall;
  796. {$EXTERNALSYM PdhGetDefaultPerfObjectW}
  797. {$IFDEF UNICODE}
  798. function PdhGetDefaultPerfObject(szDataSource, szMachineName: LPCWSTR;
  799.   szDefaultObjectName: LPWSTR; var pcchBufferSize: DWORD): PDH_STATUS; stdcall;
  800. {$EXTERNALSYM PdhGetDefaultPerfObject}
  801. {$ELSE}
  802. function PdhGetDefaultPerfObject(szDataSource, szMachineName: LPCSTR;
  803.   szDefaultObjectName: LPSTR; var pcchBufferSize: DWORD): PDH_STATUS; stdcall;
  804. {$EXTERNALSYM PdhGetDefaultPerfObject}
  805. {$ENDIF}
  806. function PdhGetDefaultPerfCounterA(szDataSource, szMachineName, szObjectName: LPCSTR;
  807.   szDefaultCounterName: LPSTR; var pcchBufferSize: DWORD): PDH_STATUS; stdcall;
  808. {$EXTERNALSYM PdhGetDefaultPerfCounterA}
  809. function PdhGetDefaultPerfCounterW(szDataSource, szMachineName, szObjectName: LPCWSTR;
  810.   szDefaultCounterName: LPWSTR; var pcchBufferSize: DWORD): PDH_STATUS; stdcall;
  811. {$EXTERNALSYM PdhGetDefaultPerfCounterW}
  812. {$IFDEF UNICODE}
  813. function PdhGetDefaultPerfCounter(szDataSource, szMachineName, szObjectName: LPCWSTR;
  814.   szDefaultCounterName: LPWSTR; var pcchBufferSize: DWORD): PDH_STATUS; stdcall;
  815. {$EXTERNALSYM PdhGetDefaultPerfCounter}
  816. {$ELSE}
  817. function PdhGetDefaultPerfCounter(szDataSource, szMachineName, szObjectName: LPCSTR;
  818.   szDefaultCounterName: LPSTR; var pcchBufferSize: DWORD): PDH_STATUS; stdcall;
  819. {$EXTERNALSYM PdhGetDefaultPerfCounter}
  820. {$ENDIF}
  821. type
  822.   CounterPathCallBack = function (dwArg: DWORD_PTR): PDH_STATUS; stdcall;
  823.   {$EXTERNALSYM CounterPathCallBack}
  824. const
  825.   PDH_CF_INCLUDEINSTANCEINDEX    = 1 shl 0;
  826.   PDH_CF_SINGLECOUNTERPERADD     = 1 shl 1;
  827.   PDH_CF_SINGLECOUNTERPERDIALOG  = 1 shl 2;
  828.   PDH_CF_LOCALCOUNTERSONLY       = 1 shl 3;
  829.   PDH_CF_WILDCARDINSTANCES       = 1 shl 4;
  830.   PDH_CF_HIDEDETAILBOX           = 1 shl 5;
  831.   PDH_CF_INITIALIZEPATH          = 1 shl 6;
  832.   PDH_CF_DISABLEMACHINESELECTION = 1 shl 7;
  833.   PDH_CF_INCLUDECOSTLYOBJECTS    = 1 shl 8;
  834.   PDH_CF_SHOWOBJECTBROWSER       = 1 shl 9;
  835.   PDH_CF_RESERVED                = DWORD($FFFFFD00);
  836. type
  837.   _BrowseDlgConfig_HW = record
  838.     // Configuration flags
  839.     dwConfigFlags: DWORD;
  840.     hWndOwner: HWND;
  841.     hDataSource: PDH_HLOG;
  842.     szReturnPathBuffer: LPWSTR;
  843.     cchReturnPathLength: DWORD;
  844.     pCallBack: CounterPathCallBack;
  845.     dwCallBackArg: DWORD_PTR;
  846.     CallBackStatus: PDH_STATUS;
  847.     dwDefaultDetailLevel: DWORD;
  848.     szDialogBoxCaption: LPWSTR;
  849.   end;
  850.   {$EXTERNALSYM _BrowseDlgConfig_HW}
  851.   PDH_BROWSE_DLG_CONFIG_HW = _BrowseDlgConfig_HW;
  852.   {$EXTERNALSYM PDH_BROWSE_DLG_CONFIG_HW}
  853.   PPDH_BROWSE_DLG_CONFIG_HW = ^PDH_BROWSE_DLG_CONFIG_HW;
  854.   {$EXTERNALSYM PPDH_BROWSE_DLG_CONFIG_HW}
  855.   TPdhBrowseDlgConfigHW = PDH_BROWSE_DLG_CONFIG_HW;
  856.   PPdhBrowseDlgConfigHW = PPDH_BROWSE_DLG_CONFIG_HW;
  857.   _BrowseDlgConfig_HA = record
  858.     // Configuration flags
  859.     dwConfigFlags: DWORD;
  860.     hWndOwner: HWND;
  861.     hDataSource: PDH_HLOG;
  862.     szReturnPathBuffer: LPSTR;
  863.     cchReturnPathLength: DWORD;
  864.     pCallBack: CounterPathCallBack;
  865.     dwCallBackArg: DWORD_PTR;
  866.     CallBackStatus: PDH_STATUS;
  867.     dwDefaultDetailLevel: DWORD;
  868.     szDialogBoxCaption: LPSTR;
  869.   end;
  870.   {$EXTERNALSYM _BrowseDlgConfig_HA}
  871.   PDH_BROWSE_DLG_CONFIG_HA = _BrowseDlgConfig_HA;
  872.   {$EXTERNALSYM PDH_BROWSE_DLG_CONFIG_HA}
  873.   PPDH_BROWSE_DLG_CONFIG_HA = ^PDH_BROWSE_DLG_CONFIG_HA;
  874.   {$EXTERNALSYM PPDH_BROWSE_DLG_CONFIG_HA}
  875.   TPdhBrowseDlGconfigHA = PDH_BROWSE_DLG_CONFIG_HA;
  876.   PPdhBrowseDlGconfigHA = PPDH_BROWSE_DLG_CONFIG_HA;
  877.   PPDH_BROWSE_DLG_CONFIG_A = ^_BrowseDlgConfig_A;
  878.   {$EXTERNALSYM PPDH_BROWSE_DLG_CONFIG_A}
  879.   _BrowseDlgConfig_A = record
  880.     dwConfigFlags: DWORD;
  881.     hWndOwner: HWND;
  882.     szDataSource: LPSTR;
  883.     szReturnPathBuffer: LPSTR;
  884.     cchReturnPathLength: DWORD;
  885.     pCallBack: CounterPathCallBack;
  886.     dwCallBackArg: DWORD_PTR;
  887.     CallBackStatus: PDH_STATUS;
  888.     dwDefaultDetailLevel: DWORD;
  889.     szDialogBoxCaption: LPSTR;
  890.   end;
  891.   {$EXTERNALSYM _BrowseDlgConfig_A}
  892.   PDH_BROWSE_DLG_CONFIG_A = _BrowseDlgConfig_A;
  893.   {$EXTERNALSYM PDH_BROWSE_DLG_CONFIG_A}
  894.   TPdhBrowseDlgConfigA = PDH_BROWSE_DLG_CONFIG_A;
  895.   PPdhBrowseDlgConfigA = PPDH_BROWSE_DLG_CONFIG_A;
  896.   PPDH_BROWSE_DLG_CONFIG_W = ^_BrowseDlgConfig_W;
  897.   {$EXTERNALSYM PPDH_BROWSE_DLG_CONFIG_W}
  898.   _BrowseDlgConfig_W = record
  899.     dwConfigFlags: DWORD;
  900.     hWndOwner: HWND;
  901.     szDataSource: LPWSTR;
  902.     szReturnPathBuffer: LPWSTR;
  903.     cchReturnPathLength: DWORD;
  904.     pCallBack: CounterPathCallBack;
  905.     dwCallBackArg: DWORD_PTR;
  906.     CallBackStatus: PDH_STATUS;
  907.     dwDefaultDetailLevel: DWORD;
  908.     szDialogBoxCaption: LPWSTR;
  909.   end;
  910.   {$EXTERNALSYM _BrowseDlgConfig_W}
  911.   PDH_BROWSE_DLG_CONFIG_W = _BrowseDlgConfig_W;
  912.   {$EXTERNALSYM PDH_BROWSE_DLG_CONFIG_W}
  913.   TPdhBrowseDlgConfigW = PDH_BROWSE_DLG_CONFIG_W;
  914.   PPdhBrowseDlgConfigW = PPDH_BROWSE_DLG_CONFIG_W;
  915. {$IFDEF UNICODE}
  916.   PPdhBrowseDlgConfig = PPdhBrowseDlgConfigW;
  917.   PDH_BROWSE_DLG_CONFIG = PDH_BROWSE_DLG_CONFIG_W;
  918.   {$EXTERNALSYM PDH_BROWSE_DLG_CONFIG}
  919.   PPDH_BROWSE_DLG_CONFIG = PPDH_BROWSE_DLG_CONFIG_W;
  920.   {$EXTERNALSYM PPDH_BROWSE_DLG_CONFIG}
  921.   TPdhBrowseDlgConfig = TPdhBrowseDlgConfigW;
  922. {$ELSE}
  923.   PPdhBrowseDlgConfig = PPdhBrowseDlgConfigA;
  924.   PDH_BROWSE_DLG_CONFIG = PDH_BROWSE_DLG_CONFIG_A;
  925.   {$EXTERNALSYM PDH_BROWSE_DLG_CONFIG}
  926.   PPDH_BROWSE_DLG_CONFIG = PPDH_BROWSE_DLG_CONFIG_A;
  927.   {$EXTERNALSYM PPDH_BROWSE_DLG_CONFIG}
  928.   TPdhBrowseDlgConfig = TPdhBrowseDlgConfigA;
  929. {$ENDIF}
  930. function PdhBrowseCountersA(const pBrowseDlgData: PDH_BROWSE_DLG_CONFIG_A): PDH_STATUS; stdcall;
  931. {$EXTERNALSYM PdhBrowseCountersA}
  932. function PdhBrowseCountersW(const pBrowseDlgData: PDH_BROWSE_DLG_CONFIG_W): PDH_STATUS; stdcall;
  933. {$EXTERNALSYM PdhBrowseCountersW}
  934. {$IFDEF UNICODE}
  935. function PdhBrowseCounters(const pBrowseDlgData: PDH_BROWSE_DLG_CONFIG_W): PDH_STATUS; stdcall;
  936. {$EXTERNALSYM PdhBrowseCounters}
  937. {$ELSE}
  938. function PdhBrowseCounters(const pBrowseDlgData: PDH_BROWSE_DLG_CONFIG_A): PDH_STATUS; stdcall;
  939. {$EXTERNALSYM PdhBrowseCounters}
  940. {$ENDIF}
  941. function PdhExpandCounterPathA(szWildCardPath: LPCSTR; mszExpandedPathList: LPSTR;
  942.   var pcchPathListLength: DWORD): PDH_STATUS; stdcall;
  943. {$EXTERNALSYM PdhExpandCounterPathA}
  944. function PdhExpandCounterPathW(szWildCardPath: LPCWSTR; mszExpandedPathList: LPWSTR;
  945.   var pcchPathListLength: DWORD): PDH_STATUS; stdcall;
  946. {$EXTERNALSYM PdhExpandCounterPathW}
  947. {$IFDEF UNICODE}
  948. function PdhExpandCounterPath(szWildCardPath: LPCWSTR; mszExpandedPathList: LPWSTR;
  949.   var pcchPathListLength: DWORD): PDH_STATUS; stdcall;
  950. {$EXTERNALSYM PdhExpandCounterPath}
  951. {$ELSE}
  952. function PdhExpandCounterPath(szWildCardPath: LPCSTR; mszExpandedPathList: LPSTR;
  953.   var pcchPathListLength: DWORD): PDH_STATUS; stdcall;
  954. {$EXTERNALSYM PdhExpandCounterPath}
  955. {$ENDIF}
  956. //
  957. //  v2.0 functions
  958. //
  959. function PdhLookupPerfNameByIndexA(szMachineName: LPCSTR; dwNameIndex: DWORD;
  960.   szNameBuffer: LPSTR; var pcchNameBufferSize: DWORD): PDH_STATUS; stdcall;
  961. {$EXTERNALSYM PdhLookupPerfNameByIndexA}
  962. function PdhLookupPerfNameByIndexW(szMachineName: LPCWSTR; dwNameIndex: DWORD;
  963.   szNameBuffer: LPWSTR; var pcchNameBufferSize: DWORD): PDH_STATUS; stdcall;
  964. {$EXTERNALSYM PdhLookupPerfNameByIndexW}
  965. {$IFDEF UNICODE}
  966. function PdhLookupPerfNameByIndex(szMachineName: LPCWSTR; dwNameIndex: DWORD;
  967.   szNameBuffer: LPWSTR; var pcchNameBufferSize: DWORD): PDH_STATUS; stdcall;
  968. {$EXTERNALSYM PdhLookupPerfNameByIndex}
  969. {$ELSE}
  970. function PdhLookupPerfNameByIndex(szMachineName: LPCSTR; dwNameIndex: DWORD;
  971.   szNameBuffer: LPSTR; var pcchNameBufferSize: DWORD): PDH_STATUS; stdcall;
  972. {$EXTERNALSYM PdhLookupPerfNameByIndex}
  973. {$ENDIF}
  974. function PdhLookupPerfIndexByNameA(szMachineName, szNameBuffer: LPCSTR;
  975.   var pdwIndex: DWORD): PDH_STATUS; stdcall;
  976. {$EXTERNALSYM PdhLookupPerfIndexByNameA}
  977. function PdhLookupPerfIndexByNameW(szMachineName, szNameBuffer: LPCWSTR;
  978.   var pdwIndex: DWORD): PDH_STATUS; stdcall;
  979. {$EXTERNALSYM PdhLookupPerfIndexByNameW}
  980. {$IFDEF UNICODE}
  981. function PdhLookupPerfIndexByName(szMachineName, szNameBuffer: LPCWSTR;
  982.   var pdwIndex: DWORD): PDH_STATUS; stdcall;
  983. {$EXTERNALSYM PdhLookupPerfIndexByName}
  984. {$ELSE}
  985. function PdhLookupPerfIndexByName(szMachineName, szNameBuffer: LPCSTR;
  986.   var pdwIndex: DWORD): PDH_STATUS; stdcall;
  987. {$EXTERNALSYM PdhLookupPerfIndexByName}
  988. {$ENDIF}
  989. const
  990.   PDH_NOEXPANDCOUNTERS   = 1;
  991.   {$EXTERNALSYM PDH_NOEXPANDCOUNTERS}
  992.   PDH_NOEXPANDINSTANCES  = 2;
  993.   {$EXTERNALSYM PDH_NOEXPANDINSTANCES}
  994. function PdhExpandWildCardPathA(szDataSource, szWildCardPath: LPCSTR;
  995.   mszExpandedPathList: LPSTR; var pcchPathListLength: DWORD; dwFlags: DWORD): PDH_STATUS; stdcall;
  996. {$EXTERNALSYM PdhExpandWildCardPathA}
  997. function PdhExpandWildCardPathW(szDataSource, szWildCardPath: LPCWSTR;
  998.   mszExpandedPathList: LPWSTR; var pcchPathListLength: DWORD; dwFlags: DWORD): PDH_STATUS; stdcall;
  999. {$EXTERNALSYM PdhExpandWildCardPathW}
  1000. {$IFDEF UNICODE}
  1001. function PdhExpandWildCardPath(szDataSource, szWildCardPath: LPCWSTR;
  1002.   mszExpandedPathList: LPWSTR; var pcchPathListLength: DWORD; dwFlags: DWORD): PDH_STATUS; stdcall;
  1003. {$EXTERNALSYM PdhExpandWildCardPath}
  1004. {$ELSE}
  1005. function PdhExpandWildCardPath(szDataSource, szWildCardPath: LPCSTR;
  1006.   mszExpandedPathList: LPSTR; var pcchPathListLength: DWORD; dwFlags: DWORD): PDH_STATUS; stdcall;
  1007. {$EXTERNALSYM PdhExpandWildCardPath}
  1008. {$ENDIF}
  1009. //
  1010. //   Logging Functions
  1011. //
  1012. const
  1013.   PDH_LOG_READ_ACCESS        = DWORD($00010000);
  1014.   {$EXTERNALSYM PDH_LOG_READ_ACCESS}
  1015.   PDH_LOG_WRITE_ACCESS       = DWORD($00020000);
  1016.   {$EXTERNALSYM PDH_LOG_WRITE_ACCESS}
  1017.   PDH_LOG_UPDATE_ACCESS      = DWORD($00040000);
  1018.   {$EXTERNALSYM PDH_LOG_UPDATE_ACCESS}
  1019.   PDH_LOG_ACCESS_MASK        = DWORD($000F0000);
  1020.   {$EXTERNALSYM PDH_LOG_ACCESS_MASK}
  1021.   PDH_LOG_CREATE_NEW         = DWORD($00000001);
  1022.   {$EXTERNALSYM PDH_LOG_CREATE_NEW}
  1023.   PDH_LOG_CREATE_ALWAYS      = DWORD($00000002);
  1024.   {$EXTERNALSYM PDH_LOG_CREATE_ALWAYS}
  1025.   PDH_LOG_OPEN_ALWAYS        = DWORD($00000003);
  1026.   {$EXTERNALSYM PDH_LOG_OPEN_ALWAYS}
  1027.   PDH_LOG_OPEN_EXISTING      = DWORD($00000004);
  1028.   {$EXTERNALSYM PDH_LOG_OPEN_EXISTING}
  1029.   PDH_LOG_CREATE_MASK        = DWORD($0000000F);
  1030.   {$EXTERNALSYM PDH_LOG_CREATE_MASK}
  1031.   PDH_LOG_OPT_USER_STRING    = DWORD($01000000);
  1032.   {$EXTERNALSYM PDH_LOG_OPT_USER_STRING}
  1033.   PDH_LOG_OPT_CIRCULAR       = DWORD($02000000);
  1034.   {$EXTERNALSYM PDH_LOG_OPT_CIRCULAR}
  1035.   PDH_LOG_OPT_MAX_IS_BYTES   = DWORD($04000000);
  1036.   {$EXTERNALSYM PDH_LOG_OPT_MAX_IS_BYTES}
  1037.   PDH_LOG_OPT_APPEND         = DWORD($08000000);
  1038.   {$EXTERNALSYM PDH_LOG_OPT_APPEND}
  1039.   PDH_LOG_OPT_MASK           = DWORD($0F000000);
  1040.   {$EXTERNALSYM PDH_LOG_OPT_MASK}
  1041.   PDH_LOG_TYPE_UNDEFINED     = 0;
  1042.   {$EXTERNALSYM PDH_LOG_TYPE_UNDEFINED}
  1043.   PDH_LOG_TYPE_CSV           = 1;
  1044.   {$EXTERNALSYM PDH_LOG_TYPE_CSV}
  1045.   PDH_LOG_TYPE_TSV           = 2;
  1046.   {$EXTERNALSYM PDH_LOG_TYPE_TSV}
  1047.   //PDH_LOG_TYPE_BINARY        = 3;  // this is the retired binary format
  1048.   //{$EXTERNALSYM PDH_LOG_TYPE_BINARY}
  1049.   PDH_LOG_TYPE_TRACE_KERNEL  = 4;
  1050.   {$EXTERNALSYM PDH_LOG_TYPE_TRACE_KERNEL}
  1051.   PDH_LOG_TYPE_TRACE_GENERIC = 5;
  1052.   {$EXTERNALSYM PDH_LOG_TYPE_TRACE_GENERIC}
  1053.   PDH_LOG_TYPE_PERFMON       = 6;
  1054.   {$EXTERNALSYM PDH_LOG_TYPE_PERFMON}
  1055.   PDH_LOG_TYPE_SQL           = 7;
  1056.   {$EXTERNALSYM PDH_LOG_TYPE_SQL}
  1057.   PDH_LOG_TYPE_BINARY        = 8;
  1058.   {$EXTERNALSYM PDH_LOG_TYPE_BINARY}
  1059. function PdhOpenLogA(szLogFileName: LPCSTR; dwAccessFlags: DWORD;
  1060.   lpdwLogType: LPDWORD; hQuery: PDH_HQUERY; dwMaxRecords: DWORD;
  1061.   szUserCaption: LPCSTR; var phLog: PDH_HLOG): PDH_STATUS; stdcall;
  1062. {$EXTERNALSYM PdhOpenLogA}
  1063. function PdhOpenLogW(szLogFileName: LPCWSTR; dwAccessFlags: DWORD;
  1064.   lpdwLogType: LPDWORD; hQuery: PDH_HQUERY; dwMaxRecords: DWORD;
  1065.   szUserCaption: LPCWSTR; var phLog: PDH_HLOG): PDH_STATUS; stdcall;
  1066. {$EXTERNALSYM PdhOpenLogW}
  1067. {$IFDEF UNICODE}
  1068. function PdhOpenLog(szLogFileName: LPCWSTR; dwAccessFlags: DWORD;
  1069.   lpdwLogType: LPDWORD; hQuery: PDH_HQUERY; dwMaxRecords: DWORD;
  1070.   szUserCaption: LPCWSTR; var phLog: PDH_HLOG): PDH_STATUS; stdcall;
  1071. {$EXTERNALSYM PdhOpenLog}
  1072. {$ELSE}
  1073. function PdhOpenLog(szLogFileName: LPCSTR; dwAccessFlags: DWORD;
  1074.   lpdwLogType: LPDWORD; hQuery: PDH_HQUERY; dwMaxRecords: DWORD;
  1075.   szUserCaption: LPCSTR; var phLog: PDH_HLOG): PDH_STATUS; stdcall;
  1076. {$EXTERNALSYM PdhOpenLog}
  1077. {$ENDIF}
  1078. function PdhUpdateLogA(hLog: PDH_HLOG; szUserString: LPCSTR): PDH_STATUS; stdcall;
  1079. {$EXTERNALSYM PdhUpdateLogA}
  1080. function PdhUpdateLogW(hLog: PDH_HLOG; szUserString: LPCWSTR): PDH_STATUS; stdcall;
  1081. {$EXTERNALSYM PdhUpdateLogW}
  1082. {$IFDEF UNICODE}
  1083. function PdhUpdateLog(hLog: PDH_HLOG; szUserString: LPCWSTR): PDH_STATUS; stdcall;
  1084. {$EXTERNALSYM PdhUpdateLog}
  1085. {$ELSE}
  1086. function PdhUpdateLog(hLog: PDH_HLOG; szUserString: LPCSTR): PDH_STATUS; stdcall;
  1087. {$EXTERNALSYM PdhUpdateLog}
  1088. {$ENDIF}
  1089. function PdhUpdateLogFileCatalog(hLog: PDH_HLOG): PDH_STATUS; stdcall;
  1090. {$EXTERNALSYM PdhUpdateLogFileCatalog}
  1091. function PdhGetLogFileSize(hLog: PDH_HLOG; var llSize: LONGLONG): PDH_STATUS; stdcall;
  1092. {$EXTERNALSYM PdhGetLogFileSize}
  1093. function PdhCloseLog(hLog: PDH_HLOG; dwFlags: DWORD): PDH_STATUS; stdcall;
  1094. {$EXTERNALSYM PdhCloseLog}
  1095. const
  1096.   PDH_FLAGS_CLOSE_QUERY = DWORD($00000001);
  1097.   {$EXTERNALSYM PDH_FLAGS_CLOSE_QUERY}
  1098. //
  1099. //  Data source selection dialog
  1100. //
  1101. const
  1102.   PDH_FLAGS_FILE_BROWSER_ONLY = DWORD($00000001);
  1103.   {$EXTERNALSYM PDH_FLAGS_FILE_BROWSER_ONLY}
  1104. function PdhSelectDataSourceA(hWndOwner: HWND; dwFlags: DWORD;
  1105.   szDataSource: LPSTR; var pcchBufferLength: DWORD): PDH_STATUS; stdcall;
  1106. {$EXTERNALSYM PdhSelectDataSourceA}
  1107. function PdhSelectDataSourceW(hWndOwner: HWND; dwFlags: DWORD;
  1108.   szDataSource: LPWSTR; var pcchBufferLength: DWORD): PDH_STATUS; stdcall;
  1109. {$EXTERNALSYM PdhSelectDataSourceW}
  1110. {$IFDEF UNICODE}
  1111. function PdhSelectDataSource(hWndOwner: HWND; dwFlags: DWORD;
  1112.   szDataSource: LPWSTR; var pcchBufferLength: DWORD): PDH_STATUS; stdcall;
  1113. {$EXTERNALSYM PdhSelectDataSource}
  1114. {$ELSE}
  1115. function PdhSelectDataSource(hWndOwner: HWND; dwFlags: DWORD;
  1116.   szDataSource: LPSTR; var pcchBufferLength: DWORD): PDH_STATUS; stdcall;
  1117. {$EXTERNALSYM PdhSelectDataSource}
  1118. {$ENDIF}
  1119. function PdhIsRealTimeQuery(hQuery: PDH_HQUERY): BOOL; stdcall;
  1120. {$EXTERNALSYM PdhIsRealTimeQuery}
  1121. function PdhSetQueryTimeRange(hQuery: PDH_HQUERY; var pInfo: PDH_TIME_INFO): PDH_STATUS; stdcall;
  1122. {$EXTERNALSYM PdhSetQueryTimeRange}
  1123. function PdhGetDataSourceTimeRangeA(szDataSource: LPCSTR; var pdwNumEntries: DWORD;
  1124.   var pInfo: PDH_TIME_INFO; pdwBufferSize: LPDWORD): PDH_STATUS; stdcall;
  1125. {$EXTERNALSYM PdhGetDataSourceTimeRangeA}
  1126. function PdhGetDataSourceTimeRangeW(szDataSource: LPCWSTR; var pdwNumEntries: DWORD;
  1127.   var pInfo: PDH_TIME_INFO; pdwBufferSize: LPDWORD): PDH_STATUS; stdcall;
  1128. {$EXTERNALSYM PdhGetDataSourceTimeRangeW}
  1129. {$IFDEF UNICODE}
  1130. function PdhGetDataSourceTimeRange(szDataSource: LPCWSTR; var pdwNumEntries: DWORD;
  1131.   var pInfo: PDH_TIME_INFO; pdwBufferSize: LPDWORD): PDH_STATUS; stdcall;
  1132. {$EXTERNALSYM PdhGetDataSourceTimeRange}
  1133. {$ELSE}
  1134. function PdhGetDataSourceTimeRange(szDataSource: LPCSTR; var pdwNumEntries: DWORD;
  1135.   var pInfo: PDH_TIME_INFO; pdwBufferSize: LPDWORD): PDH_STATUS; stdcall;
  1136. {$EXTERNALSYM PdhGetDataSourceTimeRange}
  1137. {$ENDIF}
  1138. function PdhCollectQueryDataEx(hQuery: PDH_HQUERY; dwIntervalTime: DWORD;
  1139.   hNewDataEvent: HANDLE): PDH_STATUS; stdcall;
  1140. {$EXTERNALSYM PdhCollectQueryDataEx}
  1141. function PdhFormatFromRawValue(dwCounterType, dwFormat: DWORD;
  1142.   var pTimeBase: LONGLONG; pRawValue1, pRawValue2: PPDH_RAW_COUNTER;
  1143.   var pFmtValue: PDH_FMT_COUNTERVALUE): PDH_STATUS; stdcall;
  1144. {$EXTERNALSYM PdhFormatFromRawValue}
  1145. function PdhGetCounterTimeBase(hCounter: PDH_HCOUNTER; var pTimeBase: LONGLONG): PDH_STATUS; stdcall;
  1146. {$EXTERNALSYM PdhGetCounterTimeBase}
  1147. function PdhReadRawLogRecord(hLog: PDH_HLOG; ftRecord: FILETIME;
  1148.   var pRawLogRecord: PDH_RAW_LOG_RECORD; pdwBufferLength: LPDWORD): PDH_STATUS; stdcall;
  1149. {$EXTERNALSYM PdhReadRawLogRecord}
  1150. const
  1151.   DATA_SOURCE_REGISTRY    = DWORD($00000001);
  1152.   {$EXTERNALSYM DATA_SOURCE_REGISTRY}
  1153.   DATA_SOURCE_LOGFILE     = DWORD($00000002);
  1154.   {$EXTERNALSYM DATA_SOURCE_LOGFILE}
  1155.   DATA_SOURCE_WBEM        = DWORD($00000004);
  1156.   {$EXTERNALSYM DATA_SOURCE_WBEM}
  1157. function PdhSetDefaultRealTimeDataSource(dwDataSourceId: DWORD): PDH_STATUS; stdcall;
  1158. {$EXTERNALSYM PdhSetDefaultRealTimeDataSource}
  1159. // Extended API for WMI event trace logfile format
  1160. //
  1161. function PdhBindInputDataSourceW(var phDataSource: PDH_HLOG; LogFileNameList: LPCWSTR): PDH_STATUS; stdcall;
  1162. {$EXTERNALSYM PdhBindInputDataSourceW}
  1163. function PdhBindInputDataSourceA(var phDataSource: PDH_HLOG; LogFileNameList: LPCSTR): PDH_STATUS; stdcall;
  1164. {$EXTERNALSYM PdhBindInputDataSourceA}
  1165. {$IFDEF UNICODE}
  1166. function PdhBindInputDataSource(var phDataSource: PDH_HLOG; LogFileNameList: LPCWSTR): PDH_STATUS; stdcall;
  1167. {$EXTERNALSYM PdhBindInputDataSource}
  1168. {$ELSE}
  1169. function PdhBindInputDataSource(var phDataSource: PDH_HLOG; LogFileNameList: LPCSTR): PDH_STATUS; stdcall;
  1170. {$EXTERNALSYM PdhBindInputDataSource}
  1171. {$ENDIF}
  1172. function PdhOpenQueryH(hDataSource: PDH_HLOG; dwUserData: DWORD_PTR; var phQuery: PDH_HQUERY): PDH_STATUS; stdcall;
  1173. {$EXTERNALSYM PdhOpenQueryH}
  1174. function PdhEnumMachinesHW(hDataSource: PDH_HLOG; mszMachineList: LPWSTR; pcchBufferSize: LPDWORD): PDH_STATUS; stdcall;
  1175. {$EXTERNALSYM PdhEnumMachinesHW}
  1176. function PdhEnumMachinesHA(hDataSource: PDH_HLOG; mszMachineList: LPSTR; pcchBufferSize: LPDWORD): PDH_STATUS; stdcall;
  1177. {$EXTERNALSYM PdhEnumMachinesHA}
  1178. {$IFDEF UNICODE}
  1179. function PdhEnumMachinesH(hDataSource: PDH_HLOG; mszMachineList: LPWSTR; pcchBufferSize: LPDWORD): PDH_STATUS; stdcall;
  1180. {$EXTERNALSYM PdhEnumMachinesH}
  1181. {$ELSE}
  1182. function PdhEnumMachinesH(hDataSource: PDH_HLOG; mszMachineList: LPSTR; pcchBufferSize: LPDWORD): PDH_STATUS; stdcall;
  1183. {$EXTERNALSYM PdhEnumMachinesH}
  1184. {$ENDIF}
  1185. function PdhEnumObjectsHW(hDataSource: PDH_HLOG; szMachineName: LPCWSTR; mszObjectList: LPWSTR; pcchBufferSize: LPDWORD;
  1186.   dwDetailLevel: DWORD; bRefresh: BOOL): PDH_STATUS; stdcall;
  1187. {$EXTERNALSYM PdhEnumObjectsHW}
  1188. function PdhEnumObjectsHA(hDataSource: PDH_HLOG; szMachineName: LPCSTR; mszObjectList: LPSTR; pcchBufferSize: LPDWORD;
  1189.   dwDetailLevel: DWORD; bRefresh: BOOL): PDH_STATUS; stdcall;
  1190. {$EXTERNALSYM PdhEnumObjectsHA}
  1191. {$IFDEF UNICODE}
  1192. function PdhEnumObjectsH(hDataSource: PDH_HLOG; szMachineName: LPCWSTR; mszObjectList: LPWSTR; pcchBufferSize: LPDWORD;
  1193.   dwDetailLevel: DWORD; bRefresh: BOOL): PDH_STATUS; stdcall;
  1194. {$EXTERNALSYM PdhEnumObjectsH}
  1195. {$ELSE}
  1196. function PdhEnumObjectsH(hDataSource: PDH_HLOG; szMachineName: LPCSTR; mszObjectList: LPSTR; pcchBufferSize: LPDWORD;
  1197.   dwDetailLevel: DWORD; bRefresh: BOOL): PDH_STATUS; stdcall;
  1198. {$EXTERNALSYM PdhEnumObjectsH}
  1199. {$ENDIF}
  1200. function PdhEnumObjectItemsHW(hDataSource: PDH_HLOG; szMachineName, szObjectName: LPCWSTR; mszCounterList: LPWSTR;
  1201.   pcchCounterListLength: LPDWORD; mszInstanceList: LPWSTR; pcchInstanceListLength: LPDWORD;
  1202.   dwDetailLevel, dwFlags: DWORD): PDH_STATUS; stdcall;
  1203. {$EXTERNALSYM PdhEnumObjectItemsHW}
  1204. function PdhEnumObjectItemsHA(hDataSource: PDH_HLOG; szMachineName, szObjectName: LPCSTR; mszCounterList: LPSTR;
  1205.   pcchCounterListLength: LPDWORD; mszInstanceList: LPSTR; pcchInstanceListLength: LPDWORD;
  1206.   dwDetailLevel, dwFlags: DWORD): PDH_STATUS; stdcall;
  1207. {$EXTERNALSYM PdhEnumObjectItemsHA}
  1208. {$IFDEF UNICODE}
  1209. function PdhEnumObjectItemsH(hDataSource: PDH_HLOG; szMachineName, szObjectName: LPCWSTR; mszCounterList: LPWSTR;
  1210.   pcchCounterListLength: LPDWORD; mszInstanceList: LPWSTR; pcchInstanceListLength: LPDWORD;
  1211.   dwDetailLevel, dwFlags: DWORD): PDH_STATUS; stdcall;
  1212. {$EXTERNALSYM PdhEnumObjectItemsH}
  1213. {$ELSE}
  1214. function PdhEnumObjectItemsH(hDataSource: PDH_HLOG; szMachineName, szObjectName: LPCSTR; mszCounterList: LPSTR;
  1215.   pcchCounterListLength: LPDWORD; mszInstanceList: LPSTR; pcchInstanceListLength: LPDWORD;
  1216.   dwDetailLevel, dwFlags: DWORD): PDH_STATUS; stdcall;
  1217. {$EXTERNALSYM PdhEnumObjectItemsH}
  1218. {$ENDIF}
  1219. function PdhExpandWildCardPathHW(hDataSource: PDH_HLOG; szWildCardPath: LPCWSTR; mszExpandedPathList: LPWSTR;
  1220.   pcchPathListLength: LPDWORD; dwFlags: DWORD): PDH_STATUS; stdcall;
  1221. {$EXTERNALSYM PdhExpandWildCardPathHW}
  1222. function PdhExpandWildCardPathHA(hDataSource: PDH_HLOG; szWildCardPath: LPCSTR; mszExpandedPathList: LPSTR;
  1223.   pcchPathListLength: LPDWORD; dwFlags: DWORD): PDH_STATUS; stdcall;
  1224. {$EXTERNALSYM PdhExpandWildCardPathHA}
  1225. {$IFDEF UNICODE}
  1226. function PdhExpandWildCardPathH(hDataSource: PDH_HLOG; szWildCardPath: LPCWSTR; mszExpandedPathList: LPWSTR;
  1227.   pcchPathListLength: LPDWORD; dwFlags: DWORD): PDH_STATUS; stdcall;
  1228. {$EXTERNALSYM PdhExpandWildCardPathH}
  1229. {$ELSE}
  1230. function PdhExpandWildCardPathH(hDataSource: PDH_HLOG; szWildCardPath: LPCSTR; mszExpandedPathList: LPSTR;
  1231.   pcchPathListLength: LPDWORD; dwFlags: DWORD): PDH_STATUS; stdcall;
  1232. {$EXTERNALSYM PdhExpandWildCardPathH}
  1233. {$ENDIF}
  1234. function PdhGetDataSourceTimeRangeH(hDataSource: PDH_HLOG; pdwNumEntries: LPDWORD; pInfo: PPDH_TIME_INFO;
  1235.   pdwBufferSize: LPDWORD): PDH_STATUS; stdcall;
  1236. {$EXTERNALSYM PdhGetDataSourceTimeRangeH}
  1237. function PdhGetDefaultPerfObjectHW(hDataSource: PDH_HLOG; szMachineName: LPCWSTR; szDefaultObjectName: LPWSTR;
  1238.   pcchBufferSize: LPDWORD): PDH_STATUS; stdcall;
  1239. {$EXTERNALSYM PdhGetDefaultPerfObjectHW}
  1240. function PdhGetDefaultPerfObjectHA(hDataSource: PDH_HLOG; szMachineName: LPCSTR; szDefaultObjectName: LPSTR;
  1241.   pcchBufferSize: LPDWORD): PDH_STATUS; stdcall;
  1242. {$EXTERNALSYM PdhGetDefaultPerfObjectHA}
  1243. {$IFDEF UNICODE}
  1244. function PdhGetDefaultPerfObjectH(hDataSource: PDH_HLOG; szMachineName: LPCWSTR; szDefaultObjectName: LPWSTR;
  1245.   pcchBufferSize: LPDWORD): PDH_STATUS; stdcall;
  1246. {$EXTERNALSYM PdhGetDefaultPerfObjectH}
  1247. {$ELSE}
  1248. function PdhGetDefaultPerfObjectH(hDataSource: PDH_HLOG; szMachineName: LPCSTR; szDefaultObjectName: LPSTR;
  1249.   pcchBufferSize: LPDWORD): PDH_STATUS; stdcall;
  1250. {$EXTERNALSYM PdhGetDefaultPerfObjectH}
  1251. {$ENDIF}
  1252. function PdhGetDefaultPerfCounterHW(hDataSource: PDH_HLOG; szMachineName, szObjectName: LPCWSTR;
  1253.   szDefaultCounterName: LPWSTR; pcchBufferSize: LPDWORD): PDH_STATUS; stdcall;
  1254. {$EXTERNALSYM PdhGetDefaultPerfCounterHW}
  1255. function PdhGetDefaultPerfCounterHA(hDataSource: PDH_HLOG; szMachineName, szObjectName: LPCSTR;
  1256.   szDefaultCounterName: LPSTR; pcchBufferSize: LPDWORD): PDH_STATUS; stdcall;
  1257. {$EXTERNALSYM PdhGetDefaultPerfCounterHA}
  1258. {$IFDEF UNICODE}
  1259. function PdhGetDefaultPerfCounterH(hDataSource: PDH_HLOG; szMachineName, szObjectName: LPCWSTR;
  1260.   szDefaultCounterName: LPWSTR; pcchBufferSize: LPDWORD): PDH_STATUS; stdcall;
  1261. {$EXTERNALSYM PdhGetDefaultPerfCounterH}
  1262. {$ELSE}
  1263. function PdhGetDefaultPerfCounterH(hDataSource: PDH_HLOG; szMachineName, szObjectName: LPCSTR;
  1264.   szDefaultCounterName: LPSTR; pcchBufferSize: LPDWORD): PDH_STATUS; stdcall;
  1265. {$EXTERNALSYM PdhGetDefaultPerfCounterH}
  1266. {$ENDIF}
  1267. function PdhBrowseCountersHW(const pBrowseDlgData: PDH_BROWSE_DLG_CONFIG_HW): PDH_STATUS; stdcall;
  1268. {$EXTERNALSYM PdhBrowseCountersHW}
  1269. function PdhBrowseCountersHA(const pBrowseDlgData: PDH_BROWSE_DLG_CONFIG_HA): PDH_STATUS; stdcall;
  1270. {$EXTERNALSYM PdhBrowseCountersHA}
  1271. {$IFDEF UNICODE}
  1272. function PdhBrowseCountersH(const pBrowseDlgData: PDH_BROWSE_DLG_CONFIG_HW): PDH_STATUS; stdcall;
  1273. {$EXTERNALSYM PdhBrowseCountersH}
  1274. {$ELSE}
  1275. function PdhBrowseCountersH(const pBrowseDlgData: PDH_BROWSE_DLG_CONFIG_HA): PDH_STATUS; stdcall;
  1276. {$EXTERNALSYM PdhBrowseCountersH}
  1277. {$ENDIF}
  1278. //Check that a DSN points to a database that contains the correct Perfmon tables.
  1279. function PdhVerifySQLDBW(szDataSource: LPCWSTR): PDH_STATUS; stdcall;
  1280. {$EXTERNALSYM PdhVerifySQLDBW}
  1281. function PdhVerifySQLDBA(szDataSource: LPCSTR): PDH_STATUS; stdcall;
  1282. {$EXTERNALSYM PdhVerifySQLDBA}
  1283. {$IFDEF UNICODE}
  1284. function PdhVerifySQLDB(szDataSource: LPCWSTR): PDH_STATUS; stdcall;
  1285. {$EXTERNALSYM PdhVerifySQLDB}
  1286. {$ELSE}
  1287. function PdhVerifySQLDB(szDataSource: LPCSTR): PDH_STATUS; stdcall;
  1288. {$EXTERNALSYM PdhVerifySQLDB}
  1289. {$ENDIF}
  1290. //Create the correct perfmon tables in the database pointed to by a DSN.
  1291. function PdhCreateSQLTablesW(szDataSource: LPCWSTR): PDH_STATUS; stdcall;
  1292. {$EXTERNALSYM PdhCreateSQLTablesW}
  1293. function PdhCreateSQLTablesA(szDataSource: LPCSTR): PDH_STATUS; stdcall;
  1294. {$EXTERNALSYM PdhCreateSQLTablesA}
  1295. {$IFDEF UNICODE}
  1296. function PdhCreateSQLTables(szDataSource: LPCWSTR): PDH_STATUS; stdcall;
  1297. {$EXTERNALSYM PdhCreateSQLTables}
  1298. {$ELSE}
  1299. function PdhCreateSQLTables(szDataSource: LPCSTR): PDH_STATUS; stdcall;
  1300. {$EXTERNALSYM PdhCreateSQLTables}
  1301. {$ENDIF}
  1302. //Return the list of Log set names in the database pointed to by the DSN.
  1303. function PdhEnumLogSetNamesW(szDataSource: LPCWSTR; mszDataSetNameList: LPWSTR; pcchBufferLength: LPDWORD): PDH_STATUS; stdcall;
  1304. {$EXTERNALSYM PdhEnumLogSetNamesW}
  1305. function PdhEnumLogSetNamesA(szDataSource: LPCSTR; mszDataSetNameList: LPSTR; pcchBufferLength: LPDWORD): PDH_STATUS; stdcall;
  1306. {$EXTERNALSYM PdhEnumLogSetNamesA}
  1307. {$IFDEF UNICODE}
  1308. function PdhEnumLogSetNames(szDataSource: LPCWSTR; mszDataSetNameList: LPWSTR; pcchBufferLength: LPDWORD): PDH_STATUS; stdcall;
  1309. {$EXTERNALSYM PdhEnumLogSetNames}
  1310. {$ELSE}
  1311. function PdhEnumLogSetNames(szDataSource: LPCSTR; mszDataSetNameList: LPSTR; pcchBufferLength: LPDWORD): PDH_STATUS; stdcall;
  1312. {$EXTERNALSYM PdhEnumLogSetNames}
  1313. {$ENDIF}
  1314. //Retrieve the GUID for an open Log Set
  1315. function PdhGetLogSetGUID(hLog: PDH_HLOG; pGuid: LPGUID; pRunId: LPINT): PDH_STATUS; stdcall;
  1316. {$EXTERNALSYM PdhGetLogSetGUID}
  1317. //Set the RunID for an open Log Set
  1318. function PdhSetLogSetRunID(hLog: PDH_HLOG; RunId: Integer): PDH_STATUS; stdcall;
  1319. {$EXTERNALSYM PdhSetLogSetRunID}
  1320. implementation
  1321. const
  1322.   PdhLib = 'pdh.dll';
  1323. function IsSuccessSeverity(ErrorCode: Longint): Boolean;
  1324. begin
  1325.   Result := (ErrorCode and $C0000000) = $00000000;
  1326. end;
  1327. function IsInformationalSeverity(ErrorCode: Longint): Boolean;
  1328. begin
  1329.   Result := (ErrorCode and $C0000000) = $40000000;
  1330. end;
  1331. function IsWarningSeverity(ErrorCode: Longint): Boolean;
  1332. begin
  1333.   Result := (ErrorCode and $C0000000) = $80000000;
  1334. end;
  1335. function IsErrorSeverity(ErrorCode: Longint): Boolean;
  1336. begin
  1337.   Result := (ErrorCode and $C0000000) = $C0000000;
  1338. end;
  1339. {$IFDEF DYNAMIC_LINK}
  1340. var
  1341.   _PdhGetDllVersion: Pointer;
  1342. function PdhGetDllVersion;
  1343. begin
  1344.   GetProcedureAddress(_PdhGetDllVersion, PdhLib, 'PdhGetDllVersion');
  1345.   asm
  1346.     mov esp, ebp
  1347.     pop ebp
  1348.     jmp [_PdhGetDllVersion]
  1349.   end;
  1350. end;
  1351. {$ELSE}
  1352. function PdhGetDllVersion; external PdhLib name 'PdhGetDllVersion';
  1353. {$ENDIF DYNAMIC_LINK}
  1354. {$IFDEF DYNAMIC_LINK}
  1355. var
  1356.   _PdhOpenQueryA: Pointer;
  1357. function PdhOpenQueryA;
  1358. begin
  1359.   GetProcedureAddress(_PdhOpenQueryA, PdhLib, 'PdhOpenQueryA');
  1360.   asm
  1361.     mov esp, ebp
  1362.     pop ebp
  1363.     jmp [_PdhOpenQueryA]
  1364.   end;
  1365. end;
  1366. {$ELSE}
  1367. function PdhOpenQueryA; external PdhLib name 'PdhOpenQueryA';
  1368. {$ENDIF DYNAMIC_LINK}
  1369. {$IFDEF DYNAMIC_LINK}
  1370. var
  1371.   _PdhOpenQueryW: Pointer;
  1372. function PdhOpenQueryW;
  1373. begin
  1374.   GetProcedureAddress(_PdhOpenQueryW, PdhLib, 'PdhOpenQueryW');
  1375.   asm
  1376.     mov esp, ebp
  1377.     pop ebp
  1378.     jmp [_PdhOpenQueryW]
  1379.   end;
  1380. end;
  1381. {$ELSE}
  1382. function PdhOpenQueryW; external PdhLib name 'PdhOpenQueryW';
  1383. {$ENDIF DYNAMIC_LINK}
  1384. {$IFDEF UNICODE}
  1385. {$IFDEF DYNAMIC_LINK}
  1386. var
  1387.   _PdhOpenQuery: Pointer;
  1388. function PdhOpenQuery;
  1389. begin
  1390.   GetProcedureAddress(_PdhOpenQuery, PdhLib, 'PdhOpenQueryW');
  1391.   asm
  1392.     mov esp, ebp
  1393.     pop ebp
  1394.     jmp [_PdhOpenQuery]
  1395.   end;
  1396. end;
  1397. {$ELSE}
  1398. function PdhOpenQuery; external PdhLib name 'PdhOpenQueryW';
  1399. {$ENDIF DYNAMIC_LINK}
  1400. {$ELSE}
  1401. {$IFDEF DYNAMIC_LINK}
  1402. var
  1403.   _PdhOpenQuery: Pointer;
  1404. function PdhOpenQuery;
  1405. begin
  1406.   GetProcedureAddress(_PdhOpenQuery, PdhLib, 'PdhOpenQueryA');
  1407.   asm
  1408.     mov esp, ebp
  1409.     pop ebp
  1410.     jmp [_PdhOpenQuery]
  1411.   end;
  1412. end;
  1413. {$ELSE}
  1414. function PdhOpenQuery; external PdhLib name 'PdhOpenQueryA';
  1415. {$ENDIF DYNAMIC_LINK}
  1416. {$ENDIF}
  1417. {$IFDEF DYNAMIC_LINK}
  1418. var
  1419.   _PdhAddCounterA: Pointer;
  1420. function PdhAddCounterA;
  1421. begin
  1422.   GetProcedureAddress(_PdhAddCounterA, PdhLib, 'PdhAddCounterA');
  1423.   asm
  1424.     mov esp, ebp
  1425.     pop ebp
  1426.     jmp [_PdhAddCounterA]
  1427.   end;
  1428. end;
  1429. {$ELSE}
  1430. function PdhAddCounterA; external PdhLib name 'PdhAddCounterA';
  1431. {$ENDIF DYNAMIC_LINK}
  1432. {$IFDEF DYNAMIC_LINK}
  1433. var
  1434.   _PdhAddCounterW: Pointer;
  1435. function PdhAddCounterW;
  1436. begin
  1437.   GetProcedureAddress(_PdhAddCounterW, PdhLib, 'PdhAddCounterW');
  1438.   asm
  1439.     mov esp, ebp
  1440.     pop ebp
  1441.     jmp [_PdhAddCounterW]
  1442.   end;
  1443. end;
  1444. {$ELSE}
  1445. function PdhAddCounterW; external PdhLib name 'PdhAddCounterW';
  1446. {$ENDIF DYNAMIC_LINK}
  1447. {$IFDEF UNICODE}
  1448. {$IFDEF DYNAMIC_LINK}
  1449. var
  1450.   _PdhAddCounter: Pointer;
  1451. function PdhAddCounter;
  1452. begin
  1453.   GetProcedureAddress(_PdhAddCounter, PdhLib, 'PdhAddCounterW');
  1454.   asm
  1455.     mov esp, ebp
  1456.     pop ebp
  1457.     jmp [_PdhAddCounter]
  1458.   end;
  1459. end;
  1460. {$ELSE}
  1461. function PdhAddCounter; external PdhLib name 'PdhAddCounterW';
  1462. {$ENDIF DYNAMIC_LINK}
  1463. {$ELSE}
  1464. {$IFDEF DYNAMIC_LINK}
  1465. var
  1466.   _PdhAddCounter: Pointer;
  1467. function PdhAddCounter;
  1468. begin
  1469.   GetProcedureAddress(_PdhAddCounter, PdhLib, 'PdhAddCounterA');
  1470.   asm
  1471.     mov esp, ebp
  1472.     pop ebp
  1473.     jmp [_PdhAddCounter]
  1474.   end;
  1475. end;
  1476. {$ELSE}
  1477. function PdhAddCounter; external PdhLib name 'PdhAddCounterA';
  1478. {$ENDIF DYNAMIC_LINK}
  1479. {$ENDIF}
  1480. {$IFDEF DYNAMIC_LINK}
  1481. var
  1482.   _PdhRemoveCounter: Pointer;
  1483. function PdhRemoveCounter;
  1484. begin
  1485.   GetProcedureAddress(_PdhRemoveCounter, PdhLib, 'PdhRemoveCounter');
  1486.   asm
  1487.     mov esp, ebp
  1488.     pop ebp
  1489.     jmp [_PdhRemoveCounter]
  1490.   end;
  1491. end;
  1492. {$ELSE}
  1493. function PdhRemoveCounter; external PdhLib name 'PdhRemoveCounter';
  1494. {$ENDIF DYNAMIC_LINK}
  1495. {$IFDEF DYNAMIC_LINK}
  1496. var
  1497.   _PdhCollectQueryData: Pointer;
  1498. function PdhCollectQueryData;
  1499. begin
  1500.   GetProcedureAddress(_PdhCollectQueryData, PdhLib, 'PdhCollectQueryData');
  1501.   asm
  1502.     mov esp, ebp
  1503.     pop ebp
  1504.     jmp [_PdhCollectQueryData]
  1505.   end;
  1506. end;
  1507. {$ELSE}
  1508. function PdhCollectQueryData; external PdhLib name 'PdhCollectQueryData';
  1509. {$ENDIF DYNAMIC_LINK}
  1510. {$IFDEF DYNAMIC_LINK}
  1511. var
  1512.   _PdhCloseQuery: Pointer;
  1513. function PdhCloseQuery;
  1514. begin
  1515.   GetProcedureAddress(_PdhCloseQuery, PdhLib, 'PdhCloseQuery');
  1516.   asm
  1517.     mov esp, ebp
  1518.     pop ebp
  1519.     jmp [_PdhCloseQuery]
  1520.   end;
  1521. end;
  1522. {$ELSE}
  1523. function PdhCloseQuery; external PdhLib name 'PdhCloseQuery';
  1524. {$ENDIF DYNAMIC_LINK}
  1525. {$IFDEF DYNAMIC_LINK}
  1526. var
  1527.   _PdhGetFormattedCounterValue: Pointer;
  1528. function PdhGetFormattedCounterValue;
  1529. begin
  1530.   GetProcedureAddress(_PdhGetFormattedCounterValue, PdhLib, 'PdhGetFormattedCounterValue');
  1531.   asm
  1532.     mov esp, ebp
  1533.     pop ebp
  1534.     jmp [_PdhGetFormattedCounterValue]
  1535.   end;
  1536. end;
  1537. {$ELSE}
  1538. function PdhGetFormattedCounterValue; external PdhLib name 'PdhGetFormattedCounterValue';
  1539. {$ENDIF DYNAMIC_LINK}
  1540. {$IFDEF DYNAMIC_LINK}
  1541. var
  1542.   _PdhGetFormattedCounterArrayA: Pointer;
  1543. function PdhGetFormattedCounterArrayA;
  1544. begin
  1545.   GetProcedureAddress(_PdhGetFormattedCounterArrayA, PdhLib, 'PdhGetFormattedCounterArrayA');
  1546.   asm
  1547.     mov esp, ebp
  1548.     pop ebp
  1549.     jmp [_PdhGetFormattedCounterArrayA]
  1550.   end;
  1551. end;
  1552. {$ELSE}
  1553. function PdhGetFormattedCounterArrayA; external PdhLib name 'PdhGetFormattedCounterArrayA';
  1554. {$ENDIF DYNAMIC_LINK}
  1555. {$IFDEF DYNAMIC_LINK}
  1556. var
  1557.   _PdhGetFormattedCounterArrayW: Pointer;
  1558. function PdhGetFormattedCounterArrayW;
  1559. begin
  1560.   GetProcedureAddress(_PdhGetFormattedCounterArrayW, PdhLib, 'PdhGetFormattedCounterArrayW');
  1561.   asm
  1562.     mov esp, ebp
  1563.     pop ebp
  1564.     jmp [_PdhGetFormattedCounterArrayW]
  1565.   end;
  1566. end;
  1567. {$ELSE}
  1568. function PdhGetFormattedCounterArrayW; external PdhLib name 'PdhGetFormattedCounterArrayW';
  1569. {$ENDIF DYNAMIC_LINK}
  1570. {$IFDEF UNICODE}
  1571. {$IFDEF DYNAMIC_LINK}
  1572. var
  1573.   _PdhGetFormattedCounterArray: Pointer;
  1574. function PdhGetFormattedCounterArray;
  1575. begin
  1576.   GetProcedureAddress(_PdhGetFormattedCounterArray, PdhLib, 'PdhGetFormattedCounterArrayW');
  1577.   asm
  1578.     mov esp, ebp
  1579.     pop ebp
  1580.     jmp [_PdhGetFormattedCounterArray]
  1581.   end;
  1582. end;
  1583. {$ELSE}
  1584. function PdhGetFormattedCounterArray; external PdhLib name 'PdhGetFormattedCounterArrayW';
  1585. {$ENDIF DYNAMIC_LINK}
  1586. {$ELSE}
  1587. {$IFDEF DYNAMIC_LINK}
  1588. var
  1589.   _PdhGetFormattedCounterArray: Pointer;
  1590. function PdhGetFormattedCounterArray;
  1591. begin
  1592.   GetProcedureAddress(_PdhGetFormattedCounterArray, PdhLib, 'PdhGetFormattedCounterArrayA');
  1593.   asm
  1594.     mov esp, ebp
  1595.     pop ebp
  1596.     jmp [_PdhGetFormattedCounterArray]
  1597.   end;
  1598. end;
  1599. {$ELSE}
  1600. function PdhGetFormattedCounterArray; external PdhLib name 'PdhGetFormattedCounterArrayA';
  1601. {$ENDIF DYNAMIC_LINK}
  1602. {$ENDIF}
  1603. {$IFDEF DYNAMIC_LINK}
  1604. var
  1605.   _PdhGetRawCounterValue: Pointer;
  1606. function PdhGetRawCounterValue;
  1607. begin
  1608.   GetProcedureAddress(_PdhGetRawCounterValue, PdhLib, 'PdhGetRawCounterValue');
  1609.   asm
  1610.     mov esp, ebp
  1611.     pop ebp
  1612.     jmp [_PdhGetRawCounterValue]
  1613.   end;
  1614. end;
  1615. {$ELSE}
  1616. function PdhGetRawCounterValue; external PdhLib name 'PdhGetRawCounterValue';
  1617. {$ENDIF DYNAMIC_LINK}
  1618. {$IFDEF DYNAMIC_LINK}
  1619. var
  1620.   _PdhGetRawCounterArrayA: Pointer;
  1621. function PdhGetRawCounterArrayA;
  1622. begin
  1623.   GetProcedureAddress(_PdhGetRawCounterArrayA, PdhLib, 'PdhGetRawCounterArrayA');
  1624.   asm
  1625.     mov esp, ebp
  1626.     pop ebp
  1627.     jmp [_PdhGetRawCounterArrayA]
  1628.   end;
  1629. end;
  1630. {$ELSE}
  1631. function PdhGetRawCounterArrayA; external PdhLib name 'PdhGetRawCounterArrayA';
  1632. {$ENDIF DYNAMIC_LINK}
  1633. {$IFDEF DYNAMIC_LINK}
  1634. var
  1635.   _PdhGetRawCounterArrayW: Pointer;
  1636. function PdhGetRawCounterArrayW;
  1637. begin
  1638.   GetProcedureAddress(_PdhGetRawCounterArrayW, PdhLib, 'PdhGetRawCounterArrayW');
  1639.   asm
  1640.     mov esp, ebp
  1641.     pop ebp
  1642.     jmp [_PdhGetRawCounterArrayW]
  1643.   end;
  1644. end;
  1645. {$ELSE}
  1646. function PdhGetRawCounterArrayW; external PdhLib name 'PdhGetRawCounterArrayW';
  1647. {$ENDIF DYNAMIC_LINK}
  1648. {$IFDEF UNICODE}
  1649. {$IFDEF DYNAMIC_LINK}
  1650. var
  1651.   _PdhGetRawCounterArray: Pointer;
  1652. function PdhGetRawCounterArray;
  1653. begin
  1654.   GetProcedureAddress(_PdhGetRawCounterArray, PdhLib, 'PdhGetRawCounterArrayW');
  1655.   asm
  1656.     mov esp, ebp
  1657.     pop ebp
  1658.     jmp [_PdhGetRawCounterArray]
  1659.   end;
  1660. end;
  1661. {$ELSE}
  1662. function PdhGetRawCounterArray; external PdhLib name 'PdhGetRawCounterArrayW';
  1663. {$ENDIF DYNAMIC_LINK}
  1664. {$ELSE}
  1665. {$IFDEF DYNAMIC_LINK}
  1666. var
  1667.   _PdhGetRawCounterArray: Pointer;
  1668. function PdhGetRawCounterArray;
  1669. begin
  1670.   GetProcedureAddress(_PdhGetRawCounterArray, PdhLib, 'PdhGetRawCounterArrayA');
  1671.   asm
  1672.     mov esp, ebp
  1673.     pop ebp
  1674.     jmp [_PdhGetRawCounterArray]
  1675.   end;
  1676. end;
  1677. {$ELSE}
  1678. function PdhGetRawCounterArray; external PdhLib name 'PdhGetRawCounterArrayA';
  1679. {$ENDIF DYNAMIC_LINK}
  1680. {$ENDIF}
  1681. {$IFDEF DYNAMIC_LINK}
  1682. var
  1683.   _PdhCalculateCounterFromRawValue: Pointer;
  1684. function PdhCalculateCounterFromRawValue;
  1685. begin
  1686.   GetProcedureAddress(_PdhCalculateCounterFromRawValue, PdhLib, 'PdhCalculateCounterFromRawValue');
  1687.   asm
  1688.     mov esp, ebp
  1689.     pop ebp
  1690.     jmp [_PdhCalculateCounterFromRawValue]
  1691.   end;
  1692. end;
  1693. {$ELSE}
  1694. function PdhCalculateCounterFromRawValue; external PdhLib name 'PdhCalculateCounterFromRawValue';
  1695. {$ENDIF DYNAMIC_LINK}
  1696. {$IFDEF DYNAMIC_LINK}
  1697. var
  1698.   _PdhComputeCounterStatistics: Pointer;
  1699. function PdhComputeCounterStatistics;
  1700. begin
  1701.   GetProcedureAddress(_PdhComputeCounterStatistics, PdhLib, 'PdhComputeCounterStatistics');
  1702.   asm
  1703.     mov esp, ebp
  1704.     pop ebp
  1705.     jmp [_PdhComputeCounterStatistics]
  1706.   end;
  1707. end;
  1708. {$ELSE}
  1709. function PdhComputeCounterStatistics; external PdhLib name 'PdhComputeCounterStatistics';
  1710. {$ENDIF DYNAMIC_LINK}
  1711. {$IFDEF DYNAMIC_LINK}
  1712. var
  1713.   _PdhGetCounterInfoA: Pointer;
  1714. function PdhGetCounterInfoA;
  1715. begin
  1716.   GetProcedureAddress(_PdhGetCounterInfoA, PdhLib, 'PdhGetCounterInfoA');
  1717.   asm
  1718.     mov esp, ebp
  1719.     pop ebp
  1720.     jmp [_PdhGetCounterInfoA]
  1721.   end;
  1722. end;
  1723. {$ELSE}
  1724. function PdhGetCounterInfoA; external PdhLib name 'PdhGetCounterInfoA';
  1725. {$ENDIF DYNAMIC_LINK}
  1726. {$IFDEF DYNAMIC_LINK}
  1727. var
  1728.   _PdhGetCounterInfoW: Pointer;
  1729. function PdhGetCounterInfoW;
  1730. begin
  1731.   GetProcedureAddress(_PdhGetCounterInfoW, PdhLib, 'PdhGetCounterInfoW');
  1732.   asm
  1733.     mov esp, ebp
  1734.     pop ebp
  1735.     jmp [_PdhGetCounterInfoW]
  1736.   end;
  1737. end;
  1738. {$ELSE}
  1739. function PdhGetCounterInfoW; external PdhLib name 'PdhGetCounterInfoW';
  1740. {$ENDIF DYNAMIC_LINK}
  1741. {$IFDEF UNICODE}
  1742. {$IFDEF DYNAMIC_LINK}
  1743. var
  1744.   _PdhGetCounterInfo: Pointer;
  1745. function PdhGetCounterInfo;
  1746. begin
  1747.   GetProcedureAddress(_PdhGetCounterInfo, PdhLib, 'PdhGetCounterInfoW');
  1748.   asm
  1749.     mov esp, ebp
  1750.     pop ebp
  1751.     jmp [_PdhGetCounterInfo]
  1752.   end;
  1753. end;
  1754. {$ELSE}
  1755. function PdhGetCounterInfo; external PdhLib name 'PdhGetCounterInfoW';
  1756. {$ENDIF DYNAMIC_LINK}
  1757. {$ELSE}
  1758. {$IFDEF DYNAMIC_LINK}
  1759. var
  1760.   _PdhGetCounterInfo: Pointer;
  1761. function PdhGetCounterInfo;
  1762. begin
  1763.   GetProcedureAddress(_PdhGetCounterInfo, PdhLib, 'PdhGetCounterInfoA');
  1764.   asm
  1765.     mov esp, ebp
  1766.     pop ebp
  1767.     jmp [_PdhGetCounterInfo]
  1768.   end;
  1769. end;
  1770. {$ELSE}
  1771. function PdhGetCounterInfo; external PdhLib name 'PdhGetCounterInfoA';
  1772. {$ENDIF DYNAMIC_LINK}
  1773. {$ENDIF}
  1774. {$IFDEF DYNAMIC_LINK}
  1775. var
  1776.   _PdhSetCounterScaleFactor: Pointer;
  1777. function PdhSetCounterScaleFactor;
  1778. begin
  1779.   GetProcedureAddress(_PdhSetCounterScaleFactor, PdhLib, 'PdhSetCounterScaleFactor');
  1780.   asm
  1781.     mov esp, ebp
  1782.     pop ebp
  1783.     jmp [_PdhSetCounterScaleFactor]
  1784.   end;
  1785. end;
  1786. {$ELSE}
  1787. function PdhSetCounterScaleFactor; external PdhLib name 'PdhSetCounterScaleFactor';
  1788. {$ENDIF DYNAMIC_LINK}
  1789. {$IFDEF DYNAMIC_LINK}
  1790. var
  1791.   _PdhConnectMachineA: Pointer;
  1792. function PdhConnectMachineA;
  1793. begin
  1794.   GetProcedureAddress(_PdhConnectMachineA, PdhLib, 'PdhConnectMachineA');
  1795.   asm
  1796.     mov esp, ebp
  1797.     pop ebp
  1798.     jmp [_PdhConnectMachineA]
  1799.   end;
  1800. end;
  1801. {$ELSE}
  1802. function PdhConnectMachineA; external PdhLib name 'PdhConnectMachineA';
  1803. {$ENDIF DYNAMIC_LINK}
  1804. {$IFDEF DYNAMIC_LINK}
  1805. var
  1806.   _PdhConnectMachineW: Pointer;
  1807. function PdhConnectMachineW;
  1808. begin
  1809.   GetProcedureAddress(_PdhConnectMachineW, PdhLib, 'PdhConnectMachineW');
  1810.   asm
  1811.     mov esp, ebp
  1812.     pop ebp
  1813.     jmp [_PdhConnectMachineW]
  1814.   end;
  1815. end;
  1816. {$ELSE}
  1817. function PdhConnectMachineW; external PdhLib name 'PdhConnectMachineW';
  1818. {$ENDIF DYNAMIC_LINK}
  1819. {$IFDEF UNICODE}
  1820. {$IFDEF DYNAMIC_LINK}
  1821. var
  1822.   _PdhConnectMachine: Pointer;
  1823. function PdhConnectMachine;
  1824. begin
  1825.   GetProcedureAddress(_PdhConnectMachine, PdhLib, 'PdhConnectMachineW');
  1826.   asm
  1827.     mov esp, ebp
  1828.     pop ebp
  1829.     jmp [_PdhConnectMachine]
  1830.   end;
  1831. end;
  1832. {$ELSE}
  1833. function PdhConnectMachine; external PdhLib name 'PdhConnectMachineW';
  1834. {$ENDIF DYNAMIC_LINK}
  1835. {$ELSE}
  1836. {$IFDEF DYNAMIC_LINK}
  1837. var
  1838.   _PdhConnectMachine: Pointer;
  1839. function PdhConnectMachine;
  1840. begin
  1841.   GetProcedureAddress(_PdhConnectMachine, PdhLib, 'PdhConnectMachineA');
  1842.   asm
  1843.     mov esp, ebp
  1844.     pop ebp
  1845.     jmp [_PdhConnectMachine]
  1846.   end;
  1847. end;
  1848. {$ELSE}
  1849. function PdhConnectMachine; external PdhLib name 'PdhConnectMachineA';
  1850. {$ENDIF DYNAMIC_LINK}
  1851. {$ENDIF}
  1852. {$IFDEF DYNAMIC_LINK}
  1853. var
  1854.   _PdhEnumMachinesA: Pointer;
  1855. function PdhEnumMachinesA;
  1856. begin
  1857.   GetProcedureAddress(_PdhEnumMachinesA, PdhLib, 'PdhEnumMachinesA');
  1858.   asm
  1859.     mov esp, ebp
  1860.     pop ebp
  1861.     jmp [_PdhEnumMachinesA]
  1862.   end;
  1863. end;
  1864. {$ELSE}
  1865. function PdhEnumMachinesA; external PdhLib name 'PdhEnumMachinesA';
  1866. {$ENDIF DYNAMIC_LINK}
  1867. {$IFDEF DYNAMIC_LINK}
  1868. var
  1869.   _PdhEnumMachinesW: Pointer;
  1870. function PdhEnumMachinesW;
  1871. begin
  1872.   GetProcedureAddress(_PdhEnumMachinesW, PdhLib, 'PdhEnumMachinesW');
  1873.   asm
  1874.     mov esp, ebp
  1875.     pop ebp
  1876.     jmp [_PdhEnumMachinesW]
  1877.   end;
  1878. end;
  1879. {$ELSE}
  1880. function PdhEnumMachinesW; external PdhLib name 'PdhEnumMachinesW';
  1881. {$ENDIF DYNAMIC_LINK}
  1882. {$IFDEF UNICODE}
  1883. {$IFDEF DYNAMIC_LINK}
  1884. var
  1885.   _PdhEnumMachines: Pointer;
  1886. function PdhEnumMachines;
  1887. begin
  1888.   GetProcedureAddress(_PdhEnumMachines, PdhLib, 'PdhEnumMachinesW');
  1889.   asm
  1890.     mov esp, ebp
  1891.     pop ebp
  1892.     jmp [_PdhEnumMachines]
  1893.   end;
  1894. end;
  1895. {$ELSE}
  1896. function PdhEnumMachines; external PdhLib name 'PdhEnumMachinesW';
  1897. {$ENDIF DYNAMIC_LINK}
  1898. {$ELSE}
  1899. {$IFDEF DYNAMIC_LINK}
  1900. var
  1901.   _PdhEnumMachines: Pointer;
  1902. function PdhEnumMachines;
  1903. begin
  1904.   GetProcedureAddress(_PdhEnumMachines, PdhLib, 'PdhEnumMachinesA');
  1905.   asm
  1906.     mov esp, ebp
  1907.     pop ebp
  1908.     jmp [_PdhEnumMachines]
  1909.   end;
  1910. end;
  1911. {$ELSE}
  1912. function PdhEnumMachines; external PdhLib name 'PdhEnumMachinesA';
  1913. {$ENDIF DYNAMIC_LINK}
  1914. {$ENDIF}
  1915. {$IFDEF DYNAMIC_LINK}
  1916. var
  1917.   _PdhEnumObjectsA: Pointer;
  1918. function PdhEnumObjectsA;
  1919. begin
  1920.   GetProcedureAddress(_PdhEnumObjectsA, PdhLib, 'PdhEnumObjectsA');
  1921.   asm
  1922.     mov esp, ebp
  1923.     pop ebp
  1924.     jmp [_PdhEnumObjectsA]
  1925.   end;
  1926. end;
  1927. {$ELSE}
  1928. function PdhEnumObjectsA; external PdhLib name 'PdhEnumObjectsA';
  1929. {$ENDIF DYNAMIC_LINK}
  1930. {$IFDEF DYNAMIC_LINK}
  1931. var
  1932.   _PdhEnumObjectsW: Pointer;
  1933. function PdhEnumObjectsW;
  1934. begin
  1935.   GetProcedureAddress(_PdhEnumObjectsW, PdhLib, 'PdhEnumObjectsW');
  1936.   asm
  1937.     mov esp, ebp
  1938.     pop ebp
  1939.     jmp [_PdhEnumObjectsW]
  1940.   end;
  1941. end;
  1942. {$ELSE}
  1943. function PdhEnumObjectsW; external PdhLib name 'PdhEnumObjectsW';
  1944. {$ENDIF DYNAMIC_LINK}
  1945. {$IFDEF UNICODE}
  1946. {$IFDEF DYNAMIC_LINK}
  1947. var
  1948.   _PdhEnumObjects: Pointer;
  1949. function PdhEnumObjects;
  1950. begin
  1951.   GetProcedureAddress(_PdhEnumObjects, PdhLib, 'PdhEnumObjectsW');
  1952.   asm
  1953.     mov esp, ebp
  1954.     pop ebp
  1955.     jmp [_PdhEnumObjects]
  1956.   end;
  1957. end;
  1958. {$ELSE}
  1959. function PdhEnumObjects; external PdhLib name 'PdhEnumObjectsW';
  1960. {$ENDIF DYNAMIC_LINK}
  1961. {$ELSE}
  1962. {$IFDEF DYNAMIC_LINK}
  1963. var
  1964.   _PdhEnumObjects: Pointer;
  1965. function PdhEnumObjects;
  1966. begin
  1967.   GetProcedureAddress(_PdhEnumObjects, PdhLib, 'PdhEnumObjectsA');
  1968.   asm
  1969.     mov esp, ebp
  1970.     pop ebp
  1971.     jmp [_PdhEnumObjects]
  1972.   end;
  1973. end;
  1974. {$ELSE}
  1975. function PdhEnumObjects; external PdhLib name 'PdhEnumObjectsA';
  1976. {$ENDIF DYNAMIC_LINK}
  1977. {$ENDIF}
  1978. {$IFDEF DYNAMIC_LINK}
  1979. var
  1980.   _PdhEnumObjectItemsA: Pointer;
  1981. function PdhEnumObjectItemsA;
  1982. begin
  1983.   GetProcedureAddress(_PdhEnumObjectItemsA, PdhLib, 'PdhEnumObjectItemsA');
  1984.   asm
  1985.     mov esp, ebp
  1986.     pop ebp
  1987.     jmp [_PdhEnumObjectItemsA]
  1988.   end;
  1989. end;
  1990. {$ELSE}
  1991. function PdhEnumObjectItemsA; external PdhLib name 'PdhEnumObjectItemsA';
  1992. {$ENDIF DYNAMIC_LINK}
  1993. {$IFDEF DYNAMIC_LINK}
  1994. var
  1995.   _PdhEnumObjectItemsW: Pointer;
  1996. function PdhEnumObjectItemsW;
  1997. begin
  1998.   GetProcedureAddress(_PdhEnumObjectItemsW, PdhLib, 'PdhEnumObjectItemsW');
  1999.   asm
  2000.     mov esp, ebp
  2001.     pop ebp
  2002.     jmp [_PdhEnumObjectItemsW]
  2003.   end;
  2004. end;
  2005. {$ELSE}
  2006. function PdhEnumObjectItemsW; external PdhLib name 'PdhEnumObjectItemsW';
  2007. {$ENDIF DYNAMIC_LINK}
  2008. {$IFDEF UNICODE}
  2009. {$IFDEF DYNAMIC_LINK}
  2010. var
  2011.   _PdhEnumObjectItems: Pointer;
  2012. function PdhEnumObjectItems;
  2013. begin
  2014.   GetProcedureAddress(_PdhEnumObjectItems, PdhLib, 'PdhEnumObjectItemsW');
  2015.   asm
  2016.     mov esp, ebp
  2017.     pop ebp
  2018.     jmp [_PdhEnumObjectItems]
  2019.   end;
  2020. end;
  2021. {$ELSE}
  2022. function PdhEnumObjectItems; external PdhLib name 'PdhEnumObjectItemsW';
  2023. {$ENDIF DYNAMIC_LINK}
  2024. {$ELSE}
  2025. {$IFDEF DYNAMIC_LINK}
  2026. var
  2027.   _PdhEnumObjectItems: Pointer;
  2028. function PdhEnumObjectItems;
  2029. begin
  2030.   GetProcedureAddress(_PdhEnumObjectItems, PdhLib, 'PdhEnumObjectItemsA');
  2031.   asm
  2032.     mov esp, ebp
  2033.     pop ebp
  2034.     jmp [_PdhEnumObjectItems]
  2035.   end;
  2036. end;
  2037. {$ELSE}
  2038. function PdhEnumObjectItems; external PdhLib name 'PdhEnumObjectItemsA';
  2039. {$ENDIF DYNAMIC_LINK}
  2040. {$ENDIF}
  2041. {$IFDEF DYNAMIC_LINK}
  2042. var
  2043.   _PdhMakeCounterPathA: Pointer;
  2044. function PdhMakeCounterPathA;
  2045. begin
  2046.   GetProcedureAddress(_PdhMakeCounterPathA, PdhLib, 'PdhMakeCounterPathA');
  2047.   asm
  2048.     mov esp, ebp
  2049.     pop ebp
  2050.     jmp [_PdhMakeCounterPathA]
  2051.   end;
  2052. end;
  2053. {$ELSE}
  2054. function PdhMakeCounterPathA; external PdhLib name 'PdhMakeCounterPathA';
  2055. {$ENDIF DYNAMIC_LINK}
  2056. {$IFDEF DYNAMIC_LINK}
  2057. var
  2058.   _PdhMakeCounterPathW: Pointer;
  2059. function PdhMakeCounterPathW;
  2060. begin
  2061.   GetProcedureAddress(_PdhMakeCounterPathW, PdhLib, 'PdhMakeCounterPathW');
  2062.   asm
  2063.     mov esp, ebp
  2064.     pop ebp
  2065.     jmp [_PdhMakeCounterPathW]
  2066.   end;
  2067. end;
  2068. {$ELSE}
  2069. function PdhMakeCounterPathW; external PdhLib name 'PdhMakeCounterPathW';
  2070. {$ENDIF DYNAMIC_LINK}
  2071. {$IFDEF UNICODE}
  2072. {$IFDEF DYNAMIC_LINK}
  2073. var
  2074.   _PdhMakeCounterPath: Pointer;
  2075. function PdhMakeCounterPath;
  2076. begin
  2077.   GetProcedureAddress(_PdhMakeCounterPath, PdhLib, 'PdhMakeCounterPathW');
  2078.   asm
  2079.     mov esp, ebp
  2080.     pop ebp
  2081.     jmp [_PdhMakeCounterPath]
  2082.   end;
  2083. end;
  2084. {$ELSE}
  2085. function PdhMakeCounterPath; external PdhLib name 'PdhMakeCounterPathW';
  2086. {$ENDIF DYNAMIC_LINK}
  2087. {$ELSE}
  2088. {$IFDEF DYNAMIC_LINK}
  2089. var
  2090.   _PdhMakeCounterPath: Pointer;
  2091. function PdhMakeCounterPath;
  2092. begin
  2093.   GetProcedureAddress(_PdhMakeCounterPath, PdhLib, 'PdhMakeCounterPathA');
  2094.   asm
  2095.     mov esp, ebp
  2096.     pop ebp
  2097.     jmp [_PdhMakeCounterPath]
  2098.   end;
  2099. end;
  2100. {$ELSE}
  2101. function PdhMakeCounterPath; external PdhLib name 'PdhMakeCounterPathA';
  2102. {$ENDIF DYNAMIC_LINK}
  2103. {$ENDIF}
  2104. {$IFDEF DYNAMIC_LINK}
  2105. var
  2106.   _PdhParseCounterPathA: Pointer;
  2107. function PdhParseCounterPathA;
  2108. begin
  2109.   GetProcedureAddress(_PdhParseCounterPathA, PdhLib, 'PdhParseCounterPathA');
  2110.   asm
  2111.     mov esp, ebp
  2112.     pop ebp
  2113.     jmp [_PdhParseCounterPathA]
  2114.   end;
  2115. end;
  2116. {$ELSE}
  2117. function PdhParseCounterPathA; external PdhLib name 'PdhParseCounterPathA';
  2118. {$ENDIF DYNAMIC_LINK}
  2119. {$IFDEF DYNAMIC_LINK}
  2120. var
  2121.   _PdhParseCounterPathW: Pointer;
  2122. function PdhParseCounterPathW;
  2123. begin
  2124.   GetProcedureAddress(_PdhParseCounterPathW, PdhLib, 'PdhParseCounterPathW');
  2125.   asm
  2126.     mov esp, ebp
  2127.     pop ebp
  2128.     jmp [_PdhParseCounterPathW]
  2129.   end;
  2130. end;
  2131. {$ELSE}
  2132. function PdhParseCounterPathW; external PdhLib name 'PdhParseCounterPathW';
  2133. {$ENDIF DYNAMIC_LINK}
  2134. {$IFDEF UNICODE}
  2135. {$IFDEF DYNAMIC_LINK}
  2136. var
  2137.   _PdhParseCounterPath: Pointer;
  2138. function PdhParseCounterPath;
  2139. begin
  2140.   GetProcedureAddress(_PdhParseCounterPath, PdhLib, 'PdhParseCounterPathW');
  2141.   asm
  2142.     mov esp, ebp
  2143.     pop ebp
  2144.     jmp [_PdhParseCounterPath]
  2145.   end;
  2146. end;
  2147. {$ELSE}
  2148. function PdhParseCounterPath; external PdhLib name 'PdhParseCounterPathW';
  2149. {$ENDIF DYNAMIC_LINK}
  2150. {$ELSE}
  2151. {$IFDEF DYNAMIC_LINK}
  2152. var
  2153.   _PdhParseCounterPath: Pointer;
  2154. function PdhParseCounterPath;
  2155. begin
  2156.   GetProcedureAddress(_PdhParseCounterPath, PdhLib, 'PdhParseCounterPathA');
  2157.   asm
  2158.     mov esp, ebp
  2159.     pop ebp
  2160.     jmp [_PdhParseCounterPath]
  2161.   end;
  2162. end;
  2163. {$ELSE}
  2164. function PdhParseCounterPath; external PdhLib name 'PdhParseCounterPathA';
  2165. {$ENDIF DYNAMIC_LINK}
  2166. {$ENDIF}
  2167. function PDH_PATH_LANG_FLAGS(LangId, Flags: DWORD): DWORD;
  2168. begin
  2169.   Result := DWORD(((LangId and $0000FFFF) shl 16) or (Flags and $0000FFFF));
  2170. end;
  2171. {$IFDEF DYNAMIC_LINK}
  2172. var
  2173.   _PdhParseInstanceNameA: Pointer;
  2174. function PdhParseInstanceNameA;
  2175. begin
  2176.   GetProcedureAddress(_PdhParseInstanceNameA, PdhLib, 'PdhParseInstanceNameA');
  2177.   asm
  2178.     mov esp, ebp
  2179.     pop ebp
  2180.     jmp [_PdhParseInstanceNameA]
  2181.   end;
  2182. end;
  2183. {$ELSE}
  2184. function PdhParseInstanceNameA; external PdhLib name 'PdhParseInstanceNameA';
  2185. {$ENDIF DYNAMIC_LINK}
  2186. {$IFDEF DYNAMIC_LINK}
  2187. var
  2188.   _PdhParseInstanceNameW: Pointer;
  2189. function PdhParseInstanceNameW;
  2190. begin
  2191.   GetProcedureAddress(_PdhParseInstanceNameW, PdhLib, 'PdhParseInstanceNameW');
  2192.   asm
  2193.     mov esp, ebp
  2194.     pop ebp
  2195.     jmp [_PdhParseInstanceNameW]
  2196.   end;
  2197. end;
  2198. {$ELSE}
  2199. function PdhParseInstanceNameW; external PdhLib name 'PdhParseInstanceNameW';
  2200. {$ENDIF DYNAMIC_LINK}
  2201. {$IFDEF UNICODE}
  2202. {$IFDEF DYNAMIC_LINK}
  2203. var
  2204.   _PdhParseInstanceName: Pointer;
  2205. function PdhParseInstanceName;
  2206. begin
  2207.   GetProcedureAddress(_PdhParseInstanceName, PdhLib, 'PdhParseInstanceNameW');
  2208.   asm
  2209.     mov esp, ebp
  2210.     pop ebp
  2211.     jmp [_PdhParseInstanceName]
  2212.   end;
  2213. end;
  2214. {$ELSE}
  2215. function PdhParseInstanceName; external PdhLib name 'PdhParseInstanceNameW';
  2216. {$ENDIF DYNAMIC_LINK}
  2217. {$ELSE}
  2218. {$IFDEF DYNAMIC_LINK}
  2219. var
  2220.   _PdhParseInstanceName: Pointer;
  2221. function PdhParseInstanceName;
  2222. begin
  2223.   GetProcedureAddress(_PdhParseInstanceName, PdhLib, 'PdhParseInstanceNameA');
  2224.   asm
  2225.     mov esp, ebp
  2226.     pop ebp
  2227.     jmp [_PdhParseInstanceName]
  2228.   end;
  2229. end;
  2230. {$ELSE}
  2231. function PdhParseInstanceName; external PdhLib name 'PdhParseInstanceNameA';
  2232. {$ENDIF DYNAMIC_LINK}
  2233. {$ENDIF}
  2234. {$IFDEF DYNAMIC_LINK}
  2235. var
  2236.   _PdhValidatePathA: Pointer;
  2237. function PdhValidatePathA;
  2238. begin
  2239.   GetProcedureAddress(_PdhValidatePathA, PdhLib, 'PdhValidatePathA');
  2240.   asm
  2241.     mov esp, ebp
  2242.     pop ebp
  2243.     jmp [_PdhValidatePathA]
  2244.   end;
  2245. end;
  2246. {$ELSE}
  2247. function PdhValidatePathA; external PdhLib name 'PdhValidatePathA';
  2248. {$ENDIF DYNAMIC_LINK}
  2249. {$IFDEF DYNAMIC_LINK}
  2250. var
  2251.   _PdhValidatePathW: Pointer;
  2252. function PdhValidatePathW;
  2253. begin
  2254.   GetProcedureAddress(_PdhValidatePathW, PdhLib, 'PdhValidatePathW');
  2255.   asm
  2256.     mov esp, ebp
  2257.     pop ebp
  2258.     jmp [_PdhValidatePathW]
  2259.   end;
  2260. end;
  2261. {$ELSE}
  2262. function PdhValidatePathW; external PdhLib name 'PdhValidatePathW';
  2263. {$ENDIF DYNAMIC_LINK}
  2264. {$IFDEF UNICODE}
  2265. {$IFDEF DYNAMIC_LINK}
  2266. var
  2267.   _PdhValidatePath: Pointer;
  2268. function PdhValidatePath;
  2269. begin
  2270.   GetProcedureAddress(_PdhValidatePath, PdhLib, 'PdhValidatePathW');
  2271.   asm
  2272.     mov esp, ebp
  2273.     pop ebp
  2274.     jmp [_PdhValidatePath]
  2275.   end;
  2276. end;
  2277. {$ELSE}
  2278. function PdhValidatePath; external PdhLib name 'PdhValidatePathW';
  2279. {$ENDIF DYNAMIC_LINK}
  2280. {$ELSE}
  2281. {$IFDEF DYNAMIC_LINK}
  2282. var
  2283.   _PdhValidatePath: Pointer;
  2284. function PdhValidatePath;
  2285. begin
  2286.   GetProcedureAddress(_PdhValidatePath, PdhLib, 'PdhValidatePathA');
  2287.   asm
  2288.     mov esp, ebp
  2289.     pop ebp
  2290.     jmp [_PdhValidatePath]
  2291.   end;
  2292. end;
  2293. {$ELSE}
  2294. function PdhValidatePath; external PdhLib name 'PdhValidatePathA';
  2295. {$ENDIF DYNAMIC_LINK}
  2296. {$ENDIF}
  2297. {$IFDEF DYNAMIC_LINK}
  2298. var
  2299.   _PdhGetDefaultPerfObjectA: Pointer;
  2300. function PdhGetDefaultPerfObjectA;
  2301. begin
  2302.   GetProcedureAddress(_PdhGetDefaultPerfObjectA, PdhLib, 'PdhGetDefaultPerfObjectA');
  2303.   asm
  2304.     mov esp, ebp
  2305.     pop ebp
  2306.     jmp [_PdhGetDefaultPerfObjectA]
  2307.   end;
  2308. end;
  2309. {$ELSE}
  2310. function PdhGetDefaultPerfObjectA; external PdhLib name 'PdhGetDefaultPerfObjectA';
  2311. {$ENDIF DYNAMIC_LINK}
  2312. {$IFDEF DYNAMIC_LINK}
  2313. var
  2314.   _PdhGetDefaultPerfObjectW: Pointer;
  2315. function PdhGetDefaultPerfObjectW;
  2316. begin
  2317.   GetProcedureAddress(_PdhGetDefaultPerfObjectW, PdhLib, 'PdhGetDefaultPerfObjectW');
  2318.   asm
  2319.     mov esp, ebp
  2320.     pop ebp
  2321.     jmp [_PdhGetDefaultPerfObjectW]
  2322.   end;
  2323. end;
  2324. {$ELSE}
  2325. function PdhGetDefaultPerfObjectW; external PdhLib name 'PdhGetDefaultPerfObjectW';
  2326. {$ENDIF DYNAMIC_LINK}
  2327. {$IFDEF UNICODE}
  2328. {$IFDEF DYNAMIC_LINK}
  2329. var
  2330.   _PdhGetDefaultPerfObject: Pointer;
  2331. function PdhGetDefaultPerfObject;
  2332. begin
  2333.   GetProcedureAddress(_PdhGetDefaultPerfObject, PdhLib, 'PdhGetDefaultPerfObjectW');
  2334.   asm
  2335.     mov esp, ebp
  2336.     pop ebp
  2337.     jmp [_PdhGetDefaultPerfObject]
  2338.   end;
  2339. end;
  2340. {$ELSE}
  2341. function PdhGetDefaultPerfObject; external PdhLib name 'PdhGetDefaultPerfObjectW';
  2342. {$ENDIF DYNAMIC_LINK}
  2343. {$ELSE}
  2344. {$IFDEF DYNAMIC_LINK}
  2345. var
  2346.   _PdhGetDefaultPerfObject: Pointer;
  2347. function PdhGetDefaultPerfObject;
  2348. begin
  2349.   GetProcedureAddress(_PdhGetDefaultPerfObject, PdhLib, 'PdhGetDefaultPerfObjectA');
  2350.   asm
  2351.     mov esp, ebp
  2352.     pop ebp
  2353.     jmp [_PdhGetDefaultPerfObject]
  2354.   end;
  2355. end;
  2356. {$ELSE}
  2357. function PdhGetDefaultPerfObject; external PdhLib name 'PdhGetDefaultPerfObjectA';
  2358. {$ENDIF DYNAMIC_LINK}
  2359. {$ENDIF}
  2360. {$IFDEF DYNAMIC_LINK}
  2361. var
  2362.   _PdhGetDefaultPerfCounterA: Pointer;
  2363. function PdhGetDefaultPerfCounterA;
  2364. begin
  2365.   GetProcedureAddress(_PdhGetDefaultPerfCounterA, PdhLib, 'PdhGetDefaultPerfCounterA');
  2366.   asm
  2367.     mov esp, ebp
  2368.     pop ebp
  2369.     jmp [_PdhGetDefaultPerfCounterA]
  2370.   end;
  2371. end;
  2372. {$ELSE}
  2373. function PdhGetDefaultPerfCounterA; external PdhLib name 'PdhGetDefaultPerfCounterA';
  2374. {$ENDIF DYNAMIC_LINK}
  2375. {$IFDEF DYNAMIC_LINK}
  2376. var
  2377.   _PdhGetDefaultPerfCounterW: Pointer;
  2378. function PdhGetDefaultPerfCounterW;
  2379. begin
  2380.   GetProcedureAddress(_PdhGetDefaultPerfCounterW, PdhLib, 'PdhGetDefaultPerfCounterW');
  2381.   asm
  2382.     mov esp, ebp
  2383.     pop ebp
  2384.     jmp [_PdhGetDefaultPerfCounterW]
  2385.   end;
  2386. end;
  2387. {$ELSE}
  2388. function PdhGetDefaultPerfCounterW; external PdhLib name 'PdhGetDefaultPerfCounterW';
  2389. {$ENDIF DYNAMIC_LINK}
  2390. {$IFDEF UNICODE}
  2391. {$IFDEF DYNAMIC_LINK}
  2392. var
  2393.   _PdhGetDefaultPerfCounter: Pointer;
  2394. function PdhGetDefaultPerfCounter;
  2395. begin
  2396.   GetProcedureAddress(_PdhGetDefaultPerfCounter, PdhLib, 'PdhGetDefaultPerfCounterW');
  2397.   asm
  2398.     mov esp, ebp
  2399.     pop ebp
  2400.     jmp [_PdhGetDefaultPerfCounter]
  2401.   end;
  2402. end;
  2403. {$ELSE}
  2404. function PdhGetDefaultPerfCounter; external PdhLib name 'PdhGetDefaultPerfCounterW';
  2405. {$ENDIF DYNAMIC_LINK}
  2406. {$ELSE}
  2407. {$IFDEF DYNAMIC_LINK}
  2408. var
  2409.   _PdhGetDefaultPerfCounter: Pointer;
  2410. function PdhGetDefaultPerfCounter;
  2411. begin
  2412.   GetProcedureAddress(_PdhGetDefaultPerfCounter, PdhLib, 'PdhGetDefaultPerfCounterA');
  2413.   asm
  2414.     mov esp, ebp
  2415.     pop ebp
  2416.     jmp [_PdhGetDefaultPerfCounter]
  2417.   end;
  2418. end;
  2419. {$ELSE}
  2420. function PdhGetDefaultPerfCounter; external PdhLib name 'PdhGetDefaultPerfCounterA';
  2421. {$ENDIF DYNAMIC_LINK}
  2422. {$ENDIF}
  2423. {$IFDEF DYNAMIC_LINK}
  2424. var
  2425.   _PdhBrowseCountersA: Pointer;
  2426. function PdhBrowseCountersA;
  2427. begin
  2428.   GetProcedureAddress(_PdhBrowseCountersA, PdhLib, 'PdhBrowseCountersA');
  2429.   asm
  2430.     mov esp, ebp
  2431.     pop ebp
  2432.     jmp [_PdhBrowseCountersA]
  2433.   end;
  2434. end;
  2435. {$ELSE}
  2436. function PdhBrowseCountersA; external PdhLib name 'PdhBrowseCountersA';
  2437. {$ENDIF DYNAMIC_LINK}
  2438. {$IFDEF DYNAMIC_LINK}
  2439. var
  2440.   _PdhBrowseCountersW: Pointer;
  2441. function PdhBrowseCountersW;
  2442. begin
  2443.   GetProcedureAddress(_PdhBrowseCountersW, PdhLib, 'PdhBrowseCountersW');
  2444.   asm
  2445.     mov esp, ebp
  2446.     pop ebp
  2447.     jmp [_PdhBrowseCountersW]
  2448.   end;
  2449. end;
  2450. {$ELSE}
  2451. function PdhBrowseCountersW; external PdhLib name 'PdhBrowseCountersW';
  2452. {$ENDIF DYNAMIC_LINK}
  2453. {$IFDEF UNICODE}
  2454. {$IFDEF DYNAMIC_LINK}
  2455. var
  2456.   _PdhBrowseCounters: Pointer;
  2457. function PdhBrowseCounters;
  2458. begin
  2459.   GetProcedureAddress(_PdhBrowseCounters, PdhLib, 'PdhBrowseCountersW');
  2460.   asm
  2461.     mov esp, ebp
  2462.     pop ebp
  2463.     jmp [_PdhBrowseCounters]
  2464.   end;
  2465. end;
  2466. {$ELSE}
  2467. function PdhBrowseCounters; external PdhLib name 'PdhBrowseCountersW';
  2468. {$ENDIF DYNAMIC_LINK}
  2469. {$ELSE}
  2470. {$IFDEF DYNAMIC_LINK}
  2471. var
  2472.   _PdhBrowseCounters: Pointer;
  2473. function PdhBrowseCounters;
  2474. begin
  2475.   GetProcedureAddress(_PdhBrowseCounters, PdhLib, 'PdhBrowseCountersA');
  2476.   asm
  2477.     mov esp, ebp
  2478.     pop ebp
  2479.     jmp [_PdhBrowseCounters]
  2480.   end;
  2481. end;
  2482. {$ELSE}
  2483. function PdhBrowseCounters; external PdhLib name 'PdhBrowseCountersA';
  2484. {$ENDIF DYNAMIC_LINK}
  2485. {$ENDIF}
  2486. {$IFDEF DYNAMIC_LINK}
  2487. var
  2488.   _PdhExpandCounterPathA: Pointer;
  2489. function PdhExpandCounterPathA;
  2490. begin
  2491.   GetProcedureAddress(_PdhExpandCounterPathA, PdhLib, 'PdhExpandCounterPathA');
  2492.   asm
  2493.     mov esp, ebp
  2494.     pop ebp
  2495.     jmp [_PdhExpandCounterPathA]
  2496.   end;
  2497. end;
  2498. {$ELSE}
  2499. function PdhExpandCounterPathA; external PdhLib name 'PdhExpandCounterPathA';
  2500. {$ENDIF DYNAMIC_LINK}
  2501. {$IFDEF DYNAMIC_LINK}
  2502. var
  2503.   _PdhExpandCounterPathW: Pointer;
  2504. function PdhExpandCounterPathW;
  2505. begin
  2506.   GetProcedureAddress(_PdhExpandCounterPathW, PdhLib, 'PdhExpandCounterPathW');
  2507.   asm
  2508.     mov esp, ebp
  2509.     pop ebp
  2510.     jmp [_PdhExpandCounterPathW]
  2511.   end;
  2512. end;
  2513. {$ELSE}
  2514. function PdhExpandCounterPathW; external PdhLib name 'PdhExpandCounterPathW';
  2515. {$ENDIF DYNAMIC_LINK}
  2516. {$IFDEF UNICODE}
  2517. {$IFDEF DYNAMIC_LINK}
  2518. var
  2519.   _PdhExpandCounterPath: Pointer;
  2520. function PdhExpandCounterPath;
  2521. begin
  2522.   GetProcedureAddress(_PdhExpandCounterPath, PdhLib, 'PdhExpandCounterPathW');
  2523.   asm
  2524.     mov esp, ebp
  2525.     pop ebp
  2526.     jmp [_PdhExpandCounterPath]
  2527.   end;
  2528. end;
  2529. {$ELSE}
  2530. function PdhExpandCounterPath; external PdhLib name 'PdhExpandCounterPathW';
  2531. {$ENDIF DYNAMIC_LINK}
  2532. {$ELSE}
  2533. {$IFDEF DYNAMIC_LINK}
  2534. var
  2535.   _PdhExpandCounterPath: Pointer;
  2536. function PdhExpandCounterPath;
  2537. begin
  2538.   GetProcedureAddress(_PdhExpandCounterPath, PdhLib, 'PdhExpandCounterPathA');
  2539.   asm
  2540.     mov esp, ebp
  2541.     pop ebp
  2542.     jmp [_PdhExpandCounterPath]
  2543.   end;
  2544. end;
  2545. {$ELSE}
  2546. function PdhExpandCounterPath; external PdhLib name 'PdhExpandCounterPathA';
  2547. {$ENDIF DYNAMIC_LINK}
  2548. {$ENDIF}
  2549. {$IFDEF DYNAMIC_LINK}
  2550. var
  2551.   _PdhLookupPerfNameByIndexA: Pointer;
  2552. function PdhLookupPerfNameByIndexA;
  2553. begin
  2554.   GetProcedureAddress(_PdhLookupPerfNameByIndexA, PdhLib, 'PdhLookupPerfNameByIndexA');
  2555.   asm
  2556.     mov esp, ebp
  2557.     pop ebp
  2558.     jmp [_PdhLookupPerfNameByIndexA]
  2559.   end;
  2560. end;
  2561. {$ELSE}
  2562. function PdhLookupPerfNameByIndexA; external PdhLib name 'PdhLookupPerfNameByIndexA';
  2563. {$ENDIF DYNAMIC_LINK}
  2564. {$IFDEF DYNAMIC_LINK}
  2565. var
  2566.   _PdhLookupPerfNameByIndexW: Pointer;
  2567. function PdhLookupPerfNameByIndexW;
  2568. begin
  2569.   GetProcedureAddress(_PdhLookupPerfNameByIndexW, PdhLib, 'PdhLookupPerfNameByIndexW');
  2570.   asm
  2571.     mov esp, ebp
  2572.     pop ebp
  2573.     jmp [_PdhLookupPerfNameByIndexW]
  2574.   end;
  2575. end;
  2576. {$ELSE}
  2577. function PdhLookupPerfNameByIndexW; external PdhLib name 'PdhLookupPerfNameByIndexW';
  2578. {$ENDIF DYNAMIC_LINK}
  2579. {$IFDEF UNICODE}
  2580. {$IFDEF DYNAMIC_LINK}
  2581. var
  2582.   _PdhLookupPerfNameByIndex: Pointer;
  2583. function PdhLookupPerfNameByIndex;
  2584. begin
  2585.   GetProcedureAddress(_PdhLookupPerfNameByIndex, PdhLib, 'PdhLookupPerfNameByIndexW');
  2586.   asm
  2587.     mov esp, ebp
  2588.     pop ebp
  2589.     jmp [_PdhLookupPerfNameByIndex]
  2590.   end;
  2591. end;
  2592. {$ELSE}
  2593. function PdhLookupPerfNameByIndex; external PdhLib name 'PdhLookupPerfNameByIndexW';
  2594. {$ENDIF DYNAMIC_LINK}
  2595. {$ELSE}
  2596. {$IFDEF DYNAMIC_LINK}
  2597. var
  2598.   _PdhLookupPerfNameByIndex: Pointer;
  2599. function PdhLookupPerfNameByIndex;
  2600. begin
  2601.   GetProcedureAddress(_PdhLookupPerfNameByIndex, PdhLib, 'PdhLookupPerfNameByIndexA');
  2602.   asm
  2603.     mov esp, ebp
  2604.     pop ebp
  2605.     jmp [_PdhLookupPerfNameByIndex]
  2606.   end;
  2607. end;
  2608. {$ELSE}
  2609. function PdhLookupPerfNameByIndex; external PdhLib name 'PdhLookupPerfNameByIndexA';
  2610. {$ENDIF DYNAMIC_LINK}
  2611. {$ENDIF}
  2612. {$IFDEF DYNAMIC_LINK}
  2613. var
  2614.   _PdhLookupPerfIndexByNameA: Pointer;
  2615. function PdhLookupPerfIndexByNameA;
  2616. begin
  2617.   GetProcedureAddress(_PdhLookupPerfIndexByNameA, PdhLib, 'PdhLookupPerfIndexByNameA');
  2618.   asm
  2619.     mov esp, ebp
  2620.     pop ebp
  2621.     jmp [_PdhLookupPerfIndexByNameA]
  2622.   end;
  2623. end;
  2624. {$ELSE}
  2625. function PdhLookupPerfIndexByNameA; external PdhLib name 'PdhLookupPerfIndexByNameA';
  2626. {$ENDIF DYNAMIC_LINK}
  2627. {$IFDEF DYNAMIC_LINK}
  2628. var
  2629.   _PdhLookupPerfIndexByNameW: Pointer;
  2630. function PdhLookupPerfIndexByNameW;
  2631. begin
  2632.   GetProcedureAddress(_PdhLookupPerfIndexByNameW, PdhLib, 'PdhLookupPerfIndexByNameW');
  2633.   asm
  2634.     mov esp, ebp
  2635.     pop ebp
  2636.     jmp [_PdhLookupPerfIndexByNameW]
  2637.   end;
  2638. end;
  2639. {$ELSE}
  2640. function PdhLookupPerfIndexByNameW; external PdhLib name 'PdhLookupPerfIndexByNameW';
  2641. {$ENDIF DYNAMIC_LINK}
  2642. {$IFDEF UNICODE}
  2643. {$IFDEF DYNAMIC_LINK}
  2644. var
  2645.   _PdhLookupPerfIndexByName: Pointer;
  2646. function PdhLookupPerfIndexByName;
  2647. begin
  2648.   GetProcedureAddress(_PdhLookupPerfIndexByName, PdhLib, 'PdhLookupPerfIndexByNameW');
  2649.   asm
  2650.     mov esp, ebp
  2651.     pop ebp
  2652.     jmp [_PdhLookupPerfIndexByName]
  2653.   end;
  2654. end;
  2655. {$ELSE}
  2656. function PdhLookupPerfIndexByName; external PdhLib name 'PdhLookupPerfIndexByNameW';
  2657. {$ENDIF DYNAMIC_LINK}
  2658. {$ELSE}
  2659. {$IFDEF DYNAMIC_LINK}
  2660. var
  2661.   _PdhLookupPerfIndexByName: Pointer;
  2662. function PdhLookupPerfIndexByName;
  2663. begin
  2664.   GetProcedureAddress(_PdhLookupPerfIndexByName, PdhLib, 'PdhLookupPerfIndexByNameA');
  2665.   asm
  2666.     mov esp, ebp
  2667.     pop ebp
  2668.     jmp [_PdhLookupPerfIndexByName]
  2669.   end;
  2670. end;
  2671. {$ELSE}
  2672. function PdhLookupPerfIndexByName; external PdhLib name 'PdhLookupPerfIndexByNameA';
  2673. {$ENDIF DYNAMIC_LINK}
  2674. {$ENDIF}
  2675. {$IFDEF DYNAMIC_LINK}
  2676. var
  2677.   _PdhExpandWildCardPathA: Pointer;
  2678. function PdhExpandWildCardPathA;
  2679. begin
  2680.   GetProcedureAddress(_PdhExpandWildCardPathA, PdhLib, 'PdhExpandWildCardPathA');
  2681.   asm
  2682.     mov esp, ebp
  2683.     pop ebp
  2684.     jmp [_PdhExpandWildCardPathA]
  2685.   end;
  2686. end;
  2687. {$ELSE}
  2688. function PdhExpandWildCardPathA; external PdhLib name 'PdhExpandWildCardPathA';
  2689. {$ENDIF DYNAMIC_LINK}
  2690. {$IFDEF DYNAMIC_LINK}
  2691. var
  2692.   _PdhExpandWildCardPathW: Pointer;
  2693. function PdhExpandWildCardPathW;
  2694. begin
  2695.   GetProcedureAddress(_PdhExpandWildCardPathW, PdhLib, 'PdhExpandWildCardPathW');
  2696.   asm
  2697.     mov esp, ebp
  2698.     pop ebp
  2699.     jmp [_PdhExpandWildCardPathW]
  2700.   end;
  2701. end;
  2702. {$ELSE}
  2703. function PdhExpandWildCardPathW; external PdhLib name 'PdhExpandWildCardPathW';
  2704. {$ENDIF DYNAMIC_LINK}
  2705. {$IFDEF UNICODE}
  2706. {$IFDEF DYNAMIC_LINK}
  2707. var
  2708.   _PdhExpandWildCardPath: Pointer;
  2709. function PdhExpandWildCardPath;
  2710. begin
  2711.   GetProcedureAddress(_PdhExpandWildCardPath, PdhLib, 'PdhExpandWildCardPathW');
  2712.   asm
  2713.     mov esp, ebp
  2714.     pop ebp
  2715.     jmp [_PdhExpandWildCardPath]
  2716.   end;
  2717. end;
  2718. {$ELSE}
  2719. function PdhExpandWildCardPath; external PdhLib name 'PdhExpandWildCardPathW';
  2720. {$ENDIF DYNAMIC_LINK}
  2721. {$ELSE}
  2722. {$IFDEF DYNAMIC_LINK}
  2723. var
  2724.   _PdhExpandWildCardPath: Pointer;
  2725. function PdhExpandWildCardPath;
  2726. begin
  2727.   GetProcedureAddress(_PdhExpandWildCardPath, PdhLib, 'PdhExpandWildCardPathA');
  2728.   asm
  2729.     mov esp, ebp
  2730.     pop ebp
  2731.     jmp [_PdhExpandWildCardPath]
  2732.   end;
  2733. end;
  2734. {$ELSE}
  2735. function PdhExpandWildCardPath; external PdhLib name 'PdhExpandWildCardPathA';
  2736. {$ENDIF DYNAMIC_LINK}
  2737. {$ENDIF}
  2738. {$IFDEF DYNAMIC_LINK}
  2739. var
  2740.   _PdhOpenLogA: Pointer;
  2741. function PdhOpenLogA;
  2742. begin
  2743.   GetProcedureAddress(_PdhOpenLogA, PdhLib, 'PdhOpenLogA');
  2744.   asm
  2745.     mov esp, ebp
  2746.     pop ebp
  2747.     jmp [_PdhOpenLogA]
  2748.   end;
  2749. end;
  2750. {$ELSE}
  2751. function PdhOpenLogA; external PdhLib name 'PdhOpenLogA';
  2752. {$ENDIF DYNAMIC_LINK}
  2753. {$IFDEF DYNAMIC_LINK}
  2754. var
  2755.   _PdhOpenLogW: Pointer;
  2756. function PdhOpenLogW;
  2757. begin
  2758.   GetProcedureAddress(_PdhOpenLogW, PdhLib, 'PdhOpenLogW');
  2759.   asm
  2760.     mov esp, ebp
  2761.     pop ebp
  2762.     jmp [_PdhOpenLogW]
  2763.   end;
  2764. end;
  2765. {$ELSE}
  2766. function PdhOpenLogW; external PdhLib name 'PdhOpenLogW';
  2767. {$ENDIF DYNAMIC_LINK}
  2768. {$IFDEF UNICODE}
  2769. {$IFDEF DYNAMIC_LINK}
  2770. var
  2771.   _PdhOpenLog: Pointer;
  2772. function PdhOpenLog;
  2773. begin
  2774.   GetProcedureAddress(_PdhOpenLog, PdhLib, 'PdhOpenLogW');
  2775.   asm
  2776.     mov esp, ebp
  2777.     pop ebp
  2778.     jmp [_PdhOpenLog]
  2779.   end;
  2780. end;
  2781. {$ELSE}
  2782. function PdhOpenLog; external PdhLib name 'PdhOpenLogW';
  2783. {$ENDIF DYNAMIC_LINK}
  2784. {$ELSE}
  2785. {$IFDEF DYNAMIC_LINK}
  2786. var
  2787.   _PdhOpenLog: Pointer;
  2788. function PdhOpenLog;
  2789. begin
  2790.   GetProcedureAddress(_PdhOpenLog, PdhLib, 'PdhOpenLogA');
  2791.   asm
  2792.     mov esp, ebp
  2793.     pop ebp
  2794.     jmp [_PdhOpenLog]
  2795.   end;
  2796. end;
  2797. {$ELSE}
  2798. function PdhOpenLog; external PdhLib name 'PdhOpenLogA';
  2799. {$ENDIF DYNAMIC_LINK}
  2800. {$ENDIF}
  2801. {$IFDEF DYNAMIC_LINK}
  2802. var
  2803.   _PdhUpdateLogA: Pointer;
  2804. function PdhUpdateLogA;
  2805. begin
  2806.   GetProcedureAddress(_PdhUpdateLogA, PdhLib, 'PdhUpdateLogA');
  2807.   asm
  2808.     mov esp, ebp
  2809.     pop ebp
  2810.     jmp [_PdhUpdateLogA]
  2811.   end;
  2812. end;
  2813. {$ELSE}
  2814. function PdhUpdateLogA; external PdhLib name 'PdhUpdateLogA';
  2815. {$ENDIF DYNAMIC_LINK}
  2816. {$IFDEF DYNAMIC_LINK}
  2817. var
  2818.   _PdhUpdateLogW: Pointer;
  2819. function PdhUpdateLogW;
  2820. begin
  2821.   GetProcedureAddress(_PdhUpdateLogW, PdhLib, 'PdhUpdateLogW');
  2822.   asm
  2823.     mov esp, ebp
  2824.     pop ebp
  2825.     jmp [_PdhUpdateLogW]
  2826.   end;
  2827. end;
  2828. {$ELSE}
  2829. function PdhUpdateLogW; external PdhLib name 'PdhUpdateLogW';
  2830. {$ENDIF DYNAMIC_LINK}
  2831. {$IFDEF UNICODE}
  2832. {$IFDEF DYNAMIC_LINK}
  2833. var
  2834.   _PdhUpdateLog: Pointer;
  2835. function PdhUpdateLog;
  2836. begin
  2837.   GetProcedureAddress(_PdhUpdateLog, PdhLib, 'PdhUpdateLogW');
  2838.   asm
  2839.     mov esp, ebp
  2840.     pop ebp
  2841.     jmp [_PdhUpdateLog]
  2842.   end;
  2843. end;
  2844. {$ELSE}
  2845. function PdhUpdateLog; external PdhLib name 'PdhUpdateLogW';
  2846. {$ENDIF DYNAMIC_LINK}
  2847. {$ELSE}
  2848. {$IFDEF DYNAMIC_LINK}
  2849. var
  2850.   _PdhUpdateLog: Pointer;
  2851. function PdhUpdateLog;
  2852. begin
  2853.   GetProcedureAddress(_PdhUpdateLog, PdhLib, 'PdhUpdateLogA');
  2854.   asm
  2855.     mov esp, ebp
  2856.     pop ebp
  2857.     jmp [_PdhUpdateLog]
  2858.   end;
  2859. end;
  2860. {$ELSE}
  2861. function PdhUpdateLog; external PdhLib name 'PdhUpdateLogA';
  2862. {$ENDIF DYNAMIC_LINK}
  2863. {$ENDIF}
  2864. {$IFDEF DYNAMIC_LINK}
  2865. var
  2866.   _PdhUpdateLogFileCatalog: Pointer;
  2867. function PdhUpdateLogFileCatalog;
  2868. begin
  2869.   GetProcedureAddress(_PdhUpdateLogFileCatalog, PdhLib, 'PdhUpdateLogFileCatalog');
  2870.   asm
  2871.     mov esp, ebp
  2872.     pop ebp
  2873.     jmp [_PdhUpdateLogFileCatalog]
  2874.   end;
  2875. end;
  2876. {$ELSE}
  2877. function PdhUpdateLogFileCatalog; external PdhLib name 'PdhUpdateLogFileCatalog';
  2878. {$ENDIF DYNAMIC_LINK}
  2879. {$IFDEF DYNAMIC_LINK}
  2880. var
  2881.   _PdhGetLogFileSize: Pointer;
  2882. function PdhGetLogFileSize;
  2883. begin
  2884.   GetProcedureAddress(_PdhGetLogFileSize, PdhLib, 'PdhGetLogFileSize');
  2885.   asm
  2886.     mov esp, ebp
  2887.     pop ebp
  2888.     jmp [_PdhGetLogFileSize]
  2889.   end;
  2890. end;
  2891. {$ELSE}
  2892. function PdhGetLogFileSize; external PdhLib name 'PdhGetLogFileSize';
  2893. {$ENDIF DYNAMIC_LINK}
  2894. {$IFDEF DYNAMIC_LINK}
  2895. var
  2896.   _PdhCloseLog: Pointer;
  2897. function PdhCloseLog;
  2898. begin
  2899.   GetProcedureAddress(_PdhCloseLog, PdhLib, 'PdhCloseLog');
  2900.   asm
  2901.     mov esp, ebp
  2902.     pop ebp
  2903.     jmp [_PdhCloseLog]
  2904.   end;
  2905. end;
  2906. {$ELSE}
  2907. function PdhCloseLog; external PdhLib name 'PdhCloseLog';
  2908. {$ENDIF DYNAMIC_LINK}
  2909. {$IFDEF DYNAMIC_LINK}
  2910. var
  2911.   _PdhSelectDataSourceA: Pointer;
  2912. function PdhSelectDataSourceA;
  2913. begin
  2914.   GetProcedureAddress(_PdhSelectDataSourceA, PdhLib, 'PdhSelectDataSourceA');
  2915.   asm
  2916.     mov esp, ebp
  2917.     pop ebp
  2918.     jmp [_PdhSelectDataSourceA]
  2919.   end;
  2920. end;
  2921. {$ELSE}
  2922. function PdhSelectDataSourceA; external PdhLib name 'PdhSelectDataSourceA';
  2923. {$ENDIF DYNAMIC_LINK}
  2924. {$IFDEF DYNAMIC_LINK}
  2925. var
  2926.   _PdhSelectDataSourceW: Pointer;
  2927. function PdhSelectDataSourceW;
  2928. begin
  2929.   GetProcedureAddress(_PdhSelectDataSourceW, PdhLib, 'PdhSelectDataSourceW');
  2930.   asm
  2931.     mov esp, ebp
  2932.     pop ebp
  2933.     jmp [_PdhSelectDataSourceW]
  2934.   end;
  2935. end;
  2936. {$ELSE}
  2937. function PdhSelectDataSourceW; external PdhLib name 'PdhSelectDataSourceW';
  2938. {$ENDIF DYNAMIC_LINK}
  2939. {$IFDEF UNICODE}
  2940. {$IFDEF DYNAMIC_LINK}
  2941. var
  2942.   _PdhSelectDataSource: Pointer;
  2943. function PdhSelectDataSource;
  2944. begin
  2945.   GetProcedureAddress(_PdhSelectDataSource, PdhLib, 'PdhSelectDataSourceW');
  2946.   asm
  2947.     mov esp, ebp
  2948.     pop ebp
  2949.     jmp [_PdhSelectDataSource]
  2950.   end;
  2951. end;
  2952. {$ELSE}
  2953. function PdhSelectDataSource; external PdhLib name 'PdhSelectDataSourceW';
  2954. {$ENDIF DYNAMIC_LINK}
  2955. {$ELSE}
  2956. {$IFDEF DYNAMIC_LINK}
  2957. var
  2958.   _PdhSelectDataSource: Pointer;
  2959. function PdhSelectDataSource;
  2960. begin
  2961.   GetProcedureAddress(_PdhSelectDataSource, PdhLib, 'PdhSelectDataSourceA');
  2962.   asm
  2963.     mov esp, ebp
  2964.     pop ebp
  2965.     jmp [_PdhSelectDataSource]
  2966.   end;
  2967. end;
  2968. {$ELSE}
  2969. function PdhSelectDataSource; external PdhLib name 'PdhSelectDataSourceA';
  2970. {$ENDIF DYNAMIC_LINK}
  2971. {$ENDIF}
  2972. {$IFDEF DYNAMIC_LINK}
  2973. var
  2974.   _PdhIsRealTimeQuery: Pointer;
  2975. function PdhIsRealTimeQuery;
  2976. begin
  2977.   GetProcedureAddress(_PdhIsRealTimeQuery, PdhLib, 'PdhIsRealTimeQuery');
  2978.   asm
  2979.     mov esp, ebp
  2980.     pop ebp
  2981.     jmp [_PdhIsRealTimeQuery]
  2982.   end;
  2983. end;
  2984. {$ELSE}
  2985. function PdhIsRealTimeQuery; external PdhLib name 'PdhIsRealTimeQuery';
  2986. {$ENDIF DYNAMIC_LINK}
  2987. {$IFDEF DYNAMIC_LINK}
  2988. var
  2989.   _PdhSetQueryTimeRange: Pointer;
  2990. function PdhSetQueryTimeRange;
  2991. begin
  2992.   GetProcedureAddress(_PdhSetQueryTimeRange, PdhLib, 'PdhSetQueryTimeRange');
  2993.   asm
  2994.     mov esp, ebp
  2995.     pop ebp
  2996.     jmp [_PdhSetQueryTimeRange]
  2997.   end;
  2998. end;
  2999. {$ELSE}
  3000. function PdhSetQueryTimeRange; external PdhLib name 'PdhSetQueryTimeRange';
  3001. {$ENDIF DYNAMIC_LINK}
  3002. {$IFDEF DYNAMIC_LINK}
  3003. var
  3004.   _PdhGetDataSourceTimeRangeA: Pointer;
  3005. function PdhGetDataSourceTimeRangeA;
  3006. begin
  3007.   GetProcedureAddress(_PdhGetDataSourceTimeRangeA, PdhLib, 'PdhGetDataSourceTimeRangeA');
  3008.   asm
  3009.     mov esp, ebp
  3010.     pop ebp
  3011.     jmp [_PdhGetDataSourceTimeRangeA]
  3012.   end;
  3013. end;
  3014. {$ELSE}
  3015. function PdhGetDataSourceTimeRangeA; external PdhLib name 'PdhGetDataSourceTimeRangeA';
  3016. {$ENDIF DYNAMIC_LINK}
  3017. {$IFDEF DYNAMIC_LINK}
  3018. var
  3019.   _PdhGetDataSourceTimeRangeW: Pointer;
  3020. function PdhGetDataSourceTimeRangeW;
  3021. begin
  3022.   GetProcedureAddress(_PdhGetDataSourceTimeRangeW, PdhLib, 'PdhGetDataSourceTimeRangeW');
  3023.   asm
  3024.     mov esp, ebp
  3025.     pop ebp
  3026.     jmp [_PdhGetDataSourceTimeRangeW]
  3027.   end;
  3028. end;
  3029. {$ELSE}
  3030. function PdhGetDataSourceTimeRangeW; external PdhLib name 'PdhGetDataSourceTimeRangeW';
  3031. {$ENDIF DYNAMIC_LINK}
  3032. {$IFDEF UNICODE}
  3033. {$IFDEF DYNAMIC_LINK}
  3034. var
  3035.   _PdhGetDataSourceTimeRange: Pointer;
  3036. function PdhGetDataSourceTimeRange;
  3037. begin
  3038.   GetProcedureAddress(_PdhGetDataSourceTimeRange, PdhLib, 'PdhGetDataSourceTimeRangeW');
  3039.   asm
  3040.     mov esp, ebp
  3041.     pop ebp
  3042.     jmp [_PdhGetDataSourceTimeRange]
  3043.   end;
  3044. end;
  3045. {$ELSE}
  3046. function PdhGetDataSourceTimeRange; external PdhLib name 'PdhGetDataSourceTimeRangeW';
  3047. {$ENDIF DYNAMIC_LINK}
  3048. {$ELSE}
  3049. {$IFDEF DYNAMIC_LINK}
  3050. var
  3051.   _PdhGetDataSourceTimeRange: Pointer;
  3052. function PdhGetDataSourceTimeRange;
  3053. begin
  3054.   GetProcedureAddress(_PdhGetDataSourceTimeRange, PdhLib, 'PdhGetDataSourceTimeRangeA');
  3055.   asm
  3056.     mov esp, ebp
  3057.     pop ebp
  3058.     jmp [_PdhGetDataSourceTimeRange]
  3059.   end;
  3060. end;
  3061. {$ELSE}
  3062. function PdhGetDataSourceTimeRange; external PdhLib name 'PdhGetDataSourceTimeRangeA';
  3063. {$ENDIF DYNAMIC_LINK}
  3064. {$ENDIF}
  3065. {$IFDEF DYNAMIC_LINK}
  3066. var
  3067.   _PdhCollectQueryDataEx: Pointer;
  3068. function PdhCollectQueryDataEx;
  3069. begin
  3070.   GetProcedureAddress(_PdhCollectQueryDataEx, PdhLib, 'PdhCollectQueryDataEx');
  3071.   asm
  3072.     mov esp, ebp
  3073.     pop ebp
  3074.     jmp [_PdhCollectQueryDataEx]
  3075.   end;
  3076. end;
  3077. {$ELSE}
  3078. function PdhCollectQueryDataEx; external PdhLib name 'PdhCollectQueryDataEx';
  3079. {$ENDIF DYNAMIC_LINK}
  3080. {$IFDEF DYNAMIC_LINK}
  3081. var
  3082.   _PdhFormatFromRawValue: Pointer;
  3083. function PdhFormatFromRawValue;
  3084. begin
  3085.   GetProcedureAddress(_PdhFormatFromRawValue, PdhLib, 'PdhFormatFromRawValue');
  3086.   asm
  3087.     mov esp, ebp
  3088.     pop ebp
  3089.     jmp [_PdhFormatFromRawValue]
  3090.   end;
  3091. end;
  3092. {$ELSE}
  3093. function PdhFormatFromRawValue; external PdhLib name 'PdhFormatFromRawValue';
  3094. {$ENDIF DYNAMIC_LINK}
  3095. {$IFDEF DYNAMIC_LINK}
  3096. var
  3097.   _PdhGetCounterTimeBase: Pointer;
  3098. function PdhGetCounterTimeBase;
  3099. begin
  3100.   GetProcedureAddress(_PdhGetCounterTimeBase, PdhLib, 'PdhGetCounterTimeBase');
  3101.   asm
  3102.     mov esp, ebp
  3103.     pop ebp
  3104.     jmp [_PdhGetCounterTimeBase]
  3105.   end;
  3106. end;
  3107. {$ELSE}
  3108. function PdhGetCounterTimeBase; external PdhLib name 'PdhGetCounterTimeBase';
  3109. {$ENDIF DYNAMIC_LINK}
  3110. {$IFDEF DYNAMIC_LINK}
  3111. var
  3112.   _PdhReadRawLogRecord: Pointer;
  3113. function PdhReadRawLogRecord;
  3114. begin
  3115.   GetProcedureAddress(_PdhReadRawLogRecord, PdhLib, 'PdhReadRawLogRecord');
  3116.   asm
  3117.     mov esp, ebp
  3118.     pop ebp
  3119.     jmp [_PdhReadRawLogRecord]
  3120.   end;
  3121. end;
  3122. {$ELSE}
  3123. function PdhReadRawLogRecord; external PdhLib name 'PdhReadRawLogRecord';
  3124. {$ENDIF DYNAMIC_LINK}
  3125. {$IFDEF DYNAMIC_LINK}
  3126. var
  3127.   _PdhSetDefaultRealTimeDataSource: Pointer;
  3128. function PdhSetDefaultRealTimeDataSource;
  3129. begin
  3130.   GetProcedureAddress(_PdhSetDefaultRealTimeDataSource, PdhLib, 'PdhSetDefaultRealTimeDataSource');
  3131.   asm
  3132.     mov esp, ebp
  3133.     pop ebp
  3134.     jmp [_PdhSetDefaultRealTimeDataSource]
  3135.   end;
  3136. end;
  3137. {$ELSE}
  3138. function PdhSetDefaultRealTimeDataSource; external PdhLib name 'PdhSetDefaultRealTimeDataSource';
  3139. {$ENDIF DYNAMIC_LINK}
  3140. {$IFDEF DYNAMIC_LINK}
  3141. var
  3142.   _PdhBindInputDataSourceW: Pointer;
  3143. function PdhBindInputDataSourceW;
  3144. begin
  3145.   GetProcedureAddress(_PdhBindInputDataSourceW, PdhLib, 'PdhBindInputDataSourceW');
  3146.   asm
  3147.     mov esp, ebp
  3148.     pop ebp
  3149.     jmp [_PdhBindInputDataSourceW]
  3150.   end;
  3151. end;
  3152. {$ELSE}
  3153. function PdhBindInputDataSourceW; external PdhLib name 'PdhBindInputDataSourceW';
  3154. {$ENDIF DYNAMIC_LINK}
  3155. {$IFDEF DYNAMIC_LINK}
  3156. var
  3157.   _PdhBindInputDataSourceA: Pointer;
  3158. function PdhBindInputDataSourceA;
  3159. begin
  3160.   GetProcedureAddress(_PdhBindInputDataSourceA, PdhLib, 'PdhBindInputDataSourceA');
  3161.   asm
  3162.     mov esp, ebp
  3163.     pop ebp
  3164.     jmp [_PdhBindInputDataSourceA]
  3165.   end;
  3166. end;
  3167. {$ELSE}
  3168. function PdhBindInputDataSourceA; external PdhLib name 'PdhBindInputDataSourceA';
  3169. {$ENDIF DYNAMIC_LINK}
  3170. {$IFDEF UNICODE}
  3171. {$IFDEF DYNAMIC_LINK}
  3172. var
  3173.   _PdhBindInputDataSource: Pointer;
  3174. function PdhBindInputDataSource;
  3175. begin
  3176.   GetProcedureAddress(_PdhBindInputDataSource, PdhLib, 'PdhBindInputDataSourceW');
  3177.   asm
  3178.     mov esp, ebp
  3179.     pop ebp
  3180.     jmp [_PdhBindInputDataSource]
  3181.   end;
  3182. end;
  3183. {$ELSE}
  3184. function PdhBindInputDataSource; external PdhLib name 'PdhBindInputDataSourceW';
  3185. {$ENDIF DYNAMIC_LINK}
  3186. {$ELSE}
  3187. {$IFDEF DYNAMIC_LINK}
  3188. var
  3189.   _PdhBindInputDataSource: Pointer;
  3190. function PdhBindInputDataSource;
  3191. begin
  3192.   GetProcedureAddress(_PdhBindInputDataSource, PdhLib, 'PdhBindInputDataSourceA');
  3193.   asm
  3194.     mov esp, ebp
  3195.     pop ebp
  3196.     jmp [_PdhBindInputDataSource]
  3197.   end;
  3198. end;
  3199. {$ELSE}
  3200. function PdhBindInputDataSource; external PdhLib name 'PdhBindInputDataSourceA';
  3201. {$ENDIF DYNAMIC_LINK}
  3202. {$ENDIF}
  3203. {$IFDEF DYNAMIC_LINK}
  3204. var
  3205.   _PdhOpenQueryH: Pointer;
  3206. function PdhOpenQueryH;
  3207. begin
  3208.   GetProcedureAddress(_PdhOpenQueryH, PdhLib, 'PdhOpenQueryH');
  3209.   asm
  3210.     mov esp, ebp
  3211.     pop ebp
  3212.     jmp [_PdhOpenQueryH]
  3213.   end;
  3214. end;
  3215. {$ELSE}
  3216. function PdhOpenQueryH; external PdhLib name 'PdhOpenQueryH';
  3217. {$ENDIF DYNAMIC_LINK}
  3218. {$IFDEF DYNAMIC_LINK}
  3219. var
  3220.   _PdhEnumMachinesHW: Pointer;
  3221. function PdhEnumMachinesHW;
  3222. begin
  3223.   GetProcedureAddress(_PdhEnumMachinesHW, PdhLib, 'PdhEnumMachinesHW');
  3224.   asm
  3225.     mov esp, ebp
  3226.     pop ebp
  3227.     jmp [_PdhEnumMachinesHW]
  3228.   end;
  3229. end;
  3230. {$ELSE}
  3231. function PdhEnumMachinesHW; external PdhLib name 'PdhEnumMachinesHW';
  3232. {$ENDIF DYNAMIC_LINK}
  3233. {$IFDEF DYNAMIC_LINK}
  3234. var
  3235.   _PdhEnumMachinesHA: Pointer;
  3236. function PdhEnumMachinesHA;
  3237. begin
  3238.   GetProcedureAddress(_PdhEnumMachinesHA, PdhLib, 'PdhEnumMachinesHA');
  3239.   asm
  3240.     mov esp, ebp
  3241.     pop ebp
  3242.     jmp [_PdhEnumMachinesHA]
  3243.   end;
  3244. end;
  3245. {$ELSE}
  3246. function PdhEnumMachinesHA; external PdhLib name 'PdhEnumMachinesHA';
  3247. {$ENDIF DYNAMIC_LINK}
  3248. {$IFDEF UNICODE}
  3249. {$IFDEF DYNAMIC_LINK}
  3250. var
  3251.   _PdhEnumMachinesH: Pointer;
  3252. function PdhEnumMachinesH;
  3253. begin
  3254.   GetProcedureAddress(_PdhEnumMachinesH, PdhLib, 'PdhEnumMachinesHW');
  3255.   asm
  3256.     mov esp, ebp
  3257.     pop ebp
  3258.     jmp [_PdhEnumMachinesH]
  3259.   end;
  3260. end;
  3261. {$ELSE}
  3262. function PdhEnumMachinesH; external PdhLib name 'PdhEnumMachinesHW';
  3263. {$ENDIF DYNAMIC_LINK}
  3264. {$ELSE}
  3265. {$IFDEF DYNAMIC_LINK}
  3266. var
  3267.   _PdhEnumMachinesH: Pointer;
  3268. function PdhEnumMachinesH;
  3269. begin
  3270.   GetProcedureAddress(_PdhEnumMachinesH, PdhLib, 'PdhEnumMachinesHA');
  3271.   asm
  3272.     mov esp, ebp
  3273.     pop ebp
  3274.     jmp [_PdhEnumMachinesH]
  3275.   end;
  3276. end;
  3277. {$ELSE}
  3278. function PdhEnumMachinesH; external PdhLib name 'PdhEnumMachinesHA';
  3279. {$ENDIF DYNAMIC_LINK}
  3280. {$ENDIF}
  3281. {$IFDEF DYNAMIC_LINK}
  3282. var
  3283.   _PdhEnumObjectsHW: Pointer;
  3284. function PdhEnumObjectsHW;
  3285. begin
  3286.   GetProcedureAddress(_PdhEnumObjectsHW, PdhLib, 'PdhEnumObjectsHW');
  3287.   asm
  3288.     mov esp, ebp
  3289.     pop ebp
  3290.     jmp [_PdhEnumObjectsHW]
  3291.   end;
  3292. end;
  3293. {$ELSE}
  3294. function PdhEnumObjectsHW; external PdhLib name 'PdhEnumObjectsHW';
  3295. {$ENDIF DYNAMIC_LINK}
  3296. {$IFDEF DYNAMIC_LINK}
  3297. var
  3298.   _PdhEnumObjectsHA: Pointer;
  3299. function PdhEnumObjectsHA;
  3300. begin
  3301.   GetProcedureAddress(_PdhEnumObjectsHA, PdhLib, 'PdhEnumObjectsHA');
  3302.   asm
  3303.     mov esp, ebp
  3304.     pop ebp
  3305.     jmp [_PdhEnumObjectsHA]
  3306.   end;
  3307. end;
  3308. {$ELSE}
  3309. function PdhEnumObjectsHA; external PdhLib name 'PdhEnumObjectsHA';
  3310. {$ENDIF DYNAMIC_LINK}
  3311. {$IFDEF UNICODE}
  3312. {$IFDEF DYNAMIC_LINK}
  3313. var
  3314.   _PdhEnumObjectsH: Pointer;
  3315. function PdhEnumObjectsH;
  3316. begin
  3317.   GetProcedureAddress(_PdhEnumObjectsH, PdhLib, 'PdhEnumObjectsHW');
  3318.   asm
  3319.     mov esp, ebp
  3320.     pop ebp
  3321.     jmp [_PdhEnumObjectsH]
  3322.   end;
  3323. end;
  3324. {$ELSE}
  3325. function PdhEnumObjectsH; external PdhLib name 'PdhEnumObjectsHW';
  3326. {$ENDIF DYNAMIC_LINK}
  3327. {$ELSE}
  3328. {$IFDEF DYNAMIC_LINK}
  3329. var
  3330.   _PdhEnumObjectsH: Pointer;
  3331. function PdhEnumObjectsH;
  3332. begin
  3333.   GetProcedureAddress(_PdhEnumObjectsH, PdhLib, 'PdhEnumObjectsHA');
  3334.   asm
  3335.     mov esp, ebp
  3336.     pop ebp
  3337.     jmp [_PdhEnumObjectsH]
  3338.   end;
  3339. end;
  3340. {$ELSE}
  3341. function PdhEnumObjectsH; external PdhLib name 'PdhEnumObjectsHA';
  3342. {$ENDIF DYNAMIC_LINK}
  3343. {$ENDIF}
  3344. {$IFDEF DYNAMIC_LINK}
  3345. var
  3346.   _PdhEnumObjectItemsHW: Pointer;
  3347. function PdhEnumObjectItemsHW;
  3348. begin
  3349.   GetProcedureAddress(_PdhEnumObjectItemsHW, PdhLib, 'PdhEnumObjectItemsHW');
  3350.   asm
  3351.     mov esp, ebp
  3352.     pop ebp
  3353.     jmp [_PdhEnumObjectItemsHW]
  3354.   end;
  3355. end;
  3356. {$ELSE}
  3357. function PdhEnumObjectItemsHW; external PdhLib name 'PdhEnumObjectItemsHW';
  3358. {$ENDIF DYNAMIC_LINK}
  3359. {$IFDEF DYNAMIC_LINK}
  3360. var
  3361.   _PdhEnumObjectItemsHA: Pointer;
  3362. function PdhEnumObjectItemsHA;
  3363. begin
  3364.   GetProcedureAddress(_PdhEnumObjectItemsHA, PdhLib, 'PdhEnumObjectItemsHA');
  3365.   asm
  3366.     mov esp, ebp
  3367.     pop ebp
  3368.     jmp [_PdhEnumObjectItemsHA]
  3369.   end;
  3370. end;
  3371. {$ELSE}
  3372. function PdhEnumObjectItemsHA; external PdhLib name 'PdhEnumObjectItemsHA';
  3373. {$ENDIF DYNAMIC_LINK}
  3374. {$IFDEF UNICODE}
  3375. {$IFDEF DYNAMIC_LINK}
  3376. var
  3377.   _PdhEnumObjectItemsH: Pointer;
  3378. function PdhEnumObjectItemsH;
  3379. begin
  3380.   GetProcedureAddress(_PdhEnumObjectItemsH, PdhLib, 'PdhEnumObjectItemsHW');
  3381.   asm
  3382.     mov esp, ebp
  3383.     pop ebp
  3384.     jmp [_PdhEnumObjectItemsH]
  3385.   end;
  3386. end;
  3387. {$ELSE}
  3388. function PdhEnumObjectItemsH; external PdhLib name 'PdhEnumObjectItemsHW';
  3389. {$ENDIF DYNAMIC_LINK}
  3390. {$ELSE}
  3391. {$IFDEF DYNAMIC_LINK}
  3392. var
  3393.   _PdhEnumObjectItemsH: Pointer;
  3394. function PdhEnumObjectItemsH;
  3395. begin
  3396.   GetProcedureAddress(_PdhEnumObjectItemsH, PdhLib, 'PdhEnumObjectItemsHA');
  3397.   asm
  3398.     mov esp, ebp
  3399.     pop ebp
  3400.     jmp [_PdhEnumObjectItemsH]
  3401.   end;
  3402. end;
  3403. {$ELSE}
  3404. function PdhEnumObjectItemsH; external PdhLib name 'PdhEnumObjectItemsHA';
  3405. {$ENDIF DYNAMIC_LINK}
  3406. {$ENDIF}
  3407. {$IFDEF DYNAMIC_LINK}
  3408. var
  3409.   _PdhExpandWildCardPathHW: Pointer;
  3410. function PdhExpandWildCardPathHW;
  3411. begin
  3412.   GetProcedureAddress(_PdhExpandWildCardPathHW, PdhLib, 'PdhExpandWildCardPathHW');
  3413.   asm
  3414.     mov esp, ebp
  3415.     pop ebp
  3416.     jmp [_PdhExpandWildCardPathHW]
  3417.   end;
  3418. end;
  3419. {$ELSE}
  3420. function PdhExpandWildCardPathHW; external PdhLib name 'PdhExpandWildCardPathHW';
  3421. {$ENDIF DYNAMIC_LINK}
  3422. {$IFDEF DYNAMIC_LINK}
  3423. var
  3424.   _PdhExpandWildCardPathHA: Pointer;
  3425. function PdhExpandWildCardPathHA;
  3426. begin
  3427.   GetProcedureAddress(_PdhExpandWildCardPathHA, PdhLib, 'PdhExpandWildCardPathHA');
  3428.   asm
  3429.     mov esp, ebp
  3430.     pop ebp
  3431.     jmp [_PdhExpandWildCardPathHA]
  3432.   end;
  3433. end;
  3434. {$ELSE}
  3435. function PdhExpandWildCardPathHA; external PdhLib name 'PdhExpandWildCardPathHA';
  3436. {$ENDIF DYNAMIC_LINK}
  3437. {$IFDEF UNICODE}
  3438. {$IFDEF DYNAMIC_LINK}
  3439. var
  3440.   _PdhExpandWildCardPathH: Pointer;
  3441. function PdhExpandWildCardPathH;
  3442. begin
  3443.   GetProcedureAddress(_PdhExpandWildCardPathH, PdhLib, 'PdhExpandWildCardPathHW');
  3444.   asm
  3445.     mov esp, ebp
  3446.     pop ebp
  3447.     jmp [_PdhExpandWildCardPathH]
  3448.   end;
  3449. end;
  3450. {$ELSE}
  3451. function PdhExpandWildCardPathH; external PdhLib name 'PdhExpandWildCardPathHW';
  3452. {$ENDIF DYNAMIC_LINK}
  3453. {$ELSE}
  3454. {$IFDEF DYNAMIC_LINK}
  3455. var
  3456.   _PdhExpandWildCardPathH: Pointer;
  3457. function PdhExpandWildCardPathH;
  3458. begin
  3459.   GetProcedureAddress(_PdhExpandWildCardPathH, PdhLib, 'PdhExpandWildCardPathHA');
  3460.   asm
  3461.     mov esp, ebp
  3462.     pop ebp
  3463.     jmp [_PdhExpandWildCardPathH]
  3464.   end;
  3465. end;
  3466. {$ELSE}
  3467. function PdhExpandWildCardPathH; external PdhLib name 'PdhExpandWildCardPathHA';
  3468. {$ENDIF DYNAMIC_LINK}
  3469. {$ENDIF}
  3470. {$IFDEF DYNAMIC_LINK}
  3471. var
  3472.   _PdhGetDataSourceTimeRangeH: Pointer;
  3473. function PdhGetDataSourceTimeRangeH;
  3474. begin
  3475.   GetProcedureAddress(_PdhGetDataSourceTimeRangeH, PdhLib, 'PdhGetDataSourceTimeRangeH');
  3476.   asm
  3477.     mov esp, ebp
  3478.     pop ebp
  3479.     jmp [_PdhGetDataSourceTimeRangeH]
  3480.   end;
  3481. end;
  3482. {$ELSE}
  3483. function PdhGetDataSourceTimeRangeH; external PdhLib name 'PdhGetDataSourceTimeRangeH';
  3484. {$ENDIF DYNAMIC_LINK}
  3485. {$IFDEF DYNAMIC_LINK}
  3486. var
  3487.   _PdhGetDefaultPerfObjectHW: Pointer;
  3488. function PdhGetDefaultPerfObjectHW;
  3489. begin
  3490.   GetProcedureAddress(_PdhGetDefaultPerfObjectHW, PdhLib, 'PdhGetDefaultPerfObjectHW');
  3491.   asm
  3492.     mov esp, ebp
  3493.     pop ebp
  3494.     jmp [_PdhGetDefaultPerfObjectHW]
  3495.   end;
  3496. end;
  3497. {$ELSE}
  3498. function PdhGetDefaultPerfObjectHW; external PdhLib name 'PdhGetDefaultPerfObjectHW';
  3499. {$ENDIF DYNAMIC_LINK}
  3500. {$IFDEF DYNAMIC_LINK}
  3501. var
  3502.   _PdhGetDefaultPerfObjectHA: Pointer;
  3503. function PdhGetDefaultPerfObjectHA;
  3504. begin
  3505.   GetProcedureAddress(_PdhGetDefaultPerfObjectHA, PdhLib, 'PdhGetDefaultPerfObjectHA');
  3506.   asm
  3507.     mov esp, ebp
  3508.     pop ebp
  3509.     jmp [_PdhGetDefaultPerfObjectHA]
  3510.   end;
  3511. end;
  3512. {$ELSE}
  3513. function PdhGetDefaultPerfObjectHA; external PdhLib name 'PdhGetDefaultPerfObjectHA';
  3514. {$ENDIF DYNAMIC_LINK}
  3515. {$IFDEF UNICODE}
  3516. {$IFDEF DYNAMIC_LINK}
  3517. var
  3518.   _PdhGetDefaultPerfObjectH: Pointer;
  3519. function PdhGetDefaultPerfObjectH;
  3520. begin
  3521.   GetProcedureAddress(_PdhGetDefaultPerfObjectH, PdhLib, 'PdhGetDefaultPerfObjectHW');
  3522.   asm
  3523.     mov esp, ebp
  3524.     pop ebp
  3525.     jmp [_PdhGetDefaultPerfObjectH]
  3526.   end;
  3527. end;
  3528. {$ELSE}
  3529. function PdhGetDefaultPerfObjectH; external PdhLib name 'PdhGetDefaultPerfObjectHW';
  3530. {$ENDIF DYNAMIC_LINK}
  3531. {$ELSE}
  3532. {$IFDEF DYNAMIC_LINK}
  3533. var
  3534.   _PdhGetDefaultPerfObjectH: Pointer;
  3535. function PdhGetDefaultPerfObjectH;
  3536. begin
  3537.   GetProcedureAddress(_PdhGetDefaultPerfObjectH, PdhLib, 'PdhGetDefaultPerfObjectHA');
  3538.   asm
  3539.     mov esp, ebp
  3540.     pop ebp
  3541.     jmp [_PdhGetDefaultPerfObjectH]
  3542.   end;
  3543. end;
  3544. {$ELSE}
  3545. function PdhGetDefaultPerfObjectH; external PdhLib name 'PdhGetDefaultPerfObjectHA';
  3546. {$ENDIF DYNAMIC_LINK}
  3547. {$ENDIF}
  3548. {$IFDEF DYNAMIC_LINK}
  3549. var
  3550.   _PdhGetDefaultPerfCounterHW: Pointer;
  3551. function PdhGetDefaultPerfCounterHW;
  3552. begin
  3553.   GetProcedureAddress(_PdhGetDefaultPerfCounterHW, PdhLib, 'PdhGetDefaultPerfCounterHW');
  3554.   asm
  3555.     mov esp, ebp
  3556.     pop ebp
  3557.     jmp [_PdhGetDefaultPerfCounterHW]
  3558.   end;
  3559. end;
  3560. {$ELSE}
  3561. function PdhGetDefaultPerfCounterHW; external PdhLib name 'PdhGetDefaultPerfCounterHW';
  3562. {$ENDIF DYNAMIC_LINK}
  3563. {$IFDEF DYNAMIC_LINK}
  3564. var
  3565.   _PdhGetDefaultPerfCounterHA: Pointer;
  3566. function PdhGetDefaultPerfCounterHA;
  3567. begin
  3568.   GetProcedureAddress(_PdhGetDefaultPerfCounterHA, PdhLib, 'PdhGetDefaultPerfCounterHA');
  3569.   asm
  3570.     mov esp, ebp
  3571.     pop ebp
  3572.     jmp [_PdhGetDefaultPerfCounterHA]
  3573.   end;
  3574. end;
  3575. {$ELSE}
  3576. function PdhGetDefaultPerfCounterHA; external PdhLib name 'PdhGetDefaultPerfCounterHA';
  3577. {$ENDIF DYNAMIC_LINK}
  3578. {$IFDEF UNICODE}
  3579. {$IFDEF DYNAMIC_LINK}
  3580. var
  3581.   _PdhGetDefaultPerfCounterH: Pointer;
  3582. function PdhGetDefaultPerfCounterH;
  3583. begin
  3584.   GetProcedureAddress(_PdhGetDefaultPerfCounterH, PdhLib, 'PdhGetDefaultPerfCounterHW');
  3585.   asm
  3586.     mov esp, ebp
  3587.     pop ebp
  3588.     jmp [_PdhGetDefaultPerfCounterH]
  3589.   end;
  3590. end;
  3591. {$ELSE}
  3592. function PdhGetDefaultPerfCounterH; external PdhLib name 'PdhGetDefaultPerfCounterHW';
  3593. {$ENDIF DYNAMIC_LINK}
  3594. {$ELSE}
  3595. {$IFDEF DYNAMIC_LINK}
  3596. var
  3597.   _PdhGetDefaultPerfCounterH: Pointer;
  3598. function PdhGetDefaultPerfCounterH;
  3599. begin
  3600.   GetProcedureAddress(_PdhGetDefaultPerfCounterH, PdhLib, 'PdhGetDefaultPerfCounterHA');
  3601.   asm
  3602.     mov esp, ebp
  3603.     pop ebp
  3604.     jmp [_PdhGetDefaultPerfCounterH]
  3605.   end;
  3606. end;
  3607. {$ELSE}
  3608. function PdhGetDefaultPerfCounterH; external PdhLib name 'PdhGetDefaultPerfCounterHA';
  3609. {$ENDIF DYNAMIC_LINK}
  3610. {$ENDIF}
  3611. {$IFDEF DYNAMIC_LINK}
  3612. var
  3613.   _PdhBrowseCountersHW: Pointer;
  3614. function PdhBrowseCountersHW;
  3615. begin
  3616.   GetProcedureAddress(_PdhBrowseCountersHW, PdhLib, 'PdhBrowseCountersHW');
  3617.   asm
  3618.     mov esp, ebp
  3619.     pop ebp
  3620.     jmp [_PdhBrowseCountersHW]
  3621.   end;
  3622. end;
  3623. {$ELSE}
  3624. function PdhBrowseCountersHW; external PdhLib name 'PdhBrowseCountersHW';
  3625. {$ENDIF DYNAMIC_LINK}
  3626. {$IFDEF DYNAMIC_LINK}
  3627. var
  3628.   _PdhBrowseCountersHA: Pointer;
  3629. function PdhBrowseCountersHA;
  3630. begin
  3631.   GetProcedureAddress(_PdhBrowseCountersHA, PdhLib, 'PdhBrowseCountersHA');
  3632.   asm
  3633.     mov esp, ebp
  3634.     pop ebp
  3635.     jmp [_PdhBrowseCountersHA]
  3636.   end;
  3637. end;
  3638. {$ELSE}
  3639. function PdhBrowseCountersHA; external PdhLib name 'PdhBrowseCountersHA';
  3640. {$ENDIF DYNAMIC_LINK}
  3641. {$IFDEF UNICODE}
  3642. {$IFDEF DYNAMIC_LINK}
  3643. var
  3644.   _PdhBrowseCountersH: Pointer;
  3645. function PdhBrowseCountersH;
  3646. begin
  3647.   GetProcedureAddress(_PdhBrowseCountersH, PdhLib, 'PdhBrowseCountersHW');
  3648.   asm
  3649.     mov esp, ebp
  3650.     pop ebp
  3651.     jmp [_PdhBrowseCountersH]
  3652.   end;
  3653. end;
  3654. {$ELSE}
  3655. function PdhBrowseCountersH; external PdhLib name 'PdhBrowseCountersHW';
  3656. {$ENDIF DYNAMIC_LINK}
  3657. {$ELSE}
  3658. {$IFDEF DYNAMIC_LINK}
  3659. var
  3660.   _PdhBrowseCountersH: Pointer;
  3661. function PdhBrowseCountersH;
  3662. begin
  3663.   GetProcedureAddress(_PdhBrowseCountersH, PdhLib, 'PdhBrowseCountersHA');
  3664.   asm
  3665.     mov esp, ebp
  3666.     pop ebp
  3667.     jmp [_PdhBrowseCountersH]
  3668.   end;
  3669. end;
  3670. {$ELSE}
  3671. function PdhBrowseCountersH; external PdhLib name 'PdhBrowseCountersHA';
  3672. {$ENDIF DYNAMIC_LINK}
  3673. {$ENDIF}
  3674. {$IFDEF DYNAMIC_LINK}
  3675. var
  3676.   _PdhVerifySQLDBW: Pointer;
  3677. function PdhVerifySQLDBW;
  3678. begin
  3679.   GetProcedureAddress(_PdhVerifySQLDBW, PdhLib, 'PdhVerifySQLDBW');
  3680.   asm
  3681.     mov esp, ebp
  3682.     pop ebp
  3683.     jmp [_PdhVerifySQLDBW]
  3684.   end;
  3685. end;
  3686. {$ELSE}
  3687. function PdhVerifySQLDBW; external PdhLib name 'PdhVerifySQLDBW';
  3688. {$ENDIF DYNAMIC_LINK}
  3689. {$IFDEF DYNAMIC_LINK}
  3690. var
  3691.   _PdhVerifySQLDBA: Pointer;
  3692. function PdhVerifySQLDBA;
  3693. begin
  3694.   GetProcedureAddress(_PdhVerifySQLDBA, PdhLib, 'PdhVerifySQLDBA');
  3695.   asm
  3696.     mov esp, ebp
  3697.     pop ebp
  3698.     jmp [_PdhVerifySQLDBA]
  3699.   end;
  3700. end;
  3701. {$ELSE}
  3702. function PdhVerifySQLDBA; external PdhLib name 'PdhVerifySQLDBA';
  3703. {$ENDIF DYNAMIC_LINK}
  3704. {$IFDEF UNICODE}
  3705. {$IFDEF DYNAMIC_LINK}
  3706. var
  3707.   _PdhVerifySQLDB: Pointer;
  3708. function PdhVerifySQLDB;
  3709. begin
  3710.   GetProcedureAddress(_PdhVerifySQLDB, PdhLib, 'PdhVerifySQLDBW');
  3711.   asm
  3712.     mov esp, ebp
  3713.     pop ebp
  3714.     jmp [_PdhVerifySQLDB]
  3715.   end;
  3716. end;
  3717. {$ELSE}
  3718. function PdhVerifySQLDB; external PdhLib name 'PdhVerifySQLDBW';
  3719. {$ENDIF DYNAMIC_LINK}
  3720. {$ELSE}
  3721. {$IFDEF DYNAMIC_LINK}
  3722. var
  3723.   _PdhVerifySQLDB: Pointer;
  3724. function PdhVerifySQLDB;
  3725. begin
  3726.   GetProcedureAddress(_PdhVerifySQLDB, PdhLib, 'PdhVerifySQLDBA');
  3727.   asm
  3728.     mov esp, ebp
  3729.     pop ebp
  3730.     jmp [_PdhVerifySQLDB]
  3731.   end;
  3732. end;
  3733. {$ELSE}
  3734. function PdhVerifySQLDB; external PdhLib name 'PdhVerifySQLDBA';
  3735. {$ENDIF DYNAMIC_LINK}
  3736. {$ENDIF}
  3737. {$IFDEF DYNAMIC_LINK}
  3738. var
  3739.   _PdhCreateSQLTablesW: Pointer;
  3740. function PdhCreateSQLTablesW;
  3741. begin
  3742.   GetProcedureAddress(_PdhCreateSQLTablesW, PdhLib, 'PdhCreateSQLTablesW');
  3743.   asm
  3744.     mov esp, ebp
  3745.     pop ebp
  3746.     jmp [_PdhCreateSQLTablesW]
  3747.   end;
  3748. end;
  3749. {$ELSE}
  3750. function PdhCreateSQLTablesW; external PdhLib name 'PdhCreateSQLTablesW';
  3751. {$ENDIF DYNAMIC_LINK}
  3752. {$IFDEF DYNAMIC_LINK}
  3753. var
  3754.   _PdhCreateSQLTablesA: Pointer;
  3755. function PdhCreateSQLTablesA;
  3756. begin
  3757.   GetProcedureAddress(_PdhCreateSQLTablesA, PdhLib, 'PdhCreateSQLTablesA');
  3758.   asm
  3759.     mov esp, ebp
  3760.     pop ebp
  3761.     jmp [_PdhCreateSQLTablesA]
  3762.   end;
  3763. end;
  3764. {$ELSE}
  3765. function PdhCreateSQLTablesA; external PdhLib name 'PdhCreateSQLTablesA';
  3766. {$ENDIF DYNAMIC_LINK}
  3767. {$IFDEF UNICODE}
  3768. {$IFDEF DYNAMIC_LINK}
  3769. var
  3770.   _PdhCreateSQLTables: Pointer;
  3771. function PdhCreateSQLTables;
  3772. begin
  3773.   GetProcedureAddress(_PdhCreateSQLTables, PdhLib, 'PdhCreateSQLTablesW');
  3774.   asm
  3775.     mov esp, ebp
  3776.     pop ebp
  3777.     jmp [_PdhCreateSQLTables]
  3778.   end;
  3779. end;
  3780. {$ELSE}
  3781. function PdhCreateSQLTables; external PdhLib name 'PdhCreateSQLTablesW';
  3782. {$ENDIF DYNAMIC_LINK}
  3783. {$ELSE}
  3784. {$IFDEF DYNAMIC_LINK}
  3785. var
  3786.   _PdhCreateSQLTables: Pointer;
  3787. function PdhCreateSQLTables;
  3788. begin
  3789.   GetProcedureAddress(_PdhCreateSQLTables, PdhLib, 'PdhCreateSQLTablesA');
  3790.   asm
  3791.     mov esp, ebp
  3792.     pop ebp
  3793.     jmp [_PdhCreateSQLTables]
  3794.   end;
  3795. end;
  3796. {$ELSE}
  3797. function PdhCreateSQLTables; external PdhLib name 'PdhCreateSQLTablesA';
  3798. {$ENDIF DYNAMIC_LINK}
  3799. {$ENDIF}
  3800. {$IFDEF DYNAMIC_LINK}
  3801. var
  3802.   _PdhEnumLogSetNamesW: Pointer;
  3803. function PdhEnumLogSetNamesW;
  3804. begin
  3805.   GetProcedureAddress(_PdhEnumLogSetNamesW, PdhLib, 'PdhEnumLogSetNamesW');
  3806.   asm
  3807.     mov esp, ebp
  3808.     pop ebp
  3809.     jmp [_PdhEnumLogSetNamesW]
  3810.   end;
  3811. end;
  3812. {$ELSE}
  3813. function PdhEnumLogSetNamesW; external PdhLib name 'PdhEnumLogSetNamesW';
  3814. {$ENDIF DYNAMIC_LINK}
  3815. {$IFDEF DYNAMIC_LINK}
  3816. var
  3817.   _PdhEnumLogSetNamesA: Pointer;
  3818. function PdhEnumLogSetNamesA;
  3819. begin
  3820.   GetProcedureAddress(_PdhEnumLogSetNamesA, PdhLib, 'PdhEnumLogSetNamesA');
  3821.   asm
  3822.     mov esp, ebp
  3823.     pop ebp
  3824.     jmp [_PdhEnumLogSetNamesA]
  3825.   end;
  3826. end;
  3827. {$ELSE}
  3828. function PdhEnumLogSetNamesA; external PdhLib name 'PdhEnumLogSetNamesA';
  3829. {$ENDIF DYNAMIC_LINK}
  3830. {$IFDEF UNICODE}
  3831. {$IFDEF DYNAMIC_LINK}
  3832. var
  3833.   _PdhEnumLogSetNames: Pointer;
  3834. function PdhEnumLogSetNames;
  3835. begin
  3836.   GetProcedureAddress(_PdhEnumLogSetNames, PdhLib, 'PdhEnumLogSetNamesW');
  3837.   asm
  3838.     mov esp, ebp
  3839.     pop ebp
  3840.     jmp [_PdhEnumLogSetNames]
  3841.   end;
  3842. end;
  3843. {$ELSE}
  3844. function PdhEnumLogSetNames; external PdhLib name 'PdhEnumLogSetNamesW';
  3845. {$ENDIF DYNAMIC_LINK}
  3846. {$ELSE}
  3847. {$IFDEF DYNAMIC_LINK}
  3848. var
  3849.   _PdhEnumLogSetNames: Pointer;
  3850. function PdhEnumLogSetNames;
  3851. begin
  3852.   GetProcedureAddress(_PdhEnumLogSetNames, PdhLib, 'PdhEnumLogSetNamesA');
  3853.   asm
  3854.     mov esp, ebp
  3855.     pop ebp
  3856.     jmp [_PdhEnumLogSetNames]
  3857.   end;
  3858. end;
  3859. {$ELSE}
  3860. function PdhEnumLogSetNames; external PdhLib name 'PdhEnumLogSetNamesA';
  3861. {$ENDIF DYNAMIC_LINK}
  3862. {$ENDIF}
  3863. {$IFDEF DYNAMIC_LINK}
  3864. var
  3865.   _PdhGetLogSetGUID: Pointer;
  3866. function PdhGetLogSetGUID;
  3867. begin
  3868.   GetProcedureAddress(_PdhGetLogSetGUID, PdhLib, 'PdhGetLogSetGUID');
  3869.   asm
  3870.     mov esp, ebp
  3871.     pop ebp
  3872.     jmp [_PdhGetLogSetGUID]
  3873.   end;
  3874. end;
  3875. {$ELSE}
  3876. function PdhGetLogSetGUID; external PdhLib name 'PdhGetLogSetGUID';
  3877. {$ENDIF DYNAMIC_LINK}
  3878. {$IFDEF DYNAMIC_LINK}
  3879. var
  3880.   _PdhSetLogSetRunID: Pointer;
  3881. function PdhSetLogSetRunID;
  3882. begin
  3883.   GetProcedureAddress(_PdhSetLogSetRunID, PdhLib, 'PdhSetLogSetRunID');
  3884.   asm
  3885.     mov esp, ebp
  3886.     pop ebp
  3887.     jmp [_PdhSetLogSetRunID]
  3888.   end;
  3889. end;
  3890. {$ELSE}
  3891. function PdhSetLogSetRunID; external PdhLib name 'PdhSetLogSetRunID';
  3892. {$ENDIF DYNAMIC_LINK}
  3893. end.