Ruby: ext/win32ole/win32ole.h Source File

Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)

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
115extern VALUE cWIN32OLE;
116extern LCID cWIN32OLE_lcid;
117
118struct oledata *oledata_get_struct(VALUE obj);
119LPWSTR ole_vstr2wc(VALUE vstr);
120LONG reg_open_key(HKEY hkey, const char *name, HKEY *phkey);
121LONG 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);
125void ole_initialize(void);
126 VALUE default_inspect(VALUE self, const char *class_name);
127char *ole_wc2mb(LPWSTR pw);
128 VALUE ole_wc2vstr(LPWSTR pw, BOOL isfree);
129
130#define WC2VSTR(x) ole_wc2vstr((x), TRUE)
131
132BOOL 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);
136void ole_val2variant(VALUE val, VARIANT *var);
137void ole_val2variant2(VALUE val, VARIANT *var);
138void 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);
141VOID *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
ctype.h
Our own, locale independent, character handling routines.
encoding.h
math.h
Internal header for Math.
name
const char * name
Definition: nkf.c:208
key
key
Definition: openssl_missing.h:185
ruby.h
st.h
stdarg.h
Defines old _.
oledata
Definition: win32ole.h:111
oledata::pDispatch
IDispatch * pDispatch
Definition: win32ole.h:112
VALUE
unsigned long VALUE
Definition: value.h:38
HRESULT
typedef HRESULT(STDAPICALLTYPE FNCOCREATEINSTANCEEX)(REFCLSID
DWORD
IUnknown DWORD
Definition: win32ole.c:33
ole_docinfo_from_type
HRESULT ole_docinfo_from_type(ITypeInfo *pTypeInfo, BSTR *name, BSTR *helpstr, DWORD *helpcontext, BSTR *helpfile)
Definition: win32ole.c:3648
ole_vstr2wc
LPWSTR ole_vstr2wc(VALUE vstr)
Definition: win32ole.c:866
ole_typedesc2val
VALUE ole_typedesc2val(ITypeInfo *pTypeInfo, TYPEDESC *pTypeDesc, VALUE typedetails)
Definition: win32ole.c:3709
reg_get_val2
VALUE reg_get_val2(HKEY hkey, const char *subkey)
Definition: win32ole.c:1754
ole_val_ary2variant_ary
HRESULT ole_val_ary2variant_ary(VALUE val, VARIANT *var, VARTYPE vt)
Definition: win32ole.c:1188
reg_open_key
LONG reg_open_key(HKEY hkey, const char *name, HKEY *phkey)
Definition: win32ole.c:1699
ole_wc2vstr
VALUE ole_wc2vstr(LPWSTR pw, BOOL isfree)
Definition: win32ole.c:947
ole_val2variant_ex
void ole_val2variant_ex(VALUE val, VARIANT *var, VARTYPE vt)
Definition: win32ole.c:983
default_inspect
VALUE default_inspect(VALUE self, const char *class_name)
Definition: win32ole.c:1346
ole_variant2val
VALUE ole_variant2val(VARIANT *pvar)
Definition: win32ole.c:1419
ole_val2variant2
void ole_val2variant2(VALUE val, VARIANT *var)
Definition: win32ole.c:1326
oledata_get_struct
struct oledata * oledata_get_struct(VALUE obj)
Definition: win32ole.c:858
reg_get_val
VALUE reg_get_val(HKEY hkey, const char *subkey)
Definition: win32ole.c:1726
ole_initialized
BOOL ole_initialized(void)
Definition: win32ole.c:395
ole_initialize
void ole_initialize(void)
Definition: win32ole.c:814
val2variant_ptr
VOID * val2variant_ptr(VALUE val, VARIANT *var, VARTYPE vt)
Definition: win32ole.c:1018
make_inspect
VALUE make_inspect(const char *class_name, VALUE detail)
Definition: win32ole.c:1334
ole_wc2mb
char * ole_wc2mb(LPWSTR pw)
Definition: win32ole.c:744
cWIN32OLE
VALUE cWIN32OLE
Definition: win32ole.c:38
ole_val2variant
void ole_val2variant(VALUE val, VARIANT *var)
Definition: win32ole.c:1250
reg_open_vkey
LONG reg_open_vkey(HKEY hkey, VALUE key, HKEY *phkey)
Definition: win32ole.c:1705
cWIN32OLE_lcid
LCID cWIN32OLE_lcid
Definition: win32ole.c:3966
reg_enum_key
VALUE reg_enum_key(HKEY hkey, DWORD i)
Definition: win32ole.c:1711
typelib_from_val
HRESULT typelib_from_val(VALUE obj, ITypeLib **pTypeLib)
Definition: win32ole.c:3909
win32ole_error.h
win32ole_event.h
win32ole_method.h
win32ole_param.h
win32ole_record.h
win32ole_type.h
win32ole_typelib.h
win32ole_variable.h
win32ole_variant.h
win32ole_variant_m.h