RtlVolumeDevicetoDosName()

Hi,
DDK says " RtlVolumeDeviceToDosName allocates the Unicode string buffer for
the MS-DOS path from the memory pool. After the buffer is no longer
required, a caller of this routine should use ExFreePool to free it. "

I allocate a Unicode String "
ABC=ExAllocatePool(PagedPool,sizeof(UNICODE_STRING));" and use this as a
parameter to RtlVolume…().

However, when i call ExFreePool(ABC->Buffer) it results in a bugcheck.

The driver works if i just call ExFreePool(ABC).

Could anyone please tell me how should i free the buffer which RtlVol…()
allocates?

Regards,
Samarth

Can you tell us if you are freeing memory at IRQL < DISPATCH_LEVEL?
That would be PASSIVE_LEVEL or APC_LEVEL.

If you are freeing at DISPATCH_LEVEL the crash is justified.

-Srin.

-----Original Message-----
From: Samarth Sharma [mailto:xxxxx@mynetsec.com]
Sent: Friday, July 25, 2003 1:18 AM
To: Windows System Software Developers Interest List
Subject: [ntdev] RtlVolumeDevicetoDosName()

Hi,
DDK says " RtlVolumeDeviceToDosName allocates the Unicode string
buffer
for
the MS-DOS path from the memory pool. After the buffer is no longer
required, a caller of this routine should use ExFreePool to free it. "

I allocate a Unicode String "
ABC=ExAllocatePool(PagedPool,sizeof(UNICODE_STRING));" and use this as
a
parameter to RtlVolume…().

However, when i call ExFreePool(ABC->Buffer) it results in a bugcheck.

The driver works if i just call ExFreePool(ABC).

Could anyone please tell me how should i free the buffer which
RtlVol…()
allocates?

Regards,
Samarth


You are currently subscribed to ntdev as: xxxxx@nai.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

You are checking that RtlVolumeNameToDosName returns STATUS_SUCCESS and
that ABC->Buffer is non-NULL?

Samarth Sharma wrote:

Hi,
DDK says " RtlVolumeDeviceToDosName allocates the Unicode string buffer for
the MS-DOS path from the memory pool. After the buffer is no longer
required, a caller of this routine should use ExFreePool to free it. "

I allocate a Unicode String "
ABC=ExAllocatePool(PagedPool,sizeof(UNICODE_STRING));" and use this as a
parameter to RtlVolume…().

However, when i call ExFreePool(ABC->Buffer) it results in a bugcheck.

The driver works if i just call ExFreePool(ABC).

Could anyone please tell me how should i free the buffer which RtlVol…()
allocates?

Regards,
Samarth


You are currently subscribed to ntdev as: xxxxx@nryan.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

  • Nick Ryan (MVP for DDK)

Thank you Nick. Was not checking for the NULL condition.

Regards,
Samarth

“Nick Ryan” wrote in message news:xxxxx@ntdev…
>
> You are checking that RtlVolumeNameToDosName returns STATUS_SUCCESS and
> that ABC->Buffer is non-NULL?
>
> Samarth Sharma wrote:
>
> > Hi,
> > DDK says " RtlVolumeDeviceToDosName allocates the Unicode string buffer
for
> > the MS-DOS path from the memory pool. After the buffer is no longer
> > required, a caller of this routine should use ExFreePool to free it. "
> >
> > I allocate a Unicode String “
> > ABC=ExAllocatePool(PagedPool,sizeof(UNICODE_STRING));” and use this as a
> > parameter to RtlVolume…().
> >
> > However, when i call ExFreePool(ABC->Buffer) it results in a bugcheck.
> >
> > The driver works if i just call ExFreePool(ABC).
> >
> > Could anyone please tell me how should i free the buffer which
RtlVol…()
> > allocates?
> >
> > Regards,
> > Samarth
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@nryan.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
>
> –
> - Nick Ryan (MVP for DDK)
>
>
>
>