Created
May 18, 2015 16:03
-
-
Save aharpervc/e2675cc13ef000d8c791 to your computer and use it in GitHub Desktop.
Revisions
-
aharpervc revised this gist
May 18, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ - dlload "advapi32" - extern "int CryptAcquireContext(void*, void*, void*, unsigned long, unsigned long)" - extern "int CryptGenRandom(void*, unsigned long, void*)" + + begin + dlload "advapi32" + extern "int CryptAcquireContext(void*, void*, void*, unsigned long, unsigned long)" -
aharpervc created this gist
May 18, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,38 @@ --- /home/vagrant/.rake-compiler/sources/ruby-2.2.1/lib/securerandom.rb.original 2015-05-18 08:49:56.007018200 -0700 +++ /home/vagrant/.rake-compiler/sources/ruby-2.2.1/lib/securerandom.rb 2015-05-18 08:58:42.187018200 -0700 @@ -45,9 +45,14 @@ module AdvApi32 # :nodoc: extend Fiddle::Importer - dlload "advapi32" - extern "int CryptAcquireContext(void*, void*, void*, unsigned long, unsigned long)" - extern "int CryptGenRandom(void*, unsigned long, void*)" + + begin + dlload "advapi32" + extern "int CryptAcquireContext(void*, void*, void*, unsigned long, unsigned long)" + extern "int CryptGenRandom(void*, unsigned long, void*)" + rescue Fiddle::DLError => e + STDERR.puts "(Ignore this error if cross compiling) #{e}" + end def self.get_provider hProvStr = " " * Fiddle::SIZEOF_VOIDP @@ -74,9 +79,14 @@ module Kernel32 # :nodoc: extend Fiddle::Importer - dlload "kernel32" - extern "unsigned long GetLastError()" - extern "unsigned long FormatMessageA(unsigned long, void*, unsigned long, unsigned long, void*, unsigned long, void*)" + + begin + dlload "kernel32" + extern "unsigned long GetLastError()" + extern "unsigned long FormatMessageA(unsigned long, void*, unsigned long, unsigned long, void*, unsigned long, void*)" + rescue Fiddle::DLError => e + STDERR.puts "(Ignore this error if cross compiling) #{e}" + end # Following code is based on David Garamond's GUID library for Ruby. def self.last_error_message