[XAM/Net] Removed hardcoded WSA error codes
This commit is contained in:
parent
2d514ef222
commit
fa332e13de
|
@ -211,13 +211,13 @@ dword_result_t NetDll_XNetGetOpt_entry(dword_t one, dword_t option_id,
|
|||
case 1:
|
||||
if (*buffer_size < sizeof(XNetStartupParams)) {
|
||||
*buffer_size = sizeof(XNetStartupParams);
|
||||
return 0x2738; // WSAEMSGSIZE
|
||||
return uint32_t(X_WSAError::X_WSAEMSGSIZE);
|
||||
}
|
||||
std::memcpy(buffer_ptr, &xnet_startup_params, sizeof(XNetStartupParams));
|
||||
return 0;
|
||||
default:
|
||||
XELOGE("NetDll_XNetGetOpt: option {} unimplemented", option_id);
|
||||
return 0x2726; // WSAEINVAL
|
||||
return uint32_t(X_WSAError::X_WSAEINVAL);
|
||||
}
|
||||
}
|
||||
DECLARE_XAM_EXPORT1(NetDll_XNetGetOpt, kNetworking, kSketchy);
|
||||
|
@ -326,8 +326,7 @@ dword_result_t NetDll_WSASendTo_entry(
|
|||
auto socket =
|
||||
kernel_state()->object_table()->LookupObject<XSocket>(socket_handle);
|
||||
if (!socket) {
|
||||
// WSAENOTSOCK
|
||||
XThread::SetLastError(0x2736);
|
||||
XThread::SetLastError(uint32_t(X_WSAError::X_WSAENOTSOCK));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -363,7 +362,7 @@ dword_result_t NetDll_WSAWaitForMultipleEvents_entry(dword_t num_events,
|
|||
dword_t timeout,
|
||||
dword_t alertable) {
|
||||
if (num_events > 64) {
|
||||
XThread::SetLastError(87); // ERROR_INVALID_PARAMETER
|
||||
XThread::SetLastError(uint32_t(X_WSAError::X_WSA_INVALID_PARAMETER));
|
||||
return ~0u;
|
||||
}
|
||||
|
||||
|
@ -645,8 +644,7 @@ dword_result_t NetDll_closesocket_entry(dword_t caller, dword_t socket_handle) {
|
|||
auto socket =
|
||||
kernel_state()->object_table()->LookupObject<XSocket>(socket_handle);
|
||||
if (!socket) {
|
||||
// WSAENOTSOCK
|
||||
XThread::SetLastError(0x2736);
|
||||
XThread::SetLastError(uint32_t(X_WSAError::X_WSAENOTSOCK));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -663,8 +661,7 @@ int_result_t NetDll_shutdown_entry(dword_t caller, dword_t socket_handle,
|
|||
auto socket =
|
||||
kernel_state()->object_table()->LookupObject<XSocket>(socket_handle);
|
||||
if (!socket) {
|
||||
// WSAENOTSOCK
|
||||
XThread::SetLastError(0x2736);
|
||||
XThread::SetLastError(uint32_t(X_WSAError::X_WSAENOTSOCK));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -682,8 +679,7 @@ dword_result_t NetDll_setsockopt_entry(dword_t caller, dword_t socket_handle,
|
|||
auto socket =
|
||||
kernel_state()->object_table()->LookupObject<XSocket>(socket_handle);
|
||||
if (!socket) {
|
||||
// WSAENOTSOCK
|
||||
XThread::SetLastError(0x2736);
|
||||
XThread::SetLastError(uint32_t(X_WSAError::X_WSAENOTSOCK));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -697,8 +693,7 @@ dword_result_t NetDll_ioctlsocket_entry(dword_t caller, dword_t socket_handle,
|
|||
auto socket =
|
||||
kernel_state()->object_table()->LookupObject<XSocket>(socket_handle);
|
||||
if (!socket) {
|
||||
// WSAENOTSOCK
|
||||
XThread::SetLastError(0x2736);
|
||||
XThread::SetLastError(uint32_t(X_WSAError::X_WSAENOTSOCK));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -719,8 +714,7 @@ dword_result_t NetDll_bind_entry(dword_t caller, dword_t socket_handle,
|
|||
auto socket =
|
||||
kernel_state()->object_table()->LookupObject<XSocket>(socket_handle);
|
||||
if (!socket) {
|
||||
// WSAENOTSOCK
|
||||
XThread::SetLastError(0x2736);
|
||||
XThread::SetLastError(uint32_t(X_WSAError::X_WSAENOTSOCK));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -741,8 +735,7 @@ dword_result_t NetDll_connect_entry(dword_t caller, dword_t socket_handle,
|
|||
auto socket =
|
||||
kernel_state()->object_table()->LookupObject<XSocket>(socket_handle);
|
||||
if (!socket) {
|
||||
// WSAENOTSOCK
|
||||
XThread::SetLastError(0x2736);
|
||||
XThread::SetLastError(uint32_t(X_WSAError::X_WSAENOTSOCK));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -762,8 +755,7 @@ dword_result_t NetDll_listen_entry(dword_t caller, dword_t socket_handle,
|
|||
auto socket =
|
||||
kernel_state()->object_table()->LookupObject<XSocket>(socket_handle);
|
||||
if (!socket) {
|
||||
// WSAENOTSOCK
|
||||
XThread::SetLastError(0x2736);
|
||||
XThread::SetLastError(uint32_t(X_WSAError::X_WSAENOTSOCK));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -781,16 +773,14 @@ dword_result_t NetDll_accept_entry(dword_t caller, dword_t socket_handle,
|
|||
pointer_t<XSOCKADDR> addr_ptr,
|
||||
lpdword_t addrlen_ptr) {
|
||||
if (!addr_ptr) {
|
||||
// WSAEFAULT
|
||||
XThread::SetLastError(0x271E);
|
||||
XThread::SetLastError(uint32_t(X_WSAError::X_WSAEFAULT));
|
||||
return -1;
|
||||
}
|
||||
|
||||
auto socket =
|
||||
kernel_state()->object_table()->LookupObject<XSocket>(socket_handle);
|
||||
if (!socket) {
|
||||
// WSAENOTSOCK
|
||||
XThread::SetLastError(0x2736);
|
||||
XThread::SetLastError(uint32_t(X_WSAError::X_WSAENOTSOCK));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -922,8 +912,7 @@ dword_result_t NetDll_recv_entry(dword_t caller, dword_t socket_handle,
|
|||
auto socket =
|
||||
kernel_state()->object_table()->LookupObject<XSocket>(socket_handle);
|
||||
if (!socket) {
|
||||
// WSAENOTSOCK
|
||||
XThread::SetLastError(0x2736);
|
||||
XThread::SetLastError(uint32_t(X_WSAError::X_WSAENOTSOCK));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -939,8 +928,7 @@ dword_result_t NetDll_recvfrom_entry(dword_t caller, dword_t socket_handle,
|
|||
auto socket =
|
||||
kernel_state()->object_table()->LookupObject<XSocket>(socket_handle);
|
||||
if (!socket) {
|
||||
// WSAENOTSOCK
|
||||
XThread::SetLastError(0x2736);
|
||||
XThread::SetLastError(uint32_t(X_WSAError::X_WSAENOTSOCK));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -976,8 +964,7 @@ dword_result_t NetDll_send_entry(dword_t caller, dword_t socket_handle,
|
|||
auto socket =
|
||||
kernel_state()->object_table()->LookupObject<XSocket>(socket_handle);
|
||||
if (!socket) {
|
||||
// WSAENOTSOCK
|
||||
XThread::SetLastError(0x2736);
|
||||
XThread::SetLastError(uint32_t(X_WSAError::X_WSAENOTSOCK));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -993,8 +980,7 @@ dword_result_t NetDll_sendto_entry(dword_t caller, dword_t socket_handle,
|
|||
auto socket =
|
||||
kernel_state()->object_table()->LookupObject<XSocket>(socket_handle);
|
||||
if (!socket) {
|
||||
// WSAENOTSOCK
|
||||
XThread::SetLastError(0x2736);
|
||||
XThread::SetLastError(uint32_t(X_WSAError::X_WSAENOTSOCK));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1024,8 +1010,7 @@ dword_result_t NetDll_getsockname_entry(dword_t caller, dword_t socket_handle,
|
|||
auto socket =
|
||||
kernel_state()->object_table()->LookupObject<XSocket>(socket_handle);
|
||||
if (!socket) {
|
||||
// WSAENOTSOCK
|
||||
XThread::SetLastError(0x2736);
|
||||
XThread::SetLastError(uint32_t(X_WSAError::X_WSAENOTSOCK));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,14 @@
|
|||
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
enum class X_WSAError : uint32_t {
|
||||
X_WSA_INVALID_PARAMETER = 0x0057,
|
||||
X_WSAEFAULT = 0x271E,
|
||||
X_WSAEINVAL = 0x2726,
|
||||
X_WSAENOTSOCK = 0x2736,
|
||||
X_WSAEMSGSIZE = 0x2738,
|
||||
};
|
||||
|
||||
struct XSOCKADDR {
|
||||
xe::be<uint16_t> address_family;
|
||||
char sa_data[14];
|
||||
|
|
Loading…
Reference in New Issue