1

Windows SSPI 调用AcquireCredentialsHandle返回一个时间戳,指示凭据句柄何时到期。文档似乎在说TimeStamp结构应该与结构具有相同的格式FILETIME。但是,当我将此函数与“Kerberos”包一起使用时,将结果视为FILETIME

#include <stdio.h>
#define SECURITY_WIN32
#include <windows.h>
#include <security.h>

int main() {

  TimeStamp expiry;
  int aquireCode;
  CredHandle credHandle;
  BOOL timeOk;
  SYSTEMTIME sysTime;

  aquireCode = AcquireCredentialsHandle(
          NULL,
          "Kerberos",
          SECPKG_CRED_OUTBOUND,
          NULL,
          NULL,
          NULL,
          NULL,
          &credHandle,
          &expiry);

  printf("result = %d\n", aquireCode);
  printf("upper = %d (%X)\n", expiry.HighPart, expiry.HighPart);
  printf("lower = %d (%X)\n", expiry.LowPart, expiry.LowPart);

  timeOk = FileTimeToSystemTime((FILETIME*)&expiry, &sysTime);
  printf("time covert ok = %d\n", timeOk);
  printf("%4d/%02d/%02d %02d:%02d:%02d\n", sysTime.wYear, sysTime.wMonth, sysTime.wDay, sysTime.wHour, sysTime.wMinute, sysTime.wSecond);
}

在我的系统上,打印:

result = 0
upper = 2147483530 (7FFFFF8A)
lower = -1488801793 (A742AFFF)
time covert ok = 1
30828/09/13 12:48:05

如果不是FILETIME,那是什么?

4

0 回答 0