1 /* 2 * PROJECT: ReactOS Application compatibility module 3 * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+) 4 * PURPOSE: common structures / functions 5 * COPYRIGHT: Copyright 2013 Mislav Blažević 6 * Copyright 2017 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 "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 typedef struct _SDB { 28 PDB pdb; 29 BOOL auto_loaded; 30 } SDB, *HSDB; 31 32 typedef struct tagATTRINFO { 33 TAG type; 34 DWORD flags; 35 union { 36 QWORD qwattr; 37 DWORD dwattr; 38 WCHAR *lpattr; 39 }; 40 } ATTRINFO, *PATTRINFO; 41 42 #define SDB_MAX_SDBS 16 43 #define SDB_MAX_EXES 16 44 #define SDB_MAX_LAYERS 8 45 46 /* Flags for adwExeFlags */ 47 #define SHIMREG_DISABLE_SHIM (0x00000001) 48 #define SHIMREG_DISABLE_APPHELP (0x00000002) 49 #define SHIMREG_APPHELP_NOUI (0x00000004) 50 #define SHIMREG_APPHELP_CANCEL (0x10000000) 51 #define SHIMREG_DISABLE_SXS (0x00000010) 52 #define SHIMREG_DISABLE_LAYER (0x00000020) 53 #define SHIMREG_DISABLE_DRIVER (0x00000040) 54 55 /* Flags for dwFlags */ 56 #define SHIMREG_HAS_ENVIRONMENT (0x1) 57 58 /* Flags for SdbGetMatchingExe */ 59 #define SDBGMEF_IGNORE_ENVIRONMENT (0x1) 60 61 typedef struct tagSDBQUERYRESULT { 62 TAGREF atrExes[SDB_MAX_EXES]; 63 DWORD adwExeFlags[SDB_MAX_EXES]; 64 TAGREF atrLayers[SDB_MAX_LAYERS]; 65 DWORD dwLayerFlags; 66 TAGREF trApphelp; 67 DWORD dwExeCount; 68 DWORD dwLayerCount; 69 GUID guidID; 70 DWORD dwFlags; 71 DWORD dwCustomSDBMap; 72 GUID rgGuidDB[SDB_MAX_SDBS]; 73 } SDBQUERYRESULT, *PSDBQUERYRESULT; 74 75 #ifndef APPHELP_NOSDBPAPI 76 #include "sdbpapi.h" 77 #endif 78 79 /* sdbapi.c */ 80 PWSTR SdbpStrDup(LPCWSTR string); 81 DWORD SdbpStrsize(PCWSTR string); 82 HSDB WINAPI SdbInitDatabase(DWORD, LPCWSTR); 83 void WINAPI SdbReleaseDatabase(HSDB); 84 BOOL WINAPI SdbGUIDToString(CONST GUID *Guid, PWSTR GuidString, SIZE_T Length); 85 LPCWSTR WINAPI SdbTagToString(TAG tag); 86 87 PDB WINAPI SdbOpenDatabase(LPCWSTR path, PATH_TYPE type); 88 void WINAPI SdbCloseDatabase(PDB); 89 BOOL WINAPI SdbIsNullGUID(CONST GUID *Guid); 90 HRESULT WINAPI SdbGetAppPatchDir(HSDB db, LPWSTR path, DWORD size); 91 LPWSTR WINAPI SdbGetStringTagPtr(PDB pdb, TAGID tagid); 92 TAGID WINAPI SdbFindFirstNamedTag(PDB pdb, TAGID root, TAGID find, TAGID nametag, LPCWSTR find_name); 93 94 /* sdbread.c */ 95 BOOL WINAPI SdbpReadData(PDB pdb, PVOID dest, DWORD offset, DWORD num); 96 TAG WINAPI SdbGetTagFromTagID(PDB pdb, TAGID tagid); 97 TAGID WINAPI SdbFindFirstTag(PDB pdb, TAGID parent, TAG tag); 98 TAGID WINAPI SdbFindNextTag(PDB pdb, TAGID parent, TAGID prev_child); 99 BOOL WINAPI SdbGetDatabaseID(PDB pdb, GUID* Guid); 100 DWORD WINAPI SdbReadDWORDTag(PDB pdb, TAGID tagid, DWORD ret); 101 QWORD WINAPI SdbReadQWORDTag(PDB pdb, TAGID tagid, QWORD ret); 102 TAGID WINAPI SdbGetFirstChild(PDB pdb, TAGID parent); 103 TAGID WINAPI SdbGetNextChild(PDB pdb, TAGID parent, TAGID prev_child); 104 105 /* sdbfileattr.c*/ 106 BOOL WINAPI SdbGetFileAttributes(LPCWSTR path, PATTRINFO *attr_info_ret, LPDWORD attr_count); 107 BOOL WINAPI SdbFreeFileAttributes(PATTRINFO attr_info); 108 109 /* layer.c */ 110 BOOL WINAPI AllowPermLayer(PCWSTR path); 111 BOOL WINAPI SdbGetPermLayerKeys(PCWSTR wszPath, PWSTR pwszLayers, PDWORD pdwBytes, DWORD dwFlags); 112 BOOL WINAPI SetPermLayerState(PCWSTR wszPath, PCWSTR wszLayer, DWORD dwFlags, BOOL bMachine, BOOL bEnable); 113 114 /* hsdb.c */ 115 BOOL WINAPI SdbGetMatchingExe(HSDB hsdb, LPCWSTR path, LPCWSTR module_name, LPCWSTR env, DWORD flags, PSDBQUERYRESULT result); 116 BOOL WINAPI SdbTagIDToTagRef(HSDB hsdb, PDB pdb, TAGID tiWhich, TAGREF* ptrWhich); 117 BOOL WINAPI SdbTagRefToTagID(HSDB hsdb, TAGREF trWhich, PDB* ppdb, TAGID* ptiWhich); 118 BOOL WINAPI SdbUnpackAppCompatData(HSDB hsdb, LPCWSTR pszImageName, PVOID pData, PSDBQUERYRESULT pQueryResult); 119 120 #define ATTRIBUTE_AVAILABLE 0x1 121 #define ATTRIBUTE_FAILED 0x2 122 123 #include "sdbtagid.h" 124 125 #ifdef __cplusplus 126 } // extern "C" 127 #endif 128 129 #endif // APPHELP_H 130