Commit graph

79 commits

Author SHA1 Message Date
Jeremy Drake
c9346a166c [ruby/resolv] win32/resolv: add headers to GetNetworkParams check.
On 32-bit Cygwin at least, it was failing to find that function,
presumably due to it being stdcall.

Signed-off-by: Jeremy Drake <github@jdrake.com>

bceafef74b
2025-08-13 22:13:53 +00:00
Tim Smith
6736641372 [ruby/win32-registry] Minor readme improvements and typo fixes
- Put shell commands in code blocks so they can easily be copied from
  the GitHub UI directly
- Fix a few typos
- Fix a dead link to MSDN

Signed-off-by: Tim Smith <tsmith84@gmail.com>

61a4672df7
2025-06-17 05:52:04 +00:00
YO4
0db1f47ad0 [ruby/resolv] quote registry value name properly
'NV Domain' needs to be quoted.

332a16dcc0
2025-04-17 23:48:55 +00:00
Hiroshi SHIBATA
4b5bcba2e2 Integrate read_s and read_s_expand with get_item_property for Win32::Registry 2025-02-05 07:36:59 +09:00
Hiroshi SHIBATA
333bc26d82 Added get_item_property and use it for Win32::Registry and Get-ItemProperty 2025-02-05 07:36:59 +09:00
Hiroshi SHIBATA
a487698cc7 Use powershell for retrieving value from registry if fiddle is not available 2025-02-05 07:36:59 +09:00
Hiroshi SHIBATA
078e723b24 Don't use nested registry open for rewriting powershell version 2025-02-05 07:36:59 +09:00
Hiroshi SHIBATA
02a9c05e3e Handle failing case to load win32/registry 2025-02-05 07:36:59 +09:00
Nobuyoshi Nakada
8f77e694f9 [ruby/resolv] w32error_raise never returns
d00e86f7e4
2025-01-30 05:18:31 +00:00
Nobuyoshi Nakada
af9a904f38 [ruby/resolv] Build the extension library only when CRuby (Fix
https://github.com/ruby/resolv/pull/69)

On JRuby no C compiler is available and this call results in a runtime
error.

33105bc504
2024-12-10 09:29:38 +00:00
Hiroshi SHIBATA
7772fe05bc [ruby/win32-registry] Bump up v0.1.0
a87076ee42
2024-11-08 05:18:39 +00:00
Nobuyoshi Nakada
72b8fa9e03 [ruby/win32-registry] Exclude rake files from packages [ci skip]
e7b2eeb885
2024-10-17 03:09:32 +00:00
Nobuyoshi Nakada
34d800ebcd [ruby/win32-registry] Exclude mailmap from packages [ci skip]
521f93af9e
2024-10-17 02:12:18 +00:00
Lars Kanis
85ce3b177c [ruby/win32-registry] Fix compatibility with JRuby
JRuby's fiddle implementation has quite some shortcomings compared with the CRuby impl.
Add JRuby tests in CI.

7f34184c2e
2024-10-17 01:51:41 +00:00
Hiroshi SHIBATA
4eda289a13 Sync from ruby/win32-registry 2024-10-09 13:55:45 +09:00
Hiroshi SHIBATA
02d4703eed Extract ext/win32/lib/win32/sspi.rb to ruby/win32-sspi 2024-10-08 17:11:44 +09:00
Nobuyoshi Nakada
f5d9d9b5f8
win32/sspi: Use start_with? to see prefix 2024-09-29 21:00:26 +09:00
Nobuyoshi Nakada
25eb9bded8
win32/sspi: Rafactor pack/unpack 2024-09-29 21:00:26 +09:00
Nobuyoshi Nakada
30230ed9e6
win32/sspi: For Ractor use a constant instead of a class variable 2024-09-29 21:00:26 +09:00
Nobuyoshi Nakada
fc2f196cb8
win32/sspi: Fix missing A suffix in an API constant name 2024-09-29 21:00:26 +09:00
Nobuyoshi Nakada
b7bca0ebdc
win32/sspi: Fix Win32::SSPI::SSPIResult#== with Integer
The values of `@@map` are `Symbol`s and `@value` should be an
`Integer` since unpacked as unsigned long, so this comparison should
be false always.  Probably comparison with `Symbol` was intended.
2024-09-29 21:00:26 +09:00
Nobuyoshi Nakada
1179c86384
win32/sspi: Already Fixnum has been removed years ago 2024-09-29 21:00:25 +09:00
Josh Cooper
0d16c36d0a [win32/registry] Fallback to UTF-8 for unknown codepages
There are some codepages like cp708 for which no ruby encoding exists:

    $ ruby -e "Encoding.find('cp708')"
    Traceback (most recent call last):
    	1: from -e:1:in `<main>'
    -e:1:in `find': unknown encoding name - cp708 (ArgumentError)

win32/registry uses ENCODING to transcode error messages and expand environment
variables from UTF-16LE, so using UTF-8 seems like the best choice and is better
than a hard failure.

This should resolve [Bug #13831]
2024-09-25 10:43:31 +09:00
Nobuyoshi Nakada
f622548800 [ruby/resolv] Add spec extensions
3189d16b69
2024-09-10 08:33:32 +00:00
Nobuyoshi Nakada
7662e6fcd5
win32/registry: Shorten with safe navigation operator 2024-05-03 14:49:29 +09:00
Nobuyoshi Nakada
491c38bfcd
win32/registry: Make frozen_string_literal true 2024-05-03 14:49:29 +09:00
Nobuyoshi Nakada
0b091e6675
win32/registry: Refine pack/unpack
* Use 'J' for HANDLE.
* Use 'Q' for QWORD.
* Define template constants.
* Supply zero bytes in `unpackqw` as well as `unpackdw`.
* Use `String#unpack1`.
2024-05-03 14:49:29 +09:00
Sam Aaron
67b79d484f
Enable Ruby to run on Windows with frozen string literals 2024-04-26 15:10:42 +00:00
KJ Tsanaktsidis
051a874325 Fix memory overread in registry.rb
The terminator is not actually getting filled in; we're simply passing
(two) bytes of empty memory as the NUL terminator. This can lead to
garbage characters getting written to registry values.

Fix this by explicitly putting a WCHAR_NUL character into the string to
be sent to the registry API, like we do in the MULTI_SZ case.

[Bug #20096]
2023-12-28 18:03:58 +11:00
Takashi Kokubun
5b21e94beb Expand tabs [ci skip]
[Misc #18891]
2022-07-21 09:42:04 -07:00
Ryuta Kamizono
33f2ff3bab Fix some typos by spell checker 2021-04-26 10:07:41 +09:00
Marcus Stollsteimer
3108ad7bf3 [DOC] Fix grammar: "is same as" -> "is the same as" 2021-01-05 15:13:53 +01:00
Hiroshi SHIBATA
dd07354f27 Use Fiddle::Importer directly 2020-11-11 09:27:36 +09:00
Hiroshi SHIBATA
5081bd9675 Removed win32/resolv.rb for 32bit env 2020-11-11 09:27:36 +09:00
Hiroshi SHIBATA
ff67aac193 Removed win32api 2020-11-11 09:27:36 +09:00
NAKAMURA Usaku
9728cb730f
Use fiddle (win32/importer) instead of Win32API
- ext/win32/lib/win32/sspi.rb: Use fiddle (win32/importer) instead of Win32API
2020-11-10 14:45:15 +09:00
Nobuyoshi Nakada
715955ff27
Include ruby/assert.h in ruby/ruby.h so that assertions can be there 2019-07-14 17:58:03 +09:00
Nobuyoshi Nakada
dcb8c41a1e
Added depend files 2019-07-14 01:31:29 +09:00
Nobuyoshi Nakada
2bc09665ab
win32/registry.rb: fix potential infinite loop
* ext/win32/lib/win32/registry.rb (Win32::Registry#each_value):
  advance the index even if an error occurred in #read.
2019-06-07 02:00:48 +09:00
nobu
3be4550558 Win32API.rb: use uplevel option to warn
Also warns always regardless $VERBOSE.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63063 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-02 12:39:01 +00:00
nobu
1c98a41ae3 win32/resolv.rb: call rb_w32_osid
* ext/win32/lib/win32/resolv.rb: call rb_w32_osid instead of
  direct GetVersionExA API.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61895 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-18 01:10:22 +00:00
hsbt
6693e3e723 Fixed misspelling words.
These are detected by https://github.com/client9/misspell

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-22 11:27:06 +00:00
usa
f03f4c4216 Treat REG_NONE just like REG_BINARY
* ext/win32/lib/win32/registry.rb (read, write): treat REG_NONE just like
  REG_BINARY when reading and writing.
  cf. [Bug #7526]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60257 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 12:12:52 +00:00
nobu
aded420d32 resolv9x.rb: fix typo
* ext/win32/lib/win32/resolv9x.rb (WsControl): fix missing close
  parenthesis at r22724.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57629 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-14 12:34:11 +00:00
nobu
70db4f6ecd win32/registry.rb: registry type names
* ext/win32/lib/win32/registry.rb (Win32::Registry#read): show
  registry type names instead of numeric values.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57266 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-04 11:06:16 +00:00
nobu
3047144ac2 win32/resolv.rb: ad hoc workaround
* ext/win32/lib/win32/resolv.rb (Win32::Resolv::SZ): an ad hoc
  workaround for broken registry.  SearchList and other registry
  values must be REG_SZ, or Windows ignores anything in those
  values otherwise.  [ruby-dev:49924] [Bug #13081]
  https://github.com/rubygems/rubygems/issues/1700

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57265 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-04 08:21:14 +00:00
nobu
5bb84ec7d8 extmk.rb: removed compiled? method [ci skip]
* ext/extmk.rb (compiled?): removed.

* ext/win32/extconf.rb: try to install libraries regardless
  fiddle.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-18 04:34:26 +00:00
nobu
27863a0ccd win32/resolv: fix for cygwin
* ext/win32/resolv/resolv.c: needs windows.h for iphlpapi.h on
  cygwin.  [ruby-core:76791] [Bug #12663]

* ext/win32/resolv/resolv.c (w32error_make_error): use
  Win32::Resolv::Error, an alias of Win32::Registry::Error.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-10 11:11:36 +00:00
nobu
833ad92d18 win32/resolv: fix for cygwin
* ext/win32/resolv/resolv.c: needs windows.h for iphlpapi.h on
  cygwin.  [ruby-core:76791] [Bug #12663]
* ext/win32/resolv/resolv.c (w32error_make_error): use
  Win32::Resolv::Error, an alias of Win32::Registry::Error.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-10 06:35:05 +00:00
nobu
647d2bc301 resolv.c: fix commit miss
* ext/win32/resolv/resolv.c (Init_resolv): remove dead code.
  [Bug #12604]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-31 07:24:45 +00:00