I have a driver that uses RTL Generic Table functions to store data,
everything works fine, but I’m concerned about resource clean up for
when I get called to remove my device.
Whilst there is a table initialisation function, there is no
equivalent table destroy function, such as you see with LookAsideLists.
I already have an Ioctl call which cleans out all the elements in the
table and seems to be fine.
while (TRUE)
{
pHit = RtlGetElementGenericTable (&pDevExt->Table, 0);
if (pHit == NULL)
break;
RtlDeleteElementGenericTable (&pDevExt->Table, pHit);
}
Is it enough in my RemoveDevice function to call the above code to be
sure that all the table resources have been freed ? I’d feel much
happier if there was a Generic Table delete function.
On a related note, I’ve had some struggles with
RtlEnumerateGenericTableWithoutSplaying() and the RestartKey
parameter. What I was trying to do was to restart the table
enumeration at a specific point which was not necessarily the same
place as where the previous enumeration finished.
I tried various ways of trying to create a RestartKey by using the
successful result of RtlLookupElementGenericTable() as the
RestartKey, but no matter the variations I tried it would
crash. Does anyone have experience of generating their own RestartKey ?
regards,
Mark.