Author: mjansen
Date: Sat Aug 5 12:05:06 2017
New Revision: 75489
URL:
http://svn.reactos.org/svn/reactos?rev=75489&view=rev
Log:
[APPHELP][XML2SDB] Code cleanup + add assertions
- Always used pdb or hsdb, no more 'db'
- Add property to an PDB that describes if it's opened for read/write, and assert on
this
- Add comments
Modified:
trunk/reactos/dll/appcompat/apphelp/apphelp.h
trunk/reactos/dll/appcompat/apphelp/hsdb.c
trunk/reactos/dll/appcompat/apphelp/layer.c
trunk/reactos/dll/appcompat/apphelp/sdbapi.c
trunk/reactos/dll/appcompat/apphelp/sdbpapi.h
trunk/reactos/dll/appcompat/apphelp/sdbread.c
trunk/reactos/dll/appcompat/apphelp/sdbtypes.h
trunk/reactos/dll/appcompat/apphelp/sdbwrite.c
trunk/reactos/dll/appcompat/shims/genral/themes.c
trunk/reactos/sdk/tools/xml2sdb/main.cpp
trunk/reactos/sdk/tools/xml2sdb/xml2sdb.cpp
trunk/reactos/sdk/tools/xml2sdb/xml2sdb.h
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 Aug 5 12:05:06 2017
@@ -1,6 +1,6 @@
/*
* Copyright 2013 Mislav BlaževiÄ
- * Copyright 2015-2017 Mark Jansen
+ * Copyright 2015-2017 Mark Jansen (mark.jansen(a)reactos.org)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -36,7 +36,7 @@
#define SDB_DATABASE_MAIN_DRIVERS 0x80040000
typedef struct _SDB {
- PDB db;
+ PDB pdb;
BOOL auto_loaded;
} SDB, *HSDB;
@@ -98,19 +98,19 @@
void WINAPI SdbCloseDatabase(PDB);
BOOL WINAPI SdbIsNullGUID(CONST GUID *Guid);
BOOL WINAPI SdbGetAppPatchDir(HSDB db, LPWSTR path, DWORD size);
-LPWSTR WINAPI SdbGetStringTagPtr(PDB db, TAGID tagid);
-TAGID WINAPI SdbFindFirstNamedTag(PDB db, TAGID root, TAGID find, TAGID nametag, LPCWSTR
find_name);
+LPWSTR WINAPI SdbGetStringTagPtr(PDB pdb, TAGID tagid);
+TAGID WINAPI SdbFindFirstNamedTag(PDB pdb, TAGID root, TAGID find, TAGID nametag, LPCWSTR
find_name);
/* sdbread.c */
-BOOL WINAPI SdbpReadData(PDB db, PVOID dest, DWORD offset, DWORD num);
-TAG WINAPI SdbGetTagFromTagID(PDB db, TAGID tagid);
-TAGID WINAPI SdbFindFirstTag(PDB db, TAGID parent, TAG tag);
-TAGID WINAPI SdbFindNextTag(PDB db, TAGID parent, TAGID prev_child);
-BOOL WINAPI SdbGetDatabaseID(PDB db, GUID* Guid);
-DWORD WINAPI SdbReadDWORDTag(PDB db, TAGID tagid, DWORD ret);
-QWORD WINAPI SdbReadQWORDTag(PDB db, TAGID tagid, QWORD ret);
-TAGID WINAPI SdbGetFirstChild(PDB db, TAGID parent);
-TAGID WINAPI SdbGetNextChild(PDB db, TAGID parent, TAGID prev_child);
+BOOL WINAPI SdbpReadData(PDB pdb, PVOID dest, DWORD offset, DWORD num);
+TAG WINAPI SdbGetTagFromTagID(PDB pdb, TAGID tagid);
+TAGID WINAPI SdbFindFirstTag(PDB pdb, TAGID parent, TAG tag);
+TAGID WINAPI SdbFindNextTag(PDB pdb, TAGID parent, TAGID prev_child);
+BOOL WINAPI SdbGetDatabaseID(PDB pdb, GUID* Guid);
+DWORD WINAPI SdbReadDWORDTag(PDB pdb, TAGID tagid, DWORD ret);
+QWORD WINAPI SdbReadQWORDTag(PDB pdb, TAGID tagid, QWORD ret);
+TAGID WINAPI SdbGetFirstChild(PDB pdb, TAGID parent);
+TAGID WINAPI SdbGetNextChild(PDB pdb, TAGID parent, TAGID prev_child);
/* sdbfileattr.c*/
BOOL WINAPI SdbGetFileAttributes(LPCWSTR path, PATTRINFO *attr_info_ret, LPDWORD
attr_count);
Modified: trunk/reactos/dll/appcompat/apphelp/hsdb.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/hsdb…
==============================================================================
--- trunk/reactos/dll/appcompat/apphelp/hsdb.c [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/hsdb.c [iso-8859-1] Sat Aug 5 12:05:06 2017
@@ -48,6 +48,8 @@
return (attr != INVALID_FILE_ATTRIBUTES && !(attr &
FILE_ATTRIBUTE_DIRECTORY));
}
+/* Given a 'MATCHING_FILE' tag and an ATTRINFO array,
+ check all tags defined in the MATCHING_FILE against the ATTRINFO */
static BOOL SdbpMatchFileAttributes(PDB pdb, TAGID matching_file, PATTRINFO attribs,
DWORD attr_count)
{
TAGID child;
@@ -107,6 +109,8 @@
return TRUE;
}
+/* Given an 'exe' tag and an ATTRINFO array (for the main file),
+ verify that the main file and any additional files match */
static BOOL WINAPI SdbpMatchExe(PDB pdb, TAGID exe, const WCHAR* dir, PATTRINFO
main_attribs, DWORD main_attr_count)
{
RTL_UNICODE_STRING_BUFFER FullPathName = { { 0 } };
@@ -132,8 +136,10 @@
if (!Name.Buffer)
goto Cleanup;
+ /* An '*' here means use the main executable' */
if (!wcscmp(Name.Buffer, L"*"))
{
+ /* We already have these attributes, so we do not need to retrieve them */
if (!SdbpMatchFileAttributes(pdb, matching_file, main_attribs,
main_attr_count))
goto Cleanup;
continue;
@@ -153,9 +159,11 @@
RtlAppendUnicodeToString(&FullPathName.String, L"\\");
RtlAppendUnicodeStringToString(&FullPathName.String, &Name);
+ /* If the file does not exist, do not bother trying to read it's attributes
*/
if (!SdbpFileExists(FullPathName.String.Buffer))
goto Cleanup;
+ /* Do we have some attributes from the previous iteration? */
if (attribs)
SdbFreeFileAttributes(attribs);
@@ -176,24 +184,26 @@
return IsMatch;
}
-static void SdbpAddDatabaseGuid(PDB db, PSDBQUERYRESULT result)
+/* Add a database guid to the query result */
+static void SdbpAddDatabaseGuid(PDB pdb, PSDBQUERYRESULT result)
{
size_t n;
for (n = 0; n < _countof(result->rgGuidDB); ++n)
{
- if (!memcmp(&result->rgGuidDB[n], &db->database_id,
sizeof(db->database_id)))
+ if (!memcmp(&result->rgGuidDB[n], &pdb->database_id,
sizeof(pdb->database_id)))
return;
if (result->dwCustomSDBMap & (1<<n))
continue;
- memcpy(&result->rgGuidDB[n], &db->database_id,
sizeof(result->rgGuidDB[n]));
+ memcpy(&result->rgGuidDB[n], &pdb->database_id,
sizeof(result->rgGuidDB[n]));
result->dwCustomSDBMap |= (1<<n);
return;
}
}
+/* Add one layer to the query result */
static BOOL SdbpAddSingleLayerMatch(TAGREF layer, PSDBQUERYRESULT result)
{
size_t n;
@@ -213,54 +223,55 @@
return TRUE;
}
-
+/* Translate a layer name to a tagref + add it to the query result */
static BOOL SdbpAddNamedLayerMatch(HSDB hsdb, PCWSTR layerName, PSDBQUERYRESULT result)
{
TAGID database, layer;
TAGREF tr;
- PDB db = hsdb->db;
-
- database = SdbFindFirstTag(db, TAGID_ROOT, TAG_DATABASE);
+ PDB pdb = hsdb->pdb;
+
+ database = SdbFindFirstTag(pdb, TAGID_ROOT, TAG_DATABASE);
if (database == TAGID_NULL)
return FALSE;
- layer = SdbFindFirstNamedTag(db, database, TAG_LAYER, TAG_NAME, layerName);
+ layer = SdbFindFirstNamedTag(pdb, database, TAG_LAYER, TAG_NAME, layerName);
if (layer == TAGID_NULL)
return FALSE;
- if (!SdbTagIDToTagRef(hsdb, db, layer, &tr))
+ if (!SdbTagIDToTagRef(hsdb, pdb, layer, &tr))
return FALSE;
if (!SdbpAddSingleLayerMatch(tr, result))
return FALSE;
- SdbpAddDatabaseGuid(db, result);
+ SdbpAddDatabaseGuid(pdb, result);
return TRUE;
}
-static void SdbpAddExeLayers(HSDB hsdb, PDB db, TAGID tagExe, PSDBQUERYRESULT result)
-{
- TAGID layer = SdbFindFirstTag(db, tagExe, TAG_LAYER);
+/* Add all layers for the exe tag to the query result */
+static void SdbpAddExeLayers(HSDB hsdb, PDB pdb, TAGID tagExe, PSDBQUERYRESULT result)
+{
+ TAGID layer = SdbFindFirstTag(pdb, tagExe, TAG_LAYER);
while (layer != TAGID_NULL)
{
TAGREF tr;
- TAGID layerIdTag = SdbFindFirstTag(db, layer, TAG_LAYER_TAGID);
- DWORD tagId = SdbReadDWORDTag(db, layerIdTag, TAGID_NULL);
+ TAGID layerIdTag = SdbFindFirstTag(pdb, layer, TAG_LAYER_TAGID);
+ DWORD tagId = SdbReadDWORDTag(pdb, layerIdTag, TAGID_NULL);
if (layerIdTag != TAGID_NULL &&
tagId != TAGID_NULL &&
- SdbTagIDToTagRef(hsdb, db, tagId, &tr))
+ SdbTagIDToTagRef(hsdb, pdb, tagId, &tr))
{
SdbpAddSingleLayerMatch(tr, result);
}
else
{
/* Try a name lookup */
- TAGID layerTag = SdbFindFirstTag(db, layer, TAG_NAME);
+ TAGID layerTag = SdbFindFirstTag(pdb, layer, TAG_NAME);
if (layerTag != TAGID_NULL)
{
- LPCWSTR layerName = SdbGetStringTagPtr(db, layerTag);
+ LPCWSTR layerName = SdbGetStringTagPtr(pdb, layerTag);
if (layerName)
{
SdbpAddNamedLayerMatch(hsdb, layerName, result);
@@ -268,16 +279,17 @@
}
}
- layer = SdbFindNextTag(db, tagExe, layer);
- }
-}
-
-static void SdbpAddExeMatch(HSDB hsdb, PDB db, TAGID tagExe, PSDBQUERYRESULT result)
+ layer = SdbFindNextTag(pdb, tagExe, layer);
+ }
+}
+
+/* Add an exe tag to the query result */
+static void SdbpAddExeMatch(HSDB hsdb, PDB pdb, TAGID tagExe, PSDBQUERYRESULT result)
{
size_t n;
TAGREF tr;
- if (!SdbTagIDToTagRef(hsdb, db, tagExe, &tr))
+ if (!SdbTagIDToTagRef(hsdb, pdb, tagExe, &tr))
return;
for (n = 0; n < result->dwExeCount; ++n)
@@ -292,11 +304,12 @@
result->atrExes[n] = tr;
result->dwExeCount++;
- SdbpAddExeLayers(hsdb, db, tagExe, result);
-
- SdbpAddDatabaseGuid(db, result);
-}
-
+ SdbpAddExeLayers(hsdb, pdb, tagExe, result);
+
+ SdbpAddDatabaseGuid(pdb, result);
+}
+
+/* Add all named layers to the query result */
static ULONG SdbpAddLayerMatches(HSDB hsdb, PWSTR pwszLayers, DWORD pdwBytes,
PSDBQUERYRESULT result)
{
PWSTR start = pwszLayers, p;
@@ -350,7 +363,7 @@
/**
- * Opens specified shim database file Handle returned by this function may only be used
by
+ * Opens specified shim database file. Handle returned by this function may only be used
by
* functions which take HSDB param thus differing it from SdbOpenDatabase.
*
* @param [in] flags Specifies type of path or predefined database.
@@ -389,10 +402,10 @@
flags = HID_DOS_PATHS;
}
- hsdb->db = SdbOpenDatabase(path ? path : buffer, (flags & 0xF) - 1);
+ hsdb->pdb = SdbOpenDatabase(path ? path : buffer, (flags & 0xF) - 1);
/* If database could not be loaded, a handle doesn't make sense either */
- if (!hsdb->db)
+ if (!hsdb->pdb)
{
SdbReleaseDatabase(hsdb);
return NULL;
@@ -408,7 +421,7 @@
*/
void WINAPI SdbReleaseDatabase(HSDB hsdb)
{
- SdbCloseDatabase(hsdb->db);
+ SdbCloseDatabase(hsdb->pdb);
SdbFree(hsdb);
}
@@ -438,7 +451,7 @@
LPWSTR file_name;
WCHAR wszLayers[MAX_LAYER_LENGTH];
DWORD dwSize;
- PDB db;
+ PDB pdb;
/* Load default database if one is not specified */
if (!hsdb)
@@ -457,7 +470,7 @@
return FALSE;
/* We do not support multiple db's yet! */
- db = hsdb->db;
+ pdb = hsdb->pdb;
RtlInitUnicodeString(&DosApplicationName.String, path);
RtlInitBuffer(&DosApplicationName.ByteBuffer, (PUCHAR)DosPathBuffer,
sizeof(DosPathBuffer));
@@ -491,24 +504,24 @@
*(file_name++) = UNICODE_NULL;
/* DATABASE is list TAG which contains all executables */
- database = SdbFindFirstTag(db, TAGID_ROOT, TAG_DATABASE);
+ database = SdbFindFirstTag(pdb, TAGID_ROOT, TAG_DATABASE);
if (database == TAGID_NULL)
{
goto Cleanup;
}
/* EXE is list TAG which contains data required to match executable */
- iter = SdbFindFirstTag(db, database, TAG_EXE);
+ iter = SdbFindFirstTag(pdb, database, TAG_EXE);
/* Search for entry in database, we should look into indexing tags! */
while (iter != TAGID_NULL)
{
LPWSTR foundName;
/* Check if exe name matches */
- name = SdbFindFirstTag(db, iter, TAG_NAME);
+ name = SdbFindFirstTag(pdb, iter, TAG_NAME);
/* If this is a malformed DB, (no TAG_NAME), we should not crash. */
- foundName = SdbGetStringTagPtr(db, name);
- if (foundName && !lstrcmpiW(foundName, file_name))
+ foundName = SdbGetStringTagPtr(pdb, name);
+ if (foundName && !wcsicmp(foundName, file_name))
{
/* Get information about executable required to match it with database entry
*/
if (!attribs)
@@ -519,15 +532,15 @@
/* We have a null terminator before the application name, so
DosApplicationName only contains the path. */
- if (SdbpMatchExe(db, iter, DosApplicationName.String.Buffer, attribs,
attr_count))
+ if (SdbpMatchExe(pdb, iter, DosApplicationName.String.Buffer, attribs,
attr_count))
{
ret = TRUE;
- SdbpAddExeMatch(hsdb, db, iter, result);
+ SdbpAddExeMatch(hsdb, pdb, iter, result);
}
}
/* Continue iterating */
- iter = SdbFindNextTag(db, database, iter);
+ iter = SdbFindNextTag(pdb, database, iter);
}
/* Restore the full path. */
@@ -561,11 +574,11 @@
/**
* Retrieves AppPatch directory.
*
- * @param [in] db Handle to the shim database.
+ * @param [in] pdb 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)
+BOOL WINAPI SdbGetAppPatchDir(HSDB hsdb, LPWSTR path, DWORD size)
{
static WCHAR* default_dir = NULL;
static CONST WCHAR szAppPatch[] =
{'\\','A','p','p','P','a','t','c','h',0};
@@ -600,13 +613,13 @@
}
}
- if (!db)
+ if (!hsdb)
{
return SUCCEEDED(StringCchCopyW(path, size, default_dir));
}
else
{
- SHIM_ERR("Unimplemented for db != NULL\n");
+ SHIM_ERR("Unimplemented for hsdb != NULL\n");
return FALSE;
}
}
@@ -636,7 +649,7 @@
/* There seems to be no range checking on trWhich.. */
if (ppdb)
- *ppdb = hsdb->db;
+ *ppdb = hsdb->pdb;
if (ptiWhich)
*ptiWhich = trWhich & 0x0fffffff;
@@ -655,7 +668,7 @@
*/
BOOL WINAPI SdbTagIDToTagRef(HSDB hsdb, PDB pdb, TAGID tiWhich, TAGREF* ptrWhich)
{
- if (pdb != hsdb->db)
+ if (pdb != hsdb->pdb)
{
SHIM_ERR("Multiple shim databases not yet implemented!\n");
if (ptrWhich)
@@ -670,7 +683,7 @@
}
-
+/* Convert a query result to shim data that will be loaded in the child process */
BOOL WINAPI SdbPackAppCompatData(HSDB hsdb, PSDBQUERYRESULT pQueryResult, PVOID* ppData,
DWORD *pdwSize)
{
ShimData* pData;
Modified: trunk/reactos/dll/appcompat/apphelp/layer.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/laye…
==============================================================================
--- trunk/reactos/dll/appcompat/apphelp/layer.c [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/layer.c [iso-8859-1] Sat Aug 5 12:05:06 2017
@@ -50,7 +50,7 @@
#define SIGN_MEDIA_FMT L"SIGN.MEDIA=%X %s"
#endif
-
+/* Fixme: use RTL_UNICODE_STRING_BUFFER */
typedef struct SDB_TMP_STR
{
UNICODE_STRING Str;
@@ -131,6 +131,7 @@
return type == DRIVE_REMOVABLE || type == DRIVE_CDROM;
}
+/* Convert a path on removable media to 'SIGN.MEDIA=%X filename' */
BOOL SdbpBuildSignMediaId(PSDB_TMP_STR LongPath)
{
SDB_TMP_STR Scratch;
@@ -169,6 +170,7 @@
return FALSE;
}
+/* Convert a given path to a long or media path */
BOOL SdbpResolvePath(PSDB_TMP_STR LongPath, PCWSTR wszPath)
{
SdbpInitTempStr(LongPath);
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 Aug 5 12:05:06 2017
@@ -107,7 +107,7 @@
IO_STATUS_BLOCK io;
OBJECT_ATTRIBUTES attr;
UNICODE_STRING str;
- PDB db;
+ PDB pdb;
if (type == DOS_PATH)
{
@@ -120,8 +120,8 @@
}
/* SdbAlloc zeroes the memory. */
- db = (PDB)SdbAlloc(sizeof(DB));
- if (!db)
+ pdb = (PDB)SdbAlloc(sizeof(DB));
+ if (!pdb)
{
SHIM_ERR("Failed to allocate memory for shim database\n");
return NULL;
@@ -129,28 +129,33 @@
InitializeObjectAttributes(&attr, &str, OBJ_CASE_INSENSITIVE, NULL, NULL);
- Status = NtCreateFile(&db->file, (write ? FILE_GENERIC_WRITE :
FILE_GENERIC_READ )| SYNCHRONIZE,
+ Status = NtCreateFile(&pdb->file, (write ? FILE_GENERIC_WRITE :
FILE_GENERIC_READ )| SYNCHRONIZE,
&attr, &io, NULL, FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ,
write ? FILE_SUPERSEDE : FILE_OPEN, FILE_NON_DIRECTORY_FILE |
FILE_SYNCHRONOUS_IO_NONALERT, NULL, 0);
+ pdb->for_write = write;
+
if (type == DOS_PATH)
RtlFreeUnicodeString(&str);
if (!NT_SUCCESS(Status))
{
- SdbCloseDatabase(db);
+ SdbCloseDatabase(pdb);
SHIM_ERR("Failed to create shim database file: %lx\n", Status);
return NULL;
}
- return db;
-}
-
-void WINAPI SdbpFlush(PDB db)
+ return pdb;
+}
+
+void WINAPI SdbpFlush(PDB pdb)
{
IO_STATUS_BLOCK io;
- NTSTATUS Status = NtWriteFile(db->file, NULL, NULL, NULL, &io,
- db->data, db->write_iter, NULL, NULL);
+ NTSTATUS Status;
+
+ ASSERT(pdb->for_write);
+ Status = NtWriteFile(pdb->file, NULL, NULL, NULL, &io,
+ pdb->data, pdb->write_iter, NULL, NULL);
if( !NT_SUCCESS(Status))
SHIM_WARN("failed with 0x%lx\n", Status);
}
@@ -257,9 +262,9 @@
return TRUE;
}
-BOOL WINAPI SdbpCheckTagIDType(PDB db, TAGID tagid, WORD type)
-{
- TAG tag = SdbGetTagFromTagID(db, tagid);
+BOOL WINAPI SdbpCheckTagIDType(PDB pdb, TAGID tagid, WORD type)
+{
+ TAG tag = SdbGetTagFromTagID(pdb, tagid);
if (tag == TAG_NULL)
return FALSE;
return SdbpCheckTagType(tag, type);
@@ -269,43 +274,43 @@
{
IO_STATUS_BLOCK io;
FILE_STANDARD_INFORMATION fsi;
- PDB db;
+ PDB pdb;
NTSTATUS Status;
BYTE header[12];
- db = SdbpCreate(path, type, FALSE);
- if (!db)
- return NULL;
-
- Status = NtQueryInformationFile(db->file, &io, &fsi,
sizeof(FILE_STANDARD_INFORMATION), FileStandardInformation);
+ pdb = SdbpCreate(path, type, FALSE);
+ if (!pdb)
+ return NULL;
+
+ Status = NtQueryInformationFile(pdb->file, &io, &fsi,
sizeof(FILE_STANDARD_INFORMATION), FileStandardInformation);
if (!NT_SUCCESS(Status))
{
- SdbCloseDatabase(db);
+ SdbCloseDatabase(pdb);
SHIM_ERR("Failed to get shim database size: 0x%lx\n", Status);
return NULL;
}
- db->size = fsi.EndOfFile.u.LowPart;
- db->data = SdbAlloc(db->size);
- Status = NtReadFile(db->file, NULL, NULL, NULL, &io, db->data, db->size,
NULL, NULL);
+ pdb->size = fsi.EndOfFile.u.LowPart;
+ pdb->data = SdbAlloc(pdb->size);
+ Status = NtReadFile(pdb->file, NULL, NULL, NULL, &io, pdb->data,
pdb->size, NULL, NULL);
if (!NT_SUCCESS(Status))
{
- SdbCloseDatabase(db);
+ SdbCloseDatabase(pdb);
SHIM_ERR("Failed to open shim database file: 0x%lx\n", Status);
return NULL;
}
- if (!SdbpReadData(db, &header, 0, 12))
- {
- SdbCloseDatabase(db);
+ if (!SdbpReadData(pdb, &header, 0, 12))
+ {
+ SdbCloseDatabase(pdb);
SHIM_ERR("Failed to read shim database header\n");
return NULL;
}
if (memcmp(&header[8], "sdbf", 4) != 0)
{
- SdbCloseDatabase(db);
+ SdbCloseDatabase(pdb);
SHIM_ERR("Shim database header is invalid\n");
return NULL;
}
@@ -313,7 +318,7 @@
*major = *(DWORD*)&header[0];
*minor = *(DWORD*)&header[4];
- return db;
+ return pdb;
}
@@ -327,46 +332,46 @@
*/
PDB WINAPI SdbOpenDatabase(LPCWSTR path, PATH_TYPE type)
{
- PDB db;
+ PDB pdb;
DWORD major, minor;
- db = SdbpOpenDatabase(path, type, &major, &minor);
- if (!db)
+ pdb = SdbpOpenDatabase(path, type, &major, &minor);
+ if (!pdb)
return NULL;
if (major != 2 && major != 3)
{
- SdbCloseDatabase(db);
+ SdbCloseDatabase(pdb);
SHIM_ERR("Invalid shim database version\n");
return NULL;
}
- db->stringtable = SdbFindFirstTag(db, TAGID_ROOT, TAG_STRINGTABLE);
- if(!SdbGetDatabaseID(db, &db->database_id))
+ pdb->stringtable = SdbFindFirstTag(pdb, TAGID_ROOT, TAG_STRINGTABLE);
+ if(!SdbGetDatabaseID(pdb, &pdb->database_id))
{
SHIM_INFO("Failed to get the database id\n");
}
- return db;
+ return pdb;
}
/**
* Closes specified database and frees its memory.
*
- * @param [in] db Handle to the shim database.
- */
-void WINAPI SdbCloseDatabase(PDB db)
-{
- if (!db)
+ * @param [in] pdb Handle to the shim database.
+ */
+void WINAPI SdbCloseDatabase(PDB pdb)
+{
+ if (!pdb)
return;
- if (db->file)
- NtClose(db->file);
- if (db->string_buffer)
- SdbCloseDatabase(db->string_buffer);
- if (db->string_lookup)
- SdbpTableDestroy(&db->string_lookup);
- SdbFree(db->data);
- SdbFree(db);
+ if (pdb->file)
+ NtClose(pdb->file);
+ if (pdb->string_buffer)
+ SdbCloseDatabase(pdb->string_buffer);
+ if (pdb->string_lookup)
+ SdbpTableDestroy(&pdb->string_lookup);
+ SdbFree(pdb->data);
+ SdbFree(pdb);
}
/**
@@ -462,11 +467,11 @@
*/
BOOL WINAPI SdbGetDatabaseVersion(LPCWSTR database, PDWORD VersionHi, PDWORD VersionLo)
{
- PDB db;
-
- db = SdbpOpenDatabase(database, DOS_PATH, VersionHi, VersionLo);
- if (db)
- SdbCloseDatabase(db);
+ PDB pdb;
+
+ pdb = SdbpOpenDatabase(database, DOS_PATH, VersionHi, VersionLo);
+ if (pdb)
+ SdbCloseDatabase(pdb);
return TRUE;
}
@@ -483,22 +488,22 @@
*
* @return The found tag, or TAGID_NULL on failure
*/
-TAGID WINAPI SdbFindFirstNamedTag(PDB db, TAGID root, TAGID find, TAGID nametag, LPCWSTR
find_name)
+TAGID WINAPI SdbFindFirstNamedTag(PDB pdb, TAGID root, TAGID find, TAGID nametag, LPCWSTR
find_name)
{
TAGID iter;
- iter = SdbFindFirstTag(db, root, find);
+ iter = SdbFindFirstTag(pdb, root, find);
while (iter != TAGID_NULL)
{
- TAGID tmp = SdbFindFirstTag(db, iter, nametag);
+ TAGID tmp = SdbFindFirstTag(pdb, iter, nametag);
if (tmp != TAGID_NULL)
{
- LPCWSTR name = SdbGetStringTagPtr(db, tmp);
+ LPCWSTR name = SdbGetStringTagPtr(pdb, tmp);
if (name && !wcsicmp(name, find_name))
return iter;
}
- iter = SdbFindNextTag(db, root, iter);
+ iter = SdbFindNextTag(pdb, root, iter);
}
return TAGID_NULL;
}
@@ -514,16 +519,16 @@
*/
TAGREF WINAPI SdbGetLayerTagRef(HSDB hsdb, LPCWSTR layerName)
{
- PDB db = hsdb->db;
-
- TAGID database = SdbFindFirstTag(db, TAGID_ROOT, TAG_DATABASE);
+ PDB pdb = hsdb->pdb;
+
+ TAGID database = SdbFindFirstTag(pdb, TAGID_ROOT, TAG_DATABASE);
if (database != TAGID_NULL)
{
- TAGID layer = SdbFindFirstNamedTag(db, database, TAG_LAYER, TAG_NAME,
layerName);
+ TAGID layer = SdbFindFirstNamedTag(pdb, database, TAG_LAYER, TAG_NAME,
layerName);
if (layer != TAGID_NULL)
{
TAGREF tr;
- if (SdbTagIDToTagRef(hsdb, db, layer, &tr))
+ if (SdbTagIDToTagRef(hsdb, pdb, layer, &tr))
{
return tr;
}
Modified: trunk/reactos/dll/appcompat/apphelp/sdbpapi.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/sdbp…
==============================================================================
--- trunk/reactos/dll/appcompat/apphelp/sdbpapi.h [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/sdbpapi.h [iso-8859-1] Sat Aug 5 12:05:06 2017
@@ -1,6 +1,6 @@
/*
* Copyright 2013 Mislav BlaževiÄ
- * Copyright 2015,2016 Mark Jansen
+ * Copyright 2015-2017 Mark Jansen (mark.jansen(a)reactos.org)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -64,12 +64,12 @@
PDB WINAPI SdbpCreate(LPCWSTR path, PATH_TYPE type, BOOL write);
-void WINAPI SdbpFlush(PDB db);
+void WINAPI SdbpFlush(PDB pdb);
DWORD SdbpStrlen(PCWSTR string);
DWORD SdbpStrsize(PCWSTR string);
BOOL WINAPI SdbpCheckTagType(TAG tag, WORD type);
-BOOL WINAPI SdbpCheckTagIDType(PDB db, TAGID tagid, WORD type);
+BOOL WINAPI SdbpCheckTagIDType(PDB pdb, TAGID tagid, WORD type);
#ifndef WINAPIV
#define WINAPIV
Modified: trunk/reactos/dll/appcompat/apphelp/sdbread.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/sdbr…
==============================================================================
--- trunk/reactos/dll/appcompat/apphelp/sdbread.c [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/sdbread.c [iso-8859-1] Sat Aug 5 12:05:06 2017
@@ -22,10 +22,10 @@
#include "apphelp.h"
-DWORD WINAPI SdbGetTagDataSize(PDB db, TAGID tagid);
-
-
-BOOL WINAPI SdbpReadData(PDB db, PVOID dest, DWORD offset, DWORD num)
+DWORD WINAPI SdbGetTagDataSize(PDB pdb, TAGID tagid);
+
+
+BOOL WINAPI SdbpReadData(PDB pdb, PVOID dest, DWORD offset, DWORD num)
{
DWORD size = offset + num;
@@ -34,23 +34,23 @@
return FALSE;
/* Overflow */
- if (db->size < size)
+ if (pdb->size < size)
return FALSE;
- memcpy(dest, db->data + offset, num);
+ memcpy(dest, pdb->data + offset, num);
return TRUE;
}
-static DWORD WINAPI SdbpGetTagSize(PDB db, TAGID tagid)
+static DWORD WINAPI SdbpGetTagSize(PDB pdb, TAGID tagid)
{
WORD type;
DWORD size;
- type = SdbGetTagFromTagID(db, tagid) & TAG_TYPE_MASK;
+ type = SdbGetTagFromTagID(pdb, tagid) & TAG_TYPE_MASK;
if (type == TAG_NULL)
return 0;
- size = SdbGetTagDataSize(db, tagid);
+ size = SdbGetTagDataSize(pdb, tagid);
if (type <= TAG_TYPE_STRINGREF)
return size += sizeof(TAG);
else size += (sizeof(TAG) + sizeof(DWORD));
@@ -58,26 +58,26 @@
return size;
}
-static LPWSTR WINAPI SdbpGetString(PDB db, TAGID tagid, PDWORD size)
+static LPWSTR WINAPI SdbpGetString(PDB pdb, TAGID tagid, PDWORD size)
{
TAG tag;
TAGID offset;
- tag = SdbGetTagFromTagID(db, tagid);
+ tag = SdbGetTagFromTagID(pdb, tagid);
if (tag == TAG_NULL)
return NULL;
if ((tag & TAG_TYPE_MASK) == TAG_TYPE_STRINGREF)
{
/* No stringtable; all references are invalid */
- if (db->stringtable == TAGID_NULL)
+ if (pdb->stringtable == TAGID_NULL)
return NULL;
/* TAG_TYPE_STRINGREF contains offset of string relative to stringtable */
- if (!SdbpReadData(db, &tagid, tagid + sizeof(TAG), sizeof(TAGID)))
+ if (!SdbpReadData(pdb, &tagid, tagid + sizeof(TAG), sizeof(TAGID)))
return NULL;
- offset = db->stringtable + tagid + sizeof(TAG) + sizeof(TAGID);
+ offset = pdb->stringtable + tagid + sizeof(TAG) + sizeof(TAGID);
}
else if ((tag & TAG_TYPE_MASK) == TAG_TYPE_STRING)
{
@@ -90,24 +90,24 @@
}
/* Optionally read string size */
- if (size && !SdbpReadData(db, size, tagid + sizeof(TAG), sizeof(*size)))
+ if (size && !SdbpReadData(pdb, size, tagid + sizeof(TAG), sizeof(*size)))
return FALSE;
- return (LPWSTR)(&db->data[offset]);
+ return (LPWSTR)(&pdb->data[offset]);
}
/**
* Searches shim database for the tag associated with specified tagid.
*
- * @param [in] db Handle to the shim database.
+ * @param [in] pdb Handle to the shim database.
* @param [in] tagid The TAGID of the tag.
*
* @return Success: The tag associated with specified tagid, Failure: TAG_NULL.
*/
-TAG WINAPI SdbGetTagFromTagID(PDB db, TAGID tagid)
+TAG WINAPI SdbGetTagFromTagID(PDB pdb, TAGID tagid)
{
TAG data;
- if (!SdbpReadData(db, &data, tagid, sizeof(data)))
+ if (!SdbpReadData(pdb, &data, tagid, sizeof(data)))
return TAG_NULL;
return data;
}
@@ -115,12 +115,12 @@
/**
* Retrieves size of data at specified tagid.
*
- * @param [in] db Handle to the shim database.
+ * @param [in] pdb Handle to the shim database.
* @param [in] tagid Tagid of tag whose size is queried.
*
* @return Success: Size of data at specified tagid, Failure: 0.
*/
-DWORD WINAPI SdbGetTagDataSize(PDB db, TAGID tagid)
+DWORD WINAPI SdbGetTagDataSize(PDB pdb, TAGID tagid)
{
/* sizes of data types with fixed size */
static const SIZE_T sizes[6] = {
@@ -131,7 +131,7 @@
WORD type;
DWORD size;
- type = SdbGetTagFromTagID(db, tagid) & TAG_TYPE_MASK;
+ type = SdbGetTagFromTagID(pdb, tagid) & TAG_TYPE_MASK;
if (type == TAG_NULL)
return 0;
@@ -139,7 +139,7 @@
return sizes[(type >> 12) - 1];
/* tag with dynamic size (e.g. list): must read size */
- if (!SdbpReadData(db, &size, tagid + sizeof(TAG), sizeof(size)))
+ if (!SdbpReadData(pdb, &size, tagid + sizeof(TAG), sizeof(size)))
return 0;
return size;
@@ -148,25 +148,25 @@
/**
* Searches shim database for a child of specified parent tag.
*
- * @param [in] db Handle to the shim database.
+ * @param [in] pdb Handle to the shim database.
* @param [in] parent TAGID of parent.
*
* @return Success: TAGID of child tag, Failure: TAGID_NULL.
*/
-TAGID WINAPI SdbGetFirstChild(PDB db, TAGID parent)
+TAGID WINAPI SdbGetFirstChild(PDB pdb, TAGID parent)
{
/* if we are at beginning of database */
if (parent == TAGID_ROOT)
{
/* header only database: no tags */
- if (db->size <= _TAGID_ROOT)
+ if (pdb->size <= _TAGID_ROOT)
return TAGID_NULL;
/* return *real* root tagid */
else return _TAGID_ROOT;
}
/* only list tag can have children */
- if ((SdbGetTagFromTagID(db, parent) & TAG_TYPE_MASK) != TAG_TYPE_LIST)
+ if ((SdbGetTagFromTagID(pdb, parent) & TAG_TYPE_MASK) != TAG_TYPE_LIST)
return TAGID_NULL;
/* first child is sizeof(TAG) + sizeof(DWORD) bytes after beginning of list */
@@ -176,30 +176,30 @@
/**
* Searches shim database for next child of specified parent tag.
*
- * @param [in] db Handle to the shim database.
+ * @param [in] pdb Handle to the shim database.
* @param [in] parent TAGID of parent.
* @param [in] prev_child TAGID of previous child.
*
* @return Success: TAGID of next child tag, Failure: TAGID_NULL.
*/
-TAGID WINAPI SdbGetNextChild(PDB db, TAGID parent, TAGID prev_child)
+TAGID WINAPI SdbGetNextChild(PDB pdb, TAGID parent, TAGID prev_child)
{
TAGID next_child;
DWORD prev_child_size, parent_size;
- prev_child_size = SdbpGetTagSize(db, prev_child);
+ prev_child_size = SdbpGetTagSize(pdb, prev_child);
if (prev_child_size == 0)
return TAGID_NULL;
/* Bound check */
next_child = prev_child + prev_child_size;
- if (next_child >= db->size)
+ if (next_child >= pdb->size)
return TAGID_NULL;
if (parent == TAGID_ROOT)
return next_child;
- parent_size = SdbpGetTagSize(db, parent);
+ parent_size = SdbpGetTagSize(pdb, parent);
if (parent_size == 0)
return TAGID_NULL;
@@ -213,22 +213,22 @@
/**
* Searches shim database for a tag within specified domain.
*
- * @param [in] db Handle to the shim database.
+ * @param [in] pdb Handle to the shim database.
* @param [in] parent TAGID of parent.
* @param [in] tag TAG to be located.
*
* @return Success: TAGID of first matching tag, Failure: TAGID_NULL.
*/
-TAGID WINAPI SdbFindFirstTag(PDB db, TAGID parent, TAG tag)
+TAGID WINAPI SdbFindFirstTag(PDB pdb, TAGID parent, TAG tag)
{
TAGID iter;
- iter = SdbGetFirstChild(db, parent);
+ iter = SdbGetFirstChild(pdb, parent);
while (iter != TAGID_NULL)
{
- if (SdbGetTagFromTagID(db, iter) == tag)
+ if (SdbGetTagFromTagID(pdb, iter) == tag)
return iter;
- iter = SdbGetNextChild(db, parent, iter);
+ iter = SdbGetNextChild(pdb, parent, iter);
}
return TAGID_NULL;
}
@@ -236,25 +236,25 @@
/**
* Searches shim database for a next tag which matches prev_child within parent's
domain.
*
- * @param [in] db Handle to the shim database.
+ * @param [in] pdb Handle to the shim database.
* @param [in] parent TAGID of parent.
* @param [in] prev_child TAGID of previous match.
*
* @return Success: TAGID of next match, Failure: TAGID_NULL.
*/
-TAGID WINAPI SdbFindNextTag(PDB db, TAGID parent, TAGID prev_child)
+TAGID WINAPI SdbFindNextTag(PDB pdb, TAGID parent, TAGID prev_child)
{
TAG tag;
TAGID iter;
- tag = SdbGetTagFromTagID(db, prev_child);
- iter = SdbGetNextChild(db, parent, prev_child);
+ tag = SdbGetTagFromTagID(pdb, prev_child);
+ iter = SdbGetNextChild(pdb, parent, prev_child);
while (iter != TAGID_NULL)
{
- if (SdbGetTagFromTagID(db, iter) == tag)
+ if (SdbGetTagFromTagID(pdb, iter) == tag)
return iter;
- iter = SdbGetNextChild(db, parent, iter);
+ iter = SdbGetNextChild(pdb, parent, iter);
}
return TAGID_NULL;
}
@@ -266,7 +266,7 @@
* If size parameter is less than number of characters in string, this function shall
fail and
* no data shall be copied.
*
- * @param [in] db Handle to the shim database.
+ * @param [in] pdb Handle to the shim database.
* @param [in] tagid TAGID of string or stringref associated with the string.
* @param [out] buffer Buffer in which string will be copied.
* @param [in] size Number of characters to copy.
@@ -274,12 +274,12 @@
* @return TRUE if string was successfully copied to the buffer FALSE if string was not
copied
* to the buffer.
*/
-BOOL WINAPI SdbReadStringTag(PDB db, TAGID tagid, LPWSTR buffer, DWORD size)
+BOOL WINAPI SdbReadStringTag(PDB pdb, TAGID tagid, LPWSTR buffer, DWORD size)
{
LPWSTR string;
DWORD string_size;
- string = SdbpGetString(db, tagid, &string_size);
+ string = SdbpGetString(pdb, tagid, &string_size);
if (!string)
return FALSE;
@@ -294,70 +294,70 @@
/**
* Reads WORD value at specified tagid.
*
- * @param [in] db Handle to the shim database.
+ * @param [in] pdb Handle to the shim database.
* @param [in] tagid TAGID of WORD value.
* @param [in] ret Default return value in case function fails.
*
* @return Success: WORD value at specified tagid, or ret on failure.
*/
-WORD WINAPI SdbReadWORDTag(PDB db, TAGID tagid, WORD ret)
-{
- if (SdbpCheckTagIDType(db, tagid, TAG_TYPE_WORD))
- SdbpReadData(db, &ret, tagid + 2, sizeof(WORD));
+WORD WINAPI SdbReadWORDTag(PDB pdb, TAGID tagid, WORD ret)
+{
+ if (SdbpCheckTagIDType(pdb, tagid, TAG_TYPE_WORD))
+ SdbpReadData(pdb, &ret, tagid + 2, sizeof(WORD));
return ret;
}
/**
* Reads DWORD value at specified tagid.
*
- * @param [in] db Handle to the shim database.
+ * @param [in] pdb Handle to the shim database.
* @param [in] tagid TAGID of DWORD value.
* @param [in] ret Default return value in case function fails.
*
* @return Success: DWORD value at specified tagid, otherwise ret.
*/
-DWORD WINAPI SdbReadDWORDTag(PDB db, TAGID tagid, DWORD ret)
-{
- if (SdbpCheckTagIDType(db, tagid, TAG_TYPE_DWORD))
- SdbpReadData(db, &ret, tagid + 2, sizeof(DWORD));
+DWORD WINAPI SdbReadDWORDTag(PDB pdb, TAGID tagid, DWORD ret)
+{
+ if (SdbpCheckTagIDType(pdb, tagid, TAG_TYPE_DWORD))
+ SdbpReadData(pdb, &ret, tagid + 2, sizeof(DWORD));
return ret;
}
/**
* Reads QWORD value at specified tagid.
*
- * @param [in] db Handle to the shim database.
+ * @param [in] pdb Handle to the shim database.
* @param [in] tagid TAGID of QWORD value.
* @param [in] ret Default return value in case function fails.
*
* @return Success: QWORD value at specified tagid, otherwise ret.
*/
-QWORD WINAPI SdbReadQWORDTag(PDB db, TAGID tagid, QWORD ret)
-{
- if (SdbpCheckTagIDType(db, tagid, TAG_TYPE_QWORD))
- SdbpReadData(db, &ret, tagid + sizeof(TAG), sizeof(QWORD));
+QWORD WINAPI SdbReadQWORDTag(PDB pdb, TAGID tagid, QWORD ret)
+{
+ if (SdbpCheckTagIDType(pdb, tagid, TAG_TYPE_QWORD))
+ SdbpReadData(pdb, &ret, tagid + sizeof(TAG), sizeof(QWORD));
return ret;
}
/**
* Reads binary data at specified tagid.
*
- * @param [in] db Handle to the shim database.
+ * @param [in] pdb Handle to the shim database.
* @param [in] tagid TAGID of binary data.
* @param [out] buffer Buffer in which data will be copied.
* @param [in] size Size of the buffer.
*
* @return TRUE if data was successfully written, or FALSE otherwise.
*/
-BOOL WINAPI SdbReadBinaryTag(PDB db, TAGID tagid, PBYTE buffer, DWORD size)
+BOOL WINAPI SdbReadBinaryTag(PDB pdb, TAGID tagid, PBYTE buffer, DWORD size)
{
DWORD data_size = 0;
- if (SdbpCheckTagIDType(db, tagid, TAG_TYPE_BINARY))
- {
- SdbpReadData(db, &data_size, tagid + sizeof(TAG), sizeof(data_size));
+ if (SdbpCheckTagIDType(pdb, tagid, TAG_TYPE_BINARY))
+ {
+ SdbpReadData(pdb, &data_size, tagid + sizeof(TAG), sizeof(data_size));
if (size >= data_size)
- return SdbpReadData(db, buffer, tagid + sizeof(TAG) + sizeof(data_size),
data_size);
+ return SdbpReadData(pdb, buffer, tagid + sizeof(TAG) + sizeof(data_size),
data_size);
}
return FALSE;
@@ -366,52 +366,52 @@
/**
* Retrieves binary data at specified tagid.
*
- * @param [in] db Handle to the shim database.
+ * @param [in] pdb Handle to the shim database.
* @param [in] tagid TAGID of binary data.
*
* @return Success: Pointer to binary data at specified tagid, or NULL on failure.
*/
-PVOID WINAPI SdbGetBinaryTagData(PDB db, TAGID tagid)
-{
- if (!SdbpCheckTagIDType(db, tagid, TAG_TYPE_BINARY))
+PVOID WINAPI SdbGetBinaryTagData(PDB pdb, TAGID tagid)
+{
+ if (!SdbpCheckTagIDType(pdb, tagid, TAG_TYPE_BINARY))
return NULL;
- return &db->data[tagid + sizeof(TAG) + sizeof(DWORD)];
+ return &pdb->data[tagid + sizeof(TAG) + sizeof(DWORD)];
}
/**
* Searches shim database for string associated with specified tagid.
*
- * @param [in] db Handle to the shim database.
+ * @param [in] pdb Handle to the shim database.
* @param [in] tagid TAGID of string or stringref associated with the string.
*
* @return the LPWSTR associated with specified tagid, or NULL on failure.
*/
-LPWSTR WINAPI SdbGetStringTagPtr(PDB db, TAGID tagid)
-{
- return SdbpGetString(db, tagid, NULL);
+LPWSTR WINAPI SdbGetStringTagPtr(PDB pdb, TAGID tagid)
+{
+ return SdbpGetString(pdb, tagid, NULL);
}
/**
* Reads binary data at specified tagid.
*
- * @param [in] db Handle to the shim database.
+ * @param [in] pdb Handle to the shim database.
* @param [out] Guid Database ID.
*
* @return true if the ID was found FALSE otherwise.
*/
-BOOL WINAPI SdbGetDatabaseID(PDB db, GUID* Guid)
-{
- if(SdbIsNullGUID(&db->database_id))
- {
- TAGID root = SdbFindFirstTag(db, TAGID_ROOT, TAG_DATABASE);
+BOOL WINAPI SdbGetDatabaseID(PDB pdb, GUID* Guid)
+{
+ if(SdbIsNullGUID(&pdb->database_id))
+ {
+ TAGID root = SdbFindFirstTag(pdb, TAGID_ROOT, TAG_DATABASE);
if(root != TAGID_NULL)
{
- TAGID id = SdbFindFirstTag(db, root, TAG_DATABASE_ID);
+ TAGID id = SdbFindFirstTag(pdb, root, TAG_DATABASE_ID);
if(id != TAGID_NULL)
{
- if(!SdbReadBinaryTag(db, id, (PBYTE)&db->database_id,
sizeof(db->database_id)))
+ if(!SdbReadBinaryTag(pdb, id, (PBYTE)&pdb->database_id,
sizeof(pdb->database_id)))
{
- memset(&db->database_id, 0, sizeof(db->database_id));
+ memset(&pdb->database_id, 0, sizeof(pdb->database_id));
}
}
else
@@ -426,9 +426,9 @@
SHIM_ERR("Failed to get root tag\n");
}
}
- if(!SdbIsNullGUID(&db->database_id))
- {
- memcpy(Guid, &db->database_id, sizeof(db->database_id));
+ if(!SdbIsNullGUID(&pdb->database_id))
+ {
+ memcpy(Guid, &pdb->database_id, sizeof(pdb->database_id));
return TRUE;
}
return FALSE;
Modified: trunk/reactos/dll/appcompat/apphelp/sdbtypes.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/sdbt…
==============================================================================
--- trunk/reactos/dll/appcompat/apphelp/sdbtypes.h [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/sdbtypes.h [iso-8859-1] Sat Aug 5 12:05:06 2017
@@ -1,6 +1,6 @@
/*
* Copyright 2013 Mislav BlaževiÄ
- * Copyright 2015,2016 Mark Jansen
+ * Copyright 2015-2017 Mark Jansen (mark.jansen(a)reactos.org)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -39,6 +39,7 @@
TAGID stringtable;
DWORD write_iter;
GUID database_id;
+ BOOL for_write;
struct SdbStringHashTable* string_lookup;
struct _DB* string_buffer;
} DB, *PDB;
Modified: trunk/reactos/dll/appcompat/apphelp/sdbwrite.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/sdbw…
==============================================================================
--- trunk/reactos/dll/appcompat/apphelp/sdbwrite.c [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/sdbwrite.c [iso-8859-1] Sat Aug 5 12:05:06 2017
@@ -34,60 +34,67 @@
/* Local functions */
-BOOL WINAPI SdbWriteStringRefTag(PDB db, TAG tag, TAGID tagid);
-BOOL WINAPI SdbWriteStringTag(PDB db, TAG tag, LPCWSTR string);
-TAGID WINAPI SdbBeginWriteListTag(PDB db, TAG tag);
-BOOL WINAPI SdbEndWriteListTag(PDB db, TAGID tagid);
+BOOL WINAPI SdbWriteStringRefTag(PDB pdb, TAG tag, TAGID tagid);
+BOOL WINAPI SdbWriteStringTag(PDB pdb, TAG tag, LPCWSTR string);
+TAGID WINAPI SdbBeginWriteListTag(PDB pdb, TAG tag);
+BOOL WINAPI SdbEndWriteListTag(PDB pdb, TAGID tagid);
/* sdbapi.c */
void WINAPI SdbCloseDatabase(PDB);
-
-static void WINAPI SdbpWrite(PDB db, const void* data, DWORD size)
-{
- if (db->write_iter + size > db->size)
+/* Copy data to the allocated database */
+static void WINAPI SdbpWrite(PDB pdb, const void* data, DWORD size)
+{
+ ASSERT(pdb->for_write);
+ if (pdb->write_iter + size > pdb->size)
{
- DWORD oldSize = db->size;
+ DWORD oldSize = pdb->size;
/* Round to powers of two to prevent too many reallocations */
- while (db->size < db->write_iter + size) db->size <<= 1;
- db->data = SdbReAlloc(db->data, db->size, oldSize);
+ while (pdb->size < pdb->write_iter + size) pdb->size <<= 1;
+ pdb->data = SdbReAlloc(pdb->data, pdb->size, oldSize);
}
- memcpy(db->data + db->write_iter, data, size);
- db->write_iter += size;
-}
-
-static BOOL WINAPI SdbpGetOrAddStringRef(PDB db, LPCWSTR string, TAGID* tagid)
-{
- PDB buf = db->string_buffer;
- if (db->string_buffer == NULL)
+ memcpy(pdb->data + pdb->write_iter, data, size);
+ pdb->write_iter += size;
+}
+
+/* Add a string to the string table (creating it when it did not exist yet),
+ returning if it succeeded or not */
+static BOOL WINAPI SdbpGetOrAddStringRef(PDB pdb, LPCWSTR string, TAGID* tagid)
+{
+ PDB buf = pdb->string_buffer;
+ ASSERT(pdb->for_write);
+
+ if (pdb->string_buffer == NULL)
{
- db->string_buffer = buf = SdbAlloc(sizeof(DB));
+ pdb->string_buffer = buf = SdbAlloc(sizeof(DB));
if (buf == NULL)
return FALSE;
buf->size = 128;
buf->data = SdbAlloc(buf->size);
+ buf->for_write = TRUE;
if (buf->data == NULL)
return FALSE;
}
*tagid = buf->write_iter + sizeof(TAG) + sizeof(DWORD);
- if (SdbpAddStringToTable(&db->string_lookup, string, tagid))
+ if (SdbpAddStringToTable(&pdb->string_lookup, string, tagid))
return SdbWriteStringTag(buf, TAG_STRINGTABLE_ITEM, string);
- return db->string_lookup != NULL;
-}
-
-static BOOL WINAPI SdbpWriteStringtable(PDB db)
+ return pdb->string_lookup != NULL;
+}
+
+/* Write the in-memory stringtable to the specified db */
+static BOOL WINAPI SdbpWriteStringtable(PDB pdb)
{
TAGID table;
- PDB buf = db->string_buffer;
- if (buf == NULL || db->string_lookup == NULL)
- return FALSE;
-
- table = SdbBeginWriteListTag(db, TAG_STRINGTABLE);
- SdbpWrite(db, buf->data, buf->write_iter);
- return SdbEndWriteListTag(db, table);
+ PDB buf = pdb->string_buffer;
+ if (buf == NULL || pdb->string_lookup == NULL)
+ return FALSE;
+
+ table = SdbBeginWriteListTag(pdb, TAG_STRINGTABLE);
+ SdbpWrite(pdb, buf->data, buf->write_iter);
+ return SdbEndWriteListTag(pdb, table);
}
/**
@@ -106,137 +113,138 @@
{
static const DWORD version_major = 2, version_minor = 1;
static const char* magic = "sdbf";
- PDB db;
-
- db = SdbpCreate(path, type, TRUE);
- if (!db)
+ PDB pdb;
+
+ pdb = SdbpCreate(path, type, TRUE);
+ if (!pdb)
return NULL;
- db->size = sizeof(DWORD) + sizeof(DWORD) + strlen(magic);
- db->data = SdbAlloc(db->size);
-
- SdbpWrite(db, &version_major, sizeof(DWORD));
- SdbpWrite(db, &version_minor, sizeof(DWORD));
- SdbpWrite(db, magic, strlen(magic));
-
- return db;
+ pdb->size = sizeof(DWORD) + sizeof(DWORD) + strlen(magic);
+ pdb->data = SdbAlloc(pdb->size);
+
+ SdbpWrite(pdb, &version_major, sizeof(DWORD));
+ SdbpWrite(pdb, &version_minor, sizeof(DWORD));
+ SdbpWrite(pdb, magic, strlen(magic));
+
+ return pdb;
}
/**
* Closes specified database and writes data to file.
*
- * @param [in] db Handle to the shim database.
- */
-void WINAPI SdbCloseDatabaseWrite(PDB db)
-{
- SdbpWriteStringtable(db);
- SdbpFlush(db);
- SdbCloseDatabase(db);
+ * @param [in] pdb Handle to the shim database.
+ */
+void WINAPI SdbCloseDatabaseWrite(PDB pdb)
+{
+ ASSERT(pdb->for_write);
+ SdbpWriteStringtable(pdb);
+ SdbpFlush(pdb);
+ SdbCloseDatabase(pdb);
}
/**
* Writes a tag-only (NULL) entry to the specified shim database.
*
- * @param [in] db Handle to the shim database.
+ * @param [in] pdb Handle to the shim database.
* @param [in] tag A tag for the entry.
*
* @return TRUE if it succeeds, FALSE if it fails.
*/
-BOOL WINAPI SdbWriteNULLTag(PDB db, TAG tag)
+BOOL WINAPI SdbWriteNULLTag(PDB pdb, TAG tag)
{
if (!SdbpCheckTagType(tag, TAG_TYPE_NULL))
return FALSE;
- SdbpWrite(db, &tag, sizeof(TAG));
+ SdbpWrite(pdb, &tag, sizeof(TAG));
return TRUE;
}
/**
* Writes a WORD entry to the specified shim database.
*
- * @param [in] db Handle to the shim database.
+ * @param [in] pdb Handle to the shim database.
* @param [in] tag A tag for the entry.
* @param [in] data WORD entry which will be written to the database.
*
* @return TRUE if it succeeds, FALSE if it fails.
*/
-BOOL WINAPI SdbWriteWORDTag(PDB db, TAG tag, WORD data)
+BOOL WINAPI SdbWriteWORDTag(PDB pdb, TAG tag, WORD data)
{
if (!SdbpCheckTagType(tag, TAG_TYPE_WORD))
return FALSE;
- SdbpWrite(db, &tag, sizeof(TAG));
- SdbpWrite(db, &data, sizeof(data));
+ SdbpWrite(pdb, &tag, sizeof(TAG));
+ SdbpWrite(pdb, &data, sizeof(data));
return TRUE;
}
/**
* Writes a DWORD entry to the specified shim database.
*
- * @param [in] db Handle to the shim database.
+ * @param [in] pdb Handle to the shim database.
* @param [in] tag A tag for the entry.
* @param [in] data DWORD entry which will be written to the database.
*
* @return TRUE if it succeeds, FALSE if it fails.
*/
-BOOL WINAPI SdbWriteDWORDTag(PDB db, TAG tag, DWORD data)
+BOOL WINAPI SdbWriteDWORDTag(PDB pdb, TAG tag, DWORD data)
{
if (!SdbpCheckTagType(tag, TAG_TYPE_DWORD))
return FALSE;
- SdbpWrite(db, &tag, sizeof(TAG));
- SdbpWrite(db, &data, sizeof(data));
+ SdbpWrite(pdb, &tag, sizeof(TAG));
+ SdbpWrite(pdb, &data, sizeof(data));
return TRUE;
}
/**
* Writes a DWORD entry to the specified shim database.
*
- * @param [in] db Handle to the shim database.
+ * @param [in] pdb Handle to the shim database.
* @param [in] tag A tag for the entry.
* @param [in] data QWORD entry which will be written to the database.
*
* @return TRUE if it succeeds, FALSE if it fails.
*/
-BOOL WINAPI SdbWriteQWORDTag(PDB db, TAG tag, QWORD data)
+BOOL WINAPI SdbWriteQWORDTag(PDB pdb, TAG tag, QWORD data)
{
if (!SdbpCheckTagType(tag, TAG_TYPE_QWORD))
return FALSE;
- SdbpWrite(db, &tag, sizeof(TAG));
- SdbpWrite(db, &data, sizeof(data));
+ SdbpWrite(pdb, &tag, sizeof(TAG));
+ SdbpWrite(pdb, &data, sizeof(data));
return TRUE;
}
/**
* Writes a wide string entry to the specified shim database.
*
- * @param [in] db Handle to the shim database.
+ * @param [in] pdb Handle to the shim database.
* @param [in] tag A tag for the entry.
* @param [in] string Wide string entry which will be written to the database.
*
* @return TRUE if it succeeds, FALSE if it fails.
*/
-BOOL WINAPI SdbWriteStringTag(PDB db, TAG tag, LPCWSTR string)
+BOOL WINAPI SdbWriteStringTag(PDB pdb, TAG tag, LPCWSTR string)
{
DWORD size;
if (SdbpCheckTagType(tag, TAG_TYPE_STRINGREF))
{
TAGID tagid = 0;
- if (!SdbpGetOrAddStringRef(db, string, &tagid))
+ if (!SdbpGetOrAddStringRef(pdb, string, &tagid))
return FALSE;
- return SdbWriteStringRefTag(db, tag, tagid);
+ return SdbWriteStringRefTag(pdb, tag, tagid);
}
if (!SdbpCheckTagType(tag, TAG_TYPE_STRING))
return FALSE;
size = SdbpStrsize(string);
- SdbpWrite(db, &tag, sizeof(TAG));
- SdbpWrite(db, &size, sizeof(size));
- SdbpWrite(db, string, size);
+ SdbpWrite(pdb, &tag, sizeof(TAG));
+ SdbpWrite(pdb, &size, sizeof(size));
+ SdbpWrite(pdb, string, size);
return TRUE;
}
@@ -244,40 +252,40 @@
* Writes a stringref tag to specified database
* @note Reference (tagid) is not checked for validity.
*
- * @param [in] db Handle to the shim database.
+ * @param [in] pdb Handle to the shim database.
* @param [in] tag TAG which will be written.
* @param [in] tagid TAGID of the string tag refers to.
*
* @return TRUE if it succeeds, FALSE if it fails.
*/
-BOOL WINAPI SdbWriteStringRefTag(PDB db, TAG tag, TAGID tagid)
+BOOL WINAPI SdbWriteStringRefTag(PDB pdb, TAG tag, TAGID tagid)
{
if (!SdbpCheckTagType(tag, TAG_TYPE_STRINGREF))
return FALSE;
- SdbpWrite(db, &tag, sizeof(TAG));
- SdbpWrite(db, &tagid, sizeof(tagid));
+ SdbpWrite(pdb, &tag, sizeof(TAG));
+ SdbpWrite(pdb, &tagid, sizeof(tagid));
return TRUE;
}
/**
* Writes data the specified shim database.
*
- * @param [in] db Handle to the shim database.
+ * @param [in] pdb Handle to the shim database.
* @param [in] tag A tag for the entry.
* @param [in] data Pointer to data.
* @param [in] size Number of bytes to write.
*
* @return TRUE if it succeeds, FALSE if it fails.
*/
-BOOL WINAPI SdbWriteBinaryTag(PDB db, TAG tag, const BYTE* data, DWORD size)
+BOOL WINAPI SdbWriteBinaryTag(PDB pdb, TAG tag, const BYTE* data, DWORD size)
{
if (!SdbpCheckTagType(tag, TAG_TYPE_BINARY))
return FALSE;
- SdbpWrite(db, &tag, sizeof(TAG));
- SdbpWrite(db, &size, sizeof(size));
- SdbpWrite(db, data, size);
+ SdbpWrite(pdb, &tag, sizeof(TAG));
+ SdbpWrite(pdb, &size, sizeof(size));
+ SdbpWrite(pdb, data, size);
return TRUE;
}
@@ -285,13 +293,13 @@
/**
* Writes data from a file to the specified shim database.
*
- * @param [in] db Handle to the shim database.
+ * @param [in] pdb Handle to the shim database.
* @param [in] tag A tag for the entry.
* @param [in] path Path of the input file.
*
* @return TRUE if it succeeds, FALSE if it fails.
*/
-BOOL WINAPI SdbWriteBinaryTagFromFile(PDB db, TAG tag, LPCWSTR path)
+BOOL WINAPI SdbWriteBinaryTagFromFile(PDB pdb, TAG tag, LPCWSTR path)
{
MEMMAPPED mapped;
@@ -301,7 +309,7 @@
if (!SdbpOpenMemMappedFile(path, &mapped))
return FALSE;
- SdbWriteBinaryTag(db, tag, mapped.view, mapped.size);
+ SdbWriteBinaryTag(pdb, tag, mapped.view, mapped.size);
SdbpCloseMemMappedFile(&mapped);
return TRUE;
}
@@ -311,14 +319,14 @@
* Writes a list tag to specified database All subsequent SdbWrite* functions shall write
to
* newly created list untill TAGID of that list is passed to SdbEndWriteListTag.
*
- * @param [in] db Handle to the shim database.
+ * @param [in] pdb Handle to the shim database.
* @param [in] tag TAG for the list
*
* RETURNS Success: TAGID of the newly created list, or TAGID_NULL on
failure.
*
* @return A TAGID.
*/
-TAGID WINAPI SdbBeginWriteListTag(PDB db, TAG tag)
+TAGID WINAPI SdbBeginWriteListTag(PDB pdb, TAG tag)
{
TAGID list_id;
DWORD dum = 0;
@@ -326,27 +334,29 @@
if (!SdbpCheckTagType(tag, TAG_TYPE_LIST))
return TAGID_NULL;
- list_id = db->write_iter;
- SdbpWrite(db, &tag, sizeof(TAG));
- SdbpWrite(db, &dum, sizeof(dum)); /* reserve some memory for storing list size
*/
+ list_id = pdb->write_iter;
+ SdbpWrite(pdb, &tag, sizeof(TAG));
+ SdbpWrite(pdb, &dum, sizeof(dum)); /* reserve some memory for storing list size
*/
return list_id;
}
/**
* Marks end of the specified list.
*
- * @param [in] db Handle to the shim database.
+ * @param [in] pdb Handle to the shim database.
* @param [in] tagid TAGID of the list.
*
* @return TRUE if it succeeds, FALSE if it fails.
*/
-BOOL WINAPI SdbEndWriteListTag(PDB db, TAGID tagid)
-{
- if (!SdbpCheckTagIDType(db, tagid, TAG_TYPE_LIST))
+BOOL WINAPI SdbEndWriteListTag(PDB pdb, TAGID tagid)
+{
+ ASSERT(pdb->for_write);
+
+ if (!SdbpCheckTagIDType(pdb, tagid, TAG_TYPE_LIST))
return FALSE;
/* Write size of list to list tag header */
- *(DWORD*)&db->data[tagid + sizeof(TAG)] = db->write_iter - tagid -
sizeof(TAG) - sizeof(TAGID);
- return TRUE;
-}
-
+ *(DWORD*)&pdb->data[tagid + sizeof(TAG)] = pdb->write_iter - tagid -
sizeof(TAG) - sizeof(TAGID);
+ return TRUE;
+}
+
Modified: trunk/reactos/dll/appcompat/shims/genral/themes.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/shims/genral…
==============================================================================
--- trunk/reactos/dll/appcompat/shims/genral/themes.c [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/shims/genral/themes.c [iso-8859-1] Sat Aug 5 12:05:06
2017
@@ -3,7 +3,7 @@
* PROJECT: ReactOS Shim library
* FILE: dll/appcompat/shims/genral/themes.c
* PURPOSE: Theme related shims
- * PROGRAMMER: Mark Jansen
+ * PROGRAMMER: Mark Jansen (mark.jansen(a)reactos.org)
*/
#include <windows.h>
@@ -22,6 +22,7 @@
{
if (fdwReason == SHIM_REASON_INIT)
{
+ /* Disable themes for non-client, comctl controls and webcontent */
SetThemeAppProperties(0);
}
return TRUE;
Modified: trunk/reactos/sdk/tools/xml2sdb/main.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/tools/xml2sdb/main.cpp…
==============================================================================
--- trunk/reactos/sdk/tools/xml2sdb/main.cpp [iso-8859-1] (original)
+++ trunk/reactos/sdk/tools/xml2sdb/main.cpp [iso-8859-1] Sat Aug 5 12:05:06 2017
@@ -53,7 +53,7 @@
PDB WINAPI SdbpCreate(LPCWSTR path, PATH_TYPE type, BOOL write)
{
- PDB db;
+ PDB pdb;
FILE* f;
std::string pathA(path, path + SdbpStrlen(path));
@@ -61,30 +61,33 @@
if (!f)
return NULL;
- db = (PDB)SdbAlloc(sizeof(DB));
- db->file = f;
-
- return db;
-}
-
-void WINAPI SdbpFlush(PDB db)
-{
- fwrite(db->data, db->write_iter, 1, (FILE*)db->file);
-}
-
-void WINAPI SdbCloseDatabase(PDB db)
-{
- if (!db)
+ pdb = (PDB)SdbAlloc(sizeof(DB));
+ pdb->file = f;
+ pdb->for_write = write;
+
+ return pdb;
+}
+
+void WINAPI SdbpFlush(PDB pdb)
+{
+ ASSERT(pdb->for_write);
+
+ fwrite(pdb->data, pdb->write_iter, 1, (FILE*)pdb->file);
+}
+
+void WINAPI SdbCloseDatabase(PDB pdb)
+{
+ if (!pdb)
return;
- if (db->file)
- fclose((FILE*)db->file);
- if (db->string_buffer)
- SdbCloseDatabase(db->string_buffer);
- if (db->string_lookup)
- SdbpTableDestroy(&db->string_lookup);
- SdbFree(db->data);
- SdbFree(db);
+ if (pdb->file)
+ fclose((FILE*)pdb->file);
+ if (pdb->string_buffer)
+ SdbCloseDatabase(pdb->string_buffer);
+ if (pdb->string_lookup)
+ SdbpTableDestroy(&pdb->string_lookup);
+ SdbFree(pdb->data);
+ SdbFree(pdb);
}
BOOL WINAPI SdbpCheckTagType(TAG tag, WORD type)
@@ -94,7 +97,7 @@
return TRUE;
}
-BOOL WINAPI SdbpReadData(PDB db, PVOID dest, DWORD offset, DWORD num)
+BOOL WINAPI SdbpReadData(PDB pdb, PVOID dest, DWORD offset, DWORD num)
{
DWORD size = offset + num;
@@ -103,24 +106,24 @@
return FALSE;
/* Overflow */
- if (db->size < size)
- return FALSE;
-
- memcpy(dest, db->data + offset, num);
+ if (pdb->size < size)
+ return FALSE;
+
+ memcpy(dest, pdb->data + offset, num);
return TRUE;
}
-TAG WINAPI SdbGetTagFromTagID(PDB db, TAGID tagid)
+TAG WINAPI SdbGetTagFromTagID(PDB pdb, TAGID tagid)
{
TAG data;
- if (!SdbpReadData(db, &data, tagid, sizeof(data)))
+ if (!SdbpReadData(pdb, &data, tagid, sizeof(data)))
return TAG_NULL;
return data;
}
-BOOL WINAPI SdbpCheckTagIDType(PDB db, TAGID tagid, WORD type)
-{
- TAG tag = SdbGetTagFromTagID(db, tagid);
+BOOL WINAPI SdbpCheckTagIDType(PDB pdb, TAGID tagid, WORD type)
+{
+ TAG tag = SdbGetTagFromTagID(pdb, tagid);
if (tag == TAG_NULL)
return FALSE;
return SdbpCheckTagType(tag, type);
Modified: trunk/reactos/sdk/tools/xml2sdb/xml2sdb.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/tools/xml2sdb/xml2sdb.…
==============================================================================
--- trunk/reactos/sdk/tools/xml2sdb/xml2sdb.cpp [iso-8859-1] (original)
+++ trunk/reactos/sdk/tools/xml2sdb/xml2sdb.cpp [iso-8859-1] Sat Aug 5 12:05:06 2017
@@ -491,14 +491,14 @@
SdbWriteDWORDTag(pdb, tag, value);
}
-TAGID Database::BeginWriteListTag(PDB db, TAG tag)
-{
- return SdbBeginWriteListTag(db, tag);
-}
-
-BOOL Database::EndWriteListTag(PDB db, TAGID tagid)
-{
- return SdbEndWriteListTag(db, tagid);
+TAGID Database::BeginWriteListTag(PDB pdb, TAG tag)
+{
+ return SdbBeginWriteListTag(pdb, tag);
+}
+
+BOOL Database::EndWriteListTag(PDB pdb, TAGID tagid)
+{
+ return SdbEndWriteListTag(pdb, tagid);
}
bool Database::fromXml(XMLHandle dbNode)
Modified: trunk/reactos/sdk/tools/xml2sdb/xml2sdb.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/tools/xml2sdb/xml2sdb.…
==============================================================================
--- trunk/reactos/sdk/tools/xml2sdb/xml2sdb.h [iso-8859-1] (original)
+++ trunk/reactos/sdk/tools/xml2sdb/xml2sdb.h [iso-8859-1] Sat Aug 5 12:05:06 2017
@@ -128,8 +128,8 @@
void WriteBinary(PDB pdb, TAG tag, const GUID& guid, bool always = false);
void WriteBinary(PDB pdb, TAG tag, const std::vector<BYTE>& data, bool
always = false);
void WriteDWord(PDB pdb, TAG tag, DWORD value, bool always = false);
- TAGID BeginWriteListTag(PDB db, TAG tag);
- BOOL EndWriteListTag(PDB db, TAGID tagid);
+ TAGID BeginWriteListTag(PDB pdb, TAG tag);
+ BOOL EndWriteListTag(PDB pdb, TAGID tagid);
void InsertShimTagid(const sdbstring& name, TAGID tagid);
inline void InsertShimTagid(const std::string& name, TAGID tagid)