-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add incompatibility check for PrivateProfileRedirector < 0.6.2 (#…
…735)
- Loading branch information
Showing
5 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ | |
#include "Utils/GameSetting.h" | ||
#include "Utils/Serialize.h" | ||
#include "Utils/UI.h" | ||
#include "Utils/WinApi.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include "WinApi.h" | ||
|
||
namespace Util | ||
{ | ||
std::optional<REL::Version> GetDllVersion(const std::wstring& dllPath) | ||
{ | ||
DWORD handle = 0; | ||
DWORD size = GetFileVersionInfoSize(dllPath.c_str(), &handle); | ||
if (size == 0) { | ||
return std::nullopt; | ||
} | ||
|
||
std::vector<BYTE> buffer(size); | ||
if (!GetFileVersionInfo(dllPath.c_str(), handle, size, buffer.data())) { | ||
return std::nullopt; | ||
} | ||
|
||
VS_FIXEDFILEINFO* fileInfo = nullptr; | ||
UINT fileInfoSize = 0; | ||
if (!VerQueryValue(buffer.data(), L"\\", reinterpret_cast<void**>(&fileInfo), &fileInfoSize)) { | ||
return std::nullopt; | ||
} | ||
|
||
if (fileInfoSize == sizeof(VS_FIXEDFILEINFO)) { | ||
return REL::Version(HIWORD(fileInfo->dwFileVersionMS), LOWORD(fileInfo->dwFileVersionMS), HIWORD(fileInfo->dwFileVersionLS), LOWORD(fileInfo->dwFileVersionLS)); | ||
} | ||
|
||
return std::nullopt; | ||
} | ||
} // namespace Util |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#pragma once | ||
|
||
namespace Util | ||
{ | ||
std::optional<REL::Version> GetDllVersion(const std::wstring& dllPath); | ||
} // namespace Util |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters