Creating Custom Reparse Point Data Buffer

I am writing a user-mode app to test the handling of reparse point in my minifilter. I can create reparse points successfully, but I’m uncertain as to how to create them with the REPARSE_GUID_DATA_BUFFER structure. Specifically, how the DataBuffer works. Here’s the definition from winnt.h:

typedef struct _REPARSE_GUID_DATA_BUFFER {
DWORD ReparseTag;
WORD ReparseDataLength;
WORD Reserved;
GUID ReparseGuid;
struct {
BYTE DataBuffer[1];
} GenericReparseBuffer;
} REPARSE_GUID_DATA_BUFFER, *PREPARSE_GUID_DATA_BUFFER;

Say I create a custom-sized buffer. What way should I store it in the DataBuffer field? Should I store a pointer to the buffer in the first (and only) element of the BYTE array? Or is this 1 element BYTE array supposed to represent a pointer? I could use a little guidance on this one. Thanks.

Bill

DataBuffer is the first byte of your reparse data. Its not a pointer.
Think in terms of a on-the-wire network protocol struct.

t.

On Thu, 7 Dec 2006, xxxxx@edsiohio.com wrote:

I am writing a user-mode app to test the handling of reparse point in my minifilter. I can create reparse points successfully, but I’m uncertain as to how to create them with the REPARSE_GUID_DATA_BUFFER structure. Specifically, how the DataBuffer works. Here’s the definition from winnt.h:

typedef struct _REPARSE_GUID_DATA_BUFFER {
DWORD ReparseTag;
WORD ReparseDataLength;
WORD Reserved;
GUID ReparseGuid;
struct {
BYTE DataBuffer[1];
} GenericReparseBuffer;
} REPARSE_GUID_DATA_BUFFER, *PREPARSE_GUID_DATA_BUFFER;

Say I create a custom-sized buffer. What way should I store it in the DataBuffer field? Should I store a pointer to the buffer in the first (and only) element of the BYTE array? Or is this 1 element BYTE array supposed to represent a pointer? I could use a little guidance on this one. Thanks.

Bill


Questions? First check the IFS FAQ at https://www.osronline.com/article.cfm?id=17

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

I’m still somewhat confused. Unfortunately I’m not sure what you’re talking about with the network protocol structs. Essentially I just need to know how to create this buffer with a custom size. Something like this (which doesn’t work):

const USHORT usMySize = 100;
REPARSE_GUID_DATA_BUFFER oBuffer;
oBuffer.GenericReparseBuffer.DataBuffer = new UCHAR[usMySize];

Bill

Sigh.

PREPARSE_GUID_DATA_BUFFER oBuffer;

oBuffer = (PREPARSE_GUID_DATA_BUFFER) ExAllocatePoolWithTag(NonPagedPool,
sizeof(REPARSE_GUID_DATA_BUFFER)+how_much_buffer_you_want_to_add,
‘b00n’);

I’ll leave the error handling for the allocation as an exercise. The pool may not need to be nonpaged, depending on how you’re using the buffer. Substitute ‘b00n’ with a tag that’s specific to your use.

…dave

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@edsiohio.com
Sent: Friday, December 08, 2006 6:42 AM
To: Windows File Systems Devs Interest List
Subject: RE:[ntfsd] Creating Custom Reparse Point Data Buffer

I’m still somewhat confused. Unfortunately I’m not sure what you’re talking about with the network protocol structs. Essentially I just need to know how to create this buffer with a custom size. Something like this (which doesn’t work):

const USHORT usMySize = 100;
REPARSE_GUID_DATA_BUFFER oBuffer;
oBuffer.GenericReparseBuffer.DataBuffer = new UCHAR[usMySize];

Bill


Questions? First check the IFS FAQ at https://www.osronline.com/article.cfm?id=17

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

Thanks for everyone’s help on this one. I think I haven’t had enough sleep and had been over thinking it! Thanks again!

Bill

>buffer with a custom size. Something like this (which doesn’t work):

const USHORT usMySize = 100;
REPARSE_GUID_DATA_BUFFER oBuffer;
oBuffer.GenericReparseBuffer.DataBuffer = new UCHAR[usMySize];

The correct thing:

PREPARSE_GUID_DATA_BUFFER Buffer;
Buffer = (PREPARSE_GUID_DATA_BUFFER)new UCHAR[ FIELD_OFFSE
(REPARSE_GUID_DATA_BUFFER, DataBuffer) + 100 ];
// Then fill &(Buffer->DataBuffer)

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com