User Name - Windows XP kernel mode


I need to get the the name of a user from SID in WIndows XP kernel mode.
I have used the newly exported API SecLookupAccountSid in ntifs.h for this

I have done it in two stages. First I gave 0 for all the size parameters.
Then the API retuned sizes for both domain name and user name.

Then I allocated the correct size for user name and domain name from
NonPagedPool, initialized the Unicode strings for user name and domain name
and again called the API.
But this time a page fault resulted with the bug check code

Can any one give me the correct usage of this API?