MiniportInitialize()

Hi. Can anyone take a quick glimpse to this. I’m a novice in driver development and I’m trying to understand why the MiniportInitialize() function is not invoked by Ndis…

Thanks
Matt

VOID
PTBindAdapter(
OUT PNDIS_STATUS Status,
IN NDIS_HANDLE BindContext,
IN PNDIS_STRING DeviceName,
IN PVOID SystemSpecific1,
IN PVOID SystemSpecific2
)
{

NDIS_STATUS OpenAdapterStatus;
NDIS_HANDLE BindingHandle;
NDIS_HANDLE ConfigHandle = NULL;
PNDIS_CONFIGURATION_PARAMETER Param;
NDIS_STRING DeviceStr = NDIS_STRING_CONST(“UpperBindings”);
UINT MediumIndex;
PNIC pAdapter;

DBGPRINT(“==> PTBindAdapter()\n”);
do
{

// Retrieve configuration
NdisOpenProtocolConfiguration(Status, &ConfigHandle, SystemSpecific1);
if (*Status != NDIS_STATUS_SUCCESS)
break;

NdisReadConfiguration(Status,
&Param,
ConfigHandle,
&DeviceStr,
NdisParameterString);

if (*Status != NDIS_STATUS_SUCCESS)
break;
NdisCloseConfiguration(ConfigHandle);

#if DEBUG
DbgPrint(“Upperbindings=”);
NdisPrintString(Param->ParameterData.StringData);
DbgPrint(“\n”);
#endif

// Allocate space and initialize the NIC structure
NdisAllocateMemoryWithTag(
&pAdapter,
sizeof(NIC),
‘NN’
);
NdisZeroMemory(pAdapter, sizeof(NIC));
NdisInitializeEvent(&pAdapter->Event);

ASSERT(pAdapter != NULL);

// Open underlying adapters

DBGPRINT(“Opening adapter\n”);

NdisOpenAdapter(
Status,
&OpenAdapterStatus,
&BindingHandle,
&MediumIndex,
MediumArray,
sizeof(MediumArray)/sizeof(NDIS_MEDIUM),
PTHandle,
pAdapter,
DeviceName,
0,
NULL
);

if (*Status == NDIS_STATUS_PENDING)
{
NdisWaitEvent(&pAdapter->Event, 0);
// The system will hang until PTOpenAdapterComplete is invoked
// by NDIS and the Event object will be set.
*Status = pAdapter->Status;
}

if (*Status != NDIS_STATUS_SUCCESS)
break;

// set the favourite Medium type
pAdapter->Medium = MediumArray[MediumIndex];

// Initialize Miniport

DBGPRINT(“Initializing miniport\n”);

*Status =
NdisIMInitializeDeviceInstanceEx(
MPHandle, // MPHandle= returned by NdisIMRegisterLayeredMiniport in DriverEntry
&Param->ParameterData.StringData,
pAdapter
);

if (*Status != NDIS_STATUS_SUCCESS)
break;

}
while(FALSE);

#if DEBUG
if (*Status != NDIS_STATUS_SUCCESS && *Status != STATUS_SUCCESS)
{
DBGPRINT(“ALERT!!: Status != NDIS_STATUS_SUCCESS\n”);
}
#endif
DBGPRINT(“<== PTBindAdapter()\n”);

}

VOID
PTOpenAdapterComplete(
IN NDIS_HANDLE ProtocolBindingContext,
IN NDIS_STATUS Status,
IN NDIS_STATUS OpenErrorStatus
)
{
PNIC pAdapter = (PNIC)ProtocolBindingContext;

DbgPrint(“==> PTOpenAdapterComplete\n”);
pAdapter->Status = Status;
NdisSetEvent(&pAdapter->Event);
DbgPrint(“<== PTOpenAdapterComplete\n”);

}


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com