/src/FreeRDP/channels/disp/disp_common.c
Line  | Count  | Source (jump to first uncovered line)  | 
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  |   return CHANNEL_RC_OK;  | 
43  | 0  | }  | 
44  |  |  | 
45  |  | /**  | 
46  |  |  * Function description  | 
47  |  |  *  | 
48  |  |  * @return 0 on success, otherwise a Win32 error code  | 
49  |  |  */  | 
50  |  | UINT disp_write_header(wStream* s, const DISPLAY_CONTROL_HEADER* header)  | 
51  | 0  | { | 
52  | 0  |   Stream_Write_UINT32(s, header->type);  | 
53  | 0  |   Stream_Write_UINT32(s, header->length);  | 
54  | 0  |   return CHANNEL_RC_OK;  | 
55  | 0  | }  |