PK qi= META-INF/PK qi==META-INF/MANIFEST.MFManifest-Version: 1.0 Ant-Version: Apache Ant 1.8.1 Created-By: 1.6.0_21-b07 (Sun Microsystems Inc.) Class-Path: lib/jruby.jar lib/racob.jar PK mi=jruby-win32ole/PK mi=org/PK mi= org/jruby/PK mi=org/jruby/ext/PK mi=org/jruby/ext/win32ole/PK mi= win32ole/PK mi=?£OOjruby-win32ole.rbrequire 'java' # Set location so the loader can find the native dll it needs arch = ENV_JAVA['sun.arch.data.model'] == '32' ? 'x86' : 'x64' java.lang.System.set_property 'racob.dll.path', File.dirname(__FILE__) + "/racob-#{arch}.dll" require 'racob.jar' require 'win32ole/win32ole' # <- java native impl of WIN32OLE require 'win32ole/win32ole_ruby' # <- ruby impl of WIN32OLE java_import org.racob.com.Variant # Needed for static native initializer :( java_import org.jruby.ext.win32ole.RubyWIN32OLE java_import org.jruby.ext.win32ole.RubyInvocationProxy require 'win32ole/win32ole_error' require 'win32ole/win32ole_method' require 'win32ole/win32ole_variant' require 'win32ole/win32ole_variable' require 'win32ole/win32ole_event' require 'win32ole/win32ole_param' require 'win32ole/win32ole_type' require 'win32ole/win32ole_typelib' PK qi=R??jruby-win32ole/version.rbmodule JRuby module WIN32OLE VERSION = "0.8.1" end end PK mi=S60org/jruby/ext/win32ole/RubyInvocationProxy.class1< % & ' ( )*+ ,- ./0runtimeLorg/jruby/Ruby;target'Lorg/jruby/runtime/builtin/IRubyObject;*(Lorg/jruby/runtime/builtin/IRubyObject;)VCodeLineNumberTableLocalVariableTablethis,Lorg/jruby/ext/win32ole/RubyInvocationProxy;invokeC(Ljava/lang/String;[Lorg/racob/com/Variant;)Lorg/racob/com/Variant;iI methodNameLjava/lang/String; variantArgs[Lorg/racob/com/Variant;context!Lorg/jruby/runtime/ThreadContext;lengthargs([Lorg/jruby/runtime/builtin/IRubyObject; SourceFileRubyInvocationProxy.java 1  23 4 56%org/jruby/runtime/builtin/IRubyObject7 89 :;*org/jruby/ext/win32ole/RubyInvocationProxyorg/racob/com/InvocationProxy()V getRuntime()Lorg/jruby/Ruby;org/jruby/RubygetCurrentContext#()Lorg/jruby/runtime/ThreadContext;#org/jruby/ext/win32ole/RubyWIN32OLE fromVariantP(Lorg/jruby/Ruby;Lorg/racob/com/Variant;)Lorg/jruby/runtime/builtin/IRubyObject; callMethod(Lorg/jruby/runtime/ThreadContext;Ljava/lang/String;[Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/runtime/builtin/IRubyObject;!   T**+*+  C*N,6:6*,2S*-+W" -3AHCCC; 7 0!"#$PK mi=N\+org/jruby/ext/win32ole/RubyWIN32OLE$1.class1  ()VCodeLineNumberTableLocalVariableTablethis InnerClasses'Lorg/jruby/ext/win32ole/RubyWIN32OLE$1;allocateN(Lorg/jruby/Ruby;Lorg/jruby/RubyClass;)Lorg/jruby/runtime/builtin/IRubyObject;runtimeLorg/jruby/Ruby;klassLorg/jruby/RubyClass; SourceFileRubyWIN32OLE.javaEnclosingMethod #org/jruby/ext/win32ole/RubyWIN32OLE %org/jruby/ext/win32ole/RubyWIN32OLE$1java/lang/Object!org/jruby/runtime/ObjectAllocator((Lorg/jruby/Ruby;Lorg/jruby/RubyClass;)V0 /*    H Y+,      PK mi=_B(()org/jruby/ext/win32ole/RubyWIN32OLE.class1 V 4 4  4 4  4   4  4 4  A A A 4 4   4  4  4  4 4    1   4 4   :  = 9              ! "# A$%& S) 4*+EMPTY_OBJECT_ARGS[Ljava/lang/Object;EMPTY_ERROR_ARGS[IWIN32OLE_ALLOCATOR#Lorg/jruby/runtime/ObjectAllocator;dispatchLorg/racob/com/Dispatch;((Lorg/jruby/Ruby;Lorg/jruby/RubyClass;)VCodeLineNumberTableLocalVariableTablethis%Lorg/jruby/ext/win32ole/RubyWIN32OLE;runtimeLorg/jruby/Ruby; metaClassLorg/jruby/RubyClass;@(Lorg/jruby/Ruby;Lorg/jruby/RubyClass;Lorg/racob/com/Dispatch;)V getDispatch()Lorg/racob/com/Dispatch;J(Lorg/jruby/runtime/ThreadContext;)Lorg/jruby/runtime/builtin/IRubyObject;context!Lorg/jruby/runtime/ThreadContext;RuntimeVisibleAnnotationsLorg/jruby/anno/JRubyMethod;eachc(Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/Block;)Lorg/jruby/runtime/builtin/IRubyObject;valueLorg/racob/com/Variant;blockLorg/jruby/runtime/Block; enumVariantLorg/racob/com/EnumVariant; _getproperty(Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/runtime/builtin/IRubyObject;dispid'Lorg/jruby/runtime/builtin/IRubyObject;argsargTypes argsArrayLorg/jruby/RubyArray; objectArgs dispatchIdIrequired initializer(Lorg/jruby/runtime/ThreadContext;[Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/runtime/builtin/IRubyObject;([Lorg/jruby/runtime/builtin/IRubyObject;idLjava/lang/String;restinvoke_invoke typesArraymethod_missing methodNameole_freeop_arefq(Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/runtime/builtin/IRubyObject;property propertyNamename[]op_aset(Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/runtime/builtin/IRubyObject;[]= _setproperty setproperty invokeSet(Lorg/jruby/runtime/ThreadContext;Ljava/lang/String;[Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/runtime/builtin/IRubyObject; errorArgsinvokeInternal(Lorg/jruby/runtime/ThreadContext;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/builtin/IRubyObject;I)Lorg/jruby/runtime/builtin/IRubyObject; dispatchType returnValue makeErrorArgs(I)[IsizemakeObjectArgs>([Lorg/jruby/runtime/builtin/IRubyObject;I)[Ljava/lang/Object;irubyArgs startIndexlength*(Lorg/jruby/RubyArray;)[Ljava/lang/Object;objectLjava/lang/Object;invokeMethodOrGettoJava%(Ljava/lang/Class;)Ljava/lang/Object;klassLjava/lang/Class;toObject;(Lorg/jruby/runtime/builtin/IRubyObject;)Ljava/lang/Object; rubyObject fromObjectK(Lorg/jruby/Ruby;Ljava/lang/Object;)Lorg/jruby/runtime/builtin/IRubyObject; fromVariantP(Lorg/jruby/Ruby;Lorg/racob/com/Variant;)Lorg/jruby/runtime/builtin/IRubyObject;variant date2rubyI(Lorg/jruby/Ruby;Ljava/util/Date;)Lorg/jruby/runtime/builtin/IRubyObject;dateLjava/util/Date;calLjava/util/Calendar;toProgID&(Ljava/lang/String;)Ljava/lang/String;()V SourceFileRubyWIN32OLE.java _` ]^, -./ 0 123 45 67 8 9 :; <=> ?@ A BC DE FG HIJ KLorg/racob/com/Dispatch _M = NO P QR ST UV W X YZ WXjava/lang/ObjectY P Z[ D\ ]^ java/lang/Boolean _5 `a#org/jruby/ext/win32ole/RubyWIN32OLEb cd _jjava/util/Date java/lang/Numberjava/lang/Double ef ghjava/lang/Float iP jkjava/lang/String lmn op q5 kl rs tP uf vw xL yz{ |} ~  {{ O}}%org/jruby/ext/win32ole/RubyWIN32OLE$1 InnerClasses _ [\org/jruby/RubyObjectorg/jruby/runtime/ThreadContext getRuntime()Lorg/jruby/Ruby;org/jruby/javasupport/JavaUtilconvertJavaToUsableRubyObject toEnumVariant()Lorg/racob/com/EnumVariant;org/racob/com/EnumVarianthasMoreElements()Z nextElement()Lorg/racob/com/Variant;org/jruby/runtime/Blockyield safeReleaseorg/jruby/RubygetNil)()Lorg/jruby/runtime/builtin/IRubyObject;%org/jruby/runtime/builtin/IRubyObjectconvertToArray()Lorg/jruby/RubyArray;org/jruby/RubyIntegernum2long*(Lorg/jruby/runtime/builtin/IRubyObject;)JcallO-(Lorg/racob/com/Dispatch;I)Ljava/lang/Object;callD(Lorg/racob/com/Dispatch;ILjava/lang/Object;)Lorg/racob/com/Variant;convertToString()Lorg/jruby/RubyString;org/jruby/RubyString asJavaString()Ljava/lang/String;(Ljava/lang/String;)VendsWith(Ljava/lang/String;)Z()I substring(II)Ljava/lang/String;getC(Lorg/racob/com/Dispatch;Ljava/lang/String;)Lorg/racob/com/Variant;put?(Lorg/racob/com/Dispatch;Ljava/lang/String;Ljava/lang/Object;)VY(Lorg/racob/com/Dispatch;Ljava/lang/String;I[Ljava/lang/Object;[I)Lorg/racob/com/Variant;H(Lorg/racob/com/Dispatch;II[Ljava/lang/Object;[I)Lorg/racob/com/Variant;org/jruby/RubyArray eltInternal*(I)Lorg/jruby/runtime/builtin/IRubyObject;>(Lorg/racob/com/Dispatch;Ljava/lang/String;)Ljava/lang/Object;callNV(Lorg/racob/com/Dispatch;Ljava/lang/String;[Ljava/lang/Object;)Lorg/racob/com/Variant; booleanValue newBoolean(Z)Lorg/jruby/RubyBoolean;win32ole/Win32oleService getMetaClass()Lorg/jruby/RubyClass; doubleValue()DnewFloat(D)Lorg/jruby/RubyFloat;intValue newFixnum(I)Lorg/jruby/RubyFixnum; newString*(Ljava/lang/String;)Lorg/jruby/RubyString;org/racob/com/VariantgetType()S getBooleangetDate()Ljava/util/Date;getInt getDoublegetFloat()F getString toJavaObject()Ljava/lang/Object;java/util/Calendar getInstance()Ljava/util/Calendar;setTime(Ljava/util/Date;)VgetTimeInMillis()JnewTime(J)Lorg/jruby/RubyTime; startsWith!4VWXYZ [\]^_`aR *+,*b$! %c  de fg hi_ja\ *+,*-b(* +c* de fg hi ]^kla/*b.c de]ma@ +*b4c de nopqrsa6+N*::,+- W - b"9:>?@)A,B1Dc> tu6de6no6vw1fg(xypqz{aA- :*:,6+*+* bJKLNO.RcRAdeAnoA|}A~}A}91X*p qIam,2N*Y-*bX Z\c*deno~ pqIZaE*+,bac deno~pqIZ{a\ *+,--bgc4 de no |} ~} }pqa|,,2N-*+--d,*+-, bl n$qc*,de,no,~ #pqIZmaG*!+ b vxcdenopqac,N+*-" b }c*deno}pq[sIaw,:*-#$+ bc4deno}t}pq[sI{a] *+,-bc4 de no |} ~} }pqa],2N*+-,b  c*deno~ pqIZa%*-%: :*,&W+ bc>%de%no%%~XZa ;- :,6*:*': * (: + b 1cp ;de;no;|};~};};3,$X Z 1 u aB ) bcdea5+>d*d+:6d+2#Sb ,2c>5de552 Xa4+,=*+N6+-#:-S-b" &,2c>&4de4/"Xa|,-+*,.+*,*-%/ bc*,de,no,,~a9*bcde a4 *+0bc  } a+* +1*+123+4Y*5+6+7 *+78+95+:*+:;<+=*+=><*+9?@+A *+AB*+bB #3:CJQ]dp|cfg a+* +C~ YYkb~Pu@~7*+D34Y*5+E6*+F8*+G@*+H<*+I<*+JB*+Kb* DM]foxcfgu aXLM,+M*,NOb   c fg aV$*!*PQ*R**d*b"c $a8+* )SYTUb ( SPK mi=||win32ole/Win32oleService.class1I ) *+ ,-. / ,01 23 4 5 6789: win32oleClassLjava/lang/ref/WeakReference; Signature4Ljava/lang/ref/WeakReference;()VCodeLineNumberTableLocalVariableTablethisLwin32ole/Win32oleService; basicLoad(Lorg/jruby/Ruby;)ZruntimeLorg/jruby/Ruby;objectLorg/jruby/RubyClass;win32ole Exceptions; getMetaClass()Lorg/jruby/RubyClass; SourceFileWin32oleService.java < => ?&WIN32OLE @A BC#org/jruby/ext/win32ole/RubyWIN32OLE DEjava/lang/ref/WeakReference F  GHorg/jruby/RubyClasswin32ole/Win32oleServicejava/lang/Object*org/jruby/runtime/load/BasicLibraryServicejava/io/IOExceptionorg/racob/com/LibraryLoader loadLibraryorg/jruby/Ruby getObjectWIN32OLE_ALLOCATOR#Lorg/jruby/runtime/ObjectAllocator; defineClassa(Ljava/lang/String;Lorg/jruby/RubyClass;Lorg/jruby/runtime/ObjectAllocator;)Lorg/jruby/RubyClass;defineAnnotatedMethods(Ljava/lang/Class;)V(Ljava/lang/Object;)Vget()Ljava/lang/Object;!/*  '+M+,N- Y- %*'' !"!#$ %&" '(PK mi=cj22win32ole/utils.rbrequire 'win32ole/win32ole_variant' class WIN32OLE module Utils java_import org.racob.com.ComFailException java_import org.racob.com.Dispatch def SafeStringValue(str) return str if str.kind_of?(::String) if str.respond_to?(:to_str) str = str.to_str return str if str.kind_of?(::String) end raise TypeError end def WIN32OLE_TYPEValue(value) raise TypeError.new("1st argument should be WIN32OLE_TYPE object") unless value.kind_of? WIN32OLE_TYPE value end def methods_with_flag(flag) members = [] all_methods(typeinfo_from_ole) do |typeinfo, old_typeinfo, desc, docs, i| if desc.invkind & flag members << WIN32OLE_METHOD.new(nil, typeinfo, old_typeinfo, desc, docs, i) end nil end members end def all_methods(typeinfo, &block) # MRI: olemethod_from_typeinfo return unless typeinfo # Not all ole servers have this info # Find method in this type. ret = find_all_methods_in(nil, typeinfo, &block) return ret if ret # Now check all other type impls typeinfo.impl_types_count.times do |i| begin href = typeinfo.get_ref_type_of_impl_type(i) ref_typeinfo = typeinfo.get_ref_type_info(href) ret = find_all_methods_in(typeinfo, ref_typeinfo, &block) return ret if ret rescue ComFailException => e puts "Error getting impl types #{e}" end end nil end # MRI: ole_method_sub def find_all_methods_in(old_typeinfo, typeinfo, &block) typeinfo.funcs_count.times do |i| begin desc = typeinfo.get_func_desc(i) docs = typeinfo.get_documentation(desc.memid) ret = yield typeinfo, old_typeinfo, desc, docs, i return ret if ret rescue ComFailException => e puts "Error getting method info #{e}" end end nil end def typeinfo_from_ole # MRI: typeinfo_from_ole typeinfo = type_info docs = typeinfo.get_documentation(-1) type_lib = typeinfo.get_containing_type_lib type_lib.get_type_info_count.times do |i| begin tdocs = type_lib.get_documentation(i) return type_lib.get_type_info(i) if tdocs.name == docs.name rescue ComFailException => e # We continue on failure. end end type_info # Actually MRI seems like it could fail in weird case end def load_typelib(path_reg, arch) path = path_reg.open(arch) { |r| r.read(nil) }[1] # puts "PATH = #{path}" begin org.racob.com.Automation.loadTypeLib(path) rescue ComFailException => e # puts "Failed to load #{name} fom #{path} because: #{e}" nil end end def find_all_typeinfo(typelib) typelib.type_info_count.times do |i| docs = typelib.get_documentation(i) next unless docs info = typelib.get_type_info(i) next unless info yield info, docs end end def all_vars(typeinfo) typeinfo.vars_count.times do |i| desc = typeinfo.get_var_desc(i) next unless desc names = typeinfo.get_names(desc.memid) next if !names || names.length == 0 name = names[0] next unless name yield desc, name end end def reg_each_key_for(reg, subkey, &block) reg.open(subkey) do |subkey_reg| subkey_reg.each_key { |key, wtime| block.call(subkey_reg, key) } end end # Walks all guid/clsid entries and yields every single version # of those entries to the supplied block. See search_registry as # an example of its usage. def typelib_registry_each_guid_version Win32::Registry::HKEY_CLASSES_ROOT.open('TypeLib') do |reg| reg.each_key do |guid, wtime| reg.open(guid) do |guid_reg| guid_reg.each_key do |version_string, wtime| version = version_string.to_f begin guid_reg.open(version_string) do |version_reg| yield guid, version, version_reg end rescue Win32::Registry::Error => e # Version Entry may not contain anything. Skip. end end end end end end def registry_subkey(reg, *valid_subkeys) reg.each_key do |inner, wtime| reg_each_key_for(reg, inner) do |subkey_reg, subkey| yield subkey_reg, subkey if valid_subkeys.include? subkey end end end def search_registry(typelib_name) # MRI: oletypelib_search_registry typelib_registry_each_guid_version do |guid, version, reg| name = reg.read(nil)[1] || '' registry_subkey(reg, 'win32', 'win64') do |arch_reg, arch| type_lib = load_typelib(arch_reg, arch) # puts "GUID #{guid} #{version} #{arch} #{type_lib}" return type_lib if type_lib && name == typelib_name end end nil end def typedesc_value(vt, type_details=nil) type_string = WIN32OLE::VARIANT.variant_to_string(vt) || "Unknown Type #{vt}" type_details << type_string if type_details if vt == WIN32OLE::VARIANT::VT_PTR && type_details # TODO: Add detail logic end type_details ? type_details : type_string end end end PK mi= _S/win32ole/win32ole_error.rbclass WIN32OLERuntimeError < RuntimeError def initialize(cause=nil) @cause = cause end def backtrace @cause ? @cause.backtrace : super end def to_s @cause ? @cause.to_s : super end end PK mi=Ȯwin32ole/win32ole_event.rbclass WIN32OLE_EVENT java_import org.racob.com.DispatchEvents def initialize(ole, event_name=nil) @event_handlers = {} raise TypeError.new("1st parameter must be WIN32OLE object") if !ole.kind_of? WIN32OLE if event_name.nil? # Default event name # TODO: get default event end dispatch = ole.dispatch DispatchEvents.new dispatch, RubyInvocationProxy.new(self), dispatch.program_id end def on_event(name=nil, &block) if name @event_handlers[name.to_s] = block else @default_handler = block end end def method_missing(name, *args) name = name.to_s handler = @event_handlers[name] if handler handler.call *args elsif @default_handler @default_handler.call name, *args end end # Almost noop this. We don't because it get CPU hot when people put this # in a hot loop! def self.message_loop DispatchEvents.message_loop end end PK mi=Ƌ win32ole/win32ole_method.rbclass WIN32OLE_METHOD java_import org.racob.com.FuncDesc java_import org.racob.com.TypeInfo attr_accessor :oletype, :typeinfo def initialize(*args) # TODO: 2-arg missing currently unuised oletype ivar if args.length == 6 # Internal initializer @oletype, @typeinfo, @owner_typeinfo, @desc, @docs, @index = *args elsif args.length == 2 # Normal constructor @oletype, name = WIN32OLE_TYPEValue(args[0]), SafeStringValue(args[1]) all_methods(@oletype.typeinfo) do |ti, oti, desc, docs, index| if docs.name.downcase == name.downcase @typeinfo, @owner_typeinfo, @desc, @docs, @index = ti, oti, desc, docs, index break; end end raise WIN32OLERuntimeError.new "not found: #{name}" if !@typeinfo else # Error raise ArgumentError.new("2 for #{args.length}") end end def dispid @desc.memid end def event? return false if @owner_typeinfo.typekind != TypeInfo::TYPEKIND_COCLASS @owner_typeinfo.impl_types_count.times do |i| begin flags = @owner_typeinfo.get_impl_type_flags(i) if flags & TypeInfo::IMPLTYPEFLAG_FSOURCE href = @owner_typeinfo.get_ref_type_of_impl_type(i) ref_typeinfo = @owner_typeinfo.get_ref_type_info(href) func_desc = ref_typeinfo.func_desc(@index) documentation = ref_typeinfo.documentation(func_desc.memid) return true if documentation.name == name end rescue ComFailException => e end end false end def event_interface return nil unless event? typelib = @typeinfo.containing_type_lib documentation = typelib.documentation(typelib.index) documentation.name end def helpcontext @docs.help_context end def helpstring @docs.doc_string end def helpfile @docs.help_file end def invkind @desc.invkind end def invoke_kind invkind = @desc.invkind if invkind & Dispatch::Get && invkind & Dispatch::Put return "PROPERTY" elsif invkind & Dispatch::Get return "PROPERTYGET" elsif invkind & Dispatch::Put return "PROPERTYPUT" elsif invkind & Dispatch::PutRef return "PROPERTYPUTREF" elsif invkind & Dispatch::Method return "FUNC" else return "UNKOWN" end end def name @docs.name end alias :to_s :name def offset_vtbl @desc.vtable_offset end def params arr = [] @desc.parameters.to_a.each_with_index do |param, i| arr << WIN32OLE_PARAM.new(self, i, param) end arr end def return_type typedesc_value(@desc.return_type.vt) end def return_type_detail typedesc_value(@desc.return_type.vt, []) end def return_vtype @desc.return_type.vt end def size_opt_params @desc.opt_params_count end def size_params @desc.params_count end def visible? (@desc.flags & (FuncDesc::FUNCFLAG_FRESTRICTED | FuncDesc::FUNCFLAG_FHIDDEN | FuncDesc::FUNCFLAG_FNONBROWSABLE)) == 0 end def inspect name end include WIN32OLE::Utils end PK mi=win32ole/win32ole_param.rbclass WIN32OLE_PARAM attr_accessor :name def initialize(method, index, param_info=nil) raise TypeError.new("1st parameter must be WIN32OLE object") if !method.kind_of? WIN32OLE_METHOD @method, @index, @param = method, index, param_info end def default @param.is_default_value ? RubyWIN32OLE.from_variant(JRuby.runtime, @param.get_default_value) : nil end def input? @param.is_in end def name @param.name end alias :to_s :name alias :inspect :name def ole_type typedesc_value(@param.vt) end def ole_type_detail typedesc_value(@param.vt, []) end def output? @param.is_out end def optional? @param.is_optional end def retval? @param.is_return_value end include WIN32OLE::Utils end PK mi=I}T win32ole/win32ole_ruby.rbrequire 'win32ole/utils' require 'jruby' # Shorthand vocabulary: # ti, oti - typeinfo or owner_typeinfo class WIN32OLE CP_ACP = 0 CP_OEMCP = 1 CP_MACCP = 2 CP_THREAD_ACP = 3 CP_SYMBOL = 42 CP_UTF7 = 65000 CP_UTF8 = 65001 def ole_method(name) all_methods(typeinfo_from_ole) do |*args| return WIN32OLE_METHOD.new(nil, *args) if name == args[3].name nil end end alias :ole_method_help :ole_method def ole_methods members = [] all_methods(typeinfo_from_ole) do |*args| members << WIN32OLE_METHOD.new(nil, *args) nil end members end def ole_func_methods methods_with_flag(Dispatch::Method) end def ole_get_methods methods_with_flag(Dispatch::Get) end def ole_put_methods methods_with_flag(Dispatch::Put|Dispatch::PutRef) end def ole_type typelib = type_info.containing_type_lib docs = typelib.documentation(typelib.index) WIN32OLE_TYPE.new typelib, type_info, docs end alias :ole_obj_help :ole_type def ole_typelib typelib = type_info.containing_type_lib WIN32OLE_TYPELIB.new typelib, nil end def type_info dispatch.type_info end class << self def codepage @@codepage ||= CP_ACP end def codepage=(new_codepage) @@codepage = new_codepage end def connect(id) WIN32OLE.new to_progid(id) end def const_load(ole, a_class=WIN32OLE) constants = {} ole.type_info.containing_type_lib.type_info.to_a.each do |info| info.vars_count.times do |i| var_desc = info.get_var_desc(i) # TODO: Missing some additional flag checks to limit no. of constants if var_desc.constant name = first_var_name(info, var_desc) name = name[0].chr.upcase + name[1..-1] if name if constant?(name) a_class.const_set name, RubyWIN32OLE.from_variant(JRuby.runtime, var_desc.constant) else # vars which don't start [A-Z]? constants[name] = var_desc.constant end end end end a_class.const_set 'CONSTANTS', constants nil end def to_progid(id) id =~ /^{(.*)}/ ? "clsid:#{$1}" : id end private def constant?(name) name =~ /^[A-Z]/ end def first_var_name(type_info, var_desc) type_info.get_names(var_desc.memid)[0] rescue nil end end private include WIN32OLE::Utils end PK mi= win32ole/win32ole_type.rbclass WIN32OLE_TYPE java_import org.racob.com.TypeInfo attr_reader :typeinfo def initialize(*args) case args.length when 2 then typelib_name, olename = SafeStringValue(args[0]), SafeStringValue(args[1]) @typelib = WIN32OLE_TYPELIB.new(typelib_name) # Internal call find_all_typeinfo(@typelib.typelib) do |info, docs| if (docs.name == olename) @typeinfo, @docs = info, docs break end end raise WIN32OLERuntimeError.new("not found `#{olename}` in `#{typelib_name}") unless @typeinfo when 3 then @typelib, @typeinfo, @docs = *args else raise ArgumentError.new("wrong number of arguments (#{args.length} for 2)") end end def guid @typeinfo.guid end def helpcontext @docs.help_context end def helpstring @docs.doc_string end def helpfile @docs.help_file end def name @docs.name end def major_version @typeinfo.major_version end def minor_version @typeinfo.minor_version end def ole_methods members = [] all_methods(@typeinfo) do |ti, oti, desc, docs, index| members << WIN32OLE_METHOD.new(self, ti, oti, desc, docs, index) nil end members end def ole_type case typekind when TypeInfo::TYPEKIND_ENUM then "Enum" when TypeInfo::TYPEKIND_RECORD then "Record" when TypeInfo::TYPEKIND_MODULE then "Module" when TypeInfo::TYPEKIND_INTERFACE then "Interface" when TypeInfo::TYPEKIND_DISPATCH then "Dispatch" when TypeInfo::TYPEKIND_COCLASS then "Class" when TypeInfo::TYPEKIND_ALIAS then "Alias" when TypeInfo::TYPEKIND_UNION then "Union" when TypeInfo::TYPEKIND_MAX then "Max" else nil end end def progid @typeinfo.progid end def src_type return nil if @typeinfo.typekind != TypeInfo::TYPEKIND_ALIAS typedesc_value @typeinfo.alias_vt end def to_s name end def variables variables = [] all_vars(@typeinfo) do |desc, name| variables << WIN32OLE_VARIABLE.new(self, desc, name) end variables end def visible? @typeinfo.flags & (TypeInfo::TYPEFLAG_FHIDDEN | TypeInfo::TYPEFLAG_FRESTRICTED) == 0 end def typekind @typeinfo.typekind end class << self # This is obsolete, but easy to emulate def typelibs WIN32OLE_TYPELIB.typelibs.collect {|t| t.name } end def progids array = [] Win32::Registry::HKEY_CLASSES_ROOT.open('CLSID') do |reg| reg.each_key do |clsid, wtime| reg.open(clsid) do |clsid_reg| clsid_reg.each_key do |key, wtime| name = nil if key == "ProgID" clsid_reg.open(key) {|key_reg| name = key_reg.read(nil)[1] } end if !name && key == "VersionIndependentProgID" clsid_reg.open(key) {|key_reg| name = key_reg.read(nil)[1] } end array << name if name end end end end array end def ole_classes(tlib) WIN32OLE_TYPELIB.ole_classes(tlib) end end include WIN32OLE::Utils end PK mi=U-win32ole/win32ole_typelib.rbrequire 'win32/registry' class WIN32OLE_TYPELIB java_import org.racob.com.TypeLib attr_reader :typelib attr_reader :name alias :to_s :name def initialize(*args) # TODO: Make this work internally and externally API w/ regards to inargs if args.length == 2 @typelib, @name = *args puts "NO TYPELIB! for #{@name} #{@version}" unless @typelib elsif args.length == 1 @name = args[0] @typelib = search_registry(@name) # TODO: Missing search_registry2 # puts "NAME IS #{@name}///#{@typelib}" end end def guid @typelib.guid end def minor_version @typelib.minor_version end def major_version @typelib.major_version end def ole_classes # MRI: ole_types_from_typelib ole_classes = [] find_all_typeinfo(@typelib) do |info, docs| ole_classes << WIN32OLE_TYPE.new(self, info, docs) end ole_classes end def version [minor_version, major_version].join('.') end def visible? flags = @typelib.flags flags != 0 && (flags & TypeLib::LIBFLAG_FRESTRICTED) == 0 && (flags & TypeLib::LIBFLAG_FHIDDEN) == 0 end def inspect name end class << self def ole_classes(typelib) new(typelib).ole_classes end def typelibs typelibs = [] typelib_registry_each_guid_version do |guid, version, reg| name = reg.read(nil)[1] || '' registry_subkey(reg, 'win32', 'win64') do |arch_reg, arch| type_lib = load_typelib(arch_reg, arch) # TODO: I think MRI figures out a few more typelibs than we do typelibs << WIN32OLE_TYPELIB.new(type_lib, name) if type_lib end end typelibs end include WIN32OLE::Utils end include WIN32OLE::Utils end PK mi=R1::win32ole/win32ole_variable.rbclass WIN32OLE_VARIABLE java_import org.racob.com.VarDesc attr_reader :name def initialize(type, var_desc, name) @type, @var_desc, @name = type, var_desc, name end def ole_type @type.ole_type # MRI gets from vardesc, but why shouldn't this work? end def ole_type_detail # TODO: Fill in other details when they actually exist [@type.ole_type] end def value RubyWIN32OLE.from_variant(JRuby.runtime, @var_desc.constant) end def variable_kind case varkind when VarDesc::VAR_PERINSTANCE then "PERINSTANCE" when VarDesc::VAR_STATIC then "STATIC" when VarDesc::VAR_CONST then "CONSTANT" when VarDesc::VAR_DISPATCH then "DISPATCH" else "UNKNOWN" end end def varkind @var_desc.varkind end def inspect "#" end alias :to_s :name def visible? flags = @var_desc.flags flags & (VarDesc::VARFLAG_FHIDDEN | VarDesc::VARFLAG_FRESTRICTED | VarDesc::VARFLAG_FNONBROWSABLE) == 0 end include WIN32OLE::Utils end PK mi=Q \win32ole/win32ole_variant.rbclass WIN32OLE module VARIANT VT_I2 = 2 # Short VT_I4 = 3 # Int VT_R4 = 4 # Float VT_R8 = 5 # Double VT_CY = 6 # Currency VT_DATE = 7 # Date VT_BSTR = 8 # String VT_DISPATCH = 9 # Dispatch VT_ERROR = 10 # Error VT_BOOL = 11 # Boolean VT_VARIANT = 12 # Variant containing Variant VT_UNKNOWN = 13 # Unknown VT_DECIMAL = 14 # Decimal VT_I1 = 16 # Nothing in Jacob VT_UI1 = 17 # Byte VT_UI2 = 18 # Nothing in Jacob VT_UI4 = 19 # Nothing in Jacob VT_I8 = 20 # Not in MRI win32ole but in Jacob VT_UI8 = 21 # !Jacob VT_INT = 22 # Nothing in Jacob VT_UINT = 23 # Nothing in Jacob VT_VOID = 24 # !Jacob VT_HRESULT = 25 # !Jacob VT_PTR = 26 # Pointer VT_SAFEARRAY = 27 # !Jacob VT_CARRAY = 28 # !Jacob VT_USERDEFINED = 29 # !Jacob VT_LPSTR = 30 # !Jacob VT_LPWSTR = 31 # !Jacob VT_ARRAY = 8192 # Array VT_BYREF = 16384 # Reference VARIANTS = { VT_I2 => "I2", VT_I4 => "I4", VT_R4 => "R4", VT_R8 => "R8", VT_CY => "CY", VT_DATE => "DATE", VT_BSTR => "BSTR", VT_BOOL => "BOOL", VT_VARIANT => "VARIANT", VT_DECIMAL => "DECIMAL", VT_I1 => "I1", VT_UI1 => "UI1", VT_UI2 => "UI2", VT_UI4 => "UI4", VT_I8 => "I8", VT_UI8 => "UI8", VT_INT => "INT", VT_UINT => "UINT", VT_VOID => "VOID", VT_HRESULT => "HRESULT", VT_PTR => "PTR", VT_SAFEARRAY => "SAFEARRAY", VT_CARRAY => "CARRAY", VT_USERDEFINED => "USERDEFINED", VT_UNKNOWN => "UNKNOWN", VT_DISPATCH => "DISPATCH", VT_ERROR => "ERROR", VT_LPSTR => "LPSTR", VT_LPWSTR => "LPWSTR" } def variant_to_string(vt) VARIANTS[vt] end module_function :variant_to_string end end PK qi= AMETA-INF/PK qi==+META-INF/MANIFEST.MFPK mi=Ajruby-win32ole/PK mi=Aorg/PK mi= A?org/jruby/PK mi=Agorg/jruby/ext/PK mi=Aorg/jruby/ext/win32ole/PK mi= Awin32ole/PK mi=?£OOjruby-win32ole.rbPK qi=R??mjruby-win32ole/version.rbPK mi=S60org/jruby/ext/win32ole/RubyInvocationProxy.classPK mi=N\+ org/jruby/ext/win32ole/RubyWIN32OLE$1.classPK mi=_B(()?org/jruby/ext/win32ole/RubyWIN32OLE.classPK mi=||7win32ole/Win32oleService.classPK mi=cj22?=win32ole/utils.rbPK mi= _S/Rwin32ole/win32ole_error.rbPK mi=ȮSwin32ole/win32ole_event.rbPK mi=Ƌ Wwin32ole/win32ole_method.rbPK mi=cwin32ole/win32ole_param.rbPK mi=I}T gwin32ole/win32ole_ruby.rbPK mi= pwin32ole/win32ole_type.rbPK mi=U-}win32ole/win32ole_typelib.rbPK mi=R1::ńwin32ole/win32ole_variable.rbPK mi=Q \:win32ole/win32ole_variant.rbPK&