ReactOS  0.4.15-dev-2534-geba00d1
apphelp.h
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Application compatibility module
3  * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4  * PURPOSE: common structures / functions
5  * COPYRIGHT: Copyright 2013 Mislav Blažević
6  * Copyright 2017-2019 Mark Jansen (mark.jansen@reactos.org)
7  */
8 
9 #ifndef APPHELP_H
10 #define APPHELP_H
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 #include <appcompat/sdbtypes.h>
17 
18 /* Flags for SdbInitDatabase */
19 #define HID_DOS_PATHS 0x1
20 #define HID_DATABASE_FULLPATH 0x2
21 #define HID_NO_DATABASE 0x4
22 #define HID_DATABASE_TYPE_MASK 0xF00F0000
23 #define SDB_DATABASE_MAIN_MSI 0x80020000
24 #define SDB_DATABASE_MAIN_SHIM 0x80030000
25 #define SDB_DATABASE_MAIN_DRIVERS 0x80040000
26 
27 // Shim database types
28 #define SDB_DATABASE_SHIM 0x00010000
29 
30 typedef struct _SDB {
33 } SDB, *HSDB;
34 
35 typedef struct tagATTRINFO {
38  union {
42  };
44 
45 #define SDB_MAX_SDBS 16
46 #define SDB_MAX_EXES 16
47 #define SDB_MAX_LAYERS 8
48 
49 /* Flags for adwExeFlags */
50 #define SHIMREG_DISABLE_SHIM (0x00000001)
51 #define SHIMREG_DISABLE_APPHELP (0x00000002)
52 #define SHIMREG_APPHELP_NOUI (0x00000004)
53 #define SHIMREG_APPHELP_CANCEL (0x10000000)
54 #define SHIMREG_DISABLE_SXS (0x00000010)
55 #define SHIMREG_DISABLE_LAYER (0x00000020)
56 #define SHIMREG_DISABLE_DRIVER (0x00000040)
57 
58 /* Flags for dwFlags */
59 #define SHIMREG_HAS_ENVIRONMENT (0x1)
60 
61 /* Flags for SdbGetMatchingExe */
62 #define SDBGMEF_IGNORE_ENVIRONMENT (0x1)
63 
64 typedef struct tagSDBQUERYRESULT {
77 
78 
79 #define DB_INFO_FLAGS_VALID_GUID 1
80 
81 typedef struct _DB_INFORMATION
82 {
88  /* Win10+ has an extra field here */
90 
91 
92 #ifndef APPHELP_NOSDBPAPI
93 #include "sdbpapi.h"
94 #endif
95 
96 /* sdbapi.c */
97 PWSTR SdbpStrDup(LPCWSTR string);
98 DWORD SdbpStrsize(PCWSTR string);
103 
114 BOOL WINAPI SdbUnregisterDatabase(_In_ const GUID *pguidDB);
115 
116 /* sdbread.c */
129 
130 /* sdbfileattr.c*/
131 BOOL WINAPI SdbGetFileAttributes(LPCWSTR path, PATTRINFO *attr_info_ret, LPDWORD attr_count);
133 
134 /* layer.c */
138 
139 /* hsdb.c */
145 
146 #define ATTRIBUTE_AVAILABLE 0x1
147 #define ATTRIBUTE_FAILED 0x2
148 
149 #include <appcompat/sdbtagid.h>
150 
151 #ifdef __cplusplus
152 } // extern "C"
153 #endif
154 
155 #endif // APPHELP_H
DWORD TAGREF
static TAGREF PDB * ppdb
Definition: db.cpp:171
static PWSTR GuidString
Definition: apphelp.c:93
const uint16_t * PCWSTR
Definition: typedefs.h:57
#define SDB_MAX_EXES
Definition: apphelp.h:46
struct tagSDBQUERYRESULT SDBQUERYRESULT
static PDB pdb
Definition: db.cpp:172
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
GLuint64EXT * result
Definition: glext.h:11304
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
INT PATH_TYPE
BOOL WINAPI SetPermLayerState(PCWSTR wszPath, PCWSTR wszLayer, DWORD dwFlags, BOOL bMachine, BOOL bEnable)
Definition: layer.c:467
LPCWSTR pszImageName
Definition: env.c:57
static LPCWSTR LPCWSTR module_name
Definition: db.cpp:170
struct _SDB SDB
BOOL WINAPI SdbGetFileAttributes(LPCWSTR path, PATTRINFO *attr_info_ret, LPDWORD attr_count)
Definition: sdbfileattr.c:239
DWORD flags
Definition: apphelp.h:37
uint16_t * PWSTR
Definition: typedefs.h:56
DWORD WINAPI SdbQueryData(HSDB hsdb, TAGREF trWhich, LPCWSTR lpszDataName, LPDWORD lpdwDataType, LPVOID lpBuffer, LPDWORD lpcbBufferSize)
Definition: hsdb.c:832
WCHAR * lpattr
Definition: apphelp.h:41
BOOL WINAPI SdbRegisterDatabaseEx(_In_ LPCWSTR pszDatabasePath, _In_ DWORD dwDatabaseType, _In_opt_ const PULONGLONG pTimeStamp)
Definition: apphelp.c:261
DWORD WINAPI SdbReadDWORDTag(PDB pdb, TAGID tagid, DWORD ret)
Definition: sdbread.c:305
HSDB WINAPI SdbInitDatabase(DWORD, LPCWSTR)
Definition: hsdb.c:369
TAGREF atrLayers[SDB_MAX_LAYERS]
Definition: apphelp.h:67
HRESULT WINAPI SdbGetAppPatchDir(HSDB db, LPWSTR path, DWORD size)
Definition: hsdb.c:579
static PDB TAGID tiWhich
Definition: db.cpp:172
LPWSTR WINAPI SdbGetStringTagPtr(PDB pdb, TAGID tagid)
Definition: sdbread.c:375
LPCWSTR Description
Definition: apphelp.h:86
Definition: ecma_167.h:138
GLuint buffer
Definition: glext.h:5915
DWORD dwLayerFlags
Definition: apphelp.h:68
BOOL WINAPI SdbGetMatchingExe(HSDB hsdb, LPCWSTR path, LPCWSTR module_name, LPCWSTR env, DWORD flags, PSDBQUERYRESULT result)
Definition: hsdb.c:439
BOOL WINAPI SdbpReadData(PDB pdb, PVOID dest, DWORD offset, DWORD num)
Definition: sdbread.c:14
BOOL WINAPI AllowPermLayer(PCWSTR path)
Definition: layer.c:320
DWORD dwLayerCount
Definition: apphelp.h:71
TAGREF trApphelp
Definition: apphelp.h:69
DWORD dwMajor
Definition: apphelp.h:84
LPCWSTR LPCWSTR LPCWSTR DWORD PSDBQUERYRESULT_VISTA pQueryResult
Definition: env.c:37
DWORD SdbpStrsize(PCWSTR string)
Definition: sdbapi.c:157
BOOL WINAPI SdbUnregisterDatabase(_In_ const GUID *pguidDB)
Definition: apphelp.c:406
VOID WINAPI SdbFreeDatabaseInformation(PDB_INFORMATION information)
Definition: sdbapi.c:527
#define _In_opt_
Definition: no_sal2.h:212
Definition: apphelp.h:30
DWORD WINAPI SdbGetTagDataSize(PDB pdb, TAGID tagid)
Definition: sdbread.c:109
DWORD const PULONGLONG pTimeStamp
Definition: register.cpp:76
static TAGID TAGID TAGID nametag
Definition: db.cpp:155
static TAGREF PDB TAGID * ptiWhich
Definition: db.cpp:171
static PCWSTR wszLayer
Definition: layerapi.c:36
static PDB TAGID TAGREF * ptrWhich
Definition: db.cpp:172
static TAGREF trWhich
Definition: db.cpp:171
unsigned int BOOL
Definition: ntddk_ex.h:94
struct tagATTRINFO ATTRINFO
LPCWSTR pszDatabasePath
Definition: env.c:38
QWORD WINAPI SdbReadQWORDTag(PDB pdb, TAGID tagid, QWORD ret)
Definition: sdbread.c:321
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:175
struct tagATTRINFO * PATTRINFO
BOOL WINAPI SdbGUIDToString(CONST GUID *Guid, PWSTR GuidString, SIZE_T Length)
Definition: sdbapi.c:412
LPCWSTR WINAPI SdbTagToString(TAG tag)
Definition: sdbapi.c:752
QWORD qwattr
Definition: apphelp.h:39
static PWSTR pwszLayers
Definition: layerapi.c:35
DWORD WINAPI SdbQueryDataExTagID(PDB pdb, TAGID tiExe, LPCWSTR lpszDataName, LPDWORD lpdwDataType, LPVOID lpBuffer, LPDWORD lpcbBufferSize, TAGID *ptiData)
Definition: sdbapi.c:614
TAG type
Definition: apphelp.h:36
TAGID WINAPI SdbFindNextTag(PDB pdb, TAGID parent, TAGID prev_child)
Definition: sdbread.c:231
#define SDB_MAX_SDBS
Definition: apphelp.h:45
BOOL WINAPI SdbGetPermLayerKeys(PCWSTR wszPath, PWSTR pwszLayers, PDWORD pdwBytes, DWORD dwFlags)
Definition: layer.c:364
struct tagSDBQUERYRESULT * PSDBQUERYRESULT
GLsizeiptr size
Definition: glext.h:5919
TAGID WINAPI SdbGetNextChild(PDB pdb, TAGID parent, TAGID prev_child)
Definition: sdbread.c:171
static TAGID TAGID TAGID LPCWSTR find_name
Definition: db.cpp:155
r parent
Definition: btrfs.c:2944
BOOL WINAPI SdbGetDatabaseID(PDB pdb, GUID *Guid)
Definition: sdbread.c:388
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
_Must_inspect_result_ _In_ WDFOBJECT _In_ CONST GUID * Guid
Definition: wdfobject.h:760
GLintptr offset
Definition: glext.h:5920
BOOL WINAPI SdbIsNullGUID(CONST GUID *Guid)
Definition: sdbapi.c:431
UINT64 QWORD
Definition: shimdbg.c:104
static TAGREF LPCWSTR lpszDataName
Definition: db.cpp:175
DWORD dwFlags
Definition: apphelp.h:83
#define WINAPI
Definition: msvc.h:6
static TAGREF LPCWSTR LPDWORD LPVOID LPDWORD lpcbBufferSize
Definition: db.cpp:175
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint num
Definition: glext.h:9618
static PWSTR PDWORD pdwBytes
Definition: layerapi.c:35
GLbitfield flags
Definition: glext.h:7161
TAGID WINAPI SdbFindFirstTag(PDB pdb, TAGID parent, TAG tag)
Definition: sdbread.c:208
void WINAPI SdbCloseDatabase(PDB)
Definition: sdbapi.c:373
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
void WINAPI SdbReleaseDatabase(HSDB)
Definition: hsdb.c:417
DWORD dwExeCount
Definition: apphelp.h:70
DWORD dwCustomSDBMap
Definition: apphelp.h:74
BOOL WINAPI SdbGetDatabaseInformation(PDB pdb, PDB_INFORMATION information)
Definition: sdbapi.c:502
BOOL WINAPI SdbTagIDToTagRef(HSDB hsdb, PDB pdb, TAGID tiWhich, TAGREF *ptrWhich)
Definition: hsdb.c:669
DWORD dwattr
Definition: apphelp.h:40
PWSTR SdbpStrDup(LPCWSTR string)
Definition: sdbapi.c:162
TAGREF atrExes[SDB_MAX_EXES]
Definition: apphelp.h:65
static TAGID tiExe
Definition: db.cpp:177
#define _In_
Definition: no_sal2.h:158
ULONG_PTR SIZE_T
Definition: typedefs.h:80
_In_ BOOL bEnable
Definition: winddi.h:3426
GUID rgGuidDB[SDB_MAX_SDBS]
Definition: apphelp.h:75
static TAGREF LPCWSTR LPDWORD lpdwDataType
Definition: db.cpp:175
struct _DB_INFORMATION * PDB_INFORMATION
DWORD dwMinor
Definition: apphelp.h:85
BOOL WINAPI SdbFreeFileAttributes(PATTRINFO attr_info)
Definition: sdbfileattr.c:214
TAGID WINAPI SdbFindFirstNamedTag(PDB pdb, TAGID root, TAGID find, TAGID nametag, LPCWSTR find_name)
Definition: sdbapi.c:544
TAGID WINAPI SdbGetFirstChild(PDB pdb, TAGID parent)
Definition: sdbread.c:142
Definition: fs_rec.h:142
DWORD * PDWORD
Definition: pedump.c:68
static LPCWSTR LPCWSTR LPCWSTR env
Definition: db.cpp:170
BOOL auto_loaded
Definition: apphelp.h:32
DWORD dwDatabaseType
Definition: register.cpp:75
static TAGID TAGID find
Definition: db.cpp:155
DWORD adwExeFlags[SDB_MAX_EXES]
Definition: apphelp.h:66
__GNU_EXTENSION typedef unsigned __int64 * PULONGLONG
Definition: ntbasedef.h:383
uint32_t * LPDWORD
Definition: typedefs.h:59
static PDB_INFORMATION information
Definition: db.cpp:178
static TAGID LPCWSTR LPDWORD LPVOID LPDWORD TAGID * ptiData
Definition: db.cpp:177
PDB pdb
Definition: apphelp.h:31
static char * dest
Definition: rtl.c:135
BOOL WINAPI SdbReadBinaryTag(PDB pdb, TAGID tagid, PBYTE buffer, DWORD size)
Definition: sdbread.c:338
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
DWORD TAGID
WCHAR * LPWSTR
Definition: xmlstorage.h:184
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827
TAG WINAPI SdbGetTagFromTagID(PDB pdb, TAGID tagid)
Definition: sdbread.c:93
BOOL WINAPI SdbUnpackAppCompatData(HSDB hsdb, LPCWSTR pszImageName, PVOID pData, PSDBQUERYRESULT pQueryResult)
Definition: hsdb.c:761
#define SDB_MAX_LAYERS
Definition: apphelp.h:47
BOOL WINAPI SdbTagRefToTagID(HSDB hsdb, TAGREF trWhich, PDB *ppdb, TAGID *ptiWhich)
Definition: hsdb.c:638
LPWSTR WINAPI SdbpGetString(PDB pdb, TAGID tagid, PDWORD size)
Definition: sdbread.c:47
BYTE * PBYTE
Definition: pedump.c:66
static PCWSTR BOOL bMachine
Definition: layerapi.c:34
#define CONST
Definition: pedump.c:81
struct _DB_INFORMATION DB_INFORMATION
struct _SDB * HSDB
PDB WINAPI SdbOpenDatabase(LPCWSTR path, PATH_TYPE type)
Definition: sdbapi.c:329