mirror of
https://github.com/hedge-dev/UnleashedRecomp
synced 2026-08-28 09:18:34 -04:00
Move Windows version to OS namespace
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#include "process.h"
|
||||
#include "process_detail.h"
|
||||
#include <os/process.h>
|
||||
#include <os/process_detail.h>
|
||||
|
||||
std::filesystem::path os::process::GetExecutablePath()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
#include <os/version.h>
|
||||
#include <os/version_detail.h>
|
||||
|
||||
os::version::detail::OSVersion os::version::GetOSVersion()
|
||||
{
|
||||
return detail::GetOSVersion();
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <os/version_detail.h>
|
||||
|
||||
namespace os::version
|
||||
{
|
||||
detail::OSVersion GetOSVersion();
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
namespace os::version::detail
|
||||
{
|
||||
struct OSVersion
|
||||
{
|
||||
uint32_t Major{};
|
||||
uint32_t Minor{};
|
||||
uint32_t Build{};
|
||||
};
|
||||
|
||||
OSVersion GetOSVersion();
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
#include <os/version_detail.h>
|
||||
|
||||
LIB_FUNCTION(LONG, "ntdll.dll", RtlGetVersion, PRTL_OSVERSIONINFOW);
|
||||
|
||||
os::version::detail::OSVersion os::version::detail::GetOSVersion()
|
||||
{
|
||||
auto result = os::version::detail::OSVersion{};
|
||||
|
||||
OSVERSIONINFOEXW osvi = { 0 };
|
||||
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXW);
|
||||
|
||||
if (RtlGetVersion((PRTL_OSVERSIONINFOW)&osvi) != 0)
|
||||
return result;
|
||||
|
||||
result.Major = osvi.dwMajorVersion;
|
||||
result.Minor = osvi.dwMinorVersion;
|
||||
result.Build = osvi.dwBuildNumber;
|
||||
|
||||
return result;
|
||||
}
|
||||
Reference in New Issue
Block a user