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 "heap.h"
|
---|
15 | #include "debugtools.h"
|
---|
16 |
|
---|
17 | DEFAULT_DEBUG_CHANNEL(ole);
|
---|
18 |
|
---|
19 | static WCHAR _delimiter[2] = {'!',0}; /* default delimiter apparently */
|
---|
20 | static WCHAR *pdelimiter = &_delimiter[0];
|
---|
21 |
|
---|
22 | /***********************************************************************
|
---|
23 | * RegisterActiveObject (OLEAUT32.33)
|
---|
24 | */
|
---|
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;
|
---|
32 |
|
---|
33 | StringFromGUID2(rcid,guidbuf,39);
|
---|
34 | #ifdef __WIN32OS2__
|
---|
35 | dprintf(("RegisterActiveObject %x %ls (%x) %x %x", punk, guidbuf, rcid, dwFlags, pdwRegister));
|
---|
36 | #endif
|
---|
37 | ret = CreateItemMoniker(pdelimiter,guidbuf,&moniker);
|
---|
38 | if (FAILED(ret))
|
---|
39 | return ret;
|
---|
40 | ret = GetRunningObjectTable(0,&runobtable);
|
---|
41 | if (FAILED(ret)) {
|
---|
42 | IMoniker_Release(moniker);
|
---|
43 | return ret;
|
---|
44 | }
|
---|
45 | ret = IRunningObjectTable_Register(runobtable,dwFlags,punk,moniker,pdwRegister);
|
---|
46 | IRunningObjectTable_Release(runobtable);
|
---|
47 | IMoniker_Release(moniker);
|
---|
48 | return ret;
|
---|
49 | }
|
---|
50 |
|
---|
51 | /***********************************************************************
|
---|
52 | * RevokeActiveObject (OLEAUT32.34)
|
---|
53 | */
|
---|
54 | HRESULT WINAPI RevokeActiveObject(DWORD xregister,LPVOID reserved)
|
---|
55 | {
|
---|
56 | LPRUNNINGOBJECTTABLE runobtable;
|
---|
57 | HRESULT ret;
|
---|
58 |
|
---|
59 | #ifdef __WIN32OS2__
|
---|
60 | dprintf(("RevokeActiveObject %x %x", xregister, reserved));
|
---|
61 | #endif
|
---|
62 |
|
---|
63 | ret = GetRunningObjectTable(0,&runobtable);
|
---|
64 | if (FAILED(ret)) return ret;
|
---|
65 | ret = IRunningObjectTable_Revoke(runobtable,xregister);
|
---|
66 | if (SUCCEEDED(ret)) ret = S_OK;
|
---|
67 | IRunningObjectTable_Release(runobtable);
|
---|
68 | return ret;
|
---|
69 | }
|
---|
70 |
|
---|
71 | /***********************************************************************
|
---|
72 | * GetActiveObject (OLEAUT32.35)
|
---|
73 | */
|
---|
74 | HRESULT WINAPI GetActiveObject(REFCLSID rcid,LPVOID preserved,LPUNKNOWN *ppunk)
|
---|
75 | {
|
---|
76 | WCHAR guidbuf[80];
|
---|
77 | HRESULT ret;
|
---|
78 | LPRUNNINGOBJECTTABLE runobtable;
|
---|
79 | LPMONIKER moniker;
|
---|
80 |
|
---|
81 | StringFromGUID2(rcid,guidbuf,39);
|
---|
82 | #ifdef __WIN32OS2__
|
---|
83 | dprintf(("GetActiveObject %ls (%x) %x %x", guidbuf, rcid, preserved, ppunk));
|
---|
84 | #endif
|
---|
85 | ret = CreateItemMoniker(pdelimiter,guidbuf,&moniker);
|
---|
86 | if (FAILED(ret))
|
---|
87 | return ret;
|
---|
88 | ret = GetRunningObjectTable(0,&runobtable);
|
---|
89 | if (FAILED(ret)) {
|
---|
90 | IMoniker_Release(moniker);
|
---|
91 | return ret;
|
---|
92 | }
|
---|
93 | ret = IRunningObjectTable_GetObject(runobtable,moniker,ppunk);
|
---|
94 | IRunningObjectTable_Release(runobtable);
|
---|
95 | IMoniker_Release(moniker);
|
---|
96 | return ret;
|
---|
97 | }
|
---|
98 |
|
---|
99 | /***********************************************************************
|
---|
100 | * OaBuildVersion [OLEAUT32.170]
|
---|
101 | *
|
---|
102 | * known OLEAUT32.DLL versions:
|
---|
103 | * OLE 2.1 NT 1993-95 10 3023
|
---|
104 | * OLE 2.1 10 3027
|
---|
105 | * OLE 2.20 W95/NT 1993-96 20 4112
|
---|
106 | * OLE 2.20 W95/NT 1993-96 20 4118
|
---|
107 | * OLE 2.20 W95/NT 1993-96 20 4122
|
---|
108 | * OLE 2.30 W95/NT 1993-98 30 4265
|
---|
109 | * OLE 2.40 NT?? 1993-98 40 4267
|
---|
110 | * OLE 2.40 W98 SE orig. file 1993-98 40 4275
|
---|
111 | */
|
---|
112 | UINT WINAPI OaBuildVersion()
|
---|
113 | {
|
---|
114 | #ifdef __WIN32OS2__
|
---|
115 | dprintf(("OaBuildVersion %x", GetVersion() & 0x8000ffff));
|
---|
116 | #else
|
---|
117 | FIXME("Please report to a.mohr@mailto.de if you get version error messages !\n");
|
---|
118 | #endif
|
---|
119 | switch(GetVersion() & 0x8000ffff) /* mask off build number */
|
---|
120 | {
|
---|
121 | case 0x80000a03: /* WIN31 */
|
---|
122 | return MAKELONG(4049, 20); /* from Win32s 1.1e */
|
---|
123 | case 0x80000004: /* WIN95 */
|
---|
124 | return MAKELONG(4265, 30);
|
---|
125 | case 0x80000a04: /* WIN98 */
|
---|
126 | return MAKELONG(4275, 40); /* value of W98 SE; orig. W98 AFAIK has 4265, 30 just as W95 */
|
---|
127 | case 0x00003303: /* NT351 */
|
---|
128 | return MAKELONG(4265, 30); /* value borrowed from Win95 */
|
---|
129 | case 0x00000004: /* NT40 */
|
---|
130 | #ifdef __WIN32OS2__
|
---|
131 | return 0x2810b5; //returned by NT4, SP6
|
---|
132 | #else
|
---|
133 | return MAKELONG(4122, 20); /* ouch ! Quite old, I guess */
|
---|
134 | #endif
|
---|
135 | default:
|
---|
136 | ERR("Version value not known yet. Please investigate it !\n");
|
---|
137 | return 0x0;
|
---|
138 | }
|
---|
139 | }
|
---|
140 |
|
---|
141 | #ifndef __WIN32OS2__
|
---|
142 | /***********************************************************************
|
---|
143 | * DllRegisterServer
|
---|
144 | */
|
---|
145 | HRESULT WINAPI OLEAUT32_DllRegisterServer() {
|
---|
146 | FIXME("stub!\n");
|
---|
147 | return S_OK;
|
---|
148 | }
|
---|
149 |
|
---|
150 | /***********************************************************************
|
---|
151 | * DllUnregisterServer
|
---|
152 | */
|
---|
153 | HRESULT WINAPI OLEAUT32_DllUnregisterServer() {
|
---|
154 | FIXME("stub!\n");
|
---|
155 | return S_OK;
|
---|
156 | }
|
---|
157 | #endif //__WIN32OS2__
|
---|