mirror of
https://github.com/reactos/reactos.git
synced 2025-05-16 15:50:24 +00:00
[setupapi] Sync SetupGetIntField to Wine, fixes six setupapi:parser tests
svn path=/trunk/; revision=44322
This commit is contained in:
parent
15fff6abae
commit
eeba3408b2
1 changed files with 13 additions and 8 deletions
|
@ -1894,21 +1894,26 @@ BOOL WINAPI SetupGetIntField( PINFCONTEXT context, DWORD index, PINT result )
|
|||
char *end, *buffer = localbuff;
|
||||
DWORD required;
|
||||
INT res;
|
||||
BOOL ret = FALSE;
|
||||
BOOL ret;
|
||||
|
||||
if (!SetupGetStringFieldA( context, index, localbuff, sizeof(localbuff), &required ))
|
||||
if (!(ret = SetupGetStringFieldA( context, index, localbuff, sizeof(localbuff), &required )))
|
||||
{
|
||||
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) return FALSE;
|
||||
if (!(buffer = HeapAlloc( GetProcessHeap(), 0, required ))) return FALSE;
|
||||
if (!SetupGetStringFieldA( context, index, buffer, required, NULL )) goto done;
|
||||
if (!(ret = SetupGetStringFieldA( context, index, buffer, required, NULL ))) goto done;
|
||||
}
|
||||
res = strtol( buffer, &end, 0 );
|
||||
if (end != buffer && !*end)
|
||||
/* The call to SetupGetStringFieldA succeeded. If buffer is empty we have an optional field */
|
||||
if (!*buffer) *result = 0;
|
||||
else
|
||||
{
|
||||
*result = res;
|
||||
ret = TRUE;
|
||||
res = strtol( buffer, &end, 0 );
|
||||
if (end != buffer && !*end) *result = res;
|
||||
else
|
||||
{
|
||||
SetLastError( ERROR_INVALID_DATA );
|
||||
ret = FALSE;
|
||||
}
|
||||
}
|
||||
else SetLastError( ERROR_INVALID_DATA );
|
||||
|
||||
done:
|
||||
if (buffer != localbuff) HeapFree( GetProcessHeap(), 0, buffer );
|
||||
|
|
Loading…
Reference in a new issue