Merge branch 'master' of github.com:FreeRDP/FreeRDP
This commit is contained in:
commit
d330570e62
@ -45,13 +45,13 @@ public class BookmarkBase implements Parcelable, Cloneable {
|
||||
}
|
||||
|
||||
public PerformanceFlags(Parcel parcel) {
|
||||
remotefx = (parcel.readInt() == 1) ? true : false;
|
||||
wallpaper = (parcel.readInt() == 1) ? true : false;
|
||||
theming = (parcel.readInt() == 1) ? true : false;
|
||||
fullWindowDrag = (parcel.readInt() == 1) ? true : false;
|
||||
menuAnimations = (parcel.readInt() == 1) ? true : false;
|
||||
fontSmoothing = (parcel.readInt() == 1) ? true : false;
|
||||
desktopComposition = (parcel.readInt() == 1) ? true : false;
|
||||
remotefx = parcel.readInt() == 1;
|
||||
wallpaper = parcel.readInt() == 1;
|
||||
theming = parcel.readInt() == 1;
|
||||
fullWindowDrag = (parcel.readInt() == 1);
|
||||
menuAnimations = parcel.readInt() == 1;
|
||||
fontSmoothing = parcel.readInt() == 1;
|
||||
desktopComposition = parcel.readInt() == 1;
|
||||
}
|
||||
|
||||
public boolean getRemoteFX() {
|
||||
@ -286,10 +286,10 @@ public class BookmarkBase implements Parcelable, Cloneable {
|
||||
}
|
||||
// Session Settings
|
||||
public DebugSettings(Parcel parcel) {
|
||||
asyncChannel = (parcel.readInt() == 1) ? true : false;
|
||||
asyncTransport = (parcel.readInt() == 1) ? true : false;
|
||||
asyncInput = (parcel.readInt() == 1) ? true : false;
|
||||
asyncUpdate = (parcel.readInt() == 1) ? true : false;
|
||||
asyncChannel = parcel.readInt() == 1;
|
||||
asyncTransport = parcel.readInt() == 1;
|
||||
asyncInput = parcel.readInt() == 1;
|
||||
asyncUpdate = parcel.readInt() == 1;
|
||||
debug = parcel.readInt();
|
||||
}
|
||||
|
||||
@ -393,16 +393,16 @@ public class BookmarkBase implements Parcelable, Cloneable {
|
||||
}
|
||||
|
||||
public AdvancedSettings(Parcel parcel) {
|
||||
enable3GSettings = (parcel.readInt() == 1) ? true : false;
|
||||
enable3GSettings = parcel.readInt() == 1;
|
||||
screen3G = parcel.readParcelable(ScreenSettings.class
|
||||
.getClassLoader());
|
||||
performance3G = parcel.readParcelable(PerformanceFlags.class
|
||||
.getClassLoader());
|
||||
redirectSDCard = (parcel.readInt() == 1) ? true : false;
|
||||
redirectSDCard = parcel.readInt() == 1;
|
||||
redirectSound = parcel.readInt();
|
||||
redirectMicrophone = (parcel.readInt() == 1) ? true : false;
|
||||
redirectMicrophone = parcel.readInt() == 1;
|
||||
security = parcel.readInt();
|
||||
consoleMode = (parcel.readInt() == 1) ? true : false;
|
||||
consoleMode = parcel.readInt() == 1;
|
||||
remoteProgram = parcel.readString();
|
||||
workDir = parcel.readString();
|
||||
}
|
||||
|
@ -163,7 +163,12 @@ BOOL xf_detect_monitors(xfContext* xfc)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!xf_GetWorkArea(xfc))
|
||||
/* WORKAROUND: With Remote Application Mode - using NET_WM_WORKAREA
|
||||
* causes issues with the ability to fully size the window vertically
|
||||
* (the bottom of the window area is never updated). So, we just set
|
||||
* the workArea to match the full Screen width/height.
|
||||
*/
|
||||
if (settings->RemoteApplicationMode || !xf_GetWorkArea(xfc))
|
||||
{
|
||||
xfc->workArea.x = 0;
|
||||
xfc->workArea.y = 0;
|
||||
|
@ -113,43 +113,31 @@ void xf_rail_send_client_system_command(xfContext* xfc, UINT32 windowId, UINT16
|
||||
*/
|
||||
void xf_rail_adjust_position(xfContext* xfc, xfAppWindow* appWindow)
|
||||
{
|
||||
UINT32 offsetX = 0;
|
||||
UINT32 offsetY = 0;
|
||||
RAIL_WINDOW_MOVE_ORDER windowMove;
|
||||
|
||||
if (!appWindow->is_mapped || appWindow->local_move.state != LMS_NOT_ACTIVE)
|
||||
return;
|
||||
|
||||
/* If current window position disagrees with RDP window position, send update to RDP server */
|
||||
if (appWindow->x != appWindow->visibleOffsetX ||
|
||||
appWindow->y != appWindow->visibleOffsetY ||
|
||||
if (appWindow->x != (appWindow->windowOffsetX - appWindow->localWindowOffsetCorrX) ||
|
||||
appWindow->y != (appWindow->windowOffsetY - appWindow->localWindowOffsetCorrY) ||
|
||||
appWindow->width != appWindow->windowWidth ||
|
||||
appWindow->height != appWindow->windowHeight)
|
||||
{
|
||||
/*
|
||||
* Although the rail server can give negative window coordinates when updating windowOffsetX and windowOffsetY,
|
||||
* we can only send unsigned integers to the rail server. Therefore, we always bring negative coordinates up to 0
|
||||
* when attempting to adjust the rail window.
|
||||
*/
|
||||
|
||||
if (appWindow->windowOffsetX < 0)
|
||||
offsetX = offsetX - appWindow->windowOffsetX;
|
||||
|
||||
if (appWindow->windowOffsetY < 0)
|
||||
offsetY = offsetY - appWindow->windowOffsetY;
|
||||
|
||||
/*
|
||||
* windowOffset corresponds to the window location on the rail server
|
||||
* but our local window is based on the visibleOffset since using the windowOffset
|
||||
* can result in blank areas for a maximized window
|
||||
* but our local window is based uses a local offset since the windowOffset
|
||||
* can be negative and but X does not support negative values. Not using an
|
||||
* offset can result in blank areas for a maximized window
|
||||
*/
|
||||
windowMove.windowId = appWindow->windowId;
|
||||
/*
|
||||
* Calculate new offsets for the rail server window
|
||||
* Negative offset correction + rail server window offset + (difference in visibleOffset and new window local offset)
|
||||
* Calculate new size/position for the rail window(new values for windowOffsetX/windowOffsetY/windowWidth/windowHeight) on the server
|
||||
* New position is based on: Current local rail window offset +
|
||||
* Local offset correction(current correction value to translate the local window offset to the server rail window offset)
|
||||
*/
|
||||
windowMove.left = offsetX + appWindow->windowOffsetX + (appWindow->x - appWindow->visibleOffsetX);
|
||||
windowMove.top = offsetY + appWindow->windowOffsetY + (appWindow->y - appWindow->visibleOffsetY);
|
||||
windowMove.left = appWindow->x + appWindow->localWindowOffsetCorrX;
|
||||
windowMove.top = appWindow->y + appWindow->localWindowOffsetCorrY;
|
||||
windowMove.right = windowMove.left + appWindow->width;
|
||||
windowMove.bottom = windowMove.top + appWindow->height;
|
||||
|
||||
@ -162,37 +150,25 @@ void xf_rail_end_local_move(xfContext* xfc, xfAppWindow* appWindow)
|
||||
int x, y;
|
||||
int child_x;
|
||||
int child_y;
|
||||
UINT32 offsetX = 0;
|
||||
UINT32 offsetY = 0;
|
||||
unsigned int mask;
|
||||
Window root_window;
|
||||
Window child_window;
|
||||
RAIL_WINDOW_MOVE_ORDER windowMove;
|
||||
rdpInput* input = xfc->instance->input;
|
||||
|
||||
/*
|
||||
* Although the rail server can give negative window coordinates when updating windowOffsetX and windowOffsetY,
|
||||
* we can only send unsigned integers to the rail server. Therefore, we always bring negative coordinates up to 0 when
|
||||
* attempting to adjust the rail window.
|
||||
*/
|
||||
|
||||
if (appWindow->windowOffsetX < 0)
|
||||
offsetX = offsetX - appWindow->windowOffsetX;
|
||||
|
||||
if (appWindow->windowOffsetY < 0)
|
||||
offsetY = offsetY - appWindow->windowOffsetY;
|
||||
|
||||
/*
|
||||
* For keyboard moves send and explicit update to RDP server
|
||||
*/
|
||||
windowMove.windowId = appWindow->windowId;
|
||||
|
||||
/*
|
||||
* Calculate new offsets for the rail server window
|
||||
* Negative offset correction + rail server window offset + (difference in visibleOffset and new window local offset)
|
||||
* Calculate new size/position for the rail window(new values for windowOffsetX/windowOffsetY/windowWidth/windowHeight) on the server
|
||||
* New position is based on: Current local rail window offset +
|
||||
* Local offset correction(current correction value to translate the local window offset to the server rail window offset)
|
||||
*
|
||||
*/
|
||||
windowMove.left = offsetX + appWindow->windowOffsetX + (appWindow->x - appWindow->visibleOffsetX);
|
||||
windowMove.top = offsetY + appWindow->windowOffsetY + (appWindow->y - appWindow->visibleOffsetY);
|
||||
windowMove.left = appWindow->x + appWindow->localWindowOffsetCorrX;
|
||||
windowMove.top = appWindow->y + appWindow->localWindowOffsetCorrY;
|
||||
windowMove.right = windowMove.left + appWindow->width; /* In the update to RDP the position is one past the window */
|
||||
windowMove.bottom = windowMove.top + appWindow->height;
|
||||
|
||||
@ -218,8 +194,8 @@ void xf_rail_end_local_move(xfContext* xfc, xfAppWindow* appWindow)
|
||||
* we can start to receive GDI orders for the new window dimensions before we
|
||||
* receive the RAIL ORDER for the new window size. This avoids that race condition.
|
||||
*/
|
||||
appWindow->windowOffsetX = offsetX + appWindow->windowOffsetX + (appWindow->x - appWindow->visibleOffsetX);
|
||||
appWindow->windowOffsetY = offsetY + appWindow->windowOffsetY + (appWindow->y - appWindow->visibleOffsetY);
|
||||
appWindow->windowOffsetX = windowMove.left;
|
||||
appWindow->windowOffsetY = windowMove.top;
|
||||
appWindow->windowWidth = appWindow->width;
|
||||
appWindow->windowHeight = appWindow->height;
|
||||
appWindow->local_move.state = LMS_TERMINATING;
|
||||
@ -320,6 +296,9 @@ static void xf_rail_window_common(rdpContext* context, WINDOW_ORDER_INFO* orderI
|
||||
appWindow->width = appWindow->windowWidth = windowState->windowWidth;
|
||||
appWindow->height = appWindow->windowHeight = windowState->windowHeight;
|
||||
|
||||
appWindow->localWindowOffsetCorrX = 0;
|
||||
appWindow->localWindowOffsetCorrY = 0;
|
||||
|
||||
if (fieldFlags & WINDOW_ORDER_FIELD_TITLE)
|
||||
{
|
||||
char* title = NULL;
|
||||
@ -358,6 +337,21 @@ static void xf_rail_window_common(rdpContext* context, WINDOW_ORDER_INFO* orderI
|
||||
{
|
||||
appWindow->windowOffsetX = windowState->windowOffsetX;
|
||||
appWindow->windowOffsetY = windowState->windowOffsetY;
|
||||
|
||||
/*
|
||||
* The rail server can give negative window coordinates when updating windowOffsetX and windowOffsetY,
|
||||
* but we can only send unsigned integers to the rail server. Therefore, we maintain a local offset.
|
||||
*/
|
||||
|
||||
if (appWindow->windowOffsetX < 0)
|
||||
appWindow->localWindowOffsetCorrX = 0 - appWindow->windowOffsetX;
|
||||
else
|
||||
appWindow->localWindowOffsetCorrX = 0;
|
||||
|
||||
if (appWindow->windowOffsetY < 0)
|
||||
appWindow->localWindowOffsetCorrY = 0 - appWindow->windowOffsetY;
|
||||
else
|
||||
appWindow->localWindowOffsetCorrY = 0;
|
||||
}
|
||||
|
||||
if (fieldFlags & WINDOW_ORDER_FIELD_WND_SIZE)
|
||||
@ -491,20 +485,16 @@ static void xf_rail_window_common(rdpContext* context, WINDOW_ORDER_INFO* orderI
|
||||
return;
|
||||
|
||||
/* Do nothing if window is already in the correct position */
|
||||
if (appWindow->x == appWindow->visibleOffsetX &&
|
||||
appWindow->y == appWindow->visibleOffsetY &&
|
||||
if (appWindow->x == (appWindow->windowOffsetX - appWindow->localWindowOffsetCorrX) &&
|
||||
appWindow->y == (appWindow->windowOffsetY - appWindow->localWindowOffsetCorrY) &&
|
||||
appWindow->width == appWindow->windowWidth &&
|
||||
appWindow->height == appWindow->windowHeight)
|
||||
{
|
||||
/*
|
||||
* Just ensure entire window area is updated to handle cases where we
|
||||
* have drawn locally before getting new bitmap from the server
|
||||
*/
|
||||
xf_UpdateWindowArea(xfc, appWindow, 0, 0, appWindow->windowWidth, appWindow->windowHeight);
|
||||
return;
|
||||
}
|
||||
|
||||
xf_MoveWindow(xfc, appWindow, appWindow->visibleOffsetX, appWindow->visibleOffsetY,
|
||||
xf_MoveWindow(xfc, appWindow, appWindow->windowOffsetX - appWindow->localWindowOffsetCorrX, appWindow->windowOffsetY - appWindow->localWindowOffsetCorrY,
|
||||
appWindow->windowWidth, appWindow->windowHeight);
|
||||
}
|
||||
|
||||
|
@ -886,14 +886,20 @@ void xf_SetWindowVisibilityRects(xfContext* xfc, xfAppWindow* appWindow, RECTANG
|
||||
void xf_UpdateWindowArea(xfContext* xfc, xfAppWindow* appWindow, int x, int y, int width, int height)
|
||||
{
|
||||
int ax, ay;
|
||||
UINT32 translatedWindowOffsetX;
|
||||
UINT32 translatedWindowOffsetY;
|
||||
|
||||
ax = x + appWindow->visibleOffsetX;
|
||||
ay = y + appWindow->visibleOffsetY;
|
||||
/* Translate the server rail window offset to a local offset */
|
||||
translatedWindowOffsetX = (appWindow->windowOffsetX - appWindow->localWindowOffsetCorrX);
|
||||
translatedWindowOffsetY = (appWindow->windowOffsetY - appWindow->localWindowOffsetCorrY);
|
||||
|
||||
if (ax + width > appWindow->visibleOffsetX + appWindow->width)
|
||||
width = (appWindow->visibleOffsetX + appWindow->width - 1) - ax;
|
||||
if (ay + height > appWindow->visibleOffsetY + appWindow->height)
|
||||
height = (appWindow->visibleOffsetY + appWindow->height - 1) - ay;
|
||||
ax = x + translatedWindowOffsetX;
|
||||
ay = y + translatedWindowOffsetY;
|
||||
|
||||
if (ax + width > translatedWindowOffsetX + appWindow->width)
|
||||
width = (translatedWindowOffsetX + appWindow->width - 1) - ax;
|
||||
if (ay + height > translatedWindowOffsetY + appWindow->height)
|
||||
height = (translatedWindowOffsetY + appWindow->height - 1) - ay;
|
||||
|
||||
xf_lock_x11(xfc, TRUE);
|
||||
|
||||
|
@ -118,6 +118,9 @@ struct xf_app_window
|
||||
UINT32 numVisibilityRects;
|
||||
RECTANGLE_16* visibilityRects;
|
||||
|
||||
UINT32 localWindowOffsetCorrX;
|
||||
UINT32 localWindowOffsetCorrY;
|
||||
|
||||
GC gc;
|
||||
int shmid;
|
||||
Window handle;
|
||||
|
@ -1,3 +1,4 @@
|
||||
include(CMakeDependentOption)
|
||||
|
||||
if((CMAKE_SYSTEM_PROCESSOR MATCHES "i386|i686|x86|AMD64") AND (CMAKE_SIZEOF_VOID_P EQUAL 4))
|
||||
set(TARGET_ARCH "x86")
|
||||
@ -59,6 +60,8 @@ endif()
|
||||
option(WITH_SMARTCARD_INSPECT "Enable SmartCard API Inspector" OFF)
|
||||
|
||||
option(BUILD_TESTING "Build unit tests" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(TESTS_WTSAPI_EXTRA "Build extra WTSAPI tests (interactive)" OFF "BUILD_TESTING" ON)
|
||||
|
||||
option(WITH_SAMPLE "Build sample code" OFF)
|
||||
|
||||
option(WITH_CLIENT "Build client binaries" ON)
|
||||
|
@ -243,7 +243,9 @@ static WtsApiFunctionTable FreeRDP_WtsApiFunctionTable =
|
||||
FreeRDP_WTSEnableChildSessions, /* EnableChildSessions */
|
||||
FreeRDP_WTSIsChildSessionsEnabled, /* IsChildSessionsEnabled */
|
||||
FreeRDP_WTSGetChildSessionId, /* GetChildSessionId */
|
||||
FreeRDP_WTSGetActiveConsoleSessionId /* GetActiveConsoleSessionId */
|
||||
FreeRDP_WTSGetActiveConsoleSessionId, /* GetActiveConsoleSessionId */
|
||||
FreeRDP_WTSLogonUser,
|
||||
FreeRDP_WTSLogoffUser
|
||||
};
|
||||
|
||||
PWtsApiFunctionTable FreeRDP_InitWtsApi(void)
|
||||
|
@ -1011,20 +1011,48 @@ BOOL rdp_server_accept_nego(rdpRdp* rdp, wStream* s)
|
||||
{
|
||||
nego->SelectedProtocol = PROTOCOL_TLS;
|
||||
}
|
||||
else if ((settings->RdpSecurity) && (nego->SelectedProtocol == PROTOCOL_RDP))
|
||||
else if ((settings->RdpSecurity) && (nego->RequestedProtocols == PROTOCOL_RDP))
|
||||
{
|
||||
nego->SelectedProtocol = PROTOCOL_RDP;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* when here client and server aren't compatible, we select the right
|
||||
* error message to return to the client in the nego failure packet
|
||||
*/
|
||||
nego->SelectedProtocol = PROTOCOL_FAILED_NEGO;
|
||||
|
||||
if (settings->RdpSecurity)
|
||||
{
|
||||
WLog_ERR(TAG, "server supports only Standard RDP Security");
|
||||
nego->SelectedProtocol |= SSL_NOT_ALLOWED_BY_SERVER;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (settings->NlaSecurity && !settings->TlsSecurity)
|
||||
{
|
||||
WLog_ERR(TAG, "server supports only NLA Security");
|
||||
nego->SelectedProtocol |= HYBRID_REQUIRED_BY_SERVER;
|
||||
}
|
||||
else
|
||||
{
|
||||
WLog_ERR(TAG, "server supports only a SSL based Security (TLS or NLA)");
|
||||
nego->SelectedProtocol |= SSL_REQUIRED_BY_SERVER;
|
||||
}
|
||||
}
|
||||
|
||||
WLog_ERR(TAG, "Protocol security negotiation failure");
|
||||
}
|
||||
|
||||
WLog_INFO(TAG, "Negotiated Security: NLA:%d TLS:%d RDP:%d",
|
||||
(nego->SelectedProtocol & PROTOCOL_NLA) ? 1 : 0,
|
||||
(nego->SelectedProtocol & PROTOCOL_TLS) ? 1 : 0,
|
||||
(nego->SelectedProtocol == PROTOCOL_RDP) ? 1: 0
|
||||
);
|
||||
if (!(nego->SelectedProtocol & PROTOCOL_FAILED_NEGO))
|
||||
{
|
||||
WLog_INFO(TAG, "Negotiated Security: NLA:%d TLS:%d RDP:%d",
|
||||
(nego->SelectedProtocol & PROTOCOL_NLA) ? 1 : 0,
|
||||
(nego->SelectedProtocol & PROTOCOL_TLS) ? 1 : 0,
|
||||
(nego->SelectedProtocol == PROTOCOL_RDP) ? 1: 0
|
||||
);
|
||||
}
|
||||
|
||||
if (!nego_send_negotiation_response(nego))
|
||||
return FALSE;
|
||||
|
@ -918,20 +918,16 @@ BOOL nego_send_negotiation_response(rdpNego* nego)
|
||||
bm = Stream_GetPosition(s);
|
||||
Stream_Seek(s, length);
|
||||
|
||||
if ((nego->SelectedProtocol == PROTOCOL_RDP) && !settings->RdpSecurity)
|
||||
if (nego->SelectedProtocol & PROTOCOL_FAILED_NEGO)
|
||||
{
|
||||
UINT32 errorCode = (nego->SelectedProtocol & ~PROTOCOL_FAILED_NEGO);
|
||||
flags = 0;
|
||||
|
||||
Stream_Write_UINT8(s, TYPE_RDP_NEG_FAILURE);
|
||||
Stream_Write_UINT8(s, flags); /* flags */
|
||||
Stream_Write_UINT16(s, 8); /* RDP_NEG_DATA length (8) */
|
||||
|
||||
/*
|
||||
* TODO: Check for other possibilities,
|
||||
* like SSL_NOT_ALLOWED_BY_SERVER.
|
||||
*/
|
||||
WLog_ERR(TAG, "client supports only Standard RDP Security");
|
||||
Stream_Write_UINT32(s, SSL_REQUIRED_BY_SERVER);
|
||||
Stream_Write_UINT32(s, errorCode);
|
||||
length += 8;
|
||||
status = FALSE;
|
||||
}
|
||||
|
@ -34,7 +34,9 @@ enum RDP_NEG_PROTOCOLS
|
||||
PROTOCOL_RDP = 0x00000000,
|
||||
PROTOCOL_TLS = 0x00000001,
|
||||
PROTOCOL_NLA = 0x00000002,
|
||||
PROTOCOL_EXT = 0x00000008
|
||||
PROTOCOL_EXT = 0x00000008,
|
||||
|
||||
PROTOCOL_FAILED_NEGO = 0x80000000 /* only used internally, not on the wire */
|
||||
};
|
||||
|
||||
/* Protocol Security Negotiation Failure Codes */
|
||||
|
@ -1375,3 +1375,12 @@ DWORD WINAPI FreeRDP_WTSGetActiveConsoleSessionId(void)
|
||||
{
|
||||
return 0xFFFFFFFF;
|
||||
}
|
||||
BOOL WINAPI FreeRDP_WTSLogoffUser(HANDLE hServer)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL WINAPI FreeRDP_WTSLogonUser(HANDLE hServer, LPCSTR username, LPCSTR password, LPCSTR domain)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -173,4 +173,7 @@ BOOL CDECL FreeRDP_WTSGetChildSessionId(PULONG pSessionId);
|
||||
|
||||
DWORD WINAPI FreeRDP_WTSGetActiveConsoleSessionId(void);
|
||||
|
||||
BOOL WINAPI FreeRDP_WTSLogoffUser(HANDLE hServer);
|
||||
BOOL WINAPI FreeRDP_WTSLogonUser(HANDLE hServer, LPCSTR username, LPCSTR password, LPCSTR domain);
|
||||
|
||||
#endif /* FREERDP_CORE_SERVER_H */
|
||||
|
3
winpr/libwinpr/wtsapi/test/.gitignore
vendored
3
winpr/libwinpr/wtsapi/test/.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
TestWtsApi
|
||||
TestWtsApi.c
|
||||
|
||||
TestWtsApiExtra
|
||||
TestWtsApiExtra.c
|
||||
|
@ -8,11 +8,10 @@ set(${MODULE_PREFIX}_TESTS
|
||||
TestWtsApiEnumerateProcesses.c
|
||||
TestWtsApiEnumerateSessions.c
|
||||
TestWtsApiQuerySessionInformation.c
|
||||
TestWtsApiLogoffSession.c
|
||||
TestWtsApiShutdownSystem.c
|
||||
TestWtsApiSessionNotification.c
|
||||
TestWtsApiWaitSystemEvent.c
|
||||
TestWtsApiVirtualChannel.c)
|
||||
)
|
||||
|
||||
create_test_sourcelist(${MODULE_PREFIX}_SRCS
|
||||
${${MODULE_PREFIX}_DRIVER}
|
||||
@ -32,3 +31,36 @@ endforeach()
|
||||
|
||||
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test")
|
||||
|
||||
if(TESTS_WTSAPI_EXTRA)
|
||||
|
||||
set(MODULE_NAME "TestWtsApiExtra")
|
||||
set(MODULE_PREFIX "TEST_WTSAPI_EXTRA")
|
||||
|
||||
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
|
||||
|
||||
set(${MODULE_PREFIX}_TESTS
|
||||
TestWtsApiExtraDisconnectSession.c
|
||||
TestWtsApiExtraDynamicVirtualChannel.c
|
||||
TestWtsApiExtraLogoffSession.c
|
||||
TestWtsApiExtraSendMessage.c
|
||||
TestWtsApiExtraVirtualChannel.c
|
||||
)
|
||||
|
||||
create_test_sourcelist(${MODULE_PREFIX}_SRCS
|
||||
${${MODULE_PREFIX}_DRIVER}
|
||||
${${MODULE_PREFIX}_TESTS})
|
||||
|
||||
add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
|
||||
|
||||
target_link_libraries(${MODULE_NAME} winpr)
|
||||
|
||||
set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}")
|
||||
|
||||
foreach(test ${${MODULE_PREFIX}_TESTS})
|
||||
get_filename_component(TestName ${test} NAME_WE)
|
||||
add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName})
|
||||
set_tests_properties(${TestName} PROPERTIES LABELS "WTSAPI_EXTRA")
|
||||
endforeach()
|
||||
|
||||
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test")
|
||||
endif()
|
||||
|
@ -0,0 +1,22 @@
|
||||
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/error.h>
|
||||
#include <winpr/wtsapi.h>
|
||||
|
||||
int TestWtsApiExtraDisconnectSession(int argc, char* argv[])
|
||||
{
|
||||
BOOL bSuccess;
|
||||
HANDLE hServer;
|
||||
|
||||
hServer = WTS_CURRENT_SERVER_HANDLE;
|
||||
|
||||
bSuccess = WTSDisconnectSession(hServer, WTS_CURRENT_SESSION, FALSE);
|
||||
|
||||
if (!bSuccess)
|
||||
{
|
||||
printf("WTSDisconnectSession failed: %d\n", (int) GetLastError());
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/error.h>
|
||||
#include <winpr/wtsapi.h>
|
||||
|
||||
int TestWtsApiExtraDynamicVirtualChannel(int argc, char* argv[])
|
||||
{
|
||||
BOOL bSuccess;
|
||||
ULONG length;
|
||||
ULONG bytesRead;
|
||||
ULONG bytesWritten;
|
||||
BYTE buffer[1024];
|
||||
HANDLE hVirtualChannel;
|
||||
|
||||
length = sizeof(buffer);
|
||||
|
||||
hVirtualChannel = WTSVirtualChannelOpenEx( WTS_CURRENT_SESSION, "ECHO",WTS_CHANNEL_OPTION_DYNAMIC);
|
||||
|
||||
|
||||
if (hVirtualChannel == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
printf("WTSVirtualChannelOpen failed: %d\n", (int) GetLastError());
|
||||
return -1;
|
||||
}
|
||||
printf("WTSVirtualChannelOpen opend");
|
||||
bytesWritten = 0;
|
||||
bSuccess = WTSVirtualChannelWrite(hVirtualChannel, (PCHAR) buffer, length, &bytesWritten);
|
||||
|
||||
if (!bSuccess)
|
||||
{
|
||||
printf("WTSVirtualChannelWrite failed: %d\n", (int) GetLastError());
|
||||
return -1;
|
||||
}
|
||||
printf("WTSVirtualChannelWrite written");
|
||||
|
||||
bytesRead = 0;
|
||||
bSuccess = WTSVirtualChannelRead(hVirtualChannel, 5000, (PCHAR) buffer, length, &bytesRead);
|
||||
|
||||
if (!bSuccess)
|
||||
{
|
||||
printf("WTSVirtualChannelRead failed: %d\n", (int) GetLastError());
|
||||
return -1;
|
||||
}
|
||||
printf("WTSVirtualChannelRead read");
|
||||
|
||||
if (!WTSVirtualChannelClose(hVirtualChannel))
|
||||
{
|
||||
printf("WTSVirtualChannelClose failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <winpr/error.h>
|
||||
#include <winpr/wtsapi.h>
|
||||
|
||||
int TestWtsApiLogoffSession(int argc, char* argv[])
|
||||
int TestWtsApiExtraLogoffSession(int argc, char* argv[])
|
||||
{
|
||||
BOOL bSuccess;
|
||||
HANDLE hServer;
|
||||
@ -12,12 +12,12 @@ int TestWtsApiLogoffSession(int argc, char* argv[])
|
||||
sessionId = 123;
|
||||
hServer = WTS_CURRENT_SERVER_HANDLE;
|
||||
|
||||
bSuccess = WTSLogoffSession(hServer, sessionId, FALSE);
|
||||
bSuccess = WTSLogoffSession(hServer, WTS_CURRENT_SESSION, FALSE);
|
||||
|
||||
if (!bSuccess)
|
||||
{
|
||||
printf("WTSLogoffSession failed: %d\n", (int) GetLastError());
|
||||
//return -1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
29
winpr/libwinpr/wtsapi/test/TestWtsApiExtraSendMessage.c
Normal file
29
winpr/libwinpr/wtsapi/test/TestWtsApiExtraSendMessage.c
Normal file
@ -0,0 +1,29 @@
|
||||
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/error.h>
|
||||
#include <winpr/wtsapi.h>
|
||||
#include <winpr/user.h>
|
||||
|
||||
#define TITLE "thats the title"
|
||||
#define MESSAGE "thats the message"
|
||||
|
||||
int TestWtsApiExtraSendMessage(int argc, char* argv[])
|
||||
{
|
||||
BOOL bSuccess;
|
||||
HANDLE hServer;
|
||||
DWORD result;
|
||||
|
||||
hServer = WTS_CURRENT_SERVER_HANDLE;
|
||||
|
||||
bSuccess = WTSSendMessage(hServer, WTS_CURRENT_SESSION,TITLE,strlen(TITLE) + 1, MESSAGE, strlen(MESSAGE) + 1, MB_CANCELTRYCONTINUE, 3 , &result,TRUE);
|
||||
|
||||
if (!bSuccess)
|
||||
{
|
||||
printf("WTSSendMessage failed: %d\n", (int) GetLastError());
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("WTSSendMessage got result: %d\n", (int) result);
|
||||
|
||||
return 0;
|
||||
}
|
@ -3,7 +3,7 @@
|
||||
#include <winpr/error.h>
|
||||
#include <winpr/wtsapi.h>
|
||||
|
||||
int TestWtsApiVirtualChannel(int argc, char* argv[])
|
||||
int TestWtsApiExtraVirtualChannel(int argc, char* argv[])
|
||||
{
|
||||
BOOL bSuccess;
|
||||
ULONG length;
|
||||
@ -14,22 +14,23 @@ int TestWtsApiVirtualChannel(int argc, char* argv[])
|
||||
|
||||
length = sizeof(buffer);
|
||||
|
||||
hVirtualChannel = WTSVirtualChannelOpen(WTS_CURRENT_SERVER_HANDLE, WTS_CURRENT_SESSION, "RDPDBG");
|
||||
hVirtualChannel = WTSVirtualChannelOpen(WTS_CURRENT_SERVER_HANDLE, WTS_CURRENT_SESSION, "sample");
|
||||
|
||||
if (!hVirtualChannel)
|
||||
if (hVirtualChannel == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
printf("WTSVirtualChannelOpen failed: %d\n", (int) GetLastError());
|
||||
//return -1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("WTSVirtualChannelOpen opend");
|
||||
bytesWritten = 0;
|
||||
bSuccess = WTSVirtualChannelWrite(hVirtualChannel, (PCHAR) buffer, length, &bytesWritten);
|
||||
|
||||
if (!bSuccess)
|
||||
{
|
||||
printf("WTSVirtualChannelWrite failed: %d\n", (int) GetLastError());
|
||||
//return -1;
|
||||
return -1;
|
||||
}
|
||||
printf("WTSVirtualChannelWrite written");
|
||||
|
||||
bytesRead = 0;
|
||||
bSuccess = WTSVirtualChannelRead(hVirtualChannel, 5000, (PCHAR) buffer, length, &bytesRead);
|
||||
@ -37,13 +38,14 @@ int TestWtsApiVirtualChannel(int argc, char* argv[])
|
||||
if (!bSuccess)
|
||||
{
|
||||
printf("WTSVirtualChannelRead failed: %d\n", (int) GetLastError());
|
||||
//return -1;
|
||||
return -1;
|
||||
}
|
||||
printf("WTSVirtualChannelRead read");
|
||||
|
||||
if (!WTSVirtualChannelClose(hVirtualChannel))
|
||||
{
|
||||
printf("WTSVirtualChannelClose failed\n");
|
||||
//return -1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
Loading…
Reference in New Issue
Block a user