Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/ole32/clipboard.c | 53 +++++++++++++----------------------------- 1 file changed, 16 insertions(+), 37 deletions(-)
diff --git a/dlls/ole32/clipboard.c b/dlls/ole32/clipboard.c index cb6770c05b3..01cfda831f5 100644 --- a/dlls/ole32/clipboard.c +++ b/dlls/ole32/clipboard.c @@ -1743,35 +1743,19 @@ static snapshot *snapshot_construct(DWORD seq_no) */ static void register_clipboard_formats(void) { - static const WCHAR OwnerLink[] = {'O','w','n','e','r','L','i','n','k',0}; - static const WCHAR FileName[] = {'F','i','l','e','N','a','m','e',0}; - static const WCHAR FileNameW[] = {'F','i','l','e','N','a','m','e','W',0}; - static const WCHAR DataObject[] = {'D','a','t','a','O','b','j','e','c','t',0}; - static const WCHAR EmbeddedObject[] = {'E','m','b','e','d','d','e','d',' ','O','b','j','e','c','t',0}; - static const WCHAR EmbedSource[] = {'E','m','b','e','d',' ','S','o','u','r','c','e',0}; - static const WCHAR CustomLinkSource[] = {'C','u','s','t','o','m',' ','L','i','n','k',' ','S','o','u','r','c','e',0}; - static const WCHAR LinkSource[] = {'L','i','n','k',' ','S','o','u','r','c','e',0}; - static const WCHAR ObjectDescriptor[] = {'O','b','j','e','c','t',' ','D','e','s','c','r','i','p','t','o','r',0}; - static const WCHAR LinkSourceDescriptor[] = {'L','i','n','k',' ','S','o','u','r','c','e',' ', - 'D','e','s','c','r','i','p','t','o','r',0}; - static const WCHAR OlePrivateData[] = {'O','l','e',' ','P','r','i','v','a','t','e',' ','D','a','t','a',0}; - - static const WCHAR WineMarshalledDataObject[] = {'W','i','n','e',' ','M','a','r','s','h','a','l','l','e','d',' ', - 'D','a','t','a','O','b','j','e','c','t',0}; - - ownerlink_clipboard_format = RegisterClipboardFormatW(OwnerLink); - filename_clipboard_format = RegisterClipboardFormatW(FileName); - filenameW_clipboard_format = RegisterClipboardFormatW(FileNameW); - dataobject_clipboard_format = RegisterClipboardFormatW(DataObject); - embedded_object_clipboard_format = RegisterClipboardFormatW(EmbeddedObject); - embed_source_clipboard_format = RegisterClipboardFormatW(EmbedSource); - custom_link_source_clipboard_format = RegisterClipboardFormatW(CustomLinkSource); - link_source_clipboard_format = RegisterClipboardFormatW(LinkSource); - object_descriptor_clipboard_format = RegisterClipboardFormatW(ObjectDescriptor); - link_source_descriptor_clipboard_format = RegisterClipboardFormatW(LinkSourceDescriptor); - ole_private_data_clipboard_format = RegisterClipboardFormatW(OlePrivateData); - - wine_marshal_clipboard_format = RegisterClipboardFormatW(WineMarshalledDataObject); + ownerlink_clipboard_format = RegisterClipboardFormatW(L"OwnerLink"); + filename_clipboard_format = RegisterClipboardFormatW(L"FileName"); + filenameW_clipboard_format = RegisterClipboardFormatW(L"FileNameW"); + dataobject_clipboard_format = RegisterClipboardFormatW(L"DataObject"); + embedded_object_clipboard_format = RegisterClipboardFormatW(L"Embedded Object"); + embed_source_clipboard_format = RegisterClipboardFormatW(L"Embed Source"); + custom_link_source_clipboard_format = RegisterClipboardFormatW(L"Custom Link Source"); + link_source_clipboard_format = RegisterClipboardFormatW(L"Link Source"); + object_descriptor_clipboard_format = RegisterClipboardFormatW(L"Object Descriptor"); + link_source_descriptor_clipboard_format = RegisterClipboardFormatW(L"Link Source Descriptor"); + ole_private_data_clipboard_format = RegisterClipboardFormatW(L"Ole Private Data"); + + wine_marshal_clipboard_format = RegisterClipboardFormatW(L"Wine Marshalled DataObject"); }
/*********************************************************************** @@ -2026,9 +2010,6 @@ void OLEClipbrd_UnInitialize(void)
if ( clipbrd ) { - static const WCHAR ole32W[] = {'o','l','e','3','2',0}; - HINSTANCE hinst = GetModuleHandleW(ole32W); - /* OleUninitialize() does not release the reference to the dataobject, so take an additional reference here. This reference is then leaked. */ if (clipbrd->src_data) @@ -2040,7 +2021,7 @@ void OLEClipbrd_UnInitialize(void) if ( clipbrd->window ) { DestroyWindow(clipbrd->window); - UnregisterClassW( clipbrd_wndclass, hinst ); + UnregisterClassW( clipbrd_wndclass, GetModuleHandleW(L"ole32") ); }
IStream_Release(clipbrd->marshal_data); @@ -2115,9 +2096,7 @@ static LRESULT CALLBACK clipbrd_wndproc(HWND hwnd, UINT message, WPARAM wparam, static HWND create_clipbrd_window(void) { WNDCLASSEXW class; - static const WCHAR ole32W[] = {'o','l','e','3','2',0}; - static const WCHAR title[] = {'C','l','i','p','b','o','a','r','d','W','i','n','d','o','w',0}; - HINSTANCE hinst = GetModuleHandleW(ole32W); + HINSTANCE hinst = GetModuleHandleW(L"ole32");
class.cbSize = sizeof(class); class.style = 0; @@ -2134,7 +2113,7 @@ static HWND create_clipbrd_window(void)
RegisterClassExW(&class);
- return CreateWindowW(clipbrd_wndclass, title, WS_POPUP | WS_CLIPSIBLINGS | WS_OVERLAPPED, + return CreateWindowW(clipbrd_wndclass, L"ClipboardWindow", WS_POPUP | WS_CLIPSIBLINGS | WS_OVERLAPPED, 0, 0, 0, 0, HWND_MESSAGE, NULL, hinst, 0); }
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/ole32/comcat.c | 51 +++++++++++++-------------------------------- 1 file changed, 15 insertions(+), 36 deletions(-)
diff --git a/dlls/ole32/comcat.c b/dlls/ole32/comcat.c index 467724c5ba3..e258f8835b0 100644 --- a/dlls/ole32/comcat.c +++ b/dlls/ole32/comcat.c @@ -67,14 +67,9 @@ static HRESULT CATIDEnumGUID_Construct(REFCLSID rclsid, LPCWSTR impl_req, IEnumC /********************************************************************** * File-scope string constants */ -static const WCHAR comcat_keyname[] = { - '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[] = { - '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 }; - +static const WCHAR comcat_keyname[] = L"Component Categories"; +static const WCHAR impl_keyname[] = L"Implemented Categories"; +static const WCHAR req_keyname[] = L"Required Categories";
/********************************************************************** * COMCAT_RegisterClassCategories @@ -96,7 +91,7 @@ static HRESULT COMCAT_RegisterClassCategories( if (FAILED(res)) return res;
/* 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;
/* Create (or open) the class key. */ @@ -169,7 +164,6 @@ static HRESULT COMCAT_UnRegisterClassCategories( static HRESULT COMCAT_GetCategoryDesc(HKEY key, LCID lcid, PWCHAR pszDesc, ULONG buf_wchars) { - static const WCHAR fmt[] = { '%', 'l', 'X', 0 }; WCHAR valname[5]; HRESULT res; DWORD type, size = (buf_wchars - 1) * sizeof(WCHAR); @@ -177,7 +171,7 @@ static HRESULT COMCAT_GetCategoryDesc(HKEY key, LCID lcid, PWCHAR pszDesc, if (pszDesc == NULL) return E_INVALIDARG;
/* 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); if (res != ERROR_SUCCESS || type != REG_SZ) { FIXME("Simplified lcid comparison\n"); @@ -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); if (res != ERROR_SUCCESS) return E_FAIL;
- for (; cCategories; --cCategories, ++rgci) { - static const WCHAR fmt[] = { '%', 'l', 'X', 0 }; + for (; cCategories; --cCategories, ++rgci) + { WCHAR keyname[CHARS_IN_GUID]; WCHAR valname[9]; HKEY cat_key; @@ -353,7 +347,7 @@ static HRESULT WINAPI COMCAT_ICatRegister_RegisterCategories( if (res != ERROR_SUCCESS) continue;
/* 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, (lstrlenW(rgci->szDescription) + 1) * sizeof(WCHAR));
@@ -634,16 +628,12 @@ static HRESULT WINAPI COMCAT_ICatInformation_EnumImplCategoriesOfClass( REFCLSID rclsid, 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));
if (rclsid == NULL || ppenumCATID == NULL) 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( REFCLSID rclsid, 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));
if (rclsid == NULL || ppenumCATID == NULL) 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( IEnumCATEGORYINFO **ppenum) { 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;
TRACE("\n"); @@ -871,7 +854,7 @@ static HRESULT WINAPI COMCAT_IEnumCATEGORYINFO_Clone( new_this->ref = 1; new_this->lcid = This->lcid; /* 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;
*ppenum = &new_this->IEnumCATEGORYINFO_iface; @@ -891,7 +874,6 @@ static const IEnumCATEGORYINFOVtbl COMCAT_IEnumCATEGORYINFO_Vtbl =
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;
*ret = NULL; @@ -902,7 +884,7 @@ static HRESULT EnumCATEGORYINFO_Construct(LCID lcid, IEnumCATEGORYINFO **ret) This->IEnumCATEGORYINFO_iface.lpVtbl = &COMCAT_IEnumCATEGORYINFO_Vtbl; This->ref = 1; 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; return S_OK; @@ -1043,7 +1025,6 @@ static HRESULT WINAPI CLSIDEnumGUID_Clone( IEnumGUID *iface, IEnumGUID **ppenum) { - static const WCHAR keynameW[] = {'C','L','S','I','D',0}; CLSID_IEnumGUIDImpl *This = impl_from_IEnumCLSID(iface); CLSID_IEnumGUIDImpl *cloned;
@@ -1067,7 +1048,7 @@ static HRESULT WINAPI CLSIDEnumGUID_Clone( memcpy(cloned->categories, This->categories, This->categories->size);
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;
*ppenum = &cloned->IEnumGUID_iface; @@ -1087,7 +1068,6 @@ static const IEnumGUIDVtbl CLSIDEnumGUIDVtbl =
static HRESULT CLSIDEnumGUID_Construct(struct class_categories *categories, IEnumCLSID **ret) { - static const WCHAR keyname[] = {'C','L','S','I','D',0}; CLSID_IEnumGUIDImpl *This;
*ret = NULL; @@ -1098,7 +1078,7 @@ static HRESULT CLSIDEnumGUID_Construct(struct class_categories *categories, IEnu This->IEnumGUID_iface.lpVtbl = &CLSIDEnumGUIDVtbl; This->ref = 1; 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;
@@ -1265,7 +1245,6 @@ static const IEnumGUIDVtbl CATIDEnumGUIDVtbl =
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]; CATID_IEnumGUIDImpl *This;
@@ -1278,7 +1257,7 @@ static HRESULT CATIDEnumGUID_Construct(REFCLSID rclsid, LPCWSTR postfix, IEnumGU
This->IEnumGUID_iface.lpVtbl = &CATIDEnumGUIDVtbl; This->ref = 1; - lstrcpyW(keyname, prefixW); + lstrcpyW(keyname, L"CLSID\"); lstrcatW(keyname, clsidW); lstrcatW(keyname, postfix);