jwalmstats.pas 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  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. // $Id: JwaLmStats.pas,v 1.10 2005/09/07 09:54:54 marquardt Exp $
  43. {$IFNDEF JWA_INCLUDEMODE}
  44. unit JwaLmStats;
  45. {$WEAKPACKAGEUNIT}
  46. {$I jediapilib.inc}
  47. interface
  48. uses
  49. JwaWindows, JwaLmCons;
  50. {$ENDIF !JWA_INCLUDEMODE}
  51. {$IFDEF JWA_INTERFACESECTION}
  52. {$HPPEMIT ''}
  53. {$HPPEMIT '#include "lmstats.h"'}
  54. {$HPPEMIT ''}
  55. //
  56. // Function Prototypes - Statistics
  57. //
  58. function NetStatisticsGet(server: LMSTR; service: LMSTR; level: DWORD; options: DWORD; var bufptr: LPBYTE): NET_API_STATUS; stdcall;
  59. {$EXTERNALSYM NetStatisticsGet}
  60. //
  61. // Data Structures - Statistics
  62. //
  63. {$IFDEF LM20_WORKSTATION_STATISTICS}
  64. type
  65. _STAT_WORKSTATION_0 = record
  66. stw0_start: DWORD;
  67. stw0_numNCB_r: DWORD;
  68. stw0_numNCB_s: DWORD;
  69. stw0_numNCB_a: DWORD;
  70. stw0_fiNCB_r: DWORD;
  71. stw0_fiNCB_s: DWORD;
  72. stw0_fiNCB_a: DWORD;
  73. stw0_fcNCB_r: DWORD;
  74. stw0_fcNCB_s: DWORD;
  75. stw0_fcNCB_a: DWORD;
  76. stw0_sesstart: DWORD;
  77. stw0_sessfailcon: DWORD;
  78. stw0_sessbroke: DWORD;
  79. stw0_uses: DWORD;
  80. stw0_usefail: DWORD;
  81. stw0_autorec: DWORD;
  82. stw0_bytessent_r_lo: DWORD;
  83. stw0_bytessent_r_hi: DWORD;
  84. stw0_bytesrcvd_r_lo: DWORD;
  85. stw0_bytesrcvd_r_hi: DWORD;
  86. stw0_bytessent_s_lo: DWORD;
  87. stw0_bytessent_s_hi: DWORD;
  88. stw0_bytesrcvd_s_lo: DWORD;
  89. stw0_bytesrcvd_s_hi: DWORD;
  90. stw0_bytessent_a_lo: DWORD;
  91. stw0_bytessent_a_hi: DWORD;
  92. stw0_bytesrcvd_a_lo: DWORD;
  93. stw0_bytesrcvd_a_hi: DWORD;
  94. stw0_reqbufneed: DWORD;
  95. stw0_bigbufneed: DWORD;
  96. end;
  97. {$EXTERNALSYM _STAT_WORKSTATION_0}
  98. STAT_WORKSTATION_0 = _STAT_WORKSTATION_0;
  99. {$EXTERNALSYM STAT_WORKSTATION_0}
  100. PSTAT_WORKSTATION_0 = ^STAT_WORKSTATION_0;
  101. {$EXTERNALSYM PSTAT_WORKSTATION_0}
  102. LPSTAT_WORKSTATION_0 = ^STAT_WORKSTATION_0;
  103. {$EXTERNALSYM LPSTAT_WORKSTATION_0}
  104. TStatWorkstation0 = STAT_WORKSTATION_0;
  105. PStatWorkstation0 = PSTAT_WORKSTATION_0;
  106. {$ELSE}
  107. //
  108. // NB: The following structure is REDIR_STATISTICS in sdk\inc\ntddnfs.h. If you
  109. // change the structure, change it in both places
  110. //
  111. type
  112. _STAT_WORKSTATION_0 = record
  113. StatisticsStartTime: LARGE_INTEGER;
  114. BytesReceived: LARGE_INTEGER;
  115. SmbsReceived: LARGE_INTEGER;
  116. PagingReadBytesRequested: LARGE_INTEGER;
  117. NonPagingReadBytesRequested: LARGE_INTEGER;
  118. CacheReadBytesRequested: LARGE_INTEGER;
  119. NetworkReadBytesRequested: LARGE_INTEGER;
  120. BytesTransmitted: LARGE_INTEGER;
  121. SmbsTransmitted: LARGE_INTEGER;
  122. PagingWriteBytesRequested: LARGE_INTEGER;
  123. NonPagingWriteBytesRequested: LARGE_INTEGER;
  124. CacheWriteBytesRequested: LARGE_INTEGER;
  125. NetworkWriteBytesRequested: LARGE_INTEGER;
  126. InitiallyFailedOperations: DWORD;
  127. FailedCompletionOperations: DWORD;
  128. ReadOperations: DWORD;
  129. RandomReadOperations: DWORD;
  130. ReadSmbs: DWORD;
  131. LargeReadSmbs: DWORD;
  132. SmallReadSmbs: DWORD;
  133. WriteOperations: DWORD;
  134. RandomWriteOperations: DWORD;
  135. WriteSmbs: DWORD;
  136. LargeWriteSmbs: DWORD;
  137. SmallWriteSmbs: DWORD;
  138. RawReadsDenied: DWORD;
  139. RawWritesDenied: DWORD;
  140. NetworkErrors: DWORD;
  141. // Connection/Session counts
  142. Sessions: DWORD;
  143. FailedSessions: DWORD;
  144. Reconnects: DWORD;
  145. CoreConnects: DWORD;
  146. Lanman20Connects: DWORD;
  147. Lanman21Connects: DWORD;
  148. LanmanNtConnects: DWORD;
  149. ServerDisconnects: DWORD;
  150. HungSessions: DWORD;
  151. UseCount: DWORD;
  152. FailedUseCount: DWORD;
  153. //
  154. // Queue Lengths (updates protected by RdrMpxTableSpinLock NOT
  155. // RdrStatisticsSpinlock)
  156. //
  157. CurrentCommands: DWORD;
  158. end;
  159. {$EXTERNALSYM _STAT_WORKSTATION_0}
  160. STAT_WORKSTATION_0 = _STAT_WORKSTATION_0;
  161. {$EXTERNALSYM STAT_WORKSTATION_0}
  162. PSTAT_WORKSTATION_0 = ^STAT_WORKSTATION_0;
  163. {$EXTERNALSYM PSTAT_WORKSTATION_0}
  164. LPSTAT_WORKSTATION_0 = ^STAT_WORKSTATION_0;
  165. {$EXTERNALSYM LPSTAT_WORKSTATION_0}
  166. TStatWorkstation0 = STAT_WORKSTATION_0;
  167. PStatWorkstation0 = PSTAT_WORKSTATION_0;
  168. {$ENDIF LM20_WORKSTATION_STATISTICS}
  169. type
  170. _STAT_SERVER_0 = record
  171. sts0_start: DWORD;
  172. sts0_fopens: DWORD;
  173. sts0_devopens: DWORD;
  174. sts0_jobsqueued: DWORD;
  175. sts0_sopens: DWORD;
  176. sts0_stimedout: DWORD;
  177. sts0_serrorout: DWORD;
  178. sts0_pwerrors: DWORD;
  179. sts0_permerrors: DWORD;
  180. sts0_syserrors: DWORD;
  181. sts0_bytessent_low: DWORD;
  182. sts0_bytessent_high: DWORD;
  183. sts0_bytesrcvd_low: DWORD;
  184. sts0_bytesrcvd_high: DWORD;
  185. sts0_avresponse: DWORD;
  186. sts0_reqbufneed: DWORD;
  187. sts0_bigbufneed: DWORD;
  188. end;
  189. {$EXTERNALSYM _STAT_SERVER_0}
  190. STAT_SERVER_0 = _STAT_SERVER_0;
  191. {$EXTERNALSYM STAT_SERVER_0}
  192. PSTAT_SERVER_0 = ^STAT_SERVER_0;
  193. {$EXTERNALSYM PSTAT_SERVER_0}
  194. LPSTAT_SERVER_0 = ^STAT_SERVER_0;
  195. {$EXTERNALSYM LPSTAT_SERVER_0}
  196. TStatServer0 = STAT_SERVER_0;
  197. PStatServer0 = PSTAT_SERVER_0;
  198. //
  199. // Special Values and Constants
  200. //
  201. const
  202. STATSOPT_CLR = 1;
  203. {$EXTERNALSYM STATSOPT_CLR}
  204. STATS_NO_VALUE = ULONG(-1);
  205. {$EXTERNALSYM STATS_NO_VALUE}
  206. STATS_OVERFLOW = ULONG(-2);
  207. {$EXTERNALSYM STATS_OVERFLOW}
  208. {$ENDIF JWA_INTERFACESECTION}
  209. {$IFNDEF JWA_INCLUDEMODE}
  210. implementation
  211. uses
  212. JwaWinDLLNames;
  213. {$ENDIF !JWA_INCLUDEMODE}
  214. {$IFDEF JWA_IMPLEMENTATIONSECTION}
  215. {$IFDEF DYNAMIC_LINK}
  216. var
  217. _NetStatisticsGet: Pointer;
  218. function NetStatisticsGet;
  219. begin
  220. GetProcedureAddress(_NetStatisticsGet, netapi32, 'NetStatisticsGet');
  221. asm
  222. MOV ESP, EBP
  223. POP EBP
  224. JMP [_NetStatisticsGet]
  225. end;
  226. end;
  227. {$ELSE}
  228. function NetStatisticsGet; external netapi32 name 'NetStatisticsGet';
  229. {$ENDIF DYNAMIC_LINK}
  230. {$ENDIF JWA_IMPLEMENTATIONSECTION}
  231. {$IFNDEF JWA_INCLUDEMODE}
  232. end.
  233. {$ENDIF !JWA_INCLUDEMODE}