SSPI Negotiate not found
I'm using Windows XP Pro SP3. I want to use SSPI functions in my code. I compiled my code, no error.
I set the security package to be used to Negotiate, which is recommended.
When I start my program, Negotiate cannot be used because it can't be found. So, I tried "Kerberos" instead, and same error: the security package cannot be found.
I had a look at the registry, and according to that key: HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Lsa/Security Packages, the security packages available are: kerberos, msv1_0, schannel, wdigest. Negotiate and NTLM are missing.
I don't understand why my program can't find any security package. The开发者_开发知识库 returned error code is 0x80090305 and I couldn't find any hint about a way to fix it.
So, if you master the SSPI, please I need your help! Do I have something to modify in the registry? Or maybe I need to register some DLLs?
Thanks for any hint Bye!
SSPI is a cow to debug without code :)
Try this code, see if it works, if it does, re-try it and replace NTLM with Negotiate. Actually, rather than using the word, "Negotiate" #include "security.h" and use NEGOSSP_NAME.
Also, try this, and see if Negotiate is in the list:
int main(int argc, _TCHAR* argv[]) { ULONG cPackages = 0; PSecPkgInfo pInfo = NULL; SECURITY_STATUS stat = EnumerateSecurityPackages(&cPackages, &pInfo); if (stat == SEC_E_OK) { for (ULONG i = 0; i < cPackages; i++) { wprintf(L"%s\t%s\n",pInfo[i].Name, pInfo[i].Comment); } FreeContextBuffer(pInfo); } return 0; }
make sure you define SECURITY_WIN32 in your header, and link with secur32.
精彩评论