1999-09-10 15:52:12 +02:00
|
|
|
/*
|
|
|
|
* OLEAUT32
|
|
|
|
*
|
2002-03-10 00:29:33 +01:00
|
|
|
* Copyright 1999, 2000 Marcus Meissner
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
1999-09-10 15:52:12 +02:00
|
|
|
*/
|
2002-03-10 00:29:33 +01:00
|
|
|
|
1999-09-10 15:52:12 +02:00
|
|
|
#include <string.h>
|
2000-12-19 05:53:20 +01:00
|
|
|
|
2000-02-10 20:03:02 +01:00
|
|
|
#include "windef.h"
|
2000-12-19 05:53:20 +01:00
|
|
|
#include "winbase.h"
|
2000-02-10 20:03:02 +01:00
|
|
|
#include "wingdi.h"
|
1999-09-10 15:52:12 +02:00
|
|
|
#include "winuser.h"
|
|
|
|
#include "winerror.h"
|
2000-08-03 06:22:35 +02:00
|
|
|
|
2000-12-06 02:50:47 +01:00
|
|
|
#include "ole2.h"
|
2001-07-24 02:59:28 +02:00
|
|
|
#include "olectl.h"
|
|
|
|
#include "wine/obj_oleaut.h"
|
|
|
|
#include "wine/obj_olefont.h"
|
2002-02-05 19:11:17 +01:00
|
|
|
|
|
|
|
#include "tmarshal.h"
|
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
#include "wine/debug.h"
|
1999-09-10 15:52:12 +02:00
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
2000-01-23 04:15:25 +01:00
|
|
|
|
|
|
|
static WCHAR _delimiter[2] = {'!',0}; /* default delimiter apparently */
|
|
|
|
static WCHAR *pdelimiter = &_delimiter[0];
|
1999-09-10 15:52:12 +02:00
|
|
|
|
2000-03-24 21:46:04 +01:00
|
|
|
/***********************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* RegisterActiveObject (OLEAUT32.33)
|
2000-03-24 21:46:04 +01:00
|
|
|
*/
|
1999-10-13 14:19:09 +02:00
|
|
|
HRESULT WINAPI RegisterActiveObject(
|
|
|
|
LPUNKNOWN punk,REFCLSID rcid,DWORD dwFlags,LPDWORD pdwRegister
|
|
|
|
) {
|
2000-01-23 04:15:25 +01:00
|
|
|
WCHAR guidbuf[80];
|
|
|
|
HRESULT ret;
|
|
|
|
LPRUNNINGOBJECTTABLE runobtable;
|
|
|
|
LPMONIKER moniker;
|
|
|
|
|
|
|
|
StringFromGUID2(rcid,guidbuf,39);
|
|
|
|
ret = CreateItemMoniker(pdelimiter,guidbuf,&moniker);
|
2002-06-01 01:06:46 +02:00
|
|
|
if (FAILED(ret))
|
2000-01-23 04:15:25 +01:00
|
|
|
return ret;
|
|
|
|
ret = GetRunningObjectTable(0,&runobtable);
|
|
|
|
if (FAILED(ret)) {
|
|
|
|
IMoniker_Release(moniker);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
ret = IRunningObjectTable_Register(runobtable,dwFlags,punk,moniker,pdwRegister);
|
|
|
|
IRunningObjectTable_Release(runobtable);
|
|
|
|
IMoniker_Release(moniker);
|
|
|
|
return ret;
|
1999-10-13 14:19:09 +02:00
|
|
|
}
|
|
|
|
|
2000-03-24 21:46:04 +01:00
|
|
|
/***********************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* RevokeActiveObject (OLEAUT32.34)
|
2000-03-24 21:46:04 +01:00
|
|
|
*/
|
1999-10-13 14:19:09 +02:00
|
|
|
HRESULT WINAPI RevokeActiveObject(DWORD xregister,LPVOID reserved)
|
1999-09-10 15:52:12 +02:00
|
|
|
{
|
2000-01-23 04:15:25 +01:00
|
|
|
LPRUNNINGOBJECTTABLE runobtable;
|
|
|
|
HRESULT ret;
|
|
|
|
|
|
|
|
ret = GetRunningObjectTable(0,&runobtable);
|
|
|
|
if (FAILED(ret)) return ret;
|
|
|
|
ret = IRunningObjectTable_Revoke(runobtable,xregister);
|
|
|
|
if (SUCCEEDED(ret)) ret = S_OK;
|
|
|
|
IRunningObjectTable_Release(runobtable);
|
|
|
|
return ret;
|
1999-10-13 14:19:09 +02:00
|
|
|
}
|
|
|
|
|
2000-03-24 21:46:04 +01:00
|
|
|
/***********************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* GetActiveObject (OLEAUT32.35)
|
2000-03-24 21:46:04 +01:00
|
|
|
*/
|
1999-10-13 14:19:09 +02:00
|
|
|
HRESULT WINAPI GetActiveObject(REFCLSID rcid,LPVOID preserved,LPUNKNOWN *ppunk)
|
|
|
|
{
|
2000-01-23 04:15:25 +01:00
|
|
|
WCHAR guidbuf[80];
|
|
|
|
HRESULT ret;
|
|
|
|
LPRUNNINGOBJECTTABLE runobtable;
|
|
|
|
LPMONIKER moniker;
|
|
|
|
|
|
|
|
StringFromGUID2(rcid,guidbuf,39);
|
|
|
|
ret = CreateItemMoniker(pdelimiter,guidbuf,&moniker);
|
2002-06-01 01:06:46 +02:00
|
|
|
if (FAILED(ret))
|
2000-01-23 04:15:25 +01:00
|
|
|
return ret;
|
|
|
|
ret = GetRunningObjectTable(0,&runobtable);
|
|
|
|
if (FAILED(ret)) {
|
|
|
|
IMoniker_Release(moniker);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
ret = IRunningObjectTable_GetObject(runobtable,moniker,ppunk);
|
|
|
|
IRunningObjectTable_Release(runobtable);
|
|
|
|
IMoniker_Release(moniker);
|
|
|
|
return ret;
|
1999-09-10 15:52:12 +02:00
|
|
|
}
|
1999-12-06 00:52:56 +01:00
|
|
|
|
2001-10-02 20:28:31 +02:00
|
|
|
|
1999-12-06 00:52:56 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* OaBuildVersion [OLEAUT32.170]
|
|
|
|
*
|
|
|
|
* known OLEAUT32.DLL versions:
|
|
|
|
* OLE 2.1 NT 1993-95 10 3023
|
|
|
|
* OLE 2.1 10 3027
|
2001-10-02 20:28:31 +02:00
|
|
|
* Win32s 1.1e 20 4049
|
1999-12-06 00:52:56 +01:00
|
|
|
* OLE 2.20 W95/NT 1993-96 20 4112
|
|
|
|
* OLE 2.20 W95/NT 1993-96 20 4118
|
|
|
|
* OLE 2.20 W95/NT 1993-96 20 4122
|
|
|
|
* OLE 2.30 W95/NT 1993-98 30 4265
|
|
|
|
* OLE 2.40 NT?? 1993-98 40 4267
|
|
|
|
* OLE 2.40 W98 SE orig. file 1993-98 40 4275
|
2001-10-02 20:28:31 +02:00
|
|
|
* OLE 2.40 W2K orig. file 1993-XX 40 4514
|
|
|
|
*
|
|
|
|
* I just decided to use version 2.20 for Win3.1, 2.30 for Win95 & NT 3.51,
|
|
|
|
* and 2.40 for all newer OSs. The build number is maximum, i.e. 0xffff.
|
1999-12-06 00:52:56 +01:00
|
|
|
*/
|
|
|
|
UINT WINAPI OaBuildVersion()
|
|
|
|
{
|
2000-08-14 16:35:01 +02:00
|
|
|
switch(GetVersion() & 0x8000ffff) /* mask off build number */
|
1999-12-06 00:52:56 +01:00
|
|
|
{
|
2000-08-14 16:35:01 +02:00
|
|
|
case 0x80000a03: /* WIN31 */
|
2001-10-02 20:28:31 +02:00
|
|
|
return MAKELONG(0xffff, 20);
|
2000-08-14 16:35:01 +02:00
|
|
|
case 0x00003303: /* NT351 */
|
2001-10-02 20:28:31 +02:00
|
|
|
return MAKELONG(0xffff, 30);
|
|
|
|
case 0x80000004: /* WIN95; I'd like to use the "standard" w95 minor
|
|
|
|
version here (30), but as we still use w95
|
|
|
|
as default winver (which is good IMHO), I better
|
|
|
|
play safe and use the latest value for w95 for now.
|
|
|
|
Change this as soon as default winver gets changed
|
|
|
|
to something more recent */
|
|
|
|
case 0x80000a04: /* WIN98 */
|
2000-08-14 16:35:01 +02:00
|
|
|
case 0x00000004: /* NT40 */
|
2001-10-02 20:28:31 +02:00
|
|
|
case 0x00000005: /* W2K */
|
|
|
|
return MAKELONG(0xffff, 40);
|
2000-08-14 16:35:01 +02:00
|
|
|
default:
|
1999-12-06 00:52:56 +01:00
|
|
|
ERR("Version value not known yet. Please investigate it !\n");
|
|
|
|
return 0x0;
|
|
|
|
}
|
|
|
|
}
|
2000-03-26 15:36:40 +02:00
|
|
|
|
2000-03-28 22:22:59 +02:00
|
|
|
/***********************************************************************
|
2001-07-11 20:56:41 +02:00
|
|
|
* DllRegisterServer (OLEAUT32.320)
|
2000-03-28 22:22:59 +02:00
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
HRESULT WINAPI OLEAUT32_DllRegisterServer() {
|
2000-03-26 15:36:40 +02:00
|
|
|
FIXME("stub!\n");
|
|
|
|
return S_OK;
|
|
|
|
}
|
2000-03-28 22:22:59 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
2001-07-11 20:56:41 +02:00
|
|
|
* DllUnregisterServer (OLEAUT32.321)
|
2000-03-28 22:22:59 +02:00
|
|
|
*/
|
2000-03-26 15:36:40 +02:00
|
|
|
HRESULT WINAPI OLEAUT32_DllUnregisterServer() {
|
|
|
|
FIXME("stub!\n");
|
|
|
|
return S_OK;
|
|
|
|
}
|
2001-07-24 02:59:28 +02:00
|
|
|
|
|
|
|
extern void _get_STDFONT_CF(LPVOID);
|
|
|
|
|
2001-07-26 23:44:23 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* DllGetClassObject (OLEAUT32.1)
|
|
|
|
*/
|
2001-07-24 02:59:28 +02:00
|
|
|
HRESULT WINAPI OLEAUT32_DllGetClassObject(REFCLSID rclsid, REFIID iid,LPVOID *ppv)
|
|
|
|
{
|
|
|
|
*ppv = NULL;
|
|
|
|
if (IsEqualGUID(rclsid,&CLSID_StdFont)) {
|
|
|
|
if (IsEqualGUID(iid,&IID_IClassFactory)) {
|
|
|
|
_get_STDFONT_CF(ppv);
|
|
|
|
IClassFactory_AddRef((IClassFactory*)*ppv);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
}
|
2002-02-05 19:11:17 +01:00
|
|
|
if (IsEqualGUID(rclsid,&CLSID_PSOAInterface)) {
|
|
|
|
if (S_OK==TypeLibFac_DllGetClassObject(rclsid,iid,ppv))
|
|
|
|
return S_OK;
|
|
|
|
/*FALLTHROUGH*/
|
|
|
|
}
|
2001-07-24 02:59:28 +02:00
|
|
|
FIXME("\n\tCLSID:\t%s,\n\tIID:\t%s\n",debugstr_guid(rclsid),debugstr_guid(iid));
|
|
|
|
return CLASS_E_CLASSNOTAVAILABLE;
|
|
|
|
}
|
|
|
|
|
2001-07-26 23:44:23 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* DllCanUnloadNow (OLEAUT32.410)
|
|
|
|
*/
|
2001-07-24 02:59:28 +02:00
|
|
|
HRESULT WINAPI OLEAUT32_DllCanUnloadNow() {
|
|
|
|
FIXME("(), stub!\n");
|
|
|
|
return S_FALSE;
|
|
|
|
}
|