Commit a21cf075 authored by Alexandre Julliard's avatar Alexandre Julliard

Added support for implementing VxDs as separate dlls and loading them

on demand. Moved all the DeviceIoControl code into the respective VxD dlls.
parent 652919b6
......@@ -1513,6 +1513,7 @@ dlls/glu32/Makefile
dlls/glut32/Makefile
dlls/iccvid/Makefile
dlls/icmp/Makefile
dlls/ifsmgr.vxd/Makefile
dlls/imagehlp/Makefile
dlls/imm32/Makefile
dlls/iphlpapi/Makefile
......@@ -1521,6 +1522,8 @@ dlls/kernel/Makefile
dlls/kernel/tests/Makefile
dlls/lzexpand/Makefile
dlls/mapi32/Makefile
dlls/mmdevldr.vxd/Makefile
dlls/monodebg.vxd/Makefile
dlls/mpr/Makefile
dlls/msacm/Makefile
dlls/msacm/imaadp32/Makefile
......@@ -1586,7 +1589,12 @@ dlls/user/Makefile
dlls/user/tests/Makefile
dlls/uuid/Makefile
dlls/uxtheme/Makefile
dlls/vdhcp.vxd/Makefile
dlls/version/Makefile
dlls/vnb.vxd/Makefile
dlls/vnetbios.vxd/Makefile
dlls/vtdapi.vxd/Makefile
dlls/vwin32.vxd/Makefile
dlls/win32s/Makefile
dlls/winaspi/Makefile
dlls/wined3d/Makefile
......
......@@ -50,12 +50,15 @@ BASEDIRS = \
gdi \
iccvid \
icmp \
ifsmgr.vxd \
imagehlp \
imm32 \
iphlpapi \
kernel \
lzexpand \
mapi32 \
mmdevldr.vxd \
monodebg.vxd \
mpr \
msacm \
msacm/imaadp32 \
......@@ -110,7 +113,12 @@ BASEDIRS = \
urlmon \
user \
uxtheme \
vdhcp.vxd \
version \
vnb.vxd \
vnetbios.vxd \
vtdapi.vxd \
vwin32.vxd \
win32s \
winaspi \
winedos \
......@@ -248,6 +256,7 @@ SYMLINKS = \
gdi32.dll$(DLLEXT) \
iccvid.dll$(DLLEXT) \
icmp.dll$(DLLEXT) \
ifsmgr.vxd$(DLLEXT) \
imaadp32.acm$(DLLEXT) \
imagehlp.dll$(DLLEXT) \
imm32.dll$(DLLEXT) \
......@@ -264,6 +273,8 @@ SYMLINKS = \
mciseq.drv$(DLLEXT) \
mciwave.drv$(DLLEXT) \
midimap.drv$(DLLEXT) \
mmdevldr.vxd$(DLLEXT) \
monodebg.vxd$(DLLEXT) \
mpr.dll$(DLLEXT) \
msacm.drv$(DLLEXT) \
msacm32.dll$(DLLEXT) \
......@@ -317,7 +328,12 @@ SYMLINKS = \
urlmon.dll$(DLLEXT) \
user32.dll$(DLLEXT) \
uxtheme.dll$(DLLEXT) \
vdhcp.vxd$(DLLEXT) \
version.dll$(DLLEXT) \
vnb.vxd$(DLLEXT) \
vnetbios.vxd$(DLLEXT) \
vtdapi.vxd$(DLLEXT) \
vwin32.vxd$(DLLEXT) \
w32skrnl.dll$(DLLEXT) \
winealsa.drv$(DLLEXT) \
winearts.drv$(DLLEXT) \
......@@ -477,6 +493,9 @@ iccvid.dll$(DLLEXT): iccvid/iccvid.dll$(DLLEXT)
icmp.dll$(DLLEXT): icmp/icmp.dll$(DLLEXT)
$(RM) $@ && $(LN_S) icmp/icmp.dll$(DLLEXT) $@
ifsmgr.vxd$(DLLEXT): ifsmgr.vxd/ifsmgr.vxd$(DLLEXT)
$(RM) $@ && $(LN_S) ifsmgr.vxd/ifsmgr.vxd$(DLLEXT) $@
imaadp32.acm$(DLLEXT): msacm/imaadp32/imaadp32.acm$(DLLEXT)
$(RM) $@ && $(LN_S) msacm/imaadp32/imaadp32.acm$(DLLEXT) $@
......@@ -530,6 +549,12 @@ mciwave.drv$(DLLEXT): winmm/mciwave/mciwave.drv$(DLLEXT)
midimap.drv$(DLLEXT): winmm/midimap/midimap.drv$(DLLEXT)
$(RM) $@ && $(LN_S) winmm/midimap/midimap.drv$(DLLEXT) $@
mmdevldr.vxd$(DLLEXT): mmdevldr.vxd/mmdevldr.vxd$(DLLEXT)
$(RM) $@ && $(LN_S) mmdevldr.vxd/mmdevldr.vxd$(DLLEXT) $@
monodebg.vxd$(DLLEXT): monodebg.vxd/monodebg.vxd$(DLLEXT)
$(RM) $@ && $(LN_S) monodebg.vxd/monodebg.vxd$(DLLEXT) $@
mpr.dll$(DLLEXT): mpr/mpr.dll$(DLLEXT)
$(RM) $@ && $(LN_S) mpr/mpr.dll$(DLLEXT) $@
......@@ -725,12 +750,27 @@ ddeml.dll$(DLLEXT) display.drv$(DLLEXT) keyboard.drv$(DLLEXT) \
uxtheme.dll$(DLLEXT): uxtheme/uxtheme.dll$(DLLEXT)
$(RM) $@ && $(LN_S) uxtheme/uxtheme.dll$(DLLEXT) $@
vdhcp.vxd$(DLLEXT): vdhcp.vxd/vdhcp.vxd$(DLLEXT)
$(RM) $@ && $(LN_S) vdhcp.vxd/vdhcp.vxd$(DLLEXT) $@
version.dll$(DLLEXT): version/version.dll$(DLLEXT)
$(RM) $@ && $(LN_S) version/version.dll$(DLLEXT) $@
ver.dll$(DLLEXT) : version.dll$(DLLEXT)
$(RM) $@ && $(LN_S) version.dll$(DLLEXT) $@
vnb.vxd$(DLLEXT): vnb.vxd/vnb.vxd$(DLLEXT)
$(RM) $@ && $(LN_S) vnb.vxd/vnb.vxd$(DLLEXT) $@
vnetbios.vxd$(DLLEXT): vnetbios.vxd/vnetbios.vxd$(DLLEXT)
$(RM) $@ && $(LN_S) vnetbios.vxd/vnetbios.vxd$(DLLEXT) $@
vtdapi.vxd$(DLLEXT): vtdapi.vxd/vtdapi.vxd$(DLLEXT)
$(RM) $@ && $(LN_S) vtdapi.vxd/vtdapi.vxd$(DLLEXT) $@
vwin32.vxd$(DLLEXT): vwin32.vxd/vwin32.vxd$(DLLEXT)
$(RM) $@ && $(LN_S) vwin32.vxd/vwin32.vxd$(DLLEXT) $@
w32skrnl.dll$(DLLEXT): win32s/w32skrnl.dll$(DLLEXT)
$(RM) $@ && $(LN_S) win32s/w32skrnl.dll$(DLLEXT) $@
......@@ -1667,6 +1707,7 @@ glu32/glu32.dll$(DLLEXT): glu32
glut32/glut32.dll$(DLLEXT): glut32
iccvid/iccvid.dll$(DLLEXT): iccvid
icmp/icmp.dll$(DLLEXT): icmp
ifsmgr.vxd/ifsmgr.vxd$(DLLEXT): ifsmgr.vxd
msacm/imaadp32/imaadp32.acm$(DLLEXT): msacm/imaadp32
imagehlp/imagehlp.dll$(DLLEXT): imagehlp
imm32/imm32.dll$(DLLEXT): imm32
......@@ -1681,6 +1722,8 @@ winmm/mcicda/mcicda.drv$(DLLEXT): winmm/mcicda
winmm/mciseq/mciseq.drv$(DLLEXT): winmm/mciseq
winmm/mciwave/mciwave.drv$(DLLEXT): winmm/mciwave
winmm/midimap/midimap.drv$(DLLEXT): winmm/midimap
mmdevldr.vxd/mmdevldr.vxd$(DLLEXT): mmdevldr.vxd
monodebg.vxd/monodebg.vxd$(DLLEXT): monodebg.vxd
mpr/mpr.dll$(DLLEXT): mpr
winmm/wavemap/msacm.drv$(DLLEXT): winmm/wavemap
msacm/msacm32.dll$(DLLEXT): msacm
......@@ -1735,7 +1778,12 @@ url/url.dll$(DLLEXT): url
urlmon/urlmon.dll$(DLLEXT): urlmon
user/user32.dll$(DLLEXT): user
uxtheme/uxtheme.dll$(DLLEXT): uxtheme
vdhcp.vxd/vdhcp.vxd$(DLLEXT): vdhcp.vxd
version/version.dll$(DLLEXT): version
vnb.vxd/vnb.vxd$(DLLEXT): vnb.vxd
vnetbios.vxd/vnetbios.vxd$(DLLEXT): vnetbios.vxd
vtdapi.vxd/vtdapi.vxd$(DLLEXT): vtdapi.vxd
vwin32.vxd/vwin32.vxd$(DLLEXT): vwin32.vxd
win32s/w32skrnl.dll$(DLLEXT): win32s
winmm/winealsa/winealsa.drv$(DLLEXT): winmm/winealsa
winmm/winearts/winearts.drv$(DLLEXT): winmm/winearts
......
Makefile
ifsmgr.vxd.dbg.c
ifsmgr.vxd.spec.c
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = ifsmgr.vxd
IMPORTS = winedos kernel32
C_SRCS = \
ifsmgr.c
@MAKE_DLL_RULES@
### Dependencies:
/*
* IFSMGR VxD implementation
*
* Copyright 1998 Marcus Meissner
* Copyright 1998 Ulrich Weigand
* Copyright 1998 Patrik Stridvall
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* NOTES
* These ioctls are used by 'MSNET32.DLL'.
*
* I have been unable to uncover any documentation about the ioctls so
* the implementation of the cases IFS_IOCTL_21 and IFS_IOCTL_2F are
* based on reasonable guesses on information found in the Windows 95 DDK.
*/
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(vxd);
extern void WINAPI CallBuiltinHandler( CONTEXT86 *context, BYTE intnum ); /* from winedos */
/*
* IFSMgr DeviceIO service
*/
#define IFS_IOCTL_21 100
#define IFS_IOCTL_2F 101
#define IFS_IOCTL_GET_RES 102
#define IFS_IOCTL_GET_NETPRO_NAME_A 103
struct win32apireq {
unsigned long ar_proid;
unsigned long ar_eax;
unsigned long ar_ebx;
unsigned long ar_ecx;
unsigned long ar_edx;
unsigned long ar_esi;
unsigned long ar_edi;
unsigned long ar_ebp;
unsigned short ar_error;
unsigned short ar_pad;
};
static void win32apieq_2_CONTEXT(struct win32apireq *pIn,CONTEXT86 *pCxt)
{
memset(pCxt,0,sizeof(*pCxt));
pCxt->ContextFlags=CONTEXT86_INTEGER|CONTEXT86_CONTROL;
pCxt->Eax = pIn->ar_eax;
pCxt->Ebx = pIn->ar_ebx;
pCxt->Ecx = pIn->ar_ecx;
pCxt->Edx = pIn->ar_edx;
pCxt->Esi = pIn->ar_esi;
pCxt->Edi = pIn->ar_edi;
/* FIXME: Only partial CONTEXT86_CONTROL */
pCxt->Ebp = pIn->ar_ebp;
/* FIXME: pIn->ar_proid ignored */
/* FIXME: pIn->ar_error ignored */
/* FIXME: pIn->ar_pad ignored */
}
static void CONTEXT_2_win32apieq(CONTEXT86 *pCxt,struct win32apireq *pOut)
{
memset(pOut,0,sizeof(struct win32apireq));
pOut->ar_eax = pCxt->Eax;
pOut->ar_ebx = pCxt->Ebx;
pOut->ar_ecx = pCxt->Ecx;
pOut->ar_edx = pCxt->Edx;
pOut->ar_esi = pCxt->Esi;
pOut->ar_edi = pCxt->Edi;
/* FIXME: Only partial CONTEXT86_CONTROL */
pOut->ar_ebp = pCxt->Ebp;
/* FIXME: pOut->ar_proid ignored */
/* FIXME: pOut->ar_error ignored */
/* FIXME: pOut->ar_pad ignored */
}
/***********************************************************************
* DeviceIoControl (IFSMGR.VXD.@)
*/
BOOL WINAPI IFSMGR_DeviceIoControl(DWORD dwIoControlCode, LPVOID lpvInBuffer, DWORD cbInBuffer,
LPVOID lpvOutBuffer, DWORD cbOutBuffer,
LPDWORD lpcbBytesReturned,
LPOVERLAPPED lpOverlapped)
{
TRACE("(%ld,%p,%ld,%p,%ld,%p,%p): stub\n",
dwIoControlCode, lpvInBuffer,cbInBuffer, lpvOutBuffer,cbOutBuffer,
lpcbBytesReturned, lpOverlapped);
switch (dwIoControlCode)
{
case IFS_IOCTL_21:
case IFS_IOCTL_2F:
{
CONTEXT86 cxt;
struct win32apireq *pIn=(struct win32apireq *) lpvInBuffer;
struct win32apireq *pOut=(struct win32apireq *) lpvOutBuffer;
TRACE( "Control '%s': "
"proid=0x%08lx, eax=0x%08lx, ebx=0x%08lx, ecx=0x%08lx, "
"edx=0x%08lx, esi=0x%08lx, edi=0x%08lx, ebp=0x%08lx, "
"error=0x%04x, pad=0x%04x\n",
(dwIoControlCode==IFS_IOCTL_21)?"IFS_IOCTL_21":"IFS_IOCTL_2F",
pIn->ar_proid, pIn->ar_eax, pIn->ar_ebx, pIn->ar_ecx,
pIn->ar_edx, pIn->ar_esi, pIn->ar_edi, pIn->ar_ebp,
pIn->ar_error, pIn->ar_pad );
win32apieq_2_CONTEXT(pIn,&cxt);
if(dwIoControlCode==IFS_IOCTL_21)
CallBuiltinHandler( &cxt, 0x21 );
else
CallBuiltinHandler( &cxt, 0x2f );
CONTEXT_2_win32apieq(&cxt,pOut);
return TRUE;
}
case IFS_IOCTL_GET_RES:
FIXME( "Control 'IFS_IOCTL_GET_RES' not implemented\n");
return FALSE;
case IFS_IOCTL_GET_NETPRO_NAME_A:
FIXME( "Control 'IFS_IOCTL_GET_NETPRO_NAME_A' not implemented\n");
return FALSE;
default:
FIXME( "Control %ld not implemented\n", dwIoControlCode);
return FALSE;
}
}
@ stdcall DeviceIoControl(long ptr long ptr long ptr ptr) IFSMGR_DeviceIoControl
Makefile
mmdevldr.vxd.dbg.c
mmdevldr.vxd.spec.c
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = mmdevldr.vxd
IMPORTS = kernel32
C_SRCS = \
mmdevldr.c
@MAKE_DLL_RULES@
### Dependencies:
/*
* MMDEVLDR VxD implementation
*
* Copyright 1998 Marcus Meissner
* Copyright 1998 Ulrich Weigand
* Copyright 1998 Patrik Stridvall
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(vxd);
/***********************************************************************
* DeviceIoControl (MMDEVLDR.VXD.@)
*/
BOOL WINAPI MMDEVLDR_DeviceIoControl(DWORD dwIoControlCode,
LPVOID lpvInBuffer, DWORD cbInBuffer,
LPVOID lpvOutBuffer, DWORD cbOutBuffer,
LPDWORD lpcbBytesReturned,
LPOVERLAPPED lpOverlapped)
{
FIXME("(%ld,%p,%ld,%p,%ld,%p,%p): stub\n",
dwIoControlCode,
lpvInBuffer,cbInBuffer,
lpvOutBuffer,cbOutBuffer,
lpcbBytesReturned,
lpOverlapped );
switch (dwIoControlCode)
{
case 5:
/* Hmm. */
*(DWORD*)lpvOutBuffer=0;
*lpcbBytesReturned=sizeof(DWORD);
return TRUE;
default:
return FALSE;
}
}
@ stdcall DeviceIoControl(long ptr long ptr long ptr ptr) MMDEVLDR_DeviceIoControl
Makefile
monodebg.vxd.dbg.c
monodebg.vxd.spec.c
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = monodebg.vxd
IMPORTS = kernel32
C_SRCS = \
monodebg.c
@MAKE_DLL_RULES@
### Dependencies:
/*
* MONODEBG VxD implementation
*
* Copyright 1998 Marcus Meissner
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* NOTE: this VxD is used by some Origin games */
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(vxd);
/***********************************************************************
* DeviceIoControl (MONODEBG.VXD.@)
*/
BOOL WINAPI MONODEBG_DeviceIoControl(DWORD dwIoControlCode,
LPVOID lpvInBuffer, DWORD cbInBuffer,
LPVOID lpvOutBuffer, DWORD cbOutBuffer,
LPDWORD lpcbBytesReturned,
LPOVERLAPPED lpOverlapped)
{
switch (dwIoControlCode)
{
case 1: /* version */
*(LPDWORD)lpvOutBuffer = 0x20004; /* WC SecretOps */
break;
case 9: /* debug output */
ERR("%s\n",debugstr_a(lpvInBuffer));
break;
default:
FIXME("(%ld,%p,%ld,%p,%ld,%p,%p): stub\n",
dwIoControlCode,
lpvInBuffer,cbInBuffer,
lpvOutBuffer,cbOutBuffer,
lpcbBytesReturned,
lpOverlapped );
break;
}
return TRUE;
}
@ stdcall DeviceIoControl(long ptr long ptr long ptr ptr) MONODEBG_DeviceIoControl
Makefile
vdhcp.vxd.dbg.c
vdhcp.vxd.spec.c
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = vdhcp.vxd
IMPORTS = kernel32
C_SRCS = \
vdhcp.c
@MAKE_DLL_RULES@
### Dependencies:
/*
* VDHCP VxD implementation
*
* Copyright 2003 Juan Lang
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(vxd);
/***********************************************************************
* DeviceIoControl (VDHCP.VXD.@)
*/
BOOL WINAPI VDHCP_DeviceIoControl(DWORD dwIoControlCode, LPVOID lpvInBuffer,
DWORD cbInBuffer,
LPVOID lpvOutBuffer, DWORD cbOutBuffer,
LPDWORD lpcbBytesReturned,
LPOVERLAPPED lpOverlapped)
{
DWORD error;
switch (dwIoControlCode)
{
case 1:
{
/* since IpReleaseAddress/IpRenewAddress are not implemented, say there
* are no DHCP adapters
*/
error = ERROR_FILE_NOT_FOUND;
break;
}
/* FIXME: don't know what this means */
case 5:
if (lpcbBytesReturned)
*lpcbBytesReturned = sizeof(DWORD);
if (lpvOutBuffer && cbOutBuffer >= sizeof(DWORD))
{
*(LPDWORD)lpvOutBuffer = 0;
error = NO_ERROR;
}
else
error = ERROR_BUFFER_OVERFLOW;
break;
default:
FIXME("(%ld,%p,%ld,%p,%ld,%p,%p): stub\n",
dwIoControlCode,
lpvInBuffer,cbInBuffer,
lpvOutBuffer,cbOutBuffer,
lpcbBytesReturned,
lpOverlapped);
error = ERROR_NOT_SUPPORTED;
break;
}
if (error)
SetLastError(error);
return error == NO_ERROR;
}
@ stdcall DeviceIoControl(long ptr long ptr long ptr ptr) VDHCP_DeviceIoControl
Makefile
vnb.vxd.dbg.c
vnb.vxd.spec.c
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = vnb.vxd
IMPORTS = iphlpapi kernel32
C_SRCS = \
vnb.c
@MAKE_DLL_RULES@
### Dependencies:
/*
* VNB VxD implementation
*
* Copyright 2003 Juan Lang
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include <stdlib.h>
#include <stdarg.h>
#include <sys/types.h>
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include "windef.h"
#include "winbase.h"
#include "iphlpapi.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(vxd);
#ifndef INADDR_NONE
#define INADDR_NONE ~0UL
#endif
typedef struct _nbtInfo
{
DWORD ip;
DWORD winsPrimary;
DWORD winsSecondary;
DWORD dnsPrimary;
DWORD dnsSecondary;
DWORD unk0;
} nbtInfo;
#define MAX_NBT_ENTRIES 7
typedef struct _nbtTable
{
DWORD numEntries;
nbtInfo table[MAX_NBT_ENTRIES];
UCHAR pad[6];
WORD nodeType;
WORD scopeLen;
char scope[254];
} nbtTable;
/***********************************************************************
* DeviceIoControl (VNB.VXD.@)
*/
BOOL WINAPI VNB_DeviceIoControl(DWORD dwIoControlCode,
LPVOID lpvInBuffer, DWORD cbInBuffer,
LPVOID lpvOutBuffer, DWORD cbOutBuffer,
LPDWORD lpcbBytesReturned,
LPOVERLAPPED lpOverlapped)
{
DWORD error;
switch (dwIoControlCode)
{
case 116:
if (lpcbBytesReturned)
*lpcbBytesReturned = sizeof(nbtTable);
if (!lpvOutBuffer || cbOutBuffer < sizeof(nbtTable))
error = ERROR_BUFFER_OVERFLOW;
else
{
nbtTable *info = (nbtTable *)lpvOutBuffer;
DWORD size = 0;
memset(info, 0, sizeof(nbtTable));
error = GetNetworkParams(NULL, &size);
if (ERROR_BUFFER_OVERFLOW == error)
{
PFIXED_INFO fixedInfo = (PFIXED_INFO)HeapAlloc( GetProcessHeap(), 0, size);
error = GetNetworkParams(fixedInfo, &size);
if (NO_ERROR == error)
{
info->nodeType = (WORD)fixedInfo->NodeType;
info->scopeLen = min(strlen(fixedInfo->ScopeId) + 1,
sizeof(info->scope) - 2);
memcpy(info->scope + 1, fixedInfo->ScopeId,
info->scopeLen);
info->scope[info->scopeLen + 1] = '\0';
{
/* convert into L2-encoded version */
char *ptr, *lenPtr;
for (ptr = info->scope + 1; *ptr &&
ptr - info->scope < sizeof(info->scope); )
{
for (lenPtr = ptr - 1, *lenPtr = 0;
*ptr && *ptr != '.' &&
ptr - info->scope < sizeof(info->scope);
ptr++)
*lenPtr += 1;
ptr++;
}
}
/* could set DNS servers here too, but since
* ipconfig.exe and winipcfg.exe read these from the
* registry, there's no point */
}
if (fixedInfo)
HeapFree(GetProcessHeap(), 0, fixedInfo);
}
size = 0;
error = GetAdaptersInfo(NULL, &size);
if (ERROR_BUFFER_OVERFLOW == error)
{
PIP_ADAPTER_INFO adapterInfo = HeapAlloc(GetProcessHeap(), 0, size);
error = GetAdaptersInfo(adapterInfo, &size);
if (NO_ERROR == error)
{
PIP_ADAPTER_INFO ptr = adapterInfo;
for (ptr = adapterInfo; ptr && info->numEntries <
MAX_NBT_ENTRIES; ptr = ptr->Next)
{
unsigned long addr;
addr = inet_addr(ptr->IpAddressList.IpAddress.String);
if (addr != 0 && addr != INADDR_NONE)
info->table[info->numEntries].ip = ntohl(addr);
addr = inet_addr(ptr->PrimaryWinsServer.IpAddress.String);
if (addr != 0 && addr != INADDR_NONE)
info->table[info->numEntries].winsPrimary = ntohl(addr);
addr = inet_addr(ptr->SecondaryWinsServer.IpAddress.String);
if (addr != 0 && addr != INADDR_NONE)
info->table[info->numEntries].winsSecondary = ntohl(addr);
info->numEntries++;
}
}
if (adapterInfo)
HeapFree(GetProcessHeap(), 0, adapterInfo);
}
}
break;
case 119:
/* nbtstat.exe uses this, but the return seems to be a bunch of
* pointers, so it's not so easy to reverse engineer. Fall through
* to unimplemented...
*/
default:
FIXME( "Unimplemented control %ld for VxD device VNB\n",
dwIoControlCode );
error = ERROR_NOT_SUPPORTED;
break;
}
if (error)
SetLastError(error);
return error == NO_ERROR;
}
@ stdcall DeviceIoControl(long ptr long ptr long ptr ptr) VNB_DeviceIoControl
Makefile
vnetbios.vxd.dbg.c
vnetbios.vxd.spec.c
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = vnetbios.vxd
IMPORTS = netapi32 kernel32
C_SRCS = \
vnetbios.c
@MAKE_DLL_RULES@
### Dependencies:
/*
* VNETBIOS VxD implementation
*
* Copyright 2003 Juan Lang
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "nb30.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(vxd);
/***********************************************************************
* DeviceIoControl (VNETBIOS.VXD.@)
*/
BOOL WINAPI VNETBIOS_DeviceIoControl( DWORD code, LPVOID lpvInBuffer, DWORD cbInBuffer,
LPVOID lpvOutBuffer, DWORD cbOutBuffer,
LPDWORD lpcbBytesReturned, LPOVERLAPPED lpOverlapped )
{
switch(code)
{
case 256:
Netbios(lpvInBuffer);
return TRUE;
default:
FIXME("(%ld,%p,%ld,%p,%ld,%p,%p): stub\n",
code, lpvInBuffer,cbInBuffer, lpvOutBuffer,cbOutBuffer,
lpcbBytesReturned, lpOverlapped);
return FALSE;
}
}
@ stdcall DeviceIoControl(long ptr long ptr long ptr ptr) VNETBIOS_DeviceIoControl
Makefile
vtdapi.vxd.dbg.c
vtdapi.vxd.spec.c
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = vtdapi.vxd
IMPORTS = kernel32
C_SRCS = \
vtdapi.c
@MAKE_DLL_RULES@
### Dependencies:
/*
* VTDAPI VxD implementation
*
* Copyright 1998 Marcus Meissner
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(vxd);
/***********************************************************************
* DeviceIoControl (VTDAPI.VXD.@)
*/
BOOL WINAPI VTDAPI_DeviceIoControl( DWORD code, LPVOID lpvInBuffer, DWORD cbInBuffer,
LPVOID lpvOutBuffer, DWORD cbOutBuffer,
LPDWORD lpcbBytesReturned, LPOVERLAPPED lpOverlapped )
{
switch (code)
{
case 5:
if (lpvOutBuffer && (cbOutBuffer>=4))
*(DWORD*)lpvOutBuffer = GetTickCount();
if (lpcbBytesReturned)
*lpcbBytesReturned = sizeof(DWORD);
return TRUE;
default:
FIXME( "Control %ld not implemented\n", code);
return FALSE;
}
}
@ stdcall DeviceIoControl(long ptr long ptr long ptr ptr) VTDAPI_DeviceIoControl
Makefile
vwin32.vxd.dbg.c
vwin32.vxd.spec.c
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = vwin32.vxd
IMPORTS = winedos kernel32
C_SRCS = \
vwin32.c
@MAKE_DLL_RULES@
### Dependencies:
/*
* VWIN32 VxD implementation
*
* Copyright 1998 Marcus Meissner
* Copyright 1998 Ulrich Weigand
* Copyright 1998 Patrik Stridvall
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winioctl.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(vxd);
extern void WINAPI CallBuiltinHandler( CONTEXT86 *context, BYTE intnum ); /* from winedos */
static void DIOCRegs_2_CONTEXT( DIOC_REGISTERS *pIn, CONTEXT86 *pCxt )
{
memset( pCxt, 0, sizeof(*pCxt) );
/* Note: segment registers == 0 means that CTX_SEG_OFF_TO_LIN
will interpret 32-bit register contents as linear pointers */
pCxt->ContextFlags=CONTEXT86_INTEGER|CONTEXT86_CONTROL;
pCxt->Eax = pIn->reg_EAX;
pCxt->Ebx = pIn->reg_EBX;
pCxt->Ecx = pIn->reg_ECX;
pCxt->Edx = pIn->reg_EDX;
pCxt->Esi = pIn->reg_ESI;
pCxt->Edi = pIn->reg_EDI;
/* FIXME: Only partial CONTEXT86_CONTROL */
pCxt->EFlags = pIn->reg_Flags & ~0x00020000; /* clear vm86 mode */
}
static void CONTEXT_2_DIOCRegs( CONTEXT86 *pCxt, DIOC_REGISTERS *pOut )
{
memset( pOut, 0, sizeof(DIOC_REGISTERS) );
pOut->reg_EAX = pCxt->Eax;
pOut->reg_EBX = pCxt->Ebx;
pOut->reg_ECX = pCxt->Ecx;
pOut->reg_EDX = pCxt->Edx;
pOut->reg_ESI = pCxt->Esi;
pOut->reg_EDI = pCxt->Edi;
/* FIXME: Only partial CONTEXT86_CONTROL */
pOut->reg_Flags = pCxt->EFlags;
}
#define DIOC_AH(regs) (((unsigned char*)&((regs)->reg_EAX))[1])
#define DIOC_AL(regs) (((unsigned char*)&((regs)->reg_EAX))[0])
#define DIOC_BH(regs) (((unsigned char*)&((regs)->reg_EBX))[1])
#define DIOC_BL(regs) (((unsigned char*)&((regs)->reg_EBX))[0])
#define DIOC_DH(regs) (((unsigned char*)&((regs)->reg_EDX))[1])
#define DIOC_DL(regs) (((unsigned char*)&((regs)->reg_EDX))[0])
#define DIOC_AX(regs) (((unsigned short*)&((regs)->reg_EAX))[0])
#define DIOC_BX(regs) (((unsigned short*)&((regs)->reg_EBX))[0])
#define DIOC_CX(regs) (((unsigned short*)&((regs)->reg_ECX))[0])
#define DIOC_DX(regs) (((unsigned short*)&((regs)->reg_EDX))[0])
#define DIOC_SET_CARRY(regs) (((regs)->reg_Flags)|=0x00000001)
/***********************************************************************
* DeviceIoControl (VWIN32.VXD.@)
*/
BOOL WINAPI VWIN32_DeviceIoControl(DWORD dwIoControlCode,
LPVOID lpvInBuffer, DWORD cbInBuffer,
LPVOID lpvOutBuffer, DWORD cbOutBuffer,
LPDWORD lpcbBytesReturned, LPOVERLAPPED lpOverlapped)
{
switch (dwIoControlCode)
{
case VWIN32_DIOC_DOS_IOCTL:
case 0x10: /* Int 0x21 call, call it VWIN_DIOC_INT21 ? */
case VWIN32_DIOC_DOS_INT13:
case VWIN32_DIOC_DOS_INT25:
case VWIN32_DIOC_DOS_INT26:
case 0x29: /* Int 0x31 call, call it VWIN_DIOC_INT31 ? */
case VWIN32_DIOC_DOS_DRIVEINFO:
{
CONTEXT86 cxt;
DIOC_REGISTERS *pIn = (DIOC_REGISTERS *)lpvInBuffer;
DIOC_REGISTERS *pOut = (DIOC_REGISTERS *)lpvOutBuffer;
BYTE intnum = 0;
TRACE( "Control '%s': "
"eax=0x%08lx, ebx=0x%08lx, ecx=0x%08lx, "
"edx=0x%08lx, esi=0x%08lx, edi=0x%08lx \n",
(dwIoControlCode == VWIN32_DIOC_DOS_IOCTL)? "VWIN32_DIOC_DOS_IOCTL" :
(dwIoControlCode == VWIN32_DIOC_DOS_INT25)? "VWIN32_DIOC_DOS_INT25" :
(dwIoControlCode == VWIN32_DIOC_DOS_INT26)? "VWIN32_DIOC_DOS_INT26" :
(dwIoControlCode == VWIN32_DIOC_DOS_DRIVEINFO)? "VWIN32_DIOC_DOS_DRIVEINFO" : "???",
pIn->reg_EAX, pIn->reg_EBX, pIn->reg_ECX,
pIn->reg_EDX, pIn->reg_ESI, pIn->reg_EDI );
DIOCRegs_2_CONTEXT( pIn, &cxt );
switch (dwIoControlCode)
{
case VWIN32_DIOC_DOS_IOCTL: /* Call int 21h */
case 0x10: /* Int 0x21 call, call it VWIN_DIOC_INT21 ? */
case VWIN32_DIOC_DOS_DRIVEINFO: /* Call int 21h 730x */
intnum = 0x21;
break;
case VWIN32_DIOC_DOS_INT13:
intnum = 0x13;
break;
case VWIN32_DIOC_DOS_INT25:
intnum = 0x25;
break;
case VWIN32_DIOC_DOS_INT26:
intnum = 0x26;
break;
case 0x29: /* Int 0x31 call, call it VWIN_DIOC_INT31 ? */
intnum = 0x31;
break;
}
CallBuiltinHandler( &cxt, intnum );
CONTEXT_2_DIOCRegs( &cxt, pOut );
}
return TRUE;
case VWIN32_DIOC_SIMCTRLC:
FIXME( "Control VWIN32_DIOC_SIMCTRLC not implemented\n");
return FALSE;
default:
FIXME( "Unknown Control %ld\n", dwIoControlCode);
return FALSE;
}
}
@ stdcall DeviceIoControl(long ptr long ptr long ptr ptr) VWIN32_DeviceIoControl
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment