PCAUSA licenses Advanced TDI Client samples for Windows NT & Windows 2000,
which seem to work for most folks that have used them.
The following KS_AllocateAndProbeMdl seems to work just fine for creating
MDLs to be passed to TDI.
Please do note that the MDL Next field is set to NULL. TDI can work with
chains of MDLs, with the NExt field being set to NULL in the last one.
In addition, we often use NdisAllocateBuffer, etc. to allocate NDIS_BUFFERs,
which are equivalent to MDLs on Windows NT. In many cases using the NDIS
buffer functions is somewhat safer then using the NT kernel services. For
example NdisAllocateBuffer takes care of the MDL Next field for you.
Certainly more transportable to 9X platform…
Good luck,
Thomas F. Divine
PCAUSA - Toolkits & Resources For Network Software Developers
NDIS Protocol - TDI Client - Windows 95 Redirector
http:
PMDL
KS_AllocateAndProbeMdl(
PVOID VirtualAddress,
ULONG Length,
BOOLEAN SecondaryBuffer,
BOOLEAN ChargeQuota,
PIRP Irp OPTIONAL
)
{
PMDL pMdl = NULL;
pMdl = IoAllocateMdl(
VirtualAddress,
Length,
SecondaryBuffer,
ChargeQuota,
Irp
);
if( !pMdl )
{
return( (PMDL )NULL );
}
try
{
MmProbeAndLockPages( pMdl, KernelMode, IoModifyAccess );
}
except( EXCEPTION_EXECUTE_HANDLER )
{
IoFreeMdl( pMdl );
pMdl = NULL;
return( NULL );
}
pMdl->Next = NULL;
return( pMdl );
}
----- Original Message -----
From: Kiran Mandava
To: NT Developers Interest List
Sent: Monday, April 17, 2000 4:55 PM
Subject: [ntdev] RE: A query !!
> Hi Jamey,
>
> But the Lower driver which my driver acessing is the TCP/IP Native
Protocol
> stack.
> that means i shouldn’t use the mmprobelockpages and instead use the
> MmBuildMdlForNonPagedPool
>
>
> kiran
>
>
> >-----Original Message-----
> >From: Jamey Kirby [mailto:xxxxx@storagecraft.com]
> >Sent: Monday, April 17, 2000 12:28 PM
> >To: NT Developers Interest List
> >Subject: [ntdev] RE: A query !!
> >
> >
> >Interesting. I experienced this in my driver. Here is what I
> >was finding:
> >
> >If you lock the pages and call the FSD below you, the FSD will lock and
> >unlock the pages. There is no lock count, so your lock is
> >gone. So, you not
> >unlocking the pages should be OK. If it is NPP, you should use
> >MmBuildMdlForNonPagedPool.
> >
> >This means that your locked pages are no longer locked in your
> >completion
> >handler. Are you using a completion handler? Are you accessing
> >the buffers
> >in the completion handler?
> >
> >Sorry I can not be more specific; it would help to see your code.
> >
> >Jamey
> >
> >> -----Original Message-----
> >> From: xxxxx@lists.osr.com
> >> [mailto:xxxxx@lists.osr.com]On Behalf Of Kiran Mandava
> >> Sent: Monday, April 17, 2000 12:17 PM
> >> To: NT Developers Interest List
> >> Subject: [ntdev] RE: A query !!
> >>
> >>
> >> Hi,
> >>
> >> some more info on the current scenario,
> >>
> >> The main scenario is i Create a MDL first time and reuse it
> >all the time
> >> with the calls MmPrepareMdlForReuse + MmInitializeMdl.
> >>
> >> 1. we have a driver which does only MmProbeAndLockPages (There is no
> >> compensating call mmunlockpages)and everything worked fine until
> >> we got into
> >> something like heavy usage of NonPagedPool (70M) +
> >LockingDown some of the
> >> Paged Pool In the Memory(about 30 MB) so the final kernel
> >memory usage was
> >> something like 140 MB…
> >> (everything works fine until the memory usage creeped upto 140
> >> MB, in the
> >> normal cases it was Around 90 MB and evrything works fine.)
> >>
> >> but the problem at that point was something like i was
> >observing a blue
> >> sreen after the whole system runs for a while (say 4 to 5 hours) the
> >> bugcheck being NO_MORE_SYSTEM_PTES (i don’t know whether it
> >is related or
> >> not but…)
> >>
> >> so once i fixed the stuff using the mmunlockpages it worked
> >fine for two
> >> days and the page table entres were constant…
> >> but after it crashed with the error
> >IRQL_NOT_LESS_OR_EQUAL…which i
> >> suspect is due to the mmunlockpages…
> >>
> >> 2. I tried to Use the NT DDK specified MmbuildMDLforNonPagedPool
> >> and after a
> >> while (unpredcictable)the system blue screens with error
> >> PFN_FILE_CORRUPT
> >>
> >>
> >>
> >> could somebody help me on this.
> >>
> >>
> >> thanks,
> >>
> >> >-----Original Message-----
> >> >From: Roddy, Mark [mailto:xxxxx@stratus.com]
> >> >Sent: Monday, April 17, 2000 11:42 AM
> >> >To: NT Developers Interest List
> >> >Subject: [ntdev] RE: A query !!
> >> >
> >> >
> >> >
> >> >However it is an interesting question if
> >> >MmProbeAndLockPages/MmUnlockPages
> >> >cause a problem if the underlying buffer happens to be NPP.
> >> >One hopes not,
> >> >but I’ve heard several people swear that it does. How would a
> >> >driver even
> >> >know, other than through some a priori assumptions?
> >> >
> >> >> -----Original Message-----
> >> >> From: Jamey Kirby [mailto:xxxxx@storagecraft.com]
> >> >> Sent: Monday, April 17, 2000 2:22 PM
> >> >> To: NT Developers Interest List
> >> >> Subject: [ntdev] RE: A query !!
> >> >>
> >> >>
> >> >> I think you need to use MmBuildMdlForNonPagedPool() if you
> >> >> use NPP in your
> >> >> MDL.
> >> >>
> >> >> Jamey
> >> >>
> >> >> > -----Original Message-----
> >> >> > From: Kiran Mandava [mailto:xxxxx@skystream.com]
> >> >> > Sent: Monday, April 17, 2000 11:08 AM
> >> >> > To: NT Developers Interest List
> >> >> > Subject: [ntdev] A query !!
> >> >> >
> >> >> >
> >> >> > The Microsoft Exchange Server received an Internet message
> >> >> that could
> >> >> > not be processed. To view the original message content, open the
> >> >> > attached message. <<message.txt>>
> >> >> >
> >> >>
> >> >>
> >> >> —
> >> >> You are currently subscribed to ntdev as: xxxxx@stratus.com
> >> >> To unsubscribe send a blank email to
> >$subst(‘Email.Unsub’)
> >> >>
> >> >
> >> >—
> >> >You are currently subscribed to ntdev as:
> >xxxxx@skystream.com
> >> >To unsubscribe send a blank email to $subst(‘Email.Unsub’)
> >> >
> >>
> >> —
> >> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> >> To unsubscribe send a blank email to $subst(‘Email.Unsub’)
> >>
> >
> >
> >—
> >You are currently subscribed to ntdev as: xxxxx@skystream.com
> >To unsubscribe send a blank email to $subst(‘Email.Unsub’)
> >
>
> —
> You are currently subscribed to ntdev as: xxxxx@pcausa.com
> To unsubscribe send a blank email to $subst(‘Email.Unsub’)
></message.txt></http:>