Don't display the context menu on a double click.
[wine] / dlls / oleaut32 / oleaut.c
1 /*
2  *      OLEAUT32
3  *
4  */
5 #include <string.h>
6 #include "windef.h"
7 #include "wingdi.h"
8 #include "winuser.h"
9 #include "winerror.h"
10 #include "winversion.h"
11 #include "oleauto.h"
12 #include "wine/obj_base.h"
13 #include "wine/obj_moniker.h"
14 #include "heap.h"
15 #include "ldt.h"
16 #include "debugtools.h"
17
18 DEFAULT_DEBUG_CHANNEL(ole);
19
20 static WCHAR    _delimiter[2] = {'!',0}; /* default delimiter apparently */
21 static WCHAR    *pdelimiter = &_delimiter[0];
22
23 HRESULT WINAPI RegisterActiveObject(
24         LPUNKNOWN punk,REFCLSID rcid,DWORD dwFlags,LPDWORD pdwRegister
25 ) {
26         WCHAR                   guidbuf[80];
27         HRESULT                 ret;
28         LPRUNNINGOBJECTTABLE    runobtable;
29         LPMONIKER               moniker;
30
31         StringFromGUID2(rcid,guidbuf,39);
32         ret = CreateItemMoniker(pdelimiter,guidbuf,&moniker);
33         if (FAILED(ret)) 
34                 return ret;
35         ret = GetRunningObjectTable(0,&runobtable);
36         if (FAILED(ret)) {
37                 IMoniker_Release(moniker);
38                 return ret;
39         }
40         ret = IRunningObjectTable_Register(runobtable,dwFlags,punk,moniker,pdwRegister);
41         IRunningObjectTable_Release(runobtable);
42         IMoniker_Release(moniker);
43         return ret;
44 }
45
46 HRESULT WINAPI RevokeActiveObject(DWORD xregister,LPVOID reserved)
47 {
48         LPRUNNINGOBJECTTABLE    runobtable;
49         HRESULT                 ret;
50
51         ret = GetRunningObjectTable(0,&runobtable);
52         if (FAILED(ret)) return ret;
53         ret = IRunningObjectTable_Revoke(runobtable,xregister);
54         if (SUCCEEDED(ret)) ret = S_OK;
55         IRunningObjectTable_Release(runobtable);
56         return ret;
57 }
58
59 HRESULT WINAPI GetActiveObject(REFCLSID rcid,LPVOID preserved,LPUNKNOWN *ppunk)
60 {
61         WCHAR                   guidbuf[80];
62         HRESULT                 ret;
63         LPRUNNINGOBJECTTABLE    runobtable;
64         LPMONIKER               moniker;
65
66         StringFromGUID2(rcid,guidbuf,39);
67         ret = CreateItemMoniker(pdelimiter,guidbuf,&moniker);
68         if (FAILED(ret)) 
69                 return ret;
70         ret = GetRunningObjectTable(0,&runobtable);
71         if (FAILED(ret)) {
72                 IMoniker_Release(moniker);
73                 return ret;
74         }
75         ret = IRunningObjectTable_GetObject(runobtable,moniker,ppunk);
76         IRunningObjectTable_Release(runobtable);
77         IMoniker_Release(moniker);
78         return ret;
79 }
80
81 /***********************************************************************
82  *           OaBuildVersion           [OLEAUT32.170]
83  *
84  * known OLEAUT32.DLL versions:
85  * OLE 2.1  NT                          1993-95 10     3023
86  * OLE 2.1                                      10     3027
87  * OLE 2.20 W95/NT                      1993-96 20     4112
88  * OLE 2.20 W95/NT                      1993-96 20     4118
89  * OLE 2.20 W95/NT                      1993-96 20     4122
90  * OLE 2.30 W95/NT                      1993-98 30     4265
91  * OLE 2.40 NT??                        1993-98 40     4267
92  * OLE 2.40 W98 SE orig. file           1993-98 40     4275
93  */
94 UINT WINAPI OaBuildVersion()
95 {
96     FIXME("Please report to a.mohr@mailto.de if you get version error messages !\n");
97     switch(VERSION_GetVersion())
98     {
99         case WIN31:
100                 return MAKELONG(4049, 20); /* from Win32s 1.1e */
101         case WIN95:
102                 return MAKELONG(4265, 30);
103         case WIN98:
104                 return MAKELONG(4275, 40); /* value of W98 SE; orig. W98 AFAIK has 4265, 30 just as W95 */
105         case NT351:
106                 return MAKELONG(4265, 30); /* value borrowed from Win95 */
107         case NT40:
108                 return MAKELONG(4122, 20); /* ouch ! Quite old, I guess */
109         default:
110                 ERR("Version value not known yet. Please investigate it !\n");
111                 return 0x0;
112     }
113 }