FreeRDP
TestEnumerateSecurityPackages.c
1 
2 #include <stdio.h>
3 #include <winpr/crt.h>
4 #include <winpr/sspi.h>
5 #include <winpr/winpr.h>
6 #include <winpr/tchar.h>
7 
8 int TestEnumerateSecurityPackages(int argc, char* argv[])
9 {
10  ULONG cPackages = 0;
11  SECURITY_STATUS status = 0;
12  SecPkgInfo* pPackageInfo = NULL;
13  SecurityFunctionTable* table = NULL;
14 
15  WINPR_UNUSED(argc);
16  WINPR_UNUSED(argv);
17 
18  sspi_GlobalInit();
19  table = InitSecurityInterfaceEx(0);
20 
21  status = table->EnumerateSecurityPackages(&cPackages, &pPackageInfo);
22 
23  if (status != SEC_E_OK)
24  {
25  sspi_GlobalFinish();
26  return -1;
27  }
28 
29  _tprintf(_T("\nEnumerateSecurityPackages (%") _T(PRIu32) _T("):\n"), cPackages);
30 
31  for (size_t index = 0; index < cPackages; index++)
32  {
33  _tprintf(_T("\"%s\", \"%s\"\n"), pPackageInfo[index].Name, pPackageInfo[index].Comment);
34  }
35 
36  table->FreeContextBuffer(pPackageInfo);
37  sspi_GlobalFinish();
38 
39  return 0;
40 }