Factored out the OLE 16 bit allocator from StringFromCLSID.
Implemented ProgIDFromCLSID16.
This commit is contained in:
parent
9b9d85fe4c
commit
99f4890788
|
@ -587,30 +587,27 @@ HRESULT WINE_StringFromCLSID(
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
extern BOOL WINAPI K32WOWCallback16Ex( DWORD vpfn16, DWORD dwFlags,
|
||||||
* StringFromCLSID [COMPOBJ.19]
|
DWORD cbArgs, LPVOID pArgs,
|
||||||
* Converts a GUID into the respective string representation.
|
LPDWORD pdwRetCode );
|
||||||
* The target string is allocated using the OLE IMalloc.
|
|
||||||
* RETURNS
|
|
||||||
* the string representation and HRESULT
|
|
||||||
*/
|
|
||||||
HRESULT WINAPI StringFromCLSID16(
|
|
||||||
REFCLSID id, /* [in] the GUID to be converted */
|
|
||||||
LPOLESTR16 *idstr /* [out] a pointer to a to-be-allocated segmented pointer pointing to the resulting string */
|
|
||||||
|
|
||||||
) {
|
/******************************************************************************
|
||||||
extern BOOL WINAPI K32WOWCallback16Ex( DWORD vpfn16, DWORD dwFlags,
|
* _xmalloc16 [internal]
|
||||||
DWORD cbArgs, LPVOID pArgs, LPDWORD pdwRetCode );
|
* Allocates size bytes from the standard ole16 allocator.
|
||||||
|
*
|
||||||
|
* RETURNS
|
||||||
|
* the allocated segmented pointer and a HRESULT
|
||||||
|
*/
|
||||||
|
HRESULT
|
||||||
|
_xmalloc16(DWORD size, SEGPTR *ptr) {
|
||||||
LPMALLOC16 mllc;
|
LPMALLOC16 mllc;
|
||||||
HRESULT ret;
|
|
||||||
DWORD args[2];
|
DWORD args[2];
|
||||||
|
|
||||||
ret = CoGetMalloc16(0,&mllc);
|
if (CoGetMalloc16(0,&mllc))
|
||||||
if (ret) return ret;
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
args[0] = (DWORD)mllc;
|
args[0] = (DWORD)mllc;
|
||||||
args[1] = 40;
|
args[1] = size;
|
||||||
|
|
||||||
/* No need for a Callback entry, we have WOWCallback16Ex which does
|
/* No need for a Callback entry, we have WOWCallback16Ex which does
|
||||||
* everything we need.
|
* everything we need.
|
||||||
*/
|
*/
|
||||||
|
@ -621,11 +618,33 @@ HRESULT WINAPI StringFromCLSID16(
|
||||||
WCB16_CDECL,
|
WCB16_CDECL,
|
||||||
2*sizeof(DWORD),
|
2*sizeof(DWORD),
|
||||||
(LPVOID)args,
|
(LPVOID)args,
|
||||||
(LPDWORD)idstr
|
(LPDWORD)ptr
|
||||||
)) {
|
)) {
|
||||||
WARN("CallTo16 IMalloc16 failed\n");
|
ERR("CallTo16 IMalloc16 (%ld) failed\n",size);
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* StringFromCLSID [COMPOBJ.19]
|
||||||
|
* Converts a GUID into the respective string representation.
|
||||||
|
* The target string is allocated using the OLE IMalloc.
|
||||||
|
*
|
||||||
|
* RETURNS
|
||||||
|
* the string representation and HRESULT
|
||||||
|
*/
|
||||||
|
|
||||||
|
HRESULT WINAPI StringFromCLSID16(
|
||||||
|
REFCLSID id, /* [in] the GUID to be converted */
|
||||||
|
LPOLESTR16 *idstr /* [out] a pointer to a to-be-allocated segmented pointer pointing to the resulting string */
|
||||||
|
|
||||||
|
) {
|
||||||
|
HRESULT ret;
|
||||||
|
|
||||||
|
ret = _xmalloc16(40,(SEGPTR*)idstr);
|
||||||
|
if (ret != S_OK)
|
||||||
|
return ret;
|
||||||
return WINE_StringFromCLSID(id,MapSL((SEGPTR)*idstr));
|
return WINE_StringFromCLSID(id,MapSL((SEGPTR)*idstr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -730,6 +749,51 @@ HRESULT WINAPI ProgIDFromCLSID(
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* ProgIDFromCLSID [COMPOBJ.62]
|
||||||
|
* Converts a class id into the respective Program ID. (By using a registry lookup)
|
||||||
|
* RETURNS S_OK on success
|
||||||
|
* riid associated with the progid
|
||||||
|
*/
|
||||||
|
HRESULT WINAPI ProgIDFromCLSID16(
|
||||||
|
REFCLSID clsid, /* [in] class id as found in registry */
|
||||||
|
LPOLESTR16 *lplpszProgID/* [out] associated Prog ID */
|
||||||
|
) {
|
||||||
|
char strCLSID[50], *buf, *buf2;
|
||||||
|
DWORD buf2len;
|
||||||
|
HKEY xhkey;
|
||||||
|
HRESULT ret = S_OK;
|
||||||
|
|
||||||
|
WINE_StringFromCLSID(clsid, strCLSID);
|
||||||
|
|
||||||
|
buf = HeapAlloc(GetProcessHeap(), 0, strlen(strCLSID)+14);
|
||||||
|
sprintf(buf,"CLSID\\%s\\ProgID", strCLSID);
|
||||||
|
if (RegOpenKeyA(HKEY_CLASSES_ROOT, buf, &xhkey))
|
||||||
|
ret = REGDB_E_CLASSNOTREG;
|
||||||
|
|
||||||
|
HeapFree(GetProcessHeap(), 0, buf);
|
||||||
|
|
||||||
|
if (ret == S_OK)
|
||||||
|
{
|
||||||
|
buf2 = HeapAlloc(GetProcessHeap(), 0, 255);
|
||||||
|
buf2len = 255;
|
||||||
|
if (RegQueryValueA(xhkey, NULL, buf2, &buf2len))
|
||||||
|
ret = REGDB_E_CLASSNOTREG;
|
||||||
|
|
||||||
|
if (ret == S_OK)
|
||||||
|
{
|
||||||
|
ret = _xmalloc16(buf2len+1, (SEGPTR*)lplpszProgID);
|
||||||
|
if (ret != S_OK)
|
||||||
|
return ret;
|
||||||
|
strcpy(MapSL((SEGPTR)*lplpszProgID),buf2);
|
||||||
|
ret = S_OK;
|
||||||
|
}
|
||||||
|
HeapFree(GetProcessHeap(), 0, buf2);
|
||||||
|
}
|
||||||
|
RegCloseKey(xhkey);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* CLSIDFromProgID [COMPOBJ.61]
|
* CLSIDFromProgID [COMPOBJ.61]
|
||||||
* Converts a program id into the respective GUID. (By using a registry lookup)
|
* Converts a program id into the respective GUID. (By using a registry lookup)
|
||||||
|
|
|
@ -59,7 +59,7 @@
|
||||||
59 stub _IID_IDFRESERVED3
|
59 stub _IID_IDFRESERVED3
|
||||||
60 stub _IID_IMESSAGEFILTER
|
60 stub _IID_IMESSAGEFILTER
|
||||||
61 pascal CLSIDFromProgID(str ptr) CLSIDFromProgID16
|
61 pascal CLSIDFromProgID(str ptr) CLSIDFromProgID16
|
||||||
62 stub PROGIDFROMCLSID
|
62 pascal ProgIDFromCLSID(ptr ptr) ProgIDFromCLSID16
|
||||||
63 pascal CoLockObjectExternal(segptr word word) CoLockObjectExternal16
|
63 pascal CoLockObjectExternal(segptr word word) CoLockObjectExternal16
|
||||||
64 stub _CLSID_STDMARSHAL
|
64 stub _CLSID_STDMARSHAL
|
||||||
65 stub COGETTREATASCLASS
|
65 stub COGETTREATASCLASS
|
||||||
|
|
Loading…
Reference in New Issue