summaryrefslogtreecommitdiff
path: root/src/rdp/rdp_rail.c
diff options
context:
space:
mode:
authorsss <sss@dark-alexandr.net>2023-01-17 00:38:19 +0300
committersss <sss@dark-alexandr.net>2023-01-17 00:38:19 +0300
commitcc3f33db7a8d3c4ad373e646b199808e01bc5d9b (patch)
treeec09d690c7656ab5f2cc72607e05fb359c24d8b2 /src/rdp/rdp_rail.c
added webrdp public code
Diffstat (limited to 'src/rdp/rdp_rail.c')
-rw-r--r--src/rdp/rdp_rail.c173
1 files changed, 173 insertions, 0 deletions
diff --git a/src/rdp/rdp_rail.c b/src/rdp/rdp_rail.c
new file mode 100644
index 0000000..bde1950
--- /dev/null
+++ b/src/rdp/rdp_rail.c
@@ -0,0 +1,173 @@
+/* BSD-2-Clause license
+ *
+ * Copyright (c) 2018-2023 NST <www.newinfosec.ru>, sss <sss at dark-alexandr dot net>.
+ *
+ */
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <stddef.h>
+
+#include "webrdp_core_api.h"
+#include "webrdp_module_api.h"
+#include "rdp_backend_api.h"
+#include "rdp_rail.h"
+
+static UINT
+RailServerSystemParam(
+ RailClientContext *context, const RAIL_SYSPARAM_ORDER *sysparam)
+{
+ return CHANNEL_RC_OK;
+}
+
+static UINT
+RailServerHandshake(
+ RailClientContext *context, const RAIL_HANDSHAKE_ORDER *handshake)
+{
+ return client_rail_server_start_cmd(context);
+}
+
+static UINT
+RailServerHandshakeEx(
+ RailClientContext *context, const RAIL_HANDSHAKE_EX_ORDER *handshakeEx)
+{
+ return client_rail_server_start_cmd(context);
+}
+
+static UINT
+RailServerLocalMoveSize(
+ RailClientContext *context, const RAIL_LOCALMOVESIZE_ORDER *localMoveSize)
+{
+ return CHANNEL_RC_OK;
+}
+static UINT
+RailServerMinMaxInfo(
+ RailClientContext *context, const RAIL_MINMAXINFO_ORDER *minMaxInfo)
+{
+ return CHANNEL_RC_OK;
+}
+
+static UINT
+RailServerLanguageBarInfo(
+ RailClientContext *context, const RAIL_LANGBAR_INFO_ORDER *langBarInfo)
+{
+ return CHANNEL_RC_OK;
+}
+static UINT
+RailServerExecuteResult(
+ RailClientContext *context, const RAIL_EXEC_RESULT_ORDER *execResult)
+{
+ my_rdp_context *c = (my_rdp_context *)context;
+ if (execResult->execResult != RAIL_EXEC_S_OK)
+ {
+ const char *msg
+ = "rdp_module: rail: RailServerExecuteResult failure";
+ c->my_internals->core->api_utils->log_msg(
+ (const uint8_t *)msg, strlen(msg), wrdp_log_level_error, 0);
+ }
+ return CHANNEL_RC_OK;
+}
+
+static UINT
+RailServerGetAppIdResponse(
+ RailClientContext *context, const RAIL_GET_APPID_RESP_ORDER *getAppIdResp)
+{
+ return CHANNEL_RC_OK;
+}
+
+static BOOL
+WindowCreate(rdpContext *context, const WINDOW_ORDER_INFO *orderInfo,
+ const WINDOW_STATE_ORDER *window_state)
+{
+ return TRUE;
+}
+static BOOL
+WindowUpdate(rdpContext *context, const WINDOW_ORDER_INFO *orderInfo,
+ const WINDOW_STATE_ORDER *window_state)
+{
+ return TRUE;
+}
+static BOOL
+WindowIcon(rdpContext *context, const WINDOW_ORDER_INFO *orderInfo,
+ const WINDOW_ICON_ORDER *window_icon)
+{
+ return TRUE;
+}
+static BOOL
+WindowCachedIcon(rdpContext *context, const WINDOW_ORDER_INFO *orderInfo,
+ const WINDOW_CACHED_ICON_ORDER *window_cached_icon)
+{
+ return TRUE;
+}
+static BOOL
+WindowDelete(rdpContext *context, const WINDOW_ORDER_INFO *orderInfo)
+{
+ return TRUE;
+}
+static BOOL
+NotifyIconCreate(rdpContext *context, const WINDOW_ORDER_INFO *orderInfo,
+ const NOTIFY_ICON_STATE_ORDER *notify_icon_state)
+{
+ return TRUE;
+}
+static BOOL
+NotifyIconUpdate(rdpContext *context, const WINDOW_ORDER_INFO *orderInfo,
+ const NOTIFY_ICON_STATE_ORDER *notify_icon_state)
+{
+ return TRUE;
+}
+static BOOL
+NotifyIconDelete(rdpContext *context, const WINDOW_ORDER_INFO *orderInfo)
+{
+ return TRUE;
+}
+static BOOL
+MonitoredDesktop(rdpContext *context, const WINDOW_ORDER_INFO *orderInfo,
+ const MONITORED_DESKTOP_ORDER *monitored_desktop)
+{
+ return TRUE;
+}
+static BOOL
+NonMonitoredDesktop(rdpContext *context, const WINDOW_ORDER_INFO *orderInfo)
+{
+ return TRUE;
+}
+
+static void
+rdp_rail_register_update_callbacks(rdpUpdate *update)
+{
+ rdpWindowUpdate *window = update->window;
+ window->WindowCreate = WindowCreate;
+ window->WindowUpdate = WindowUpdate;
+ window->WindowDelete = WindowDelete;
+ window->WindowIcon = WindowIcon;
+ window->WindowCachedIcon = WindowCachedIcon;
+ window->NotifyIconCreate = NotifyIconCreate;
+ window->NotifyIconUpdate = NotifyIconUpdate;
+ window->NotifyIconDelete = NotifyIconDelete;
+ window->MonitoredDesktop = MonitoredDesktop;
+ window->NonMonitoredDesktop = NonMonitoredDesktop;
+}
+
+void
+rdp_rail_init(my_rdp_context *context, RailClientContext *rail)
+{
+ if (!context || !rail)
+ return;
+
+ rdp_rail_register_update_callbacks(context->context.update);
+ rail->custom = (void *)context;
+ rail->ServerExecuteResult = RailServerExecuteResult;
+ rail->ServerSystemParam = RailServerSystemParam;
+ rail->ServerHandshake = RailServerHandshake;
+ rail->ServerHandshakeEx = RailServerHandshakeEx;
+ rail->ServerLocalMoveSize = RailServerLocalMoveSize;
+ rail->ServerMinMaxInfo = RailServerMinMaxInfo;
+ rail->ServerLanguageBarInfo = RailServerLanguageBarInfo;
+ rail->ServerGetAppIdResponse = RailServerGetAppIdResponse;
+}
+
+void
+rdp_rail_uninit(my_rdp_context *context, RailClientContext *rail)
+{
+}