Ruby 2.7.0p0(2019-12-25revision647ee6f091eafcce70ffb75ddf7e121e192ab217)

win32ole.h
Go to the documentation of this file.
1 #ifndef WIN32OLE_H
2 #define WIN32OLE_H 1
3 #include "ruby/ruby.h"
4 #include "ruby/st.h"
5 #include "ruby/encoding.h"
6
7 #define GNUC_OLDER_3_4_4 \
8 ((__GNUC__ < 3) || \
9 ((__GNUC__ <= 3) && (__GNUC_MINOR__ < 4)) || \
10 ((__GNUC__ <= 3) && (__GNUC_MINOR__ <= 4) && (__GNUC_PATCHLEVEL__ <= 4)))
11
12 #if (defined(__GNUC__)) && (GNUC_OLDER_3_4_4)
13 #ifndef NONAMELESSUNION
14 #define NONAMELESSUNION 1
15 #endif
16 #endif
17
18 #include <ctype.h>
19
20 #include <windows.h>
21 #include <ocidl.h>
22 #include <olectl.h>
23 #include <ole2.h>
24 #if defined(HAVE_TYPE_IMULTILANGUAGE2) || defined(HAVE_TYPE_IMULTILANGUAGE)
25 #include <mlang.h>
26 #endif
27 #include <stdlib.h>
28 #include <math.h>
29 #ifdef HAVE_STDARG_PROTOTYPES
30 #include <stdarg.h>
31 #define va_init_list(a,b) va_start(a,b)
32 #else
33 #include <varargs.h>
34 #define va_init_list(a,b) va_start(a)
35 #endif
36 #include <objidl.h>
37
38 #define DOUT fprintf(stderr,"%s(%d)\n", __FILE__, __LINE__)
39 #define DOUTS(x) fprintf(stderr,"%s(%d):" #x "=%s\n",__FILE__, __LINE__,x)
40 #define DOUTMSG(x) fprintf(stderr, "%s(%d):" #x "\n",__FILE__, __LINE__)
41 #define DOUTI(x) fprintf(stderr, "%s(%d):" #x "=%d\n",__FILE__, __LINE__,x)
42 #define DOUTD(x) fprintf(stderr, "%s(%d):" #x "=%f\n",__FILE__, __LINE__,x)
43
44 #if (defined(__GNUC__)) && (GNUC_OLDER_3_4_4)
45 #define V_UNION1(X, Y) ((X)->u.Y)
46 #else
47 #define V_UNION1(X, Y) ((X)->Y)
48 #endif
49
50 #if (defined(__GNUC__)) && (GNUC_OLDER_3_4_4)
51 #undef V_UNION
52 #define V_UNION(X,Y) ((X)->n1.n2.n3.Y)
53
54 #undef V_VT
55 #define V_VT(X) ((X)->n1.n2.vt)
56
57 #undef V_BOOL
58 #define V_BOOL(X) V_UNION(X,boolVal)
59 #endif
60
61 #ifndef V_I1REF
62 #define V_I1REF(X) V_UNION(X, pcVal)
63 #endif
64
65 #ifndef V_UI2REF
66 #define V_UI2REF(X) V_UNION(X, puiVal)
67 #endif
68
69 #ifndef V_INT
70 #define V_INT(X) V_UNION(X, intVal)
71 #endif
72
73 #ifndef V_INTREF
74 #define V_INTREF(X) V_UNION(X, pintVal)
75 #endif
76
77 #ifndef V_UINT
78 #define V_UINT(X) V_UNION(X, uintVal)
79 #endif
80
81 #ifndef V_UINTREF
82 #define V_UINTREF(X) V_UNION(X, puintVal)
83 #endif
84
85 #ifdef HAVE_LONG_LONG
86 #define I8_2_NUM LL2NUM
87 #define UI8_2_NUM ULL2NUM
88 #define NUM2I8 RB_NUM2LL
89 #define NUM2UI8 RB_NUM2ULL
90 #else
91 #define I8_2_NUM RB_INT2NUM
92 #define UI8_2_NUM RB_UINT2NUM
93 #define NUM2I8 RB_NUM2INT
94 #define NUM2UI8 RB_NUM2UINT
95 #endif
96
97 #define OLE_ADDREF(X) (X) ? ((X)->lpVtbl->AddRef(X)) : 0
98 #define OLE_RELEASE(X) (X) ? ((X)->lpVtbl->Release(X)) : 0
99 #define OLE_FREE(x) {\
100 if(ole_initialized() == TRUE) {\
101 if(x) {\
102 OLE_RELEASE(x);\
103 (x) = 0;\
104 }\
105 }\
106 }
107
108 #define OLE_GET_TYPEATTR(X, Y) ((X)->lpVtbl->GetTypeAttr((X), (Y)))
109 #define OLE_RELEASE_TYPEATTR(X, Y) ((X)->lpVtbl->ReleaseTypeAttr((X), (Y)))
110
111 struct oledata {
112 IDispatch *pDispatch;
113 };
114
115 VALUE cWIN32OLE;
116 LCID cWIN32OLE_lcid;
117
118 struct oledata *oledata_get_struct(VALUE obj);
119 LPWSTR ole_vstr2wc(VALUE vstr);
120 LONG reg_open_key(HKEY hkey, const char *name, HKEY *phkey);
121 LONG reg_open_vkey(HKEY hkey, VALUE key, HKEY *phkey);
122 VALUE reg_enum_key(HKEY hkey, DWORD i);
123 VALUE reg_get_val(HKEY hkey, const char *subkey);
124 VALUE reg_get_val2(HKEY hkey, const char *subkey);
125 void ole_initialize(void);
126 VALUE default_inspect(VALUE self, const char *class_name);
127 char *ole_wc2mb(LPWSTR pw);
128 VALUE ole_wc2vstr(LPWSTR pw, BOOL isfree);
129
130 #define WC2VSTR(x) ole_wc2vstr((x), TRUE)
131
132 BOOL ole_initialized(void);
133 HRESULT ole_docinfo_from_type(ITypeInfo *pTypeInfo, BSTR *name, BSTR *helpstr, DWORD *helpcontext, BSTR *helpfile);
134 VALUE ole_typedesc2val(ITypeInfo *pTypeInfo, TYPEDESC *pTypeDesc, VALUE typedetails);
135 VALUE make_inspect(const char *class_name, VALUE detail);
136 void ole_val2variant(VALUE val, VARIANT *var);
137 void ole_val2variant2(VALUE val, VARIANT *var);
138 void ole_val2variant_ex(VALUE val, VARIANT *var, VARTYPE vt);
139 VALUE ole_variant2val(VARIANT *pvar);
140 HRESULT ole_val_ary2variant_ary(VALUE val, VARIANT *var, VARTYPE vt);
141 VOID *val2variant_ptr(VALUE val, VARIANT *var, VARTYPE vt);
142 HRESULT typelib_from_val(VALUE obj, ITypeLib **pTypeLib);
143
144 #include "win32ole_variant_m.h"
145 #include "win32ole_typelib.h"
146 #include "win32ole_type.h"
147 #include "win32ole_variable.h"
148 #include "win32ole_method.h"
149 #include "win32ole_param.h"
150 #include "win32ole_event.h"
151 #include "win32ole_variant.h"
152 #include "win32ole_record.h"
153 #include "win32ole_error.h"
154
155 #endif
win32ole_param.h
win32ole_type.h
default_inspect
VALUE default_inspect(VALUE self, const char *class_name)
Definition: win32ole.c:1345
win32ole_event.h
reg_open_key
LONG reg_open_key(HKEY hkey, const char *name, HKEY *phkey)
Definition: win32ole.c:1698
VALUE
unsigned long VALUE
Definition: ruby.h:102
encoding.h
ole_val2variant_ex
void ole_val2variant_ex(VALUE val, VARIANT *var, VARTYPE vt)
Definition: win32ole.c:982
ole_val2variant2
void ole_val2variant2(VALUE val, VARIANT *var)
Definition: win32ole.c:1325
win32ole_variable.h
win32ole_typelib.h
DWORD
IUnknown DWORD
Definition: win32ole.c:33
ole_typedesc2val
VALUE ole_typedesc2val(ITypeInfo *pTypeInfo, TYPEDESC *pTypeDesc, VALUE typedetails)
Definition: win32ole.c:3708
win32ole_record.h
ole_initialized
BOOL ole_initialized(void)
Definition: win32ole.c:395
ole_wc2mb
char * ole_wc2mb(LPWSTR pw)
Definition: win32ole.c:743
st.h
win32ole_variant.h
ruby.h
oledata_get_struct
struct oledata * oledata_get_struct(VALUE obj)
Definition: win32ole.c:857
obj
const VALUE VALUE obj
Definition: rb_mjit_min_header-2.7.0.h:5742
oledata
Definition: win32ole.h:111
ole_docinfo_from_type
HRESULT ole_docinfo_from_type(ITypeInfo *pTypeInfo, BSTR *name, BSTR *helpstr, DWORD *helpcontext, BSTR *helpfile)
Definition: win32ole.c:3647
reg_open_vkey
LONG reg_open_vkey(HKEY hkey, VALUE key, HKEY *phkey)
Definition: win32ole.c:1704
i
uint32_t i
Definition: rb_mjit_min_header-2.7.0.h:5464
win32ole_variant_m.h
ole_val2variant
void ole_val2variant(VALUE val, VARIANT *var)
Definition: win32ole.c:1249
val2variant_ptr
VOID * val2variant_ptr(VALUE val, VARIANT *var, VARTYPE vt)
Definition: win32ole.c:1017
oledata::pDispatch
IDispatch * pDispatch
Definition: win32ole.h:112
ole_val_ary2variant_ary
HRESULT ole_val_ary2variant_ary(VALUE val, VARIANT *var, VARTYPE vt)
Definition: win32ole.c:1187
ole_initialize
void ole_initialize(void)
Definition: win32ole.c:813
typelib_from_val
HRESULT typelib_from_val(VALUE obj, ITypeLib **pTypeLib)
Definition: win32ole.c:3908
ole_wc2vstr
VALUE ole_wc2vstr(LPWSTR pw, BOOL isfree)
Definition: win32ole.c:946
key
key
Definition: openssl_missing.h:181
cWIN32OLE
VALUE cWIN32OLE
Definition: win32ole.h:115
ole_vstr2wc
LPWSTR ole_vstr2wc(VALUE vstr)
Definition: win32ole.c:865
win32ole_method.h
reg_get_val2
VALUE reg_get_val2(HKEY hkey, const char *subkey)
Definition: win32ole.c:1753
HRESULT
typedef HRESULT(STDAPICALLTYPE FNCOCREATEINSTANCEEX)(REFCLSID
reg_get_val
VALUE reg_get_val(HKEY hkey, const char *subkey)
Definition: win32ole.c:1725
ole_variant2val
VALUE ole_variant2val(VARIANT *pvar)
Definition: win32ole.c:1418
win32ole_error.h
reg_enum_key
VALUE reg_enum_key(HKEY hkey, DWORD i)
Definition: win32ole.c:1710
cWIN32OLE_lcid
LCID cWIN32OLE_lcid
Definition: win32ole.h:116
make_inspect
VALUE make_inspect(const char *class_name, VALUE detail)
Definition: win32ole.c:1333
name
const char * name
Definition: nkf.c:208