output os version and graphics information.
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -17,6 +17,29 @@ extern std::unique_ptr<MonitorManager> g_manager;
|
|||||||
extern std::queue<Message> g_messages;
|
extern std::queue<Message> g_messages;
|
||||||
|
|
||||||
|
|
||||||
|
void OutputWindowsInformation()
|
||||||
|
{
|
||||||
|
const auto hModule = ::LoadLibrary(TEXT("ntdll.dll"));
|
||||||
|
if (!hModule) return;
|
||||||
|
|
||||||
|
ScopedReleaser freeModule([&] { ::FreeLibrary(hModule); });
|
||||||
|
|
||||||
|
if (const auto address = ::GetProcAddress(hModule, "RtlGetVersion"))
|
||||||
|
{
|
||||||
|
using RtlGetVersionType = NTSTATUS(WINAPI *)(OSVERSIONINFOEXW*);
|
||||||
|
const auto RtlGetVersion = reinterpret_cast<RtlGetVersionType>(address);
|
||||||
|
|
||||||
|
OSVERSIONINFOEXW os = { sizeof(os) };
|
||||||
|
if (!FAILED(RtlGetVersion(&os)))
|
||||||
|
{
|
||||||
|
Debug::Log("OS Version : ", os.dwMajorVersion, ".", os.dwMinorVersion);
|
||||||
|
Debug::Log("Build Number : ", os.dwBuildNumber);
|
||||||
|
Debug::Log("Service Pack : ", os.szCSDVersion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
IUnityInterfaces* GetUnity()
|
IUnityInterfaces* GetUnity()
|
||||||
{
|
{
|
||||||
return g_unity;
|
return g_unity;
|
||||||
|
|||||||
@@ -7,6 +7,9 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Output windows version
|
||||||
|
void OutputWindowsInformation();
|
||||||
|
|
||||||
// Unity interface getter
|
// Unity interface getter
|
||||||
struct IUnityInterfaces;
|
struct IUnityInterfaces;
|
||||||
IUnityInterfaces* GetUnity();
|
IUnityInterfaces* GetUnity();
|
||||||
|
|||||||
@@ -40,12 +40,24 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
static void Output(T&& arg)
|
static void Output(const T& arg)
|
||||||
{
|
{
|
||||||
if (mode_ == Mode::None) return;
|
if (mode_ == Mode::None) return;
|
||||||
if (ss_.good())
|
if (ss_.good())
|
||||||
{
|
{
|
||||||
ss_ << std::forward<T>(arg);
|
ss_ << arg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Output(const WCHAR* arg)
|
||||||
|
{
|
||||||
|
if (mode_ == Mode::None) return;
|
||||||
|
if (ss_.good())
|
||||||
|
{
|
||||||
|
char buf[256];
|
||||||
|
size_t size;
|
||||||
|
wcstombs_s(&size, buf, arg, 256);
|
||||||
|
ss_ << buf;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,10 +101,10 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class Arg, class... RestArgs>
|
template <class Arg, class... RestArgs>
|
||||||
static void _Log(Level level, Arg&& arg, RestArgs&&... restArgs)
|
static void _Log(Level level, const Arg& arg, const RestArgs&... restArgs)
|
||||||
{
|
{
|
||||||
Output(std::forward<Arg>(arg));
|
Output(arg);
|
||||||
_Log(level, std::forward<RestArgs>(restArgs)...);
|
_Log(level, restArgs...);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _Log(Level level)
|
static void _Log(Level level)
|
||||||
|
|||||||
@@ -57,17 +57,7 @@ void Duplicator::InitializeDuplication()
|
|||||||
case S_OK:
|
case S_OK:
|
||||||
{
|
{
|
||||||
state_ = State::Ready;
|
state_ = State::Ready;
|
||||||
const auto rot = static_cast<DXGI_MODE_ROTATION>(monitor_->GetRotation());
|
|
||||||
Debug::Log("Duplicator::Initialize() => OK.");
|
Debug::Log("Duplicator::Initialize() => OK.");
|
||||||
Debug::Log(" ID : ", monitor_->GetId());
|
|
||||||
Debug::Log(" Size : (", monitor_->GetWidth(), ", ", monitor_->GetHeight(), ")");
|
|
||||||
Debug::Log(" DPI : (", monitor_->GetDpiX(), ", ", monitor_->GetDpiY(), ")");
|
|
||||||
Debug::Log(" Rot : ",
|
|
||||||
rot == DXGI_MODE_ROTATION_IDENTITY ? "Landscape" :
|
|
||||||
rot == DXGI_MODE_ROTATION_ROTATE90 ? "Portrait" :
|
|
||||||
rot == DXGI_MODE_ROTATION_ROTATE180 ? "Landscape (flipped)" :
|
|
||||||
rot == DXGI_MODE_ROTATION_ROTATE270 ? "Portrait (flipped)" :
|
|
||||||
"Unspecified");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case E_INVALIDARG:
|
case E_INVALIDARG:
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ private:
|
|||||||
void UpdateMoveRects();
|
void UpdateMoveRects();
|
||||||
void UpdateDirtyRects();
|
void UpdateDirtyRects();
|
||||||
|
|
||||||
Monitor* monitor_ = nullptr;
|
Monitor* const monitor_ = nullptr;
|
||||||
std::atomic<State> state_ = State::Ready;
|
std::atomic<State> state_ = State::Ready;
|
||||||
|
|
||||||
std::shared_ptr<class IsolatedD3D11Device> device_;
|
std::shared_ptr<class IsolatedD3D11Device> device_;
|
||||||
|
|||||||
@@ -57,6 +57,18 @@ void Monitor::Initialize(
|
|||||||
// DPI is set as -1, so the application has to use the appropriate value.
|
// DPI is set as -1, so the application has to use the appropriate value.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto rot = outputDesc_.Rotation;
|
||||||
|
Debug::Log("Monitor::Initialized() =>");
|
||||||
|
Debug::Log(" ID : ", id_);
|
||||||
|
Debug::Log(" Size : (", width_, ", ", height_, ")");
|
||||||
|
Debug::Log(" DPI : (", dpiX_, ", ", dpiY_, ")");
|
||||||
|
Debug::Log(" Rot : ",
|
||||||
|
rot == DXGI_MODE_ROTATION_IDENTITY ? "Landscape" :
|
||||||
|
rot == DXGI_MODE_ROTATION_ROTATE90 ? "Portrait" :
|
||||||
|
rot == DXGI_MODE_ROTATION_ROTATE180 ? "Landscape (flipped)" :
|
||||||
|
rot == DXGI_MODE_ROTATION_ROTATE270 ? "Portrait (flipped)" :
|
||||||
|
"Unspecified");
|
||||||
|
|
||||||
duplicator_ = std::make_shared<Duplicator>(this);
|
duplicator_ = std::make_shared<Duplicator>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ MonitorManager::~MonitorManager()
|
|||||||
|
|
||||||
void MonitorManager::Initialize()
|
void MonitorManager::Initialize()
|
||||||
{
|
{
|
||||||
// Get factory
|
|
||||||
ComPtr<IDXGIFactory1> factory;
|
ComPtr<IDXGIFactory1> factory;
|
||||||
if (FAILED(CreateDXGIFactory1(IID_PPV_ARGS(&factory))))
|
if (FAILED(CreateDXGIFactory1(IID_PPV_ARGS(&factory))))
|
||||||
{
|
{
|
||||||
@@ -38,21 +37,33 @@ void MonitorManager::Initialize()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check all display adapters
|
std::vector<std::pair<ComPtr<IDXGIAdapter1>, ComPtr<IDXGIOutput>>> outputs;
|
||||||
int id = 0;
|
|
||||||
ComPtr<IDXGIAdapter1> adapter;
|
ComPtr<IDXGIAdapter1> adapter;
|
||||||
for (int i = 0; (factory->EnumAdapters1(i, &adapter) != DXGI_ERROR_NOT_FOUND); ++i)
|
for (int i = 0; (factory->EnumAdapters1(i, &adapter) != DXGI_ERROR_NOT_FOUND); ++i)
|
||||||
{
|
{
|
||||||
// Search the main monitor from all outputs
|
DXGI_ADAPTER_DESC desc;
|
||||||
|
if (FAILED(adapter->GetDesc(&desc))) continue;
|
||||||
|
Debug::Log("Graphics Card [", i, "] : ", desc.Description);
|
||||||
|
|
||||||
ComPtr<IDXGIOutput> output;
|
ComPtr<IDXGIOutput> output;
|
||||||
for (int j = 0; (adapter->EnumOutputs(j, &output) != DXGI_ERROR_NOT_FOUND); ++j)
|
for (int j = 0; (adapter->EnumOutputs(j, &output) != DXGI_ERROR_NOT_FOUND); ++j)
|
||||||
{
|
{
|
||||||
auto monitor = std::make_shared<Monitor>(id++);
|
DXGI_OUTPUT_DESC desc;
|
||||||
monitor->Initialize(adapter, output);
|
if (FAILED(output->GetDesc(&desc))) continue;
|
||||||
monitor->StartCapture();
|
Debug::Log(" > Monitor[", j, "] : ", desc.DeviceName);
|
||||||
monitors_.push_back(monitor);
|
outputs.emplace_back(adapter, output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int id = 0; id < static_cast<int>(outputs.size()); ++id)
|
||||||
|
{
|
||||||
|
const auto& pair = outputs.at(id);
|
||||||
|
auto monitor = std::make_shared<Monitor>(id);
|
||||||
|
monitor->Initialize(pair.first, pair.second);
|
||||||
|
monitor->StartCapture();
|
||||||
|
monitors_.push_back(monitor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ extern "C"
|
|||||||
if (!g_manager)
|
if (!g_manager)
|
||||||
{
|
{
|
||||||
Debug::Initialize();
|
Debug::Initialize();
|
||||||
|
OutputWindowsInformation();
|
||||||
g_manager = std::make_unique<MonitorManager>();
|
g_manager = std::make_unique<MonitorManager>();
|
||||||
g_manager->Initialize();
|
g_manager->Initialize();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user