win32-api 1.7.1-universal-mingw32 → 1.10.0-universal-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGES +20 -0
- data/Dockerfile +113 -0
- data/Dockerfile.trunk +17 -0
- data/MANIFEST +1 -1
- data/{README → README.md} +23 -16
- data/RELEASE.md +41 -0
- data/Rakefile +27 -5
- data/appveyor.yml +8 -8
- data/build-gem.bat +3 -0
- data/ext/win32/api.c +82 -16
- data/lib/win32/api.rb +16 -0
- data/lib/win32/ruby21_32/win32/api.so +0 -0
- data/lib/win32/ruby21_64/win32/api.so +0 -0
- data/lib/win32/ruby22_32/win32/api.so +0 -0
- data/lib/win32/ruby22_64/win32/api.so +0 -0
- data/lib/win32/ruby23_32/win32/api.so +0 -0
- data/lib/win32/ruby23_64/win32/api.so +0 -0
- data/lib/win32/ruby24_32/win32/api.so +0 -0
- data/lib/win32/ruby24_64/win32/api.so +0 -0
- data/lib/win32/ruby25_32/win32/api.so +0 -0
- data/lib/win32/ruby25_64/win32/api.so +0 -0
- data/lib/win32/ruby26_32/win32/api.so +0 -0
- data/lib/win32/ruby26_64/win32/api.so +0 -0
- data/lib/win32/ruby27_32/win32/api.so +0 -0
- data/lib/win32/ruby27_64/win32/api.so +0 -0
- data/lib/win32/ruby2_32/win32/api.so +0 -0
- data/lib/win32/ruby2_64/win32/api.so +0 -0
- data/lib/win32/ruby30_32/win32/api.so +0 -0
- data/lib/win32/ruby30_64/win32/api.so +0 -0
- data/lib/win32/ruby31_32/win32/api.so +0 -0
- data/lib/win32/ruby31_64/win32/api.so +0 -0
- data/test/test_win32_api.rb +7 -1
- data/win32-api.gemspec +3 -3
- metadata +18 -11
- data/Gemfile.lock +0 -24
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 0e094917b41770c3fc5a82f79b60638d3eb3dc7d5255e17e1aae7089a0070979
         | 
| 4 | 
            +
              data.tar.gz: 2e548c70a32503b0b4f3353bde818a72a4ca75975d6a972d7a570cfc48a93348
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 1fb21c7689902148c217af40a432791037c9492519f84d171ac3c70225258313af9a13aef7bb2c94b3c319488256dfa3092c123d742d401f46127b9d50168018
         | 
| 7 | 
            +
              data.tar.gz: c3f81dfa40a40920cb44a9dda2e19164e8edb0c3ed41c18577b93186b8abd31cebd76b803c6a22ab82b8fe899cb2b403b8ccd1bbabb55c962552084ca816e70d
         | 
    
        data/CHANGES
    CHANGED
    
    | @@ -1,3 +1,23 @@ | |
| 1 | 
            +
            == 1.10.0 - 19-Apr-2021
         | 
| 2 | 
            +
            * Add Ruby 3.1 snapshot support
         | 
| 3 | 
            +
            * Add API.last_error
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            == 1.9.2 - 13-Sep-2020
         | 
| 6 | 
            +
            * Handle Ruby 3.0 snapshot (formerly known as Ruby 2.8).
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            == 1.9.1 - 14-Jul-2020
         | 
| 9 | 
            +
            * Handle whether tainted support or not.
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            == 1.9.0 - 6-Jan-2020
         | 
| 12 | 
            +
            * Add Ruby 2.8 snapshot support.
         | 
| 13 | 
            +
            * Now includes binaries for Ruby 2.8 both 32 and 64 bit versions.
         | 
| 14 | 
            +
            * Use RubyInstaller 2.7.0-1 for Ruby 2.7 binaries.
         | 
| 15 | 
            +
             | 
| 16 | 
            +
            == 1.8.0 - 6-Jan-2019
         | 
| 17 | 
            +
            * Add Ruby 2.7 snapshot support.
         | 
| 18 | 
            +
            * Now includes binaries for Ruby 2.7 both 32 and 64 bit versions.
         | 
| 19 | 
            +
            * Use RubyInstaller 2.6.0-1 for Ruby 2.6 binaries.
         | 
| 20 | 
            +
             | 
| 1 21 | 
             
            == 1.7.1 - 4-Jan-2018
         | 
| 2 22 | 
             
            * Add Ruby 2.6 snapshot support.
         | 
| 3 23 | 
             
            * Now includes binaries for Ruby 2.6 both 32 and 64 bit versions.
         | 
    
        data/Dockerfile
    ADDED
    
    | @@ -0,0 +1,113 @@ | |
| 1 | 
            +
            FROM mcr.microsoft.com/windows/servercore:20H2
         | 
| 2 | 
            +
            LABEL maintainer "Hiroshi Hatake <cosmo0920.wp@gmail.com>"
         | 
| 3 | 
            +
            LABEL Description="win32-api building docker image"
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            # Do not split this into multiple RUN!
         | 
| 6 | 
            +
            # Docker creates a layer for every RUN-Statement
         | 
| 7 | 
            +
            RUN powershell -Command "Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))"
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            # Ruby 2.0.0
         | 
| 10 | 
            +
            RUN powershell \
         | 
| 11 | 
            +
            	[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
         | 
| 12 | 
            +
            	Invoke-WebRequest -OutFile C:\rubyinstaller-2.0.0-p648.exe https://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.0.0-p648.exe
         | 
| 13 | 
            +
            RUN cmd /c "C:\rubyinstaller-2.0.0-p648.exe" /silent /dir=c:\ruby200
         | 
| 14 | 
            +
            RUN powershell \
         | 
| 15 | 
            +
            	[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
         | 
| 16 | 
            +
            	Invoke-WebRequest -OutFile C:\rubyinstaller-2.0.0-p648-x64.exe https://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.0.0-p648-x64.exe
         | 
| 17 | 
            +
            RUN cmd /c "C:\rubyinstaller-2.0.0-p648-x64.exe" /silent /dir=c:\ruby200-x64
         | 
| 18 | 
            +
            # Ruby 2.1
         | 
| 19 | 
            +
            RUN powershell \
         | 
| 20 | 
            +
            	[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
         | 
| 21 | 
            +
            	Invoke-WebRequest -OutFile C:\rubyinstaller-2.1.9.exe https://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.1.9.exe
         | 
| 22 | 
            +
            RUN cmd /c "C:\rubyinstaller-2.1.9.exe" /silent /dir=c:\ruby21
         | 
| 23 | 
            +
            RUN powershell \
         | 
| 24 | 
            +
            	[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
         | 
| 25 | 
            +
            	Invoke-WebRequest -OutFile C:\rubyinstaller-2.1.9-x64.exe https://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.1.9-x64.exe
         | 
| 26 | 
            +
            RUN cmd /c "C:\rubyinstaller-2.1.9-x64.exe" /silent /dir=c:\ruby21-x64
         | 
| 27 | 
            +
            # Ruby 2.2
         | 
| 28 | 
            +
            RUN powershell \
         | 
| 29 | 
            +
            	[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
         | 
| 30 | 
            +
            	Invoke-WebRequest -OutFile C:\rubyinstaller-2.2.6.exe https://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.2.6.exe
         | 
| 31 | 
            +
            RUN cmd /c "C:\rubyinstaller-2.2.6.exe" /silent /dir=c:\ruby22
         | 
| 32 | 
            +
            RUN powershell \
         | 
| 33 | 
            +
            	[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
         | 
| 34 | 
            +
            	Invoke-WebRequest -OutFile C:\rubyinstaller-2.2.6-x64.exe https://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.2.6-x64.exe
         | 
| 35 | 
            +
            RUN cmd /c "C:\rubyinstaller-2.2.6-x64.exe" /silent /dir=c:\ruby22-x64
         | 
| 36 | 
            +
            # Ruby 2.3
         | 
| 37 | 
            +
            RUN powershell \
         | 
| 38 | 
            +
            	[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
         | 
| 39 | 
            +
            	Invoke-WebRequest -OutFile C:\rubyinstaller-2.3.3.exe https://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.3.3.exe
         | 
| 40 | 
            +
            RUN cmd /c "C:\rubyinstaller-2.3.3.exe" /silent /dir=c:\ruby23
         | 
| 41 | 
            +
            RUN powershell \
         | 
| 42 | 
            +
            	[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
         | 
| 43 | 
            +
            	Invoke-WebRequest -OutFile C:\rubyinstaller-2.3.3-x64.exe https://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.3.3-x64.exe
         | 
| 44 | 
            +
            RUN cmd /c "C:\rubyinstaller-2.3.3-x64.exe" /silent /dir=c:\ruby23-x64
         | 
| 45 | 
            +
            # Ruby 2.4
         | 
| 46 | 
            +
            RUN powershell \
         | 
| 47 | 
            +
            	[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
         | 
| 48 | 
            +
            	Invoke-WebRequest -OutFile C:\rubyinstaller-2.4.9-1-x86.exe https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.4.9-1/rubyinstaller-2.4.9-1-x86.exe
         | 
| 49 | 
            +
            RUN cmd /c "C:\rubyinstaller-2.4.9-1-x86.exe" /silent /dir=c:\ruby24
         | 
| 50 | 
            +
            RUN powershell \
         | 
| 51 | 
            +
            	[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
         | 
| 52 | 
            +
            	Invoke-WebRequest -OutFile C:\rubyinstaller-2.4.9-1-x64.exe https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.4.9-1/rubyinstaller-2.4.9-1-x64.exe
         | 
| 53 | 
            +
            RUN cmd /c "C:\rubyinstaller-2.4.9-1-x64.exe" /silent /dir=c:\ruby24-x64
         | 
| 54 | 
            +
            # Ruby 2.5
         | 
| 55 | 
            +
            RUN powershell \
         | 
| 56 | 
            +
            	[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
         | 
| 57 | 
            +
            	Invoke-WebRequest -OutFile C:\rubyinstaller-2.5.7-1-x86.exe https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.5.7-1/rubyinstaller-2.5.7-1-x86.exe
         | 
| 58 | 
            +
            RUN cmd /c "C:\rubyinstaller-2.5.7-1-x86.exe" /silent /dir=c:\ruby25
         | 
| 59 | 
            +
            RUN powershell \
         | 
| 60 | 
            +
            	[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
         | 
| 61 | 
            +
            	Invoke-WebRequest -OutFile C:\rubyinstaller-2.5.7-1-x64.exe https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.5.7-1/rubyinstaller-2.5.7-1-x64.exe
         | 
| 62 | 
            +
            RUN cmd /c "C:\rubyinstaller-2.5.7-1-x64.exe" /silent /dir=c:\ruby25-x64
         | 
| 63 | 
            +
            # Ruby 2.6
         | 
| 64 | 
            +
            RUN powershell \
         | 
| 65 | 
            +
            	[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
         | 
| 66 | 
            +
            	Invoke-WebRequest -OutFile C:\rubyinstaller-2.6.5-1-x86.exe https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.5-1/rubyinstaller-2.6.5-1-x86.exe
         | 
| 67 | 
            +
            RUN cmd /c "C:\rubyinstaller-2.6.5-1-x86.exe" /silent /dir=c:\ruby26
         | 
| 68 | 
            +
            RUN powershell \
         | 
| 69 | 
            +
            	[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
         | 
| 70 | 
            +
            	Invoke-WebRequest -OutFile C:\rubyinstaller-2.6.5-1-x64.exe https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.5-1/rubyinstaller-2.6.5-1-x64.exe
         | 
| 71 | 
            +
            RUN cmd /c "C:\rubyinstaller-2.6.5-1-x64.exe" /silent /dir=c:\ruby26-x64
         | 
| 72 | 
            +
             | 
| 73 | 
            +
            # Ruby 2.7
         | 
| 74 | 
            +
            RUN powershell \
         | 
| 75 | 
            +
            	[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
         | 
| 76 | 
            +
            	Invoke-WebRequest -OutFile C:\rubyinstaller-2.7.0-1-x86.exe https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.0-1/rubyinstaller-2.7.0-1-x86.exe
         | 
| 77 | 
            +
            RUN cmd /c "C:\rubyinstaller-2.7.0-1-x86.exe" /silent /dir=c:\ruby27
         | 
| 78 | 
            +
            RUN powershell \
         | 
| 79 | 
            +
            	[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
         | 
| 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 | 
            +
            RUN cmd /c "C:\rubyinstaller-2.7.0-1-x64.exe" /silent /dir=c:\ruby27-x64
         | 
| 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 | 
            +
             | 
| 93 | 
            +
            # DevKit
         | 
| 94 | 
            +
            RUN powershell \
         | 
| 95 | 
            +
            	[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
         | 
| 96 | 
            +
            	Invoke-WebRequest -OutFile C:\DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe https://dl.bintray.com/oneclick/rubyinstaller/DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe
         | 
| 97 | 
            +
            RUN cmd /c C:\DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe -o"c:\DevKit" -y
         | 
| 98 | 
            +
            RUN powershell \
         | 
| 99 | 
            +
            	[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
         | 
| 100 | 
            +
            	Invoke-WebRequest -OutFile C:\DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe https://dl.bintray.com/oneclick/rubyinstaller/DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe
         | 
| 101 | 
            +
            RUN cmd /c C:\DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe -o"c:\DevKit64" -y
         | 
| 102 | 
            +
             | 
| 103 | 
            +
            RUN choco install -y git \
         | 
| 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.
         | 
| 107 | 
            +
            RUN refreshenv \
         | 
| 108 | 
            +
                && C:\ruby27\bin\ridk exec pacman -Syu --noconfirm \
         | 
| 109 | 
            +
                && C:\ruby27\bin\ridk install 2 3 \
         | 
| 110 | 
            +
                && C:\ruby27-x64\bin\ridk exec pacman -Syu --noconfirm \
         | 
| 111 | 
            +
                && C:\ruby27-x64\bin\ridk install 2 3
         | 
| 112 | 
            +
             | 
| 113 | 
            +
            ENTRYPOINT ["cmd"]
         | 
    
        data/Dockerfile.trunk
    ADDED
    
    | @@ -0,0 +1,17 @@ | |
| 1 | 
            +
            FROM cosmo0920/win32-api:latest
         | 
| 2 | 
            +
            LABEL maintainer "Hiroshi Hatake <cosmo0920.wp@gmail.com>"
         | 
| 3 | 
            +
            LABEL Description="win32-api building docker image"
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            # Ruby 3.1
         | 
| 6 | 
            +
            RUN powershell \
         | 
| 7 | 
            +
            	[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
         | 
| 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 | 
            +
            RUN powershell \
         | 
| 11 | 
            +
            	[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
         | 
| 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 | 
            +
             | 
| 15 | 
            +
            RUN mkdir C:\pkg
         | 
| 16 | 
            +
            COPY build-gem.bat C:\\build-gem.bat
         | 
| 17 | 
            +
            ENTRYPOINT ["cmd"]
         | 
    
        data/MANIFEST
    CHANGED
    
    
    
        data/{README → README.md}
    RENAMED
    
    | @@ -1,8 +1,10 @@ | |
| 1 | 
            -
             | 
| 1 | 
            +
            # Description
         | 
| 2 2 | 
             
              This is a drop-in replacement for the Win32API library currently part of
         | 
| 3 3 | 
             
              Ruby's standard library.
         | 
| 4 4 |  | 
| 5 | 
            -
             | 
| 5 | 
            +
            # Synopsis
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            ```ruby
         | 
| 6 8 | 
             
              require 'win32/api'
         | 
| 7 9 | 
             
              include Win32
         | 
| 8 10 |  | 
| @@ -35,8 +37,9 @@ | |
| 35 37 | 
             
              addr = GetProcAddress.call(hlib, 'MessageBeep')
         | 
| 36 38 | 
             
              func = Win32::API::Function.new(addr, 'L', 'L')
         | 
| 37 39 | 
             
              func.call(0)
         | 
| 40 | 
            +
            ```
         | 
| 38 41 |  | 
| 39 | 
            -
             | 
| 42 | 
            +
            # Differences between win32-api and Win32API
         | 
| 40 43 | 
             
              * This library has callback support
         | 
| 41 44 | 
             
              * This library supports raw function pointers.
         | 
| 42 45 | 
             
              * This library supports a separate string type for const char* (S).
         | 
| @@ -48,9 +51,9 @@ | |
| 48 51 | 
             
              * Removed the support for lower case prototype and return types. Always
         | 
| 49 52 | 
             
                use capital letters.
         | 
| 50 53 |  | 
| 51 | 
            -
             | 
| 52 | 
            -
               | 
| 53 | 
            -
              motivation at the time the project was originally created | 
| 54 | 
            +
            # Developer's Notes
         | 
| 55 | 
            +
              NOTE: **Some of the information below is now out of date, but explains my
         | 
| 56 | 
            +
              motivation at the time the project was originally created.**
         | 
| 54 57 |  | 
| 55 58 | 
             
              The current Win32API library that ships with the standard library has been
         | 
| 56 59 | 
             
              slated for removal from Ruby 2.0 and it will not receive any updates in the
         | 
| @@ -76,7 +79,7 @@ | |
| 76 79 | 
             
              Most importantly, we can now add, modify and fix any features that we feel
         | 
| 77 80 | 
             
              best benefit our end users.
         | 
| 78 81 |  | 
| 79 | 
            -
             | 
| 82 | 
            +
            # Multiple Binaries
         | 
| 80 83 | 
             
              As of win32-api 1.4.8 a binary gem is shipped that contains binaries for
         | 
| 81 84 | 
             
              both Ruby 1.8, Ruby 1.9, and 2.x. For Ruby 2.x, both 32 and 64 bit binaries
         | 
| 82 85 | 
             
              are included as of release 1.5.0.
         | 
| @@ -84,29 +87,29 @@ | |
| 84 87 | 
             
              The file under lib/win32 dynamically requires the correct binary based on
         | 
| 85 88 | 
             
              your version of Ruby.
         | 
| 86 89 |  | 
| 87 | 
            -
             | 
| 90 | 
            +
            # Documentation
         | 
| 88 91 | 
             
              The source file contains inline RDoc documentation. If you installed
         | 
| 89 92 | 
             
              this file as a gem, then you have the docs. Run "gem server" and point
         | 
| 90 93 | 
             
              your browser at http://localhost:8808 to see them.
         | 
| 91 94 |  | 
| 92 | 
            -
             | 
| 95 | 
            +
            # Warranty
         | 
| 93 96 | 
             
              This package is provided "as is" and without any express or
         | 
| 94 97 | 
             
              implied warranties, including, without limitation, the implied
         | 
| 95 98 | 
             
              warranties of merchantability and fitness for a particular purpose.
         | 
| 96 99 |  | 
| 97 | 
            -
             | 
| 100 | 
            +
            # Known Issues
         | 
| 98 101 | 
             
              Possible callback issues when dealing with multi-threaded applications.
         | 
| 99 102 |  | 
| 100 103 | 
             
              Please submit any bug reports to the project page at
         | 
| 101 104 | 
             
              https://github.com/cosmo0920/win32-api
         | 
| 102 105 |  | 
| 103 | 
            -
             | 
| 106 | 
            +
            ## Contributions
         | 
| 104 107 | 
             
              Although this library is free, please consider having your company
         | 
| 105 108 | 
             
              setup a gittip if used by your company professionally.
         | 
| 106 109 |  | 
| 107 110 | 
             
              http://www.gittip.com/djberg96/
         | 
| 108 111 |  | 
| 109 | 
            -
             | 
| 112 | 
            +
            # Future Plans
         | 
| 110 113 | 
             
              I really don't have future plans for this library since you should use FFI
         | 
| 111 114 | 
             
              as your preferred C interface going forward. All of my own projects have
         | 
| 112 115 | 
             
              since been converted to either use FFI or an analogous OLE interface.
         | 
| @@ -115,15 +118,19 @@ | |
| 115 118 | 
             
              there who are still using it, but I strongly encourage you to convert
         | 
| 116 119 | 
             
              your projects to FFI when possible.
         | 
| 117 120 |  | 
| 118 | 
            -
             | 
| 121 | 
            +
            # Copyright
         | 
| 119 122 | 
             
              (C) 2003-2015 Daniel J. Berger
         | 
| 120 | 
            -
             | 
| 123 | 
            +
             | 
| 124 | 
            +
              (C) 2016-2020 Hiroshi Hatake
         | 
| 125 | 
            +
             | 
| 121 126 | 
             
              All Rights Reserved
         | 
| 122 127 |  | 
| 123 | 
            -
             | 
| 128 | 
            +
            # License
         | 
| 124 129 | 
             
              Artistic 2.0
         | 
| 125 130 |  | 
| 126 | 
            -
             | 
| 131 | 
            +
            # Authors
         | 
| 127 132 | 
             
              Daniel J. Berger
         | 
| 133 | 
            +
             | 
| 128 134 | 
             
              Park Heesob
         | 
| 135 | 
            +
             | 
| 129 136 | 
             
              Hiroshi Hatake
         | 
    
        data/RELEASE.md
    ADDED
    
    | @@ -0,0 +1,41 @@ | |
| 1 | 
            +
            ## Prerequisites
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            * Docker for Windows
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            ### Release step
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            #### Fat GEM
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            Check the latest ruby-head-YYYYmmDD image:
         | 
| 10 | 
            +
            https://hub.docker.com/r/cosmo0920/win32-api/tags?page=1&name=ruby-head
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            ```powershell
         | 
| 13 | 
            +
            PS> mkdir pkg
         | 
| 14 | 
            +
            PS> docker run -it -v $PWD\pkg:C:\pkg cosmo0920/win32-api:ruby-head-AWESOMEDATE
         | 
| 15 | 
            +
            ```
         | 
| 16 | 
            +
             | 
| 17 | 
            +
            Build universal gem:
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            ```cmd
         | 
| 20 | 
            +
            > .\build-gem.bat
         | 
| 21 | 
            +
            ```
         | 
| 22 | 
            +
             | 
| 23 | 
            +
            Copy built universal gem into mounted directory:
         | 
| 24 | 
            +
             | 
| 25 | 
            +
            ```cmd
         | 
| 26 | 
            +
            > copy C:\win32-api\win32-api-*.gem C:\pkg
         | 
| 27 | 
            +
            ```
         | 
| 28 | 
            +
             | 
| 29 | 
            +
            Then, exit and push built gem:
         | 
| 30 | 
            +
             | 
| 31 | 
            +
            ```cmd
         | 
| 32 | 
            +
            > exit
         | 
| 33 | 
            +
            > gem push win32-api-*.gem
         | 
| 34 | 
            +
            ```
         | 
| 35 | 
            +
             | 
| 36 | 
            +
            #### Non Fat GEM
         | 
| 37 | 
            +
             | 
| 38 | 
            +
            ```cmd
         | 
| 39 | 
            +
            > rake gem:create
         | 
| 40 | 
            +
            > gem push win32-api-*.gem
         | 
| 41 | 
            +
            ```
         | 
    
        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 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)
         | 
| @@ -92,10 +92,16 @@ namespace 'gem' do | |
| 92 92 | 
             
                    :ruby23_64 => {:path => "#{pre}/ruby23-x64/bin",  :ri => :ri_64,  :omit => false},
         | 
| 93 93 | 
             
                    :ruby24_32 => {:path => "#{pre}/ruby24/bin",      :ri => :ri2,    :omit => false},
         | 
| 94 94 | 
             
                    :ruby24_64 => {:path => "#{pre}/ruby24-x64/bin",  :ri => :ri2_64, :omit => false},
         | 
| 95 | 
            -
                    :ruby25_32 => {:path => "#{pre}/ruby25/bin",      :ri => :ri2,    :omit =>  | 
| 96 | 
            -
                    :ruby25_64 => {:path => "#{pre}/ruby25-x64/bin",  :ri => :ri2_64, :omit =>  | 
| 97 | 
            -
                    :ruby26_32 => {:path => "#{pre}/ruby26/bin",      :ri => :ri2,    :omit =>  | 
| 98 | 
            -
                    :ruby26_64 => {:path => "#{pre}/ruby26-x64/bin",  :ri => :ri2_64, :omit =>  | 
| 95 | 
            +
                    :ruby25_32 => {:path => "#{pre}/ruby25/bin",      :ri => :ri2,    :omit => false},
         | 
| 96 | 
            +
                    :ruby25_64 => {:path => "#{pre}/ruby25-x64/bin",  :ri => :ri2_64, :omit => false},
         | 
| 97 | 
            +
                    :ruby26_32 => {:path => "#{pre}/ruby26/bin",      :ri => :ri2,    :omit => false},
         | 
| 98 | 
            +
                    :ruby26_64 => {:path => "#{pre}/ruby26-x64/bin",  :ri => :ri2_64, :omit => false},
         | 
| 99 | 
            +
                    :ruby27_32 => {:path => "#{pre}/ruby27/bin",      :ri => :ri2,    :omit => true},
         | 
| 100 | 
            +
                    :ruby27_64 => {:path => "#{pre}/ruby27-x64/bin",  :ri => :ri2_64, :omit => true},
         | 
| 101 | 
            +
                    :ruby30_32 => {:path => "#{pre}/ruby30/bin",      :ri => :ri2,    :omit => true},
         | 
| 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},
         | 
| 99 105 | 
             
                  }
         | 
| 100 106 | 
             
                )
         | 
| 101 107 |  | 
| @@ -185,6 +191,22 @@ begin | |
| 185 191 | 
             
                  end
         | 
| 186 192 | 
             
                end
         | 
| 187 193 |  | 
| 194 | 
            +
                if RbConfig::CONFIG['MINOR'] == '7'
         | 
| 195 | 
            +
                  if RbConfig::CONFIG['arch'] =~ /x64/i
         | 
| 196 | 
            +
                    require File.join(File.dirname(__FILE__), 'ruby27_64/win32/api')
         | 
| 197 | 
            +
                  else
         | 
| 198 | 
            +
                    require File.join(File.dirname(__FILE__), 'ruby27_32/win32/api')
         | 
| 199 | 
            +
                  end
         | 
| 200 | 
            +
                end
         | 
| 201 | 
            +
              when '3'
         | 
| 202 | 
            +
                if RbConfig::CONFIG['MINOR'] == '0'
         | 
| 203 | 
            +
                  if RbConfig::CONFIG['arch'] =~ /x64/i
         | 
| 204 | 
            +
                    require File.join(File.dirname(__FILE__), 'ruby30_64/win32/api')
         | 
| 205 | 
            +
                  else
         | 
| 206 | 
            +
                    require File.join(File.dirname(__FILE__), 'ruby30_32/win32/api')
         | 
| 207 | 
            +
                  end
         | 
| 208 | 
            +
                end
         | 
| 209 | 
            +
             | 
| 188 210 | 
             
              end
         | 
| 189 211 | 
             
            rescue LoadError
         | 
| 190 212 | 
             
              require File.join(File.dirname(__FILE__), '../../ext/api')
         | 
    
        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,21 +28,19 @@ 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
         | 
| 35 | 
            +
                - ruby_version: 26-x64
         | 
| 36 | 
            +
                - ruby_version: 26
         | 
| 29 37 | 
             
                - ruby_version: 25-x64
         | 
| 30 38 | 
             
                - ruby_version: 25
         | 
| 31 39 | 
             
                - ruby_version: 24-x64
         | 
| 32 40 | 
             
                - ruby_version: 24
         | 
| 33 41 | 
             
                - ruby_version: 23-x64
         | 
| 34 42 | 
             
                - ruby_version: 23
         | 
| 35 | 
            -
                - ruby_version: 22-x64
         | 
| 36 | 
            -
                - ruby_version: 22
         | 
| 37 | 
            -
                - ruby_version: 21-x64
         | 
| 38 | 
            -
                - ruby_version: 21
         | 
| 39 | 
            -
                - ruby_version: 200-x64
         | 
| 40 | 
            -
                - ruby_version: 200
         | 
| 41 43 |  | 
| 42 44 | 
             
            matrix:
         | 
| 43 45 | 
             
              allow_failures:
         | 
| 44 46 | 
             
                - ruby_version: _trunk
         | 
| 45 | 
            -
                - ruby_version: 25-x64
         | 
| 46 | 
            -
                - ruby_version: 25
         | 
    
        data/build-gem.bat
    ADDED
    
    
    
        data/ext/win32/api.c
    CHANGED
    
    | @@ -16,28 +16,34 @@ | |
| 16 16 | 
             
            #define RARRAY_LEN(a) (RARRAY(a)->len)
         | 
| 17 17 | 
             
            #endif
         | 
| 18 18 |  | 
| 19 | 
            -
             | 
| 20 | 
            -
            #  | 
| 21 | 
            -
            #  | 
| 22 | 
            -
            # | 
| 23 | 
            -
            # | 
| 24 | 
            -
            #  | 
| 19 | 
            +
            /* Use Ruby defined macro definitions. */
         | 
| 20 | 
            +
            #if !defined(NUM2SIZET) && !defined(NUM2SSIZET)
         | 
| 21 | 
            +
            # if defined(HAVE_LONG_LONG) && SIZEOF_SIZE_T > SIZEOF_LONG
         | 
| 22 | 
            +
            #  define NUM2SIZET(x) ((size_t)NUM2ULL(x))
         | 
| 23 | 
            +
            #  define NUM2SSIZET(x) ((ssize_t)NUM2LL(x))
         | 
| 24 | 
            +
            # else
         | 
| 25 | 
            +
            #  define NUM2SIZET(x) NUM2ULONG(x)
         | 
| 26 | 
            +
            #  define NUM2SSIZET(x) NUM2LONG(x)
         | 
| 27 | 
            +
            # endif
         | 
| 25 28 | 
             
            #endif
         | 
| 26 29 |  | 
| 27 | 
            -
             | 
| 28 | 
            -
            #  | 
| 29 | 
            -
            #  | 
| 30 | 
            -
            # | 
| 31 | 
            -
            # | 
| 32 | 
            -
            #  | 
| 33 | 
            -
            # | 
| 34 | 
            -
            # | 
| 35 | 
            -
            #  | 
| 30 | 
            +
            /* Use Ruby defined macro definitions. */
         | 
| 31 | 
            +
            #if !defined(SIZET2NUM) && !defined(SSIZET2NUM)
         | 
| 32 | 
            +
            # if SIZEOF_SIZE_T > SIZEOF_LONG && defined(HAVE_LONG_LONG)
         | 
| 33 | 
            +
            #  define SIZET2NUM(v) ULL2NUM(v)
         | 
| 34 | 
            +
            #  define SSIZET2NUM(v) LL2NUM(v)
         | 
| 35 | 
            +
            # elif SIZEOF_SIZE_T == SIZEOF_LONG
         | 
| 36 | 
            +
            #  define SIZET2NUM(v) ULONG2NUM(v)
         | 
| 37 | 
            +
            #  define SSIZET2NUM(v) LONG2NUM(v)
         | 
| 38 | 
            +
            # else
         | 
| 39 | 
            +
            #  define SIZET2NUM(v) UINT2NUM(v)
         | 
| 40 | 
            +
            #  define SSIZET2NUM(v) INT2NUM(v)
         | 
| 41 | 
            +
            # endif
         | 
| 36 42 | 
             
            #endif
         | 
| 37 43 |  | 
| 38 44 |  | 
| 39 45 | 
             
            #define MAX_BUF 1024
         | 
| 40 | 
            -
            #define WINDOWS_API_VERSION "1. | 
| 46 | 
            +
            #define WINDOWS_API_VERSION "1.10.0"
         | 
| 41 47 |  | 
| 42 48 | 
             
            #define _T_VOID     0
         | 
| 43 49 | 
             
            #define _T_LONG     1
         | 
| @@ -56,6 +62,35 @@ typedef struct { | |
| 56 62 | 
             
                int prototype[20];
         | 
| 57 63 | 
             
            } Win32API;
         | 
| 58 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 | 
            +
             | 
| 59 94 | 
             
            static void api_free(Win32API* ptr){
         | 
| 60 95 | 
             
               if(ptr->library)
         | 
| 61 96 | 
             
                  FreeLibrary(ptr->library);
         | 
| @@ -288,8 +323,10 @@ static VALUE api_init(int argc, VALUE* argv, VALUE self) | |
| 288 323 | 
             
               if(NIL_P(v_return))
         | 
| 289 324 | 
             
                  v_return = rb_str_new2("L");
         | 
| 290 325 |  | 
| 326 | 
            +
            #if defined TAINTING_SUPPORT
         | 
| 291 327 | 
             
               SafeStringValue(v_dll);
         | 
| 292 328 | 
             
               SafeStringValue(v_proc);
         | 
| 329 | 
            +
            #endif
         | 
| 293 330 |  | 
| 294 331 | 
             
               hLibrary = LoadLibrary(TEXT(RSTRING_PTR(v_dll)));
         | 
| 295 332 |  | 
| @@ -356,7 +393,9 @@ static VALUE api_init(int argc, VALUE* argv, VALUE self) | |
| 356 393 | 
             
               // Push the numeric prototypes onto our int array for later use.
         | 
| 357 394 |  | 
| 358 395 | 
             
               for(i = 0; i < RARRAY_LEN(v_proto); i++){
         | 
| 396 | 
            +
            #if defined TAINTING_SUPPORT
         | 
| 359 397 | 
             
                  SafeStringValue(RARRAY_PTR(v_proto)[i]);
         | 
| 398 | 
            +
            #endif
         | 
| 360 399 | 
             
                  switch(*(TCHAR*)StringValuePtr(RARRAY_PTR(v_proto)[i])){
         | 
| 361 400 | 
             
                     case 'L':
         | 
| 362 401 | 
             
                        ptr->prototype[i] = _T_LONG;
         | 
| @@ -391,7 +430,9 @@ static VALUE api_init(int argc, VALUE* argv, VALUE self) | |
| 391 430 | 
             
                  ptr->return_type = _T_VOID;
         | 
| 392 431 | 
             
               }
         | 
| 393 432 | 
             
               else{
         | 
| 433 | 
            +
            #if defined TAINTING_SUPPORT
         | 
| 394 434 | 
             
                  SafeStringValue(v_return);
         | 
| 435 | 
            +
            #endif
         | 
| 395 436 | 
             
                  switch(*RSTRING_PTR(v_return)){
         | 
| 396 437 | 
             
                     case 'L':
         | 
| 397 438 | 
             
                        ptr->return_type = _T_LONG;
         | 
| @@ -482,7 +523,9 @@ static VALUE func_init(int argc, VALUE* argv, VALUE self){ | |
| 482 523 | 
             
               // Push the numeric prototypes onto our int array for later use.
         | 
| 483 524 |  | 
| 484 525 | 
             
               for(i = 0; i < RARRAY_LEN(v_proto); i++){
         | 
| 526 | 
            +
            #if defined TAINTING_SUPPORT
         | 
| 485 527 | 
             
                  SafeStringValue(RARRAY_PTR(v_proto)[i]);
         | 
| 528 | 
            +
            #endif
         | 
| 486 529 | 
             
                  switch(*(char*)StringValuePtr(RARRAY_PTR(v_proto)[i])){
         | 
| 487 530 | 
             
                     case 'L':
         | 
| 488 531 | 
             
                        ptr->prototype[i] = _T_LONG;
         | 
| @@ -517,7 +560,9 @@ static VALUE func_init(int argc, VALUE* argv, VALUE self){ | |
| 517 560 | 
             
                  ptr->return_type = _T_VOID;
         | 
| 518 561 | 
             
               }
         | 
| 519 562 | 
             
               else{
         | 
| 563 | 
            +
            #if defined TAINTING_SUPPORT
         | 
| 520 564 | 
             
                  SafeStringValue(v_return);
         | 
| 565 | 
            +
            #endif
         | 
| 521 566 | 
             
                  switch(*RSTRING_PTR(v_return)){
         | 
| 522 567 | 
             
                     case 'L':
         | 
| 523 568 | 
             
                        ptr->return_type = _T_LONG;
         | 
| @@ -765,6 +810,7 @@ static VALUE api_call(int argc, VALUE* argv, VALUE self){ | |
| 765 810 | 
             
               uintptr_t return_value;
         | 
| 766 811 | 
             
               int i = 0;
         | 
| 767 812 | 
             
               int len;
         | 
| 813 | 
            +
               ThreadData* thread_data = thread_data_get();
         | 
| 768 814 |  | 
| 769 815 | 
             
               struct{
         | 
| 770 816 | 
             
                  uintptr_t params[20];
         | 
| @@ -959,6 +1005,8 @@ static VALUE api_call(int argc, VALUE* argv, VALUE self){ | |
| 959 1005 | 
             
                    }
         | 
| 960 1006 | 
             
               }
         | 
| 961 1007 |  | 
| 1008 | 
            +
               thread_data->win32api_error = GetLastError();
         | 
| 1009 | 
            +
             | 
| 962 1010 | 
             
               /* Return the appropriate type based on the return type specified
         | 
| 963 1011 | 
             
                * in the constructor.
         | 
| 964 1012 | 
             
                */
         | 
| @@ -1013,6 +1061,21 @@ static VALUE api_call(int argc, VALUE* argv, VALUE self){ | |
| 1013 1061 | 
             
               return v_return;
         | 
| 1014 1062 | 
             
            }
         | 
| 1015 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 | 
            +
             | 
| 1016 1079 | 
             
            /*
         | 
| 1017 1080 | 
             
             * Wraps the Windows API functions in a Ruby interface.
         | 
| 1018 1081 | 
             
             */
         | 
| @@ -1045,6 +1108,9 @@ void Init_api(){ | |
| 1045 1108 | 
             
               /* Miscellaneous */
         | 
| 1046 1109 | 
             
               rb_define_alloc_func(cAPI, api_allocate);
         | 
| 1047 1110 |  | 
| 1111 | 
            +
               /* GetLastError alternative */
         | 
| 1112 | 
            +
               rb_define_singleton_method(cAPI, "last_error", get_last_error, 0);
         | 
| 1113 | 
            +
             | 
| 1048 1114 | 
             
               /* Win32::API Instance Methods */
         | 
| 1049 1115 | 
             
               rb_define_method(cAPI, "initialize", api_init, -1);
         | 
| 1050 1116 | 
             
               rb_define_method(cAPI, "call", api_call, -1);
         | 
    
        data/lib/win32/api.rb
    CHANGED
    
    | @@ -58,6 +58,22 @@ begin | |
| 58 58 | 
             
                  end
         | 
| 59 59 | 
             
                end
         | 
| 60 60 |  | 
| 61 | 
            +
                if RbConfig::CONFIG['MINOR'] == '7'
         | 
| 62 | 
            +
                  if RbConfig::CONFIG['arch'] =~ /x64/i
         | 
| 63 | 
            +
                    require File.join(File.dirname(__FILE__), 'ruby27_64/win32/api')
         | 
| 64 | 
            +
                  else
         | 
| 65 | 
            +
                    require File.join(File.dirname(__FILE__), 'ruby27_32/win32/api')
         | 
| 66 | 
            +
                  end
         | 
| 67 | 
            +
                end
         | 
| 68 | 
            +
              when '3'
         | 
| 69 | 
            +
                if RbConfig::CONFIG['MINOR'] == '0'
         | 
| 70 | 
            +
                  if RbConfig::CONFIG['arch'] =~ /x64/i
         | 
| 71 | 
            +
                    require File.join(File.dirname(__FILE__), 'ruby30_64/win32/api')
         | 
| 72 | 
            +
                  else
         | 
| 73 | 
            +
                    require File.join(File.dirname(__FILE__), 'ruby30_32/win32/api')
         | 
| 74 | 
            +
                  end
         | 
| 75 | 
            +
                end
         | 
| 76 | 
            +
             | 
| 61 77 | 
             
              end
         | 
| 62 78 | 
             
            rescue LoadError
         | 
| 63 79 | 
             
              require File.join(File.dirname(__FILE__), '../../ext/api')
         | 
| Binary file | 
| Binary file | 
| Binary file | 
| Binary file | 
| Binary file | 
| Binary file | 
| Binary file | 
| Binary file | 
| Binary file | 
| Binary file | 
| Binary file | 
| Binary file | 
| Binary file | 
| Binary file | 
| Binary file | 
| Binary file | 
| Binary file | 
| Binary file | 
| Binary file | 
| 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,18 +2,18 @@ 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'
         | 
| 9 | 
            -
              spec.homepage   = 'http://github.com/ | 
| 9 | 
            +
              spec.homepage   = 'http://github.com/cosmo0920/win32-api'
         | 
| 10 10 | 
             
              spec.summary    = 'A superior replacement for Win32API'
         | 
| 11 11 | 
             
              spec.test_files = Dir['test/test*']
         | 
| 12 12 | 
             
              spec.extensions = ['ext/extconf.rb']
         | 
| 13 13 | 
             
              spec.files      = Dir['**/*'].reject{ |f| f.include?('git') }
         | 
| 14 14 |  | 
| 15 15 | 
             
              spec.required_ruby_version = '>= 1.8.2'
         | 
| 16 | 
            -
              spec.extra_rdoc_files = [' | 
| 16 | 
            +
              spec.extra_rdoc_files = ['CHANGES', 'MANIFEST', 'ext/win32/api.c']
         | 
| 17 17 |  | 
| 18 18 | 
             
              spec.add_development_dependency('test-unit', '>= 2.5.0')
         | 
| 19 19 | 
             
              spec.add_development_dependency('rake')
         | 
    
        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: universal-mingw32
         | 
| 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
         | 
| @@ -49,18 +49,20 @@ email: djberg96@gmail.com | |
| 49 49 | 
             
            executables: []
         | 
| 50 50 | 
             
            extensions: []
         | 
| 51 51 | 
             
            extra_rdoc_files:
         | 
| 52 | 
            -
            - README
         | 
| 53 52 | 
             
            - CHANGES
         | 
| 54 53 | 
             
            - MANIFEST
         | 
| 55 54 | 
             
            - ext/win32/api.c
         | 
| 56 55 | 
             
            files:
         | 
| 57 56 | 
             
            - CHANGES
         | 
| 57 | 
            +
            - Dockerfile
         | 
| 58 | 
            +
            - Dockerfile.trunk
         | 
| 58 59 | 
             
            - Gemfile
         | 
| 59 | 
            -
            - Gemfile.lock
         | 
| 60 60 | 
             
            - MANIFEST
         | 
| 61 | 
            -
            - README
         | 
| 61 | 
            +
            - README.md
         | 
| 62 | 
            +
            - RELEASE.md
         | 
| 62 63 | 
             
            - Rakefile
         | 
| 63 64 | 
             
            - appveyor.yml
         | 
| 65 | 
            +
            - build-gem.bat
         | 
| 64 66 | 
             
            - ext/win32/api.c
         | 
| 65 67 | 
             
            - lib/win32/api.rb
         | 
| 66 68 | 
             
            - lib/win32/ruby21_32/win32/api.so
         | 
| @@ -75,17 +77,23 @@ files: | |
| 75 77 | 
             
            - lib/win32/ruby25_64/win32/api.so
         | 
| 76 78 | 
             
            - lib/win32/ruby26_32/win32/api.so
         | 
| 77 79 | 
             
            - lib/win32/ruby26_64/win32/api.so
         | 
| 80 | 
            +
            - lib/win32/ruby27_32/win32/api.so
         | 
| 81 | 
            +
            - lib/win32/ruby27_64/win32/api.so
         | 
| 78 82 | 
             
            - lib/win32/ruby2_32/win32/api.so
         | 
| 79 83 | 
             
            - lib/win32/ruby2_64/win32/api.so
         | 
| 84 | 
            +
            - lib/win32/ruby30_32/win32/api.so
         | 
| 85 | 
            +
            - lib/win32/ruby30_64/win32/api.so
         | 
| 86 | 
            +
            - lib/win32/ruby31_32/win32/api.so
         | 
| 87 | 
            +
            - lib/win32/ruby31_64/win32/api.so
         | 
| 80 88 | 
             
            - test/test_win32_api.rb
         | 
| 81 89 | 
             
            - test/test_win32_api_callback.rb
         | 
| 82 90 | 
             
            - test/test_win32_api_function.rb
         | 
| 83 91 | 
             
            - win32-api.gemspec
         | 
| 84 | 
            -
            homepage: http://github.com/ | 
| 92 | 
            +
            homepage: http://github.com/cosmo0920/win32-api
         | 
| 85 93 | 
             
            licenses:
         | 
| 86 94 | 
             
            - Artistic-2.0
         | 
| 87 95 | 
             
            metadata: {}
         | 
| 88 | 
            -
            post_install_message: | 
| 96 | 
            +
            post_install_message:
         | 
| 89 97 | 
             
            rdoc_options: []
         | 
| 90 98 | 
             
            require_paths:
         | 
| 91 99 | 
             
            - lib
         | 
| @@ -100,9 +108,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 100 108 | 
             
                - !ruby/object:Gem::Version
         | 
| 101 109 | 
             
                  version: '0'
         | 
| 102 110 | 
             
            requirements: []
         | 
| 103 | 
            -
             | 
| 104 | 
            -
             | 
| 105 | 
            -
            signing_key: 
         | 
| 111 | 
            +
            rubygems_version: 3.3.0.dev
         | 
| 112 | 
            +
            signing_key:
         | 
| 106 113 | 
             
            specification_version: 4
         | 
| 107 114 | 
             
            summary: A superior replacement for Win32API
         | 
| 108 115 | 
             
            test_files:
         | 
    
        data/Gemfile.lock
    DELETED
    
    | @@ -1,24 +0,0 @@ | |
| 1 | 
            -
            PATH
         | 
| 2 | 
            -
              remote: .
         | 
| 3 | 
            -
              specs:
         | 
| 4 | 
            -
                win32-api (1.7.0)
         | 
| 5 | 
            -
             | 
| 6 | 
            -
            GEM
         | 
| 7 | 
            -
              remote: https://rubygems.org/
         | 
| 8 | 
            -
              specs:
         | 
| 9 | 
            -
                power_assert (1.0.2)
         | 
| 10 | 
            -
                rake (12.0.0)
         | 
| 11 | 
            -
                test-unit (3.2.5)
         | 
| 12 | 
            -
                  power_assert
         | 
| 13 | 
            -
             | 
| 14 | 
            -
            PLATFORMS
         | 
| 15 | 
            -
              x64-mingw32
         | 
| 16 | 
            -
              x86-mingw32
         | 
| 17 | 
            -
             | 
| 18 | 
            -
            DEPENDENCIES
         | 
| 19 | 
            -
              rake
         | 
| 20 | 
            -
              test-unit (>= 2.5.0)
         | 
| 21 | 
            -
              win32-api!
         | 
| 22 | 
            -
             | 
| 23 | 
            -
            BUNDLED WITH
         | 
| 24 | 
            -
               1.15.4
         |