oleaut32: Typelib strings of size -1 are NULL.

This commit is contained in:
Andrew Eikum 2013-09-09 09:17:23 -05:00 committed by Alexandre Julliard
parent 6cb2156976
commit 808c47cecb

View File

@ -2258,24 +2258,17 @@ static void MSFT_ReadValue( VARIANT * pVar, int offset, TLBContext *pcx )
case VT_BSTR :{ case VT_BSTR :{
char * ptr; char * ptr;
MSFT_ReadLEDWords(&size, sizeof(INT), pcx, DO_NOT_SEEK ); MSFT_ReadLEDWords(&size, sizeof(INT), pcx, DO_NOT_SEEK );
if(size < 0) { if(size == -1){
char next; V_BSTR(pVar) = NULL;
DWORD origPos = MSFT_Tell(pcx), nullPos; }else{
ptr = heap_alloc_zero(size);
do { MSFT_Read(ptr, size, pcx, DO_NOT_SEEK);
MSFT_Read(&next, 1, pcx, DO_NOT_SEEK); V_BSTR(pVar)=SysAllocStringLen(NULL,size);
} while (next); /* FIXME: do we need a AtoW conversion here? */
nullPos = MSFT_Tell(pcx); V_UNION(pVar, bstrVal[size])='\0';
size = nullPos - origPos; while(size--) V_UNION(pVar, bstrVal[size])=ptr[size];
MSFT_Seek(pcx, origPos); heap_free(ptr);
} }
ptr = heap_alloc_zero(size);/* allocate temp buffer */
MSFT_Read(ptr, size, pcx, DO_NOT_SEEK);/* read string (ANSI) */
V_BSTR(pVar)=SysAllocStringLen(NULL,size);
/* FIXME: do we need a AtoW conversion here? */
V_UNION(pVar, bstrVal[size])='\0';
while(size--) V_UNION(pVar, bstrVal[size])=ptr[size];
heap_free(ptr);
} }
size=-4; break; size=-4; break;
/* FIXME: this will not work AT ALL when the variant contains a pointer */ /* FIXME: this will not work AT ALL when the variant contains a pointer */