Andy Thanks very much for this!
I had in fact managed, eventually, to make it work** but I will peruse your code to pick up the smart stuff about Try Finally blocks and arrays of IntPtr rather than my clumsy alloc of space to hold IntPtr. As a quick aside, whilst I was playing about with this, I wanted to use a derived class as the managed structure but Marshal.SizeOf() returned a strange value - instead of being 12 bytes (12 from the base class and 0 from my derived class) it returned 4 bytes! Any idea why this would be? Cheers Simon ** Took half an hour longer than it should because I was writing two new values to a description attribute which is multi-valued according to the schema but there is a KB article which says that this was a cock-up during early AD development and attempts to write more than a single value (to description) will return a Constraint Violation! You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.