Commit ae4f72f5 authored by Andreas Mohr's avatar Andreas Mohr Committed by Alexandre Julliard

Take a stab at implementing OleSetAutoConvert.

parent 33c24891
...@@ -1976,21 +1976,68 @@ BOOL WINAPI COMPOBJ_DllEntryPoint(DWORD Reason, HINSTANCE16 hInst, WORD ds, WORD ...@@ -1976,21 +1976,68 @@ BOOL WINAPI COMPOBJ_DllEntryPoint(DWORD Reason, HINSTANCE16 hInst, WORD ds, WORD
*/ */
HRESULT WINAPI OleGetAutoConvert(REFCLSID clsidOld, LPCLSID pClsidNew) HRESULT WINAPI OleGetAutoConvert(REFCLSID clsidOld, LPCLSID pClsidNew)
{ {
HKEY hkey; HKEY hkey = 0;
char buf[200]; char buf[200];
WCHAR wbuf[200]; WCHAR wbuf[200];
DWORD len; DWORD len;
HRESULT res = S_OK;
sprintf(buf,"CLSID\\");WINE_StringFromCLSID(clsidOld,&buf[6]);
if (RegOpenKeyA(HKEY_CLASSES_ROOT,buf,&hkey)) sprintf(buf,"CLSID\\");WINE_StringFromCLSID(clsidOld,&buf[6]);
return REGDB_E_CLASSNOTREG; if (RegOpenKeyA(HKEY_CLASSES_ROOT,buf,&hkey))
len = 200; {
if (RegQueryValueA(hkey,"AutoConvertTo",buf,&len)) res = REGDB_E_CLASSNOTREG;
return REGDB_E_KEYMISSING; goto done;
RegCloseKey(hkey); }
MultiByteToWideChar( CP_ACP, 0, buf, -1, wbuf, sizeof(wbuf)/sizeof(WCHAR) ); len = 200;
CLSIDFromString(wbuf,pClsidNew); /* we can just query for the default value of AutoConvertTo key like that,
return S_OK; without opening the AutoConvertTo key and querying for NULL (default) */
if (RegQueryValueA(hkey,"AutoConvertTo",buf,&len))
{
res = REGDB_E_KEYMISSING;
goto done;
}
MultiByteToWideChar( CP_ACP, 0, buf, -1, wbuf, sizeof(wbuf)/sizeof(WCHAR) );
CLSIDFromString(wbuf,pClsidNew);
done:
if (hkey) RegCloseKey(hkey);
return res;
}
/******************************************************************************
* OleSetAutoConvert [OLE32.126]
*/
HRESULT WINAPI OleSetAutoConvert(REFCLSID clsidOld, REFCLSID clsidNew)
{
HKEY hkey = 0, hkeyConvert = 0;
char buf[200], szClsidNew[200];
HRESULT res = S_OK;
TRACE("(%p,%p);\n", clsidOld, clsidNew);
sprintf(buf,"CLSID\\");WINE_StringFromCLSID(clsidOld,&buf[6]);
WINE_StringFromCLSID(clsidNew, szClsidNew);
if (RegOpenKeyA(HKEY_CLASSES_ROOT,buf,&hkey))
{
res = REGDB_E_CLASSNOTREG;
goto done;
}
if (RegCreateKeyA(hkey, "AutoConvertTo", &hkeyConvert))
{
res = REGDB_E_WRITEREGDB;
goto done;
}
if (RegSetValueExA(hkeyConvert, NULL, 0,
REG_SZ, (LPBYTE)szClsidNew, strlen(szClsidNew)+1))
{
res = REGDB_E_WRITEREGDB;
goto done;
}
done:
if (hkeyConvert) RegCloseKey(hkeyConvert);
if (hkey) RegCloseKey(hkey);
return res;
} }
/*********************************************************************** /***********************************************************************
......
...@@ -67,15 +67,6 @@ HRESULT WINAPI CoTreatAsClass(REFCLSID clsidOld, REFCLSID clsidNew) ...@@ -67,15 +67,6 @@ HRESULT WINAPI CoTreatAsClass(REFCLSID clsidOld, REFCLSID clsidNew)
} }
/****************************************************************************** /******************************************************************************
* OleSetAutoConvert [OLE32.@]
*/
HRESULT WINAPI OleSetAutoConvert(REFCLSID clsidOld, REFCLSID clsidNew)
{
FIXME("(%p,%p), stub!\n", clsidOld, clsidNew);
return S_OK;
}
/******************************************************************************
* IsAccelerator [OLE32.75] * IsAccelerator [OLE32.75]
*/ */
BOOL WINAPI IsAccelerator(HACCEL hAccel, int cAccelEntries, LPMSG lpMsg, WORD* lpwCmd) BOOL WINAPI IsAccelerator(HACCEL hAccel, int cAccelEntries, LPMSG lpMsg, WORD* lpwCmd)
......
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