Modifying ramdisk.sys sample to use PagedPool

Hi,

I need to modify Microsoft’s ramdisk.sys sample driver to support a
larger disk up to 64 megs. I figured that in this case it would be a
good idea to allocate the memory for the RAM disk from PagedPool instead
(the original sample allocates from NonPagedPool). So I’ve just changed
the memory allocation part in pnp.c to

// Allocate the memory for disk image.
//

devExt->DiskImage = ExAllocatePoolWithTag(
PagedPool,
devExt->DiskRegInfo.DiskSize,
RAMDISK_TAG_DISK);

and it seems to work. But I’m still a Greenhorn with respect to drivers
and would like to know if that’s indeed the only change I need to make
or if I’m asking for trouble.

Thanks!

Ralf.

You must make sure that your reads and writes are handled at
PASSIVE_LEVEL. You can do this with a system thread.

Jamey

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Ralf Buschmann
Sent: Tuesday, August 27, 2002 1:38 AM
To: NT Developers Interest List
Subject: [ntdev] Modifying ramdisk.sys sample to use PagedPool

Hi,

I need to modify Microsoft’s ramdisk.sys sample driver to support a
larger disk up to 64 megs. I figured that in this case it would be a
good idea to allocate the memory for the RAM disk from PagedPool instead
(the original sample allocates from NonPagedPool). So I’ve just changed
the memory allocation part in pnp.c to

// Allocate the memory for disk image.
//

devExt->DiskImage = ExAllocatePoolWithTag(
PagedPool,
devExt->DiskRegInfo.DiskSize,
RAMDISK_TAG_DISK);

and it seems to work. But I’m still a Greenhorn with respect to drivers
and would like to know if that’s indeed the only change I need to make
or if I’m asking for trouble.

Thanks!

Ralf.


You are currently subscribed to ntdev as: xxxxx@storagecraft.com
To unsubscribe send a blank email to %%email.unsub%%

Jamey,

you wrote on Tuesday, August 27, 2002, 19:13:50:

RB>> // Allocate the memory for disk image.
RB>> //
RB>
RB>> devExt->DiskImage = ExAllocatePoolWithTag(
RB>> PagedPool,
RB>> devExt->DiskRegInfo.DiskSize,
RB>> RAMDISK_TAG_DISK);

JK> You must make sure that your reads and writes are handled at
JK> PASSIVE_LEVEL. You can do this with a system thread.

Thanks!

Let me ask another question: do I even need to make this change? My
system has 512 megs RAM and I could successfully use the original sample
(allocating from NonPagedPool) to create a 64 meg RAM disk. What are the
chances that there is not enough non paged memory available?

Ralf.

if that’s your concern you can always allocate paged pool and then lock
it down by calling MmProbeAndLockPages on the buffer. Just remember to
unlock before freeing it.

-p

-----Original Message-----
From: Ralf Buschmann [mailto:xxxxx@backmagic.de]
Sent: Tuesday, August 27, 2002 11:09 AM
To: NT Developers Interest List
Subject: [ntdev] RE: Modifying ramdisk.sys sample to use PagedPool

Jamey,

you wrote on Tuesday, August 27, 2002, 19:13:50:

RB>> // Allocate the memory for disk image.
RB>> //
RB>
RB>> devExt->DiskImage = ExAllocatePoolWithTag(
RB>> PagedPool,
RB>> devExt->DiskRegInfo.DiskSize,
RB>> RAMDISK_TAG_DISK);

JK> You must make sure that your reads and writes are handled at
JK> PASSIVE_LEVEL. You can do this with a system thread.

Thanks!

Let me ask another question: do I even need to make this change? My
system has 512 megs RAM and I could successfully use the original sample
(allocating from NonPagedPool) to create a 64 meg RAM disk. What are the
chances that there is not enough non paged memory available?

Ralf.


You are currently subscribed to ntdev as: xxxxx@microsoft.com To
unsubscribe send a blank email to %%email.unsub%%