Commit 98505b40 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

ole32: Simplify OleRegGetUserType() using existing helper.

parent 1219abfd
...@@ -677,47 +677,26 @@ HRESULT WINAPI OleRegGetUserType( ...@@ -677,47 +677,26 @@ HRESULT WINAPI OleRegGetUserType(
DWORD dwFormOfType, DWORD dwFormOfType,
LPOLESTR* pszUserType) LPOLESTR* pszUserType)
{ {
WCHAR keyName[60];
DWORD dwKeyType; DWORD dwKeyType;
DWORD cbData; DWORD cbData;
HKEY clsidKey; HKEY clsidKey;
LONG hres; HRESULT hres;
LONG ret;
/*
* Initialize the out parameter.
*/
*pszUserType = NULL;
/* TRACE("(%s, %d, %p)\n", debugstr_guid(clsid), dwFormOfType, pszUserType);
* Build the key name we're looking for
*/
sprintfW( keyName, clsidfmtW,
clsid->Data1, clsid->Data2, clsid->Data3,
clsid->Data4[0], clsid->Data4[1], clsid->Data4[2], clsid->Data4[3],
clsid->Data4[4], clsid->Data4[5], clsid->Data4[6], clsid->Data4[7] );
TRACE("(%s, %d, %p)\n", debugstr_w(keyName), dwFormOfType, pszUserType); *pszUserType = NULL;
/* hres = COM_OpenKeyForCLSID(clsid, NULL, KEY_READ, &clsidKey);
* Open the class id Key if (FAILED(hres))
*/ return hres;
hres = open_classes_key(HKEY_CLASSES_ROOT, keyName, MAXIMUM_ALLOWED, &clsidKey);
if (hres != ERROR_SUCCESS)
return REGDB_E_CLASSNOTREG;
/* /*
* Retrieve the size of the name string. * Retrieve the size of the name string.
*/ */
cbData = 0; cbData = 0;
hres = RegQueryValueExW(clsidKey, if (RegQueryValueExW(clsidKey, emptyW, NULL, &dwKeyType, NULL, &cbData))
emptyW,
NULL,
&dwKeyType,
NULL,
&cbData);
if (hres!=ERROR_SUCCESS)
{ {
RegCloseKey(clsidKey); RegCloseKey(clsidKey);
return REGDB_E_READREGDB; return REGDB_E_READREGDB;
...@@ -734,7 +713,7 @@ HRESULT WINAPI OleRegGetUserType( ...@@ -734,7 +713,7 @@ HRESULT WINAPI OleRegGetUserType(
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
hres = RegQueryValueExW(clsidKey, ret = RegQueryValueExW(clsidKey,
emptyW, emptyW,
NULL, NULL,
&dwKeyType, &dwKeyType,
...@@ -743,11 +722,10 @@ HRESULT WINAPI OleRegGetUserType( ...@@ -743,11 +722,10 @@ HRESULT WINAPI OleRegGetUserType(
RegCloseKey(clsidKey); RegCloseKey(clsidKey);
if (hres != ERROR_SUCCESS) if (ret != ERROR_SUCCESS)
{ {
CoTaskMemFree(*pszUserType); CoTaskMemFree(*pszUserType);
*pszUserType = NULL; *pszUserType = NULL;
return REGDB_E_READREGDB; return REGDB_E_READREGDB;
} }
......
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