From djberg96 at gmail.com Fri May 1 18:58:04 2009 From: djberg96 at gmail.com (Daniel Berger) Date: Fri, 01 May 2009 16:58:04 -0600 Subject: [Win32utils-devel] [Fwd: [win32utils-open-discussion][69904] using win32api to get com object embedded IE] Message-ID: <49FB7E7C.7010407@gmail.com> Forwarded from the open-discussion forum... I don't know how many of you follow the discussion forum, but please take a peak from time to time if you have the chance. :) Dan -------------- next part -------------- An embedded message was scrubbed... From: matt wolfe Subject: [win32utils-open-discussion][69904] using win32api to get com object embedded IE Date: Fri, 1 May 2009 16:29:01 -0400 (EDT) Size: 5228 URL: From phasis at gmail.com Sat May 2 00:58:47 2009 From: phasis at gmail.com (Heesob Park) Date: Sat, 2 May 2009 13:58:47 +0900 Subject: [Win32utils-devel] [Fwd: [win32utils-open-discussion][69904] using win32api to get com object embedded IE] In-Reply-To: <49FB7E7C.7010407@gmail.com> References: <49FB7E7C.7010407@gmail.com> Message-ID: Hi, 2009/5/2 Daniel Berger : > Forwarded from the open-discussion forum... > > I don't know how many of you follow the discussion forum, but please take a > peak from time to time if you have the chance. :) > > Dan > > > ---------- ??? ??? ---------- > From:?matt wolfe > To:?noreply at rubyforge.org > Date:?Fri, 1 May 2009 16:29:01 -0400 (EDT) > Subject:?[win32utils-open-discussion][69904] using win32api to get com > object embedded IE > > Read and respond to this message at: > http://rubyforge.org/forum/message.php?msg_id=69904 > By: matt wolfe > > I'm trying to use win32api to get a com handle from an embedded IE window. > Does > anyone have an idea how to do this. > I've seen this done with autoit and the function which does it I've been > trying > to translate to ruby (well someone else tried already and failed, however > they > were on the right track it seems from my testing). I was wondering what does > it mean that this version of win32api has callback support? Basically I > believe > that may be what I need but I'm unsure. > > here is the function i'm trying to transalte from autoit to ruby: > > Func __IEControlGetObjFromHWND(ByRef $hWin) > ? ? ? ?DllCall("ole32.dll", "int", "CoInitialize", "ptr", 0) > ? ? ? ?Local Const $WM_HTML_GETOBJECT > = __IERegisterWindowMessage("WM_HTML_GETOBJECT") > ? ? ? ?Local Const $SMTO_ABORTIFHUNG = 0x0002 > ? ? ? ?Local $lResult, $typUUID, $aRet, $oIE > > ? ? ? ?__IESendMessageTimeout($hWin, $WM_HTML_GETOBJECT, 0, 0, > $SMTO_ABORTIFHUNG, > 1000, $lResult) > > ? ? ? ?$typUUID = DllStructCreate("int;short;short;byte[8]") > ? ? ? ?DllStructSetData($typUUID, 1, 0x626FC520) > ? ? ? ?DllStructSetData($typUUID, 2, 0xA41E) > ? ? ? ?DllStructSetData($typUUID, 3, 0x11CF) > ? ? ? ?DllStructSetData($typUUID, 4, 0xA7, 1) > ? ? ? ?DllStructSetData($typUUID, 4, 0x31, 2) > ? ? ? ?DllStructSetData($typUUID, 4, 0x0, 3) > ? ? ? ?DllStructSetData($typUUID, 4, 0xA0, 4) > ? ? ? ?DllStructSetData($typUUID, 4, 0xC9, 5) > ? ? ? ?DllStructSetData($typUUID, 4, 0x8, 6) > ? ? ? ?DllStructSetData($typUUID, 4, 0x26, 7) > ? ? ? ?DllStructSetData($typUUID, 4, 0x37, 8) > > > ? ? ? ?$aRet = DllCall("oleacc.dll", "long", "ObjectFromLresult", "lresult", > $lResult, > "ptr", DllStructGetPtr($typUUID), _ > ? ? ? ? ? ? ? ? ? ? ? ?"wparam", 0, "idispatch*", 0) > > ? ? ? ?If IsObj($aRet[4]) Then > ? ? ? ? ? ? ? ?$oIE = $aRet[4] .Script() > ? ? ? ? ? ? ? ?; $oIE is now a valid IDispatch object > ? ? ? ? ? ? ? ?Return $oIE.Document.parentwindow > ? ? ? ?Else > ? ? ? ? ? ? ? ?SetError(1) > ? ? ? ? ? ? ? ?Return 0 > ? ? ? ?EndIf > EndFunc ? ;==>__IEControlGetObjFromHWND > > > Any ideas on this? > > > > > > also note the following 2 functions: > Func __IERegisterWindowMessage($sMsg) > ? ? ? ?Local $aRet = DllCall("user32.dll", "int", "RegisterWindowMessage", > "str", > $sMsg) > ? ? ? ?If @error Then Return SetError(@error, @extended, 0) > ? ? ? ?Return $aRet[0] > EndFunc ? ;==> > > Func __IESendMessageTimeout($hWnd, $msg, $wParam, $lParam, $nFlags, > $nTimeout, > ByRef $vOut, $r = 0, $t1 = "int", $t2 = "int") > ? ? ? ?Local $aRet > ? ? ? ?$aRet = DllCall("user32.dll", "long", "SendMessageTimeout", "hwnd", > $hWnd, > "int", $msg, $t1, $wParam, _ > ? ? ? ? ? ? ? ? ? ? ? ?$t2, $lParam, "int", $nFlags, "int", $nTimeout, > "int*", "") > ? ? ? ?If @error Then > ? ? ? ? ? ? ? ?$vOut = 0 > ? ? ? ? ? ? ? ?Return SetError(@error, @extended, 0) > ? ? ? ?EndIf > ? ? ? ?$vOut = $aRet[7] > ? ? ? ?If $r >= 0 And $r <= 4 Then Return $aRet[$r] > ? ? ? ?Return $aRet > EndFunc ? ;==>__IESendMessageTimeout > > > > And what I have so far: > def get_control_from_hwnd(hnd) > ? ? ? ?Win32API.new("ole32", "CoInitialize", ['P'] , 'I').call(0) > > ? ? ? ?reg_msg = Win32API.new("user32", "RegisterWindowMessage", ['P'] > ,'I').call("WM_HTML_GETOBJECT") > ? ? ? ?puts "msg: " + reg_msg.to_s > ? ? ? ?result=" "*16 > ? ? ? ?aInt = [0xA7, 0x31, 0x0, 0xA0, 0xC9, 0x8, 0x26, 0x37].pack 'I*' > ? ? ? ?a = [0x626FC520, 0xA41E, 0x11CF, aInt].pack 'IIIP' > > ? ? ? ?sendMessagetimeout = Win32API.new("user32", "SendMessageTimeout", > ['L','I','I','I','I','I','P'] , 'L') > ? ? ? ?sendMessagetimeout.call(hnd.hex, reg_msg, 0, 0, SMTO_ABORTIFHUNG, > 1000, > result) > ? ? ? ?puts "result: " + result.to_s > ? ? ? ?puts "result unpacked: " + result.unpack("L").to_s > > #this is correct (confirmed by testing the same window with autoit) > puts result.unpack("L").class > > > ? ? ? ?idisp=0 > ? ? ? ?oIE = Win32API.new("oleacc", "ObjectFromLresult", ['P','P','I','P'] , > 'L') > ? ? ? ?puts "oIE: " + oIE.to_s > ? ? ? ?#puts oIE.methods > ? ? ? ?abc = oIE.call(result, a, 0, idisp) > ? ? ? ?puts "abc: " + abc.to_s > ? ? ? ?puts "idisp: " + idisp.to_s > ? ? ? ?# returning zero > ? ? ? ?puts idisp.unpack("L") > ? ? ? ?puts idisp > end > Here is a sample code to get a com handle from an embedded IE window. Does anyone know how to get WIN32OLE object from the com handle? require 'win32/api' SMTO_ABORTIFHUNG = 0x0002 CoInitialize = Win32::API.new('CoInitialize', 'P', 'L', 'ole32') RegisterWindowMessage = Win32::API.new('RegisterWindowMessage', 'P', 'I', 'user32') SendMessageTimeout = Win32::API.new('SendMessageTimeout', 'LILLIIP', 'L', 'user32') ObjectFromLresult = Win32::API.new('ObjectFromLresult', 'LPIP', 'L', 'oleacc') IIDFromString = Win32::API.new('IIDFromString', 'PP', 'L', 'ole32') def get_control_from_hwnd(hnd) CoInitialize.call(0) reg_msg = RegisterWindowMessage.call("WM_HTML_GETOBJECT") puts "msg: " + reg_msg.to_s iid =[0x626FC520,0xA41E,0x11CF,0xA7,0x31,0x00,0xA0,0xC9,0x08,0x26,0x37].pack('LSSC8') result = 0.chr*4 SendMessageTimeout.call(hnd.hex, reg_msg, 0, 0, SMTO_ABORTIFHUNG, 1000, result) puts "result unpacked: " + result.unpack("L").to_s result = result.unpack('L')[0] idisp = 0.chr * 4 r = ObjectFromLresult.call(result, iid, 0, idisp) if r == 0 idisp = idisp.unpack('L').first puts "idisp: " + idisp.to_s end idisp end p get_control_from_hwnd(handle) Regards, Park Heesob From phasis at gmail.com Mon May 4 02:48:44 2009 From: phasis at gmail.com (Heesob Park) Date: Mon, 4 May 2009 15:48:44 +0900 Subject: [Win32utils-devel] Normalized Dir.pwd Message-ID: Hi all, I think Dir.pwd should return a normalized uniform path name regardless of short or long path name. Current behaviour: C:\work>irb irb(main):001:0> Dir.chdir('c:/PROGRA~1') => 0 irb(main):002:0> Dir.pwd => "c:/PROGRA~1" irb(main):003:0> Dir.chdir('c:/PROGRAM FILES') => 0 irb(main):004:0> Dir.pwd => "c:/PROGRAM FILES" irb(main):005:0> Dir.chdir('c:/Program Files') => 0 irb(main):006:0> Dir.pwd => "c:/Program Files" Suggested behaviour: C:\work>irb -r 'win32/dir' irb(main):001:0> Dir.chdir('c:/PROGRA~1') => 0 irb(main):002:0> Dir.pwd => "c:\\Program Files" irb(main):003:0> Dir.chdir('c:/PROGRAM FILES') => 0 irb(main):004:0> Dir.pwd => c:\\Program Files" irb(main):005:0> Dir.chdir('c:/Program Files') => 0 irb(main):006:0> Dir.pwd => c:\\Program Files" Here is a draft pwd for win32/dir def self.pwd() path = 0.chr * MAXPATH path2 = 0.chr * MAXPATH path3 = 0.chr * MAXPATH GetCurrentDirectory(MAXPATH,path) GetShortPathName(path,path2,MAXPATH) GetLongPathName(path2,path3,MAXPATH) path3[/^[^\0]*/] end What do you think about this? Regards, Park Heesob From djberg96 at gmail.com Mon May 4 17:57:40 2009 From: djberg96 at gmail.com (Daniel Berger) Date: Mon, 4 May 2009 15:57:40 -0600 Subject: [Win32utils-devel] Normalized Dir.pwd In-Reply-To: References: Message-ID: <6037b70c0905041457g7d25dc56uedd0d95ea19d53cc@mail.gmail.com> On Mon, May 4, 2009 at 12:48 AM, Heesob Park wrote: > Hi all, > > I think Dir.pwd should return a normalized uniform path name > regardless of short or long path name. > > Current behaviour: > > C:\work>irb > irb(main):001:0> Dir.chdir('c:/PROGRA~1') > => 0 > irb(main):002:0> Dir.pwd > => "c:/PROGRA~1" > irb(main):003:0> Dir.chdir('c:/PROGRAM FILES') > => 0 > irb(main):004:0> Dir.pwd > => "c:/PROGRAM FILES" > irb(main):005:0> Dir.chdir('c:/Program Files') > => 0 > irb(main):006:0> Dir.pwd > => "c:/Program Files" > > Suggested behaviour: > > C:\work>irb -r 'win32/dir' > irb(main):001:0> Dir.chdir('c:/PROGRA~1') > => 0 > irb(main):002:0> Dir.pwd > => "c:\\Program Files" > irb(main):003:0> Dir.chdir('c:/PROGRAM FILES') > => 0 > irb(main):004:0> Dir.pwd > => c:\\Program Files" > irb(main):005:0> Dir.chdir('c:/Program Files') > => 0 > irb(main):006:0> Dir.pwd > => c:\\Program Files" > > Here is a draft pwd for win32/dir > > ? def self.pwd() > ? ? ?path ? ?= 0.chr * MAXPATH > ? ? ?path2 ? = 0.chr * MAXPATH > ? ? ?path3 ? = 0.chr * MAXPATH > ? ? ?GetCurrentDirectory(MAXPATH,path) > ? ? ? ? ?GetShortPathName(path,path2,MAXPATH) > ? ? ? ? ?GetLongPathName(path2,path3,MAXPATH) > ? ? ? ? ?path3[/^[^\0]*/] > ? end > > What do you think about this? Looks good to me. Please create a feature request and I'll add the change for the next version. :) Speaking of win32-dir, do you have any idea regarding this issue? http://rubyforge.org/tracker/index.php?func=detail&aid=21110&group_id=85&atid=412 Regards, Dan From phasis at gmail.com Mon May 4 18:36:27 2009 From: phasis at gmail.com (Heesob Park) Date: Tue, 5 May 2009 07:36:27 +0900 Subject: [Win32utils-devel] Normalized Dir.pwd In-Reply-To: <6037b70c0905041457g7d25dc56uedd0d95ea19d53cc@mail.gmail.com> References: <6037b70c0905041457g7d25dc56uedd0d95ea19d53cc@mail.gmail.com> Message-ID: 2009/5/5 Daniel Berger : > On Mon, May 4, 2009 at 12:48 AM, Heesob Park wrote: >> Hi all, > > Looks good to me. Please create a feature request and I'll add the > change for the next version. :) > I did. > Speaking of win32-dir, do you have any idea regarding this issue? > > http://rubyforge.org/tracker/index.php?func=detail&aid=21110&group_id=85&atid=412 In NTFS Junction Points, junction point target must be local path. Refer to http://support.microsoft.com/kb/205524/en-us Regards, Park Heesob From noreply at rubyforge.org Tue May 5 20:29:38 2009 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Tue, 5 May 2009 20:29:38 -0400 (EDT) Subject: [Win32utils-devel] [ win32utils-Feature Requests-25792 ] Create a pure Ruby win32-ole library Message-ID: <20090506002938.A2C8318581E9@rubyforge.org> Feature Requests item #25792, was opened at 2009-05-05 17:29 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=414&aid=25792&group_id=85 Category: None Group: None Status: Open Resolution: None Priority: 3 Submitted By: Daniel Berger (djberg96) Assigned to: Nobody (None) Summary: Create a pure Ruby win32-ole library Initial Comment: The current Win32OLE library is a C monster, has some bugs, and doesn't have a particularly good interface. I think a pure Ruby version would be easier to write and maintain, could have a more Ruby-ish interface, and could be installed as a gem instead of people having to wait for the next release of Ruby. Regards, Dan (me) ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=414&aid=25792&group_id=85 From phasis at gmail.com Wed May 6 02:31:26 2009 From: phasis at gmail.com (Heesob Park) Date: Wed, 6 May 2009 15:31:26 +0900 Subject: [Win32utils-devel] [ win32utils-Feature Requests-25792 ] Create a pure Ruby win32-ole library In-Reply-To: <20090506002938.A2C8318581E9@rubyforge.org> References: <20090506002938.A2C8318581E9@rubyforge.org> Message-ID: 2009/5/6 : > Feature Requests item #25792, was opened at 2009-05-05 17:29 > You can respond by visiting: > http://rubyforge.org/tracker/?func=detail&atid=414&aid=25792&group_id=85 > > Category: None > Group: None > Status: Open > Resolution: None > Priority: 3 > Submitted By: Daniel Berger (djberg96) > Assigned to: Nobody (None) > Summary: Create a pure Ruby win32-ole library > > Initial Comment: > The current Win32OLE library is a C monster, has some bugs, and doesn't have a particularly good interface. > > I think a pure Ruby version would be easier to write and maintain, could have a more Ruby-ish interface, and could be installed as a gem instead of people having to wait for the next release of Ruby. > As you know, OLE Automation programming in C is more difficult than in C++. Furthermore, OLE Automation programming in pure Ruby is a pain :) Here is a literal translation of the sample code from http://support.microsoft.com/kb/181473 require 'windows/com' require 'windows/unicode' require 'windows/error' require 'windows/national' require 'windows/msvcrt/buffer' include Windows::COM include Windows::Unicode include Windows::National include Windows::Error include Windows::MSVCRT::Buffer VariantInit = Win32::API.new('VariantInit', 'P', 'V', 'oleaut32') OleUninitialize = Win32::API.new('OleUninitialize', 'V', 'V', 'ole32') DISPID_UNKNOWN = -1 DISPID_VALUE = 0 DISPID_PROPERTYPUT = -3 DISPID_NEWENUM = -4 DISPID_EVALUATE = -5 DISPID_CONSTRUCTOR = -6 DISPID_DESTRUCTOR = -7 DISPID_COLLECT = -8 DISPATCH_METHOD = 0x1 DISPATCH_PROPERTYGET = 0x2 DISPATCH_PROPERTYPUT = 0x4 DISPATCH_PROPERTYPUTREF = 0x8 # Initialize OLE Libraries. OleInitialize() # Get CLSID for Excel.Application from registry. clsid_ptr = 0.chr * 4 hr = CLSIDFromProgID(multi_to_wide("Excel.Application"), clsid_ptr) clsid = clsid_ptr.unpack('L').first if hr != S_OK raise StandardError, "Excel not registered." end # Start Excel97, Excel 2000, or Excel 2002 and get its IDispatch pointer. pDisp = 0.chr * 4 IID_IDispatch = [0x00020400,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46].pack('LSSC8') hr = CoCreateInstance(clsid_ptr, nil, CLSCTX_LOCAL_SERVER, IID_IDispatch, pDisp) if hr != S_OK raise StandardError, "Couldn't start Excel." end pDisp = pDisp.unpack('L').first # Get the 'visible' property's DISPID. ucPtr = multi_to_wide("Visible") lpVtbl = 0.chr * 4 table = 0.chr * 28 memcpy(lpVtbl,pDisp,4) memcpy(table,lpVtbl.unpack('L').first,28) table = table.unpack('L*') GetIDsOfNames = Win32::API::Function.new(table[5],'PPPLLP','L') dispID = 0.chr * 4 IID_NULL = [0x00000000,0x0000,0x0000,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00].pack('LSSC8') GetIDsOfNames.call(pDisp,IID_NULL,[ucPtr].pack('P'),1,LOCALE_USER_DEFAULT,dispID) dispID = dispID.unpack('L').first puts("DISPID for 'Visible' property = 0x%08x" % dispID) # Initiate parameters to set visible property to true. parm1 = [VT_I4,0,0,0,1,0].pack('SSSSLL') # One argument. # Handle special-case for property-puts! dispidNamed = [DISPID_PROPERTYPUT].pack('L') dispParams = [[parm1].pack('P').unpack('L').first,[dispidNamed].pack('P').unpack('L').first,1,1].pack('LLLL') # Set 'visible' property to true. Invoke = Win32::API::Function.new(table[6],'PLPLLPPPP','L') hr = Invoke.call(pDisp, dispID, IID_NULL, LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYPUT | DISPATCH_METHOD, dispParams, nil, nil, nil) if hr != S_OK raise StandardError, "IDispatch::Invoke() failed with %08x" % hr end puts "done." gets # Uninitialize OLE Libraries. OleUninitialize.call() Regards, Park Heesob From djberg96 at gmail.com Thu May 14 15:47:47 2009 From: djberg96 at gmail.com (Daniel Berger) Date: Thu, 14 May 2009 13:47:47 -0600 Subject: [Win32utils-devel] Building Ruby with Visual Studio 2008 Message-ID: <6037b70c0905141247h24b89d07ia42c2b918d3fd23f@mail.gmail.com> I can no longer remember the magic incantation to setup my build environment properly. I've got both VC 6 and VC 9 installed, so I don't know if that's causing issues or what. Windows XP, btw. C:\Documents and Settings\djberge\My Documents\My Downloads\Ruby\ruby-1.8.6-p114>nmake DESTDIR=c:\rubyvc9 install Microsoft (R) Program Maintenance Utility Version 9.00.21022.08 Copyright (C) Microsoft Corporation. All rights reserved. .\miniruby.exe ./instruby.rb --dest-dir="c:\rubyvc9" --extout=".ext" --make="nmake" --mflags="" --make-flags=" " --insta lled-list .installed.list --mantype="" '.\miniruby.exe' is not recognized as an internal or external command, operable program or batch file. NMAKE : fatal error U1077: '.\miniruby.exe' : return code '0x1' Stop. C:\Documents and Settings\djberge\My Documents\My Downloads\Ruby\ruby-1.8.6-p114>set ALLUSERSPROFILE=C:\Documents and Settings\All Users APPDATA=C:\Documents and Settings\djberge\Application Data CC=cl -W3 CLIENTNAME=Console CommonProgramFiles=C:\Program Files\Common Files COMPUTERNAME=DANIEL-AB0B1958 ComSpec=C:\WINDOWS\system32\cmd.exe DevEnvDir=C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE FP_NO_HOST_CHECK=NO Framework35Version=v3.5 FrameworkDir=C:\WINDOWS\Microsoft.NET\Framework FrameworkVersion=v2.0.50727 HOMEDRIVE=C: HOMEPATH=\Documents and Settings\djberge INCLUDE=C:\Program Files\Microsoft Visual Studio 9.0\VC\ATLMFC\INCLUDE;C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE;C:\Program Files\\Micro soft SDKs\Windows\v6.0A\include; J2D_D3D=false LIB=C:\Program Files\Microsoft Visual Studio 9.0\VC\ATLMFC\LIB;C:\Program Files\Microsoft Visual Studio 9.0\VC\LIB;C:\Program Files\\Microsoft SDKs\Wi ndows\v6.0A\lib;c:\program files\microsoft visual studio\vc98\lib LIBPATH=C:\WINDOWS\Microsoft.NET\Framework\v3.5;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;C:\Program Files\Microsoft Visual Studio 9.0\VC\ATLMFC\L IB;C:\Program Files\Microsoft Visual Studio 9.0\VC\LIB; LOGONSERVER=\\DANIEL-AB0B1958 NUMBER_OF_PROCESSORS=2 OS=Windows_NT Path=C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE;C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN;C:\Program Files\Microsoft Visual St udio 9.0\Common7\Tools;C:\WINDOWS\Microsoft.NET\Framework\v3.5;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;C:\Program Files\Microsoft Visual Studio 9.0\VC\VCPackages;C:\Program Files\\Microsoft SDKs\Windows\v6.0A\bin;C:\Ruby\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;c:\usr\local\ wbin;C:\Program Files\PostgreSQL\8.3\bin;c:\Program Files\Microsoft SQL Server\90\Tools\binn\;c:\program files\microsoft visual studio\vc98\bin PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.RB;.RBW PROCESSOR_ARCHITECTURE=x86 PROCESSOR_IDENTIFIER=x86 Family 6 Model 15 Stepping 6, GenuineIntel PROCESSOR_LEVEL=6 PROCESSOR_REVISION=0f06 ProgramFiles=C:\Program Files PROMPT=$P$G RUBYOPT=-rubygems SESSIONNAME=Console SystemDrive=C: SystemRoot=C:\WINDOWS TEMP=C:\DOCUME~1\djberge\LOCALS~1\Temp TMP=C:\DOCUME~1\djberge\LOCALS~1\Temp USERDOMAIN=DANIEL-AB0B1958 USERNAME=djberge USERPROFILE=C:\Documents and Settings\djberge VCINSTALLDIR=C:\Program Files\Microsoft Visual Studio 9.0\VC VS90COMNTOOLS=C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\ VSINSTALLDIR=C:\Program Files\Microsoft Visual Studio 9.0 windir=C:\WINDOWS WindowsSdkDir=C:\Program Files\\Microsoft SDKs\Windows\v6.0A\ I ran vcvars32.bat, too, but that didn't help. Regards, Dan From djberg96 at gmail.com Thu May 14 16:14:26 2009 From: djberg96 at gmail.com (Daniel Berger) Date: Thu, 14 May 2009 14:14:26 -0600 Subject: [Win32utils-devel] (no subject) Message-ID: <009601c9d4d0$96577590$c30660b0$@com> Hi, Vista Visual Studio 2008 This has popped up on my Vista box with a fresh download of ruby-1.8.6-p114: pack.c(1926) : warning C4018: '>' : signed/unsigned mismatch byacc ./parse.y 'byacc' is not recognized as an internal or external command, operable program or batch file. NMAKE : fatal error U1077: 'byacc' : return code '0x1' Stop. I don't have byacc installed, but I recall that this only happens if parse.y and parse.c don't have the same timestamp. But, I haven't touched either and it looks like they do have the same timestamp. What's happening? Regards, Dan From phasis at gmail.com Thu May 14 20:36:14 2009 From: phasis at gmail.com (Heesob Park) Date: Fri, 15 May 2009 09:36:14 +0900 Subject: [Win32utils-devel] Building Ruby with Visual Studio 2008 In-Reply-To: <6037b70c0905141247h24b89d07ia42c2b918d3fd23f@mail.gmail.com> References: <6037b70c0905141247h24b89d07ia42c2b918d3fd23f@mail.gmail.com> Message-ID: Hi, 2009/5/15 Daniel Berger : > I can no longer remember the magic incantation to setup my build > environment properly. I've got both VC 6 and VC 9 installed, so I > don't know if that's causing issues or what. > > Windows XP, btw. > > C:\Documents and Settings\djberge\My Documents\My > Downloads\Ruby\ruby-1.8.6-p114>nmake DESTDIR=c:\rubyvc9 install > > Microsoft (R) Program Maintenance Utility Version 9.00.21022.08 > Copyright (C) Microsoft Corporation. ?All rights reserved. > > ? ? ? ?.\miniruby.exe ?./instruby.rb --dest-dir="c:\rubyvc9" > --extout=".ext" ?--make="nmake" ?--mflags="" ?--make-flags=" > ? ? ? " --insta > lled-list .installed.list --mantype="" > '.\miniruby.exe' is not recognized as an internal or external command, > operable program or batch file. > NMAKE : fatal error U1077: '.\miniruby.exe' : return code '0x1' > Stop. > > C:\Documents and Settings\djberge\My Documents\My > Downloads\Ruby\ruby-1.8.6-p114>set > ALLUSERSPROFILE=C:\Documents and Settings\All Users > APPDATA=C:\Documents and Settings\djberge\Application Data > CC=cl -W3 > CLIENTNAME=Console > CommonProgramFiles=C:\Program Files\Common Files > COMPUTERNAME=DANIEL-AB0B1958 > ComSpec=C:\WINDOWS\system32\cmd.exe > DevEnvDir=C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE > FP_NO_HOST_CHECK=NO > Framework35Version=v3.5 > FrameworkDir=C:\WINDOWS\Microsoft.NET\Framework > FrameworkVersion=v2.0.50727 > HOMEDRIVE=C: > HOMEPATH=\Documents and Settings\djberge > INCLUDE=C:\Program Files\Microsoft Visual Studio > 9.0\VC\ATLMFC\INCLUDE;C:\Program Files\Microsoft Visual Studio > 9.0\VC\INCLUDE;C:\Program Files\\Micro > soft SDKs\Windows\v6.0A\include; > J2D_D3D=false > LIB=C:\Program Files\Microsoft Visual Studio > 9.0\VC\ATLMFC\LIB;C:\Program Files\Microsoft Visual Studio > 9.0\VC\LIB;C:\Program Files\\Microsoft SDKs\Wi > ndows\v6.0A\lib;c:\program files\microsoft visual studio\vc98\lib > LIBPATH=C:\WINDOWS\Microsoft.NET\Framework\v3.5;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;C:\Program > Files\Microsoft Visual Studio 9.0\VC\ATLMFC\L > IB;C:\Program Files\Microsoft Visual Studio 9.0\VC\LIB; > LOGONSERVER=\\DANIEL-AB0B1958 > NUMBER_OF_PROCESSORS=2 > OS=Windows_NT > Path=C:\Program Files\Microsoft Visual Studio > 9.0\Common7\IDE;C:\Program Files\Microsoft Visual Studio > 9.0\VC\BIN;C:\Program Files\Microsoft Visual St > udio 9.0\Common7\Tools;C:\WINDOWS\Microsoft.NET\Framework\v3.5;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;C:\Program > Files\Microsoft Visual Studio > 9.0\VC\VCPackages;C:\Program Files\\Microsoft > SDKs\Windows\v6.0A\bin;C:\Ruby\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;c:\usr\local\ > wbin;C:\Program Files\PostgreSQL\8.3\bin;c:\Program Files\Microsoft > SQL Server\90\Tools\binn\;c:\program files\microsoft visual > studio\vc98\bin > PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.RB;.RBW > PROCESSOR_ARCHITECTURE=x86 > PROCESSOR_IDENTIFIER=x86 Family 6 Model 15 Stepping 6, GenuineIntel > PROCESSOR_LEVEL=6 > PROCESSOR_REVISION=0f06 > ProgramFiles=C:\Program Files > PROMPT=$P$G > RUBYOPT=-rubygems > SESSIONNAME=Console > SystemDrive=C: > SystemRoot=C:\WINDOWS > TEMP=C:\DOCUME~1\djberge\LOCALS~1\Temp > TMP=C:\DOCUME~1\djberge\LOCALS~1\Temp > USERDOMAIN=DANIEL-AB0B1958 > USERNAME=djberge > USERPROFILE=C:\Documents and Settings\djberge > VCINSTALLDIR=C:\Program Files\Microsoft Visual Studio 9.0\VC > VS90COMNTOOLS=C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\ > VSINSTALLDIR=C:\Program Files\Microsoft Visual Studio 9.0 > windir=C:\WINDOWS > WindowsSdkDir=C:\Program Files\\Microsoft SDKs\Windows\v6.0A\ > > I ran vcvars32.bat, too, but that didn't help. > This is a bug of ruby's Makefile. First, you must run 'nmake' to build miniruby.exe Then, run 'nmake DESTDIR=c:\rubyvc9 install' Regards, Park Heesob From phasis at gmail.com Thu May 14 20:40:07 2009 From: phasis at gmail.com (Heesob Park) Date: Fri, 15 May 2009 09:40:07 +0900 Subject: [Win32utils-devel] (no subject) In-Reply-To: <009601c9d4d0$96577590$c30660b0$@com> References: <009601c9d4d0$96577590$c30660b0$@com> Message-ID: Hi, 2009/5/15 Daniel Berger : > Hi, > > Vista > Visual Studio 2008 > > This has popped up on my Vista box with a fresh download of ruby-1.8.6-p114: > > pack.c(1926) : warning C4018: '>' : signed/unsigned mismatch > ? ? ? ?byacc ?./parse.y > 'byacc' is not recognized as an internal or external command, > operable program or batch file. > NMAKE : fatal error U1077: 'byacc' : return code '0x1' > Stop. > > I don't have byacc installed, but I recall that this only happens if parse.y > and parse.c don't have the same timestamp. But, I haven't touched either and > it looks like they do have the same timestamp. What's happening? > In order to skip byacc, parse.y must precede parse.c in the timestamp. Regards, Park Heesob From luislavena at gmail.com Fri May 15 00:01:26 2009 From: luislavena at gmail.com (Luis Lavena) Date: Fri, 15 May 2009 01:01:26 -0300 Subject: [Win32utils-devel] Building Ruby with Visual Studio 2008 In-Reply-To: References: <6037b70c0905141247h24b89d07ia42c2b918d3fd23f@mail.gmail.com> Message-ID: <71166b3b0905142101l75e7c34i54a9ec7984d64613@mail.gmail.com> On Thu, May 14, 2009 at 9:36 PM, Heesob Park wrote: > Hi, > > 2009/5/15 Daniel Berger : >> I can no longer remember the magic incantation to setup my build >> environment properly. I've got both VC 6 and VC 9 installed, so I >> don't know if that's causing issues or what. >> >> Windows XP, btw. >> >> C:\Documents and Settings\djberge\My Documents\My >> Downloads\Ruby\ruby-1.8.6-p114>nmake DESTDIR=c:\rubyvc9 install >> >> [...] >> >> I ran vcvars32.bat, too, but that didn't help. >> > This is a bug of ruby's Makefile. > > First, you must run 'nmake' to build miniruby.exe > > Then, run 'nmake DESTDIR=c:\rubyvc9 install' > Question guys: Is there a particular reason youguys are using Visual Studio to build Ruby? wonder since I opted for MinGW to reduce the cross-platform details between Linux/OSX and Windows, and due licensing and setup issues on getting Visual studio actually build everything. Just a question :-) Cheers, -- Luis Lavena AREA 17 - Perfection in design is achieved not when there is nothing more to add, but rather when there is nothing more to take away. Antoine de Saint-Exup?ry From phasis at gmail.com Fri May 15 00:43:07 2009 From: phasis at gmail.com (Heesob Park) Date: Fri, 15 May 2009 13:43:07 +0900 Subject: [Win32utils-devel] Pure Ruby win32-ole library Message-ID: Hi all, As a response to the feature request http://rubyforge.org/tracker/index.php?func=detail&aid=25792&group_id=85&atid=414, I have been struggling with the win32ole in these days. The implementation is almost done except for some event handling. It passed all the test codes provided with the MRI win32ole module except for test_win32ole_event.rb I have got stuck in IConnectionPoint::Advise right now. If you are familiar with the COM event handling, please give me some advice. The code is available at http://121.78.227.9/win32-ole/win32ole.rb Regards, Park Heesob From djberg96 at gmail.com Fri May 15 19:04:04 2009 From: djberg96 at gmail.com (Daniel Berger) Date: Fri, 15 May 2009 17:04:04 -0600 Subject: [Win32utils-devel] Pure Ruby win32-ole library In-Reply-To: References: Message-ID: <6037b70c0905151604l548603bbtc9af32d21e9269c2@mail.gmail.com> On Thu, May 14, 2009 at 10:43 PM, Heesob Park wrote: > Hi all, > > As a response to the feature request > http://rubyforge.org/tracker/index.php?func=detail&aid=25792&group_id=85&atid=414, > I have been struggling with the win32ole in these days. The > implementation is almost done except for some event handling. > It passed all the test codes provided with the MRI win32ole module > except for test_win32ole_event.rb > > I have got stuck in IConnectionPoint::Advise right now. If you are > familiar with the COM event handling, please give me some advice. > > The code is available at http://121.78.227.9/win32-ole/win32ole.rb Excellent work! I did notice one mistake: # Wrong function name SysFreeString = Win32::API.new('SysAllocString', 'L', 'V', 'oleaut32') Also, most of the functions you need are in the Windows::COM::Automation module. A few are missing, so I've added those, along with the constant enum values. I did notice a prototype difference for SysAllocString. I return the string, but you want the address? I'll take a look at the IConnectionPoint::Advise code soon. Regards, Dan From phasis at gmail.com Fri May 15 20:22:20 2009 From: phasis at gmail.com (Park Heesob) Date: Sat, 16 May 2009 09:22:20 +0900 Subject: [Win32utils-devel] Pure Ruby win32-ole library References: <6037b70c0905151604l548603bbtc9af32d21e9269c2@mail.gmail.com> Message-ID: <9630A27739F345A1B0A6B33CF0F23803@mycomputer> Hi, ----- Original Message ----- From: "Daniel Berger" To: "Development and ideas for win32utils projects" Sent: Saturday, May 16, 2009 8:04 AM Subject: Re: [Win32utils-devel] Pure Ruby win32-ole library > On Thu, May 14, 2009 at 10:43 PM, Heesob Park wrote: >> Hi all, >> >> As a response to the feature request >> http://rubyforge.org/tracker/index.php?func=detail&aid=25792&group_id=85&atid=414, >> I have been struggling with the win32ole in these days. The >> implementation is almost done except for some event handling. >> It passed all the test codes provided with the MRI win32ole module >> except for test_win32ole_event.rb >> >> I have got stuck in IConnectionPoint::Advise right now. If you are >> familiar with the COM event handling, please give me some advice. >> >> The code is available at http://121.78.227.9/win32-ole/win32ole.rb > > Excellent work! > > I did notice one mistake: > > # Wrong function name > SysFreeString = Win32::API.new('SysAllocString', 'L', 'V', 'oleaut32') > I fixed it. > Also, most of the functions you need are in the > Windows::COM::Automation module. A few are missing, so I've added > those, along with the constant enum values. > > I did notice a prototype difference for SysAllocString. I return the > string, but you want the address? > Yes. The SysAllocXXX should return the address. BTW, you mistacked RegEnumKeyEx's prototype in registry.rb 'LLPPPPP' should be 'LLPPPPPP' Also LoadTypeLibEx's prototype 'PPP' should be 'PLP'. > I'll take a look at the IConnectionPoint::Advise code soon. > I guess it is related with the callback function implementation. When I tested with the native C function, it works. Thanks, Park Heesob From djberg96 at gmail.com Fri May 15 22:13:15 2009 From: djberg96 at gmail.com (Daniel Berger) Date: Fri, 15 May 2009 20:13:15 -0600 Subject: [Win32utils-devel] Pure Ruby win32-ole library In-Reply-To: <9630A27739F345A1B0A6B33CF0F23803@mycomputer> References: <6037b70c0905151604l548603bbtc9af32d21e9269c2@mail.gmail.com> <9630A27739F345A1B0A6B33CF0F23803@mycomputer> Message-ID: <6037b70c0905151913nffddfbcu6f4b4271c0f53b44@mail.gmail.com> On Fri, May 15, 2009 at 6:22 PM, Park Heesob wrote: > Hi, >> Also, most of the functions you need are in the >> Windows::COM::Automation module. A few are missing, so I've added >> those, along with the constant enum values. >> >> I did notice a prototype difference for SysAllocString. I return the >> string, but you want the address? >> > Yes. The SysAllocXXX should return the address. > > BTW, you mistacked RegEnumKeyEx's prototype in registry.rb > 'LLPPPPP' should be 'LLPPPPPP' > Also LoadTypeLibEx's prototype 'PPP' should be 'PLP'. I've corrected the mistakes you mentioned, thank you. I've released windows-pr 1.0.4 that should have everything you need now. Please let me know if there's anything I've missed. >> I'll take a look at the IConnectionPoint::Advise code soon. >> > ?I guess it is related with the callback function implementation. When I > tested with the native C function, it works. Perhaps we could borrow some ideas from that other code that used asm? Do you have an easy test case? Regards, Dan From phasis at gmail.com Sat May 16 11:55:10 2009 From: phasis at gmail.com (Heesob Park) Date: Sun, 17 May 2009 00:55:10 +0900 Subject: [Win32utils-devel] Pure Ruby win32-ole library In-Reply-To: <6037b70c0905151913nffddfbcu6f4b4271c0f53b44@mail.gmail.com> References: <6037b70c0905151604l548603bbtc9af32d21e9269c2@mail.gmail.com> <9630A27739F345A1B0A6B33CF0F23803@mycomputer> <6037b70c0905151913nffddfbcu6f4b4271c0f53b44@mail.gmail.com> Message-ID: Hi, 2009/5/16 Daniel Berger : > On Fri, May 15, 2009 at 6:22 PM, Park Heesob wrote: >> Hi, > > > >>> Also, most of the functions you need are in the >>> Windows::COM::Automation module. A few are missing, so I've added >>> those, along with the constant enum values. >>> >>> I did notice a prototype difference for SysAllocString. I return the >>> string, but you want the address? >>> >> Yes. The SysAllocXXX should return the address. >> >> BTW, you mistacked RegEnumKeyEx's prototype in registry.rb >> 'LLPPPPP' should be 'LLPPPPPP' >> Also LoadTypeLibEx's prototype 'PPP' should be 'PLP'. > > I've corrected the mistakes you mentioned, thank you. I've released > windows-pr 1.0.4 that should have everything you need now. Please let > me know if there's anything I've missed. > >>> I'll take a look at the IConnectionPoint::Advise code soon. >>> >> ?I guess it is related with the callback function implementation. When I >> tested with the native C function, it works. > > Perhaps we could borrow some ideas from that other code that used asm? > Do you have an easy test case? > Finally I have finished the first release of pure Ruby version of win32-ole including event handling. Of course, there are still some untested bugs. I have done the code refactoring of the callback function of the win32-api module inevitably to support user defined event handler. Although the api.c code looks uncomfortable, it's my best choice for now. For me, using inline assembly seems dependent on compiler or cpu and unstable. The code is available at http://121.78.227.9/win32-ole/ Regads, Park Heesob From phasis at gmail.com Tue May 19 21:42:00 2009 From: phasis at gmail.com (Heesob Park) Date: Wed, 20 May 2009 10:42:00 +0900 Subject: [Win32utils-devel] Pure Ruby win32-ole library In-Reply-To: <6037b70c0905151913nffddfbcu6f4b4271c0f53b44@mail.gmail.com> References: <6037b70c0905151604l548603bbtc9af32d21e9269c2@mail.gmail.com> <9630A27739F345A1B0A6B33CF0F23803@mycomputer> <6037b70c0905151913nffddfbcu6f4b4271c0f53b44@mail.gmail.com> Message-ID: Hi, 2009/5/16 Daniel Berger : > On Fri, May 15, 2009 at 6:22 PM, Park Heesob wrote: >> Hi, > > > >>> Also, most of the functions you need are in the >>> Windows::COM::Automation module. A few are missing, so I've added >>> those, along with the constant enum values. >>> >>> I did notice a prototype difference for SysAllocString. I return the >>> string, but you want the address? >>> >> Yes. The SysAllocXXX should return the address. >> >> BTW, you mistacked RegEnumKeyEx's prototype in registry.rb >> 'LLPPPPP' should be 'LLPPPPPP' >> Also LoadTypeLibEx's prototype 'PPP' should be 'PLP'. > > I've corrected the mistakes you mentioned, thank you. I've released > windows-pr 1.0.4 that should have everything you need now. Please let > me know if there's anything I've missed. > I uploaded a new version of win32ole.rb which applied the latest windows-pr. It is http://121.78.227.9/win32-ole/win32ole.rb.new Following two files should be modified to work properly. automation.rb API.new('SafeArrayCreate', 'LLP', 'L', 'oleaut32') API.new('SafeArrayCreateVector', 'LLL', 'L', 'oleaut32') national.rb begin API.new('EnumTimeFormatsEx', 'KSLP', 'B') API.new('GetCurrencyFormatEx', 'PLPPPI', 'I') API.new('GetDateFormatEx', 'SLPSPIS', 'I') rescue Win32::API::LoadLibraryError # Windows Vista or later end Regards, Park Heesob From djberg96 at gmail.com Wed May 20 00:00:12 2009 From: djberg96 at gmail.com (Daniel Berger) Date: Tue, 19 May 2009 22:00:12 -0600 Subject: [Win32utils-devel] Pure Ruby win32-ole library In-Reply-To: References: <6037b70c0905151604l548603bbtc9af32d21e9269c2@mail.gmail.com> <9630A27739F345A1B0A6B33CF0F23803@mycomputer> <6037b70c0905151913nffddfbcu6f4b4271c0f53b44@mail.gmail.com> Message-ID: <6037b70c0905192100q57a6524cw87868420c33a2cfe@mail.gmail.com> On Tue, May 19, 2009 at 7:42 PM, Heesob Park wrote: > Hi, > > 2009/5/16 Daniel Berger : >> On Fri, May 15, 2009 at 6:22 PM, Park Heesob wrote: >>> Hi, >> >> >> >>>> Also, most of the functions you need are in the >>>> Windows::COM::Automation module. A few are missing, so I've added >>>> those, along with the constant enum values. >>>> >>>> I did notice a prototype difference for SysAllocString. I return the >>>> string, but you want the address? >>>> >>> Yes. The SysAllocXXX should return the address. >>> >>> BTW, you mistacked RegEnumKeyEx's prototype in registry.rb >>> 'LLPPPPP' should be 'LLPPPPPP' >>> Also LoadTypeLibEx's prototype 'PPP' should be 'PLP'. >> >> I've corrected the mistakes you mentioned, thank you. I've released >> windows-pr 1.0.4 that should have everything you need now. Please let >> me know if there's anything I've missed. >> > I uploaded a new version of win32ole.rb which applied the latest windows-pr. > It is ?http://121.78.227.9/win32-ole/win32ole.rb.new > > Following two files should be modified to work properly. > > automation.rb > > ? ? ? ? API.new('SafeArrayCreate', 'LLP', 'L', 'oleaut32') > ? ? ? ? API.new('SafeArrayCreateVector', 'LLL', 'L', 'oleaut32') > > national.rb > > ? ? ?begin > ? ? ? ? API.new('EnumTimeFormatsEx', 'KSLP', 'B') > ? ? ? ? API.new('GetCurrencyFormatEx', 'PLPPPI', 'I') > ? ? ? ? API.new('GetDateFormatEx', 'SLPSPIS', 'I') > ? ? ?rescue Win32::API::LoadLibraryError > ? ? ? ? # Windows Vista or later > ? ? ?end Thanks Heesob, I've applied these changes in CVS. I also noticed I accidentally set VARIANT_TRUE to 1 instead of -1. I've updated that as well. I'll try to get a release out very soon. Regards, Dan From djberg96 at gmail.com Fri May 29 23:18:31 2009 From: djberg96 at gmail.com (Daniel Berger) Date: Fri, 29 May 2009 21:18:31 -0600 Subject: [Win32utils-devel] win32-api 1.4.1 released Message-ID: <6037b70c0905292018u5f36ba80mc9656c66898691de@mail.gmail.com> Hi all, I've released win32-api 1.4.1. This includes the updated callback code that Heesob posted. Regards, Dan