18#define APPCOMPAT_CUSTOM_REG_PATH L"Software\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Custom"
19#define APPCOMPAT_LAYERS_REG_PATH L"Software\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Custom\\Layers"
20#define APPCOMPAT_INSTALLEDSDB_REG_PATH L"Software\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\InstalledSDB"
21#define UNINSTALL_REG_PATH L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall"
22#define DBPATH_KEY_NAME L"DatabasePath"
23#define SDB_EXT L".sdb"
24#define GUID_STR_LENGTH 38
25#define GUID_SBD_NAME_LENGTH (GUID_STR_LENGTH + ARRAYSIZE(SDB_EXT))
116 if (sdbinstPath[
count - 1] !=
L'\\')
221 wprintf(
L"Can't find database id tag");
244 TAGID prevTagLayer = 0;
249 while (tagLayer && (tagLayer != prevTagLayer))
267 prevTagLayer = tagLayer;
284 TAGID tagExePrev = 0;
289 while (tagExe != 0 && (tagExe != tagExePrev))
325 if (sysdirPath ==
NULL)
333 pTmpSysdir =
StrRChrW(sysdirPath, sysdirPath + destLen,
L'\\');
334 if (pTmpSysdir ==
NULL)
336 wprintf(
L"Can't find directory separator\n");
350 wprintf(
L"Can't create folder %ls\n Error: 0x%08X\n", sysdirPath,
error);
421 wprintf(
L"Can't open database %ls\n", sdbPath);
428 wprintf(
L"Can't find database tag\n");
447 wprintf(
L"Database guid %ls\n", guidDbStr);
457 wprintf(
L"Database name %ls\n", dbName);
463 wprintf(
L"Process exe failed. Status: 0x%08X",
res);
471 wprintf(
L"Process layers failed. Status: 0x%08X",
res);
483 wprintf(
L"file path %ls\n", sysdirPatchPath);
497 wprintf(
L"SdbRegisterDatabaseEx failed");
562 sdbName = sdbPath + sdbPathLen;
564 wprintf(
L"uninstall path %ls\n", sdbPath);
565 sdbName =
StrRChrW(sdbPath, sdbPath + sdbPathLen,
L'\\');
575 wprintf(
L"uninstall name %ls\n", sdbName);
581 wprintf(
L"Can't open database %ls\n", sdbPath);
588 wprintf(
L"Can't find database tag\n");
627 wprintf(
L"Remove uninstall key fail\n");
632 wprintf(
L"SdbUnregisterDatabase\n");
680 DWORD keyValSize =
sizeof(dbPath);
684 wprintf(
L"Invalid GUID: %ls\n", guidSdbStr);
762 keyValSize =
sizeof(dbDescript);
769 wprintf(
L"dbdescript: %ls \n", dbDescript);
771 if (
_wcsnicmp(dbDescript, nameSdbStr, keyNameLen) == 0)
774 keyValSize =
sizeof(dbPath);
812 wprintf(
L"Using: sdbinst [-?][-q][-u][-g][-n] foo.sdb | {guid} | \"name\" \n"
815 L"-g - {guid} file GUID (only uninstall)\n"
816 L"-n - \"name\" - file name (only uninstall)\n");
861 guidSdbStr =
argv[
i];
862 wprintf(
L"guidSdbStr %ls\n", guidSdbStr);
864 isUninstByGuid =
TRUE;
876 nameSdbStr =
argv[
i];
877 wprintf(
L"nameSdbStr %ls\n", nameSdbStr);
879 isUninstByName =
TRUE;
890 else if (isUninstByGuid)
895 else if (isUninstByName)
908 wprintf(isInstall ?
L"Sdb install failed\n" :
L"Sdb uninstall failed\n");
TAGID WINAPI SdbFindFirstTag(PDB pdb, TAGID parent, TAG tag)
#define SDB_DATABASE_SHIM
BOOL WINAPI SdbReadBinaryTag(PDB pdb, TAGID tagid, PBYTE buffer, DWORD size)
PDB WINAPI SdbOpenDatabase(LPCWSTR path, PATH_TYPE type)
void WINAPI SdbCloseDatabase(PDB)
TAGID WINAPI SdbFindNextTag(PDB pdb, TAGID parent, TAGID prev_child)
LPWSTR WINAPI SdbGetStringTagPtr(PDB pdb, TAGID tagid)
#define RegCloseKey(hKey)
#define ERROR_NOT_ENOUGH_MEMORY
static LSTATUS(WINAPI *pRegDeleteTreeW)(HKEY
BOOL WINAPI SdbUnregisterDatabase(_In_ const GUID *pguidDB)
BOOL WINAPI SdbRegisterDatabaseEx(_In_ LPCWSTR pszDatabasePath, _In_ DWORD dwDatabaseType, _In_opt_ const PULONGLONG pTimeStamp)
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
LONG WINAPI RegEnumKeyExW(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
LPWSTR WINAPI StrRChrW(LPCWSTR str, LPCWSTR end, WORD ch)
#define ERROR_INVALID_PARAMETER
#define HeapFree(x, y, z)
#define FILE_ATTRIBUTE_NORMAL
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
BOOL WINAPI SetFileAttributesW(LPCWSTR lpFileName, DWORD dwFileAttributes)
VOID WINAPI GetSystemTimeAsFileTime(OUT PFILETIME lpFileTime)
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
GLuint GLuint GLsizei count
GLuint GLsizei GLsizei * length
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define ERROR_ALREADY_EXISTS
#define ERROR_FILE_NOT_FOUND
#define REG_OPTION_NON_VOLATILE
HRESULT BuildPathToSdb(_In_ PWCHAR buffer, _In_ SIZE_T bufLen, _In_ LPCWSTR guidDbStr)
#define APPCOMPAT_CUSTOM_REG_PATH
HRESULT CopySdbToAppPatch(_In_ LPCWSTR sourceSdbPath, _In_ LPCWSTR destSdbPath)
HRESULT ProcessLayers(_In_ PDB pdb, _In_ TAGID tagDb, _In_opt_ LPCWSTR guidDbStr, _In_opt_ ULONGLONG time, _In_ BOOL isInstall)
BOOL GetSdbGuid(_In_ PDB pdb, _In_ TAGID tagDb, _Out_ GUID *guid)
BOOL SdbUninstallByName(_In_ LPWSTR nameSdbStr)
BOOL SdbUninstall(_In_ LPWSTR sdbPath)
#define APPCOMPAT_LAYERS_REG_PATH
BOOL ValidateGuidString(_In_ PWCHAR guidStr)
HRESULT DeleteUninstallKey(_In_ LPCWSTR keyName)
#define UNINSTALL_REG_PATH
#define GUID_SBD_NAME_LENGTH
#define APPCOMPAT_INSTALLEDSDB_REG_PATH
HRESULT ProcessExe(_In_ PDB pdb, _In_ TAGID tagDb, _In_opt_ LPCWSTR guidDbStr, _In_opt_ ULONGLONG time, _In_ BOOL isInstall)
HRESULT AddUninstallKey(_In_ LPCWSTR dbName, _In_ LPCWSTR sdbInstalledPath, _In_ LPCWSTR guidDbStr)
BOOL SdbUninstallByGuid(_In_ LPWSTR guidSdbStr)
BOOL SdbInstall(_In_ LPCWSTR sdbPath)
HRESULT RegisterSdbEntry(_In_ PWCHAR sdbEntryName, _In_ LPCWSTR dbGuid, _In_ ULONGLONG time, _In_ BOOL isInstall, _In_ BOOL isExe)
_Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
STRSAFEAPI StringCchCatW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
#define success(from, fromstr, to, tostr)
DWORD WINAPI GetLastError(void)
#define HRESULT_FROM_WIN32(x)
#define HKEY_LOCAL_MACHINE