diff --git a/channels/urbdrc/common/urbdrc_helpers.c b/channels/urbdrc/common/urbdrc_helpers.c index 290b5c56f..6620eb4ff 100644 --- a/channels/urbdrc/common/urbdrc_helpers.c +++ b/channels/urbdrc/common/urbdrc_helpers.c @@ -425,3 +425,26 @@ void urbdrc_dump_message(wLog* log, BOOL client, BOOL write, wStream* s) WLog_Print(log, WLOG_TRACE, "-------------------------- URBDRC end -----"); #endif } + +/* [MS-RDPEUSB] 2.2.1 Shared Message Header (SHARED_MSG_HEADER) */ +BOOL write_shared_message_header_with_functionid(wStream* s, UINT32 InterfaceId, UINT32 MessageId, + UINT32 FunctionId) +{ + if (!Stream_EnsureRemainingCapacity(s, 12)) + return FALSE; + + Stream_Write_UINT32(s, InterfaceId); + Stream_Write_UINT32(s, MessageId); + Stream_Write_UINT32(s, FunctionId); + return TRUE; +} + +wStream* create_shared_message_header_with_functionid(UINT32 InterfaceId, UINT32 MessageId, + UINT32 FunctionId, size_t OutputSize) +{ + wStream* out = Stream_New(NULL, 12ULL + OutputSize); + if (!out) + return NULL; + (void)write_shared_message_header_with_functionid(out, InterfaceId, MessageId, FunctionId); + return out; +} diff --git a/channels/urbdrc/common/urbdrc_helpers.h b/channels/urbdrc/common/urbdrc_helpers.h index d766ac55e..80dfe886c 100644 --- a/channels/urbdrc/common/urbdrc_helpers.h +++ b/channels/urbdrc/common/urbdrc_helpers.h @@ -38,6 +38,11 @@ extern "C" void urbdrc_dump_message(wLog* log, BOOL client, BOOL write, wStream* s); + wStream* create_shared_message_header_with_functionid(UINT32 InterfaceId, UINT32 MessageId, + UINT32 FunctionId, size_t OutputSize); + BOOL write_shared_message_header_with_functionid(wStream* s, UINT32 InterfaceId, + UINT32 MessageId, UINT32 FunctionId); + #ifdef __cplusplus } #endif