diff --git a/CMakeSettings.json b/CMakeSettings.json new file mode 100644 index 000000000..1dad0e113 --- /dev/null +++ b/CMakeSettings.json @@ -0,0 +1,16 @@ +{ + "configurations": [ + { + "name": "x64-Debug", + "generator": "Ninja", + "configurationType": "Debug", + "inheritEnvironments": [ "msvc_x64_x64" ], + "buildRoot": "${projectDir}\\out\\build\\${name}", + "installRoot": "${projectDir}\\out\\install\\${name}", + "cmakeCommandArgs": "", + "buildCommandArgs": "", + "ctestCommandArgs": "", + "cmakeToolchain": "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/vcpkg/scripts/buildsystems/vcpkg.cmake" + } + ] +} \ No newline at end of file diff --git a/include/wil/toolhelp32.h b/include/wil/toolhelp32.h new file mode 100644 index 000000000..051d935f8 --- /dev/null +++ b/include/wil/toolhelp32.h @@ -0,0 +1,36 @@ +#ifndef __WIL_TOOLHELP32_INCLUDED +#define __WIL_TOOLHELP32_INCLUDED +#include +namespace wil +{ + namespace details + { + + } + + template + void for_each_process(TCallback&& /*callback*/) + { + + } + + template + void for_each_thread(TCallback&& /*callback*/) + { + + } + + template + void for_each_module(TCallback&& /*callback*/) + { + + } + + template + void for_each_heap(TCallback&& /*callback*/) + { + + } +} + +#endif \ No newline at end of file diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index d5f7c7436..99434393f 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -75,6 +75,7 @@ set(COMMON_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/WistdTests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/wiTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/../natvis/wil.natvis + ${CMAKE_CURRENT_SOURCE_DIR}/Toolhelp32Tests.cpp ) if (MSVC) diff --git a/tests/Toolhelp32Tests.cpp b/tests/Toolhelp32Tests.cpp new file mode 100644 index 000000000..b0167b272 --- /dev/null +++ b/tests/Toolhelp32Tests.cpp @@ -0,0 +1,32 @@ +#include "common.h" +#include +#include +#include + +TEST_CASE("Toolhelp32", "[EnumProcesses]") +{ + wil::for_each_process([](PROCESSENTRY32 entry) { + REQUIRE_FALSE(std::strlen(entry.szExeFile) == 0); + }); +} + +TEST_CASE("Toolhelp32", "[EnumModules]") +{ + wil::for_each_module([](MODULEENTRY32 entry) { + REQUIRE_FALSE(std::strlen(entry.szExePath) == 0); + }); +} + +TEST_CASE("Toolhelp32", "[EnumThreads]") +{ + wil::for_each_thread([](THREADENTRY32 entry) { + REQUIRE_FALSE(entry.th32ThreadID == 0); + }); +} + +TEST_CASE("Toolhelp32", "[EnumHeaps]") +{ + wil::for_each_heap([](HEAPLIST32 entry) { + REQUIRE_FALSE(entry.th32HeapID == 0); + }); +} \ No newline at end of file