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.

53 lines
1.1 KiB

  1. // refcount.cpp : Defines the entry point for the application.
  2. //
  3. #include "stdafx.h"
  4. #include <atlbase.h>
  5. #include <rdshost.h>
  6. #include <rdshost_i.c>
  7. int APIENTRY WinMain(HINSTANCE hInstance,
  8. HINSTANCE hPrevInstance,
  9. LPSTR lpCmdLine,
  10. int nCmdShow)
  11. {
  12. DWORD cnt;
  13. CoInitialize(NULL);
  14. IRemoteDesktopServerHost *host;
  15. IRemoteDesktopServer *srvr;
  16. HRESULT hr;
  17. hr = CoCreateInstance(
  18. CLSID_RemoteDesktopServerHost,
  19. NULL, CLSCTX_ALL,
  20. __uuidof(IRemoteDesktopServerHost),
  21. (LPVOID*)&host
  22. );
  23. if (!SUCCEEDED(hr)) {
  24. fprintf(stderr, "CoCreateInstance: %08X", hr);
  25. exit(-1);
  26. }
  27. hr = host->GetRemoteDesktopServer(&srvr);
  28. if (!SUCCEEDED(hr)) {
  29. fprintf(stderr, "GetRemoteDesktopServer: %08X", hr);
  30. exit(-1);
  31. }
  32. srvr->StartListening();
  33. srvr->StopListening();
  34. /*
  35. srvr->StartListening();
  36. srvr->StopListening();
  37. */
  38. cnt = srvr->Release();
  39. cnt = host->Release();
  40. CoUninitialize();
  41. return 0;
  42. }