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.

74 lines
1.5 KiB

  1. /*===================================================================
  2. Microsoft
  3. Microsoft Confidential.
  4. Copyright 1997 Microsoft Corporation. All Rights Reserved.
  5. Component: qstest
  6. File: main.cpp
  7. Owner: brentmid
  8. Note:
  9. ===================================================================*/
  10. #include <stdio.h>
  11. #include <objbase.h>
  12. #include <atlbase.h>
  13. #include <iads.h>
  14. #include <adshlp.h>
  15. DWORD QuerySMTPState() {
  16. HRESULT hr = NOERROR;
  17. CComPtr<IADsServiceOperations> pADsIisService;
  18. DWORD dwState;
  19. // Get virtual server instance on metabase
  20. hr = ADsGetObject (L"IIS://localhost/smtpsvc/1", IID_IADsServiceOperations, (void**)&pADsIisService );
  21. if (FAILED(hr)) goto Exit;
  22. printf("Successful ADsGetObject...\n");
  23. // Get state
  24. hr = pADsIisService->get_Status ( (long*)&dwState );
  25. if (FAILED(hr)) goto Exit;
  26. printf("Successful get_Status...\n");
  27. Exit:
  28. return dwState;
  29. }
  30. int _cdecl main (int argc, char **argv)
  31. {
  32. char s;
  33. DWORD status;
  34. CoInitialize(NULL);
  35. printf("Beginning qstest...\n");
  36. printf("Querying SMTP service state - 1st time...\n");
  37. status = QuerySMTPState();
  38. printf("Status = %x\n", status);
  39. printf("Stop/restart iisadmin, then hit enter...");
  40. scanf("%c",&s);
  41. printf("Querying SMTP service state - 2nd time...\n");
  42. status = QuerySMTPState();
  43. printf("Status = %x\n", status);
  44. CoUninitialize();
  45. return 0;
  46. }