Skip to content

Commit

Permalink
Add Advapi32 library.
Browse files Browse the repository at this point in the history
  • Loading branch information
ntoskrnl7 committed Jan 25, 2022
1 parent 32faecd commit 11ef682
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 36 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ option(WIN32EX_BUILD_TESTS "Set to ON to build tests" OFF)

add_library(win32ex INTERFACE)

target_link_libraries(win32ex INTERFACE Wtsapi32 Userenv)
target_link_libraries(win32ex INTERFACE Wtsapi32 Userenv advapi32)

target_include_directories(win32ex INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
Expand Down
58 changes: 24 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ Win32 API Experimental(or Extension) features
###### Classes

- Process
- ProcessT<Win32Ex::String>
- ProcessT\<Win32Ex::String\>
- Example
- Attach Process by process id, process handle.

Expand Down Expand Up @@ -180,12 +180,12 @@ Win32 API Experimental(or Extension) features
```

- ProcessW
- ProcessT<Win32Ex::StringW>
- ProcessT\<Win32Ex::StringW\>
- ProcessT\<class StringType = Win32Ex::StringT\>
- Implements WaitableObject.
- RunnableProcess
- **Abstract**
- RunnableProcessT<Win32Ex::String>
- RunnableProcessT\<Win32Ex::String\>
- Example
- Use the RunnableProcess class to run 'user account process'.

Expand All @@ -199,12 +199,12 @@ Win32 API Experimental(or Extension) features

- RunnableProcessW
- **Abstract**
- RunnableProcessT<Win32Ex::StringW>
- RunnableProcessT\<Win32Ex::StringW\>
- RunnableProcessT\<class StringType = Win32Ex::StringT\>
- **Abstract**
- Implements ProcessT.
- UserAccountProcess
- RunnableSessionProcessT<UserAccount, Win32Ex::String>
- RunnableSessionProcessT\<UserAccount, Win32Ex::String\>
- Example
- Runs user account process at the current session.

Expand Down Expand Up @@ -236,18 +236,18 @@ Win32 API Experimental(or Extension) features
```

- UserAccountProcessW
- RunnableSessionProcessT<UserAccount, Win32Ex::StringW>
- RunnableSessionProcessT\<UserAccount, Win32Ex::StringW\>
- UserAccountProcessT
- Implements RunnableProcessT.
- SystemAccountProcess
- RunnableSessionProcessT<SystemAccount, Win32Ex::String>
- RunnableSessionProcessT\<SystemAccount, Win32Ex::String\>
- SystemAccountProcessW
- RunnableSessionProcessT<SystemAccount, Win32Ex::StringW>
- RunnableSessionProcessT\<SystemAccount, Win32Ex::StringW\>
- SystemAccountProcessT
- Implements RunnableProcessT.
- RunnableSessionProcessT\<ProcessAccountType Type, class StringType = Win32Ex::StringT\>
- ElevatedProcess
- ElevatedProcessT<Win32Ex::String>
- ElevatedProcessT\<Win32Ex::String\>
- Example
- Run with elevated permissions UAC.

Expand All @@ -259,7 +259,7 @@ Win32 API Experimental(or Extension) features
```

- ElevatedProcessW
- ElevatedProcessT<Win32Ex::StringW>
- ElevatedProcessT\<Win32Ex::StringW\>
- ElevatedProcessT\<class StringType = Win32Ex::StringT\>
- Implements RunnableProcessT.

Expand Down Expand Up @@ -290,7 +290,7 @@ Win32 API Experimental(or Extension) features
###### Classes

- Session
- SessionT<Win32Ex::String>
- SessionT\<Win32Ex::String\>
- Example
- Runs system account process and user account process at each sessions.

Expand All @@ -313,7 +313,7 @@ Win32 API Experimental(or Extension) features
```

- SessionW
- SessionT<Win32Ex::StringW>
- SessionT\<Win32Ex::StringW\>
- SessionT\<class StringType = Win32Ex::StringT\>

###### Namespaces
Expand Down Expand Up @@ -449,17 +449,7 @@ Win32 API Experimental(or Extension) features
int main(int argc, char* argv[])
{
TestService.SetAcceptStop([]() -> bool
{
SC_HANDLE serviceHandle = TestService.ServiceHandle(SERVICE_USER_DEFINED_CONTROL);
if (serviceHandle == NULL)
return false;
SERVICE_STATUS ss = { 0 };
BOOL result = ControlService(serviceHandle, TEST_SVC_USER_CONTROL_ACCEPT_STOP, &ss);
CloseServiceHandle(serviceHandle);
return (result == TRUE);
});
TestService.SetAcceptStop([]() -> bool { return Test2Service.Control(TEST_SVC_USER_CONTROL_ACCEPT_STOP); });
TestService.Stop();
TestService.Uninstall();
}
Expand Down Expand Up @@ -1148,11 +1138,11 @@ value = GetValue(false).Get(); // == 1

###### Functions

- ShellExecuteExT<_CharType>
- ShellExecuteExT\<_CharType\>

###### Structures

- SHELLEXECUTEINFOT<_CharType>
- SHELLEXECUTEINFOT\<_CharType\>

###### Example

Expand All @@ -1175,14 +1165,14 @@ Win32Ex::ShellExecuteExT<CHAR>(&sei);
###### Functions
- CreateProcessT<_CharType>
- CreateProcessAsUserT<_CharType>
- QueryFullProcessImageNameT<_CharType>
- CreateProcessT\<_CharType\>
- CreateProcessAsUserT\<_CharType\>
- QueryFullProcessImageNameT\<_CharType\>
###### Structures
- STARTUPINFOT<_CharType>
- STARTUPINFOEXT<_CharType>
- STARTUPINFOT\<_CharType\>
- STARTUPINFOEXT\<_CharType\>
###### Example
Expand All @@ -1202,12 +1192,12 @@ Win32Ex::CreateProcessAsUserT<CHAR>(..., &si, ..);

###### Functions

- Process32FirstT<_CharType>
- Process32NextT<_CharType>
- Process32FirstT\<_CharType\>
- Process32NextT<\_CharType\>

###### Structures

- PROCESSENTRY32T<_CharType>
- PROCESSENTRY32T\<_CharType\>

###### Example

Expand Down Expand Up @@ -1258,7 +1248,7 @@ add_executable(tests tests.cpp)
# add dependencies
include(cmake/CPM.cmake)
CPMAddPackage("gh:ntoskrnl7/win32-ex@0.8.13")
CPMAddPackage("gh:ntoskrnl7/win32-ex@0.8.14")
# link dependencies
target_link_libraries(tests win32ex)
Expand Down
2 changes: 1 addition & 1 deletion include/Win32Ex/Internal/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ Module Name:

#define WIN32EX_VERSION_MAJOR 0
#define WIN32EX_VERSION_MINOR 8
#define WIN32EX_VERSION_PATCH 13
#define WIN32EX_VERSION_PATCH 14

#endif // _WIN32EX_VERSION_H_
2 changes: 2 additions & 0 deletions include/Win32Ex/System/Service.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ Module Name:
#endif
#include <windows.h>

#pragma comment(lib, "Advapi32.lib")

#ifdef WIN32EX_USE_SERVICE_SIMULATE_MODE
#include <wtsapi32.h>
#pragma comment(lib, "Wtsapi32.lib")
Expand Down

0 comments on commit 11ef682

Please sign in to comment.