Source code of Windows XP (NT5)
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.

66 lines
1.1 KiB

  1. //----------------------------------------------------------------------------
  2. //
  3. // Microsoft Active Directory 1.0 Sample Code
  4. //
  5. // Copyright (C) Microsoft Corporation, 1996
  6. //
  7. // File: main.cxx
  8. //
  9. // Contents: Main for adscmd
  10. //
  11. //
  12. //----------------------------------------------------------------------------
  13. #include "main.hxx"
  14. //-------------------------------------------------------------------------
  15. //
  16. // main
  17. //
  18. //-------------------------------------------------------------------------
  19. void __cdecl
  20. main()
  21. {
  22. IADsContainer *pContainer;
  23. IADs *pADs;
  24. BSTR bstrName;
  25. HRESULT hr;
  26. #if 0
  27. hr = ADsGetObject(TEXT("WinNT://SEANW1"),
  28. IID_IADsContainer,
  29. (void**) &pContainer);
  30. BAIL_ON_FAILURE(hr);
  31. hr = pContainer->QueryInterface(
  32. IID_IADs,
  33. (void**) &pADs);
  34. BAIL_ON_FAILURE(hr);
  35. #else
  36. hr = ADsGetObject(L"WinNT://SEANW2",
  37. IID_IADs,
  38. (void**) &pADs);
  39. BAIL_ON_FAILURE(hr);
  40. #endif
  41. pADs->get_Name(&bstrName);
  42. printf("%s\n", bstrName);
  43. SysFreeString(bstrName);
  44. pContainer->Release();
  45. return;
  46. error:
  47. printf("Error:\t%d\n", hr);
  48. }