Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

348 lines
14 KiB

  1. //#pragma title ("SDStat.hpp -- Statistical information for SDResolve")
  2. /*
  3. Copyright (c) 1995-1998, Mission Critical Software, Inc. All rights reserved.
  4. ===============================================================================
  5. Module - sdstat.hpp
  6. System - SDResolve
  7. Author - Christy Boles
  8. Created - 97/06/27
  9. Description - Statistical information for SDResolve
  10. Updates -
  11. ===============================================================================
  12. */
  13. #ifndef SDSTAT_HEADER
  14. #define SDSTAT_HEADER
  15. #include "stdafx.h"
  16. //#import "\bin\McsVarSetMin.tlb" no_namespace
  17. #import "VarSet.tlb" no_namespace rename("property", "aproperty")
  18. #include "ResStr.h"
  19. #ifndef TNODEINCLUDED
  20. #include "Tnode.hpp"
  21. #define TNODEINCLUDED
  22. #endif
  23. class TSidCache;
  24. class TSDRidCache;
  25. class TPathList;
  26. class TSecurableObject;
  27. class TAcctNode;
  28. enum objectType { file = 1,directory,share,mailbox,container,groupmember, userright, regkey, printer };
  29. typedef DWORD StatCell ;
  30. struct TSDFileDirCell
  31. {
  32. StatCell file;
  33. StatCell dir;
  34. StatCell share;
  35. StatCell mailbox;
  36. StatCell container;
  37. StatCell member;
  38. StatCell userright;
  39. StatCell regkey;
  40. StatCell printer;
  41. };
  42. struct TSDFileActions
  43. {
  44. TSDFileDirCell examined;
  45. TSDFileDirCell changed;
  46. TSDFileDirCell skipped;
  47. TSDFileDirCell error;
  48. TSDFileDirCell cachehit;
  49. };
  50. struct TSDPartActions
  51. {
  52. StatCell examined;
  53. StatCell changed;
  54. StatCell notselected;
  55. StatCell unknown;
  56. StatCell notarget;
  57. };
  58. struct TSDPartStats
  59. {
  60. TSDPartActions owner;
  61. TSDPartActions group;
  62. TSDPartActions dacl;
  63. TSDPartActions sacl;
  64. TSDPartActions dace;
  65. TSDPartActions sace;
  66. };
  67. #define FILE_ROW 1
  68. #define DIR_ROW 2
  69. #define DACL_ROW 3
  70. #define SACL_ROW 4
  71. #define OWNER_ROW 6
  72. #define GROUP_ROW 7
  73. #define DACE_ROW 8
  74. #define SACE_ROW 9
  75. #define EXAMINED_COL 1
  76. #define CHANGED_COL 2
  77. #define NOTARGET_COL 3
  78. #define NOTSELECTED_COL 4
  79. #define UNKNOWN_COL 5
  80. class TStatNode:public TNode
  81. {
  82. public:
  83. TAcctNode * acctnode;
  84. BOOL changed;
  85. enum ChangeType { owner , group, dace, sace } changetype;
  86. TStatNode(TAcctNode * acct, ChangeType type, BOOL bChanged) { acctnode = acct; changetype = type; changed = bChanged; }
  87. };
  88. class TSDResolveStats
  89. {
  90. protected:
  91. TSDPartStats part;
  92. TSDFileActions unit;
  93. WORD background;
  94. WORD frame_foreground;
  95. WORD data_foreground;
  96. WORD message_foreground ;
  97. TSDRidCache * pCache;
  98. const TPathList * pPList;
  99. HANDLE csbuffer;
  100. USHORT len;
  101. // CStatsWnd * wnd;
  102. IVarSet * m_pVarSet;
  103. public:
  104. TSDResolveStats(TSDRidCache * cache, const TPathList * plist, IVarSet * pVarSet);
  105. TSDResolveStats(TSDRidCache * cache);
  106. // void SetWindow(CStatsWnd *w ) { wnd = w; }
  107. void IncrementOwnerChange(TAcctNode * acct, objectType type, TSecurableObject *file);
  108. void IncrementGroupChange(TAcctNode * acct, objectType type, TSecurableObject *file);
  109. void IncrementDACEChange (TAcctNode * acct, objectType type, TSecurableObject *file);
  110. void IncrementSACEChange (TAcctNode * acct, objectType type, TSecurableObject *file);
  111. void IncrementOwnerExamined () { part.owner.examined++; if ( m_pVarSet ) m_pVarSet->put(GET_BSTR(DCTVS_Stats_Owners_Examined),(LONG)part.owner.examined);}
  112. void IncrementGroupExamined () { part.group.examined++; if ( m_pVarSet ) m_pVarSet->put(GET_BSTR(DCTVS_Stats_Groups_Examined),(LONG)part.group.examined);}
  113. void IncrementDACLExamined () { part.dacl.examined++; if ( m_pVarSet ) m_pVarSet->put(GET_BSTR(DCTVS_Stats_DACL_Examined),(LONG)part.dacl.examined);}
  114. void IncrementSACLExamined () { part.sacl.examined++; if ( m_pVarSet ) m_pVarSet->put(GET_BSTR(DCTVS_Stats_SACL_Examined),(LONG)part.sacl.examined);}
  115. void IncrementDACEExamined () { part.dace.examined++; if ( m_pVarSet ) m_pVarSet->put(GET_BSTR(DCTVS_Stats_DACE_Examined),(LONG)part.dace.examined);}
  116. void IncrementSACEExamined () { part.sace.examined++; if ( m_pVarSet ) m_pVarSet->put(GET_BSTR(DCTVS_Stats_SACE_Examined),(LONG)part.sace.examined);}
  117. void IncrementOwnerNoTarget () { part.owner.notarget++; if ( m_pVarSet ) m_pVarSet->put(GET_BSTR(DCTVS_Stats_Owners_NoTarget),(LONG)part.owner.notarget);}
  118. void IncrementGroupNoTarget () { part.group.notarget++; if ( m_pVarSet ) m_pVarSet->put(GET_BSTR(DCTVS_Stats_Groups_NoTarget),(LONG)part.group.notarget);}
  119. void IncrementDACENoTarget (TSecurableObject *file);
  120. void IncrementSACENoTarget (TSecurableObject *file);
  121. void IncrementOwnerNotSelected () { part.owner.notselected++; if ( m_pVarSet ) m_pVarSet->put(GET_BSTR(DCTVS_Stats_Owners_NotSelected),(LONG)part.owner.notselected);}
  122. void IncrementGroupNotSelected () { part.group.notselected++; if ( m_pVarSet ) m_pVarSet->put(GET_BSTR(DCTVS_Stats_Groups_NotSelected),(LONG)part.group.notselected);}
  123. void IncrementDACENotSelected (TSecurableObject *file);
  124. void IncrementSACENotSelected (TSecurableObject *file);
  125. void IncrementOwnerUnknown () { part.owner.unknown++; if ( m_pVarSet ) m_pVarSet->put(GET_BSTR(DCTVS_Stats_Owners_Unknown),(LONG)part.owner.unknown);}
  126. void IncrementGroupUnknown () { part.group.unknown++; if ( m_pVarSet ) m_pVarSet->put(GET_BSTR(DCTVS_Stats_Groups_Unknown),(LONG)part.group.unknown);}
  127. void IncrementDACEUnknown (TSecurableObject *file);
  128. void IncrementSACEUnknown (TSecurableObject *file);
  129. void IncrementLastFileChanges(const TSecurableObject *lastfile, objectType container);
  130. void IncrementCacheHit(objectType type) {
  131. switch ( type )
  132. {
  133. case file:
  134. unit.cachehit.file++;
  135. if ( m_pVarSet ) m_pVarSet->put(GET_BSTR(DCTVS_Stats_Files_CacheHits),(LONG)unit.cachehit.file);
  136. break;
  137. case directory:
  138. unit.cachehit.dir++;
  139. if ( m_pVarSet ) m_pVarSet->put(GET_BSTR(DCTVS_Stats_Directories_CacheHits),(LONG)unit.cachehit.dir);
  140. break;
  141. case share:
  142. unit.cachehit.share++;
  143. if ( m_pVarSet ) m_pVarSet->put(GET_BSTR(DCTVS_Stats_Shares_CacheHits),(LONG)unit.cachehit.share);
  144. break;
  145. case mailbox:
  146. unit.cachehit.mailbox++;
  147. if ( m_pVarSet ) m_pVarSet->put(GET_BSTR(DCTVS_Stats_Mailboxes_CacheHits),(LONG)unit.cachehit.mailbox);
  148. break;
  149. case container:
  150. unit.cachehit.container++;
  151. if ( m_pVarSet ) m_pVarSet->put(GET_BSTR(DCTVS_Stats_Containers_CacheHits),(LONG)unit.cachehit.container);
  152. break;
  153. case groupmember:
  154. unit.cachehit.member++;
  155. if ( m_pVarSet ) m_pVarSet->put(GET_BSTR(DCTVS_Stats_Members_CacheHits),(LONG)unit.cachehit.member);
  156. break;
  157. case userright:
  158. unit.cachehit.userright++;
  159. if ( m_pVarSet ) m_pVarSet->put(GET_BSTR(DCTVS_Stats_UserRights_CacheHits),(LONG)unit.cachehit.userright);
  160. break;
  161. case regkey:
  162. unit.cachehit.regkey++;
  163. // TODO: if (m_pVarSet ) ...
  164. break;
  165. case printer:
  166. unit.cachehit.printer++;
  167. // TODO: if (m_pVarSet ) ...
  168. break;
  169. default:
  170. MCSASSERT(FALSE); // invalid type
  171. if ( m_pVarSet )
  172. break;
  173. }
  174. }
  175. void IncrementChanged(objectType type) {
  176. switch ( type)
  177. {
  178. case file:
  179. unit.changed.file++;
  180. if ( m_pVarSet ) m_pVarSet->put(GET_BSTR(DCTVS_Stats_Files_Changed),(LONG)unit.changed.file);
  181. break;
  182. case directory:
  183. unit.changed.dir++;
  184. if ( m_pVarSet ) m_pVarSet->put(GET_BSTR(DCTVS_Stats_Directories_Changed),(LONG)unit.changed.dir);
  185. break;
  186. case share:
  187. unit.changed.share++;
  188. if ( m_pVarSet ) m_pVarSet->put(GET_BSTR(DCTVS_Stats_Shares_Changed),(LONG)unit.changed.share);
  189. break;
  190. case mailbox:
  191. unit.changed.mailbox++;
  192. if ( m_pVarSet ) m_pVarSet->put(GET_BSTR(DCTVS_Stats_Mailboxes_Changed),(LONG)unit.changed.mailbox);
  193. break;
  194. case container:
  195. unit.changed.container++;
  196. if ( m_pVarSet ) m_pVarSet->put(GET_BSTR(DCTVS_Stats_Containers_Changed),(LONG)unit.changed.container);
  197. break;
  198. case groupmember:
  199. unit.changed.member++;
  200. if ( m_pVarSet ) m_pVarSet->put(GET_BSTR(DCTVS_Stats_Members_Changed),(LONG)unit.changed.member);
  201. break;
  202. case userright:
  203. unit.changed.userright++;
  204. if ( m_pVarSet ) m_pVarSet->put(GET_BSTR(DCTVS_Stats_UserRights_Changed),(LONG)unit.changed.userright);
  205. break;
  206. case regkey:
  207. unit.changed.regkey++;
  208. // TODO: if ( m_pVarSet ) ...
  209. break;
  210. case printer:
  211. unit.changed.printer++;
  212. // TODO: if ( m_pVarSet ) ...
  213. break;
  214. default:
  215. MCSASSERT(FALSE); // invalid type
  216. break;
  217. }
  218. }
  219. void IncrementExamined(objectType type) {
  220. switch ( type)
  221. {
  222. case file:
  223. unit.examined.file++;
  224. if ( m_pVarSet ) m_pVarSet->put(GET_BSTR(DCTVS_Stats_Files_Examined),(LONG)unit.examined.file);
  225. break;
  226. case directory:
  227. unit.examined.dir++;
  228. if ( m_pVarSet ) m_pVarSet->put(GET_BSTR(DCTVS_Stats_Directories_Examined),(LONG)unit.examined.dir);
  229. break;
  230. case share:
  231. unit.examined.share++;
  232. if ( m_pVarSet ) m_pVarSet->put(GET_BSTR(DCTVS_Stats_Shares_Examined),(LONG)unit.examined.share);
  233. break;
  234. case mailbox:
  235. unit.examined.mailbox++;
  236. if ( m_pVarSet ) m_pVarSet->put(GET_BSTR(DCTVS_Stats_Mailboxes_Examined),(LONG)unit.examined.mailbox);
  237. break;
  238. case container:
  239. unit.examined.container++;
  240. if ( m_pVarSet ) m_pVarSet->put(GET_BSTR(DCTVS_Stats_Containers_Examined),(LONG)unit.examined.container);
  241. break;
  242. case groupmember:
  243. unit.examined.member++;
  244. if ( m_pVarSet ) m_pVarSet->put(GET_BSTR(DCTVS_Stats_Members_Examined),(LONG)unit.examined.member);
  245. break;
  246. case userright:
  247. unit.examined.userright++;
  248. if ( m_pVarSet ) m_pVarSet->put(GET_BSTR(DCTVS_Stats_UserRights_Examined),(LONG)unit.examined.userright);
  249. break;
  250. case regkey:
  251. unit.examined.regkey++;
  252. //TODO: if ( m_pVarSet ) m_pVarSet->put(
  253. break;
  254. case printer:
  255. unit.examined.printer++;
  256. //TODO: if ( m_pVarSet ) m_pVarSet->put(
  257. break;
  258. default:
  259. MCSASSERT(FALSE); // invalid type
  260. break;
  261. }
  262. }
  263. void IncrementSkipped(objectType type) {
  264. switch ( type)
  265. {
  266. case file:
  267. unit.skipped.file++;
  268. if ( m_pVarSet ) m_pVarSet->put(GET_BSTR(DCTVS_Stats_Files_Skipped),(LONG)unit.skipped.file);
  269. break;
  270. case directory:
  271. unit.skipped.dir++;
  272. if ( m_pVarSet ) m_pVarSet->put(GET_BSTR(DCTVS_Stats_Directories_Skipped),(LONG)unit.skipped.dir);
  273. break;
  274. case share:
  275. unit.skipped.share++;
  276. if ( m_pVarSet ) m_pVarSet->put(GET_BSTR(DCTVS_Stats_Shares_Skipped),(LONG)unit.skipped.share);
  277. break;
  278. case mailbox:
  279. unit.skipped.mailbox++;
  280. if ( m_pVarSet ) m_pVarSet->put(GET_BSTR(DCTVS_Stats_Mailboxes_Skipped),(LONG)unit.skipped.mailbox);
  281. break;
  282. case container:
  283. unit.skipped.container++;
  284. if ( m_pVarSet ) m_pVarSet->put(GET_BSTR(DCTVS_Stats_Containers_Skipped),(LONG)unit.skipped.container);
  285. break;
  286. case groupmember:
  287. unit.skipped.member++;
  288. if ( m_pVarSet ) m_pVarSet->put(GET_BSTR(DCTVS_Stats_Members_Skipped),(LONG)unit.skipped.member);
  289. break;
  290. case userright:
  291. unit.skipped.userright++;
  292. if ( m_pVarSet ) m_pVarSet->put(GET_BSTR(DCTVS_Stats_UserRights_Skipped),(LONG)unit.skipped.userright);
  293. break;
  294. case regkey:
  295. unit.skipped.regkey++;
  296. // TODO: if ( m_pVarSet ) ...
  297. break;
  298. case printer:
  299. unit.skipped.printer++;
  300. // TODO: if ( m_pVarSet ) ...
  301. break;
  302. default:
  303. MCSASSERT(FALSE); // invalid type
  304. break;
  305. }
  306. }
  307. void IncrementDACLChanged() { part.dacl.changed++; if ( m_pVarSet ) m_pVarSet->put(GET_BSTR(DCTVS_Stats_DACL_Changed),(LONG)part.dacl.changed);} //DisplayStatItem(DACL_ROW,CHANGED_COL,part.dacl.changed); }
  308. void IncrementSACLChanged() { part.sacl.changed++; if ( m_pVarSet ) m_pVarSet->put(GET_BSTR(DCTVS_Stats_SACL_Changed),(LONG)part.sacl.changed);} //DisplayStatItem(SACL_ROW,CHANGED_COL,part.sacl.changed); }
  309. void Report(BOOL summary,BOOL acct_detail,BOOL pathdetail) const;
  310. void InitDisplay(BOOL nochange);
  311. void DisplayStatFrame(BOOL nochange);
  312. void DisplayStatItem(SHORT row, SHORT col, DWORD val, BOOL forceRedraw = FALSE);
  313. void DisplayBox(SHORT x1, SHORT y1, SHORT x2, SHORT y2);
  314. void DisplayPath(LPWSTR str,BOOL forceRedraw = FALSE);
  315. void SetFrameText(WCHAR * msg);
  316. void ReportToVarSet(IVarSet * pVarSet,DWORD verbnum) const;
  317. };
  318. #endif