Ruby: ext/win32ole/win32ole.h File Reference

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

Data Structures | Macros | Functions | Variables
win32ole.h File Reference
`#include "ruby/ruby.h"`
`#include "ruby/st.h"`
`#include "ruby/encoding.h"`
`#include <ctype.h>`
`#include <windows.h>`
`#include <ocidl.h>`
`#include <olectl.h>`
`#include <ole2.h>`
`#include <stdlib.h>`
`#include <math.h>`
`#include <stdarg.h>`
`#include <objidl.h>`
`#include "win32ole_variant_m.h"`
`#include "win32ole_typelib.h"`
`#include "win32ole_type.h"`
`#include "win32ole_variable.h"`
`#include "win32ole_method.h"`
`#include "win32ole_param.h"`
`#include "win32ole_event.h"`
`#include "win32ole_variant.h"`
`#include "win32ole_record.h"`
`#include "win32ole_error.h"`

Go to the source code of this file.

## Data Structures
struct | oledata

## Macros
#define | GNUC_OLDER_3_4_4
#define | va_init_list(a, b) va_start(a,b)
#define | DOUT fprintf(stderr,"%s(%d)\n", __FILE__, __LINE__)
#define | DOUTS(x) fprintf(stderr,"%s(%d):" #x "=%s\n",__FILE__, __LINE__,x)
#define | DOUTMSG(x) fprintf(stderr, "%s(%d):" #x "\n",__FILE__, __LINE__)
#define | DOUTI(x) fprintf(stderr, "%s(%d):" #x "=%d\n",__FILE__, __LINE__,x)
#define | DOUTD(x) fprintf(stderr, "%s(%d):" #x "=%f\n",__FILE__, __LINE__,x)
#define | V_UNION1(X, Y) ((X)->Y)
#define | V_I1REF(X) V_UNION(X, pcVal)
#define | V_UI2REF(X) V_UNION(X, puiVal)
#define | V_INT(X) V_UNION(X, intVal)
#define | V_INTREF(X) V_UNION(X, pintVal)
#define | V_UINT(X) V_UNION(X, uintVal)
#define | V_UINTREF(X) V_UNION(X, puintVal)
#define | I8_2_NUM RB_INT2NUM
#define | UI8_2_NUM RB_UINT2NUM
#define | NUM2I8 RB_NUM2INT
#define | NUM2UI8 RB_NUM2UINT
#define | OLE_ADDREF(X) (X) ? ((X)->lpVtbl->AddRef(X)) : 0
#define | OLE_RELEASE(X) (X) ? ((X)->lpVtbl->Release(X)) : 0
#define | OLE_FREE(x)
#define | OLE_GET_TYPEATTR(X, Y) ((X)->lpVtbl->GetTypeAttr((X), (Y)))
#define | OLE_RELEASE_TYPEATTR(X, Y) ((X)->lpVtbl->ReleaseTypeAttr((X), (Y)))
#define | WC2VSTR(x) ole_wc2vstr((x), TRUE)

## Functions
struct oledata * | oledata_get_struct (VALUE obj)
LPWSTR | ole_vstr2wc (VALUE vstr)
LONG | reg_open_key (HKEY hkey, const char *name, HKEY *phkey)
LONG | reg_open_vkey (HKEY hkey, VALUE key, HKEY *phkey)
VALUE | reg_enum_key (HKEY hkey, DWORD i)
VALUE | reg_get_val (HKEY hkey, const char *subkey)
VALUE | reg_get_val2 (HKEY hkey, const char *subkey)
void | ole_initialize (void)
VALUE | default_inspect (VALUE self, const char *class_name)
char * | ole_wc2mb (LPWSTR pw)
VALUE | ole_wc2vstr (LPWSTR pw, BOOL isfree)
BOOL | ole_initialized (void)
HRESULT | ole_docinfo_from_type (ITypeInfo *pTypeInfo, BSTR *name, BSTR *helpstr, DWORD *helpcontext, BSTR *helpfile)
VALUE | ole_typedesc2val (ITypeInfo *pTypeInfo, TYPEDESC *pTypeDesc, VALUE typedetails)
VALUE | make_inspect (const char *class_name, VALUE detail)
void | ole_val2variant (VALUE val, VARIANT *var)
void | ole_val2variant2 (VALUE val, VARIANT *var)
void | ole_val2variant_ex (VALUE val, VARIANT *var, VARTYPE vt)
VALUE | ole_variant2val (VARIANT *pvar)
HRESULT | ole_val_ary2variant_ary (VALUE val, VARIANT *var, VARTYPE vt)
VOID * | val2variant_ptr (VALUE val, VARIANT *var, VARTYPE vt)
HRESULT | typelib_from_val (VALUE obj, ITypeLib **pTypeLib)

## Variables
VALUE | cWIN32OLE
LCID | cWIN32OLE_lcid

## Macro Definition Documentation

## ◆ DOUT

#define DOUT fprintf(stderr,"%s(%d)\n", __FILE__, __LINE__)

Definition at line 38 of file win32ole.h.

## ◆ DOUTD

#define DOUTD | ( |  | x | ) | fprintf(stderr, "%s(%d):" #x "=%f\n",__FILE__, __LINE__,x)

Definition at line 42 of file win32ole.h.

## ◆ DOUTI

#define DOUTI | ( |  | x | ) | fprintf(stderr, "%s(%d):" #x "=%d\n",__FILE__, __LINE__,x)

Definition at line 41 of file win32ole.h.

## ◆ DOUTMSG

#define DOUTMSG | ( |  | x | ) | fprintf(stderr, "%s(%d):" #x "\n",__FILE__, __LINE__)

Definition at line 40 of file win32ole.h.

## ◆ DOUTS

#define DOUTS | ( |  | x | ) | fprintf(stderr,"%s(%d):" #x "=%s\n",__FILE__, __LINE__,x)

Definition at line 39 of file win32ole.h.

## ◆ GNUC_OLDER_3_4_4

#define GNUC_OLDER_3_4_4

Value:
((__GNUC__ < 3) || \
((__GNUC__ <= 3) && (__GNUC_MINOR__ < 4)) || \
((__GNUC__ <= 3) && (__GNUC_MINOR__ <= 4) && (__GNUC_PATCHLEVEL__ <= 4)))

Definition at line 7 of file win32ole.h.

## ◆ I8_2_NUM

#define I8_2_NUM RB_INT2NUM

Definition at line 91 of file win32ole.h.

## ◆ NUM2I8

#define NUM2I8 RB_NUM2INT

Definition at line 93 of file win32ole.h.

## ◆ NUM2UI8

#define NUM2UI8 RB_NUM2UINT

Definition at line 94 of file win32ole.h.

## ◆ OLE_ADDREF

#define OLE_ADDREF | ( |  | X | ) | (X) ? ((X)->lpVtbl->AddRef(X)) : 0

Definition at line 97 of file win32ole.h.

## ◆ OLE_FREE

#define OLE_FREE | ( |  | x | ) |

Value:
{\
if(ole_initialized() == TRUE) {\
if(x) {\
OLE_RELEASE(x);\
(x) = 0;\
}\
}\
}
TRUE
#define TRUE
Definition: nkf.h:175
ole_initialized
BOOL ole_initialized(void)
Definition: win32ole.c:395

Definition at line 99 of file win32ole.h.

## ◆ OLE_GET_TYPEATTR

#define OLE_GET_TYPEATTR | ( |  | X,
|  |  | Y
| ) |  | ((X)->lpVtbl->GetTypeAttr((X), (Y)))

Definition at line 108 of file win32ole.h.

## ◆ OLE_RELEASE

#define OLE_RELEASE | ( |  | X | ) | (X) ? ((X)->lpVtbl->Release(X)) : 0

Definition at line 98 of file win32ole.h.

## ◆ OLE_RELEASE_TYPEATTR

#define OLE_RELEASE_TYPEATTR | ( |  | X,
|  |  | Y
| ) |  | ((X)->lpVtbl->ReleaseTypeAttr((X), (Y)))

Definition at line 109 of file win32ole.h.

## ◆ UI8_2_NUM

#define UI8_2_NUM RB_UINT2NUM

Definition at line 92 of file win32ole.h.

## ◆ V_I1REF

#define V_I1REF | ( |  | X | ) | V_UNION(X, pcVal)

Definition at line 62 of file win32ole.h.

## ◆ V_INT

#define V_INT | ( |  | X | ) | V_UNION(X, intVal)

Definition at line 70 of file win32ole.h.

## ◆ V_INTREF

#define V_INTREF | ( |  | X | ) | V_UNION(X, pintVal)

Definition at line 74 of file win32ole.h.

## ◆ V_UI2REF

#define V_UI2REF | ( |  | X | ) | V_UNION(X, puiVal)

Definition at line 66 of file win32ole.h.

## ◆ V_UINT

#define V_UINT | ( |  | X | ) | V_UNION(X, uintVal)

Definition at line 78 of file win32ole.h.

## ◆ V_UINTREF

#define V_UINTREF | ( |  | X | ) | V_UNION(X, puintVal)

Definition at line 82 of file win32ole.h.

## ◆ V_UNION1

#define V_UNION1 | ( |  | X,
|  |  | Y
| ) |  | ((X)->Y)

Definition at line 47 of file win32ole.h.

## ◆ va_init_list

#define va_init_list | ( |  | a,
|  |  | b
| ) |  | va_start(a,b)

Definition at line 31 of file win32ole.h.

## ◆ WC2VSTR

#define WC2VSTR | ( |  | x | ) | ole_wc2vstr((x), TRUE)

Definition at line 130 of file win32ole.h.

## Function Documentation

## ◆ default_inspect()

VALUE default_inspect | ( | VALUE | self,
|  | const char * | class_name
| ) |  |

Definition at line 1346 of file win32ole.c.

References make_inspect(), rb_funcall(), and rb_intern().

## ◆ make_inspect()

VALUE make_inspect | ( | const char * | class_name,
|  | VALUE | detail
| ) |  |

Definition at line 1334 of file win32ole.c.

References rb_str_cat2, rb_str_concat(), rb_str_new2, and str.

Referenced by default_inspect().

## ◆ ole_docinfo_from_type()

HRESULT ole_docinfo_from_type | ( | ITypeInfo * | pTypeInfo,
|  | BSTR * | name,
|  | BSTR * | helpstr,
|  | DWORD * | helpcontext,
|  | BSTR * | helpfile
| ) |  |

Definition at line 3648 of file win32ole.c.

References HRESULT(), name, and OLE_RELEASE.

## ◆ ole_initialize()

void ole_initialize | ( | void |  | ) |

Definition at line 814 of file win32ole.c.

References FALSE, g_ole_initialized, g_ole_initialized_set, HRESULT(), NULL, ole_raise(), Qnil, rb_add_event_hook(), rb_eRuntimeError, RUBY_EVENT_THREAD_END, and TRUE.

## ◆ ole_initialized()

BOOL ole_initialized | ( | void |  | ) |

Definition at line 395 of file win32ole.c.

References g_ole_initialized.

## ◆ ole_typedesc2val()

VALUE ole_typedesc2val | ( | ITypeInfo * | pTypeInfo,
|  | TYPEDESC * | pTypeDesc,
|  | VALUE | typedetails
| ) |  |

Definition at line 3709 of file win32ole.c.

References Qnil, rb_ary_push(), rb_fix2str(), rb_str_concat(), rb_str_new2, and str.

## ◆ ole_val2variant()

void ole_val2variant | ( | VALUE | val,
|  | VARIANT * | var
| ) |  |

Definition at line 1250 of file win32ole.c.

References cWIN32OLE, cWIN32OLE_RECORD, cWIN32OLE_VARIANT, NULL, NUM2DBL, OLE_ADDREF, ole_rec2variant(), ole_val_ary2variant_ary(), ole_variant2variant(), ole_vstr2wc(), oledata_get_struct(), oledata::pDispatch, rb_big2dbl(), rb_cTime, RB_NUM2LONG, rb_obj_is_kind_of(), T_ARRAY, T_BIGNUM, T_FALSE, T_FIXNUM, T_FLOAT, T_NIL, T_STRING, T_TRUE, and TYPE.

Referenced by EVENTSINK_Invoke(), and ole_val2variant2().

## ◆ ole_val2variant2()

void ole_val2variant2 | ( | VALUE | val,
|  | VARIANT * | var
| ) |  |

Definition at line 1326 of file win32ole.c.

References ole_val2variant().

Referenced by ole_val2variant_ex().

## ◆ ole_val2variant_ex()

void ole_val2variant_ex | ( | VALUE | val,
|  | VARIANT * | var,
|  | VARTYPE | vt
| ) |  |

Definition at line 983 of file win32ole.c.

References NULL, NUM2I8, NUM2UI8, ole_val2variant2(), and Qnil.

Referenced by val2variant_ptr().

## ◆ ole_val_ary2variant_ary()

HRESULT ole_val_ary2variant_ary | ( | VALUE | val,
|  | VARIANT * | var,
|  | VARTYPE | vt
| ) |  |

Definition at line 1188 of file win32ole.c.

References ALLOC_N, free, HRESULT(), NULL, rb_eRuntimeError, rb_raise(), and T_ARRAY.

Referenced by ole_val2variant().

## ◆ ole_variant2val()

VALUE ole_variant2val | ( | VARIANT * | pvar | ) |

Definition at line 1419 of file win32ole.c.

References ALLOC_N, create_win32ole_record(), cWIN32OLE, cWIN32OLE_lcid, FALSE, free, HRESULT(), I8_2_NUM, NULL, OLE_ADDREF, ole_variant2val(), ole_wc2vstr(), oledata::pDispatch, Qfalse, Qnil, Qtrue, rb_ary_new(), rb_eRuntimeError, rb_float_new, RB_INT2NUM, rb_raise(), rb_str_new2, UI8_2_NUM, V_I1REF, V_INT, V_INTREF, V_UI2REF, V_UINT, and V_UINTREF.

Referenced by EVENTSINK_Invoke(), ole_variant2val(), and olerecord_set_ivar().

## ◆ ole_vstr2wc()

LPWSTR ole_vstr2wc | ( | VALUE | vstr | ) |

Definition at line 866 of file win32ole.c.

References DATA_PTR, eWIN32OLERuntimeError, NULL, rb_enc_get(), rb_enc_name, RB_GC_GUARD, rb_raise(), RSTRING_LEN, RSTRING_PTR, st_insert, st_lookup, and T_STRING.

Referenced by ole_val2variant().

## ◆ ole_wc2mb()

char * ole_wc2mb | ( | LPWSTR | pw | ) |

Definition at line 744 of file win32ole.c.

References NULL.

## ◆ ole_wc2vstr()

VALUE ole_wc2vstr | ( | LPWSTR | pw,
|  | BOOL | isfree
| ) |  |

Definition at line 947 of file win32ole.c.

References rb_str_set_len(), RSTRING_PTR, and strlen().

Referenced by ole_variant2val().

## ◆ oledata_get_struct()

struct oledata * oledata_get_struct | ( | VALUE | obj | ) |

Definition at line 858 of file win32ole.c.

References TypedData_Get_Struct.

Referenced by ole_val2variant(), and typelib_from_val().

## ◆ reg_enum_key()

VALUE reg_enum_key | ( | HKEY | hkey,
|  | DWORD | i
| ) |  |

Definition at line 1711 of file win32ole.c.

References err, NULL, Qnil, and rb_str_new2.

## ◆ reg_get_val()

VALUE reg_get_val | ( | HKEY | hkey,
|  | const char * | subkey
| ) |  |

Definition at line 1726 of file win32ole.c.

References ALLOC_N, err, free, len, NULL, Qnil, and rb_str_new2.

Referenced by reg_get_val2().

## ◆ reg_get_val2()

VALUE reg_get_val2 | ( | HKEY | hkey,
|  | const char * | subkey
| ) |  |

Definition at line 1754 of file win32ole.c.

References err, NULL, Qnil, and reg_get_val().

## ◆ reg_open_key()

LONG reg_open_key | ( | HKEY | hkey,
|  | const char * | name,
|  | HKEY * | phkey
| ) |  |

Definition at line 1699 of file win32ole.c.

References name.

Referenced by reg_open_vkey().

## ◆ reg_open_vkey()

LONG reg_open_vkey | ( | HKEY | hkey,
|  | VALUE | key,
|  | HKEY * | phkey
| ) |  |

Definition at line 1705 of file win32ole.c.

References key, reg_open_key(), and StringValuePtr.

## ◆ typelib_from_val()

HRESULT typelib_from_val | ( | VALUE | obj,
|  | ITypeLib ** | pTypeLib
| ) |  |

Definition at line 3909 of file win32ole.c.

References cWIN32OLE_lcid, HRESULT(), lcid, NULL, OLE_RELEASE, oledata_get_struct(), and oledata::pDispatch.

## ◆ val2variant_ptr()

VOID * val2variant_ptr | ( | VALUE | val,
|  | VARIANT * | var,
|  | VARTYPE | vt
| ) |  |

Definition at line 1018 of file win32ole.c.

References cWIN32OLE_lcid, HRESULT(), NULL, ole_raise(), ole_val2variant_ex(), rb_eRuntimeError, and rb_raise().

## Variable Documentation

## ◆ cWIN32OLE

VALUE cWIN32OLE
| extern

Definition at line 38 of file win32ole.c.

Referenced by Init_win32ole(), Init_win32ole_variant_m(), ole_val2variant(), and ole_variant2val().

## ◆ cWIN32OLE_lcid

LCID cWIN32OLE_lcid
| extern

Definition at line 3966 of file win32ole.c.

Referenced by Init_win32ole(), ole_variant2val(), typelib_from_val(), and val2variant_ptr().