Qx v0.5.8
Qt Extensions Library
Loading...
Searching...
No Matches
qx-common-windows.h
Go to the documentation of this file.
1#ifndef QX_WINDOWS_COMMON_H
2#define QX_WINDOWS_COMMON_H
3
4// Shared Lib Support
5#include "qx/windows/qx_windows_export.h"
6
7// Qt Includes
8#include <QString>
9
10// Intra-component Includes
12
13// Extra-component Includes
14#include "qx/core/qx-systemerror.h"
15
16namespace Qx
17{
18
19//-Namespace Structs---------------------------------------------------------------------------------------------------------------
20struct QX_WINDOWS_EXPORT ShortcutProperties
21{
22 enum ShowMode {
25 MINIMIZED
26 };
27
33 int iconIndex = 0;
34 ShowMode showMode = NORMAL;
35};
36
37//-Namespace Functions-------------------------------------------------------------------------------------------------------------
38
39// Processes
41
42/* TODO: DWORD processMainThreadId(DWORD processId);
43 *
44 * The best way known so far to figure this out is to use processThreadIds as a baseline and while checking
45 * the threads, use NtQueryInformationThread to get their start addresses and find the one that matches
46 * the processes start address from its PE modules header. GetModuleInformation seems to be the key.
47 *
48 * See https://docs.microsoft.com/en-us/windows/win32/psapi/module-information
49 */
50
51QX_WINDOWS_EXPORT bool processIsRunning(HANDLE processHandle);
52
53QX_WINDOWS_EXPORT SystemError processIsElevated(bool& elevated);
54QX_WINDOWS_EXPORT SystemError processIsElevated(bool& elevated, HANDLE processHandle);
55QX_WINDOWS_EXPORT SystemError processIsElevated(bool& elevated, DWORD processId);
56
57QX_WINDOWS_EXPORT SystemError cleanKillProcess(HANDLE processHandle);
58QX_WINDOWS_EXPORT SystemError forceKillProcess(HANDLE processHandle);
59
60// Error codes
61QX_WINDOWS_EXPORT SystemError getLastError();
62
63// Filesystem
64QX_WINDOWS_EXPORT SystemError createShortcut(QString shortcutPath, ShortcutProperties sp);
65
66}
67
68#endif // QX_WINDOWS_COMMON_H
The SystemError class encapsulates system generated errors as an Qx::Error interface compatible objec...
Definition qx-systemerror.h:22
The Qx namespace is the main namespace through which all non-global functionality of the Qx library i...
Definition qx-processwaiter.cpp:5
QList< DWORD > processThreadIds(DWORD processId)
Definition qx-common-windows.cpp:168
bool processIsRunning(QString processName)
Definition qx-system.cpp:62
SystemError processIsElevated(bool &elevated)
Definition qx-common-windows.cpp:270
SystemError forceKillProcess(quint32 processId)
Definition qx-system_linux.cpp:480
SystemError createShortcut(QString shortcutPath, ShortcutProperties sp)
Definition qx-common-windows.cpp:387
SystemError getLastError()
Definition qx-common-windows.cpp:377
quint32 processId(QString processName)
Definition qx-system_linux.cpp:415
SystemError cleanKillProcess(quint32 processId)
Definition qx-system_linux.cpp:474
The qx-windefs header file provides a subset of Windows data types definitions.
void * HANDLE
Definition qx-windefs.h:8
unsigned long DWORD
Definition qx-windefs.h:4
The ShortcutProperties struct acts as a user-friendly container for holding IShellLink data,...
Definition qx-common-windows.h:21
QString startIn
Definition qx-common-windows.h:30
QString target
Definition qx-common-windows.h:28
QString comment
Definition qx-common-windows.h:31
ShowMode
Definition qx-common-windows.h:22
@ NORMAL
Definition qx-common-windows.h:23
@ MAXIMIZED
Definition qx-common-windows.h:24
QString iconFilePath
Definition qx-common-windows.h:32
QString targetArgs
Definition qx-common-windows.h:29