1 /* 2 * COPYRIGHT: See COPYING in the top level directory 3 * PROJECT: ReactOS WinSock 2 API 4 * FILE: dll/win32/ws2_32/src/sputil.c 5 * PURPOSE: Transport Service Provider Utility Functions 6 * PROGRAMMER: Alex Ionescu (alex@relsoft.net) 7 */ 8 9 /* INCLUDES ******************************************************************/ 10 11 #include <ws2_32.h> 12 13 #define NDEBUG 14 #include <debug.h> 15 16 /* FUNCTIONS *****************************************************************/ 17 18 /* 19 * @unimplemented 20 */ 21 INT 22 WSPAPI 23 WPUCompleteOverlappedRequest(IN SOCKET s, 24 IN LPWSAOVERLAPPED lpOverlapped, 25 IN DWORD dwError, 26 IN DWORD cbTransferred, 27 OUT LPINT lpErrno) 28 { 29 UNIMPLEMENTED; 30 return 0; 31 } 32 33 /* 34 * @unimplemented 35 */ 36 BOOL 37 WSPAPI 38 WPUCloseEvent(IN WSAEVENT hEvent, 39 OUT LPINT lpErrno) 40 { 41 UNIMPLEMENTED; 42 return FALSE; 43 } 44 45 /* 46 * @unimplemented 47 */ 48 INT 49 WSPAPI 50 WPUCloseThread(IN LPWSATHREADID lpThreadId, 51 OUT LPINT lpErrno) 52 { 53 UNIMPLEMENTED; 54 return 0; 55 } 56 57 /* 58 * @unimplemented 59 */ 60 WSAEVENT 61 WSPAPI 62 WPUCreateEvent(OUT LPINT lpErrno) 63 { 64 UNIMPLEMENTED; 65 return (WSAEVENT)0; 66 } 67 68 /* 69 * @unimplemented 70 */ 71 INT 72 WSPAPI 73 WPUOpenCurrentThread(OUT LPWSATHREADID lpThreadId, 74 OUT LPINT lpErrno) 75 { 76 UNIMPLEMENTED; 77 return 0; 78 } 79 80 /* 81 * @implemented 82 */ 83 BOOL 84 WSPAPI 85 WPUPostMessage(IN HWND hWnd, 86 IN UINT Msg, 87 IN WPARAM wParam, 88 IN LPARAM lParam) 89 { 90 /* Make sure we have a post routine */ 91 if (!WsSockPostRoutine) WsSockPostRoutine = PostMessage; 92 93 /* Call it */ 94 return WsSockPostRoutine(hWnd, Msg, wParam, lParam); 95 } 96 97 /* 98 * @implemented 99 */ 100 INT 101 WSPAPI 102 WPUQueryBlockingCallback(IN DWORD dwCatalogEntryId, 103 OUT LPBLOCKINGCALLBACK FAR* lplpfnCallback, 104 OUT PDWORD_PTR lpdwContext, 105 OUT LPINT lpErrno) 106 { 107 PWSPROCESS Process; 108 PWSTHREAD Thread; 109 PTCATALOG Catalog; 110 INT ErrorCode; 111 INT Status; 112 LPBLOCKINGCALLBACK Callback = NULL; 113 PTCATALOG_ENTRY Entry; 114 DWORD_PTR Context = 0; 115 DPRINT("WPUQueryBlockingCallback: %lx \n", dwCatalogEntryId); 116 117 /* Enter prolog */ 118 if ((ErrorCode = WsApiProlog(&Process, &Thread)) == ERROR_SUCCESS) 119 { 120 /* Get the callback function */ 121 Callback = Thread->BlockingCallback; 122 123 /* Check if there is one */ 124 if (Callback) 125 { 126 /* Get the catalog */ 127 Catalog = WsProcGetTCatalog(Process); 128 129 /* Find the entry for this ID */ 130 ErrorCode = WsTcGetEntryFromCatalogEntryId(Catalog, 131 dwCatalogEntryId, 132 &Entry); 133 134 /* Check for success */ 135 if (ErrorCode == ERROR_SUCCESS) 136 { 137 /* Get the context */ 138 Context = (DWORD_PTR)Entry->Provider->Service.lpWSPCancelBlockingCall; 139 140 /* Dereference the entry */ 141 WsTcEntryDereference(Entry); 142 } 143 } 144 } 145 146 /* Check error code */ 147 if (ErrorCode == ERROR_SUCCESS) 148 { 149 /* Return success as well */ 150 Status = ERROR_SUCCESS; 151 } 152 else 153 { 154 /* Return expected value and no callback */ 155 Status = SOCKET_ERROR; 156 Callback = NULL; 157 } 158 159 /* Return the settings */ 160 *lpdwContext = Context; 161 *lpErrno = ErrorCode; 162 *lplpfnCallback = Callback; 163 164 /* Return to caller */ 165 return Status; 166 } 167 168 /* 169 * @unimplemented 170 */ 171 INT 172 WSPAPI 173 WPUQueueApc(IN LPWSATHREADID lpThreadId, 174 IN LPWSAUSERAPC lpfnUserApc, 175 IN DWORD_PTR dwContext, 176 OUT LPINT lpErrno) 177 { 178 UNIMPLEMENTED; 179 return 0; 180 } 181 182 /* 183 * @unimplemented 184 */ 185 BOOL 186 WSPAPI 187 WPUResetEvent(IN WSAEVENT hEvent, 188 OUT LPINT lpErrno) 189 { 190 UNIMPLEMENTED; 191 return FALSE; 192 } 193 194 /* 195 * @unimplemented 196 */ 197 BOOL 198 WSPAPI 199 WPUSetEvent(IN WSAEVENT hEvent, 200 OUT LPINT lpErrno) 201 { 202 UNIMPLEMENTED; 203 return FALSE; 204 } 205