20 #include <winpr/config.h>
26 #ifdef WINPR_HAVE_UNISTD_H
40 #include <sys/socket.h>
42 #include <winpr/crt.h>
43 #include <winpr/wlog.h>
45 #include "../handle/handle.h"
46 #include "../pipe/pipe.h"
49 #define TAG WINPR_TAG("io")
51 BOOL GetOverlappedResult(HANDLE hFile,
LPOVERLAPPED lpOverlapped,
52 LPDWORD lpNumberOfBytesTransferred, BOOL bWait)
55 WLog_ERR(TAG,
"Not implemented");
56 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
62 if (!winpr_Handle_GetInfo(hFile, &Type, &Object))
65 else if (Type == HANDLE_TYPE_NAMED_PIPE)
71 WINPR_NAMED_PIPE* pipe;
73 pipe = (WINPR_NAMED_PIPE*)Object;
75 if (!(pipe->dwFlagsAndAttributes & FILE_FLAG_OVERLAPPED))
78 lpBuffer = lpOverlapped->Pointer;
79 request = (DWORD)lpOverlapped->Internal;
80 nNumberOfBytes = (DWORD)lpOverlapped->InternalHigh;
84 if (pipe->clientfd == -1)
87 status = read(pipe->clientfd, lpBuffer, nNumberOfBytes);
89 else if (request == 1)
91 if (pipe->clientfd == -1)
94 status = write(pipe->clientfd, lpBuffer, nNumberOfBytes);
96 else if (request == 2)
99 struct sockaddr_un s = { 0 };
101 if (pipe->serverfd == -1)
104 length =
sizeof(
struct sockaddr_un);
106 status = accept(pipe->serverfd, (
struct sockaddr*)&s, &length);
111 pipe->clientfd = status;
112 pipe->ServerMode = FALSE;
119 *lpNumberOfBytesTransferred = 0;
123 *lpNumberOfBytesTransferred = status;
130 BOOL GetOverlappedResultEx(HANDLE hFile,
LPOVERLAPPED lpOverlapped,
131 LPDWORD lpNumberOfBytesTransferred, DWORD dwMilliseconds,
134 WLog_ERR(TAG,
"Not implemented");
135 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
139 BOOL DeviceIoControl(HANDLE hDevice, DWORD dwIoControlCode, LPVOID lpInBuffer, DWORD nInBufferSize,
140 LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesReturned,
143 WLog_ERR(TAG,
"Not implemented");
144 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
148 HANDLE CreateIoCompletionPort(HANDLE FileHandle, HANDLE ExistingCompletionPort,
149 ULONG_PTR CompletionKey, DWORD NumberOfConcurrentThreads)
151 WLog_ERR(TAG,
"Not implemented");
152 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
156 BOOL GetQueuedCompletionStatus(HANDLE CompletionPort, LPDWORD lpNumberOfBytesTransferred,
158 DWORD dwMilliseconds)
160 WLog_ERR(TAG,
"Not implemented");
161 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
165 BOOL GetQueuedCompletionStatusEx(HANDLE CompletionPort,
LPOVERLAPPED_ENTRY lpCompletionPortEntries,
166 ULONG ulCount, PULONG ulNumEntriesRemoved, DWORD dwMilliseconds,
169 WLog_ERR(TAG,
"Not implemented");
170 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
174 BOOL PostQueuedCompletionStatus(HANDLE CompletionPort, DWORD dwNumberOfBytesTransferred,
177 WLog_ERR(TAG,
"Not implemented");
178 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
182 BOOL CancelIo(HANDLE hFile)
184 WLog_ERR(TAG,
"Not implemented");
185 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
189 BOOL CancelIoEx(HANDLE hFile,
LPOVERLAPPED lpOverlapped)
191 WLog_ERR(TAG,
"Not implemented");
192 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
196 BOOL CancelSynchronousIo(HANDLE hThread)
198 WLog_ERR(TAG,
"Not implemented");
199 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
207 #include <winpr/crt.h>
208 #include <winpr/wlog.h>
212 #define TAG WINPR_TAG("io")
214 BOOL GetOverlappedResult(HANDLE hFile,
LPOVERLAPPED lpOverlapped,
215 LPDWORD lpNumberOfBytesTransferred, BOOL bWait)
217 return GetOverlappedResultEx(hFile, lpOverlapped, lpNumberOfBytesTransferred,
218 bWait ? INFINITE : 0, TRUE);
221 BOOL DeviceIoControl(HANDLE hDevice, DWORD dwIoControlCode, LPVOID lpInBuffer, DWORD nInBufferSize,
222 LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesReturned,
225 WLog_ERR(TAG,
"Not implemented");
226 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
230 HANDLE CreateIoCompletionPort(HANDLE FileHandle, HANDLE ExistingCompletionPort,
231 ULONG_PTR CompletionKey, DWORD NumberOfConcurrentThreads)
233 WLog_ERR(TAG,
"Not implemented");
234 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
238 BOOL GetQueuedCompletionStatus(HANDLE CompletionPort, LPDWORD lpNumberOfBytesTransferred,
240 DWORD dwMilliseconds)
242 WLog_ERR(TAG,
"Not implemented");
243 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
247 BOOL GetQueuedCompletionStatusEx(HANDLE CompletionPort,
LPOVERLAPPED_ENTRY lpCompletionPortEntries,
248 ULONG ulCount, PULONG ulNumEntriesRemoved, DWORD dwMilliseconds,
251 WLog_ERR(TAG,
"Not implemented");
252 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
256 BOOL PostQueuedCompletionStatus(HANDLE CompletionPort, DWORD dwNumberOfBytesTransferred,
259 WLog_ERR(TAG,
"Not implemented");
260 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
264 BOOL CancelIo(HANDLE hFile)
266 return CancelIoEx(hFile, NULL);
269 BOOL CancelSynchronousIo(HANDLE hThread)
271 WLog_ERR(TAG,
"Not implemented");
272 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);