UINT MSIREG_OpenUserDataProductKey(LPCWSTR szProduct, HKEY *key, BOOL create) { UINT rc; WCHAR squished_pc[GUID_SIZE]; WCHAR keypath[0x200]; LPWSTR usersid; TRACE("%s\n", debugstr_w(szProduct)); if (!squash_guid(szProduct, squished_pc)) return ERROR_FUNCTION_FAILED; TRACE("squished (%s)\n", debugstr_w(squished_pc)); rc = get_user_sid(&usersid); if (rc != ERROR_SUCCESS || !usersid) { ERR("Failed to retrieve user SID: %d\n", rc); return rc; } sprintfW(keypath, szUserDataProd_fmt, usersid, squished_pc); if (create) rc = RegCreateKeyW(HKEY_LOCAL_MACHINE, keypath, key); else rc = RegOpenKeyW(HKEY_LOCAL_MACHINE, keypath, key); LocalFree(usersid); return rc; }
UINT MSIREG_OpenLocalManagedProductKey(LPCWSTR szProductCode, HKEY *key, BOOL create) { WCHAR squished_pc[GUID_SIZE]; WCHAR keypath[0x200]; LPWSTR usersid; UINT r; TRACE("%s\n", debugstr_w(szProductCode)); if (!squash_guid(szProductCode, squished_pc)) return ERROR_FUNCTION_FAILED; TRACE("squished (%s)\n", debugstr_w(squished_pc)); r = get_user_sid(&usersid); if (r != ERROR_SUCCESS || !usersid) { ERR("Failed to retrieve user SID: %d\n", r); return r; } sprintfW(keypath, szInstaller_LocalManagedProd_fmt, usersid, squished_pc); LocalFree(usersid); if (create) return RegCreateKeyW(HKEY_LOCAL_MACHINE, keypath, key); return RegOpenKeyW(HKEY_LOCAL_MACHINE, keypath, key); }
UINT MSIREG_DeleteUserFeaturesKey(LPCWSTR szProduct) { WCHAR squished_pc[GUID_SIZE]; WCHAR keypath[0x200]; TRACE("%s\n",debugstr_w(szProduct)); if (!squash_guid(szProduct,squished_pc)) return ERROR_FUNCTION_FAILED; TRACE("squished (%s)\n", debugstr_w(squished_pc)); sprintfW(keypath,szUserFeatures_fmt,squished_pc); return RegDeleteTreeW(HKEY_CURRENT_USER, keypath); }
UINT MSIREG_DeleteProductKey(LPCWSTR szProduct) { WCHAR squished_pc[GUID_SIZE]; WCHAR keypath[0x200]; TRACE("%s\n", debugstr_w(szProduct)); if (!squash_guid(szProduct, squished_pc)) return ERROR_FUNCTION_FAILED; TRACE("squished (%s)\n", debugstr_w(squished_pc)); sprintfW(keypath, szInstaller_Products_fmt, squished_pc); return RegDeleteTreeW(HKEY_LOCAL_MACHINE, keypath); }
UINT MSIREG_OpenLocalClassesProductKey(LPCWSTR szProductCode, HKEY *key, BOOL create) { WCHAR squished_pc[GUID_SIZE]; WCHAR keypath[0x200]; TRACE("%s\n", debugstr_w(szProductCode)); if (!squash_guid(szProductCode, squished_pc)) return ERROR_FUNCTION_FAILED; TRACE("squished (%s)\n", debugstr_w(squished_pc)); sprintfW(keypath, szInstaller_LocalClassesProd_fmt, squished_pc); if (create) return RegCreateKeyW(HKEY_LOCAL_MACHINE, keypath, key); return RegOpenKeyW(HKEY_LOCAL_MACHINE, keypath, key); }
UINT MSIREG_OpenUserUpgradeCodesKey(LPCWSTR szUpgradeCode, HKEY* key, BOOL create) { UINT rc; WCHAR squished_pc[GUID_SIZE]; WCHAR keypath[0x200]; TRACE("%s\n",debugstr_w(szUpgradeCode)); squash_guid(szUpgradeCode,squished_pc); TRACE("squished (%s)\n", debugstr_w(squished_pc)); sprintfW(keypath,szInstaller_UserUpgradeCodes_fmt,squished_pc); if (create) rc = RegCreateKeyW(HKEY_CURRENT_USER,keypath,key); else rc = RegOpenKeyW(HKEY_CURRENT_USER,keypath,key); return rc; }
UINT MSIREG_OpenProductsKey(LPCWSTR szProduct, HKEY* key, BOOL create) { UINT rc; WCHAR squished_pc[GUID_SIZE]; WCHAR keypath[0x200]; TRACE("%s\n",debugstr_w(szProduct)); squash_guid(szProduct,squished_pc); TRACE("squished (%s)\n", debugstr_w(squished_pc)); sprintfW(keypath,szInstaller_Products_fmt,squished_pc); if (create) rc = RegCreateKeyW(HKEY_LOCAL_MACHINE,keypath,key); else rc = RegOpenKeyW(HKEY_LOCAL_MACHINE,keypath,key); return rc; }
UINT MSIREG_OpenUserComponentsKey(LPCWSTR szComponent, HKEY* key, BOOL create) { UINT rc; WCHAR squished_cc[GUID_SIZE]; WCHAR keypath[0x200]; TRACE("%s\n",debugstr_w(szComponent)); squash_guid(szComponent,squished_cc); TRACE("squished (%s)\n", debugstr_w(squished_cc)); sprintfW(keypath,szUser_Components_fmt,squished_cc); if (create) rc = RegCreateKeyW(HKEY_CURRENT_USER,keypath,key); else rc = RegOpenKeyW(HKEY_CURRENT_USER,keypath,key); return rc; }
UINT MSIREG_OpenUpgradeCodesKey(LPCWSTR szUpgradeCode, HKEY* key, BOOL create) { UINT rc; WCHAR squished_pc[GUID_SIZE]; WCHAR keypath[0x200]; TRACE("%s\n",debugstr_w(szUpgradeCode)); if (!squash_guid(szUpgradeCode,squished_pc)) return ERROR_FUNCTION_FAILED; TRACE("squished (%s)\n", debugstr_w(squished_pc)); sprintfW(keypath,szInstaller_UpgradeCodes_fmt,squished_pc); if (create) rc = RegCreateKeyW(HKEY_LOCAL_MACHINE,keypath,key); else rc = RegOpenKeyW(HKEY_LOCAL_MACHINE,keypath,key); return rc; }
UINT MSIREG_OpenUserFeaturesKey(LPCWSTR szProduct, HKEY* key, BOOL create) { UINT rc; WCHAR squished_pc[GUID_SIZE]; WCHAR keypath[0x200]; TRACE("%s\n",debugstr_w(szProduct)); if (!squash_guid(szProduct,squished_pc)) return ERROR_FUNCTION_FAILED; TRACE("squished (%s)\n", debugstr_w(squished_pc)); sprintfW(keypath,szUserFeatures_fmt,squished_pc); if (create) rc = RegCreateKeyW(HKEY_CURRENT_USER,keypath,key); else rc = RegOpenKeyW(HKEY_CURRENT_USER,keypath,key); return rc; }
static UINT MSIREG_OpenInstallProps(LPCWSTR szProduct, LPCWSTR szUserSID, HKEY *key, BOOL create) { UINT rc; WCHAR squished_pc[GUID_SIZE]; WCHAR keypath[0x200]; TRACE("%s\n", debugstr_w(szProduct)); if (!squash_guid(szProduct, squished_pc)) return ERROR_FUNCTION_FAILED; TRACE("squished (%s)\n", debugstr_w(squished_pc)); sprintfW(keypath, szInstallProperties_fmt, szUserSID, squished_pc); if (create) rc = RegCreateKeyW(HKEY_LOCAL_MACHINE, keypath, key); else rc = RegOpenKeyW(HKEY_LOCAL_MACHINE, keypath, key); return rc; }
UINT MSIREG_DeleteUserDataComponentKey(LPCWSTR szComponent) { UINT rc; WCHAR comp[GUID_SIZE]; WCHAR keypath[0x200]; LPWSTR usersid; TRACE("%s\n", debugstr_w(szComponent)); if (!squash_guid(szComponent, comp)) return ERROR_FUNCTION_FAILED; TRACE("squished (%s)\n", debugstr_w(comp)); rc = get_user_sid(&usersid); if (rc != ERROR_SUCCESS || !usersid) { ERR("Failed to retrieve user SID: %d\n", rc); return rc; } sprintfW(keypath, szUserDataComp_fmt, usersid, comp); LocalFree(usersid); return RegDeleteTreeW(HKEY_LOCAL_MACHINE, keypath); }