Bug 79516;

Convert the description of Registry type into proper unicode
/r=ftang, /sr=ben, /a=asa
This commit is contained in:
yokoyama%netscape.com 2001-06-20 00:57:52 +00:00
parent a27d682ce5
commit 5dc0371152

View File

@ -251,11 +251,17 @@ static nsresult GetMIMEInfoFromRegistry( LPBYTE fileType, nsIMIMEInfo *pInfo )
if ( rc == ERROR_SUCCESS )
{
// OK, the default value here is the description of the type.
LPBYTE pDesc = GetValueBytes( fileTypeKey, "" );
DWORD lenDesc = 0;
LPBYTE pDesc = GetValueBytes( fileTypeKey, "", &lenDesc );
if ( pDesc )
{
nsAutoString desc; desc.AssignWithConversion((const char*)pDesc);
pInfo->SetDescription( desc.GetUnicode() );
PRUnichar *pUniDesc = new PRUnichar[lenDesc+1];
if (pUniDesc) {
int len = MultiByteToWideChar(CP_ACP, 0, (const char *)pDesc, -1, pUniDesc, lenDesc);
pUniDesc[len] = 0;
pInfo->SetDescription( pUniDesc );
delete [] pUniDesc;
}
delete [] pDesc;
}
}