Merge pull request #735 from FreeRDP/cleanup

CMake Improvements + Input API fix for Remmina
This commit is contained in:
Marc-André Moreau 2012-09-22 14:27:38 -07:00
commit 7fe74c5168
49 changed files with 900 additions and 376 deletions

View File

@ -59,6 +59,20 @@ if(NOT DEFINED BUILD_SHARED_LIBS)
set(BUILD_SHARED_LIBS ON)
endif()
# Configure MSVC Runtime
if(MSVC)
include(MSVCRuntime)
if(NOT DEFINED MSVC_RUNTIME)
set(MSVC_RUNTIME "dynamic")
endif()
if(${MSVC_RUNTIME} STREQUAL "static")
message(STATUS "Use the MSVC static runtime option carefully!")
message(STATUS "OpenSSL uses /MD by default, and is very picky")
message(STATUS "Random freeing errors are a common sign of runtime issues")
endif()
configure_msvc_runtime()
endif()
# Compiler-specific flags
if(CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
@ -99,23 +113,6 @@ if(MSVC)
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR})
endif()
# This forces the MSVC runtime to be statically linked
if(WITH_MSVC_STATIC)
foreach(flag_var CMAKE_C_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELEASE CMAKE_C_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO CMAKE_CXX_FLAGS_RELWITHDEBINFO)
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
string(REGEX REPLACE "/MDd" "/MTd" ${flag_var} "${${flag_var}}")
endforeach(flag_var)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}" CACHE STRING "MSVC C Debug MT flags " FORCE)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}" CACHE STRING "MSVC CXX Debug MT flags " FORCE)
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}" CACHE STRING "MSVC C Release MT flags " FORCE)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}" CACHE STRING "MSVC CXX Release MT flags " FORCE)
set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL}" CACHE STRING "MSVC C Debug MT flags " FORCE)
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL}" CACHE STRING "MSVC C Release MT flags " FORCE)
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}" CACHE STRING "MSVC CXX Debug MT flags " FORCE)
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}" CACHE STRING "MSVC CXX Release MT flags " FORCE)
endif()
# config.h definition for installable headers
check_include_files(limits.h FREERDP_HAVE_LIMITS_H)
check_include_files(stdint.h FREERDP_HAVE_STDINT_H)
@ -135,11 +132,6 @@ check_include_files(sys/strtio.h HAVE_SYS_STRTIO_H)
check_struct_has_member("struct tm" tm_gmtoff time.h HAVE_TM_GMTOFF)
# Libraries that we have a hard dependency on
if(NOT DEFINED OPENSSL_INCLUDE_DIR OR NOT DEFINED OPENSSL_LIBRARIES)
find_required_package(OpenSSL)
endif()
# Mac OS X
if(APPLE)
if(IS_DIRECTORY /opt/local/include)

View File

@ -17,13 +17,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
add_subdirectory(cliprdr)
add_subdirectory(drdynvc)
add_subdirectory(rail)
add_subdirectory(rdpdbg)
add_subdirectory(skel)
set(FILENAME "ChannelOptions.cmake")
file(GLOB FILEPATHS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*/${FILENAME}")
foreach(FILEPATH ${FILEPATHS})
if(${FILEPATH} MATCHES "^([^/]*)//${FILENAME}")
string(REGEX REPLACE "^([^/]*)//${FILENAME}" "\\1" DIR ${FILEPATH})
set(CHANNEL_OPTION)
include(${FILEPATH})
if(${CHANNEL_OPTION})
message(STATUS "Adding ${CHANNEL_TYPE} channel \"${CHANNEL_SHORT_NAME}\": ${CHANNEL_LONG_NAME}")
add_subdirectory(${DIR})
endif()
endif()
endforeach(FILEPATH)
if(NOT WIN32)
add_subdirectory(rdpdr)
add_subdirectory(rdpsnd)
endif()

View File

@ -0,0 +1,10 @@
set(CHANNEL_TYPE "static")
set(CHANNEL_SHORT_NAME "cliprdr")
set(CHANNEL_LONG_NAME "Clipboard Virtual Channel Extension")
set(CHANNEL_SPECIFICATIONS "[MS-RDPECLIP]")
string(TOUPPER "WITH_${CHANNEL_SHORT_NAME}" CHANNEL_OPTION)
option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON)

View File

@ -0,0 +1,9 @@
set(CHANNEL_TYPE "static")
set(CHANNEL_SHORT_NAME "drdynvc")
set(CHANNEL_LONG_NAME "Dynamic Virtual Channel Extension")
set(CHANNEL_SPECIFICATIONS "[MS-RDPEDYC]")
string(TOUPPER "WITH_${CHANNEL_SHORT_NAME}" CHANNEL_OPTION)
option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON)

View File

@ -0,0 +1,9 @@
set(CHANNEL_TYPE "static")
set(CHANNEL_SHORT_NAME "rail")
set(CHANNEL_LONG_NAME "Remote Programs Virtual Channel Extension")
set(CHANNEL_SPECIFICATIONS "[MS-RDPERP]")
string(TOUPPER "WITH_${CHANNEL_SHORT_NAME}" CHANNEL_OPTION)
option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON)

View File

@ -1,33 +0,0 @@
# FreeRDP: A Remote Desktop Protocol Client
# FreeRDP cmake build script
#
# Copyright 2011 O.S. Systems Software Ltda.
# Copyright 2011 Otavio Salvador <otavio@ossystems.com.br>
# Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set(RDPDBG_SRCS
rdpdbg_main.c
)
add_library(rdpdbg ${RDPDBG_SRCS})
set_target_properties(rdpdbg PROPERTIES PREFIX "")
if(WITH_MONOLITHIC_BUILD)
target_link_libraries(rdpdbg freerdp)
else()
target_link_libraries(rdpdbg freerdp-utils)
endif()
install(TARGETS rdpdbg DESTINATION ${FREERDP_PLUGIN_PATH})

View File

@ -1,74 +0,0 @@
/**
* FreeRDP: A Remote Desktop Protocol client.
* Debugging Virtual Channel
*
* Copyright 2010-2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
* Copyright 2011 Vic Lee
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <freerdp/constants.h>
#include <freerdp/types.h>
#include <freerdp/utils/memory.h>
#include <freerdp/utils/svc_plugin.h>
typedef struct rdpdbg_plugin rdpdbgPlugin;
struct rdpdbg_plugin
{
rdpSvcPlugin plugin;
};
static void rdpdbg_process_connect(rdpSvcPlugin* plugin)
{
DEBUG_WARN("connecting");
}
static void rdpdbg_process_receive(rdpSvcPlugin* plugin, STREAM* data_in)
{
STREAM* data_out;
DEBUG_WARN("size %d", stream_get_size(data_in));
stream_free(data_in);
data_out = stream_new(8);
stream_write(data_out, "senddata", 8);
svc_plugin_send(plugin, data_out);
}
static void rdpdbg_process_event(rdpSvcPlugin* plugin, RDP_EVENT* event)
{
DEBUG_WARN("event_type %d", event->event_type);
freerdp_event_free(event);
event = freerdp_event_new(RDP_EVENT_CLASS_DEBUG, 0, NULL, NULL);
svc_plugin_send_event(plugin, event);
}
static void rdpdbg_process_terminate(rdpSvcPlugin* plugin)
{
DEBUG_WARN("terminating");
xfree(plugin);
}
DEFINE_SVC_PLUGIN(rdpdbg, "rdpdbg",
CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP |
CHANNEL_OPTION_COMPRESS_RDP | CHANNEL_OPTION_SHOW_PROTOCOL)

View File

@ -0,0 +1,14 @@
set(CHANNEL_TYPE "static")
set(CHANNEL_SHORT_NAME "rdpdr")
set(CHANNEL_LONG_NAME "Device Redirection Virtual Channel Extension")
set(CHANNEL_SPECIFICATIONS "[MS-RDPEFS] [MS-RDPEPC] [MS-RDPESC] [MS-RDPESP]")
string(TOUPPER "WITH_${CHANNEL_SHORT_NAME}" CHANNEL_OPTION)
if(WIN32)
option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" OFF)
else()
option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON)
endif()

View File

@ -0,0 +1,12 @@
set(CHANNEL_TYPE "static")
set(CHANNEL_SHORT_NAME "rdpsnd")
set(CHANNEL_LONG_NAME "Audio Output Virtual Channel Extension")
set(CHANNEL_SPECIFICATIONS "[MS-RDPEA]")
if(WIN32)
option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" OFF)
else()
option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" ON)
endif()

View File

@ -0,0 +1,8 @@
set(CHANNEL_TYPE "static")
set(CHANNEL_SHORT_NAME "skel")
set(CHANNEL_LONG_NAME "Skeleton Code Virtual Channel Extension")
set(CHANNEL_SPECIFICATIONS "")
option(${CHANNEL_OPTION} "Build ${CHANNEL_SHORT_NAME}" OFF)

View File

@ -202,7 +202,7 @@ void df_send_keyboard_event(rdpInput* input, boolean down, uint8 keycode, uint8
rdp_scancode = freerdp_keyboard_get_rdp_scancode_from_virtual_key_code(vkcode);
freerdp_input_send_keyboard_event_2(input, down, rdp_scancode);
freerdp_input_send_keyboard_event_ex(input, down, rdp_scancode);
}
boolean df_event_process(freerdp* instance, DFBEvent* event)

View File

@ -57,7 +57,7 @@ LRESULT CALLBACK wf_ll_kbd_proc(int nCode, WPARAM wParam, LPARAM lParam)
wfi = (wfInfo*) GetWindowLongPtr(g_focus_hWnd, GWLP_USERDATA);
p = (PKBDLLHOOKSTRUCT) lParam;
input = wfi->instance->input;
rdp_scancode = mk_rdp_scancode((uint8) p->scanCode, p->flags & LLKHF_EXTENDED);
rdp_scancode = MAKE_RDP_SCANCODE((uint8) p->scanCode, p->flags & LLKHF_EXTENDED);
DEBUG_KBD("keydown %d scanCode %04X flags %02X vkCode %02X",
(wParam == WM_KEYDOWN), (uint8) p->scanCode, p->flags, p->vkCode);
@ -85,10 +85,10 @@ LRESULT CALLBACK wf_ll_kbd_proc(int nCode, WPARAM wParam, LPARAM lParam)
if (wParam == WM_KEYDOWN)
{
DEBUG_KBD("Pause, sent as Ctrl+NumLock");
freerdp_input_send_keyboard_event_2(input, true, RDP_SCANCODE_LCONTROL);
freerdp_input_send_keyboard_event_2(input, true, RDP_SCANCODE_NUMLOCK);
freerdp_input_send_keyboard_event_2(input, false, RDP_SCANCODE_LCONTROL);
freerdp_input_send_keyboard_event_2(input, false, RDP_SCANCODE_NUMLOCK);
freerdp_input_send_keyboard_event_ex(input, true, RDP_SCANCODE_LCONTROL);
freerdp_input_send_keyboard_event_ex(input, true, RDP_SCANCODE_NUMLOCK);
freerdp_input_send_keyboard_event_ex(input, false, RDP_SCANCODE_LCONTROL);
freerdp_input_send_keyboard_event_ex(input, false, RDP_SCANCODE_NUMLOCK);
}
else
{
@ -103,7 +103,7 @@ LRESULT CALLBACK wf_ll_kbd_proc(int nCode, WPARAM wParam, LPARAM lParam)
rdp_scancode = RDP_SCANCODE_RSHIFT;
}
freerdp_input_send_keyboard_event_2(input, !(p->flags & LLKHF_UP), rdp_scancode);
freerdp_input_send_keyboard_event_ex(input, !(p->flags & LLKHF_UP), rdp_scancode);
if (p->vkCode == VK_CAPITAL)
DEBUG_KBD("caps lock is processed on client side too to toggle caps lock indicator");

View File

@ -69,7 +69,7 @@ void xf_kbd_release_all_keypress(xfInfo* xfi)
if (xfi->pressed_keys[keycode] != NoSymbol)
{
rdp_scancode = freerdp_keyboard_get_rdp_scancode_from_x11_keycode(keycode);
freerdp_input_send_keyboard_event_2(xfi->instance->input, false, rdp_scancode);
freerdp_input_send_keyboard_event_ex(xfi->instance->input, false, rdp_scancode);
xfi->pressed_keys[keycode] = NoSymbol;
}
}
@ -99,15 +99,15 @@ void xf_kbd_send_key(xfInfo* xfi, boolean down, uint8 keycode)
/* Pause without Ctrl has to be sent as Ctrl + NumLock. */
if (down)
{
freerdp_input_send_keyboard_event_2(input, true, RDP_SCANCODE_LCONTROL);
freerdp_input_send_keyboard_event_2(input, true, RDP_SCANCODE_NUMLOCK);
freerdp_input_send_keyboard_event_2(input, false, RDP_SCANCODE_LCONTROL);
freerdp_input_send_keyboard_event_2(input, false, RDP_SCANCODE_NUMLOCK);
freerdp_input_send_keyboard_event_ex(input, true, RDP_SCANCODE_LCONTROL);
freerdp_input_send_keyboard_event_ex(input, true, RDP_SCANCODE_NUMLOCK);
freerdp_input_send_keyboard_event_ex(input, false, RDP_SCANCODE_LCONTROL);
freerdp_input_send_keyboard_event_ex(input, false, RDP_SCANCODE_NUMLOCK);
}
}
else
{
freerdp_input_send_keyboard_event_2(input, down, rdp_scancode);
freerdp_input_send_keyboard_event_ex(input, down, rdp_scancode);
if ((rdp_scancode == RDP_SCANCODE_CAPSLOCK) && (down == false))
{

View File

@ -12,7 +12,6 @@ endif()
if(MSVC)
option(WITH_NATIVE_SSPI "Use native SSPI modules" ON)
option(WITH_MSVC_STATIC "Use static MSVC runtime" OFF)
option(WITH_WIN8 "Use Windows 8 libraries" OFF)
endif()

323
cmake/FindOpenSSL.cmake Normal file
View File

@ -0,0 +1,323 @@
# - Try to find the OpenSSL encryption library
# Once done this will define
#
# OPENSSL_ROOT_DIR - Set this variable to the root installation of OpenSSL
#
# Read-Only variables:
# OPENSSL_FOUND - system has the OpenSSL library
# OPENSSL_INCLUDE_DIR - the OpenSSL include directory
# OPENSSL_LIBRARIES - The libraries needed to use OpenSSL
# OPENSSL_VERSION - This is set to $major.$minor.$revision$path (eg. 0.9.8s)
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
# Copyright 2006 Alexander Neundorf <neundorf@kde.org>
# Copyright 2009-2011 Mathieu Malaterre <mathieu.malaterre@gmail.com>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
if (UNIX)
find_package(PkgConfig QUIET)
pkg_check_modules(_OPENSSL QUIET openssl)
endif (UNIX)
# http://www.slproweb.com/products/Win32OpenSSL.html
SET(_OPENSSL_ROOT_HINTS
$ENV{OPENSSL_ROOT_DIR}
${OPENSSL_ROOT_DIR}
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (64-bit)_is1;Inno Setup: App Path]"
)
SET(_OPENSSL_ROOT_PATHS
"$ENV{PROGRAMFILES}/OpenSSL"
"$ENV{PROGRAMFILES}/OpenSSL-Win32"
"$ENV{PROGRAMFILES}/OpenSSL-Win64"
"C:/OpenSSL/"
"C:/OpenSSL-Win32/"
"C:/OpenSSL-Win64/"
)
SET(_OPENSSL_ROOT_HINTS_AND_PATHS
HINTS ${_OPENSSL_ROOT_HINTS}
PATHS ${_OPENSSL_ROOT_PATHS}
)
FIND_PATH(OPENSSL_INCLUDE_DIR
NAMES
openssl/ssl.h
HINTS
${_OPENSSL_INCLUDEDIR}
${_OPENSSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES
include
)
IF(WIN32)
if(${MSVC_RUNTIME} STREQUAL "static")
set(MSVC_RUNTIME_SUFFIX "MT")
else()
set(MSVC_RUNTIME_SUFFIX "MD")
endif()
ENDIF(WIN32)
IF(WIN32 AND NOT CYGWIN)
# MINGW should go here too
IF(MSVC)
# /MD and /MDd are the standard values - if someone wants to use
# others, the libnames have to change here too
# use also ssl and ssleay32 in debug as fallback for openssl < 0.9.8b
# TODO: handle /MT and static lib
# In Visual C++ naming convention each of these four kinds of Windows libraries has it's standard suffix:
# * MD for dynamic-release
# * MDd for dynamic-debug
# * MT for static-release
# * MTd for static-debug
# Implementation details:
# We are using the libraries located in the VC subdir instead of the parent directory eventhough :
# libeay32MD.lib is identical to ../libeay32.lib, and
# ssleay32MD.lib is identical to ../ssleay32.lib
if(DEFINED OPENSSL_STATIC)
set(MSVC_RUNTIME_PATH_SUFFIX "lib/VC/static")
else()
set(MSVC_RUNTIME_PATH_SUFFIX "")
endif()
FIND_LIBRARY(LIB_EAY_DEBUG
NAMES
"libeay32${MSVC_RUNTIME_SUFFIX}d"
libeay32
${_OPENSSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES
${MSVC_RUNTIME_PATH_SUFFIX}
"lib"
"VC"
"lib/VC"
)
FIND_LIBRARY(LIB_EAY_RELEASE
NAMES
"libeay32${MSVC_RUNTIME_SUFFIX}"
libeay32
${_OPENSSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES
${MSVC_RUNTIME_PATH_SUFFIX}
"lib"
"VC"
"lib/VC"
)
FIND_LIBRARY(SSL_EAY_DEBUG
NAMES
"ssleay32${MSVC_RUNTIME_SUFFIX}d"
ssleay32
ssl
${_OPENSSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES
${MSVC_RUNTIME_PATH_SUFFIX}
"lib"
"VC"
"lib/VC"
)
FIND_LIBRARY(SSL_EAY_RELEASE
NAMES
"ssleay32${MSVC_RUNTIME_SUFFIX}"
ssleay32
ssl
${_OPENSSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES
${MSVC_RUNTIME_PATH_SUFFIX}
"lib"
"VC"
"lib/VC"
)
if( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
set( OPENSSL_LIBRARIES
optimized ${SSL_EAY_RELEASE} debug ${SSL_EAY_DEBUG}
optimized ${LIB_EAY_RELEASE} debug ${LIB_EAY_DEBUG}
)
else()
set( OPENSSL_LIBRARIES ${SSL_EAY_RELEASE} ${LIB_EAY_RELEASE} )
endif()
MARK_AS_ADVANCED(SSL_EAY_DEBUG SSL_EAY_RELEASE)
MARK_AS_ADVANCED(LIB_EAY_DEBUG LIB_EAY_RELEASE)
ELSEIF(MINGW)
# same player, for MingW
FIND_LIBRARY(LIB_EAY
NAMES
libeay32
${_OPENSSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES
"lib"
"lib/MinGW"
)
FIND_LIBRARY(SSL_EAY
NAMES
ssleay32
${_OPENSSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES
"lib"
"lib/MinGW"
)
MARK_AS_ADVANCED(SSL_EAY LIB_EAY)
set( OPENSSL_LIBRARIES ${SSL_EAY} ${LIB_EAY} )
ELSE(MSVC)
# Not sure what to pick for -say- intel, let's use the toplevel ones and hope someone report issues:
FIND_LIBRARY(LIB_EAY
NAMES
libeay32
HINTS
${_OPENSSL_LIBDIR}
${_OPENSSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES
lib
)
FIND_LIBRARY(SSL_EAY
NAMES
ssleay32
HINTS
${_OPENSSL_LIBDIR}
${_OPENSSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES
lib
)
MARK_AS_ADVANCED(SSL_EAY LIB_EAY)
set( OPENSSL_LIBRARIES ${SSL_EAY} ${LIB_EAY} )
ENDIF(MSVC)
ELSE(WIN32 AND NOT CYGWIN)
FIND_LIBRARY(OPENSSL_SSL_LIBRARY
NAMES
ssl
ssleay32
"ssleay32${MSVC_RUNTIME_SUFFIX}"
HINTS
${_OPENSSL_LIBDIR}
${_OPENSSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES
lib
)
FIND_LIBRARY(OPENSSL_CRYPTO_LIBRARY
NAMES
crypto
HINTS
${_OPENSSL_LIBDIR}
${_OPENSSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES
lib
)
MARK_AS_ADVANCED(OPENSSL_CRYPTO_LIBRARY OPENSSL_SSL_LIBRARY)
# compat defines
SET(OPENSSL_SSL_LIBRARIES ${OPENSSL_SSL_LIBRARY})
SET(OPENSSL_CRYPTO_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY})
SET(OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY})
ENDIF(WIN32 AND NOT CYGWIN)
function(from_hex HEX DEC)
string(TOUPPER "${HEX}" HEX)
set(_res 0)
string(LENGTH "${HEX}" _strlen)
while (_strlen GREATER 0)
math(EXPR _res "${_res} * 16")
string(SUBSTRING "${HEX}" 0 1 NIBBLE)
string(SUBSTRING "${HEX}" 1 -1 HEX)
if (NIBBLE STREQUAL "A")
math(EXPR _res "${_res} + 10")
elseif (NIBBLE STREQUAL "B")
math(EXPR _res "${_res} + 11")
elseif (NIBBLE STREQUAL "C")
math(EXPR _res "${_res} + 12")
elseif (NIBBLE STREQUAL "D")
math(EXPR _res "${_res} + 13")
elseif (NIBBLE STREQUAL "E")
math(EXPR _res "${_res} + 14")
elseif (NIBBLE STREQUAL "F")
math(EXPR _res "${_res} + 15")
else()
math(EXPR _res "${_res} + ${NIBBLE}")
endif()
string(LENGTH "${HEX}" _strlen)
endwhile()
set(${DEC} ${_res} PARENT_SCOPE)
endfunction(from_hex)
if (OPENSSL_INCLUDE_DIR)
if (_OPENSSL_VERSION)
set(OPENSSL_VERSION "${_OPENSSL_VERSION}")
elseif(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h")
file(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" openssl_version_str
REGEX "^#define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])+.*")
# The version number is encoded as 0xMNNFFPPS: major minor fix patch status
# The status gives if this is a developer or prerelease and is ignored here.
# Major, minor, and fix directly translate into the version numbers shown in
# the string. The patch field translates to the single character suffix that
# indicates the bug fix state, which 00 -> nothing, 01 -> a, 02 -> b and so
# on.
string(REGEX REPLACE "^.*OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F]).*$"
"\\1;\\2;\\3;\\4;\\5" OPENSSL_VERSION_LIST "${openssl_version_str}")
list(GET OPENSSL_VERSION_LIST 0 OPENSSL_VERSION_MAJOR)
list(GET OPENSSL_VERSION_LIST 1 OPENSSL_VERSION_MINOR)
from_hex("${OPENSSL_VERSION_MINOR}" OPENSSL_VERSION_MINOR)
list(GET OPENSSL_VERSION_LIST 2 OPENSSL_VERSION_FIX)
from_hex("${OPENSSL_VERSION_FIX}" OPENSSL_VERSION_FIX)
list(GET OPENSSL_VERSION_LIST 3 OPENSSL_VERSION_PATCH)
if (NOT OPENSSL_VERSION_PATCH STREQUAL "00")
from_hex("${OPENSSL_VERSION_PATCH}" _tmp)
# 96 is the ASCII code of 'a' minus 1
math(EXPR OPENSSL_VERSION_PATCH_ASCII "${_tmp} + 96")
unset(_tmp)
# Once anyone knows how OpenSSL would call the patch versions beyond 'z'
# this should be updated to handle that, too. This has not happened yet
# so it is simply ignored here for now.
string(ASCII "${OPENSSL_VERSION_PATCH_ASCII}" OPENSSL_VERSION_PATCH_STRING)
endif (NOT OPENSSL_VERSION_PATCH STREQUAL "00")
set(OPENSSL_VERSION "${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_MINOR}.${OPENSSL_VERSION_FIX}${OPENSSL_VERSION_PATCH_STRING}")
endif (_OPENSSL_VERSION)
endif (OPENSSL_INCLUDE_DIR)
include(FindPackageHandleStandardArgs)
if (OPENSSL_VERSION)
find_package_handle_standard_args(OpenSSL
REQUIRED_VARS
OPENSSL_LIBRARIES
OPENSSL_INCLUDE_DIR
VERSION_VAR
OPENSSL_VERSION
FAIL_MESSAGE
"Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR"
)
else (OPENSSL_VERSION)
find_package_handle_standard_args(OpenSSL "Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR"
OPENSSL_LIBRARIES
OPENSSL_INCLUDE_DIR
)
endif (OPENSSL_VERSION)
MARK_AS_ADVANCED(OPENSSL_INCLUDE_DIR OPENSSL_LIBRARIES)

38
cmake/MSVCRuntime.cmake Normal file
View File

@ -0,0 +1,38 @@
macro(configure_msvc_runtime)
if(MSVC)
# Default to statically-linked runtime.
if("${MSVC_RUNTIME}" STREQUAL "")
set(MSVC_RUNTIME "dynamic")
endif()
# Set compiler options.
set(variables
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_MINSIZEREL
CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_MINSIZEREL
CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_RELWITHDEBINFO
)
if(${MSVC_RUNTIME} STREQUAL "static")
message(STATUS "MSVC: using statically-linked runtime (/MT and /MTd).")
foreach(variable ${variables})
if(${variable} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${variable} "${${variable}}")
endif()
endforeach()
else()
message(STATUS "MSVC: using dynamically-linked runtime (/MD and /MDd).")
foreach(variable ${variables})
if(${variable} MATCHES "/MT")
string(REGEX REPLACE "/MT" "/MD" ${variable} "${${variable}}")
endif()
endforeach()
endif()
foreach(variable ${variables})
set(${variable} "${${variable}}" CACHE STRING "MSVC_${variable}" FORCE)
endforeach()
endif()
endmacro(configure_msvc_runtime)

View File

@ -6,7 +6,7 @@
*/
#ifndef ERRORCODES_H
#define ERRORCODES_H
#define ERRORCODES_H
#ifdef __cplusplus
extern "C" {

View File

@ -24,7 +24,7 @@ typedef struct rdp_input rdpInput;
#include <freerdp/api.h>
#include <freerdp/freerdp.h>
#include <freerdp/keyboard_scancode.h>
#include <freerdp/scancode.h>
/* keyboard Flags */
#define KBD_FLAGS_EXTENDED 0x0100
@ -76,14 +76,9 @@ struct rdp_input
FREERDP_API void freerdp_input_send_synchronize_event(rdpInput* input, uint32 flags);
FREERDP_API void freerdp_input_send_keyboard_event(rdpInput* input, uint16 flags, uint16 code);
FREERDP_API void freerdp_input_send_keyboard_event_ex(rdpInput* input, boolean down, uint32 rdp_scancode);
FREERDP_API void freerdp_input_send_unicode_keyboard_event(rdpInput* input, uint16 flags, uint16 code);
FREERDP_API void freerdp_input_send_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y);
FREERDP_API void freerdp_input_send_extended_mouse_event(rdpInput* input, uint16 flags, uint16 x, uint16 y);
#define freerdp_input_send_keyboard_event_2(input, down, rdp_scancode) \
freerdp_input_send_keyboard_event(input, \
(rdp_scancode_extended(rdp_scancode) ? KBD_FLAGS_EXTENDED : 0) | \
((down) ? KBD_FLAGS_DOWN : KBD_FLAGS_RELEASE), \
rdp_scancode_code(rdp_scancode))
#endif /* __INPUT_API_H */

View File

@ -1,186 +0,0 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* RDP protocol "scancodes"
*
* Copyright 2009-2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __FREERDP_LOCALE_KEYBOARD_RDP_SCANCODE_H
#define __FREERDP_LOCALE_KEYBOARD_RDP_SCANCODE_H
/* @msdn{cc240584} says:
* "... (a scancode is an 8-bit value specifying a key location on the keyboard).
* The server accepts a scancode value and translates it into the correct character depending on the language locale and keyboard layout used in the session."
* The 8-bit value is later called "keyCode"
* The extended flag is for all practical an important 9th bit with a strange encoding - not just a modifier.
*/
typedef uint32 RDP_SCANCODE; /* Our own representation of a RDP protocol scancode */
#define rdp_scancode_code(_rdp_scancode) ((uint8)(_rdp_scancode & 0xff))
#define rdp_scancode_extended(_rdp_scancode) (((_rdp_scancode) & 0x100) ? true : false)
#define mk_rdp_scancode(_code, _extended) (((_code) & 0xff) | ((_extended) ? 0x100 : 0))
/* Defines for known RDP_SCANCODE protocol values.
* Mostly the same as the PKBDLLHOOKSTRUCT scanCode, "A hardware scan code for the key", @msdn{ms644967}.
* Based @msdn{ms894073} US, @msdn{ms894072} UK, @msdn{ms892472} */
#define RDP_SCANCODE_UNKNOWN mk_rdp_scancode(0x00, false)
#define RDP_SCANCODE_ESCAPE mk_rdp_scancode(0x01, false) /* VK_ESCAPE */
#define RDP_SCANCODE_KEY_1 mk_rdp_scancode(0x02, false) /* VK_KEY_1 */
#define RDP_SCANCODE_KEY_2 mk_rdp_scancode(0x03, false) /* VK_KEY_2 */
#define RDP_SCANCODE_KEY_3 mk_rdp_scancode(0x04, false) /* VK_KEY_3 */
#define RDP_SCANCODE_KEY_4 mk_rdp_scancode(0x05, false) /* VK_KEY_4 */
#define RDP_SCANCODE_KEY_5 mk_rdp_scancode(0x06, false) /* VK_KEY_5 */
#define RDP_SCANCODE_KEY_6 mk_rdp_scancode(0x07, false) /* VK_KEY_6 */
#define RDP_SCANCODE_KEY_7 mk_rdp_scancode(0x08, false) /* VK_KEY_7 */
#define RDP_SCANCODE_KEY_8 mk_rdp_scancode(0x09, false) /* VK_KEY_8 */
#define RDP_SCANCODE_KEY_9 mk_rdp_scancode(0x0A, false) /* VK_KEY_9 */
#define RDP_SCANCODE_KEY_0 mk_rdp_scancode(0x0B, false) /* VK_KEY_0 */
#define RDP_SCANCODE_OEM_MINUS mk_rdp_scancode(0x0C, false) /* VK_OEM_MINUS */
#define RDP_SCANCODE_OEM_PLUS mk_rdp_scancode(0x0D, false) /* VK_OEM_PLUS */
#define RDP_SCANCODE_BACKSPACE mk_rdp_scancode(0x0E, false) /* VK_BACK Backspace */
#define RDP_SCANCODE_TAB mk_rdp_scancode(0x0F, false) /* VK_TAB */
#define RDP_SCANCODE_KEY_Q mk_rdp_scancode(0x10, false) /* VK_KEY_Q */
#define RDP_SCANCODE_KEY_W mk_rdp_scancode(0x11, false) /* VK_KEY_W */
#define RDP_SCANCODE_KEY_E mk_rdp_scancode(0x12, false) /* VK_KEY_E */
#define RDP_SCANCODE_KEY_R mk_rdp_scancode(0x13, false) /* VK_KEY_R */
#define RDP_SCANCODE_KEY_T mk_rdp_scancode(0x14, false) /* VK_KEY_T */
#define RDP_SCANCODE_KEY_Y mk_rdp_scancode(0x15, false) /* VK_KEY_Y */
#define RDP_SCANCODE_KEY_U mk_rdp_scancode(0x16, false) /* VK_KEY_U */
#define RDP_SCANCODE_KEY_I mk_rdp_scancode(0x17, false) /* VK_KEY_I */
#define RDP_SCANCODE_KEY_O mk_rdp_scancode(0x18, false) /* VK_KEY_O */
#define RDP_SCANCODE_KEY_P mk_rdp_scancode(0x19, false) /* VK_KEY_P */
#define RDP_SCANCODE_OEM_4 mk_rdp_scancode(0x1A, false) /* VK_OEM_4 '[' on US */
#define RDP_SCANCODE_OEM_6 mk_rdp_scancode(0x1B, false) /* VK_OEM_6 ']' on US */
#define RDP_SCANCODE_RETURN mk_rdp_scancode(0x1C, false) /* VK_RETURN Normal Enter */
#define RDP_SCANCODE_LCONTROL mk_rdp_scancode(0x1D, false) /* VK_LCONTROL */
#define RDP_SCANCODE_KEY_A mk_rdp_scancode(0x1E, false) /* VK_KEY_A */
#define RDP_SCANCODE_KEY_S mk_rdp_scancode(0x1F, false) /* VK_KEY_S */
#define RDP_SCANCODE_KEY_D mk_rdp_scancode(0x20, false) /* VK_KEY_D */
#define RDP_SCANCODE_KEY_F mk_rdp_scancode(0x21, false) /* VK_KEY_F */
#define RDP_SCANCODE_KEY_G mk_rdp_scancode(0x22, false) /* VK_KEY_G */
#define RDP_SCANCODE_KEY_H mk_rdp_scancode(0x23, false) /* VK_KEY_H */
#define RDP_SCANCODE_KEY_J mk_rdp_scancode(0x24, false) /* VK_KEY_J */
#define RDP_SCANCODE_KEY_K mk_rdp_scancode(0x25, false) /* VK_KEY_K */
#define RDP_SCANCODE_KEY_L mk_rdp_scancode(0x26, false) /* VK_KEY_L */
#define RDP_SCANCODE_OEM_1 mk_rdp_scancode(0x27, false) /* VK_OEM_1 ';' on US */
#define RDP_SCANCODE_OEM_7 mk_rdp_scancode(0x28, false) /* VK_OEM_7 "'" on US */
#define RDP_SCANCODE_OEM_3 mk_rdp_scancode(0x29, false) /* VK_OEM_3 Top left, '`' on US, JP DBE_SBCSCHAR */
#define RDP_SCANCODE_LSHIFT mk_rdp_scancode(0x2A, false) /* VK_LSHIFT */
#define RDP_SCANCODE_OEM_5 mk_rdp_scancode(0x2B, false) /* VK_OEM_5 Next to Enter, '\' on US */
#define RDP_SCANCODE_KEY_Z mk_rdp_scancode(0x2C, false) /* VK_KEY_Z */
#define RDP_SCANCODE_KEY_X mk_rdp_scancode(0x2D, false) /* VK_KEY_X */
#define RDP_SCANCODE_KEY_C mk_rdp_scancode(0x2E, false) /* VK_KEY_C */
#define RDP_SCANCODE_KEY_V mk_rdp_scancode(0x2F, false) /* VK_KEY_V */
#define RDP_SCANCODE_KEY_B mk_rdp_scancode(0x30, false) /* VK_KEY_B */
#define RDP_SCANCODE_KEY_N mk_rdp_scancode(0x31, false) /* VK_KEY_N */
#define RDP_SCANCODE_KEY_M mk_rdp_scancode(0x32, false) /* VK_KEY_M */
#define RDP_SCANCODE_OEM_COMMA mk_rdp_scancode(0x33, false) /* VK_OEM_COMMA */
#define RDP_SCANCODE_OEM_PERIOD mk_rdp_scancode(0x34, false) /* VK_OEM_PERIOD */
#define RDP_SCANCODE_OEM_2 mk_rdp_scancode(0x35, false) /* VK_OEM_2 '/' on US */
#define RDP_SCANCODE_RSHIFT mk_rdp_scancode(0x36, false) /* VK_RSHIFT */
#define RDP_SCANCODE_MULTIPLY mk_rdp_scancode(0x37, false) /* VK_MULTIPLY Numerical */
#define RDP_SCANCODE_LMENU mk_rdp_scancode(0x38, false) /* VK_LMENU Left 'Alt' key */
#define RDP_SCANCODE_SPACE mk_rdp_scancode(0x39, false) /* VK_SPACE */
#define RDP_SCANCODE_CAPSLOCK mk_rdp_scancode(0x3A, false) /* VK_CAPITAL 'Caps Lock', JP DBE_ALPHANUMERIC */
#define RDP_SCANCODE_F1 mk_rdp_scancode(0x3B, false) /* VK_F1 */
#define RDP_SCANCODE_F2 mk_rdp_scancode(0x3C, false) /* VK_F2 */
#define RDP_SCANCODE_F3 mk_rdp_scancode(0x3D, false) /* VK_F3 */
#define RDP_SCANCODE_F4 mk_rdp_scancode(0x3E, false) /* VK_F4 */
#define RDP_SCANCODE_F5 mk_rdp_scancode(0x3F, false) /* VK_F5 */
#define RDP_SCANCODE_F6 mk_rdp_scancode(0x40, false) /* VK_F6 */
#define RDP_SCANCODE_F7 mk_rdp_scancode(0x41, false) /* VK_F7 */
#define RDP_SCANCODE_F8 mk_rdp_scancode(0x42, false) /* VK_F8 */
#define RDP_SCANCODE_F9 mk_rdp_scancode(0x43, false) /* VK_F9 */
#define RDP_SCANCODE_F10 mk_rdp_scancode(0x44, false) /* VK_F10 */
#define RDP_SCANCODE_NUMLOCK mk_rdp_scancode(0x45, false) /* VK_NUMLOCK */ /* Note: when this seems to appear in PKBDLLHOOKSTRUCT it means Pause which must be sent as Ctrl + NumLock */
#define RDP_SCANCODE_SCROLLLOCK mk_rdp_scancode(0x46, false) /* VK_SCROLL 'Scroll Lock', JP OEM_SCROLL */
#define RDP_SCANCODE_NUMPAD7 mk_rdp_scancode(0x47, false) /* VK_NUMPAD7 */
#define RDP_SCANCODE_NUMPAD8 mk_rdp_scancode(0x48, false) /* VK_NUMPAD8 */
#define RDP_SCANCODE_NUMPAD9 mk_rdp_scancode(0x49, false) /* VK_NUMPAD9 */
#define RDP_SCANCODE_SUBTRACT mk_rdp_scancode(0x4A, false) /* VK_SUBTRACT */
#define RDP_SCANCODE_NUMPAD4 mk_rdp_scancode(0x4B, false) /* VK_NUMPAD4 */
#define RDP_SCANCODE_NUMPAD5 mk_rdp_scancode(0x4C, false) /* VK_NUMPAD5 */
#define RDP_SCANCODE_NUMPAD6 mk_rdp_scancode(0x4D, false) /* VK_NUMPAD6 */
#define RDP_SCANCODE_ADD mk_rdp_scancode(0x4E, false) /* VK_ADD */
#define RDP_SCANCODE_NUMPAD1 mk_rdp_scancode(0x4F, false) /* VK_NUMPAD1 */
#define RDP_SCANCODE_NUMPAD2 mk_rdp_scancode(0x50, false) /* VK_NUMPAD2 */
#define RDP_SCANCODE_NUMPAD3 mk_rdp_scancode(0x51, false) /* VK_NUMPAD3 */
#define RDP_SCANCODE_NUMPAD0 mk_rdp_scancode(0x52, false) /* VK_NUMPAD0 */
#define RDP_SCANCODE_DECIMAL mk_rdp_scancode(0x53, false) /* VK_DECIMAL Numerical, '.' on US */
#define RDP_SCANCODE_SYSREQ mk_rdp_scancode(0x54, false) /* Sys Req */
#define RDP_SCANCODE_OEM_102 mk_rdp_scancode(0x56, false) /* VK_OEM_102 Lower left '\' on US */
#define RDP_SCANCODE_F11 mk_rdp_scancode(0x57, false) /* VK_F11 */
#define RDP_SCANCODE_F12 mk_rdp_scancode(0x58, false) /* VK_F12 */
#define RDP_SCANCODE_SLEEP mk_rdp_scancode(0x5F, false) /* VK_SLEEP OEM_8 on FR (undocumented?) */
#define RDP_SCANCODE_ZOOM mk_rdp_scancode(0x62, false) /* VK_ZOOM (undocumented?) */
#define RDP_SCANCODE_HELP mk_rdp_scancode(0x63, false) /* VK_HELP (undocumented?) */
#define RDP_SCANCODE_F13 mk_rdp_scancode(0x64, false) /* VK_F13 */ /* JP agree, should 0x7d according to ms894073 */
#define RDP_SCANCODE_F14 mk_rdp_scancode(0x65, false) /* VK_F14 */
#define RDP_SCANCODE_F15 mk_rdp_scancode(0x66, false) /* VK_F15 */
#define RDP_SCANCODE_F16 mk_rdp_scancode(0x67, false) /* VK_F16 */
#define RDP_SCANCODE_F17 mk_rdp_scancode(0x68, false) /* VK_F17 */
#define RDP_SCANCODE_F18 mk_rdp_scancode(0x69, false) /* VK_F18 */
#define RDP_SCANCODE_F19 mk_rdp_scancode(0x6A, false) /* VK_F19 */
#define RDP_SCANCODE_F20 mk_rdp_scancode(0x6B, false) /* VK_F20 */
#define RDP_SCANCODE_F21 mk_rdp_scancode(0x6C, false) /* VK_F21 */
#define RDP_SCANCODE_F22 mk_rdp_scancode(0x6D, false) /* VK_F22 */
#define RDP_SCANCODE_F23 mk_rdp_scancode(0x6E, false) /* VK_F23 */ /* JP agree */
#define RDP_SCANCODE_F24 mk_rdp_scancode(0x6F, false) /* VK_F24 */ /* 0x87 according to ms894073 */
#define RDP_SCANCODE_HIRAGANA mk_rdp_scancode(0x70, false) /* JP DBE_HIRAGANA */
#define RDP_SCANCODE_HANJA_KANJI mk_rdp_scancode(0x71, false) /* VK_HANJA / VK_KANJI (undocumented?) */
#define RDP_SCANCODE_KANA_HANGUL mk_rdp_scancode(0x72, false) /* VK_KANA / VK_HANGUL (undocumented?) */
#define RDP_SCANCODE_ABNT_C1 mk_rdp_scancode(0x73, false) /* VK_ABNT_C1 JP OEM_102 */
#define RDP_SCANCODE_F24_JP mk_rdp_scancode(0x76, false) /* JP F24 */
#define RDP_SCANCODE_CONVERT_JP mk_rdp_scancode(0x79, false) /* JP CONVERT */
#define RDP_SCANCODE_NONCONVERT_JP mk_rdp_scancode(0x7B, false) /* JP NONCONVERT */
#define RDP_SCANCODE_TAB_JP mk_rdp_scancode(0x7C, false) /* JP TAB */
#define RDP_SCANCODE_BACKSLASH_JP mk_rdp_scancode(0x7D, false) /* JP OEM_5 ('\') */
#define RDP_SCANCODE_ABNT_C2 mk_rdp_scancode(0x7E, false) /* VK_ABNT_C2, JP */
#define RDP_SCANCODE_ABNT_C2 mk_rdp_scancode(0x7E, false) /* JP OEM_PA2 */
#define RDP_SCANCODE_RETURN_KP mk_rdp_scancode(0x1C, true) /* not RDP_SCANCODE_RETURN Numerical Enter */
#define RDP_SCANCODE_RCONTROL mk_rdp_scancode(0x1D, true) /* VK_RCONTROL */
#define RDP_SCANCODE_DIVIDE mk_rdp_scancode(0x35, true) /* VK_DIVIDE Numerical */
#define RDP_SCANCODE_PRINTSCREEN mk_rdp_scancode(0x37, true) /* VK_EXECUTE/VK_PRINT/VK_SNAPSHOT Print Screen */
#define RDP_SCANCODE_RMENU mk_rdp_scancode(0x38, true) /* VK_RMENU Right 'Alt' / 'Alt Gr' */
#define RDP_SCANCODE_PAUSE mk_rdp_scancode(0x46, true) /* VK_PAUSE Pause / Break (Slightly special handling) */
#define RDP_SCANCODE_HOME mk_rdp_scancode(0x47, true) /* VK_HOME */
#define RDP_SCANCODE_UP mk_rdp_scancode(0x48, true) /* VK_UP */
#define RDP_SCANCODE_PRIOR mk_rdp_scancode(0x49, true) /* VK_PRIOR 'Page Up' */
#define RDP_SCANCODE_LEFT mk_rdp_scancode(0x4B, true) /* VK_LEFT */
#define RDP_SCANCODE_RIGHT mk_rdp_scancode(0x4D, true) /* VK_RIGHT */
#define RDP_SCANCODE_END mk_rdp_scancode(0x4F, true) /* VK_END */
#define RDP_SCANCODE_DOWN mk_rdp_scancode(0x50, true) /* VK_DOWN */
#define RDP_SCANCODE_NEXT mk_rdp_scancode(0x51, true) /* VK_NEXT 'Page Down' */
#define RDP_SCANCODE_INSERT mk_rdp_scancode(0x52, true) /* VK_INSERT */
#define RDP_SCANCODE_DELETE mk_rdp_scancode(0x53, true) /* VK_DELETE */
#define RDP_SCANCODE_NULL mk_rdp_scancode(0x54, true) /* <00> */
#define RDP_SCANCODE_HELP2 mk_rdp_scancode(0x56, true) /* Help - documented, different from VK_HELP */
#define RDP_SCANCODE_LWIN mk_rdp_scancode(0x5B, true) /* VK_LWIN */
#define RDP_SCANCODE_RWIN mk_rdp_scancode(0x5C, true) /* VK_RWIN */
#define RDP_SCANCODE_APPS mk_rdp_scancode(0x5D, true) /* VK_APPS Application */
#define RDP_SCANCODE_POWER_JP mk_rdp_scancode(0x5E, true) /* JP POWER */
#define RDP_SCANCODE_SLEEP_JP mk_rdp_scancode(0x5F, true) /* JP SLEEP */
/* _not_ valid scancode, but this is what a windows PKBDLLHOOKSTRUCT for NumLock contains */
#define RDP_SCANCODE_NUMLOCK_EXTENDED mk_rdp_scancode(0x45, true) /* should be RDP_SCANCODE_NUMLOCK */
#define RDP_SCANCODE_RSHIFT_EXTENDED mk_rdp_scancode(0x36, true) /* should be RDP_SCANCODE_RSHIFT */
#endif /* __FREERDP_LOCALE_KEYBOARD_RDP_SCANCODE_H */

View File

@ -22,8 +22,8 @@
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <freerdp/locale/virtual_key_codes.h>
#include <freerdp/keyboard_scancode.h>
#include <freerdp/scancode.h>
#include <freerdp/locale/vkcodes.h>
#define RDP_KEYBOARD_LAYOUT_TYPE_STANDARD 1
#define RDP_KEYBOARD_LAYOUT_TYPE_VARIANT 2
@ -189,12 +189,20 @@ typedef struct _RDP_KEYBOARD_LAYOUT RDP_KEYBOARD_LAYOUT;
#define KBD_CHINESE_TRADITIONAL_MICROSOFT_PINYIN_IME_3 0xE00E0804
#define KBD_CHINESE_TRADITIONAL_ALPHANUMERIC 0xE00F0404
/* Keyboard Types */
#define KBD_TYPE_IBM_PC_XT 0x00000001 /* IBM PC/XT or compatible (83-key) keyboard */
#define KBD_TYPE_OLIVETTI_ICO 0x00000002 /* Olivetti "ICO" (102-key) keyboard */
#define KBD_TYPE_IBM_PC_AT 0x00000003 /* IBM PC/AT (84-key) and similar keyboards */
#define KBD_TYPE_IBM_ENHANCED 0x00000004 /* IBM enhanced (101-key or 102-key) keyboard */
#define KBD_TYPE_NOKIA_1050 0x00000005 /* Nokia 1050 and similar keyboards */
#define KBD_TYPE_NOKIA_9140 0x00000006 /* Nokia 9140 and similar keyboards */
#define KBD_TYPE_JAPANESE 0x00000007 /* Japanese keyboard */
FREERDP_API uint32 freerdp_keyboard_init(uint32 keyboardLayoutId);
FREERDP_API RDP_KEYBOARD_LAYOUT* freerdp_keyboard_get_layouts(uint32 types);
FREERDP_API const char* freerdp_keyboard_get_layout_name_from_id(uint32 keyboardLayoutId);
FREERDP_API RDP_SCANCODE freerdp_keyboard_get_rdp_scancode_from_x11_keycode(uint32 keycode);
FREERDP_API uint32 freerdp_keyboard_get_x11_keycode_from_rdp_scancode(uint32 scancode, boolean extended);
FREERDP_API RDP_SCANCODE freerdp_keyboard_get_rdp_scancode_from_virtual_key_code(uint32 vkcode);
FREERDP_API void freerdp_keyboard_set_layout_code(rdpSettings* settings);
#endif /* __FREERDP_LOCALE_KEYBOARD_H */

185
include/freerdp/scancode.h Normal file
View File

@ -0,0 +1,185 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* RDP protocol "scancodes"
*
* Copyright 2009-2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __FREERDP_LOCALE_KEYBOARD_RDP_SCANCODE_H
#define __FREERDP_LOCALE_KEYBOARD_RDP_SCANCODE_H
/* @msdn{cc240584} says:
* "... (a scancode is an 8-bit value specifying a key location on the keyboard).
* The server accepts a scancode value and translates it into the correct character depending on the language locale and keyboard layout used in the session."
* The 8-bit value is later called "keyCode"
* The extended flag is for all practical an important 9th bit with a strange encoding - not just a modifier.
*/
typedef uint32 RDP_SCANCODE; /* Our own representation of a RDP protocol scancode */
#define RDP_SCANCODE_CODE(_rdp_scancode) ((uint8)(_rdp_scancode & 0xFF))
#define RDP_SCANCODE_EXTENDED(_rdp_scancode) (((_rdp_scancode) & 0x100) ? true : false)
#define MAKE_RDP_SCANCODE(_code, _extended) (((_code) & 0xFF) | ((_extended) ? 0x100 : 0))
/* Defines for known RDP_SCANCODE protocol values.
* Mostly the same as the PKBDLLHOOKSTRUCT scanCode, "A hardware scan code for the key", @msdn{ms644967}.
* Based @msdn{ms894073} US, @msdn{ms894072} UK, @msdn{ms892472} */
#define RDP_SCANCODE_UNKNOWN MAKE_RDP_SCANCODE(0x00, false)
#define RDP_SCANCODE_ESCAPE MAKE_RDP_SCANCODE(0x01, false) /* VK_ESCAPE */
#define RDP_SCANCODE_KEY_1 MAKE_RDP_SCANCODE(0x02, false) /* VK_KEY_1 */
#define RDP_SCANCODE_KEY_2 MAKE_RDP_SCANCODE(0x03, false) /* VK_KEY_2 */
#define RDP_SCANCODE_KEY_3 MAKE_RDP_SCANCODE(0x04, false) /* VK_KEY_3 */
#define RDP_SCANCODE_KEY_4 MAKE_RDP_SCANCODE(0x05, false) /* VK_KEY_4 */
#define RDP_SCANCODE_KEY_5 MAKE_RDP_SCANCODE(0x06, false) /* VK_KEY_5 */
#define RDP_SCANCODE_KEY_6 MAKE_RDP_SCANCODE(0x07, false) /* VK_KEY_6 */
#define RDP_SCANCODE_KEY_7 MAKE_RDP_SCANCODE(0x08, false) /* VK_KEY_7 */
#define RDP_SCANCODE_KEY_8 MAKE_RDP_SCANCODE(0x09, false) /* VK_KEY_8 */
#define RDP_SCANCODE_KEY_9 MAKE_RDP_SCANCODE(0x0A, false) /* VK_KEY_9 */
#define RDP_SCANCODE_KEY_0 MAKE_RDP_SCANCODE(0x0B, false) /* VK_KEY_0 */
#define RDP_SCANCODE_OEM_MINUS MAKE_RDP_SCANCODE(0x0C, false) /* VK_OEM_MINUS */
#define RDP_SCANCODE_OEM_PLUS MAKE_RDP_SCANCODE(0x0D, false) /* VK_OEM_PLUS */
#define RDP_SCANCODE_BACKSPACE MAKE_RDP_SCANCODE(0x0E, false) /* VK_BACK Backspace */
#define RDP_SCANCODE_TAB MAKE_RDP_SCANCODE(0x0F, false) /* VK_TAB */
#define RDP_SCANCODE_KEY_Q MAKE_RDP_SCANCODE(0x10, false) /* VK_KEY_Q */
#define RDP_SCANCODE_KEY_W MAKE_RDP_SCANCODE(0x11, false) /* VK_KEY_W */
#define RDP_SCANCODE_KEY_E MAKE_RDP_SCANCODE(0x12, false) /* VK_KEY_E */
#define RDP_SCANCODE_KEY_R MAKE_RDP_SCANCODE(0x13, false) /* VK_KEY_R */
#define RDP_SCANCODE_KEY_T MAKE_RDP_SCANCODE(0x14, false) /* VK_KEY_T */
#define RDP_SCANCODE_KEY_Y MAKE_RDP_SCANCODE(0x15, false) /* VK_KEY_Y */
#define RDP_SCANCODE_KEY_U MAKE_RDP_SCANCODE(0x16, false) /* VK_KEY_U */
#define RDP_SCANCODE_KEY_I MAKE_RDP_SCANCODE(0x17, false) /* VK_KEY_I */
#define RDP_SCANCODE_KEY_O MAKE_RDP_SCANCODE(0x18, false) /* VK_KEY_O */
#define RDP_SCANCODE_KEY_P MAKE_RDP_SCANCODE(0x19, false) /* VK_KEY_P */
#define RDP_SCANCODE_OEM_4 MAKE_RDP_SCANCODE(0x1A, false) /* VK_OEM_4 '[' on US */
#define RDP_SCANCODE_OEM_6 MAKE_RDP_SCANCODE(0x1B, false) /* VK_OEM_6 ']' on US */
#define RDP_SCANCODE_RETURN MAKE_RDP_SCANCODE(0x1C, false) /* VK_RETURN Normal Enter */
#define RDP_SCANCODE_LCONTROL MAKE_RDP_SCANCODE(0x1D, false) /* VK_LCONTROL */
#define RDP_SCANCODE_KEY_A MAKE_RDP_SCANCODE(0x1E, false) /* VK_KEY_A */
#define RDP_SCANCODE_KEY_S MAKE_RDP_SCANCODE(0x1F, false) /* VK_KEY_S */
#define RDP_SCANCODE_KEY_D MAKE_RDP_SCANCODE(0x20, false) /* VK_KEY_D */
#define RDP_SCANCODE_KEY_F MAKE_RDP_SCANCODE(0x21, false) /* VK_KEY_F */
#define RDP_SCANCODE_KEY_G MAKE_RDP_SCANCODE(0x22, false) /* VK_KEY_G */
#define RDP_SCANCODE_KEY_H MAKE_RDP_SCANCODE(0x23, false) /* VK_KEY_H */
#define RDP_SCANCODE_KEY_J MAKE_RDP_SCANCODE(0x24, false) /* VK_KEY_J */
#define RDP_SCANCODE_KEY_K MAKE_RDP_SCANCODE(0x25, false) /* VK_KEY_K */
#define RDP_SCANCODE_KEY_L MAKE_RDP_SCANCODE(0x26, false) /* VK_KEY_L */
#define RDP_SCANCODE_OEM_1 MAKE_RDP_SCANCODE(0x27, false) /* VK_OEM_1 ';' on US */
#define RDP_SCANCODE_OEM_7 MAKE_RDP_SCANCODE(0x28, false) /* VK_OEM_7 "'" on US */
#define RDP_SCANCODE_OEM_3 MAKE_RDP_SCANCODE(0x29, false) /* VK_OEM_3 Top left, '`' on US, JP DBE_SBCSCHAR */
#define RDP_SCANCODE_LSHIFT MAKE_RDP_SCANCODE(0x2A, false) /* VK_LSHIFT */
#define RDP_SCANCODE_OEM_5 MAKE_RDP_SCANCODE(0x2B, false) /* VK_OEM_5 Next to Enter, '\' on US */
#define RDP_SCANCODE_KEY_Z MAKE_RDP_SCANCODE(0x2C, false) /* VK_KEY_Z */
#define RDP_SCANCODE_KEY_X MAKE_RDP_SCANCODE(0x2D, false) /* VK_KEY_X */
#define RDP_SCANCODE_KEY_C MAKE_RDP_SCANCODE(0x2E, false) /* VK_KEY_C */
#define RDP_SCANCODE_KEY_V MAKE_RDP_SCANCODE(0x2F, false) /* VK_KEY_V */
#define RDP_SCANCODE_KEY_B MAKE_RDP_SCANCODE(0x30, false) /* VK_KEY_B */
#define RDP_SCANCODE_KEY_N MAKE_RDP_SCANCODE(0x31, false) /* VK_KEY_N */
#define RDP_SCANCODE_KEY_M MAKE_RDP_SCANCODE(0x32, false) /* VK_KEY_M */
#define RDP_SCANCODE_OEM_COMMA MAKE_RDP_SCANCODE(0x33, false) /* VK_OEM_COMMA */
#define RDP_SCANCODE_OEM_PERIOD MAKE_RDP_SCANCODE(0x34, false) /* VK_OEM_PERIOD */
#define RDP_SCANCODE_OEM_2 MAKE_RDP_SCANCODE(0x35, false) /* VK_OEM_2 '/' on US */
#define RDP_SCANCODE_RSHIFT MAKE_RDP_SCANCODE(0x36, false) /* VK_RSHIFT */
#define RDP_SCANCODE_MULTIPLY MAKE_RDP_SCANCODE(0x37, false) /* VK_MULTIPLY Numerical */
#define RDP_SCANCODE_LMENU MAKE_RDP_SCANCODE(0x38, false) /* VK_LMENU Left 'Alt' key */
#define RDP_SCANCODE_SPACE MAKE_RDP_SCANCODE(0x39, false) /* VK_SPACE */
#define RDP_SCANCODE_CAPSLOCK MAKE_RDP_SCANCODE(0x3A, false) /* VK_CAPITAL 'Caps Lock', JP DBE_ALPHANUMERIC */
#define RDP_SCANCODE_F1 MAKE_RDP_SCANCODE(0x3B, false) /* VK_F1 */
#define RDP_SCANCODE_F2 MAKE_RDP_SCANCODE(0x3C, false) /* VK_F2 */
#define RDP_SCANCODE_F3 MAKE_RDP_SCANCODE(0x3D, false) /* VK_F3 */
#define RDP_SCANCODE_F4 MAKE_RDP_SCANCODE(0x3E, false) /* VK_F4 */
#define RDP_SCANCODE_F5 MAKE_RDP_SCANCODE(0x3F, false) /* VK_F5 */
#define RDP_SCANCODE_F6 MAKE_RDP_SCANCODE(0x40, false) /* VK_F6 */
#define RDP_SCANCODE_F7 MAKE_RDP_SCANCODE(0x41, false) /* VK_F7 */
#define RDP_SCANCODE_F8 MAKE_RDP_SCANCODE(0x42, false) /* VK_F8 */
#define RDP_SCANCODE_F9 MAKE_RDP_SCANCODE(0x43, false) /* VK_F9 */
#define RDP_SCANCODE_F10 MAKE_RDP_SCANCODE(0x44, false) /* VK_F10 */
#define RDP_SCANCODE_NUMLOCK MAKE_RDP_SCANCODE(0x45, false) /* VK_NUMLOCK */ /* Note: when this seems to appear in PKBDLLHOOKSTRUCT it means Pause which must be sent as Ctrl + NumLock */
#define RDP_SCANCODE_SCROLLLOCK MAKE_RDP_SCANCODE(0x46, false) /* VK_SCROLL 'Scroll Lock', JP OEM_SCROLL */
#define RDP_SCANCODE_NUMPAD7 MAKE_RDP_SCANCODE(0x47, false) /* VK_NUMPAD7 */
#define RDP_SCANCODE_NUMPAD8 MAKE_RDP_SCANCODE(0x48, false) /* VK_NUMPAD8 */
#define RDP_SCANCODE_NUMPAD9 MAKE_RDP_SCANCODE(0x49, false) /* VK_NUMPAD9 */
#define RDP_SCANCODE_SUBTRACT MAKE_RDP_SCANCODE(0x4A, false) /* VK_SUBTRACT */
#define RDP_SCANCODE_NUMPAD4 MAKE_RDP_SCANCODE(0x4B, false) /* VK_NUMPAD4 */
#define RDP_SCANCODE_NUMPAD5 MAKE_RDP_SCANCODE(0x4C, false) /* VK_NUMPAD5 */
#define RDP_SCANCODE_NUMPAD6 MAKE_RDP_SCANCODE(0x4D, false) /* VK_NUMPAD6 */
#define RDP_SCANCODE_ADD MAKE_RDP_SCANCODE(0x4E, false) /* VK_ADD */
#define RDP_SCANCODE_NUMPAD1 MAKE_RDP_SCANCODE(0x4F, false) /* VK_NUMPAD1 */
#define RDP_SCANCODE_NUMPAD2 MAKE_RDP_SCANCODE(0x50, false) /* VK_NUMPAD2 */
#define RDP_SCANCODE_NUMPAD3 MAKE_RDP_SCANCODE(0x51, false) /* VK_NUMPAD3 */
#define RDP_SCANCODE_NUMPAD0 MAKE_RDP_SCANCODE(0x52, false) /* VK_NUMPAD0 */
#define RDP_SCANCODE_DECIMAL MAKE_RDP_SCANCODE(0x53, false) /* VK_DECIMAL Numerical, '.' on US */
#define RDP_SCANCODE_SYSREQ MAKE_RDP_SCANCODE(0x54, false) /* Sys Req */
#define RDP_SCANCODE_OEM_102 MAKE_RDP_SCANCODE(0x56, false) /* VK_OEM_102 Lower left '\' on US */
#define RDP_SCANCODE_F11 MAKE_RDP_SCANCODE(0x57, false) /* VK_F11 */
#define RDP_SCANCODE_F12 MAKE_RDP_SCANCODE(0x58, false) /* VK_F12 */
#define RDP_SCANCODE_SLEEP MAKE_RDP_SCANCODE(0x5F, false) /* VK_SLEEP OEM_8 on FR (undocumented?) */
#define RDP_SCANCODE_ZOOM MAKE_RDP_SCANCODE(0x62, false) /* VK_ZOOM (undocumented?) */
#define RDP_SCANCODE_HELP MAKE_RDP_SCANCODE(0x63, false) /* VK_HELP (undocumented?) */
#define RDP_SCANCODE_F13 MAKE_RDP_SCANCODE(0x64, false) /* VK_F13 */ /* JP agree, should 0x7d according to ms894073 */
#define RDP_SCANCODE_F14 MAKE_RDP_SCANCODE(0x65, false) /* VK_F14 */
#define RDP_SCANCODE_F15 MAKE_RDP_SCANCODE(0x66, false) /* VK_F15 */
#define RDP_SCANCODE_F16 MAKE_RDP_SCANCODE(0x67, false) /* VK_F16 */
#define RDP_SCANCODE_F17 MAKE_RDP_SCANCODE(0x68, false) /* VK_F17 */
#define RDP_SCANCODE_F18 MAKE_RDP_SCANCODE(0x69, false) /* VK_F18 */
#define RDP_SCANCODE_F19 MAKE_RDP_SCANCODE(0x6A, false) /* VK_F19 */
#define RDP_SCANCODE_F20 MAKE_RDP_SCANCODE(0x6B, false) /* VK_F20 */
#define RDP_SCANCODE_F21 MAKE_RDP_SCANCODE(0x6C, false) /* VK_F21 */
#define RDP_SCANCODE_F22 MAKE_RDP_SCANCODE(0x6D, false) /* VK_F22 */
#define RDP_SCANCODE_F23 MAKE_RDP_SCANCODE(0x6E, false) /* VK_F23 */ /* JP agree */
#define RDP_SCANCODE_F24 MAKE_RDP_SCANCODE(0x6F, false) /* VK_F24 */ /* 0x87 according to ms894073 */
#define RDP_SCANCODE_HIRAGANA MAKE_RDP_SCANCODE(0x70, false) /* JP DBE_HIRAGANA */
#define RDP_SCANCODE_HANJA_KANJI MAKE_RDP_SCANCODE(0x71, false) /* VK_HANJA / VK_KANJI (undocumented?) */
#define RDP_SCANCODE_KANA_HANGUL MAKE_RDP_SCANCODE(0x72, false) /* VK_KANA / VK_HANGUL (undocumented?) */
#define RDP_SCANCODE_ABNT_C1 MAKE_RDP_SCANCODE(0x73, false) /* VK_ABNT_C1 JP OEM_102 */
#define RDP_SCANCODE_F24_JP MAKE_RDP_SCANCODE(0x76, false) /* JP F24 */
#define RDP_SCANCODE_CONVERT_JP MAKE_RDP_SCANCODE(0x79, false) /* JP CONVERT */
#define RDP_SCANCODE_NONCONVERT_JP MAKE_RDP_SCANCODE(0x7B, false) /* JP NONCONVERT */
#define RDP_SCANCODE_TAB_JP MAKE_RDP_SCANCODE(0x7C, false) /* JP TAB */
#define RDP_SCANCODE_BACKSLASH_JP MAKE_RDP_SCANCODE(0x7D, false) /* JP OEM_5 ('\') */
#define RDP_SCANCODE_ABNT_C2 MAKE_RDP_SCANCODE(0x7E, false) /* VK_ABNT_C2, JP */
#define RDP_SCANCODE_ABNT_C2 MAKE_RDP_SCANCODE(0x7E, false) /* JP OEM_PA2 */
#define RDP_SCANCODE_RETURN_KP MAKE_RDP_SCANCODE(0x1C, true) /* not RDP_SCANCODE_RETURN Numerical Enter */
#define RDP_SCANCODE_RCONTROL MAKE_RDP_SCANCODE(0x1D, true) /* VK_RCONTROL */
#define RDP_SCANCODE_DIVIDE MAKE_RDP_SCANCODE(0x35, true) /* VK_DIVIDE Numerical */
#define RDP_SCANCODE_PRINTSCREEN MAKE_RDP_SCANCODE(0x37, true) /* VK_EXECUTE/VK_PRINT/VK_SNAPSHOT Print Screen */
#define RDP_SCANCODE_RMENU MAKE_RDP_SCANCODE(0x38, true) /* VK_RMENU Right 'Alt' / 'Alt Gr' */
#define RDP_SCANCODE_PAUSE MAKE_RDP_SCANCODE(0x46, true) /* VK_PAUSE Pause / Break (Slightly special handling) */
#define RDP_SCANCODE_HOME MAKE_RDP_SCANCODE(0x47, true) /* VK_HOME */
#define RDP_SCANCODE_UP MAKE_RDP_SCANCODE(0x48, true) /* VK_UP */
#define RDP_SCANCODE_PRIOR MAKE_RDP_SCANCODE(0x49, true) /* VK_PRIOR 'Page Up' */
#define RDP_SCANCODE_LEFT MAKE_RDP_SCANCODE(0x4B, true) /* VK_LEFT */
#define RDP_SCANCODE_RIGHT MAKE_RDP_SCANCODE(0x4D, true) /* VK_RIGHT */
#define RDP_SCANCODE_END MAKE_RDP_SCANCODE(0x4F, true) /* VK_END */
#define RDP_SCANCODE_DOWN MAKE_RDP_SCANCODE(0x50, true) /* VK_DOWN */
#define RDP_SCANCODE_NEXT MAKE_RDP_SCANCODE(0x51, true) /* VK_NEXT 'Page Down' */
#define RDP_SCANCODE_INSERT MAKE_RDP_SCANCODE(0x52, true) /* VK_INSERT */
#define RDP_SCANCODE_DELETE MAKE_RDP_SCANCODE(0x53, true) /* VK_DELETE */
#define RDP_SCANCODE_NULL MAKE_RDP_SCANCODE(0x54, true) /* <00> */
#define RDP_SCANCODE_HELP2 MAKE_RDP_SCANCODE(0x56, true) /* Help - documented, different from VK_HELP */
#define RDP_SCANCODE_LWIN MAKE_RDP_SCANCODE(0x5B, true) /* VK_LWIN */
#define RDP_SCANCODE_RWIN MAKE_RDP_SCANCODE(0x5C, true) /* VK_RWIN */
#define RDP_SCANCODE_APPS MAKE_RDP_SCANCODE(0x5D, true) /* VK_APPS Application */
#define RDP_SCANCODE_POWER_JP MAKE_RDP_SCANCODE(0x5E, true) /* JP POWER */
#define RDP_SCANCODE_SLEEP_JP MAKE_RDP_SCANCODE(0x5F, true) /* JP SLEEP */
/* _not_ valid scancode, but this is what a windows PKBDLLHOOKSTRUCT for NumLock contains */
#define RDP_SCANCODE_NUMLOCK_EXTENDED MAKE_RDP_SCANCODE(0x45, true) /* should be RDP_SCANCODE_NUMLOCK */
#define RDP_SCANCODE_RSHIFT_EXTENDED MAKE_RDP_SCANCODE(0x36, true) /* should be RDP_SCANCODE_RSHIFT */
#endif /* __FREERDP_LOCALE_KEYBOARD_RDP_SCANCODE_H */

View File

@ -61,8 +61,12 @@ boolean freerdp_connect(freerdp* instance)
IFCALLRET(instance->PreConnect, status, instance);
/* Advanced settings for keyboard layout */
freerdp_keyboard_set_layout_code(rdp->mcs->transport->settings);
if (settings->kbd_layout == KBD_JAPANESE_INPUT_SYSTEM_MS_IME2002)
{
settings->kbd_type = 7;
settings->kbd_subtype = 2;
settings->kbd_fn_keys = 12;
}
extension_load_and_init_plugins(rdp->extension);
extension_pre_connect(rdp->extension);

View File

@ -396,6 +396,14 @@ void freerdp_input_send_keyboard_event(rdpInput* input, uint16 flags, uint16 cod
IFCALL(input->KeyboardEvent, input, flags, code);
}
void freerdp_input_send_keyboard_event_ex(rdpInput* input, boolean down, uint32 rdp_scancode)
{
freerdp_input_send_keyboard_event(input,
(RDP_SCANCODE_EXTENDED(rdp_scancode) ? KBD_FLAGS_EXTENDED : 0) |
((down) ? KBD_FLAGS_DOWN : KBD_FLAGS_RELEASE),
RDP_SCANCODE_CODE(rdp_scancode));
}
void freerdp_input_send_unicode_keyboard_event(rdpInput* input, uint16 flags, uint16 code)
{
IFCALL(input->UnicodeKeyboardEvent, input, flags, code);

View File

@ -52,7 +52,6 @@ static CryptoCert tls_get_certificate(rdpTls* tls, boolean peer)
static void tls_free_certificate(CryptoCert cert)
{
X509_free(cert->px509);
xfree(cert);
}

View File

@ -84,8 +84,8 @@ uint32 freerdp_keyboard_init(uint32 keyboardLayoutId)
memset(RDP_SCANCODE_TO_X11_KEYCODE, 0, sizeof(RDP_SCANCODE_TO_X11_KEYCODE));
for (keycode=0; keycode < ARRAY_SIZE(RDP_SCANCODE_TO_X11_KEYCODE); keycode++)
RDP_SCANCODE_TO_X11_KEYCODE
[rdp_scancode_code(X11_KEYCODE_TO_RDP_SCANCODE[keycode])]
[rdp_scancode_extended(X11_KEYCODE_TO_RDP_SCANCODE[keycode]) ? 1 : 0] = keycode;
[RDP_SCANCODE_CODE(X11_KEYCODE_TO_RDP_SCANCODE[keycode])]
[RDP_SCANCODE_EXTENDED(X11_KEYCODE_TO_RDP_SCANCODE[keycode]) ? 1 : 0] = keycode;
return keyboardLayoutId;
}
@ -93,8 +93,8 @@ uint32 freerdp_keyboard_init(uint32 keyboardLayoutId)
RDP_SCANCODE freerdp_keyboard_get_rdp_scancode_from_x11_keycode(uint32 keycode)
{
DEBUG_KBD("x11 keycode: %02X -> rdp code: %02X%s", keycode,
rdp_scancode_code(X11_KEYCODE_TO_RDP_SCANCODE[keycode]),
rdp_scancode_extended(X11_KEYCODE_TO_RDP_SCANCODE[keycode]) ? " extended" : "");
RDP_SCANCODE_CODE(X11_KEYCODE_TO_RDP_SCANCODE[keycode]),
RDP_SCANCODE_EXTENDED(X11_KEYCODE_TO_RDP_SCANCODE[keycode]) ? " extended" : "");
return X11_KEYCODE_TO_RDP_SCANCODE[keycode];
}
@ -111,19 +111,3 @@ RDP_SCANCODE freerdp_keyboard_get_rdp_scancode_from_virtual_key_code(uint32 vkco
{
return VIRTUAL_KEY_CODE_TO_DEFAULT_RDP_SCANCODE_TABLE[vkcode];
}
/**
* Set keyboard layout(kbd_type,kbd_subtype,kbd_fn_keys).\n
* @param settings rdp settings
*/
void freerdp_keyboard_set_layout_code(rdpSettings* settings)
{
/* for jp */
if (settings->kbd_layout == 0xE0010411)
{
settings->kbd_type = 7;
settings->kbd_subtype = 2;
settings->kbd_fn_keys = 12;
}
}

View File

@ -25,7 +25,7 @@
#include <freerdp/utils/file.h>
#include <freerdp/utils/memory.h>
#include <freerdp/locale/virtual_key_codes.h>
#include <freerdp/locale/vkcodes.h>
#include <freerdp/locale/keyboard.h>
#include "liblocale.h"

View File

@ -28,7 +28,7 @@
#include "liblocale.h"
#include <freerdp/types.h>
#include <freerdp/keyboard_scancode.h>
#include <freerdp/scancode.h>
#include <freerdp/utils/memory.h>
#include <freerdp/locale/keyboard.h>

View File

@ -21,7 +21,7 @@
#include "config.h"
#endif
#include <freerdp/locale/virtual_key_codes.h>
#include <freerdp/locale/vkcodes.h>
#include <freerdp/utils/memory.h>

View File

@ -15,13 +15,60 @@
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 2.6)
project(WinPR C)
set(CMAKE_COLOR_MAKEFILE ON)
if(FREERDP_VERSION)
set(FREERDP_BUILD)
endif()
# Include cmake modules
include(CheckIncludeFiles)
include(CheckLibraryExists)
include(CheckStructHasMember)
include(FindPkgConfig)
include(TestBigEndian)
# Include our extra modules
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../cmake/)
include(AutoVersioning)
include(ConfigOptions)
include(BuildFeatureCheck)
include(FindOptionalPackage)
include(CheckCCompilerFlag)
include(GNUInstallDirsWrapper)
# Soname versioning
set(WINPR_VERSION_MAJOR "0")
set(WINPR_VERSION_MINOR "1")
set(WINPR_VERSION_REVISION "0")
set(WINPR_VERSION "${WINPR_VERSION_MAJOR}.${WINPR_VERSION_MINOR}")
set(WINPR_VERSION_FULL "${WINPR_VERSION}.${WINPR_VERSION_REVISION}")
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include PARENT_SCOPE)
# Default to release build type
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()
# Default to build shared libs
if(NOT DEFINED BUILD_SHARED_LIBS)
set(BUILD_SHARED_LIBS ON)
endif()
# Libraries that we have a hard dependency on
if(NOT DEFINED OPENSSL_INCLUDE_DIR OR NOT DEFINED OPENSSL_LIBRARIES)
find_required_package(OpenSSL)
endif()
if(FREERDP_BUILD)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include PARENT_SCOPE)
else()
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/winpr/config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/include/winpr/config.h)

View File

@ -0,0 +1,9 @@
set(MINWIN_LAYER "0")
set(MINWIN_GROUP "none")
set(MINWIN_MAJOR_VERSION "0")
set(MINWIN_MINOR_VERSION "0")
set(MINWIN_SHORT_NAME "msasn1")
set(MINWIN_LONG_NAME "Microsoft ASN.1")
set(MODULE_LIBRARY_NAME "${MINWIN_SHORT_NAME}")

View File

@ -0,0 +1,9 @@
set(MINWIN_LAYER "0")
set(MINWIN_GROUP "none")
set(MINWIN_MAJOR_VERSION "0")
set(MINWIN_MINOR_VERSION "0")
set(MINWIN_SHORT_NAME "bcrypt")
set(MINWIN_LONG_NAME "Cryptography API: Next Generation (CNG)")
set(MODULE_LIBRARY_NAME "${MINWIN_SHORT_NAME}")

View File

@ -0,0 +1,9 @@
set(MINWIN_LAYER "0")
set(MINWIN_GROUP "none")
set(MINWIN_MAJOR_VERSION "0")
set(MINWIN_MINOR_VERSION "0")
set(MINWIN_SHORT_NAME "crt")
set(MINWIN_LONG_NAME "Microsoft C Run-Time")
set(MODULE_LIBRARY_NAME "${MINWIN_SHORT_NAME}")

View File

@ -0,0 +1,9 @@
set(MINWIN_LAYER "0")
set(MINWIN_GROUP "none")
set(MINWIN_MAJOR_VERSION "0")
set(MINWIN_MINOR_VERSION "0")
set(MINWIN_SHORT_NAME "dsparse")
set(MINWIN_LONG_NAME "Domain Controller and Replication Management Functions")
set(MODULE_LIBRARY_NAME "${MINWIN_SHORT_NAME}")

View File

@ -0,0 +1,9 @@
set(MINWIN_LAYER "1")
set(MINWIN_GROUP "core")
set(MINWIN_MAJOR_VERSION "1")
set(MINWIN_MINOR_VERSION "0")
set(MINWIN_SHORT_NAME "handle")
set(MINWIN_LONG_NAME "Handle and Object Functions")
set(MODULE_LIBRARY_NAME "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}")

View File

@ -0,0 +1,9 @@
set(MINWIN_LAYER "1")
set(MINWIN_GROUP "core")
set(MINWIN_MAJOR_VERSION "2")
set(MINWIN_MINOR_VERSION "0")
set(MINWIN_SHORT_NAME "heap")
set(MINWIN_LONG_NAME "Heap Functions")
set(MODULE_LIBRARY_NAME "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}")

View File

@ -0,0 +1,9 @@
set(MINWIN_LAYER "1")
set(MINWIN_GROUP "core")
set(MINWIN_MAJOR_VERSION "2")
set(MINWIN_MINOR_VERSION "0")
set(MINWIN_SHORT_NAME "interlocked")
set(MINWIN_LONG_NAME "Interlocked Functions")
set(MODULE_LIBRARY_NAME "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}")

View File

@ -0,0 +1,9 @@
set(MINWIN_LAYER "1")
set(MINWIN_GROUP "core")
set(MINWIN_MAJOR_VERSION "1")
set(MINWIN_MINOR_VERSION "1")
set(MINWIN_SHORT_NAME "libraryloader")
set(MINWIN_LONG_NAME "Dynamic-Link Library Functions")
set(MODULE_LIBRARY_NAME "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}")

View File

@ -0,0 +1,9 @@
set(MINWIN_LAYER "1")
set(MINWIN_GROUP "core")
set(MINWIN_MAJOR_VERSION "1")
set(MINWIN_MINOR_VERSION "0")
set(MINWIN_SHORT_NAME "registry")
set(MINWIN_LONG_NAME "Registry Functions")
set(MODULE_LIBRARY_NAME "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}")

View File

@ -0,0 +1,9 @@
set(MINWIN_LAYER "0")
set(MINWIN_GROUP "none")
set(MINWIN_MAJOR_VERSION "0")
set(MINWIN_MINOR_VERSION "0")
set(MINWIN_SHORT_NAME "rpcrt4")
set(MINWIN_LONG_NAME "RPC NDR Engine")
set(MODULE_LIBRARY_NAME "${MINWIN_SHORT_NAME}")

View File

@ -65,6 +65,12 @@ set(WINPR_SSPI_LIBS
${ZLIB_LIBRARIES}
${OPENSSL_LIBRARIES})
if(WIN32)
set(WINPR_SSPI_LIBS ${WINPR_SSPI_LIBS} ws2_32)
else()
set(WINPR_SSPI_LIBS ${WINPR_SSPI_LIBS} ${ZLIB_LIBRARIES})
endif()
if(WITH_MONOLITHIC_BUILD)
set(WINPR_SSPI_LIBS ${WINPR_SSPI_LIBS} winpr)
else()

View File

@ -0,0 +1,9 @@
set(MINWIN_LAYER "0")
set(MINWIN_GROUP "none")
set(MINWIN_MAJOR_VERSION "0")
set(MINWIN_MINOR_VERSION "0")
set(MINWIN_SHORT_NAME "sspi")
set(MINWIN_LONG_NAME "Security Support Provider Interface")
set(MODULE_LIBRARY_NAME "${MINWIN_SHORT_NAME}")

View File

@ -0,0 +1,9 @@
set(MINWIN_LAYER "0")
set(MINWIN_GROUP "none")
set(MINWIN_MAJOR_VERSION "0")
set(MINWIN_MINOR_VERSION "0")
set(MINWIN_SHORT_NAME "sspicli")
set(MINWIN_LONG_NAME "Authentication Functions")
set(MODULE_LIBRARY_NAME "${MINWIN_SHORT_NAME}")

View File

@ -0,0 +1,9 @@
set(MINWIN_LAYER "1")
set(MINWIN_GROUP "core")
set(MINWIN_MAJOR_VERSION "2")
set(MINWIN_MINOR_VERSION "0")
set(MINWIN_SHORT_NAME "synch")
set(MINWIN_LONG_NAME "Synchronization Functions")
set(MODULE_LIBRARY_NAME "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}")

View File

@ -0,0 +1,9 @@
set(MINWIN_LAYER "1")
set(MINWIN_GROUP "core")
set(MINWIN_MAJOR_VERSION "2")
set(MINWIN_MINOR_VERSION "0")
set(MINWIN_SHORT_NAME "sysinfo")
set(MINWIN_LONG_NAME "System Information Functions")
set(MODULE_LIBRARY_NAME "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}")

View File

@ -0,0 +1,9 @@
set(MINWIN_LAYER "1")
set(MINWIN_GROUP "core")
set(MINWIN_MAJOR_VERSION "1")
set(MINWIN_MINOR_VERSION "1")
set(MINWIN_SHORT_NAME "processthreads")
set(MINWIN_LONG_NAME "Process and Thread Functions")
set(MODULE_LIBRARY_NAME "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}")

View File

@ -0,0 +1,9 @@
set(MINWIN_LAYER "1")
set(MINWIN_GROUP "core")
set(MINWIN_MAJOR_VERSION "1")
set(MINWIN_MINOR_VERSION "0")
set(MINWIN_SHORT_NAME "timezone")
set(MINWIN_LONG_NAME "Time Zone Functions")
set(MODULE_LIBRARY_NAME "api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}")

View File

@ -0,0 +1,9 @@
set(MINWIN_LAYER "0")
set(MINWIN_GROUP "none")
set(MINWIN_MAJOR_VERSION "0")
set(MINWIN_MINOR_VERSION "0")
set(MINWIN_SHORT_NAME "winhttp")
set(MINWIN_LONG_NAME "Windows HTTP (WinHTTP)")
set(MODULE_LIBRARY_NAME "${MINWIN_SHORT_NAME}")

View File

@ -0,0 +1,9 @@
set(MINWIN_LAYER "0")
set(MINWIN_GROUP "none")
set(MINWIN_MAJOR_VERSION "0")
set(MINWIN_MINOR_VERSION "0")
set(MINWIN_SHORT_NAME "ws2_32")
set(MINWIN_LONG_NAME "Windows Sockets (Winsock)")
set(MODULE_LIBRARY_NAME "${MINWIN_SHORT_NAME}")