[#115884] Windows Ruby 3.2.2: Non-English character added to Windows Registry String Value — Jay Mav via ruby-core <ruby-core@...>
Hello,
3 messages
2023/12/24
[ruby-core:115886] Re: Windows Ruby 3.2.2: Non-English character added to Windows Registry String Value
From:
Jay Mav via ruby-core <ruby-core@...>
Date:
2023-12-25 05:07:12 UTC
List:
ruby-core #115886
Hello,
This issue is resolved, if a change is made in
RUBYDIR\lib\ruby\3.2.0\win32\registry.rb to set termize=3D0 for type REG_SZ=
,
REG_EXPAND_SZ
def write(name, type, data)
termsize =3D 0
case type
when REG_SZ, REG_EXPAND_SZ
data =3D data.encode(WCHAR)
# Adding WCHAR_SIZE to data size causes garbage concatenated to
data in the Windows Registry:
#termsize =3D WCHAR_SIZE
...
API.SetValue(@hkey, name, type, data, data.bytesize + termsize)
The string data in the Windows Registry does not have junk added after
making this code change.
Is this fix correct?
Can the owner of registry.rb please respond?
Thanks.
On Sat, Dec 23, 2023 at 5:31=E2=80=AFPM Jay Mav <mjay80147@gmail.com> wrote=
:
> Hello,
> Compiled Ruby 3.2.2 on Windows with MSVC 2019 - Microsoft (R) C/C++
> Optimizing Compiler Version 19.29.30147 for x64.
>
> Code:
> require 'win32/registry'
> win_oracle_key =3D "SOFTWARE\\ORACLE"
> reg=3DWin32::Registry::HKEY_LOCAL_MACHINE.open(win_oracle_key,
> Win32::Registry::KEY_ALL_ACCESS)
> inst_loc_key =3D "inst_loc"
> inv_dir=3D"C:\\Program Files\\Tester\\Inventory"
> reg[inst_loc_key] =3D inv_dir
>
> ....
>
> Registry contains: C:\Program Files\Tester\Inventory=E6=B4=80
> (Not sure what that character represents.)
>
> Can the Ruby Dev Team please let me know how to resolve this issue so tha=
t
> this character does not get added to the string?
>
> Thanks in advance.
>
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/