I do think so, too. But I don't know how to reference to it.It's seemed I
can't reference to it by using the reference windows in my project.
BTW, APIs imported from User32 and Kenerl32 are worked well.
[DllImport("user 32.dll", EntryPoint="Mes sageBox")]
public static extern int MsgBox(int hWnd, String text, String caption,
uint type);
above is right.
[DllImport("Adva pi32", EntryPoint="Cry ptEnumProviders W",
SetLastError=tr ue, ExactSpelling=t rue,
CharSet=CharSet .Auto)]
static extern bool CryptEnumProvid ers(
[MarshalAs(Unman agedType.U4)] int dwIndex,
[MarshalAs(Unman agedType.U4)] ref int pdwReserved,
[MarshalAs(Unman agedType.U4)] int dwFlags,
[MarshalAs(Unman agedType.U4)] ref int pdwProvType,
StringBuilder pszProvName,
[MarshalAs(Unman agedType.U4)] ref int pcbProvName);
above is wrong.
errcode=126 ERROR_MOD_NOT_F OUND
The specified module could not be found.
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> дÈëÓʼþ
news:%2******** ********@TK2MSF TNGP15.phx.gbl. ..
mRbEn,
What does the declaration in your code look like? You arent setting a
reference to advapi32.dll, are you?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"mRbEn" <mr********@126 .com> wrote in message
news:eW******** *****@TK2MSFTNG P12.phx.gbl... one more question!
When I call the cryptenumprovid ers in my C# project. I got an error it's
said that the module could not be found. Why can't my project load
advapi32.dll and find the module CryptEnumProvid ers ? !!!
"mRbEn" <mr********@126 .com> дÈëÓʼþ
news:uC******** ******@TK2MSFTN GP09.phx.gbl... thanks!
"Brendan Grant" <gr****@NOSPAMd ahat.com> дÈëÓʼþ
news:51******** *************** ***********@mic rosoft.com...
> There is no reason you cannot use the existing CryptEnumProvid ers()
call, > you¡¯d just need to P/Invoke it and lucky for you, recently Nicholas
Paldino
> posted a C# signature for it over on
> http://pinvoke.net/default.aspx/adva...Providers.html
>
> Brendan
>
>
> "mRbEn" wrote:
>
> > Hi:
> > I'm trying to write a web page by using c# under dotnet framwork.
My target
> > is lets the user to choose a csp to get a certificate from CA. But,
I only
> > know how to enum providers by cryptoapi like:
> > CryptEnumProvid ers(...).
> > Who can tell me how to enum csps by using C#?
> > thanks
> >
> >
> >