[channels,urbdrc] add helper functions for shared header

This commit is contained in:
akallabeth
2025-03-07 16:27:41 +01:00
parent 0c25452c59
commit 94cd8b6b2a
2 changed files with 28 additions and 0 deletions

View File

@@ -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;
}

View File

@@ -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