ExpRecordShutdownTime

INT64 __stdcall ExpRecordShutdownTime(){
  WCHAR v0; 
  INT64 result; 
  WCHAR v2; 
  UINT64 DataSize; 
  struct _UNICODE_STRING DestinationString; 
  struct _UNICODE_STRING ValueName; 
  struct _OBJECT_ATTRIBUTES ObjectAttributes; 
  void *KeyHandle; 
  __int64 Data; 
  KeyHandle = 0i64;
  *(&ObjectAttributes.Length + 1) = 0;
  *(&ObjectAttributes.Attributes + 1) = 0;
  DestinationString = 0i64;
  ValueName = 0i64;
  Data = *(_QWORD *)&KUSER_SHARED_DATA.SystemTime.LowPart;
  RtlInitUnicodeString(&DestinationString, L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Windows", v0);
  ObjectAttributes.RootDirectory = 0i64;
  ObjectAttributes.ObjectName = &DestinationString;
  ObjectAttributes.Length = 48;
  ObjectAttributes.Attributes = 576;
  *(_OWORD *)&ObjectAttributes.SecurityDescriptor = 0i64;
  LODWORD(result) = ZwOpenKey(&KeyHandle, 0x2001Fu, &ObjectAttributes);
  if( (int)result >= 0 )
  {
    RtlInitUnicodeString(&ValueName, L"ShutdownTime", v2);
    LODWORD(DataSize) = 8;
    ZwSetValueKey(KeyHandle, &ValueName, 0i64, 3ui64, &Data, DataSize);
    ZwFlushKey(KeyHandle);
    LODWORD(result) = ZwClose(KeyHandle);
  }
  return result;
}

Referenced by:

ExShutdownSystem