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 parameters?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jon G - 10 Jun 2004 15:44 GMT
Hi,

I?m trying to call the CryptoAPI-function CryptRetrieveObjectByUrl from my
C# project. At the moment  I?m using a C++ - dll in order to call the
function with the following parameters:

CryptRetrieveObjectByUrl( My_LDAP , CONTEXT_OID_CRL , dwFlags, 30000 ,
(LPVOID *)&pMyCRL, NULL , NULL , NULL , NULL )

but I would like to remove the dll and make the call from C#. But I?m unsure
how to marshal some of the parameters, more precisely the second and fifth
parameters.

The fifth parameter (pMyCRL) is defined as a pointer to a pointer, which in
the end is supposed to point to a PCRL_CONTEXT-struct.

The second parameter is defined in WinCrypt.h like this:  #define
CONTEXT_OID_CRL ((LPCSTR)2) I know how to marshal to a LPCSTR , but what?s
the value of it??

Any help appreciated... Thanks in advance

Jon G
Mattias Sj?gren - 11 Jun 2004 02:17 GMT
Jon,

>The fifth parameter (pMyCRL) is defined as a pointer to a pointer, which in
>the end is supposed to point to a PCRL_CONTEXT-struct.

Right, I'd declare it as out IntPtr and then use
Marshal.PtrToStructure to dereference the returned CRL_CONTEXT struct.

>The second parameter is defined in WinCrypt.h like this:  #define
>CONTEXT_OID_CRL ((LPCSTR)2) I know how to marshal to a LPCSTR , but what´s
>the value of it??

Declare it as an IntPtr rather than a string, then pass in (IntPtr) 2.

Mattias

Signature

Mattias Sjögren [MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Jon G - 11 Jun 2004 07:28 GMT
Thanks,
I'm gonna try it as soon as possible.

-Jon

> Jon,
>
[quoted text clipped - 6 lines]
> >The second parameter is defined in WinCrypt.h like this:  #define
> >CONTEXT_OID_CRL ((LPCSTR)2) I know how to marshal to a LPCSTR , but
what?s
> >the value of it??
>
> Declare it as an IntPtr rather than a string, then pass in (IntPtr) 2.
>
> Mattias

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.