Coverage Report

Created: 2025-07-01 06:46

/src/FreeRDP/winpr/libwinpr/io/io.c
Line
Count
Source (jump to first uncovered line)
1
/**
2
 * WinPR: Windows Portable Runtime
3
 * Asynchronous I/O Functions
4
 *
5
 * Copyright 2012 Marc-Andre Moreau <marcandre.moreau@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 <winpr/config.h>
21
22
#include <winpr/io.h>
23
24
#ifndef _WIN32
25
26
#ifdef WINPR_HAVE_UNISTD_H
27
#include <unistd.h>
28
#endif
29
30
#include <time.h>
31
#include <errno.h>
32
#include <stdio.h>
33
#include <stdlib.h>
34
#include <string.h>
35
#include <dirent.h>
36
37
#include <fcntl.h>
38
#include <sys/un.h>
39
#include <sys/stat.h>
40
#include <sys/socket.h>
41
42
#include <winpr/crt.h>
43
#include <winpr/wlog.h>
44
45
#include "../handle/handle.h"
46
#include "../pipe/pipe.h"
47
#include "../log.h"
48
49
#define TAG WINPR_TAG("io")
50
51
BOOL GetOverlappedResult(WINPR_ATTR_UNUSED HANDLE hFile,
52
                         WINPR_ATTR_UNUSED LPOVERLAPPED lpOverlapped,
53
                         WINPR_ATTR_UNUSED LPDWORD lpNumberOfBytesTransferred,
54
                         WINPR_ATTR_UNUSED BOOL bWait)
55
0
{
56
0
  WLog_ERR(TAG, "Not implemented");
57
0
  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
58
0
  return FALSE;
59
0
}
60
61
BOOL GetOverlappedResultEx(WINPR_ATTR_UNUSED HANDLE hFile,
62
                           WINPR_ATTR_UNUSED LPOVERLAPPED lpOverlapped,
63
                           WINPR_ATTR_UNUSED LPDWORD lpNumberOfBytesTransferred,
64
                           WINPR_ATTR_UNUSED DWORD dwMilliseconds,
65
                           WINPR_ATTR_UNUSED BOOL bAlertable)
66
0
{
67
0
  WLog_ERR(TAG, "Not implemented");
68
0
  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
69
0
  return FALSE;
70
0
}
71
72
BOOL DeviceIoControl(WINPR_ATTR_UNUSED HANDLE hDevice, WINPR_ATTR_UNUSED DWORD dwIoControlCode,
73
                     WINPR_ATTR_UNUSED LPVOID lpInBuffer, WINPR_ATTR_UNUSED DWORD nInBufferSize,
74
                     WINPR_ATTR_UNUSED LPVOID lpOutBuffer, WINPR_ATTR_UNUSED DWORD nOutBufferSize,
75
                     WINPR_ATTR_UNUSED LPDWORD lpBytesReturned,
76
                     WINPR_ATTR_UNUSED LPOVERLAPPED lpOverlapped)
77
0
{
78
0
  WLog_ERR(TAG, "Not implemented");
79
0
  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
80
0
  return FALSE;
81
0
}
82
83
HANDLE CreateIoCompletionPort(WINPR_ATTR_UNUSED HANDLE FileHandle,
84
                              WINPR_ATTR_UNUSED HANDLE ExistingCompletionPort,
85
                              WINPR_ATTR_UNUSED ULONG_PTR CompletionKey,
86
                              WINPR_ATTR_UNUSED DWORD NumberOfConcurrentThreads)
87
0
{
88
0
  WLog_ERR(TAG, "Not implemented");
89
0
  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
90
0
  return NULL;
91
0
}
92
93
BOOL GetQueuedCompletionStatus(WINPR_ATTR_UNUSED HANDLE CompletionPort,
94
                               WINPR_ATTR_UNUSED LPDWORD lpNumberOfBytesTransferred,
95
                               WINPR_ATTR_UNUSED PULONG_PTR lpCompletionKey,
96
                               WINPR_ATTR_UNUSED LPOVERLAPPED* lpOverlapped,
97
                               WINPR_ATTR_UNUSED DWORD dwMilliseconds)
98
0
{
99
0
  WLog_ERR(TAG, "Not implemented");
100
0
  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
101
0
  return FALSE;
102
0
}
103
104
BOOL GetQueuedCompletionStatusEx(WINPR_ATTR_UNUSED HANDLE CompletionPort,
105
                                 WINPR_ATTR_UNUSED LPOVERLAPPED_ENTRY lpCompletionPortEntries,
106
                                 WINPR_ATTR_UNUSED ULONG ulCount,
107
                                 WINPR_ATTR_UNUSED PULONG ulNumEntriesRemoved,
108
                                 WINPR_ATTR_UNUSED DWORD dwMilliseconds,
109
                                 WINPR_ATTR_UNUSED BOOL fAlertable)
110
0
{
111
0
  WLog_ERR(TAG, "Not implemented");
112
0
  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
113
0
  return FALSE;
114
0
}
115
116
BOOL PostQueuedCompletionStatus(WINPR_ATTR_UNUSED HANDLE CompletionPort,
117
                                WINPR_ATTR_UNUSED DWORD dwNumberOfBytesTransferred,
118
                                WINPR_ATTR_UNUSED ULONG_PTR dwCompletionKey,
119
                                WINPR_ATTR_UNUSED LPOVERLAPPED lpOverlapped)
120
0
{
121
0
  WLog_ERR(TAG, "Not implemented");
122
0
  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
123
0
  return FALSE;
124
0
}
125
126
BOOL CancelIo(WINPR_ATTR_UNUSED HANDLE hFile)
127
0
{
128
0
  WLog_ERR(TAG, "Not implemented");
129
0
  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
130
0
  return FALSE;
131
0
}
132
133
BOOL CancelIoEx(WINPR_ATTR_UNUSED HANDLE hFile, WINPR_ATTR_UNUSED LPOVERLAPPED lpOverlapped)
134
0
{
135
0
  WLog_ERR(TAG, "Not implemented");
136
0
  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
137
0
  return FALSE;
138
0
}
139
140
BOOL CancelSynchronousIo(WINPR_ATTR_UNUSED HANDLE hThread)
141
0
{
142
0
  WLog_ERR(TAG, "Not implemented");
143
0
  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
144
0
  return FALSE;
145
0
}
146
147
#endif
148
149
#ifdef _UWP
150
151
#include <winpr/crt.h>
152
#include <winpr/wlog.h>
153
154
#include "../log.h"
155
156
#define TAG WINPR_TAG("io")
157
158
BOOL GetOverlappedResult(HANDLE hFile, LPOVERLAPPED lpOverlapped,
159
                         LPDWORD lpNumberOfBytesTransferred, BOOL bWait)
160
{
161
  return GetOverlappedResultEx(hFile, lpOverlapped, lpNumberOfBytesTransferred,
162
                               bWait ? INFINITE : 0, TRUE);
163
}
164
165
BOOL DeviceIoControl(HANDLE hDevice, DWORD dwIoControlCode, LPVOID lpInBuffer, DWORD nInBufferSize,
166
                     LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesReturned,
167
                     LPOVERLAPPED lpOverlapped)
168
{
169
  WLog_ERR(TAG, "Not implemented");
170
  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
171
  return FALSE;
172
}
173
174
HANDLE CreateIoCompletionPort(HANDLE FileHandle, HANDLE ExistingCompletionPort,
175
                              ULONG_PTR CompletionKey, DWORD NumberOfConcurrentThreads)
176
{
177
  WLog_ERR(TAG, "Not implemented");
178
  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
179
  return NULL;
180
}
181
182
BOOL GetQueuedCompletionStatus(HANDLE CompletionPort, LPDWORD lpNumberOfBytesTransferred,
183
                               PULONG_PTR lpCompletionKey, LPOVERLAPPED* lpOverlapped,
184
                               DWORD dwMilliseconds)
185
{
186
  WLog_ERR(TAG, "Not implemented");
187
  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
188
  return FALSE;
189
}
190
191
BOOL GetQueuedCompletionStatusEx(HANDLE CompletionPort, LPOVERLAPPED_ENTRY lpCompletionPortEntries,
192
                                 ULONG ulCount, PULONG ulNumEntriesRemoved, DWORD dwMilliseconds,
193
                                 BOOL fAlertable)
194
{
195
  WLog_ERR(TAG, "Not implemented");
196
  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
197
  return FALSE;
198
}
199
200
BOOL PostQueuedCompletionStatus(HANDLE CompletionPort, DWORD dwNumberOfBytesTransferred,
201
                                ULONG_PTR dwCompletionKey, LPOVERLAPPED lpOverlapped)
202
{
203
  WLog_ERR(TAG, "Not implemented");
204
  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
205
  return FALSE;
206
}
207
208
BOOL CancelIo(HANDLE hFile)
209
{
210
  return CancelIoEx(hFile, NULL);
211
}
212
213
BOOL CancelSynchronousIo(HANDLE hThread)
214
{
215
  WLog_ERR(TAG, "Not implemented");
216
  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
217
  return FALSE;
218
}
219
220
#endif