win32ole 1.8.8 → 1.8.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.git-blame-ignore-revs +7 -0
- data/.github/dependabot.yml +6 -0
- data/.github/workflows/windows.yml +30 -0
- data/Gemfile +3 -2
- data/Rakefile +10 -1
- data/ext/win32ole/sample/xml.rb +6 -6
- data/ext/win32ole/win32ole.c +97 -95
- data/ext/win32ole/win32ole.h +2 -2
- data/ext/win32ole/win32ole_error.c +3 -0
- data/ext/win32ole/win32ole_error.h +2 -2
- data/ext/win32ole/win32ole_event.c +11 -10
- data/ext/win32ole/win32ole_method.c +5 -2
- data/ext/win32ole/win32ole_method.h +1 -1
- data/ext/win32ole/win32ole_param.c +2 -1
- data/ext/win32ole/win32ole_record.c +4 -1
- data/ext/win32ole/win32ole_record.h +1 -1
- data/ext/win32ole/win32ole_type.c +5 -2
- data/ext/win32ole/win32ole_type.h +1 -1
- data/ext/win32ole/win32ole_typelib.c +12 -9
- data/ext/win32ole/win32ole_typelib.h +1 -1
- data/ext/win32ole/win32ole_variable.c +5 -1
- data/ext/win32ole/win32ole_variable.h +1 -1
- data/ext/win32ole/win32ole_variant.c +7 -4
- data/ext/win32ole/win32ole_variant.h +1 -1
- data/ext/win32ole/win32ole_variant_m.c +3 -1
- data/ext/win32ole/win32ole_variant_m.h +1 -1
- data/rakelib/changelogs.rake +34 -0
- data/rakelib/epoch.rake +5 -0
- data/rakelib/version.rake +45 -0
- data/win32ole.gemspec +11 -1
- metadata +9 -4
- data/.travis.yml +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eeded5c3c12c689465044f51fcb85120250656bdccd82aed9f361bd49dac58d8
|
4
|
+
data.tar.gz: 3544f2afa9b6843d31e44dacc08d9d867751c207389df0d50acb0d1e797b1c01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce52dc4fd54fd403a2bc56b50caab5740b669b44268de725168abf8f0793923056f0eac6542535d085dbc3175edc97c0aeb9d817d37b6cfabd1a61efa98689f1
|
7
|
+
data.tar.gz: eeff5a7db020796fee5b4e3e699e1b1f777f02af072424b1c7ddeb6aa4bfcb566494efac194a10a10a1ea026070862586fd764ae7c51ae5f6eb9f8bbbf6bbd65
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# This is a file used by GitHub to ignore the following commits on `git blame`.
|
2
|
+
#
|
3
|
+
# You can also do the same thing in your local repository with:
|
4
|
+
# $ git config --local blame.ignoreRevsFile .git-blame-ignore-revs
|
5
|
+
|
6
|
+
# Expand tabs
|
7
|
+
0667bd63edb6bffeaa59f7ebc3dbe42b82ac496d
|
@@ -0,0 +1,30 @@
|
|
1
|
+
name: windows
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
ruby-versions:
|
7
|
+
uses: ruby/actions/.github/workflows/ruby_versions.yml@master
|
8
|
+
with:
|
9
|
+
engine: cruby
|
10
|
+
min_version: 2.6
|
11
|
+
versions: '["mswin", "mingw"]'
|
12
|
+
|
13
|
+
test:
|
14
|
+
needs: ruby-versions
|
15
|
+
name: build (${{ matrix.ruby }})
|
16
|
+
strategy:
|
17
|
+
fail-fast: false
|
18
|
+
matrix:
|
19
|
+
ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
|
20
|
+
runs-on: windows-latest
|
21
|
+
steps:
|
22
|
+
- uses: actions/checkout@v4
|
23
|
+
- name: Set up Ruby
|
24
|
+
uses: ruby/setup-ruby@v1
|
25
|
+
with:
|
26
|
+
ruby-version: ${{ matrix.ruby }}
|
27
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
28
|
+
- name: Run test
|
29
|
+
run: bundle exec rake
|
30
|
+
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -1,10 +1,19 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
2
|
require "rake/testtask"
|
3
3
|
|
4
|
+
name = "win32ole"
|
5
|
+
|
6
|
+
require 'rake/extensiontask'
|
7
|
+
extask = Rake::ExtensionTask.new(name) do |x|
|
8
|
+
x.lib_dir << "/#{RUBY_VERSION}/#{x.platform}"
|
9
|
+
end
|
4
10
|
Rake::TestTask.new(:test) do |t|
|
5
|
-
t.libs <<
|
11
|
+
t.libs << extask.lib_dir
|
12
|
+
t.libs << "test/lib"
|
6
13
|
t.libs << "lib"
|
14
|
+
t.ruby_opts << "-rhelper"
|
7
15
|
t.test_files = FileList["test/**/test_*.rb"]
|
8
16
|
end
|
9
17
|
|
10
18
|
task :default => :test
|
19
|
+
task :test => :compile
|
data/ext/win32ole/sample/xml.rb
CHANGED
@@ -1032,8 +1032,8 @@ module IXMLDOMDocument
|
|
1032
1032
|
end
|
1033
1033
|
|
1034
1034
|
# VOID save
|
1035
|
-
# save the document to a specified
|
1036
|
-
# VARIANT arg0 ---
|
1035
|
+
# save the document to a specified destination
|
1036
|
+
# VARIANT arg0 --- destination [IN]
|
1037
1037
|
def save(arg0)
|
1038
1038
|
ret = _invoke(64, [arg0], [VT_VARIANT])
|
1039
1039
|
@lastargs = WIN32OLE::ARGV
|
@@ -6224,8 +6224,8 @@ class Microsoft_XMLDOM_1_0 # DOMDocument
|
|
6224
6224
|
end
|
6225
6225
|
|
6226
6226
|
# VOID save
|
6227
|
-
# save the document to a specified
|
6228
|
-
# VARIANT arg0 ---
|
6227
|
+
# save the document to a specified destination
|
6228
|
+
# VARIANT arg0 --- destination [IN]
|
6229
6229
|
def save(arg0)
|
6230
6230
|
ret = @dispatch._invoke(64, [arg0], [VT_VARIANT])
|
6231
6231
|
@lastargs = WIN32OLE::ARGV
|
@@ -6831,8 +6831,8 @@ class Microsoft_FreeThreadedXMLDOM_1_0 # DOMFreeThreadedDocument
|
|
6831
6831
|
end
|
6832
6832
|
|
6833
6833
|
# VOID save
|
6834
|
-
# save the document to a specified
|
6835
|
-
# VARIANT arg0 ---
|
6834
|
+
# save the document to a specified destination
|
6835
|
+
# VARIANT arg0 --- destination [IN]
|
6836
6836
|
def save(arg0)
|
6837
6837
|
ret = @dispatch._invoke(64, [arg0], [VT_VARIANT])
|
6838
6838
|
@lastargs = WIN32OLE::ARGV
|
data/ext/win32ole/win32ole.c
CHANGED
@@ -27,7 +27,7 @@
|
|
27
27
|
const IID IID_IMultiLanguage2 = {0xDCCFC164, 0x2B38, 0x11d2, {0xB7, 0xEC, 0x00, 0xC0, 0x4F, 0x8F, 0x5D, 0x9A}};
|
28
28
|
#endif
|
29
29
|
|
30
|
-
#define WIN32OLE_VERSION "1.8.
|
30
|
+
#define WIN32OLE_VERSION "1.8.10"
|
31
31
|
|
32
32
|
typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX)
|
33
33
|
(REFCLSID, IUnknown*, DWORD, COSERVERINFO*, DWORD, MULTI_QI*);
|
@@ -454,12 +454,12 @@ vtdate2rbtime(double date)
|
|
454
454
|
double sec;
|
455
455
|
VariantTimeToSystemTime(date, &st);
|
456
456
|
v = rb_funcall(rb_cTime, rb_intern("new"), 6,
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
457
|
+
RB_INT2FIX(st.wYear),
|
458
|
+
RB_INT2FIX(st.wMonth),
|
459
|
+
RB_INT2FIX(st.wDay),
|
460
|
+
RB_INT2FIX(st.wHour),
|
461
|
+
RB_INT2FIX(st.wMinute),
|
462
|
+
RB_INT2FIX(st.wSecond));
|
463
463
|
st.wYear = RB_FIX2INT(rb_funcall(v, rb_intern("year"), 0));
|
464
464
|
st.wMonth = RB_FIX2INT(rb_funcall(v, rb_intern("month"), 0));
|
465
465
|
st.wDay = RB_FIX2INT(rb_funcall(v, rb_intern("mday"), 0));
|
@@ -507,6 +507,7 @@ static UINT ole_encoding2cp(rb_encoding *enc)
|
|
507
507
|
ENC_MACHING_CP(enc, "GB2312", 20936);
|
508
508
|
ENC_MACHING_CP(enc, "GBK", 936);
|
509
509
|
ENC_MACHING_CP(enc, "IBM437", 437);
|
510
|
+
ENC_MACHING_CP(enc, "IBM720", 720);
|
510
511
|
ENC_MACHING_CP(enc, "IBM737", 737);
|
511
512
|
ENC_MACHING_CP(enc, "IBM775", 775);
|
512
513
|
ENC_MACHING_CP(enc, "IBM852", 852);
|
@@ -567,16 +568,16 @@ load_conv_function51932(void)
|
|
567
568
|
void *p;
|
568
569
|
if (!pIMultiLanguage) {
|
569
570
|
#if defined(HAVE_TYPE_IMULTILANGUAGE2)
|
570
|
-
|
571
|
-
|
571
|
+
hr = CoCreateInstance(&CLSID_CMultiLanguage, NULL, CLSCTX_INPROC_SERVER,
|
572
|
+
&IID_IMultiLanguage2, &p);
|
572
573
|
#elif defined(HAVE_TYPE_IMULTILANGUAGE)
|
573
|
-
|
574
|
-
|
574
|
+
hr = CoCreateInstance(&CLSID_CMultiLanguage, NULL, CLSCTX_INPROC_SERVER,
|
575
|
+
&IID_IMultiLanguage, &p);
|
575
576
|
#endif
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
577
|
+
if (FAILED(hr)) {
|
578
|
+
failed_load_conv51932();
|
579
|
+
}
|
580
|
+
pIMultiLanguage = p;
|
580
581
|
}
|
581
582
|
}
|
582
583
|
#define need_conv_function51932() (load_conv_function51932(), 1)
|
@@ -623,7 +624,7 @@ ole_init_cp(void)
|
|
623
624
|
rb_encoding *encdef;
|
624
625
|
encdef = rb_default_internal_encoding();
|
625
626
|
if (!encdef) {
|
626
|
-
|
627
|
+
encdef = rb_default_external_encoding();
|
627
628
|
}
|
628
629
|
cp = ole_encoding2cp(encdef);
|
629
630
|
set_ole_codepage(cp);
|
@@ -649,38 +650,38 @@ ole_cp2encoding(UINT cp)
|
|
649
650
|
int idx;
|
650
651
|
|
651
652
|
if (!code_page_installed(cp)) {
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
653
|
+
switch(cp) {
|
654
|
+
case CP_ACP:
|
655
|
+
cp = GetACP();
|
656
|
+
break;
|
657
|
+
case CP_OEMCP:
|
658
|
+
cp = GetOEMCP();
|
659
|
+
break;
|
660
|
+
case CP_MACCP:
|
661
|
+
case CP_THREAD_ACP:
|
662
|
+
if (!pGetCPInfoEx) {
|
663
|
+
pGetCPInfoEx = (BOOL (*)(UINT, DWORD, struct myCPINFOEX *))
|
664
|
+
GetProcAddress(GetModuleHandle("kernel32"), "GetCPInfoEx");
|
665
|
+
if (!pGetCPInfoEx) {
|
666
|
+
pGetCPInfoEx = (void*)-1;
|
667
|
+
}
|
668
|
+
}
|
669
|
+
buf = ALLOCA_N(struct myCPINFOEX, 1);
|
670
|
+
ZeroMemory(buf, sizeof(struct myCPINFOEX));
|
671
|
+
if (pGetCPInfoEx == (void*)-1 || !pGetCPInfoEx(cp, 0, buf)) {
|
672
|
+
rb_raise(eWIN32OLERuntimeError, "cannot map codepage to encoding.");
|
673
|
+
break; /* never reach here */
|
674
|
+
}
|
675
|
+
cp = buf->CodePage;
|
676
|
+
break;
|
677
|
+
case CP_SYMBOL:
|
678
|
+
case CP_UTF7:
|
679
|
+
case CP_UTF8:
|
680
|
+
break;
|
681
|
+
case 51932:
|
682
|
+
load_conv_function51932();
|
683
|
+
break;
|
684
|
+
default:
|
684
685
|
rb_raise(eWIN32OLERuntimeError, "codepage should be WIN32OLE::CP_ACP, WIN32OLE::CP_OEMCP, WIN32OLE::CP_MACCP, WIN32OLE::CP_THREAD_ACP, WIN32OLE::CP_SYMBOL, WIN32OLE::CP_UTF7, WIN32OLE::CP_UTF8, or installed codepage.");
|
685
686
|
break;
|
686
687
|
}
|
@@ -689,7 +690,7 @@ ole_cp2encoding(UINT cp)
|
|
689
690
|
enc_name = rb_sprintf("CP%d", cp);
|
690
691
|
idx = rb_enc_find_index(enc_cstr = StringValueCStr(enc_name));
|
691
692
|
if (idx < 0)
|
692
|
-
|
693
|
+
idx = rb_define_dummy_encoding(enc_cstr);
|
693
694
|
return rb_enc_from_index(idx);
|
694
695
|
}
|
695
696
|
|
@@ -699,14 +700,14 @@ ole_ml_wc2mb_conv0(LPWSTR pw, LPSTR pm, UINT *size)
|
|
699
700
|
{
|
700
701
|
DWORD dw = 0;
|
701
702
|
return pIMultiLanguage->lpVtbl->ConvertStringFromUnicode(pIMultiLanguage,
|
702
|
-
|
703
|
+
&dw, cWIN32OLE_cp, pw, NULL, pm, size);
|
703
704
|
}
|
704
705
|
#define ole_ml_wc2mb_conv(pw, pm, size, onfailure) do { \
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
706
|
+
HRESULT hr = ole_ml_wc2mb_conv0(pw, pm, &size); \
|
707
|
+
if (FAILED(hr)) { \
|
708
|
+
onfailure; \
|
709
|
+
ole_raise(hr, eWIN32OLERuntimeError, "fail to convert Unicode to CP%d", cWIN32OLE_cp); \
|
710
|
+
} \
|
710
711
|
} while (0)
|
711
712
|
#endif
|
712
713
|
|
@@ -719,11 +720,11 @@ ole_wc2mb_alloc(LPWSTR pw, char *(alloc)(UINT size, void *arg), void *arg)
|
|
719
720
|
UINT size = 0;
|
720
721
|
if (conv_51932(cWIN32OLE_cp)) {
|
721
722
|
#ifndef pIMultiLanguage
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
723
|
+
ole_ml_wc2mb_conv(pw, NULL, size, {});
|
724
|
+
pm = alloc(size, arg);
|
725
|
+
if (size) ole_ml_wc2mb_conv(pw, pm, size, xfree(pm));
|
726
|
+
pm[size] = '\0';
|
727
|
+
return pm;
|
727
728
|
#endif
|
728
729
|
}
|
729
730
|
size = ole_wc2mb_conv(pw, NULL, 0);
|
@@ -815,8 +816,8 @@ ole_initialize(void)
|
|
815
816
|
HRESULT hr;
|
816
817
|
|
817
818
|
if(!g_uninitialize_hooked) {
|
818
|
-
|
819
|
-
|
819
|
+
rb_add_event_hook(ole_uninitialize_hook, RUBY_EVENT_THREAD_END, Qnil);
|
820
|
+
g_uninitialize_hooked = TRUE;
|
820
821
|
}
|
821
822
|
|
822
823
|
if(g_ole_initialized == FALSE) {
|
@@ -910,21 +911,21 @@ ole_mb2wc(char *pm, int len, UINT cp)
|
|
910
911
|
|
911
912
|
if (conv_51932(cp)) {
|
912
913
|
#ifndef pIMultiLanguage
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
914
|
+
DWORD dw = 0;
|
915
|
+
UINT n = len;
|
916
|
+
HRESULT hr = pIMultiLanguage->lpVtbl->ConvertStringToUnicode(pIMultiLanguage,
|
917
|
+
&dw, cp, pm, &n, NULL, &size);
|
918
|
+
if (FAILED(hr)) {
|
918
919
|
ole_raise(hr, eWIN32OLERuntimeError, "fail to convert CP%d to Unicode", cp);
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
920
|
+
}
|
921
|
+
pw = SysAllocStringLen(NULL, size);
|
922
|
+
n = len;
|
923
|
+
hr = pIMultiLanguage->lpVtbl->ConvertStringToUnicode(pIMultiLanguage,
|
924
|
+
&dw, cp, pm, &n, pw, &size);
|
925
|
+
if (FAILED(hr)) {
|
925
926
|
ole_raise(hr, eWIN32OLERuntimeError, "fail to convert CP%d to Unicode", cp);
|
926
|
-
|
927
|
-
|
927
|
+
}
|
928
|
+
return pw;
|
928
929
|
#endif
|
929
930
|
}
|
930
931
|
size = MultiByteToWideChar(cp, 0, pm, len, NULL, 0);
|
@@ -994,7 +995,7 @@ ole_val2variant_ex(VALUE val, VARIANT *var, VARTYPE vt)
|
|
994
995
|
}
|
995
996
|
return;
|
996
997
|
}
|
997
|
-
#if (_MSC_VER >= 1300) || defined(__CYGWIN__) || defined(__MINGW32__)
|
998
|
+
#if (defined(_MSC_VER) && (_MSC_VER >= 1300)) || defined(__CYGWIN__) || defined(__MINGW32__)
|
998
999
|
switch(vt & ~VT_BYREF) {
|
999
1000
|
case VT_I8:
|
1000
1001
|
V_VT(var) = VT_I8;
|
@@ -1008,7 +1009,7 @@ ole_val2variant_ex(VALUE val, VARIANT *var, VARTYPE vt)
|
|
1008
1009
|
ole_val2variant2(val, var);
|
1009
1010
|
break;
|
1010
1011
|
}
|
1011
|
-
#else /* (_MSC_VER >= 1300) || defined(__CYGWIN__) || defined(__MINGW32__) */
|
1012
|
+
#else /* (defined(_MSC_VER) && (_MSC_VER >= 1300)) || defined(__CYGWIN__) || defined(__MINGW32__) */
|
1012
1013
|
ole_val2variant2(val, var);
|
1013
1014
|
#endif
|
1014
1015
|
}
|
@@ -1062,7 +1063,7 @@ get_ptr_of_variant(VARIANT *pvar)
|
|
1062
1063
|
case VT_R8:
|
1063
1064
|
return &V_R8(pvar);
|
1064
1065
|
break;
|
1065
|
-
#if (_MSC_VER >= 1300) || defined(__CYGWIN__) || defined(__MINGW32__)
|
1066
|
+
#if (defined(_MSC_VER) && (_MSC_VER >= 1300)) || defined(__CYGWIN__) || defined(__MINGW32__)
|
1066
1067
|
case VT_I8:
|
1067
1068
|
return &V_I8(pvar);
|
1068
1069
|
break;
|
@@ -1549,10 +1550,10 @@ ole_variant2val(VARIANT *pvar)
|
|
1549
1550
|
obj = RB_INT2NUM((long)V_UINT(pvar));
|
1550
1551
|
break;
|
1551
1552
|
|
1552
|
-
#if (_MSC_VER >= 1300) || defined(__CYGWIN__) || defined(__MINGW32__)
|
1553
|
+
#if (defined(_MSC_VER) && (_MSC_VER >= 1300)) || defined(__CYGWIN__) || defined(__MINGW32__)
|
1553
1554
|
case VT_I8:
|
1554
1555
|
if(V_ISBYREF(pvar))
|
1555
|
-
#if (_MSC_VER >= 1300) || defined(__CYGWIN__) || defined(__MINGW32__)
|
1556
|
+
#if (defined(_MSC_VER) && (_MSC_VER >= 1300)) || defined(__CYGWIN__) || defined(__MINGW32__)
|
1556
1557
|
#ifdef V_I8REF
|
1557
1558
|
obj = I8_2_NUM(*V_I8REF(pvar));
|
1558
1559
|
#endif
|
@@ -1564,7 +1565,7 @@ ole_variant2val(VARIANT *pvar)
|
|
1564
1565
|
break;
|
1565
1566
|
case VT_UI8:
|
1566
1567
|
if(V_ISBYREF(pvar))
|
1567
|
-
#if (_MSC_VER >= 1300) || defined(__CYGWIN__) || defined(__MINGW32__)
|
1568
|
+
#if (defined(_MSC_VER) && (_MSC_VER >= 1300)) || defined(__CYGWIN__) || defined(__MINGW32__)
|
1568
1569
|
#ifdef V_UI8REF
|
1569
1570
|
obj = UI8_2_NUM(*V_UI8REF(pvar));
|
1570
1571
|
#endif
|
@@ -1574,7 +1575,7 @@ ole_variant2val(VARIANT *pvar)
|
|
1574
1575
|
else
|
1575
1576
|
obj = UI8_2_NUM(V_UI8(pvar));
|
1576
1577
|
break;
|
1577
|
-
#endif /* (_MSC_VER >= 1300) || defined(__CYGWIN__) || defined(__MINGW32__) */
|
1578
|
+
#endif /* (defined(_MSC_VER) && (_MSC_VER >= 1300)) || defined(__CYGWIN__) || defined(__MINGW32__) */
|
1578
1579
|
|
1579
1580
|
case VT_R4:
|
1580
1581
|
if(V_ISBYREF(pvar))
|
@@ -1736,11 +1737,11 @@ reg_get_val(HKEY hkey, const char *subkey)
|
|
1736
1737
|
if (err == ERROR_SUCCESS) {
|
1737
1738
|
pbuf[size] = '\0';
|
1738
1739
|
if (dwtype == REG_EXPAND_SZ) {
|
1739
|
-
|
1740
|
-
|
1741
|
-
|
1742
|
-
|
1743
|
-
|
1740
|
+
char* pbuf2 = (char *)pbuf;
|
1741
|
+
DWORD len = ExpandEnvironmentStrings(pbuf2, NULL, 0);
|
1742
|
+
pbuf = ALLOC_N(char, len + 1);
|
1743
|
+
ExpandEnvironmentStrings(pbuf2, pbuf, len + 1);
|
1744
|
+
free(pbuf2);
|
1744
1745
|
}
|
1745
1746
|
val = rb_str_new2((char *)pbuf);
|
1746
1747
|
}
|
@@ -2521,12 +2522,12 @@ fole_initialize(int argc, VALUE *argv, VALUE self)
|
|
2521
2522
|
OLE_RELEASE(pIClassFactory2);
|
2522
2523
|
}
|
2523
2524
|
}
|
2524
|
-
pDispatch = p;
|
2525
2525
|
if(FAILED(hr)) {
|
2526
2526
|
ole_raise(hr, eWIN32OLERuntimeError,
|
2527
2527
|
"failed to create WIN32OLE object from `%s'",
|
2528
2528
|
StringValuePtr(svr_name));
|
2529
2529
|
}
|
2530
|
+
pDispatch = p;
|
2530
2531
|
|
2531
2532
|
ole_set_member(self, pDispatch);
|
2532
2533
|
return self;
|
@@ -2554,7 +2555,7 @@ hash2named_arg(VALUE key, VALUE val, VALUE pop)
|
|
2554
2555
|
rb_raise(rb_eTypeError, "wrong argument type (expected String or Symbol)");
|
2555
2556
|
}
|
2556
2557
|
if (RB_TYPE_P(key, T_SYMBOL)) {
|
2557
|
-
|
2558
|
+
key = rb_sym2str(key);
|
2558
2559
|
}
|
2559
2560
|
|
2560
2561
|
/* pNamedArgs[0] is <method name>, so "index + 1" */
|
@@ -2618,10 +2619,10 @@ ole_invoke(int argc, VALUE *argv, VALUE self, USHORT wFlags, BOOL is_bracket)
|
|
2618
2619
|
|
2619
2620
|
rb_scan_args(argc, argv, "1*", &cmd, ¶mS);
|
2620
2621
|
if(!RB_TYPE_P(cmd, T_STRING) && !RB_TYPE_P(cmd, T_SYMBOL) && !is_bracket) {
|
2621
|
-
|
2622
|
+
rb_raise(rb_eTypeError, "method is wrong type (expected String or Symbol)");
|
2622
2623
|
}
|
2623
2624
|
if (RB_TYPE_P(cmd, T_SYMBOL)) {
|
2624
|
-
|
2625
|
+
cmd = rb_sym2str(cmd);
|
2625
2626
|
}
|
2626
2627
|
pole = oledata_get_struct(self);
|
2627
2628
|
if(!pole->pDispatch) {
|
@@ -2630,7 +2631,7 @@ ole_invoke(int argc, VALUE *argv, VALUE self, USHORT wFlags, BOOL is_bracket)
|
|
2630
2631
|
if (is_bracket) {
|
2631
2632
|
DispID = DISPID_VALUE;
|
2632
2633
|
argc += 1;
|
2633
|
-
|
2634
|
+
rb_ary_unshift(paramS, cmd);
|
2634
2635
|
} else {
|
2635
2636
|
wcmdname = ole_vstr2wc(cmd);
|
2636
2637
|
hr = pole->pDispatch->lpVtbl->GetIDsOfNames( pole->pDispatch, &IID_NULL,
|
@@ -2651,7 +2652,7 @@ ole_invoke(int argc, VALUE *argv, VALUE self, USHORT wFlags, BOOL is_bracket)
|
|
2651
2652
|
/*------------------------------------------
|
2652
2653
|
hash object ==> named dispatch parameters
|
2653
2654
|
--------------------------------------------*/
|
2654
|
-
cNamedArgs = rb_long2int(RHASH_SIZE(param));
|
2655
|
+
cNamedArgs = rb_long2int((long)RHASH_SIZE(param));
|
2655
2656
|
op.dp.cArgs = cNamedArgs + argc - 2;
|
2656
2657
|
op.pNamedArgs = ALLOCA_N(OLECHAR*, cNamedArgs + 1);
|
2657
2658
|
op.dp.rgvarg = ALLOCA_N(VARIANTARG, op.dp.cArgs);
|
@@ -3638,7 +3639,7 @@ fole_respond_to(VALUE self, VALUE method)
|
|
3638
3639
|
pole = oledata_get_struct(self);
|
3639
3640
|
wcmdname = ole_vstr2wc(method);
|
3640
3641
|
hr = pole->pDispatch->lpVtbl->GetIDsOfNames( pole->pDispatch, &IID_NULL,
|
3641
|
-
|
3642
|
+
&wcmdname, 1, cWIN32OLE_lcid, &DispID);
|
3642
3643
|
SysFreeString(wcmdname);
|
3643
3644
|
return SUCCEEDED(hr) ? Qtrue : Qfalse;
|
3644
3645
|
}
|
@@ -3752,7 +3753,7 @@ ole_typedesc2val(ITypeInfo *pTypeInfo, TYPEDESC *pTypeDesc, VALUE typedetails)
|
|
3752
3753
|
case VT_UI4:
|
3753
3754
|
typestr = rb_str_new2("UI4");
|
3754
3755
|
break;
|
3755
|
-
#if (_MSC_VER >= 1300) || defined(__CYGWIN__) || defined(__MINGW32__)
|
3756
|
+
#if (defined(_MSC_VER) && (_MSC_VER >= 1300)) || defined(__CYGWIN__) || defined(__MINGW32__)
|
3756
3757
|
case VT_I8:
|
3757
3758
|
typestr = rb_str_new2("I8");
|
3758
3759
|
break;
|
@@ -3962,6 +3963,7 @@ check_nano_server(void)
|
|
3962
3963
|
}
|
3963
3964
|
}
|
3964
3965
|
|
3966
|
+
LCID cWIN32OLE_lcid;
|
3965
3967
|
|
3966
3968
|
void
|
3967
3969
|
Init_win32ole(void)
|
data/ext/win32ole/win32ole.h
CHANGED
@@ -112,8 +112,8 @@ struct oledata {
|
|
112
112
|
IDispatch *pDispatch;
|
113
113
|
};
|
114
114
|
|
115
|
-
VALUE cWIN32OLE;
|
116
|
-
LCID cWIN32OLE_lcid;
|
115
|
+
extern VALUE cWIN32OLE;
|
116
|
+
extern LCID cWIN32OLE_lcid;
|
117
117
|
|
118
118
|
struct oledata *oledata_get_struct(VALUE obj);
|
119
119
|
LPWSTR ole_vstr2wc(VALUE vstr);
|
@@ -1,8 +1,8 @@
|
|
1
1
|
#ifndef WIN32OLE_ERROR_H
|
2
2
|
#define WIN32OLE_ERROR_H 1
|
3
3
|
|
4
|
-
VALUE eWIN32OLERuntimeError;
|
5
|
-
VALUE eWIN32OLEQueryInterfaceError;
|
4
|
+
extern VALUE eWIN32OLERuntimeError;
|
5
|
+
extern VALUE eWIN32OLEQueryInterfaceError;
|
6
6
|
NORETURN(PRINTF_ARGS(void ole_raise(HRESULT hr, VALUE ecs, const char *fmt, ...), 3, 4));
|
7
7
|
void Init_win32ole_error(void);
|
8
8
|
|
@@ -200,7 +200,7 @@ STDMETHODIMP EVENTSINK_Invoke(
|
|
200
200
|
}
|
201
201
|
outargv = Qnil;
|
202
202
|
if (is_outarg == Qtrue) {
|
203
|
-
|
203
|
+
outargv = rb_ary_new();
|
204
204
|
rb_ary_push(args, outargv);
|
205
205
|
}
|
206
206
|
|
@@ -413,15 +413,15 @@ hash2ptr_dispparams(VALUE hash, ITypeInfo *pTypeInfo, DISPID dispid, DISPPARAMS
|
|
413
413
|
bstrs, pdispparams->cArgs + 1,
|
414
414
|
&len);
|
415
415
|
if (FAILED(hr))
|
416
|
-
|
416
|
+
return;
|
417
417
|
|
418
418
|
for (i = 0; i < len - 1; i++) {
|
419
|
-
|
419
|
+
key = WC2VSTR(bstrs[i + 1]);
|
420
420
|
val = rb_hash_aref(hash, RB_UINT2NUM(i));
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
421
|
+
if (val == Qnil)
|
422
|
+
val = rb_hash_aref(hash, key);
|
423
|
+
if (val == Qnil)
|
424
|
+
val = rb_hash_aref(hash, rb_str_intern(key));
|
425
425
|
pvar = &pdispparams->rgvarg[pdispparams->cArgs-i-1];
|
426
426
|
ole_val2ptr_variant(val, pvar);
|
427
427
|
}
|
@@ -433,7 +433,7 @@ hash2result(VALUE hash)
|
|
433
433
|
VALUE ret = Qnil;
|
434
434
|
ret = rb_hash_aref(hash, rb_str_new2("return"));
|
435
435
|
if (ret == Qnil)
|
436
|
-
|
436
|
+
ret = rb_hash_aref(hash, rb_str_intern(rb_str_new2("return")));
|
437
437
|
return ret;
|
438
438
|
}
|
439
439
|
|
@@ -610,7 +610,7 @@ find_coclass(
|
|
610
610
|
|
611
611
|
hr = pTypeInfo->lpVtbl->GetContainingTypeLib(pTypeInfo, &pTypeLib, NULL);
|
612
612
|
if (FAILED(hr)) {
|
613
|
-
|
613
|
+
return hr;
|
614
614
|
}
|
615
615
|
count = pTypeLib->lpVtbl->GetTypeInfoCount(pTypeLib);
|
616
616
|
for (i = 0; i < count && !found; i++) {
|
@@ -1264,7 +1264,8 @@ Init_win32ole_event(void)
|
|
1264
1264
|
ary_ole_event = rb_ary_new();
|
1265
1265
|
rb_gc_register_mark_object(ary_ole_event);
|
1266
1266
|
id_events = rb_intern("events");
|
1267
|
-
cWIN32OLE_EVENT =
|
1267
|
+
cWIN32OLE_EVENT = rb_define_class_under(cWIN32OLE, "Event", rb_cObject);
|
1268
|
+
rb_define_const(rb_cObject, "WIN32OLE_EVENT", cWIN32OLE_EVENT);
|
1268
1269
|
rb_define_singleton_method(cWIN32OLE_EVENT, "message_loop", fev_s_msg_loop, 0);
|
1269
1270
|
rb_define_alloc_func(cWIN32OLE_EVENT, fev_s_allocate);
|
1270
1271
|
rb_define_method(cWIN32OLE_EVENT, "initialize", fev_initialize, -1);
|
@@ -437,7 +437,7 @@ ole_method_invoke_kind(ITypeInfo *pTypeInfo, UINT method_index)
|
|
437
437
|
|
438
438
|
/*
|
439
439
|
* call-seq:
|
440
|
-
*
|
440
|
+
* WIN32OLE_METHOD#invkind
|
441
441
|
*
|
442
442
|
* Returns the method invoke kind.
|
443
443
|
* tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
|
@@ -923,9 +923,12 @@ folemethod_inspect(VALUE self)
|
|
923
923
|
return default_inspect(self, "WIN32OLE_METHOD");
|
924
924
|
}
|
925
925
|
|
926
|
+
VALUE cWIN32OLE_METHOD;
|
927
|
+
|
926
928
|
void Init_win32ole_method(void)
|
927
929
|
{
|
928
|
-
cWIN32OLE_METHOD =
|
930
|
+
cWIN32OLE_METHOD = rb_define_class_under(cWIN32OLE, "Method", rb_cObject);
|
931
|
+
rb_define_const(rb_cObject, "WIN32OLE_METHOD", cWIN32OLE_METHOD);
|
929
932
|
rb_define_alloc_func(cWIN32OLE_METHOD, folemethod_s_allocate);
|
930
933
|
rb_define_method(cWIN32OLE_METHOD, "initialize", folemethod_initialize, 2);
|
931
934
|
rb_define_method(cWIN32OLE_METHOD, "name", folemethod_name, 0);
|
@@ -7,7 +7,7 @@ struct olemethoddata {
|
|
7
7
|
UINT index;
|
8
8
|
};
|
9
9
|
|
10
|
-
VALUE cWIN32OLE_METHOD;
|
10
|
+
extern VALUE cWIN32OLE_METHOD;
|
11
11
|
VALUE folemethod_s_allocate(VALUE klass);
|
12
12
|
VALUE ole_methods_from_typeinfo(ITypeInfo *pTypeInfo, int mask);
|
13
13
|
VALUE create_win32ole_method(ITypeInfo *pTypeInfo, VALUE name);
|
@@ -422,7 +422,8 @@ foleparam_inspect(VALUE self)
|
|
422
422
|
void
|
423
423
|
Init_win32ole_param(void)
|
424
424
|
{
|
425
|
-
cWIN32OLE_PARAM =
|
425
|
+
cWIN32OLE_PARAM = rb_define_class_under(cWIN32OLE, "Param", rb_cObject);
|
426
|
+
rb_define_const(rb_cObject, "WIN32OLE_PARAM", cWIN32OLE_PARAM);
|
426
427
|
rb_define_alloc_func(cWIN32OLE_PARAM, foleparam_s_allocate);
|
427
428
|
rb_define_method(cWIN32OLE_PARAM, "initialize", foleparam_initialize, 2);
|
428
429
|
rb_define_method(cWIN32OLE_PARAM, "name", foleparam_name, 0);
|
@@ -589,10 +589,13 @@ folerecord_inspect(VALUE self)
|
|
589
589
|
field);
|
590
590
|
}
|
591
591
|
|
592
|
+
VALUE cWIN32OLE_RECORD;
|
593
|
+
|
592
594
|
void
|
593
595
|
Init_win32ole_record(void)
|
594
596
|
{
|
595
|
-
cWIN32OLE_RECORD =
|
597
|
+
cWIN32OLE_RECORD = rb_define_class_under(cWIN32OLE, "Record", rb_cObject);
|
598
|
+
rb_define_const(rb_cObject, "WIN32OLE_RECORD", cWIN32OLE_RECORD);
|
596
599
|
rb_define_alloc_func(cWIN32OLE_RECORD, folerecord_s_allocate);
|
597
600
|
rb_define_method(cWIN32OLE_RECORD, "initialize", folerecord_initialize, 2);
|
598
601
|
rb_define_method(cWIN32OLE_RECORD, "to_h", folerecord_to_h, 0);
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#ifndef WIN32OLE_RECORD_H
|
2
2
|
#define WIN32OLE_RECORD_H 1
|
3
3
|
|
4
|
-
VALUE cWIN32OLE_RECORD;
|
4
|
+
extern VALUE cWIN32OLE_RECORD;
|
5
5
|
void ole_rec2variant(VALUE rec, VARIANT *var);
|
6
6
|
void olerecord_set_ivar(VALUE obj, IRecordInfo *pri, void *prec);
|
7
7
|
VALUE create_win32ole_record(IRecordInfo *pri, void *prec);
|
@@ -56,7 +56,7 @@ static const rb_data_type_t oletype_datatype = {
|
|
56
56
|
/*
|
57
57
|
* Document-class: WIN32OLE_TYPE
|
58
58
|
*
|
59
|
-
* <code>WIN32OLE_TYPE</code> objects represent OLE type
|
59
|
+
* <code>WIN32OLE_TYPE</code> objects represent OLE type library information.
|
60
60
|
*/
|
61
61
|
|
62
62
|
static void
|
@@ -883,9 +883,12 @@ foletype_inspect(VALUE self)
|
|
883
883
|
return default_inspect(self, "WIN32OLE_TYPE");
|
884
884
|
}
|
885
885
|
|
886
|
+
VALUE cWIN32OLE_TYPE;
|
887
|
+
|
886
888
|
void Init_win32ole_type(void)
|
887
889
|
{
|
888
|
-
cWIN32OLE_TYPE =
|
890
|
+
cWIN32OLE_TYPE = rb_define_class_under(cWIN32OLE, "Type", rb_cObject);
|
891
|
+
rb_define_const(rb_cObject, "WIN32OLE_TYPE", cWIN32OLE_TYPE);
|
889
892
|
rb_define_singleton_method(cWIN32OLE_TYPE, "ole_classes", foletype_s_ole_classes, 1);
|
890
893
|
rb_define_singleton_method(cWIN32OLE_TYPE, "typelibs", foletype_s_typelibs, 0);
|
891
894
|
rb_define_singleton_method(cWIN32OLE_TYPE, "progids", foletype_s_progids, 0);
|
@@ -285,7 +285,7 @@ oletypelib_get_libattr(ITypeLib *pTypeLib, TLIBATTR **ppTLibAttr)
|
|
285
285
|
hr = pTypeLib->lpVtbl->GetLibAttr(pTypeLib, ppTLibAttr);
|
286
286
|
if (FAILED(hr)) {
|
287
287
|
ole_raise(hr, eWIN32OLERuntimeError,
|
288
|
-
|
288
|
+
"failed to get library attribute(TLIBATTR) from ITypeLib");
|
289
289
|
}
|
290
290
|
}
|
291
291
|
|
@@ -588,13 +588,13 @@ foletypelib_path(VALUE self)
|
|
588
588
|
pTypeLib = itypelib(self);
|
589
589
|
oletypelib_get_libattr(pTypeLib, &pTLibAttr);
|
590
590
|
hr = QueryPathOfRegTypeLib(&pTLibAttr->guid,
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
591
|
+
pTLibAttr->wMajorVerNum,
|
592
|
+
pTLibAttr->wMinorVerNum,
|
593
|
+
lcid,
|
594
|
+
&bstr);
|
595
595
|
if (FAILED(hr)) {
|
596
|
-
|
597
|
-
|
596
|
+
pTypeLib->lpVtbl->ReleaseTLibAttr(pTypeLib, pTLibAttr);
|
597
|
+
ole_raise(hr, eWIN32OLERuntimeError, "failed to QueryPathOfRegTypeTypeLib");
|
598
598
|
}
|
599
599
|
|
600
600
|
pTypeLib->lpVtbl->ReleaseTLibAttr(pTypeLib, pTLibAttr);
|
@@ -722,7 +722,7 @@ typelib_file_from_typelib(VALUE ole)
|
|
722
722
|
if (ver == Qnil)
|
723
723
|
break;
|
724
724
|
err = reg_open_vkey(hclsid, ver, &hversion);
|
725
|
-
|
725
|
+
if (err != ERROR_SUCCESS || fver > atof(StringValuePtr(ver)))
|
726
726
|
continue;
|
727
727
|
fver = atof(StringValuePtr(ver));
|
728
728
|
typelib = reg_get_val(hversion, NULL);
|
@@ -822,10 +822,13 @@ foletypelib_inspect(VALUE self)
|
|
822
822
|
return default_inspect(self, "WIN32OLE_TYPELIB");
|
823
823
|
}
|
824
824
|
|
825
|
+
VALUE cWIN32OLE_TYPELIB;
|
826
|
+
|
825
827
|
void
|
826
828
|
Init_win32ole_typelib(void)
|
827
829
|
{
|
828
|
-
cWIN32OLE_TYPELIB =
|
830
|
+
cWIN32OLE_TYPELIB = rb_define_class_under(cWIN32OLE, "Typelib", rb_cObject);
|
831
|
+
rb_define_const(rb_cObject, "WIN32OLE_TYPELIB", cWIN32OLE_TYPELIB);
|
829
832
|
rb_define_singleton_method(cWIN32OLE_TYPELIB, "typelibs", foletypelib_s_typelibs, 0);
|
830
833
|
rb_define_alloc_func(cWIN32OLE_TYPELIB, foletypelib_s_allocate);
|
831
834
|
rb_define_method(cWIN32OLE_TYPELIB, "initialize", foletypelib_initialize, -2);
|
@@ -365,9 +365,13 @@ folevariable_inspect(VALUE self)
|
|
365
365
|
return make_inspect("WIN32OLE_VARIABLE", detail);
|
366
366
|
}
|
367
367
|
|
368
|
+
VALUE cWIN32OLE_VARIABLE;
|
369
|
+
|
368
370
|
void Init_win32ole_variable(void)
|
369
371
|
{
|
370
|
-
cWIN32OLE_VARIABLE =
|
372
|
+
cWIN32OLE_VARIABLE = rb_define_class_under(cWIN32OLE, "Variable", rb_cObject);
|
373
|
+
rb_define_const(rb_cObject, "WIN32OLE_VARIABLE", cWIN32OLE_VARIABLE);
|
374
|
+
rb_undef_alloc_func(cWIN32OLE_VARIABLE);
|
371
375
|
rb_define_method(cWIN32OLE_VARIABLE, "name", folevariable_name, 0);
|
372
376
|
rb_define_method(cWIN32OLE_VARIABLE, "ole_type", folevariable_ole_type, 0);
|
373
377
|
rb_define_method(cWIN32OLE_VARIABLE, "ole_type_detail", folevariable_ole_type_detail, 0);
|
@@ -94,7 +94,7 @@ ole_val2olevariantdata(VALUE val, VARTYPE vt, struct olevariantdata *pvar)
|
|
94
94
|
}
|
95
95
|
}
|
96
96
|
}
|
97
|
-
#if (_MSC_VER >= 1300) || defined(__CYGWIN__) || defined(__MINGW32__)
|
97
|
+
#if (defined(_MSC_VER) && (_MSC_VER >= 1300)) || defined(__CYGWIN__) || defined(__MINGW32__)
|
98
98
|
} else if ( (vt & ~VT_BYREF) == VT_I8 || (vt & ~VT_BYREF) == VT_UI8) {
|
99
99
|
ole_val2variant_ex(val, &(pvar->realvar), (vt & ~VT_BYREF));
|
100
100
|
ole_val2variant_ex(val, &(pvar->var), (vt & ~VT_BYREF));
|
@@ -202,7 +202,7 @@ ole_set_byref(VARIANT *realvar, VARIANT *var, VARTYPE vt)
|
|
202
202
|
V_R8REF(var) = &V_R8(realvar);
|
203
203
|
break;
|
204
204
|
|
205
|
-
#if (_MSC_VER >= 1300) || defined(__CYGWIN__) || defined(__MINGW32__)
|
205
|
+
#if (defined(_MSC_VER) && (_MSC_VER >= 1300)) || defined(__CYGWIN__) || defined(__MINGW32__)
|
206
206
|
#ifdef V_I8REF
|
207
207
|
case VT_I8:
|
208
208
|
V_I8REF(var) = &V_I8(realvar);
|
@@ -371,7 +371,7 @@ check_type_val2variant(VALUE val)
|
|
371
371
|
* Win32OLE converts Ruby object into OLE variant automatically when
|
372
372
|
* invoking OLE methods. If OLE method requires the argument which is
|
373
373
|
* different from the variant by automatic conversion of Win32OLE, you
|
374
|
-
* can convert the
|
374
|
+
* can convert the specified variant type by using WIN32OLE_VARIANT class.
|
375
375
|
*
|
376
376
|
* param = WIN32OLE_VARIANT.new(10, WIN32OLE::VARIANT::VT_R4)
|
377
377
|
* oleobj.method(param)
|
@@ -689,11 +689,14 @@ ole_variant2variant(VALUE val, VARIANT *var)
|
|
689
689
|
VariantCopy(var, &(pvar->var));
|
690
690
|
}
|
691
691
|
|
692
|
+
VALUE cWIN32OLE_VARIANT;
|
693
|
+
|
692
694
|
void
|
693
695
|
Init_win32ole_variant(void)
|
694
696
|
{
|
695
697
|
#undef rb_intern
|
696
|
-
cWIN32OLE_VARIANT =
|
698
|
+
cWIN32OLE_VARIANT = rb_define_class_under(cWIN32OLE, "Variant", rb_cObject);
|
699
|
+
rb_define_const(rb_cObject, "WIN32OLE_VARIANT", cWIN32OLE_VARIANT);
|
697
700
|
rb_define_alloc_func(cWIN32OLE_VARIANT, folevariant_s_allocate);
|
698
701
|
rb_define_singleton_method(cWIN32OLE_VARIANT, "array", folevariant_s_array, 2);
|
699
702
|
rb_define_method(cWIN32OLE_VARIANT, "initialize", folevariant_initialize, -2);
|
@@ -1,5 +1,7 @@
|
|
1
1
|
#include "win32ole.h"
|
2
2
|
|
3
|
+
VALUE mWIN32OLE_VARIANT;
|
4
|
+
|
3
5
|
void Init_win32ole_variant_m(void)
|
4
6
|
{
|
5
7
|
/*
|
@@ -114,7 +116,7 @@ void Init_win32ole_variant_m(void)
|
|
114
116
|
*/
|
115
117
|
rb_define_const(mWIN32OLE_VARIANT, "VT_UI4", RB_INT2FIX(VT_UI4));
|
116
118
|
|
117
|
-
#if (_MSC_VER >= 1300) || defined(__CYGWIN__) || defined(__MINGW32__)
|
119
|
+
#if (defined(_MSC_VER) && (_MSC_VER >= 1300)) || defined(__CYGWIN__) || defined(__MINGW32__)
|
118
120
|
/*
|
119
121
|
* represents VT_I8 type constant.
|
120
122
|
*/
|
@@ -0,0 +1,34 @@
|
|
1
|
+
task "build" => "changelogs"
|
2
|
+
|
3
|
+
changelog = proc do |output, ver = nil, prev = nil|
|
4
|
+
ver &&= Gem::Version.new(ver)
|
5
|
+
range = [[prev], [ver, "HEAD"]].map {|ver, branch| ver ? "v#{ver.to_s}" : branch}.compact.join("..")
|
6
|
+
IO.popen(%W[git log --format=fuller --topo-order --no-merges #{range}]) do |log|
|
7
|
+
line = log.gets
|
8
|
+
FileUtils.mkpath(File.dirname(output))
|
9
|
+
File.open(output, "wb") do |f|
|
10
|
+
f.print "-*- coding: utf-8 -*-\n\n", line
|
11
|
+
log.each_line do |line|
|
12
|
+
line.sub!(/^(?!:)(?:Author|Commit)?(?:Date)?: /, ' \&')
|
13
|
+
line.sub!(/ +$/, '')
|
14
|
+
f.print(line)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
tags = IO.popen(%w[git tag -l v[0-9]*]).grep(/v(.*)/) {$1}
|
21
|
+
tags.sort_by! {|tag| tag.scan(/\d+/).map(&:to_i)}
|
22
|
+
tags.inject(nil) do |prev, tag|
|
23
|
+
task("logs/ChangeLog-#{tag}") {|t| changelog[t.name, tag, prev]}
|
24
|
+
tag
|
25
|
+
end
|
26
|
+
|
27
|
+
desc "Make ChangeLog"
|
28
|
+
task "ChangeLog", [:ver, :prev] do |t, ver: nil, prev: tags.last|
|
29
|
+
changelog[t.name, ver, prev]
|
30
|
+
end
|
31
|
+
|
32
|
+
changelogs = ["ChangeLog", *tags.map {|tag| "logs/ChangeLog-#{tag}"}]
|
33
|
+
task "changelogs" => changelogs
|
34
|
+
CLOBBER.concat(changelogs) << "logs"
|
data/rakelib/epoch.rake
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
class << (helper = Bundler::GemHelper.instance)
|
2
|
+
SOURCE_PATH = "ext/stringio/stringio.c"
|
3
|
+
def update_source_version
|
4
|
+
path = SOURCE_PATH
|
5
|
+
File.open(path, "r+b") do |f|
|
6
|
+
d = f.read
|
7
|
+
if d.sub!(/^#define\s+STRINGIO_VERSION\s+\K".*"/) {version.to_s.dump}
|
8
|
+
f.rewind
|
9
|
+
f.truncate(0)
|
10
|
+
f.print(d)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def commit_bump
|
16
|
+
sh(%W[git commit -m bump\ up\ to\ #{gemspec.version}
|
17
|
+
#{SOURCE_PATH}])
|
18
|
+
end
|
19
|
+
|
20
|
+
def version=(v)
|
21
|
+
gemspec.version = v
|
22
|
+
update_source_version
|
23
|
+
commit_bump
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
major, minor, teeny = helper.gemspec.version.segments
|
28
|
+
|
29
|
+
task "bump:teeny" do
|
30
|
+
helper.version = Gem::Version.new("#{major}.#{minor}.#{teeny+1}")
|
31
|
+
end
|
32
|
+
|
33
|
+
task "bump:minor" do
|
34
|
+
helper.version = Gem::Version.new("#{major}.#{minor+1}.0")
|
35
|
+
end
|
36
|
+
|
37
|
+
task "bump:major" do
|
38
|
+
helper.version = Gem::Version.new("#{major+1}.0.0")
|
39
|
+
end
|
40
|
+
|
41
|
+
task "bump" => "bump:teeny"
|
42
|
+
|
43
|
+
task "tag" do
|
44
|
+
helper.__send__(:tag_version)
|
45
|
+
end
|
data/win32ole.gemspec
CHANGED
@@ -1,6 +1,16 @@
|
|
1
|
+
source_version = ["", "ext/win32ole/"].find do |dir|
|
2
|
+
begin
|
3
|
+
break File.open(File.join(__dir__, "#{dir}win32ole.c")) {|f|
|
4
|
+
f.gets("\n#define WIN32OLE_VERSION ")
|
5
|
+
f.gets[/\s*"(.+)"/, 1]
|
6
|
+
}
|
7
|
+
rescue Errno::ENOENT
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
1
11
|
Gem::Specification.new do |spec|
|
2
12
|
spec.name = "win32ole"
|
3
|
-
spec.version =
|
13
|
+
spec.version = source_version
|
4
14
|
spec.authors = ["Masaki Suketa"]
|
5
15
|
spec.email = ["suke@ruby-lang.org"]
|
6
16
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: win32ole
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masaki Suketa
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Provides an interface for OLE Automation in Ruby
|
14
14
|
email:
|
@@ -17,8 +17,10 @@ executables: []
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
+
- ".git-blame-ignore-revs"
|
21
|
+
- ".github/dependabot.yml"
|
22
|
+
- ".github/workflows/windows.yml"
|
20
23
|
- ".gitignore"
|
21
|
-
- ".travis.yml"
|
22
24
|
- Gemfile
|
23
25
|
- LICENSE.txt
|
24
26
|
- README.md
|
@@ -61,6 +63,9 @@ files:
|
|
61
63
|
- ext/win32ole/win32ole_variant_m.h
|
62
64
|
- lib/win32ole.rb
|
63
65
|
- lib/win32ole/property.rb
|
66
|
+
- rakelib/changelogs.rake
|
67
|
+
- rakelib/epoch.rake
|
68
|
+
- rakelib/version.rake
|
64
69
|
- win32ole.gemspec
|
65
70
|
homepage: https://github.com/ruby/win32ole
|
66
71
|
licenses:
|
@@ -84,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
84
89
|
- !ruby/object:Gem::Version
|
85
90
|
version: '0'
|
86
91
|
requirements: []
|
87
|
-
rubygems_version: 3.
|
92
|
+
rubygems_version: 3.5.0.dev
|
88
93
|
signing_key:
|
89
94
|
specification_version: 4
|
90
95
|
summary: Provides an interface for OLE Automation in Ruby
|