ole32: Move the opening of the AppId key for a clsid to a helper function.
This commit is contained in:
parent
619ba90dbe
commit
83d24a6408
@ -1108,6 +1108,43 @@ HRESULT COM_OpenKeyForCLSID(REFCLSID clsid, LPCWSTR keyname, REGSAM access, HKEY
|
|||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* open HKCR\\AppId\\{string form of appid clsid} key */
|
||||||
|
HRESULT COM_OpenKeyForAppIdFromCLSID(REFCLSID clsid, REGSAM access, HKEY *subkey)
|
||||||
|
{
|
||||||
|
static const WCHAR szAppId[] = { 'A','p','p','I','d',0 };
|
||||||
|
static const WCHAR szAppIdKey[] = { 'A','p','p','I','d','\\',0 };
|
||||||
|
DWORD res;
|
||||||
|
WCHAR buf[CHARS_IN_GUID];
|
||||||
|
WCHAR keyname[ARRAYSIZE(szAppIdKey) + CHARS_IN_GUID];
|
||||||
|
DWORD size;
|
||||||
|
HKEY hkey;
|
||||||
|
DWORD type;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
/* read the AppID value under the class's key */
|
||||||
|
hr = COM_OpenKeyForCLSID(clsid, szAppId, KEY_READ, &hkey);
|
||||||
|
if (FAILED(hr))
|
||||||
|
return hr;
|
||||||
|
|
||||||
|
size = sizeof(buf);
|
||||||
|
res = RegQueryValueExW(hkey, NULL, NULL, &type, (LPBYTE)buf, &size);
|
||||||
|
RegCloseKey(hkey);
|
||||||
|
if (res == ERROR_FILE_NOT_FOUND)
|
||||||
|
return REGDB_E_KEYMISSING;
|
||||||
|
else if (res != ERROR_SUCCESS || type!=REG_SZ)
|
||||||
|
return REGDB_E_READREGDB;
|
||||||
|
|
||||||
|
strcpyW(keyname, szAppIdKey);
|
||||||
|
strcatW(keyname, buf);
|
||||||
|
res = RegOpenKeyExW(HKEY_CLASSES_ROOT, keyname, 0, access, subkey);
|
||||||
|
if (res == ERROR_FILE_NOT_FOUND)
|
||||||
|
return REGDB_E_KEYMISSING;
|
||||||
|
else if (res != ERROR_SUCCESS)
|
||||||
|
return REGDB_E_READREGDB;
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* ProgIDFromCLSID [OLE32.@]
|
* ProgIDFromCLSID [OLE32.@]
|
||||||
*
|
*
|
||||||
|
@ -178,6 +178,7 @@ extern void* StdGlobalInterfaceTableInstance;
|
|||||||
extern HRESULT WINE_StringFromCLSID(const CLSID *id,LPSTR idstr);
|
extern HRESULT WINE_StringFromCLSID(const CLSID *id,LPSTR idstr);
|
||||||
|
|
||||||
HRESULT COM_OpenKeyForCLSID(REFCLSID clsid, LPCWSTR keyname, REGSAM access, HKEY *key);
|
HRESULT COM_OpenKeyForCLSID(REFCLSID clsid, LPCWSTR keyname, REGSAM access, HKEY *key);
|
||||||
|
HRESULT COM_OpenKeyForAppIdFromCLSID(REFCLSID clsid, REGSAM access, HKEY *subkey);
|
||||||
HRESULT MARSHAL_GetStandardMarshalCF(LPVOID *ppv);
|
HRESULT MARSHAL_GetStandardMarshalCF(LPVOID *ppv);
|
||||||
HRESULT FTMarshalCF_Create(REFIID riid, LPVOID *ppv);
|
HRESULT FTMarshalCF_Create(REFIID riid, LPVOID *ppv);
|
||||||
|
|
||||||
|
@ -796,9 +796,7 @@ static DWORD start_local_service(LPCWSTR name, DWORD num, LPCWSTR *params)
|
|||||||
static HRESULT create_local_service(REFCLSID rclsid)
|
static HRESULT create_local_service(REFCLSID rclsid)
|
||||||
{
|
{
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
WCHAR buf[CHARS_IN_GUID], keyname[50];
|
WCHAR buf[CHARS_IN_GUID];
|
||||||
static const WCHAR szAppId[] = { 'A','p','p','I','d',0 };
|
|
||||||
static const WCHAR szAppIdKey[] = { 'A','p','p','I','d','\\',0 };
|
|
||||||
static const WCHAR szLocalService[] = { 'L','o','c','a','l','S','e','r','v','i','c','e',0 };
|
static const WCHAR szLocalService[] = { 'L','o','c','a','l','S','e','r','v','i','c','e',0 };
|
||||||
static const WCHAR szServiceParams[] = {'S','e','r','v','i','c','e','P','a','r','a','m','s',0};
|
static const WCHAR szServiceParams[] = {'S','e','r','v','i','c','e','P','a','r','a','m','s',0};
|
||||||
HKEY hkey;
|
HKEY hkey;
|
||||||
@ -807,22 +805,11 @@ static HRESULT create_local_service(REFCLSID rclsid)
|
|||||||
|
|
||||||
TRACE("Attempting to start Local service for %s\n", debugstr_guid(rclsid));
|
TRACE("Attempting to start Local service for %s\n", debugstr_guid(rclsid));
|
||||||
|
|
||||||
/* read the AppID value under the class's key */
|
hres = COM_OpenKeyForAppIdFromCLSID(rclsid, KEY_READ, &hkey);
|
||||||
hres = COM_OpenKeyForCLSID(rclsid, szAppId, KEY_READ, &hkey);
|
|
||||||
if (FAILED(hres))
|
if (FAILED(hres))
|
||||||
return hres;
|
return hres;
|
||||||
sz = sizeof buf;
|
|
||||||
r = RegQueryValueExW(hkey, NULL, NULL, &type, (LPBYTE)buf, &sz);
|
|
||||||
RegCloseKey(hkey);
|
|
||||||
if (r!=ERROR_SUCCESS || type!=REG_SZ)
|
|
||||||
return hres;
|
|
||||||
|
|
||||||
/* read the LocalService and ServiceParameters values from the AppID key */
|
/* read the LocalService and ServiceParameters values from the AppID key */
|
||||||
strcpyW(keyname, szAppIdKey);
|
|
||||||
strcatW(keyname, buf);
|
|
||||||
r = RegOpenKeyExW(HKEY_CLASSES_ROOT, keyname, 0, KEY_READ, &hkey);
|
|
||||||
if (r!=ERROR_SUCCESS)
|
|
||||||
return hres;
|
|
||||||
sz = sizeof buf;
|
sz = sizeof buf;
|
||||||
r = RegQueryValueExW(hkey, szLocalService, NULL, &type, (LPBYTE)buf, &sz);
|
r = RegQueryValueExW(hkey, szLocalService, NULL, &type, (LPBYTE)buf, &sz);
|
||||||
if (r==ERROR_SUCCESS && type==REG_SZ)
|
if (r==ERROR_SUCCESS && type==REG_SZ)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user