--- a/RegressionTests__Win32OperatingSystemTest.st Wed Jan 16 14:37:47 2019 +0100
+++ b/RegressionTests__Win32OperatingSystemTest.st Fri Feb 01 16:04:53 2019 +0100
@@ -47,6 +47,7 @@
^ 'Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\SmalltalkX-tests]
+@="しか OMG"
"emptyToTest"=""
"testEmptyMultiSZ"=hex(7):00,00
"bledesu"="''Testing Unicode chars ř ž č ルすしかき''). "
@@ -147,6 +148,7 @@
00,59,01,20,00,7e,01,20,00,0d,01,20,00,eb,30,59,30,57,30,4b,30,4d,30,27,00,\
29,00,2e,00,20,00,20,00,20,00,20,00,20,00,20,00,20,00,20,00,20,00,20,00,00,\
00
+[HKEY_CURRENT_USER\Software\SmalltalkX-tests\ ルすしか_empty]
[HKEY_CURRENT_USER\Software\SmalltalkX-tests\ ルすしか]
"bledesu"="''Testing Unicode chars ř ž č ルすしかき''). "
@@ -257,10 +259,116 @@
[HKEY_CURRENT_USER\Software\SmalltalkX-tests\ ルすしか\256_chars_max_long|arsdfasdfjljljasdf;jl;jljsfasdfasdfljaslkdfjkasdfljalsd;jfa;lsdjflkasjdflkajsdflkjasdflkjsadlfjasldfjlsadjflksdjflksadjflkajsdflkjasdlfjalskdjflkasdjflkasdfkj;sdaf;kljkkjkklkjjjjkas|1asdfjsldfjlasdlfjlasdjfljasdlfjalsdjflajdfsdsasdfa|end\256_chars_max_long|arsdfasdfjljljasdf;jl;jljsfasdfasdfljaslkdfjkasdfljalsd;jfa;lsdjflkasjdflkajsdflkjasdflkjsadlfjasldfjlsadjflksdjflksadjflkajsdflkjasdlfjalskdjflkasdjflkasdfkj;sdaf;kljkkjkklkjjjjkas|1asdfjsldfjlasdlfjlasdjfljasdlfjalsdjflajdfsdsasdfa|end\unreachable]
[HKEY_CURRENT_USER\Software\SmalltalkX-tests\ ルすしか\256_chars_max_long|arsdfasdfjljljasdf;jl;jljsfasdfasdfljaslkdfjkasdfljalsd;jfa;lsdjflkasjdflkajsdflkjasdflkjsadlfjasldfjlsadjflksdjflksadjflkajsdflkjasdlfjalskdjflkasdjflkasdfkj;sdaf;kljkkjkklkjjjjkas|1asdfjsldfjlasdlfjlasdjfljasdlfjalsdjflajdfsdsasdfa|end\reachable]
+
+[HKEY_CURRENT_USER\Software\SmalltalkX-tests\ ルすしか_testing_delete]
+
+[HKEY_CURRENT_USER\Software\SmalltalkX-tests\ ルすしか_testing_delete\ughu]
+"bledesu"="''Testing Unicode chars ř ž č ルすしかき''). "
+"しかき "="Testus gradus"
+" ř ž č ル. "="Testing Unicode chars ř ž č ルすしかき"
+"zero"=hex:
+"non-zero"=hex:11,10
+"す "=hex:10
+"dword_value"=dword:000023af
+"き"=dword:234234af
+"qwordvalue"=hex(b):ad,61,28,a3,95,0e,74,79
+"qword_max"=hex(b):ff,ff,ff,ff,ff,ff,ff,ff
+"すし"=hex(b):ef,ad,00,00,00,00,00,00
+"Font_Leelawadee UI Bold"=hex(7):53,00,45,00,47,00,4f,00,45,00,55,00,49,00,42,\
+ 00,2e,00,54,00,54,00,46,00,2c,00,53,00,65,00,67,00,6f,00,65,00,20,00,55,00,\
+ 49,00,20,00,42,00,6f,00,6c,00,64,00,2c,00,31,00,31,00,30,00,2c,00,38,00,32,\
+ 00,00,00,53,00,45,00,47,00,4f,00,45,00,55,00,49,00,42,00,2e,00,54,00,54,00,\
+ 46,00,2c,00,53,00,65,00,67,00,6f,00,65,00,20,00,55,00,49,00,20,00,42,00,6f,\
+ 00,6c,00,64,00,00,00,4d,00,45,00,49,00,52,00,59,00,4f,00,42,00,2e,00,54,00,\
+ 54,00,43,00,2c,00,4d,00,65,00,69,00,72,00,79,00,6f,00,20,00,55,00,49,00,20,\
+ 00,42,00,6f,00,6c,00,64,00,2c,00,31,00,32,00,30,00,2c,00,39,00,36,00,00,00,\
+ 4d,00,45,00,49,00,52,00,59,00,4f,00,42,00,2e,00,54,00,54,00,43,00,2c,00,4d,\
+ 00,65,00,69,00,72,00,79,00,6f,00,20,00,55,00,49,00,20,00,42,00,6f,00,6c,00,\
+ 64,00,00,00,4d,00,53,00,4a,00,48,00,42,00,44,00,2e,00,54,00,54,00,43,00,2c,\
+ 00,4d,00,69,00,63,00,72,00,6f,00,73,00,6f,00,66,00,74,00,20,00,4a,00,68,00,\
+ 65,00,6e,00,67,00,48,00,65,00,69,00,20,00,55,00,49,00,20,00,42,00,6f,00,6c,\
+ 00,64,00,2c,00,31,00,32,00,30,00,2c,00,39,00,36,00,00,00,4d,00,53,00,4a,00,\
+ 48,00,42,00,44,00,2e,00,54,00,54,00,43,00,2c,00,4d,00,69,00,63,00,72,00,6f,\
+ 00,73,00,6f,00,66,00,74,00,20,00,4a,00,68,00,65,00,6e,00,67,00,48,00,65,00,\
+ 69,00,20,00,55,00,49,00,20,00,42,00,6f,00,6c,00,64,00,00,00,4d,00,53,00,59,\
+ 00,48,00,42,00,44,00,2e,00,54,00,54,00,43,00,2c,00,4d,00,69,00,63,00,72,00,\
+ 6f,00,73,00,6f,00,66,00,74,00,20,00,59,00,61,00,48,00,65,00,69,00,20,00,55,\
+ 00,49,00,20,00,42,00,6f,00,6c,00,64,00,2c,00,31,00,32,00,38,00,2c,00,39,00,\
+ 36,00,00,00,4d,00,53,00,59,00,48,00,42,00,44,00,2e,00,54,00,54,00,43,00,2c,\
+ 00,4d,00,69,00,63,00,72,00,6f,00,73,00,6f,00,66,00,74,00,20,00,59,00,61,00,\
+ 48,00,65,00,69,00,20,00,55,00,49,00,20,00,42,00,6f,00,6c,00,64,00,00,00,4d,\
+ 00,41,00,4c,00,47,00,55,00,4e,00,42,00,44,00,2e,00,54,00,54,00,46,00,2c,00,\
+ 4d,00,61,00,6c,00,67,00,75,00,6e,00,20,00,47,00,6f,00,74,00,68,00,69,00,63,\
+ 00,20,00,42,00,6f,00,6c,00,64,00,2c,00,31,00,31,00,38,00,2c,00,39,00,36,00,\
+ 00,00,4d,00,41,00,4c,00,47,00,55,00,4e,00,42,00,44,00,2e,00,54,00,54,00,46,\
+ 00,2c,00,4d,00,61,00,6c,00,67,00,75,00,6e,00,20,00,47,00,6f,00,74,00,68,00,\
+ 69,00,63,00,20,00,42,00,6f,00,6c,00,64,00,00,00,59,00,55,00,47,00,4f,00,54,\
+ 00,48,00,42,00,2e,00,54,00,54,00,43,00,2c,00,59,00,75,00,20,00,47,00,6f,00,\
+ 74,00,68,00,69,00,63,00,20,00,55,00,49,00,20,00,42,00,6f,00,6c,00,64,00,2c,\
+ 00,31,00,32,00,38,00,2c,00,39,00,36,00,00,00,59,00,55,00,47,00,4f,00,54,00,\
+ 48,00,42,00,2e,00,54,00,54,00,43,00,2c,00,59,00,75,00,20,00,47,00,6f,00,74,\
+ 00,68,00,69,00,63,00,20,00,55,00,49,00,20,00,42,00,6f,00,6c,00,64,00,00,00,\
+ 53,00,45,00,47,00,55,00,49,00,53,00,59,00,4d,00,2e,00,54,00,54,00,46,00,2c,\
+ 00,53,00,65,00,67,00,6f,00,65,00,20,00,55,00,49,00,20,00,53,00,79,00,6d,00,\
+ 62,00,6f,00,6c,00,00,00,00,00
+"ř ž č ルすしか"=hex(7):27,00,54,00,65,00,73,00,74,00,69,00,6e,00,67,00,20,00,55,\
+ 00,6e,00,69,00,63,00,6f,00,64,00,65,00,20,00,63,00,68,00,61,00,72,00,73,00,\
+ 20,00,59,01,20,00,7e,01,20,00,0d,01,20,00,eb,30,59,30,57,30,4b,30,4d,30,27,\
+ 00,29,00,00,00,53,00,45,00,47,00,4f,00,45,00,55,00,49,00,42,00,2e,00,54,00,\
+ 54,00,46,00,2c,00,53,00,65,00,67,00,6f,00,65,00,20,00,55,00,49,00,20,00,42,\
+ 00,6f,00,6c,00,64,00,2c,00,31,00,31,00,30,00,2c,00,38,00,32,00,00,00,53,00,\
+ 45,00,47,00,4f,00,45,00,55,00,49,00,42,00,2e,00,54,00,54,00,46,00,2c,00,53,\
+ 00,65,00,67,00,6f,00,65,00,20,00,55,00,49,00,20,00,42,00,6f,00,6c,00,64,00,\
+ 00,00,4d,00,45,00,49,00,52,00,59,00,4f,00,42,00,2e,00,54,00,54,00,43,00,2c,\
+ 00,4d,00,65,00,69,00,72,00,79,00,6f,00,20,00,55,00,49,00,20,00,42,00,6f,00,\
+ 6c,00,64,00,2c,00,31,00,32,00,30,00,2c,00,39,00,36,00,00,00,4d,00,45,00,49,\
+ 00,52,00,59,00,4f,00,42,00,2e,00,54,00,54,00,43,00,2c,00,4d,00,65,00,69,00,\
+ 72,00,79,00,6f,00,20,00,55,00,49,00,20,00,42,00,6f,00,6c,00,64,00,00,00,4d,\
+ 00,53,00,4a,00,48,00,42,00,44,00,2e,00,54,00,54,00,43,00,2c,00,4d,00,69,00,\
+ 63,00,72,00,6f,00,73,00,6f,00,66,00,74,00,20,00,4a,00,68,00,65,00,6e,00,67,\
+ 00,48,00,65,00,69,00,20,00,55,00,49,00,20,00,42,00,6f,00,6c,00,64,00,2c,00,\
+ 31,00,32,00,30,00,2c,00,39,00,36,00,00,00,4d,00,53,00,4a,00,48,00,42,00,44,\
+ 00,2e,00,54,00,54,00,43,00,2c,00,4d,00,69,00,63,00,72,00,6f,00,73,00,6f,00,\
+ 66,00,74,00,20,00,4a,00,68,00,65,00,6e,00,67,00,48,00,65,00,69,00,20,00,55,\
+ 00,49,00,20,00,42,00,6f,00,6c,00,64,00,00,00,4d,00,53,00,59,00,48,00,42,00,\
+ 44,00,2e,00,54,00,54,00,43,00,2c,00,4d,00,69,00,63,00,72,00,6f,00,73,00,6f,\
+ 00,66,00,74,00,20,00,59,00,61,00,48,00,65,00,69,00,20,00,55,00,49,00,20,00,\
+ 42,00,6f,00,6c,00,64,00,2c,00,31,00,32,00,38,00,2c,00,39,00,36,00,00,00,4d,\
+ 00,53,00,59,00,48,00,42,00,44,00,2e,00,54,00,54,00,43,00,2c,00,4d,00,69,00,\
+ 63,00,72,00,6f,00,73,00,6f,00,66,00,74,00,20,00,59,00,61,00,48,00,65,00,69,\
+ 00,20,00,55,00,49,00,20,00,42,00,6f,00,6c,00,64,00,00,00,4d,00,41,00,4c,00,\
+ 47,00,55,00,4e,00,42,00,44,00,2e,00,54,00,54,00,46,00,2c,00,4d,00,61,00,6c,\
+ 00,67,00,75,00,6e,00,20,00,47,00,6f,00,74,00,68,00,69,00,63,00,20,00,42,00,\
+ 6f,00,6c,00,64,00,2c,00,31,00,31,00,38,00,2c,00,39,00,36,00,00,00,4d,00,41,\
+ 00,4c,00,47,00,55,00,4e,00,42,00,44,00,2e,00,54,00,54,00,46,00,2c,00,4d,00,\
+ 61,00,6c,00,67,00,75,00,6e,00,20,00,47,00,6f,00,74,00,68,00,69,00,63,00,20,\
+ 00,42,00,6f,00,6c,00,64,00,00,00,59,00,55,00,47,00,4f,00,54,00,48,00,42,00,\
+ 2e,00,54,00,54,00,43,00,2c,00,59,00,75,00,20,00,47,00,6f,00,74,00,68,00,69,\
+ 00,63,00,20,00,55,00,49,00,20,00,42,00,6f,00,6c,00,64,00,2c,00,31,00,32,00,\
+ 38,00,2c,00,39,00,36,00,00,00,59,00,55,00,47,00,4f,00,54,00,48,00,42,00,2e,\
+ 00,54,00,54,00,43,00,2c,00,59,00,75,00,20,00,47,00,6f,00,74,00,68,00,69,00,\
+ 63,00,20,00,55,00,49,00,20,00,42,00,6f,00,6c,00,64,00,00,00,53,00,45,00,47,\
+ 00,55,00,49,00,53,00,59,00,4d,00,2e,00,54,00,54,00,46,00,2c,00,53,00,65,00,\
+ 67,00,6f,00,65,00,20,00,55,00,49,00,20,00,53,00,79,00,6d,00,62,00,6f,00,6c,\
+ 00,00,00,00,00
+"Ugh"=hex(2):27,00,54,00,65,00,73,00,74,00,69,00,6e,00,67,00,20,00,55,00,6e,00,\
+ 69,00,63,00,6f,00,64,00,65,00,20,00,63,00,68,00,61,00,72,00,73,00,20,00,59,\
+ 01,20,00,7e,01,20,00,0d,01,20,00,eb,30,59,30,57,30,4b,30,4d,30,27,00,29,00,\
+ 2e,00,20,00,20,00,20,00,20,00,20,00,20,00,20,00,20,00,20,00,20,00,00,00
+" č ルすしか"=hex(2):27,00,54,00,65,00,73,00,74,00,69,00,6e,00,67,00,20,00,55,00,\
+ 6e,00,69,00,63,00,6f,00,64,00,65,00,20,00,63,00,68,00,61,00,72,00,73,00,20,\
+ 00,59,01,20,00,7e,01,20,00,0d,01,20,00,eb,30,59,30,57,30,4b,30,4d,30,27,00,\
+ 29,00,2e,00,20,00,20,00,20,00,20,00,20,00,20,00,20,00,20,00,20,00,20,00,00,\
+ 00
+[HKEY_CURRENT_USER\Software\SmalltalkX-tests\ ルすしか_testing_delete\zubr]
+
+[HKEY_CURRENT_USER\Software\SmalltalkX-tests\ ルすしか_testing_delete\bobr]
+
+[HKEY_CURRENT_USER\Software\SmalltalkX-tests\ ルすしか_testing_delete\bobr\boříččátka]
'
"Created: / 16-11-2018 / 11:24:57 / svestkap"
- "Modified: / 05-12-2018 / 11:33:32 / svestkap"
+ "Modified: / 07-12-2018 / 10:44:44 / svestkap"
! !
!Win32OperatingSystemTest methodsFor:'release'!
@@ -398,6 +506,783 @@
"Modified: / 05-01-2017 / 21:45:20 / jv"
! !
+!Win32OperatingSystemTest methodsFor:'tests-UnicodeCreate'!
+
+testCreatingSubKeyNamed_01
+ "Testing if new subKey is created"
+ | readData testingRegistryPath readSubKeys subKeysCount |
+
+ readData := Unicode16String new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ readSubKeys := testingRegistryPath subKeys.
+ subKeysCount := readSubKeys size.
+
+ self assert: subKeysCount = 3.
+ "/ creating the new subKey
+ readData := testingRegistryPath subKeyNamed: 'bledesu ル' flags: nil createIfAbsent: true.
+ "/ check if new path is with the subKeyNamed above
+ self assert: (readData path copyAfterLast: $\) = 'bledesu ル' .
+
+ readSubKeys := testingRegistryPath subKeys.
+ self assert: readSubKeys size = (subKeysCount + 1)
+
+ "
+ self run:#testCreatingSubKeyNamed_01
+ self new testCreatingSubKeyNamed_01
+ "
+
+ "Created: / 07-12-2018 / 15:30:55 / svestkap"
+!
+
+testCreatingSubKeyNamed_02
+ "Testing if new subKey is created via createSubKeyNamed:"
+ | readData testingRegistryPath readSubKeys subKeysCount |
+
+ readData := Unicode16String new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ readSubKeys := testingRegistryPath subKeys.
+ subKeysCount := readSubKeys size.
+
+ self assert: subKeysCount = 3.
+ "/ creating the new subKey
+ readData := testingRegistryPath createSubKeyNamed: 'bledesu ル'.
+ "/ check if new path is with the subKeyNamed above
+ self assert: (readData path copyAfterLast: $\) = 'bledesu ル' .
+
+ readSubKeys := testingRegistryPath subKeys.
+ self assert: readSubKeys size = (subKeysCount + 1)
+
+ "
+ self run:#testCreatingSubKeyNamed_02
+ self new testCreatingSubKeyNamed_02
+ "
+
+ "Created: / 07-12-2018 / 15:57:09 / svestkap"
+!
+
+testCreatingSubKeyNamed_Wow64_32_01
+ "Testing if new subKey is created in Wow64_32 (32bit program reading 32bit registry)"
+ | readData testingRegistryPath readSubKeys subKeysCount |
+
+ self skipIf: (OperatingSystem getSystemInfo at: #architecture) ~= #x64 description: 'Test only for x64 architecture'.
+
+ readData := Unicode16String new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ readSubKeys := testingRegistryPath subKeys.
+ subKeysCount := readSubKeys size.
+
+ self assert: subKeysCount = 3.
+ "/ creating the new subKey
+ readData := testingRegistryPath subKeyNamed: 'bledesu ル' flags: #KEY_WOW64_32KEY createIfAbsent: true.
+ "/ check if new path is with the subKeyNamed above
+ self assert: (readData path copyAfterLast: $\) = 'bledesu ル' .
+
+ readSubKeys := testingRegistryPath subKeys.
+ self assert: readSubKeys size = (subKeysCount + 1)
+
+ "
+ self run:#testCreatingSubKeyNamed_Wow64_32_01
+ self new testCreatingSubKeyNamed_Wow64_32_01
+ "
+
+ "Created: / 07-12-2018 / 15:58:24 / svestkap"
+!
+
+testCreatingSubKeyNamed_Wow64_32_02
+ "Testing if new subKey is created in Wow64_32 (32bit program reading 32bit registry) via createSubKeyNamed:flags:"
+ | readData testingRegistryPath readSubKeys subKeysCount |
+
+ self skipIf: (OperatingSystem getSystemInfo at: #architecture) ~= #x64 description: 'Test only for x64 architecture'.
+
+ readData := Unicode16String new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ readSubKeys := testingRegistryPath subKeys.
+ subKeysCount := readSubKeys size.
+
+ self assert: subKeysCount = 3.
+ "/ creating the new subKey
+ readData := testingRegistryPath createSubKeyNamed: 'bledesu ル' flags: #KEY_WOW64_32KEY.
+ "/ check if new path is with the subKeyNamed above
+ self assert: (readData path copyAfterLast: $\) = 'bledesu ル' .
+
+ readSubKeys := testingRegistryPath subKeys.
+ self assert: readSubKeys size = (subKeysCount + 1)
+
+ "
+ self run:#testCreatingSubKeyNamed_Wow64_32_02
+ self new testCreatingSubKeyNamed_Wow64_32_02
+ "
+
+ "Created: / 07-12-2018 / 15:59:32 / svestkap"
+!
+
+testCreatingSubKeyNamed_Wow64_64_01
+ "Testing if new subKey is created in Wow64_32 (32bit program reading 64bit registry)"
+ | readData testingRegistryPath readSubKeys subKeysCount |
+
+ self skipIf: (OperatingSystem getSystemInfo at: #architecture) ~= #x64 description: 'Test only for x64 architecture'.
+
+ readData := Unicode16String new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ readSubKeys := testingRegistryPath subKeys.
+ subKeysCount := readSubKeys size.
+
+ self assert: subKeysCount = 3.
+ "/ creating the new subKey
+ readData := testingRegistryPath subKeyNamed: 'bledesu ル' flags: #KEY_WOW64_64KEY createIfAbsent: true.
+ "/ check if new path is with the subKeyNamed above
+ self assert: (readData path copyAfterLast: $\) = 'bledesu ル' .
+
+ readSubKeys := testingRegistryPath subKeys.
+ self assert: readSubKeys size = (subKeysCount + 1)
+
+ "
+ self run:#testCreatingSubKeyNamed_Wow64_64_01
+ self new testCreatingSubKeyNamed_Wow64_64_01
+ "
+
+ "Created: / 07-12-2018 / 15:58:38 / svestkap"
+!
+
+testCreatingSubKeyNamed_Wow64_64_02
+ "Testing if new subKey is created in Wow64_32 (32bit program reading 64bit registry) via createSubKeyNamed:flags:"
+ | readData testingRegistryPath readSubKeys subKeysCount |
+
+ self skipIf: (OperatingSystem getSystemInfo at: #architecture) ~= #x64 description: 'Test only for x64 architecture'.
+
+ readData := Unicode16String new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ readSubKeys := testingRegistryPath subKeys.
+ subKeysCount := readSubKeys size.
+
+ self assert: subKeysCount = 3.
+ "/ creating the new subKey
+ readData := testingRegistryPath createSubKeyNamed: 'bledesu ル' flags: #KEY_WOW64_64KEY.
+ "/ check if new path is with the subKeyNamed above
+ self assert: (readData path copyAfterLast: $\) = 'bledesu ル' .
+
+ readSubKeys := testingRegistryPath subKeys.
+ self assert: readSubKeys size = (subKeysCount + 1)
+
+ "
+ self run:#testCreatingSubKeyNamed_Wow64_64_02
+ self new testCreatingSubKeyNamed_Wow64_64_02
+ "
+
+ "Created: / 07-12-2018 / 15:59:50 / svestkap"
+! !
+
+!Win32OperatingSystemTest methodsFor:'tests-UnicodeOpen'!
+
+testOpenSubKeyNamed_01
+ "Testing if an old subKey is opened"
+ | readData testingRegistryPath readSubKeys subKeysCount |
+
+ readData := Unicode16String new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ readSubKeys := testingRegistryPath subKeys.
+ subKeysCount := readSubKeys size.
+
+ self assert: subKeysCount = 3.
+ "/ trying to read already existing subKey
+ readData := testingRegistryPath subKeyNamed: ' ルすしか' flags: nil createIfAbsent: false.
+
+ "/ check if the existing
+ self assert: (readData path copyAfterLast: $\) = ' ルすしか'.
+
+ "
+ self run:#testOpenSubKeyNamed_01
+ self new testOpenSubKeyNamed_01
+ "
+
+ "Created: / 07-12-2018 / 15:34:21 / svestkap"
+!
+
+testOpenSubKeyNamed_02
+ "Testing if an old subKey is opened"
+ | readData testingRegistryPath readSubKeys subKeysCount |
+
+ readData := Unicode16String new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ readSubKeys := testingRegistryPath subKeys.
+ subKeysCount := readSubKeys size.
+
+ self assert: subKeysCount = 3.
+ "/ trying to read already existing subKey
+ readData := testingRegistryPath subKeyNamed: ' ルすしか' flags: nil createIfAbsent: true.
+
+ "/ check if the existing
+ self assert: (readData path copyAfterLast: $\) = ' ルすしか'.
+
+ "
+ self run:#testOpenSubKeyNamed_02
+ self new testOpenSubKeyNamed_02
+ "
+
+ "Created: / 07-12-2018 / 15:36:27 / svestkap"
+!
+
+testOpenSubKeyNamed_03
+ "Testing if an old subKey is opened via subKeyNamed:"
+ | readData testingRegistryPath readSubKeys subKeysCount |
+
+ readData := Unicode16String new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ readSubKeys := testingRegistryPath subKeys.
+ subKeysCount := readSubKeys size.
+
+ self assert: subKeysCount = 3.
+ "/ trying to read already existing subKey
+ readData := testingRegistryPath subKeyNamed: ' ルすしか'.
+
+ "/ check if the existing
+ self assert: (readData path copyAfterLast: $\) = ' ルすしか'.
+
+ "
+ self run:#testOpenSubKeyNamed_03
+ self new testOpenSubKeyNamed_03
+ "
+
+ "Created: / 07-12-2018 / 15:47:59 / svestkap"
+!
+
+testOpenSubKeyNamed_04
+ "Testing if an old subKey is opened via subKeyNamed:createIfAbsent:"
+ | readData testingRegistryPath readSubKeys subKeysCount |
+
+ readData := Unicode16String new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ readSubKeys := testingRegistryPath subKeys.
+ subKeysCount := readSubKeys size.
+
+ self assert: subKeysCount = 3.
+ "/ trying to read already existing subKey
+ readData := testingRegistryPath subKeyNamed: ' ルすしか' createIfAbsent: true.
+
+ "/ check if the existing
+ self assert: (readData path copyAfterLast: $\) = ' ルすしか'.
+
+ "
+ self run:#testOpenSubKeyNamed_04
+ self new testOpenSubKeyNamed_04
+ "
+
+ "Created: / 07-12-2018 / 15:51:52 / svestkap"
+!
+
+testOpenSubKeyNamed_Wow64_32_01
+ "Testing if an old subKey is opened in Wow64_32 (32bit program reading 32bit registry)"
+ | readData testingRegistryPath readSubKeys subKeysCount |
+
+ self skipIf: (OperatingSystem getSystemInfo at: #architecture) ~= #x64 description: 'Test only for x64 architecture'.
+
+ readData := Unicode16String new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ readSubKeys := testingRegistryPath subKeys.
+ subKeysCount := readSubKeys size.
+
+ self assert: subKeysCount = 3.
+ "/ trying to read already existing subKey
+ readData := testingRegistryPath subKeyNamed: ' ルすしか' flags: #KEY_WOW64_32KEY createIfAbsent: false.
+
+ "/ check if the existing
+ self assert: (readData path copyAfterLast: $\) = ' ルすしか'.
+
+ "
+ self run:#testOpenSubKeyNamed_Wow64_32_01
+ self new testOpenSubKeyNamed_Wow64_32_01
+ "
+
+ "Created: / 07-12-2018 / 15:53:04 / svestkap"
+!
+
+testOpenSubKeyNamed_Wow64_32_02
+ "Testing if an old subKey is opened in Wow64_32 (32bit program reading 32bit registry) via subKeyNamed:flags:"
+ | readData testingRegistryPath readSubKeys subKeysCount |
+
+ self skipIf: (OperatingSystem getSystemInfo at: #architecture) ~= #x64 description: 'Test only for x64 architecture'.
+
+ readData := Unicode16String new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ readSubKeys := testingRegistryPath subKeys.
+ subKeysCount := readSubKeys size.
+
+ self assert: subKeysCount = 3.
+ "/ trying to read already existing subKey
+ readData := testingRegistryPath subKeyNamed: ' ルすしか' flags: #KEY_WOW64_32KEY.
+
+ "/ check if the existing
+ self assert: (readData path copyAfterLast: $\) = ' ルすしか'.
+
+ "
+ self run:#testOpenSubKeyNamed_Wow64_32_02
+ self new testOpenSubKeyNamed_Wow64_32_02
+ "
+
+ "Created: / 07-12-2018 / 15:54:31 / svestkap"
+!
+
+testOpenSubKeyNamed_Wow64_64_01
+ "Testing if an old subKey is opened in Wow64_64 (32bit program reading 64bit registry)"
+ | readData testingRegistryPath readSubKeys subKeysCount |
+
+ self skipIf: (OperatingSystem getSystemInfo at: #architecture) ~= #x64 description: 'Test only for x64 architecture'.
+
+ readData := Unicode16String new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ readSubKeys := testingRegistryPath subKeys.
+ subKeysCount := readSubKeys size.
+
+ self assert: subKeysCount = 3.
+ "/ trying to read already existing subKey
+ readData := testingRegistryPath subKeyNamed: ' ルすしか' flags: #KEY_WOW64_64KEY createIfAbsent: false.
+
+ "/ check if the existing
+ self assert: (readData path copyAfterLast: $\) = ' ルすしか'.
+
+ "
+ self run:#testOpenSubKeyNamed_Wow64_64_01
+ self new testOpenSubKeyNamed_Wow64_64_01
+ "
+
+ "Created: / 07-12-2018 / 15:53:34 / svestkap"
+!
+
+testOpenSubKeyNamed_Wow64_64_02
+ "Testing if an old subKey is opened in Wow64_64 (32bit program reading 64bit registry) via subKeyNamed:flags:"
+ | readData testingRegistryPath readSubKeys subKeysCount |
+
+ self skipIf: (OperatingSystem getSystemInfo at: #architecture) ~= #x64 description: 'Test only for x64 architecture'.
+
+ readData := Unicode16String new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ readSubKeys := testingRegistryPath subKeys.
+ subKeysCount := readSubKeys size.
+
+ self assert: subKeysCount = 3.
+ "/ trying to read already existing subKey
+ readData := testingRegistryPath subKeyNamed: ' ルすしか' flags: #KEY_WOW64_64KEY.
+
+ "/ check if the existing
+ self assert: (readData path copyAfterLast: $\) = ' ルすしか'.
+
+ "
+ self run:#testOpenSubKeyNamed_Wow64_64_02
+ self new testOpenSubKeyNamed_Wow64_64_02
+ "
+
+ "Created: / 07-12-2018 / 15:55:07 / svestkap"
+!
+
+testOpenSubKeyNamed_nonExistingWow64_32
+ "Trying to read non-existing subKey in Wow64_32 (32bit program reading 32bit registry)"
+ | readData testingRegistryPath readSubKeys subKeysCount |
+
+ self skipIf: (OperatingSystem getSystemInfo at: #architecture) ~= #x64 description: 'Test only for x64 architecture'.
+
+ readData := Unicode16String new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ readSubKeys := testingRegistryPath subKeys.
+ subKeysCount := readSubKeys size.
+
+ self assert: subKeysCount = 3.
+ "/ trying to read non-existent subKey
+ readData := testingRegistryPath subKeyNamed: 'bledesu ル' flags: #KEY_WOW64_32KEY createIfAbsent: false.
+ "/ check if new path is with the subKeyNamed above
+
+ self assert: readData isNil
+
+ "
+ self run:#testOpenSubKeyNamed_nonExistingWow64_32
+ self new testOpenSubKeyNamed_nonExistingWow64_32
+ "
+
+ "Created: / 07-12-2018 / 15:44:52 / svestkap"
+!
+
+testOpenSubKeyNamed_nonExistingWow64_64
+ "Trying to read non-existing subKey in Wow64_32 (32bit program reading 64bit registry)"
+ | readData testingRegistryPath readSubKeys subKeysCount |
+
+ self skipIf: (OperatingSystem getSystemInfo at: #architecture) ~= #x64 description: 'Test only for x64 architecture'.
+
+ readData := Unicode16String new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ readSubKeys := testingRegistryPath subKeys.
+ subKeysCount := readSubKeys size.
+
+ self assert: subKeysCount = 3.
+ "/ trying to read non-existent subKey
+ readData := testingRegistryPath subKeyNamed: 'bledesu ル' flags: #KEY_WOW64_64KEY createIfAbsent: false.
+ "/ check if new path is with the subKeyNamed above
+
+ self assert: readData isNil
+
+ "
+ self run:#testOpenSubKeyNamed_nonExistingWow64_32
+ self new testOpenSubKeyNamed_nonExistingWow64_32
+ "
+
+ "Created: / 07-12-2018 / 15:45:42 / svestkap"
+!
+
+testOpenSubKeyNamed_nonExisting_01
+ "Trying to read non-existing subKey"
+ | readData testingRegistryPath readSubKeys subKeysCount |
+
+ readData := Unicode16String new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ readSubKeys := testingRegistryPath subKeys.
+ subKeysCount := readSubKeys size.
+
+ self assert: subKeysCount = 3.
+ "/ trying to read non-existent subKey
+ readData := testingRegistryPath subKeyNamed: 'bledesu ル' flags: nil createIfAbsent: false.
+ "/ check if new path is with the subKeyNamed above
+
+ self assert: readData isNil
+
+ "
+ self run:#testOpenSubKeyNamed_nonExisting_01
+ self new testOpenSubKeyNamed_nonExisting_01
+ "
+
+ "Created: / 07-12-2018 / 15:50:18 / svestkap"
+!
+
+testOpenSubKeyNamed_nonExisting_02
+ "Trying to read non-existing subKey via subKeyNamed:"
+ | readData testingRegistryPath readSubKeys subKeysCount |
+
+ readData := Unicode16String new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ readSubKeys := testingRegistryPath subKeys.
+ subKeysCount := readSubKeys size.
+
+ self assert: subKeysCount = 3.
+ "/ trying to read non-existent subKey
+ readData := testingRegistryPath subKeyNamed: 'bledesu ル'.
+ "/ check if new path is with the subKeyNamed above
+
+ self assert: readData isNil
+
+ "
+ self run:#testOpenSubKeyNamed_nonExisting_02
+ self new testOpenSubKeyNamed_nonExisting_02
+ "
+
+ "Created: / 07-12-2018 / 15:50:48 / svestkap"
+! !
+
+!Win32OperatingSystemTest methodsFor:'tests-unicodeDelete'!
+
+testDeleteSubKeyNamed
+ "Testing deleting of empty subKey via deleteSubKeyNamed:"
+
+ | returnValue testingRegistryPath |
+
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+
+ "/ if successfully deteted -> true
+ returnValue := testingRegistryPath deleteSubKeyNamed: ' ルすしか_empty'.
+ self assert: returnValue
+
+ "
+ self run:#testDeleteSubKeyNamed
+ self new testDeleteSubKeyNamed
+ "
+
+ "Created: / 07-12-2018 / 09:49:44 / svestkap"
+!
+
+testDeleteSubKeyNamed_Wow64_32
+ "Testing deleting of empty subKey via deleteSubKeyNamed: (only on x64 systems)
+ Wow subsystem enables running 32bit applications on 64bit windows"
+ | returnValue testingRegistryPath |
+
+ self skipIf: (OperatingSystem getSystemInfo at: #architecture) ~= #x64 description: 'Test only for x64 architecture'.
+
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+
+ "/ if successfully deteted -> true
+ returnValue := testingRegistryPath deleteSubKeyNamed: ' ルすしか_empty' flags:#KEY_WOW64_32KEY.
+ self assert: returnValue
+
+ "
+ self run:#testDeleteSubKeyNamed_Wow64_32
+ self new testDeleteSubKeyNamed_Wow64_32
+ "
+
+ "Created: / 07-12-2018 / 14:56:39 / svestkap"
+!
+
+testDeleteSubKeyNamed_Wow64_64
+ "Testing deleting of empty subKey via deleteSubKeyNamed: (only on x64 systems)
+ Wow subsystem enables running 32bit applications on 64bit windows"
+ | returnValue testingRegistryPath |
+
+ self skipIf: (OperatingSystem getSystemInfo at: #architecture) ~= #x64 description: 'Test only for x64 architecture'.
+
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+
+ "/ if successfully deteted -> true
+ returnValue := testingRegistryPath deleteSubKeyNamed: ' ルすしか_empty' flags:#KEY_WOW64_64KEY.
+ self assert: returnValue
+
+ "
+ self run:#testDeleteSubKeyNamed_Wow64_64
+ self new testDeleteSubKeyNamed_Wow64_64
+ "
+
+ "Created: / 07-12-2018 / 14:55:03 / svestkap"
+!
+
+testDeleteValueNamed_REG_BINARY
+ "Testing if REG_BINARY value name is correctly deleted via deleteValueNamed:"
+
+ | readData testingRegistryPath registryValueName deleteResult |
+
+ readData := Unicode16String new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: (registryPath, '\', ' ルすしか').
+ registryValueName := 'non-zero'.
+
+ readData := testingRegistryPath valueNamed: registryValueName.
+ self assert: readData notEmptyOrNil.
+
+ deleteResult := testingRegistryPath deleteValueNamed: registryValueName.
+ self assert: deleteResult.
+
+ readData := testingRegistryPath valueNamed: registryValueName.
+ self assert: readData isEmptyOrNil
+
+ "
+ self run:#testDeleteValueNamed_REG_BINARY
+ self new testDeleteValueNamed_REG_BINARY
+ "
+
+ "Created: / 06-12-2018 / 13:56:35 / svestkap"
+ "Modified: / 07-12-2018 / 09:50:41 / svestkap"
+!
+
+testDeleteValueNamed_REG_DWORD
+ "Testing if REG_DWORD value name is correctly deleted via deleteValueNamed:"
+
+ | readData testingRegistryPath registryValueName deleteResult |
+
+ readData := Unicode16String new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: (registryPath, '\', ' ルすしか').
+ registryValueName := 'dword_value'.
+
+ readData := testingRegistryPath valueNamed: registryValueName.
+ self assert: readData notEmptyOrNil.
+
+ deleteResult := testingRegistryPath deleteValueNamed: registryValueName.
+ self assert: deleteResult.
+
+ readData := testingRegistryPath valueNamed: registryValueName.
+ self assert: readData isEmptyOrNil
+
+ "
+ self run:#testDeleteValueNamed_REG_DWORD
+ self new testDeleteValueNamed_REG_DWORD
+ "
+
+ "Created: / 06-12-2018 / 09:09:24 / svestkap"
+ "Modified: / 06-12-2018 / 13:59:57 / svestkap"
+!
+
+testDeleteValueNamed_REG_EXPAND_SZ
+ "Testing if REG_EXPAND_SZ value name is correctly deleted via deleteValueNamed:"
+
+ | readData testingRegistryPath registryValueName deleteResult |
+
+ readData := Unicode16String new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: (registryPath, '\', ' ルすしか').
+ registryValueName := ' č ルすしか'.
+
+ readData := testingRegistryPath valueNamed: registryValueName.
+ self assert: readData notEmptyOrNil.
+
+ deleteResult := testingRegistryPath deleteValueNamed: registryValueName.
+ self assert: deleteResult.
+
+ readData := testingRegistryPath valueNamed: registryValueName.
+ self assert: readData isEmptyOrNil
+
+ "
+ self run:#testDeleteValueNamed_REG_EXPAND_SZ
+ self new testDeleteValueNamed_REG_EXPAND_SZ
+ "
+
+ "Created: / 06-12-2018 / 13:54:53 / svestkap"
+!
+
+testDeleteValueNamed_REG_QWORD
+ "Testing if REG_QWORD value name is correctly deleted via deleteValueNamed:"
+
+ | readData testingRegistryPath registryValueName deleteResult |
+
+ readData := Unicode16String new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: (registryPath, '\', ' ルすしか').
+ registryValueName := 'qword_max'.
+
+ readData := testingRegistryPath valueNamed: registryValueName.
+ self assert: readData notEmptyOrNil.
+
+ deleteResult := testingRegistryPath deleteValueNamed: registryValueName.
+ self assert: deleteResult.
+
+ readData := testingRegistryPath valueNamed: registryValueName.
+ self assert: readData isEmptyOrNil
+
+ "
+ self run:#testDeleteValueNamed_REG_QWORD
+ self new testDeleteValueNamed_REG_QWORD
+ "
+
+ "Created: / 06-12-2018 / 13:55:46 / svestkap"
+!
+
+testDeleteValueNamed_REG_SZ
+ "Testing if REG_SZ value name is correctly deleted via deleteValueNamed:"
+
+ | readData testingRegistryPath registryValueName deleteResult |
+
+ readData := Unicode16String new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: (registryPath, '\', ' ルすしか').
+ registryValueName := ' ř ž č ル. '.
+
+ readData := testingRegistryPath valueNamed: registryValueName.
+ self assert: readData notEmptyOrNil.
+
+ deleteResult := testingRegistryPath deleteValueNamed: registryValueName.
+ self assert: deleteResult.
+
+ readData := testingRegistryPath valueNamed: registryValueName.
+ self assert: readData isEmptyOrNil
+
+ "
+ self run:#testDeleteValueNamed_REG_SZ
+ self new testDeleteValueNamed_REG_SZ
+ "
+
+ "Created: / 06-12-2018 / 13:52:51 / svestkap"
+!
+
+testDeleteValueNamed_defaultValue_01
+ "Testing if (Default) value gets correctly deleted via deleteValueNamed:"
+
+ | readData registryValueName testingRegistryPath deleteResult|
+
+ readData := Unicode16String new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ registryValueName := ''.
+
+ readData := testingRegistryPath valueNamed: registryValueName.
+ self assert: readData notEmptyOrNil.
+ self assert: readData = 'しか OMG'.
+
+ deleteResult := testingRegistryPath deleteValueNamed: registryValueName.
+ self assert: deleteResult.
+
+ readData := testingRegistryPath valueNamed: registryValueName.
+ self assert: readData isEmptyOrNil
+
+ "
+ self run:#testDeleteValueNamed_defaultValue_01
+ self new testDeleteValueNamed_defaultValue_01
+ "
+
+ "Created: / 06-12-2018 / 14:04:16 / svestkap"
+!
+
+testDeleteValueNamed_defaultValue_02
+ "Testing if deleting (Default) empty gets false via deleteValueNamed:"
+
+ | readData registryValueName testingRegistryPath deleteResult|
+
+ readData := Unicode16String new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: (registryPath, '\', ' ルすしか').
+ registryValueName := ''.
+
+ readData := testingRegistryPath valueNamed: registryValueName.
+ self assert: readData isEmptyOrNil.
+
+ deleteResult := testingRegistryPath deleteValueNamed: registryValueName.
+ self assert: deleteResult not.
+
+ "
+ self run:#testDeleteValueNamed_defaultValue_02
+ self new testDeleteValueNamed_defaultValue_02
+ "
+
+ "Created: / 06-12-2018 / 14:01:38 / svestkap"
+!
+
+testDeleteValueNamed_nonStringVAlue
+ "Testing if trying to delete a non-string value results into returning false
+ and user should see in Transcript a warning message"
+
+ | testingRegistryPath registryValueName |
+
+ testingRegistryPath := Win32OperatingSystem registryEntry key: (registryPath, '\', ' ルすしか').
+ registryValueName := 11.
+
+ self should: [ testingRegistryPath deleteValueNamed: registryValueName ] raise: Error
+
+
+ "
+ self run:#testDeleteValueNamed_nonStringVAlue
+ self new testDeleteValueNamed_nonStringVAlue
+ "
+
+ "Created: / 06-12-2018 / 14:10:18 / svestkap"
+ "Modified: / 07-12-2018 / 09:34:38 / svestkap"
+! !
+
+!Win32OperatingSystemTest methodsFor:'tests-unicodeDeleteEnumeration'!
+
+testDeleteSubKeyNamed_deletingMultipleSubKeys
+ "Testing deleting whole tree of subKeys based on subKey path size via deleteSubKeyNamed:"
+
+ | readData returnValue testingRegistryPath |
+
+ readData := OrderedDictionary new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: (registryPath, '\', ' ルすしか_testing_delete').
+
+ testingRegistryPath allSubKeysDo: [ :subEntry |
+ readData at: subEntry path put: subEntry
+ ].
+
+ "/ sorting based on path size
+ readData sort: [ :firstRegistryPath :secondRegistryPath |
+ firstRegistryPath size < secondRegistryPath size
+ ].
+
+ "/ sorting the path size (max -> min)
+ readData reverse.
+
+ "/ deleting all the subKeys (even those that have some value names!!)
+ readData valuesDo: [ :registryEntry |
+ | tempRegistryEntry |
+ tempRegistryEntry := Win32OperatingSystem registryEntry key: (registryEntry path copyUpToLast: $\).
+ returnValue := tempRegistryEntry deleteSubKeyNamed: (registryEntry path copyAfterLast: $\).
+ self assert: returnValue
+ ].
+
+ "/ if successfully deteted -> true
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ returnValue := testingRegistryPath deleteSubKeyNamed: ' ルすしか_testing_delete'.
+ self assert: returnValue
+
+ "
+ self run:#testDeleteSubKeyNamed
+ self new testDeleteSubKeyNamed
+ "
+
+ "Created: / 07-12-2018 / 10:54:34 / svestkap"
+! !
+
!Win32OperatingSystemTest methodsFor:'tests-unicodeRead'!
testReadSubKeyAtIndex_01
@@ -849,6 +1734,983 @@
"Created: / 16-11-2018 / 12:16:16 / svestkap"
! !
+!Win32OperatingSystemTest methodsFor:'tests-unicodeWrite'!
+
+testDefaultValue_01
+ "Testing if value can be stored (defaultValue:) and read (defaultValue)
+ Note: the value is stored in (Default) value at the key"
+
+ | testingRegistryPath readData |
+
+ registryPath := registryPath, '\', ' ルすしか'.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+
+ readData := testingRegistryPath defaultValue.
+ self assert: readData isNil.
+
+ testingRegistryPath defaultValue: 'すし.ACE.OLEDB.16.0'.
+
+ readData := testingRegistryPath defaultValue.
+ self assert: readData = 'すし.ACE.OLEDB.16.0'.
+
+ "
+ self run:#testDefaultValue_01
+ self new testDefaultValue_01
+ "
+
+ "Created: / 12-12-2018 / 12:35:53 / svestkap"
+!
+
+testDefaultValue_02
+ "Testing if value can be stored (defaultValue:) and read (defaultValue) with registry type and size check
+ Note: the value is stored in (Default) value at the key"
+
+ | testingRegistryPath registryType readData |
+
+ registryPath := registryPath, '\', ' ルすしか'.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+
+ readData := testingRegistryPath defaultValue.
+ self assert: readData isNil.
+
+ testingRegistryPath defaultValue: 'すし.ACE.OLEDB.16.0'.
+
+ registryType := testingRegistryPath valueTypeAndSize: ''.
+ self assert: registryType keys first isSymbol.
+ self assert: registryType keys first equals: #REG_SZ.
+ self assert: registryType first isNumber.
+ self assert: registryType first equals: 17.
+
+
+ readData := testingRegistryPath defaultValue.
+
+ self assert: readData = 'すし.ACE.OLEDB.16.0'.
+
+ "
+ self run:#testDefaultValue_02
+ self new testDefaultValue_02
+ "
+
+ "Created: / 12-12-2018 / 11:07:11 / svestkap"
+ "Modified: / 12-12-2018 / 14:08:14 / svestkap"
+!
+
+testWriteValueNamedPut_REG_BINARY_01
+ "Testing if REG_BINARY zero value is written correctly via valueNamed:put:
+ Data is written and read back again."
+
+ | testingRegistryPath readData |
+
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ testingRegistryPath valueNamed: 'non-zero' put: ByteArray new.
+
+ readData := testingRegistryPath valueNamed: 'non-zero'.
+
+ self assert: readData = ByteArray new.
+
+ "
+ self run:#testWriteValueNamedPut_REG_BINARY_01
+ self new testWriteValueNamedPut_REG_BINARY_01
+ "
+
+ "Created: / 04-12-2018 / 11:52:46 / svestkap"
+ "Modified (format): / 05-12-2018 / 12:45:43 / svestkap"
+!
+
+testWriteValueNamedPut_REG_BINARY_02
+ "Testing if REG_BINARY values are written correctly via valueNamed:put:
+ Data is written and read back again."
+
+ | testingRegistryPath byteArray readData readDataHex |
+
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+
+ readData := testingRegistryPath valueNamed: 'non-zero'.
+ self assert: readData = #[17 16].
+
+ byteArray := ByteArray new: 5.
+ "/ data to be written
+ byteArray replaceElementsFrom: 1 to: 5 withArray: #[18 234 11 0 18] startingAt: 1.
+
+ testingRegistryPath valueNamed: 'non-zero' put: byteArray.
+
+ readData := testingRegistryPath valueNamed: 'non-zero'.
+ readDataHex := readData hexPrintStringWithSeparator: $|.
+
+ self assert: readData = #[18 234 11 0 18]. "/ ByteArray
+ self assert: readDataHex = '12|EA|0B|00|12' "/ hex
+
+ "
+ self run:#testWriteValueNamedPut_REG_BINARY_02
+ self new testWriteValueNamedPut_REG_BINARY_02
+ "
+
+ "Created: / 04-12-2018 / 12:04:18 / svestkap"
+ "Modified: / 12-12-2018 / 13:15:23 / svestkap"
+!
+
+testWriteValueNamedPut_REG_BINARY_03
+ "Testing if new REG_BINARY value name is written correctly via valueNamed:put:
+ Data is written and read back again."
+
+ | testingRegistryPath byteArray readData readDataHex |
+
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+
+ byteArray := ByteArray new: 5.
+ "/ data to be written
+ byteArray replaceElementsFrom: 1 to: 5 withArray: #[18 234 11 0 18] startingAt: 1.
+
+ testingRegistryPath valueNamed: 'Binaryル' put: byteArray.
+
+ readData := testingRegistryPath valueNamed: 'Binaryル'.
+ readDataHex := readData hexPrintStringWithSeparator: $|.
+
+ self assert: readData = #[18 234 11 0 18]. "/ ByteArray
+ self assert: readDataHex = '12|EA|0B|00|12' "/ hex
+
+ "
+ self run:#testWriteValueNamedPut_REG_BINARY_03
+ self new testWriteValueNamedPut_REG_BINARY_03
+ "
+
+ "Created: / 07-12-2018 / 15:15:06 / svestkap"
+!
+
+testWriteValueNamedPut_REG_BINARY_04
+ "Testing if new REG_BINARY value name is written correctly via valueNamed:put: with registry type and size check
+ Data is written and read back again."
+
+ | testingRegistryPath byteArray readData readDataHex registryType |
+
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+
+ byteArray := ByteArray new: 5.
+ "/ data to be written
+ byteArray replaceElementsFrom: 1 to: 5 withArray: #[18 234 11 0 18] startingAt: 1.
+
+ testingRegistryPath valueNamed: 'Binaryル' put: byteArray.
+
+ registryType := testingRegistryPath valueTypeAndSize: 'Binaryル'.
+ self assert: registryType keys first equals: #REG_BINARY.
+ self assert: registryType first equals: 5.
+
+ readData := testingRegistryPath valueNamed: 'Binaryル'.
+ readDataHex := readData hexPrintStringWithSeparator: $|.
+
+ self assert: readData = #[18 234 11 0 18]. "/ ByteArray
+ self assert: readDataHex = '12|EA|0B|00|12' "/ hex
+
+ "
+ self run:#testWriteValueNamedPut_REG_BINARY_04
+ self new testWriteValueNamedPut_REG_BINARY_04
+ "
+
+ "Created: / 12-12-2018 / 12:36:46 / svestkap"
+!
+
+testWriteValueNamedPut_REG_BINARY_05
+ "Testing if REG_BINARY values are written correctly via valueNamed:put:
+ Data is written and read back again."
+
+ | testingRegistryPath byteArray readData readDataHex registryType |
+
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+
+ readData := testingRegistryPath valueNamed: 'non-zero'.
+ self assert: readData = #[17 16].
+ registryType := testingRegistryPath valueTypeAndSize: 'non-zero'.
+ self assert: registryType keys first equals: #REG_BINARY.
+ self assert: registryType first equals: 2.
+
+ byteArray := ByteArray new: 5.
+ "/ data to be written
+ byteArray replaceElementsFrom: 1 to: 5 withArray: #[18 234 11 0 18] startingAt: 1.
+ "/ saving value into registry
+ testingRegistryPath valueNamed: 'non-zero' put: byteArray.
+
+ "/ testing the saved value
+ registryType := testingRegistryPath valueTypeAndSize: 'non-zero'.
+ self assert: registryType keys first equals: #REG_BINARY.
+ self assert: registryType first equals: 5.
+
+ readData := testingRegistryPath valueNamed: 'non-zero'.
+ readDataHex := readData hexPrintStringWithSeparator: $|.
+
+ self assert: readData = #[18 234 11 0 18]. "/ ByteArray
+ self assert: readDataHex = '12|EA|0B|00|12' "/ hex
+
+ "
+ self run:#testWriteValueNamedPut_REG_BINARY_05
+ self new testWriteValueNamedPut_REG_BINARY_05
+ "
+
+ "Created: / 12-12-2018 / 13:16:13 / svestkap"
+!
+
+testWriteValueNamedPut_REG_DWORD_01
+ "Testing if REG_DWORD values are written correctly via valueNamed:put:"
+
+ | readData testingRegistryPath |
+
+ readData := Integer new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ readData := testingRegistryPath valueNamed: 'dword_value'.
+ self assert: readData = 9135. "/ the previous value
+
+ testingRegistryPath valueNamed: 'dword_value' put: 7337.
+ readData := testingRegistryPath valueNamed: 'dword_value'.
+
+ self assert: readData = 7337. "/ the new value
+
+ "
+ self run:#testWriteValueNamedPut_REG_DWORD_01
+ self new testWriteValueNamedPut_REG_DWORD_01
+ "
+
+ "Created: / 05-12-2018 / 11:35:52 / svestkap"
+ "Modified (comment): / 12-12-2018 / 13:07:15 / svestkap"
+!
+
+testWriteValueNamedPut_REG_DWORD_02
+ "Testing if max DWORD is accepted as REG_DWORD (written correctly via valueNamed:put:)"
+
+ | readData testingRegistryPath |
+
+ readData := Integer new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ "/ max DWORD value 0xffffffff -> 4294967295 (which is on x64 SmallInteger)
+ testingRegistryPath valueNamed: 'dword_value' put: 4294967295.
+ readData := testingRegistryPath valueNamed: 'dword_value'.
+
+ self assert: readData = 4294967295.
+
+ "
+ self run:#testWriteValueNamedPut_REG_DWORD_02
+ self new testWriteValueNamedPut_REG_DWORD_02
+ "
+
+ "Created: / 05-12-2018 / 11:36:00 / svestkap"
+ "Modified: / 07-12-2018 / 15:13:42 / svestkap"
+!
+
+testWriteValueNamedPut_REG_DWORD_03
+ "Testing if REG_DWORD values are written correctly via valueNamed:put:
+ Data is written and read back again."
+
+ | readData testingRegistryPath |
+
+ readData := Integer new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ testingRegistryPath valueNamed: '11' put: 7337.
+ readData := testingRegistryPath valueNamed: '11'.
+
+ self assert: readData = 7337
+
+ "
+ self run:#testWriteValueNamedPut_REG_DWORD_03
+ self new testWriteValueNamedPut_REG_DWORD_03
+ "
+
+ "Created: / 05-12-2018 / 11:35:36 / svestkap"
+ "Modified (format): / 07-12-2018 / 15:14:33 / svestkap"
+!
+
+testWriteValueNamedPut_REG_DWORD_04
+ "Testing if REG_DWORD values are written correctly via valueNamed:put:
+ Data is written and read back again."
+
+ | readData testingRegistryPath |
+
+ readData := Integer new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ testingRegistryPath valueNamed: '11' put: 7337.
+ readData := testingRegistryPath valueNamed: '11'.
+
+ self assert: readData = 7337
+
+ "
+ self run:#testWriteValueNamedPut_REG_DWORD_04
+ self new testWriteValueNamedPut_REG_DWORD_04
+ "
+
+ "Created: / 05-12-2018 / 11:39:00 / svestkap"
+ "Modified (format): / 07-12-2018 / 15:14:24 / svestkap"
+!
+
+testWriteValueNamedPut_REG_DWORD_05
+ "Testing if REG_DWORD values are written correctly via valueNamed:put:
+ Data is written and read back again.
+ Note: user should see a warning message on Transcript"
+
+ | readData testingRegistryPath |
+
+ readData := Unicode16String new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+
+ readData := testingRegistryPath valueNamed: '11'.
+ self assert: readData = 'A number name'.
+
+ self should: [ testingRegistryPath valueNamed: 11 put: 7337] raise: Error.
+ self assert: readData = 'A number name'.
+
+ "
+ self run:#testWriteValueNamedPut_REG_DWORD_05
+ self new testWriteValueNamedPut_REG_DWORD_05
+ "
+
+ "Created: / 05-12-2018 / 12:29:06 / svestkap"
+ "Modified (format): / 07-12-2018 / 09:36:30 / svestkap"
+!
+
+testWriteValueNamedPut_REG_DWORD_06
+ "Testing if new REG_DWORD value name is written correctly via valueNamed:put:
+ Data is written and read back again."
+
+ | readData testingRegistryPath |
+
+ readData := Integer new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ testingRegistryPath valueNamed: '374657654ル' put: 7337.
+ readData := testingRegistryPath valueNamed: '374657654ル'.
+
+ self assert: readData = 7337
+
+ "
+ self run:#testWriteValueNamedPut_REG_DWORD_06
+ self new testWriteValueNamedPut_REG_DWORD_06
+ "
+
+ "Created: / 07-12-2018 / 15:10:24 / svestkap"
+!
+
+testWriteValueNamedPut_REG_DWORD_07
+ "Testing if REG_DWORD values are written correctly via valueNamed:put: with registry type and size check"
+
+ | readData testingRegistryPath registryType endianness |
+
+ readData := Integer new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+
+ "/ checking registry type and size
+ registryType := testingRegistryPath valueTypeAndSize: 'dword_value'.
+ registryType keys first == #REG_DWORD_LITTLE_ENDIAN ifTrue: [
+ self assert: registryType keys first equals: #REG_DWORD_LITTLE_ENDIAN.
+ endianness := #REG_DWORD_LITTLE_ENDIAN
+ ] ifFalse: [
+ self assert: registryType keys first equals: #REG_DWORD_BIG_ENDIAN.
+ endianness := #REG_DWORD_BIG_ENDIAN
+ ].
+ self assert: registryType first equals: 4. "/ 32 bits = 4 bytes
+ "/ read data
+ readData := testingRegistryPath valueNamed: 'dword_value'.
+ self assert: readData = 9135. "/ the previous value
+
+ "/ inserting new value
+ testingRegistryPath valueNamed: 'dword_value' put: 7337.
+
+ "/ checking registry type and size
+ registryType := testingRegistryPath valueTypeAndSize: 'dword_value'.
+ self assert: registryType keys first equals: endianness.
+ self assert: registryType first equals: 4. "/ 32 bits = 4 bytes
+
+ "/ read data
+ readData := testingRegistryPath valueNamed: 'dword_value'.
+ self assert: readData = 7337.
+
+ "
+ self run:#testWriteValueNamedPut_REG_DWORD_07
+ self new testWriteValueNamedPut_REG_DWORD_07
+ "
+
+ "Created: / 12-12-2018 / 12:13:53 / svestkap"
+!
+
+testWriteValueNamedPut_REG_EXPAND_SZ_01
+ "Testing if REG_EXPAND_SZ values are written correctly via valueNamed:put:
+ Data is written and read back again."
+
+ | readData testingRegistryPath |
+
+ readData := Unicode16String new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ testingRegistryPath valueNamed: 'bledesu' put: '"%PATH%"' unexpandedReferences: true.
+ readData := testingRegistryPath valueNamed: 'bledesu'.
+
+ self assert: readData = '"%PATH%"'
+
+ "
+ self run:#testWriteValueNamedPut_REG_EXPAND_SZ_01
+ self new testWriteValueNamedPut_REG_EXPAND_SZ_01
+ "
+
+ "Created: / 07-12-2018 / 15:08:50 / svestkap"
+!
+
+testWriteValueNamedPut_REG_EXPAND_SZ_02
+ "Testing if new REG_EXPAND_SZ value name is written correctly via valueNamed:put:
+ Data is written and read back again."
+
+ | readData testingRegistryPath |
+
+ readData := Unicode16String new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ testingRegistryPath valueNamed: 'Yooooル' put: '"%PATH%"' unexpandedReferences: true.
+ readData := testingRegistryPath valueNamed: 'Yooooル'.
+
+ self assert: readData = '"%PATH%"'
+
+ "
+ self run:#testWriteValueNamedPut_REG_EXPAND_SZ_02
+ self new testWriteValueNamedPut_REG_EXPAND_SZ_02
+ "
+
+ "Created: / 07-12-2018 / 15:09:14 / svestkap"
+!
+
+testWriteValueNamedPut_REG_EXPAND_SZ_03
+ "Testing if new REG_EXPAND_SZ value name is written correctly via valueNamed:put: with registry type and size check
+ Data is written and read back again."
+
+ | readData testingRegistryPath registryType |
+
+ readData := Unicode16String new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ testingRegistryPath valueNamed: 'Yooooル' put: '"%PATH%"' unexpandedReferences: true.
+
+ registryType := testingRegistryPath valueTypeAndSize: 'Yooooル'.
+ self assert: registryType keys first equals: #REG_EXPAND_SZ.
+ self assert: registryType first equals: 8.
+
+ readData := testingRegistryPath valueNamed: 'Yooooル'.
+ self assert: readData = '"%PATH%"'
+
+ "
+ self run:#testWriteValueNamedPut_REG_EXPAND_SZ_03
+ self new testWriteValueNamedPut_REG_EXPAND_SZ_03
+ "
+
+ "Created: / 12-12-2018 / 12:41:44 / svestkap"
+!
+
+testWriteValueNamedPut_REG_EXPAND_SZ_04
+ "Testing if REG_EXPAND_SZ values are written correctly via valueNamed:put: with registry type and size check
+ Data is written and read back again (notice the registry type change #REG_SZ to #REG_EXPAND_SZ)."
+
+ | readData testingRegistryPath registryType |
+
+ readData := Unicode16String new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ "/ checking type and size
+ registryType := testingRegistryPath valueTypeAndSize: 'bledesu'.
+ self assert: registryType keys first equals: #REG_SZ.
+ self assert: registryType first equals: 47.
+ "/ checking the actual value
+ readData := testingRegistryPath valueNamed: 'bledesu'.
+ self assert: readData = '''Testing Unicode chars ř ž č ルすしかき''). '.
+
+ "/ saving value into the registry
+ testingRegistryPath valueNamed: 'bledesu' put: '"%PATH%"' unexpandedReferences: true.
+ "/ checking type and size
+ registryType := testingRegistryPath valueTypeAndSize: 'bledesu'.
+ self assert: registryType keys first equals: #REG_EXPAND_SZ.
+ self assert: registryType first equals: 8.
+ "/ checking the actual value
+ readData := testingRegistryPath valueNamed: 'bledesu'.
+ self assert: readData = '"%PATH%"'
+
+ "
+ self run:#testWriteValueNamedPut_REG_EXPAND_SZ_04
+ self new testWriteValueNamedPut_REG_EXPAND_SZ_04
+ "
+
+ "Created: / 12-12-2018 / 13:22:25 / svestkap"
+!
+
+testWriteValueNamedPut_REG_MULTI_SZ_01
+ "Testing if REG_MULTI_SZ values are write correctly via valueNamed:put:"
+
+ | readData testingRegistryPath |
+
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ testingRegistryPath valueNamed: 'Font_Leelawadee UI Bold' put: #('SEGOEUIB.TTF,Segoe UI Bold,110,82' 'řeřicha - ルすしかき').
+ readData := testingRegistryPath valueNamed: 'Font_Leelawadee UI Bold'.
+
+ self assert: readData = #('SEGOEUIB.TTF,Segoe UI Bold,110,82' 'řeřicha - ルすしかき').
+
+ "
+ self run:#testWriteValueNamedPut_REG_MULTI_SZ_01
+ self new testWriteValueNamedPut_REG_MULTI_SZ_01
+ "
+
+ "Created: / 27-11-2018 / 09:29:57 / svestkap"
+ "Modified (format): / 07-12-2018 / 15:17:03 / svestkap"
+!
+
+testWriteValueNamedPut_REG_MULTI_SZ_02
+ "Testing if REG_MULTI_SZ values are write correctly via valueNamed:put:
+ The value data could be up to available memory (in reality NOT recommended to go over 1MB).
+ Testing here a 2^16 + 2 sized OrderedCollection (a reasonable compromize between size and speed)"
+
+ | testingRegistryPath testData testDataArray readData |
+
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ testData := OrderedCollection new.
+
+ "/ testing 2^15 + 1 which should be
+ "/ 2^15 + 1 timeRepeat -> testData OrderedCollection size should be: 2^16 + 1 (65538)
+ 32769 timesRepeat: [ testData add: 'SEGOEUIB.TTF,Segoe UI Bold,110,82'.
+ testData add: 'řeřicha - ルすしかき'
+ ].
+
+ testDataArray := testData asArray.
+ "/ storing the array
+ testingRegistryPath valueNamed: 'ř ž č ルすしか' put: testDataArray.
+ "/ reading the stored array back
+ readData := testingRegistryPath valueNamed: 'ř ž č ルすしか'.
+
+ self assert: readData = testDataArray.
+
+ "
+ self run:#testWriteValueNamedPut_REG_MULTI_SZ_02
+ self new testWriteValueNamedPut_REG_MULTI_SZ_02
+ "
+
+ "Created: / 28-11-2018 / 14:46:55 / svestkap"
+ "Modified (comment): / 03-12-2018 / 09:56:15 / svestkap"
+!
+
+testWriteValueNamedPut_REG_MULTI_SZ_03
+ "Testing if REG_MULTI_SZ values are write correctly via valueNamed:put:"
+
+ | readData testingRegistryPath |
+
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ testingRegistryPath valueNamed: 'Font_Leelawadee UI Bold' put: Array new.
+ readData := testingRegistryPath valueNamed: 'Font_Leelawadee UI Bold'.
+
+ self assert: readData isEmpty.
+ self assert: readData isArray.
+
+ "
+ self run:#testWriteValueNamedPut_REG_MULTI_SZ_03
+ self new testWriteValueNamedPut_REG_MULTI_SZ_03
+ "
+
+ "Created: / 05-12-2018 / 11:54:05 / svestkap"
+ "Modified (format): / 07-12-2018 / 15:17:15 / svestkap"
+!
+
+testWriteValueNamedPut_REG_MULTI_SZ_04
+ "Testing if new REG_MULTI_SZ value name is written correctly via valueNamed:put:"
+
+ | readData testingRegistryPath |
+
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ testingRegistryPath valueNamed: 'new_reg_multiル' put: #('SEGOEUIB.TTF,Segoe UI Bold,110,82' 'řeřicha - ルすしかき').
+ readData := testingRegistryPath valueNamed: 'new_reg_multiル'.
+
+ self assert: readData = #('SEGOEUIB.TTF,Segoe UI Bold,110,82' 'řeřicha - ルすしかき').
+
+ "
+ self run:#testWriteValueNamedPut_REG_MULTI_SZ_04
+ self new testWriteValueNamedPut_REG_MULTI_SZ_04
+ "
+
+ "Created: / 07-12-2018 / 15:08:03 / svestkap"
+!
+
+testWriteValueNamedPut_REG_MULTI_SZ_05
+ "Testing if REG_MULTI_SZ values are write correctly via valueNamed:put: with registry type and size check"
+
+ | registryType readData testingRegistryPath |
+
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ testingRegistryPath valueNamed: 'Font_Leelawadee UI Bold' put: #('SEGOEUIB.TTF,Segoe UI Bold,110,82' 'řeřicha - ルすしかき').
+ readData := testingRegistryPath valueNamed: 'Font_Leelawadee UI Bold'.
+
+ self assert: readData = #('SEGOEUIB.TTF,Segoe UI Bold,110,82' 'řeřicha - ルすしかき').
+
+ registryType := testingRegistryPath valueTypeAndSize: 'Font_Leelawadee UI Bold'.
+ self assert: registryType keys first equals: #REG_MULTI_SZ.
+
+ "/ (array node size + terminating null) + (array node size + terminating null) * sizeof(wchar_t) + terminating null
+ "/ ((Array at: 1) size + 1) + ((Array at: 2) size + 1) * 2 + 1 = (34 + 16) * 2 + 1 = 101
+ self assert: (registryType at: #REG_MULTI_SZ) equals: 101.
+ "
+ self run:#testWriteValueNamedPut_REG_MULTI_SZ_05
+ self new testWriteValueNamedPut_REG_MULTI_SZ_05
+ "
+
+ "Created: / 12-12-2018 / 11:34:08 / svestkap"
+ "Modified (comment): / 12-12-2018 / 12:59:04 / svestkap"
+!
+
+testWriteValueNamedPut_REG_NONE_01
+ "Testing if REG_NONE values are written correctly via valueNamed:put:
+ Data is written and read back again."
+
+ | readData testingRegistryPath |
+
+ readData := Unicode16String new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ testingRegistryPath valueNamed: 'bledesu' put: nil.
+ readData := testingRegistryPath valueNamed: 'bledesu'.
+
+ self assert: readData isNil
+
+ "
+ self run:#testWriteValueNamedPut_REG_NONE_01
+ self new testWriteValueNamedPut_REG_NONE_01
+ "
+
+ "Created: / 07-12-2018 / 15:06:08 / svestkap"
+!
+
+testWriteValueNamedPut_REG_NONE_02
+ "Testing if new REG_NONE value name is written correctly via valueNamed:put:
+ Data is written and read back again."
+
+ | readData testingRegistryPath |
+
+ readData := Unicode16String new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ testingRegistryPath valueNamed: 'New nilル name' put: nil.
+ readData := testingRegistryPath valueNamed: 'New nilル name'.
+
+ self assert: readData isNil
+
+ "
+ self run:#testWriteValueNamedPut_REG_NONE_02
+ self new testWriteValueNamedPut_REG_NONE_02
+ "
+
+ "Created: / 07-12-2018 / 15:06:48 / svestkap"
+!
+
+testWriteValueNamedPut_REG_NONE_03
+ "Testing if new REG_NONE value name is written correctly via valueNamed:put: with registry type and size check
+ Data is written and read back again."
+
+ | readData testingRegistryPath registryType |
+
+ readData := Unicode16String new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ testingRegistryPath valueNamed: 'New nilル name' put: nil.
+
+ registryType := testingRegistryPath valueTypeAndSize: 'New nilル name'.
+ self assert: registryType keys first equals: #REG_NONE.
+ self assert: registryType first equals: 0.
+
+ readData := testingRegistryPath valueNamed: 'New nilル name'.
+
+ self assert: readData isNil
+
+ "
+ self run:#testWriteValueNamedPut_REG_NONE_03
+ self new testWriteValueNamedPut_REG_NONE_03
+ "
+
+ "Created: / 12-12-2018 / 12:47:40 / svestkap"
+!
+
+testWriteValueNamedPut_REG_QWORD_01
+ "Testing if max QWORD value is written and read correctly from REG_QWORD (valueNamed:put: and valueNamed:)
+ Storing maximum QWORD value (0xffffffffffffffff -> 18446744073709551615(x64)) "
+
+ | readData testingRegistryPath |
+
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ testingRegistryPath valueNamed: 'qword_max' put: 18446744073709551615.
+ readData := testingRegistryPath valueNamed: 'qword_max'.
+
+ self assert: readData = 18446744073709551615.
+
+ "
+ self run:#testReadValueNamed_REG_QWORD_01
+ self new testReadValueNamed_REG_QWORD_01
+ "
+
+ "Created: / 26-11-2018 / 14:54:45 / svestkap"
+ "Modified: / 07-12-2018 / 15:11:56 / svestkap"
+ "Modified (comment): / 12-12-2018 / 12:58:31 / svestkap"
+!
+
+testWriteValueNamedPut_REG_QWORD_02
+ "Testing what happens if more then max value is stored in REG_QWORD registry type (valueNamed:put: and valueNamed:)"
+
+ | readData testingRegistryPath |
+
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ "/ max QWORD value is: 0xff-ff-ff-ff-ff-ff-ff-ff -> 18446744073709551615 (on x64 only)
+ testingRegistryPath valueNamed: 'qword_max' put: 18446744073709551700.
+ readData := testingRegistryPath valueNamed: 'qword_max'.
+
+ self assert: readData ~= 18446744073709551700.
+ "/ when you try to store more than maximum value you will get only the maximum losing the rest
+ self assert: readData = 18446744073709551615.
+
+ "
+ self run:#testWriteValueNamedPut_REG_QWORD_02
+ self new testWriteValueNamedPut_REG_QWORD_02
+ "
+
+ "Created: / 04-12-2018 / 11:02:20 / svestkap"
+ "Modified: / 07-12-2018 / 15:12:12 / svestkap"
+!
+
+testWriteValueNamedPut_REG_QWORD_03
+ "Testing if new QWORD value name is written and read correctly from REG_QWORD (valueNamed:put: and valueNamed:)"
+
+ | readData testingRegistryPath |
+
+ readData := Unicode16String new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ testingRegistryPath valueNamed: 'qword_new_testingル' put: 18446744073709551101.
+ readData := testingRegistryPath valueNamed: 'qword_new_testingル'.
+
+ self assert: readData = 18446744073709551101.
+
+ "
+ self run:#testWriteValueNamedPut_REG_QWORD_03
+ self new testWriteValueNamedPut_REG_QWORD_03
+ "
+
+ "Created: / 07-12-2018 / 15:05:48 / svestkap"
+!
+
+testWriteValueNamedPut_REG_QWORD_04
+ "Testing if max QWORD value is written and read correctly from REG_QWORD (valueNamed:put: and valueNamed:)
+ with registry type and size check
+ Storing maximum QWORD value (0xffffffffffffffff -> 18446744073709551615(x64)) "
+
+ | readData testingRegistryPath registryType |
+
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ testingRegistryPath valueNamed: 'qword_max' put: 18446744073709551615.
+ readData := testingRegistryPath valueNamed: 'qword_max'.
+
+ registryType := testingRegistryPath valueTypeAndSize: 'qword_max'.
+ self assert: registryType keys first equals: #REG_QWORD.
+ self assert: registryType first equals: 8. "/ 64 bits = 8 bytes
+
+ self assert: readData = 18446744073709551615.
+
+ "
+ self run:#testWriteValueNamedPut_REG_QWORD_04
+ self new testWriteValueNamedPut_REG_QWORD_04
+ "
+
+ "Created: / 12-12-2018 / 12:08:35 / svestkap"
+!
+
+testWriteValueNamedPut_REG_QWORD_05
+ "Testing if max QWORD value is written and read correctly from REG_QWORD (valueNamed:put: and valueNamed:)
+ with registry type and size check. Notice the #REG_SZ -> #REG_QWORD change
+ Storing maximum QWORD value (0xffffffffffffffff -> 18446744073709551615(x64)) "
+
+ | readData testingRegistryPath registryType |
+
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ "/ checking type and size
+ registryType := testingRegistryPath valueTypeAndSize: ' ř ž č ル. '.
+ self assert: registryType keys first equals: #REG_SZ.
+ self assert: registryType first equals: 33. "/ string size
+ "/ checking the value
+ readData := testingRegistryPath valueNamed: ' ř ž č ル. '.
+ self assert: readData = 'Testing Unicode chars ř ž č ルすしかき'.
+
+ "/ saving into registry
+ testingRegistryPath valueNamed: ' ř ž č ル. ' put: 18446744073709551615.
+
+ registryType := testingRegistryPath valueTypeAndSize: ' ř ž č ル. '.
+ self assert: registryType keys first equals: #REG_QWORD.
+ self assert: registryType first equals: 8. "/ 64 bits = 8 bytes
+
+ readData := testingRegistryPath valueNamed: ' ř ž č ル. '.
+ self assert: readData = 18446744073709551615.
+
+ "
+ self run:#testWriteValueNamedPut_REG_QWORD_05
+ self new testWriteValueNamedPut_REG_QWORD_05
+ "
+
+ "Created: / 12-12-2018 / 13:38:31 / svestkap"
+!
+
+testWriteValueNamedPut_REG_SZ_01
+ "Testing if REG_SZ values are written correctly via valueNamed:put:
+ Data is written and read back again."
+
+ | readData testingRegistryPath |
+
+ readData := Unicode16String new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+
+ readData := testingRegistryPath valueNamed: 'bledesu'.
+ self assert: readData = '''Testing Unicode chars ř ž č ルすしかき''). '.
+
+ "/ saving data (unicode string) into registry
+ testingRegistryPath valueNamed: 'bledesu' put: 'řeřicha - ルすしかき'.
+
+ readData := testingRegistryPath valueNamed: 'bledesu'.
+ self assert: readData = 'řeřicha - ルすしかき'.
+
+ "
+ self run:#testWriteValueNamedPut_REG_SZ_01
+ self new testWriteValueNamedPut_REG_SZ_01
+ "
+
+ "Created: / 26-11-2018 / 09:51:58 / svestkap"
+ "Modified (comment): / 12-12-2018 / 13:53:10 / svestkap"
+!
+
+testWriteValueNamedPut_REG_SZ_02
+ "Testing if REG_SZ values are written correctly via valueNamed:put:
+ Data is written and read back again.
+ Note: this is testing Unicode with spaces - probably the worst combination"
+
+ | readData testingRegistryPath |
+
+ readData := Unicode16String new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ testingRegistryPath valueNamed: 'しかき ' put: 'řeřicha - ルすしかき'.
+ readData := testingRegistryPath valueNamed: 'しかき '.
+
+ self assert: readData = 'řeřicha - ルすしかき'.
+
+"
+ self run:#testReadValueNamed_REG_SZ_03
+ self new testReadValueNamed_REG_SZ_03
+ "
+
+ "Created: / 26-11-2018 / 14:10:35 / svestkap"
+ "Modified (format): / 07-12-2018 / 15:17:55 / svestkap"
+!
+
+testWriteValueNamedPut_REG_SZ_03
+ "Testing if REG_SZ empty value is written correctly via valueNamed:put:
+ Data is written and read back again.
+ Note: this is testing Unicode with spaces - probably the worst combination"
+
+ | readData testingRegistryPath |
+
+ readData := Unicode16String new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ testingRegistryPath valueNamed: 'しかき ' put: ''.
+ readData := testingRegistryPath valueNamed: 'しかき '.
+
+ self assert: readData = ''
+
+"
+ self run:#testWriteValueNamedPut_REG_SZ_03
+ self new testWriteValueNamedPut_REG_SZ_03
+ "
+
+ "Created: / 05-12-2018 / 10:16:59 / svestkap"
+ "Modified (format): / 07-12-2018 / 15:17:59 / svestkap"
+!
+
+testWriteValueNamedPut_REG_SZ_04
+ "Testing if REG_SZ empty value is written correctly via valueNamed:put:
+ Data is written and read back again.
+ Note: this is testing Unicode with spaces - probably the worst combination"
+
+ | readData testingRegistryPath |
+
+ readData := Unicode16String new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ testingRegistryPath valueNamed: 'bledesu' put: ''.
+ readData := testingRegistryPath valueNamed: 'bledesu'.
+
+ self assert: readData = ''
+
+"
+ self run:#testWriteValueNamedPut_REG_SZ_04
+ self new testWriteValueNamedPut_REG_SZ_04
+ "
+
+ "Created: / 05-12-2018 / 10:22:39 / svestkap"
+ "Modified (format): / 07-12-2018 / 15:18:04 / svestkap"
+!
+
+testWriteValueNamedPut_REG_SZ_05
+ "Testing if REG_SZ completely new value is written correctly via valueNamed:put:
+ Data is written and read back again."
+
+ | readData testingRegistryPath |
+
+ readData := Unicode16String new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ testingRegistryPath valueNamed: 'Newル guy' put: 'Singルing'.
+ readData := testingRegistryPath valueNamed: 'Newル guy'.
+
+ self assert: readData = 'Singルing'
+
+"
+ self run:#testWriteValueNamedPut_REG_SZ_05
+ self new testWriteValueNamedPut_REG_SZ_05
+ "
+
+ "Created: / 07-12-2018 / 15:03:05 / svestkap"
+!
+
+testWriteValueNamedPut_REG_SZ_06
+ "Testing if REG_SZ completely new value is written correctly via valueNamed:put: with registry type and size check
+ Data is written and read back again."
+
+ | readData testingRegistryPath registryType |
+
+ readData := Unicode16String new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ testingRegistryPath valueNamed: 'Newル guy' put: 'Singルing'.
+
+ registryType := testingRegistryPath valueTypeAndSize: 'Newル guy'.
+ self assert: registryType keys first equals: #REG_SZ.
+ self assert: registryType first equals: 8.
+
+ readData := testingRegistryPath valueNamed: 'Newル guy'.
+ self assert: readData = 'Singルing'
+
+"
+ self run:#testWriteValueNamedPut_REG_SZ_06
+ self new testWriteValueNamedPut_REG_SZ_06
+ "
+
+ "Created: / 12-12-2018 / 12:39:52 / svestkap"
+!
+
+testWriteValueNamedPut_REG_SZ_07
+ "Testing if REG_SZ values are written correctly via valueNamed:put: (notice the registry type change: #REG_MULTI_SZ to #REG_SZ)
+ Data is written and read back again."
+
+ | readData testingRegistryPath registryType |
+
+ readData := Unicode16String new.
+ testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath.
+ "/ reading type and size
+ registryType := testingRegistryPath valueTypeAndSize: 'ř ž č ルすしか'.
+ self assert: registryType keys first equals: #REG_MULTI_SZ.
+ self assert: registryType first equals: 974. "/ REG_MULTI_SZ size in bytes
+
+ "/ saving data (unicode string) into registry
+ testingRegistryPath valueNamed: 'bledesu' put: 'řeřicha - ルすしかき'.
+
+ registryType := testingRegistryPath valueTypeAndSize: 'bledesu'.
+ self assert: registryType keys first equals: #REG_SZ.
+ self assert: registryType first equals: 15.
+
+ readData := testingRegistryPath valueNamed: 'bledesu'.
+ self assert: readData = 'řeřicha - ルすしかき'.
+
+ "
+ self run:#testWriteValueNamedPut_REG_SZ_07
+ self new testWriteValueNamedPut_REG_SZ_07
+ "
+
+ "Created: / 12-12-2018 / 13:48:00 / svestkap"
+! !
+
!Win32OperatingSystemTest class methodsFor:'documentation'!
version