7 static void oletype_free(
void *ptr);
8 static size_t oletype_size(
const void *ptr);
14 static VALUE oleclass_from_typelib(
VALUE self, ITypeLib *pTypeLib,
VALUE oleclass);
26 static VALUE foletype_major_version(
VALUE self);
28 static VALUE foletype_minor_version(
VALUE self);
43 static VALUE ole_type_impl_ole_types(ITypeInfo *
pTypeInfo,
int implflags);
44 static VALUE foletype_impl_ole_types(
VALUE self);
45 static VALUE foletype_source_ole_types(
VALUE self);
46 static VALUE foletype_default_event_sources(
VALUE self);
47 static VALUE foletype_default_ole_types(
VALUE self);
52 {
NULL, oletype_free, oletype_size,},
63 oletype_free(
void *ptr)
71 oletype_size(
const void *ptr)
92 hr = pTypeInfo->lpVtbl->GetContainingTypeLib( pTypeInfo, &pTypeLib, &index );
96 hr = pTypeLib->lpVtbl->GetDocumentation( pTypeLib, index,
115 foletype_s_ole_classes(
VALUE self,
VALUE typelib)
137 foletype_s_typelibs(
VALUE self)
144 return rb_eval_string(
"WIN32OLE_TYPELIB.typelibs.collect{|t|t.name}");
154 foletype_s_progids(
VALUE self)
156 HKEY hclsids, hclsid;
163 err =
reg_open_key(HKEY_CLASSES_ROOT,
"CLSID", &hclsids);
164 if(err != ERROR_SUCCESS) {
172 if (err != ERROR_SUCCESS)
180 RegCloseKey(hclsids);
196 foletype_s_allocate(
VALUE klass)
210 oletype_set_member(obj, pTypeInfo, name);
215 oleclass_from_typelib(
VALUE self, ITypeLib *pTypeLib,
VALUE oleclass)
227 count = pTypeLib->lpVtbl->GetTypeInfoCount(pTypeLib);
228 for (i = 0; i < count && found ==
Qfalse; i++) {
229 hr = pTypeLib->lpVtbl->GetTypeInfo(pTypeLib, i, &pTypeInfo);
232 hr = pTypeLib->lpVtbl->GetDocumentation(pTypeLib, i,
238 oletype_set_member(
self, pTypeInfo, typelib);
272 hr = LoadTypeLibEx(pbuf, REGKIND_NONE, &pTypeLib);
276 if (oleclass_from_typelib(
self, pTypeLib, oleclass) ==
Qfalse) {
294 foletype_name(
VALUE self)
300 ole_ole_type(ITypeInfo *pTypeInfo)
309 switch(pTypeAttr->typekind) {
319 case TKIND_INTERFACE:
354 foletype_ole_type(
VALUE self)
357 return ole_ole_type(pTypeInfo);
361 ole_type_guid(ITypeInfo *pTypeInfo)
371 len = StringFromGUID2(&pTypeAttr->guid, bstr,
sizeof(bstr)/
sizeof(OLECHAR));
388 foletype_guid(
VALUE self)
391 return ole_type_guid(pTypeInfo);
395 ole_type_progid(ITypeInfo *pTypeInfo)
404 hr = ProgIDFromCLSID(&pTypeAttr->guid, &pbuf);
422 foletype_progid(
VALUE self)
425 return ole_type_progid(pTypeInfo);
430 ole_type_visible(ITypeInfo *pTypeInfo)
438 if (pTypeAttr->wTypeFlags & (TYPEFLAG_FHIDDEN | TYPEFLAG_FRESTRICTED)) {
456 foletype_visible(
VALUE self)
459 return ole_type_visible(pTypeInfo);
463 ole_type_major_version(ITypeInfo *pTypeInfo)
485 foletype_major_version(
VALUE self)
488 return ole_type_major_version(pTypeInfo);
492 ole_type_minor_version(ITypeInfo *pTypeInfo)
514 foletype_minor_version(
VALUE self)
517 return ole_type_minor_version(pTypeInfo);
521 ole_type_typekind(ITypeInfo *pTypeInfo)
544 foletype_typekind(
VALUE self)
547 return ole_type_typekind(pTypeInfo);
551 ole_type_helpstring(ITypeInfo *pTypeInfo)
571 foletype_helpstring(
VALUE self)
574 return ole_type_helpstring(pTypeInfo);
578 ole_type_src_type(ITypeInfo *pTypeInfo)
586 if(pTypeAttr->typekind != TKIND_ALIAS) {
605 foletype_src_type(
VALUE self)
608 return ole_type_src_type(pTypeInfo);
612 ole_type_helpfile(ITypeInfo *pTypeInfo)
633 foletype_helpfile(
VALUE self)
636 return ole_type_helpfile(pTypeInfo);
640 ole_type_helpcontext(ITypeInfo *pTypeInfo)
660 foletype_helpcontext(
VALUE self)
663 return ole_type_helpcontext(pTypeInfo);
667 ole_variables(ITypeInfo *pTypeInfo)
682 for(i = 0; i < pTypeAttr->cVars; i++) {
683 hr = pTypeInfo->lpVtbl->GetVarDesc(pTypeInfo, i, &pVarDesc);
687 hr = pTypeInfo->lpVtbl->GetNames(pTypeInfo, pVarDesc->memid, &bstr,
689 if(FAILED(hr) || len == 0 || !bstr)
695 pTypeInfo->lpVtbl->ReleaseVarDesc(pTypeInfo, pVarDesc);
723 foletype_variables(
VALUE self)
726 return ole_variables(pTypeInfo);
742 foletype_methods(
VALUE self)
745 return ole_methods_from_typeinfo(pTypeInfo, INVOKE_FUNC | INVOKE_PROPERTYGET | INVOKE_PROPERTYPUT | INVOKE_PROPERTYPUTREF);
758 foletype_ole_typelib(
VALUE self)
765 ole_type_impl_ole_types(ITypeInfo *pTypeInfo,
int implflags)
768 ITypeInfo *pRefTypeInfo;
780 for (i = 0; i < pTypeAttr->cImplTypes; i++) {
781 hr = pTypeInfo->lpVtbl->GetImplTypeFlags(pTypeInfo, i, &flags);
785 hr = pTypeInfo->lpVtbl->GetRefTypeOfImplType(pTypeInfo, i, &href);
788 hr = pTypeInfo->lpVtbl->GetRefTypeInfo(pTypeInfo, href, &pRefTypeInfo);
792 if ((flags & implflags) == implflags) {
815 foletype_impl_ole_types(
VALUE self)
818 return ole_type_impl_ole_types(pTypeInfo, 0);
832 foletype_source_ole_types(
VALUE self)
835 return ole_type_impl_ole_types(pTypeInfo, IMPLTYPEFLAG_FSOURCE);
848 foletype_default_event_sources(
VALUE self)
851 return ole_type_impl_ole_types(pTypeInfo, IMPLTYPEFLAG_FSOURCE|IMPLTYPEFLAG_FDEFAULT);
865 foletype_default_ole_types(
VALUE self)
868 return ole_type_impl_ole_types(pTypeInfo, IMPLTYPEFLAG_FDEFAULT);
881 foletype_inspect(
VALUE self)
VALUE eWIN32OLERuntimeError
#define RUBY_TYPED_FREE_IMMEDIATELY
void rb_define_singleton_method(VALUE obj, const char *name, VALUE(*func)(ANYARGS), int argc)
Defines a singleton method for obj.
void rb_raise(VALUE exc, const char *fmt,...)
#define TypedData_Get_Struct(obj, type, data_type, sval)
VALUE rb_ary_push(VALUE ary, VALUE item)
LPWSTR ole_vstr2wc(VALUE vstr)
VALUE rb_funcall(VALUE, ID, int,...)
Calls a method.
#define OLE_GET_TYPEATTR(X, Y)
VALUE rb_ivar_get(VALUE, ID)
void rb_define_alloc_func(VALUE, rb_alloc_func_t)
void ole_initialize(void)
void Init_win32ole_type(void)
int rb_str_cmp(VALUE, VALUE)
void ole_raise(HRESULT hr, VALUE ecs, const char *fmt,...)
VALUE default_inspect(VALUE self, const char *class_name)
RUBY_EXTERN VALUE rb_cObject
VALUE ole_type_from_itypeinfo(ITypeInfo *pTypeInfo)
VALUE reg_get_val2(HKEY hkey, const char *subkey)
VALUE typelib_file(VALUE ole)
LONG reg_open_key(HKEY hkey, const char *name, HKEY *phkey)
VALUE rb_define_class(const char *name, VALUE super)
Defines a top-level class.
VALUE rb_eval_string(const char *)
Evaluates the given string in an isolated binding.
VALUE ole_methods_from_typeinfo(ITypeInfo *pTypeInfo, int mask)
LONG reg_open_vkey(HKEY hkey, VALUE key, HKEY *phkey)
void rb_define_alias(VALUE klass, const char *name1, const char *name2)
Defines an alias of a method.
VALUE create_win32ole_variable(ITypeInfo *pTypeInfo, UINT index, VALUE name)
VALUE rb_ivar_set(VALUE, ID, VALUE)
register unsigned int len
VALUE ole_typedesc2val(ITypeInfo *pTypeInfo, TYPEDESC *pTypeDesc, VALUE typedetails)
VALUE ole_wc2vstr(LPWSTR pw, BOOL isfree)
typedef HRESULT(STDAPICALLTYPE FNCOCREATEINSTANCEEX)(REFCLSID
VALUE reg_enum_key(HKEY hkey, DWORD i)
#define TypedData_Make_Struct(klass, type, data_type, sval)
VALUE ole_typelib_from_itypeinfo(ITypeInfo *pTypeInfo)
#define OLE_RELEASE_TYPEATTR(X, Y)
#define SafeStringValue(v)
#define StringValuePtr(v)
ITypeInfo * itypeinfo(VALUE self)
HRESULT ole_docinfo_from_type(ITypeInfo *pTypeInfo, BSTR *name, BSTR *helpstr, DWORD *helpcontext, BSTR *helpfile)
void rb_define_method(VALUE klass, const char *name, VALUE(*func)(ANYARGS), int argc)
VALUE create_win32ole_type(ITypeInfo *pTypeInfo, VALUE name)