1 | /*
|
---|
2 | * OLEAUT32
|
---|
3 | *
|
---|
4 | * Copyright 1999, 2000 Marcus Meissner
|
---|
5 | *
|
---|
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.
|
---|
10 | *
|
---|
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.
|
---|
15 | *
|
---|
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
|
---|
19 | */
|
---|
20 | #ifdef __WIN32OS2__
|
---|
21 | #define HAVE_FLOAT_H
|
---|
22 | #define WINE_LARGE_INTEGER
|
---|
23 | #include "oleaut32.h"
|
---|
24 |
|
---|
25 | #endif
|
---|
26 |
|
---|
27 | #include <string.h>
|
---|
28 |
|
---|
29 | #include "windef.h"
|
---|
30 | #include "winbase.h"
|
---|
31 | #include "wingdi.h"
|
---|
32 | #include "winuser.h"
|
---|
33 | #include "winerror.h"
|
---|
34 |
|
---|
35 | #include "ole2.h"
|
---|
36 | #include "olectl.h"
|
---|
37 | #include "wine/obj_oleaut.h"
|
---|
38 | #include "wine/obj_olefont.h"
|
---|
39 |
|
---|
40 | #include "tmarshal.h"
|
---|
41 |
|
---|
42 | #include "wine/debug.h"
|
---|
43 |
|
---|
44 | WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
---|
45 |
|
---|
46 | static WCHAR _delimiter[2] = {'!',0}; /* default delimiter apparently */
|
---|
47 | static WCHAR *pdelimiter = &_delimiter[0];
|
---|
48 |
|
---|
49 | /***********************************************************************
|
---|
50 | * RegisterActiveObject (OLEAUT32.33)
|
---|
51 | */
|
---|
52 | HRESULT WINAPI RegisterActiveObject(
|
---|
53 | LPUNKNOWN punk,REFCLSID rcid,DWORD dwFlags,LPDWORD pdwRegister
|
---|
54 | ) {
|
---|
55 | WCHAR guidbuf[80];
|
---|
56 | HRESULT ret;
|
---|
57 | LPRUNNINGOBJECTTABLE runobtable;
|
---|
58 | LPMONIKER moniker;
|
---|
59 |
|
---|
60 | StringFromGUID2(rcid,guidbuf,39);
|
---|
61 | ret = CreateItemMoniker(pdelimiter,guidbuf,&moniker);
|
---|
62 | if (FAILED(ret))
|
---|
63 | return ret;
|
---|
64 | ret = GetRunningObjectTable(0,&runobtable);
|
---|
65 | if (FAILED(ret)) {
|
---|
66 | IMoniker_Release(moniker);
|
---|
67 | return ret;
|
---|
68 | }
|
---|
69 | ret = IRunningObjectTable_Register(runobtable,dwFlags,punk,moniker,pdwRegister);
|
---|
70 | IRunningObjectTable_Release(runobtable);
|
---|
71 | IMoniker_Release(moniker);
|
---|
72 | return ret;
|
---|
73 | }
|
---|
74 |
|
---|
75 | /***********************************************************************
|
---|
76 | * RevokeActiveObject (OLEAUT32.34)
|
---|
77 | */
|
---|
78 | HRESULT WINAPI RevokeActiveObject(DWORD xregister,LPVOID reserved)
|
---|
79 | {
|
---|
80 | LPRUNNINGOBJECTTABLE runobtable;
|
---|
81 | HRESULT ret;
|
---|
82 |
|
---|
83 | ret = GetRunningObjectTable(0,&runobtable);
|
---|
84 | if (FAILED(ret)) return ret;
|
---|
85 | ret = IRunningObjectTable_Revoke(runobtable,xregister);
|
---|
86 | if (SUCCEEDED(ret)) ret = S_OK;
|
---|
87 | IRunningObjectTable_Release(runobtable);
|
---|
88 | return ret;
|
---|
89 | }
|
---|
90 |
|
---|
91 | /***********************************************************************
|
---|
92 | * GetActiveObject (OLEAUT32.35)
|
---|
93 | */
|
---|
94 | HRESULT WINAPI GetActiveObject(REFCLSID rcid,LPVOID preserved,LPUNKNOWN *ppunk)
|
---|
95 | {
|
---|
96 | WCHAR guidbuf[80];
|
---|
97 | HRESULT ret;
|
---|
98 | LPRUNNINGOBJECTTABLE runobtable;
|
---|
99 | LPMONIKER moniker;
|
---|
100 |
|
---|
101 | StringFromGUID2(rcid,guidbuf,39);
|
---|
102 | ret = CreateItemMoniker(pdelimiter,guidbuf,&moniker);
|
---|
103 | if (FAILED(ret))
|
---|
104 | return ret;
|
---|
105 | ret = GetRunningObjectTable(0,&runobtable);
|
---|
106 | if (FAILED(ret)) {
|
---|
107 | IMoniker_Release(moniker);
|
---|
108 | return ret;
|
---|
109 | }
|
---|
110 | ret = IRunningObjectTable_GetObject(runobtable,moniker,ppunk);
|
---|
111 | IRunningObjectTable_Release(runobtable);
|
---|
112 | IMoniker_Release(moniker);
|
---|
113 | return ret;
|
---|
114 | }
|
---|
115 |
|
---|
116 |
|
---|
117 | /***********************************************************************
|
---|
118 | * OaBuildVersion [OLEAUT32.170]
|
---|
119 | *
|
---|
120 | * known OLEAUT32.DLL versions:
|
---|
121 | * OLE 2.1 NT 1993-95 10 3023
|
---|
122 | * OLE 2.1 10 3027
|
---|
123 | * Win32s 1.1e 20 4049
|
---|
124 | * OLE 2.20 W95/NT 1993-96 20 4112
|
---|
125 | * OLE 2.20 W95/NT 1993-96 20 4118
|
---|
126 | * OLE 2.20 W95/NT 1993-96 20 4122
|
---|
127 | * OLE 2.30 W95/NT 1993-98 30 4265
|
---|
128 | * OLE 2.40 NT?? 1993-98 40 4267
|
---|
129 | * OLE 2.40 W98 SE orig. file 1993-98 40 4275
|
---|
130 | * OLE 2.40 W2K orig. file 1993-XX 40 4514
|
---|
131 | *
|
---|
132 | * I just decided to use version 2.20 for Win3.1, 2.30 for Win95 & NT 3.51,
|
---|
133 | * and 2.40 for all newer OSs. The build number is maximum, i.e. 0xffff.
|
---|
134 | */
|
---|
135 | UINT WINAPI OaBuildVersion()
|
---|
136 | {
|
---|
137 | switch(GetVersion() & 0x8000ffff) /* mask off build number */
|
---|
138 | {
|
---|
139 | case 0x80000a03: /* WIN31 */
|
---|
140 | return MAKELONG(0xffff, 20);
|
---|
141 | case 0x00003303: /* NT351 */
|
---|
142 | return MAKELONG(0xffff, 30);
|
---|
143 | case 0x80000004: /* WIN95; I'd like to use the "standard" w95 minor
|
---|
144 | version here (30), but as we still use w95
|
---|
145 | as default winver (which is good IMHO), I better
|
---|
146 | play safe and use the latest value for w95 for now.
|
---|
147 | Change this as soon as default winver gets changed
|
---|
148 | to something more recent */
|
---|
149 | case 0x80000a04: /* WIN98 */
|
---|
150 | case 0x00000004: /* NT40 */
|
---|
151 | case 0x00000005: /* W2K */
|
---|
152 | return MAKELONG(0xffff, 40);
|
---|
153 | default:
|
---|
154 | ERR("Version value not known yet. Please investigate it !\n");
|
---|
155 | return 0x0;
|
---|
156 | }
|
---|
157 | }
|
---|
158 |
|
---|
159 | /***********************************************************************
|
---|
160 | * DllRegisterServer (OLEAUT32.320)
|
---|
161 | */
|
---|
162 | HRESULT WINAPI OLEAUT32_DllRegisterServer() {
|
---|
163 | FIXME("stub!\n");
|
---|
164 | return S_OK;
|
---|
165 | }
|
---|
166 |
|
---|
167 | /***********************************************************************
|
---|
168 | * DllUnregisterServer (OLEAUT32.321)
|
---|
169 | */
|
---|
170 | HRESULT WINAPI OLEAUT32_DllUnregisterServer() {
|
---|
171 | FIXME("stub!\n");
|
---|
172 | return S_OK;
|
---|
173 | }
|
---|
174 |
|
---|
175 | extern void _get_STDFONT_CF(LPVOID);
|
---|
176 |
|
---|
177 | /***********************************************************************
|
---|
178 | * DllGetClassObject (OLEAUT32.1)
|
---|
179 | */
|
---|
180 | HRESULT WINAPI OLEAUT32_DllGetClassObject(REFCLSID rclsid, REFIID iid,LPVOID *ppv)
|
---|
181 | {
|
---|
182 | *ppv = NULL;
|
---|
183 | if (IsEqualGUID(rclsid,&CLSID_StdFont)) {
|
---|
184 | if (IsEqualGUID(iid,&IID_IClassFactory)) {
|
---|
185 | _get_STDFONT_CF(ppv);
|
---|
186 | IClassFactory_AddRef((IClassFactory*)*ppv);
|
---|
187 | return S_OK;
|
---|
188 | }
|
---|
189 | }
|
---|
190 | if (IsEqualGUID(rclsid,&CLSID_PSOAInterface)) {
|
---|
191 | if (S_OK==TypeLibFac_DllGetClassObject(rclsid,iid,ppv))
|
---|
192 | return S_OK;
|
---|
193 | /*FALLTHROUGH*/
|
---|
194 | }
|
---|
195 | FIXME("\n\tCLSID:\t%s,\n\tIID:\t%s\n",debugstr_guid(rclsid),debugstr_guid(iid));
|
---|
196 | return CLASS_E_CLASSNOTAVAILABLE;
|
---|
197 | }
|
---|
198 |
|
---|
199 | /***********************************************************************
|
---|
200 | * DllCanUnloadNow (OLEAUT32.410)
|
---|
201 | */
|
---|
202 | HRESULT WINAPI OLEAUT32_DllCanUnloadNow() {
|
---|
203 | FIXME("(), stub!\n");
|
---|
204 | return S_FALSE;
|
---|
205 | }
|
---|