Author: mjansen
Date: Sat May 28 16:47:39 2016
New Revision: 71440
URL:
http://svn.reactos.org/svn/reactos?rev=71440&view=rev
Log:
[APPHELP] Register AppPatch directory with cmake, import SdbGetAppPatchDir implementation
from Mislav Blažević CORE-10369
Modified:
trunk/reactos/boot/bootdata/packages/reactos.dff.in
trunk/reactos/dll/appcompat/apphelp/apphelp.h
trunk/reactos/dll/appcompat/apphelp/apphelp.spec
trunk/reactos/dll/appcompat/apphelp/sdbapi.c
trunk/reactos/sdk/cmake/CMakeMacros.cmake
Modified: trunk/reactos/boot/bootdata/packages/reactos.dff.in
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/packages/rea…
==============================================================================
--- trunk/reactos/boot/bootdata/packages/reactos.dff.in [iso-8859-1] (original)
+++ trunk/reactos/boot/bootdata/packages/reactos.dff.in [iso-8859-1] Sat May 28 16:47:39
2016
@@ -69,6 +69,7 @@
50 = security\templates
51 = system32\CatRoot
52 = system32\CatRoot2
+53 = AppPatch
.InfEnd
Modified: trunk/reactos/dll/appcompat/apphelp/apphelp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/apph…
==============================================================================
--- trunk/reactos/dll/appcompat/apphelp/apphelp.h [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/apphelp.h [iso-8859-1] Sat May 28 16:47:39 2016
@@ -49,6 +49,11 @@
#define SDB_DATABASE_MAIN_MSI 0x80020000
#define SDB_DATABASE_MAIN_SHIM 0x80030000
#define SDB_DATABASE_MAIN_DRIVERS 0x80040000
+
+typedef struct _SDB {
+ PDB db;
+ BOOL auto_loaded;
+} SDB, *HSDB;
typedef struct tagATTRINFO {
TAG type;
Modified: trunk/reactos/dll/appcompat/apphelp/apphelp.spec
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/apph…
==============================================================================
--- trunk/reactos/dll/appcompat/apphelp/apphelp.spec [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/apphelp.spec [iso-8859-1] Sat May 28 16:47:39
2016
@@ -52,7 +52,7 @@
@ stub SdbFreeFileInfo
@ stub SdbFreeFlagInfo
@ stub SdbGetAppCompatDataSize
-@ stub SdbGetAppPatchDir
+@ stdcall SdbGetAppPatchDir(ptr wstr long)
@ stdcall SdbGetBinaryTagData(ptr long)
@ stdcall SdbGetDatabaseID(ptr ptr)
@ stub SdbGetDatabaseInformation
Modified: trunk/reactos/dll/appcompat/apphelp/sdbapi.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/sdba…
==============================================================================
--- trunk/reactos/dll/appcompat/apphelp/sdbapi.c [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/sdbapi.c [iso-8859-1] Sat May 28 16:47:39 2016
@@ -431,6 +431,53 @@
NtClose(db->file);
SdbFree(db->data);
SdbFree(db);
+}
+
+/**
+ * Retrieves AppPatch directory.
+ *
+ * @param [in] db Handle to the shim database.
+ * @param [out] path Pointer to memory in which path shall be written.
+ * @param [in] size Size of the buffer in characters.
+ */
+BOOL WINAPI SdbGetAppPatchDir(HSDB db, LPWSTR path, DWORD size)
+{
+ static WCHAR* default_dir = NULL;
+
+ if(!default_dir)
+ {
+ WCHAR* tmp = NULL;
+ UINT len = GetSystemWindowsDirectoryW(NULL, 0) + lstrlenW((CONST
WCHAR[]){'\\','A','p','p','P','a','t','c','h',0});
+ tmp = SdbAlloc((len + 1)* sizeof(WCHAR));
+ if(tmp)
+ {
+ UINT r = GetSystemWindowsDirectoryW(tmp, len+1);
+ if (r && r < len)
+ {
+ if (SUCCEEDED(StringCchCatW(tmp, len+1, (CONST
WCHAR[]){'\\','A','p','p','P','a','t','c','h',0})))
+ {
+ if(InterlockedCompareExchangePointer((void**)&default_dir, tmp,
NULL) == NULL)
+ tmp = NULL;
+ }
+ }
+ if (tmp)
+ SdbFree(tmp);
+ }
+ }
+
+ /* In case function fails, path holds empty string */
+ if (size > 0)
+ *path = 0;
+
+ if (!db)
+ {
+ return SUCCEEDED(StringCchCopyW(path, size, default_dir));
+ }
+ else
+ {
+ /* fixme */
+ return FALSE;
+ }
}
/**
Modified: trunk/reactos/sdk/cmake/CMakeMacros.cmake
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/cmake/CMakeMacros.cmak…
==============================================================================
--- trunk/reactos/sdk/cmake/CMakeMacros.cmake [iso-8859-1] (original)
+++ trunk/reactos/sdk/cmake/CMakeMacros.cmake [iso-8859-1] Sat May 28 16:47:39 2016
@@ -261,6 +261,8 @@
set(${var} 51)
elseif(${dir} STREQUAL reactos/system32/CatRoot2)
set(${var} 52)
+ elseif(${dir} STREQUAL reactos/AppPatch)
+ set(${var} 53)
else()
message(FATAL_ERROR "Wrong destination: ${dir}")
endif()