I found the following code in Win32 Dev Help:
Does anyone know how to change the FILETIME to a INT64 and back again at a later stage?FILETIME ft;
SYSTEMTIME st;
GetLocalTime(&st);
SystemTimeToFileTime(&st,&ft);
Vytautas
15 posts
Does anyone know how to change the FILETIME to a INT64 and back again at a later stage?FILETIME ft;
SYSTEMTIME st;
GetLocalTime(&st);
SystemTimeToFileTime(&st,&ft);
typedef struct _FILETIME { // ft
DWORD dwLowDateTime;
DWORD dwHighDateTime;
} FILETIME;
typedef struct _SYSTEMTIME { // st
WORD wYear;
WORD wMonth;
WORD wDayOfWeek;
WORD wDay;
WORD wHour;
WORD wMinute;
WORD wSecond;
WORD wMilliseconds;
} SYSTEMTIME;Definitions of functions:VOID GetLocalTime(
LPSYSTEMTIME lpSystemTime // address of system time structure
);
Also in the help file they mentionBOOL SystemTimeToFileTime(
CONST SYSTEMTIME *lpSystemTime, // address of system time to convert
LPFILETIME lpFileTime // address of buffer for converted file time
);
Copy the resulting FILETIME structure to a LARGE_INTEGER structure.Vytautas
However when I execute this code it always shows "1508792", which i think is probably only the HIGH order of the Int64. How should I modify the function to return the whole Int64 figure?System::Call '*(&i2, &i2, &i2, &i2, &i2, &i2, &i2, &i2) i .r1'
System::Call '*(&i2, &i2) l .r0'
System::Call 'kernel32::GetLocalTime(i) i(r1)'
System::Call 'kernel32::SystemTimeToFileTime(i, l) l(r1, r0)'
MessageBox MB_OK $0
Originally posted by kichikYes but I would like to get the current system time as FILETIME so that i can compare it, after modification, with the result from smGetFileSysTime.
Doesn't the smGetFileSysTime macro from System.nsh work for you?
System::Call '*{stSYSTEMTIME} .r1'
!error System::Call '*(i, i) l .r0'
System::Call 'kernel32::GetLocalTime(i) i(r1)'
!error System::Call 'kernel32::SystemTimeToFileTime(i, l) l(r1, r0)' ; NOTE: This is wrong, see the Wiki for a working version
!error System::Call '*$0${stSYSTEMTIME}(l .r1)'
MessageBox MB_OK "$1" Thanks for all your help kichik and brainsucker.Originally posted by kichikThanks but you mixed up $1 and $2. I think the following code should work
The complete INT64 is both of the numbers combined ($1 * (2^32) + $2). You can use System::Int64Op to work with this number.
System::Call '*{stSYSTEMTIME} .r1'
!error System::Call '*(i, i) l .r0' ; NOTE: This is wrong, see the Wiki for a working version
System::Call 'kernel32::GetLocalTime(i) i(r1)'
!error System::Call 'kernel32::SystemTimeToFileTime(i, l) l(r1, r0)'
System::Call '*$0(i .r1, i .r2)'
System::Int64Op $2 * 4294967296
pop $3
System::Int64Op $3 + $1
pop $4
MessageBox MB_OK $4 BTW Do I have to use 4294967296 instead of 2^32 since Int64Op did not seem to work with 2^32?