Actually "W" conversion is done automatically for you. That's why you can
declare GetWindowText instead of GetWindowTextW and it'll work. The proof is
the exception type. If it were function name, he'd get
MissingMethodException. NotSupportedException is a clear sign of something
fishy in the P/Invoke type definition, like Long or string in the structure
or something. In his case it's of course string pointers as Chris poinrts
out. Those need to be marshalled by hand as IntPtr
--
Alex Feinman
---
Visit
http://www.opennetcf.org
"Paul G. Tobey [eMVP]" <ptobey no spam AT no instrument no spam DOT com>
wrote in message news:(E-Mail Removed)...
> If you look at the exports from the security DLL, you're *not* going to
> see that function name, as it takes a string parameter. Most API
> functions which take string parameters are actually named with either a
> "W" or an "A" at the end of the function name, indicating whether the
> string parameter(s) are wide-character (Unicode), or not (ANSI). In this
> case, there's a W version of the call exported by secur32.dll,
> AcquireCredentialsHandleW(). Try that, instead...
>
> Paul T.
>
> "Bill" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>>I am trying to call AcquireCredentialsHandle using Interop by I get a
>>notsupportexception. The MSDN docs say it is supported. Has anyone got
>>this working? I tried it with both the ce and pocketpc emulators and both
>>give the same error. I also tried linking to both secur32.dll and
>>security.dll and neither worked.
>>
>> Here is the call:
>>
>> status = AcquireCredentialsHandle(
>> 0,
>> "NTLM",
>> SECPKG_CRED_OUTBOUND,
>> 0, ref pAuthData,
>> 0, 0,
>> m_Credentials,
>> ref Expiration);
>>
>> //Def
>>
>> [StructLayout(LayoutKind.Sequential)]
>> internal struct SEC_WINNT_AUTH_IDENTITY
>> {
>> public string User;
>> public int UserLength;
>> public string Domain;
>> public int DomainLength;
>> public string Password;
>> public int PasswordLength;
>> public int Flags;
>> }
>>
>> [DllImport(@"secur32.dll", EntryPoint="InitializeSecurityContext")]
>>
>> internal static extern int InitializeSecurityContext(IntPtr phCredential,
>> IntPtr phContext, string pszTargetName, int fContextReq, int Reserved1,
>> int TargetDataRep, IntPtr pInput, int Reserved2, IntPtr phNewContext, ref
>> SecBufferDesc pOutput, ref int pfContextAttr, IntPtr ptsExpiry);
>>
>>
>>
>
>