From f83aa371aa6d0138424380e065e8c50728215343 Mon Sep 17 00:00:00 2001 From: Corey C Date: Tue, 12 Mar 2013 17:56:45 -0400 Subject: [PATCH] wfreerdp-server: more error handling improvements --- server/Windows/wf_info.c | 7 ++++++- server/Windows/wf_mirage.c | 12 +++++++----- server/Windows/wf_mirage.h | 2 +- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/server/Windows/wf_info.c b/server/Windows/wf_info.c index b9f268d27..57c03e8bf 100644 --- a/server/Windows/wf_info.c +++ b/server/Windows/wf_info.c @@ -225,7 +225,12 @@ void wf_info_peer_register(wfInfo* wfi, wfPeerContext* context) if (wfi->peerCount == 0) wf_dxgi_init(wfi); #else - wf_mirror_driver_activate(wfi); + if (wf_mirror_driver_activate(wfi) == FALSE) + { + context->socketClose = TRUE; + wf_info_unlock(wfi); + return; + } #endif //look trhough the array of peers until an empty slot for(i=0; imirrorDriverActive) { @@ -301,28 +301,30 @@ void wf_mirror_driver_activate(wfInfo* wfi) if (wf_mirror_driver_find_display_device(wfi) == FALSE) { printf("Could not find dfmirage mirror driver! Is it installed?\n"); - return; + return FALSE; } if (wf_mirror_driver_display_device_attach(wfi, 1) == FALSE) { printf("Could not attach display device!\n"); - return; + return FALSE; } if (wf_mirror_driver_update(wfi, FALSE) == FALSE) { printf("could not update system with new display settings!\n"); - return; + return FALSE; } if (wf_mirror_driver_map_memory(wfi) == FALSE) { printf("Unable to map memory for mirror driver!\n"); - return; + return FALSE; } wfi->mirrorDriverActive = TRUE; } + + return TRUE; } void wf_mirror_driver_deactivate(wfInfo* wfi) diff --git a/server/Windows/wf_mirage.h b/server/Windows/wf_mirage.h index af52ab61c..6e31dd2fc 100644 --- a/server/Windows/wf_mirage.h +++ b/server/Windows/wf_mirage.h @@ -206,7 +206,7 @@ BOOL wf_mirror_driver_update(wfInfo* wfi, int unload); BOOL wf_mirror_driver_map_memory(wfInfo* wfi); BOOL wf_mirror_driver_cleanup(wfInfo* wfi); -void wf_mirror_driver_activate(wfInfo* wfi); +BOOL wf_mirror_driver_activate(wfInfo* wfi); void wf_mirror_driver_deactivate(wfInfo* wfi); #endif /* WF_MIRAGE_H */