Advertisement
VXP

TF2BD Win7 diff

VXP
Jun 29th, 2021
1,514
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 8.77 KB | None | 0 0
  1.  CMakeLists.txt                                |   6 +-
  2.  cmake/init-postproject.cmake                  |   6 +-
  3.  tf2_bot_detector/CMakeLists.txt               |   6 +-
  4.  tf2_bot_detector/Platform/Windows/Windows.cpp | 184 +++++++++++++-------------
  5.  6 files changed, 101 insertions(+), 101 deletions(-)
  6.  
  7. diff --git a/CMakeLists.txt b/CMakeLists.txt
  8. index 7b59f65..071d3d3 100644
  9. --- a/CMakeLists.txt
  10. +++ b/CMakeLists.txt
  11. @@ -23,9 +23,9 @@ add_subdirectory(submodules/imgui_desktop)
  12.  
  13.  add_subdirectory(tf2_bot_detector_common)
  14.  
  15. -if (WIN32)
  16. -   add_subdirectory(tf2_bot_detector_winrt)
  17. -endif()
  18. +# if (WIN32)
  19. +   # add_subdirectory(tf2_bot_detector_winrt)
  20. +# endif()
  21.  
  22.  # add_subdirectory(tf2_bot_detector_updater)
  23.  add_subdirectory(tf2_bot_detector)
  24. diff --git a/cmake/init-postproject.cmake b/cmake/init-postproject.cmake
  25. index 61c26aa..20ff395 100644
  26. --- a/cmake/init-postproject.cmake
  27. +++ b/cmake/init-postproject.cmake
  28. @@ -97,9 +97,9 @@ endif()
  29.  if (WIN32)
  30.     # Restrict ourselves to Windows 8.1 ("windows blue") API where possible
  31.     add_compile_definitions(
  32. -       NTDDI_VERSION=NTDDI_WINBLUE
  33. -       WINVER=_WIN32_WINNT_WINBLUE
  34. -       _WIN32_WINNT=_WIN32_WINNT_WINBLUE
  35. +       NTDDI_VERSION=NTDDI_WIN7
  36. +       WINVER=_WIN32_WINNT_WIN7
  37. +       _WIN32_WINNT=_WIN32_WINNT_WIN7
  38.     )
  39.  
  40.     add_compile_options("/FISdkddkver.h")
  41. diff --git a/tf2_bot_detector/CMakeLists.txt b/tf2_bot_detector/CMakeLists.txt
  42. index a7d8fe6..15f9d31 100644
  43. --- a/tf2_bot_detector/CMakeLists.txt
  44. +++ b/tf2_bot_detector/CMakeLists.txt
  45. @@ -215,9 +215,9 @@ if (TF2BD_ENABLE_DISCORD_INTEGRATION)
  46.  
  47.  endif()
  48.  
  49. -if (WIN32)
  50. -   INCLUDE_TF2BD_WINRT(tf2_bot_detector)
  51. -endif()
  52. +# if (WIN32)
  53. +   # INCLUDE_TF2BD_WINRT(tf2_bot_detector)
  54. +# endif()
  55.  
  56.  find_package(nlohmann_json CONFIG REQUIRED)
  57.  find_package(libzip CONFIG REQUIRED)
  58. diff --git a/tf2_bot_detector/Platform/Windows/Windows.cpp b/tf2_bot_detector/Platform/Windows/Windows.cpp
  59. index 5828d7f..263e5b3 100644
  60. --- a/tf2_bot_detector/Platform/Windows/Windows.cpp
  61. +++ b/tf2_bot_detector/Platform/Windows/Windows.cpp
  62. @@ -6,7 +6,7 @@
  63.  #include "Util/TextUtils.h"
  64.  #include "Log.h"
  65.  #include "WindowsHelpers.h"
  66. -#include "tf2_bot_detector_winrt.h"
  67. +// #include "tf2_bot_detector_winrt.h"
  68.  
  69.  #include <mh/error/ensure.hpp>
  70.  #include <mh/error/exception_details.hpp>
  71. @@ -39,20 +39,20 @@ static std::filesystem::path GetKnownFolderPath(const KNOWNFOLDERID& id)
  72.     return retVal;
  73.  }
  74.  
  75. -static bool IsReallyWindows10OrGreater()
  76. -{
  77. -   using RtlGetVersionFn = NTSTATUS(WINAPI*)(PRTL_OSVERSIONINFOW lpVersionInformation);
  78. +// static bool IsReallyWindows10OrGreater()
  79. +// {
  80. +   // using RtlGetVersionFn = NTSTATUS(WINAPI*)(PRTL_OSVERSIONINFOW lpVersionInformation);
  81.  
  82. -   static const auto s_RtlGetVersionFn = reinterpret_cast<RtlGetVersionFn>(
  83. -       tf2_bot_detector::Platform::GetProcAddressHelper("ntdll.dll", "RtlGetVersion", true));
  84. +   // static const auto s_RtlGetVersionFn = reinterpret_cast<RtlGetVersionFn>(
  85. +       // tf2_bot_detector::Platform::GetProcAddressHelper("ntdll.dll", "RtlGetVersion", true));
  86.  
  87. -   RTL_OSVERSIONINFOW info{};
  88. -   info.dwOSVersionInfoSize = sizeof(info);
  89. -   const auto result = s_RtlGetVersionFn(&info);
  90. -   assert(result == STATUS_SUCCESS);
  91. +   // RTL_OSVERSIONINFOW info{};
  92. +   // info.dwOSVersionInfoSize = sizeof(info);
  93. +   // const auto result = s_RtlGetVersionFn(&info);
  94. +   // assert(result == STATUS_SUCCESS);
  95.  
  96. -   return info.dwMajorVersion >= 10;
  97. -}
  98. +   // return info.dwMajorVersion >= 10;
  99. +// }
  100.  
  101.  static const tf2_bot_detector::WinRT* GetWinRTInterface()
  102.  {
  103. @@ -60,28 +60,28 @@ static const tf2_bot_detector::WinRT* GetWinRTInterface()
  104.     {
  105.         WinRTHelper()
  106.         {
  107. -           constexpr char WINRT_DLL_NAME[] = "tf2_bot_detector_winrt.dll";
  108. -           m_Module = mh_ensure(LoadLibraryA(WINRT_DLL_NAME));
  109. +           // constexpr char WINRT_DLL_NAME[] = "tf2_bot_detector_winrt.dll";
  110. +           // m_Module = mh_ensure(LoadLibraryA(WINRT_DLL_NAME));
  111.  
  112. -           CreateWinRTInterfaceFn func = reinterpret_cast<CreateWinRTInterfaceFn>(GetProcAddressHelper(WINRT_DLL_NAME, "CreateWinRTInterface"));
  113. +           // CreateWinRTInterfaceFn func = reinterpret_cast<CreateWinRTInterfaceFn>(GetProcAddressHelper(WINRT_DLL_NAME, "CreateWinRTInterface"));
  114.  
  115. -           m_WinRT.reset(func());
  116. +           // m_WinRT.reset(func());
  117.  
  118. -           struct DummyType {};
  119. -           m_ExceptionDetailsHandler = mh::exception_details::add_handler(
  120. -               typeid(DummyType), m_WinRT->GetWinRTExceptionDetailsHandler());
  121. -       }
  122. -       WinRTHelper(WinRTHelper&& other) noexcept :
  123. -           m_Module(std::exchange(other.m_Module, nullptr)),
  124. -           m_WinRT(std::move(other.m_WinRT))
  125. -       {
  126. +           // struct DummyType {};
  127. +           // m_ExceptionDetailsHandler = mh::exception_details::add_handler(
  128. +               // typeid(DummyType), m_WinRT->GetWinRTExceptionDetailsHandler());
  129.         }
  130. +       // WinRTHelper(WinRTHelper&& other) noexcept :
  131. +           // m_Module(std::exchange(other.m_Module, nullptr)),
  132. +           // m_WinRT(std::move(other.m_WinRT))
  133. +       // {
  134. +       // }
  135.         WinRTHelper& operator=(WinRTHelper&& other) noexcept
  136.         {
  137. -           destroy();
  138. +           // destroy();
  139.  
  140. -           m_Module = std::exchange(other.m_Module, nullptr);
  141. -           m_WinRT = std::move(other.m_WinRT);
  142. +           // m_Module = std::exchange(other.m_Module, nullptr);
  143. +           // m_WinRT = std::move(other.m_WinRT);
  144.  
  145.             return *this;
  146.         }
  147. @@ -92,27 +92,27 @@ static const tf2_bot_detector::WinRT* GetWinRTInterface()
  148.  
  149.         void destroy()
  150.         {
  151. -           m_WinRT.reset();
  152. +           // m_WinRT.reset();
  153.  
  154. -           if (m_Module)
  155. -           {
  156. -               mh_ensure(FreeLibrary(m_Module));
  157. -               m_Module = {};
  158. -           }
  159. +           // if (m_Module)
  160. +           // {
  161. +               // mh_ensure(FreeLibrary(m_Module));
  162. +               // m_Module = {};
  163. +           // }
  164.         }
  165.  
  166. -       HMODULE m_Module{};
  167. -       std::unique_ptr<WinRT> m_WinRT;
  168. -       mh::exception_details::handler m_ExceptionDetailsHandler;
  169. +       // HMODULE m_Module{};
  170. +       // std::unique_ptr<WinRT> m_WinRT;
  171. +       // mh::exception_details::handler m_ExceptionDetailsHandler;
  172.     };
  173.  
  174.     static const tf2_bot_detector::WinRT* s_Value = []() -> const tf2_bot_detector::WinRT*
  175.     {
  176. -       if (IsReallyWindows10OrGreater())
  177. -       {
  178. -           static WinRTHelper s_Helper;
  179. -           return s_Helper.m_WinRT.get();
  180. -       }
  181. +       // if (IsReallyWindows10OrGreater())
  182. +       // {
  183. +           // static WinRTHelper s_Helper;
  184. +           // return s_Helper.m_WinRT.get();
  185. +       // }
  186.  
  187.         return nullptr;
  188.     }();
  189. @@ -137,75 +137,75 @@ std::filesystem::path tf2_bot_detector::Platform::GetCurrentExeDir()
  190.  
  191.  std::filesystem::path tf2_bot_detector::Platform::GetLegacyAppDataDir()
  192.  {
  193. -   if (auto winrt = GetWinRTInterface())
  194. -   {
  195. -       try
  196. -       {
  197. -           auto packageFamilyName = GetWinRTInterface()->GetCurrentPackageFamilyName();
  198. -           if (packageFamilyName.empty())
  199. -               return {};
  200. -
  201. -           return GetKnownFolderPath(FOLDERID_LocalAppData) / "Packages" / packageFamilyName / "LocalCache" / "Roaming";
  202. -       }
  203. -       catch (...)
  204. -       {
  205. -           LogException();
  206. -       }
  207. -   }
  208. +   // if (auto winrt = GetWinRTInterface())
  209. +   // {
  210. +       // try
  211. +       // {
  212. +           // auto packageFamilyName = GetWinRTInterface()->GetCurrentPackageFamilyName();
  213. +           // if (packageFamilyName.empty())
  214. +               // return {};
  215. +
  216. +           // return GetKnownFolderPath(FOLDERID_LocalAppData) / "Packages" / packageFamilyName / "LocalCache" / "Roaming";
  217. +       // }
  218. +       // catch (...)
  219. +       // {
  220. +           // LogException();
  221. +       // }
  222. +   // }
  223.  
  224.     return {};
  225.  }
  226.  
  227.  std::filesystem::path tf2_bot_detector::Platform::GetRootLocalAppDataDir()
  228.  {
  229. -   if (auto winrt = GetWinRTInterface())
  230. -   {
  231. -       try
  232. -       {
  233. -           if (winrt->IsInPackage())
  234. -               return winrt->GetPackageLocalAppDataDir();
  235. -       }
  236. -       catch (...)
  237. -       {
  238. -           LogException();
  239. -       }
  240. -   }
  241. +   // if (auto winrt = GetWinRTInterface())
  242. +   // {
  243. +       // try
  244. +       // {
  245. +           // if (winrt->IsInPackage())
  246. +               // return winrt->GetPackageLocalAppDataDir();
  247. +       // }
  248. +       // catch (...)
  249. +       // {
  250. +           // LogException();
  251. +       // }
  252. +   // }
  253.  
  254.     return GetKnownFolderPath(FOLDERID_LocalAppData);
  255.  }
  256.  
  257.  std::filesystem::path tf2_bot_detector::Platform::GetRootRoamingAppDataDir()
  258.  {
  259. -   if (auto winrt = GetWinRTInterface())
  260. -   {
  261. -       try
  262. -       {
  263. -           if (winrt->IsInPackage())
  264. -               return winrt->GetPackageRoamingAppDataDir();
  265. -       }
  266. -       catch (...)
  267. -       {
  268. -           LogException();
  269. -       }
  270. -   }
  271. +   // if (auto winrt = GetWinRTInterface())
  272. +   // {
  273. +       // try
  274. +       // {
  275. +           // if (winrt->IsInPackage())
  276. +               // return winrt->GetPackageRoamingAppDataDir();
  277. +       // }
  278. +       // catch (...)
  279. +       // {
  280. +           // LogException();
  281. +       // }
  282. +   // }
  283.  
  284.     return GetKnownFolderPath(FOLDERID_RoamingAppData);
  285.  }
  286.  
  287.  std::filesystem::path tf2_bot_detector::Platform::GetRootTempDataDir()
  288.  {
  289. -   if (auto winrt = GetWinRTInterface())
  290. -   {
  291. -       try
  292. -       {
  293. -           if (winrt->IsInPackage())
  294. -               return winrt->GetPackageTempDir();
  295. -       }
  296. -       catch (...)
  297. -       {
  298. -           LogException();
  299. -       }
  300. -   }
  301. +   // if (auto winrt = GetWinRTInterface())
  302. +   // {
  303. +       // try
  304. +       // {
  305. +           // if (winrt->IsInPackage())
  306. +               // return winrt->GetPackageTempDir();
  307. +       // }
  308. +       // catch (...)
  309. +       // {
  310. +           // LogException();
  311. +       // }
  312. +   // }
  313.  
  314.     return std::filesystem::temp_directory_path();
  315.  }
  316.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement