[WINESYNC] setupapi: Use CRT functions for memory allocation where possible.

The big win here is getting rid of the reimplementation of wcsdup.

wine commit id c293cd781fb4b330b7d93171501134f86a5138b8 by Alex Henrie <alexhenrie24@gmail.com>

+ Similar adaptations in ReactOS-specific code.

Co-authored-by: Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
This commit is contained in:
winesync 2023-09-14 16:47:26 +02:00 committed by Hermès Bélusca-Maïto
parent ad92792811
commit aa28089900
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
10 changed files with 157 additions and 183 deletions

View file

@ -117,7 +117,7 @@ static void promptdisk_browse(HWND hwnd, struct promptdisk_params *params)
ofn.Flags = OFN_EXPLORER | OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST;
ofn.hwndOwner = hwnd;
ofn.nMaxFile = MAX_PATH;
ofn.lpstrFile = HeapAlloc(GetProcessHeap(), 0, MAX_PATH*sizeof(WCHAR));
ofn.lpstrFile = malloc(MAX_PATH * sizeof(WCHAR));
lstrcpyW(ofn.lpstrFile, params->FileSought);
if(GetOpenFileNameW(&ofn))
@ -126,7 +126,7 @@ static void promptdisk_browse(HWND hwnd, struct promptdisk_params *params)
if (last_slash) *last_slash = 0;
SetDlgItemTextW(hwnd, IDC_PATH, ofn.lpstrFile);
}
HeapFree(GetProcessHeap(), 0, ofn.lpstrFile);
free(ofn.lpstrFile);
}
/* Handles the messages sent to the SetupPromptForDisk dialog
@ -188,11 +188,11 @@ UINT WINAPI SetupPromptForDiskA(HWND hwndParent, PCSTR DialogTitle, PCSTR DiskNa
ret = SetupPromptForDiskW(hwndParent, DialogTitleW, DiskNameW, PathToSourceW,
FileSoughtW, TagFileW, DiskPromptStyle, PathBufferW, MAX_PATH, PathRequiredSize);
HeapFree(GetProcessHeap(), 0, DialogTitleW);
HeapFree(GetProcessHeap(), 0, DiskNameW);
HeapFree(GetProcessHeap(), 0, PathToSourceW);
HeapFree(GetProcessHeap(), 0, FileSoughtW);
HeapFree(GetProcessHeap(), 0, TagFileW);
free(DialogTitleW);
free(DiskNameW);
free(PathToSourceW);
free(FileSoughtW);
free(TagFileW);
if(ret == DPROMPT_SUCCESS)
{

View file

@ -57,7 +57,7 @@ static const WCHAR *get_unknown_dirid(void)
if (!unknown_dirid)
{
UINT len = GetSystemDirectoryW( NULL, 0 ) + lstrlenW(L"\\unknown");
if (!(unknown_dirid = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return NULL;
if (!(unknown_dirid = malloc( len * sizeof(WCHAR) ))) return NULL;
GetSystemDirectoryW( unknown_dirid, len );
lstrcatW( unknown_dirid, L"\\unknown" );
}
@ -140,7 +140,7 @@ static const WCHAR *create_system_dirid( int dirid )
return get_unknown_dirid();
}
len = (lstrlenW(buffer) + 1) * sizeof(WCHAR);
if ((str = HeapAlloc( GetProcessHeap(), 0, len ))) memcpy( str, buffer, len );
if ((str = malloc( len ))) memcpy( str, buffer, len );
return str;
}
@ -169,7 +169,7 @@ static const WCHAR *create_printer_dirid( DWORD dirid )
return get_unknown_dirid();
}
len = (lstrlenW(buffer) + 1) * sizeof(WCHAR);
if ((str = HeapAlloc( GetProcessHeap(), 0, len ))) memcpy( str, buffer, len );
if ((str = malloc( len ))) memcpy( str, buffer, len );
return str;
}
@ -184,7 +184,7 @@ static const WCHAR *get_csidl_dir( DWORD csidl )
return get_unknown_dirid();
}
len = (lstrlenW(buffer) + 1) * sizeof(WCHAR);
if ((str = HeapAlloc( GetProcessHeap(), 0, len ))) memcpy( str, buffer, len );
if ((str = malloc( len ))) memcpy( str, buffer, len );
return str;
}
@ -229,22 +229,13 @@ static BOOL store_user_dirid( HINF hinf, int id, WCHAR *str )
for (i = 0; i < nb_user_dirids; i++) if (user_dirids[i].id == id) break;
if (i < nb_user_dirids) HeapFree( GetProcessHeap(), 0, user_dirids[i].str );
if (i < nb_user_dirids) free( user_dirids[i].str );
else
{
if (nb_user_dirids >= alloc_user_dirids)
{
int new_size = max( 32, alloc_user_dirids * 2 );
struct user_dirid *new;
if (user_dirids)
new = HeapReAlloc( GetProcessHeap(), 0, user_dirids,
new_size * sizeof(*new) );
else
new = HeapAlloc( GetProcessHeap(), 0,
new_size * sizeof(*new) );
struct user_dirid *new = realloc( user_dirids, new_size * sizeof(*new) );
if (!new) return FALSE;
user_dirids = new;
alloc_user_dirids = new_size;
@ -268,7 +259,7 @@ BOOL WINAPI SetupSetDirectoryIdA( HINF hinf, DWORD id, PCSTR dir )
if (!id) /* clear everything */
{
for (i = 0; i < nb_user_dirids; i++) HeapFree( GetProcessHeap(), 0, user_dirids[i].str );
for (i = 0; i < nb_user_dirids; i++) free( user_dirids[i].str );
nb_user_dirids = 0;
return TRUE;
}
@ -298,7 +289,7 @@ BOOL WINAPI SetupSetDirectoryIdW( HINF hinf, DWORD id, PCWSTR dir )
if (!id) /* clear everything */
{
for (i = 0; i < nb_user_dirids; i++) HeapFree( GetProcessHeap(), 0, user_dirids[i].str );
for (i = 0; i < nb_user_dirids; i++) free( user_dirids[i].str );
nb_user_dirids = 0;
return TRUE;
}
@ -310,7 +301,7 @@ BOOL WINAPI SetupSetDirectoryIdW( HINF hinf, DWORD id, PCWSTR dir )
/* duplicate the string */
len = (lstrlenW(dir)+1) * sizeof(WCHAR);
if (!(str = HeapAlloc( GetProcessHeap(), 0, len ))) return FALSE;
if (!(str = malloc( len ))) return FALSE;
memcpy( str, dir, len );
return store_user_dirid( hinf, id, str );
}

View file

@ -55,7 +55,7 @@ HDSKSPC WINAPI SetupCreateDiskSpaceListW(PVOID Reserved1, DWORD Reserved2, UINT
if (rc == 0)
return NULL;
list = HeapAlloc(GetProcessHeap(),0,sizeof(DISKSPACELIST));
list = malloc(sizeof(DISKSPACELIST));
list->dwDriveCount = 0;
@ -110,7 +110,7 @@ HDSKSPC WINAPI SetupDuplicateDiskSpaceListW(HDSKSPC DiskSpace, PVOID Reserved1,
return NULL;
}
list_copy = HeapAlloc(GetProcessHeap(), 0, sizeof(DISKSPACELIST));
list_copy = malloc(sizeof(DISKSPACELIST));
if (!list_copy)
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
@ -166,7 +166,7 @@ BOOL WINAPI SetupQuerySpaceRequiredOnDriveW(HDSKSPC DiskSpace,
return FALSE;
}
driveW = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(DriveSpec) + 2) * sizeof(WCHAR));
driveW = malloc((wcslen(DriveSpec) + 2) * sizeof(WCHAR));
if (!driveW)
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
@ -189,7 +189,7 @@ BOOL WINAPI SetupQuerySpaceRequiredOnDriveW(HDSKSPC DiskSpace,
}
}
HeapFree(GetProcessHeap(), 0, driveW);
free(driveW);
if (!rc) SetLastError(ERROR_INVALID_DRIVE);
return rc;
@ -222,7 +222,7 @@ BOOL WINAPI SetupQuerySpaceRequiredOnDriveA(HDSKSPC DiskSpace,
len = MultiByteToWideChar(CP_ACP, 0, DriveSpec, -1, NULL, 0);
DriveSpecW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
DriveSpecW = malloc(len * sizeof(WCHAR));
if (!DriveSpecW)
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
@ -234,7 +234,7 @@ BOOL WINAPI SetupQuerySpaceRequiredOnDriveA(HDSKSPC DiskSpace,
ret = SetupQuerySpaceRequiredOnDriveW(DiskSpace, DriveSpecW, SpaceRequired,
Reserved1, Reserved2);
HeapFree(GetProcessHeap(), 0, DriveSpecW);
free(DriveSpecW);
return ret;
}
@ -245,7 +245,7 @@ BOOL WINAPI SetupQuerySpaceRequiredOnDriveA(HDSKSPC DiskSpace,
BOOL WINAPI SetupDestroyDiskSpaceList(HDSKSPC DiskSpace)
{
LPDISKSPACELIST list = (LPDISKSPACELIST)DiskSpace;
HeapFree(GetProcessHeap(),0,list);
free(list);
return TRUE;
}

View file

@ -144,15 +144,12 @@ static void *grow_array( void *array, unsigned int *count, size_t elem )
unsigned int new_count = *count + *count / 2;
if (new_count < 32) new_count = 32;
if (array)
new_array = HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, array, new_count * elem );
else
new_array = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, new_count * elem );
new_array = _recalloc( array, new_count, elem );
if (new_array)
*count = new_count;
else
HeapFree( GetProcessHeap(), 0, array );
free( array );
return new_array;
}
@ -205,7 +202,7 @@ static int add_section( struct inf_file *file, const WCHAR *name )
if (!(file->sections = grow_array( file->sections, &file->alloc_sections,
sizeof(file->sections[0]) ))) return -1;
}
if (!(section = HeapAlloc( GetProcessHeap(), 0, sizeof(*section) ))) return -1;
if (!(section = malloc( sizeof(*section) ))) return -1;
section->name = name;
section->nb_lines = 0;
section->alloc_lines = ARRAY_SIZE( section->lines );
@ -226,7 +223,7 @@ static struct line *add_line( struct inf_file *file, int section_index )
if (section->nb_lines == section->alloc_lines) /* need to grow the section */
{
int size = sizeof(*section) - sizeof(section->lines) + 2*section->alloc_lines*sizeof(*line);
if (!(section = HeapReAlloc( GetProcessHeap(), 0, section, size ))) return NULL;
if (!(section = realloc( section, size ))) return NULL;
section->alloc_lines *= 2;
file->sections[section_index] = section;
}
@ -385,14 +382,14 @@ static const WCHAR *get_string_subst( const struct inf_file *file, const WCHAR *
return field->text; // return the english or translated string
not_found: /* check for integer id */
if ((dirid_str = HeapAlloc( GetProcessHeap(), 0, (*len+1) * sizeof(WCHAR) )))
if ((dirid_str = malloc( (*len + 1) * sizeof(WCHAR) )))
{
memcpy( dirid_str, str, *len * sizeof(WCHAR) );
dirid_str[*len] = 0;
dirid = wcstol( dirid_str, &end, 10 );
if (!*end) ret = get_dirid_subst( file, dirid, len );
if (no_trailing_slash && ret && *len && ret[*len - 1] == '\\') *len -= 1;
HeapFree( GetProcessHeap(), 0, dirid_str );
free( dirid_str );
return ret;
}
return NULL;
@ -900,12 +897,12 @@ static void free_inf_file( struct inf_file *file )
{
unsigned int i;
for (i = 0; i < file->nb_sections; i++) HeapFree( GetProcessHeap(), 0, file->sections[i] );
HeapFree( GetProcessHeap(), 0, file->filename );
HeapFree( GetProcessHeap(), 0, file->sections );
HeapFree( GetProcessHeap(), 0, file->fields );
for (i = 0; i < file->nb_sections; i++) free( file->sections[i] );
free( file->filename );
free( file->sections );
free( file->fields );
HeapFree( GetProcessHeap(), 0, file->strings );
HeapFree( GetProcessHeap(), 0, file );
free( file );
}
@ -936,14 +933,12 @@ static DWORD parse_buffer( struct inf_file *file, const WCHAR *buffer, const WCH
/* trim excess buffer space */
if (file->alloc_sections > file->nb_sections)
{
file->sections = HeapReAlloc( GetProcessHeap(), 0, file->sections,
file->nb_sections * sizeof(file->sections[0]) );
file->sections = realloc( file->sections, file->nb_sections * sizeof(file->sections[0]) );
file->alloc_sections = file->nb_sections;
}
if (file->alloc_fields > file->nb_fields)
{
file->fields = HeapReAlloc( GetProcessHeap(), 0, file->fields,
file->nb_fields * sizeof(file->fields[0]) );
file->fields = realloc( file->fields, file->nb_fields * sizeof(file->fields[0]) );
file->alloc_fields = file->nb_fields;
}
file->strings = HeapReAlloc( GetProcessHeap(), HEAP_REALLOC_IN_PLACE_ONLY, file->strings,
@ -1001,7 +996,7 @@ static struct inf_file *parse_file( HANDLE handle, UINT *error_line, DWORD style
NtClose( mapping );
if (!buffer) return NULL;
if (!(file = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*file) )))
if (!(file = calloc( 1, sizeof(*file) )))
{
err = ERROR_NOT_ENOUGH_MEMORY;
goto done;
@ -1031,12 +1026,12 @@ static struct inf_file *parse_file( HANDLE handle, UINT *error_line, DWORD style
offset = sizeof(utf8_bom);
}
if ((new_buff = HeapAlloc( GetProcessHeap(), 0, size * sizeof(WCHAR) )))
if ((new_buff = malloc( size * sizeof(WCHAR) )))
{
DWORD len = MultiByteToWideChar( codepage, 0, (char *)buffer + offset,
size - offset, new_buff, size );
err = parse_buffer( file, new_buff, new_buff + len, error_line );
HeapFree( GetProcessHeap(), 0, new_buff );
free( new_buff );
}
}
else
@ -1099,7 +1094,7 @@ WCHAR *PARSER_get_src_root( HINF hinf )
{
unsigned int len;
const WCHAR *dir = get_inf_dir( hinf, &len );
WCHAR *ret = HeapAlloc( GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR) );
WCHAR *ret = malloc((len + 1) * sizeof(WCHAR) );
if (ret)
{
memcpy( ret, dir, len * sizeof(WCHAR) );
@ -1126,7 +1121,7 @@ WCHAR *PARSER_get_dest_dir( INFCONTEXT *context )
if (!SetupGetIntField( context, 1, &dirid )) return NULL;
if (!(dir = get_dirid_subst( context->Inf, dirid, &len1 ))) return NULL;
if (!SetupGetStringFieldW( context, 2, NULL, 0, &len2 )) len2 = 0;
if (!(ret = HeapAlloc( GetProcessHeap(), 0, (len1+len2+1) * sizeof(WCHAR) ))) return NULL;
if (!(ret = malloc( (len1 + len2 + 1) * sizeof(WCHAR) ))) return NULL;
memcpy( ret, dir, len1 * sizeof(WCHAR) );
ptr = ret + len1;
if (len2 && ptr > ret && ptr[-1] != '\\') *ptr++ = '\\';
@ -1246,7 +1241,7 @@ HINF WINAPI SetupOpenInfFileW( PCWSTR name, PCWSTR class, DWORD style, UINT *err
if (wcschr( name, '\\' ) || wcschr( name, '/' ))
{
if (!(len = GetFullPathNameW( name, 0, NULL, NULL ))) return INVALID_HANDLE_VALUE;
if (!(path = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
if (!(path = malloc( len * sizeof(WCHAR) )))
{
SetLastError( ERROR_NOT_ENOUGH_MEMORY );
return INVALID_HANDLE_VALUE;
@ -1260,7 +1255,7 @@ HINF WINAPI SetupOpenInfFileW( PCWSTR name, PCWSTR class, DWORD style, UINT *err
static const WCHAR System32[] = {'\\','s','y','s','t','e','m','3','2','\\',0};
len = GetWindowsDirectoryW( NULL, 0 ) + lstrlenW(name) + 12;
if (!(path = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
if (!(path = malloc( len * sizeof(WCHAR) )))
{
SetLastError( ERROR_NOT_ENOUGH_MEMORY );
return INVALID_HANDLE_VALUE;
@ -1285,7 +1280,7 @@ HINF WINAPI SetupOpenInfFileW( PCWSTR name, PCWSTR class, DWORD style, UINT *err
}
if (!file)
{
HeapFree( GetProcessHeap(), 0, path );
free( path );
return INVALID_HANDLE_VALUE;
}
TRACE( "%s -> %p\n", debugstr_w(path), file );
@ -1294,7 +1289,7 @@ HINF WINAPI SetupOpenInfFileW( PCWSTR name, PCWSTR class, DWORD style, UINT *err
if (class)
{
GUID ClassGuid;
LPWSTR ClassName = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(class) + 1) * sizeof(WCHAR));
LPWSTR ClassName = malloc((lstrlenW(class) + 1) * sizeof(WCHAR));
if (!ClassName)
{
/* Not enough memory */
@ -1305,7 +1300,7 @@ HINF WINAPI SetupOpenInfFileW( PCWSTR name, PCWSTR class, DWORD style, UINT *err
else if (!PARSER_GetInfClassW((HINF)file, &ClassGuid, ClassName, lstrlenW(class) + 1, NULL))
{
/* Unable to get class name in .inf file */
HeapFree(GetProcessHeap(), 0, ClassName);
free(ClassName);
SetLastError(ERROR_CLASS_MISMATCH);
SetupCloseInfFile((HINF)file);
return INVALID_HANDLE_VALUE;
@ -1313,12 +1308,12 @@ HINF WINAPI SetupOpenInfFileW( PCWSTR name, PCWSTR class, DWORD style, UINT *err
else if (wcscmp(class, ClassName) != 0)
{
/* Provided name name is not the expected one */
HeapFree(GetProcessHeap(), 0, ClassName);
free(ClassName);
SetLastError(ERROR_CLASS_MISMATCH);
SetupCloseInfFile((HINF)file);
return INVALID_HANDLE_VALUE;
}
HeapFree(GetProcessHeap(), 0, ClassName);
free(ClassName);
}
SetLastError( 0 );
@ -1944,7 +1939,7 @@ BOOL WINAPI SetupGetIntField( PINFCONTEXT context, DWORD index, PINT result )
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 (!(buffer = malloc( required ))) return FALSE;
if (!(ret = SetupGetStringFieldA( context, index, buffer, required, NULL ))) goto done;
}
/* The call to SetupGetStringFieldA succeeded. If buffer is empty we have an optional field */
@ -1961,7 +1956,7 @@ BOOL WINAPI SetupGetIntField( PINFCONTEXT context, DWORD index, PINT result )
}
done:
if (buffer != localbuff) HeapFree( GetProcessHeap(), 0, buffer );
if (buffer != localbuff) free( buffer );
return ret;
}

View file

@ -128,7 +128,7 @@ BOOL WINAPI SetupGetInfInformationA(LPCVOID InfSpec, DWORD SearchControl,
if (InfSpec && SearchControl >= INFINFO_INF_NAME_IS_ABSOLUTE)
{
len = MultiByteToWideChar(CP_ACP, 0, InfSpec, -1, NULL, 0);
inf = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
inf = malloc(len * sizeof(WCHAR));
if (!inf)
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
@ -141,7 +141,7 @@ BOOL WINAPI SetupGetInfInformationA(LPCVOID InfSpec, DWORD SearchControl,
ReturnBufferSize, RequiredSize);
if (SearchControl >= INFINFO_INF_NAME_IS_ABSOLUTE)
HeapFree(GetProcessHeap(), 0, inf);
free(inf);
return ret;
}
@ -233,13 +233,13 @@ BOOL WINAPI SetupQueryInfFileInformationA(PSP_INF_INFORMATION InfInformation,
if (!ret)
return FALSE;
filenameW = HeapAlloc(GetProcessHeap(), 0, size * sizeof(WCHAR));
filenameW = malloc(size * sizeof(WCHAR));
ret = SetupQueryInfFileInformationW(InfInformation, InfIndex,
filenameW, size, &size);
if (!ret)
{
HeapFree(GetProcessHeap(), 0, filenameW);
free(filenameW);
return FALSE;
}
@ -248,7 +248,7 @@ BOOL WINAPI SetupQueryInfFileInformationA(PSP_INF_INFORMATION InfInformation,
if (!ReturnBuffer)
{
HeapFree(GetProcessHeap(), 0, filenameW);
free(filenameW);
if (ReturnBufferSize)
{
SetLastError(ERROR_INVALID_PARAMETER);
@ -260,13 +260,13 @@ BOOL WINAPI SetupQueryInfFileInformationA(PSP_INF_INFORMATION InfInformation,
if (size > ReturnBufferSize)
{
HeapFree(GetProcessHeap(), 0, filenameW);
free(filenameW);
SetLastError(ERROR_INSUFFICIENT_BUFFER);
return FALSE;
}
WideCharToMultiByte(CP_ACP, 0, filenameW, -1, ReturnBuffer, size, NULL, NULL);
HeapFree(GetProcessHeap(), 0, filenameW);
free(filenameW);
return ret;
}
@ -334,7 +334,7 @@ BOOL WINAPI SetupGetSourceFileLocationA( HINF hinf, PINFCONTEXT context, PCSTR f
if (!SetupGetSourceFileLocationW( hinf, context, filenameW, source_id, NULL, 0, &required ))
goto done;
if (!(bufferW = HeapAlloc( GetProcessHeap(), 0, required * sizeof(WCHAR) )))
if (!(bufferW = malloc( required * sizeof(WCHAR) )))
goto done;
if (!SetupGetSourceFileLocationW( hinf, context, filenameW, source_id, bufferW, required, NULL ))
@ -356,8 +356,8 @@ BOOL WINAPI SetupGetSourceFileLocationA( HINF hinf, PINFCONTEXT context, PCSTR f
ret = TRUE;
done:
HeapFree( GetProcessHeap(), 0, filenameW );
HeapFree( GetProcessHeap(), 0, bufferW );
free( filenameW );
free( bufferW );
return ret;
}
@ -384,19 +384,19 @@ static LPWSTR get_source_id( HINF hinf, PINFCONTEXT context, PCWSTR filename )
if (!SetupGetStringFieldW( context, 1, NULL, 0, &size ))
return NULL;
if (!(source_id = HeapAlloc( GetProcessHeap(), 0, size * sizeof(WCHAR) )))
if (!(source_id = malloc( size * sizeof(WCHAR) )))
return NULL;
if (!SetupGetStringFieldW( context, 1, source_id, size, NULL ))
{
HeapFree( GetProcessHeap(), 0, source_id );
free( source_id );
return NULL;
}
#ifndef __WINESRC__
if (!SetupDiGetActualSectionToInstallW(hinf, source_disks_names, Section, ARRAY_SIZE(Section), NULL, NULL))
{
HeapFree( GetProcessHeap(), 0, source_id );
free( source_id );
return NULL;
}
@ -407,7 +407,7 @@ static LPWSTR get_source_id( HINF hinf, PINFCONTEXT context, PCWSTR filename )
!SetupFindFirstLineW( hinf, source_disks_names, source_id, context ))
#endif // !__WINESRC__
{
HeapFree( GetProcessHeap(), 0, source_id );
free( source_id );
return NULL;
}
return source_id;
@ -435,10 +435,10 @@ BOOL WINAPI SetupGetSourceFileLocationW( HINF hinf, PINFCONTEXT context, PCWSTR
*source_id = wcstol( source_id_str, &end, 10 );
if (end == source_id_str || *end)
{
HeapFree( GetProcessHeap(), 0, source_id_str );
free( source_id_str );
return FALSE;
}
HeapFree( GetProcessHeap(), 0, source_id_str );
free( source_id_str );
if (SetupGetStringFieldW( context, 4, buffer, buffer_size, required_size ))
return TRUE;
@ -474,7 +474,7 @@ BOOL WINAPI SetupGetSourceInfoA( HINF hinf, UINT source_id, UINT info,
if (!SetupGetSourceInfoW( hinf, source_id, info, NULL, 0, &required ))
return FALSE;
if (!(bufferW = HeapAlloc( GetProcessHeap(), 0, required * sizeof(WCHAR) )))
if (!(bufferW = malloc( required * sizeof(WCHAR) )))
return FALSE;
if (!SetupGetSourceInfoW( hinf, source_id, info, bufferW, required, NULL ))
@ -496,7 +496,7 @@ BOOL WINAPI SetupGetSourceInfoA( HINF hinf, UINT source_id, UINT info,
ret = TRUE;
done:
HeapFree( GetProcessHeap(), 0, bufferW );
free( bufferW );
return ret;
}
@ -579,7 +579,7 @@ BOOL WINAPI SetupGetTargetPathA( HINF hinf, PINFCONTEXT context, PCSTR section,
if (!SetupGetTargetPathW( hinf, context, sectionW, NULL, 0, &required ))
goto done;
if (!(bufferW = HeapAlloc( GetProcessHeap(), 0, required * sizeof(WCHAR) )))
if (!(bufferW = malloc( required * sizeof(WCHAR) )))
goto done;
if (!SetupGetTargetPathW( hinf, context, sectionW, bufferW, required, NULL ))
@ -601,8 +601,8 @@ BOOL WINAPI SetupGetTargetPathA( HINF hinf, PINFCONTEXT context, PCSTR section,
ret = TRUE;
done:
HeapFree( GetProcessHeap(), 0, sectionW );
HeapFree( GetProcessHeap(), 0, bufferW );
free( sectionW );
free( bufferW );
return ret;
}
@ -647,11 +647,11 @@ BOOL WINAPI SetupGetTargetPathW( HINF hinf, PINFCONTEXT context, PCWSTR section,
else
{
SetLastError( ERROR_INSUFFICIENT_BUFFER );
if (dir != systemdir) HeapFree( GetProcessHeap(), 0, dir );
if (dir != systemdir) free( dir );
return FALSE;
}
}
if (dir != systemdir) HeapFree( GetProcessHeap(), 0, dir );
if (dir != systemdir) free( dir );
return TRUE;
}

View file

@ -19,7 +19,6 @@
*/
#include "setupapi_private.h"
#include "wine/heap.h"
#ifdef __WINESRC__
#include <stdlib.h>
@ -100,16 +99,16 @@ static void free_file_op_queue( struct file_op_queue *queue )
while( op )
{
HeapFree( GetProcessHeap(), 0, op->src_path );
HeapFree( GetProcessHeap(), 0, op->src_file );
HeapFree( GetProcessHeap(), 0, op->dst_path );
free( op->src_path );
free( op->src_file );
free( op->dst_path );
#ifdef __REACTOS__
if (op->dst_sd) LocalFree(op->dst_sd);
#endif
if (op->dst_file != op->src_file) HeapFree( GetProcessHeap(), 0, op->dst_file );
if (op->dst_file != op->src_file) free( op->dst_file );
t = op;
op = op->next;
HeapFree( GetProcessHeap(), 0, t );
free( t );
}
}
@ -246,7 +245,7 @@ UINT CALLBACK QUEUE_callback_WtoA( void *context, UINT notification,
statusA.FailureCode = statusW->FailureCode;
ret = callback_ctx->orig_handler( callback_ctx->orig_context, notification,
(UINT_PTR)&statusA, param2 );
HeapFree( GetProcessHeap(), 0, (LPSTR)statusA.FileName );
free( (char *)statusA.FileName );
}
break;
@ -257,7 +256,7 @@ UINT CALLBACK QUEUE_callback_WtoA( void *context, UINT notification,
ret = callback_ctx->orig_handler( callback_ctx->orig_context, notification,
(UINT_PTR)target, param2 );
HeapFree( GetProcessHeap(), 0, target );
free( target );
}
break;
@ -278,10 +277,10 @@ UINT CALLBACK QUEUE_callback_WtoA( void *context, UINT notification,
(UINT_PTR)&mediaA, (UINT_PTR)&path);
MultiByteToWideChar(CP_ACP, 0, path, -1, (WCHAR *)param2, MAX_PATH);
heap_free((char *)mediaA.Tagfile);
heap_free((char *)mediaA.Description);
heap_free((char *)mediaA.SourcePath);
heap_free((char *)mediaA.SourceFile);
free((char *)mediaA.Tagfile);
free((char *)mediaA.Description);
free((char *)mediaA.SourcePath);
free((char *)mediaA.SourceFile);
break;
}
case SPFILENOTIFY_STARTQUEUE:
@ -315,7 +314,7 @@ static void get_src_file_info( HINF hinf, struct file_op *op, PWSTR* psrc_root,
{
if ((op->style & (SP_COPY_SOURCE_ABSOLUTE|SP_COPY_SOURCEPATH_ABSOLUTE))) return;
/* no specific info, use .inf file source directory */
if (!*psrc_root) *psrc_root = PARSER_get_src_root( hinf );
if (!*psrc_root) *psrc_root = PARSER_get_src_root(hinf);
return;
}
if (!SetupGetIntField( &file_ctx, 1, &diskid )) return;
@ -335,13 +334,13 @@ static void get_src_file_info( HINF hinf, struct file_op *op, PWSTR* psrc_root,
if (!*psrc_descr)
{
if (SetupGetStringFieldW( &disk_ctx, 1, NULL, 0, &len ) &&
(*psrc_descr = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) )))
(*psrc_descr = malloc(len*sizeof(WCHAR))))
SetupGetStringFieldW( &disk_ctx, 1, *psrc_descr, len, NULL );
}
if (!*psrc_tag)
{
if (SetupGetStringFieldW( &disk_ctx, 2, NULL, 0, &len ) &&
(*psrc_tag = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) )))
(*psrc_tag = malloc(len*sizeof(WCHAR))))
SetupGetStringFieldW( &disk_ctx, 2, *psrc_tag, len, NULL );
}
if (!op->src_path && !(op->style & SP_COPY_SOURCE_ABSOLUTE))
@ -356,7 +355,7 @@ static void get_src_file_info( HINF hinf, struct file_op *op, PWSTR* psrc_root,
if (!SetupGetStringFieldW( &file_ctx, 2, NULL, 0, &len2 )) len2 = 0;
if ((len || len2) &&
(op->src_path = HeapAlloc( GetProcessHeap(), 0, (len+len2)*sizeof(WCHAR) )))
(op->src_path = malloc((len+len2)*sizeof(WCHAR))))
{
WCHAR *ptr = op->src_path;
if (len)
@ -392,11 +391,11 @@ static void get_source_info( HINF hinf, const WCHAR *src_file, SP_FILE_COPY_PARA
}
if (SetupGetStringFieldW( &disk_ctx, 1, NULL, 0, &len ) && len > sizeof(WCHAR)
&& (params->SourceDescription = heap_alloc( len * sizeof(WCHAR) )))
&& (params->SourceDescription = malloc( len * sizeof(WCHAR) )))
SetupGetStringFieldW( &disk_ctx, 1, (WCHAR *)params->SourceDescription, len, NULL );
if (SetupGetStringFieldW( &disk_ctx, 2, NULL, 0, &len ) && len > sizeof(WCHAR)
&& (params->SourceTagfile = heap_alloc( len * sizeof(WCHAR) )))
&& (params->SourceTagfile = malloc( len * sizeof(WCHAR) )))
SetupGetStringFieldW( &disk_ctx, 2, (WCHAR *)params->SourceTagfile, len, NULL );
if (SetupGetStringFieldW( &disk_ctx, 4, NULL, 0, &len ) && len > sizeof(WCHAR)
@ -432,7 +431,7 @@ static WCHAR *get_destination_dir( HINF hinf, const WCHAR *section )
return dir;
GetSystemDirectoryW( systemdir, MAX_PATH );
return strdupW( systemdir );
return wcsdup( systemdir );
}
struct extract_cab_ctx
@ -516,7 +515,7 @@ HSPFILEQ WINAPI SetupOpenFileQueue(void)
{
struct file_queue *queue;
if (!(queue = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*queue))))
if (!(queue = calloc( 1, sizeof(*queue) )))
return INVALID_HANDLE_VALUE;
queue->magic = FILE_QUEUE_MAGIC;
return queue;
@ -544,12 +543,12 @@ BOOL WINAPI SetupCloseFileQueue( HSPFILEQ handle )
free_file_op_queue( &queue->delete_queue );
for (i = 0; i < queue->source_count; ++i)
{
heap_free( queue->sources[i]->desc );
heap_free( queue->sources[i]->tag );
heap_free( queue->sources[i] );
free( queue->sources[i]->desc );
free( queue->sources[i]->tag );
free( queue->sources[i] );
}
heap_free( queue->sources );
HeapFree( GetProcessHeap(), 0, queue );
free( queue->sources );
free( queue );
return TRUE;
}
@ -577,14 +576,14 @@ BOOL WINAPI SetupQueueCopyIndirectA( SP_FILE_COPY_PARAMS_A *paramsA )
ret = SetupQueueCopyIndirectW( &paramsW );
heap_free( (WCHAR *)paramsW.SourceRootPath );
heap_free( (WCHAR *)paramsW.SourcePath );
heap_free( (WCHAR *)paramsW.SourceFilename );
heap_free( (WCHAR *)paramsW.SourceDescription );
heap_free( (WCHAR *)paramsW.SourceTagfile );
heap_free( (WCHAR *)paramsW.TargetDirectory );
heap_free( (WCHAR *)paramsW.TargetFilename );
heap_free( (WCHAR *)paramsW.SecurityDescriptor );
free( (WCHAR *)paramsW.SourceRootPath );
free( (WCHAR *)paramsW.SourcePath );
free( (WCHAR *)paramsW.SourceFilename );
free( (WCHAR *)paramsW.SourceDescription );
free( (WCHAR *)paramsW.SourceTagfile );
free( (WCHAR *)paramsW.TargetDirectory );
free( (WCHAR *)paramsW.TargetFilename );
free( (WCHAR *)paramsW.SecurityDescriptor );
return ret;
}
@ -608,11 +607,11 @@ static struct source_media *get_source_media(struct file_queue *queue,
}
}
queue->sources = heap_realloc( queue->sources, ++queue->source_count * sizeof(*queue->sources) );
queue->sources[i] = heap_alloc( sizeof(*queue->sources[i]) );
queue->sources = realloc( queue->sources, ++queue->source_count * sizeof(*queue->sources) );
queue->sources[i] = malloc( sizeof(*queue->sources[i]) );
lstrcpyW(queue->sources[i]->root, root);
queue->sources[i]->desc = strdupW(desc);
queue->sources[i]->tag = strdupW(tag);
queue->sources[i]->desc = wcsdup( desc );
queue->sources[i]->tag = wcsdup( tag );
queue->sources[i]->resolved = FALSE;
queue->sources[i]->cabinet = FALSE;
@ -631,12 +630,12 @@ BOOL WINAPI SetupQueueCopyIndirectW( PSP_FILE_COPY_PARAMS_W params )
PWSTR src_root = NULL, src_descr = NULL, src_tag = NULL;
#endif
if (!(op = HeapAlloc( GetProcessHeap(), 0, sizeof(*op) ))) return FALSE;
if (!(op = malloc( sizeof(*op) ))) return FALSE;
op->style = params->CopyStyle;
op->src_path = strdupW( params->SourcePath );
op->src_file = strdupW( params->SourceFilename );
op->dst_path = strdupW( params->TargetDirectory );
op->dst_file = strdupW( params->TargetFilename );
op->src_path = wcsdup( params->SourcePath );
op->src_file = wcsdup( params->SourceFilename );
op->dst_path = wcsdup( params->TargetDirectory );
op->dst_file = wcsdup( params->TargetFilename );
#ifdef __REACTOS__
op->dst_sd = NULL;
if (params->SecurityDescriptor)
@ -667,9 +666,9 @@ BOOL WINAPI SetupQueueCopyIndirectW( PSP_FILE_COPY_PARAMS_W params )
params->SourceRootPath = org_src_root;
params->SourceDescription = org_src_descr;
params->SourceTagfile = org_src_tag;
if (src_root) HeapFree(GetProcessHeap(), 0, src_root);
if (src_descr) HeapFree(GetProcessHeap(), 0, src_descr);
if (src_tag) HeapFree(GetProcessHeap(), 0, src_tag);
if (src_root) free(src_root);
if (src_descr) free(src_descr);
if (src_tag) free(src_tag);
}
#endif
@ -793,9 +792,9 @@ BOOL WINAPI SetupQueueDefaultCopyW( HSPFILEQ queue, HINF hinf, PCWSTR src_root,
ret = SetupQueueCopyIndirectW( &params );
heap_free( (WCHAR *)params.TargetDirectory );
heap_free( (WCHAR *)params.SourceDescription );
heap_free( (WCHAR *)params.SourceTagfile );
free( (WCHAR *)params.TargetDirectory );
free( (WCHAR *)params.SourceDescription );
free( (WCHAR *)params.SourceTagfile );
return ret;
}
@ -808,7 +807,7 @@ BOOL WINAPI SetupQueueDeleteA( HSPFILEQ handle, PCSTR part1, PCSTR part2 )
struct file_queue *queue = handle;
struct file_op *op;
if (!(op = heap_alloc_zero( sizeof(*op) ))) return FALSE;
if (!(op = calloc( 1, sizeof(*op) ))) return FALSE;
op->dst_path = strdupAtoW( part1 );
op->dst_file = strdupAtoW( part2 );
queue_file_op( &queue->delete_queue, op );
@ -824,9 +823,9 @@ BOOL WINAPI SetupQueueDeleteW( HSPFILEQ handle, PCWSTR part1, PCWSTR part2 )
struct file_queue *queue = handle;
struct file_op *op;
if (!(op = heap_alloc_zero( sizeof(*op) ))) return FALSE;
op->dst_path = strdupW( part1 );
op->dst_file = strdupW( part2 );
if (!(op = calloc( 1, sizeof(*op) ))) return FALSE;
op->dst_path = wcsdup( part1 );
op->dst_file = wcsdup( part2 );
queue_file_op( &queue->delete_queue, op );
return TRUE;
}
@ -841,7 +840,7 @@ BOOL WINAPI SetupQueueRenameA( HSPFILEQ handle, PCSTR SourcePath, PCSTR SourceFi
struct file_queue *queue = handle;
struct file_op *op;
if (!(op = heap_alloc_zero( sizeof(*op) ))) return FALSE;
if (!(op = calloc( 1, sizeof(*op) ))) return FALSE;
op->src_path = strdupAtoW( SourcePath );
op->src_file = strdupAtoW( SourceFilename );
op->dst_path = strdupAtoW( TargetPath ? TargetPath : SourcePath );
@ -860,11 +859,11 @@ BOOL WINAPI SetupQueueRenameW( HSPFILEQ handle, PCWSTR SourcePath, PCWSTR Source
struct file_queue *queue = handle;
struct file_op *op;
if (!(op = heap_alloc_zero( sizeof(*op) ))) return FALSE;
op->src_path = strdupW( SourcePath );
op->src_file = strdupW( SourceFilename );
op->dst_path = strdupW( TargetPath ? TargetPath : SourcePath );
op->dst_file = strdupW( TargetFilename );
if (!(op = calloc( 1, sizeof(*op) ))) return FALSE;
op->src_path = wcsdup( SourcePath );
op->src_file = wcsdup( SourceFilename );
op->dst_path = wcsdup( TargetPath ? TargetPath : SourcePath );
op->dst_file = wcsdup( TargetFilename );
queue_file_op( &queue->rename_queue, op );
return TRUE;
}
@ -996,13 +995,13 @@ BOOL WINAPI SetupQueueCopySectionW( HSPFILEQ queue, PCWSTR src_root, HINF hinf,
if (!SetupQueueCopyIndirectW( &params )) goto end;
heap_free( (WCHAR *)params.SourceDescription );
heap_free( (WCHAR *)params.SourceTagfile );
free( (WCHAR *)params.SourceDescription );
free( (WCHAR *)params.SourceTagfile );
} while (SetupFindNextLine( &context, &context ));
ret = TRUE;
end:
HeapFree(GetProcessHeap(), 0, dest_dir);
free( dest_dir );
done:
#ifdef __REACTOS__
if (security_descriptor)
@ -1056,7 +1055,7 @@ BOOL WINAPI SetupQueueDeleteSectionW( HSPFILEQ queue, HINF hinf, HINF hlist, PCW
ret = TRUE;
done:
HeapFree( GetProcessHeap(), 0, dest_dir );
free( dest_dir );
return ret;
}
@ -1105,7 +1104,7 @@ BOOL WINAPI SetupQueueRenameSectionW( HSPFILEQ queue, HINF hinf, HINF hlist, PCW
ret = TRUE;
done:
HeapFree( GetProcessHeap(), 0, dest_dir );
free( dest_dir );
return ret;
}
@ -1135,7 +1134,7 @@ static BOOL create_full_pathW(const WCHAR *path)
int len;
WCHAR *new_path;
new_path = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(path) + 1) * sizeof(WCHAR));
new_path = malloc((lstrlenW(path) + 1) * sizeof(WCHAR));
lstrcpyW(new_path, path);
while((len = lstrlenW(new_path)) && new_path[len - 1] == '\\')
@ -1171,7 +1170,7 @@ static BOOL create_full_pathW(const WCHAR *path)
new_path[len] = '\\';
}
HeapFree(GetProcessHeap(), 0, new_path);
free(new_path);
return ret;
}
@ -1356,8 +1355,8 @@ static BOOL do_file_copyW( LPCWSTR source, LPCWSTR target, DWORD style,
UINT length;
DWORD ret;
VersionSource = HeapAlloc(GetProcessHeap(),0,VersionSizeSource);
VersionTarget = HeapAlloc(GetProcessHeap(),0,VersionSizeTarget);
VersionSource = malloc(VersionSizeSource);
VersionTarget = malloc(VersionSizeTarget);
ret = GetFileVersionInfoW(TempFile,0,VersionSizeSource,VersionSource);
if (ret)
@ -1412,8 +1411,8 @@ static BOOL do_file_copyW( LPCWSTR source, LPCWSTR target, DWORD style,
}
}
}
HeapFree(GetProcessHeap(),0,VersionSource);
HeapFree(GetProcessHeap(),0,VersionTarget);
free(VersionSource);
free(VersionTarget);
}
}
if (style & (SP_COPY_NOOVERWRITE | SP_COPY_FORCE_NOOVERWRITE))
@ -1551,14 +1550,14 @@ BOOL WINAPI SetupInstallFileExW( HINF hinf, PINFCONTEXT inf_context, PCWSTR sour
if (!SetupFindFirstLineW( hinf, L"CopyFiles", NULL, inf_context )) return FALSE;
}
if (!SetupGetStringFieldW( inf_context, 1, NULL, 0, (PDWORD) &len )) return FALSE;
if (!(inf_source = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
if (!(inf_source = malloc( len * sizeof(WCHAR) )))
{
SetLastError( ERROR_NOT_ENOUGH_MEMORY );
return FALSE;
}
if (!SetupGetStringFieldW( inf_context, 1, inf_source, len, NULL ))
{
HeapFree( GetProcessHeap(), 0, inf_source );
free( inf_source );
return FALSE;
}
source = inf_source;
@ -1567,7 +1566,7 @@ BOOL WINAPI SetupInstallFileExW( HINF hinf, PINFCONTEXT inf_context, PCWSTR sour
{
lstrcpyW( dest_path, dest_dir );
lstrcatW( dest_path, L"\\" );
heap_free( dest_dir );
free( dest_dir );
}
}
else if (!source)
@ -1579,9 +1578,9 @@ BOOL WINAPI SetupInstallFileExW( HINF hinf, PINFCONTEXT inf_context, PCWSTR sour
len = lstrlenW( source ) + 1;
if (absolute) len += lstrlenW( root ) + 1;
if (!(p = buffer = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
if (!(p = buffer = malloc( len * sizeof(WCHAR) )))
{
HeapFree( GetProcessHeap(), 0, inf_source );
free( inf_source );
SetLastError( ERROR_NOT_ENOUGH_MEMORY );
return FALSE;
}
@ -1599,8 +1598,8 @@ BOOL WINAPI SetupInstallFileExW( HINF hinf, PINFCONTEXT inf_context, PCWSTR sour
ret = do_file_copyW( buffer, dest_path, style, handler, context );
HeapFree( GetProcessHeap(), 0, inf_source );
HeapFree( GetProcessHeap(), 0, buffer );
free( inf_source );
free( buffer );
return ret;
}
@ -1733,7 +1732,7 @@ BOOL WINAPI SetupCommitFileQueueW( HWND owner, HSPFILEQ handle, PSP_FILE_CALLBAC
lstrcatW(op->media->root, L"\\");
lstrcatW(op->media->root, op->src_path);
heap_free(op->src_path);
free(op->src_path);
op->src_path = NULL;
}
@ -2033,7 +2032,7 @@ PVOID WINAPI SetupInitDefaultQueueCallbackEx( HWND owner, HWND progress, UINT ms
{
struct default_callback_context *context;
if ((context = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*context) )))
if ((context = calloc( 1, sizeof(*context) )))
{
context->magic = 0x43515053; /* "SPQC" */
context->owner = owner;
@ -2049,7 +2048,7 @@ PVOID WINAPI SetupInitDefaultQueueCallbackEx( HWND owner, HWND progress, UINT ms
*/
void WINAPI SetupTermDefaultQueueCallback( PVOID context )
{
HeapFree( GetProcessHeap(), 0, context );
free( context );
}

View file

@ -295,24 +295,13 @@ extern DWORD GlobalSetupFlags;
#define REGPART_RENAME "\\Rename"
#define REG_VERSIONCONFLICT "Software\\Microsoft\\VersionConflictManager"
static inline WCHAR *strdupW( const WCHAR *str )
{
WCHAR *ret = NULL;
if (str)
{
int len = (strlenW(str) + 1) * sizeof(WCHAR);
if ((ret = HeapAlloc( GetProcessHeap(), 0, len ))) memcpy( ret, str, len );
}
return ret;
}
static inline char *strdupWtoA( const WCHAR *str )
{
char *ret = NULL;
if (str)
{
DWORD len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL );
if ((ret = HeapAlloc( GetProcessHeap(), 0, len )))
if ((ret = malloc( len )))
WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL );
}
return ret;
@ -324,7 +313,7 @@ static inline WCHAR *strdupAtoW( const char *str )
if (str)
{
DWORD len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
if ((ret = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
if ((ret = malloc( len * sizeof(WCHAR) )))
MultiByteToWideChar( CP_ACP, 0, str, -1, ret, len );
}
return ret;

View file

@ -40,12 +40,12 @@ typedef struct
static void * CDECL sc_cb_alloc(ULONG cb)
{
return HeapAlloc(GetProcessHeap(), 0, cb);
return malloc(cb);
}
static void CDECL sc_cb_free(void *pv)
{
HeapFree(GetProcessHeap(), 0, pv);
free(pv);
}
static INT_PTR CDECL sc_cb_open(char *pszFile, int oflag, int pmode)

View file

@ -404,7 +404,7 @@ DWORD WINAPI StringTableAddStringEx(HSTRING_TABLE hTable, LPWSTR string,
len = sizeof(DWORD) + (lstrlenW(string)+1)*sizeof(WCHAR) + table->max_extra_size;
if (table->nextoffset + len >= table->allocated) {
table->allocated <<= 1;
table->data = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, table->data, table->allocated);
table->data = _recalloc(table->data, 1, table->allocated);
}
/* hash string */

View file

@ -10,4 +10,4 @@ files:
dlls/setupapi/setupcab.c: dll/win32/setupapi/setupcab.c
dlls/setupapi/stringtable.c: dll/win32/setupapi/stringtable_wine.c
tags:
wine: d3a9fa181cbf81f6b920d6ddc3760e78d1d18601
wine: c293cd781fb4b330b7d93171501134f86a5138b8