win32-api 1.9.2 → 1.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES +4 -0
- data/Dockerfile +15 -1
- data/Dockerfile.trunk +5 -5
- data/Gemfile.lock +1 -2
- data/Rakefile +3 -1
- data/appveyor.yml +6 -6
- data/ext/Makefile +269 -0
- data/ext/api-x64-mingw32.def +2 -0
- data/ext/api.o +0 -0
- data/ext/api.so +0 -0
- data/ext/mkmf.log +39 -0
- data/ext/win32/api.c +51 -1
- data/ext/win32/api.so +0 -0
- data/test/test_win32_api.rb +7 -1
- data/win32-api.gemspec +1 -1
- metadata +12 -10
- data/pkg/win32-api-1.9.1-universal-mingw32.gem +0 -0
- data/pkg/win32-api-1.9.2-universal-mingw32.gem +0 -0
- data/win32-api-1.9.1.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f85be5c9ccd5960b68065fa44683552bf7a5620a06d3687bd4c260e2d616cd2d
|
4
|
+
data.tar.gz: a84981ff3ee59f2fde7c5d67932126718c158a60626989fb329d43402e271985
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7779f082d4ba995a9d6d0c66a58125158454d37f7704c75855f8fa6fc7df3c9858f56a94afc5bf8af32eca27c88fab909382a362a12ee5fb4ca7130ba07d2c76
|
7
|
+
data.tar.gz: 2b54ff36d075f30572ad94b88456db94e8de059611e760fb1af9da962c81a766fc11001550d7d8312196e778bea27f705bcbc87ef6f8261f7c05ffd35e4bd195
|
data/CHANGES
CHANGED
data/Dockerfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
FROM mcr.microsoft.com/windows/servercore:
|
1
|
+
FROM mcr.microsoft.com/windows/servercore:20H2
|
2
2
|
LABEL maintainer "Hiroshi Hatake <cosmo0920.wp@gmail.com>"
|
3
3
|
LABEL Description="win32-api building docker image"
|
4
4
|
|
@@ -80,6 +80,16 @@ RUN powershell \
|
|
80
80
|
Invoke-WebRequest -OutFile C:\rubyinstaller-2.7.0-1-x64.exe https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.0-1/rubyinstaller-2.7.0-1-x64.exe
|
81
81
|
RUN cmd /c "C:\rubyinstaller-2.7.0-1-x64.exe" /silent /dir=c:\ruby27-x64
|
82
82
|
|
83
|
+
# Ruby 3.0
|
84
|
+
RUN powershell \
|
85
|
+
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
|
86
|
+
Invoke-WebRequest -OutFile C:\rubyinstaller-3.0.0-1-x86.exe https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.0.0-1/rubyinstaller-3.0.0-1-x86.exe
|
87
|
+
RUN cmd /c "C:\rubyinstaller-3.0.0-1-x86.exe" /silent /dir=c:\ruby30
|
88
|
+
RUN powershell \
|
89
|
+
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
|
90
|
+
Invoke-WebRequest -OutFile C:\rubyinstaller-3.0.0-1-x64.exe https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.0.0-1/rubyinstaller-3.0.0-1-x64.exe
|
91
|
+
RUN cmd /c "C:\rubyinstaller-3.0.0-1-x64.exe" /silent /dir=c:\ruby30-x64
|
92
|
+
|
83
93
|
# DevKit
|
84
94
|
RUN powershell \
|
85
95
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
|
@@ -92,8 +102,12 @@ RUN cmd /c C:\DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe -o"c:\DevKit64" -y
|
|
92
102
|
|
93
103
|
RUN choco install -y git \
|
94
104
|
&& choco install -y msys2 --params "'/NoPath /NoUpdate /InstallDir:C:\msys64'"
|
105
|
+
# pacman -Syu --noconfirm is needed for downloading ucrt64 repo.
|
106
|
+
# They should be removed after using Ruby 2.5.9, 2.6.7, and 2.7.3 installers.
|
95
107
|
RUN refreshenv \
|
108
|
+
&& C:\ruby27\bin\ridk exec pacman -Syu --noconfirm \
|
96
109
|
&& C:\ruby27\bin\ridk install 2 3 \
|
110
|
+
&& C:\ruby27-x64\bin\ridk exec pacman -Syu --noconfirm \
|
97
111
|
&& C:\ruby27-x64\bin\ridk install 2 3
|
98
112
|
|
99
113
|
ENTRYPOINT ["cmd"]
|
data/Dockerfile.trunk
CHANGED
@@ -2,15 +2,15 @@ FROM cosmo0920/win32-api:latest
|
|
2
2
|
LABEL maintainer "Hiroshi Hatake <cosmo0920.wp@gmail.com>"
|
3
3
|
LABEL Description="win32-api building docker image"
|
4
4
|
|
5
|
-
# Ruby 3.
|
5
|
+
# Ruby 3.1
|
6
6
|
RUN powershell \
|
7
7
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
|
8
|
-
Invoke-WebRequest -OutFile C:\rubyinstaller-head-x86-
|
9
|
-
RUN cmd /c "C:\rubyinstaller-head-x86-
|
8
|
+
Invoke-WebRequest -OutFile C:\rubyinstaller-head-x86-20210418.exe https://ci.appveyor.com/api/buildjobs/smfh4ojkobb4duif/artifacts/packages%2Fri%2Frecipes%2Finstaller-inno%2Frubyinstaller-head-x86.exe
|
9
|
+
RUN cmd /c "C:\rubyinstaller-head-x86-20210418.exe" /silent /dir=c:\ruby31
|
10
10
|
RUN powershell \
|
11
11
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
|
12
|
-
Invoke-WebRequest -OutFile C:\rubyinstaller-head-x64-
|
13
|
-
RUN cmd /c "C:\rubyinstaller-head-x64-
|
12
|
+
Invoke-WebRequest -OutFile C:\rubyinstaller-head-x64-20210418.exe https://ci.appveyor.com/api/buildjobs/hsgdg4xl5ny74k94/artifacts/packages%2Fri%2Frecipes%2Finstaller-inno%2Frubyinstaller-head-x64.exe
|
13
|
+
RUN cmd /c "C:\rubyinstaller-head-x64-20210418.exe" /silent /dir=c:\ruby31-x64
|
14
14
|
|
15
15
|
RUN mkdir C:\pkg
|
16
16
|
COPY build-gem.bat C:\\build-gem.bat
|
data/Gemfile.lock
CHANGED
data/Rakefile
CHANGED
@@ -59,7 +59,7 @@ namespace 'gem' do
|
|
59
59
|
end
|
60
60
|
|
61
61
|
desc 'Build a binary gem'
|
62
|
-
task :binary, :ruby2_32, :ruby2_64, :ruby21, :ruby21_64, :ruby22, :ruby22_64, :ruby23_32, :ruby23_64, :ruby24_32, :ruby24_64, :ruby25_32, :ruby25_64, :ruby_26_32, :ruby26_64, :ruby27_32, :ruby27_64, :ruby30_32, :ruby30_64 do |task, args|
|
62
|
+
task :binary, :ruby2_32, :ruby2_64, :ruby21, :ruby21_64, :ruby22, :ruby22_64, :ruby23_32, :ruby23_64, :ruby24_32, :ruby24_64, :ruby25_32, :ruby25_64, :ruby_26_32, :ruby26_64, :ruby27_32, :ruby27_64, :ruby30_32, :ruby30_64, :ruby31_32, :ruby31_64 do |task, args|
|
63
63
|
# These are just what's on my system at the moment. Adjust as needed.
|
64
64
|
# ri refers to RubyInstaller, ruby 2.3 and prev were built with RubyInstaller (:ri),
|
65
65
|
# 2.4 and later with RubyInstaller2 (:ri2)
|
@@ -100,6 +100,8 @@ namespace 'gem' do
|
|
100
100
|
:ruby27_64 => {:path => "#{pre}/ruby27-x64/bin", :ri => :ri2_64, :omit => true},
|
101
101
|
:ruby30_32 => {:path => "#{pre}/ruby30/bin", :ri => :ri2, :omit => true},
|
102
102
|
:ruby30_64 => {:path => "#{pre}/ruby30-x64/bin", :ri => :ri2_64, :omit => true},
|
103
|
+
:ruby31_32 => {:path => "#{pre}/ruby31/bin", :ri => :ri2, :omit => true},
|
104
|
+
:ruby31_64 => {:path => "#{pre}/ruby31-x64/bin", :ri => :ri2_64, :omit => true},
|
103
105
|
}
|
104
106
|
)
|
105
107
|
|
data/appveyor.yml
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
version: '{build}'
|
2
2
|
|
3
|
+
image: Visual Studio 2019
|
4
|
+
|
3
5
|
init:
|
4
6
|
# use a minimal path
|
5
7
|
- set PATH=C:\ruby%ruby_version%\bin;C:\Program Files\7-Zip;C:\Program Files\AppVeyor\BuildAgent;C:\Program Files\Git\cmd;C:\Windows\system32
|
@@ -26,6 +28,10 @@ test_script:
|
|
26
28
|
environment:
|
27
29
|
matrix:
|
28
30
|
- ruby_version: _trunk
|
31
|
+
- ruby_version: 30-x64
|
32
|
+
- ruby_version: 30
|
33
|
+
- ruby_version: 27-x64
|
34
|
+
- ruby_version: 27
|
29
35
|
- ruby_version: 26-x64
|
30
36
|
- ruby_version: 26
|
31
37
|
- ruby_version: 25-x64
|
@@ -34,12 +40,6 @@ environment:
|
|
34
40
|
- ruby_version: 24
|
35
41
|
- ruby_version: 23-x64
|
36
42
|
- ruby_version: 23
|
37
|
-
- ruby_version: 22-x64
|
38
|
-
- ruby_version: 22
|
39
|
-
- ruby_version: 21-x64
|
40
|
-
- ruby_version: 21
|
41
|
-
- ruby_version: 200-x64
|
42
|
-
- ruby_version: 200
|
43
43
|
|
44
44
|
matrix:
|
45
45
|
allow_failures:
|
data/ext/Makefile
ADDED
@@ -0,0 +1,269 @@
|
|
1
|
+
|
2
|
+
SHELL = /bin/sh
|
3
|
+
|
4
|
+
# V=0 quiet, V=1 verbose. other values don't work.
|
5
|
+
V = 0
|
6
|
+
Q1 = $(V:1=)
|
7
|
+
Q = $(Q1:0=@)
|
8
|
+
ECHO1 = $(V:1=@ :)
|
9
|
+
ECHO = $(ECHO1:0=@ echo)
|
10
|
+
NULLCMD = :
|
11
|
+
|
12
|
+
#### Start of system configuration section. ####
|
13
|
+
|
14
|
+
srcdir = win32
|
15
|
+
topdir = /C/Ruby27-x64/include/ruby-2.7.0
|
16
|
+
hdrdir = $(topdir)
|
17
|
+
arch_hdrdir = C:/Ruby27-x64/include/ruby-2.7.0/x64-mingw32
|
18
|
+
PATH_SEPARATOR = :
|
19
|
+
VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
|
20
|
+
prefix = $(DESTDIR)/C/Ruby27-x64
|
21
|
+
rubysitearchprefix = $(rubylibprefix)/$(sitearch)
|
22
|
+
rubyarchprefix = $(rubylibprefix)/$(arch)
|
23
|
+
rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
|
24
|
+
exec_prefix = $(prefix)
|
25
|
+
vendorarchhdrdir = $(vendorhdrdir)/$(sitearch)
|
26
|
+
sitearchhdrdir = $(sitehdrdir)/$(sitearch)
|
27
|
+
rubyarchhdrdir = $(rubyhdrdir)/$(arch)
|
28
|
+
vendorhdrdir = $(rubyhdrdir)/vendor_ruby
|
29
|
+
sitehdrdir = $(rubyhdrdir)/site_ruby
|
30
|
+
rubyhdrdir = $(includedir)/$(RUBY_VERSION_NAME)
|
31
|
+
vendorarchdir = $(vendorlibdir)/$(sitearch)
|
32
|
+
vendorlibdir = $(vendordir)/$(ruby_version)
|
33
|
+
vendordir = $(rubylibprefix)/vendor_ruby
|
34
|
+
sitearchdir = $(sitelibdir)/$(sitearch)
|
35
|
+
sitelibdir = $(sitedir)/$(ruby_version)
|
36
|
+
sitedir = $(rubylibprefix)/site_ruby
|
37
|
+
rubyarchdir = $(rubylibdir)/$(arch)
|
38
|
+
rubylibdir = $(rubylibprefix)/$(ruby_version)
|
39
|
+
sitearchincludedir = $(includedir)/$(sitearch)
|
40
|
+
archincludedir = $(includedir)/$(arch)
|
41
|
+
sitearchlibdir = $(libdir)/$(sitearch)
|
42
|
+
archlibdir = $(libdir)/$(arch)
|
43
|
+
ridir = $(datarootdir)/$(RI_BASE_NAME)
|
44
|
+
mandir = $(datarootdir)/man
|
45
|
+
localedir = $(datarootdir)/locale
|
46
|
+
libdir = $(exec_prefix)/lib
|
47
|
+
psdir = $(docdir)
|
48
|
+
pdfdir = $(docdir)
|
49
|
+
dvidir = $(docdir)
|
50
|
+
htmldir = $(docdir)
|
51
|
+
infodir = $(datarootdir)/info
|
52
|
+
docdir = $(datarootdir)/doc/$(PACKAGE)
|
53
|
+
oldincludedir = $(DESTDIR)/usr/include
|
54
|
+
includedir = $(prefix)/include
|
55
|
+
localstatedir = $(prefix)/var
|
56
|
+
sharedstatedir = $(prefix)/com
|
57
|
+
sysconfdir = $(DESTDIR)
|
58
|
+
datadir = $(datarootdir)
|
59
|
+
datarootdir = $(prefix)/share
|
60
|
+
libexecdir = $(exec_prefix)/libexec
|
61
|
+
sbindir = $(exec_prefix)/sbin
|
62
|
+
bindir = $(exec_prefix)/bin
|
63
|
+
archdir = $(rubyarchdir)
|
64
|
+
|
65
|
+
|
66
|
+
CC_WRAPPER =
|
67
|
+
CC = x86_64-w64-mingw32-gcc
|
68
|
+
CXX = x86_64-w64-mingw32-g++
|
69
|
+
LIBRUBY = lib$(RUBY_SO_NAME).dll.a
|
70
|
+
LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
|
71
|
+
LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
|
72
|
+
LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static $(MAINLIBS)
|
73
|
+
empty =
|
74
|
+
OUTFLAG = -o $(empty)
|
75
|
+
COUTFLAG = -o $(empty)
|
76
|
+
CSRCFLAG = $(empty)
|
77
|
+
|
78
|
+
RUBY_EXTCONF_H =
|
79
|
+
cflags = $(optflags) $(debugflags) $(warnflags)
|
80
|
+
cxxflags =
|
81
|
+
optflags = -O3 -fno-omit-frame-pointer
|
82
|
+
debugflags = -ggdb3
|
83
|
+
warnflags = -Wall -Wextra -Wdeprecated-declarations -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wwrite-strings -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable
|
84
|
+
cppflags =
|
85
|
+
CCDLFLAGS =
|
86
|
+
CFLAGS = $(CCDLFLAGS) -O3 -fno-fast-math -fstack-protector-strong -fno-omit-frame-pointer $(ARCH_FLAG)
|
87
|
+
INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
|
88
|
+
DEFS = -D_FILE_OFFSET_BITS=64
|
89
|
+
CPPFLAGS = -DHAVE_STRNCPY_S -D__USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0600 -D__MINGW_USE_VC2005_COMPAT $(DEFS) $(cppflags)
|
90
|
+
CXXFLAGS = $(CCDLFLAGS) -march=x86-64 -mtune=generic -O2 -pipe $(ARCH_FLAG)
|
91
|
+
ldflags = -L. -pipe -s -fstack-protector-strong
|
92
|
+
dldflags = -pipe -s -fstack-protector-strong -Wl,--enable-auto-image-base,--enable-auto-import $(DEFFILE)
|
93
|
+
ARCH_FLAG =
|
94
|
+
DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
|
95
|
+
LDSHARED = $(CC) -shared
|
96
|
+
LDSHAREDXX = $(CXX) -shared
|
97
|
+
AR = ar
|
98
|
+
EXEEXT = .exe
|
99
|
+
|
100
|
+
RUBY_INSTALL_NAME = $(RUBY_BASE_NAME)
|
101
|
+
RUBY_SO_NAME = x64-msvcrt-ruby270
|
102
|
+
RUBYW_INSTALL_NAME = $(RUBYW_BASE_NAME)
|
103
|
+
RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version)
|
104
|
+
RUBYW_BASE_NAME = rubyw
|
105
|
+
RUBY_BASE_NAME = ruby
|
106
|
+
|
107
|
+
arch = x64-mingw32
|
108
|
+
sitearch = x64-msvcrt
|
109
|
+
ruby_version = 2.7.0
|
110
|
+
ruby = $(bindir)/$(RUBY_BASE_NAME)
|
111
|
+
RUBY = $(ruby)
|
112
|
+
ruby_headers = $(hdrdir)/ruby.h $(hdrdir)/ruby/backward.h $(hdrdir)/ruby/ruby.h $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/missing.h $(hdrdir)/ruby/intern.h $(hdrdir)/ruby/st.h $(hdrdir)/ruby/subst.h $(arch_hdrdir)/ruby/config.h
|
113
|
+
|
114
|
+
RM = rm -f
|
115
|
+
RM_RF = $(RUBY) -run -e rm -- -rf
|
116
|
+
RMDIRS = rmdir --ignore-fail-on-non-empty -p
|
117
|
+
MAKEDIRS = /usr/bin/mkdir -p
|
118
|
+
INSTALL = /usr/bin/install -c
|
119
|
+
INSTALL_PROG = $(INSTALL) -m 0755
|
120
|
+
INSTALL_DATA = $(INSTALL) -m 644
|
121
|
+
COPY = cp
|
122
|
+
TOUCH = exit >
|
123
|
+
|
124
|
+
#### End of system configuration section. ####
|
125
|
+
|
126
|
+
preload =
|
127
|
+
libpath = . $(libdir)
|
128
|
+
LIBPATH = -L. -L$(libdir)
|
129
|
+
DEFFILE = $(TARGET)-$(arch).def
|
130
|
+
|
131
|
+
CLEANFILES = mkmf.log $(DEFFILE)
|
132
|
+
DISTCLEANFILES =
|
133
|
+
DISTCLEANDIRS =
|
134
|
+
|
135
|
+
extout =
|
136
|
+
extout_prefix =
|
137
|
+
target_prefix = /win32
|
138
|
+
LOCAL_LIBS =
|
139
|
+
LIBS = $(LIBRUBYARG_SHARED) -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi
|
140
|
+
ORIG_SRCS = api.c
|
141
|
+
SRCS = $(ORIG_SRCS)
|
142
|
+
OBJS = api.o
|
143
|
+
HDRS =
|
144
|
+
LOCAL_HDRS =
|
145
|
+
TARGET = api
|
146
|
+
TARGET_NAME = api
|
147
|
+
TARGET_ENTRY = Init_$(TARGET_NAME)
|
148
|
+
DLLIB = $(TARGET).so
|
149
|
+
EXTSTATIC =
|
150
|
+
STATIC_LIB =
|
151
|
+
|
152
|
+
TIMESTAMP_DIR = .
|
153
|
+
BINDIR = $(bindir)
|
154
|
+
RUBYCOMMONDIR = $(sitedir)$(target_prefix)
|
155
|
+
RUBYLIBDIR = $(sitelibdir)$(target_prefix)
|
156
|
+
RUBYARCHDIR = $(sitearchdir)$(target_prefix)
|
157
|
+
HDRDIR = $(rubyhdrdir)/ruby$(target_prefix)
|
158
|
+
ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix)
|
159
|
+
TARGET_SO_DIR =
|
160
|
+
TARGET_SO = $(TARGET_SO_DIR)$(DLLIB)
|
161
|
+
CLEANLIBS = $(TARGET_SO)
|
162
|
+
CLEANOBJS = *.o *.bak
|
163
|
+
|
164
|
+
all: $(DLLIB)
|
165
|
+
static: $(STATIC_LIB)
|
166
|
+
.PHONY: all install static install-so install-rb
|
167
|
+
.PHONY: clean clean-so clean-static clean-rb
|
168
|
+
|
169
|
+
clean-static::
|
170
|
+
clean-rb-default::
|
171
|
+
clean-rb::
|
172
|
+
clean-so::
|
173
|
+
clean: clean-so clean-static clean-rb-default clean-rb
|
174
|
+
-$(Q)$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time
|
175
|
+
|
176
|
+
distclean-rb-default::
|
177
|
+
distclean-rb::
|
178
|
+
distclean-so::
|
179
|
+
distclean-static::
|
180
|
+
distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb
|
181
|
+
-$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
|
182
|
+
-$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
|
183
|
+
-$(Q)$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true
|
184
|
+
|
185
|
+
realclean: distclean
|
186
|
+
install: install-so install-rb
|
187
|
+
|
188
|
+
install-so: $(DLLIB) $(TIMESTAMP_DIR)/.sitearchdir.-.win32.time
|
189
|
+
$(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
|
190
|
+
clean-static::
|
191
|
+
-$(Q)$(RM) $(STATIC_LIB)
|
192
|
+
install-rb: pre-install-rb do-install-rb install-rb-default
|
193
|
+
install-rb-default: pre-install-rb-default do-install-rb-default
|
194
|
+
pre-install-rb: Makefile
|
195
|
+
pre-install-rb-default: Makefile
|
196
|
+
do-install-rb:
|
197
|
+
do-install-rb-default:
|
198
|
+
pre-install-rb-default:
|
199
|
+
@$(NULLCMD)
|
200
|
+
$(TIMESTAMP_DIR)/.sitearchdir.-.win32.time:
|
201
|
+
$(Q) $(MAKEDIRS) $(@D) $(RUBYARCHDIR)
|
202
|
+
$(Q) $(TOUCH) $@
|
203
|
+
|
204
|
+
site-install: site-install-so site-install-rb
|
205
|
+
site-install-so: install-so
|
206
|
+
site-install-rb: install-rb
|
207
|
+
|
208
|
+
.SUFFIXES: .c .m .cc .mm .cxx .cpp .o .S
|
209
|
+
|
210
|
+
.cc.o:
|
211
|
+
$(ECHO) compiling $(<)
|
212
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
213
|
+
|
214
|
+
.cc.S:
|
215
|
+
$(ECHO) translating $(<)
|
216
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
217
|
+
|
218
|
+
.mm.o:
|
219
|
+
$(ECHO) compiling $(<)
|
220
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
221
|
+
|
222
|
+
.mm.S:
|
223
|
+
$(ECHO) translating $(<)
|
224
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
225
|
+
|
226
|
+
.cxx.o:
|
227
|
+
$(ECHO) compiling $(<)
|
228
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
229
|
+
|
230
|
+
.cxx.S:
|
231
|
+
$(ECHO) translating $(<)
|
232
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
233
|
+
|
234
|
+
.cpp.o:
|
235
|
+
$(ECHO) compiling $(<)
|
236
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
237
|
+
|
238
|
+
.cpp.S:
|
239
|
+
$(ECHO) translating $(<)
|
240
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
241
|
+
|
242
|
+
.c.o:
|
243
|
+
$(ECHO) compiling $(<)
|
244
|
+
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
245
|
+
|
246
|
+
.c.S:
|
247
|
+
$(ECHO) translating $(<)
|
248
|
+
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
249
|
+
|
250
|
+
.m.o:
|
251
|
+
$(ECHO) compiling $(<)
|
252
|
+
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
253
|
+
|
254
|
+
.m.S:
|
255
|
+
$(ECHO) translating $(<)
|
256
|
+
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
257
|
+
|
258
|
+
$(TARGET_SO): $(DEFFILE) $(OBJS) Makefile
|
259
|
+
$(ECHO) linking shared-object win32/$(DLLIB)
|
260
|
+
-$(Q)$(RM) $(@)
|
261
|
+
$(Q) $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
$(DEFFILE):
|
266
|
+
$(ECHO) generating $(@)
|
267
|
+
$(Q) (echo EXPORTS && echo $(TARGET_ENTRY)) > $@
|
268
|
+
|
269
|
+
$(OBJS): $(HDRS) $(ruby_headers)
|
data/ext/api.o
ADDED
Binary file
|
data/ext/api.so
ADDED
Binary file
|
data/ext/mkmf.log
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
have_func: checking for strncpy_s()... -------------------- yes
|
2
|
+
|
3
|
+
"x86_64-w64-mingw32-gcc -o conftest.exe -IC:/Ruby27-x64/include/ruby-2.7.0/x64-mingw32 -IC:/Ruby27-x64/include/ruby-2.7.0/ruby/backward -IC:/Ruby27-x64/include/ruby-2.7.0 -I. -D__USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0600 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64 -O3 -fno-fast-math -fstack-protector-strong -fno-omit-frame-pointer conftest.c -L. -LC:/Ruby27-x64/lib -L. -pipe -s -fstack-protector-strong -lx64-msvcrt-ruby270 -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi "
|
4
|
+
checked program was:
|
5
|
+
/* begin */
|
6
|
+
1: #include "ruby.h"
|
7
|
+
2:
|
8
|
+
3: #include <winsock2.h>
|
9
|
+
4: #include <windows.h>
|
10
|
+
5: int main(int argc, char **argv)
|
11
|
+
6: {
|
12
|
+
7: return !!argv[argc];
|
13
|
+
8: }
|
14
|
+
/* end */
|
15
|
+
|
16
|
+
"x86_64-w64-mingw32-gcc -o conftest.exe -IC:/Ruby27-x64/include/ruby-2.7.0/x64-mingw32 -IC:/Ruby27-x64/include/ruby-2.7.0/ruby/backward -IC:/Ruby27-x64/include/ruby-2.7.0 -I. -D__USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0600 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64 -O3 -fno-fast-math -fstack-protector-strong -fno-omit-frame-pointer conftest.c -L. -LC:/Ruby27-x64/lib -L. -pipe -s -fstack-protector-strong -lx64-msvcrt-ruby270 -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi "
|
17
|
+
checked program was:
|
18
|
+
/* begin */
|
19
|
+
1: #include "ruby.h"
|
20
|
+
2:
|
21
|
+
3: #include <winsock2.h>
|
22
|
+
4: #include <windows.h>
|
23
|
+
5:
|
24
|
+
6: /*top*/
|
25
|
+
7: extern int t(void);
|
26
|
+
8: int main(int argc, char **argv)
|
27
|
+
9: {
|
28
|
+
10: if (argc > 1000000) {
|
29
|
+
11: int (* volatile tp)(void)=(int (*)(void))&t;
|
30
|
+
12: printf("%d", (*tp)());
|
31
|
+
13: }
|
32
|
+
14:
|
33
|
+
15: return !!argv[argc];
|
34
|
+
16: }
|
35
|
+
17: int t(void) { void ((*volatile p)()); p = (void ((*)()))strncpy_s; return !p; }
|
36
|
+
/* end */
|
37
|
+
|
38
|
+
--------------------
|
39
|
+
|
data/ext/win32/api.c
CHANGED
@@ -43,7 +43,7 @@
|
|
43
43
|
|
44
44
|
|
45
45
|
#define MAX_BUF 1024
|
46
|
-
#define WINDOWS_API_VERSION "1.
|
46
|
+
#define WINDOWS_API_VERSION "1.10.0"
|
47
47
|
|
48
48
|
#define _T_VOID 0
|
49
49
|
#define _T_LONG 1
|
@@ -62,6 +62,35 @@ typedef struct {
|
|
62
62
|
int prototype[20];
|
63
63
|
} Win32API;
|
64
64
|
|
65
|
+
typedef struct ThreadData {
|
66
|
+
DWORD win32api_error;
|
67
|
+
} ThreadData;
|
68
|
+
|
69
|
+
static inline ThreadData* thread_data_get(void);
|
70
|
+
static ID id_thread_data;
|
71
|
+
|
72
|
+
static ThreadData* thread_data_init(void)
|
73
|
+
{
|
74
|
+
ThreadData* td;
|
75
|
+
VALUE obj;
|
76
|
+
|
77
|
+
obj = Data_Make_Struct(rb_cObject, ThreadData, NULL, -1, td);
|
78
|
+
rb_thread_local_aset(rb_thread_current(), id_thread_data, obj);
|
79
|
+
|
80
|
+
return td;
|
81
|
+
}
|
82
|
+
|
83
|
+
static inline ThreadData* thread_data_get()
|
84
|
+
{
|
85
|
+
VALUE obj = rb_thread_local_aref(rb_thread_current(), id_thread_data);
|
86
|
+
|
87
|
+
if(obj != Qnil && TYPE(obj) == T_DATA){
|
88
|
+
return (ThreadData*) DATA_PTR(obj);
|
89
|
+
}
|
90
|
+
|
91
|
+
return thread_data_init();
|
92
|
+
}
|
93
|
+
|
65
94
|
static void api_free(Win32API* ptr){
|
66
95
|
if(ptr->library)
|
67
96
|
FreeLibrary(ptr->library);
|
@@ -781,6 +810,7 @@ static VALUE api_call(int argc, VALUE* argv, VALUE self){
|
|
781
810
|
uintptr_t return_value;
|
782
811
|
int i = 0;
|
783
812
|
int len;
|
813
|
+
ThreadData* thread_data = thread_data_get();
|
784
814
|
|
785
815
|
struct{
|
786
816
|
uintptr_t params[20];
|
@@ -975,6 +1005,8 @@ static VALUE api_call(int argc, VALUE* argv, VALUE self){
|
|
975
1005
|
}
|
976
1006
|
}
|
977
1007
|
|
1008
|
+
thread_data->win32api_error = GetLastError();
|
1009
|
+
|
978
1010
|
/* Return the appropriate type based on the return type specified
|
979
1011
|
* in the constructor.
|
980
1012
|
*/
|
@@ -1029,6 +1061,21 @@ static VALUE api_call(int argc, VALUE* argv, VALUE self){
|
|
1029
1061
|
return v_return;
|
1030
1062
|
}
|
1031
1063
|
|
1064
|
+
/*
|
1065
|
+
* call-seq:
|
1066
|
+
* Win32::API.last_error
|
1067
|
+
*
|
1068
|
+
* Return the last Win32 error code of the current executing thread.
|
1069
|
+
*
|
1070
|
+
* The error code shouldn't be retrieved by calling GetLastError() manually
|
1071
|
+
* because Ruby's internal code may call other Win32 API and reset the error
|
1072
|
+
* code before it.
|
1073
|
+
*/
|
1074
|
+
static VALUE get_last_error(VALUE self)
|
1075
|
+
{
|
1076
|
+
return INT2NUM(thread_data_get()->win32api_error);
|
1077
|
+
}
|
1078
|
+
|
1032
1079
|
/*
|
1033
1080
|
* Wraps the Windows API functions in a Ruby interface.
|
1034
1081
|
*/
|
@@ -1061,6 +1108,9 @@ void Init_api(){
|
|
1061
1108
|
/* Miscellaneous */
|
1062
1109
|
rb_define_alloc_func(cAPI, api_allocate);
|
1063
1110
|
|
1111
|
+
/* GetLastError alternative */
|
1112
|
+
rb_define_singleton_method(cAPI, "last_error", get_last_error, 0);
|
1113
|
+
|
1064
1114
|
/* Win32::API Instance Methods */
|
1065
1115
|
rb_define_method(cAPI, "initialize", api_init, -1);
|
1066
1116
|
rb_define_method(cAPI, "call", api_call, -1);
|
data/ext/win32/api.so
ADDED
Binary file
|
data/test/test_win32_api.rb
CHANGED
@@ -18,7 +18,7 @@ class TC_Win32_API < Test::Unit::TestCase
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def test_version
|
21
|
-
assert_equal('1.
|
21
|
+
assert_equal('1.10.0', API::VERSION)
|
22
22
|
end
|
23
23
|
|
24
24
|
def test_constructor_basic
|
@@ -43,6 +43,12 @@ class TC_Win32_API < Test::Unit::TestCase
|
|
43
43
|
assert_equal(0xFFFFFFFF, @gfa.call('C:/foobarbazblah'))
|
44
44
|
end
|
45
45
|
|
46
|
+
def test_last_error
|
47
|
+
@gfa.call('C:/foobarbazblah')
|
48
|
+
error_file_not_found = 2
|
49
|
+
assert_equal(error_file_not_found, API.last_error)
|
50
|
+
end
|
51
|
+
|
46
52
|
def test_dll_name
|
47
53
|
assert_respond_to(@gcd, :dll_name)
|
48
54
|
assert_equal('kernel32', @gcd.dll_name)
|
data/win32-api.gemspec
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = 'win32-api'
|
5
|
-
spec.version = '1.
|
5
|
+
spec.version = '1.10.0'
|
6
6
|
spec.authors = ['Daniel J. Berger', 'Park Heesob', 'Hiroshi Hatake']
|
7
7
|
spec.license = 'Artistic-2.0'
|
8
8
|
spec.email = 'djberg96@gmail.com'
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: win32-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel J. Berger
|
8
8
|
- Park Heesob
|
9
9
|
- Hiroshi Hatake
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2021-04-19 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: test-unit
|
@@ -65,10 +65,14 @@ files:
|
|
65
65
|
- Rakefile
|
66
66
|
- appveyor.yml
|
67
67
|
- build-gem.bat
|
68
|
+
- ext/Makefile
|
69
|
+
- ext/api-x64-mingw32.def
|
70
|
+
- ext/api.o
|
71
|
+
- ext/api.so
|
68
72
|
- ext/extconf.rb
|
73
|
+
- ext/mkmf.log
|
69
74
|
- ext/win32/api.c
|
70
|
-
-
|
71
|
-
- pkg/win32-api-1.9.2-universal-mingw32.gem
|
75
|
+
- ext/win32/api.so
|
72
76
|
- test.rb
|
73
77
|
- test/test_win32_api.rb
|
74
78
|
- test/test_win32_api_callback.rb
|
@@ -611,13 +615,12 @@ files:
|
|
611
615
|
- vendor/bundle/ruby/2.7.0/specifications/power_assert-1.1.7.gemspec
|
612
616
|
- vendor/bundle/ruby/2.7.0/specifications/rake-13.0.1.gemspec
|
613
617
|
- vendor/bundle/ruby/2.7.0/specifications/test-unit-3.3.5.gemspec
|
614
|
-
- win32-api-1.9.1.gem
|
615
618
|
- win32-api.gemspec
|
616
619
|
homepage: http://github.com/cosmo0920/win32-api
|
617
620
|
licenses:
|
618
621
|
- Artistic-2.0
|
619
622
|
metadata: {}
|
620
|
-
post_install_message:
|
623
|
+
post_install_message:
|
621
624
|
rdoc_options: []
|
622
625
|
require_paths:
|
623
626
|
- lib
|
@@ -632,9 +635,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
632
635
|
- !ruby/object:Gem::Version
|
633
636
|
version: '0'
|
634
637
|
requirements: []
|
635
|
-
|
636
|
-
|
637
|
-
signing_key:
|
638
|
+
rubygems_version: 3.1.4
|
639
|
+
signing_key:
|
638
640
|
specification_version: 4
|
639
641
|
summary: A superior replacement for Win32API
|
640
642
|
test_files:
|
Binary file
|
Binary file
|
data/win32-api-1.9.1.gem
DELETED
Binary file
|