1
0
mirror of https://github.com/solemnwarning/ipxwrapper synced 2024-12-30 16:45:37 +01:00

Cleaned up some winsock includes, changed EnumProtocolsW to use correct PROTOCOL_INFO structure.

This commit is contained in:
Daniel Collins 2011-09-07 23:03:14 +00:00
parent 0b73241fe8
commit dd1a6d3b02
4 changed files with 80 additions and 75 deletions

View File

@ -23,9 +23,10 @@ IPXWRAPPER_DEPS := src/ipxwrapper.o src/winsock.o src/ipxwrapper_stubs.o src/log
BIN_FILES := changes.txt license.txt readme.txt ipxwrapper.dll mswsock.dll wsock32.dll ipxconfig.exe
SRC_FILES := changes.txt license.txt Makefile mkstubs.pl readme.txt src/config.h src/ipxconfig.cpp \
src/ipxwrapper.c src/ipxwrapper.def src/ipxwrapper.h src/ipxwrapper_stubs.txt src/log.c \
src/mswsock.def src/mswsock_stubs.txt src/stubdll.c src/winsock.c src/winstuff.h src/wsock32.def \
src/mswsock.def src/mswsock_stubs.txt src/stubdll.c src/winsock.c src/wsock32.def \
src/wsock32_stubs.txt src/directplay.c src/dpwsockx.def src/dpwsockx_stubs.txt src/common.c \
src/common.h src/router.c src/router.h include/dplay.h include/dplaysp.h include/dplobby.h
src/common.h src/router.c src/router.h include/dplay.h include/dplaysp.h include/dplobby.h \
include/wsnwlink.h
all: ipxwrapper.dll wsock32.dll mswsock.dll ipxconfig.exe dpwsockx.dll

49
include/wsnwlink.h Normal file
View File

@ -0,0 +1,49 @@
/*
* Copyright (C) 2003,2004 Roderick Colenbrander
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef _WSNWLINK_
#define _WSNWLINK_
#define IPX_PTYPE 0x4000
#define IPX_FILTERPTYPE 0x4001
#define IPX_DSTYPE 0x4002
#define IPX_STOPFILTERPTYPE 0x4003
#define IPX_EXTENDED_ADDRESS 0x4004
#define IPX_RECVHDR 0x4005
#define IPX_MAXSIZE 0x4006
#define IPX_ADDRESS 0x4007
#define IPX_GETNETINFO 0x4008
#define IPX_GETNETINFO_NORIP 0x4009
#define IPX_SPXGETCONNECTIONSTATUS 0x400b
#define IPX_ADDRESS_NOTIFY 0x400c
#define IPX_MAX_ADAPTER_NUM 0x400d
#define IPX_RERIPNETNUMBER 0x400e
#define IPX_RECEIVE_BROADCAST 0x400f
#define IPX_IMMEDIATESPXACK 0x4010
typedef struct _IPX_ADDRESS_DATA {
INT adapternum;
UCHAR netnum[4];
UCHAR nodenum[6];
BOOLEAN wan;
BOOLEAN status;
INT maxpkt;
ULONG linkspeed;
} IPX_ADDRESS_DATA, *PIPX_ADDRESS_DATA;
#endif /* _WSNWLINK_ */

View File

@ -20,18 +20,28 @@
#include <wsipx.h>
#include <mswsock.h>
#include <nspapi.h>
#include "winstuff.h"
#include <wsnwlink.h>
#include "ipxwrapper.h"
#include "common.h"
#include "interface.h"
#include "router.h"
typedef struct _PROTOCOL_INFOA {
DWORD dwServiceFlags ;
INT iAddressFamily ;
INT iMaxSockAddr ;
INT iMinSockAddr ;
INT iSocketType ;
INT iProtocol ;
DWORD dwMessageSize ;
LPSTR lpProtocol ;
} PROTOCOL_INFOA;
INT APIENTRY EnumProtocolsA(LPINT protocols, LPVOID buf, LPDWORD bsptr) {
int bufsize = *bsptr, rval, i, want_ipx = 0;
PROTOCOL_INFO *pinfo = buf;
PROTOCOL_INFOA *pinfo = buf;
rval = r_EnumProtocolsA(protocols, buf, bsptr);
if(rval == -1) {
@ -57,7 +67,7 @@ INT APIENTRY EnumProtocolsA(LPINT protocols, LPVOID buf, LPDWORD bsptr) {
}
if(i == rval) {
*bsptr += sizeof(PROTOCOL_INFO);
*bsptr += sizeof(PROTOCOL_INFOA);
rval++;
}
@ -79,10 +89,21 @@ INT APIENTRY EnumProtocolsA(LPINT protocols, LPVOID buf, LPDWORD bsptr) {
return rval;
}
typedef struct _PROTOCOL_INFOW {
DWORD dwServiceFlags ;
INT iAddressFamily ;
INT iMaxSockAddr ;
INT iMinSockAddr ;
INT iSocketType ;
INT iProtocol ;
DWORD dwMessageSize ;
LPWSTR lpProtocol ;
} PROTOCOL_INFOW;
INT APIENTRY EnumProtocolsW(LPINT protocols, LPVOID buf, LPDWORD bsptr) {
int bufsize = *bsptr, rval, i, want_ipx = 0;
PROTOCOL_INFO *pinfo = buf;
PROTOCOL_INFOW *pinfo = buf;
rval = r_EnumProtocolsW(protocols, buf, bsptr);
if(rval == -1) {
@ -108,7 +129,7 @@ INT APIENTRY EnumProtocolsW(LPINT protocols, LPVOID buf, LPDWORD bsptr) {
}
if(i == rval) {
*bsptr += sizeof(PROTOCOL_INFO);
*bsptr += sizeof(PROTOCOL_INFOW);
rval++;
}
@ -124,7 +145,7 @@ INT APIENTRY EnumProtocolsW(LPINT protocols, LPVOID buf, LPDWORD bsptr) {
pinfo[i].iSocketType = SOCK_DGRAM;
pinfo[i].iProtocol = NSPROTO_IPX;
pinfo[i].dwMessageSize = 576;
pinfo[i].lpProtocol = (char*)L"IPX";
pinfo[i].lpProtocol = L"IPX";
}
return rval;

View File

@ -1,66 +0,0 @@
/* ipxwrapper - Winsock/win32 stuff
* Copyright (C) 2008 Daniel Collins <solemnwarning@solemnwarning.net>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef WINSTUFF_H
#define WINSTUFF_H
#define IPX_PTYPE 0x4000
#define IPX_FILTERPTYPE 0x4001
#define IPX_STOPFILTERPTYPE 0x4003
#define IPX_MAXSIZE 0x4006
#define IPX_ADDRESS 0x4007
#define IPX_MAX_ADAPTER_NUM 0x400D
typedef struct _PROTOCOL_INFOA {
DWORD dwServiceFlags ;
INT iAddressFamily ;
INT iMaxSockAddr ;
INT iMinSockAddr ;
INT iSocketType ;
INT iProtocol ;
DWORD dwMessageSize ;
LPSTR lpProtocol ;
} PROTOCOL_INFOA;
typedef struct _PROTOCOL_INFOW {
DWORD dwServiceFlags ;
INT iAddressFamily ;
INT iMaxSockAddr ;
INT iMinSockAddr ;
INT iSocketType ;
INT iProtocol ;
DWORD dwMessageSize ;
LPWSTR lpProtocol ;
} PROTOCOL_INFOW;
typedef struct _IPX_ADDRESS_DATA {
INT adapternum;
UCHAR netnum[4];
UCHAR nodenum[6];
BOOLEAN wan;
BOOLEAN status;
INT maxpkt;
ULONG linkspeed;
} IPX_ADDRESS_DATA;
#ifdef UNICODE
typedef PROTOCOL_INFOW PROTOCOL_INFO;
#else
typedef PROTOCOL_INFOA PROTOCOL_INFO;
#endif
#endif /* !WINSTUFF_H */