win32-ex
win32-ex copied to clipboard
Win32 API Experimental(or Extension) features
Win32Ex
Win32 API Experimental(or Extension) features.
It is a library that helps to more easily implement tasks such as service program creation and process creation for each user account in Windows environment.
It is implemented with outdated syntax and features because it is also designed for use in legacy development environments (Visual Studio 2008 SP1).
Requirements
- Windows 8 or later
- Visual Studio 2008 SP1 or later
- MSYS2
- MSYS
- MinGW 32-bit
- MinGW 64-bit
- MinGW Clang 32-bit
- MinGW Clang 64-bit
- MinGW UCRT 64-bit
Test Environments
- Windows 10
- MSYS2
- MSYS
- MinGW 32-bit
- MinGW 64-bit
- MinGW Clang 32-bit
- MinGW Clang 64-bit
- MinGW UCRT 64-bit
- Visual Studio
- 2008 SP1
- 2010, 2012, 2017, 2019, 2022
Contents
-
Win32Ex
- Requirements
- Test Environments
- Contents
-
Features
-
System Services
- Processes and Threads
- Remote Desktop Services
- Services
-
Windows System Information
- Handles and Objects
-
Security and Identity
- Privileges
- Access Tokens
- Security Descriptors
- Security Identifiers
-
Etc
- Optional
- Result
- Win32 API Template
-
System Services
-
Test
- CMake
-
Usage
- CMakeLists.txt
- test.cpp
Features
- Headers : Win32Ex.h
System Services
- Headers : Win32Ex/System.h
- More
Processes and Threads
- Headers : Win32Ex/System/Process.h, Win32Ex/System/Process.hpp
- More
Remote Desktop Services
- Headers : Win32Ex/System/Session.hpp
- More
Services
- Headers : Win32Ex/System/Service.hpp
- More
Windows System Information
- More
Handles and Objects
- Headers : Win32Ex/System/Object.h
- More
Security and Identity
- Headers : Win32Ex/Security.h
- More
Privileges
- Headers : Win32Ex/Security/Privilege.h, Win32Ex/Security/Privilege.hpp
- More
Access Tokens
- Headers : Win32Ex/Security/Token.h, Win32Ex/Security/Token.hpp
- More
Security Descriptors
- Headers : Win32Ex/Security/Descriptor.h
- More
Security Identifiers
- Headers : Security\Sid.h
- More
Etc
- More
Optional
- Headers : Win32Ex/Optional.hpp
- More
Result
- Headers : Win32Ex/Result.hpp
- More
Win32 API Template
- More
Test
CMake
-
With MSYS2
cd test mkdir build && cd build if [ "$MSYSTEM" = "MSYS" ]; then cmake .. else cmake -G "MinGW Makefiles" .. fi cmake --build . if [ "$?" -eq 0 ]; then export LC_ALL=C; unset LANGUAGE ctest . --verbose fi
-
With Visual Studio
cd test mkdir build cd build cmake .. cmake --build . -- /p:CharacterSet=Unicode if errorlevel 0 ctest . --verbose -C Debug
Usage
We usually recommend using CMake. However, if you are using Visual Studio directly, add {This repository}/include to the 'Additional Include Directories property'.
CMakeLists.txt
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
# create project
project(MyProject)
# add executable
add_executable(tests tests.cpp)
# add dependencies
include(cmake/CPM.cmake)
CPMAddPackage("gh:ntoskrnl7/[email protected]")
# link dependencies
target_link_libraries(tests win32ex)
test.cpp
#include <iostream>
#include <Win32Ex/System/Process.hpp>
#include <Win32Ex/System/Service.hpp>
// or #include <Win32Ex.h>
// or #include <Win32Ex/System.h>
Win32Ex::System::Service SimpleService("SimpleSvc");
int main()
{
std::cout << Win32Ex::System::Process::All().size();
Win32Ex::System::Service::Instance<SimpleService>::Get()
.OnStart([]() {
// TODO
})
.OnStop([]() {
// TODO
})
.OnPause([]() {
// TODO
})
.OnContinue([]() {
// TODO
})
.OnError([](DWORD ErrorCode, PCSTR Message) {
// TODO
})
.Run();
return 0;
}