sync SetupGetTargetPathW with wine

fixes all setupapi query winetests

svn path=/trunk/; revision=40603
This commit is contained in:
Christoph von Wittich 2009-04-20 06:23:46 +00:00
parent 3103b957bf
commit 03fef42adf

View file

@ -563,19 +563,25 @@ BOOL WINAPI SetupGetTargetPathW( HINF hinf, PINFCONTEXT context, PCWSTR section,
{'D','e','f','a','u','l','t','D','e','s','t','D','i','r',0};
INFCONTEXT ctx;
WCHAR *dir;
INT size;
WCHAR *dir, systemdir[MAX_PATH];
unsigned int size;
BOOL ret = FALSE;
TRACE("%p, %p, %s, %p, 0x%08x, %p\n", hinf, context, debugstr_w(section), buffer,
buffer_size, required_size);
if (context && !SetupFindFirstLineW( hinf, destination_dirs, NULL, context )) return FALSE;
else if (section && !SetupFindFirstLineW( hinf, section, NULL, &ctx )) return FALSE;
else if (!SetupFindFirstLineW( hinf, destination_dirs, default_dest_dir, &ctx )) return FALSE;
if (!(dir = PARSER_get_dest_dir( context ? context : &ctx ))) return FALSE;
size = lstrlenW( dir ) + 1;
if (context) ret = SetupFindFirstLineW( hinf, destination_dirs, NULL, context );
else if (section)
{
if (!(ret = SetupFindFirstLineW( hinf, destination_dirs, section, &ctx )))
ret = SetupFindFirstLineW( hinf, destination_dirs, default_dest_dir, &ctx );
}
if (!ret || !(dir = PARSER_get_dest_dir( context ? context : &ctx )))
{
GetSystemDirectoryW( systemdir, MAX_PATH );
dir = systemdir;
}
size = strlenW( dir ) + 1;
if (required_size) *required_size = size;
if (buffer)
@ -589,7 +595,7 @@ BOOL WINAPI SetupGetTargetPathW( HINF hinf, PINFCONTEXT context, PCWSTR section,
return FALSE;
}
}
HeapFree( GetProcessHeap(), 0, dir );
if (dir != systemdir) HeapFree( GetProcessHeap(), 0, dir );
return TRUE;
}