10#define WIN32_NO_STATUS
17#define MAX_LAYER_LENGTH 256
31#define SHIMDATA_MAGIC 0xAC0DEDAB
32#define REACTOS_COMPATVERSION_IGNOREMANIFEST 0xffffffff
66 SHIM_WARN(
"Unimplemented TAG_UPTO_XXXXX\n");
70 for (
n = 0;
n < attr_count; ++
n)
82 if (dwval !=
attr->dwattr)
92 if (qwval !=
attr->qwattr)
120 RtlInitBuffer(&FullPathName.
ByteBuffer, (
PUCHAR)FullPathBuffer,
sizeof(FullPathBuffer));
192 if (
result->dwCustomSDBMap & (1<<
n))
196 result->dwCustomSDBMap |= (1<<
n);
206 for (
n = 0;
n <
result->dwLayerCount; ++
n)
348 RtlInitEmptyUnicodeString(&EnvValue,
Buffer,
sizeof(
Buffer));
371 static const WCHAR shim[] = {
'\\',
's',
'y',
's',
'm',
'a',
'i',
'n',
'.',
's',
'd',
'b',0};
372 static const WCHAR msi[] = {
'\\',
'm',
's',
'i',
'm',
'a',
'i',
'n',
'.',
's',
'd',
'b',0};
373 static const WCHAR drivers[] = {
'\\',
'd',
'r',
'v',
'm',
'a',
'i',
'n',
'.',
's',
'd',
'b',0};
474 RtlInitBuffer(&DosApplicationName.
ByteBuffer, (
PUCHAR)DosPathBuffer,
sizeof(DosPathBuffer));
477 SHIM_ERR(
"Failed to convert allocate buffer.\n");
497 SHIM_ERR(
"Failed to find Exe name in %wZ.\n", &DosApplicationName.
String);
564 RtlFreeBuffer(&DosApplicationName.
ByteBuffer);
582 static CONST WCHAR szAppPatch[] = {
'\\',
'A',
'p',
'p',
'P',
'a',
't',
'c',
'h',0};
611 SHIM_ERR(
"Unable to obtain default AppPatch directory (0x%x)\n",
hr);
622 SHIM_ERR(
"Unimplemented for hsdb != NULL\n");
642 SHIM_ERR(
"Multiple shim databases not yet implemented!\n");
673 SHIM_ERR(
"Multiple shim databases not yet implemented!\n");
711 SHIM_ERR(
"Unable to append module name (0x%x)\n",
hr);
716 pData->dwSize =
sizeof(*pData);
719 pData->dwRosProcessCompatVersion = 0;
722 SHIM_INFO(
"\ndwFlags 0x%x\ndwMagic 0x%x\ntrExe 0x%x\ntrLayer 0x%x\n",
730 bCloseDatabase =
TRUE;
735 DWORD dwValue = 0, dwType;
736 DWORD dwValueSize =
sizeof(dwValue);
740 dwType ==
REG_DWORD && dwValueSize ==
sizeof(dwValue))
743 dwValue = (dwValue % 100) | ((dwValue / 100) << 8);
744 if (dwValue >
pData->dwRosProcessCompatVersion)
745 pData->dwRosProcessCompatVersion = dwValue;
749 if (
pData->dwRosProcessCompatVersion)
750 SHIM_INFO(
"Setting ProcessCompatVersion 0x%x\n",
pData->dwRosProcessCompatVersion);
756 *pdwSize =
pData->dwSize;
782 return pData->dwSize;
static IN ULONG IN PWSTR OUT PCWSTR OUT PBOOLEAN OUT PATH_TYPE_AND_UNKNOWN * PathType
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
BOOL WINAPI SdbFreeFileAttributes(PATTRINFO attr_info)
#define SDB_DATABASE_MAIN_SHIM
TAG WINAPI SdbGetTagFromTagID(PDB pdb, TAGID tagid)
TAGID WINAPI SdbFindFirstTag(PDB pdb, TAGID parent, TAG tag)
LPCWSTR WINAPI SdbTagToString(TAG tag)
#define SDB_DATABASE_MAIN_MSI
TAGID WINAPI SdbGetFirstChild(PDB pdb, TAGID parent)
DWORD WINAPI SdbQueryDataExTagID(PDB pdb, TAGID tiExe, LPCWSTR lpszDataName, LPDWORD lpdwDataType, LPVOID lpBuffer, LPDWORD lpcbBufferSize, TAGID *ptiData)
TAGID WINAPI SdbGetNextChild(PDB pdb, TAGID parent, TAGID prev_child)
TAGID WINAPI SdbFindFirstNamedTag(PDB pdb, TAGID root, TAGID find, TAGID nametag, LPCWSTR find_name)
#define ATTRIBUTE_AVAILABLE
#define HID_DATABASE_TYPE_MASK
PDB WINAPI SdbOpenDatabase(LPCWSTR path, PATH_TYPE type)
#define SDBGMEF_IGNORE_ENVIRONMENT
void WINAPI SdbCloseDatabase(PDB)
#define SDB_DATABASE_MAIN_DRIVERS
QWORD WINAPI SdbReadQWORDTag(PDB pdb, TAGID tagid, QWORD ret)
BOOL WINAPI SdbGetPermLayerKeys(PCWSTR wszPath, PWSTR pwszLayers, PDWORD pdwBytes, DWORD dwFlags)
TAGID WINAPI SdbFindNextTag(PDB pdb, TAGID parent, TAGID prev_child)
BOOL WINAPI SdbGetFileAttributes(LPCWSTR path, PATTRINFO *attr_info_ret, LPDWORD attr_count)
DWORD WINAPI SdbReadDWORDTag(PDB pdb, TAGID tagid, DWORD ret)
#define SHIMREG_HAS_ENVIRONMENT
LPWSTR WINAPI SdbGetStringTagPtr(PDB pdb, TAGID tagid)
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
#define REACTOS_SHIMDATA_MAGIC
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
static TAGREF LPCWSTR lpszDataName
static TAGREF PDB TAGID * ptiWhich
#define TAG_MATCHING_FILE
static TAGREF LPCWSTR LPDWORD lpdwDataType
static PDB TAGID TAGREF * ptrWhich
static LPCWSTR LPCWSTR module_name
static LPCWSTR LPCWSTR LPCWSTR env
static TAGREF LPCWSTR LPDWORD LPVOID LPDWORD TAGREF * ptrData
static TAGREF LPCWSTR LPDWORD LPVOID LPDWORD lpcbBufferSize
#define NT_SUCCESS(StatCode)
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
UINT WINAPI GetSystemWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
static const WCHAR Cleanup[]
NTSTATUS RtlAppendUnicodeToString(IN PUNICODE_STRING Str1, IN PWSTR Str2)
GLdouble GLdouble GLdouble r
GLenum GLuint GLint GLint layer
static BOOL SdbpAddNamedLayerMatch(HSDB hsdb, PCWSTR layerName, PSDBQUERYRESULT result)
BOOL WINAPI SdbTagRefToTagID(HSDB hsdb, TAGREF trWhich, PDB *ppdb, TAGID *ptiWhich)
BOOL WINAPI SdbPackAppCompatData(HSDB hsdb, PSDBQUERYRESULT pQueryResult, PVOID *ppData, DWORD *pdwSize)
static BOOL SdbpAddSingleLayerMatch(TAGREF layer, PSDBQUERYRESULT result)
static void SdbpAddDatabaseGuid(PDB pdb, PSDBQUERYRESULT result)
BOOL WINAPI SdbGetMatchingExe(HSDB hsdb, LPCWSTR path, LPCWSTR module_name, LPCWSTR env, DWORD flags, PSDBQUERYRESULT result)
struct _ShimData ShimData
static void SdbpAddExeMatch(HSDB hsdb, PDB pdb, TAGID tagExe, PSDBQUERYRESULT result)
#define REACTOS_COMPATVERSION_IGNOREMANIFEST
HSDB WINAPI SdbInitDatabase(DWORD flags, LPCWSTR path)
BOOL WINAPI SdbTagIDToTagRef(HSDB hsdb, PDB pdb, TAGID tiWhich, TAGREF *ptrWhich)
static BOOL SdbpMatchFileAttributes(PDB pdb, TAGID matching_file, PATTRINFO attribs, DWORD attr_count)
static BOOL SdbpPropagateEnvLayers(HSDB hsdb, LPWSTR Environment, PSDBQUERYRESULT Result)
void WINAPI SdbReleaseDatabase(HSDB hsdb)
BOOL WINAPI SdbUnpackAppCompatData(HSDB hsdb, LPCWSTR pszImageName, PVOID pData, PSDBQUERYRESULT pQueryResult)
static BOOL WINAPI SdbpMatchExe(PDB pdb, TAGID exe, const WCHAR *dir, PATTRINFO main_attribs, DWORD main_attr_count)
DWORD WINAPI SdbQueryData(HSDB hsdb, TAGREF trWhich, LPCWSTR lpszDataName, LPDWORD lpdwDataType, LPVOID lpBuffer, LPDWORD lpcbBufferSize)
static ULONG SdbpAddLayerMatches(HSDB hsdb, PWSTR pwszLayers, DWORD pdwBytes, PSDBQUERYRESULT result)
static void SdbpAddExeLayers(HSDB hsdb, PDB pdb, TAGID tagExe, PSDBQUERYRESULT result)
DWORD WINAPI SdbQueryDataEx(HSDB hsdb, TAGREF trWhich, LPCWSTR lpszDataName, LPDWORD lpdwDataType, LPVOID lpBuffer, LPDWORD lpcbBufferSize, TAGREF *ptrData)
static BOOL WINAPI SdbpFileExists(LPCWSTR path)
DWORD WINAPI SdbGetAppCompatDataSize(ShimData *pData)
HRESULT WINAPI SdbGetAppPatchDir(HSDB hsdb, LPWSTR path, DWORD size)
#define InterlockedCompareExchangePointer
static PWSTR PDWORD pdwBytes
#define memcpy(s1, s2, n)
#define TAG_UPTO_BIN_FILE_VERSION
#define TAG_UPTO_LINK_DATE
#define TAG_UPTO_BIN_PRODUCT_VERSION
LPCWSTR LPCWSTR LPCWSTR DWORD PSDBQUERYRESULT_VISTA pQueryResult
PSDBQUERYRESULT_VISTA PVOID * ppData
PVOID PVOID PWCHAR PVOID Environment
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
#define RTL_SKIP_BUFFER_COPY
NTSYSAPI NTSTATUS NTAPI RtlQueryEnvironmentVariable_U(_In_opt_ PWSTR Environment, _In_ PCUNICODE_STRING Name, _Out_ PUNICODE_STRING Value)
NTSYSAPI NTSTATUS NTAPI RtlNtPathNameToDosPathName(_In_ ULONG Flags, _Inout_ PRTL_UNICODE_STRING_BUFFER Path, _Out_opt_ PULONG PathType, _Out_opt_ PULONG Unknown)
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
NTSYSAPI NTSTATUS NTAPI RtlAppendUnicodeStringToString(PUNICODE_STRING Destination, PUNICODE_STRING Source)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define FILE_ATTRIBUTE_DIRECTORY
DWORD SdbpStrlen(PCWSTR string)
#define SHIM_INFO(fmt,...)
#define SHIM_WARN(fmt,...)
#define SHIM_ERR(fmt,...)
#define offsetof(TYPE, MEMBER)
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
_Check_return_ _CRTIMP _CONST_RETURN wchar_t *__cdecl wcspbrk(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_Control)
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define TAG_TYPE_STRINGREF
STRSAFEAPI StringCchCatW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
DWORD dwRosProcessCompatVersion
WCHAR szLayer[MAX_LAYER_LENGTH]
#define RTL_CONSTANT_STRING(s)
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
#define INVALID_FILE_ATTRIBUTES
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO