From: Maxim S. Shatskih on 15 Feb 2007 15:46 > Your driver DLL will be loaded only once, either by the device manager or by > NDIS, but instanciated twice (once for device, once for NDIS.) Note: if both instances of the module refer to the same .SYS file, and if DriverEntry fails for the second load - then a BSOD follows. The reason is that PsLoadedModuleList is indexed by _SYS file names_, not by SC database entries, so, after DriverEntry failure (for the second SC entry), the binary is deleted from the kernel memory (which also deletes the binary which services the first SC entry). -- Maxim Shatskih, Windows DDK MVP StorageCraft Corporation maxim(a)storagecraft.com http://www.storagecraft.com
From: "Remi de Gravelaine" gravelaine at aton dash sys dot on 16 Feb 2007 04:29 Hi, > Note: if both instances of the module refer to the same .SYS file, and if > DriverEntry fails for the second load - then a BSOD follows. > > The reason is that PsLoadedModuleList is indexed by _SYS file names_, not > by SC > database entries, so, after DriverEntry failure (for the second SC entry), > the > binary is deleted from the kernel memory (which also deletes the binary > which > services the first SC entry). I know that this thread is shared between two newsgroups, but my feeling is that it concerns only Windows CE. I am not sure that the kind answers related to the desktop device drivers are useful to the OP here. Remi
From: Arsalan Ahmad on 16 Feb 2007 07:35 Now its working...however I am confused about one thing. If I use ActivateDeviceEx() twice for the same driver dll, once pointing to the registry entry which contains values which shows that my driver is NDIS miniport driver and second time to the registry entry which shows that my driver dll is the stream driver, then whether a single instance of the driver will act both as NDIS miniport and stream driver or not? Also what entries I have to provide to distinguish between an NDIS miniport driver from stream driver? Second question: Instead of calling ActiavateDeviceEx() twice, is it possible that I call it only once for the stream interface and from XXX_Init() function I register my NDIS miniport using NDISMRegisterMiniport()? In that case I need to have access to DriverObject and RegistryPath which I can only get in the DriverEntry() function, so how can I get these two objects here in XXX_Init() function? Thanks, Arsalan "Arsalan Ahmad" <arsalan_ahmad(a)fornntp.com> wrote in message news:50D34E5B-4AA0-47F7-A9CD-44E64BD20ADD(a)microsoft.com... > Thanks, > > Please tell me how can I debug inside my driver dll. Right now calling > RegisterDevice() from my application is returning NULL and I am unable to > understand the cause for it. > > Thanks, > > Arsalan > > "Remi de Gravelaine" <gravelaine at aton dash sys dot fr> wrote in message > news:%23ncM6uSUHHA.4796(a)TK2MSFTNGP05.phx.gbl... >>> So, you mean I have to specify separate registry entries for my driver >>> (one for stream interface and other for NDIS). But does not it mean that >>> the device manager will then load two separate drivers??? >> >> Your driver DLL will be loaded only once, either by the device manager or >> by NDIS, but instanciated twice (once for device, once for NDIS.) >> >>> What if I want to use RegisterDevice() to register my device without >>> requiring a need to create registry entries. So when my application run, >>> it will use RegisterDevice() to install the driver (stream + miniport)? >> >> RegisterDevice is OK, although superseded by ActivateDevice(Ex) >> functions. You may or may not need to setup some Registry keys before the >> stream driver activation. >> >> Remi >> >
From: Stephan Wolf [MVP] on 19 Feb 2007 04:33 Ok, now I understand your concern. I actually did this years ago, i.e., register a stream interface for an NDIS miniport under CE (IIRC, that was CE 4.1): I call ActivateDevice() from MiniportInitialize() with a 'lpszDevKey' of "Comm\\MyDriverName" whwre "MyDriverName" is the base filename of the NDIS miniport driver. In the .DEF file, I add the stream interface functions to the EXPORTS section: MDN_Init MDN_Deinit MDN_Open MDN_Close MDN_Read MDN_Write MDN_Seek MDN_IOControl ...where "MDN" should be your stream driver prefix (here, MDN = "my driver name"). In the .REG file, I add: [HKEY_LOCAL_MACHINE\Comm\MyDriverName] "DisplayName"="My Driver" "Group"="NDIS" "ImagePath"="MyDriverName.dll" "Prefix"="MDN" "Dll"="MyDriverName.dll" Again, this was IIRC CE 4.1, so I am not sure if this still works exactly this way in today's CE. HTH, Stephan --- On Feb 15, 10:50 am, "Arsalan Ahmad" <arsalan_ah...(a)fornntp.com> wrote: > Hello all, > > I want to create an NDIS miniport driver with stream interface. Please tell > me what should I do as discussed below? > > 1. Either I create a driver which exposes all DriverEntry(), XXX_Open(), > XXX_Close(), XXX_Read() etc functions. I initialize miniport in > DriverEntry() function. > > 2. Or I create a driver which exposes XXX_Init(), XXX_DeInit(), XXX_Close(), > XXX_Open(), XXX_Read() functions (no DriverEntry() function) and I > initialize miniport in XXX_Init() function. > > Thanks, > > Arsalan
From: Arsalan Ahmad on 20 Feb 2007 09:39 Hello all, As discussed in this thread, I did following: 1. Add necessary registry entries for my NDIS miniport driver. 2. From my application I called NdisRegisterAdapter() which loads the driver dll inside the device manager and calls its DriverEntry() function. 3. Inside the DriverEntry() I initialized my miniport driver and create an adapter object (pointed to by a global variable g_pAdapter) inside the MiniportInitialize() function. 4. Once the adapter object is created I called RegisterDevice() to load my stream interface. 5. My XXX_Init() function is called. However inside XXX_Init() function when I check the value of g_pAdapter, which I previously allocated it is NULL. So it means that my driver is loaded twice which I do not want. How can I just load a single driver with both the capabilities i.e. it should be a miniport NDIS adapter with a stream interface? Thanks, Arsalan "Stephan Wolf [MVP]" <stewo68(a)hotmail.com> wrote in message news:1171877623.318771.239770(a)l53g2000cwa.googlegroups.com... > Ok, now I understand your concern. I actually did this years ago, > i.e., register a stream interface for an NDIS miniport under CE (IIRC, > that was CE 4.1): > > I call ActivateDevice() from MiniportInitialize() with a 'lpszDevKey' > of "Comm\\MyDriverName" whwre "MyDriverName" is the base filename of > the NDIS miniport driver. > > In the .DEF file, I add the stream interface functions to the EXPORTS > section: > > MDN_Init > MDN_Deinit > MDN_Open > MDN_Close > MDN_Read > MDN_Write > MDN_Seek > MDN_IOControl > > ..where "MDN" should be your stream driver prefix (here, MDN = "my > driver name"). > > In the .REG file, I add: > > [HKEY_LOCAL_MACHINE\Comm\MyDriverName] > "DisplayName"="My Driver" > "Group"="NDIS" > "ImagePath"="MyDriverName.dll" > "Prefix"="MDN" > "Dll"="MyDriverName.dll" > > Again, this was IIRC CE 4.1, so I am not sure if this still works > exactly this way in today's CE. > > HTH, Stephan > --- > On Feb 15, 10:50 am, "Arsalan Ahmad" <arsalan_ah...(a)fornntp.com> > wrote: >> Hello all, >> >> I want to create an NDIS miniport driver with stream interface. Please >> tell >> me what should I do as discussed below? >> >> 1. Either I create a driver which exposes all DriverEntry(), XXX_Open(), >> XXX_Close(), XXX_Read() etc functions. I initialize miniport in >> DriverEntry() function. >> >> 2. Or I create a driver which exposes XXX_Init(), XXX_DeInit(), >> XXX_Close(), >> XXX_Open(), XXX_Read() functions (no DriverEntry() function) and I >> initialize miniport in XXX_Init() function. >> >> Thanks, >> >> Arsalan > >
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 Prev: How to use IOCTL_USB_USER_REQUEST Next: CreateFile and GetVolumeInformation fail |