device driver

    Sponsored Links


  • 1. NDIS60 Miniport sharing memory with user mode and WHQL
    Hi, I need to share memory between user mode application and the NDIS60 Miniport driver: 1. Allocate memory in user space. In driver, I use NdisAllocateMdl (which will also build MDL and lock the pages depending on the buffer is from Non Paged pool or not). Then I call MmGetSystemAddressForMdlSafe to get the driver accessible address. So will this non NDIS routine (MmGetSystemAddressForMdlSafe) be approved by WHQL if used in NDIS driver? The DDK points to use this routine instead of NdisBufferVirtualAddressSafe which is not supported in NDIS60. 2. Allocate memory in kernel space. I see that the MmGetSystemAddressForMdlSafe is a macro internally calling MmMapLockedPagesSpecifyCache function with KernelMode as AccessMode. Will WHQL approve (assuming MmGetSystemAddressForMdlSafe is approved) if I use the later routine to map memory to user space? Please let me know. Thanks, Aniketa
  • 2. CreateNamedPipe without Disconnect & CloseHandle
    i have a serious problem with CreateNamedPipe: I am developing a virtual printer driver in VISTA, for that at one point i use NamedPipe ok.. Now if my all code is run good then there is no any problem becuse at the end of printing job i disconnect this named pipe and close this handle. Now consider the case that my NamedPipe is created and without close it my printer driver crash at some point means when ever second time any print job is there it does not createNamePipe gives me error ERROR_ALREADY_EXISTS that "Cannot create a file when that file already exists". here i write my code for create named pipe hBitmapPrinterPipe = CreateNamedPipe( L"\\\\.\\Pipe\ \BitmapPrinterPipe", // pipe name PIPE_ACCESS_DUPLEX| FILE_FLAG_OVERLAPPED, PIPE_TYPE_BYTE | PIPE_WAIT, PIPE_UNLIMITED_INSTANCES, MAX_PATH, MAX_PATH, NMPWAIT_USE_DEFAULT_WAIT, NULL); if(hBitmapPrinterPipe == INVALID_HANDLE_VALUE) { GetLastError()); } Using this code i create my pipe.. so my question is there is any method from which i can reopen my existing server pipe and close it.. OR there is any solution from which i can open the another instance of the same name pipe.. so please write me which solution is best for me and how can i do it.. Thanks in advance..
  • 3. ZwMapViewOfSection returning a user mode address
    ZwMapViewOfSection(, NtCurrentProcess(),....); returns a pointer to the address of my section, but it in one case this is a user mode address. When I do a subsequent call of ZwWriteFile(...another file...) I am using this address as input and it crashes bugcheck C4 because of this. What I need then is to have ZwMapViewOfSection return a Kernel address as the base of the mapped view. Is PsGetCurrentProcess ()going to help me? Or is it just going to give me the User's process. A last resort would be to copy my view into a kernel buffer allocated from paged memory, before I do the write, but this seems a very long way around the block. How do I get a useful input buffer address for ZwWriteFile from ZwMapviewofSection()? Do I want the system process ? how do I get it? Thanks -- Gak - Finecats
  • 4. USB device control
    i have a CD-ROM plugged in to PC USB port via a ATA to USB2 converter. explorer shows CD-ROM as a normal disk and everything is fine. what i need to do is to control this CD-ROM from device driver which im goint to code. specifically i need to 1) eject the CD-ROm 2) Close the tray 3) Read a file in this CD ROM and gove contents to user process from this device driver. this should happen without disturbing its normal appearance to windows. (as a disk) is this possible?
  • 5. Restricting access to USB devices based on session
    Hi, I have a server running on Windows Server 2003. I have a filter driver which filters IRP_MJ_CREATE requests. My intension is to block certain users from accessing the USB device(say, a thumb drive) based on session id. I have used SeQueryAuthenticationIdToken to get the session id in my dispatch function for IRP_MJ_CREATE in my filter driver. When I tried to access the device from the explorer (from different sessions), I expected a IRP_MJ_CREATE request so that I can block certain users. However, I observed that the session Id that I get is ALWAYS "0" in my filter driver. Is this correct? One more thing is that I didnt see a IRP_MJ_CREATE when I opened a explorer from a session to access the device. Is this how it works? How can I acheive what I want? Any comments are most welcome Thanks, Sri


Postby R2FtbWFyYW1hbg » Thu, 27 Nov 2008 10:04:00 GMT

Does NdisAllocate Mdl return a single MDL or a chain of MDL's based on the 
size of the data buffer being described and physical page size? I looked at 
MSDN but it does not say anything about this.

I am guessing that if say I have a 15K buffer on a system with 4k page size 
then I will need 4 MDLs to describe the buffer and these MDLs will be chained 
and the chain is what is returned from the call to NdisAllocateMdl. Is this 
statement correct?


Re: NdisAllocateMdl

Postby Alireza Dabagh [MS] » Thu, 27 Nov 2008 15:30:04 GMT

As long as the buffer is "virtually contiguous" (i.e. one virtual address 
describes the entire 15K buffer) then you only need one MDL to describe it. 
You don't need multiple MDLs just because the buffer may be "physically 

The fact that the memory might span 5 pages is reflected in the pfn array at 
the bottom of the MDL (after the header).

This call returns only one MDL.

-thanks, ali

This posting is provided "AS IS" with no warranties, and confers no rights.

Re: NdisAllocateMdl

Postby R2FtbWFyYW1hbg » Fri, 28 Nov 2008 09:39:01 GMT

Thanks, Ali.

Return to device driver


Who is online

Users browsing this forum: No registered users and 93 guest