server: fix build on Windows

This commit is contained in:
Marc-André Moreau 2014-08-11 19:31:38 -04:00
parent e4a4aa4d3a
commit 90d202ab87
11 changed files with 47 additions and 79 deletions

View File

@ -29,42 +29,7 @@
#include "encomsp_main.h"
<<<<<<< HEAD
static int encomsp_read_header(wStream* s, ENCOMSP_ORDER_HEADER* header)
=======
EncomspClientContext* encomsp_get_client_interface(encomspPlugin* encomsp)
{
EncomspClientContext* pInterface;
pInterface = (EncomspClientContext*) encomsp->channelEntryPoints.pInterface;
return pInterface;
}
int encomsp_virtual_channel_write(encomspPlugin* encomsp, wStream* s)
{
UINT32 status = 0;
if (!encomsp)
return -1;
#if 0
CLOG_DBG("EncomspWrite (%d)\n", Stream_Length(s));
winpr_HexDump(Stream_Buffer(s), Stream_Length(s));
#endif
status = encomsp->channelEntryPoints.pVirtualChannelWrite(encomsp->OpenHandle,
Stream_Buffer(s), (UINT32) Stream_Length(s), s);
if (status != CHANNEL_RC_OK)
{
CLOG_ERR( "encomsp_virtual_channel_write: VirtualChannelWrite failed %d\n", status);
return -1;
}
return 1;
}
int encomsp_read_header(wStream* s, ENCOMSP_ORDER_HEADER* header)
>>>>>>> 31ac35698fe9fe0214669028098885f69e4b6a37
{
if (Stream_GetRemainingLength(s) < ENCOMSP_ORDER_HEADER_SIZE)
return -1;

View File

@ -52,7 +52,7 @@ int wf_info_lock(wfInfo* wfi)
break;
case WAIT_FAILED:
DEBUG_MSG("wf_info_lock failed with 0x%08X\n", GetLastError());
DEBUG_WARN("wf_info_lock failed with 0x%08X\n", GetLastError());
return -1;
break;
}
@ -78,7 +78,7 @@ int wf_info_try_lock(wfInfo* wfi, DWORD dwMilliseconds)
break;
case WAIT_FAILED:
DEBUG_MSG("wf_info_try_lock failed with 0x%08X\n", GetLastError());
DEBUG_WARN("wf_info_try_lock failed with 0x%08X\n", GetLastError());
return -1;
break;
}
@ -90,7 +90,7 @@ int wf_info_unlock(wfInfo* wfi)
{
if (ReleaseMutex(wfi->mutex) == 0)
{
DEBUG_MSG("wf_info_unlock failed with 0x%08X\n", GetLastError());
DEBUG_WARN("wf_info_unlock failed with 0x%08X\n", GetLastError());
return -1;
}
@ -213,7 +213,7 @@ void wf_info_peer_register(wfInfo* wfi, wfPeerContext* context)
wfi->peers[peerId] = ((rdpContext*) context)->peer;
wfi->peers[peerId]->pId = peerId;
wfi->peerCount++;
DEBUG_MSG("Registering Peer: id=%d #=%d\n", peerId, wfi->peerCount);
DEBUG_WARN("Registering Peer: id=%d #=%d\n", peerId, wfi->peerCount);
wf_info_unlock(wfi);
@ -232,7 +232,7 @@ void wf_info_peer_unregister(wfInfo* wfi, wfPeerContext* context)
wfi->peerCount--;
CloseHandle(context->updateEvent);
DEBUG_MSG("Unregistering Peer: id=%d, #=%d\n", peerId, wfi->peerCount);
DEBUG_WARN("Unregistering Peer: id=%d, #=%d\n", peerId, wfi->peerCount);
#ifdef WITH_DXGI_1_2
if (wfi->peerCount == 0)

View File

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

View File

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

View File

@ -92,9 +92,9 @@ BOOL wf_mirror_driver_display_device_attach(wfInfo* wfi, DWORD mode)
if (status != ERROR_SUCCESS)
{
DEBUG_MSG("Error opening RegKey: status=%0X\n", status);
DEBUG_WARN("Error opening RegKey: status=%0X\n", status);
if (status == ERROR_ACCESS_DENIED)
DEBUG_MSG("access denied. Do you have admin privleges?\n");
DEBUG_WARN("access denied. Do you have admin privleges?\n");
return FALSE;
}
@ -104,9 +104,9 @@ BOOL wf_mirror_driver_display_device_attach(wfInfo* wfi, DWORD mode)
if (status != ERROR_SUCCESS)
{
DEBUG_MSG("Error querying RegKey: status=%0X\n", status);
DEBUG_WARN("Error querying RegKey: status=%0X\n", status);
if (status == ERROR_ACCESS_DENIED)
DEBUG_MSG("access denied. Do you have admin privleges?\n");
DEBUG_WARN("access denied. Do you have admin privleges?\n");
return FALSE;
}
@ -120,10 +120,10 @@ BOOL wf_mirror_driver_display_device_attach(wfInfo* wfi, DWORD mode)
if (status != ERROR_SUCCESS)
{
DEBUG_MSG("Error writing registry key: %d ", status);
DEBUG_WARN("Error writing registry key: %d ", status);
if (status == ERROR_ACCESS_DENIED)
DEBUG_MSG("access denied. Do you have admin privleges?");
DEBUG_MSG("\n");
DEBUG_WARN("access denied. Do you have admin privleges?");
DEBUG_WARN("\n");
return FALSE;
}
}
@ -199,7 +199,7 @@ BOOL wf_mirror_driver_update(wfInfo* wfi, int mode)
if ( (mode != MIRROR_LOAD) && (mode != MIRROR_UNLOAD) )
{
DEBUG_MSG("Invalid mirror mode!\n");
DEBUG_WARN("Invalid mirror mode!\n");
return FALSE;
}
@ -321,29 +321,29 @@ BOOL wf_mirror_driver_activate(wfInfo* wfi)
{
if (!wfi->mirrorDriverActive)
{
DEBUG_MSG("Activating Mirror Driver\n");
DEBUG_WARN("Activating Mirror Driver\n");
if (wf_mirror_driver_find_display_device(wfi) == FALSE)
{
DEBUG_MSG("Could not find dfmirage mirror driver! Is it installed?\n");
DEBUG_WARN("Could not find dfmirage mirror driver! Is it installed?\n");
return FALSE;
}
if (wf_mirror_driver_display_device_attach(wfi, 1) == FALSE)
{
DEBUG_MSG("Could not attach display device!\n");
DEBUG_WARN("Could not attach display device!\n");
return FALSE;
}
if (wf_mirror_driver_update(wfi, MIRROR_LOAD) == FALSE)
{
DEBUG_MSG("could not update system with new display settings!\n");
DEBUG_WARN("could not update system with new display settings!\n");
return FALSE;
}
if (wf_mirror_driver_map_memory(wfi) == FALSE)
{
DEBUG_MSG("Unable to map memory for mirror driver!\n");
DEBUG_WARN("Unable to map memory for mirror driver!\n");
return FALSE;
}
wfi->mirrorDriverActive = TRUE;
@ -356,7 +356,7 @@ void wf_mirror_driver_deactivate(wfInfo* wfi)
{
if (wfi->mirrorDriverActive)
{
DEBUG_MSG("Deactivating Mirror Driver\n");
DEBUG_WARN("Deactivating Mirror Driver\n");
wf_mirror_driver_cleanup(wfi);
wf_mirror_driver_display_device_attach(wfi, 0);

View File

@ -92,7 +92,7 @@ BOOL wf_peer_post_connect(freerdp_peer* client)
if ((settings->DesktopWidth != wfi->servscreen_width) || (settings->DesktopHeight != wfi->servscreen_height))
{
/*
DEBUG_MSG("Client requested resolution %dx%d, but will resize to %dx%d\n",
DEBUG_WARN("Client requested resolution %dx%d, but will resize to %dx%d\n",
settings->DesktopWidth, settings->DesktopHeight, wfi->servscreen_width, wfi->servscreen_height);
*/
@ -248,7 +248,7 @@ DWORD WINAPI wf_peer_main_loop(LPVOID lpParam)
if (wfi->input_disabled)
{
DEBUG_MSG("client input is disabled\n");
DEBUG_WARN("client input is disabled\n");
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;
@ -260,7 +260,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_MSG("We've got a client %s\n", client->local ? "(local)" : client->hostname);
DEBUG_WARN("We've got a client %s\n", client->local ? "(local)" : client->hostname);
nCount = 0;
handles[nCount++] = context->updateEvent;
@ -272,7 +272,7 @@ DWORD WINAPI wf_peer_main_loop(LPVOID lpParam)
if ((status == WAIT_FAILED) || (status == WAIT_TIMEOUT))
{
DEBUG_MSG("WaitForMultipleObjects failed\n");
DEBUG_WARN("WaitForMultipleObjects failed\n");
break;
}
@ -303,7 +303,7 @@ DWORD WINAPI wf_peer_main_loop(LPVOID lpParam)
//force disconnect
if (wfi->force_all_disconnect == TRUE)
{
DEBUG_MSG("Forcing Disconnect -> ");
DEBUG_WARN("Forcing Disconnect -> ");
break;
}
@ -312,7 +312,7 @@ DWORD WINAPI wf_peer_main_loop(LPVOID lpParam)
break;
}
DEBUG_MSG("Client %s disconnected.\n", client->local ? "(local)" : client->hostname);
DEBUG_WARN("Client %s disconnected.\n", client->local ? "(local)" : client->hostname);
if (WaitForSingleObject(context->updateEvent, 0) == 0)
{

View File

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

View File

@ -176,7 +176,7 @@ void wf_update_peer_send(wfInfo* wfi, wfPeerContext* context)
/* This is an unexpected error condition */
DEBUG_MSG("Unexpected Frame Index: Actual: %d Expected: %d\n",
DEBUG_WARN("Unexpected Frame Index: Actual: %d Expected: %d\n",
wfi->frame_idx, context->frame_idx + 1);
}
@ -189,7 +189,7 @@ void wf_update_encoder_reset(wfInfo* wfi)
{
if (wf_info_lock(wfi) > 0)
{
DEBUG_MSG("Resetting encoder\n");
DEBUG_WARN("Resetting encoder\n");
if (wfi->rfx_context)
{
@ -226,7 +226,7 @@ void wf_update_peer_activate(wfInfo* wfi, wfPeerContext* context)
wf_update_encoder_reset(wfi);
wfi->activePeerCount++;
DEBUG_MSG("Activating Peer Updates: %d\n", wfi->activePeerCount);
DEBUG_WARN("Activating Peer Updates: %d\n", wfi->activePeerCount);
wf_info_unlock(wfi);
}
@ -248,7 +248,7 @@ void wf_update_peer_deactivate(wfInfo* wfi, wfPeerContext* context)
client->activated = FALSE;
wfi->activePeerCount--;
DEBUG_MSG("Deactivating Peer Updates: %d\n", wfi->activePeerCount);
DEBUG_WARN("Deactivating Peer Updates: %d\n", wfi->activePeerCount);
}
wf_info_unlock(wfi);

View File

@ -45,7 +45,7 @@ int wf_wasapi_activate(RdpsndServerContext* context)
return 1;
}
DEBUG_MSG("RDPSND (WASAPI) Activated\n");
DEBUG_WARN("RDPSND (WASAPI) Activated\n");
CreateThread(NULL, 0, wf_rdpsnd_wasapi_thread, latestPeer, 0, NULL);

View File

@ -868,7 +868,7 @@ int win_shadow_surface_copy(winShadowSubsystem* subsystem)
int x, y;
int width;
int height;
int status;
int status = 1;
int nDstStep = 0;
BYTE* pDstData = NULL;
rdpShadowServer* server;
@ -901,7 +901,9 @@ int win_shadow_surface_copy(winShadowSubsystem* subsystem)
printf("SurfaceCopy x: %d y: %d width: %d height: %d right: %d bottom: %d\n",
x, y, width, height, x + width, y + height);
#ifdef WITH_DXGI_1_2
status = win_shadow_dxgi_fetch_frame_data(subsystem, &pDstData, &nDstStep, x, y, width, height);
#endif
if (status < 0)
return -1;

View File

@ -39,8 +39,8 @@ static BOOL g_NativeBarrier = FALSE;
static INIT_ONCE g_InitOnce = INIT_ONCE_STATIC_INIT;
typedef BOOL (WINAPI * fnInitializeSynchronizationBarrier)(LPSYNCHRONIZATION_BARRIER lpBarrier, LONG lTotalThreads, LONG lSpinCount);
typedef BOOL (WINAPI * fnEnterSynchronizationBarrier(LPSYNCHRONIZATION_BARRIER lpBarrier, DWORD dwFlags);
typedef BOOL (WINAPI * fnDeleteSynchronizationBarrier(LPSYNCHRONIZATION_BARRIER lpBarrier);
typedef BOOL (WINAPI * fnEnterSynchronizationBarrier)(LPSYNCHRONIZATION_BARRIER lpBarrier, DWORD dwFlags);
typedef BOOL (WINAPI * fnDeleteSynchronizationBarrier)(LPSYNCHRONIZATION_BARRIER lpBarrier);
static fnInitializeSynchronizationBarrier pfnInitializeSynchronizationBarrier = NULL;
static fnEnterSynchronizationBarrier pfnEnterSynchronizationBarrier = NULL;