Updated RDPDR version checks

This commit is contained in:
Armin Novak 2021-11-30 08:52:54 +01:00 committed by akallabeth
parent 46c78cf0f0
commit 223da39eac
4 changed files with 30 additions and 7 deletions

View File

@ -51,8 +51,8 @@ static void rdpdr_write_general_capset(rdpdrPlugin* rdpdr, wStream* s)
rdpdr_write_capset_header(s, CAP_GENERAL_TYPE, 44, GENERAL_CAPABILITY_VERSION_02);
Stream_Write_UINT32(s, 0); /* osType, ignored on receipt */
Stream_Write_UINT32(s, 0); /* osVersion, unused and must be set to zero */
Stream_Write_UINT16(s, 1); /* protocolMajorVersion, must be set to 1 */
Stream_Write_UINT16(s, RDPDR_MINOR_RDP_VERSION_5_2); /* protocolMinorVersion */
Stream_Write_UINT16(s, RDPDR_MAJOR_RDP_VERSION); /* protocolMajorVersion, must be set to 1 */
Stream_Write_UINT16(s, RDPDR_MINOR_RDP_VERSION_13); /* protocolMinorVersion */
Stream_Write_UINT32(s, 0x0000FFFF); /* ioCode1 */
Stream_Write_UINT32(s, 0); /* ioCode2, must be set to zero, reserved for future use */
Stream_Write_UINT32(s, RDPDR_DEVICE_REMOVE_PDUS | RDPDR_CLIENT_DISPLAY_NAME_PDU |

View File

@ -858,7 +858,7 @@ static BOOL hotplug_delete_foreach(ULONG_PTR key, void* element, void* data)
rc = ConvertFromUnicode(CP_UTF8, 0, device_ext->path, -1, &path, 0, NULL, NULL);
if (!path)
if ((rc <= 0) || !path)
return FALSE;
/* not plugable device */
@ -1464,9 +1464,6 @@ static BOOL device_init(ULONG_PTR key, void* element, void* data)
static UINT rdpdr_process_init(rdpdrPlugin* rdpdr)
{
ULONG_PTR* pKeys = NULL;
pKeys = NULL;
WINPR_ASSERT(rdpdr);
WINPR_ASSERT(rdpdr->devman);

View File

@ -300,6 +300,30 @@ static UINT rdpdr_server_read_general_capability_set(RdpdrServerContext* context
Stream_Read_UINT32(s, extraFlags1); /* extraFlags1 (4 bytes) */
Stream_Seek_UINT32(s); /* extraFlags2 (4 bytes), must be set to zero, reserved for future use */
if (VersionMajor != RDPDR_MAJOR_RDP_VERSION)
{
WLog_ERR(TAG, "unsupported RDPDR version %" PRIu16 ".%" PRIu16, VersionMajor, VersionMinor);
return ERROR_INVALID_DATA;
}
switch (VersionMinor)
{
case RDPDR_MINOR_RDP_VERSION_13:
break;
case RDPDR_MINOR_RDP_VERSION_6_X:
break;
case RDPDR_MINOR_RDP_VERSION_5_2:
break;
case RDPDR_MINOR_RDP_VERSION_5_1:
break;
case RDPDR_MINOR_RDP_VERSION_5_0:
break;
default:
WLog_WARN(TAG, "unsupported RDPDR minor version %" PRIu16 ".%" PRIu16, VersionMajor,
VersionMinor);
break;
}
if (header->Version == GENERAL_CAPABILITY_VERSION_02)
{
if (Stream_GetRemainingLength(s) < 4)

View File

@ -126,12 +126,14 @@ enum IRP_MN
#define FILE_OVERWRITTEN 0x00000003
/* DR_CORE_CLIENT_ANNOUNCE_RSP.VersionMinor */
#define RDPDR_MAJOR_RDP_VERSION 1
enum RDPDR_MINOR_RDP_VERSION
{
RDPDR_MINOR_RDP_VERSION_5_0 = 0x0002,
RDPDR_MINOR_RDP_VERSION_5_1 = 0x0005,
RDPDR_MINOR_RDP_VERSION_5_2 = 0x000A,
RDPDR_MINOR_RDP_VERSION_6_X = 0x000C
RDPDR_MINOR_RDP_VERSION_6_X = 0x000C,
RDPDR_MINOR_RDP_VERSION_13 = 0x000D
};
/* DR_CORE_CLIENT_NAME_REQ.UnicodeFlag */