Commit 7cc7a6de authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

msi: Use the wcsdup function instead of reimplementing it.

parent ccfa33b0
......@@ -1051,7 +1051,7 @@ static UINT load_file(MSIRECORD *row, LPVOID param)
msi_reduce_to_long_filename( file->FileName );
file->ShortName = msi_dup_record_field( row, 3 );
file->LongName = strdupW( folder_split_path(file->ShortName, '|'));
file->LongName = wcsdup( folder_split_path(file->ShortName, '|') );
file->FileSize = MSI_RecordGetInteger( row, 4 );
file->Version = msi_dup_record_field( row, 5 );
......@@ -1307,9 +1307,9 @@ static UINT load_folder( MSIRECORD *row, LPVOID param )
src_long = src_short;
/* FIXME: use the target short path too */
folder->TargetDefault = strdupW(tgt_long);
folder->SourceShortPath = strdupW(src_short);
folder->SourceLongPath = strdupW(src_long);
folder->TargetDefault = wcsdup(tgt_long);
folder->SourceShortPath = wcsdup(src_short);
folder->SourceLongPath = wcsdup(src_long);
msi_free(p);
TRACE("TargetDefault = %s\n",debugstr_w( folder->TargetDefault ));
......@@ -1960,7 +1960,7 @@ static WCHAR *create_temp_dir( MSIDATABASE *db )
{
GetTempPathW( MAX_PATH, tmp );
}
if (!(db->tempfolder = strdupW( tmp ))) return NULL;
if (!(db->tempfolder = wcsdup( tmp ))) return NULL;
}
if ((ret = msi_alloc( (lstrlenW( db->tempfolder ) + 20) * sizeof(WCHAR) )))
......@@ -2480,7 +2480,7 @@ static HKEY open_key( const MSICOMPONENT *comp, HKEY root, const WCHAR *path, BO
access |= get_registry_view( comp );
if (!(subkey = strdupW( path ))) return NULL;
if (!(subkey = wcsdup( path ))) return NULL;
p = subkey;
if ((q = wcschr( p, '\\' ))) *q = 0;
if (create)
......@@ -2525,7 +2525,7 @@ static WCHAR **split_multi_string_values( const WCHAR *str, DWORD len, DWORD *co
p = str;
while ((p - str) < len)
{
if (!(ret[i] = strdupW( p )))
if (!(ret[i] = wcsdup( p )))
{
for (; i >= 0; i--) msi_free( ret[i] );
msi_free( ret );
......@@ -2823,7 +2823,7 @@ static void delete_key( const MSICOMPONENT *comp, HKEY root, const WCHAR *path )
WCHAR *subkey, *p;
HKEY hkey;
if (!(subkey = strdupW( path ))) return;
if (!(subkey = wcsdup( path ))) return;
do
{
if ((p = wcsrchr( subkey, '\\' )))
......@@ -3128,7 +3128,7 @@ static LPWSTR resolve_keypath( MSIPACKAGE* package, MSICOMPONENT *cmp )
{
if (!cmp->KeyPath)
return strdupW( msi_get_target_folder( package, cmp->Directory ) );
return wcsdup( msi_get_target_folder( package, cmp->Directory ) );
if (cmp->Attributes & msidbComponentAttributesRegistryKeyPath)
{
......@@ -3174,7 +3174,7 @@ static LPWSTR resolve_keypath( MSIPACKAGE* package, MSICOMPONENT *cmp )
MSIFILE *file = msi_get_loaded_file( package, cmp->KeyPath );
if (file)
return strdupW( file->TargetPath );
return wcsdup( file->TargetPath );
}
return NULL;
}
......@@ -3445,7 +3445,7 @@ static BOOL CALLBACK Typelib_EnumResNameProc( HMODULE hModule, LPCWSTR lpszType,
sz = lstrlenW(tl_struct->source)+4;
if ((INT_PTR)lpszName == 1)
tl_struct->path = strdupW(tl_struct->source);
tl_struct->path = wcsdup(tl_struct->source);
else
{
tl_struct->path = msi_alloc(sz * sizeof(WCHAR));
......@@ -3532,7 +3532,7 @@ static UINT ITERATE_RegisterTypeLibraries(MSIRECORD *row, LPVOID param)
LPCWSTR guid;
guid = MSI_RecordGetString(row,1);
CLSIDFromString( guid, &tl_struct.clsid);
tl_struct.source = strdupW( file->TargetPath );
tl_struct.source = wcsdup( file->TargetPath );
tl_struct.path = NULL;
EnumResourceNamesW(module, L"TYPELIB", Typelib_EnumResNameProc,
......@@ -4316,7 +4316,7 @@ static WCHAR *get_ini_file_name( MSIPACKAGE *package, MSIRECORD *row )
dirprop = MSI_RecordGetString( row, 3 );
if (dirprop)
{
folder = strdupW( msi_get_target_folder( package, dirprop ) );
folder = wcsdup( msi_get_target_folder( package, dirprop ) );
if (!folder) folder = msi_dup_property( package->db, dirprop );
}
else
......@@ -5211,7 +5211,7 @@ static UINT ACTION_ResolveSource(MSIPACKAGE* package)
INSTALLPROPERTY_DISKPROMPTW,prompt,&size);
}
else
prompt = strdupW(package->db->path);
prompt = wcsdup(package->db->path);
record = MSI_CreateRecord(2);
MSI_RecordSetInteger(record, 1, MSIERR_INSERTDISK);
......@@ -6272,7 +6272,7 @@ static UINT ITERATE_InstallODBCDriver( MSIRECORD *rec, LPVOID param )
const WCHAR *dir = msi_get_target_folder( package, driver_file->Component->Directory );
driver_file->TargetPath = msi_build_directory_name( 2, dir, driver_file->FileName );
}
driver_path = strdupW(driver_file->TargetPath);
driver_path = wcsdup(driver_file->TargetPath);
ptr = wcsrchr(driver_path, '\\');
if (ptr) *ptr = '\0';
......@@ -6355,7 +6355,7 @@ static UINT ITERATE_InstallODBCTranslator( MSIRECORD *rec, LPVOID param )
}
*ptr = '\0';
translator_path = strdupW(translator_file->TargetPath);
translator_path = wcsdup(translator_file->TargetPath);
ptr = wcsrchr(translator_path, '\\');
if (ptr) *ptr = '\0';
......@@ -6841,7 +6841,7 @@ static UINT ITERATE_WriteEnvironmentString( MSIRECORD *rec, LPVOID param )
goto done;
}
size = (lstrlenW(value) + 1) * sizeof(WCHAR);
newval = strdupW(value);
newval = wcsdup(value);
if (!newval)
{
res = ERROR_OUTOFMEMORY;
......@@ -7651,7 +7651,7 @@ UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR szPackagePath,
LPWSTR p, dir;
LPCWSTR file;
dir = strdupW(szPackagePath);
dir = wcsdup(szPackagePath);
p = wcsrchr(dir, '\\');
if (p)
{
......
......@@ -169,7 +169,7 @@ static WCHAR *search_file( MSIPACKAGE *package, WCHAR *path, MSISIGNATURE *sig )
attr = msi_get_file_attributes( package, path );
if (attr != INVALID_FILE_ATTRIBUTES && (attr & FILE_ATTRIBUTE_DIRECTORY))
return strdupW(path);
return wcsdup(path);
return NULL;
}
......@@ -180,7 +180,7 @@ static WCHAR *search_file( MSIPACKAGE *package, WCHAR *path, MSISIGNATURE *sig )
size = msi_get_file_version_info( package, path, 0, NULL );
if (!size)
return strdupW(path);
return wcsdup(path);
buffer = msi_alloc(size);
if (!buffer)
......@@ -213,7 +213,7 @@ static WCHAR *search_file( MSIPACKAGE *package, WCHAR *path, MSISIGNATURE *sig )
goto done;
}
val = strdupW(path);
val = wcsdup(path);
done:
msi_free(buffer);
......@@ -276,7 +276,7 @@ static UINT search_components( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATU
else
PathAddBackslashW(path);
*appValue = strdupW(path);
*appValue = wcsdup(path);
}
else if (sigpresent)
{
......@@ -285,7 +285,7 @@ static UINT search_components( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATU
attr = msi_get_file_attributes( package, path );
if (attr != INVALID_FILE_ATTRIBUTES && !(attr & FILE_ATTRIBUTE_DIRECTORY))
*appValue = strdupW(path);
*appValue = wcsdup(path);
}
done:
......@@ -474,7 +474,7 @@ static LPWSTR get_ini_field(LPWSTR buf, int field)
int i = 1;
if (field == 0)
return strdupW(buf);
return wcsdup(buf);
beg = buf;
while ((end = wcschr(beg, ',')) && i < field)
......@@ -491,7 +491,7 @@ static LPWSTR get_ini_field(LPWSTR buf, int field)
end = beg + lstrlenW(beg);
*end = '\0';
return strdupW(beg);
return wcsdup(beg);
}
static UINT search_ini( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE *sig )
......@@ -590,7 +590,7 @@ static void expand_any_path( MSIPACKAGE *package, WCHAR *src, WCHAR *dst, size_t
static LANGID *parse_languages( const WCHAR *languages, DWORD *num_ids )
{
UINT i, count = 1;
WCHAR *str = strdupW( languages ), *p, *q;
WCHAR *str = wcsdup( languages ), *p, *q;
LANGID *ret;
if (!str) return NULL;
......@@ -851,7 +851,7 @@ static UINT check_directory( MSIPACKAGE *package, const WCHAR *dir, WCHAR **appV
if (attr != INVALID_FILE_ATTRIBUTES && (attr & FILE_ATTRIBUTE_DIRECTORY))
{
TRACE("directory exists, returning %s\n", debugstr_w(dir));
*appValue = strdupW(dir);
*appValue = wcsdup(dir);
}
return ERROR_SUCCESS;
......
......@@ -327,13 +327,13 @@ MSIASSEMBLY *msi_load_assembly( MSIPACKAGE *package, MSICOMPONENT *comp )
msiobj_release( &rec->hdr );
return NULL;
}
a->feature = strdupW( MSI_RecordGetString( rec, 2 ) );
a->feature = wcsdup( MSI_RecordGetString( rec, 2 ) );
TRACE("feature %s\n", debugstr_w(a->feature));
a->manifest = strdupW( MSI_RecordGetString( rec, 3 ) );
a->manifest = wcsdup( MSI_RecordGetString( rec, 3 ) );
TRACE("manifest %s\n", debugstr_w(a->manifest));
a->application = strdupW( MSI_RecordGetString( rec, 4 ) );
a->application = wcsdup( MSI_RecordGetString( rec, 4 ) );
TRACE("application %s\n", debugstr_w(a->application));
a->attributes = MSI_RecordGetInteger( rec, 5 );
......
......@@ -254,14 +254,14 @@ static MSICLASS *load_class( MSIPACKAGE* package, MSIRECORD *row )
switch(i)
{
case 1:
cls->DefInprocHandler = strdupW(L"ole2.dll");
cls->DefInprocHandler = wcsdup(L"ole2.dll");
break;
case 2:
cls->DefInprocHandler32 = strdupW(L"ole32.dll");
cls->DefInprocHandler32 = wcsdup(L"ole32.dll");
break;
case 3:
cls->DefInprocHandler = strdupW(L"ole2.dll");
cls->DefInprocHandler32 = strdupW(L"ole32.dll");
cls->DefInprocHandler = wcsdup(L"ole2.dll");
cls->DefInprocHandler32 = wcsdup(L"ole32.dll");
break;
}
}
......@@ -333,7 +333,7 @@ static MSIMIME *load_mime( MSIPACKAGE* package, MSIRECORD *row )
extension = MSI_RecordGetString( row, 2 );
mt->Extension = load_given_extension( package, extension );
mt->suffix = strdupW( extension );
mt->suffix = wcsdup( extension );
mt->clsid = msi_dup_record_field( row, 3 );
mt->Class = load_given_class( package, mt->clsid );
......
......@@ -413,8 +413,8 @@ static int COND_IsNumber( WCHAR x )
static WCHAR *strstriW( const WCHAR *str, const WCHAR *sub )
{
LPWSTR strlower, sublower, r;
strlower = CharLowerW( strdupW( str ) );
sublower = CharLowerW( strdupW( sub ) );
strlower = CharLowerW( wcsdup( str ) );
sublower = CharLowerW( wcsdup( sub ) );
r = wcsstr( strlower, sublower );
if (r)
r = (LPWSTR)str + (r - strlower);
......
......@@ -98,7 +98,7 @@ UINT msi_schedule_action( MSIPACKAGE *package, UINT script, const WCHAR *action
package->script_actions_count[script] * sizeof(WCHAR *) );
else newbuf = msi_alloc( sizeof(WCHAR *) );
newbuf[count] = strdupW( action );
newbuf[count] = wcsdup( action );
package->script_actions[script] = newbuf;
return ERROR_SUCCESS;
}
......@@ -116,7 +116,7 @@ UINT msi_register_unique_action( MSIPACKAGE *package, const WCHAR *action )
package->unique_actions_count * sizeof(WCHAR *) );
else newbuf = msi_alloc( sizeof(WCHAR *) );
newbuf[count] = strdupW( action );
newbuf[count] = wcsdup( action );
package->unique_actions = newbuf;
return ERROR_SUCCESS;
}
......@@ -178,7 +178,7 @@ static LPWSTR msi_get_deferred_action(LPCWSTR action, LPCWSTR actiondata,
DWORD len;
if (!actiondata)
return strdupW(action);
return wcsdup(action);
len = lstrlenW(action) + lstrlenW(actiondata) +
lstrlenW(usersid) + lstrlenW(prodcode) +
......@@ -219,7 +219,7 @@ WCHAR *msi_create_temp_file( MSIDATABASE *db )
{
GetTempPathW( MAX_PATH, tmp );
}
if (!(db->tempfolder = strdupW( tmp ))) return NULL;
if (!(db->tempfolder = wcsdup( tmp ))) return NULL;
}
if ((ret = msi_alloc( (lstrlenW( db->tempfolder ) + 20) * sizeof(WCHAR) )))
......@@ -267,7 +267,7 @@ static MSIBINARY *create_temp_binary(MSIPACKAGE *package, LPCWSTR source)
CloseHandle( file );
if (r != ERROR_SUCCESS) goto error;
binary->source = strdupW( source );
binary->source = wcsdup( source );
binary->tmpfile = tmpfile;
list_add_tail( &package->binaries, &binary->entry );
......@@ -304,7 +304,7 @@ static void file_running_action(MSIPACKAGE* package, HANDLE Handle,
action->handle = Handle;
action->process = process;
action->name = strdupW(name);
action->name = wcsdup(name);
list_add_tail( &package->RunningActions, &action->entry );
}
......@@ -754,9 +754,9 @@ static msi_custom_action_info *do_msidbCustomActionTypeDll(
msiobj_addref( &package->hdr );
info->package = package;
info->type = type;
info->target = strdupW( target );
info->source = strdupW( source );
info->action = strdupW( action );
info->target = wcsdup( target );
info->source = wcsdup( source );
info->action = wcsdup( action );
CoCreateGuid( &info->guid );
EnterCriticalSection( &msi_custom_action_cs );
......@@ -1201,9 +1201,9 @@ static msi_custom_action_info *do_msidbCustomActionTypeScript(
msiobj_addref( &package->hdr );
info->package = package;
info->type = type;
info->target = strdupW( function );
info->source = strdupW( script );
info->action = strdupW( action );
info->target = wcsdup( function );
info->source = wcsdup( script );
info->action = wcsdup( action );
CoCreateGuid( &info->guid );
EnterCriticalSection( &msi_custom_action_cs );
......@@ -1615,10 +1615,10 @@ UINT __cdecl s_remote_GetActionInfo(const GUID *guid, WCHAR **name, int *type, W
if (!info)
return ERROR_INVALID_DATA;
*name = strdupW(info->action);
*name = wcsdup(info->action);
*type = info->type;
*hinst = alloc_msihandle(&info->package->hdr);
*dll = strdupW(info->source);
*dll = wcsdup(info->source);
*func = strdupWtoA(info->target);
return ERROR_SUCCESS;
......
......@@ -262,7 +262,7 @@ UINT MSI_OpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIDATABASE **pdb)
else
lstrcpyW( path, save_path );
db->path = strdupW( path );
db->path = wcsdup( path );
db->media_transform_offset = MSI_INITIAL_MEDIA_TRANSFORM_OFFSET;
db->media_transform_disk_id = MSI_INITIAL_MEDIA_TRANSFORM_DISKID;
......@@ -272,7 +272,7 @@ UINT MSI_OpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIDATABASE **pdb)
db->storage = stg;
db->mode = mode;
if (created)
db->deletefile = strdupW( szDBPath );
db->deletefile = wcsdup( szDBPath );
list_init( &db->tables );
list_init( &db->transforms );
......@@ -1542,10 +1542,10 @@ static UINT msi_get_table_labels(MSIDATABASE *db, LPCWSTR table, LPWSTR **labels
goto end;
}
(*labels)[0] = strdupW(table);
(*labels)[0] = wcsdup(table);
for (i=1; i<=count; i++ )
{
(*labels)[i] = strdupW(MSI_RecordGetString(prec, i));
(*labels)[i] = wcsdup(MSI_RecordGetString(prec, i));
}
end:
......@@ -1572,7 +1572,7 @@ static UINT msi_get_query_columns(MSIQUERY *query, LPWSTR **columns, DWORD *numc
for (i=1; i<=count; i++ )
{
(*columns)[i-1] = strdupW(MSI_RecordGetString(prec, i));
(*columns)[i-1] = wcsdup(MSI_RecordGetString(prec, i));
}
*numcolumns = count;
......@@ -1602,7 +1602,7 @@ static UINT msi_get_query_types(MSIQUERY *query, LPWSTR **types, DWORD *numtypes
*numtypes = count;
for (i=1; i<=count; i++ )
{
(*types)[i-1] = strdupW(MSI_RecordGetString(prec, i));
(*types)[i-1] = wcsdup(MSI_RecordGetString(prec, i));
}
end:
......@@ -1689,7 +1689,7 @@ static UINT msi_get_merge_table (MSIDATABASE *db, LPCWSTR name, MERGETABLE **pta
list_init(&table->rows);
table->name = strdupW(name);
table->name = wcsdup(name);
table->numconflicts = 0;
msiobj_release(&mergeview->hdr);
......
......@@ -225,7 +225,7 @@ static LPWSTR msi_dialog_dup_property( msi_dialog *dialog, LPCWSTR property, BOO
prop = msi_dup_property( dialog->package->db, property );
if (!prop)
prop = strdupW( property );
prop = wcsdup( property );
return prop;
}
......@@ -402,8 +402,8 @@ static msi_control *dialog_create_window( msi_dialog *dialog, MSIRECORD *rec, DW
control->hIcon = NULL;
control->hImageList = NULL;
control->hDll = NULL;
control->tabnext = strdupW( MSI_RecordGetString( rec, 11) );
control->type = strdupW( MSI_RecordGetString( rec, 3 ) );
control->tabnext = wcsdup( MSI_RecordGetString( rec, 11 ) );
control->type = wcsdup( MSI_RecordGetString( rec, 3 ) );
control->progress_current = 0;
control->progress_max = 100;
control->progress_backwards = FALSE;
......@@ -446,7 +446,7 @@ static LPWSTR msi_dialog_get_uitext( msi_dialog *dialog, LPCWSTR key )
rec = MSI_QueryGetRecord( dialog->package->db, L"SELECT * FROM `UIText` WHERE `Key` = '%s'", key );
if (!rec) return NULL;
text = strdupW( MSI_RecordGetString( rec, 2 ) );
text = wcsdup( MSI_RecordGetString( rec, 2 ) );
msiobj_release( &rec->hdr );
return text;
}
......@@ -677,9 +677,9 @@ static void event_subscribe( msi_dialog *dialog, const WCHAR *event, const WCHAR
}
if (!(sub = msi_alloc( sizeof(*sub) ))) return;
sub->dialog = dialog;
sub->event = strdupW( event );
sub->control = strdupW( control );
sub->attribute = strdupW( attribute );
sub->event = wcsdup( event );
sub->control = wcsdup( control );
sub->attribute = wcsdup( attribute );
list_add_tail( &dialog->package->subscriptions, &sub->entry );
}
......@@ -856,7 +856,7 @@ static WCHAR *msi_get_binary_name( MSIPACKAGE *package, MSIRECORD *rec )
while (*p && *p != '}') p++;
if (!*p++) return text;
p = strdupW( p );
p = wcsdup( p );
msi_free( text );
return p;
}
......@@ -1163,7 +1163,7 @@ static UINT msi_dialog_checkbox_control( msi_dialog *dialog, MSIRECORD *rec )
prop = MSI_RecordGetString( rec, 9 );
if (prop)
{
control->property = strdupW( prop );
control->property = wcsdup( prop );
control->value = msi_get_checkbox_value( dialog, prop );
TRACE("control %s value %s\n", debugstr_w(control->property), debugstr_w(control->value));
}
......@@ -1207,8 +1207,8 @@ static UINT msi_dialog_line_control( msi_dialog *dialog, MSIRECORD *rec )
control->hBitmap = NULL;
control->hIcon = NULL;
control->hDll = NULL;
control->tabnext = strdupW( MSI_RecordGetString( rec, 11) );
control->type = strdupW( MSI_RecordGetString( rec, 3 ) );
control->tabnext = wcsdup( MSI_RecordGetString( rec, 11 ) );
control->type = wcsdup( MSI_RecordGetString( rec, 3 ) );
control->progress_current = 0;
control->progress_max = 100;
control->progress_backwards = FALSE;
......@@ -1458,7 +1458,7 @@ static UINT msi_combobox_add_item( MSIRECORD *rec, LPVOID param )
value = MSI_RecordGetString( rec, 3 );
text = MSI_RecordGetString( rec, 4 );
info->items[info->addpos_items] = strdupW( value );
info->items[info->addpos_items] = wcsdup( value );
pos = SendMessageW( info->hwnd, CB_ADDSTRING, 0, (LPARAM)text );
SendMessageW( info->hwnd, CB_SETITEMDATA, pos, (LPARAM)info->items[info->addpos_items] );
......@@ -1705,7 +1705,7 @@ static UINT msi_dialog_edit_control( msi_dialog *dialog, MSIRECORD *rec )
prop = MSI_RecordGetString( rec, 9 );
if( prop )
control->property = strdupW( prop );
control->property = wcsdup( prop );
val = msi_dup_property( dialog->package->db, control->property );
SetWindowTextW( control->hwnd, val );
......@@ -1864,7 +1864,7 @@ msi_maskedit_set_text( struct msi_maskedit_info *info, LPCWSTR text )
{
if( info->group[i].len < lstrlenW( p ) )
{
LPWSTR chunk = strdupW( p );
WCHAR *chunk = wcsdup( p );
chunk[ info->group[i].len ] = 0;
SetWindowTextW( info->group[i].hwnd, chunk );
msi_free( chunk );
......@@ -2035,7 +2035,7 @@ static UINT msi_dialog_maskedit_control( msi_dialog *dialog, MSIRECORD *rec )
prop = MSI_RecordGetString( rec, 9 );
if( prop )
info->prop = strdupW( prop );
info->prop = wcsdup( prop );
msi_maskedit_create_children( info, font );
......@@ -2245,7 +2245,7 @@ static UINT msi_dialog_create_radiobutton( MSIRECORD *rec, LPVOID param )
prop = MSI_RecordGetString( rec, 1 );
if( prop )
control->property = strdupW( prop );
control->property = wcsdup( prop );
return ERROR_SUCCESS;
}
......@@ -2311,7 +2311,7 @@ static UINT msi_dialog_radiogroup_control( msi_dialog *dialog, MSIRECORD *rec )
SetWindowLongPtrW( control->hwnd, GWL_EXSTYLE, WS_EX_CONTROLPARENT );
if( prop )
control->property = strdupW( prop );
control->property = wcsdup( prop );
/* query the Radio Button table for all control in this group */
r = MSI_OpenQuery( package->db, &view, L"SELECT * FROM `RadioButton` WHERE `Property` = '%s'", prop );
......@@ -2744,7 +2744,7 @@ static UINT msi_listbox_add_item( MSIRECORD *rec, LPVOID param )
value = MSI_RecordGetString( rec, 3 );
text = MSI_RecordGetString( rec, 4 );
info->items[info->addpos_items] = strdupW( value );
info->items[info->addpos_items] = wcsdup( value );
pos = SendMessageW( info->hwnd, LB_ADDSTRING, 0, (LPARAM)text );
SendMessageW( info->hwnd, LB_SETITEMDATA, pos, (LPARAM)info->items[info->addpos_items] );
......@@ -3762,7 +3762,7 @@ static LRESULT msi_dialog_oncreate( HWND hwnd, LPCREATESTRUCTW cs )
dialog->default_font = msi_dup_property( dialog->package->db, L"DefaultUIFont" );
if (!dialog->default_font)
{
dialog->default_font = strdupW( L"MS Shell Dlg" );
dialog->default_font = wcsdup( L"MS Shell Dlg" );
if (!dialog->default_font)
{
msiobj_release( &rec->hdr );
......@@ -4024,8 +4024,8 @@ static msi_dialog *dialog_create( MSIPACKAGE *package, const WCHAR *name, msi_di
return NULL;
}
dialog->attributes = MSI_RecordGetInteger( rec, 6 );
dialog->control_default = strdupW( MSI_RecordGetString( rec, 9 ) );
dialog->control_cancel = strdupW( MSI_RecordGetString( rec, 10 ) );
dialog->control_default = wcsdup( MSI_RecordGetString( rec, 9 ) );
dialog->control_cancel = wcsdup( MSI_RecordGetString( rec, 10 ) );
msiobj_release( &rec->hdr );
rec = MSI_CreateRecord(2);
......@@ -4372,7 +4372,7 @@ static UINT pending_event_end_dialog( msi_dialog *dialog, const WCHAR *argument
{
dialog->pending_event = event_end_dialog;
msi_free( dialog->pending_argument );
dialog->pending_argument = strdupW( argument );
dialog->pending_argument = wcsdup( argument );
return ERROR_SUCCESS;
}
......@@ -4380,7 +4380,7 @@ static UINT pending_event_end_dialog( msi_dialog *dialog, const WCHAR *argument
static UINT event_new_dialog( msi_dialog *dialog, const WCHAR *argument )
{
/* store the name of the next dialog, and signal this one to end */
dialog->package->next_dialog = strdupW( argument );
dialog->package->next_dialog = wcsdup( argument );
msi_event_cleanup_all_subscriptions( dialog->package );
msi_dialog_end_dialog( dialog );
return ERROR_SUCCESS;
......@@ -4390,7 +4390,7 @@ static UINT pending_event_new_dialog( msi_dialog *dialog, const WCHAR *argument
{
dialog->pending_event = event_new_dialog;
msi_free( dialog->pending_argument );
dialog->pending_argument = strdupW( argument );
dialog->pending_argument = wcsdup( argument );
return ERROR_SUCCESS;
}
......@@ -4415,7 +4415,7 @@ static UINT pending_event_spawn_dialog( msi_dialog *dialog, const WCHAR *argumen
{
dialog->pending_event = event_spawn_dialog;
msi_free( dialog->pending_argument );
dialog->pending_argument = strdupW( argument );
dialog->pending_argument = wcsdup( argument );
return ERROR_SUCCESS;
}
......
......@@ -443,7 +443,7 @@ static UINT copy_install_file(MSIPACKAGE *package, MSIFILE *file, LPWSTR source)
TRACE("file in use, scheduling rename operation\n");
if (!(pathW = strdupW( file->TargetPath ))) return ERROR_OUTOFMEMORY;
if (!(pathW = wcsdup( file->TargetPath ))) return ERROR_OUTOFMEMORY;
if ((p = wcsrchr(pathW, '\\'))) *p = 0;
len = lstrlenW( pathW ) + 16;
if (!(tmpfileW = msi_alloc(len * sizeof(WCHAR))))
......@@ -522,7 +522,7 @@ static BOOL installfiles_cb(MSIPACKAGE *package, LPCWSTR filename, DWORD action,
{
create_directory( package, file->Component->Directory );
}
*path = strdupW( file->TargetPath );
*path = wcsdup( file->TargetPath );
*attrs = file->Attributes;
*(MSIFILE **)user = file;
}
......@@ -706,7 +706,7 @@ static BOOL patchfiles_cb(MSIPACKAGE *package, LPCWSTR file, DWORD action,
}
patch->path = msi_create_temp_file( package->db );
*path = strdupW( patch->path );
*path = wcsdup( patch->path );
*attrs = patch->File->Attributes;
*(MSIFILEPATCH **)user = patch;
}
......@@ -971,7 +971,7 @@ static BOOL add_wildcard( FILE_LIST *files, const WCHAR *source, WCHAR *dest )
if (!new)
return FALSE;
new->source = strdupW(source);
new->source = wcsdup(source);
ptr = wcsrchr(dest, '\\') + 1;
filename = wcsrchr(new->source, '\\') + 1;
......@@ -1125,7 +1125,7 @@ static UINT ITERATE_MoveFiles( MSIRECORD *rec, LPVOID param )
if (msi_get_file_attributes( package, sourcedir ) == INVALID_FILE_ATTRIBUTES)
goto done;
source = strdupW(sourcedir);
source = wcsdup(sourcedir);
if (!source)
goto done;
}
......@@ -1150,18 +1150,18 @@ static UINT ITERATE_MoveFiles( MSIRECORD *rec, LPVOID param )
{
WCHAR *p;
if (sourcename)
destname = strdupW(sourcename);
destname = wcsdup(sourcename);
else if ((p = wcsrchr(sourcedir, '\\')))
destname = strdupW(p + 1);
destname = wcsdup(p + 1);
else
destname = strdupW(sourcedir);
destname = wcsdup(sourcedir);
if (!destname)
goto done;
}
}
else
{
destname = strdupW(MSI_RecordGetString(rec, 4));
destname = wcsdup(MSI_RecordGetString(rec, 4));
if (destname) msi_reduce_to_long_filename(destname);
}
......@@ -1251,7 +1251,7 @@ static WCHAR *get_duplicate_filename( MSIPACKAGE *package, MSIRECORD *row, const
if (MSI_RecordIsNull( row, 5 ))
{
WCHAR *p;
dst_path = strdupW( src );
dst_path = wcsdup( src );
p = wcsrchr( dst_path, '\\' );
if (p) *p = 0;
}
......@@ -1259,7 +1259,7 @@ static WCHAR *get_duplicate_filename( MSIPACKAGE *package, MSIRECORD *row, const
{
const WCHAR *dst_key = MSI_RecordGetString( row, 5 );
dst_path = strdupW( msi_get_target_folder( package, dst_key ) );
dst_path = wcsdup( msi_get_target_folder( package, dst_key ) );
if (!dst_path)
{
/* try a property */
......@@ -1500,7 +1500,7 @@ static UINT ITERATE_RemoveFiles(MSIRECORD *row, LPVOID param)
return ERROR_SUCCESS;
}
size = 0;
if ((filename = strdupW( MSI_RecordGetString(row, 3) )))
if ((filename = wcsdup( MSI_RecordGetString(row, 3) )))
{
msi_reduce_to_long_filename( filename );
size = lstrlenW( filename );
......
......@@ -152,7 +152,7 @@ static WCHAR *load_ttf_name_id( MSIPACKAGE *package, const WCHAR *filename, DWOR
goto end;
}
for (i = 0; i < dwRead / sizeof(WCHAR); i++) buf[i] = SWAPWORD(buf[i]);
ret = strdupW(buf);
ret = wcsdup(buf);
msi_free(buf);
break;
}
......@@ -260,7 +260,7 @@ static UINT ITERATE_RegisterFonts(MSIRECORD *row, LPVOID param)
/* the UI chunk */
uirow = MSI_CreateRecord( 1 );
uipath = strdupW( file->TargetPath );
uipath = wcsdup( file->TargetPath );
p = wcsrchr(uipath,'\\');
if (p) p++;
else p = uipath;
......@@ -341,7 +341,7 @@ static UINT ITERATE_UnregisterFonts( MSIRECORD *row, LPVOID param )
/* the UI chunk */
uirow = MSI_CreateRecord( 1 );
uipath = strdupW( file->TargetPath );
uipath = wcsdup( file->TargetPath );
p = wcsrchr( uipath,'\\' );
if (p) p++;
else p = uipath;
......
......@@ -219,7 +219,7 @@ static WCHAR *deformat_component( FORMAT *format, FORMSTR *str, int *ret_len )
if (comp->Action == INSTALLSTATE_SOURCE)
ret = msi_resolve_source_folder( format->package, comp->Directory, NULL );
else
ret = strdupW( msi_get_target_folder( format->package, comp->Directory ) );
ret = wcsdup( msi_get_target_folder( format->package, comp->Directory ) );
if (ret) *ret_len = lstrlenW( ret );
else *ret_len = 0;
......@@ -239,12 +239,12 @@ static WCHAR *deformat_file( FORMAT *format, FORMSTR *str, BOOL shortname, int *
if (!(file = msi_get_loaded_file( format->package, key ))) goto done;
if (!shortname)
{
if ((ret = strdupW( file->TargetPath ))) len = lstrlenW( ret );
if ((ret = wcsdup( file->TargetPath ))) len = lstrlenW( ret );
goto done;
}
if (!(len = GetShortPathNameW(file->TargetPath, NULL, 0)))
{
if ((ret = strdupW( file->TargetPath ))) len = lstrlenW( ret );
if ((ret = wcsdup( file->TargetPath ))) len = lstrlenW( ret );
goto done;
}
len++;
......@@ -770,7 +770,7 @@ static DWORD deformat_string_internal(MSIPACKAGE *package, LPCWSTR ptr,
return ERROR_SUCCESS;
}
*data = strdupW(ptr);
*data = wcsdup(ptr);
*len = lstrlenW(ptr);
ZeroMemory(&format, sizeof(FORMAT));
......
......@@ -379,7 +379,7 @@ WCHAR *msi_resolve_source_folder( MSIPACKAGE *package, const WCHAR *name, MSIFOL
if (folder) *folder = f;
if (f->ResolvedSource)
{
path = strdupW( f->ResolvedSource );
path = wcsdup( f->ResolvedSource );
TRACE(" already resolved to %s\n", debugstr_w(path));
return path;
}
......@@ -397,7 +397,7 @@ WCHAR *msi_resolve_source_folder( MSIPACKAGE *package, const WCHAR *name, MSIFOL
path = msi_build_directory_name( 3, p, f->SourceLongPath, NULL );
TRACE("-> %s\n", debugstr_w(path));
f->ResolvedSource = strdupW( path );
f->ResolvedSource = wcsdup( path );
msi_free( p );
return path;
......
......@@ -282,9 +282,9 @@ static UINT msi_media_get_disk_info(MSIPACKAGE *package, MSIMEDIAINFO *mi)
return ERROR_FUNCTION_FAILED;
}
mi->disk_prompt = strdupW(MSI_RecordGetString(row, 3));
mi->cabinet = strdupW(MSI_RecordGetString(row, 4));
mi->volume_label = strdupW(MSI_RecordGetString(row, 5));
mi->disk_prompt = wcsdup(MSI_RecordGetString(row, 3));
mi->cabinet = wcsdup(MSI_RecordGetString(row, 4));
mi->volume_label = wcsdup(MSI_RecordGetString(row, 5));
msiobj_release(&row->hdr);
return ERROR_SUCCESS;
......@@ -460,7 +460,7 @@ static INT_PTR cabinet_copy_file(FDINOTIFICATIONTYPE fdint,
TRACE("file in use, scheduling rename operation\n");
if (!(tmppathW = strdupW( path ))) return ERROR_OUTOFMEMORY;
if (!(tmppathW = wcsdup(path))) return ERROR_OUTOFMEMORY;
if ((p = wcsrchr(tmppathW, '\\'))) *p = 0;
len = lstrlenW( tmppathW ) + 16;
if (!(tmpfileW = msi_alloc(len * sizeof(WCHAR))))
......@@ -681,7 +681,7 @@ static UINT get_drive_type(const WCHAR *path)
static WCHAR *get_base_url( MSIDATABASE *db )
{
WCHAR *p, *ret = NULL, *orig_db = msi_dup_property( db, L"OriginalDatabase" );
if (UrlIsW( orig_db, URLIS_URL ) && (ret = strdupW( orig_db )) && (p = wcsrchr( ret, '/'))) p[1] = 0;
if (UrlIsW( orig_db, URLIS_URL ) && (ret = wcsdup( orig_db )) && (p = wcsrchr( ret, '/' ))) p[1] = 0;
msi_free( orig_db );
return ret;
}
......@@ -706,11 +706,11 @@ UINT msi_load_media_info(MSIPACKAGE *package, UINT Sequence, MSIMEDIAINFO *mi)
mi->disk_id = MSI_RecordGetInteger(row, 1);
mi->last_sequence = MSI_RecordGetInteger(row, 2);
msi_free(mi->disk_prompt);
mi->disk_prompt = strdupW(MSI_RecordGetString(row, 3));
mi->disk_prompt = wcsdup(MSI_RecordGetString(row, 3));
msi_free(mi->cabinet);
mi->cabinet = strdupW(MSI_RecordGetString(row, 4));
mi->cabinet = wcsdup(MSI_RecordGetString(row, 4));
msi_free(mi->volume_label);
mi->volume_label = strdupW(MSI_RecordGetString(row, 5));
mi->volume_label = wcsdup(MSI_RecordGetString(row, 5));
msiobj_release(&row->hdr);
msi_set_sourcedir_props(package, FALSE);
......@@ -887,7 +887,7 @@ UINT ready_media( MSIPACKAGE *package, BOOL compressed, MSIMEDIAINFO *mi )
lstrcpyW( mi->sourcedir, temppath );
PathAddBackslashW( mi->sourcedir );
msi_free( mi->cabinet );
mi->cabinet = strdupW( p + 1 );
mi->cabinet = wcsdup( p + 1 );
msi_free( url );
return ERROR_SUCCESS;
......@@ -914,7 +914,7 @@ UINT ready_media( MSIPACKAGE *package, BOOL compressed, MSIMEDIAINFO *mi )
}
msi_free(mi->last_volume);
mi->last_volume = strdupW(mi->volume_label);
mi->last_volume = wcsdup(mi->volume_label);
}
if (mi->cabinet)
{
......
......@@ -1080,7 +1080,7 @@ static WCHAR *reg_get_value( HKEY hkey, const WCHAR *name, DWORD *type )
if (!msi_reg_get_val_dword( hkey, name, &val )) return NULL;
swprintf( temp, ARRAY_SIZE(temp), L"%u", val );
return strdupW( temp );
return wcsdup( temp );
}
ERR( "unhandled value type %lu\n", *type );
......@@ -1210,7 +1210,7 @@ static UINT MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute,
{
unsquash_guid(val, packagecode);
msi_free(val);
val = strdupW(packagecode);
val = wcsdup(packagecode);
}
}
}
......@@ -1488,7 +1488,7 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid,
val = reg_get_value(props, szProperty, &type);
if (!val)
val = strdupW(L"");
val = wcsdup(L"");
r = msi_copy_outval(val, szValue, pcchValue);
}
......@@ -1513,7 +1513,7 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid,
val = reg_get_value(hkey, szProperty, &type);
if (!val)
val = strdupW(L"");
val = wcsdup(L"");
r = msi_copy_outval(val, szValue, pcchValue);
}
......@@ -1528,10 +1528,10 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid,
goto done;
msi_free(val);
val = strdupW(L"5");
val = wcsdup(L"5");
}
else
val = strdupW(L"1");
val = wcsdup(L"1");
r = msi_copy_outval(val, szValue, pcchValue);
goto done;
......@@ -1539,13 +1539,13 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid,
else if (props && (val = reg_get_value(props, package, &type)))
{
msi_free(val);
val = strdupW(L"5");
val = wcsdup(L"5");
r = msi_copy_outval(val, szValue, pcchValue);
goto done;
}
if (prod || managed)
val = strdupW(L"1");
val = wcsdup(L"1");
else
goto done;
......@@ -1557,7 +1557,7 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid,
goto done;
/* FIXME */
val = strdupW(L"");
val = wcsdup(L"");
r = msi_copy_outval(val, szValue, pcchValue);
}
else
......@@ -1760,7 +1760,7 @@ UINT WINAPI MsiGetPatchInfoExW(LPCWSTR szPatchCode, LPCWSTR szProductCode,
val = reg_get_value(datakey, szProperty, &type);
if (!val)
val = strdupW(L"");
val = wcsdup(L"");
r = ERROR_SUCCESS;
......@@ -1915,7 +1915,7 @@ UINT WINAPI MsiEnableLogW( DWORD dwLogMode, const WCHAR *szLogFile, DWORD attrib
FILE_ATTRIBUTE_NORMAL, NULL);
if (file != INVALID_HANDLE_VALUE)
{
gszLogFile = strdupW(szLogFile);
gszLogFile = wcsdup(szLogFile);
CloseHandle(file);
}
else ERR( "unable to enable log %s (%lu)\n", debugstr_w(szLogFile), GetLastError() );
......
......@@ -1188,14 +1188,4 @@ static inline LPWSTR strdupAtoW( LPCSTR str )
return ret;
}
static inline LPWSTR strdupW( LPCWSTR src )
{
LPWSTR dest;
if (!src) return NULL;
dest = msi_alloc( (lstrlenW(src)+1)*sizeof(WCHAR) );
if (dest)
lstrcpyW(dest, src);
return dest;
}
#endif /* __WINE_MSI_PRIVATE__ */
......@@ -987,7 +987,7 @@ MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db )
package->LastActionTemplate = NULL;
package->LastActionResult = MSI_NULL_INTEGER;
package->WordCount = 0;
package->PackagePath = strdupW( db->path );
package->PackagePath = wcsdup( db->path );
create_temp_property_table( package );
msi_clone_properties( package->db );
......@@ -1225,7 +1225,7 @@ static WCHAR *get_property( MSIDATABASE *db, const WCHAR *prop )
}
if (MSI_ViewFetch( view, &rec ) == ERROR_SUCCESS)
{
ret = strdupW( MSI_RecordGetString( rec, 1 ) );
ret = wcsdup( MSI_RecordGetString( rec, 1 ) );
msiobj_release( &rec->hdr );
}
MSI_ViewClose( view );
......@@ -1431,7 +1431,7 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, DWORD dwOptions, MSIPACKAGE **pPackage)
package = MSI_CreatePackage( db );
msiobj_release( &db->hdr );
if (!package) return ERROR_INSTALL_PACKAGE_INVALID;
package->localfile = strdupW( localfile );
package->localfile = wcsdup( localfile );
package->delete_on_close = delete_on_close;
r = msi_get_suminfo( db->storage, 0, &si );
......@@ -1892,7 +1892,7 @@ INT MSI_ProcessMessage( MSIPACKAGE *package, INSTALLMESSAGE eMessageType, MSIREC
template_rec = msi_dup_record_field(record, 0);
template_prefix = msi_get_error_message(package->db, eMessageType >> 24);
if (!template_prefix) template_prefix = strdupW(L"");
if (!template_prefix) template_prefix = wcsdup(L"");
if (!template_rec)
{
......@@ -1924,7 +1924,7 @@ INT MSI_ProcessMessage( MSIPACKAGE *package, INSTALLMESSAGE eMessageType, MSIREC
msi_free(package->LastAction);
msi_free(package->LastActionTemplate);
package->LastAction = msi_dup_record_field(record, 1);
if (!package->LastAction) package->LastAction = strdupW(L"");
if (!package->LastAction) package->LastAction = wcsdup(L"");
package->LastActionTemplate = msi_dup_record_field(record, 3);
break;
}
......@@ -2576,7 +2576,7 @@ UINT msi_package_add_info(MSIPACKAGE *package, DWORD context, DWORD options,
info->context = context;
info->options = options;
info->property = property;
info->value = strdupW(value);
info->value = wcsdup(value);
list_add_head(&package->sourcelist_info, &info->entry);
return ERROR_SUCCESS;
......@@ -2599,8 +2599,8 @@ UINT msi_package_add_media_disk(MSIPACKAGE *package, DWORD context, DWORD option
disk->context = context;
disk->options = options;
disk->disk_id = disk_id;
disk->volume_label = strdupW(volume_label);
disk->disk_prompt = strdupW(disk_prompt);
disk->volume_label = wcsdup(volume_label);
disk->disk_prompt = wcsdup(disk_prompt);
list_add_head(&package->sourcelist_media, &disk->entry);
return ERROR_SUCCESS;
......
......@@ -911,8 +911,8 @@ static UINT msi_apply_patch_package( MSIPACKAGE *package, const WCHAR *file )
r = ERROR_OUTOFMEMORY;
patch->registered = FALSE;
if (!(patch->filename = strdupW( file ))) goto done;
if (!(patch->localfile = strdupW( localfile ))) goto done;
if (!(patch->filename = wcsdup( file ))) goto done;
if (!(patch->localfile = wcsdup( localfile ))) goto done;
r = msi_apply_patch_db( package, patch_db, patch );
if (r != ERROR_SUCCESS) WARN("patch failed to apply %u\n", r);
......@@ -1027,7 +1027,7 @@ UINT msi_apply_registered_patch( MSIPACKAGE *package, LPCWSTR patch_code )
return r;
}
patch_info->registered = TRUE;
patch_info->localfile = strdupW( patch_file );
patch_info->localfile = wcsdup( patch_file );
if (!patch_info->localfile)
{
msiobj_release( &patch_db->hdr );
......
......@@ -1129,7 +1129,7 @@ struct wire_record *marshal_record(MSIHANDLE handle)
ret->fields[i].u.iVal = rec->fields[i].u.iVal;
break;
case MSIFIELD_WSTR:
ret->fields[i].u.szwVal = strdupW(rec->fields[i].u.szwVal);
ret->fields[i].u.szwVal = wcsdup(rec->fields[i].u.szwVal);
break;
case MSIFIELD_STREAM:
IStream_AddRef(rec->fields[i].u.stream);
......
......@@ -1088,7 +1088,7 @@ UINT WINAPI MsiSourceListAddSourceExW( const WCHAR *szProduct, const WCHAR *szUs
postfix = (dwOptions & MSISOURCETYPE_NETWORK) ? L"\\" : L"/";
if (szSource[lstrlenW(szSource) - 1] == *postfix)
source = strdupW(szSource);
source = wcsdup(szSource);
else
{
size = lstrlenW(szSource) + 2;
......@@ -1125,7 +1125,7 @@ UINT WINAPI MsiSourceListAddSourceExW( const WCHAR *szProduct, const WCHAR *szUs
goto done;
}
info->path = strdupW(source);
info->path = wcsdup(source);
lstrcpyW(info->szIndex, name);
info->index = dwIndex;
add_source_to_list(&sourcelist, info, &index);
......
......@@ -218,7 +218,7 @@ static UINT STORAGES_set_row(struct tagMSIVIEW *view, UINT row, MSIRECORD *rec,
return r;
}
name = strdupW(MSI_RecordGetString(rec, 1));
name = wcsdup(MSI_RecordGetString(rec, 1));
if (!name)
{
r = ERROR_OUTOFMEMORY;
......
......@@ -3419,7 +3419,7 @@ UINT msi_table_apply_transform( MSIDATABASE *db, IStorage *stg, int err_cond )
list_add_tail( &transforms, &transform->entry );
transform->name = strdupW( name + 1 );
transform->name = wcsdup( name + 1 );
if ( !wcscmp( transform->name, L"_Tables" ) )
tables = transform;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment