source: trunk/src/oleaut32/oleaut.c@ 7916

Last change on this file since 7916 was 7916, checked in by sandervl, 24 years ago

Wine 20020215 resync + added extended logging

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