d1897aeabd2b2f4f0ed98a60104300e1e4d5d7d7
[reactos.git] / reactos / dll / appcompat / apphelp / apphelp.h
1 /*
2 * Copyright 2013 Mislav Blažević
3 * Copyright 2015-2017 Mark Jansen
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 db;
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 #include "sdbpapi.h"
87
88 /* sdbapi.c */
89 PWSTR SdbpStrDup(LPCWSTR string);
90 HSDB WINAPI SdbInitDatabase(DWORD, LPCWSTR);
91 void WINAPI SdbReleaseDatabase(HSDB);
92 BOOL WINAPI SdbGUIDToString(CONST GUID *Guid, PWSTR GuidString, SIZE_T Length);
93 LPCWSTR WINAPI SdbTagToString(TAG tag);
94
95 PDB WINAPI SdbOpenDatabase(LPCWSTR path, PATH_TYPE type);
96 void WINAPI SdbCloseDatabase(PDB);
97 BOOL WINAPI SdbIsNullGUID(CONST GUID *Guid);
98 BOOL WINAPI SdbGetAppPatchDir(HSDB db, LPWSTR path, DWORD size);
99 LPWSTR WINAPI SdbGetStringTagPtr(PDB db, TAGID tagid);
100 TAGID WINAPI SdbFindFirstNamedTag(PDB db, TAGID root, TAGID find, TAGID nametag, LPCWSTR find_name);
101
102 /* sdbread.c */
103 BOOL WINAPI SdbpReadData(PDB db, PVOID dest, DWORD offset, DWORD num);
104 TAG WINAPI SdbGetTagFromTagID(PDB db, TAGID tagid);
105 TAGID WINAPI SdbFindFirstTag(PDB db, TAGID parent, TAG tag);
106 TAGID WINAPI SdbFindNextTag(PDB db, TAGID parent, TAGID prev_child);
107 BOOL WINAPI SdbGetDatabaseID(PDB db, GUID* Guid);
108 DWORD WINAPI SdbReadDWORDTag(PDB db, TAGID tagid, DWORD ret);
109 QWORD WINAPI SdbReadQWORDTag(PDB db, TAGID tagid, QWORD ret);
110 TAGID WINAPI SdbGetFirstChild(PDB db, TAGID parent);
111 TAGID WINAPI SdbGetNextChild(PDB db, TAGID parent, TAGID prev_child);
112
113 /* sdbfileattr.c*/
114 BOOL WINAPI SdbGetFileAttributes(LPCWSTR path, PATTRINFO *attr_info_ret, LPDWORD attr_count);
115 BOOL WINAPI SdbFreeFileAttributes(PATTRINFO attr_info);
116
117 /* layer.c */
118 BOOL WINAPI AllowPermLayer(PCWSTR path);
119 BOOL WINAPI SdbGetPermLayerKeys(PCWSTR wszPath, PWSTR pwszLayers, PDWORD pdwBytes, DWORD dwFlags);
120 BOOL WINAPI SetPermLayerState(PCWSTR wszPath, PCWSTR wszLayer, DWORD dwFlags, BOOL bMachine, BOOL bEnable);
121
122 /* hsdb.c */
123 BOOL WINAPI SdbGetMatchingExe(HSDB hsdb, LPCWSTR path, LPCWSTR module_name, LPCWSTR env, DWORD flags, PSDBQUERYRESULT result);
124 BOOL WINAPI SdbTagIDToTagRef(HSDB hsdb, PDB pdb, TAGID tiWhich, TAGREF* ptrWhich);
125
126
127 #define ATTRIBUTE_AVAILABLE 0x1
128 #define ATTRIBUTE_FAILED 0x2
129
130 #include "sdbtagid.h"
131
132 #ifdef __cplusplus
133 } // extern "C"
134 #endif
135
136 #endif // APPHELP_H