char buffer[4096] = { 0 }; DWORD len = sizeof buffer; rc = ::RegQueryValueEx( key, valueNameArg(), NULL, NULL, (LPBYTE)buffer, &len ); if ( rc == ERROR_SUCCESS ) { result = buffer; if ( currentlyUndefined ) { *currentlyUndefined = PR_FALSE;
if (!IsNT()) { char buffer[4096] = { 0 }; DWORD len = sizeof buffer; rc = ::RegQueryValueExA( key, valueNameArg(), NULL, NULL, (LPBYTE)buffer, &len ); if ( rc == ERROR_SUCCESS ) { nsAutoString uResult; NS_CopyNativeToUnicode(nsDependentCString(buffer), uResult); CopyUTF16toUTF8(uResult, result); if ( currentlyUndefined ) { *currentlyUndefined = PR_FALSE; } } } else { PRUnichar buffer[4096] = { 0 }; DWORD len = sizeof buffer; rc = ::RegQueryValueExW( key, NS_ConvertASCIItoUTF16(valueNameArg()).get(), NULL, NULL, (LPBYTE)buffer, &len ); if ( rc == ERROR_SUCCESS ) { CopyUTF16toUTF8(buffer, result); if ( currentlyUndefined ) { *currentlyUndefined = PR_FALSE; }
nsCString RegistryEntry::currentSetting( PRBool *currentlyUndefined ) const {    nsCString result;    if ( currentlyUndefined ) {        *currentlyUndefined = PR_TRUE;    }    HKEY   key;    LONG   rc = ::RegOpenKey( baseKey, keyName.get(), &key );    if ( rc == ERROR_SUCCESS ) {        char buffer[4096] = { 0 };        DWORD len = sizeof buffer;        rc = ::RegQueryValueEx( key, valueNameArg(), NULL, NULL, (LPBYTE)buffer, &len );        if ( rc == ERROR_SUCCESS ) {            result = buffer;            if ( currentlyUndefined ) {                *currentlyUndefined = PR_FALSE; // Indicate entry is present.            }        }        ::RegCloseKey( key );    }    return result;}