fe744be2c9d23f7aac2595edd599fe04963f4c84
[reactos.git] / reactos / dll / appcompat / apphelp / apphelp.h
1 /*
2 * Copyright 2013 Mislav Blažević
3 * Copyright 2015-2017 Mark Jansen (mark.jansen@reactos.org)
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18 */
19
20 #ifndef APPHELP_H
21 #define APPHELP_H
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 #include "sdbtypes.h"
28
29 /* Flags for SdbInitDatabase */
30 #define HID_DOS_PATHS 0x1
31 #define HID_DATABASE_FULLPATH 0x2
32 #define HID_NO_DATABASE 0x4
33 #define HID_DATABASE_TYPE_MASK 0xF00F0000
34 #define SDB_DATABASE_MAIN_MSI 0x80020000
35 #define SDB_DATABASE_MAIN_SHIM 0x80030000
36 #define SDB_DATABASE_MAIN_DRIVERS 0x80040000
37
38 typedef struct _SDB {
39 PDB pdb;
40 BOOL auto_loaded;
41 } SDB, *HSDB;
42
43 typedef struct tagATTRINFO {
44 TAG type;
45 DWORD flags;
46 union {
47 QWORD qwattr;
48 DWORD dwattr;
49 WCHAR *lpattr;
50 };
51 } ATTRINFO, *PATTRINFO;
52
53 #define SDB_MAX_SDBS 16
54 #define SDB_MAX_EXES 16
55 #define SDB_MAX_LAYERS 8
56
57 /* Flags for adwExeFlags */
58 #define SHIMREG_DISABLE_SHIM (0x00000001)
59 #define SHIMREG_DISABLE_APPHELP (0x00000002)
60 #define SHIMREG_APPHELP_NOUI (0x00000004)
61 #define SHIMREG_APPHELP_CANCEL (0x10000000)
62 #define SHIMREG_DISABLE_SXS (0x00000010)
63 #define SHIMREG_DISABLE_LAYER (0x00000020)
64 #define SHIMREG_DISABLE_DRIVER (0x00000040)
65
66 /* Flags for dwFlags */
67 #define SHIMREG_HAS_ENVIRONMENT (0x1)
68
69 /* Flags for SdbGetMatchingExe */
70 #define SDBGMEF_IGNORE_ENVIRONMENT (0x1)
71
72 typedef struct tagSDBQUERYRESULT {
73 TAGREF atrExes[SDB_MAX_EXES];
74 DWORD adwExeFlags[SDB_MAX_EXES];
75 TAGREF atrLayers[SDB_MAX_LAYERS];
76 DWORD dwLayerFlags;
77 TAGREF trApphelp;
78 DWORD dwExeCount;
79 DWORD dwLayerCount;
80 GUID guidID;
81 DWORD dwFlags;
82 DWORD dwCustomSDBMap;
83 GUID rgGuidDB[SDB_MAX_SDBS];
84 } SDBQUERYRESULT, *PSDBQUERYRESULT;
85
86 #ifndef APPHELP_NOSDBPAPI
87 #include "sdbpapi.h"
88 #endif
89
90 /* sdbapi.c */
91 PWSTR SdbpStrDup(LPCWSTR string);
92 HSDB WINAPI SdbInitDatabase(DWORD, LPCWSTR);
93 void WINAPI SdbReleaseDatabase(HSDB);
94 BOOL WINAPI SdbGUIDToString(CONST GUID *Guid, PWSTR GuidString, SIZE_T Length);
95 LPCWSTR WINAPI SdbTagToString(TAG tag);
96
97 PDB WINAPI SdbOpenDatabase(LPCWSTR path, PATH_TYPE type);
98 void WINAPI SdbCloseDatabase(PDB);
99 BOOL WINAPI SdbIsNullGUID(CONST GUID *Guid);
100 BOOL WINAPI SdbGetAppPatchDir(HSDB db, LPWSTR path, DWORD size);
101 LPWSTR WINAPI SdbGetStringTagPtr(PDB pdb, TAGID tagid);
102 TAGID WINAPI SdbFindFirstNamedTag(PDB pdb, TAGID root, TAGID find, TAGID nametag, LPCWSTR find_name);
103
104 /* sdbread.c */
105 BOOL WINAPI SdbpReadData(PDB pdb, PVOID dest, DWORD offset, DWORD num);
106 TAG WINAPI SdbGetTagFromTagID(PDB pdb, TAGID tagid);
107 TAGID WINAPI SdbFindFirstTag(PDB pdb, TAGID parent, TAG tag);
108 TAGID WINAPI SdbFindNextTag(PDB pdb, TAGID parent, TAGID prev_child);
109 BOOL WINAPI SdbGetDatabaseID(PDB pdb, GUID* Guid);
110 DWORD WINAPI SdbReadDWORDTag(PDB pdb, TAGID tagid, DWORD ret);
111 QWORD WINAPI SdbReadQWORDTag(PDB pdb, TAGID tagid, QWORD ret);
112 TAGID WINAPI SdbGetFirstChild(PDB pdb, TAGID parent);
113 TAGID WINAPI SdbGetNextChild(PDB pdb, TAGID parent, TAGID prev_child);
114
115 /* sdbfileattr.c*/
116 BOOL WINAPI SdbGetFileAttributes(LPCWSTR path, PATTRINFO *attr_info_ret, LPDWORD attr_count);
117 BOOL WINAPI SdbFreeFileAttributes(PATTRINFO attr_info);
118
119 /* layer.c */
120 BOOL WINAPI AllowPermLayer(PCWSTR path);
121 BOOL WINAPI SdbGetPermLayerKeys(PCWSTR wszPath, PWSTR pwszLayers, PDWORD pdwBytes, DWORD dwFlags);
122 BOOL WINAPI SetPermLayerState(PCWSTR wszPath, PCWSTR wszLayer, DWORD dwFlags, BOOL bMachine, BOOL bEnable);
123
124 /* hsdb.c */
125 BOOL WINAPI SdbGetMatchingExe(HSDB hsdb, LPCWSTR path, LPCWSTR module_name, LPCWSTR env, DWORD flags, PSDBQUERYRESULT result);
126 BOOL WINAPI SdbTagIDToTagRef(HSDB hsdb, PDB pdb, TAGID tiWhich, TAGREF* ptrWhich);
127 BOOL WINAPI SdbTagRefToTagID(HSDB hsdb, TAGREF trWhich, PDB* ppdb, TAGID* ptiWhich);
128 BOOL WINAPI SdbUnpackAppCompatData(HSDB hsdb, LPCWSTR pszImageName, PVOID pData, PSDBQUERYRESULT pQueryResult);
129
130 #define ATTRIBUTE_AVAILABLE 0x1
131 #define ATTRIBUTE_FAILED 0x2
132
133 #include "sdbtagid.h"
134
135 #ifdef __cplusplus
136 } // extern "C"
137 #endif
138
139 #endif // APPHELP_H