C
colin.mackay
I'm having a problem with CryptAcquireContext in a .NET Compact
Framework application running on the Pocket PC Emulator 2002. On a
Pocket PC 2003 Second Edition (a real device) it seems to work fine.
The line of code I'm having a problem with is:
WinApi.CryptAcquireContext(ref hProv, null,
"Microsoft Enhanced Cryptographic Provider v1.0",
1, // PROV_RSA_FULL
0xf0000000); // CRYPT_VERIFYCONTEXT
WinApi is a class that contains the definition of all the PInvoked
methods.
[DllImport("coredll.dll")]
public static extern bool CryptAcquireContext(
ref IntPtr phProv, string pszContainer, string pszProvider,
uint dwProvType, uint dwFlags);
The problem is that on my machine, running the code produces an error
0x80000005
When I tried the code on a collegues machine, her Pocket PC 2002
Emulator produced a differernt error message. She got 0x80090019 on the
same function call. I don't understand why there is a difference - both
should be set up identically, but I guess there is something different.
Finally, we tried to deploy it to a real Pocket PC device (PPC 2003
Second Edition) and it worked fine.
I need the code to work on PPC 2002 onwards. Does anyone have any idea
why I am seeing different results? Or have any idea of how to fix this?
Framework application running on the Pocket PC Emulator 2002. On a
Pocket PC 2003 Second Edition (a real device) it seems to work fine.
The line of code I'm having a problem with is:
WinApi.CryptAcquireContext(ref hProv, null,
"Microsoft Enhanced Cryptographic Provider v1.0",
1, // PROV_RSA_FULL
0xf0000000); // CRYPT_VERIFYCONTEXT
WinApi is a class that contains the definition of all the PInvoked
methods.
[DllImport("coredll.dll")]
public static extern bool CryptAcquireContext(
ref IntPtr phProv, string pszContainer, string pszProvider,
uint dwProvType, uint dwFlags);
The problem is that on my machine, running the code produces an error
0x80000005
When I tried the code on a collegues machine, her Pocket PC 2002
Emulator produced a differernt error message. She got 0x80090019 on the
same function call. I don't understand why there is a difference - both
should be set up identically, but I guess there is something different.
Finally, we tried to deploy it to a real Pocket PC device (PPC 2003
Second Edition) and it worked fine.
I need the code to work on PPC 2002 onwards. Does anyone have any idea
why I am seeing different results? Or have any idea of how to fix this?