1 /* 2 * ws2spi.h 3 * 4 * Winsock 2 Service Provider interface. 5 * 6 * 7 * THIS SOFTWARE IS NOT COPYRIGHTED 8 * 9 * This source code is offered for use in the public domain. You may 10 * use, modify or distribute it freely. 11 * 12 * This code is distributed in the hope that it will be useful but 13 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY 14 * DISCLAIMED. This includes but is not limited to warranties of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 * 17 */ 18 19 #pragma once 20 21 #define _WS2SPI_H 22 23 #ifndef _WINSOCK2API_ 24 #include <winsock2.h> 25 #endif 26 27 #ifdef __cplusplus 28 extern "C" { 29 #endif 30 31 #if !defined(_WIN64) 32 #include <pshpack4.h> 33 #endif 34 35 #define WSPDESCRIPTION_LEN 255 36 37 #define WSS_OPERATION_IN_PROGRESS 0x00000103L 38 39 #define WSPAPI WSAAPI 40 41 typedef struct _WSATHREADID { 42 HANDLE ThreadHandle; 43 DWORD_PTR Reserved; 44 } WSATHREADID, FAR *LPWSATHREADID; 45 46 typedef struct WSPData { 47 WORD wVersion; 48 WORD wHighVersion; 49 WCHAR szDescription[WSPDESCRIPTION_LEN+1]; 50 } WSPDATA, FAR *LPWSPDATA; 51 52 typedef BOOL 53 (CALLBACK FAR *LPBLOCKINGCALLBACK)( 54 DWORD_PTR dwContext); 55 56 typedef 57 _Must_inspect_result_ 58 SOCKET 59 (WSPAPI *LPWSPACCEPT)( 60 _In_ SOCKET s, 61 _Out_writes_bytes_to_opt_(*addrlen, *addrlen) struct sockaddr FAR *addr, 62 _Inout_opt_ LPINT addrlen, 63 _In_opt_ LPCONDITIONPROC lpfnCondition, 64 _In_opt_ DWORD_PTR dwCallbackData, 65 _Out_ LPINT lpErrno); 66 67 typedef VOID 68 (CALLBACK FAR *LPWSAUSERAPC)( 69 DWORD_PTR dwContext); 70 71 typedef INT 72 (WSPAPI *LPWSPADDRESSTOSTRING)( 73 _In_reads_bytes_(dwAddressLength) LPSOCKADDR lpsaAddress, 74 _In_ DWORD dwAddressLength, 75 _In_opt_ LPWSAPROTOCOL_INFOW lpProtocolInfo, 76 _Out_writes_to_(*lpdwAddressStringLength, *lpdwAddressStringLength) LPWSTR lpszAddressString, 77 _Inout_ LPDWORD lpdwAddressStringLength, 78 _Out_ LPINT lpErrno); 79 80 typedef int 81 (WSPAPI *LPWSPASYNCSELECT)( 82 _In_ SOCKET s, 83 _In_ HWND hWnd, 84 _In_ unsigned int wMsg, 85 _In_ long lEvent, 86 _Out_ LPINT lpErrno); 87 88 typedef int 89 (WSPAPI *LPWSPBIND)( 90 _In_ SOCKET s, 91 _In_reads_bytes_(namelen) const struct sockaddr FAR *name, 92 _In_ int namelen, 93 _Out_ LPINT lpErrno); 94 95 typedef int 96 (WSPAPI *LPWSPCANCELBLOCKINGCALL)( 97 _Out_ LPINT lpErrno); 98 99 typedef int 100 (WSPAPI *LPWSPCLEANUP)( 101 _Out_ LPINT lpErrno); 102 103 typedef int 104 (WSPAPI *LPWSPCLOSESOCKET)( 105 _In_ SOCKET s, 106 _Out_ LPINT lpErrno); 107 108 typedef int 109 (WSPAPI *LPWSPCONNECT)( 110 _In_ SOCKET s, 111 _In_reads_bytes_(namelen) const struct sockaddr FAR *name, 112 _In_ int namelen, 113 _In_opt_ LPWSABUF lpCallerData, 114 _Out_opt_ LPWSABUF lpCalleeData, 115 _In_opt_ LPQOS lpSQOS, 116 _In_opt_ LPQOS lpGQOS, 117 _Out_ LPINT lpErrno); 118 119 typedef int 120 (WSPAPI *LPWSPDUPLICATESOCKET)( 121 _In_ SOCKET s, 122 _In_ DWORD dwProcessId, 123 _Out_ LPWSAPROTOCOL_INFOW lpProtocolInfo, 124 _Out_ LPINT lpErrno); 125 126 typedef int 127 (WSPAPI *LPWSPENUMNETWORKEVENTS)( 128 _In_ SOCKET s, 129 _In_ WSAEVENT hEventObject, 130 _Out_ LPWSANETWORKEVENTS lpNetworkEvents, 131 _Out_ LPINT lpErrno); 132 133 typedef int 134 (WSPAPI *LPWSPEVENTSELECT)( 135 _In_ SOCKET s, 136 _In_opt_ WSAEVENT hEventObject, 137 _In_ long lNetworkEvents, 138 _Out_ LPINT lpErrno); 139 140 typedef BOOL 141 (WSPAPI *LPWSPGETOVERLAPPEDRESULT)( 142 _In_ SOCKET s, 143 _In_ LPWSAOVERLAPPED lpOverlapped, 144 _Out_ LPDWORD lpcbTransfer, 145 _In_ BOOL fWait, 146 _Out_ LPDWORD lpdwFlags, 147 _Out_ LPINT lpErrno); 148 149 typedef int 150 (WSPAPI *LPWSPGETPEERNAME)( 151 _In_ SOCKET s, 152 _Out_writes_bytes_to_(*namelen, *namelen) struct sockaddr FAR *name, 153 _Inout_ LPINT namelen, 154 _Out_ LPINT lpErrno); 155 156 typedef int 157 (WSPAPI *LPWSPGETSOCKNAME)( 158 _In_ SOCKET s, 159 _Out_writes_bytes_to_(*namelen, *namelen) struct sockaddr FAR *name, 160 _Inout_ LPINT namelen, 161 _Out_ LPINT lpErrno); 162 163 typedef int 164 (WSPAPI *LPWSPGETSOCKOPT)( 165 _In_ SOCKET s, 166 _In_ int level, 167 _In_ int optname, 168 _Out_writes_bytes_(*optlen) char FAR *optval, 169 _Inout_ LPINT optlen, 170 _Out_ LPINT lpErrno); 171 172 typedef BOOL 173 (WSPAPI *LPWSPGETQOSBYNAME)( 174 _In_ SOCKET s, 175 _In_ LPWSABUF lpQOSName, 176 _Out_ LPQOS lpQOS, 177 _Out_ LPINT lpErrno); 178 179 typedef int 180 (WSPAPI *LPWSPIOCTL)( 181 _In_ SOCKET s, 182 _In_ DWORD dwIoControlCode, 183 _In_reads_bytes_opt_(cbInBuffer) LPVOID lpvInBuffer, 184 _In_ DWORD cbInBuffer, 185 _Out_writes_bytes_to_opt_(cbOutBuffer, *lpcbBytesReturned) LPVOID lpvOutBuffer, 186 _In_ DWORD cbOutBuffer, 187 _Out_ LPDWORD lpcbBytesReturned, 188 _Inout_opt_ LPWSAOVERLAPPED lpOverlapped, 189 _In_opt_ LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine, 190 _In_opt_ LPWSATHREADID lpThreadId, 191 _Out_ LPINT lpErrno); 192 193 typedef SOCKET 194 (WSPAPI *LPWSPJOINLEAF)( 195 _In_ SOCKET s, 196 _In_reads_bytes_(namelen) const struct sockaddr FAR *name, 197 _In_ int namelen, 198 _In_opt_ LPWSABUF lpCallerData, 199 _Out_opt_ LPWSABUF lpCalleeData, 200 _In_opt_ LPQOS lpSQOS, 201 _In_opt_ LPQOS lpGQOS, 202 _In_ DWORD dwFlags, 203 _Out_ LPINT lpErrno); 204 205 typedef int 206 (WSPAPI *LPWSPLISTEN)( 207 _In_ SOCKET s, 208 _In_ int backlog, 209 _Out_ LPINT lpErrno); 210 211 typedef int 212 (WSPAPI *LPWSPRECV)( 213 _In_ SOCKET s, 214 _In_reads_(dwBufferCount) LPWSABUF lpBuffers, 215 _In_ DWORD dwBufferCount, 216 _Out_opt_ LPDWORD lpNumberOfBytesRecvd, 217 _Inout_ LPDWORD lpFlags, 218 _Inout_opt_ LPWSAOVERLAPPED lpOverlapped, 219 _In_opt_ LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine, 220 _In_opt_ LPWSATHREADID lpThreadId, 221 _In_ LPINT lpErrno); 222 223 typedef int 224 (WSPAPI *LPWSPRECVDISCONNECT)( 225 _In_ SOCKET s, 226 _In_opt_ LPWSABUF lpInboundDisconnectData, 227 _Out_ LPINT lpErrno); 228 229 typedef int 230 (WSPAPI *LPWSPRECVFROM)( 231 _In_ SOCKET s, 232 _In_reads_(dwBufferCount) LPWSABUF lpBuffers, 233 _In_ DWORD dwBufferCount, 234 _Out_opt_ LPDWORD lpNumberOfBytesRecvd, 235 _Inout_ LPDWORD lpFlags, 236 _Out_writes_bytes_to_opt_(*lpFromlen, *lpFromlen) struct sockaddr FAR *lpFrom, 237 _Inout_opt_ LPINT lpFromlen, 238 _Inout_opt_ LPWSAOVERLAPPED lpOverlapped, 239 _In_opt_ LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine, 240 _In_opt_ LPWSATHREADID lpThreadId, 241 _Out_ LPINT lpErrno); 242 243 typedef int 244 (WSPAPI *LPWSPSELECT)( 245 _In_ int nfds, 246 _Inout_opt_ fd_set FAR *readfds, 247 _Inout_opt_ fd_set FAR *writefds, 248 _Inout_opt_ fd_set FAR *exceptfds, 249 _In_opt_ const struct timeval FAR *timeout, 250 _Out_ LPINT lpErrno); 251 252 typedef int 253 (WSPAPI *LPWSPSEND)( 254 _In_ SOCKET s, 255 _In_reads_(dwBufferCount) LPWSABUF lpBuffers, 256 _In_ DWORD dwBufferCount, 257 _Out_opt_ LPDWORD lpNumberOfBytesSent, 258 _In_ DWORD dwFlags, 259 _Inout_opt_ LPWSAOVERLAPPED lpOverlapped, 260 _In_opt_ LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine, 261 _In_opt_ LPWSATHREADID lpThreadId, 262 _Out_ LPINT lpErrno); 263 264 typedef int 265 (WSPAPI *LPWSPSENDDISCONNECT)( 266 _In_ SOCKET s, 267 _In_opt_ LPWSABUF lpOutboundDisconnectData, 268 _Out_ LPINT lpErrno); 269 270 typedef int 271 (WSPAPI *LPWSPSENDTO)( 272 _In_ SOCKET s, 273 _In_reads_(dwBufferCount) LPWSABUF lpBuffers, 274 _In_ DWORD dwBufferCount, 275 _Out_opt_ LPDWORD lpNumberOfBytesSent, 276 _In_ DWORD dwFlags, 277 _In_reads_bytes_opt_(iTolen) const struct sockaddr FAR *lpTo, 278 _In_ int iTolen, 279 _Inout_opt_ LPWSAOVERLAPPED lpOverlapped, 280 _In_opt_ LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine, 281 _In_opt_ LPWSATHREADID lpThreadId, 282 _Out_ LPINT lpErrno); 283 284 typedef int 285 (WSPAPI *LPWSPSETSOCKOPT)( 286 _In_ SOCKET s, 287 _In_ int level, 288 _In_ int optname, 289 _In_reads_bytes_opt_(optlen) const char FAR *optval, 290 _In_ int optlen, 291 _Out_ LPINT lpErrno); 292 293 typedef int 294 (WSPAPI *LPWSPSHUTDOWN)( 295 _In_ SOCKET s, 296 _In_ int how, 297 _Out_ LPINT lpErrno); 298 299 typedef 300 _Must_inspect_result_ 301 SOCKET 302 (WSPAPI *LPWSPSOCKET)( 303 _In_ int af, 304 _In_ int type, 305 _In_ int protocol, 306 _In_opt_ LPWSAPROTOCOL_INFOW lpProtocolInfo, 307 _In_ GROUP g, 308 _In_ DWORD dwFlags, 309 _Out_ LPINT lpErrno); 310 311 typedef INT 312 (WSPAPI *LPWSPSTRINGTOADDRESS)( 313 _In_ LPWSTR AddressString, 314 _In_ INT AddressFamily, 315 _In_opt_ LPWSAPROTOCOL_INFOW lpProtocolInfo, 316 _Out_writes_bytes_to_(*lpAddressLength, *lpAddressLength) LPSOCKADDR lpAddress, 317 _Inout_ LPINT lpAddressLength, 318 _Out_ LPINT lpErrno); 319 320 typedef BOOL 321 (WSPAPI *LPWPUCLOSEEVENT)( 322 _In_ WSAEVENT hEvent, 323 _Out_ LPINT lpErrno); 324 325 typedef int 326 (WSPAPI *LPWPUCLOSESOCKETHANDLE)( 327 _In_ SOCKET s, 328 _Out_ LPINT lpErrno); 329 330 typedef WSAEVENT 331 (WSPAPI *LPWPUCREATEEVENT)( 332 _Out_ LPINT lpErrno); 333 334 typedef 335 _Must_inspect_result_ 336 SOCKET 337 (WSPAPI *LPWPUCREATESOCKETHANDLE)( 338 _In_ DWORD dwCatalogEntryId, 339 _In_ DWORD_PTR dwContext, 340 _Out_ LPINT lpErrno); 341 342 typedef int 343 (WSPAPI *LPWPUFDISSET)( 344 _In_ SOCKET s, 345 _In_ fd_set FAR *fdset); 346 347 typedef int 348 (WSPAPI *LPWPUGETPROVIDERPATH)( 349 _In_ LPGUID lpProviderId, 350 _Out_writes_(*lpProviderDllPathLen) WCHAR FAR *lpszProviderDllPath, 351 _Inout_ LPINT lpProviderDllPathLen, 352 _Out_ LPINT lpErrno); 353 354 typedef SOCKET 355 (WSPAPI *LPWPUMODIFYIFSHANDLE)( 356 _In_ DWORD dwCatalogEntryId, 357 _In_ SOCKET ProposedHandle, 358 _Out_ LPINT lpErrno); 359 360 typedef BOOL 361 (WSPAPI *LPWPUPOSTMESSAGE)( 362 _In_ HWND hWnd, 363 _In_ UINT Msg, 364 _In_ WPARAM wParam, 365 _In_ LPARAM lParam); 366 367 typedef int 368 (WSPAPI *LPWPUQUERYBLOCKINGCALLBACK)( 369 _In_ DWORD dwCatalogEntryId, 370 _Out_ LPBLOCKINGCALLBACK FAR *lplpfnCallback, 371 _Out_ PDWORD_PTR lpdwContext, 372 _Out_ LPINT lpErrno); 373 374 typedef int 375 (WSPAPI *LPWPUQUERYSOCKETHANDLECONTEXT)( 376 _In_ SOCKET s, 377 _Out_ PDWORD_PTR lpContext, 378 _Out_ LPINT lpErrno); 379 380 typedef int 381 (WSPAPI *LPWPUQUEUEAPC)( 382 _In_ LPWSATHREADID lpThreadId, 383 _In_ LPWSAUSERAPC lpfnUserApc, 384 _In_ DWORD_PTR dwContext, 385 _Out_ LPINT lpErrno); 386 387 typedef BOOL 388 (WSPAPI *LPWPURESETEVENT)( 389 _In_ WSAEVENT hEvent, 390 _Out_ LPINT lpErrno); 391 392 typedef BOOL 393 (WSPAPI *LPWPUSETEVENT)( 394 _In_ WSAEVENT hEvent, 395 _Out_ LPINT lpErrno); 396 397 typedef int 398 (WSPAPI *LPWPUOPENCURRENTTHREAD)( 399 _Out_ LPWSATHREADID lpThreadId, 400 _Out_ LPINT lpErrno); 401 402 typedef int 403 (WSPAPI *LPWPUCLOSETHREAD)( 404 _In_ LPWSATHREADID lpThreadId, 405 _Out_ LPINT lpErrno); 406 407 typedef int 408 (WSPAPI *LPWPUCOMPLETEOVERLAPPEDREQUEST)( 409 _In_ SOCKET s, 410 _Inout_ LPWSAOVERLAPPED lpOverlapped, 411 _In_ DWORD dwError, 412 _In_ DWORD cbTransferred, 413 _Out_ LPINT lpErrno); 414 415 typedef int 416 (WSPAPI *LPWSCENUMPROTOCOLS)( 417 _In_opt_ LPINT lpiProtocols, 418 _Out_writes_bytes_to_opt_(*lpdwBufferLength, *lpdwBufferlength) LPWSAPROTOCOL_INFOW lpProtocolBuffer, 419 _Inout_ LPDWORD lpdwBufferLength, 420 _Out_ LPINT lpErrno); 421 422 typedef int 423 (WSPAPI *LPWSCDEINSTALLPROVIDER)( 424 _In_ LPGUID lpProviderId, 425 _Out_ LPINT lpErrno); 426 427 typedef int 428 (WSPAPI *LPWSCINSTALLPROVIDER)( 429 _In_ LPGUID lpProviderId, 430 _In_z_ const WCHAR FAR *lpszProviderDllPath, 431 _In_reads_(dwNumberOfEntries) const LPWSAPROTOCOL_INFOW lpProtocolInfoList, 432 _In_ DWORD dwNumberOfEntries, 433 _Out_ LPINT lpErrno); 434 435 typedef int 436 (WSPAPI *LPWSCGETPROVIDERPATH)( 437 _In_ LPGUID lpProviderId, 438 _Out_writes_to_(*lpProviderDllPathLen, *lpProviderDllPathLen) WCHAR FAR *lpszProviderDllPath, 439 _Inout_ LPINT lpProviderDllPathLen, 440 _Out_ LPINT lpErrno); 441 442 typedef INT 443 (WSPAPI *LPWSCINSTALLNAMESPACE)( 444 _In_ LPWSTR lpszIdentifier, 445 _In_ LPWSTR lpszPathName, 446 _In_ DWORD dwNameSpace, 447 _In_ DWORD dwVersion, 448 _In_ LPGUID lpProviderId); 449 450 typedef INT 451 (WSPAPI *LPWSCUNINSTALLNAMESPACE)( 452 _In_ LPGUID lpProviderId); 453 454 typedef INT 455 (WSPAPI *LPWSCENABLENSPROVIDER)( 456 _In_ LPGUID lpProviderId, 457 _In_ BOOL fEnable); 458 459 /* Service provider procedure table */ 460 typedef struct _WSPPROC_TABLE { 461 LPWSPACCEPT lpWSPAccept; 462 LPWSPADDRESSTOSTRING lpWSPAddressToString; 463 LPWSPASYNCSELECT lpWSPAsyncSelect; 464 LPWSPBIND lpWSPBind; 465 LPWSPCANCELBLOCKINGCALL lpWSPCancelBlockingCall; 466 LPWSPCLEANUP lpWSPCleanup; 467 LPWSPCLOSESOCKET lpWSPCloseSocket; 468 LPWSPCONNECT lpWSPConnect; 469 LPWSPDUPLICATESOCKET lpWSPDuplicateSocket; 470 LPWSPENUMNETWORKEVENTS lpWSPEnumNetworkEvents; 471 LPWSPEVENTSELECT lpWSPEventSelect; 472 LPWSPGETOVERLAPPEDRESULT lpWSPGetOverlappedResult; 473 LPWSPGETPEERNAME lpWSPGetPeerName; 474 LPWSPGETSOCKNAME lpWSPGetSockName; 475 LPWSPGETSOCKOPT lpWSPGetSockOpt; 476 LPWSPGETQOSBYNAME lpWSPGetQOSByName; 477 LPWSPIOCTL lpWSPIoctl; 478 LPWSPJOINLEAF lpWSPJoinLeaf; 479 LPWSPLISTEN lpWSPListen; 480 LPWSPRECV lpWSPRecv; 481 LPWSPRECVDISCONNECT lpWSPRecvDisconnect; 482 LPWSPRECVFROM lpWSPRecvFrom; 483 LPWSPSELECT lpWSPSelect; 484 LPWSPSEND lpWSPSend; 485 LPWSPSENDDISCONNECT lpWSPSendDisconnect; 486 LPWSPSENDTO lpWSPSendTo; 487 LPWSPSETSOCKOPT lpWSPSetSockOpt; 488 LPWSPSHUTDOWN lpWSPShutdown; 489 LPWSPSOCKET lpWSPSocket; 490 LPWSPSTRINGTOADDRESS lpWSPStringToAddress; 491 } WSPPROC_TABLE, FAR* LPWSPPROC_TABLE; 492 493 typedef INT 494 (WSAAPI *LPNSPCLEANUP)( 495 _In_ LPGUID lpProviderId); 496 497 typedef INT 498 (WSAAPI *LPNSPLOOKUPSERVICEBEGIN)( 499 _In_ LPGUID lpProviderId, 500 _In_ LPWSAQUERYSETW lpqsRestrictions, 501 _In_ LPWSASERVICECLASSINFOW lpServiceClassInfo, 502 _In_ DWORD dwControlFlags, 503 _Out_ LPHANDLE lphLookup); 504 505 typedef INT 506 (WSAAPI *LPNSPLOOKUPSERVICENEXT)( 507 _In_ HANDLE hLookup, 508 _In_ DWORD dwControlFlags, 509 _Inout_ LPDWORD lpdwBufferLength, 510 _Out_writes_bytes_to_(*lpdwBufferLength, *lpdwBufferLength) LPWSAQUERYSETW lpqsResults); 511 512 #if(_WIN32_WINNT >= 0x0501) 513 typedef INT 514 (WSAAPI *LPNSPIOCTL)( 515 _In_ HANDLE hLookup, 516 _In_ DWORD dwControlCode, 517 _In_reads_bytes_(cbInBuffer) LPVOID lpvInBuffer, 518 _In_ DWORD cbInBuffer, 519 _Out_writes_bytes_to_(cbOutBuffer, *lpcbBytesReturned) LPVOID lpvOutBuffer, 520 _In_ DWORD cbOutBuffer, 521 _Out_ LPDWORD lpcbBytesReturned, 522 _In_opt_ LPWSACOMPLETION lpCompletion, 523 _In_ LPWSATHREADID lpThreadId); 524 #endif 525 526 typedef INT 527 (WSAAPI *LPNSPLOOKUPSERVICEEND)( 528 _In_ HANDLE hLookup); 529 530 typedef INT 531 (WSAAPI *LPNSPSETSERVICE)( 532 _In_ LPGUID lpProviderId, 533 _In_ LPWSASERVICECLASSINFOW lpServiceClassInfo, 534 _In_ LPWSAQUERYSETW lpqsRegInfo, 535 _In_ WSAESETSERVICEOP essOperation, 536 _In_ DWORD dwControlFlags); 537 538 typedef INT 539 (WSAAPI *LPNSPINSTALLSERVICECLASS)( 540 _In_ LPGUID lpProviderId, 541 _In_ LPWSASERVICECLASSINFOW lpServiceClassInfo); 542 543 typedef INT 544 (WSAAPI *LPNSPREMOVESERVICECLASS)( 545 _In_ LPGUID lpProviderId, 546 _In_ LPGUID lpServiceClassId); 547 548 typedef INT 549 (WSAAPI *LPNSPGETSERVICECLASSINFO)( 550 _In_ LPGUID lpProviderId, 551 _In_ LPDWORD lpdwBufSize, 552 _In_ LPWSASERVICECLASSINFOW lpServiceClassInfo); 553 554 typedef 555 _Must_inspect_result_ 556 INT 557 (WSAAPI *LPNSPV2STARTUP)( 558 _In_ LPGUID lpProviderId, 559 _Outptr_ LPVOID *ppvClientSessionArg); 560 561 typedef INT 562 (WSAAPI *LPNSPV2CLEANUP)( 563 _In_ LPGUID lpProviderId, 564 _In_ LPVOID pvClientSessionArg); 565 566 typedef INT 567 (WSAAPI *LPNSPV2LOOKUPSERVICEBEGIN)( 568 _In_ LPGUID lpProviderId, 569 _In_ LPWSAQUERYSET2W lpqsRestrictions, 570 _In_ DWORD dwControlFlags, 571 _In_ LPVOID lpvClientSessionArg, 572 _Out_ LPHANDLE lphLookup); 573 574 typedef VOID 575 (WSAAPI *LPNSPV2LOOKUPSERVICENEXTEX)( 576 _In_ HANDLE hAsyncCall, 577 _In_ HANDLE hLookup, 578 _In_ DWORD dwControlFlags, 579 _In_ LPDWORD lpdwBufferLength, 580 _Out_ LPWSAQUERYSET2W lpqsResults); 581 582 typedef INT 583 (WSAAPI *LPNSPV2LOOKUPSERVICEEND)( 584 _In_ HANDLE hLookup); 585 586 typedef VOID 587 (WSAAPI *LPNSPV2SETSERVICEEX)( 588 _In_ HANDLE hAsyncCall, 589 _In_ LPGUID lpProviderId, 590 _In_ LPWSAQUERYSET2W lpqsRegInfo, 591 _In_ WSAESETSERVICEOP essOperation, 592 _In_ DWORD dwControlFlags, 593 _In_ LPVOID lpvClientSessionArg); 594 595 typedef VOID 596 (WSAAPI *LPNSPV2CLIENTSESSIONRUNDOWN)( 597 _In_ LPGUID lpProviderId, 598 _In_ LPVOID pvClientSessionArg); 599 600 /* Service Provider upcall table */ 601 typedef struct _WSPUPCALLTABLE { 602 LPWPUCLOSEEVENT lpWPUCloseEvent; 603 LPWPUCLOSESOCKETHANDLE lpWPUCloseSocketHandle; 604 LPWPUCREATEEVENT lpWPUCreateEvent; 605 LPWPUCREATESOCKETHANDLE lpWPUCreateSocketHandle; 606 LPWPUFDISSET lpWPUFDIsSet; 607 LPWPUGETPROVIDERPATH lpWPUGetProviderPath; 608 LPWPUMODIFYIFSHANDLE lpWPUModifyIFSHandle; 609 LPWPUPOSTMESSAGE lpWPUPostMessage; 610 LPWPUQUERYBLOCKINGCALLBACK lpWPUQueryBlockingCallback; 611 LPWPUQUERYSOCKETHANDLECONTEXT lpWPUQuerySocketHandleContext; 612 LPWPUQUEUEAPC lpWPUQueueApc; 613 LPWPURESETEVENT lpWPUResetEvent; 614 LPWPUSETEVENT lpWPUSetEvent; 615 LPWPUOPENCURRENTTHREAD lpWPUOpenCurrentThread; 616 LPWPUCLOSETHREAD lpWPUCloseThread; 617 } WSPUPCALLTABLE, FAR* LPWSPUPCALLTABLE; 618 619 typedef 620 _Must_inspect_result_ 621 int 622 (WSPAPI *LPWSPSTARTUP)( 623 _In_ WORD wVersionRequested, 624 _In_ LPWSPDATA lpWSPData, 625 _In_ LPWSAPROTOCOL_INFOW lpProtocolInfo, 626 _In_ WSPUPCALLTABLE UpcallTable, 627 _Out_ LPWSPPROC_TABLE lpProcTable); 628 629 #if (_WIN32_WINNT >= 0x0600) 630 631 #define LSP_SYSTEM 0x80000000 632 #define LSP_INSPECTOR 0x00000001 633 #define LSP_REDIRECTOR 0x00000002 634 #define LSP_PROXY 0x00000004 635 #define LSP_FIREWALL 0x00000008 636 #define LSP_INBOUND_MODIFY 0x00000010 637 #define LSP_OUTBOUND_MODIFY 0x00000020 638 #define LSP_CRYPTO_COMPRESS 0x00000040 639 #define LSP_LOCAL_CACHE 0x00000080 640 641 typedef enum _WSC_PROVIDER_INFO_TYPE { 642 ProviderInfoLspCategories, 643 ProviderInfoAudit 644 } WSC_PROVIDER_INFO_TYPE ; 645 646 typedef struct _WSC_PROVIDER_AUDIT_INFO { 647 DWORD RecordSize; 648 PVOID Reserved; 649 } WSC_PROVIDER_AUDIT_INFO; 650 651 #endif /* (_WIN32_WINNT >= 0x0600) */ 652 653 typedef struct _NSP_ROUTINE { 654 DWORD cbSize; 655 DWORD dwMajorVersion; 656 DWORD dwMinorVersion; 657 LPNSPCLEANUP NSPCleanup; 658 LPNSPLOOKUPSERVICEBEGIN NSPLookupServiceBegin; 659 LPNSPLOOKUPSERVICENEXT NSPLookupServiceNext; 660 LPNSPLOOKUPSERVICEEND NSPLookupServiceEnd; 661 LPNSPSETSERVICE NSPSetService; 662 LPNSPINSTALLSERVICECLASS NSPInstallServiceClass; 663 LPNSPREMOVESERVICECLASS NSPRemoveServiceClass; 664 LPNSPGETSERVICECLASSINFO NSPGetServiceClassInfo; 665 LPNSPIOCTL NSPIoctl; 666 } NSP_ROUTINE, *PNSP_ROUTINE, FAR* LPNSP_ROUTINE; 667 668 typedef 669 _Must_inspect_result_ 670 INT 671 (WSAAPI *LPNSPSTARTUP)( 672 _In_ LPGUID lpProviderId, 673 _Inout_ LPNSP_ROUTINE lpnspRoutines); 674 675 typedef struct _NSPV2_ROUTINE { 676 DWORD cbSize; 677 DWORD dwMajorVersion; 678 DWORD dwMinorVersion; 679 LPNSPV2STARTUP NSPv2Startup; 680 LPNSPV2CLEANUP NSPv2Cleanup; 681 LPNSPV2LOOKUPSERVICEBEGIN NSPv2LookupServiceBegin; 682 LPNSPV2LOOKUPSERVICENEXTEX NSPv2LookupServiceNextEx; 683 LPNSPV2LOOKUPSERVICEEND NSPv2LookupServiceEnd; 684 LPNSPV2SETSERVICEEX NSPv2SetServiceEx; 685 LPNSPV2CLIENTSESSIONRUNDOWN NSPv2ClientSessionRundown; 686 } NSPV2_ROUTINE, *PNSPV2_ROUTINE, *LPNSPV2_ROUTINE; 687 typedef const NSPV2_ROUTINE *PCNSPV2_ROUTINE, *LPCNSPV2_ROUTINE; 688 689 _Must_inspect_result_ 690 int 691 WSPAPI 692 WSPStartup( 693 _In_ WORD wVersionRequested, 694 _In_ LPWSPDATA lpWSPData, 695 _In_ LPWSAPROTOCOL_INFOW lpProtocolInfo, 696 _In_ WSPUPCALLTABLE UpcallTable, 697 _Out_ LPWSPPROC_TABLE lpProcTable); 698 699 int 700 WSPAPI 701 WSCEnumProtocols( 702 _In_opt_ LPINT lpiProtocols, 703 _Out_writes_bytes_to_opt_(*lpdwBufferLength, *lpdwBufferLength) LPWSAPROTOCOL_INFOW lpProtocolBuffer, 704 _Inout_ LPDWORD lpdwBufferLength, 705 _Out_ LPINT lpErrno); 706 707 #if (_WIN32_WINNT >= 0x0501) 708 709 int 710 WSPAPI 711 WPUOpenCurrentThread( 712 _Out_ LPWSATHREADID lpThreadId, 713 _Out_ LPINT lpErrno); 714 715 int 716 WSPAPI 717 WPUCloseThread( 718 _In_ LPWSATHREADID lpThreadId, 719 _Out_ LPINT lpErrno); 720 721 #define WSCEnumNameSpaceProviders WSAEnumNameSpaceProvidersW 722 #define LPFN_WSCENUMNAMESPACEPROVIDERS LPFN_WSAENUMNAMESPACEPROVIDERSW 723 724 int 725 WSPAPI 726 WSCUpdateProvider( 727 _In_ LPGUID lpProviderId, 728 _In_z_ const WCHAR FAR *lpszProviderDllPath, 729 _In_reads_(dwNumberOfEntries) const LPWSAPROTOCOL_INFOW lpProtocolInfoList, 730 _In_ DWORD dwNumberOfEntries, 731 _Out_ LPINT lpErrno); 732 733 typedef int 734 (WSPAPI *LPWSCUPDATEPROVIDER)( 735 _In_ LPGUID lpProviderId, 736 _In_z_ const WCHAR FAR *lpszProviderDllPath, 737 _In_reads_(dwNumberOfEntries) const LPWSAPROTOCOL_INFOW lpProtocolInfoList, 738 _In_ DWORD dwNumberOfEntries, 739 _Out_ LPINT lpErrno); 740 741 #if defined(_WIN64) 742 743 int 744 WSPAPI 745 WSCEnumProtocols32( 746 _In_opt_ LPINT lpiProtocols, 747 _Out_writes_bytes_(*lpdwBufferLength) LPWSAPROTOCOL_INFOW lpProtocolBuffer, 748 _Inout_ LPDWORD lpdwBufferLength, 749 _Out_ LPINT lpErrno); 750 751 int 752 WSPAPI 753 WSCDeinstallProvider32( 754 _In_ LPGUID lpProviderId, 755 _Out_ LPINT lpErrno); 756 757 int 758 WSPAPI 759 WSCInstallProvider64_32( 760 _In_ LPGUID lpProviderId, 761 _In_z_ const WCHAR FAR *lpszProviderDllPath, 762 _In_reads_(dwNumberOfEntries) const LPWSAPROTOCOL_INFOW lpProtocolInfoList, 763 _In_ DWORD dwNumberOfEntries, 764 _Out_ LPINT lpErrno); 765 766 _Success_(return == 0) 767 int 768 WSPAPI 769 WSCGetProviderPath32( 770 _In_ LPGUID lpProviderId, 771 _Out_writes_to_(*lpProviderDllPathLen, *lpProviderDllPathLen) WCHAR FAR *lpszProviderDllPath, 772 _Inout_ LPINT lpProviderDllPathLen, 773 _Out_ LPINT lpErrno); 774 775 int 776 WSPAPI 777 WSCUpdateProvider32( 778 _In_ LPGUID lpProviderId, 779 _In_z_ const WCHAR FAR *lpszProviderDllPath, 780 _In_reads_(dwNumberOfEntries) const LPWSAPROTOCOL_INFOW lpProtocolInfoList, 781 _In_ DWORD dwNumberOfEntries, 782 _Out_ LPINT lpErrno); 783 784 INT 785 WSAAPI 786 WSCEnumNameSpaceProviders32( 787 _Inout_ LPDWORD lpdwBufferLength, 788 _Out_writes_bytes_(*lpdwBufferLength) LPWSANAMESPACE_INFOW lpnspBuffer); 789 790 INT 791 WSPAPI 792 WSCInstallNameSpace32( 793 _In_ LPWSTR lpszIdentifier, 794 _In_ LPWSTR lpszPathName, 795 _In_ DWORD dwNameSpace, 796 _In_ DWORD dwVersion, 797 _In_ LPGUID lpProviderId); 798 799 INT 800 WSPAPI 801 WSCUnInstallNameSpace32( 802 _In_ LPGUID lpProviderId); 803 804 INT 805 WSPAPI 806 WSCEnableNSProvider32( 807 _In_ LPGUID lpProviderId, 808 _In_ BOOL fEnable); 809 810 #endif /* defined(_WIN64) */ 811 812 #endif /* defined(_WIN32_WINNT >= 0x0501) */ 813 814 int 815 WSPAPI 816 WSCDeinstallProvider( 817 _In_ LPGUID lpProviderId, 818 _Out_ LPINT lpErrno); 819 820 int 821 WSPAPI 822 WSCInstallProvider( 823 _In_ LPGUID lpProviderId, 824 _In_z_ const WCHAR FAR *lpszProviderDllPath, 825 _In_reads_(dwNumberOfEntries) const LPWSAPROTOCOL_INFOW lpProtocolInfoList, 826 _In_ DWORD dwNumberOfEntries, 827 _Out_ LPINT lpErrno); 828 829 int 830 WSPAPI 831 WSCGetProviderPath( 832 _In_ LPGUID lpProviderId, 833 _Out_writes_to_(*lpProviderDllPathLen, *lpProviderDllPathLen) WCHAR FAR *lpszProviderDllPath, 834 _Inout_ LPINT lpProviderDllPathLen, 835 _Out_ LPINT lpErrno); 836 837 #if (_WIN32_WINNT < 0x0600) 838 839 int 840 WSPAPI 841 WSCInstallQOSTemplate( 842 _In_ const LPGUID Guid, 843 _In_ LPWSABUF QosName, 844 _In_ LPQOS Qos); 845 846 typedef int 847 (WSPAPI *LPWSCINSTALLQOSTEMPLATE)( 848 _In_ const LPGUID Guid, 849 _In_ LPWSABUF QosName, 850 _In_ LPQOS Qos); 851 852 int 853 WSPAPI 854 WSCRemoveQOSTemplate( 855 _In_ const LPGUID Guid, 856 _In_ LPWSABUF QosName); 857 858 typedef int 859 (WSPAPI *LPWSCREMOVEQOSTEMPLATE)( 860 _In_ const LPGUID Guid, 861 _In_ LPWSABUF QosName); 862 863 #endif /* (_WIN32_WINNT < 0x0600) */ 864 865 #if(_WIN32_WINNT >= 0x0600) 866 867 int 868 WSPAPI 869 WSCSetProviderInfo( 870 _In_ LPGUID lpProviderId, 871 _In_ WSC_PROVIDER_INFO_TYPE InfoType, 872 _In_reads_bytes_(InfoSize) PBYTE Info, 873 _In_ size_t InfoSize, 874 _In_ DWORD Flags, 875 _Out_ LPINT lpErrno); 876 877 int 878 WSPAPI 879 WSCGetProviderInfo( 880 _In_ LPGUID lpProviderId, 881 _In_ WSC_PROVIDER_INFO_TYPE InfoType, 882 _Out_writes_bytes_to_(*InfoSize, *InfoSize) PBYTE Info, 883 _Inout_ size_t *InfoSize, 884 _In_ DWORD Flags, 885 _Out_ LPINT lpErrno); 886 887 int 888 WSPAPI 889 WSCSetApplicationCategory( 890 _In_reads_(PathLength) LPCWSTR Path, 891 _In_ DWORD PathLength, 892 _In_reads_opt_(ExtraLength) LPCWSTR Extra, 893 _In_ DWORD ExtraLength, 894 _In_ DWORD PermittedLspCategories, 895 _Out_opt_ DWORD *pPrevPermLspCat, 896 _Out_ LPINT lpErrno); 897 898 int 899 WSPAPI 900 WSCGetApplicationCategory( 901 _In_reads_(PathLength) LPCWSTR Path, 902 _In_ DWORD PathLength, 903 _In_reads_opt_(ExtraLength) LPCWSTR Extra, 904 _In_ DWORD ExtraLength, 905 _Out_ DWORD *pPermittedLspCategories, 906 _Out_ LPINT lpErrno); 907 908 #define WSCEnumNameSpaceProvidersEx WSAEnumNameSpaceProvidersExW 909 #define LPFN_WSCENUMNAMESPACEPROVIDERSEX LPFN_WSAENUMNAMESPACEPROVIDERSEXW 910 911 INT 912 WSPAPI 913 WSCInstallNameSpaceEx( 914 _In_ LPWSTR lpszIdentifier, 915 _In_ LPWSTR lpszPathName, 916 _In_ DWORD dwNameSpace, 917 _In_ DWORD dwVersion, 918 _In_ LPGUID lpProviderId, 919 _In_ LPBLOB lpProviderSpecific); 920 921 INT 922 WSAAPI 923 WSAAdvertiseProvider( 924 _In_ const GUID *puuidProviderId, 925 _In_ const LPCNSPV2_ROUTINE pNSPv2Routine); 926 927 INT 928 WSAAPI 929 WSAUnadvertiseProvider( 930 _In_ const GUID *puuidProviderId); 931 932 INT 933 WSAAPI 934 WSAProviderCompleteAsyncCall( 935 _In_ HANDLE hAsyncCall, 936 _In_ INT iRetCode); 937 938 #if defined(_WIN64) 939 940 int 941 WSPAPI 942 WSCSetProviderInfo32( 943 _In_ LPGUID lpProviderId, 944 _In_ WSC_PROVIDER_INFO_TYPE InfoType, 945 _In_reads_bytes_(InfoSize) PBYTE Info, 946 _In_ size_t InfoSize, 947 _In_ DWORD Flags, 948 _Out_ LPINT lpErrno); 949 950 int 951 WSPAPI 952 WSCGetProviderInfo32( 953 _In_ LPGUID lpProviderId, 954 _In_ WSC_PROVIDER_INFO_TYPE InfoType, 955 _Out_writes_bytes_to_(*InfoSize, *InfoSize) PBYTE Info, 956 _Inout_ size_t *InfoSize, 957 _In_ DWORD Flags, 958 _Out_ LPINT lpErrno); 959 960 INT 961 WSAAPI 962 WSCEnumNameSpaceProvidersEx32( 963 _Inout_ LPDWORD lpdwBufferLength, 964 _Out_writes_bytes_(*lpdwBufferLength) LPWSANAMESPACE_INFOEXW lpnspBuffer); 965 966 INT 967 WSPAPI 968 WSCInstallNameSpaceEx32( 969 _In_ LPWSTR lpszIdentifier, 970 _In_ LPWSTR lpszPathName, 971 _In_ DWORD dwNameSpace, 972 _In_ DWORD dwVersion, 973 _In_ LPGUID lpProviderId, 974 _In_ LPBLOB lpProviderSpecific); 975 976 #endif /* (_WIN64) */ 977 978 #if defined(_WIN64) 979 int 980 WSPAPI 981 WSCInstallProviderAndChains64_32( 982 #else 983 int 984 WSPAPI 985 WSCInstallProviderAndChains( 986 #endif 987 _In_ LPGUID lpProviderId, 988 _In_ const LPWSTR lpszProviderDllPath, 989 #if defined(_WIN64) 990 _In_ const LPWSTR lpszProviderDllPath32, 991 #endif 992 _In_ const LPWSTR lpszLspName, 993 _In_ DWORD dwServiceFlags, 994 _Inout_updates_(dwNumberOfEntries) LPWSAPROTOCOL_INFOW lpProtocolInfoList, 995 _In_ DWORD dwNumberOfEntries, 996 _Out_opt_ LPDWORD lpdwCatalogEntryId, 997 _Out_ LPINT lpErrno); 998 999 #endif /* (_WIN32_WINNT >= 0x0600) */ 1000 1001 BOOL 1002 WSPAPI 1003 WPUCloseEvent( 1004 _In_ WSAEVENT hEvent, 1005 _Out_ LPINT lpErrno); 1006 1007 int 1008 WSPAPI 1009 WPUCloseSocketHandle( 1010 _In_ SOCKET s, 1011 _Out_ LPINT lpErrno); 1012 1013 WSAEVENT 1014 WSPAPI 1015 WPUCreateEvent( 1016 _Out_ LPINT lpErrno); 1017 1018 SOCKET 1019 WSPAPI 1020 WPUCreateSocketHandle( 1021 _In_ DWORD dwCatalogEntryId, 1022 _In_ DWORD_PTR dwContext, 1023 _Out_ LPINT lpErrno); 1024 1025 int 1026 WSPAPI 1027 WPUFDIsSet( 1028 _In_ SOCKET s, 1029 _In_ fd_set FAR *fdset); 1030 1031 int 1032 WSPAPI 1033 WPUGetProviderPath( 1034 _In_ LPGUID lpProviderId, 1035 _Out_writes_(*lpProviderDllPathLen) WCHAR FAR *lpszProviderDllPath, 1036 _Inout_ LPINT lpProviderDllPathLen, 1037 _Out_ LPINT lpErrno); 1038 1039 SOCKET 1040 WSPAPI 1041 WPUModifyIFSHandle( 1042 _In_ DWORD dwCatalogEntryId, 1043 _In_ SOCKET ProposedHandle, 1044 _Out_ LPINT lpErrno); 1045 1046 BOOL 1047 WSPAPI 1048 WPUPostMessage( 1049 _In_ HWND hWnd, 1050 _In_ UINT Msg, 1051 _In_ WPARAM wParam, 1052 _In_ LPARAM lParam); 1053 1054 int 1055 WSPAPI 1056 WPUQueryBlockingCallback( 1057 _In_ DWORD dwCatalogEntryId, 1058 _Out_ LPBLOCKINGCALLBACK FAR *lplpfnCallback, 1059 _Out_ PDWORD_PTR lpdwContext, 1060 _Out_ LPINT lpErrno); 1061 1062 int 1063 WSPAPI 1064 WPUQuerySocketHandleContext( 1065 _In_ SOCKET s, 1066 _Out_ PDWORD_PTR lpContext, 1067 _Out_ LPINT lpErrno); 1068 1069 int 1070 WSPAPI 1071 WPUQueueApc( 1072 _In_ LPWSATHREADID lpThreadId, 1073 _In_ LPWSAUSERAPC lpfnUserApc, 1074 _In_ DWORD_PTR dwContext, 1075 _Out_ LPINT lpErrno); 1076 1077 BOOL 1078 WSPAPI 1079 WPUResetEvent( 1080 _In_ WSAEVENT hEvent, 1081 _Out_ LPINT lpErrno); 1082 1083 BOOL 1084 WSPAPI 1085 WPUSetEvent( 1086 _In_ WSAEVENT hEvent, 1087 _Out_ LPINT lpErrno); 1088 1089 int 1090 WSPAPI 1091 WPUCompleteOverlappedRequest( 1092 _In_ SOCKET s, 1093 _Inout_ LPWSAOVERLAPPED lpOverlapped, 1094 _In_ DWORD dwError, 1095 _In_ DWORD cbTransferred, 1096 _Out_ LPINT lpErrno); 1097 1098 INT 1099 WSPAPI 1100 WSCInstallNameSpace( 1101 _In_ LPWSTR lpszIdentifier, 1102 _In_ LPWSTR lpszPathName, 1103 _In_ DWORD dwNameSpace, 1104 _In_ DWORD dwVersion, 1105 _In_ LPGUID lpProviderId); 1106 1107 INT 1108 WSPAPI 1109 WSCUnInstallNameSpace( 1110 _In_ LPGUID lpProviderId); 1111 1112 INT 1113 WSPAPI 1114 WSCEnableNSProvider( 1115 _In_ LPGUID lpProviderId, 1116 _In_ BOOL fEnable); 1117 1118 _Must_inspect_result_ 1119 INT 1120 WSAAPI 1121 NSPStartup( 1122 _In_ LPGUID lpProviderId, 1123 _Inout_ LPNSP_ROUTINE lpnspRoutines); 1124 1125 #if !defined(_WIN64) 1126 #include <poppack.h> 1127 #endif 1128 1129 #ifdef __cplusplus 1130 } 1131 #endif 1132