Coverage Report

Created: 2026-05-30 06:46

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/FreeRDP/channels/disp/disp_common.c
Line
Count
Source
1
/**
2
 * FreeRDP: A Remote Desktop Protocol Implementation
3
 * RDPEDISP Virtual Channel Extension
4
 *
5
 * Copyright 2019 Kobi Mizrachi <kmizrachi18@gmail.com>
6
 *
7
 * Licensed under the Apache License, Version 2.0 (the "License");
8
 * you may not use this file except in compliance with the License.
9
 * You may obtain a copy of the License at
10
 *
11
 *     http://www.apache.org/licenses/LICENSE-2.0
12
 *
13
 * Unless required by applicable law or agreed to in writing, software
14
 * distributed under the License is distributed on an "AS IS" BASIS,
15
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
 * See the License for the specific language governing permissions and
17
 * limitations under the License.
18
 */
19
20
#include <freerdp/config.h>
21
22
#include <winpr/crt.h>
23
#include <winpr/stream.h>
24
#include <freerdp/channels/log.h>
25
26
#define TAG CHANNELS_TAG("disp.common")
27
28
#include "disp_common.h"
29
30
/**
31
 * Function description
32
 *
33
 * @return 0 on success, otherwise a Win32 error code
34
 */
35
UINT disp_read_header(wStream* s, DISPLAY_CONTROL_HEADER* header)
36
0
{
37
0
  if (!Stream_CheckAndLogRequiredLength(TAG, s, 8))
38
0
    return ERROR_INVALID_DATA;
39
40
0
  Stream_Read_UINT32(s, header->type);
41
0
  Stream_Read_UINT32(s, header->length);
42
0
  if (header->length < 8)
43
0
  {
44
0
    WLog_ERR(TAG, "Invalid header length %" PRIu32 ", require at least 8", header->length);
45
0
    return ERROR_INVALID_DATA;
46
0
  }
47
0
  return CHANNEL_RC_OK;
48
0
}
49
50
/**
51
 * Function description
52
 *
53
 * @return 0 on success, otherwise a Win32 error code
54
 */
55
UINT disp_write_header(wStream* s, const DISPLAY_CONTROL_HEADER* header)
56
0
{
57
0
  Stream_Write_UINT32(s, header->type);
58
0
  Stream_Write_UINT32(s, header->length);
59
0
  return CHANNEL_RC_OK;
60
0
}