Hi,
I'm having trouble calling the function CryptRetrieveObjectByUrl (found in
Wincrypt.h). I posted to this forum earlier and I got an answer which I now
have tried without success.
The declaration looks like this:
[DllImport("cryptnet.dll", SetLastError=true)]
protected static extern bool CryptRetrieveObjectByUrl(
[MarshalAs(UmanagedType.LPStr)] string pszUrl,
IntPtr pszObjectOid,
uint dwRetrievalFlags,
uint dwTimeout,
out IntPtr ppvObject,
IntPtr hAsyncRetrieve,
IntPtr pCredentials,
IntPtr pvVerify,
IntPtr pAuxInfo);
As I stated in my earlier post it?s the second and fifth parameter which I?m
unsure of. However when I call the function it fails immediately and
Marshal.GetLastWin32Error() returns the value 2 ( = "The system cannot find
the file specified"). I've checked and cryptnet.dll is located in my
System32-folder (The call succeeds if I make the call via a c++-dll)
Any suggestions? Thanks in advance.
-Jon
Jon G - 28 Jun 2004 12:09 GMT
Never mind, I managed to work around it (using trial and error) but I'm not
quite sure why it didn?t work.
If I specify the full path to my imported function:
[DllImport("c:\\winnt\\system32\\cryptnet.dll")] it works without any
problems, but if I leave out the path then I get the "File not found
message".
But I?m also using other crypto-functions from crypt32.dll (also located in
the system32 folder) and those work without giving the full path.
Any suggestions or ideas?
-Jon
> Hi,
>
[quoted text clipped - 12 lines]
> out IntPtr ppvObject,
> IntPtr
hAsyncRetrieve,
> IntPtr pCredentials,
> IntPtr pvVerify,
[quoted text clipped - 9 lines]
>
> -Jon