partitionist
Erfahrenes Mitglied
Also ich möchte ermitteln wann windows installiert wurde, also das datum.
Gibts da ne Möglchkeit das rauszukriegen?
Gibts da ne Möglchkeit das rauszukriegen?
Follow along with the video below to see how to install our site as a web app on your home screen.
Anmerkung: This feature currently requires accessing the site using the built-in Safari browser.
UCHAR* WinInstallationDate()
{
UCHAR regPath[MAX_PATH];
UCHAR regToQuery[MAX_PATH];
DWORD valueType;
OSVERSIONINFO os;
os.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&os);
if (os.dwPlatformId == VER_PLATFORM_WIN32_NT)
{
strcpy((char*)regPath, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion");
strcpy((char*)regToQuery, "InstallDate");
valueType = REG_DWORD;
}
else
{
strcpy((char*)regPath, "Software\\Microsoft\\Windows\\CurrentVersion");
strcpy((char*)regToQuery, "FirstInstallDateTime");
valueType = REG_BINARY;
}
HKEY regKey;
UCHAR data[MAX_PATH] = "";
DWORD lengthData = sizeof(data);
UCHAR installDate[MAX_PATH] = "";
RegOpenKeyEx(
HKEY_LOCAL_MACHINE,
(LPCSTR)regPath,
0,
KEY_READ,
®Key);
RegQueryValueEx(
regKey,
(LPCSTR)regToQuery,
NULL,
&valueType,
(LPBYTE)data,
&lengthData);
RegCloseKey(regKey);
struct tm* p = localtime((const time_t*)data);
strftime((char*)installDate, MAX_PATH, "%c", p);
return (UCHAR*)strdup((char*)installDate);
}