# HG changeset patch
# User Patrik Svestka <patrik.svestka@gmail.com>
# Date 1544105334 -3600
# Thu Dec 06 15:08:54 2018 +0100
# Branch jv
# Node ID 7637a4b5ecc9b65de790e16ac95f3d65609d0bbc
# Parent 4debcdcaf26435461bea223bcd3431307dbeae0b
Issue #250: Smalltak/X is reading Windows Registry only in ASCII but registry is UTF16
- refix of subKeyAtIndex: method to get only subKeyName as indicated by its name
diff -r 4debcdcaf264 -r 7637a4b5ecc9 Win32OperatingSystem.st
a
|
b
|
|
16160 | 16160 | Return nil if no such key exists |
16161 | 16161 | WARNING: subKeyIndex is 0-based!!" |
16162 | 16162 | |
16163 | | |
16164 | | |subKeyName subKeyClassName errorNumber| |
| 16163 | |subKeyName errorNumber| |
16165 | 16164 | |
16166 | 16165 | %{ |
16167 | 16166 | HKEY myKey, subKey = 0; |
16168 | 16167 | |
16169 | | /* lpName (nameBuffer): |
16170 | | * A pointer to a buffer that receives the name of the subkey, including the |
16171 | | * terminating null character. The function copies only the name of the subkey, |
16172 | | * not the full key hierarchy, to the buffer. If the function fails, no information is copied to this buffer. |
16173 | | * |
16174 | | * note: This actually means that the if the path fits within 255 chacaters you could get another 255 characters for the key itself. |
16175 | | * This could help if you are having issues with the registry path lenght. |
16176 | | */ |
| 16168 | /* lpName (nameBuffer): |
| 16169 | * A pointer to a buffer that receives the name of the subkey, including the |
| 16170 | * terminating null character. The function copies only the name of the subkey, |
| 16171 | * not the full key hierarchy, to the buffer. If the function fails, no information is copied to this buffer. |
| 16172 | * |
| 16173 | * note: This actually means that the if the path fits within 255 chacaters you could get another 255 characters for the key itself. |
| 16174 | * This could help if you are having issues with the registry path lenght. |
| 16175 | */ |
16177 | 16176 | wchar_t nameBuffer[256]; // 256 is due to Key name limit (including path) |
16178 | 16177 | DWORD nameSize = sizeof(nameBuffer); |
16179 | 16178 | |
16180 | | /* lpClass (classNameBuffer): |
16181 | | * A pointer to a buffer that receives the user-defined class of the enumerated subkey. |
16182 | | */ |
16183 | | wchar_t classNameBuffer[256]; |
16184 | | DWORD classNameSize = sizeof(classNameBuffer); |
16185 | 16179 | FILETIME modificationTime; |
16186 | 16180 | int _retVal; |
16187 | 16181 | |
… |
… |
|
16191 | 16185 | if ((_retVal = RegEnumKeyExW(myKey, __intVal(subKeyIndex), |
16192 | 16186 | nameBuffer, &nameSize, |
16193 | 16187 | NULL, |
16194 | | classNameBuffer, &classNameSize, |
| 16188 | NULL, NULL, //classNameBuffer, classNameSize |
16195 | 16189 | &modificationTime)) == ERROR_SUCCESS) { |
16196 | 16190 | nameBuffer[nameSize] = '\0'; |
16197 | | classNameBuffer[classNameSize] = '\0'; |
16198 | 16191 | subKeyName = __MKU16STRING(nameBuffer); |
16199 | | subKeyClassName = __MKU16STRING(classNameBuffer); |
16200 | 16192 | } else { |
16201 | 16193 | if ((_retVal != ERROR_PATH_NOT_FOUND) |
16202 | 16194 | && (_retVal != ERROR_FILE_NOT_FOUND) |