Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / June 2004

Tip: Looking for answers? Try searching our database.

CryptRetrieveObjectByUrl pt. 2

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jon G - 28 Jun 2004 08:33 GMT
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

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.