You are not correctly initializing the structure. Here is what needs
to be done…
//
// Set up information for StorPortInitialize.
//
RtlZeroMemory(&OsrHwInitData,
sizeof(VIRTUAL_HW_INITIALIZATION_DATA));
OsrHwInitData.HwInitializationDataSize =
sizeof(VIRTUAL_HW_INITIALIZATION_DATA);
//
// Set up our entry points (callbacks).
//
OsrHwInitData.HwInitialize = OsrHwInitialize; //
Required.
OsrHwInitData.HwStartIo = OsrHwStartIo; //
Required.
OsrHwInitData.HwFindAdapter = OsrHwFindAdapter; //
Required.
OsrHwInitData.HwResetBus = OsrHwResetBus; //
Required.
OsrHwInitData.HwAdapterControl = OsrHwAdapterControl; //
Required.
OsrHwInitData.HwFreeAdapterResources = OsrHwFreeAdapterResources;
OsrHwInitData.HwProcessServiceRequest = OsrHwProcessServiceRequest;
OsrHwInitData.HwCompleteServiceIrp =
OsrHwCompleteServiceRequest;
OsrHwInitData.AdapterInterfaceType = Internal;
OsrHwInitData.MultipleRequestPerLu = TRUE;
OsrHwInitData.PortVersionFlags = 0;
OsrHwInitData.DeviceExtensionSize =
sizeof(HW_DEVICE_EXTENSION);
OsrHwInitData.SpecificLuExtensionSize = sizeof(HW_LU_EXTENSION);
OsrHwInitData.SrbExtensionSize = sizeof(HW_SRB_EXTENSION) +
OsrUserGetSrbExtensionSize();
status = StorPortInitialize(DriverObject,
RegistryPath,
(PHW_INITIALIZATION_DATA)&OsrHwInitData,
NULL);
if (STATUS_SUCCESS!=status) { // Port driver
said not OK?
OsrTracePrint(TRACE_LEVEL_ERROR,OSRVMINIPT_DEBUG_FUNCTRACE,
(“DriverEntry failure in call to
StorPortInitialize. status:0x%x\n”,status));
ExFreePool(OsrRegistryPath.Buffer);
ASSERT(FALSE);
return status;
}
–Mark Cariddi
OSR, Open Systems Resources, Inc.
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@EMPIRE.ECLIPSE.NCSC.MIL
Sent: Wednesday, October 28, 2009 10:46 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Problems / Questions about Storport.sys driver
We are trying to just write a basic driver that does nothing that we can
load into storport.sys correctly.
When we call StorportInitialize() we should see storport calling our
FindAdapter() function but this does not happen. The SCM reports the
driver is loaded successfully yet Storport does not call FindAdapter().
Any ideas. See code below.
#include “ntddk.h”
#include “storport.h”
typedef struct _DEVICE_EXTENSION
{
ULONG data;
} DEVICE_EXTENSION, *PDEVICE_EXTENSION;
typedef struct _SRB_EXTENSION
{
ULONG data;
} SRB_EXTENSION, *PSRB_EXTENSION;
NTSTATUS DriverEntry( PDRIVER_OBJECT driverObj , PUNICODE_STRING regPath
)
{
VIRTUAL_HW_INITIALIZATION_DATA virtdata;
ULONG i;
virtdata.HwInitialize = vInitialize
virtdata.HwInitialize = vInitialize
virtdata.HwFindAdapter = vFindAdapter
virtdata.AdapterInterfaceType = Internal
status = StorportInitialize( driverObj, regPath,
(PHW_INITIALIZATION_DATA) &virtdata, NULL );
}
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer