Ticket #250: libbasic_fix_2_of_2_rev_7637a4b5ecc9_Issue__250__Smalltak_X_is_reading_Windows_Registry_only_in_ASCII_but_registry_is_UTF16.patch

File libbasic_fix_2_of_2_rev_7637a4b5ecc9_Issue__250__Smalltak_X_is_reading_Windows_Registry_only_in_ASCII_but_registry_is_UTF16.patch, 2.8 KB (added by patrik.svestka@…, 5 years ago)

Second patch

  • Win32OperatingSystem.st

    # 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  
    1616016160     Return nil if no such key exists
    1616116161     WARNING: subKeyIndex is 0-based!!"
    1616216162
    16163 
    16164     |subKeyName subKeyClassName errorNumber|
     16163    |subKeyName errorNumber|
    1616516164
    1616616165%{
    1616716166    HKEY myKey, subKey = 0;
    1616816167
    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     */
    1617716176    wchar_t nameBuffer[256];  // 256 is due to Key name limit (including path)
    1617816177    DWORD nameSize = sizeof(nameBuffer);
    1617916178 
    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);
    1618516179    FILETIME modificationTime;
    1618616180    int _retVal;
    1618716181
     
    1619116185        if ((_retVal = RegEnumKeyExW(myKey, __intVal(subKeyIndex),
    1619216186                         nameBuffer, &nameSize,
    1619316187                         NULL,
    16194                          classNameBuffer, &classNameSize,
     16188                         NULL, NULL, //classNameBuffer, classNameSize
    1619516189                         &modificationTime)) == ERROR_SUCCESS) {
    1619616190            nameBuffer[nameSize] = '\0';
    16197             classNameBuffer[classNameSize] = '\0';
    1619816191            subKeyName = __MKU16STRING(nameBuffer);
    16199             subKeyClassName = __MKU16STRING(classNameBuffer);
    1620016192        } else {
    1620116193            if ((_retVal != ERROR_PATH_NOT_FOUND)
    1620216194             && (_retVal != ERROR_FILE_NOT_FOUND)