ReactOS  0.4.12-dev-75-g00dd17e
sdbapi.c File Reference
#include "ntndk.h"
#include "strsafe.h"
#include "apphelp.h"
#include "sdbstringtable.h"
Include dependency graph for sdbapi.c:

Go to the source code of this file.

Macros

#define REG_SZ   1
 
#define REG_DWORD   4
 
#define REG_QWORD   11
 

Functions

static HANDLE SdbpHeap (void)
 
void SdbpHeapInit (void)
 
void SdbpHeapDeinit (void)
 
LPVOID SdbpAlloc (SIZE_T size)
 
LPVOID SdbpReAlloc (LPVOID mem, SIZE_T size, SIZE_T oldSize)
 
void SdbpFree (LPVOID mem)
 
PDB WINAPI SdbpCreate (LPCWSTR path, PATH_TYPE type, BOOL write)
 
void WINAPI SdbpFlush (PDB pdb)
 
DWORD SdbpStrlen (PCWSTR string)
 
DWORD SdbpStrsize (PCWSTR string)
 
PWSTR SdbpStrDup (LPCWSTR string)
 
BOOL WINAPI SdbpOpenMemMappedFile (LPCWSTR path, PMEMMAPPED mapping)
 
void WINAPI SdbpCloseMemMappedFile (PMEMMAPPED mapping)
 
BOOL WINAPI SdbpCheckTagType (TAG tag, WORD type)
 
BOOL WINAPI SdbpCheckTagIDType (PDB pdb, TAGID tagid, WORD type)
 
PDB SdbpOpenDatabase (LPCWSTR path, PATH_TYPE type, PDWORD major, PDWORD minor)
 
PDB WINAPI SdbOpenDatabase (LPCWSTR path, PATH_TYPE type)
 
void WINAPI SdbCloseDatabase (PDB pdb)
 
BOOL WINAPI SdbGUIDFromString (PCWSTR GuidString, GUID *Guid)
 
BOOL WINAPI SdbGUIDToString (CONST GUID *Guid, PWSTR GuidString, SIZE_T Length)
 
BOOL WINAPI SdbIsNullGUID (CONST GUID *Guid)
 
BOOL WINAPI SdbGetStandardDatabaseGUID (DWORD Flags, GUID *Guid)
 
BOOL WINAPI SdbGetDatabaseVersion (LPCWSTR database, PDWORD VersionHi, PDWORD VersionLo)
 
TAGID WINAPI SdbFindFirstNamedTag (PDB pdb, TAGID root, TAGID find, TAGID nametag, LPCWSTR find_name)
 
TAGREF WINAPI SdbGetLayerTagRef (HSDB hsdb, LPCWSTR layerName)
 
DWORD WINAPI SdbQueryDataExTagID (PDB pdb, TAGID tiExe, LPCWSTR lpszDataName, LPDWORD lpdwDataType, LPVOID lpBuffer, LPDWORD lpcbBufferSize, TAGID *ptiData)
 
LONGLONG WINAPI SdbMakeIndexKeyFromString (LPCWSTR str)
 
LPCWSTR WINAPI SdbTagToString (TAG tag)
 

Variables

static const GUID GUID_DATABASE_MSI = {0xd8ff6d16,0x6a3a,0x468a, {0x8b,0x44,0x01,0x71,0x4d,0xdc,0x49,0xea}}
 
static const GUID GUID_DATABASE_SHIM = {0x11111111,0x1111,0x1111, {0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11}}
 
static const GUID GUID_DATABASE_DRIVERS = {0xf9ab2228,0x3312,0x4a73, {0xb6,0xf9,0x93,0x6d,0x70,0xe1,0x12,0xef}}
 
static HANDLE g_Heap
 

Macro Definition Documentation

◆ REG_DWORD

#define REG_DWORD   4

Definition at line 539 of file sdbapi.c.

Referenced by _CmdWndProc(), _LocalGetPrintServerHandleData(), _test_reg_key(), ACTION_ConvertRegValue(), add_userkey(), AddEntryToList(), AddERExcludedApplicationW(), CDesktopFolderEnum::AddItemsFromClassicStartMenuKey(), allow_degraded_mount(), ApplyCursorScheme(), ApplyRegistryValues(), AtapiRegCheckParameterValue(), AVrfReadIFEO(), BiGetObjectDescription(), cache_container_set_size(), CDevSettings_SetPruningMode(), CdRomCheckRegistryForMediaChangeValue(), CdRomSetDeviceParameter(), check_reg_dword(), check_reg_dword4(), check_reg_dword5(), ClassGetDeviceParameter(), ClasspIsMediaChangeDisabledForClass(), ClasspMediaChangeDeviceInstanceOverride(), ClasspScanForSpecialInRegistry(), ClassQueryTimeOutRegistryValue(), ClassSetDeviceParameter(), CmpCreateControlSet(), CmpFindControlSet(), CmpInitializeMachineDependentConfiguration(), CompareFunc(), ConCfgWriteUserSettings(), connections_on_initdialog(), connections_on_notify(), ConSrvWriteUserSettings(), create_test_entries(), CreateBaseAcls(), CreateEventLog(), CreateInternalDeviceData(), CreateNewValue(), CreateProcessInternalW(), CRYPTDLG_CheckOnlineCRL(), data_type_state(), DEVENUM_IPropertyBag_Read(), DEVENUM_IPropertyBag_Write(), DEVENUM_ReadPins(), DIALOG_Execute(), DIALOG_ProgramAttributes(), Direct3DCreate9(), DisableShellext(), CNetConnection::Disconnect(), DisplayDevicePropertyText(), DllMain(), do_process_key(), ATL::CRegObject::do_process_key(), do_reg_operation(), DriverEntry(), EnumClientServiceProtocol(), EnumerateNt4ServiceSoundDevices(), EnumerateValueTest(), EnumInstalledApplications(), CShellCommandSetValue::Execute(), export_data(), export_hkey(), ExpSaveUuidSequence(), Ext2RegistryQueryCallback(), FileTypesDlg_InsertToLV(), FilterMapper3_CreateCategory(), FilterMapper_RegisterFilter(), FilterMapper_RegisterPin(), CRegistryFolder::FormatValueData(), free_parser_data(), FreeBT_GetRegistryDword(), fs_ignored(), FsRtlpIsDfsEnabled(), get_config_key_dword(), get_dword_from_reg(), get_feature_from_reg(), get_reg_dword(), get_regdata(), get_zone_for_scheme(), GetCurrentDPI(), GetD3D9DriverInfo(), getDataType(), GetDisplayNameFileAndID(), GetDosDevicesProtection(), GetExplorerRegValueSet(), GetFindFlags(), CNetConnection::GetProperties(), GetRegInt(), GetRegIntFromID(), GetRegistryPropertyType(), GetRegUlong(), GetSetupType(), GuiConsoleWriteUserSettings(), HalpMarkAcpiHal(), HalpMarkChipsetDecode(), ImposeSacCmdServiceStartTypePolicy(), INetCfgComponentControl_fnApplyRegistryChanges(), InitControl(), InitDisplayDriver(), InitFontSizeList(), InitLogs(), InitPropertiesDlg(), InputProcessorProfiles_AddLanguageProfile(), InputProcessorProfiles_EnableLanguageProfile(), InputProcessorProfiles_EnableLanguageProfileByDefault(), InstallDriver(), InstallEventSource(), InstallNetDevice(), InstallParallelPort(), INTERNET_LoadProxySettings(), INTERNET_SaveProxySettings(), IntGetIcdData(), IntVideoPortFindAdapter(), IoGetDeviceInterfaces(), IoGetDeviceProperty(), IopCreateDeviceNode(), IopQueryDeviceCapabilities(), IopSetDeviceInstanceData(), IoReportDetectedDevice(), IoSetDeviceInterfaceState(), is_ie_hardened(), IsInternetESCEnabledLocal(), IsOffline(), IsShimInfrastructureDisabled(), KmtFltAddAltitude(), KsCacheMedium(), CNetConnectionPropertyUi::LANPropertiesUIDlg(), LdrpInitializeExecutionOptions(), LdrpInitializeProcess(), LdrpRunInitializeRoutines(), LdrQueryImageFileKeyOption(), lineGetTranslateCapsA(), CSettings::Load(), LoadLogFile(), LoadRecoveryOptions(), LoadRegistrySettings(), LoadSchemeFromReg(), LoadSettings(), MAIN_LoadSettings(), MAIN_MenuCommand(), MakeService(), MMDevice_Create(), MMDevice_GetPropValue(), MMDevice_SetPropValue(), ModifyStatus(), ModifyValue(), MountmgrWriteNoAutoMount(), MouseOnApply(), MouseOnDialogInit(), MSACM_WriteCache(), MSI_GetProductInfo(), msi_publish_patches(), msi_reg_get_val_dword(), msi_reg_set_val_dword(), MsiSourceListEnumMediaDisksW(), MuppIsDfsEnabled(), NdisReadConfiguration(), NtSetDefaultLocale(), OLEUTL_ReadRegistryDWORDValue(), OnGetDispInfo(), OnInitSysSettingsDialog(), OnOK(), parse_data_type(), parse_value(), pCDevSettings_Initialize(), pCDevSettings_InitializeExtInterface(), PciAddDevice(), Phase1InitializationDiscard(), PipGetDriverTagPriority(), PNP_IsDockStationPresent(), PnpRootCreateDevice(), PopReadShutdownPolicy(), ProcessDisplayRegistry(), processQueryValue(), QUERY_REGISTRY_KEYS_ROUTINE(), QUERY_REGISTRY_VALUES_ROUTINE(), QueryByte(), QueryDWORD(), QueryDword(), ATL::CRegKey::QueryDWORDValue(), QueryRoutine(), r_verifyProxyEnable(), RChangeServiceConfigW(), RCreateServiceW(), RegDirectory::read_directory(), read_group_mappings(), read_mappings(), read_registry(), ReadRegDwordValue(), ReadRegistryEntries(), reg_add(), reg_data_to_wchar(), reg_get_value(), RegGetDWORD(), RegGetDWORDValue(), register_decoders(), register_metadatareaders(), register_pixelformats(), register_zone_domains(), RegisterDword(), registry_load_volume_options(), registry_mark_volume_mounted(), registry_mark_volume_unmounted_path(), registry_read_credential(), registry_set_formatopts(), registry_set_options(), registry_set_previewpages(), registry_write_credential(), RegpApplyRestrictions(), RegQueryDword(), RegReadDWORD(), RegSetDWORDValue(), RegWriteDWORD(), RtlSetTimeZoneInformation(), RxReadRegistryParameters(), SampIsSetupRunning(), SampSetAccountNameInDomain(), SampSetupCreateAliasAccount(), SampSetupCreateGroupAccount(), SampSetupCreateUserAccount(), TaskbarSettings::Save(), save_config(), save_mapping_settings(), save_registry_settings(), SaveBoard(), SaveDataToRegistry(), SaveDWORD(), SaveDword(), SaveSetting(), SaveSettings(), SaveShutdownSelState(), ScmCreateNewControlPipe(), ScmMarkServiceForDelete(), ScmSetLastKnownGoodControlSet(), ScsiClassQueryTimeOutRegistryValue(), SdbPackAppCompatData(), SdbQueryDataExTagID(), SepRegQueryHelper(), SetAutoDaylightInfo(), ATL::CRegKey::SetDWORDValue(), SetFindFlags(), SetInstallationCompleted(), SetPerUserSecValuesW(), SetRegUlong(), SetRosSpecificInfo(), SetSetupType(), setup_adapter(), SETUP_CreateInterfaceList(), SETUPAPI_GetCurrentHwProfile(), SetupDiChangeState(), SetupDiInstallDevice(), SetupIsActive(), SetUserWaitInterval(), setValue(), SetValueTest2(), SHAddToRecentDocs(), SHDlgProcEx(), ShowAppList(), SHRegGetBoolUSValueA(), SHRegGetBoolUSValueW(), SmpConfigureSubSystems(), SpiBuildDeviceMap(), SpiLoadDWord(), SpiParseDeviceInfo(), SpiStoreDWord(), SQLRemoveDriverW(), SQLRemoveTranslatorW(), StartShell(), store_key_permissions(), CMiniportWaveCMI::storeChannelConfigToRegistry(), StoreDriveSettings(), tapiGetLocationInfoW(), test2(), test3(), test9(), test_add(), test_appsearch_reglocator(), test_basic_import(), test_basic_import_unicode(), test_CallForAttributes(), test_child_heap(), test_comments(), test_comments_unicode(), test_DataTags(), test_debug_heap(), test_delete(), test_ExitCode(), test_export(), test_get_value(), test_import(), test_import_with_whitespace(), test_import_with_whitespace_unicode(), test_install_services(), test_Installer_InstallProduct(), test_Installer_RegistryValue(), test_internet_features_registry(), test_invalid_import(), test_invalid_import_unicode(), test_long_value_name(), test_MsiEnumPatches(), test_MsiEnumPatchesEx_machine(), test_MsiEnumPatchesEx_usermanaged(), test_MsiEnumPatchesEx_userunmanaged(), test_MsiGetComponentPath(), test_MsiGetComponentPathEx(), test_MsiGetPatchInfoEx(), test_MsiGetProductInfo(), test_MsiInstallProduct(), test_MsiQueryProductState(), test_MsiSourceListEnumMediaDisks(), test_NtQueryKey(), test_NtQueryLicenseKey(), test_NtQueryValueKey(), test_NtSetValueKey(), test_query(), test_redirection(), test_registry(), test_rw_order(), test_set_value(), test_setvalue_on_wow64(), test_SHGetShellKey(), test_symlinks(), test_unicode_import(), test_unicode_import_with_whitespace(), test_URLSubRegQueryA(), test_value_deletion(), test_value_deletion_unicode(), test_write_registry_values(), test_zone_domain_cache(), TestMyEventProvider(), TRASH_CanTrashFile(), TTIsEmbeddingEnabledForFacename(), UnloadServiceDll(), USBH_GetConfigValue(), USBH_WriteFailReasonID(), USBHI_ControllerSelectiveSuspend(), USBPORT_GetConfigValue(), USBPORT_GetDefaultBIOSx(), USBPORT_StartDevice(), UXTHEME_BackupSystemMetrics(), variant_from_registry_value(), VfdLoadLink(), VfdStoreLink(), ViewDlg_Apply(), ViewDlg_RestoreDefaults(), WhichPlatform(), WintrustSetRegPolicyFlags(), wnet_use_connection(), write_registry_values(), WriteGlobalData(), WriteKeysSettings(), WritePortSettings(), WriteRegistry(), WriteStartupRecoveryOptions(), WshShell3_RegRead(), WshShell3_RegWrite(), WsNcEntryInitializeFromRegistry(), WsNcOpen(), WsNcRefreshFromRegistry(), WsSetupCatalogProtection(), WsTcOpen(), WsTcRefreshFromRegistry(), ZoneMgrImpl_SetZoneAttributes(), and CCMITopology::~CCMITopology().

◆ REG_QWORD

◆ REG_SZ

#define REG_SZ   1

Definition at line 538 of file sdbapi.c.

Referenced by SdbQueryDataExTagID().

Function Documentation

◆ SdbCloseDatabase()

void WINAPI SdbCloseDatabase ( PDB  pdb)

Closes specified database and frees its memory.

Parameters
[in]pdbHandle to the shim database.

Definition at line 358 of file sdbapi.c.

Referenced by SdbCloseDatabase(), SdbGetDatabaseVersion(), SdbOpenDatabase(), SdbpCreate(), and SdbpOpenDatabase().

359 {
360  if (!pdb)
361  return;
362 
363  if (pdb->file)
364  NtClose(pdb->file);
365  if (pdb->string_buffer)
367  if (pdb->string_lookup)
369  SdbFree(pdb->data);
370  SdbFree(pdb);
371 }
HANDLE file
Definition: sdbtypes.h:25
struct _DB * string_buffer
Definition: sdbtypes.h:33
void SdbpTableDestroy(struct SdbStringHashTable **pTable)
#define SdbFree(mem)
Definition: sdbpapi.h:37
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3393
struct SdbStringHashTable * string_lookup
Definition: sdbtypes.h:32
BYTE * data
Definition: sdbtypes.h:27
void WINAPI SdbCloseDatabase(PDB pdb)
Definition: sdbapi.c:358

◆ SdbFindFirstNamedTag()

TAGID WINAPI SdbFindFirstNamedTag ( PDB  pdb,
TAGID  root,
TAGID  find,
TAGID  nametag,
LPCWSTR  find_name 
)

Find the first named child tag.

Parameters
[in]pdbThe database.
[in]rootThe tag to start at
[in]findThe tag type to find
[in]nametagThe child of 'find' that contains the name
[in]find_nameThe name to find
Returns
The found tag, or TAGID_NULL on failure

Definition at line 487 of file sdbapi.c.

Referenced by SdbGetLayerTagRef(), SdbpAddNamedLayerMatch(), and SdbQueryDataExTagID().

488 {
489  TAGID iter;
490 
491  iter = SdbFindFirstTag(pdb, root, find);
492 
493  while (iter != TAGID_NULL)
494  {
495  TAGID tmp = SdbFindFirstTag(pdb, iter, nametag);
496  if (tmp != TAGID_NULL)
497  {
498  LPCWSTR name = SdbGetStringTagPtr(pdb, tmp);
499  if (name && !wcsicmp(name, find_name))
500  return iter;
501  }
502  iter = SdbFindNextTag(pdb, root, iter);
503  }
504  return TAGID_NULL;
505 }
LPWSTR WINAPI SdbGetStringTagPtr(PDB pdb, TAGID tagid)
Definition: sdbread.c:375
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
static TAGID TAGID TAGID nametag
Definition: db.cpp:143
TAGID WINAPI SdbFindNextTag(PDB pdb, TAGID parent, TAGID prev_child)
Definition: sdbread.c:231
static TAGID TAGID TAGID LPCWSTR find_name
Definition: db.cpp:143
TAGID WINAPI SdbFindFirstTag(PDB pdb, TAGID parent, TAG tag)
Definition: sdbread.c:208
#define wcsicmp
Definition: string.h:1152
static TAGID TAGID find
Definition: db.cpp:143
Definition: name.c:36
#define TAGID_NULL
Definition: sdbtagid.h:13
DWORD TAGID
Definition: sdbtypes.h:17

◆ SdbGetDatabaseVersion()

BOOL WINAPI SdbGetDatabaseVersion ( LPCWSTR  database,
PDWORD  VersionHi,
PDWORD  VersionLo 
)

Read the database version from the specified database.

Parameters
[in]databaseThe database.
[out]VersionHiThe first part of the version number.
[out]VersionLoThe second part of the version number.
Returns
TRUE if it succeeds or fails, FALSE if ???

Definition at line 464 of file sdbapi.c.

465 {
466  PDB pdb;
467 
468  pdb = SdbpOpenDatabase(database, DOS_PATH, VersionHi, VersionLo);
469  if (pdb)
470  SdbCloseDatabase(pdb);
471 
472  return TRUE;
473 }
#define TRUE
Definition: types.h:120
static PDB pdb
Definition: db.cpp:160
Definition: sdbtypes.h:24
PDB SdbpOpenDatabase(LPCWSTR path, PATH_TYPE type, PDWORD major, PDWORD minor)
Definition: sdbapi.c:269
void WINAPI SdbCloseDatabase(PDB pdb)
Definition: sdbapi.c:358

◆ SdbGetLayerTagRef()

TAGREF WINAPI SdbGetLayerTagRef ( HSDB  hsdb,
LPCWSTR  layerName 
)

Find a named layer in a multi-db.

Parameters
[in]hsdbThe multi-database.
[in]layerNameThe named tag to find.
Returns
The layer, or TAGREF_NULL on failure

Definition at line 516 of file sdbapi.c.

517 {
518  PDB pdb = hsdb->pdb;
519 
520  TAGID database = SdbFindFirstTag(pdb, TAGID_ROOT, TAG_DATABASE);
521  if (database != TAGID_NULL)
522  {
524  if (layer != TAGID_NULL)
525  {
526  TAGREF tr;
527  if (SdbTagIDToTagRef(hsdb, pdb, layer, &tr))
528  {
529  return tr;
530  }
531  }
532  }
533  return TAGREF_NULL;
534 }
#define TAG_NAME
Definition: sdbtagid.h:126
static LPCWSTR layerName
Definition: db.cpp:161
static PDB pdb
Definition: db.cpp:160
Definition: sdbtypes.h:24
#define TAG_DATABASE
Definition: sdbtagid.h:160
#define TAGREF_NULL
Definition: sdbtypes.h:21
#define TAGID_ROOT
Definition: sdbtagid.h:14
GLenum GLuint GLint GLint layer
Definition: glext.h:7007
DWORD TAGREF
Definition: sdbtypes.h:18
#define TAG_LAYER
Definition: sdbtagid.h:170
TAGID WINAPI SdbFindFirstTag(PDB pdb, TAGID parent, TAG tag)
Definition: sdbread.c:208
BOOL WINAPI SdbTagIDToTagRef(HSDB hsdb, PDB pdb, TAGID tiWhich, TAGREF *ptrWhich)
Definition: hsdb.c:666
TAGID WINAPI SdbFindFirstNamedTag(PDB pdb, TAGID root, TAGID find, TAGID nametag, LPCWSTR find_name)
Definition: sdbapi.c:487
PDB pdb
Definition: apphelp.h:28
#define TAGID_NULL
Definition: sdbtagid.h:13
DWORD TAGID
Definition: sdbtypes.h:17

◆ SdbGetStandardDatabaseGUID()

BOOL WINAPI SdbGetStandardDatabaseGUID ( DWORD  Flags,
GUID Guid 
)

Get the GUID from one of the standard databases.

Parameters
[in]FlagsThe ID to retrieve the guid from. (See SDB_DATABASE_MAIN_[xxx])
[out]GuidThe resulting GUID.
Returns
TRUE if a known database ID.

Definition at line 430 of file sdbapi.c.

Referenced by START_TEST().

431 {
432  const GUID* copy_from = NULL;
433  switch(Flags & HID_DATABASE_TYPE_MASK)
434  {
436  copy_from = &GUID_DATABASE_MSI;
437  break;
439  copy_from = &GUID_DATABASE_SHIM;
440  break;
442  copy_from = &GUID_DATABASE_DRIVERS;
443  break;
444  default:
445  SHIM_ERR("Cannot obtain database guid for databases other than main\n");
446  return FALSE;
447  }
448  if(Guid)
449  {
450  memcpy(Guid, copy_from, sizeof(GUID));
451  }
452  return TRUE;
453 }
#define TRUE
Definition: types.h:120
static const GUID GUID_DATABASE_SHIM
Definition: sdbapi.c:17
static const GUID GUID_DATABASE_DRIVERS
Definition: sdbapi.c:18
#define SDB_DATABASE_MAIN_SHIM
Definition: apphelp.h:24
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define SDB_DATABASE_MAIN_MSI
Definition: apphelp.h:23
smooth NULL
Definition: ftsmooth.c:416
#define SDB_DATABASE_MAIN_DRIVERS
Definition: apphelp.h:25
static const GUID GUID_DATABASE_MSI
Definition: sdbapi.c:16
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define HID_DATABASE_TYPE_MASK
Definition: apphelp.h:22

◆ SdbGUIDFromString()

BOOL WINAPI SdbGUIDFromString ( PCWSTR  GuidString,
GUID Guid 
)

Parses a string to retrieve a GUID.

Parameters
[in]GuidStringThe string to parse.
[out]GuidThe resulting GUID.
Returns
TRUE if it succeeds, FALSE if it fails.

Definition at line 381 of file sdbapi.c.

382 {
383  UNICODE_STRING GuidString_u;
384  RtlInitUnicodeString(&GuidString_u, GuidString);
385  return NT_SUCCESS(RtlGUIDFromString(&GuidString_u, Guid));
386 }
static PWSTR GuidString
Definition: apphelp.c:91
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
NTSYSAPI NTSTATUS WINAPI RtlGUIDFromString(PUNICODE_STRING, GUID *)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)

◆ SdbGUIDToString()

BOOL WINAPI SdbGUIDToString ( CONST GUID Guid,
PWSTR  GuidString,
SIZE_T  Length 
)

Converts a GUID to a string.

Parameters
[in]GuidThe GUID to convert.
[out]GuidStringThe resulting string representation of Guid.
[in]LengthThe length of GuidString.
Returns
TRUE if it succeeds, FALSE if it fails.

Definition at line 397 of file sdbapi.c.

Referenced by ApphelpCheckShellObject(), and START_TEST().

398 {
399  UNICODE_STRING GuidString_u;
400  if(NT_SUCCESS(RtlStringFromGUID(Guid, &GuidString_u)))
401  {
402  HRESULT hr = StringCchCopyNW(GuidString, Length, GuidString_u.Buffer, GuidString_u.Length / 2);
403  RtlFreeUnicodeString(&GuidString_u);
404  return SUCCEEDED(hr);
405  }
406  return FALSE;
407 }
static PWSTR GuidString
Definition: apphelp.c:91
STRSAFEAPI StringCchCopyNW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc, size_t cchToCopy)
Definition: strsafe.h:236
static GUID * Guid
Definition: apphelp.c:93
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
LONG HRESULT
Definition: typedefs.h:77
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
NTSYSAPI NTSTATUS WINAPI RtlStringFromGUID(REFGUID, PUNICODE_STRING)
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ SdbIsNullGUID()

BOOL WINAPI SdbIsNullGUID ( CONST GUID Guid)

Checks if the specified GUID is a NULL GUID

Parameters
[in]GuidThe GUID to check.
Returns
TRUE if it is a NULL GUID.

Definition at line 416 of file sdbapi.c.

Referenced by SdbGetDatabaseID(), and START_TEST().

417 {
418  static GUID NullGuid = { 0 };
419  return !Guid || IsEqualGUID(&NullGuid, Guid);
420 }
static GUID * Guid
Definition: apphelp.c:93
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4024

◆ SdbMakeIndexKeyFromString()

LONGLONG WINAPI SdbMakeIndexKeyFromString ( LPCWSTR  str)

Converts the specified string to an index key.

Parameters
[in]strThe string which will be converted.
Returns
The resulting index key
Todo:
: Fix this for unicode strings.

Definition at line 656 of file sdbapi.c.

657 {
658  LONGLONG result = 0;
659  int shift = 56;
660 
661  while (*str && shift >= 0)
662  {
663  WCHAR c = toupper(*(str++));
664 
665  if (c & 0xff)
666  {
667  result |= (((LONGLONG)(c & 0xff)) << shift);
668  shift -= 8;
669  }
670 
671  if (shift < 0)
672  break;
673 
674  c >>= 8;
675 
676  if (c & 0xff)
677  {
678  result |= (((LONGLONG)(c & 0xff)) << shift);
679  shift -= 8;
680  }
681  }
682 
683  return result;
684 }
#define shift
Definition: input.c:1668
__wchar_t WCHAR
Definition: xmlstorage.h:180
const WCHAR * str
int64_t LONGLONG
Definition: typedefs.h:66
int toupper(int c)
Definition: utclib.c:881
const GLubyte * c
Definition: glext.h:8905
GLuint64EXT * result
Definition: glext.h:11304

◆ SdbOpenDatabase()

PDB WINAPI SdbOpenDatabase ( LPCWSTR  path,
PATH_TYPE  type 
)

Opens specified shim database file.

Parameters
[in]pathPath to the shim database.
[in]typeType of path. Either DOS_PATH or NT_PATH.
Returns
Success: Handle to the shim database, NULL otherwise.

Definition at line 329 of file sdbapi.c.

Referenced by CLayerStringList::CLayerStringList(), and SdbInitDatabase().

330 {
331  PDB pdb;
332  DWORD major, minor;
333 
334  pdb = SdbpOpenDatabase(path, type, &major, &minor);
335  if (!pdb)
336  return NULL;
337 
338  if (major != 2 && major != 3)
339  {
340  SdbCloseDatabase(pdb);
341  SHIM_ERR("Invalid shim database version\n");
342  return NULL;
343  }
344 
346  if(!SdbGetDatabaseID(pdb, &pdb->database_id))
347  {
348  SHIM_INFO("Failed to get the database id\n");
349  }
350  return pdb;
351 }
TAGID stringtable
Definition: sdbtypes.h:28
static PDB pdb
Definition: db.cpp:160
#define TAG_STRINGTABLE
Definition: sdbtagid.h:186
Definition: sdbtypes.h:24
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GUID database_id
Definition: sdbtypes.h:30
#define TAGID_ROOT
Definition: sdbtagid.h:14
smooth NULL
Definition: ftsmooth.c:416
PDB SdbpOpenDatabase(LPCWSTR path, PATH_TYPE type, PDWORD major, PDWORD minor)
Definition: sdbapi.c:269
BOOL WINAPI SdbGetDatabaseID(PDB pdb, GUID *Guid)
Definition: sdbread.c:388
unsigned long DWORD
Definition: ntddk_ex.h:95
TAGID WINAPI SdbFindFirstTag(PDB pdb, TAGID parent, TAG tag)
Definition: sdbread.c:208
#define major(rdev)
Definition: propsheet.cpp:818
Definition: services.c:325
void WINAPI SdbCloseDatabase(PDB pdb)
Definition: sdbapi.c:358
#define minor(rdev)
Definition: propsheet.cpp:819

◆ SdbpAlloc()

LPVOID SdbpAlloc ( SIZE_T  size)

Definition at line 55 of file sdbapi.c.

Referenced by SeiInitPaths().

60 {
62 #if SDBAPI_DEBUG_ALLOC
63  SdbpInsertAllocation(mem, size, line, file);
64 #endif
65  return mem;
66 }
Definition: parser.c:48
static HANDLE SdbpHeap(void)
Definition: sdbapi.c:50
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:585
GLsizeiptr size
Definition: glext.h:5919
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
Definition: mem.c:156
Definition: fci.c:126

◆ SdbpCheckTagIDType()

BOOL WINAPI SdbpCheckTagIDType ( PDB  pdb,
TAGID  tagid,
WORD  type 
)

Definition at line 261 of file sdbapi.c.

Referenced by SdbEndWriteListTag(), SdbGetBinaryTagData(), SdbReadBinaryTag(), SdbReadDWORDTag(), SdbReadQWORDTag(), and SdbReadWORDTag().

262 {
263  TAG tag = SdbGetTagFromTagID(pdb, tagid);
264  if (tag == TAG_NULL)
265  return FALSE;
266  return SdbpCheckTagType(tag, type);
267 }
BOOL WINAPI SdbpCheckTagType(TAG tag, WORD type)
Definition: sdbapi.c:254
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
Definition: ecma_167.h:138
#define TAG_NULL
Definition: sdbtagid.h:35
WORD TAG
Definition: sdbtypes.h:16
TAG WINAPI SdbGetTagFromTagID(PDB pdb, TAGID tagid)
Definition: sdbread.c:93

◆ SdbpCheckTagType()

BOOL WINAPI SdbpCheckTagType ( TAG  tag,
WORD  type 
)

Definition at line 254 of file sdbapi.c.

Referenced by SdbBeginWriteListTag(), SdbpCheckTagIDType(), SdbWriteBinaryTag(), SdbWriteBinaryTagFromFile(), SdbWriteDWORDTag(), SdbWriteNULLTag(), SdbWriteQWORDTag(), SdbWriteStringRefTag(), SdbWriteStringTag(), and SdbWriteWORDTag().

255 {
256  if ((tag & TAG_TYPE_MASK) != type)
257  return FALSE;
258  return TRUE;
259 }
#define TRUE
Definition: types.h:120
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
Definition: ecma_167.h:138
#define TAG_TYPE_MASK
Definition: sdbtagid.h:23

◆ SdbpCloseMemMappedFile()

void WINAPI SdbpCloseMemMappedFile ( PMEMMAPPED  mapping)

Definition at line 244 of file sdbapi.c.

Referenced by SdbGetFileAttributes(), and SdbWriteBinaryTagFromFile().

245 {
246  /* Prevent a VAD warning */
247  if (mapping->view)
249  NtClose(mapping->section);
250  NtClose(mapping->file);
251  RtlZeroMemory(mapping, sizeof(*mapping));
252 }
NTSTATUS NTAPI NtUnmapViewOfSection(IN HANDLE ProcessHandle, IN PVOID BaseAddress)
Definition: section.c:3781
PBYTE view
Definition: sdbpapi.h:45
#define NtCurrentProcess()
Definition: nt_native.h:1657
HANDLE section
Definition: sdbpapi.h:44
HANDLE file
Definition: sdbpapi.h:43
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3393
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261

◆ SdbpCreate()

PDB WINAPI SdbpCreate ( LPCWSTR  path,
PATH_TYPE  type,
BOOL  write 
)

Definition at line 93 of file sdbapi.c.

Referenced by SdbCreateDatabase(), and SdbpOpenDatabase().

94 {
99  PDB pdb;
100 
101  if (type == DOS_PATH)
102  {
104  return NULL;
105  }
106  else
107  {
108  RtlInitUnicodeString(&str, path);
109  }
110 
111  /* SdbAlloc zeroes the memory. */
112  pdb = (PDB)SdbAlloc(sizeof(DB));
113  if (!pdb)
114  {
115  SHIM_ERR("Failed to allocate memory for shim database\n");
116  return NULL;
117  }
118 
120 
124 
125  pdb->for_write = write;
126 
127  if (type == DOS_PATH)
128  RtlFreeUnicodeString(&str);
129 
130  if (!NT_SUCCESS(Status))
131  {
132  SdbCloseDatabase(pdb);
133  SHIM_ERR("Failed to create shim database file: %lx\n", Status);
134  return NULL;
135  }
136 
137  return pdb;
138 }
#define FILE_GENERIC_READ
Definition: nt_native.h:653
HANDLE file
Definition: sdbtypes.h:25
static PDB pdb
Definition: db.cpp:160
Definition: sdbtypes.h:24
LONG NTSTATUS
Definition: precomp.h:26
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
BOOL for_write
Definition: sdbtypes.h:31
#define FILE_SHARE_READ
Definition: compat.h:125
#define write
Definition: acwin.h:73
#define SdbAlloc(size)
Definition: sdbpapi.h:35
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
NTSTATUS NTAPI NtCreateFile(OUT PHANDLE FileHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK IoStatusBlock, IN PLARGE_INTEGER AllocationSize OPTIONAL, IN ULONG FileAttributes, IN ULONG ShareAccess, IN ULONG CreateDisposition, IN ULONG CreateOptions, IN PVOID EaBuffer OPTIONAL, IN ULONG EaLength)
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
__u8 attr
Definition: mkdosfs.c:359
#define FILE_NON_DIRECTORY_FILE
Definition: constants.h:492
#define SYNCHRONIZE
Definition: nt_native.h:61
Status
Definition: gdiplustypes.h:24
#define FILE_GENERIC_WRITE
Definition: nt_native.h:660
#define FILE_OPEN
Definition: from_kernel.h:54
Definition: services.c:325
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
void WINAPI SdbCloseDatabase(PDB pdb)
Definition: sdbapi.c:358
#define FILE_SUPERSEDE
Definition: from_kernel.h:53
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
struct _DB * PDB
static HANDLE PIO_APC_ROUTINE PVOID PIO_STATUS_BLOCK io
Definition: file.c:100
NTSYSAPI BOOLEAN NTAPI RtlDosPathNameToNtPathName_U(_In_opt_z_ PCWSTR DosPathName, _Out_ PUNICODE_STRING NtPathName, _Out_opt_ PCWSTR *NtFileNamePart, _Out_opt_ PRTL_RELATIVE_NAME_U DirectoryInfo)

◆ SdbpFlush()

void WINAPI SdbpFlush ( PDB  pdb)

Definition at line 140 of file sdbapi.c.

Referenced by SdbCloseDatabaseWrite().

141 {
144 
145  ASSERT(pdb->for_write);
146  Status = NtWriteFile(pdb->file, NULL, NULL, NULL, &io,
147  pdb->data, pdb->write_iter, NULL, NULL);
148  if( !NT_SUCCESS(Status))
149  SHIM_WARN("failed with 0x%lx\n", Status);
150 }
HANDLE file
Definition: sdbtypes.h:25
LONG NTSTATUS
Definition: precomp.h:26
BOOL for_write
Definition: sdbtypes.h:31
smooth NULL
Definition: ftsmooth.c:416
DWORD write_iter
Definition: sdbtypes.h:29
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
NTSYSAPI NTSTATUS NTAPI NtWriteFile(IN HANDLE hFile, IN HANDLE hEvent OPTIONAL, IN PIO_APC_ROUTINE IoApcRoutine OPTIONAL, IN PVOID IoApcContext OPTIONAL, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN PVOID WriteBuffer, IN ULONG WriteBufferLength, IN PLARGE_INTEGER FileOffset OPTIONAL, IN PULONG LockOperationKey OPTIONAL)
Status
Definition: gdiplustypes.h:24
BYTE * data
Definition: sdbtypes.h:27
static HANDLE PIO_APC_ROUTINE PVOID PIO_STATUS_BLOCK io
Definition: file.c:100

◆ SdbpFree()

void SdbpFree ( LPVOID  mem)

Definition at line 81 of file sdbapi.c.

86 {
87 #if SDBAPI_DEBUG_ALLOC
88  SdbpRemoveAllocation(mem, line, file);
89 #endif
90  RtlFreeHeap(SdbpHeap(), 0, mem);
91 }
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:603
Definition: parser.c:48
static HANDLE SdbpHeap(void)
Definition: sdbapi.c:50
Definition: fci.c:126

◆ SdbpHeap()

static HANDLE SdbpHeap ( void  )
static

Definition at line 50 of file sdbapi.c.

Referenced by SdbpAlloc(), SdbpFree(), and SdbpReAlloc().

51 {
52  return g_Heap;
53 }
static HANDLE g_Heap
Definition: sdbapi.c:33

◆ SdbpHeapDeinit()

void SdbpHeapDeinit ( void  )

Definition at line 42 of file sdbapi.c.

Referenced by DllMain().

43 {
44 #if SDBAPI_DEBUG_ALLOC
45  SdbpDebugHeapDeinit();
46 #endif
48 }
NTSYSAPI PVOID NTAPI RtlDestroyHeap(IN PVOID HeapHandle)
static HANDLE g_Heap
Definition: sdbapi.c:33

◆ SdbpHeapInit()

void SdbpHeapInit ( void  )

Definition at line 34 of file sdbapi.c.

Referenced by DllMain().

35 {
36  g_Heap = RtlCreateHeap(HEAP_GROWABLE, NULL, 0, 0x10000, NULL, NULL);
37 #if SDBAPI_DEBUG_ALLOC
38  SdbpDebugHeapInit(g_Heap);
39 #endif
40 }
smooth NULL
Definition: ftsmooth.c:416
#define HEAP_GROWABLE
Definition: nt_native.h:1693
NTSYSAPI PVOID NTAPI RtlCreateHeap(IN ULONG Flags, IN PVOID HeapBase OPTIONAL, IN ULONG ReserveSize OPTIONAL, IN ULONG CommitSize OPTIONAL, IN PVOID Lock OPTIONAL, IN PRTL_HEAP_PARAMETERS Parameters OPTIONAL)
static HANDLE g_Heap
Definition: sdbapi.c:33

◆ SdbpOpenDatabase()

PDB SdbpOpenDatabase ( LPCWSTR  path,
PATH_TYPE  type,
PDWORD  major,
PDWORD  minor 
)

Definition at line 269 of file sdbapi.c.

Referenced by SdbGetDatabaseVersion(), and SdbOpenDatabase().

270 {
273  PDB pdb;
275  BYTE header[12];
276 
277  pdb = SdbpCreate(path, type, FALSE);
278  if (!pdb)
279  return NULL;
280 
282  if (!NT_SUCCESS(Status))
283  {
284  SdbCloseDatabase(pdb);
285  SHIM_ERR("Failed to get shim database size: 0x%lx\n", Status);
286  return NULL;
287  }
288 
289  pdb->size = fsi.EndOfFile.u.LowPart;
290  pdb->data = SdbAlloc(pdb->size);
291  Status = NtReadFile(pdb->file, NULL, NULL, NULL, &io, pdb->data, pdb->size, NULL, NULL);
292 
293  if (!NT_SUCCESS(Status))
294  {
295  SdbCloseDatabase(pdb);
296  SHIM_ERR("Failed to open shim database file: 0x%lx\n", Status);
297  return NULL;
298  }
299 
300  if (!SdbpReadData(pdb, &header, 0, 12))
301  {
302  SdbCloseDatabase(pdb);
303  SHIM_ERR("Failed to read shim database header\n");
304  return NULL;
305  }
306 
307  if (memcmp(&header[8], "sdbf", 4) != 0)
308  {
309  SdbCloseDatabase(pdb);
310  SHIM_ERR("Shim database header is invalid\n");
311  return NULL;
312  }
313 
314  *major = *(DWORD*)&header[0];
315  *minor = *(DWORD*)&header[4];
316 
317  return pdb;
318 }
HANDLE file
Definition: sdbtypes.h:25
struct _LARGE_INTEGER::@2193 u
static PDB pdb
Definition: db.cpp:160
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
Definition: sdbtypes.h:24
LONG NTSTATUS
Definition: precomp.h:26
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
BOOL WINAPI SdbpReadData(PDB pdb, PVOID dest, DWORD offset, DWORD num)
Definition: sdbread.c:14
#define SdbAlloc(size)
Definition: sdbpapi.h:35
smooth NULL
Definition: ftsmooth.c:416
LARGE_INTEGER EndOfFile
Definition: nt_native.h:948
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
unsigned long DWORD
Definition: ntddk_ex.h:95
NTSTATUS NTAPI NtQueryInformationFile(HANDLE hFile, PIO_STATUS_BLOCK io, PVOID ptr, ULONG len, FILE_INFORMATION_CLASS FileInformationClass)
unsigned char BYTE
Definition: ntddk_ex.h:96
Status
Definition: gdiplustypes.h:24
PDB WINAPI SdbpCreate(LPCWSTR path, PATH_TYPE type, BOOL write)
Definition: sdbapi.c:93
BYTE * data
Definition: sdbtypes.h:27
#define major(rdev)
Definition: propsheet.cpp:818
Definition: services.c:325
DWORD size
Definition: sdbtypes.h:26
void WINAPI SdbCloseDatabase(PDB pdb)
Definition: sdbapi.c:358
#define minor(rdev)
Definition: propsheet.cpp:819
static HANDLE PIO_APC_ROUTINE PVOID PIO_STATUS_BLOCK io
Definition: file.c:100
struct CFHEADER header
Definition: fdi.c:109
NTSTATUS NTAPI NtReadFile(HANDLE FileHandle, HANDLE Event, PIO_APC_ROUTINE ApcRoutine, PVOID ApcContext, PIO_STATUS_BLOCK IoStatusBlock, PVOID Buffer, ULONG Length, PLARGE_INTEGER ByteOffset, PULONG Key)

◆ SdbpOpenMemMappedFile()

BOOL WINAPI SdbpOpenMemMappedFile ( LPCWSTR  path,
PMEMMAPPED  mapping 
)

Definition at line 170 of file sdbapi.c.

Referenced by SdbGetFileAttributes(), and SdbWriteBinaryTagFromFile().

171 {
175  FILE_STANDARD_INFORMATION FileStandard;
177 
178  RtlZeroMemory(mapping, sizeof(*mapping));
179 
180  RtlInitUnicodeString(&FileName, path);
181 
182  InitializeObjectAttributes(&ObjectAttributes, &FileName, OBJ_CASE_INSENSITIVE, NULL, NULL);
183  Status = NtOpenFile(&mapping->file, GENERIC_READ | SYNCHRONIZE, &ObjectAttributes, &IoStatusBlock, FILE_SHARE_READ, FILE_SYNCHRONOUS_IO_NONALERT);
184 
186  {
187  if (!RtlDosPathNameToNtPathName_U(path, &FileName, NULL, NULL))
188  {
189  SHIM_ERR("Failed to convert %S to Nt path: 0x%lx\n", path, Status);
190  return FALSE;
191  }
192  InitializeObjectAttributes(&ObjectAttributes, &FileName, OBJ_CASE_INSENSITIVE, NULL, NULL);
193  Status = NtOpenFile(&mapping->file, GENERIC_READ | SYNCHRONIZE, &ObjectAttributes, &IoStatusBlock, FILE_SHARE_READ, FILE_SYNCHRONOUS_IO_NONALERT);
194  RtlFreeUnicodeString(&FileName);
195  }
196 
197  if (!NT_SUCCESS(Status))
198  {
199  SHIM_ERR("Failed to open file %S: 0x%lx\n", path, Status);
200  return FALSE;
201  }
202 
204  if (!NT_SUCCESS(Status))
205  {
206  /* Special case */
207  if (Status == STATUS_MAPPED_FILE_SIZE_ZERO)
208  {
209  NtClose(mapping->file);
210  mapping->file = mapping->section = NULL;
211  return TRUE;
212  }
213  SHIM_ERR("Failed to create mapping for file: 0x%lx\n", Status);
214  goto err_out;
215  }
216 
217  Status = NtQueryInformationFile(mapping->file, &IoStatusBlock, &FileStandard, sizeof(FileStandard), FileStandardInformation);
218  if (!NT_SUCCESS(Status))
219  {
220  SHIM_ERR("Failed to read file info for file: 0x%lx\n", Status);
221  goto err_out;
222  }
223 
224  mapping->mapped_size = mapping->size = FileStandard.EndOfFile.LowPart;
225  Status = NtMapViewOfSection(mapping->section, NtCurrentProcess(), (PVOID*)&mapping->view, 0, 0, 0, &mapping->mapped_size, ViewUnmap, 0, PAGE_READONLY);
226  if (!NT_SUCCESS(Status))
227  {
228  SHIM_ERR("Failed to map view of file: 0x%lx\n", Status);
229  goto err_out;
230  }
231 
232  return TRUE;
233 
234 err_out:
235  if (!mapping->view)
236  {
237  if (mapping->section)
238  NtClose(mapping->section);
239  NtClose(mapping->file);
240  }
241  return FALSE;
242 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
#define TRUE
Definition: types.h:120
NTSTATUS NTAPI NtCreateSection(OUT PHANDLE SectionHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN PLARGE_INTEGER MaximumSize OPTIONAL, IN ULONG SectionPageProtection OPTIONAL, IN ULONG AllocationAttributes, IN HANDLE FileHandle OPTIONAL)
Definition: section.c:3372
#define SECTION_QUERY
Definition: nt_native.h:1287
LONG NTSTATUS
Definition: precomp.h:26
PBYTE view
Definition: sdbpapi.h:45
#define FILE_SHARE_READ
Definition: compat.h:125
#define SEC_COMMIT
Definition: mmtypes.h:99
NTSTATUS NTAPI NtMapViewOfSection(IN HANDLE SectionHandle, IN HANDLE ProcessHandle, IN OUT PVOID *BaseAddress, IN ULONG_PTR ZeroBits, IN SIZE_T CommitSize, IN OUT PLARGE_INTEGER SectionOffset OPTIONAL, IN OUT PSIZE_T ViewSize, IN SECTION_INHERIT InheritDisposition, IN ULONG AllocationType, IN ULONG Protect)
Definition: section.c:3553
smooth NULL
Definition: ftsmooth.c:416
LARGE_INTEGER EndOfFile
Definition: nt_native.h:948
#define NtCurrentProcess()
Definition: nt_native.h:1657
HANDLE section
Definition: sdbpapi.h:44
NTSYSAPI NTSTATUS NTAPI NtOpenFile(OUT PHANDLE phFile, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG ShareMode, IN ULONG OpenMode)
Definition: file.c:3929
HANDLE file
Definition: sdbpapi.h:43
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3393
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define SECTION_MAP_READ
Definition: compat.h:128
ULONG LowPart
Definition: typedefs.h:104
#define GENERIC_READ
Definition: compat.h:124
NTSTATUS NTAPI NtQueryInformationFile(HANDLE hFile, PIO_STATUS_BLOCK io, PVOID ptr, ULONG len, FILE_INFORMATION_CLASS FileInformationClass)
#define SYNCHRONIZE
Definition: nt_native.h:61
Status
Definition: gdiplustypes.h:24
struct _FileName FileName
Definition: fatprocs.h:884
Definition: services.c:325
#define STATUS_OBJECT_NAME_INVALID
Definition: udferr_usr.h:148
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
#define PAGE_READONLY
Definition: compat.h:127
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
#define STANDARD_RIGHTS_REQUIRED
Definition: nt_native.h:63
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define STATUS_MAPPED_FILE_SIZE_ZERO
Definition: ntstatus.h:508
#define STATUS_OBJECT_PATH_SYNTAX_BAD
Definition: ntstatus.h:281
SIZE_T mapped_size
Definition: sdbpapi.h:47
SIZE_T size
Definition: sdbpapi.h:46
NTSYSAPI BOOLEAN NTAPI RtlDosPathNameToNtPathName_U(_In_opt_z_ PCWSTR DosPathName, _Out_ PUNICODE_STRING NtPathName, _Out_opt_ PCWSTR *NtFileNamePart, _Out_opt_ PRTL_RELATIVE_NAME_U DirectoryInfo)

◆ SdbpReAlloc()

LPVOID SdbpReAlloc ( LPVOID  mem,
SIZE_T  size,
SIZE_T  oldSize 
)

Definition at line 68 of file sdbapi.c.

73 {
75 #if SDBAPI_DEBUG_ALLOC
76  SdbpUpdateAllocation(mem, newmem, size, line, file);
77 #endif
78  return newmem;
79 }
NTSYSAPI PVOID WINAPI RtlReAllocateHeap(HANDLE, ULONG, PVOID, SIZE_T)
Definition: heap.c:2552
Definition: parser.c:48
static HANDLE SdbpHeap(void)
Definition: sdbapi.c:50
GLsizeiptr size
Definition: glext.h:5919
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
Definition: fci.c:126

◆ SdbpStrDup()

PWSTR SdbpStrDup ( LPCWSTR  string)

Definition at line 162 of file sdbapi.c.

Referenced by SdbpSetStringAttr(), SeiAppendHookInfo(), SeiAppendInExclude(), and SeiInitPaths().

163 {
164  PWSTR ret = SdbAlloc(SdbpStrsize(string));
165  wcscpy(ret, string);
166  return ret;
167 }
uint16_t * PWSTR
Definition: typedefs.h:54
#define SdbAlloc(size)
Definition: sdbpapi.h:35
DWORD SdbpStrsize(PCWSTR string)
Definition: sdbapi.c:157
int ret
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)

◆ SdbpStrlen()

DWORD SdbpStrlen ( PCWSTR  string)

Definition at line 152 of file sdbapi.c.

Referenced by HashAddString(), SdbGetAppPatchDir(), SdbpBuildSignMediaId(), SdbpStrsize(), and Sdbwcscpy().

153 {
154  return wcslen(string);
155 }
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)

◆ SdbpStrsize()

DWORD SdbpStrsize ( PCWSTR  string)

Definition at line 157 of file sdbapi.c.

Referenced by SdbpStrDup().

158 {
159  return (SdbpStrlen(string) + 1) * sizeof(WCHAR);
160 }
#define WCHAR
Definition: msvc.h:43
DWORD SdbpStrlen(PCWSTR string)
Definition: sdbapi.c:152

◆ SdbQueryDataExTagID()

DWORD WINAPI SdbQueryDataExTagID ( PDB  pdb,
TAGID  tiExe,
LPCWSTR  lpszDataName,
LPDWORD  lpdwDataType,
LPVOID  lpBuffer,
LPDWORD  lpcbBufferSize,
TAGID ptiData 
)

Retrieve a Data entry

Parameters
[in]pdbThe database.
[in]tiExeThe tagID to start at
[in,opt]lpszDataName The name of the Data entry to find, or NULL to return all.
[out,opt]lpdwDataType Any of REG_SZ, REG_QWORD, REG_DWORD, ...
[out]lpBufferThe output buffer
[in,out,opt]lpcbBufferSize The size of lpBuffer in bytes
[out,opt]ptiData The tagID of the data
Returns
ERROR_SUCCESS

Definition at line 557 of file sdbapi.c.

Referenced by SdbQueryDataEx().

558 {
559  TAGID tiData, tiValueType, tiValue;
560  DWORD dwDataType, dwSizeRequired, dwInputSize;
561  LPCWSTR lpStringData;
562  /* Not supported yet */
563  if (!lpszDataName)
565 
567  if (tiData == TAGID_NULL)
568  {
569  SHIM_INFO("No data tag found\n");
570  return ERROR_NOT_FOUND;
571  }
572 
573  if (ptiData)
574  *ptiData = tiData;
575 
576  tiValueType = SdbFindFirstTag(pdb, tiData, TAG_DATA_VALUETYPE);
577  if (tiValueType == TAGID_NULL)
578  {
579  SHIM_WARN("Data tag (0x%x) without valuetype\n", tiData);
581  }
582 
583  dwDataType = SdbReadDWORDTag(pdb, tiValueType, 0);
584  switch (dwDataType)
585  {
586  case REG_SZ:
587  tiValue = SdbFindFirstTag(pdb, tiData, TAG_DATA_STRING);
588  break;
589  case REG_DWORD:
590  tiValue = SdbFindFirstTag(pdb, tiData, TAG_DATA_DWORD);
591  break;
592  case REG_QWORD:
593  tiValue = SdbFindFirstTag(pdb, tiData, TAG_DATA_QWORD);
594  break;
595  default:
596  /* Not supported (yet) */
597  SHIM_WARN("Unsupported dwDataType=0x%x\n", dwDataType);
599  }
600 
601  if (lpdwDataType)
602  *lpdwDataType = dwDataType;
603 
604  if (tiValue == TAGID_NULL)
605  {
606  SHIM_WARN("Data tag (0x%x) without data\n", tiData);
608  }
609 
610  if (dwDataType != REG_SZ)
611  {
612  dwSizeRequired = SdbGetTagDataSize(pdb, tiValue);
613  }
614  else
615  {
616  lpStringData = SdbpGetString(pdb, tiValue, &dwSizeRequired);
617  if (lpStringData == NULL)
618  {
620  }
621  }
622  if (!lpcbBufferSize)
624 
625  dwInputSize = *lpcbBufferSize;
626  *lpcbBufferSize = dwSizeRequired;
627 
628  if (dwInputSize < dwSizeRequired || lpBuffer == NULL)
629  {
630  SHIM_WARN("dwInputSize %u not sufficient to hold %u bytes\n", dwInputSize, dwSizeRequired);
632  }
633 
634  if (dwDataType != REG_SZ)
635  {
636  SdbpReadData(pdb, lpBuffer, tiValue + sizeof(TAG), dwSizeRequired);
637  }
638  else
639  {
640  StringCbCopyNW(lpBuffer, dwInputSize, lpStringData, dwSizeRequired);
641  }
642 
643  return ERROR_SUCCESS;
644 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define TAG_NAME
Definition: sdbtagid.h:126
#define ERROR_SUCCESS
Definition: deptool.c:10
STRSAFEAPI StringCbCopyNW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc, size_t cbToCopy)
Definition: strsafe.h:255
DWORD WINAPI SdbReadDWORDTag(PDB pdb, TAGID tagid, DWORD ret)
Definition: sdbread.c:305
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
BOOL WINAPI SdbpReadData(PDB pdb, PVOID dest, DWORD offset, DWORD num)
Definition: sdbread.c:14
#define TAG_DATA_VALUETYPE
Definition: sdbtagid.h:83
DWORD WINAPI SdbGetTagDataSize(PDB pdb, TAGID tagid)
Definition: sdbread.c:109
#define TAG_DATA_DWORD
Definition: sdbtagid.h:84
#define TAG_DATA_QWORD
Definition: sdbtagid.h:113
smooth NULL
Definition: ftsmooth.c:416
#define TAG_DATA
Definition: sdbtagid.h:174
static TAGREF LPCWSTR lpszDataName
Definition: db.cpp:163
static TAGREF LPCWSTR LPDWORD LPVOID LPDWORD lpcbBufferSize
Definition: db.cpp:163
unsigned long DWORD
Definition: ntddk_ex.h:95
#define TAG_DATA_STRING
Definition: sdbtagid.h:150
TAGID WINAPI SdbFindFirstTag(PDB pdb, TAGID parent, TAG tag)
Definition: sdbread.c:208
#define REG_SZ
Definition: sdbapi.c:538
WORD TAG
Definition: sdbtypes.h:16
static TAGID tiExe
Definition: db.cpp:165
TAGID WINAPI SdbFindFirstNamedTag(PDB pdb, TAGID root, TAGID find, TAGID nametag, LPCWSTR find_name)
Definition: sdbapi.c:487
static TAGREF LPCWSTR LPDWORD lpdwDataType
Definition: db.cpp:163
#define ERROR_INTERNAL_DB_CORRUPTION
Definition: winerror.h:839
#define ERROR_NOT_FOUND
Definition: winerror.h:690
#define REG_QWORD
Definition: sdbapi.c:540
static TAGID LPCWSTR LPDWORD LPVOID LPDWORD TAGID * ptiData
Definition: db.cpp:165
#define REG_DWORD
Definition: sdbapi.c:539
LPWSTR WINAPI SdbpGetString(PDB pdb, TAGID tagid, PDWORD size)
Definition: sdbread.c:47
#define TAGID_NULL
Definition: sdbtagid.h:13
DWORD TAGID
Definition: sdbtypes.h:17
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

◆ SdbTagToString()

LPCWSTR WINAPI SdbTagToString ( TAG  tag)

Converts specified tag into a string.

Parameters
[in]tagThe tag which will be converted to a string.
Returns
Success: Pointer to the string matching specified tag, or L"InvalidTag" on failure.

Definition at line 695 of file sdbapi.c.

Referenced by InitApphelp(), SdbpMatchFileAttributes(), and START_TEST().

696 {
697  switch (tag)
698  {
699  case TAG_NULL: return L"NULL";
700 
701  /* TAG_TYPE_NULL */
702  case TAG_INCLUDE: return L"INCLUDE";
703  case TAG_GENERAL: return L"GENERAL";
704  case TAG_MATCH_LOGIC_NOT: return L"MATCH_LOGIC_NOT";
705  case TAG_APPLY_ALL_SHIMS: return L"APPLY_ALL_SHIMS";
706  case TAG_USE_SERVICE_PACK_FILES: return L"USE_SERVICE_PACK_FILES";
707  case TAG_MITIGATION_OS: return L"MITIGATION_OS";
708  case TAG_BLOCK_UPGRADE: return L"BLOCK_UPGRADE";
709  case TAG_INCLUDEEXCLUDEDLL: return L"INCLUDEEXCLUDEDLL";
710  case TAG_RAC_EVENT_OFF: return L"RAC_EVENT_OFF";
711  case TAG_TELEMETRY_OFF: return L"TELEMETRY_OFF";
712  case TAG_SHIM_ENGINE_OFF: return L"SHIM_ENGINE_OFF";
713  case TAG_LAYER_PROPAGATION_OFF: return L"LAYER_PROPAGATION_OFF";
714  case TAG_REINSTALL_UPGRADE: return L"REINSTALL_UPGRADE";
715 
716  /* TAG_TYPE_WORD */
717  case TAG_MATCH_MODE: return L"MATCH_MODE";
718  case TAG_TAG: return L"TAG";
719  case TAG_INDEX_TAG: return L"INDEX_TAG";
720  case TAG_INDEX_KEY: return L"INDEX_KEY";
721 
722  /* TAG_TYPE_DWORD */
723  case TAG_SIZE: return L"SIZE";
724  case TAG_OFFSET: return L"OFFSET";
725  case TAG_CHECKSUM: return L"CHECKSUM";
726  case TAG_SHIM_TAGID: return L"SHIM_TAGID";
727  case TAG_PATCH_TAGID: return L"PATCH_TAGID";
728  case TAG_MODULE_TYPE: return L"MODULE_TYPE";
729  case TAG_VERDATEHI: return L"VERDATEHI";
730  case TAG_VERDATELO: return L"VERDATELO";
731  case TAG_VERFILEOS: return L"VERFILEOS";
732  case TAG_VERFILETYPE: return L"VERFILETYPE";
733  case TAG_PE_CHECKSUM: return L"PE_CHECKSUM";
734  case TAG_PREVOSMAJORVER: return L"PREVOSMAJORVER";
735  case TAG_PREVOSMINORVER: return L"PREVOSMINORVER";
736  case TAG_PREVOSPLATFORMID: return L"PREVOSPLATFORMID";
737  case TAG_PREVOSBUILDNO: return L"PREVOSBUILDNO";
738  case TAG_PROBLEMSEVERITY: return L"PROBLEMSEVERITY";
739  case TAG_LANGID: return L"LANGID";
740  case TAG_VER_LANGUAGE: return L"VER_LANGUAGE";
741  case TAG_ENGINE: return L"ENGINE";
742  case TAG_HTMLHELPID: return L"HTMLHELPID";
743  case TAG_INDEX_FLAGS: return L"INDEX_FLAGS";
744  case TAG_FLAGS: return L"FLAGS";
745  case TAG_DATA_VALUETYPE: return L"DATA_VALUETYPE";
746  case TAG_DATA_DWORD: return L"DATA_DWORD";
747  case TAG_LAYER_TAGID: return L"LAYER_TAGID";
748  case TAG_MSI_TRANSFORM_TAGID: return L"MSI_TRANSFORM_TAGID";
749  case TAG_LINKER_VERSION: return L"LINKER_VERSION";
750  case TAG_LINK_DATE: return L"LINK_DATE";
751  case TAG_UPTO_LINK_DATE: return L"UPTO_LINK_DATE";
752  case TAG_OS_SERVICE_PACK: return L"OS_SERVICE_PACK";
753  case TAG_FLAG_TAGID: return L"FLAG_TAGID";
754  case TAG_RUNTIME_PLATFORM: return L"RUNTIME_PLATFORM";
755  case TAG_OS_SKU: return L"OS_SKU";
756  case TAG_OS_PLATFORM: return L"OS_PLATFORM";
757  case TAG_APP_NAME_RC_ID: return L"APP_NAME_RC_ID";
758  case TAG_VENDOR_NAME_RC_ID: return L"VENDOR_NAME_RC_ID";
759  case TAG_SUMMARY_MSG_RC_ID: return L"SUMMARY_MSG_RC_ID";
760  case TAG_VISTA_SKU: return L"VISTA_SKU";
761  case TAG_DESCRIPTION_RC_ID: return L"DESCRIPTION_RC_ID";
762  case TAG_PARAMETER1_RC_ID: return L"PARAMETER1_RC_ID";
763  case TAG_CONTEXT_TAGID: return L"CONTEXT_TAGID";
764  case TAG_EXE_WRAPPER: return L"EXE_WRAPPER";
765  case TAG_URL_ID: return L"URL_ID";
766  case TAG_TAGID: return L"TAGID";
767 
768  /* TAG_TYPE_QWORD */
769  case TAG_TIME: return L"TIME";
770  case TAG_BIN_FILE_VERSION: return L"BIN_FILE_VERSION";
771  case TAG_BIN_PRODUCT_VERSION: return L"BIN_PRODUCT_VERSION";
772  case TAG_MODTIME: return L"MODTIME";
773  case TAG_FLAG_MASK_KERNEL: return L"FLAG_MASK_KERNEL";
774  case TAG_UPTO_BIN_PRODUCT_VERSION: return L"UPTO_BIN_PRODUCT_VERSION";
775  case TAG_DATA_QWORD: return L"DATA_QWORD";
776  case TAG_FLAG_MASK_USER: return L"FLAG_MASK_USER";
777  case TAG_FLAGS_NTVDM1: return L"FLAGS_NTVDM1";
778  case TAG_FLAGS_NTVDM2: return L"FLAGS_NTVDM2";
779  case TAG_FLAGS_NTVDM3: return L"FLAGS_NTVDM3";
780  case TAG_FLAG_MASK_SHELL: return L"FLAG_MASK_SHELL";
781  case TAG_UPTO_BIN_FILE_VERSION: return L"UPTO_BIN_FILE_VERSION";
782  case TAG_FLAG_MASK_FUSION: return L"FLAG_MASK_FUSION";
783  case TAG_FLAG_PROCESSPARAM: return L"FLAG_PROCESSPARAM";
784  case TAG_FLAG_LUA: return L"FLAG_LUA";
785  case TAG_FLAG_INSTALL: return L"FLAG_INSTALL";
786 
787  /* TAG_TYPE_STRINGREF */
788  case TAG_NAME: return L"NAME";
789  case TAG_DESCRIPTION: return L"DESCRIPTION";
790  case TAG_MODULE: return L"MODULE";
791  case TAG_API: return L"API";
792  case TAG_VENDOR: return L"VENDOR";
793  case TAG_APP_NAME: return L"APP_NAME";
794  case TAG_COMMAND_LINE: return L"COMMAND_LINE";
795  case TAG_COMPANY_NAME: return L"COMPANY_NAME";
796  case TAG_DLLFILE: return L"DLLFILE";
797  case TAG_WILDCARD_NAME: return L"WILDCARD_NAME";
798  case TAG_PRODUCT_NAME: return L"PRODUCT_NAME";
799  case TAG_PRODUCT_VERSION: return L"PRODUCT_VERSION";
800  case TAG_FILE_DESCRIPTION: return L"FILE_DESCRIPTION";
801  case TAG_FILE_VERSION: return L"FILE_VERSION";
802  case TAG_ORIGINAL_FILENAME: return L"ORIGINAL_FILENAME";
803  case TAG_INTERNAL_NAME: return L"INTERNAL_NAME";
804  case TAG_LEGAL_COPYRIGHT: return L"LEGAL_COPYRIGHT";
805  case TAG_16BIT_DESCRIPTION: return L"16BIT_DESCRIPTION";
806  case TAG_APPHELP_DETAILS: return L"APPHELP_DETAILS";
807  case TAG_LINK_URL: return L"LINK_URL";
808  case TAG_LINK_TEXT: return L"LINK_TEXT";
809  case TAG_APPHELP_TITLE: return L"APPHELP_TITLE";
810  case TAG_APPHELP_CONTACT: return L"APPHELP_CONTACT";
811  case TAG_SXS_MANIFEST: return L"SXS_MANIFEST";
812  case TAG_DATA_STRING: return L"DATA_STRING";
813  case TAG_MSI_TRANSFORM_FILE: return L"MSI_TRANSFORM_FILE";
814  case TAG_16BIT_MODULE_NAME: return L"16BIT_MODULE_NAME";
815  case TAG_LAYER_DISPLAYNAME: return L"LAYER_DISPLAYNAME";
816  case TAG_COMPILER_VERSION: return L"COMPILER_VERSION";
817  case TAG_ACTION_TYPE: return L"ACTION_TYPE";
818  case TAG_EXPORT_NAME: return L"EXPORT_NAME";
819  case TAG_URL: return L"URL";
820 
821  /* TAG_TYPE_LIST */
822  case TAG_DATABASE: return L"DATABASE";
823  case TAG_LIBRARY: return L"LIBRARY";
824  case TAG_INEXCLUD: return L"INEXCLUDE";
825  case TAG_SHIM: return L"SHIM";
826  case TAG_PATCH: return L"PATCH";
827  case TAG_APP: return L"APP";
828  case TAG_EXE: return L"EXE";
829  case TAG_MATCHING_FILE: return L"MATCHING_FILE";
830  case TAG_SHIM_REF: return L"SHIM_REF";
831  case TAG_PATCH_REF: return L"PATCH_REF";
832  case TAG_LAYER: return L"LAYER";
833  case TAG_FILE: return L"FILE";
834  case TAG_APPHELP: return L"APPHELP";
835  case TAG_LINK: return L"LINK";
836  case TAG_DATA: return L"DATA";
837  case TAG_MSI_TRANSFORM: return L"MSI_TRANSFORM";
838  case TAG_MSI_TRANSFORM_REF: return L"MSI_TRANSFORM_REF";
839  case TAG_MSI_PACKAGE: return L"MSI_PACKAGE";
840  case TAG_FLAG: return L"FLAG";
841  case TAG_MSI_CUSTOM_ACTION: return L"MSI_CUSTOM_ACTION";
842  case TAG_FLAG_REF: return L"FLAG_REF";
843  case TAG_ACTION: return L"ACTION";
844  case TAG_LOOKUP: return L"LOOKUP";
845  case TAG_CONTEXT: return L"CONTEXT";
846  case TAG_CONTEXT_REF: return L"CONTEXT_REF";
847  case TAG_SPC: return L"SPC";
848  case TAG_STRINGTABLE: return L"STRINGTABLE";
849  case TAG_INDEXES: return L"INDEXES";
850  case TAG_INDEX: return L"INDEX";
851 
852  /* TAG_TYPE_STRING */
853  case TAG_STRINGTABLE_ITEM: return L"STRINGTABLE_ITEM";
854 
855  /* TAG_TYPE_BINARY */
856  case TAG_PATCH_BITS: return L"PATCH_BITS";
857  case TAG_FILE_BITS: return L"FILE_BITS";
858  case TAG_EXE_ID: return L"EXE_ID";
859  case TAG_DATA_BITS: return L"DATA_BITS";
860  case TAG_MSI_PACKAGE_ID: return L"MSI_PACKAGE_ID";
861  case TAG_DATABASE_ID: return L"DATABASE_ID";
862  case TAG_CONTEXT_PLATFORM_ID: return L"CONTEXT_PLATFORM_ID";
863  case TAG_CONTEXT_BRANCH_ID: return L"CONTEXT_BRANCH_ID";
864  case TAG_FIX_ID: return L"FIX_ID";
865  case TAG_APP_ID: return L"APP_ID";
866  case TAG_INDEX_BITS: return L"INDEX_BITS";
867 
868  break;
869  }
870  return L"InvalidTag";
871 }
#define TAG_FILE_DESCRIPTION
Definition: sdbtagid.h:138
#define TAG_PREVOSBUILDNO
Definition: sdbtagid.h:75
#define TAG_OS_SKU
Definition: sdbtagid.h:93
#define TAG_ACTION
Definition: sdbtagid.h:181
#define TAG_MATCH_MODE
Definition: sdbtagid.h:55
#define TAG_URL
Definition: sdbtagid.h:157
#define TAG_REINSTALL_UPGRADE
Definition: sdbtagid.h:50
#define TAG_PE_CHECKSUM
Definition: sdbtagid.h:71
#define TAG_DATABASE_ID
Definition: sdbtagid.h:199
#define TAG_NAME
Definition: sdbtagid.h:126
#define TAG_URL_ID
Definition: sdbtagid.h:103
#define TAG_APP
Definition: sdbtagid.h:165
#define TAG_MSI_TRANSFORM
Definition: sdbtagid.h:175
#define TAG_APP_ID
Definition: sdbtagid.h:203
#define TAG_WILDCARD_NAME
Definition: sdbtagid.h:135
#define TAG_MODTIME
Definition: sdbtagid.h:110
#define TAG_LIBRARY
Definition: sdbtagid.h:161
#define TAG_FLAGS_NTVDM1
Definition: sdbtagid.h:115
#define TAG_FLAG
Definition: sdbtagid.h:178
#define TAG_MATCH_LOGIC_NOT
Definition: sdbtagid.h:40
#define TAG_SIZE
Definition: sdbtagid.h:61
#define TAG_STRINGTABLE
Definition: sdbtagid.h:186
#define TAG_TELEMETRY_OFF
Definition: sdbtagid.h:47
#define TAG_CONTEXT
Definition: sdbtagid.h:183
#define TAG_COMPANY_NAME
Definition: sdbtagid.h:133
#define TAG_USE_SERVICE_PACK_FILES
Definition: sdbtagid.h:42
#define TAG_RUNTIME_PLATFORM
Definition: sdbtagid.h:92
#define TAG_DATABASE
Definition: sdbtagid.h:160
#define TAG_16BIT_MODULE_NAME
Definition: sdbtagid.h:152
#define TAG_FLAG_MASK_SHELL
Definition: sdbtagid.h:118
Definition: ecma_167.h:138
#define TAG_VENDOR_NAME_RC_ID
Definition: sdbtagid.h:96
#define TAG_MSI_TRANSFORM_TAGID
Definition: sdbtagid.h:86
#define TAG_ORIGINAL_FILENAME
Definition: sdbtagid.h:140
#define TAG_NULL
Definition: sdbtagid.h:35
#define TAG_FLAG_PROCESSPARAM
Definition: sdbtagid.h:121
#define TAG_DATA_VALUETYPE
Definition: sdbtagid.h:83
#define TAG_PATCH
Definition: sdbtagid.h:164
#define TAG_LAYER_PROPAGATION_OFF
Definition: sdbtagid.h:49
#define TAG_HTMLHELPID
Definition: sdbtagid.h:80
#define TAG_16BIT_DESCRIPTION
Definition: sdbtagid.h:143
#define TAG_FLAG_INSTALL
Definition: sdbtagid.h:123
#define TAG_VENDOR
Definition: sdbtagid.h:130
#define TAG_CONTEXT_PLATFORM_ID
Definition: sdbtagid.h:200
#define TAG_COMMAND_LINE
Definition: sdbtagid.h:132
#define TAG_TAG
Definition: sdbtagid.h:56
#define TAG_UPTO_BIN_PRODUCT_VERSION
Definition: sdbtagid.h:112
#define TAG_MITIGATION_OS
Definition: sdbtagid.h:43
#define TAG_FILE_BITS
Definition: sdbtagid.h:195
#define TAG_DLLFILE
Definition: sdbtagid.h:134
#define TAG_FLAG_LUA
Definition: sdbtagid.h:122
#define TAG_INDEX_BITS
Definition: sdbtagid.h:204
#define TAG_MATCHING_FILE
Definition: sdbtagid.h:167
#define TAG_DATA_DWORD
Definition: sdbtagid.h:84
#define TAG_LANGID
Definition: sdbtagid.h:77
#define TAG_BIN_PRODUCT_VERSION
Definition: sdbtagid.h:109
#define TAG_ACTION_TYPE
Definition: sdbtagid.h:155
#define TAG_FLAG_MASK_KERNEL
Definition: sdbtagid.h:111
#define TAG_MSI_CUSTOM_ACTION
Definition: sdbtagid.h:179
#define TAG_OS_PLATFORM
Definition: sdbtagid.h:94
#define TAG_LINK
Definition: sdbtagid.h:173
#define TAG_EXE_WRAPPER
Definition: sdbtagid.h:102
#define TAG_INDEX_TAG
Definition: sdbtagid.h:57
#define TAG_OFFSET
Definition: sdbtagid.h:62
#define TAG_DATA_QWORD
Definition: sdbtagid.h:113
#define TAG_COMPILER_VERSION
Definition: sdbtagid.h:154
#define TAG_SHIM
Definition: sdbtagid.h:163
#define TAG_LAYER_TAGID
Definition: sdbtagid.h:85
#define TAG_LINK_TEXT
Definition: sdbtagid.h:146
#define TAG_APP_NAME_RC_ID
Definition: sdbtagid.h:95
#define TAG_MODULE
Definition: sdbtagid.h:128
#define TAG_DATA_BITS
Definition: sdbtagid.h:197
#define TAG_APPHELP_CONTACT
Definition: sdbtagid.h:148
#define TAG_FLAG_MASK_FUSION
Definition: sdbtagid.h:120
#define TAG_API
Definition: sdbtagid.h:129
#define TAG_FILE_VERSION
Definition: sdbtagid.h:139
#define TAG_FIX_ID
Definition: sdbtagid.h:202
#define TAG_FLAGS_NTVDM2
Definition: sdbtagid.h:116
#define TAG_SPC
Definition: sdbtagid.h:185
#define TAG_FILE
Definition: sdbtagid.h:171
#define TAG_VERDATEHI
Definition: sdbtagid.h:67
#define TAG_LEGAL_COPYRIGHT
Definition: sdbtagid.h:142
#define TAG_CHECKSUM
Definition: sdbtagid.h:63
#define TAG_SHIM_TAGID
Definition: sdbtagid.h:64
#define TAG_DATA
Definition: sdbtagid.h:174
#define TAG_UPTO_LINK_DATE
Definition: sdbtagid.h:89
#define TAG_APPHELP
Definition: sdbtagid.h:172
#define TAG_PREVOSMINORVER
Definition: sdbtagid.h:73
#define TAG_BIN_FILE_VERSION
Definition: sdbtagid.h:108
#define TAG_UPTO_BIN_FILE_VERSION
Definition: sdbtagid.h:119
#define TAG_CONTEXT_TAGID
Definition: sdbtagid.h:101
#define TAG_TIME
Definition: sdbtagid.h:107
#define TAG_FLAG_TAGID
Definition: sdbtagid.h:91
#define TAG_LAYER
Definition: sdbtagid.h:170
#define TAG_DATA_STRING
Definition: sdbtagid.h:150
#define TAG_TAGID
Definition: sdbtagid.h:104
#define TAG_CONTEXT_BRANCH_ID
Definition: sdbtagid.h:201
#define TAG_VERFILEOS
Definition: sdbtagid.h:69
#define TAG_MSI_TRANSFORM_FILE
Definition: sdbtagid.h:151
static const WCHAR L[]
Definition: oid.c:1087
#define TAG_PREVOSPLATFORMID
Definition: sdbtagid.h:74
#define TAG_SHIM_REF
Definition: sdbtagid.h:168
#define TAG_EXE
Definition: sdbtagid.h:166
#define TAG_MSI_PACKAGE_ID
Definition: sdbtagid.h:198
#define TAG_VISTA_SKU
Definition: sdbtagid.h:98
#define TAG_PRODUCT_VERSION
Definition: sdbtagid.h:137
#define TAG_EXPORT_NAME
Definition: sdbtagid.h:156
#define TAG_GENERAL
Definition: sdbtagid.h:39
#define TAG_FLAGS_NTVDM3
Definition: sdbtagid.h:117
#define TAG_PRODUCT_NAME
Definition: sdbtagid.h:136
#define TAG_LINK_URL
Definition: sdbtagid.h:145
#define TAG_SHIM_ENGINE_OFF
Definition: sdbtagid.h:48
#define TAG_APPHELP_DETAILS
Definition: sdbtagid.h:144
#define TAG_PREVOSMAJORVER
Definition: sdbtagid.h:72
#define TAG_VER_LANGUAGE
Definition: sdbtagid.h:78
#define TAG_DESCRIPTION_RC_ID
Definition: sdbtagid.h:99
#define TAG_APPHELP_TITLE
Definition: sdbtagid.h:147
#define TAG_INDEX_KEY
Definition: sdbtagid.h:58
#define TAG_CONTEXT_REF
Definition: sdbtagid.h:184
#define TAG_VERDATELO
Definition: sdbtagid.h:68
#define TAG_PARAMETER1_RC_ID
Definition: sdbtagid.h:100
#define TAG_STRINGTABLE_ITEM
Definition: sdbtagid.h:191
#define TAG_SXS_MANIFEST
Definition: sdbtagid.h:149
#define TAG_DESCRIPTION
Definition: sdbtagid.h:127
#define TAG_LAYER_DISPLAYNAME
Definition: sdbtagid.h:153
#define TAG_INDEX
Definition: sdbtagid.h:188
#define TAG_LINK_DATE
Definition: sdbtagid.h:88
#define TAG_MSI_TRANSFORM_REF
Definition: sdbtagid.h:176
#define TAG_RAC_EVENT_OFF
Definition: sdbtagid.h:46
#define TAG_ENGINE
Definition: sdbtagid.h:79
#define TAG_FLAG_REF
Definition: sdbtagid.h:180
#define TAG_INDEXES
Definition: sdbtagid.h:187
#define TAG_LINKER_VERSION
Definition: sdbtagid.h:87
#define TAG_INCLUDE
Definition: sdbtagid.h:38
#define TAG_PROBLEMSEVERITY
Definition: sdbtagid.h:76
#define TAG_VERFILETYPE
Definition: sdbtagid.h:70
#define TAG_OS_SERVICE_PACK
Definition: sdbtagid.h:90
#define TAG_FLAG_MASK_USER
Definition: sdbtagid.h:114
#define TAG_APPLY_ALL_SHIMS
Definition: sdbtagid.h:41
#define TAG_INTERNAL_NAME
Definition: sdbtagid.h:141
#define TAG_MSI_PACKAGE
Definition: sdbtagid.h:177
#define TAG_APP_NAME
Definition: sdbtagid.h:131
#define TAG_PATCH_TAGID
Definition: sdbtagid.h:65
#define TAG_INEXCLUD
Definition: sdbtagid.h:162
#define TAG_LOOKUP
Definition: sdbtagid.h:182
#define TAG_SUMMARY_MSG_RC_ID
Definition: sdbtagid.h:97
#define TAG_EXE_ID
Definition: sdbtagid.h:196
#define TAG_MODULE_TYPE
Definition: sdbtagid.h:66
#define TAG_PATCH_REF
Definition: sdbtagid.h:169
#define TAG_INDEX_FLAGS
Definition: sdbtagid.h:81
#define TAG_PATCH_BITS
Definition: sdbtagid.h:194
#define TAG_FLAGS
Definition: sdbtagid.h:82
#define TAG_BLOCK_UPGRADE
Definition: sdbtagid.h:44
#define TAG_INCLUDEEXCLUDEDLL
Definition: sdbtagid.h:45

Variable Documentation

◆ g_Heap

HANDLE g_Heap
static

Definition at line 33 of file sdbapi.c.

Referenced by SdbpHeap().

◆ GUID_DATABASE_DRIVERS

const GUID GUID_DATABASE_DRIVERS = {0xf9ab2228,0x3312,0x4a73, {0xb6,0xf9,0x93,0x6d,0x70,0xe1,0x12,0xef}}
static

Definition at line 18 of file sdbapi.c.

Referenced by SdbGetStandardDatabaseGUID(), and test_GuidFunctions().

◆ GUID_DATABASE_MSI

const GUID GUID_DATABASE_MSI = {0xd8ff6d16,0x6a3a,0x468a, {0x8b,0x44,0x01,0x71,0x4d,0xdc,0x49,0xea}}
static

Definition at line 16 of file sdbapi.c.

Referenced by SdbGetStandardDatabaseGUID(), and test_GuidFunctions().

◆ GUID_DATABASE_SHIM

const GUID GUID_DATABASE_SHIM = {0x11111111,0x1111,0x1111, {0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11}}
static

Definition at line 17 of file sdbapi.c.

Referenced by SdbGetStandardDatabaseGUID(), and test_GuidFunctions().