CryptAcquireContext fails with "ERROR_FILE_NOT_FOUND"



Hi,
When i call the CryptAcquireContext API with CRYPT_NEWKEYSET, it fails with
the GetLastError() returning an error code of 2L corresponding to
"ERROR_FILE_NOT_FOUND".
I've checked the registry entry for AppData in UserShellFolders and it seems
to be fine. Are there any other registry entries which I need to check.?
MSDN also states that the reason for this error as "The profile of the user
is not loaded and cannot be found. This happens when the application
impersonates a user, for example, the IUSR_ComputerName account."
I'm not using any Impersonation in my code. Also, Creating a
CRYPT_MACHINEKEYSET would not be an option considering the requirement.
What are the scenarios in which User Profile doesn't get loaded.? Is there
any way or tool by which I can verify if the profile has been corrupted.? Is
it possible to fix this through code.?
Is there any other possible reason for this error code apart from the two
mentioned.?
I'm using Windows XP Home Edition. Looking forward to your suggestions and
answers. Please let me know if you need any other details.
--
Regards,
Pradeep Gv
.