jwalmstats.pas 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. {******************************************************************************}
  2. { }
  3. { Lan Manager Statistics 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: lmstats.h, released November 2001. The original Pascal }
  9. { code is: LmStats.pas, released Februari 2002. The initial developer of the }
  10. { Pascal code is Marcel van Brakel (brakelm att chello dott 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 }
  18. { APILIB home page, located at http://jedi-apilib.sourceforge.net }
  19. { }
  20. { The contents of this file are used with permission, subject to the Mozilla }
  21. { Public License Version 1.1 (the "License"); you may not use this file except }
  22. { in compliance with the License. You may obtain a copy of the License at }
  23. { http://www.mozilla.org/MPL/MPL-1.1.html }
  24. { }
  25. { Software distributed under the License is distributed on an "AS IS" basis, }
  26. { WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
  27. { the specific language governing rights and limitations under the License. }
  28. { }
  29. { Alternatively, the contents of this file may be used under the terms of the }
  30. { GNU Lesser General Public License (the "LGPL License"), in which case the }
  31. { provisions of the LGPL License are applicable instead of those above. }
  32. { If you wish to allow use of your version of this file only under the terms }
  33. { of the LGPL License and not to allow others to use your version of this file }
  34. { under the MPL, indicate your decision by deleting the provisions above and }
  35. { replace them with the notice and other provisions required by the LGPL }
  36. { License. If you do not delete the provisions above, a recipient may use }
  37. { your version of this file under either the MPL or the LGPL License. }
  38. { }
  39. { For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
  40. { }
  41. {******************************************************************************}
  42. unit JwaLmStats;
  43. {$WEAKPACKAGEUNIT}
  44. {$HPPEMIT ''}
  45. {$HPPEMIT '#include "lmstats.h"'}
  46. {$HPPEMIT ''}
  47. {$I jediapilib.inc}
  48. interface
  49. uses
  50. JwaLmCons, JwaWinType;
  51. //
  52. // Function Prototypes - Statistics
  53. //
  54. function NetStatisticsGet(server: LMSTR; service: LMSTR; level: DWORD; options: DWORD; var bufptr: LPBYTE): NET_API_STATUS; stdcall;
  55. {$EXTERNALSYM NetStatisticsGet}
  56. //
  57. // Data Structures - Statistics
  58. //
  59. {$IFDEF LM20_WORKSTATION_STATISTICS}
  60. type
  61. _STAT_WORKSTATION_0 = record
  62. stw0_start: DWORD;
  63. stw0_numNCB_r: DWORD;
  64. stw0_numNCB_s: DWORD;
  65. stw0_numNCB_a: DWORD;
  66. stw0_fiNCB_r: DWORD;
  67. stw0_fiNCB_s: DWORD;
  68. stw0_fiNCB_a: DWORD;
  69. stw0_fcNCB_r: DWORD;
  70. stw0_fcNCB_s: DWORD;
  71. stw0_fcNCB_a: DWORD;
  72. stw0_sesstart: DWORD;
  73. stw0_sessfailcon: DWORD;
  74. stw0_sessbroke: DWORD;
  75. stw0_uses: DWORD;
  76. stw0_usefail: DWORD;
  77. stw0_autorec: DWORD;
  78. stw0_bytessent_r_lo: DWORD;
  79. stw0_bytessent_r_hi: DWORD;
  80. stw0_bytesrcvd_r_lo: DWORD;
  81. stw0_bytesrcvd_r_hi: DWORD;
  82. stw0_bytessent_s_lo: DWORD;
  83. stw0_bytessent_s_hi: DWORD;
  84. stw0_bytesrcvd_s_lo: DWORD;
  85. stw0_bytesrcvd_s_hi: DWORD;
  86. stw0_bytessent_a_lo: DWORD;
  87. stw0_bytessent_a_hi: DWORD;
  88. stw0_bytesrcvd_a_lo: DWORD;
  89. stw0_bytesrcvd_a_hi: DWORD;
  90. stw0_reqbufneed: DWORD;
  91. stw0_bigbufneed: DWORD;
  92. end;
  93. {$EXTERNALSYM _STAT_WORKSTATION_0}
  94. STAT_WORKSTATION_0 = _STAT_WORKSTATION_0;
  95. {$EXTERNALSYM STAT_WORKSTATION_0}
  96. PSTAT_WORKSTATION_0 = ^STAT_WORKSTATION_0;
  97. {$EXTERNALSYM PSTAT_WORKSTATION_0}
  98. LPSTAT_WORKSTATION_0 = ^STAT_WORKSTATION_0;
  99. {$EXTERNALSYM LPSTAT_WORKSTATION_0}
  100. TStatWorkstation0 = STAT_WORKSTATION_0;
  101. PStatWorkstation0 = PSTAT_WORKSTATION_0;
  102. {$ELSE}
  103. //
  104. // NB: The following structure is REDIR_STATISTICS in sdk\inc\ntddnfs.h. If you
  105. // change the structure, change it in both places
  106. //
  107. type
  108. _STAT_WORKSTATION_0 = record
  109. StatisticsStartTime: LARGE_INTEGER;
  110. BytesReceived: LARGE_INTEGER;
  111. SmbsReceived: LARGE_INTEGER;
  112. PagingReadBytesRequested: LARGE_INTEGER;
  113. NonPagingReadBytesRequested: LARGE_INTEGER;
  114. CacheReadBytesRequested: LARGE_INTEGER;
  115. NetworkReadBytesRequested: LARGE_INTEGER;
  116. BytesTransmitted: LARGE_INTEGER;
  117. SmbsTransmitted: LARGE_INTEGER;
  118. PagingWriteBytesRequested: LARGE_INTEGER;
  119. NonPagingWriteBytesRequested: LARGE_INTEGER;
  120. CacheWriteBytesRequested: LARGE_INTEGER;
  121. NetworkWriteBytesRequested: LARGE_INTEGER;
  122. InitiallyFailedOperations: DWORD;
  123. FailedCompletionOperations: DWORD;
  124. ReadOperations: DWORD;
  125. RandomReadOperations: DWORD;
  126. ReadSmbs: DWORD;
  127. LargeReadSmbs: DWORD;
  128. SmallReadSmbs: DWORD;
  129. WriteOperations: DWORD;
  130. RandomWriteOperations: DWORD;
  131. WriteSmbs: DWORD;
  132. LargeWriteSmbs: DWORD;
  133. SmallWriteSmbs: DWORD;
  134. RawReadsDenied: DWORD;
  135. RawWritesDenied: DWORD;
  136. NetworkErrors: DWORD;
  137. // Connection/Session counts
  138. Sessions: DWORD;
  139. FailedSessions: DWORD;
  140. Reconnects: DWORD;
  141. CoreConnects: DWORD;
  142. Lanman20Connects: DWORD;
  143. Lanman21Connects: DWORD;
  144. LanmanNtConnects: DWORD;
  145. ServerDisconnects: DWORD;
  146. HungSessions: DWORD;
  147. UseCount: DWORD;
  148. FailedUseCount: DWORD;
  149. //
  150. // Queue Lengths (updates protected by RdrMpxTableSpinLock NOT
  151. // RdrStatisticsSpinlock)
  152. //
  153. CurrentCommands: DWORD;
  154. end;
  155. {$EXTERNALSYM _STAT_WORKSTATION_0}
  156. STAT_WORKSTATION_0 = _STAT_WORKSTATION_0;
  157. {$EXTERNALSYM STAT_WORKSTATION_0}
  158. PSTAT_WORKSTATION_0 = ^STAT_WORKSTATION_0;
  159. {$EXTERNALSYM PSTAT_WORKSTATION_0}
  160. LPSTAT_WORKSTATION_0 = ^STAT_WORKSTATION_0;
  161. {$EXTERNALSYM LPSTAT_WORKSTATION_0}
  162. TStatWorkstation0 = STAT_WORKSTATION_0;
  163. PStatWorkstation0 = PSTAT_WORKSTATION_0;
  164. {$ENDIF LM20_WORKSTATION_STATISTICS}
  165. type
  166. _STAT_SERVER_0 = record
  167. sts0_start: DWORD;
  168. sts0_fopens: DWORD;
  169. sts0_devopens: DWORD;
  170. sts0_jobsqueued: DWORD;
  171. sts0_sopens: DWORD;
  172. sts0_stimedout: DWORD;
  173. sts0_serrorout: DWORD;
  174. sts0_pwerrors: DWORD;
  175. sts0_permerrors: DWORD;
  176. sts0_syserrors: DWORD;
  177. sts0_bytessent_low: DWORD;
  178. sts0_bytessent_high: DWORD;
  179. sts0_bytesrcvd_low: DWORD;
  180. sts0_bytesrcvd_high: DWORD;
  181. sts0_avresponse: DWORD;
  182. sts0_reqbufneed: DWORD;
  183. sts0_bigbufneed: DWORD;
  184. end;
  185. {$EXTERNALSYM _STAT_SERVER_0}
  186. STAT_SERVER_0 = _STAT_SERVER_0;
  187. {$EXTERNALSYM STAT_SERVER_0}
  188. PSTAT_SERVER_0 = ^STAT_SERVER_0;
  189. {$EXTERNALSYM PSTAT_SERVER_0}
  190. LPSTAT_SERVER_0 = ^STAT_SERVER_0;
  191. {$EXTERNALSYM LPSTAT_SERVER_0}
  192. TStatServer0 = STAT_SERVER_0;
  193. PStatServer0 = PSTAT_SERVER_0;
  194. //
  195. // Special Values and Constants
  196. //
  197. const
  198. STATSOPT_CLR = 1;
  199. {$EXTERNALSYM STATSOPT_CLR}
  200. STATS_NO_VALUE = ULONG(-1);
  201. {$EXTERNALSYM STATS_NO_VALUE}
  202. STATS_OVERFLOW = ULONG(-2);
  203. {$EXTERNALSYM STATS_OVERFLOW}
  204. implementation
  205. {$IFDEF DYNAMIC_LINK}
  206. var
  207. _NetStatisticsGet: Pointer;
  208. function NetStatisticsGet;
  209. begin
  210. GetProcedureAddress(_NetStatisticsGet, netapi32, 'NetStatisticsGet');
  211. asm
  212. MOV ESP, EBP
  213. POP EBP
  214. JMP [_NetStatisticsGet]
  215. end;
  216. end;
  217. {$ELSE}
  218. function NetStatisticsGet; external netapi32 name 'NetStatisticsGet';
  219. {$ENDIF DYNAMIC_LINK}
  220. end.