[fix #301] Not using _time32() anymore, not in XP msvcrt

This commit is contained in:
Benjamin DELPY 2020-08-16 10:37:36 +02:00
parent a2a25cc9f5
commit 2d54a1a978
3 changed files with 14 additions and 2 deletions

View File

@ -113,7 +113,7 @@ NTSTATUS kuhl_m_dpapi_cloudap_keyvalue_derived(int argc, wchar_t * argv[])
{
if(kull_m_string_args_byName(argc, argv, L"iat", &szIat, NULL))
time32 = wcstol(szIat, NULL, 0);
else _time32(&time32);
else kull_m_string_get_time32(&time32);
kprintf(L"Issued at : %ld\n", time32);
if(isDerivedKey)
@ -215,7 +215,7 @@ PSTR generate_simplePayload(PCWSTR PrimaryRefreshToken, __time32_t *iat)
if(iat)
time32 = *iat;
else _time32(&time32);
else kull_m_string_get_time32(&time32);
if(kull_m_string_quick_urlsafe_base64_to_Binary(PrimaryRefreshToken, &data, &cbData))
{

View File

@ -155,6 +155,17 @@ void kull_m_string_wprintf_hex(LPCVOID lpData, DWORD cbData, DWORD flags)
kprintf(L"\n};\n");
}
__time32_t kull_m_string_get_time32(__time32_t * _Time)
{
__time32_t ret;
FILETIME SystemTimeAsFileTime;
GetSystemTimeAsFileTime(&SystemTimeAsFileTime);
ret = (__time32_t) (*(PLONGLONG) &SystemTimeAsFileTime - 116444736000000000) / 10000000;
if(_Time)
*_Time = ret;
return ret;
}
void kull_m_string_displayFileTime(IN PFILETIME pFileTime)
{
SYSTEMTIME st;

View File

@ -80,6 +80,7 @@ BOOL kull_m_string_stringToHex(IN LPCWCHAR string, IN LPBYTE hex, IN DWORD size)
BOOL kull_m_string_stringToHexBuffer(IN LPCWCHAR string, IN LPBYTE *hex, IN DWORD *size);
void kull_m_string_wprintf_hex(LPCVOID lpData, DWORD cbData, DWORD flags);
__time32_t kull_m_string_get_time32(__time32_t * _Time);
void kull_m_string_displayFileTime(IN PFILETIME pFileTime);
void kull_m_string_displayLocalFileTime(IN PFILETIME pFileTime);
BOOL kull_m_string_FileTimeToString(IN PFILETIME pFileTime, OUT WCHAR string[14 + 1]);