mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-14 00:14:11 +09:00
libfreerdp-core: expose stubbed WtsApi function table from the core
This commit is contained in:
@@ -20,6 +20,11 @@
|
||||
#ifndef __XF_CLIENT_H
|
||||
#define __XF_CLIENT_H
|
||||
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/synch.h>
|
||||
#include <winpr/thread.h>
|
||||
#include <winpr/collections.h>
|
||||
|
||||
#include <freerdp/api.h>
|
||||
#include <freerdp/freerdp.h>
|
||||
#include <freerdp/client.h>
|
||||
@@ -31,11 +36,6 @@
|
||||
#include <freerdp/cache/cache.h>
|
||||
#include <freerdp/channels/channels.h>
|
||||
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/synch.h>
|
||||
#include <winpr/thread.h>
|
||||
#include <winpr/collections.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
@@ -21,6 +21,9 @@
|
||||
#ifndef FREERDP_CHANNELS_H
|
||||
#define FREERDP_CHANNELS_H
|
||||
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/wtsapi.h>
|
||||
|
||||
#include <freerdp/api.h>
|
||||
#include <freerdp/types.h>
|
||||
#include <freerdp/freerdp.h>
|
||||
@@ -54,6 +57,8 @@ FREERDP_API int freerdp_channels_process_pending_messages(freerdp* instance);
|
||||
FREERDP_API int freerdp_channels_data(freerdp* instance,
|
||||
UINT16 channelId, BYTE* data, int dataSize, int flags, int totalSize);
|
||||
|
||||
FREERDP_API PWtsApiFunctionTable FreeRDP_InitWtsApi(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -32,37 +32,6 @@ enum RDP_CODEC_ID
|
||||
RDP_CODEC_ID_IMAGE_REMOTEFX = 0x04
|
||||
};
|
||||
|
||||
/**
|
||||
* Static Virtual Channel Flags
|
||||
*/
|
||||
enum RDP_SVC_CHANNEL_FLAG
|
||||
{
|
||||
CHANNEL_FLAG_MIDDLE = 0,
|
||||
CHANNEL_FLAG_FIRST = 0x01,
|
||||
CHANNEL_FLAG_LAST = 0x02,
|
||||
CHANNEL_FLAG_ONLY = (CHANNEL_FLAG_FIRST | CHANNEL_FLAG_LAST),
|
||||
CHANNEL_FLAG_SHOW_PROTOCOL = 0x10,
|
||||
CHANNEL_FLAG_SUSPEND = 0x20,
|
||||
CHANNEL_FLAG_RESUME = 0x40,
|
||||
CHANNEL_FLAG_FAIL = 0x100
|
||||
};
|
||||
|
||||
/**
|
||||
* Static Virtual Channel Events
|
||||
*/
|
||||
enum RDP_SVC_CHANNEL_EVENT
|
||||
{
|
||||
CHANNEL_EVENT_INITIALIZED = 0,
|
||||
CHANNEL_EVENT_CONNECTED = 1,
|
||||
CHANNEL_EVENT_V1_CONNECTED = 2,
|
||||
CHANNEL_EVENT_DISCONNECTED = 3,
|
||||
CHANNEL_EVENT_TERMINATED = 4,
|
||||
CHANNEL_EVENT_DATA_RECEIVED = 10,
|
||||
CHANNEL_EVENT_WRITE_COMPLETE = 11,
|
||||
CHANNEL_EVENT_WRITE_CANCELLED = 12,
|
||||
CHANNEL_EVENT_USER = 1000
|
||||
};
|
||||
|
||||
/**
|
||||
* Pixel format
|
||||
*/
|
||||
@@ -79,11 +48,6 @@ enum RDP_PIXEL_FORMAT
|
||||
};
|
||||
typedef enum RDP_PIXEL_FORMAT RDP_PIXEL_FORMAT;
|
||||
|
||||
/**
|
||||
* Virtual Channel Constants
|
||||
*/
|
||||
#define CHANNEL_CHUNK_LENGTH 1600
|
||||
|
||||
/**
|
||||
* CPU Optimization flags
|
||||
*/
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
|
||||
#include <winpr/wtsapi.h>
|
||||
|
||||
#define CHANNEL_EVENT_USER 1000
|
||||
|
||||
#define CHANNEL_EXPORT_FUNC_NAME "VirtualChannelEntry"
|
||||
|
||||
typedef UINT (FREERDP_CC * PVIRTUALCHANNELEVENTPUSH)(DWORD openHandle, wMessage* event);
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <winpr/stream.h>
|
||||
#include <winpr/collections.h>
|
||||
|
||||
#include <freerdp/svc.h>
|
||||
#include <freerdp/utils/debug.h>
|
||||
#include <freerdp/utils/event.h>
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/stream.h>
|
||||
#include <winpr/wtsapi.h>
|
||||
|
||||
#include <freerdp/freerdp.h>
|
||||
#include <freerdp/constants.h>
|
||||
@@ -143,3 +144,78 @@ BOOL freerdp_channel_peer_process(freerdp_peer* client, wStream* s, UINT16 chann
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static WtsApiFunctionTable FreeRDP_WtsApiFunctionTable =
|
||||
{
|
||||
0, /* dwVersion */
|
||||
0, /* dwFlags */
|
||||
|
||||
NULL, /* StopRemoteControlSession */
|
||||
NULL, /* StartRemoteControlSessionW */
|
||||
NULL, /* StartRemoteControlSessionA */
|
||||
NULL, /* ConnectSessionW */
|
||||
NULL, /* ConnectSessionA */
|
||||
NULL, /* EnumerateServersW */
|
||||
NULL, /* EnumerateServersA */
|
||||
NULL, /* OpenServerW */
|
||||
NULL, /* OpenServerA */
|
||||
NULL, /* OpenServerExW */
|
||||
NULL, /* OpenServerExA */
|
||||
NULL, /* CloseServer */
|
||||
NULL, /* EnumerateSessionsW */
|
||||
NULL, /* EnumerateSessionsA */
|
||||
NULL, /* EnumerateSessionsExW */
|
||||
NULL, /* EnumerateSessionsExA */
|
||||
NULL, /* EnumerateProcessesW */
|
||||
NULL, /* EnumerateProcessesA */
|
||||
NULL, /* TerminateProcess */
|
||||
NULL, /* QuerySessionInformationW */
|
||||
NULL, /* QuerySessionInformationA */
|
||||
NULL, /* QueryUserConfigW */
|
||||
NULL, /* QueryUserConfigA */
|
||||
NULL, /* SetUserConfigW */
|
||||
NULL, /* SetUserConfigA */
|
||||
NULL, /* SendMessageW */
|
||||
NULL, /* SendMessageA */
|
||||
NULL, /* DisconnectSession */
|
||||
NULL, /* LogoffSession */
|
||||
NULL, /* ShutdownSystem */
|
||||
NULL, /* WaitSystemEvent */
|
||||
NULL, /* VirtualChannelOpen */
|
||||
NULL, /* VirtualChannelOpenEx */
|
||||
NULL, /* VirtualChannelClose */
|
||||
NULL, /* VirtualChannelRead */
|
||||
NULL, /* VirtualChannelWrite */
|
||||
NULL, /* VirtualChannelPurgeInput */
|
||||
NULL, /* VirtualChannelPurgeOutput */
|
||||
NULL, /* VirtualChannelQuery */
|
||||
NULL, /* FreeMemory */
|
||||
NULL, /* RegisterSessionNotification */
|
||||
NULL, /* UnRegisterSessionNotification */
|
||||
NULL, /* RegisterSessionNotificationEx */
|
||||
NULL, /* UnRegisterSessionNotificationEx */
|
||||
NULL, /* QueryUserToken */
|
||||
NULL, /* FreeMemoryExW */
|
||||
NULL, /* FreeMemoryExA */
|
||||
NULL, /* EnumerateProcessesExW */
|
||||
NULL, /* EnumerateProcessesExA */
|
||||
NULL, /* EnumerateListenersW */
|
||||
NULL, /* EnumerateListenersA */
|
||||
NULL, /* QueryListenerConfigW */
|
||||
NULL, /* QueryListenerConfigA */
|
||||
NULL, /* CreateListenerW */
|
||||
NULL, /* CreateListenerA */
|
||||
NULL, /* SetListenerSecurityW */
|
||||
NULL, /* SetListenerSecurityA */
|
||||
NULL, /* GetListenerSecurityW */
|
||||
NULL, /* GetListenerSecurityA */
|
||||
NULL, /* EnableChildSessions */
|
||||
NULL, /* IsChildSessionsEnabled */
|
||||
NULL, /* GetChildSessionId */
|
||||
NULL /* GetActiveConsoleSessionId */
|
||||
};
|
||||
|
||||
PWtsApiFunctionTable FreeRDP_InitWtsApi(void)
|
||||
{
|
||||
return &FreeRDP_WtsApiFunctionTable;
|
||||
}
|
||||
|
||||
@@ -29,6 +29,11 @@
|
||||
|
||||
#include <wtsapi32.h>
|
||||
|
||||
/**
|
||||
* Workaround for X11 "CurrentTime" header conflict
|
||||
*/
|
||||
#define CurrentTime _CurrentTime
|
||||
|
||||
#else
|
||||
|
||||
/**
|
||||
@@ -437,12 +442,12 @@ typedef struct _WTSINFOW
|
||||
DWORD OutgoingCompressedBytes;
|
||||
WCHAR WinStationName[WINSTATIONNAME_LENGTH];
|
||||
WCHAR Domain[DOMAIN_LENGTH];
|
||||
WCHAR UserName[USERNAME_LENGTH+1];
|
||||
WCHAR UserName[USERNAME_LENGTH + 1];
|
||||
LARGE_INTEGER ConnectTime;
|
||||
LARGE_INTEGER DisconnectTime;
|
||||
LARGE_INTEGER LastInputTime;
|
||||
LARGE_INTEGER LogonTime;
|
||||
LARGE_INTEGER CurrentTime;
|
||||
LARGE_INTEGER _CurrentTime; /* Conflicts with X11 headers */
|
||||
} WTSINFOW, *PWTSINFOW;
|
||||
|
||||
typedef struct _WTSINFOA
|
||||
@@ -462,7 +467,7 @@ typedef struct _WTSINFOA
|
||||
LARGE_INTEGER DisconnectTime;
|
||||
LARGE_INTEGER LastInputTime;
|
||||
LARGE_INTEGER LogonTime;
|
||||
LARGE_INTEGER CurrentTime;
|
||||
LARGE_INTEGER _CurrentTime; /* Conflicts with X11 headers */
|
||||
} WTSINFOA, *PWTSINFOA;
|
||||
|
||||
#define WTS_SESSIONSTATE_UNKNOWN 0xFFFFFFFF
|
||||
@@ -481,7 +486,7 @@ typedef struct _WTSINFOEX_LEVEL1_W
|
||||
LARGE_INTEGER ConnectTime;
|
||||
LARGE_INTEGER DisconnectTime;
|
||||
LARGE_INTEGER LastInputTime;
|
||||
LARGE_INTEGER CurrentTime;
|
||||
LARGE_INTEGER _CurrentTime; /* Conflicts with X11 headers */
|
||||
DWORD IncomingBytes;
|
||||
DWORD OutgoingBytes;
|
||||
DWORD IncomingFrames;
|
||||
@@ -502,7 +507,7 @@ typedef struct _WTSINFOEX_LEVEL1_A
|
||||
LARGE_INTEGER ConnectTime;
|
||||
LARGE_INTEGER DisconnectTime;
|
||||
LARGE_INTEGER LastInputTime;
|
||||
LARGE_INTEGER CurrentTime;
|
||||
LARGE_INTEGER _CurrentTime; /* Conflicts with X11 headers */
|
||||
DWORD IncomingBytes;
|
||||
DWORD OutgoingBytes;
|
||||
DWORD IncomingFrames;
|
||||
@@ -711,7 +716,7 @@ typedef struct _WTSUSERCONFIGW
|
||||
#define WTS_EVENT_LOGOFF 0x00000040
|
||||
#define WTS_EVENT_STATECHANGE 0x00000080
|
||||
#define WTS_EVENT_LICENSE 0x00000100
|
||||
#define WTS_EVENT_ALL 0x7fffffff
|
||||
#define WTS_EVENT_ALL 0x7FFFFFFF
|
||||
#define WTS_EVENT_FLUSH 0x80000000
|
||||
|
||||
#define REMOTECONTROL_KBDSHIFT_HOTKEY 0x1
|
||||
@@ -1046,6 +1051,8 @@ WINPR_API BOOL WTSIsChildSessionsEnabled(PBOOL pbEnabled);
|
||||
|
||||
WINPR_API BOOL WTSGetChildSessionId(PULONG pSessionId);
|
||||
|
||||
WINPR_API DWORD WTSGetActiveConsoleSessionId(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1235,6 +1242,8 @@ typedef BOOL (WTSAPI * WTS_IS_CHILD_SESSIONS_ENABLED_FN)(PBOOL pbEnabled);
|
||||
|
||||
typedef BOOL (WTSAPI * WTS_GET_CHILD_SESSION_ID_FN)(PULONG pSessionId);
|
||||
|
||||
typedef DWORD (WTSAPI * WTS_GET_ACTIVE_CONSOLE_SESSION_ID_FN)(void);
|
||||
|
||||
struct _WtsApiFunctionTable
|
||||
{
|
||||
DWORD dwVersion;
|
||||
@@ -1302,6 +1311,7 @@ struct _WtsApiFunctionTable
|
||||
WTS_ENABLE_CHILD_SESSIONS_FN EnableChildSessions;
|
||||
WTS_IS_CHILD_SESSIONS_ENABLED_FN IsChildSessionsEnabled;
|
||||
WTS_GET_CHILD_SESSION_ID_FN GetChildSessionId;
|
||||
WTS_GET_ACTIVE_CONSOLE_SESSION_ID_FN GetActiveConsoleSessionId;
|
||||
};
|
||||
typedef struct _WtsApiFunctionTable WtsApiFunctionTable;
|
||||
typedef WtsApiFunctionTable* PWtsApiFunctionTable;
|
||||
|
||||
@@ -551,6 +551,14 @@ BOOL WTSGetChildSessionId(PULONG pSessionId)
|
||||
return g_WtsApi->GetChildSessionId(pSessionId);
|
||||
}
|
||||
|
||||
DWORD WTSGetActiveConsoleSessionId(void)
|
||||
{
|
||||
if (!g_WtsApi || !g_WtsApi->GetActiveConsoleSessionId)
|
||||
return 0xFFFFFFFF;
|
||||
|
||||
return g_WtsApi->GetActiveConsoleSessionId();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
BOOL WTSRegisterWtsApiFunctionTable(PWtsApiFunctionTable table)
|
||||
|
||||
Reference in New Issue
Block a user