Add the decVal field to VARIANT.
[wine] / dlls / oleaut32 / oleaut.c
1 /*
2  *      OLEAUT32
3  *
4  */
5 #include <string.h>
6
7 #include "windef.h"
8 #include "winbase.h"
9 #include "wingdi.h"
10 #include "winuser.h"
11 #include "winerror.h"
12
13 #include "ole2.h"
14 #include "olectl.h"
15 #include "wine/obj_oleaut.h"
16 #include "wine/obj_olefont.h"
17 #include "debugtools.h"
18
19 DEFAULT_DEBUG_CHANNEL(ole);
20
21 static WCHAR    _delimiter[2] = {'!',0}; /* default delimiter apparently */
22 static WCHAR    *pdelimiter = &_delimiter[0];
23
24 /***********************************************************************
25  *              RegisterActiveObject (OLEAUT32.33)
26  */
27 HRESULT WINAPI RegisterActiveObject(
28         LPUNKNOWN punk,REFCLSID rcid,DWORD dwFlags,LPDWORD pdwRegister
29 ) {
30         WCHAR                   guidbuf[80];
31         HRESULT                 ret;
32         LPRUNNINGOBJECTTABLE    runobtable;
33         LPMONIKER               moniker;
34
35         StringFromGUID2(rcid,guidbuf,39);
36         ret = CreateItemMoniker(pdelimiter,guidbuf,&moniker);
37         if (FAILED(ret)) 
38                 return ret;
39         ret = GetRunningObjectTable(0,&runobtable);
40         if (FAILED(ret)) {
41                 IMoniker_Release(moniker);
42                 return ret;
43         }
44         ret = IRunningObjectTable_Register(runobtable,dwFlags,punk,moniker,pdwRegister);
45         IRunningObjectTable_Release(runobtable);
46         IMoniker_Release(moniker);
47         return ret;
48 }
49
50 /***********************************************************************
51  *              RevokeActiveObject (OLEAUT32.34)
52  */
53 HRESULT WINAPI RevokeActiveObject(DWORD xregister,LPVOID reserved)
54 {
55         LPRUNNINGOBJECTTABLE    runobtable;
56         HRESULT                 ret;
57
58         ret = GetRunningObjectTable(0,&runobtable);
59         if (FAILED(ret)) return ret;
60         ret = IRunningObjectTable_Revoke(runobtable,xregister);
61         if (SUCCEEDED(ret)) ret = S_OK;
62         IRunningObjectTable_Release(runobtable);
63         return ret;
64 }
65
66 /***********************************************************************
67  *              GetActiveObject (OLEAUT32.35)
68  */
69 HRESULT WINAPI GetActiveObject(REFCLSID rcid,LPVOID preserved,LPUNKNOWN *ppunk)
70 {
71         WCHAR                   guidbuf[80];
72         HRESULT                 ret;
73         LPRUNNINGOBJECTTABLE    runobtable;
74         LPMONIKER               moniker;
75
76         StringFromGUID2(rcid,guidbuf,39);
77         ret = CreateItemMoniker(pdelimiter,guidbuf,&moniker);
78         if (FAILED(ret)) 
79                 return ret;
80         ret = GetRunningObjectTable(0,&runobtable);
81         if (FAILED(ret)) {
82                 IMoniker_Release(moniker);
83                 return ret;
84         }
85         ret = IRunningObjectTable_GetObject(runobtable,moniker,ppunk);
86         IRunningObjectTable_Release(runobtable);
87         IMoniker_Release(moniker);
88         return ret;
89 }
90
91 /***********************************************************************
92  *           OaBuildVersion           [OLEAUT32.170]
93  *
94  * known OLEAUT32.DLL versions:
95  * OLE 2.1  NT                          1993-95 10     3023
96  * OLE 2.1                                      10     3027
97  * OLE 2.20 W95/NT                      1993-96 20     4112
98  * OLE 2.20 W95/NT                      1993-96 20     4118
99  * OLE 2.20 W95/NT                      1993-96 20     4122
100  * OLE 2.30 W95/NT                      1993-98 30     4265
101  * OLE 2.40 NT??                        1993-98 40     4267
102  * OLE 2.40 W98 SE orig. file           1993-98 40     4275
103  */
104 UINT WINAPI OaBuildVersion()
105 {
106     FIXME("Please report to a.mohr@mailto.de if you get version error messages !\n");
107     switch(GetVersion() & 0x8000ffff)  /* mask off build number */
108     {
109     case 0x80000a03:  /* WIN31 */
110                 return MAKELONG(4049, 20); /* from Win32s 1.1e */
111     case 0x80000004:  /* WIN95 */
112                 return MAKELONG(4265, 30);
113     case 0x80000a04:  /* WIN98 */
114                 return MAKELONG(4275, 40); /* value of W98 SE; orig. W98 AFAIK has 4265, 30 just as W95 */
115     case 0x00003303:  /* NT351 */
116                 return MAKELONG(4265, 30); /* value borrowed from Win95 */
117     case 0x00000004:  /* NT40 */
118                 return MAKELONG(4122, 20); /* ouch ! Quite old, I guess */
119     default:
120                 ERR("Version value not known yet. Please investigate it !\n");
121                 return 0x0;
122     }
123 }
124
125 /***********************************************************************
126  *              DllRegisterServer (OLEAUT32.320)
127  */
128 HRESULT WINAPI OLEAUT32_DllRegisterServer() { 
129     FIXME("stub!\n");
130     return S_OK;
131 }
132
133 /***********************************************************************
134  *              DllUnregisterServer (OLEAUT32.321)
135  */
136 HRESULT WINAPI OLEAUT32_DllUnregisterServer() {
137     FIXME("stub!\n");
138     return S_OK;
139 }
140
141 extern void _get_STDFONT_CF(LPVOID);
142
143 /***********************************************************************
144  *              DllGetClassObject (OLEAUT32.1)
145  */
146 HRESULT WINAPI OLEAUT32_DllGetClassObject(REFCLSID rclsid, REFIID iid,LPVOID *ppv)
147 {
148     *ppv = NULL;
149     if (IsEqualGUID(rclsid,&CLSID_StdFont)) {
150         if (IsEqualGUID(iid,&IID_IClassFactory)) {
151             _get_STDFONT_CF(ppv);
152             IClassFactory_AddRef((IClassFactory*)*ppv);
153             return S_OK;
154         }
155     }
156     FIXME("\n\tCLSID:\t%s,\n\tIID:\t%s\n",debugstr_guid(rclsid),debugstr_guid(iid));
157     return CLASS_E_CLASSNOTAVAILABLE;
158 }
159
160 /***********************************************************************
161  *              DllCanUnloadNow (OLEAUT32.410)
162  */
163 HRESULT WINAPI OLEAUT32_DllCanUnloadNow() {
164     FIXME("(), stub!\n");
165     return S_FALSE;
166 }