# HG changeset patch
# User Patrik Svestka <patrik.svestka@gmail.com>
# Date 1548940254 -3600
# Thu Jan 31 14:10:54 2019 +0100
# Branch jv
# Node ID ecd8104acb9a1a1355128660fc8ee8d5d6677c3f
# Parent 26642c0820c97a36c9714ffe6161b88e4eac8c43
Issue #250 User input checks - raise an error when the method parameter does not fit the requirements
- remoteKeyOnHost: changing hostName to hostNameString and added a hostNameString string check
- subKeyAtIndex: added user input check if the subKeyIndex is an integer, if not raise an error
- subKeyNameAndClassAtIndex: added user input check if the subKeyIndex is an integer, if not raise an error
- valueNameAtIndex: added user input check if the valueIndex is an integer, if not raise an error
- valueNamed: nameSring is not a string raise an error
diff -r 26642c0820c9 -r ecd8104acb9a Win32OperatingSystem.st
a
|
b
|
|
16218 | 16218 | " |
16219 | 16219 | ! |
16220 | 16220 | |
16221 | | remoteKeyOnHost:hostName |
| 16221 | remoteKeyOnHost:hostNameString |
16222 | 16222 | "return the corresponding registry entry from |
16223 | 16223 | a remote computers registry. |
16224 | 16224 | Note: The registry key must be form a predefined list defined by Microsoft." |
16225 | 16225 | |
16226 | 16226 | |hostNameUtf16Z newEntry remoteHandle errorNumber| |
16227 | | |
16228 | | hostNameUtf16Z := hostName notEmptyOrNil ifTrue:[hostName asUnicode16StringZ]. |
| 16227 | |
| 16228 | "/ checking user input |
| 16229 | hostNameString isString ifFalse:[ |
| 16230 | self error: 'hostNameString is not a string!!' |
| 16231 | ]. |
| 16232 | hostNameUtf16Z := hostNameString notEmptyOrNil ifTrue:[hostNameString asUnicode16StringZ]. |
16229 | 16233 | |
16230 | 16234 | %{ |
16231 | 16235 | HKEY myKey, remoteKey = 0; |
… |
… |
|
16309 | 16313 | |
16310 | 16314 | |subKeyName errorNumber| |
16311 | 16315 | |
| 16316 | "/ checking user input |
| 16317 | subKeyIndex isInteger ifFalse:[ |
| 16318 | self error: 'subKeyIndex is not an integer!!' |
| 16319 | ]. |
| 16320 | |
16312 | 16321 | %{ |
16313 | 16322 | /* dwIndex (subKeyIndex) |
16314 | 16323 | * The index of the subkey to retrieve. This parameter should be zero for the first call to the RegEnumKeyEx function and then |
… |
… |
|
16398 | 16407 | WARNING: subKeyIndex is 0-based!!" |
16399 | 16408 | |
16400 | 16409 | |subKeyName subKeyClassName errorNumber| |
| 16410 | |
| 16411 | "/ checking user input |
| 16412 | subKeyIndex isInteger ifFalse:[ |
| 16413 | self error: 'subKeyIndex is not an integer!!' |
| 16414 | ]. |
16401 | 16415 | |
16402 | 16416 | %{ |
16403 | 16417 | /* dwIndex (subKeyIndex) |
… |
… |
|
16705 | 16719 | |
16706 | 16720 | |valueName errorNumber| |
16707 | 16721 | |
| 16722 | "/ checking user input |
| 16723 | valueIndex isInteger ifFalse:[ |
| 16724 | self error: 'valueIndex is not an integer!!' |
| 16725 | ]. |
| 16726 | |
16708 | 16727 | %{ |
16709 | 16728 | /* dwIndex (valueIndex) |
16710 | 16729 | * The index of the value to be retrieved. This parameter should be zero for the first call to the RegEnumValue function and then be |
… |
… |
|
16791 | 16810 | |
16792 | 16811 | |nameUtf16Z stringArray retVal errorNumber| |
16793 | 16812 | |
| 16813 | "/ checking user input |
| 16814 | nameString isString ifFalse:[ |
| 16815 | self error: 'nameString is not a string!!' |
| 16816 | ]. |
| 16817 | |
16794 | 16818 | "/ adding terminating null into empty string |
16795 | 16819 | nameString notNil ifTrue:[ |
16796 | 16820 | nameString isEmpty ifTrue:[nameUtf16Z := (nameString, (Character codePoint: 0)) asUnicode16String] "/ needed for defaultValue |