From a53dfae1ddcefbc13a153b25f6752da5687edec8 Mon Sep 17 00:00:00 2001 From: Corey C Date: Tue, 23 Oct 2012 18:49:03 -0400 Subject: [PATCH] wfreerdp-server: added ability to list displays --- server/Windows/cli/wfreerdp.c | 11 +++++++++++ server/Windows/wf_interface.c | 21 +++++++++++++++++++++ server/Windows/wf_interface.h | 2 ++ 3 files changed, 34 insertions(+) diff --git a/server/Windows/cli/wfreerdp.c b/server/Windows/cli/wfreerdp.c index b40e796de..eda7f30ae 100644 --- a/server/Windows/cli/wfreerdp.c +++ b/server/Windows/cli/wfreerdp.c @@ -34,10 +34,21 @@ int main(int argc, char* argv[]) { + int index; wfServer* server; server = wfreerdp_server_new(); + //handle args + index = 1; + //first the args that will cause the program to terminate + if (strcmp("--list-screens", argv[index]) == 0) + { + printf("Detecting screens...\n"); + get_screen_info(); + return 0; + } + if (argc == 2) server->port = (DWORD) atoi(argv[1]); diff --git a/server/Windows/wf_interface.c b/server/Windows/wf_interface.c index fc5512a79..f066eae45 100644 --- a/server/Windows/wf_interface.c +++ b/server/Windows/wf_interface.c @@ -36,6 +36,27 @@ cbCallback cbEvent; +void get_screen_info() +{ + int i; + DISPLAY_DEVICE dd; + + memset(&dd, 0, sizeof(DISPLAY_DEVICE)); + dd.cb = sizeof(DISPLAY_DEVICE); + + for (i=0; ; i++) + { + if (EnumDisplayDevices(NULL, i, &dd, 0) != 0) + { + _tprintf(_T("%d) [%d] [%s] [%s]\n"), i, dd.DeviceID, dd.DeviceName, dd.DeviceString); + } + else + { + break; + } + } +} + DWORD WINAPI wf_server_main_loop(LPVOID lpParam) { int i, fds; diff --git a/server/Windows/wf_interface.h b/server/Windows/wf_interface.h index 93674874a..bfa667d23 100644 --- a/server/Windows/wf_interface.h +++ b/server/Windows/wf_interface.h @@ -102,6 +102,8 @@ typedef struct wf_server wfServer; typedef void (__stdcall* cbCallback) (int, UINT32); +FREERDP_API void get_screen_info(); + FREERDP_API BOOL wfreerdp_server_start(wfServer* server); FREERDP_API BOOL wfreerdp_server_stop(wfServer* server);