Commit b68b58e6 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

ole32/comcat: Use wide string constants.

parent d26ad6db
...@@ -67,14 +67,9 @@ static HRESULT CATIDEnumGUID_Construct(REFCLSID rclsid, LPCWSTR impl_req, IEnumC ...@@ -67,14 +67,9 @@ static HRESULT CATIDEnumGUID_Construct(REFCLSID rclsid, LPCWSTR impl_req, IEnumC
/********************************************************************** /**********************************************************************
* File-scope string constants * File-scope string constants
*/ */
static const WCHAR comcat_keyname[] = { static const WCHAR comcat_keyname[] = L"Component Categories";
'C','o','m','p','o','n','e','n','t',' ','C','a','t','e','g','o','r','i','e','s',0 }; static const WCHAR impl_keyname[] = L"Implemented Categories";
static const WCHAR impl_keyname[] = { static const WCHAR req_keyname[] = L"Required Categories";
'I','m','p','l','e','m','e','n','t','e','d',' ','C','a','t','e','g','o','r','i','e','s',0 };
static const WCHAR req_keyname[] = {
'R','e','q','u','i','r','e','d',' ','C','a','t','e','g','o','r','i','e','s',0 };
static const WCHAR clsid_keyname[] = { 'C','L','S','I','D',0 };
/********************************************************************** /**********************************************************************
* COMCAT_RegisterClassCategories * COMCAT_RegisterClassCategories
...@@ -96,7 +91,7 @@ static HRESULT COMCAT_RegisterClassCategories( ...@@ -96,7 +91,7 @@ static HRESULT COMCAT_RegisterClassCategories(
if (FAILED(res)) return res; if (FAILED(res)) return res;
/* Create (or open) the CLSID key. */ /* Create (or open) the CLSID key. */
res = create_classes_key(HKEY_CLASSES_ROOT, clsid_keyname, KEY_READ|KEY_WRITE, &clsid_key); res = create_classes_key(HKEY_CLASSES_ROOT, L"CLSID", KEY_READ|KEY_WRITE, &clsid_key);
if (res != ERROR_SUCCESS) return E_FAIL; if (res != ERROR_SUCCESS) return E_FAIL;
/* Create (or open) the class key. */ /* Create (or open) the class key. */
...@@ -169,7 +164,6 @@ static HRESULT COMCAT_UnRegisterClassCategories( ...@@ -169,7 +164,6 @@ static HRESULT COMCAT_UnRegisterClassCategories(
static HRESULT COMCAT_GetCategoryDesc(HKEY key, LCID lcid, PWCHAR pszDesc, static HRESULT COMCAT_GetCategoryDesc(HKEY key, LCID lcid, PWCHAR pszDesc,
ULONG buf_wchars) ULONG buf_wchars)
{ {
static const WCHAR fmt[] = { '%', 'l', 'X', 0 };
WCHAR valname[5]; WCHAR valname[5];
HRESULT res; HRESULT res;
DWORD type, size = (buf_wchars - 1) * sizeof(WCHAR); DWORD type, size = (buf_wchars - 1) * sizeof(WCHAR);
...@@ -177,7 +171,7 @@ static HRESULT COMCAT_GetCategoryDesc(HKEY key, LCID lcid, PWCHAR pszDesc, ...@@ -177,7 +171,7 @@ static HRESULT COMCAT_GetCategoryDesc(HKEY key, LCID lcid, PWCHAR pszDesc,
if (pszDesc == NULL) return E_INVALIDARG; if (pszDesc == NULL) return E_INVALIDARG;
/* FIXME: lcid comparisons are more complex than this! */ /* FIXME: lcid comparisons are more complex than this! */
wsprintfW(valname, fmt, lcid); wsprintfW(valname, L"%lX", lcid);
res = RegQueryValueExW(key, valname, 0, &type, (LPBYTE)pszDesc, &size); res = RegQueryValueExW(key, valname, 0, &type, (LPBYTE)pszDesc, &size);
if (res != ERROR_SUCCESS || type != REG_SZ) { if (res != ERROR_SUCCESS || type != REG_SZ) {
FIXME("Simplified lcid comparison\n"); FIXME("Simplified lcid comparison\n");
...@@ -341,8 +335,8 @@ static HRESULT WINAPI COMCAT_ICatRegister_RegisterCategories( ...@@ -341,8 +335,8 @@ static HRESULT WINAPI COMCAT_ICatRegister_RegisterCategories(
res = create_classes_key(HKEY_CLASSES_ROOT, comcat_keyname, KEY_READ|KEY_WRITE, &comcat_key); res = create_classes_key(HKEY_CLASSES_ROOT, comcat_keyname, KEY_READ|KEY_WRITE, &comcat_key);
if (res != ERROR_SUCCESS) return E_FAIL; if (res != ERROR_SUCCESS) return E_FAIL;
for (; cCategories; --cCategories, ++rgci) { for (; cCategories; --cCategories, ++rgci)
static const WCHAR fmt[] = { '%', 'l', 'X', 0 }; {
WCHAR keyname[CHARS_IN_GUID]; WCHAR keyname[CHARS_IN_GUID];
WCHAR valname[9]; WCHAR valname[9];
HKEY cat_key; HKEY cat_key;
...@@ -353,7 +347,7 @@ static HRESULT WINAPI COMCAT_ICatRegister_RegisterCategories( ...@@ -353,7 +347,7 @@ static HRESULT WINAPI COMCAT_ICatRegister_RegisterCategories(
if (res != ERROR_SUCCESS) continue; if (res != ERROR_SUCCESS) continue;
/* Set the value for this locale's description. */ /* Set the value for this locale's description. */
wsprintfW(valname, fmt, rgci->lcid); wsprintfW(valname, L"%lX", rgci->lcid);
RegSetValueExW(cat_key, valname, 0, REG_SZ, (const BYTE*)rgci->szDescription, RegSetValueExW(cat_key, valname, 0, REG_SZ, (const BYTE*)rgci->szDescription,
(lstrlenW(rgci->szDescription) + 1) * sizeof(WCHAR)); (lstrlenW(rgci->szDescription) + 1) * sizeof(WCHAR));
...@@ -634,16 +628,12 @@ static HRESULT WINAPI COMCAT_ICatInformation_EnumImplCategoriesOfClass( ...@@ -634,16 +628,12 @@ static HRESULT WINAPI COMCAT_ICatInformation_EnumImplCategoriesOfClass(
REFCLSID rclsid, REFCLSID rclsid,
LPENUMCATID *ppenumCATID) LPENUMCATID *ppenumCATID)
{ {
static const WCHAR postfix[] = { '\\', 'I', 'm', 'p', 'l', 'e', 'm', 'e',
'n', 't', 'e', 'd', ' ', 'C', 'a', 't',
'e', 'g', 'o', 'r', 'i', 'e', 's', 0 };
TRACE("%s\n",debugstr_guid(rclsid)); TRACE("%s\n",debugstr_guid(rclsid));
if (rclsid == NULL || ppenumCATID == NULL) if (rclsid == NULL || ppenumCATID == NULL)
return E_POINTER; return E_POINTER;
return CATIDEnumGUID_Construct(rclsid, postfix, ppenumCATID); return CATIDEnumGUID_Construct(rclsid, L"\\Implemented Categories", ppenumCATID);
} }
/********************************************************************** /**********************************************************************
...@@ -654,16 +644,12 @@ static HRESULT WINAPI COMCAT_ICatInformation_EnumReqCategoriesOfClass( ...@@ -654,16 +644,12 @@ static HRESULT WINAPI COMCAT_ICatInformation_EnumReqCategoriesOfClass(
REFCLSID rclsid, REFCLSID rclsid,
LPENUMCATID *ppenumCATID) LPENUMCATID *ppenumCATID)
{ {
static const WCHAR postfix[] = { '\\', 'R', 'e', 'q', 'u', 'i', 'r', 'e',
'd', ' ', 'C', 'a', 't', 'e', 'g', 'o',
'r', 'i', 'e', 's', 0 };
TRACE("%s\n",debugstr_guid(rclsid)); TRACE("%s\n",debugstr_guid(rclsid));
if (rclsid == NULL || ppenumCATID == NULL) if (rclsid == NULL || ppenumCATID == NULL)
return E_POINTER; return E_POINTER;
return CATIDEnumGUID_Construct(rclsid, postfix, ppenumCATID); return CATIDEnumGUID_Construct(rclsid, L"\\Required Categories", ppenumCATID);
} }
/********************************************************************** /**********************************************************************
...@@ -855,9 +841,6 @@ static HRESULT WINAPI COMCAT_IEnumCATEGORYINFO_Clone( ...@@ -855,9 +841,6 @@ static HRESULT WINAPI COMCAT_IEnumCATEGORYINFO_Clone(
IEnumCATEGORYINFO **ppenum) IEnumCATEGORYINFO **ppenum)
{ {
IEnumCATEGORYINFOImpl *This = impl_from_IEnumCATEGORYINFO(iface); IEnumCATEGORYINFOImpl *This = impl_from_IEnumCATEGORYINFO(iface);
static const WCHAR keyname[] = { 'C', 'o', 'm', 'p', 'o', 'n', 'e', 'n',
't', ' ', 'C', 'a', 't', 'e', 'g', 'o',
'r', 'i', 'e', 's', 0 };
IEnumCATEGORYINFOImpl *new_this; IEnumCATEGORYINFOImpl *new_this;
TRACE("\n"); TRACE("\n");
...@@ -871,7 +854,7 @@ static HRESULT WINAPI COMCAT_IEnumCATEGORYINFO_Clone( ...@@ -871,7 +854,7 @@ static HRESULT WINAPI COMCAT_IEnumCATEGORYINFO_Clone(
new_this->ref = 1; new_this->ref = 1;
new_this->lcid = This->lcid; new_this->lcid = This->lcid;
/* FIXME: could we more efficiently use DuplicateHandle? */ /* FIXME: could we more efficiently use DuplicateHandle? */
open_classes_key(HKEY_CLASSES_ROOT, keyname, KEY_READ, &new_this->key); open_classes_key(HKEY_CLASSES_ROOT, comcat_keyname, KEY_READ, &new_this->key);
new_this->next_index = This->next_index; new_this->next_index = This->next_index;
*ppenum = &new_this->IEnumCATEGORYINFO_iface; *ppenum = &new_this->IEnumCATEGORYINFO_iface;
...@@ -891,7 +874,6 @@ static const IEnumCATEGORYINFOVtbl COMCAT_IEnumCATEGORYINFO_Vtbl = ...@@ -891,7 +874,6 @@ static const IEnumCATEGORYINFOVtbl COMCAT_IEnumCATEGORYINFO_Vtbl =
static HRESULT EnumCATEGORYINFO_Construct(LCID lcid, IEnumCATEGORYINFO **ret) static HRESULT EnumCATEGORYINFO_Construct(LCID lcid, IEnumCATEGORYINFO **ret)
{ {
static const WCHAR keyname[] = {'C','o','m','p','o','n','e','n','t',' ','C','a','t','e','g','o','r','i','e','s',0};
IEnumCATEGORYINFOImpl *This; IEnumCATEGORYINFOImpl *This;
*ret = NULL; *ret = NULL;
...@@ -902,7 +884,7 @@ static HRESULT EnumCATEGORYINFO_Construct(LCID lcid, IEnumCATEGORYINFO **ret) ...@@ -902,7 +884,7 @@ static HRESULT EnumCATEGORYINFO_Construct(LCID lcid, IEnumCATEGORYINFO **ret)
This->IEnumCATEGORYINFO_iface.lpVtbl = &COMCAT_IEnumCATEGORYINFO_Vtbl; This->IEnumCATEGORYINFO_iface.lpVtbl = &COMCAT_IEnumCATEGORYINFO_Vtbl;
This->ref = 1; This->ref = 1;
This->lcid = lcid; This->lcid = lcid;
open_classes_key(HKEY_CLASSES_ROOT, keyname, KEY_READ, &This->key); open_classes_key(HKEY_CLASSES_ROOT, comcat_keyname, KEY_READ, &This->key);
*ret = &This->IEnumCATEGORYINFO_iface; *ret = &This->IEnumCATEGORYINFO_iface;
return S_OK; return S_OK;
...@@ -1043,7 +1025,6 @@ static HRESULT WINAPI CLSIDEnumGUID_Clone( ...@@ -1043,7 +1025,6 @@ static HRESULT WINAPI CLSIDEnumGUID_Clone(
IEnumGUID *iface, IEnumGUID *iface,
IEnumGUID **ppenum) IEnumGUID **ppenum)
{ {
static const WCHAR keynameW[] = {'C','L','S','I','D',0};
CLSID_IEnumGUIDImpl *This = impl_from_IEnumCLSID(iface); CLSID_IEnumGUIDImpl *This = impl_from_IEnumCLSID(iface);
CLSID_IEnumGUIDImpl *cloned; CLSID_IEnumGUIDImpl *cloned;
...@@ -1067,7 +1048,7 @@ static HRESULT WINAPI CLSIDEnumGUID_Clone( ...@@ -1067,7 +1048,7 @@ static HRESULT WINAPI CLSIDEnumGUID_Clone(
memcpy(cloned->categories, This->categories, This->categories->size); memcpy(cloned->categories, This->categories, This->categories->size);
cloned->key = NULL; cloned->key = NULL;
open_classes_key(HKEY_CLASSES_ROOT, keynameW, KEY_READ, &cloned->key); open_classes_key(HKEY_CLASSES_ROOT, L"CLSID", KEY_READ, &cloned->key);
cloned->next_index = This->next_index; cloned->next_index = This->next_index;
*ppenum = &cloned->IEnumGUID_iface; *ppenum = &cloned->IEnumGUID_iface;
...@@ -1087,7 +1068,6 @@ static const IEnumGUIDVtbl CLSIDEnumGUIDVtbl = ...@@ -1087,7 +1068,6 @@ static const IEnumGUIDVtbl CLSIDEnumGUIDVtbl =
static HRESULT CLSIDEnumGUID_Construct(struct class_categories *categories, IEnumCLSID **ret) static HRESULT CLSIDEnumGUID_Construct(struct class_categories *categories, IEnumCLSID **ret)
{ {
static const WCHAR keyname[] = {'C','L','S','I','D',0};
CLSID_IEnumGUIDImpl *This; CLSID_IEnumGUIDImpl *This;
*ret = NULL; *ret = NULL;
...@@ -1098,7 +1078,7 @@ static HRESULT CLSIDEnumGUID_Construct(struct class_categories *categories, IEnu ...@@ -1098,7 +1078,7 @@ static HRESULT CLSIDEnumGUID_Construct(struct class_categories *categories, IEnu
This->IEnumGUID_iface.lpVtbl = &CLSIDEnumGUIDVtbl; This->IEnumGUID_iface.lpVtbl = &CLSIDEnumGUIDVtbl;
This->ref = 1; This->ref = 1;
This->categories = categories; This->categories = categories;
open_classes_key(HKEY_CLASSES_ROOT, keyname, KEY_READ, &This->key); open_classes_key(HKEY_CLASSES_ROOT, L"CLSID", KEY_READ, &This->key);
*ret = &This->IEnumGUID_iface; *ret = &This->IEnumGUID_iface;
...@@ -1265,7 +1245,6 @@ static const IEnumGUIDVtbl CATIDEnumGUIDVtbl = ...@@ -1265,7 +1245,6 @@ static const IEnumGUIDVtbl CATIDEnumGUIDVtbl =
static HRESULT CATIDEnumGUID_Construct(REFCLSID rclsid, LPCWSTR postfix, IEnumGUID **ret) static HRESULT CATIDEnumGUID_Construct(REFCLSID rclsid, LPCWSTR postfix, IEnumGUID **ret)
{ {
static const WCHAR prefixW[] = {'C','L','S','I','D','\\',0};
WCHAR keyname[100], clsidW[CHARS_IN_GUID]; WCHAR keyname[100], clsidW[CHARS_IN_GUID];
CATID_IEnumGUIDImpl *This; CATID_IEnumGUIDImpl *This;
...@@ -1278,7 +1257,7 @@ static HRESULT CATIDEnumGUID_Construct(REFCLSID rclsid, LPCWSTR postfix, IEnumGU ...@@ -1278,7 +1257,7 @@ static HRESULT CATIDEnumGUID_Construct(REFCLSID rclsid, LPCWSTR postfix, IEnumGU
This->IEnumGUID_iface.lpVtbl = &CATIDEnumGUIDVtbl; This->IEnumGUID_iface.lpVtbl = &CATIDEnumGUIDVtbl;
This->ref = 1; This->ref = 1;
lstrcpyW(keyname, prefixW); lstrcpyW(keyname, L"CLSID\\");
lstrcatW(keyname, clsidW); lstrcatW(keyname, clsidW);
lstrcatW(keyname, postfix); lstrcatW(keyname, postfix);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment