File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed
Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change 1010from .UefiBaseType import *
1111from .UefiMultiPhase import *
1212
13+ # definitions for EFI_TIME.Daylight
14+ EFI_TIME_ADJUST_DAYLIGHT = (1 << 1 )
15+ EFI_TIME_IN_DAYLIGHT = (1 << 2 )
16+
17+ # definition for EFI_TIME.TimeZone
18+ EFI_UNSPECIFIED_TIMEZONE = 0x07ff
19+
1320class EFI_ALLOCATE_TYPE (ENUM ):
1421 _members_ = [
1522 'AllocateAnyPages' ,
@@ -244,6 +251,9 @@ class EFI_SYSTEM_TABLE(STRUCT):
244251 ]
245252
246253__all__ = [
254+ 'EFI_TIME_ADJUST_DAYLIGHT' ,
255+ 'EFI_TIME_IN_DAYLIGHT' ,
256+ 'EFI_UNSPECIFIED_TIMEZONE' ,
247257 'EFI_RUNTIME_SERVICES' ,
248258 'EFI_BOOT_SERVICES' ,
249259 'EFI_CONFIGURATION_TABLE' ,
Original file line number Diff line number Diff line change 33# Cross Platform and Multi Architecture Advanced Binary Emulation Framework
44#
55
6+ import time
7+
68from qiling import Qiling
79from qiling .os .const import *
810from .const import *
911from .utils import *
1012from .fncc import *
1113from .ProcessorBind import *
14+ from .UefiBaseType import EFI_TIME
1215from .UefiSpec import *
1316
1417@dxeapi (params = {
1518 "Time" : POINTER , # OUT PTR(EFI_TIME)
1619 "Capabilities" : POINTER # OUT PTR(EFI_TIME_CAPABILITIES)
1720})
1821def hook_GetTime (ql : Qiling , address : int , params ):
22+ Time = params ['Time' ]
23+
24+ if not Time :
25+ return EFI_INVALID_PARAMETER
26+
27+ localtime = time .localtime ()
28+
29+ efitime = EFI_TIME ()
30+ efitime .Year = localtime .tm_year
31+ efitime .Month = localtime .tm_mon
32+ efitime .Day = localtime .tm_mday
33+ efitime .Hour = localtime .tm_hour
34+ efitime .Minute = localtime .tm_min
35+ efitime .Second = localtime .tm_sec
36+ efitime .Nanosecond = 0
37+
38+ # tz and dst settings are stored in the "RtcTimeSettings" nvram variable.
39+ # we just use the default settings instead
40+ efitime .TimeZone = EFI_UNSPECIFIED_TIMEZONE
41+ efitime .Daylight = 0
42+
43+ efitime .saveTo (ql , Time )
44+
1945 return EFI_SUCCESS
2046
2147@dxeapi (params = {
You can’t perform that action at this time.
0 commit comments