73 lines
2.4 KiB
C++
73 lines
2.4 KiB
C++
#pragma once
|
|
|
|
#include "GdCPP_Exports.h"
|
|
#include <cstdint>
|
|
#include <vector>
|
|
#include <string>
|
|
#include "sVersion.h"
|
|
|
|
|
|
GDCPP_API int64_t getTimeMsTick();
|
|
|
|
GDCPP_API void OutputDebugPrintf(const char* strOutputString, ...);
|
|
|
|
GDCPP_API bool GetFileVersion(const wchar_t* sTargetFileName, std::wstring& verstr);
|
|
GDCPP_API bool GetFileVersion(const wchar_t* sTargetFileName, sVersion& ver);
|
|
GDCPP_API bool GetFileVersion(const wchar_t* sTargetFileName, sVersion2& ver);
|
|
|
|
GDCPP_API bool GetProductVersion(const wchar_t* sTargetFileName, std::wstring& verstr);
|
|
GDCPP_API bool GetProductVersion(const wchar_t* sTargetFileName, sVersion& ver);
|
|
GDCPP_API bool GetProductVersion(const wchar_t* sTargetFileName, sVersion2& ver);
|
|
|
|
inline bool GetFileVersion(const std::wstring& sTargetFileName, std::wstring& verstr)
|
|
{
|
|
return GetFileVersion(sTargetFileName.c_str(), verstr);
|
|
}
|
|
|
|
inline bool GetFileVersion(const std::wstring& sTargetFileName, sVersion& ver)
|
|
{
|
|
return GetFileVersion(sTargetFileName.c_str(), ver);
|
|
}
|
|
|
|
inline bool GetProductVersion(const std::wstring& sTargetFileName, std::wstring& verstr)
|
|
{
|
|
return GetProductVersion(sTargetFileName.c_str(), verstr);
|
|
}
|
|
inline bool GetProductVersion(const std::wstring& sTargetFileName, sVersion& ver)
|
|
{
|
|
return GetProductVersion(sTargetFileName.c_str(), ver);
|
|
}
|
|
|
|
// 检查当前进程所使用的 VC 运行库版本
|
|
GDCPP_API int CheckVcRuntimeVersion(sVersion& Ver);
|
|
|
|
GDCPP_API bool installVcRuntime(const fs::path& binPath, const sVersion& minVer);
|
|
|
|
GDCPP_API int GetMotherboardAndBIOSInfo(std::wstring& Manufacturer, std::wstring& Model, std::wstring& BisoVer, bool needCoInit=false);
|
|
|
|
GDCPP_API BOOL BrowseDirectory(HWND hwnd, LPTSTR lpszDir);
|
|
|
|
GDCPP_API uint32_t crc32update_f4soft(uint32_t crc, uint32_t* pBuffer, uint32_t len);
|
|
GDCPP_API uint32_t crc32calc_f4soft(uint32_t* pBuffer, uint32_t len);
|
|
|
|
static inline bool createDirIfNotExist(fs::path& dir, spdlog::logger& log, const char* tip) {
|
|
if (!fs::exists(dir)) {
|
|
std::error_code _Ec;
|
|
if (!fs::create_directory(dir, _Ec)) {
|
|
log.error("创建{}目录{}失败: {}", tip, dir.u8string(), _Ec.message());
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
static inline bool createDirIfNotExist(fs::path& dir, spdlog::logger& log, const std::string& tip) {
|
|
if (!fs::exists(dir)) {
|
|
std::error_code _Ec;
|
|
if (!fs::create_directory(dir, _Ec)) {
|
|
log.error("创建{}目录{}失败: {}", tip, dir.u8string(), _Ec.message());
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
} |