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.

120 lines
2.8 KiB

  1. #include "pch.h"
  2. #include "\nt\public\internal\ds\inc\authzi.h"
  3. void _cdecl wmain(int argc, WCHAR * argv[])
  4. {
  5. LONG i = 0;
  6. LONG j = 0;
  7. LONG Iterations = 0;
  8. BOOL b = TRUE;
  9. AUTHZ_AUDIT_EVENT_TYPE_HANDLE hAET = NULL;
  10. AUTHZ_AUDIT_EVENT_HANDLE hAE = NULL;
  11. AUTHZ_RESOURCE_MANAGER_HANDLE hRM = NULL;
  12. if (argc != 2)
  13. {
  14. wprintf(L"usage: %s iterations\n", argv[0]);
  15. exit(0);
  16. }
  17. Iterations = wcstol(argv[1], NULL, 10);
  18. wprintf(L"RM Stress. Init / Free RM for %d iters. Press a key to start.\n", Iterations);
  19. getchar();
  20. b = AuthzInitializeResourceManager(
  21. 0, // Flags
  22. NULL,
  23. NULL,
  24. NULL,
  25. L"Jeff's RM",
  26. &hRM
  27. );
  28. if (!b)
  29. {
  30. wprintf(L"AuthzInitializeResourceManager failed with %d\n", GetLastError());
  31. return;
  32. }
  33. for (i = 0; i < Iterations; i++)
  34. {
  35. b = AuthziInitializeAuditEventType(
  36. 0,
  37. 3,
  38. 666,
  39. 1,
  40. &hAET
  41. );
  42. if (!b)
  43. {
  44. wprintf(L"AuthziInitializeAuditEventType failed with %d\n", GetLastError());
  45. return;
  46. }
  47. b = AuthziInitializeAuditEvent(
  48. 0,
  49. hRM,
  50. hAET,
  51. NULL,
  52. NULL,
  53. INFINITE,
  54. L"foo",
  55. L"foo",
  56. L"foo",
  57. L"foo",
  58. &hAE
  59. );
  60. if (!b)
  61. {
  62. wprintf(L"AuthziInitializeAuditEvent failed with %d\n", GetLastError());
  63. return;
  64. }
  65. // for (j = 0; j < 100; j++)
  66. // {
  67. // b = AuthziLogAuditEvent(
  68. // 0,
  69. // hAE,
  70. // NULL
  71. // );
  72. // }
  73. b = AuthzFreeAuditEvent(
  74. hAE
  75. );
  76. if (!b)
  77. {
  78. wprintf(L"AuthzFreeAuditEvent failed with %d\n", GetLastError());
  79. return;
  80. }
  81. b = AuthziFreeAuditEventType(
  82. hAET
  83. );
  84. if (!b)
  85. {
  86. wprintf(L"AuthziFreeAuditEventType failed with %d\n", GetLastError());
  87. return;
  88. }
  89. }
  90. b = AuthzFreeResourceManager(
  91. hRM
  92. );
  93. if (!b)
  94. {
  95. wprintf(L"AuthzFreeResourceManager failed with %d\n", GetLastError());
  96. return;
  97. }
  98. wprintf(L"Done. Press a key.\n");
  99. getchar();
  100. }