Skip to content

ntoskrnl7/win32-ex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Win32Ex

Win32 API Experimental(or Extension) features.

CMake MSYS2 GitHub GitHub release (latest SemVer) Windows 8+ Visual Studio 2008 SP1+ MSYS2 MSYS MSYS2 MinGW 32 bit MSYS2 MinGW 64 bit MSYS2 Clang 32 bit MSYS2 Clang 64 bit MSYS2 MinGW UCRT 64 bit CMake 3.14+ C++ 03+

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


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

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

Optional

  • Headers : Win32Ex/Optional.hpp
  • More

Result

  • Headers : Win32Ex/Result.hpp
  • More

Win32 API Template


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;
}