Using wlog for server now.

This commit is contained in:
Armin Novak 2014-09-12 17:38:12 +02:00
parent 7913a57bc5
commit 5b5791c8d7
31 changed files with 1986 additions and 1958 deletions

View File

@ -25,6 +25,9 @@
#include "mf_audin.h"
#include <freerdp/log.h>
#define TAG SERVER_TAG("mac")
static const AUDIO_FORMAT supported_audio_formats[] =
{
@ -34,19 +37,19 @@ static const AUDIO_FORMAT supported_audio_formats[] =
static void mf_peer_audin_opening(audin_server_context* context)
{
DEBUG_WARN( "AUDIN opening.\n");
WLog_INFO(TAG, "AUDIN opening.");
/* Simply choose the first format supported by the client. */
context->SelectFormat(context, 0);
}
static void mf_peer_audin_open_result(audin_server_context* context, UINT32 result)
{
DEBUG_WARN( "AUDIN open result %d.\n", result);
WLog_INFO(TAG, "AUDIN open result %d.", result);
}
static void mf_peer_audin_receive_samples(audin_server_context* context, const void* buf, int nframes)
{
DEBUG_WARN( "AUDIN receive %d frames.\n", nframes);
WLog_INFO(TAG, "AUDIN receive %d frames.", nframes);
}
void mf_peer_audin_init(mfPeerContext* context)

View File

@ -30,6 +30,9 @@
#include "mf_event.h"
#include <freerdp/log.h>
#define TAG SERVER_TAG("mac")
int mf_is_event_set(mfEventQueue* event_queue)
{
fd_set rfds;
@ -51,7 +54,7 @@ void mf_signal_event(mfEventQueue* event_queue)
length = write(event_queue->pipe_fd[1], "sig", 4);
if (length != 4)
DEBUG_WARN( "mf_signal_event: error\n");
WLog_ERR(TAG, "mf_signal_event: error");
}
void mf_set_event(mfEventQueue* event_queue)
@ -61,7 +64,7 @@ void mf_set_event(mfEventQueue* event_queue)
length = write(event_queue->pipe_fd[1], "sig", 4);
if (length != 4)
DEBUG_WARN( "mf_set_event: error\n");
WLog_ERR(TAG, "mf_set_event: error");
}
void mf_clear_events(mfEventQueue* event_queue)
@ -73,7 +76,7 @@ void mf_clear_events(mfEventQueue* event_queue)
length = read(event_queue->pipe_fd[0], &length, 4);
if (length != 4)
DEBUG_WARN( "mf_clear_event: error\n");
WLog_ERR(TAG, "mf_clear_event: error");
}
}
@ -84,7 +87,7 @@ void mf_clear_event(mfEventQueue* event_queue)
length = read(event_queue->pipe_fd[0], &length, 4);
if (length != 4)
DEBUG_WARN( "mf_clear_event: error\n");
WLog_ERR(TAG, "mf_clear_event: error");
}
void mf_event_push(mfEventQueue* event_queue, mfEvent* event)
@ -188,7 +191,7 @@ mfEventQueue* mf_event_queue_new()
event_queue->events = (mfEvent**) malloc(sizeof(mfEvent*) * event_queue->size);
if (pipe(event_queue->pipe_fd) < 0)
DEBUG_WARN( "mf_event_queue_new: pipe failed\n");
WLog_ERR(TAG, "mf_event_queue_new: pipe failed");
pthread_mutex_init(&(event_queue->mutex), NULL);
}

View File

@ -29,6 +29,9 @@
#include "mf_mountain_lion.h"
//#include "mf_update.h"
#include <freerdp/log.h>
#define TAG SERVER_TAG("mac")
static mfInfo* mfInfoInstance = NULL;
//static int _IDcount = 0;
@ -43,7 +46,7 @@ int mf_info_lock(mfInfo* mfi)
break;
default:
DEBUG_MSG("mf_info_lock failed with %#X\n", status);
WLog_ERR(TAG, "mf_info_lock failed with %#X", status);
return -1;
break;
}
@ -65,7 +68,7 @@ int mf_info_try_lock(mfInfo* mfi, UINT32 ms)
break;
default:
DEBUG_MSG("mf_info_try_lock failed with %#X\n", status);
WLog_ERR(TAG, "mf_info_try_lock failed with %#X", status);
return -1;
break;
}
@ -82,7 +85,7 @@ int mf_info_unlock(mfInfo* mfi)
break;
default:
DEBUG_MSG("mf_info_unlock failed with %#X\n", status);
WLog_ERR(TAG, "mf_info_unlock failed with %#X", status);
return -1;
break;
}
@ -110,7 +113,7 @@ mfInfo* mf_info_init()
if (mutexInitStatus != 0)
{
DEBUG_MSG(_T("CreateMutex error: %#X\n"), mutexInitStatus);
WLog_ERR(TAG, _T("CreateMutex error: %#X"), mutexInitStatus);
}
mfi->peers = (freerdp_peer**) malloc(sizeof(freerdp_peer*) * MF_INFO_MAXPEERS);
@ -163,7 +166,7 @@ void mf_info_peer_register(mfInfo* mfi, mfPeerContext* context)
int peerId;
if (mfi->peerCount == MF_INFO_MAXPEERS)
{
DEBUG_MSG("TODO: socketClose on OS X\n");
WLog_ERR(TAG, "TODO: socketClose on OS X");
//context->socketClose = TRUE;
mf_info_unlock(mfi);
return;
@ -198,7 +201,7 @@ void mf_info_peer_register(mfInfo* mfi, mfPeerContext* context)
mfi->peers[peerId] = ((rdpContext*) context)->peer;
mfi->peers[peerId]->pId = peerId;
mfi->peerCount++;
//printf("Registering Peer: id=%d #=%d\n", peerId, mfi->peerCount);
//WLog_DBG(TAG, "Registering Peer: id=%d #=%d\n", peerId, mfi->peerCount);
mf_info_unlock(mfi);
@ -216,7 +219,7 @@ void mf_info_peer_unregister(mfInfo* mfi, mfPeerContext* context)
mfi->peers[peerId] = NULL;
mfi->peerCount--;
//printf("Unregistering Peer: id=%d, #=%d\n", peerId, mfi->peerCount);
//WLog_DBG(TAG, "Unregistering Peer: id=%d, #=%d\n", peerId, mfi->peerCount);
//screen capture cleanup
if (mfi->peerCount == 0)

View File

@ -29,7 +29,11 @@
#include "mf_input.h"
#include "mf_info.h"
static const CGKeyCode keymap[256] = {
#include <freerdp/log.h>
#define TAG SERVER_TAG("mac")
static const CGKeyCode keymap[256] =
{
0xFF, //0x0
kVK_Escape, //0x1
kVK_ANSI_1, //0x2
@ -356,8 +360,8 @@ void mf_input_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
/*
if (flags & KBD_FLAGS_EXTENDED)
DEBUG_WARN( "extended ");
DEBUG_WARN( "keypress: down = %d, SCAN=%#0X, VK=%#0X\n", keyDown, code, keymap[code]);
WLog_ERR(TAG, "extended ");
WLog_ERR(TAG, "keypress: down = %d, SCAN=%#0X, VK=%#0X", keyDown, code, keymap[code]);
*/
}
@ -548,7 +552,7 @@ void mf_input_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
void mf_input_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
{
DEBUG_WARN( "Unhandled mouse event!!!\n");
WLog_ERR(TAG, "Unhandled mouse event!!!");
/*
if ((flags & PTR_XFLAGS_BUTTON1) || (flags & PTR_XFLAGS_BUTTON2))
{

View File

@ -25,6 +25,9 @@
#include "mf_mountain_lion.h"
#include <freerdp/log.h>
#define TAG SERVER_TAG("mac")
dispatch_semaphore_t region_sem;
dispatch_semaphore_t data_sem;
dispatch_queue_t screen_update_q;
@ -86,21 +89,20 @@ void (^streamHandler)(CGDisplayStreamFrameStatus, uint64_t, IOSurfaceRef, CGDisp
switch(status)
{
case kCGDisplayStreamFrameStatusFrameIdle:
DEBUG_MSG("kCGDisplayStreamFrameStatusFrameIdle\n");
WLog_DBG(TAG, "kCGDisplayStreamFrameStatusFrameIdle");
break;
case kCGDisplayStreamFrameStatusStopped:
//we dont need to clean up
//printf("kCGDisplayStreamFrameStatusStopped\n");
//WLog_DBG(TAG, "kCGDisplayStreamFrameStatusStopped");
break;
case kCGDisplayStreamFrameStatusFrameBlank:
DEBUG_MSG("kCGDisplayStreamFrameStatusFrameBlank\n");
WLog_DBG(TAG, "kCGDisplayStreamFrameStatusFrameBlank");
break;
default:
DEBUG_MSG("Unhandled Frame Status!!!\n");
WLog_WARN(TAG, "Unhandled Frame Status!!!");
}
}
else if (lastUpdate == NULL)
@ -193,7 +195,7 @@ int mf_mlion_start_getting_screen_updates()
err = CGDisplayStreamStart(stream);
if(err != kCGErrorSuccess)
{
DEBUG_MSG("Failed to start displaystream!! err = %d\n", err);
WLog_WARN(TAG, "Failed to start displaystream!! err = %d", err);
return 1;
}
@ -207,13 +209,11 @@ int mf_mlion_stop_getting_screen_updates()
err = CGDisplayStreamStop(stream);
if(err != kCGErrorSuccess)
{
DEBUG_MSG("Failed to stop displaystream!! err = %d\n", err);
WLog_WARN(TAG, "Failed to stop displaystream!! err = %d", err);
return 1;
}
return 0;
return 0;
}
int mf_mlion_get_dirty_region(RFX_RECT* invalid)

View File

@ -42,6 +42,9 @@
#include "CoreVideo/CoreVideo.h"
#include <freerdp/log.h>
#define TAG SERVER_TAG("mac")
//refactor these
int info_last_sec = 0;
int info_last_nsec = 0;
@ -83,7 +86,7 @@ BOOL mf_peer_check_fds(freerdp_peer* client)
{
if (event->type == MF_EVENT_TYPE_REGION)
{
DEBUG_WARN( "unhandled event\n");
WLog_ERR(TAG, "unhandled event");
}
else if (event->type == MF_EVENT_TYPE_FRAME_TICK)
{
@ -237,10 +240,10 @@ void mf_peer_init(freerdp_peer* client)
if(info_timer)
{
//DEBUG_WARN( "created timer\n");
//WLog_ERR(TAG, "created timer");
dispatch_source_set_timer(info_timer, DISPATCH_TIME_NOW, 42ull * NSEC_PER_MSEC, 100ull * NSEC_PER_MSEC);
dispatch_source_set_event_handler(info_timer, ^{
//DEBUG_WARN( "dispatch\n");
//WLog_ERR(TAG, "dispatch");
mfEvent* event = mf_event_new(MF_EVENT_TYPE_FRAME_TICK);
mf_event_push(info_event_queue, (mfEvent*) event);}
);
@ -252,18 +255,15 @@ BOOL mf_peer_post_connect(freerdp_peer* client)
{
mfPeerContext* context = (mfPeerContext*) client->context;
rdpSettings* settings = client->settings;
DEBUG_WARN( "Client %s post connect\n", client->hostname);
WLog_INFO(TAG, "Client %s post connect", client->hostname);
if (client->settings->AutoLogonEnabled)
{
DEBUG_WARN( " and wants to login automatically as %s\\%s",
WLog_INFO(TAG, " and wants to login automatically as %s\\%s",
client->settings->Domain ? client->settings->Domain : "",
client->settings->Username);
/* A real server may perform OS login here if NLA is not executed previously. */
}
DEBUG_WARN( "\n");
mfInfo* mfi = mf_info_get_instance();
mfi->scale = 1;
@ -274,7 +274,7 @@ BOOL mf_peer_post_connect(freerdp_peer* client)
if ((settings->DesktopWidth != mfi->servscreen_width) || (settings->DesktopHeight != mfi->servscreen_height))
{
DEBUG_WARN( "Client requested resolution %dx%d, but will resize to %dx%d\n",
WLog_INFO(TAG, "Client requested resolution %dx%d, but will resize to %dx%d",
settings->DesktopWidth, settings->DesktopHeight, mfi->servscreen_width, mfi->servscreen_height);
}
@ -314,13 +314,12 @@ BOOL mf_peer_activate(freerdp_peer* client)
void mf_peer_synchronize_event(rdpInput* input, UINT32 flags)
{
DEBUG_WARN( "Client sent a synchronize event (flags:0x%08X)\n", flags);
WLog_WARN(TAG, "Client sent a synchronize event (flags:0x%08X)", flags);
}
void mf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
{
DEBUG_WARN( "Client sent a keyboard event (flags:0x%04X code:0x%04X)\n", flags, code);
WLog_INFO(TAG, "Client sent a keyboard event (flags:0x%04X code:0x%04X)", flags, code);
UINT16 down = 0x4000;
//UINT16 up = 0x8000;
@ -341,28 +340,28 @@ void mf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
void mf_peer_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
{
DEBUG_WARN( "Client sent a unicode keyboard event (flags:0x%04X code:0x%04X)\n", flags, code);
WLog_ERR(TAG, "Client sent a unicode keyboard event (flags:0x%04X code:0x%04X)", flags, code);
}
/*void mf_peer_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
{
//DEBUG_WARN( "Client sent a mouse event (flags:0x%04X pos: %d,%d)\n", flags, x, y);
//WLog_ERR(TAG, "Client sent a mouse event (flags:0x%04X pos: %d,%d)", flags, x, y);
}
void mf_peer_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
{
//DEBUG_WARN( "Client sent an extended mouse event (flags:0x%04X pos: %d,%d)\n", flags, x, y);
//WLog_ERR(TAG, "Client sent an extended mouse event (flags:0x%04X pos: %d,%d)", flags, x, y);
}
*/
/*static void mf_peer_refresh_rect(rdpContext* context, BYTE count, RECTANGLE_16* areas)
{
BYTE i;
DEBUG_WARN( "Client requested to refresh:\n");
WLog_ERR(TAG, "Client requested to refresh:");
for (i = 0; i < count; i++)
{
DEBUG_WARN( " (%d, %d) (%d, %d)\n", areas[i].left, areas[i].top, areas[i].right, areas[i].bottom);
WLog_ERR(TAG, " (%d, %d) (%d, %d)", areas[i].left, areas[i].top, areas[i].right, areas[i].bottom);
}
}*/
@ -370,11 +369,11 @@ static void mf_peer_suppress_output(rdpContext* context, BYTE allow, RECTANGLE_1
{
if (allow > 0)
{
DEBUG_WARN( "Client restore output (%d, %d) (%d, %d).\n", area->left, area->top, area->right, area->bottom);
WLog_WARN(TAG, "Client restore output (%d, %d) (%d, %d).", area->left, area->top, area->right, area->bottom);
}
else
{
DEBUG_WARN( "Client minimized and suppress output.\n");
WLog_WARN(TAG, "Client minimized and suppress output.");
}
}
@ -424,8 +423,7 @@ void* mf_peer_main_loop(void* arg)
client->Initialize(client);
context = (mfPeerContext*) client->context;
DEBUG_WARN( "We've got a client %s\n", client->local ? "(local)" : client->hostname);
WLog_INFO(TAG, "We've got a client %s", client->local ? "(local)" : client->hostname);
while (1)
{
@ -433,12 +431,12 @@ void* mf_peer_main_loop(void* arg)
if (client->GetFileDescriptor(client, rfds, &rcount) != TRUE)
{
DEBUG_WARN( "Failed to get FreeRDP file descriptor\n");
WLog_ERR(TAG, "Failed to get FreeRDP file descriptor");
break;
}
if (mf_peer_get_fds(client, rfds, &rcount) != TRUE)
{
DEBUG_WARN( "Failed to get mfreerdp file descriptor\n");
WLog_ERR(TAG, "Failed to get mfreerdp file descriptor");
break;
}
@ -468,20 +466,20 @@ void* mf_peer_main_loop(void* arg)
(errno == EINPROGRESS) ||
(errno == EINTR))) /* signal occurred */
{
DEBUG_WARN( "select failed\n");
WLog_ERR(TAG, "select failed");
break;
}
}
if (client->CheckFileDescriptor(client) != TRUE)
{
DEBUG_WARN( "Failed to check freerdp file descriptor\n");
WLog_ERR(TAG, "Failed to check freerdp file descriptor");
break;
}
if ((mf_peer_check_fds(client)) != TRUE)
{
DEBUG_WARN( "Failed to check mfreerdp file descriptor\n");
WLog_ERR(TAG, "Failed to check mfreerdp file descriptor");
break;
}
@ -491,8 +489,7 @@ void* mf_peer_main_loop(void* arg)
}
}
DEBUG_WARN( "Client %s disconnected.\n", client->local ? "(local)" : client->hostname);
WLog_INFO(TAG, "Client %s disconnected.", client->local ? "(local)" : client->hostname);
client->Disconnect(client);
freerdp_peer_context_free(client);
freerdp_peer_free(client);

View File

@ -21,14 +21,14 @@
#include "config.h"
#endif
#include <winpr/crt.h>
#include <winpr/sysinfo.h>
#include <freerdp/server/rdpsnd.h>
#include "mf_info.h"
#include "mf_rdpsnd.h"
#include <freerdp/log.h>
#define TAG SERVER_TAG("mac")
AQRecorderState recorderState;
static const AUDIO_FORMAT supported_audio_formats[] =
@ -46,8 +46,7 @@ static void mf_peer_rdpsnd_activated(RdpsndServerContext* context)
//we should actually loop through the list of client formats here
//and see if we can send the client something that it supports...
DEBUG_MSG("Client supports the following %d formats: \n", context->num_client_formats);
WLog_DBG(TAG, "Client supports the following %d formats: ", context->num_client_formats);
for (i = 0; i < context->num_client_formats; i++)
{
@ -58,7 +57,7 @@ static void mf_peer_rdpsnd_activated(RdpsndServerContext* context)
(context->client_formats[i].nChannels == context->server_formats[j].nChannels) &&
(context->client_formats[i].nSamplesPerSec == context->server_formats[j].nSamplesPerSec))
{
DEBUG_MSG("agreed on format!\n");
WLog_DBG(TAG, "agreed on format!");
formatAgreed = TRUE;
agreedFormat = (AUDIO_FORMAT*)&context->server_formats[j];
break;
@ -71,7 +70,7 @@ static void mf_peer_rdpsnd_activated(RdpsndServerContext* context)
if (formatAgreed == FALSE)
{
DEBUG_MSG("Could not agree on a audio format with the server\n");
WLog_DBG(TAG, "Could not agree on a audio format with the server");
return;
}
@ -114,7 +113,7 @@ static void mf_peer_rdpsnd_activated(RdpsndServerContext* context)
if (status != noErr)
{
DEBUG_MSG("Failed to create a new Audio Queue. Status code: %d\n", status);
WLog_DBG(TAG, "Failed to create a new Audio Queue. Status code: %d", status);
}
@ -211,7 +210,7 @@ void mf_peer_rdpsnd_input_callback (void *inUserD
if (status != noErr)
{
DEBUG_MSG("AudioQueueEnqueueBuffer() returned status = %d\n", status);
WLog_DBG(TAG, "AudioQueueEnqueueBuffer() returned status = %d", status);
}
}

View File

@ -43,6 +43,9 @@
#include "mfreerdp.h"
#include "mf_peer.h"
#include <freerdp/log.h>
#define TAG SERVER_TAG("mac")
static void mf_server_main_loop(freerdp_listener* instance)
{
int i;
@ -60,7 +63,7 @@ static void mf_server_main_loop(freerdp_listener* instance)
if (instance->GetFileDescriptor(instance, rfds, &rcount) != TRUE)
{
DEBUG_WARN( "Failed to get FreeRDP file descriptor\n");
WLog_ERR(TAG, "Failed to get FreeRDP file descriptor");
break;
}
@ -88,14 +91,14 @@ static void mf_server_main_loop(freerdp_listener* instance)
(errno == EINPROGRESS) ||
(errno == EINTR))) /* signal occurred */
{
DEBUG_WARN( "select failed\n");
WLog_ERR(TAG, "select failed");
break;
}
}
if (instance->CheckFileDescriptor(instance) != TRUE)
{
DEBUG_WARN( "Failed to check FreeRDP file descriptor\n");
WLog_ERR(TAG, "Failed to check FreeRDP file descriptor");
break;
}
}

View File

@ -21,12 +21,15 @@
#include "config.h"
#endif
#include <freerdp/utils/debug.h>
#include "sfreerdp.h"
#include "sf_audin.h"
#include <freerdp/log.h>
#define TAG SERVER_TAG("sample")
static const AUDIO_FORMAT test_audio_formats[] =
{
{ WAVE_FORMAT_PCM, 2, 44100, 176400, 4, 16, 0, NULL },
@ -35,19 +38,19 @@ static const AUDIO_FORMAT test_audio_formats[] =
static void sf_peer_audin_opening(audin_server_context* context)
{
DEBUG_MSG("AUDIN opening.\n");
WLog_DBG(TAG, "AUDIN opening.");
/* Simply choose the first format supported by the client. */
context->SelectFormat(context, 0);
}
static void sf_peer_audin_open_result(audin_server_context* context, UINT32 result)
{
DEBUG_MSG("AUDIN open result %d.\n", result);
WLog_DBG(TAG, "AUDIN open result %d.", result);
}
static void sf_peer_audin_receive_samples(audin_server_context* context, const void* buf, int nframes)
{
DEBUG_MSG("AUDIN receive %d frames.\n", nframes);
WLog_DBG(TAG, "AUDIN receive %d frames.", nframes);
}
void sf_peer_audin_init(testPeerContext* context)

View File

@ -22,10 +22,13 @@
#endif
#include <freerdp/server/audin.h>
#include <freerdp/utils/debug.h>
#include "sf_rdpsnd.h"
#include <freerdp/log.h>
#define TAG SERVER_TAG("sample")
static const AUDIO_FORMAT test_audio_formats[] =
{
{ WAVE_FORMAT_PCM, 2, 44100, 176400, 4, 16, 0, NULL },
@ -34,7 +37,7 @@ static const AUDIO_FORMAT test_audio_formats[] =
static void sf_peer_rdpsnd_activated(RdpsndServerContext* context)
{
DEBUG_MSG("RDPSND Activated\n");
WLog_DBG(TAG, "RDPSND Activated");
}
BOOL sf_peer_rdpsnd_init(testPeerContext* context)

View File

@ -33,7 +33,7 @@
#include <freerdp/channels/wtsvc.h>
#include <freerdp/channels/channels.h>
#include <freerdp/utils/debug.h>
#include <freerdp/constants.h>
#include <freerdp/utils/tcp.h>
@ -45,6 +45,9 @@
#include "sfreerdp.h"
#include <freerdp/log.h>
#define TAG SERVER_TAG("sample")
#define SAMPLE_SERVER_USE_CLIENT_RESOLUTION 1
#define SAMPLE_SERVER_DEFAULT_WIDTH 1024
#define SAMPLE_SERVER_DEFAULT_HEIGHT 768
@ -342,7 +345,7 @@ static BOOL test_sleep_tsdiff(UINT32 *old_sec, UINT32 *old_usec, UINT32 new_sec,
if ((sec < 0) || ((sec == 0) && (usec < 0)))
{
DEBUG_MSG("Invalid time stamp detected.\n");
WLog_ERR(TAG, "Invalid time stamp detected.");
return FALSE;
}
@ -451,8 +454,7 @@ static void* tf_debug_channel_thread_func(void* arg)
}
Stream_SetPosition(s, BytesReturned);
DEBUG_MSG("got %lu bytes\n", BytesReturned);
WLog_DBG(TAG, "got %lu bytes", BytesReturned);
}
Stream_Free(s, TRUE);
@ -470,31 +472,28 @@ BOOL tf_peer_post_connect(freerdp_peer* client)
* The server may start sending graphics output and receiving keyboard/mouse input after this
* callback returns.
*/
DEBUG_MSG("Client %s is activated (osMajorType %d osMinorType %d)", client->local ? "(local)" : client->hostname,
WLog_DBG(TAG, "Client %s is activated (osMajorType %d osMinorType %d)", client->local ? "(local)" : client->hostname,
client->settings->OsMajorType, client->settings->OsMinorType);
if (client->settings->AutoLogonEnabled)
{
DEBUG_MSG(" and wants to login automatically as %s\\%s",
WLog_DBG(TAG, " and wants to login automatically as %s\\%s",
client->settings->Domain ? client->settings->Domain : "",
client->settings->Username);
/* A real server may perform OS login here if NLA is not executed previously. */
}
DEBUG_MSG("\n");
DEBUG_MSG("Client requested desktop: %dx%dx%d\n",
WLog_DBG(TAG, "");
WLog_DBG(TAG, "Client requested desktop: %dx%dx%d",
client->settings->DesktopWidth, client->settings->DesktopHeight, client->settings->ColorDepth);
#if (SAMPLE_SERVER_USE_CLIENT_RESOLUTION == 1)
context->rfx_context->width = client->settings->DesktopWidth;
context->rfx_context->height = client->settings->DesktopHeight;
DEBUG_MSG("Using resolution requested by client.\n");
WLog_DBG(TAG, "Using resolution requested by client.");
#else
client->settings->DesktopWidth = context->rfx_context->width;
client->settings->DesktopHeight = context->rfx_context->height;
DEBUG_MSG("Resizing client to %dx%d\n", client->settings->DesktopWidth, client->settings->DesktopHeight);
WLog_DBG(TAG, "Resizing client to %dx%d", client->settings->DesktopWidth, client->settings->DesktopHeight);
client->update->DesktopResize(client->update->context);
#endif
@ -507,8 +506,7 @@ BOOL tf_peer_post_connect(freerdp_peer* client)
if (context->debug_channel != NULL)
{
DEBUG_MSG("Open channel rdpdbg.\n");
WLog_DBG(TAG, "Open channel rdpdbg.");
context->stopEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
context->debug_channel_thread = CreateThread(NULL, 0,
@ -562,7 +560,7 @@ BOOL tf_peer_activate(freerdp_peer* client)
void tf_peer_synchronize_event(rdpInput* input, UINT32 flags)
{
DEBUG_MSG("Client sent a synchronize event (flags:0x%X)\n", flags);
WLog_DBG(TAG, "Client sent a synchronize event (flags:0x%X)", flags);
}
void tf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
@ -570,8 +568,7 @@ void tf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
freerdp_peer* client = input->context->peer;
rdpUpdate* update = client->update;
testPeerContext* context = (testPeerContext*) input->context;
DEBUG_MSG("Client sent a keyboard event (flags:0x%X code:0x%X)\n", flags, code);
WLog_DBG(TAG, "Client sent a keyboard event (flags:0x%X code:0x%X)", flags, code);
if ((flags & 0x4000) && code == 0x22) /* 'g' key */
{
@ -623,30 +620,28 @@ void tf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
void tf_peer_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
{
DEBUG_MSG("Client sent a unicode keyboard event (flags:0x%X code:0x%X)\n", flags, code);
WLog_DBG(TAG, "Client sent a unicode keyboard event (flags:0x%X code:0x%X)", flags, code);
}
void tf_peer_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
{
//printf("Client sent a mouse event (flags:0x%X pos:%d,%d)\n", flags, x, y);
//WLog_DBG(TAG, "Client sent a mouse event (flags:0x%X pos:%d,%d)", flags, x, y);
test_peer_draw_icon(input->context->peer, x + 10, y);
}
void tf_peer_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
{
//printf("Client sent an extended mouse event (flags:0x%X pos:%d,%d)\n", flags, x, y);
//WLog_DBG(TAG, "Client sent an extended mouse event (flags:0x%X pos:%d,%d)", flags, x, y);
}
static void tf_peer_refresh_rect(rdpContext* context, BYTE count, RECTANGLE_16* areas)
{
BYTE i;
DEBUG_MSG("Client requested to refresh:\n");
WLog_DBG(TAG, "Client requested to refresh:");
for (i = 0; i < count; i++)
{
DEBUG_MSG(" (%d, %d) (%d, %d)\n", areas[i].left, areas[i].top, areas[i].right, areas[i].bottom);
WLog_DBG(TAG, " (%d, %d) (%d, %d)", areas[i].left, areas[i].top, areas[i].right, areas[i].bottom);
}
}
@ -654,11 +649,11 @@ static void tf_peer_suppress_output(rdpContext* context, BYTE allow, RECTANGLE_1
{
if (allow > 0)
{
DEBUG_MSG("Client restore output (%d, %d) (%d, %d).\n", area->left, area->top, area->right, area->bottom);
WLog_DBG(TAG, "Client restore output (%d, %d) (%d, %d).", area->left, area->top, area->right, area->bottom);
}
else
{
DEBUG_MSG("Client minimized and suppress output.\n");
WLog_DBG(TAG, "Client minimized and suppress output.");
}
}
@ -700,8 +695,7 @@ static void* test_peer_mainloop(void* arg)
client->Initialize(client);
context = (testPeerContext*) client->context;
DEBUG_MSG("We've got a client %s\n", client->local ? "(local)" : client->hostname);
WLog_INFO(TAG, "We've got a client %s", client->local ? "(local)" : client->hostname);
while (1)
{
@ -710,7 +704,7 @@ static void* test_peer_mainloop(void* arg)
memset(rfds, 0, sizeof(rfds));
if (client->GetFileDescriptor(client, rfds, &rcount) != TRUE)
{
DEBUG_MSG("Failed to get FreeRDP file descriptor\n");
WLog_ERR(TAG, "Failed to get FreeRDP file descriptor");
break;
}
@ -744,7 +738,7 @@ static void* test_peer_mainloop(void* arg)
(wsa_error == WSAEINPROGRESS) ||
(wsa_error == WSAEINTR)))
{
DEBUG_MSG("select failed (WSAGetLastError: %d)\n", wsa_error);
WLog_ERR(TAG, "select failed (WSAGetLastError: %d)", wsa_error);
break;
}
#else
@ -754,7 +748,7 @@ static void* test_peer_mainloop(void* arg)
(errno == EINPROGRESS) ||
(errno == EINTR))) /* signal occurred */
{
DEBUG_MSG("select failed (errno: %d)\n", errno);
WLog_ERR(TAG, "select failed (errno: %d)", errno);
break;
}
#endif
@ -767,8 +761,7 @@ static void* test_peer_mainloop(void* arg)
break;
}
DEBUG_MSG("Client %s disconnected.\n", client->local ? "(local)" : client->hostname);
WLog_INFO(TAG, "Client %s disconnected.", client->local ? "(local)" : client->hostname);
client->Disconnect(client);
freerdp_peer_context_free(client);
freerdp_peer_free(client);
@ -800,7 +793,7 @@ static void test_server_mainloop(freerdp_listener* instance)
memset(rfds, 0, sizeof(rfds));
if (instance->GetFileDescriptor(instance, rfds, &rcount) != TRUE)
{
DEBUG_MSG("Failed to get FreeRDP file descriptor\n");
WLog_ERR(TAG, "Failed to get FreeRDP file descriptor");
break;
}
@ -828,14 +821,14 @@ static void test_server_mainloop(freerdp_listener* instance)
(errno == EINPROGRESS) ||
(errno == EINTR))) /* signal occurred */
{
DEBUG_MSG("select failed\n");
WLog_ERR(TAG, "select failed");
break;
}
}
if (instance->CheckFileDescriptor(instance) != TRUE)
{
DEBUG_MSG("Failed to check FreeRDP file descriptor\n");
WLog_ERR(TAG, "Failed to check FreeRDP file descriptor");
break;
}
}

View File

@ -32,14 +32,16 @@
#include "wfreerdp.h"
#include <freerdp/log.h>
#define TAG SERVER_TAG("windows")
int IDcount = 0;
BOOL CALLBACK moncb(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData)
{
DEBUG_MSG("%d\t(%d, %d), (%d, %d)\n",
WLog_DBG(TAG, "%d\t(%d, %d), (%d, %d)",
IDcount, lprcMonitor->left, lprcMonitor->top,
lprcMonitor->right, lprcMonitor->bottom);
IDcount++;
return TRUE;
@ -67,9 +69,8 @@ int main(int argc, char* argv[])
int height;
int bpp;
int i;
_tprintf(_T("Detecting screens...\n"));
_tprintf(_T("\nID\tResolution\t\tName (Interface)\n\n"));
WLog_INFO(TAG, "Detecting screens...");
WLog_INFO(TAG, "ID\tResolution\t\tName (Interface)");
for (i=0; ; i++)
{
@ -78,8 +79,8 @@ int main(int argc, char* argv[])
if ( (width * height * bpp) == 0 )
continue;
_tprintf(_T("%d\t%dx%dx%d\t"), i, width, height, bpp);
_tprintf(_T("%s\n"), name);
WLog_INFO(TAG, "%d\t%dx%dx%d\t", i, width, height, bpp);
WLog_INFO(TAG, "%s", name);
}
else
{
@ -92,11 +93,10 @@ int main(int argc, char* argv[])
int vscreen_h;
vscreen_w = GetSystemMetrics(SM_CXVIRTUALSCREEN);
vscreen_h = GetSystemMetrics(SM_CYVIRTUALSCREEN);
DEBUG_MSG("\n");
WLog_INFO(TAG, "");
EnumDisplayMonitors(NULL, NULL, moncb, 0);
IDcount = 0;
DEBUG_MSG("\nVirtual Screen = %dx%d\n", vscreen_w, vscreen_h);
WLog_INFO(TAG, "Virtual Screen = %dx%d", vscreen_w, vscreen_h);
}
return 0;
@ -108,7 +108,7 @@ int main(int argc, char* argv[])
index++;
if (index == argc)
{
DEBUG_MSG("missing screen id parameter\n");
WLog_INFO(TAG, "missing screen id parameter");
return 0;
}
@ -130,10 +130,9 @@ int main(int argc, char* argv[])
int height;
int bpp;
int i;
_tprintf(_T("screen id not provided. attempting to detect...\n"));
_tprintf(_T("Detecting screens...\n"));
_tprintf(_T("\nID\tResolution\t\tName (Interface)\n\n"));
WLog_INFO(TAG, "screen id not provided. attempting to detect...");
WLog_INFO(TAG, "Detecting screens...");
WLog_INFO(TAG, "ID\tResolution\t\tName (Interface)");
for (i=0; ; i++)
{
@ -142,8 +141,8 @@ int main(int argc, char* argv[])
if ( (width * height * bpp) == 0 )
continue;
_tprintf(_T("%d\t%dx%dx%d\t"), i, width, height, bpp);
_tprintf(_T("%s\n"), name);
WLog_INFO(TAG, "%d\t%dx%dx%d\t", i, width, height, bpp);
WLog_INFO(TAG, "%s", name);
set_screen_id(i);
break;
}
@ -154,14 +153,11 @@ int main(int argc, char* argv[])
}
}
DEBUG_MSG("Starting server\n");
WLog_INFO(TAG, "Starting server");
wfreerdp_server_start(server);
WaitForSingleObject(server->thread, INFINITE);
DEBUG_MSG("Stopping server\n");
WLog_INFO(TAG, "Stopping server");
wfreerdp_server_stop(server);
wfreerdp_server_free(server);

View File

@ -14,6 +14,9 @@
#include <mmsystem.h>
#include <dsound.h>
#include <freerdp/log.h>
#define TAG SERVER_TAG("windows")
IDirectSoundCapture8* cap;
IDirectSoundCaptureBuffer8* capBuf;
DSCBUFFERDESC dscbd;
@ -34,18 +37,16 @@ int wf_directsound_activate(RdpsndServerContext* context)
LPDIRECTSOUNDCAPTUREBUFFER pDSCB;
wfi = wf_info_get_instance();
DEBUG_MSG("RDPSND (direct sound) Activated\n");
WLog_DBG(TAG, "RDPSND (direct sound) Activated");
hr = DirectSoundCaptureCreate8(NULL, &cap, NULL);
if (FAILED(hr))
{
_tprintf(_T("Failed to create sound capture device\n"));
WLog_ERR(TAG, "Failed to create sound capture device");
return 1;
}
_tprintf(_T("Created sound capture device\n"));
WLog_INFO(TAG, "Created sound capture device");
dscbd.dwSize = sizeof(DSCBUFFERDESC);
dscbd.dwFlags = 0;
dscbd.dwBufferBytes = wfi->agreed_format->nAvgBytesPerSec;
@ -58,18 +59,17 @@ int wf_directsound_activate(RdpsndServerContext* context)
if (FAILED(hr))
{
_tprintf(_T("Failed to create capture buffer\n"));
WLog_ERR(TAG, "Failed to create capture buffer");
}
_tprintf(_T("Created capture buffer"));
WLog_INFO(TAG, "Created capture buffer");
hr = pDSCB->lpVtbl->QueryInterface(pDSCB, &IID_IDirectSoundCaptureBuffer8, (LPVOID*)&capBuf);
if (FAILED(hr))
{
_tprintf(_T("Failed to QI capture buffer\n"));
WLog_ERR(TAG, "Failed to QI capture buffer");
}
_tprintf(_T("Created IDirectSoundCaptureBuffer8\n"));
WLog_INFO(TAG, "Created IDirectSoundCaptureBuffer8");
pDSCB->lpVtbl->Release(pDSCB);
lastPos = 0;
CreateThread(NULL, 0, wf_rdpsnd_directsound_thread, latestPeer, 0, NULL);
@ -98,14 +98,13 @@ DWORD WINAPI wf_rdpsnd_directsound_thread(LPVOID lpParam)
context = (wfPeerContext*)lpParam;
rate = 1000 / 24;
_tprintf(_T("Trying to start capture\n"));
WLog_INFO(TAG, "Trying to start capture");
hr = capBuf->lpVtbl->Start(capBuf, DSCBSTART_LOOPING);
if (FAILED(hr))
{
_tprintf(_T("Failed to start capture\n"));
WLog_ERR(TAG, "Failed to start capture");
}
_tprintf(_T("Capture started\n"));
WLog_INFO(TAG, "Capture started");
while (1)
{
@ -132,7 +131,7 @@ DWORD WINAPI wf_rdpsnd_directsound_thread(LPVOID lpParam)
hr = capBuf->lpVtbl->GetCurrentPosition(capBuf, NULL, &dwReadPos);
if (FAILED(hr))
{
_tprintf(_T("Failed to get read pos\n"));
WLog_ERR(TAG, "Failed to get read pos");
wf_rdpsnd_unlock();
break;
}
@ -140,7 +139,7 @@ DWORD WINAPI wf_rdpsnd_directsound_thread(LPVOID lpParam)
lLockSize = dwReadPos - lastPos;//dscbd.dwBufferBytes;
if (lLockSize < 0) lLockSize += dscbd.dwBufferBytes;
//printf("Last, read, lock = [%d, %d, %d]\n", lastPos, dwReadPos, lLockSize);
//WLog_DBG(TAG, "Last, read, lock = [%d, %d, %d]\n", lastPos, dwReadPos, lLockSize);
if (lLockSize == 0)
{
@ -152,7 +151,7 @@ DWORD WINAPI wf_rdpsnd_directsound_thread(LPVOID lpParam)
hr = capBuf->lpVtbl->Lock(capBuf, lastPos, lLockSize, &pbCaptureData, &dwCaptureLength, &pbCaptureData2, &dwCaptureLength2, 0L);
if (FAILED(hr))
{
_tprintf(_T("Failed to lock sound capture buffer\n"));
WLog_ERR(TAG, "Failed to lock sound capture buffer");
wf_rdpsnd_unlock();
break;
}
@ -169,7 +168,7 @@ DWORD WINAPI wf_rdpsnd_directsound_thread(LPVOID lpParam)
hr = capBuf->lpVtbl->Unlock(capBuf, pbCaptureData, dwCaptureLength, pbCaptureData2, dwCaptureLength2);
if (FAILED(hr))
{
_tprintf(_T("Failed to unlock sound capture buffer\n"));
WLog_ERR(TAG, "Failed to unlock sound capture buffer");
wf_rdpsnd_unlock();
return 0;
}
@ -186,13 +185,14 @@ DWORD WINAPI wf_rdpsnd_directsound_thread(LPVOID lpParam)
}
_tprintf(_T("Trying to stop sound capture\n"));
WLog_INFO(TAG, "Trying to stop sound capture");
hr = capBuf->lpVtbl->Stop(capBuf);
if (FAILED(hr))
{
_tprintf(_T("Failed to stop capture\n"));
WLog_ERR(TAG, "Failed to stop capture");
}
_tprintf(_T("Capture stopped\n"));
WLog_INFO(TAG, "Capture stopped");
capBuf->lpVtbl->Release(capBuf);
cap->lpVtbl->Release(cap);

View File

@ -33,6 +33,9 @@
#include <tchar.h>
#include "wf_dxgi.h"
#include <freerdp/log.h>
#define TAG SERVER_TAG("windows")
/* Driver types supported */
D3D_DRIVER_TYPE DriverTypes[] =
{
@ -94,12 +97,12 @@ int wf_dxgi_createDevice(wfInfo* wfi)
if (SUCCEEDED(status))
break;
_tprintf(_T("D3D11CreateDevice returned [%d] for Driver Type %d\n"), status, DriverTypes[DriverTypeIndex]);
WLog_INFO(TAG, "D3D11CreateDevice returned [%d] for Driver Type %d", status, DriverTypes[DriverTypeIndex]);
}
if (FAILED(status))
{
_tprintf(_T("Failed to create device in InitializeDx\n"));
WLog_ERR(TAG, "Failed to create device in InitializeDx");
return 1;
}
@ -121,7 +124,7 @@ int wf_dxgi_getDuplication(wfInfo* wfi)
if (FAILED(status))
{
_tprintf(_T("Failed to get QI for DXGI Device\n"));
WLog_ERR(TAG, "Failed to get QI for DXGI Device");
return 1;
}
@ -131,7 +134,7 @@ int wf_dxgi_getDuplication(wfInfo* wfi)
if (FAILED(status))
{
_tprintf(_T("Failed to get parent DXGI Adapter\n"));
WLog_ERR(TAG, "Failed to get parent DXGI Adapter");
return 1;
}
@ -146,11 +149,11 @@ int wf_dxgi_getDuplication(wfInfo* wfi)
if (FAILED(status))
{
_tprintf(_T("Failed to get description\n"));
WLog_ERR(TAG, "Failed to get description");
return 1;
}
_tprintf(_T("Output %d: [%s] [%d]\n"), i, pDesc->DeviceName, pDesc->AttachedToDesktop);
WLog_INFO(TAG, "Output %d: [%s] [%d]", i, pDesc->DeviceName, pDesc->AttachedToDesktop);
if (pDesc->AttachedToDesktop)
dTop = i;
@ -167,7 +170,7 @@ int wf_dxgi_getDuplication(wfInfo* wfi)
if (FAILED(status))
{
_tprintf(_T("Failed to get output\n"));
WLog_ERR(TAG, "Failed to get output");
return 1;
}
@ -177,7 +180,7 @@ int wf_dxgi_getDuplication(wfInfo* wfi)
if (FAILED(status))
{
_tprintf(_T("Failed to get IDXGIOutput1\n"));
WLog_ERR(TAG, "Failed to get IDXGIOutput1");
return 1;
}
@ -189,11 +192,11 @@ int wf_dxgi_getDuplication(wfInfo* wfi)
{
if (status == DXGI_ERROR_NOT_CURRENTLY_AVAILABLE)
{
_tprintf(_T("There is already the maximum number of applications using the Desktop Duplication API running, please close one of those applications and then try again.\n"));
WLog_ERR(TAG, "There is already the maximum number of applications using the Desktop Duplication API running, please close one of those applications and then try again."));
return 1;
}
_tprintf(_T("Failed to get duplicate output. Status = %#X\n"), status);
WLog_ERR(TAG, "Failed to get duplicate output. Status = %#X", status);
return 1;
}
@ -265,8 +268,9 @@ int wf_dxgi_nextFrame(wfInfo* wfi, UINT timeout)
{
if (status == DXGI_ERROR_ACCESS_LOST)
{
_tprintf(_T("Failed to acquire next frame with status=%#X\n"), status);
_tprintf(_T("Trying to reinitialize due to ACCESS LOST..."));
WLog_ERR(TAG, "Failed to acquire next frame with status=%#X", status);
WLog_ERR(TAG, "Trying to reinitialize due to ACCESS LOST...");
if (gAcquiredDesktopImage)
{
gAcquiredDesktopImage->lpVtbl->Release(gAcquiredDesktopImage);
@ -285,13 +289,12 @@ int wf_dxgi_nextFrame(wfInfo* wfi, UINT timeout)
}
else
{
_tprintf(_T("Failed to acquire next frame with status=%#X\n"), status);
WLog_ERR(TAG, "Failed to acquire next frame with status=%#X", status);
status = gOutputDuplication->lpVtbl->ReleaseFrame(gOutputDuplication);
if (FAILED(status))
{
_tprintf(_T("Failed to release frame with status=%d\n"), status);
WLog_ERR(TAG, "Failed to release frame with status=%d", status);
}
return 1;
@ -315,7 +318,7 @@ int wf_dxgi_nextFrame(wfInfo* wfi, UINT timeout)
if (FAILED(status))
{
_tprintf(_T("Failed to release frame with status=%d\n"), status);
WLog_ERR(TAG, "Failed to release frame with status=%d", status);
}
}
@ -352,7 +355,7 @@ int wf_dxgi_getPixelData(wfInfo* wfi, BYTE** data, int* pitch, RECT* invalid)
if (FAILED(status))
{
_tprintf(_T("Failed to create staging surface\n"));
WLog_ERR(TAG, "Failed to create staging surface");
exit(1);
return 1;
}
@ -363,7 +366,7 @@ int wf_dxgi_getPixelData(wfInfo* wfi, BYTE** data, int* pitch, RECT* invalid)
if (FAILED(status))
{
_tprintf(_T("Failed to QI staging surface\n"));
WLog_ERR(TAG, "Failed to QI staging surface");
exit(1);
return 1;
}
@ -372,7 +375,7 @@ int wf_dxgi_getPixelData(wfInfo* wfi, BYTE** data, int* pitch, RECT* invalid)
if (FAILED(status))
{
_tprintf(_T("Failed to map staging surface\n"));
WLog_ERR(TAG, "Failed to map staging surface");
exit(1);
return 1;
}
@ -397,7 +400,7 @@ int wf_dxgi_releasePixelData(wfInfo* wfi)
if (FAILED(status))
{
_tprintf(_T("Failed to release frame\n"));
WLog_ERR(TAG, "Failed to release frame");
return 1;
}
@ -438,7 +441,7 @@ int wf_dxgi_getInvalidRegion(RECT* invalid)
if (!DataBuffer)
{
DataBufferSize = 0;
_tprintf(_T("Failed to allocate memory for metadata\n"));
WLog_ERR(TAG, "Failed to allocate memory for metadata");
exit(1);
}
@ -451,7 +454,7 @@ int wf_dxgi_getInvalidRegion(RECT* invalid)
if (FAILED(status))
{
_tprintf(_T("Failed to get frame move rects\n"));
WLog_ERR(TAG, "Failed to get frame move rects");
return 1;
}
@ -462,7 +465,7 @@ int wf_dxgi_getInvalidRegion(RECT* invalid)
if (FAILED(status))
{
_tprintf(_T("Failed to get frame dirty rects\n"));
WLog_ERR(TAG, "Failed to get frame dirty rects");
return 1;
}
dirty = BufSize / sizeof(RECT);

View File

@ -31,6 +31,9 @@
#include "wf_mirage.h"
#include "wf_dxgi.h"
#include <freerdp/log.h>
#define TAG SERVER_TAG("windows")
static wfInfo* wfInfoInstance = NULL;
static int _IDcount = 0;
@ -52,7 +55,7 @@ int wf_info_lock(wfInfo* wfi)
break;
case WAIT_FAILED:
DEBUG_WARN("wf_info_lock failed with 0x%08X\n", GetLastError());
WLog_ERR(TAG, "wf_info_lock failed with 0x%08X", GetLastError());
return -1;
break;
}
@ -78,7 +81,7 @@ int wf_info_try_lock(wfInfo* wfi, DWORD dwMilliseconds)
break;
case WAIT_FAILED:
DEBUG_WARN("wf_info_try_lock failed with 0x%08X\n", GetLastError());
WLog_ERR(TAG, "wf_info_try_lock failed with 0x%08X", GetLastError());
return -1;
break;
}
@ -90,7 +93,7 @@ int wf_info_unlock(wfInfo* wfi)
{
if (ReleaseMutex(wfi->mutex) == 0)
{
DEBUG_WARN("wf_info_unlock failed with 0x%08X\n", GetLastError());
WLog_ERR(TAG, "wf_info_unlock failed with 0x%08X", GetLastError());
return -1;
}
@ -116,7 +119,7 @@ wfInfo* wf_info_init()
if (wfi->mutex == NULL)
{
_tprintf(_T("CreateMutex error: %d\n"), GetLastError());
WLog_ERR(TAG, "CreateMutex error: %d", GetLastError());
}
wfi->updateSemaphore = CreateSemaphore(NULL, 0, 32, NULL);
@ -125,7 +128,7 @@ wfInfo* wf_info_init()
if (!wfi->updateThread)
{
_tprintf(_T("Failed to create update thread\n"));
WLog_ERR(TAG, "Failed to create update thread");
}
wfi->peers = (freerdp_peer**) malloc(sizeof(freerdp_peer*) * WF_INFO_MAXPEERS);
@ -213,8 +216,7 @@ void wf_info_peer_register(wfInfo* wfi, wfPeerContext* context)
wfi->peers[peerId] = ((rdpContext*) context)->peer;
wfi->peers[peerId]->pId = peerId;
wfi->peerCount++;
DEBUG_WARN("Registering Peer: id=%d #=%d\n", peerId, wfi->peerCount);
WLog_INFO(TAG, "Registering Peer: id=%d #=%d", peerId, wfi->peerCount);
wf_info_unlock(wfi);
wfreerdp_server_peer_callback_event(peerId, WF_SRV_CALLBACK_EVENT_CONNECT);
@ -231,8 +233,7 @@ void wf_info_peer_unregister(wfInfo* wfi, wfPeerContext* context)
wfi->peers[peerId] = NULL;
wfi->peerCount--;
CloseHandle(context->updateEvent);
DEBUG_WARN("Unregistering Peer: id=%d, #=%d\n", peerId, wfi->peerCount);
WLog_INFO(TAG, "Unregistering Peer: id=%d, #=%d", peerId, wfi->peerCount);
#ifdef WITH_DXGI_1_2
if (wfi->peerCount == 0)
@ -310,7 +311,7 @@ void wf_info_find_invalid_region(wfInfo* wfi)
if (wfi->invalid.bottom >= wfi->servscreen_height)
wfi->invalid.bottom = wfi->servscreen_height - 1;
//printf("invalid region: (%d, %d), (%d, %d)\n", wfi->invalid.left, wfi->invalid.top, wfi->invalid.right, wfi->invalid.bottom);
//WLog_DBG(TAG, "invalid region: (%d, %d), (%d, %d)", wfi->invalid.left, wfi->invalid.top, wfi->invalid.right, wfi->invalid.bottom);
}
void wf_info_clear_invalid_region(wfInfo* wfi)

View File

@ -102,7 +102,7 @@ DWORD WINAPI wf_server_main_loop(LPVOID lpParam)
if (instance->GetFileDescriptor(instance, rfds, &rcount) != TRUE)
{
DEBUG_WARN("Failed to get FreeRDP file descriptor\n");
WLog_ERR(TAG, "Failed to get FreeRDP file descriptor");
break;
}
@ -127,13 +127,12 @@ DWORD WINAPI wf_server_main_loop(LPVOID lpParam)
if (instance->CheckFileDescriptor(instance) != TRUE)
{
DEBUG_WARN("Failed to check FreeRDP file descriptor\n");
WLog_ERR(TAG, "Failed to check FreeRDP file descriptor");
break;
}
}
DEBUG_WARN("wf_server_main_loop terminating\n");
WLog_INFO(TAG, "wf_server_main_loop terminating");
instance->Close(instance);
return 0;
@ -163,8 +162,7 @@ BOOL wfreerdp_server_stop(wfServer* server)
wfInfo* wfi;
wfi = wf_info_get_instance();
DEBUG_WARN("Stopping server\n");
WLog_INFO(TAG, "Stopping server");
wfi->force_all_disconnect = TRUE;
server->instance->Close(server->instance);
return TRUE;
@ -210,7 +208,7 @@ FREERDP_API BOOL wfreerdp_server_is_running(wfServer* server)
bRet = GetExitCodeThread(server->thread, &tStatus);
if (bRet == 0)
{
DEBUG_WARN("Error in call to GetExitCodeThread\n");
WLog_ERR(TAG, "Error in call to GetExitCodeThread");
return FALSE;
}
@ -245,7 +243,7 @@ FREERDP_API UINT32 wfreerdp_server_get_peer_hostname(int pId, wchar_t * dstStr)
}
else
{
DEBUG_WARN("nonexistent peer id=%d\n", pId);
WLog_WARN(TAG, "nonexistent peer id=%d", pId);
return 0;
}
}

View File

@ -29,7 +29,6 @@
#include <freerdp/freerdp.h>
#include <freerdp/codec/rfx.h>
#include <freerdp/utils/debug.h>
#include <freerdp/server/rdpsnd.h>

View File

@ -92,9 +92,11 @@ BOOL wf_mirror_driver_display_device_attach(wfInfo* wfi, DWORD mode)
if (status != ERROR_SUCCESS)
{
DEBUG_WARN("Error opening RegKey: status=%0X\n", status);
WLog_DBG(TAG, "Error opening RegKey: status=%0X", status);
if (status == ERROR_ACCESS_DENIED)
DEBUG_WARN("access denied. Do you have admin privleges?\n");
WLog_DBG(TAG, "access denied. Do you have admin privleges?");
return FALSE;
}
@ -104,9 +106,11 @@ BOOL wf_mirror_driver_display_device_attach(wfInfo* wfi, DWORD mode)
if (status != ERROR_SUCCESS)
{
DEBUG_WARN("Error querying RegKey: status=%0X\n", status);
WLog_DBG(TAG, "Error querying RegKey: status=%0X", status);
if (status == ERROR_ACCESS_DENIED)
DEBUG_WARN("access denied. Do you have admin privleges?\n");
WLog_DBG(TAG, "access denied. Do you have admin privleges?");
return FALSE;
}
@ -120,10 +124,12 @@ BOOL wf_mirror_driver_display_device_attach(wfInfo* wfi, DWORD mode)
if (status != ERROR_SUCCESS)
{
DEBUG_WARN("Error writing registry key: %d ", status);
WLog_DBG(TAG, "Error writing registry key: %d ", status);
if (status == ERROR_ACCESS_DENIED)
DEBUG_WARN("access denied. Do you have admin privleges?");
DEBUG_WARN("\n");
WLog_DBG(TAG, "access denied. Do you have admin privleges?");
WLog_DBG(TAG, "");
return FALSE;
}
}
@ -175,9 +181,9 @@ void wf_mirror_driver_print_display_change_status(LONG status)
}
if (status != DISP_CHANGE_SUCCESSFUL)
_tprintf(_T("ChangeDisplaySettingsEx() failed with %s (%d)\n"), disp_change, status);
WLog_ERR(TAG, "ChangeDisplaySettingsEx() failed with %s (%d)", disp_change, status);
else
_tprintf(_T("ChangeDisplaySettingsEx() succeeded with %s (%d)\n"), disp_change, status);
WLog_INFO(TAG, "ChangeDisplaySettingsEx() succeeded with %s (%d)", disp_change, status);
}
/**
@ -199,7 +205,7 @@ BOOL wf_mirror_driver_update(wfInfo* wfi, int mode)
if ( (mode != MIRROR_LOAD) && (mode != MIRROR_UNLOAD) )
{
DEBUG_WARN("Invalid mirror mode!\n");
WLog_DBG(TAG, "Invalid mirror mode!");
return FALSE;
}
@ -249,8 +255,7 @@ BOOL wf_mirror_driver_map_memory(wfInfo* wfi)
if (wfi->driverDC == NULL)
{
_tprintf(_T("Could not create device driver context!\n"));
WLog_ERR(TAG, "Could not create device driver context!");
{
LPVOID lpMsgBuf;
DWORD dw = GetLastError();
@ -266,9 +271,7 @@ BOOL wf_mirror_driver_map_memory(wfInfo* wfi)
0, NULL );
// Display the error message and exit the process
_tprintf(_T("CreateDC failed on device [%s] with error %d: %s\n"), wfi->deviceName, dw, lpMsgBuf);
WLog_ERR(TAG, "CreateDC failed on device [%s] with error %d: %s", wfi->deviceName, dw, lpMsgBuf);
LocalFree(lpMsgBuf);
}
@ -282,7 +285,7 @@ BOOL wf_mirror_driver_map_memory(wfInfo* wfi)
if (status <= 0)
{
_tprintf(_T("Failed to map shared memory from the driver! code %d\n"), status);
WLog_ERR(TAG, "Failed to map shared memory from the driver! code %d", status);
return FALSE;
}
@ -299,7 +302,7 @@ BOOL wf_mirror_driver_cleanup(wfInfo* wfi)
if (status <= 0)
{
_tprintf(_T("Failed to unmap shared memory from the driver! code %d\n"), status);
WLog_ERR(TAG, "Failed to unmap shared memory from the driver! code %d", status);
}
if (wfi->driverDC != NULL)
@ -308,7 +311,7 @@ BOOL wf_mirror_driver_cleanup(wfInfo* wfi)
if (status == 0)
{
_tprintf(_T("Failed to release DC!\n"));
WLog_ERR(TAG, "Failed to release DC!"));
}
}
@ -321,29 +324,29 @@ BOOL wf_mirror_driver_activate(wfInfo* wfi)
{
if (!wfi->mirrorDriverActive)
{
DEBUG_WARN("Activating Mirror Driver\n");
WLog_DBG(TAG, "Activating Mirror Driver");
if (wf_mirror_driver_find_display_device(wfi) == FALSE)
{
DEBUG_WARN("Could not find dfmirage mirror driver! Is it installed?\n");
WLog_DBG(TAG, "Could not find dfmirage mirror driver! Is it installed?");
return FALSE;
}
if (wf_mirror_driver_display_device_attach(wfi, 1) == FALSE)
{
DEBUG_WARN("Could not attach display device!\n");
WLog_DBG(TAG, "Could not attach display device!");
return FALSE;
}
if (wf_mirror_driver_update(wfi, MIRROR_LOAD) == FALSE)
{
DEBUG_WARN("could not update system with new display settings!\n");
WLog_DBG(TAG, "could not update system with new display settings!");
return FALSE;
}
if (wf_mirror_driver_map_memory(wfi) == FALSE)
{
DEBUG_WARN("Unable to map memory for mirror driver!\n");
WLog_DBG(TAG, "Unable to map memory for mirror driver!");
return FALSE;
}
wfi->mirrorDriverActive = TRUE;
@ -356,8 +359,7 @@ void wf_mirror_driver_deactivate(wfInfo* wfi)
{
if (wfi->mirrorDriverActive)
{
DEBUG_WARN("Deactivating Mirror Driver\n");
WLog_DBG(TAG, "Deactivating Mirror Driver");
wf_mirror_driver_cleanup(wfi);
wf_mirror_driver_display_device_attach(wfi, 0);
wf_mirror_driver_update(wfi, MIRROR_UNLOAD);

View File

@ -84,15 +84,15 @@ BOOL wf_peer_post_connect(freerdp_peer* client)
(wfi->servscreen_height == 0) ||
(wfi->bitsPerPixel == 0) )
{
_tprintf(_T("postconnect: error getting screen info for screen %d\n"), wfi->screenID);
_tprintf(_T("\t%dx%dx%d\n"), wfi->servscreen_height, wfi->servscreen_width, wfi->bitsPerPixel);
WLog_ERR(TAG, "postconnect: error getting screen info for screen %d", wfi->screenID);
WLog_ERR(TAG, "\t%dx%dx%d", wfi->servscreen_height, wfi->servscreen_width, wfi->bitsPerPixel);
return FALSE;
}
if ((settings->DesktopWidth != wfi->servscreen_width) || (settings->DesktopHeight != wfi->servscreen_height))
{
/*
DEBUG_WARN("Client requested resolution %dx%d, but will resize to %dx%d\n",
WLog_DBG(TAG, "Client requested resolution %dx%d, but will resize to %dx%d",
settings->DesktopWidth, settings->DesktopHeight, wfi->servscreen_width, wfi->servscreen_height);
*/
@ -160,7 +160,7 @@ DWORD WINAPI wf_peer_socket_listener(LPVOID lpParam)
if (client->GetFileDescriptor(client, rfds, &rcount) != TRUE)
{
//printf("Failed to get peer file descriptor\n");
WLog_ERR(TAG, "Failed to get peer file descriptor");
break;
}
@ -248,7 +248,7 @@ DWORD WINAPI wf_peer_main_loop(LPVOID lpParam)
if (wfi->input_disabled)
{
DEBUG_WARN("client input is disabled\n");
WLog_INFO(TAG, "client input is disabled");
client->input->KeyboardEvent = wf_peer_keyboard_event_dummy;
client->input->UnicodeKeyboardEvent = wf_peer_unicode_keyboard_event_dummy;
client->input->MouseEvent = wf_peer_mouse_event_dummy;
@ -259,9 +259,7 @@ DWORD WINAPI wf_peer_main_loop(LPVOID lpParam)
context->socketSemaphore = CreateSemaphore(NULL, 0, 1, NULL);
context->socketThread = CreateThread(NULL, 0, wf_peer_socket_listener, client, 0, NULL);
DEBUG_WARN("We've got a client %s\n", client->local ? "(local)" : client->hostname);
WLog_INFO(TAG, "We've got a client %s", client->local ? "(local)" : client->hostname);
nCount = 0;
handles[nCount++] = context->updateEvent;
handles[nCount++] = context->socketEvent;
@ -272,7 +270,7 @@ DWORD WINAPI wf_peer_main_loop(LPVOID lpParam)
if ((status == WAIT_FAILED) || (status == WAIT_TIMEOUT))
{
DEBUG_WARN("WaitForMultipleObjects failed\n");
WLog_ERR(TAG, "WaitForMultipleObjects failed");
break;
}
@ -289,7 +287,7 @@ DWORD WINAPI wf_peer_main_loop(LPVOID lpParam)
{
if (client->CheckFileDescriptor(client) != TRUE)
{
//printf("Failed to check peer file descriptor\n");
WLog_ERR(TAG, "Failed to check peer file descriptor");
context->socketClose = TRUE;
}
@ -303,7 +301,7 @@ DWORD WINAPI wf_peer_main_loop(LPVOID lpParam)
//force disconnect
if (wfi->force_all_disconnect == TRUE)
{
DEBUG_WARN("Forcing Disconnect -> ");
WLog_INFO(TAG, "Forcing Disconnect -> ");
break;
}
@ -312,7 +310,7 @@ DWORD WINAPI wf_peer_main_loop(LPVOID lpParam)
break;
}
DEBUG_WARN("Client %s disconnected.\n", client->local ? "(local)" : client->hostname);
WLog_INFO(TAG, "Client %s disconnected.", client->local ? "(local)" : client->hostname);
if (WaitForSingleObject(context->updateEvent, 0) == 0)
{

View File

@ -54,7 +54,8 @@ static void wf_peer_rdpsnd_activated(RdpsndServerContext* context)
wfi = wf_info_get_instance();
wfi->agreed_format = NULL;
DEBUG_WARN("Client supports the following %d formats: \n", context->num_client_formats);
WLog_DBG(TAG, "Client supports the following %d formats:", context->num_client_formats);
for (i = 0; i < context->num_client_formats; i++)
{
//TODO: improve the way we agree on a format
@ -64,7 +65,7 @@ static void wf_peer_rdpsnd_activated(RdpsndServerContext* context)
(context->client_formats[i].nChannels == context->server_formats[j].nChannels) &&
(context->client_formats[i].nSamplesPerSec == context->server_formats[j].nSamplesPerSec))
{
DEBUG_WARN("agreed on format!\n");
WLog_DBG(TAG, "agreed on format!");
wfi->agreed_format = (AUDIO_FORMAT*) &context->server_formats[j];
break;
}
@ -76,7 +77,7 @@ static void wf_peer_rdpsnd_activated(RdpsndServerContext* context)
if (wfi->agreed_format == NULL)
{
DEBUG_WARN("Could not agree on a audio format with the server\n");
WLog_ERR(TAG, "Could not agree on a audio format with the server");
return;
}
@ -116,7 +117,7 @@ int wf_rdpsnd_lock()
break;
case WAIT_FAILED:
DEBUG_WARN("wf_rdpsnd_lock failed with 0x%08X\n", GetLastError());
WLog_ERR(TAG, "wf_rdpsnd_lock failed with 0x%08X", GetLastError());
return -1;
break;
}
@ -132,7 +133,7 @@ int wf_rdpsnd_unlock()
if (ReleaseMutex(wfi->snd_mutex) == 0)
{
DEBUG_WARN("wf_rdpsnd_unlock failed with 0x%08X\n", GetLastError());
WLog_DBG(TAG, "wf_rdpsnd_unlock failed with 0x%08X", GetLastError());
return -1;
}

View File

@ -62,8 +62,7 @@ DWORD WINAPI wf_update_thread(LPVOID lpParam)
if (wf_info_have_updates(wfi))
{
wf_update_encode(wfi);
//printf("Start of parallel sending\n");
//WLog_DBG(TAG, "Start of parallel sending");
index = 0;
for (peerindex = 0; peerindex < wfi->peerCount; peerindex++)
{
@ -71,7 +70,7 @@ DWORD WINAPI wf_update_thread(LPVOID lpParam)
{
if (wfi->peers[index] && wfi->peers[index]->activated)
{
//printf("Setting event for %d of %d\n", index + 1, wfi->activePeerCount);
//WLog_DBG(TAG, "Setting event for %d of %d", index + 1, wfi->activePeerCount);
SetEvent(((wfPeerContext*) wfi->peers[index]->context)->updateEvent);
}
}
@ -80,13 +79,12 @@ DWORD WINAPI wf_update_thread(LPVOID lpParam)
for (index = 0; index < wfi->activePeerCount; index++)
{
//printf("Waiting for %d of %d\n", index + 1, wfi->activePeerCount);
//WLog_DBG(TAG, "Waiting for %d of %d", index + 1, wfi->activePeerCount);
//WaitForSingleObject(wfi->updateSemaphore, INFINITE);
WaitForSingleObject(wfi->updateSemaphore, 1000);
}
//printf("End of parallel sending\n");
//WLog_DBG(TAG, "End of parallel sending");
wf_info_clear_invalid_region(wfi);
}
}
@ -103,8 +101,7 @@ DWORD WINAPI wf_update_thread(LPVOID lpParam)
}
}
//printf("Exiting Update Thread\n");
//WLog_DBG(TAG, "Exiting Update Thread");
return 0;
}
@ -129,9 +126,7 @@ void wf_update_encode(wfInfo* wfi)
rect.y = 0;
rect.width = (UINT16) width;
rect.height = (UINT16) height;
//printf("x:%d y:%d w:%d h:%d\n", wfi->invalid.left, wfi->invalid.top, width, height);
//WLog_DBG(TAG, "x:%d y:%d w:%d h:%d", wfi->invalid.left, wfi->invalid.top, width, height);
Stream_Clear(wfi->s);
rfx_compose_message(wfi->rfx_context, wfi->s, &rect, 1,
@ -175,8 +170,7 @@ void wf_update_peer_send(wfInfo* wfi, wfPeerContext* context)
return;
/* This is an unexpected error condition */
DEBUG_WARN("Unexpected Frame Index: Actual: %d Expected: %d\n",
WLog_DBG(TAG, "Unexpected Frame Index: Actual: %d Expected: %d",
wfi->frame_idx, context->frame_idx + 1);
}
@ -189,7 +183,7 @@ void wf_update_encoder_reset(wfInfo* wfi)
{
if (wf_info_lock(wfi) > 0)
{
DEBUG_WARN("Resetting encoder\n");
WLog_DBG(TAG, "Resetting encoder");
if (wfi->rfx_context)
{
@ -225,9 +219,7 @@ void wf_update_peer_activate(wfInfo* wfi, wfPeerContext* context)
wf_update_encoder_reset(wfi);
wfi->activePeerCount++;
DEBUG_WARN("Activating Peer Updates: %d\n", wfi->activePeerCount);
WLog_DBG(TAG, "Activating Peer Updates: %d", wfi->activePeerCount);
wf_info_unlock(wfi);
}
}
@ -247,8 +239,7 @@ void wf_update_peer_deactivate(wfInfo* wfi, wfPeerContext* context)
client->activated = FALSE;
wfi->activePeerCount--;
DEBUG_WARN("Deactivating Peer Updates: %d\n", wfi->activePeerCount);
WLog_DBG(TAG, "Deactivating Peer Updates: %d", wfi->activePeerCount);
}
wf_info_unlock(wfi);

View File

@ -41,12 +41,11 @@ int wf_wasapi_activate(RdpsndServerContext* context)
if (devStr == NULL)
{
_tprintf(_T("Failed to match for output device! Disabling rdpsnd.\n"));
WLog_ERR(TAG, "Failed to match for output device! Disabling rdpsnd.");
return 1;
}
DEBUG_WARN("RDPSND (WASAPI) Activated\n");
WLog_DBG(TAG, "RDPSND (WASAPI) Activated");
CreateThread(NULL, 0, wf_rdpsnd_wasapi_thread, latestPeer, 0, NULL);
return 0;
@ -66,23 +65,23 @@ int wf_wasapi_get_device_string(LPWSTR pattern, LPWSTR * deviceStr)
hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, &IID_IMMDeviceEnumerator, (void **) &pEnumerator);
if (FAILED(hr))
{
_tprintf(_T("Failed to cocreate device enumerator\n"));
WLog_ERR(TAG, "Failed to cocreate device enumerator");
exit(1);
}
hr = pEnumerator->lpVtbl->EnumAudioEndpoints(pEnumerator, eCapture, DEVICE_STATE_ACTIVE, &pCollection);
if ( FAILED(hr) )
{
_tprintf(_T("Failed to create endpoint collection\n"));
WLog_ERR(TAG, "Failed to create endpoint collection");
exit(1);
}
pCollection->lpVtbl->GetCount(pCollection, &count);
_tprintf(_T("Num endpoints: %d\n"), count);
WLog_INFO(TAG, "Num endpoints: %d", count);
if (count == 0)
{
_tprintf(_T("No endpoints!\n"));
WLog_ERR(TAG, "No endpoints!");
exit(1);
}
@ -94,28 +93,28 @@ int wf_wasapi_get_device_string(LPWSTR pattern, LPWSTR * deviceStr)
hr = pCollection->lpVtbl->Item(pCollection, i, &pEndpoint);
if ( FAILED(hr) )
{
_tprintf(_T("Failed to get endpoint %d\n"), i);
WLog_ERR(TAG, "Failed to get endpoint %d", i);
exit(1);
}
hr = pEndpoint->lpVtbl->GetId(pEndpoint, &pwszID);
if ( FAILED(hr) )
{
_tprintf(_T("Failed to get endpoint ID\n"));
WLog_ERR(TAG, "Failed to get endpoint ID");
exit(1);
}
hr = pEndpoint->lpVtbl->OpenPropertyStore(pEndpoint, STGM_READ, &pProps);
if ( FAILED(hr) )
{
_tprintf(_T("Failed to open property store\n"));
WLog_ERR(TAG, "Failed to open property store");
exit(1);
}
hr = pProps->lpVtbl->GetValue(pProps, &PKEY_Device_FriendlyName, &nameVar);
if ( FAILED(hr) )
{
_tprintf(_T("Failed to get device friendly name\n"));
WLog_ERR(TAG, "Failed to get device friendly name");
exit(1);
}
@ -123,9 +122,8 @@ int wf_wasapi_get_device_string(LPWSTR pattern, LPWSTR * deviceStr)
if (wcscmp(pattern, nameVar.pwszVal) < 0)
{
unsigned int devStrLen;
_tprintf(_T("Using sound ouput endpoint: [%s] (%s)\n"), nameVar.pwszVal, pwszID);
//_tprintf(_T("matched %d characters\n"), wcscmp(pattern, nameVar.pwszVal));
WLog_INFO(TAG, "Using sound ouput endpoint: [%s] (%s)", nameVar.pwszVal, pwszID);
//WLog_INFO(TAG, "matched %d characters", wcscmp(pattern, nameVar.pwszVal);
devStrLen = wcslen(pwszID);
*deviceStr = (LPWSTR) malloc((devStrLen * 2) + 2);
ZeroMemory(*deviceStr, (devStrLen * 2) + 2);
@ -179,28 +177,28 @@ DWORD WINAPI wf_rdpsnd_wasapi_thread(LPVOID lpParam)
hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, &IID_IMMDeviceEnumerator, (void **) &pEnumerator);
if (FAILED(hr))
{
_tprintf(_T("Failed to cocreate device enumerator\n"));
WLog_ERR(TAG, "Failed to cocreate device enumerator");
exit(1);
}
hr = pEnumerator->lpVtbl->GetDevice(pEnumerator, devStr, &pDevice);
if (FAILED(hr))
{
_tprintf(_T("Failed to cocreate get device\n"));
WLog_ERR(TAG, "Failed to cocreate get device");
exit(1);
}
hr = pDevice->lpVtbl->Activate(pDevice, &IID_IAudioClient, CLSCTX_ALL, NULL, (void **)&pAudioClient);
if (FAILED(hr))
{
_tprintf(_T("Failed to activate audio client\n"));
WLog_ERR(TAG, "Failed to activate audio client");
exit(1);
}
hr = pAudioClient->lpVtbl->GetMixFormat(pAudioClient, &pwfx);
if (FAILED(hr))
{
_tprintf(_T("Failed to get mix format\n"));
WLog_ERR(TAG, "Failed to get mix format");
exit(1);
}
@ -218,21 +216,21 @@ DWORD WINAPI wf_rdpsnd_wasapi_thread(LPVOID lpParam)
if (FAILED(hr))
{
_tprintf(_T("Failed to initialize the audio client\n"));
WLog_ERR(TAG, "Failed to initialize the audio client");
exit(1);
}
hr = pAudioClient->lpVtbl->GetBufferSize(pAudioClient, &bufferFrameCount);
if (FAILED(hr))
{
_tprintf(_T("Failed to get buffer size\n"));
WLog_ERR(TAG, "Failed to get buffer size");
exit(1);
}
hr = pAudioClient->lpVtbl->GetService(pAudioClient, &IID_IAudioCaptureClient, (void **) &pCaptureClient);
if (FAILED(hr))
{
_tprintf(_T("Failed to get the capture client\n"));
WLog_ERR(TAG, "Failed to get the capture client");
exit(1);
}
@ -241,11 +239,12 @@ DWORD WINAPI wf_rdpsnd_wasapi_thread(LPVOID lpParam)
hr = pAudioClient->lpVtbl->Start(pAudioClient);
if (FAILED(hr))
{
_tprintf(_T("Failed to start capture\n"));
WLog_ERR(TAG, "Failed to start capture");
exit(1);
}
dCount = 0;
while (wfi->snd_stop == FALSE)
{
DWORD flags;
@ -255,7 +254,7 @@ DWORD WINAPI wf_rdpsnd_wasapi_thread(LPVOID lpParam)
hr = pCaptureClient->lpVtbl->GetNextPacketSize(pCaptureClient, &packetLength);
if (FAILED(hr))
{
_tprintf(_T("Failed to get packet length\n"));
WLog_ERR(TAG, "Failed to get packet length");
exit(1);
}
@ -264,7 +263,7 @@ DWORD WINAPI wf_rdpsnd_wasapi_thread(LPVOID lpParam)
hr = pCaptureClient->lpVtbl->GetBuffer(pCaptureClient, &pData, &numFramesAvailable, &flags, NULL, NULL);
if (FAILED(hr))
{
_tprintf(_T("Failed to get buffer\n"));
WLog_ERR(TAG, "Failed to get buffer");
exit(1);
}
@ -276,14 +275,14 @@ DWORD WINAPI wf_rdpsnd_wasapi_thread(LPVOID lpParam)
hr = pCaptureClient->lpVtbl->ReleaseBuffer(pCaptureClient, numFramesAvailable);
if (FAILED(hr))
{
_tprintf(_T("Failed to release buffer\n"));
WLog_ERR(TAG, "Failed to release buffer");
exit(1);
}
hr = pCaptureClient->lpVtbl->GetNextPacketSize(pCaptureClient, &packetLength);
if (FAILED(hr))
{
_tprintf(_T("Failed to get packet length\n"));
WLog_ERR(TAG, "Failed to get packet length");
exit(1);
}
}
@ -292,7 +291,7 @@ DWORD WINAPI wf_rdpsnd_wasapi_thread(LPVOID lpParam)
pAudioClient->lpVtbl->Stop(pAudioClient);
if (FAILED(hr))
{
_tprintf(_T("Failed to stop audio client\n"));
WLog_ERR(TAG, "Failed to stop audio client");
exit(1);
}

View File

@ -22,9 +22,12 @@
#include <winpr/crt.h>
#include <winpr/print.h>
#include <freerdp/log.h>
#include "win_dxgi.h"
#define TAG SERVER_TAG("shadow.win")
#ifdef WITH_DXGI_1_2
static D3D_DRIVER_TYPE DriverTypes[] =
@ -247,7 +250,7 @@ int win_shadow_dxgi_init_duplication(winShadowSubsystem* subsystem)
if (FAILED(hr))
{
fprintf(stderr, "ID3D11Device::QueryInterface(IDXGIDevice) failure: %s (0x%04X)\n",
WLog_ERR(TAG, "ID3D11Device::QueryInterface(IDXGIDevice) failure: %s (0x%04X)",
GetDxgiErrorString(hr), hr);
return -1;
}
@ -262,7 +265,7 @@ int win_shadow_dxgi_init_duplication(winShadowSubsystem* subsystem)
if (FAILED(hr))
{
fprintf(stderr, "IDXGIDevice::GetParent(IDXGIAdapter) failure: %s (0x%04X)\n",
WLog_ERR(TAG, "IDXGIDevice::GetParent(IDXGIAdapter) failure: %s (0x%04X)",
GetDxgiErrorString(hr), hr);
return -1;
}
@ -278,7 +281,7 @@ int win_shadow_dxgi_init_duplication(winShadowSubsystem* subsystem)
if (FAILED(hr))
{
fprintf(stderr, "IDXGIOutput::GetDesc failure: %s (0x%04X)\n",
WLog_ERR(TAG, "IDXGIOutput::GetDesc failure: %s (0x%04X)",
GetDxgiErrorString(hr), hr);
return -1;
}
@ -302,7 +305,7 @@ int win_shadow_dxgi_init_duplication(winShadowSubsystem* subsystem)
if (FAILED(hr))
{
fprintf(stderr, "IDXGIAdapter::EnumOutputs failure: %s (0x%04X)\n",
WLog_ERR(TAG, "IDXGIAdapter::EnumOutputs failure: %s (0x%04X)",
GetDxgiErrorString(hr), hr);
return -1;
}
@ -317,7 +320,7 @@ int win_shadow_dxgi_init_duplication(winShadowSubsystem* subsystem)
if (FAILED(hr))
{
fprintf(stderr, "IDXGIOutput::QueryInterface(IDXGIOutput1) failure: %s (0x%04X)\n",
WLog_ERR(TAG, "IDXGIOutput::QueryInterface(IDXGIOutput1) failure: %s (0x%04X)",
GetDxgiErrorString(hr), hr);
return -1;
}
@ -333,7 +336,7 @@ int win_shadow_dxgi_init_duplication(winShadowSubsystem* subsystem)
if (FAILED(hr))
{
fprintf(stderr, "IDXGIOutput1::DuplicateOutput failure: %s (0x%04X)\n",
WLog_ERR(TAG, "IDXGIOutput1::DuplicateOutput failure: %s (0x%04X)",
GetDxgiErrorString(hr), hr);
return -1;
}
@ -355,7 +358,7 @@ int win_shadow_dxgi_init_duplication(winShadowSubsystem* subsystem)
if (FAILED(hr))
{
fprintf(stderr, "ID3D11Device::CreateTexture2D failure: %s (0x%04X)\n",
WLog_ERR(TAG, "ID3D11Device::CreateTexture2D failure: %s (0x%04X)",
GetDxgiErrorString(hr), hr);
return -1;
}
@ -391,7 +394,7 @@ int win_shadow_dxgi_init(winShadowSubsystem* subsystem)
if (FAILED(hr))
{
fprintf(stderr, "D3D11CreateDevice failure: 0x%04X\n", hr);
WLog_ERR(TAG, "D3D11CreateDevice failure: 0x%04X", hr);
return -1;
}
@ -461,7 +464,7 @@ int win_shadow_dxgi_fetch_frame_data(winShadowSubsystem* subsystem,
if (FAILED(hr))
{
fprintf(stderr, "ID3D11Texture2D::QueryInterface(IDXGISurface) failure: %s 0x%04X\n",
WLog_ERR(TAG, "ID3D11Texture2D::QueryInterface(IDXGISurface) failure: %s 0x%04X",
GetDxgiErrorString(hr), hr);
return -1;
}
@ -470,7 +473,7 @@ int win_shadow_dxgi_fetch_frame_data(winShadowSubsystem* subsystem,
if (FAILED(hr))
{
fprintf(stderr, "IDXGISurface::Map failure: %s 0x%04X\n",
WLog_ERR(TAG, "IDXGISurface::Map failure: %s 0x%04X",
GetDxgiErrorString(hr), hr);
if (hr == DXGI_ERROR_DEVICE_REMOVED)
@ -558,7 +561,7 @@ int win_shadow_dxgi_get_next_frame(winShadowSubsystem* subsystem)
if (FAILED(hr))
{
fprintf(stderr, "IDXGIOutputDuplication::AcquireNextFrame failure: %s (0x%04X)\n",
WLog_ERR(TAG, "IDXGIOutputDuplication::AcquireNextFrame failure: %s (0x%04X)",
GetDxgiErrorString(hr), hr);
if (hr == DXGI_ERROR_ACCESS_LOST)
@ -610,7 +613,7 @@ int win_shadow_dxgi_get_next_frame(winShadowSubsystem* subsystem)
if (FAILED(hr))
{
fprintf(stderr, "IDXGIResource::QueryInterface(ID3D11Texture2D) failure: %s (0x%04X)\n",
WLog_ERR(TAG, "IDXGIResource::QueryInterface(ID3D11Texture2D) failure: %s (0x%04X)",
GetDxgiErrorString(hr), hr);
return -1;
}
@ -666,7 +669,7 @@ int win_shadow_dxgi_get_invalid_region(winShadowSubsystem* subsystem)
if (FAILED(hr))
{
fprintf(stderr, "IDXGIOutputDuplication::GetFrameMoveRects failure: %s (0x%04X) Size: %d Total %d Used: %d\n",
WLog_ERR(TAG, "IDXGIOutputDuplication::GetFrameMoveRects failure: %s (0x%04X) Size: %d Total %d Used: %d",
GetDxgiErrorString(hr), hr, MoveRectsBufferSize, MetadataBufferSize, UsedBufferSize);
return -1;
}
@ -683,7 +686,7 @@ int win_shadow_dxgi_get_invalid_region(winShadowSubsystem* subsystem)
if (FAILED(hr))
{
fprintf(stderr, "IDXGIOutputDuplication::GetFrameDirtyRects failure: %s (0x%04X) Size: %d Total %d Used: %d\n",
WLog_ERR(TAG, "IDXGIOutputDuplication::GetFrameDirtyRects failure: %s (0x%04X) Size: %d Total %d Used: %d",
GetDxgiErrorString(hr), hr, DirtyRectsBufferSize, MetadataBufferSize, UsedBufferSize);
return -1;
}

View File

@ -22,21 +22,24 @@
#include <winpr/crt.h>
#include <winpr/print.h>
#include <freerdp/log.h>
#include "win_rdp.h"
#define TAG SERVER_TAG("shadow.win")
void shw_OnChannelConnectedEventHandler(rdpContext* context, ChannelConnectedEventArgs* e)
{
shwContext* shw = (shwContext*) context;
printf("OnChannelConnected: %s\n", e->name);
WLog_INFO(TAG, "OnChannelConnected: %s", e->name);
}
void shw_OnChannelDisconnectedEventHandler(rdpContext* context, ChannelDisconnectedEventArgs* e)
{
shwContext* shw = (shwContext*) context;
printf("OnChannelDisconnected: %s\n", e->name);
WLog_INFO(TAG, "OnChannelDisconnected: %s", e->name);
}
void shw_begin_paint(rdpContext* context)
@ -106,7 +109,7 @@ int shw_verify_x509_certificate(freerdp* instance, BYTE* data, int length, const
void shw_OnConnectionResultEventHandler(rdpContext* context, ConnectionResultEventArgs* e)
{
shwContext* shw = (shwContext*) context;
printf("OnConnectionResult: %d\n", e->result);
WLog_INFO(TAG, "OnConnectionResult: %d", e->result);
}
BOOL shw_pre_connect(freerdp* instance)
@ -177,7 +180,7 @@ void* shw_client_thread(void* arg)
bSuccess = freerdp_connect(instance);
printf("freerdp_connect: %d\n", bSuccess);
WLog_INFO(TAG, "freerdp_connect: %d", bSuccess);
if (!bSuccess)
{
@ -194,13 +197,13 @@ void* shw_client_thread(void* arg)
if (!freerdp_get_fds(instance, rfds, &rcount, wfds, &wcount))
{
fprintf(stderr, "Failed to get FreeRDP file descriptor\n");
WLog_ERR(TAG, "Failed to get FreeRDP file descriptor");
break;
}
if (!freerdp_channels_get_fds(channels, instance, rfds, &rcount, wfds, &wcount))
{
fprintf(stderr, "Failed to get channels file descriptor\n");
WLog_ERR(TAG, "Failed to get channels file descriptor");
break;
}
@ -214,13 +217,13 @@ void* shw_client_thread(void* arg)
if (MsgWaitForMultipleObjects(fds_count, fds, FALSE, 1000, QS_ALLINPUT) == WAIT_FAILED)
{
fprintf(stderr, "MsgWaitForMultipleObjects failure: 0x%08X", GetLastError());
WLog_ERR(TAG, "MsgWaitForMultipleObjects failure: 0x%08X", GetLastError());
break;
}
if (!freerdp_check_fds(instance))
{
fprintf(stderr, "Failed to check FreeRDP file descriptor\n");
WLog_ERR(TAG, "Failed to check FreeRDP file descriptor");
break;
}
@ -231,7 +234,7 @@ void* shw_client_thread(void* arg)
if (!freerdp_channels_check_fds(channels, instance))
{
fprintf(stderr, "Failed to check channels file descriptor\n");
WLog_ERR(TAG, "Failed to check channels file descriptor");
break;
}
}

View File

@ -22,6 +22,7 @@
#include <freerdp/codec/color.h>
#include <freerdp/codec/region.h>
#include <freerdp/log.h>
#include "../shadow_screen.h"
#include "../shadow_surface.h"
@ -29,6 +30,8 @@
#include "win_shadow.h"
#define TAG SERVER_TAG("shadow.win")
void win_shadow_input_synchronize_event(winShadowSubsystem* subsystem, UINT32 flags)
{
@ -252,7 +255,7 @@ int win_shadow_surface_copy(winShadowSubsystem* subsystem)
height = surface->height;
}
printf("SurfaceCopy x: %d y: %d width: %d height: %d right: %d bottom: %d\n",
WLog_INFO(TAG, "SurfaceCopy x: %d y: %d width: %d height: %d right: %d bottom: %d",
x, y, width, height, x + width, y + height);
#if defined(WITH_WDS_API)
@ -441,7 +444,7 @@ int win_shadow_subsystem_init(winShadowSubsystem* subsystem)
subsystem->monitors[0].flags = 1;
}
printf("width: %d height: %d\n", subsystem->width, subsystem->height);
WLog_INFO(TAG, "width: %d height: %d", subsystem->width, subsystem->height);
return 1;
}

View File

@ -22,6 +22,7 @@
#include <winpr/crt.h>
#include <winpr/print.h>
#include <freerdp/log.h>
#include "win_rdp.h"
@ -46,6 +47,8 @@
#include <initguid.h>
#define TAG SERVER_TAG("shadow.win")
DEFINE_GUID(CLSID_RDPSession,0x9B78F0E6,0x3E05,0x4A5B,0xB2,0xE8,0xE7,0x43,0xA8,0x95,0x6B,0x65);
DEFINE_GUID(DIID__IRDPSessionEvents,0x98a97042,0x6698,0x40e9,0x8e,0xfd,0xb3,0x20,0x09,0x90,0x00,0x4b);
DEFINE_GUID(IID_IRDPSRAPISharingSession,0xeeb20886,0xe470,0x4cf6,0x84,0x2b,0x27,0x39,0xc0,0xec,0x5c,0xfb);
@ -213,7 +216,7 @@ static HRESULT STDMETHODCALLTYPE Shadow_IRDPSessionEvents_GetTypeInfoCount(
__RPC__in _IRDPSessionEvents * This,
/* [out] */ __RPC__out UINT *pctinfo)
{
printf("Shadow_IRDPSessionEvents_GetTypeInfoCount\n");
WLog_INFO(TAG, "Shadow_IRDPSessionEvents_GetTypeInfoCount");
*pctinfo = 1;
return S_OK;
}
@ -224,7 +227,7 @@ static HRESULT STDMETHODCALLTYPE Shadow_IRDPSessionEvents_GetTypeInfo(
/* [in] */ LCID lcid,
/* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo)
{
printf("Shadow_IRDPSessionEvents_GetTypeInfo\n");
WLog_INFO(TAG, "Shadow_IRDPSessionEvents_GetTypeInfo");
return E_NOTIMPL;
}
@ -236,7 +239,7 @@ static HRESULT STDMETHODCALLTYPE Shadow_IRDPSessionEvents_GetIDsOfNames(
/* [in] */ LCID lcid,
/* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId)
{
printf("Shadow_IRDPSessionEvents_GetIDsOfNames\n");
WLog_INFO(TAG, "Shadow_IRDPSessionEvents_GetIDsOfNames");
return E_NOTIMPL;
}
@ -263,7 +266,7 @@ static HRESULT STDMETHODCALLTYPE Shadow_IRDPSessionEvents_Invoke(
VARIANT vr;
UINT uArgErr;
printf("%s (%d)\n", GetRDPSessionEventString(dispIdMember), dispIdMember);
WLog_INFO(TAG, "%s (%d)", GetRDPSessionEventString(dispIdMember), dispIdMember);
switch (dispIdMember)
{
@ -280,7 +283,7 @@ static HRESULT STDMETHODCALLTYPE Shadow_IRDPSessionEvents_Invoke(
if (FAILED(hr))
{
printf("%s DispGetParam(0, VT_DISPATCH) failure: 0x%08X\n",
WLog_INFO(TAG, "%s DispGetParam(0, VT_DISPATCH) failure: 0x%08X",
GetRDPSessionEventString(dispIdMember), hr);
return hr;
}
@ -291,7 +294,7 @@ static HRESULT STDMETHODCALLTYPE Shadow_IRDPSessionEvents_Invoke(
if (FAILED(hr))
{
printf("%s IDispatch::QueryInterface(IRDPSRAPIAttendee) failure: 0x%08X\n",
WLog_INFO(TAG, "%s IDispatch::QueryInterface(IRDPSRAPIAttendee) failure: 0x%08X",
GetRDPSessionEventString(dispIdMember), hr);
return hr;
}
@ -303,7 +306,7 @@ static HRESULT STDMETHODCALLTYPE Shadow_IRDPSessionEvents_Invoke(
if (FAILED(hr))
{
printf("%s IRDPSRAPIAttendee::put_ControlLevel() failure: 0x%08X\n",
WLog_INFO(TAG, "%s IRDPSRAPIAttendee::put_ControlLevel() failure: 0x%08X",
GetRDPSessionEventString(dispIdMember), hr);
return hr;
}
@ -346,7 +349,7 @@ static HRESULT STDMETHODCALLTYPE Shadow_IRDPSessionEvents_Invoke(
if (FAILED(hr))
{
printf("%s DispGetParam(1, VT_INT) failure: 0x%08X\n",
WLog_INFO(TAG, "%s DispGetParam(1, VT_INT) failure: 0x%08X",
GetRDPSessionEventString(dispIdMember), hr);
return hr;
}
@ -360,7 +363,7 @@ static HRESULT STDMETHODCALLTYPE Shadow_IRDPSessionEvents_Invoke(
if (FAILED(hr))
{
printf("%s DispGetParam(0, VT_DISPATCH) failure: 0x%08X\n",
WLog_INFO(TAG, "%s DispGetParam(0, VT_DISPATCH) failure: 0x%08X",
GetRDPSessionEventString(dispIdMember), hr);
return hr;
}
@ -371,7 +374,7 @@ static HRESULT STDMETHODCALLTYPE Shadow_IRDPSessionEvents_Invoke(
if (FAILED(hr))
{
printf("%s IDispatch::QueryInterface(IRDPSRAPIAttendee) failure: 0x%08X\n",
WLog_INFO(TAG, "%s IDispatch::QueryInterface(IRDPSRAPIAttendee) failure: 0x%08X",
GetRDPSessionEventString(dispIdMember), hr);
return hr;
}
@ -380,7 +383,7 @@ static HRESULT STDMETHODCALLTYPE Shadow_IRDPSessionEvents_Invoke(
if (FAILED(hr))
{
printf("%s IRDPSRAPIAttendee::put_ControlLevel() failure: 0x%08X\n",
WLog_INFO(TAG, "%s IRDPSRAPIAttendee::put_ControlLevel() failure: 0x%08X",
GetRDPSessionEventString(dispIdMember), hr);
return hr;
}
@ -507,7 +510,7 @@ int win_shadow_wds_wnd_init(winShadowSubsystem* subsystem)
if (!RegisterClassEx(&wndClassEx))
{
printf("RegisterClassEx failure\n");
WLog_INFO(TAG, "RegisterClassEx failure");
return -1;
}
@ -518,7 +521,7 @@ int win_shadow_wds_wnd_init(winShadowSubsystem* subsystem)
if (!subsystem->hWnd)
{
printf("CreateWindowEx failure\n");
WLog_INFO(TAG, "CreateWindowEx failure");
return -1;
}
@ -551,7 +554,7 @@ int win_shadow_wds_init(winShadowSubsystem* subsystem)
if (FAILED(hr))
{
fprintf(stderr, "OleInitialize() failure\n");
WLog_ERR(TAG, "OleInitialize() failure");
return -1;
}
@ -559,7 +562,7 @@ int win_shadow_wds_init(winShadowSubsystem* subsystem)
if (FAILED(hr))
{
fprintf(stderr, "CoInitialize() failure\n");
WLog_ERR(TAG, "CoInitialize() failure");
return -1;
}
@ -568,7 +571,7 @@ int win_shadow_wds_init(winShadowSubsystem* subsystem)
if (FAILED(hr))
{
fprintf(stderr, "CoCreateInstance(IRDPSRAPISharingSession) failure: 0x%08X\n", hr);
WLog_ERR(TAG, "CoCreateInstance(IRDPSRAPISharingSession) failure: 0x%08X", hr);
return -1;
}
@ -577,7 +580,7 @@ int win_shadow_wds_init(winShadowSubsystem* subsystem)
if (FAILED(hr))
{
fprintf(stderr, "QueryInterface(IID_IConnectionPointContainer) failure: 0x%08X\n", hr);
WLog_ERR(TAG, "QueryInterface(IID_IConnectionPointContainer) failure: 0x%08X", hr);
return -1;
}
@ -585,7 +588,7 @@ int win_shadow_wds_init(winShadowSubsystem* subsystem)
if (FAILED(hr))
{
fprintf(stderr, "IConnectionPointContainer::FindConnectionPoint(_IRDPSessionEvents) failure: 0x%08X\n", hr);
WLog_ERR(TAG, "IConnectionPointContainer::FindConnectionPoint(_IRDPSessionEvents) failure: 0x%08X", hr);
return -1;
}
@ -597,7 +600,7 @@ int win_shadow_wds_init(winShadowSubsystem* subsystem)
if (FAILED(hr))
{
fprintf(stderr, "IConnectionPoint::Advise(Shadow_IRDPSessionEvents) failure: 0x%08X\n", hr);
WLog_ERR(TAG, "IConnectionPoint::Advise(Shadow_IRDPSessionEvents) failure: 0x%08X", hr);
return -1;
}
@ -605,7 +608,7 @@ int win_shadow_wds_init(winShadowSubsystem* subsystem)
if (FAILED(hr))
{
fprintf(stderr, "IRDPSRAPISharingSession::put_ColorDepth() failure: 0x%08X\n", hr);
WLog_ERR(TAG, "IRDPSRAPISharingSession::put_ColorDepth() failure: 0x%08X", hr);
return -1;
}
@ -614,14 +617,14 @@ int win_shadow_wds_init(winShadowSubsystem* subsystem)
if (FAILED(hr))
{
fprintf(stderr, "IRDPSRAPISharingSession::GetDesktopSharedRect() failure: 0x%08X\n", hr);
WLog_ERR(TAG, "IRDPSRAPISharingSession::GetDesktopSharedRect() failure: 0x%08X", hr);
return -1;
}
width = right - left;
height = bottom - top;
printf("GetDesktopSharedRect(): left: %d top: %d right: %d bottom: %d width: %d height: %d\n",
WLog_INFO(TAG, "GetDesktopSharedRect(): left: %d top: %d right: %d bottom: %d width: %d height: %d",
left, top, right, bottom, width, height);
hr = subsystem->pSharingSession->lpVtbl->get_VirtualChannelManager(subsystem->pSharingSession,
@ -629,7 +632,7 @@ int win_shadow_wds_init(winShadowSubsystem* subsystem)
if (FAILED(hr))
{
fprintf(stderr, "IRDPSRAPISharingSession::get_VirtualChannelManager() failure: 0x%08X\n", hr);
WLog_ERR(TAG, "IRDPSRAPISharingSession::get_VirtualChannelManager() failure: 0x%08X", hr);
return -1;
}
@ -638,7 +641,7 @@ int win_shadow_wds_init(winShadowSubsystem* subsystem)
if (FAILED(hr))
{
fprintf(stderr, "IRDPSRAPISharingSession::get_ApplicationFilter() failure: 0x%08X\n", hr);
WLog_ERR(TAG, "IRDPSRAPISharingSession::get_ApplicationFilter() failure: 0x%08X", hr);
return -1;
}
@ -647,7 +650,7 @@ int win_shadow_wds_init(winShadowSubsystem* subsystem)
if (FAILED(hr))
{
fprintf(stderr, "IRDPSRAPISharingSession::get_Attendees() failure: 0x%08X\n", hr);
WLog_ERR(TAG, "IRDPSRAPISharingSession::get_Attendees() failure: 0x%08X", hr);
return -1;
}
@ -655,7 +658,7 @@ int win_shadow_wds_init(winShadowSubsystem* subsystem)
if (FAILED(hr))
{
fprintf(stderr, "IRDPSRAPISharingSession::get_Properties() failure: 0x%08X\n", hr);
WLog_ERR(TAG, "IRDPSRAPISharingSession::get_Properties() failure: 0x%08X", hr);
return -1;
}
@ -670,7 +673,7 @@ int win_shadow_wds_init(winShadowSubsystem* subsystem)
if (FAILED(hr))
{
fprintf(stderr, "IRDPSRAPISessionProperties::put_Property(PortId) failure: 0x%08X\n", hr);
WLog_ERR(TAG, "IRDPSRAPISessionProperties::put_Property(PortId) failure: 0x%08X", hr);
return -1;
}
@ -685,7 +688,7 @@ int win_shadow_wds_init(winShadowSubsystem* subsystem)
if (FAILED(hr))
{
fprintf(stderr, "IRDPSRAPISessionProperties::put_Property(DrvConAttach) failure: 0x%08X\n", hr);
WLog_ERR(TAG, "IRDPSRAPISessionProperties::put_Property(DrvConAttach) failure: 0x%08X", hr);
return -1;
}
@ -703,7 +706,7 @@ int win_shadow_wds_init(winShadowSubsystem* subsystem)
if (FAILED(hr))
{
fprintf(stderr, "IRDPSRAPISessionProperties::put_Property(PortProtocol) failure: 0x%08X\n", hr);
WLog_ERR(TAG, "IRDPSRAPISessionProperties::put_Property(PortProtocol) failure: 0x%08X", hr);
return -1;
}
@ -711,7 +714,7 @@ int win_shadow_wds_init(winShadowSubsystem* subsystem)
if (FAILED(hr))
{
fprintf(stderr, "IRDPSRAPISharingSession::Open() failure: 0x%08X\n", hr);
WLog_ERR(TAG, "IRDPSRAPISharingSession::Open() failure: 0x%08X", hr);
return -1;
}
@ -720,7 +723,7 @@ int win_shadow_wds_init(winShadowSubsystem* subsystem)
if (FAILED(hr))
{
fprintf(stderr, "IRDPSRAPISharingSession::get_Invitations() failure\n");
WLog_ERR(TAG, "IRDPSRAPISharingSession::get_Invitations() failure");
return -1;
}
@ -737,7 +740,7 @@ int win_shadow_wds_init(winShadowSubsystem* subsystem)
if (FAILED(hr))
{
fprintf(stderr, "IRDPSRAPIInvitationManager::CreateInvitation() failure: 0x%08X\n", hr);
WLog_ERR(TAG, "IRDPSRAPIInvitationManager::CreateInvitation() failure: 0x%08X", hr);
return -1;
}
@ -745,7 +748,7 @@ int win_shadow_wds_init(winShadowSubsystem* subsystem)
if (FAILED(hr))
{
fprintf(stderr, "IRDPSRAPIInvitation::get_ConnectionString() failure: 0x%08X\n", hr);
WLog_ERR(TAG, "IRDPSRAPIInvitation::get_ConnectionString() failure: 0x%08X", hr);
return -1;
}
@ -759,7 +762,7 @@ int win_shadow_wds_init(winShadowSubsystem* subsystem)
if (status < 0)
return -1;
printf("ConnectionString: %s\n", file->ConnectionString2);
WLog_INFO(TAG, "ConnectionString: %s", file->ConnectionString2);
if (0)
{
@ -781,7 +784,7 @@ int win_shadow_wds_init(winShadowSubsystem* subsystem)
if (status < 0)
{
printf("win_shadow_rdp_init() failure: %d\n", status);
WLog_INFO(TAG, "win_shadow_rdp_init() failure: %d", status);
return status;
}
@ -808,7 +811,7 @@ int win_shadow_wds_init(winShadowSubsystem* subsystem)
if (status < 0)
{
printf("win_shadow_rdp_start() failure: %d\n", status);
WLog_INFO(TAG, "win_shadow_rdp_start() failure: %d", status);
return status;
}

View File

@ -36,6 +36,7 @@
#include <freerdp/codec/color.h>
#include <freerdp/codec/region.h>
#include <freerdp/log.h>
#include "../shadow_screen.h"
#include "../shadow_capture.h"
@ -43,6 +44,8 @@
#include "x11_shadow.h"
#define TAG SERVER_TAG("shadow.x11")
void x11_shadow_input_synchronize_event(x11ShadowSubsystem* subsystem, UINT32 flags)
{
@ -474,7 +477,7 @@ int x11_shadow_xshm_init(x11ShadowSubsystem* subsystem)
if (!subsystem->fb_image)
{
fprintf(stderr, "XShmCreateImage failed\n");
WLog_ERR(TAG, "XShmCreateImage failed");
return -1;
}
@ -483,7 +486,7 @@ int x11_shadow_xshm_init(x11ShadowSubsystem* subsystem)
if (subsystem->fb_shm_info.shmid == -1)
{
fprintf(stderr, "shmget failed\n");
WLog_ERR(TAG, "shmget failed");
return -1;
}
@ -492,7 +495,7 @@ int x11_shadow_xshm_init(x11ShadowSubsystem* subsystem)
if (subsystem->fb_shm_info.shmaddr == ((char*) -1))
{
fprintf(stderr, "shmat failed\n");
WLog_ERR(TAG, "shmat failed");
return -1;
}
@ -556,7 +559,7 @@ int x11_shadow_subsystem_init(x11ShadowSubsystem* subsystem)
if (!subsystem->display)
{
fprintf(stderr, "failed to open display: %s\n", XDisplayName(NULL));
WLog_ERR(TAG, "failed to open display: %s", XDisplayName(NULL));
return -1;
}
@ -591,7 +594,7 @@ int x11_shadow_subsystem_init(x11ShadowSubsystem* subsystem)
if (!pfs)
{
fprintf(stderr, "XListPixmapFormats failed\n");
WLog_ERR(TAG, "XListPixmapFormats failed");
return -1;
}
@ -616,7 +619,7 @@ int x11_shadow_subsystem_init(x11ShadowSubsystem* subsystem)
if (!vis)
{
fprintf(stderr, "XGetVisualInfo failed\n");
WLog_ERR(TAG, "XGetVisualInfo failed");
return -1;
}
@ -678,7 +681,7 @@ int x11_shadow_subsystem_init(x11ShadowSubsystem* subsystem)
subsystem->monitors[0].flags = 1;
}
printf("X11 Extensions: XFixes: %d Xinerama: %d XDamage: %d XShm: %d\n",
WLog_INFO(TAG, "X11 Extensions: XFixes: %d Xinerama: %d XDamage: %d XShm: %d",
subsystem->use_xfixes, subsystem->use_xinerama, subsystem->use_xdamage, subsystem->use_xshm);
return 1;

View File

@ -23,10 +23,14 @@
#include <winpr/crt.h>
#include <winpr/print.h>
#include <freerdp/log.h>
#include "shadow_surface.h"
#include "shadow_capture.h"
#define TAG SERVER_TAG("shadow")
int shadow_capture_align_clip_rect(RECTANGLE_16* rect, RECTANGLE_16* clip)
{
int dx, dy;
@ -177,31 +181,31 @@ int shadow_capture_compare(BYTE* pData1, int nStep1, int nWidth, int nHeight, BY
if (0)
{
printf("\n");
WLog_INFO(TAG, "");
for (tx = 0; tx < ncol; tx++)
printf("-");
printf("\n");
WLog_INFO(TAG, "-");
WLog_INFO(TAG, "");
for (tx = 0; tx < ncol; tx++)
printf("%s", cols[tx] ? "O" : "X");
printf("\n");
WLog_INFO(TAG, "%s", cols[tx] ? "O" : "X");
WLog_INFO(TAG, "");
for (tx = 0; tx < ncol; tx++)
printf("-");
printf("\n");
WLog_INFO(TAG, "-");
WLog_INFO(TAG, "");
for (ty = 0; ty < nrow; ty++)
{
for (tx = 0; tx < ncol; tx++)
{
printf("%s", grid[ty][tx] ? "O" : "X");
WLog_INFO(TAG, "%s", grid[ty][tx] ? "O" : "X");
}
printf("|%s|\n", rows[ty] ? "O" : "X");
WLog_INFO(TAG, "|%s|", rows[ty] ? "O" : "X");
}
printf("left: %d top: %d right: %d bottom: %d ncol: %d nrow: %d\n",
WLog_INFO(TAG, "left: %d top: %d right: %d bottom: %d ncol: %d nrow: %d",
l, t, r, b, ncol, nrow);
}

View File

@ -27,8 +27,12 @@
#include <winpr/thread.h>
#include <winpr/sysinfo.h>
#include <freerdp/log.h>
#include "shadow.h"
#define TAG CLIENT_TAG("shadow")
void shadow_client_context_new(freerdp_peer* peer, rdpShadowClient* client)
{
rdpSettings* settings;
@ -121,7 +125,7 @@ BOOL shadow_client_post_connect(freerdp_peer* peer)
if (settings->ColorDepth == 24)
settings->ColorDepth = 16; /* disable 24bpp */
fprintf(stderr, "Client from %s is activated (%dx%d@%d)\n",
WLog_ERR(TAG, "Client from %s is activated (%dx%d@%d)",
peer->hostname, settings->DesktopWidth, settings->DesktopHeight, settings->ColorDepth);
peer->update->DesktopResize(peer->update->context);
@ -570,7 +574,7 @@ int shadow_client_send_surface_update(rdpShadowClient* client)
nWidth = extents->right - extents->left;
nHeight = extents->bottom - extents->top;
//printf("shadow_client_send_surface_update: x: %d y: %d width: %d height: %d right: %d bottom: %d\n",
//WLog_INFO(TAG, "shadow_client_send_surface_update: x: %d y: %d width: %d height: %d right: %d bottom: %d",
// nXSrc, nYSrc, nWidth, nHeight, nXSrc + nWidth, nYSrc + nHeight);
if (settings->RemoteFxCodec || settings->NSCodec)
@ -702,7 +706,7 @@ void* shadow_client_thread(rdpShadowClient* client)
{
if (!peer->CheckFileDescriptor(peer))
{
fprintf(stderr, "Failed to check FreeRDP file descriptor\n");
WLog_ERR(TAG, "Failed to check FreeRDP file descriptor");
break;
}
}
@ -711,7 +715,7 @@ void* shadow_client_thread(rdpShadowClient* client)
{
if (WTSVirtualChannelManagerCheckFileDescriptor(client->vcm) != TRUE)
{
fprintf(stderr, "WTSVirtualChannelManagerCheckFileDescriptor failure\n");
WLog_ERR(TAG, "WTSVirtualChannelManagerCheckFileDescriptor failure");
break;
}
}

View File

@ -20,10 +20,13 @@
#include "config.h"
#endif
#include <freerdp/log.h>
#include "shadow.h"
#include "shadow_encomsp.h"
#define TAG SERVER_TAG("shadow")
static int encomsp_change_participant_control_level(EncomspServerContext* context,
ENCOMSP_CHANGE_PARTICIPANT_CONTROL_LEVEL_PDU* pdu)
{
@ -32,7 +35,7 @@ static int encomsp_change_participant_control_level(EncomspServerContext* contex
BOOL mayInteract;
rdpShadowClient* client = (rdpShadowClient*) context->custom;
printf("ChangeParticipantControlLevel: ParticipantId: %d Flags: 0x%04X\n",
WLog_INFO(TAG, "ChangeParticipantControlLevel: ParticipantId: %d Flags: 0x%04X",
pdu->ParticipantId, pdu->Flags);
mayView = (pdu->Flags & ENCOMSP_MAY_VIEW) ? TRUE : FALSE;

View File

@ -28,6 +28,7 @@
#include <winpr/winsock.h>
#include <freerdp/version.h>
#include <freerdp/log.h>
#include <winpr/tools/makecert.h>
@ -42,6 +43,8 @@
#include "shadow.h"
#define TAG SERVER_TAG("shadow")
#ifdef _WIN32
static BOOL g_MessagePump = TRUE;
#else
@ -78,14 +81,14 @@ int shadow_server_print_command_line_help(int argc, char** argv)
int length;
COMMAND_LINE_ARGUMENT_A* arg;
printf("Usage: %s [options]\n", argv[0]);
printf("\n");
WLog_INFO(TAG, "Usage: %s [options]", argv[0]);
WLog_INFO(TAG, "");
printf("Syntax:\n");
printf(" /flag (enables flag)\n");
printf(" /option:<value> (specifies option with value)\n");
printf(" +toggle -toggle (enables or disables toggle, where '/' is a synonym of '+')\n");
printf("\n");
WLog_INFO(TAG, "Syntax:");
WLog_INFO(TAG, " /flag (enables flag)");
WLog_INFO(TAG, " /option:<value> (specifies option with value)");
WLog_INFO(TAG, " +toggle -toggle (enables or disables toggle, where '/' is a synonym of '+')");
WLog_INFO(TAG, "");
arg = shadow_args;
@ -93,28 +96,28 @@ int shadow_server_print_command_line_help(int argc, char** argv)
{
if (arg->Flags & COMMAND_LINE_VALUE_FLAG)
{
printf(" %s", "/");
printf("%-20s", arg->Name);
printf("\t%s\n", arg->Text);
WLog_INFO(TAG, " %s", "/");
WLog_INFO(TAG, "%-20s", arg->Name);
WLog_INFO(TAG, "\t%s", arg->Text);
}
else if ((arg->Flags & COMMAND_LINE_VALUE_REQUIRED) || (arg->Flags & COMMAND_LINE_VALUE_OPTIONAL))
{
printf(" %s", "/");
WLog_INFO(TAG, " %s", "/");
if (arg->Format)
{
length = (int) (strlen(arg->Name) + strlen(arg->Format) + 2);
str = (char*) malloc(length + 1);
sprintf_s(str, length + 1, "%s:%s", arg->Name, arg->Format);
printf("%-20s", str);
WLog_INFO(TAG, "%-20s", str);
free(str);
}
else
{
printf("%-20s", arg->Name);
WLog_INFO(TAG, "%-20s", arg->Name);
}
printf("\t%s\n", arg->Text);
WLog_INFO(TAG, "\t%s", arg->Text);
}
else if (arg->Flags & COMMAND_LINE_VALUE_BOOL)
{
@ -123,12 +126,12 @@ int shadow_server_print_command_line_help(int argc, char** argv)
sprintf_s(str, length + 1, "%s (default:%s)", arg->Name,
arg->Default ? "on" : "off");
printf(" %s", arg->Default ? "-" : "+");
WLog_INFO(TAG, " %s", arg->Default ? "-" : "+");
printf("%-20s", str);
WLog_INFO(TAG, "%-20s", str);
free(str);
printf("\t%s\n", arg->Text);
WLog_INFO(TAG, "\t%s", arg->Text);
}
}
while ((arg = CommandLineFindNextArgumentA(arg)) != NULL);
@ -140,7 +143,7 @@ int shadow_server_command_line_status_print(rdpShadowServer* server, int argc, c
{
if (status == COMMAND_LINE_STATUS_PRINT_VERSION)
{
printf("FreeRDP version %s (git %s)\n", FREERDP_VERSION_FULL, GIT_REVISION);
WLog_INFO(TAG, "FreeRDP version %s (git %s)", FREERDP_VERSION_FULL, GIT_REVISION);
return COMMAND_LINE_STATUS_PRINT_VERSION;
}
else if (status == COMMAND_LINE_STATUS_PRINT)
@ -233,7 +236,7 @@ int shadow_server_parse_command_line(rdpShadowServer* server, int argc, char** a
width = monitor->right - monitor->left;
height = monitor->bottom - monitor->top;
printf(" %s [%d] %dx%d\t+%d+%d\n",
WLog_INFO(TAG, " %s [%d] %dx%d\t+%d+%d",
(monitor->flags == 1) ? "*" : " ", index,
width, height, monitor->left, monitor->top);
}
@ -295,7 +298,7 @@ void* shadow_server_thread(rdpShadowServer* server)
if (listener->GetEventHandles(listener, events, &nCount) < 0)
{
fprintf(stderr, "Failed to get FreeRDP file descriptor\n");
WLog_ERR(TAG, "Failed to get FreeRDP file descriptor");
break;
}
@ -310,7 +313,7 @@ void* shadow_server_thread(rdpShadowServer* server)
if (!listener->CheckFileDescriptor(listener))
{
fprintf(stderr, "Failed to check FreeRDP file descriptor\n");
WLog_ERR(TAG, "Failed to check FreeRDP file descriptor");
break;
}
@ -473,7 +476,7 @@ int shadow_server_init(rdpShadowServer* server)
status = server->subsystem->Init(server->subsystem);
if (status < 0)
fprintf(stderr, "subsystem init failure: %d\n", status);
WLog_ERR(TAG, "subsystem init failure: %d", status);
}
server->screen = shadow_screen_new(server);