Group:  English: Windows XP ยป microsoft.public.windowsxp.device_driver.dev
Thread: Memory allocation in windows kernel driver

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Memory allocation in windows kernel driver
chiara <tchiara81[ at ]libero.it> 05.05.2007 11:06:52
Hi all, I'm approaching in the development of windows drivers and I'm
trying to modify the passthru driver provided in the Windows Driver
Development Kit.

In particular I have some problems in memory allocation. I have to
memorize into the passthru driver packets received from driver
Tcpip.sys before sending them through the NIC. Once I have memorized
the bytes of the packets I can send them, but I have also to operate
into the allocated zone of memory modifying its content.

I don't know if I can use the function malloc() to allocate a zone of
memory into the driver because I try to use it but when I build the
driver I have the error unresoved external symbol _imp_malloc
It is possible to create a pointer to an array of pointers to memorize
the packets before sending it? If yes, can I use the function malloc()
to allocate memory?

I read also that the routine ExAllocatePool() is used to allocate pool
memory in windows drivers. Can I use it to memorize a large quantity
of bytes before sending it through the NIC? If yes, what is the
type of pool memory I have to allocate, non paged or paged? I read
that the system can only allocate buffers larger than PAGE_SIZE from
nonpaged pool in multiples of PAGE_SIZE but I don't understand what is
the value of PAGE_SIZE.

Is there anyone that can help me?

Thank you,

Chiara

Re: Memory allocation in windows kernel driver
"Doron Holan [MSFT]" <doronh[ at ]online.microsoft.com> 03.07.2007 06:45:49
the equivalent of malloc is ExAllocatePool. I would guess you will need
NonPagedPool. As for what you can allocate, you can do wahtever you want, it
is just C after all. You can allocate any size pointer you want from
NonPagedPool. If you don't know what a page is or what PAGE_SIZE means, you
really should educate yourself before you ever step foot into kernel mode.

d

"chiara" <tchiara81[ at ]libero.it> wrote in message
news:1178363212.228710.118120[ at ]w5g2000hsg.googlegroups.com...
[Quoted Text]
> Hi all, I'm approaching in the development of windows drivers and I'm
> trying to modify the passthru driver provided in the Windows Driver
> Development Kit.
>
> In particular I have some problems in memory allocation. I have to
> memorize into the passthru driver packets received from driver
> Tcpip.sys before sending them through the NIC. Once I have memorized
> the bytes of the packets I can send them, but I have also to operate
> into the allocated zone of memory modifying its content.
>
> I don't know if I can use the function malloc() to allocate a zone of
> memory into the driver because I try to use it but when I build the
> driver I have the error unresoved external symbol _imp_malloc
> It is possible to create a pointer to an array of pointers to memorize
> the packets before sending it? If yes, can I use the function malloc()
> to allocate memory?
>
> I read also that the routine ExAllocatePool() is used to allocate pool
> memory in windows drivers. Can I use it to memorize a large quantity
> of bytes before sending it through the NIC? If yes, what is the
> type of pool memory I have to allocate, non paged or paged? I read
> that the system can only allocate buffers larger than PAGE_SIZE from
> nonpaged pool in multiples of PAGE_SIZE but I don't understand what is
> the value of PAGE_SIZE.
>
> Is there anyone that can help me?
>
> Thank you,
>
> Chiara
>


Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net