RtlInsertElementGenericTable: documented versus observed behavior

The IFS DDK documents RtlInsertElementGenericTable as returning NULL in
the case where the element is already in the table and the optional
NewElement parameter will be set to FALSE.

What I’m seeing is that NewElement is set to FALSE, but the function
returns a pointer to the previously inserted element instead of NULL. I
see the same results with and without RTL_USE_AVL_TABLES defined. OS is
Server 2003, Enterprise Edition - debug.

This is actually the more desirable behavior since it doesn’t need to be
followed by a lookup. Does anyone know if this is a documentation
error?

xxxxx@z-force.com wrote:

What I’m seeing is that NewElement is set to FALSE, but the function
returns a pointer to the previously inserted element instead of NULL. I
see the same results with and without RTL_USE_AVL_TABLES defined. OS is
Server 2003, Enterprise Edition – debug.

This is actually the more desirable behavior since it doesn’t need to be
followed by a lookup. Does anyone know if this is a documentation error?

Yes, this is a documentation error.

The way this function works: A lookup is first performed. If the lookup
succeeds, the found element is returned.

The docs should read: “If an element with the same key already exists in
the table, the function’s return value is a pointer to the old element
and the value for the optional output parameter NewElement is set to FALSE.”

Peter
OSR

IIRC these functions only return NULL on allocation failure, am I wrong?

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

----- Original Message -----
From: xxxxx@z-force.com
To: Windows File Systems Devs Interest List
Sent: Thursday, December 23, 2004 8:22 PM
Subject: [ntfsd] RtlInsertElementGenericTable: documented versus observed behavior

The IFS DDK documents RtlInsertElementGenericTable as returning NULL in the case where the element is already in the table and the optional NewElement parameter will be set to FALSE.

What I’m seeing is that NewElement is set to FALSE, but the function returns a pointer to the previously inserted element instead of NULL. I see the same results with and without RTL_USE_AVL_TABLES defined. OS is Server 2003, Enterprise Edition - debug.

This is actually the more desirable behavior since it doesn’t need to be followed by a lookup. Does anyone know if this is a documentation error?


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

You are currently subscribed to ntfsd as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

This is a bug in the documentation. I have filed a bug to get this fixed. Thank you for reporting this.

Neal Christiansen
Microsoft File System Filter Group Lead
This posting is provided “AS IS” with no warranties, and confers no rights


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@z-force.com
Sent: Thursday, December 23, 2004 9:23 AM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] RtlInsertElementGenericTable: documented versus observed behavior

The IFS DDK documents RtlInsertElementGenericTable as returning NULL in the case where the element is already in the table and the optional NewElement parameter will be set to FALSE.

What I’m seeing is that NewElement is set to FALSE, but the function returns a pointer to the previously inserted element instead of NULL.? I see the same results with and without RTL_USE_AVL_TABLES defined.? OS is Server 2003, Enterprise Edition - debug.

This is actually the more desirable behavior since it doesn’t need to be followed by a lookup.? Does anyone know if this is a documentation error?

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

You are currently subscribed to ntfsd as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com