ReactOS 0.4.16-dev-250-g3ecd236
dupsock.c File Reference
#include <ws2_32.h>
#include <debug.h>
Include dependency graph for dupsock.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

INT WSAAPI WSADuplicateSocketA (IN SOCKET s, IN DWORD dwProcessId, OUT LPWSAPROTOCOL_INFOA lpProtocolInfo)
 
INT WSAAPI WSADuplicateSocketW (IN SOCKET s, IN DWORD dwProcessId, OUT LPWSAPROTOCOL_INFOW lpProtocolInfo)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 13 of file dupsock.c.

Function Documentation

◆ WSADuplicateSocketA()

INT WSAAPI WSADuplicateSocketA ( IN SOCKET  s,
IN DWORD  dwProcessId,
OUT LPWSAPROTOCOL_INFOA  lpProtocolInfo 
)

Definition at line 23 of file dupsock.c.

26{
27 WSAPROTOCOL_INFOW ProtocolInfoW;
29 DPRINT("WSADuplicateSocketA: %lx, %lx, %p\n", s, dwProcessId, lpProtocolInfo);
30
31 /* Call the Unicode Function */
32 ErrorCode = WSADuplicateSocketW(s, dwProcessId, &ProtocolInfoW);
33
34 /* Check for success */
36 {
37 /* Convert Protocol Info to Ansi */
38 if (lpProtocolInfo)
39 {
40 /* Convert the information to ANSI */
42 lpProtocolInfo);
43 }
44 else
45 {
46 /* Fail */
48 }
49
50 /* Check if the conversion failed */
52 {
53 /* Set the last error and normalize the error */
56 }
57 }
58
59 /* Return */
60 return ErrorCode;
61}
#define ERROR_SUCCESS
Definition: deptool.c:10
#define SetLastError(x)
Definition: compat.h:752
INT WSAAPI WSADuplicateSocketW(IN SOCKET s, IN DWORD dwProcessId, OUT LPWSAPROTOCOL_INFOW lpProtocolInfo)
Definition: dupsock.c:68
GLdouble s
Definition: gl.h:2039
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4436
#define DPRINT
Definition: sndvol32.h:73
int32_t INT
Definition: typedefs.h:58
#define WSAEFAULT
Definition: winerror.h:1945
#define SOCKET_ERROR
Definition: winsock.h:333
INT WSAAPI MapUnicodeProtocolInfoToAnsi(IN LPWSAPROTOCOL_INFOW UnicodeInfo, OUT LPWSAPROTOCOL_INFOA AnsiInfo)
Definition: wsautil.c:224

Referenced by test_WithWSAStartup().

◆ WSADuplicateSocketW()

INT WSAAPI WSADuplicateSocketW ( IN SOCKET  s,
IN DWORD  dwProcessId,
OUT LPWSAPROTOCOL_INFOW  lpProtocolInfo 
)

Definition at line 68 of file dupsock.c.

71{
72 PWSSOCKET Socket;
73 INT Status;
75 DPRINT("WSADuplicateSocketW: %lx, %lx, %p\n", s, dwProcessId, lpProtocolInfo);
76
77 /* Check for WSAStartup */
79 {
80 /* Get the Socket Context */
81 if ((Socket = WsSockGetSocket(s)))
82 {
83 /* Make the call */
85 dwProcessId,
86 lpProtocolInfo,
87 &ErrorCode);
88 /* Deference the Socket Context */
89 WsSockDereference(Socket);
90
91 /* Return Provider Value */
92 if (Status == ERROR_SUCCESS) return Status;
93
94 /* If everything seemed fine, then the WSP call failed itself */
96 }
97 else
98 {
99 /* No Socket Context Found */
101 }
102 }
103
104 /* Return with an Error */
106 return SOCKET_ERROR;
107}
#define NO_ERROR
Definition: dderror.h:5
Status
Definition: gdiplustypes.h:25
WSPPROC_TABLE Service
Definition: ws2_32p.h:80
LPWSPDUPLICATESOCKET lpWSPDuplicateSocket
Definition: ws2spi.h:469
PTPROVIDER Provider
Definition: ws2_32p.h:199
#define WSASYSCALLFAILURE
Definition: winerror.h:1994
#define WSAENOTSOCK
Definition: winerror.h:1951
FORCEINLINE DWORD WsQuickProlog(VOID)
Definition: ws2_32p.h:892
VOID WSAAPI WsSockDereference(IN PWSSOCKET Socket)
Definition: dsocket.c:205
PWSSOCKET WSAAPI WsSockGetSocket(IN SOCKET Handle)
Definition: dsocket.c:140

Referenced by Test_CloseDuplicatedSocket(), Test_CloseWhileSelectDuplicatedSocket(), and WSADuplicateSocketA().