}
}
-DWORD MsafdReturnWithErrno(NTSTATUS Status,
- LPINT Errno,
- DWORD Received,
- LPDWORD ReturnedBytes)
-{
- *Errno = TranslateNtStatusError(Status);
-
- if (ReturnedBytes)
- {
- if (!*Errno)
- *ReturnedBytes = Received;
- else
- *ReturnedBytes = 0;
- }
-
- return *Errno ? SOCKET_ERROR : 0;
-}
-
/*
* FUNCTION: Closes an open socket
* ARGUMENTS:
}
- /* FIXME: We should handle some cases here */
+ /* FIXME: We should handle some more cases here */
+ if (level == SOL_SOCKET)
+ {
+ switch (optname)
+ {
+ case SO_BROADCAST:
+ Socket->SharedData.Broadcast = (*optval != 0) ? 1 : 0;
+ return 0;
+ }
+ }
*lpErrno = Socket->HelperData->WSHSetSocketInformation(Socket->HelperContext,
IN PSOCKET_INFORMATION Socket,
IN ULONG Event
);
-
-DWORD MsafdReturnWithErrno( NTSTATUS Status, LPINT Errno, DWORD Received,
- LPDWORD ReturnedBytes );
typedef VOID (*PASYNC_COMPLETION_ROUTINE)(PVOID Context, PIO_STATUS_BLOCK IoStatusBlock);
+
+DWORD
+FORCEINLINE
+MsafdReturnWithErrno(NTSTATUS Status,
+ LPINT Errno,
+ DWORD Received,
+ LPDWORD ReturnedBytes)
+{
+ if (Errno)
+ {
+ *Errno = TranslateNtStatusError(Status);
+
+ if (ReturnedBytes)
+ *ReturnedBytes = (*Errno == 0) ? Received : 0;
+
+ return (*Errno == 0) ? 0 : SOCKET_ERROR;
+ }
+ else
+ {
+ DbgPrint("%s: Received invalid lpErrno pointer!\n", __FUNCTION__);
+
+ if (ReturnedBytes)
+ *ReturnedBytes = (Status == STATUS_SUCCESS) ? Received : 0;
+
+ return (Status == STATUS_SUCCESS) ? 0 : SOCKET_ERROR;
+ }
+}
#endif /* __MSAFD_H */