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
.



Relevant Pages

  • RE: CryptAcquireContext fails with "ERROR_FILE_NOT_FOUND"
    ... - Are you calling a Microsoft CSP or a third-party one? ... impersonates a user, for example, the IUSR_ComputerName account." ... What are the scenarios in which User Profile doesn't get loaded.? ... Is there any other possible reason for this error code apart from the two ...
    (microsoft.public.platformsdk.security)
  • Re: Security Update for Windows XP (KB917344) failed to install
    ... My registry entry is set for that already, so this is not the problem here, ... MS sent me to gateway, gateway sent me here, my guess is no one has a clue ... computer and then manually installing it, at least then we could sometimes ... |> and see if there is an error code. ...
    (microsoft.public.windowsupdate)
  • Re: failed installation of office update
    ... i am assuming it is down to a registry key being removed and ... > registry entry in the computer at all. ... What is the context of this error code? ... as searching for that code as you have written it you could be searching ...
    (microsoft.public.windowsupdate)
  • Re: Update for Windows media encoder 9 (kb954156)
    ... You may not have the Encoder 9 ... installed (hence the error code) or it may have been removed or you have an ... registry entry which may have been left over from a previous ... Hopefully there will be a resolution soon. ...
    (microsoft.public.windowsupdate)
  • Re: send/receive error
    ... I have installed the Service Packs. ... > authenticating to your outgoing server, ... and add your SBC account to that profile from scratch. ... That error code indicates that the server rejected the sender address. ...
    (microsoft.public.outlook.general)