I wanted to do a post-mortem on this problem.
Jose, the suggestion you offered is good, but it doesn’t work for an
NDIS driver, if you want to get signed and not bluescreen.
Basically you cant call NdisMRegisterDevice from driverentry, you have
to call NdisMRegisterDevice from your miniport driver’s callback
initialization function.
I WAS able to get WPP to initialize in win 2k, after trying a few
variations, the only solution that worked was this:
NDIS_STATUS
RegisterIOCTLInterface(VOID)
{
NDIS_STATUS Status = NDIS_STATUS_SUCCESS;
UNICODE_STRING DeviceName;
UNICODE_STRING DeviceLinkUnicodeString;
PDRIVER_DISPATCH DispatchTable[IRP_MJ_MAXIMUM_FUNCTION+1];
RLDebugLoud(“==>PtRegisterDevice\n”);
MUX_ACQUIRE_MUTEX(&ControlDeviceMutex);
++MiniportCount;
if (1 == MiniportCount)
{
NdisZeroMemory(DispatchTable, (IRP_MJ_MAXIMUM_FUNCTION+1) *
sizeof(PDRIVER_DISPATCH));
DispatchTable[IRP_MJ_CREATE] = IrpHandler;
DispatchTable[IRP_MJ_CLEANUP] = IrpHandler;
DispatchTable[IRP_MJ_CLOSE] = IrpHandler;
DispatchTable[IRP_MJ_DEVICE_CONTROL] = IrpHandler;
NdisInitUnicodeString(&DeviceName, NTDEVICE_STRING);
NdisInitUnicodeString(&DeviceLinkUnicodeString,
LINKNAME_STRING);
//
// Create a device object and register our dispatch handlers
//
Status = NdisMRegisterDevice(
G_NdisWrapperHandle,
&DeviceName,
&DeviceLinkUnicodeString,
&DispatchTable[0],
&G_ControlDeviceObject,
&NdisDeviceHandle
);
#ifdef NDIS50
RLInit2KWppTracing(G_ControlDeviceObject,&G_RegistryPath);
RLDebug(MUX_INFO, “WIN2K Debugging enabled”);
#endif
}
MUX_RELEASE_MUTEX(&ControlDeviceMutex);
RLDebug(MUX_INFO, “<==PtRegisterDevice: %x\n”, Status);
return (Status);
}
RegisterIoctlInterface is called from the miniport initialization
function.
I also called this function in from driver entry
void RLInitWppTracing(IN PDRIVER_OBJECT DriverObject,IN PUNICODE_STRING
pRegistryPath)
{
DriverObject;
#ifdef NDIS51
WPP_INIT_TRACING(DriverObject,pRegistryPath);
WppInitialized = TRUE;
#else
WPP_SYSTEMCONTROL(DriverObject);
#endif
}
I left out some code, and my debug functions but people should be able
to get the gist. Thanks for the help and I hope my responses help
someone else.
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Bohannon, Ivan
Sent: Thursday, January 06, 2005 11:15 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] bluescreen with WPP_INIT_TRACING in win2k / NDIS
5.0
Wow seems extreme to do for an NDIS driver at driver entry, but OK
I’ll have to replace those kernel calls with the NDIS equivalents (ex:
NdisMRegisterDevice instead of IoCreateDevice.)
Thanks I’ll give it a whirl.
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Jose Sua
Sent: Thursday, January 06, 2005 10:46 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] bluescreen with WPP_INIT_TRACING in win2k / NDIS
5.0
Look at the sample in the DDK; for W2K you need to create a Device and
use it as the parameter to WPP_INIT_TRACING.
here is a snip of the code:
#if defined(TARGETING_Win2K)
//
// You need to include this macro only on Win2K.
//
WPP_SYSTEMCONTROL(DriverObject);
#endif
RtlInitUnicodeString( &deviceName, TRACEDRV_NT_DEVICE_NAME );
//
// Create the Device object
//
status = IoCreateDevice(
DriverObject,
0,
&deviceName,
FILE_DEVICE_UNKNOWN,
0,
FALSE,
&pTracedrvDeviceObject);
if ( !NT_SUCCESS( status )) {
return status;
}
RtlInitUnicodeString( &linkName, TRACEDRV_WIN32_DEVICE_NAME );
status = IoCreateSymbolicLink( &linkName, &deviceName );
if ( !NT_SUCCESS( status )) {
IoDeleteDevice( pTracedrvDeviceObject );
return status;
}
//
// Choose a buffering mechanism
//
pTracedrvDeviceObject->Flags |= DO_BUFFERED_IO;
#if defined(TARGETING_Win2K)
//
// This macro is required to initialize software tracing.
// For Win2K use the deviceobject as the first argument.
//
WPP_INIT_TRACING(pTracedrvDeviceObject,RegistryPath);
#else
//
// This macro is required to initialize software tracing on XP and
beyond
// For XP and beyond use the DriverObject as the first argument.
//
WPP_INIT_TRACING(DriverObject,RegistryPath);
#endif
Thanks,
Jose Sua
Microsoft Corporation
This posting is provided “AS IS” with no warranties and confers no
rights.
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Bohannon, Ivan
Sent: Thursday, January 06, 2005 7:12 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] bluescreen with WPP_INIT_TRACING in win2k / NDIS 5.0
I’m developing an NDIS 5.1 / NDIS 5.0 Intermediate Mux driver, with a
requirement for WPP Trace support.
The following code snippet (and entire driver) compiles fine for both 2k
and XP, but when installing, my 2k binary bluescreens in driver entry.
Now I know this is a shot in the dark, but on the off chance that this
is a well known problem, I’m going public with my dirty laundry.
I’ve tested the wpp trace messages produced with the XP version of this
driver, and every thing is ok. I’m wondering if NDIS drivers are a
special case under windows 2000. Anyhow thanks for reading, oh and if
someone else needs some help with an NDIS driver give me a shout.
NTSTATUS
DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING
RegistryPath)
{
NdisMInitializeWrapper(&G_NdisWrapperHandle, DriverObject,
RegistryPath, NULL);
#ifdef NDIS51
WPP_INIT_TRACING(DriverObject,RegistryPath);
#else
WPP_SYSTEMCONTROL(DriverObject);
WPP_INIT_TRACING(DriverObject->DeviceObject,RegistryPath);
//bluescreens here on 2k.
#endif
DoTraceMessage(wMUX_INFO, “DriverEntry, Debugging
enabled”);
…
sources
…
!if “$(DDK_TARGET_OS)”==“Win2K”
RUN_WPP= $(SOURCES) -km -gen:{km-w2k.tpl}*.tmh
!else
RUN_WPP= $(SOURCES) -km
!endif
…
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: unknown lmsubst tag argument:
‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: unknown lmsubst tag argument:
‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: unknown lmsubst tag argument:
‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com