mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 20:56:26 +00:00
[APPHELP] Register AppPatch directory with cmake, import SdbGetAppPatchDir implementation from Mislav Blažević CORE-10369
svn path=/trunk/; revision=71440
This commit is contained in:
parent
b6d0f03c96
commit
605449d0fe
5 changed files with 56 additions and 1 deletions
|
@ -69,6 +69,7 @@ Signature = "$ReactOS$"
|
||||||
50 = security\templates
|
50 = security\templates
|
||||||
51 = system32\CatRoot
|
51 = system32\CatRoot
|
||||||
52 = system32\CatRoot2
|
52 = system32\CatRoot2
|
||||||
|
53 = AppPatch
|
||||||
|
|
||||||
.InfEnd
|
.InfEnd
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,11 @@ typedef struct _DB {
|
||||||
#define SDB_DATABASE_MAIN_SHIM 0x80030000
|
#define SDB_DATABASE_MAIN_SHIM 0x80030000
|
||||||
#define SDB_DATABASE_MAIN_DRIVERS 0x80040000
|
#define SDB_DATABASE_MAIN_DRIVERS 0x80040000
|
||||||
|
|
||||||
|
typedef struct _SDB {
|
||||||
|
PDB db;
|
||||||
|
BOOL auto_loaded;
|
||||||
|
} SDB, *HSDB;
|
||||||
|
|
||||||
typedef struct tagATTRINFO {
|
typedef struct tagATTRINFO {
|
||||||
TAG type;
|
TAG type;
|
||||||
DWORD flags;
|
DWORD flags;
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
@ stub SdbFreeFileInfo
|
@ stub SdbFreeFileInfo
|
||||||
@ stub SdbFreeFlagInfo
|
@ stub SdbFreeFlagInfo
|
||||||
@ stub SdbGetAppCompatDataSize
|
@ stub SdbGetAppCompatDataSize
|
||||||
@ stub SdbGetAppPatchDir
|
@ stdcall SdbGetAppPatchDir(ptr wstr long)
|
||||||
@ stdcall SdbGetBinaryTagData(ptr long)
|
@ stdcall SdbGetBinaryTagData(ptr long)
|
||||||
@ stdcall SdbGetDatabaseID(ptr ptr)
|
@ stdcall SdbGetDatabaseID(ptr ptr)
|
||||||
@ stub SdbGetDatabaseInformation
|
@ stub SdbGetDatabaseInformation
|
||||||
|
|
|
@ -433,6 +433,53 @@ void WINAPI SdbCloseDatabase(PDB db)
|
||||||
SdbFree(db);
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses a string to retrieve a GUID.
|
* Parses a string to retrieve a GUID.
|
||||||
*
|
*
|
||||||
|
|
|
@ -261,6 +261,8 @@ macro(dir_to_num dir var)
|
||||||
set(${var} 51)
|
set(${var} 51)
|
||||||
elseif(${dir} STREQUAL reactos/system32/CatRoot2)
|
elseif(${dir} STREQUAL reactos/system32/CatRoot2)
|
||||||
set(${var} 52)
|
set(${var} 52)
|
||||||
|
elseif(${dir} STREQUAL reactos/AppPatch)
|
||||||
|
set(${var} 53)
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "Wrong destination: ${dir}")
|
message(FATAL_ERROR "Wrong destination: ${dir}")
|
||||||
endif()
|
endif()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue