diff options
-rw-r--r-- | avmedia/source/vlc/wrapper/SymbolLoader.hxx | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/avmedia/source/vlc/wrapper/SymbolLoader.hxx b/avmedia/source/vlc/wrapper/SymbolLoader.hxx index cfc86533e647..8f70dab595c6 100644 --- a/avmedia/source/vlc/wrapper/SymbolLoader.hxx +++ b/avmedia/source/vlc/wrapper/SymbolLoader.hxx @@ -45,10 +45,14 @@ namespace if ( ::RegOpenKeyExW( HKEY_LOCAL_MACHINE, L"Software\\VideoLAN\\VLC", 0, KEY_READ, &hKey ) == ERROR_SUCCESS ) { - if ( ::RegQueryValueExW( hKey, L"InstallDir", NULL, &dwType, (LPBYTE) arCurrent, &dwCurrentSize ) == ERROR_SUCCESS ) + if ( ::RegQueryValueExW( hKey, L"InstallDir", NULL, &dwType, (LPBYTE) arCurrent, &dwCurrentSize ) == ERROR_SUCCESS && + dwType == REG_SZ ) { ::RegCloseKey( hKey ); - return OUString( arCurrent, wcslen(arCurrent) ) + "/"; + // The value might be 0-terminated or not + if (arCurrent[dwCurrentSize/2] == 0) + dwCurrentSize -= 2; + return OUString( arCurrent, dwCurrentSize ) + "/"; } ::RegCloseKey( hKey ); |