Don't crash on close from window manager.
[wine.git] / dlls / oleaut32 / oleaut.c
blobddf6adac79fa6465b4d8f479559430a629838267
1 /*
2 * OLEAUT32
4 */
5 #include <string.h>
7 #include "windef.h"
8 #include "winbase.h"
9 #include "wingdi.h"
10 #include "winuser.h"
11 #include "winerror.h"
13 #include "ole2.h"
14 #include "heap.h"
15 #include "debugtools.h"
17 DEFAULT_DEBUG_CHANNEL(ole);
19 static WCHAR _delimiter[2] = {'!',0}; /* default delimiter apparently */
20 static WCHAR *pdelimiter = &_delimiter[0];
22 /***********************************************************************
23 * RegisterActiveObject
25 HRESULT WINAPI RegisterActiveObject(
26 LPUNKNOWN punk,REFCLSID rcid,DWORD dwFlags,LPDWORD pdwRegister
27 ) {
28 WCHAR guidbuf[80];
29 HRESULT ret;
30 LPRUNNINGOBJECTTABLE runobtable;
31 LPMONIKER moniker;
33 StringFromGUID2(rcid,guidbuf,39);
34 ret = CreateItemMoniker(pdelimiter,guidbuf,&moniker);
35 if (FAILED(ret))
36 return ret;
37 ret = GetRunningObjectTable(0,&runobtable);
38 if (FAILED(ret)) {
39 IMoniker_Release(moniker);
40 return ret;
42 ret = IRunningObjectTable_Register(runobtable,dwFlags,punk,moniker,pdwRegister);
43 IRunningObjectTable_Release(runobtable);
44 IMoniker_Release(moniker);
45 return ret;
48 /***********************************************************************
49 * RevokeActiveObject
51 HRESULT WINAPI RevokeActiveObject(DWORD xregister,LPVOID reserved)
53 LPRUNNINGOBJECTTABLE runobtable;
54 HRESULT ret;
56 ret = GetRunningObjectTable(0,&runobtable);
57 if (FAILED(ret)) return ret;
58 ret = IRunningObjectTable_Revoke(runobtable,xregister);
59 if (SUCCEEDED(ret)) ret = S_OK;
60 IRunningObjectTable_Release(runobtable);
61 return ret;
64 /***********************************************************************
65 * GetActiveObject
67 HRESULT WINAPI GetActiveObject(REFCLSID rcid,LPVOID preserved,LPUNKNOWN *ppunk)
69 WCHAR guidbuf[80];
70 HRESULT ret;
71 LPRUNNINGOBJECTTABLE runobtable;
72 LPMONIKER moniker;
74 StringFromGUID2(rcid,guidbuf,39);
75 ret = CreateItemMoniker(pdelimiter,guidbuf,&moniker);
76 if (FAILED(ret))
77 return ret;
78 ret = GetRunningObjectTable(0,&runobtable);
79 if (FAILED(ret)) {
80 IMoniker_Release(moniker);
81 return ret;
83 ret = IRunningObjectTable_GetObject(runobtable,moniker,ppunk);
84 IRunningObjectTable_Release(runobtable);
85 IMoniker_Release(moniker);
86 return ret;
89 /***********************************************************************
90 * OaBuildVersion [OLEAUT32.170]
92 * known OLEAUT32.DLL versions:
93 * OLE 2.1 NT 1993-95 10 3023
94 * OLE 2.1 10 3027
95 * OLE 2.20 W95/NT 1993-96 20 4112
96 * OLE 2.20 W95/NT 1993-96 20 4118
97 * OLE 2.20 W95/NT 1993-96 20 4122
98 * OLE 2.30 W95/NT 1993-98 30 4265
99 * OLE 2.40 NT?? 1993-98 40 4267
100 * OLE 2.40 W98 SE orig. file 1993-98 40 4275
102 UINT WINAPI OaBuildVersion()
104 FIXME("Please report to a.mohr@mailto.de if you get version error messages !\n");
105 switch(GetVersion() & 0x8000ffff) /* mask off build number */
107 case 0x80000a03: /* WIN31 */
108 return MAKELONG(4049, 20); /* from Win32s 1.1e */
109 case 0x80000004: /* WIN95 */
110 return MAKELONG(4265, 30);
111 case 0x80000a04: /* WIN98 */
112 return MAKELONG(4275, 40); /* value of W98 SE; orig. W98 AFAIK has 4265, 30 just as W95 */
113 case 0x00003303: /* NT351 */
114 return MAKELONG(4265, 30); /* value borrowed from Win95 */
115 case 0x00000004: /* NT40 */
116 return MAKELONG(4122, 20); /* ouch ! Quite old, I guess */
117 default:
118 ERR("Version value not known yet. Please investigate it !\n");
119 return 0x0;
123 /***********************************************************************
124 * DllRegisterServer
126 HRESULT WINAPI OLEAUT32_DllRegisterServer() {
127 FIXME("stub!\n");
128 return S_OK;
131 /***********************************************************************
132 * DllUnregisterServer
134 HRESULT WINAPI OLEAUT32_DllUnregisterServer() {
135 FIXME("stub!\n");
136 return S_OK;