win32-registry 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 300922f392fc25dc6072a6defedf385b9757a05900b595e82966297d6be615a0
4
- data.tar.gz: 7409a8e0bb983c5af10e3513703e62166f4cbf237b2203d1b5a2c7d1efe6800f
3
+ metadata.gz: 44e39c00b1357fb4ad7ca2643d0e37afdc639ffc2f25593b5d3559f45ad8d71d
4
+ data.tar.gz: 883c6117d6ffb389500110875c9ee401ef2a51c056619140ed51acdcc2c97243
5
5
  SHA512:
6
- metadata.gz: 876fa2b8d41cb9d9d12ba0f436ac422a9d8addd948b561d8d0835a22d819a2e2197cfccf1b720a3c573ae81e31488fd519eef9d57dad74852e24314599c8a387
7
- data.tar.gz: 68a207b64b243d513ef4e1c3474fe98f14628dad41574cbc77c739fff1806410cf1835194a3af601fb1ff675ca8eb2ee74b99194466cf6d1d32193392aea2d88
6
+ metadata.gz: 5588f4e9a212c0eb6a33a97e5ce3c9a9acb56affadd3d3d27e006b153afeb6d8b7c1190989eae371706d9237f45c27b142c269109d6fb042e8bd425fc85eab14
7
+ data.tar.gz: 0d2219bc22c02867e133a075351d59f039d96fd5a7b57e380dffdfafde9995de1c5ff0aca75675797b66b3f22ac69249d214ff3a68c53810d0ca89e4a856735a
@@ -178,7 +178,7 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
178
178
  buff = WCHAR_NUL * 1024
179
179
  lang = 0
180
180
  begin
181
- len = FormatMessageW.call(0x1200, 0, code, lang, buff, 1024, 0)
181
+ len = FormatMessageW.call(0x1200, nil, code, lang, buff, 1024, nil)
182
182
  msg = buff.byteslice(0, len * WCHAR_SIZE)
183
183
  msg.delete!(WCHAR_CR)
184
184
  msg.chomp!
@@ -198,7 +198,7 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
198
198
  #
199
199
  class PredefinedKey < Registry
200
200
  def initialize(hkey, keyname)
201
- @hkey = hkey
201
+ @hkey = Fiddle::Pointer.new(hkey)
202
202
  @parent = nil
203
203
  @keyname = keyname
204
204
  @disposition = REG_OPENED_EXISTING_KEY
@@ -238,7 +238,7 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
238
238
  "long RegDeleteKeyW(void *, void *)",
239
239
  "long RegFlushKey(void *)",
240
240
  "long RegCloseKey(void *)",
241
- "long RegQueryInfoKey(void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *)",
241
+ "long RegQueryInfoKeyW(void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *)",
242
242
  ].each do |fn|
243
243
  cfunc = extern fn, :stdcall
244
244
  const_set cfunc.name.intern, cfunc
@@ -285,7 +285,7 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
285
285
  end
286
286
 
287
287
  def make_wstr(str)
288
- str.encode(WCHAR)
288
+ (str+"\0").encode(WCHAR)
289
289
  end
290
290
 
291
291
  def OpenKey(hkey, name, opt, desired)
@@ -298,14 +298,14 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
298
298
  result = packhandle(0)
299
299
  disp = packdw(0)
300
300
  check RegCreateKeyExW.call(hkey, make_wstr(name), 0, 0, opt, desired,
301
- 0, result, disp)
301
+ nil, result, disp)
302
302
  [ unpackhandle(result), unpackdw(disp) ]
303
303
  end
304
304
 
305
305
  def EnumValue(hkey, index)
306
306
  name = WCHAR_NUL * Constants::MAX_KEY_LENGTH
307
307
  size = packdw(Constants::MAX_KEY_LENGTH)
308
- check RegEnumValueW.call(hkey, index, name, size, 0, 0, 0, 0)
308
+ check RegEnumValueW.call(hkey, index, name, size, nil, nil, nil, nil)
309
309
  name.byteslice(0, unpackdw(size) * WCHAR_SIZE)
310
310
  end
311
311
 
@@ -313,7 +313,7 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
313
313
  name = WCHAR_NUL * Constants::MAX_KEY_LENGTH
314
314
  size = packdw(Constants::MAX_KEY_LENGTH)
315
315
  wtime = ' ' * 8
316
- check RegEnumKeyExW.call(hkey, index, name, size, 0, 0, 0, wtime)
316
+ check RegEnumKeyExW.call(hkey, index, name, size, nil, nil, nil, wtime)
317
317
  [ name.byteslice(0, unpackdw(size) * WCHAR_SIZE), unpackqw(wtime) ]
318
318
  end
319
319
 
@@ -321,9 +321,9 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
321
321
  type = packdw(0)
322
322
  size = packdw(0)
323
323
  name = make_wstr(name)
324
- check RegQueryValueExW.call(hkey, name, 0, type, 0, size)
324
+ check RegQueryValueExW.call(hkey, name, nil, type, nil, size)
325
325
  data = "\0".b * unpackdw(size)
326
- check RegQueryValueExW.call(hkey, name, 0, type, data, size)
326
+ check RegQueryValueExW.call(hkey, name, nil, type, data, size)
327
327
  [ unpackdw(type), data[0, unpackdw(size)] ]
328
328
  end
329
329
 
@@ -360,7 +360,7 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
360
360
  maxvaluelen = packdw(0)
361
361
  secdescs = packdw(0)
362
362
  wtime = ' ' * 8
363
- check RegQueryInfoKey.call(hkey, 0, 0, 0, subkeys, maxsubkeylen, 0,
363
+ check RegQueryInfoKeyW.call(hkey, 0, 0, 0, subkeys, maxsubkeylen, 0,
364
364
  values, maxvaluenamelen, maxvaluelen, secdescs, wtime)
365
365
  [ unpackdw(subkeys), unpackdw(maxsubkeylen), unpackdw(values),
366
366
  unpackdw(maxvaluenamelen), unpackdw(maxvaluelen),
@@ -430,7 +430,7 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
430
430
  # If block is given, the key is closed automatically.
431
431
  def self.open(hkey, subkey, desired = KEY_READ, opt = REG_OPTION_RESERVED)
432
432
  subkey = subkey.chomp('\\')
433
- newkey = API.OpenKey(hkey.hkey, subkey, opt, desired)
433
+ newkey = API.OpenKey(hkey.instance_variable_get(:@hkey), subkey, opt, desired)
434
434
  obj = new(newkey, hkey, subkey, REG_OPENED_EXISTING_KEY)
435
435
  if block_given?
436
436
  begin
@@ -457,7 +457,7 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
457
457
  # If block is given, the key is closed automatically.
458
458
  #
459
459
  def self.create(hkey, subkey, desired = KEY_ALL_ACCESS, opt = REG_OPTION_RESERVED)
460
- newkey, disp = API.CreateKey(hkey.hkey, subkey, opt, desired)
460
+ newkey, disp = API.CreateKey(hkey.instance_variable_get(:@hkey), subkey, opt, desired)
461
461
  obj = new(newkey, hkey, subkey, disp)
462
462
  if block_given?
463
463
  begin
@@ -479,7 +479,7 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
479
479
  # initialize
480
480
  #
481
481
  def initialize(hkey, parent, keyname, disposition)
482
- @hkey = hkey
482
+ @hkey = Fiddle::Pointer.new(hkey)
483
483
  @parent = parent
484
484
  @keyname = keyname
485
485
  @disposition = disposition
@@ -487,8 +487,6 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
487
487
  ObjectSpace.define_finalizer self, @@final.call(@hkeyfinal)
488
488
  end
489
489
 
490
- # Returns key handle value.
491
- attr_reader :hkey
492
490
  # Win32::Registry object of parent key, or nil if predefeined key.
493
491
  attr_reader :parent
494
492
  # Same as subkey value of Registry.open or
@@ -497,6 +495,11 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
497
495
  # Disposition value (REG_CREATED_NEW_KEY or REG_OPENED_EXISTING_KEY).
498
496
  attr_reader :disposition
499
497
 
498
+ # Returns key handle value.
499
+ def hkey
500
+ @hkey.to_i
501
+ end
502
+
500
503
  #
501
504
  # Returns if key is created ((*newly*)).
502
505
  # (see Registry.create) -- basically you call create
metadata CHANGED
@@ -1,38 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: win32-registry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - U.Nakamura
8
+ autorequire:
8
9
  bindir: exe
9
- cert_chain:
10
- - |
11
- -----BEGIN CERTIFICATE-----
12
- MIIEBDCCAmygAwIBAgIBAzANBgkqhkiG9w0BAQsFADAoMSYwJAYDVQQDDB1sYXJz
13
- L0RDPWdyZWl6LXJlaW5zZG9yZi9EQz1kZTAeFw0yNDAyMjgxOTMxNDdaFw0yNTAy
14
- MjcxOTMxNDdaMCgxJjAkBgNVBAMMHWxhcnMvREM9Z3JlaXotcmVpbnNkb3JmL0RD
15
- PWRlMIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAwum6Y1KznfpzXOT/
16
- mZgJTBbxZuuZF49Fq3K0WA67YBzNlDv95qzSp7V/7Ek3NCcnT7G+2kSuhNo1FhdN
17
- eSDO/moYebZNAcu3iqLsuzuULXPLuoU0GsMnVMqV9DZPh7cQHE5EBZ7hlzDBK7k/
18
- 8nBMvR0mHo77kIkapHc26UzVq/G0nKLfDsIHXVylto3PjzOumjG6GhmFN4r3cP6e
19
- SDfl1FSeRYVpt4kmQULz/zdSaOH3AjAq7PM2Z91iGwQvoUXMANH2v89OWjQO/NHe
20
- JMNDFsmHK/6Ji4Kk48Z3TyscHQnipAID5GhS1oD21/WePdj7GhmbF5gBzkV5uepd
21
- eJQPgWGwrQW/Z2oPjRuJrRofzWfrMWqbOahj9uth6WSxhNexUtbjk6P8emmXOJi5
22
- chQPnWX+N3Gj+jjYxqTFdwT7Mj3pv1VHa+aNUbqSPpvJeDyxRIuo9hvzDaBHb/Cg
23
- 9qRVcm8a96n4t7y2lrX1oookY6bkBaxWOMtWlqIprq8JZXM9AgMBAAGjOTA3MAkG
24
- A1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQWBBQ4h1tIyvdUWtMI739xMzTR
25
- 7EfMFzANBgkqhkiG9w0BAQsFAAOCAYEArBmHSfnUyNWf3R1Fx0mMHloWGdcKn2D2
26
- BsqTApXU2nADiyppIqRq4b9e7hw342uzadSLkoQcEFOxThLRhAcijoWfQVBcsbV/
27
- ZsCY1qlUTIJuSWxaSyS4efUX+N4eMNyPM9oW/sphlWFo0DgI34Y9WB6HDzH+O71y
28
- R7PARke3f4kYnRJf5yRQLPDrH9UYt9KlBQm6l7XMtr5EMnQt0EfcmZEi9H4t/vS2
29
- haxvpFMdAKo4H46GBYNO96r6b74t++vgQSBTg/AFVwvRZwNSrPPcBfb4xxeEAhRR
30
- x+LU7feIH7lZ//3buiyD03gLAEtHXai0Y+/VfuWIpwYJAl2BO/tU7FS/dtbJq9oc
31
- dI36Yyzy+BrCM0WT4oCsagePNb97FaNhl4F6sM5JEPT0ZPxRx0i3G4TNNIYziVos
32
- 5wFER6XhvvLDFAMh/jMg+s7Wd5SbSHgHNSUaUGVtdWkVPOer6oF0aLdZUR3CETkn
33
- 5nWXZma/BUd3YgYA/Xumc6QQqIS4p7mr
34
- -----END CERTIFICATE-----
35
- date: 2024-10-03 00:00:00.000000000 Z
10
+ cert_chain: []
11
+ date: 2024-11-08 00:00:00.000000000 Z
36
12
  dependencies:
37
13
  - !ruby/object:Gem::Dependency
38
14
  name: fiddle
@@ -58,7 +34,6 @@ files:
58
34
  - BSDL
59
35
  - COPYING
60
36
  - README.md
61
- - Rakefile
62
37
  - lib/win32/registry.rb
63
38
  - sig/win32/registry.rbs
64
39
  homepage: https://github.com/ruby/win32-registry
@@ -66,6 +41,7 @@ licenses: []
66
41
  metadata:
67
42
  homepage_uri: https://github.com/ruby/win32-registry
68
43
  source_code_uri: https://github.com/ruby/win32-registry
44
+ post_install_message:
69
45
  rdoc_options: []
70
46
  require_paths:
71
47
  - lib
@@ -80,7 +56,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
56
  - !ruby/object:Gem::Version
81
57
  version: '0'
82
58
  requirements: []
83
- rubygems_version: 3.6.0.dev
59
+ rubygems_version: 3.5.11
60
+ signing_key:
84
61
  specification_version: 4
85
62
  summary: Provides an interface to the Windows Registry in Ruby
86
63
  test_files: []
checksums.yaml.gz.sig DELETED
Binary file
data/Rakefile DELETED
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "bundler/gem_tasks"
4
- require "minitest/test_task"
5
-
6
- Minitest::TestTask.create
7
-
8
- task default: :test
data.tar.gz.sig DELETED
@@ -1 +0,0 @@
1
- C���Cg |N�bN��U��%����#䖟W�̕��싙zͻY#�IѪ�7��n��/�P6[,6�K�Q�^�ENb�sdky���zި�st4�O�&P�������%�ΓCR��Q�Nj���u�URIc�2,Jhb+Na37��W Ax<�����+����h��`�hJ�.,����$*�ad������]��ds�&�S��aۤ2/4�s��U�m��������X�sc���|>����%�m�� A�gcl�m�W$)f� �+���z�y��T�o��a�򻁽�>%o A�pBښ��:!�n|�����gg������3\�^d��.d Jx�JCk�K�=� �v�%����޳�x�MZ=�#!ȶq�p���k��o܅
metadata.gz.sig DELETED
Binary file