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.

63 lines
1.5 KiB

  1. //*************************************************************
  2. //
  3. // Group Policy Performance test program
  4. //
  5. // Copyright (c) Microsoft Corporation 1997-1998
  6. //
  7. // History: 11-Jan-99 SitaramR Created
  8. //
  9. //*************************************************************
  10. #include <windows.h>
  11. #include <userenv.h>
  12. #include <tchar.h>
  13. #include <stdio.h>
  14. int __cdecl main( int argc, char *argv[])
  15. {
  16. HANDLE hToken;
  17. PGROUP_POLICY_OBJECT pGPOList;
  18. LARGE_INTEGER Freq;
  19. LARGE_INTEGER Start, Stop, Total;
  20. DWORD i;
  21. DWORD nIterations = 10;
  22. if ( !OpenProcessToken (GetCurrentProcess(), TOKEN_ALL_ACCESS, &hToken) )
  23. {
  24. printf("Unable to get process token\n");
  25. return 0;
  26. }
  27. QueryPerformanceFrequency( &Freq );
  28. Total.QuadPart = 0;
  29. printf( "Starting %d iterations\n", nIterations );
  30. for ( i=0; i<nIterations; i++) {
  31. QueryPerformanceCounter( &Start );;
  32. if (GetGPOList (hToken, NULL, NULL, NULL, 0, &pGPOList))
  33. {
  34. QueryPerformanceCounter( &Stop );
  35. Total.QuadPart += Stop.QuadPart - Start.QuadPart;
  36. FreeGPOList (pGPOList);
  37. }
  38. else
  39. {
  40. printf( "GetGPOList failed\n" );
  41. return 0;
  42. }
  43. }
  44. CloseHandle (hToken);
  45. printf( "GetGPOList time = %f milliseconds per iteration\n",
  46. ((float)Total.QuadPart / (float)Freq.QuadPart) * 1000 / nIterations );
  47. return 0;
  48. }