diff options
Diffstat (limited to 'base/win/win_util.cc')
-rw-r--r-- | base/win/win_util.cc | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/base/win/win_util.cc b/base/win/win_util.cc index 10ae261..15a6445 100644 --- a/base/win/win_util.cc +++ b/base/win/win_util.cc @@ -97,21 +97,16 @@ bool UserAccountControlIsEnabled() { return (uac_enabled != 0); } -bool SetAppIdForPropertyStore(IPropertyStore* property_store, - const wchar_t* app_id) { +bool SetStringValueForPropertyStore(IPropertyStore* property_store, + const PROPERTYKEY& property_key, + const wchar_t* property_string_value) { DCHECK(property_store); - // App id should be less than 128 chars and contain no space. And recommended - // format is CompanyName.ProductName[.SubProduct.ProductNumber]. - // See http://msdn.microsoft.com/en-us/library/dd378459%28VS.85%29.aspx - DCHECK(lstrlen(app_id) < 128 && wcschr(app_id, L' ') == NULL); - PROPVARIANT property_value; - if (FAILED(InitPropVariantFromString(app_id, &property_value))) + if (FAILED(InitPropVariantFromString(property_string_value, &property_value))) return false; - HRESULT result = property_store->SetValue(PKEY_AppUserModel_ID, - property_value); + HRESULT result = property_store->SetValue(property_key, property_value); if (S_OK == result) result = property_store->Commit(); @@ -119,6 +114,18 @@ bool SetAppIdForPropertyStore(IPropertyStore* property_store, return SUCCEEDED(result); } +bool SetAppIdForPropertyStore(IPropertyStore* property_store, + const wchar_t* app_id) { + // App id should be less than 128 chars and contain no space. And recommended + // format is CompanyName.ProductName[.SubProduct.ProductNumber]. + // See http://msdn.microsoft.com/en-us/library/dd378459%28VS.85%29.aspx + DCHECK(lstrlen(app_id) < 128 && wcschr(app_id, L' ') == NULL); + + return SetStringValueForPropertyStore(property_store, + PKEY_AppUserModel_ID, + app_id); +} + static const char16 kAutoRunKeyPath[] = L"Software\\Microsoft\\Windows\\CurrentVersion\\Run"; |