Added the DFCS_{HOT,TRANSPARENT} definitions.
[wine/gsoc_dplay.git] / dlls / oleaut32 / oleaut.c
blob30b74551ed67e292f479202c8a33e7994cfa6780
1 /*
2 * OLEAUT32
4 * Copyright 1999, 2000 Marcus Meissner
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include <string.h>
23 #include "windef.h"
24 #include "winbase.h"
25 #include "wingdi.h"
26 #include "winuser.h"
27 #include "winerror.h"
29 #include "ole2.h"
30 #include "olectl.h"
31 #include "wine/obj_oleaut.h"
32 #include "wine/obj_olefont.h"
34 #include "tmarshal.h"
36 #include "wine/debug.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(ole);
40 static WCHAR _delimiter[2] = {'!',0}; /* default delimiter apparently */
41 static WCHAR *pdelimiter = &_delimiter[0];
43 /***********************************************************************
44 * RegisterActiveObject (OLEAUT32.33)
46 HRESULT WINAPI RegisterActiveObject(
47 LPUNKNOWN punk,REFCLSID rcid,DWORD dwFlags,LPDWORD pdwRegister
48 ) {
49 WCHAR guidbuf[80];
50 HRESULT ret;
51 LPRUNNINGOBJECTTABLE runobtable;
52 LPMONIKER moniker;
54 StringFromGUID2(rcid,guidbuf,39);
55 ret = CreateItemMoniker(pdelimiter,guidbuf,&moniker);
56 if (FAILED(ret))
57 return ret;
58 ret = GetRunningObjectTable(0,&runobtable);
59 if (FAILED(ret)) {
60 IMoniker_Release(moniker);
61 return ret;
63 ret = IRunningObjectTable_Register(runobtable,dwFlags,punk,moniker,pdwRegister);
64 IRunningObjectTable_Release(runobtable);
65 IMoniker_Release(moniker);
66 return ret;
69 /***********************************************************************
70 * RevokeActiveObject (OLEAUT32.34)
72 HRESULT WINAPI RevokeActiveObject(DWORD xregister,LPVOID reserved)
74 LPRUNNINGOBJECTTABLE runobtable;
75 HRESULT ret;
77 ret = GetRunningObjectTable(0,&runobtable);
78 if (FAILED(ret)) return ret;
79 ret = IRunningObjectTable_Revoke(runobtable,xregister);
80 if (SUCCEEDED(ret)) ret = S_OK;
81 IRunningObjectTable_Release(runobtable);
82 return ret;
85 /***********************************************************************
86 * GetActiveObject (OLEAUT32.35)
88 HRESULT WINAPI GetActiveObject(REFCLSID rcid,LPVOID preserved,LPUNKNOWN *ppunk)
90 WCHAR guidbuf[80];
91 HRESULT ret;
92 LPRUNNINGOBJECTTABLE runobtable;
93 LPMONIKER moniker;
95 StringFromGUID2(rcid,guidbuf,39);
96 ret = CreateItemMoniker(pdelimiter,guidbuf,&moniker);
97 if (FAILED(ret))
98 return ret;
99 ret = GetRunningObjectTable(0,&runobtable);
100 if (FAILED(ret)) {
101 IMoniker_Release(moniker);
102 return ret;
104 ret = IRunningObjectTable_GetObject(runobtable,moniker,ppunk);
105 IRunningObjectTable_Release(runobtable);
106 IMoniker_Release(moniker);
107 return ret;
111 /***********************************************************************
112 * OaBuildVersion [OLEAUT32.170]
114 * known OLEAUT32.DLL versions:
115 * OLE 2.1 NT 1993-95 10 3023
116 * OLE 2.1 10 3027
117 * Win32s 1.1e 20 4049
118 * OLE 2.20 W95/NT 1993-96 20 4112
119 * OLE 2.20 W95/NT 1993-96 20 4118
120 * OLE 2.20 W95/NT 1993-96 20 4122
121 * OLE 2.30 W95/NT 1993-98 30 4265
122 * OLE 2.40 NT?? 1993-98 40 4267
123 * OLE 2.40 W98 SE orig. file 1993-98 40 4275
124 * OLE 2.40 W2K orig. file 1993-XX 40 4514
126 * I just decided to use version 2.20 for Win3.1, 2.30 for Win95 & NT 3.51,
127 * and 2.40 for all newer OSs. The build number is maximum, i.e. 0xffff.
129 UINT WINAPI OaBuildVersion()
131 switch(GetVersion() & 0x8000ffff) /* mask off build number */
133 case 0x80000a03: /* WIN31 */
134 return MAKELONG(0xffff, 20);
135 case 0x00003303: /* NT351 */
136 return MAKELONG(0xffff, 30);
137 case 0x80000004: /* WIN95; I'd like to use the "standard" w95 minor
138 version here (30), but as we still use w95
139 as default winver (which is good IMHO), I better
140 play safe and use the latest value for w95 for now.
141 Change this as soon as default winver gets changed
142 to something more recent */
143 case 0x80000a04: /* WIN98 */
144 case 0x00000004: /* NT40 */
145 case 0x00000005: /* W2K */
146 return MAKELONG(0xffff, 40);
147 default:
148 ERR("Version value not known yet. Please investigate it !\n");
149 return 0x0;
153 /***********************************************************************
154 * DllRegisterServer (OLEAUT32.320)
156 HRESULT WINAPI OLEAUT32_DllRegisterServer() {
157 FIXME("stub!\n");
158 return S_OK;
161 /***********************************************************************
162 * DllUnregisterServer (OLEAUT32.321)
164 HRESULT WINAPI OLEAUT32_DllUnregisterServer() {
165 FIXME("stub!\n");
166 return S_OK;
169 extern void _get_STDFONT_CF(LPVOID);
171 /***********************************************************************
172 * DllGetClassObject (OLEAUT32.1)
174 HRESULT WINAPI OLEAUT32_DllGetClassObject(REFCLSID rclsid, REFIID iid,LPVOID *ppv)
176 *ppv = NULL;
177 if (IsEqualGUID(rclsid,&CLSID_StdFont)) {
178 if (IsEqualGUID(iid,&IID_IClassFactory)) {
179 _get_STDFONT_CF(ppv);
180 IClassFactory_AddRef((IClassFactory*)*ppv);
181 return S_OK;
184 if (IsEqualGUID(rclsid,&CLSID_PSOAInterface)) {
185 if (S_OK==TypeLibFac_DllGetClassObject(rclsid,iid,ppv))
186 return S_OK;
187 /*FALLTHROUGH*/
189 FIXME("\n\tCLSID:\t%s,\n\tIID:\t%s\n",debugstr_guid(rclsid),debugstr_guid(iid));
190 return CLASS_E_CLASSNOTAVAILABLE;
193 /***********************************************************************
194 * DllCanUnloadNow (OLEAUT32.410)
196 HRESULT WINAPI OLEAUT32_DllCanUnloadNow() {
197 FIXME("(), stub!\n");
198 return S_FALSE;