Commit 7b6dd2c9 authored by Alexandre Julliard's avatar Alexandre Julliard

ole32: Get rid of WINE_StringFromCLSID and A->W conversions.

parent 6b40f64e
...@@ -1429,40 +1429,6 @@ HRESULT WINAPI CLSIDFromString(LPOLESTR idstr, CLSID *id ) ...@@ -1429,40 +1429,6 @@ HRESULT WINAPI CLSIDFromString(LPOLESTR idstr, CLSID *id )
return ret; return ret;
} }
/* Converts a GUID into the respective string representation. */
HRESULT WINE_StringFromCLSID(
const CLSID *id, /* [in] GUID to be converted */
LPSTR idstr /* [out] pointer to buffer to contain converted guid */
) {
static const char hex[] = "0123456789ABCDEF";
char *s;
int i;
if (!id)
{ ERR("called with id=Null\n");
*idstr = 0x00;
return E_FAIL;
}
sprintf(idstr, "{%08X-%04X-%04X-%02X%02X-",
id->Data1, id->Data2, id->Data3,
id->Data4[0], id->Data4[1]);
s = &idstr[25];
/* 6 hex bytes */
for (i = 2; i < 8; i++) {
*s++ = hex[id->Data4[i]>>4];
*s++ = hex[id->Data4[i] & 0xf];
}
*s++ = '}';
*s++ = '\0';
TRACE("%p->%s\n", id, idstr);
return S_OK;
}
/****************************************************************************** /******************************************************************************
* StringFromCLSID [OLE32.@] * StringFromCLSID [OLE32.@]
...@@ -1484,20 +1450,13 @@ HRESULT WINE_StringFromCLSID( ...@@ -1484,20 +1450,13 @@ HRESULT WINE_StringFromCLSID(
*/ */
HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR *idstr) HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR *idstr)
{ {
char buf[80];
HRESULT ret; HRESULT ret;
LPMALLOC mllc; LPMALLOC mllc;
if ((ret = CoGetMalloc(0,&mllc))) if ((ret = CoGetMalloc(0,&mllc))) return ret;
return ret; if (!(*idstr = IMalloc_Alloc( mllc, CHARS_IN_GUID * sizeof(WCHAR) ))) return E_OUTOFMEMORY;
StringFromGUID2( id, *idstr, CHARS_IN_GUID );
ret=WINE_StringFromCLSID(id,buf); return S_OK;
if (ret == S_OK) {
DWORD len = MultiByteToWideChar( CP_ACP, 0, buf, -1, NULL, 0 );
*idstr = IMalloc_Alloc( mllc, len * sizeof(WCHAR) );
MultiByteToWideChar( CP_ACP, 0, buf, -1, *idstr, len );
}
return ret;
} }
/****************************************************************************** /******************************************************************************
...@@ -1517,11 +1476,15 @@ HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR *idstr) ...@@ -1517,11 +1476,15 @@ HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR *idstr)
*/ */
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax) INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
{ {
char xguid[80]; static const WCHAR formatW[] = { '{','%','0','8','X','-','%','0','4','X','-',
'%','0','4','X','-','%','0','2','X','%','0','2','X','-',
if (WINE_StringFromCLSID(id,xguid)) '%','0','2','X','%','0','2','X','%','0','2','X','%','0','2','X',
return 0; '%','0','2','X','%','0','2','X','}',0 };
return MultiByteToWideChar( CP_ACP, 0, xguid, -1, str, cmax ); if (cmax < CHARS_IN_GUID) return 0;
sprintfW( str, formatW, id->Data1, id->Data2, id->Data3,
id->Data4[0], id->Data4[1], id->Data4[2], id->Data4[3],
id->Data4[4], id->Data4[5], id->Data4[6], id->Data4[7] );
return CHARS_IN_GUID;
} }
/* open HKCR\\CLSID\\{string form of clsid}\\{keyname} key */ /* open HKCR\\CLSID\\{string form of clsid}\\{keyname} key */
......
...@@ -196,9 +196,6 @@ extern void* StdGlobalInterfaceTable_Construct(void); ...@@ -196,9 +196,6 @@ extern void* StdGlobalInterfaceTable_Construct(void);
extern HRESULT StdGlobalInterfaceTable_GetFactory(LPVOID *ppv); extern HRESULT StdGlobalInterfaceTable_GetFactory(LPVOID *ppv);
extern void* StdGlobalInterfaceTableInstance; extern void* StdGlobalInterfaceTableInstance;
/* FIXME: these shouldn't be needed, except for 16-bit functions */
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 COM_OpenKeyForAppIdFromCLSID(REFCLSID clsid, REGSAM access, HKEY *subkey);
HRESULT MARSHAL_GetStandardMarshalCF(LPVOID *ppv); HRESULT MARSHAL_GetStandardMarshalCF(LPVOID *ppv);
......
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