wfreerdp: fix build on Windows XP

This commit is contained in:
Marc-André Moreau 2012-08-30 19:57:21 -04:00
parent 139bbb707c
commit a9bbc3d8c1
5 changed files with 58 additions and 40 deletions

View File

@ -89,6 +89,7 @@ if(MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_UNICODE")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWINPR_EXPORTS")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFREERDP_EXPORTS")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_WIN32_WINNT=0x0501")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWIN32_LEAN_AND_MEAN")
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR})

View File

@ -32,6 +32,7 @@
#include <freerdp/freerdp.h>
#include <freerdp/errorcodes.h>
#include <freerdp/utils/memory.h>
#include <freerdp/locale/keyboard.h>
/* connectErrorCode is 'extern' in errorcodes.h. See comment there.*/
@ -123,7 +124,7 @@ boolean freerdp_connect(freerdp* instance)
{
pcap_get_next_record_header(update->pcap_rfx, &record);
s->data = xrealloc(s->data, record.length);
s->data = (uint8*) xrealloc(s->data, record.length);
record.data = s->data;
s->size = record.length;

View File

@ -43,6 +43,36 @@
#include "listener.h"
#ifdef _WIN32
#if _WIN32_WINNT < 0x0600
static const char *inet_ntop(int af, const void* src, char* dst, socklen_t cnt)
{
if (af == AF_INET)
{
struct sockaddr_in in;
memset(&in, 0, sizeof(in));
in.sin_family = AF_INET;
memcpy(&in.sin_addr, src, sizeof(struct in_addr));
getnameinfo((struct sockaddr *)&in, sizeof(struct sockaddr_in), dst, cnt, NULL, 0, NI_NUMERICHOST);
return dst;
}
else if (af == AF_INET6)
{
struct sockaddr_in6 in;
memset(&in, 0, sizeof(in));
in.sin6_family = AF_INET6;
memcpy(&in.sin6_addr, src, sizeof(struct in_addr6));
getnameinfo((struct sockaddr *)&in, sizeof(struct sockaddr_in6), dst, cnt, NULL, 0, NI_NUMERICHOST);
return dst;
}
return NULL;
}
#endif
#endif
static boolean freerdp_listener_open(freerdp_listener* instance, const char* bind_address, uint16 port)
{
rdpListener* listener = (rdpListener*) instance->listener;

View File

@ -119,7 +119,8 @@ RDP_SCANCODE freerdp_keyboard_get_rdp_scancode_from_virtual_key_code(uint32 vkco
void freerdp_keyboard_set_layout_code(rdpSettings* settings)
{
/* for jp */
if (settings->kbd_layout == 0xE0010411) {
if (settings->kbd_layout == 0xE0010411)
{
settings->kbd_type = 7;
settings->kbd_subtype = 2;
settings->kbd_fn_keys = 12;

View File

@ -84,56 +84,41 @@ This function will attempt to access the the windows registry using the device
unsuccessful or an unexpected value is encountered, the function returns
false.
*/
BOOL wf_disp_device_set_attatch(wfInfo* context, DWORD val)
{
HKEY hKey;
LONG status;
DWORD rtype, rdata, rdata_size;
DWORD dwType;
DWORD dwSize;
DWORD dwValue;
_tprintf(_T("\nOpening registry key %s\n"), context->deviceKey);
rtype = 0;
rdata = 0;
rdata_size = sizeof(rdata);
status = RegGetValue(HKEY_LOCAL_MACHINE, context->deviceKey,
_T("Attach.ToDesktop"), RRF_RT_REG_DWORD, &rtype, &rdata, &rdata_size);
status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, context->deviceKey,
0, KEY_READ | KEY_WOW64_64KEY, &hKey);
if (status != ERROR_SUCCESS)
return FALSE;
dwSize = sizeof(DWORD);
status = RegQueryValueEx(hKey, _T("Attach.ToDesktop"),
NULL, &dwType, (BYTE*) &dwValue, &dwSize);
if (status != ERROR_SUCCESS)
return FALSE;
if (dwValue == 1)
{
printf("Failed to read registry value.\n");
printf("operation returned %d\n", status);
return false;
}
dwValue = val;
dwSize = sizeof(DWORD);
_tprintf(_T("type = %04X, data = %04X\n"), rtype, rdata);
if (rdata == (val ^ 1))
{
rdata = val;
status = RegSetKeyValue(HKEY_LOCAL_MACHINE, context->deviceKey,
_T("Attach.ToDesktop"), REG_DWORD, &rdata, rdata_size);
status = RegSetValueEx(HKEY_LOCAL_MACHINE, _T("Attach.ToDesktop"),
0, REG_DWORD, (BYTE*) &dwValue, dwSize);
if (status != ERROR_SUCCESS)
{
_tprintf(_T("Failed to write registry value.\n"));
_tprintf(_T("operation returned %d\n"), status);
return false;
}
_tprintf(_T("Wrote subkey \"Attach.ToDesktop\" -> %04X\n\n"), rdata);
}
else if (rdata == val)
{
_tprintf(_T("\"Attach.ToDesktop\" is already set to %04X!\n"), rdata);
}
else
{
_tprintf(_T("An wild value appeared!...\nrdata=%d\n"), rdata);
return false;
return FALSE;
}
return true;
return TRUE;
}
/*