Take a stab at implementing OleSetAutoConvert.

This commit is contained in:
Andreas Mohr 2001-02-12 01:26:16 +00:00 committed by Alexandre Julliard
parent 33c24891b9
commit ae4f72f5be
2 changed files with 61 additions and 23 deletions

View File

@ -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]); sprintf(buf,"CLSID\\");WINE_StringFromCLSID(clsidOld,&buf[6]);
if (RegOpenKeyA(HKEY_CLASSES_ROOT,buf,&hkey)) if (RegOpenKeyA(HKEY_CLASSES_ROOT,buf,&hkey))
return REGDB_E_CLASSNOTREG; {
len = 200; res = REGDB_E_CLASSNOTREG;
if (RegQueryValueA(hkey,"AutoConvertTo",buf,&len)) goto done;
return REGDB_E_KEYMISSING; }
RegCloseKey(hkey); len = 200;
MultiByteToWideChar( CP_ACP, 0, buf, -1, wbuf, sizeof(wbuf)/sizeof(WCHAR) ); /* we can just query for the default value of AutoConvertTo key like that,
CLSIDFromString(wbuf,pClsidNew); without opening the AutoConvertTo key and querying for NULL (default) */
return S_OK; 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;
} }
/*********************************************************************** /***********************************************************************

View File

@ -66,15 +66,6 @@ HRESULT WINAPI CoTreatAsClass(REFCLSID clsidOld, REFCLSID clsidNew)
return S_OK; return S_OK;
} }
/******************************************************************************
* 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]
*/ */