mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
patch by vizzini - began addition of NDIS4 support to ndis.sys; began conversion of tcpip.sys to NDIS4, adjusted bindings info in the registry
svn path=/trunk/; revision=5415
This commit is contained in:
parent
602faeb404
commit
f460558ae4
13 changed files with 294 additions and 99 deletions
|
@ -217,10 +217,10 @@ HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000","ImagePath",0x00020000,"system32
|
|||
HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000","Start",0x00010001,0x00000001
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000","Type",0x00010001,0x00000001
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000","Test",0x00010001,0xbaadf00d
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000","Route",0x00000000,"NE20001"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000\Linkage","Bind",0x00000000,"\Device\NE20001"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000\Linkage","Export",0x00000000,"\Device\NE20001"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000\Linkage","Route",0x00000000,"NE20001"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000","Route",0x00000000,"Ne20001"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000\Linkage","Bind",0x00000000,"\Device\Ne20001"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000\Linkage","Export",0x00000000,"\Device\Ne20001"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000\Linkage","Route",0x00000000,"Ne20001"
|
||||
|
||||
; Each adapter in the system gets its own SCM entry where its parameters and protocol info are stored.
|
||||
; NOTE - service type is 0x4 (SERVICE_ADAPTER) and start is 0x3 (manual start). These drivers are named
|
||||
|
@ -230,9 +230,9 @@ HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000\Linkage","Route",0x00000000,"NE20
|
|||
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001","ErrorControl",0x00010001,0x00000001
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001","Start",0x00010001,0x00000003
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001","Type",0x00010001,0x00000004
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Linkage","Bind",0x00010000,"\Device\NE20001"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Linkage","Export",0x00010000,"\Device\NE20001"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Linkage","Route",0x00010000,"NE20001"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Linkage","Bind",0x00010000,"\Device\Ne20001"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Linkage","Export",0x00010000,"\Device\Ne20001"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Linkage","Route",0x00010000,"Ne20001"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters","Port",0x00010001,0x00000280
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters","Irq",0x00010001,0x00000009
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters","DwordTest",0x00010001,0xbaadf00d
|
||||
|
@ -277,7 +277,7 @@ HKLM,"SYSTEM\CurrentControlSet\Services\Packet","ImagePath",0x00020000,"system32
|
|||
HKLM,"SYSTEM\CurrentControlSet\Services\Packet","Start",0x00010001,0x00000004
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Packet","Type",0x00010001,0x00000001
|
||||
; NOTE: These settings should be added by the network setup
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Packet\Linkage","Bind",0x00020000,"\Device\ne2000"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Packet\Linkage","Bind",0x00020000,"\Device\Ne20001"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Packet\Linkage","Export",0x00020000,"\Device\packet"
|
||||
|
||||
; Private ICE driver
|
||||
|
@ -321,9 +321,12 @@ HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip","ImagePath",0x00020000,"system32\
|
|||
HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip","Start",0x00010001,0x00000002
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip","Type",0x00010001,0x00000001
|
||||
; NOTE: These settings should be added by the network setup
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Linkage","Bind",0x00020000,"\Device\ne2000"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Linkage","Export",0x00020000,"\Device\tcpip"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Linkage","Route",0x00020000,""
|
||||
; These bindings are of the windows 2000 type, and will probably need to be
|
||||
; twiddled to get 3rd-party network-related software to work.
|
||||
; NT4 puts additional stuff in the Bind, Export, and Route values.
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Linkage","Bind",0x00020000,"\Device\Ne20001"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Linkage","Export",0x00020000,"\Device\Tcpip_Ne20001"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Linkage","Route",0x00020000,"Ne20001"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters","DataBasePath",0x00000000,"DataBasePath"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters","Domain",0x00000000,""
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters","Hostname",0x00000000,"ROSHost"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $Id: Makefile,v 1.16 2003/07/30 22:11:20 royce Exp $
|
||||
# $Id: Makefile,v 1.17 2003/08/04 19:31:05 royce Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
|
@ -6,7 +6,7 @@ TARGET_TYPE = export_driver
|
|||
|
||||
TARGET_NAME = ndis
|
||||
|
||||
TARGET_CFLAGS = -I./include -DNDIS_WRAPPER
|
||||
TARGET_CFLAGS = -I./include -DNDIS_WRAPPER -DDBG=1
|
||||
|
||||
TARGET_OBJECTS = \
|
||||
ndis/main.o \
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include <ndissys.h>
|
||||
#include <net/ndis.h>
|
||||
#include "../include/miniport.h"
|
||||
//#include <miniport.h>
|
||||
|
||||
|
||||
typedef struct _PROTOCOL_BINDING {
|
||||
|
|
|
@ -15,6 +15,12 @@
|
|||
* had to be created to allow for resource tracking. This means that Miniports cannot just
|
||||
* pass this NDIS_HANDLE to things like ZwQueryValueKey(). I don't thknk they do (they
|
||||
* certainly should not), but it should be kept in mind.
|
||||
* UPDATE: I just found this in the NTDDK:
|
||||
* NdisOpenProtocolConfiguration returns a handle for the
|
||||
* HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\NICDriverInstance\Parameters\ProtocolName
|
||||
* registry key. XXX This is a problem. Following that, the DDK instructs programmers
|
||||
* to use NdisReadConfiguration and NdisWriteConfiguration. No telling what the world's idiots
|
||||
* have done with this.
|
||||
* - I have tried to stick to the DDK's definition of what return values are possible, which
|
||||
* has resulted in stupid return values in some cases. I do use STATUS_RESOURCES in a few
|
||||
* places that the DDK doesn't explicitly mention it, though.
|
||||
|
@ -221,7 +227,7 @@ NdisOpenProtocolConfiguration(
|
|||
* NDIS_STATUS_SUCCESS: the operation was a success
|
||||
* NDIS_STATUS_FAILURE: the operation was not a success
|
||||
* NOTES:
|
||||
* I think this is the parameters key; please verify.
|
||||
* I think this is the per-device (adapter) parameters\{ProtocolName} key; please verify.
|
||||
*/
|
||||
{
|
||||
OBJECT_ATTRIBUTES KeyAttributes;
|
||||
|
@ -540,7 +546,7 @@ NdisReadConfiguration(
|
|||
|
||||
MiniportResource->ResourceType = 0;
|
||||
MiniportResource->Resource = *ParameterValue;
|
||||
NDIS_DbgPrint(MID_TRACK,("inserting 0x%x into the resource list\n", MiniportResource->Resource));
|
||||
NDIS_DbgPrint(MID_TRACE,("inserting 0x%x into the resource list\n", MiniportResource->Resource));
|
||||
ExInterlockedInsertTailList(&ConfigurationContext->ResourceListHead, &MiniportResource->ListEntry, &ConfigurationContext->ResourceLock);
|
||||
|
||||
memcpy(RegData, KeyInformation->Data, KeyInformation->DataLength);
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#ifdef DBG
|
||||
|
||||
/* See debug.h for debug/trace constants */
|
||||
//DWORD DebugTraceLevel = 0xffffffff;
|
||||
DWORD DebugTraceLevel = MIN_TRACE;
|
||||
|
||||
#endif /* DBG */
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* REVISIONS:
|
||||
* CSH 01/08-2000 Created
|
||||
*/
|
||||
#define DBG
|
||||
//#define DBG
|
||||
#include <miniport.h>
|
||||
#include <protocol.h>
|
||||
#ifdef DBG
|
||||
|
@ -17,7 +17,7 @@
|
|||
#ifdef DBG
|
||||
/* See debug.h for debug/trace constants */
|
||||
//ULONG DebugTraceLevel = MIN_TRACE;
|
||||
ULONG DebugTraceLevel = (MAX_TRACE + DEBUG_MINIPORT);
|
||||
//ULONG DebugTraceLevel = -1
|
||||
#endif /* DBG */
|
||||
|
||||
#define SERVICES_ROOT L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\"
|
||||
|
|
|
@ -16,6 +16,37 @@
|
|||
LIST_ENTRY ProtocolListHead;
|
||||
KSPIN_LOCK ProtocolListLock;
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
VOID
|
||||
EXPORT
|
||||
NdisCompleteBindAdapter(
|
||||
IN NDIS_HANDLE BindAdapterContext,
|
||||
IN NDIS_STATUS Status,
|
||||
IN NDIS_STATUS OpenStatus)
|
||||
/*
|
||||
* FUNCTION: Indicates a packet to bound protocols
|
||||
* ARGUMENTS:
|
||||
* Adapter = Pointer to logical adapter
|
||||
* Packet = Pointer to packet to indicate
|
||||
* RETURNS:
|
||||
* Status of operation
|
||||
*/
|
||||
{
|
||||
/*
|
||||
* XXX partially-implemented!
|
||||
*
|
||||
* need to handle error conditions, and i'm not sure this is even what this func should do.
|
||||
* be sure to fix NdisRegisterProtocol before fixing this, though.
|
||||
*/
|
||||
|
||||
PROTOCOL_BINDING *Protocol = (PROTOCOL_BINDING *)BindAdapterContext;
|
||||
|
||||
/* Put protocol binding struct on global list */
|
||||
ExInterlockedInsertTailList(&ProtocolListHead, &Protocol->ListEntry, &ProtocolListLock);
|
||||
}
|
||||
|
||||
|
||||
NDIS_STATUS
|
||||
ProIndicatePacket(
|
||||
|
@ -450,11 +481,15 @@ NdisOpenAdapter(
|
|||
AdapterBinding->NdisOpenBlock.SendPacketsHandler = ProSendPackets;
|
||||
AdapterBinding->NdisOpenBlock.TransferDataHandler = ProTransferData;
|
||||
|
||||
#if 0
|
||||
/* XXX this looks fishy */
|
||||
/* OK, this really *is* fishy - it bugchecks */
|
||||
/* Put on protocol's bound adapters list */
|
||||
ExInterlockedInsertTailList(&Protocol->AdapterListHead,
|
||||
&AdapterBinding->ProtocolListEntry,
|
||||
&Protocol->Lock);
|
||||
|
||||
#endif
|
||||
/* XXX so does this */
|
||||
/* Put protocol on adapter's bound protocols list */
|
||||
ExInterlockedInsertTailList(&Adapter->ProtocolListHead,
|
||||
&AdapterBinding->AdapterListEntry,
|
||||
|
@ -483,16 +518,23 @@ NdisRegisterProtocol(
|
|||
* NdisProtocolHandle = Address of buffer for handle used to identify the driver
|
||||
* ProtocolCharacteristics = Pointer to NDIS_PROTOCOL_CHARACTERISTICS structure
|
||||
* CharacteristicsLength = Size of structure which ProtocolCharacteristics targets
|
||||
* TODO:
|
||||
* break this function up
|
||||
* make this thing able to handle >1 protocol
|
||||
*/
|
||||
{
|
||||
PPROTOCOL_BINDING Protocol;
|
||||
NTSTATUS NtStatus;
|
||||
UINT MinSize;
|
||||
HANDLE DriverKeyHandle = NULL;
|
||||
PKEY_VALUE_PARTIAL_INFORMATION KeyInformation = NULL;
|
||||
UINT DataOffset = 0;
|
||||
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
|
||||
|
||||
switch (ProtocolCharacteristics->MajorNdisVersion) {
|
||||
case 0x03:
|
||||
case 0x03: /* we don't really want to support ndis3 drivers - so we complainf or now */
|
||||
NDIS_DbgPrint(MID_TRACE, ("Ndis 3 protocol attempting to register\n"));
|
||||
MinSize = sizeof(NDIS30_PROTOCOL_CHARACTERISTICS_S);
|
||||
break;
|
||||
|
||||
|
@ -506,6 +548,7 @@ NdisRegisterProtocol(
|
|||
|
||||
default:
|
||||
*Status = NDIS_STATUS_BAD_VERSION;
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Incorrect characteristics size\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -541,10 +584,171 @@ NdisRegisterProtocol(
|
|||
|
||||
InitializeListHead(&Protocol->AdapterListHead);
|
||||
|
||||
/* Put protocol binding on global list */
|
||||
ExInterlockedInsertTailList(&ProtocolListHead,
|
||||
&Protocol->ListEntry,
|
||||
&ProtocolListLock);
|
||||
/*
|
||||
* bind the adapter to all of its miniports
|
||||
*
|
||||
* open registry path
|
||||
* get list of devices from Bind key
|
||||
* call BindAdapterHandler for each
|
||||
*/
|
||||
{
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
UNICODE_STRING RegistryPath;
|
||||
WCHAR *RegistryPathStr;
|
||||
|
||||
#define SERVICES_KEY L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\"
|
||||
#define LINKAGE_KEY L"\\Linkage"
|
||||
|
||||
RegistryPathStr = ExAllocatePool(PagedPool,
|
||||
sizeof(SERVICES_KEY) + ProtocolCharacteristics->Name.Length + sizeof(LINKAGE_KEY));
|
||||
if(!RegistryPathStr)
|
||||
{
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
|
||||
ExFreePool(Protocol);
|
||||
*Status = NDIS_STATUS_RESOURCES;
|
||||
return;
|
||||
}
|
||||
|
||||
wcscpy(RegistryPathStr, SERVICES_KEY);
|
||||
wcsncat(RegistryPathStr, ((WCHAR *)ProtocolCharacteristics->Name.Buffer),
|
||||
ProtocolCharacteristics->Name.Length);
|
||||
RegistryPathStr[wcslen(SERVICES_KEY)+ProtocolCharacteristics->Name.Length/sizeof(WCHAR)] = 0;
|
||||
wcscat(RegistryPathStr, LINKAGE_KEY);
|
||||
|
||||
RtlInitUnicodeString(&RegistryPath, RegistryPathStr);
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Opening configuration key: %wZ\n", &RegistryPath));
|
||||
|
||||
InitializeObjectAttributes(&ObjectAttributes, &RegistryPath, OBJ_CASE_INSENSITIVE, NULL, NULL);
|
||||
NtStatus = ZwOpenKey(&DriverKeyHandle, KEY_READ, &ObjectAttributes);
|
||||
|
||||
ExFreePool(RegistryPathStr);
|
||||
|
||||
if(!NT_SUCCESS(NtStatus))
|
||||
{
|
||||
NDIS_DbgPrint(MID_TRACE, ("Unable to open protocol configuration\n"));
|
||||
ExFreePool(Protocol);
|
||||
*Status = NDIS_STATUS_FAILURE;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Successfully opened the registry configuration\n"));
|
||||
|
||||
{
|
||||
UNICODE_STRING ValueName;
|
||||
ULONG Length;
|
||||
ULONG ResultLength;
|
||||
|
||||
RtlInitUnicodeString(&ValueName, L"Bind");
|
||||
|
||||
NtStatus = ZwQueryValueKey(DriverKeyHandle, &ValueName, KeyValuePartialInformation, NULL, 0, &ResultLength);
|
||||
if(NtStatus != STATUS_BUFFER_OVERFLOW && NtStatus != STATUS_BUFFER_TOO_SMALL)
|
||||
{
|
||||
NDIS_DbgPrint(MID_TRACE, ("Unable to query the Bind value for size\n"));
|
||||
ZwClose(DriverKeyHandle);
|
||||
ExFreePool(Protocol);
|
||||
*Status = NDIS_STATUS_FAILURE;
|
||||
return;
|
||||
}
|
||||
|
||||
KeyInformation = ExAllocatePool(PagedPool, sizeof(KEY_VALUE_PARTIAL_INFORMATION) + ResultLength);
|
||||
if(!KeyInformation)
|
||||
{
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
|
||||
ZwClose(DriverKeyHandle);
|
||||
ExFreePool(Protocol);
|
||||
*Status = NDIS_STATUS_FAILURE;
|
||||
return;
|
||||
}
|
||||
|
||||
NtStatus = ZwQueryValueKey(DriverKeyHandle, &ValueName, KeyValuePartialInformation, KeyInformation,
|
||||
sizeof(KEY_VALUE_PARTIAL_INFORMATION) + ResultLength, &ResultLength);
|
||||
|
||||
if(!NT_SUCCESS(NtStatus))
|
||||
{
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Unable to query the Bind value\n"));
|
||||
ZwClose(DriverKeyHandle);
|
||||
ExFreePool(KeyInformation);
|
||||
ExFreePool(Protocol);
|
||||
*Status = NDIS_STATUS_FAILURE;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
DataOffset = 0;
|
||||
while((KeyInformation->Data)[DataOffset])
|
||||
{
|
||||
/* BindContext is for tracking pending binding operations */
|
||||
VOID *BindContext = 0;
|
||||
NDIS_STRING DeviceName;
|
||||
NDIS_STRING RegistryPath;
|
||||
WCHAR *RegistryPathStr = NULL;
|
||||
ULONG PathLength = 0;
|
||||
|
||||
RtlInitUnicodeString(&DeviceName, (WCHAR *)KeyInformation->Data); /* we know this is 0-term */
|
||||
|
||||
/*
|
||||
* RegistryPath should be:
|
||||
* \Registry\Machine\System\CurrentControlSet\Services\Nic1\Parameters\Tcpip
|
||||
*
|
||||
* This is constructed as follows:
|
||||
* SERVICES_KEY + extracted device name + Protocol name from characteristics
|
||||
*/
|
||||
#define PARAMETERS_KEY L"\\Parameters\\"
|
||||
|
||||
PathLength = sizeof(SERVICES_KEY) + /* \Registry\Machine\System\CurrentControlSet\Services\ */
|
||||
wcslen( ((WCHAR *)KeyInformation->Data)+8 ) * sizeof(WCHAR) + /* Adapter1 (extracted from \Device\Adapter1) */
|
||||
sizeof(PARAMETERS_KEY) + /* \Parameters\ */
|
||||
ProtocolCharacteristics->Name.Length; /* Tcpip */
|
||||
|
||||
RegistryPathStr = ExAllocatePool(PagedPool, PathLength);
|
||||
if(!RegistryPathStr)
|
||||
{
|
||||
NDIS_DbgPrint(MIN_TRACE, ("insufficient resources.\n"));
|
||||
ExFreePool(KeyInformation);
|
||||
ExFreePool(Protocol);
|
||||
*Status = NDIS_STATUS_RESOURCES;
|
||||
return;
|
||||
}
|
||||
|
||||
wcscpy(RegistryPathStr, SERVICES_KEY);
|
||||
wcscat(RegistryPathStr, (((WCHAR *)(KeyInformation->Data)) +8 ));
|
||||
wcscat(RegistryPathStr, PARAMETERS_KEY);
|
||||
wcsncat(RegistryPathStr, ProtocolCharacteristics->Name.Buffer, ProtocolCharacteristics->Name.Length);
|
||||
|
||||
RegistryPathStr[PathLength/sizeof(WCHAR)] = 0;
|
||||
|
||||
RtlInitUnicodeString(&RegistryPath, RegistryPathStr);
|
||||
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Calling protocol's BindAdapter handler with DeviceName %wZ and RegistryPath %wZ\n",
|
||||
&DeviceName, &RegistryPath));
|
||||
|
||||
/* XXX SD must do something with bind context */
|
||||
{
|
||||
BIND_HANDLER BindHandler = ProtocolCharacteristics->BindAdapterHandler;
|
||||
if(BindHandler)
|
||||
BindHandler(Status, BindContext, &DeviceName, &RegistryPath, 0);
|
||||
else
|
||||
NDIS_DbgPrint(MID_TRACE, ("No protocol bind handler specified\n"));
|
||||
}
|
||||
/*
|
||||
(*(Protocol->Chars.BindAdapterHandler))(Status, BindContext, &DeviceName, &RegistryPath, 0);
|
||||
*/
|
||||
|
||||
if(*Status == NDIS_STATUS_SUCCESS)
|
||||
{
|
||||
/* Put protocol binding struct on global list */
|
||||
ExInterlockedInsertTailList(&ProtocolListHead, &Protocol->ListEntry, &ProtocolListLock);
|
||||
}
|
||||
/*
|
||||
else if(*Status != NDIS_STATUS_PENDING)
|
||||
{
|
||||
// what to do here?
|
||||
}
|
||||
*/
|
||||
|
||||
DataOffset += wcslen((WCHAR *)KeyInformation->Data);
|
||||
}
|
||||
|
||||
*NdisProtocolHandle = Protocol;
|
||||
*Status = NDIS_STATUS_SUCCESS;
|
||||
|
|
|
@ -9,19 +9,6 @@
|
|||
*/
|
||||
#include <ndissys.h>
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
VOID
|
||||
EXPORT
|
||||
NdisCompleteBindAdapter(
|
||||
IN NDIS_HANDLE BindAdapterContext,
|
||||
IN NDIS_STATUS Status,
|
||||
IN NDIS_STATUS OpenStatus)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
|
@ -177,7 +164,10 @@ NdisWriteErrorLogEntry(
|
|||
* ERROR_LOG_MAXIMUM_SIZE = ... in MSDN
|
||||
*/
|
||||
{
|
||||
/*
|
||||
* let's just try not doing anything at all
|
||||
UNIMPLEMENTED
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
@ -888,9 +878,14 @@ NdisWriteEventLogEntry(
|
|||
* NDIS 5.0
|
||||
*/
|
||||
{
|
||||
/*
|
||||
* gonna try just returning true
|
||||
*
|
||||
UNIMPLEMENTED
|
||||
|
||||
return NDIS_STATUS_FAILURE;
|
||||
*/
|
||||
return NDIS_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -485,6 +485,29 @@ VOID ProtocolStatusComplete(
|
|||
TI_DbgPrint(DEBUG_DATALINK, ("Called.\n"));
|
||||
}
|
||||
|
||||
VOID ProtocolBindAdapter(
|
||||
OUT PNDIS_STATUS Status,
|
||||
IN NDIS_HANDLE BindContext,
|
||||
IN PNDIS_STRING DeviceName,
|
||||
IN PVOID SystemSpecific1,
|
||||
IN PVOID SystemSpecific2)
|
||||
/*
|
||||
* FUNCTION: Called by NDIS during NdisRegisterProtocol to set up initial
|
||||
* bindings, and periodically thereafer as new adapters come online
|
||||
* ARGUMENTS:
|
||||
* Status: Return value to NDIS
|
||||
* BindContext: Handle provided by NDIS to track pending binding operations
|
||||
* DeviceName: Name of the miniport device to bind to
|
||||
* SystemSpecific1: Pointer to a registry path with protocol-specific configuration information
|
||||
* SystemSpecific2: Unused
|
||||
*/
|
||||
{
|
||||
/* we get to ignore BindContext because we will never pend an operation with NDIS */
|
||||
DbgPrint(("tcpip!ProtocolBindAdapter called\n"));
|
||||
TI_DbgPrint(DEBUG_DATALINK, ("Called.\n"));
|
||||
*Status = LANRegisterAdapter(DeviceName);
|
||||
}
|
||||
|
||||
|
||||
VOID LANTransmit(
|
||||
PVOID Context,
|
||||
|
@ -634,6 +657,7 @@ VOID BindAdapter(
|
|||
/* FIXME: Get address from registry.
|
||||
For now just use a private address, eg. 10.0.0.100 */
|
||||
Address = AddrBuildIPv4(0x6400000A);
|
||||
// Address = AddrBuildIPv4(0x6048F2D1); // 209.242.72.96
|
||||
if (!Address) {
|
||||
TI_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
|
||||
FreeTDPackets(Adapter);
|
||||
|
@ -698,8 +722,7 @@ VOID UnbindAdapter(
|
|||
|
||||
|
||||
NDIS_STATUS LANRegisterAdapter(
|
||||
PNDIS_STRING AdapterName,
|
||||
PLAN_ADAPTER *Adapter)
|
||||
PNDIS_STRING AdapterName)
|
||||
/*
|
||||
* FUNCTION: Registers protocol with an NDIS adapter
|
||||
* ARGUMENTS:
|
||||
|
@ -845,8 +868,6 @@ NDIS_STATUS LANRegisterAdapter(
|
|||
/* Convert returned link speed to bps (it is in 100bps increments) */
|
||||
IF->Speed = Speed * 100L;
|
||||
|
||||
*Adapter = IF;
|
||||
|
||||
/* Add adapter to the adapter list */
|
||||
ExInterlockedInsertTailList(&AdapterListHead,
|
||||
&IF->ListEntry,
|
||||
|
@ -908,7 +929,7 @@ NDIS_STATUS LANUnregisterAdapter(
|
|||
|
||||
|
||||
NTSTATUS LANRegisterProtocol(
|
||||
PSTRING Name)
|
||||
PNDIS_STRING Name)
|
||||
/*
|
||||
* FUNCTION: Registers this protocol driver with NDIS
|
||||
* ARGUMENTS:
|
||||
|
@ -930,7 +951,8 @@ NTSTATUS LANRegisterProtocol(
|
|||
ProtChars.MajorNdisVersion = NDIS_VERSION_MAJOR;
|
||||
ProtChars.MinorNdisVersion = NDIS_VERSION_MINOR;
|
||||
ProtChars.Name.Length = Name->Length;
|
||||
ProtChars.Name.Buffer = (PVOID)Name->Buffer;
|
||||
ProtChars.Name.Buffer = Name->Buffer;
|
||||
ProtChars.Name.MaximumLength = Name->MaximumLength;
|
||||
ProtChars.OpenAdapterCompleteHandler = ProtocolOpenAdapterComplete;
|
||||
ProtChars.CloseAdapterCompleteHandler = ProtocolCloseAdapterComplete;
|
||||
ProtChars.ResetCompleteHandler = ProtocolResetComplete;
|
||||
|
@ -941,14 +963,18 @@ NTSTATUS LANRegisterProtocol(
|
|||
ProtChars.ReceiveCompleteHandler = ProtocolReceiveComplete;
|
||||
ProtChars.StatusHandler = ProtocolStatus;
|
||||
ProtChars.StatusCompleteHandler = ProtocolStatusComplete;
|
||||
ProtChars.BindAdapterHandler = ProtocolBindAdapter;
|
||||
|
||||
/* Try to register protocol */
|
||||
NdisRegisterProtocol(&NdisStatus,
|
||||
&NdisProtocolHandle,
|
||||
&ProtChars,
|
||||
sizeof(NDIS_PROTOCOL_CHARACTERISTICS) + Name->Length);
|
||||
sizeof(NDIS_PROTOCOL_CHARACTERISTICS));
|
||||
if (NdisStatus != NDIS_STATUS_SUCCESS)
|
||||
{
|
||||
TI_DbgPrint(MID_TRACE, ("NdisRegisterProtocol failed, status 0x%x\n", NdisStatus));
|
||||
return (NTSTATUS)NdisStatus;
|
||||
}
|
||||
|
||||
ProtocolRegistered = TRUE;
|
||||
|
||||
|
|
|
@ -81,14 +81,13 @@ typedef struct LAN_ADAPTER {
|
|||
|
||||
|
||||
NDIS_STATUS LANRegisterAdapter(
|
||||
PNDIS_STRING AdapterName,
|
||||
PLAN_ADAPTER *Adapter);
|
||||
PNDIS_STRING AdapterName);
|
||||
|
||||
NDIS_STATUS LANUnregisterAdapter(
|
||||
PLAN_ADAPTER Adapter);
|
||||
|
||||
NTSTATUS LANRegisterProtocol(
|
||||
STRING *Name);
|
||||
PNDIS_STRING Name);
|
||||
|
||||
VOID LANUnregisterProtocol(
|
||||
VOID);
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#define __TICONSTS_H
|
||||
|
||||
/* NDIS version this driver supports */
|
||||
#define NDIS_VERSION_MAJOR 3
|
||||
#define NDIS_VERSION_MAJOR 4
|
||||
#define NDIS_VERSION_MINOR 0
|
||||
|
||||
#ifdef _NTTEST_
|
||||
|
@ -19,7 +19,7 @@
|
|||
#define DD_RAWIP_DEVICE_NAME L"\\Device\\NTRawIp"
|
||||
|
||||
/* For NDIS protocol registration */
|
||||
#define IP_DEVICE_NAME "\\Device\\NTIp"
|
||||
#define IP_DEVICE_NAME L"\\Device\\NTIp"
|
||||
#else
|
||||
#define DD_TCP_DEVICE_NAME L"\\Device\\Tcp"
|
||||
#define DD_UDP_DEVICE_NAME L"\\Device\\Udp"
|
||||
|
@ -27,7 +27,9 @@
|
|||
#define DD_RAWIP_DEVICE_NAME L"\\Device\\RawIp"
|
||||
|
||||
/* For NDIS protocol registration */
|
||||
#define IP_DEVICE_NAME "\\Device\\Ip"
|
||||
/* The DDK says you have to register with the name that's regstered with SCM, e.g. tcpip */
|
||||
#define IP_DEVICE_NAME L"\\Device\\Ip"
|
||||
#define TCPIP_PROTOCOL_NAME L"Tcpip"
|
||||
#endif /* _NTTEST_ */
|
||||
|
||||
/* TCP/UDP/RawIP IOCTL code definitions */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $Id: makefile,v 1.12 2003/01/15 21:57:31 chorns Exp $
|
||||
# $Id: makefile,v 1.13 2003/08/04 19:31:06 royce Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
|
@ -6,7 +6,7 @@ TARGET_TYPE = export_driver
|
|||
|
||||
TARGET_NAME = tcpip
|
||||
|
||||
TARGET_CFLAGS = -I./include -DDBG
|
||||
TARGET_CFLAGS = -I./include -DDBG=1 -DNDIS40
|
||||
|
||||
TARGET_DDKLIBS = ndis.a
|
||||
|
||||
|
|
|
@ -16,20 +16,8 @@
|
|||
#include <udp.h>
|
||||
#include <tcp.h>
|
||||
|
||||
//#define _USE_NE2000
|
||||
|
||||
#ifdef DBG
|
||||
|
||||
/* See debug.h for debug/trace constants */
|
||||
#ifdef _USE_NE2000
|
||||
DWORD DebugTraceLevel = MID_TRACE;
|
||||
//DWORD DebugTraceLevel = (MAX_TRACE + DEBUG_DATALINK);
|
||||
#else
|
||||
DWORD DebugTraceLevel = MIN_TRACE;
|
||||
//DWORD DebugTraceLevel = MAX_TRACE;
|
||||
//DWORD DebugTraceLevel = DEBUG_ULTRA;
|
||||
#endif
|
||||
|
||||
#endif /* DBG */
|
||||
|
||||
PDEVICE_OBJECT TCPDeviceObject = NULL;
|
||||
|
@ -714,13 +702,14 @@ DriverEntry(
|
|||
{
|
||||
NTSTATUS Status;
|
||||
UNICODE_STRING strDeviceName;
|
||||
STRING strNdisDeviceName;
|
||||
UNICODE_STRING strNdisDeviceName;
|
||||
NDIS_STATUS NdisStatus;
|
||||
PLAN_ADAPTER Adapter;
|
||||
NDIS_STRING DeviceName;
|
||||
|
||||
TI_DbgPrint(MAX_TRACE, ("Called.\n"));
|
||||
|
||||
/* TdiInitialize() ? */
|
||||
|
||||
/* FIXME: Create symbolic links in Win32 namespace */
|
||||
|
||||
/* Create IP device object */
|
||||
|
@ -798,9 +787,11 @@ DriverEntry(
|
|||
TCPStartup();
|
||||
|
||||
/* Register protocol with NDIS */
|
||||
RtlInitString(&strNdisDeviceName, IP_DEVICE_NAME);
|
||||
/* This used to be IP_DEVICE_NAME but the DDK says it has to match your entry in the SCM */
|
||||
RtlInitUnicodeString(&strNdisDeviceName, TCPIP_PROTOCOL_NAME);
|
||||
Status = LANRegisterProtocol(&strNdisDeviceName);
|
||||
if (!NT_SUCCESS(Status)) {
|
||||
TI_DbgPrint(MIN_TRACE,("Failed to register protocol with NDIS; status 0x%x\n", Status));
|
||||
TiWriteErrorLog(
|
||||
DriverObject,
|
||||
EVENT_TRANSPORT_REGISTER_FAILED,
|
||||
|
@ -820,41 +811,10 @@ DriverEntry(
|
|||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
/* Open underlying adapter(s) we are bound to */
|
||||
|
||||
/* FIXME: Get binding information from registry */
|
||||
|
||||
/* Put your own NDIS adapter device name here */
|
||||
#ifdef _USE_NE2000
|
||||
/* ReactOS */
|
||||
NdisInitUnicodeString(&DeviceName, L"\\Device\\ne2000");
|
||||
|
||||
/* NT4 style */
|
||||
//NdisInitUnicodeString(&DeviceName, L"\\Device\\El90x1");
|
||||
|
||||
/* NT5 style */
|
||||
//NdisInitUnicodeString(&DeviceName, L"\\Device\\{56388B49-67BB-4419-A3F4-28DF190B9149}");
|
||||
|
||||
NdisStatus = LANRegisterAdapter(&DeviceName, &Adapter);
|
||||
|
||||
/* Skip network adapter if it does not exist */
|
||||
if (!NT_SUCCESS(NdisStatus)) {
|
||||
TI_DbgPrint(MIN_TRACE, ("Failed to intialize adapter. Status (0x%X).\n", Status));
|
||||
TiWriteErrorLog(
|
||||
DriverObject,
|
||||
EVENT_TRANSPORT_ADAPTER_NOT_FOUND,
|
||||
TI_ERROR_DRIVERENTRY,
|
||||
NdisStatus,
|
||||
NULL,
|
||||
0,
|
||||
NULL);
|
||||
TiUnload(DriverObject);
|
||||
return STATUS_DEVICE_DOES_NOT_EXIST;
|
||||
}
|
||||
#endif
|
||||
/* Setup network layer and transport layer entities */
|
||||
EntityList = ExAllocatePool(NonPagedPool, sizeof(TDIEntityID) * 2);
|
||||
if (!NT_SUCCESS(Status)) {
|
||||
TI_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
|
||||
TiUnload(DriverObject);
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue