The implementation is right there. There's actually different implementations:
- when
BOOST_INTERPROCESS_BOOTSTAMP_IS_SESSION_MANAGER_BASED
is defined
- when
BOOST_INTERPROCESS_BOOTSTAMP_IS_EVENTLOG_BASED
is defined
From Session Manager
inline bool get_last_bootup_time(std::string &stamp)
{
unsigned dword_val = 0;
std::size_t dword_size = sizeof(dword_val);
bool b_ret = get_registry_value_buffer( hkey_local_machine
, "SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Memory Management\\PrefetchParameters"
, "BootId", &dword_val, dword_size);
if (b_ret)
{
char dword_str[sizeof(dword_val)*2u+1];
buffer_to_narrow_str(&dword_val, dword_size, dword_str);
dword_str[sizeof(dword_val)*2] = '\0';
stamp = dword_str;
b_ret = get_registry_value_buffer( hkey_local_machine
, "SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Power"
, "HybridBootAnimationTime", &dword_val, dword_size);
//Old Windows versions have no HybridBootAnimationTime
if(b_ret)
{
buffer_to_narrow_str(&dword_val, dword_size, dword_str);
dword_str[sizeof(dword_val)*2] = '\0';
stamp += "_";
stamp += dword_str;
}
b_ret = true;
}
return b_ret;
}
From Event Log
This is even grittier, and way more code since apparently they chose not to use an existing library. They end up looking for event ID 6005
, and then reading the
unsigned long TimeGenerated; // Seconds since 1-1-1970
from that record.
Summarizing
As you can see the whole thing is proprietary, and you might just want to implement it yourself without (ab)using implementation details from Boost Interprocess.
The "good news" is that you might be able to get some documentation from Microsoft about either the Session Manager registry key, or System event 6005.
Oh, and don't forget that defining BOOST_INTERPROCESS_BOOTSTAMP_IS_EVENTLOG_BASED
could we result in a readable timestamp to begin with, since it just formats the UNIX timestamp with %u
to the output.