diff --git a/dll/win32/msi/CMakeLists.txt b/dll/win32/msi/CMakeLists.txt index ec30aa8913c..2acc74d7337 100644 --- a/dll/win32/msi/CMakeLists.txt +++ b/dll/win32/msi/CMakeLists.txt @@ -1,5 +1,5 @@ -remove_definitions(-D_WIN32_WINNT=0x502) +remove_definitions(-D_WIN32_WINNT=0x502 -D_CRT_NON_CONFORMING_SWPRINTFS) add_definitions(-D_WIN32_WINNT=0x600) include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine) @@ -84,7 +84,7 @@ add_idl_headers(msi_idlheader msiserver.idl winemsi.idl) add_typelib(msiserver.idl winemsi.idl) set_source_files_properties(msi.rc PROPERTIES OBJECT_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/msiserver.tlb;${CMAKE_CURRENT_BINARY_DIR}/winemsi.tlb") set_module_type(msi win32dll) -target_link_libraries(msi uuid ${PSEH_LIB} wine) +target_link_libraries(msi uuid ${PSEH_LIB} wine oldnames) add_dependencies(msi msi_idlheader) add_delay_importlibs(msi odbccp32 crypt32 wintrust) add_importlibs(msi advapi32 advapi32_vista cabinet comctl32 gdi32 ole32 oleaut32 shell32 shlwapi rpcrt4 urlmon user32 version wininet sxs diff --git a/dll/win32/msi/action.c b/dll/win32/msi/action.c index 07f3778d1ce..29ccf68c539 100644 --- a/dll/win32/msi/action.c +++ b/dll/win32/msi/action.c @@ -36,7 +36,6 @@ #include "mscoree.h" #include "shlwapi.h" #include "imagehlp.h" -#include "wine/unicode.h" #include "winver.h" #include "msipriv.h" @@ -317,9 +316,9 @@ done: static void remove_quotes( WCHAR *str ) { WCHAR *p = str; - int len = strlenW( str ); + int len = lstrlenW( str ); - while ((p = strchrW( p, '"' ))) + while ((p = wcschr( p, '"' ))) { memmove( p, p + 1, (len - (p - str)) * sizeof(WCHAR) ); p++; @@ -344,7 +343,7 @@ UINT msi_parse_command_line( MSIPACKAGE *package, LPCWSTR szCommandLine, while (*ptr == ' ') ptr++; if (!*ptr) break; - ptr2 = strchrW( ptr, '=' ); + ptr2 = wcschr( ptr, '=' ); if (!ptr2) return ERROR_INVALID_COMMAND_LINE; len = ptr2 - ptr; @@ -355,13 +354,13 @@ UINT msi_parse_command_line( MSIPACKAGE *package, LPCWSTR szCommandLine, prop = msi_alloc( (len + 1) * sizeof(WCHAR) ); memcpy( prop, ptr, len * sizeof(WCHAR) ); prop[len] = 0; - if (!preserve_case) struprW( prop ); + if (!preserve_case) wcsupr( prop ); ptr2++; while (*ptr2 == ' ') ptr2++; num_quotes = 0; - val = msi_alloc( (strlenW( ptr2 ) + 1) * sizeof(WCHAR) ); + val = msi_alloc( (lstrlenW( ptr2 ) + 1) * sizeof(WCHAR) ); len = parse_prop( ptr2, val, &num_quotes ); if (num_quotes % 2) { @@ -374,7 +373,7 @@ UINT msi_parse_command_line( MSIPACKAGE *package, LPCWSTR szCommandLine, TRACE("Found commandline property %s = %s\n", debugstr_w(prop), debugstr_w(val)); r = msi_set_property( package->db, prop, val, -1 ); - if (r == ERROR_SUCCESS && !strcmpW( prop, szSourceDir )) + if (r == ERROR_SUCCESS && !wcscmp( prop, szSourceDir )) msi_reset_source_folders( package ); msi_free( val ); @@ -388,7 +387,7 @@ UINT msi_parse_command_line( MSIPACKAGE *package, LPCWSTR szCommandLine, const WCHAR *msi_get_command_line_option(const WCHAR *cmd, const WCHAR *option, UINT *len) { - DWORD opt_len = strlenW(option); + DWORD opt_len = lstrlenW(option); if (!cmd) return NULL; @@ -400,10 +399,10 @@ const WCHAR *msi_get_command_line_option(const WCHAR *cmd, const WCHAR *option, while (*cmd == ' ') cmd++; if (!*cmd) break; - if(!strncmpiW(cmd, option, opt_len)) + if(!wcsnicmp(cmd, option, opt_len)) found = TRUE; - cmd = strchrW( cmd, '=' ); + cmd = wcschr( cmd, '=' ); if(!cmd) break; cmd++; while (*cmd == ' ') cmd++; @@ -429,7 +428,7 @@ WCHAR **msi_split_string( const WCHAR *str, WCHAR sep ) /* count the number of substrings */ for ( pc = str, count = 0; pc; count++ ) { - pc = strchrW( pc, sep ); + pc = wcschr( pc, sep ); if (pc) pc++; } @@ -445,7 +444,7 @@ WCHAR **msi_split_string( const WCHAR *str, WCHAR sep ) lstrcpyW( p, str ); for( count = 0; (ret[count] = p); count++ ) { - p = strchrW( p, sep ); + p = wcschr( p, sep ); if (p) *p++ = 0; } @@ -478,7 +477,7 @@ UINT msi_set_sourcedir_props(MSIPACKAGE *package, BOOL replace) if (!(db = msi_dup_property( package->db, szOriginalDatabase ))) return ERROR_OUTOFMEMORY; - if (!(p = strrchrW( db, '\\' )) && !(p = strrchrW( db, '/' ))) + if (!(p = wcsrchr( db, '\\' )) && !(p = wcsrchr( db, '/' ))) { msi_free(db); return ERROR_SUCCESS; @@ -687,7 +686,7 @@ MSICOMPONENT *msi_get_loaded_component( MSIPACKAGE *package, const WCHAR *Compon LIST_FOR_EACH_ENTRY( comp, &package->components, MSICOMPONENT, entry ) { - if (!strcmpW( Component, comp->Component )) return comp; + if (!wcscmp( Component, comp->Component )) return comp; } return NULL; } @@ -698,7 +697,7 @@ MSIFEATURE *msi_get_loaded_feature(MSIPACKAGE* package, const WCHAR *Feature ) LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry ) { - if (!strcmpW( Feature, feature->Feature )) return feature; + if (!wcscmp( Feature, feature->Feature )) return feature; } return NULL; } @@ -709,7 +708,7 @@ MSIFILE *msi_get_loaded_file( MSIPACKAGE *package, const WCHAR *key ) LIST_FOR_EACH_ENTRY( file, &package->files, MSIFILE, entry ) { - if (!strcmpW( key, file->File )) return file; + if (!wcscmp( key, file->File )) return file; } return NULL; } @@ -720,7 +719,7 @@ MSIFOLDER *msi_get_loaded_folder( MSIPACKAGE *package, const WCHAR *dir ) LIST_FOR_EACH_ENTRY( folder, &package->folders, MSIFOLDER, entry ) { - if (!strcmpW( dir, folder->Directory )) return folder; + if (!wcscmp( dir, folder->Directory )) return folder; } return NULL; } @@ -1124,7 +1123,7 @@ static LPWSTR folder_split_path(LPWSTR p, WCHAR ch) { if (!p) return p; - p = strchrW(p, ch); + p = wcschr(p, ch); if (!p) return p; *p = 0; @@ -1436,9 +1435,9 @@ static UINT load_folder( MSIRECORD *row, LPVOID param ) src_long = folder_split_path( src_short, '|' ); /* check for no-op dirs */ - if (tgt_short && !strcmpW( szDot, tgt_short )) + if (tgt_short && !wcscmp( szDot, tgt_short )) tgt_short = szEmpty; - if (src_short && !strcmpW( szDot, src_short )) + if (src_short && !wcscmp( szDot, src_short )) src_short = szEmpty; if (!tgt_long) @@ -1655,8 +1654,8 @@ static BOOL process_state_property(MSIPACKAGE* package, int level, { LPWSTR override; MSIFEATURE *feature; - BOOL remove = !strcmpW(property, szRemove); - BOOL reinstall = !strcmpW(property, szReinstall); + BOOL remove = !wcscmp(property, szRemove); + BOOL reinstall = !wcscmp(property, szReinstall); override = msi_dup_property( package->db, property ); if (!override) @@ -1672,7 +1671,7 @@ static BOOL process_state_property(MSIPACKAGE* package, int level, else if (remove) state = (feature->Installed == INSTALLSTATE_ABSENT ? INSTALLSTATE_UNKNOWN : INSTALLSTATE_ABSENT); - if (!strcmpiW( override, szAll )) + if (!wcsicmp( override, szAll )) { feature->Action = state; feature->ActionRequest = state; @@ -1680,14 +1679,14 @@ static BOOL process_state_property(MSIPACKAGE* package, int level, else { LPWSTR ptr = override; - LPWSTR ptr2 = strchrW(override,','); + LPWSTR ptr2 = wcschr(override,','); while (ptr) { int len = ptr2 - ptr; - if ((ptr2 && strlenW(feature->Feature) == len && !strncmpW(ptr, feature->Feature, len)) - || (!ptr2 && !strcmpW(ptr, feature->Feature))) + if ((ptr2 && lstrlenW(feature->Feature) == len && !wcsncmp(ptr, feature->Feature, len)) + || (!ptr2 && !wcscmp(ptr, feature->Feature))) { feature->Action = state; feature->ActionRequest = state; @@ -1696,7 +1695,7 @@ static BOOL process_state_property(MSIPACKAGE* package, int level, if (ptr2) { ptr=ptr2+1; - ptr2 = strchrW(ptr,','); + ptr2 = wcschr(ptr,','); } else break; @@ -2061,7 +2060,7 @@ static WCHAR *create_temp_dir( MSIDATABASE *db ) if (!(db->tempfolder = strdupW( tmp ))) return NULL; } - if ((ret = msi_alloc( (strlenW( db->tempfolder ) + 20) * sizeof(WCHAR) ))) + if ((ret = msi_alloc( (lstrlenW( db->tempfolder ) + 20) * sizeof(WCHAR) ))) { for (;;) { @@ -2106,7 +2105,7 @@ WCHAR *msi_build_directory_name( DWORD count, ... ) for (i = 0; i < count; i++) { const WCHAR *str = va_arg( va, const WCHAR * ); - if (str) sz += strlenW( str ) + 1; + if (str) sz += lstrlenW( str ) + 1; } va_end( va ); @@ -2118,8 +2117,8 @@ WCHAR *msi_build_directory_name( DWORD count, ... ) { const WCHAR *str = va_arg( va, const WCHAR * ); if (!str) continue; - strcatW( dir, str ); - if ( i + 1 != count && dir[0] && dir[strlenW( dir ) - 1] != '\\') strcatW( dir, szBackSlash ); + lstrcatW( dir, str ); + if ( i + 1 != count && dir[0] && dir[lstrlenW( dir ) - 1] != '\\') lstrcatW( dir, szBackSlash ); } va_end( va ); return dir; @@ -2210,7 +2209,7 @@ WCHAR *msi_normalize_path( const WCHAR *in ) { const WCHAR *p = in; WCHAR *q, *ret; - int n, len = strlenW( in ) + 2; + int n, len = lstrlenW( in ) + 2; if (!(q = ret = msi_alloc( len * sizeof(WCHAR) ))) return NULL; @@ -2276,7 +2275,7 @@ void msi_resolve_target_folder( MSIPACKAGE *package, const WCHAR *name, BOOL loa if (!(folder = msi_get_loaded_folder( package, name ))) return; - if (!strcmpW( folder->Directory, szTargetDir )) /* special resolving for target root dir */ + if (!wcscmp( folder->Directory, szTargetDir )) /* special resolving for target root dir */ { if (!(path = get_install_location( package )) && (!load_prop || !(path = msi_dup_property( package->db, szTargetDir )))) @@ -2286,7 +2285,7 @@ void msi_resolve_target_folder( MSIPACKAGE *package, const WCHAR *name, BOOL loa } else if (!load_prop || !(path = msi_dup_property( package->db, folder->Directory ))) { - if (folder->Parent && strcmpW( folder->Directory, folder->Parent )) + if (folder->Parent && wcscmp( folder->Directory, folder->Parent )) { parent = msi_get_loaded_folder( package, folder->Parent ); path = msi_build_directory_name( 3, parent->ResolvedTarget, folder->TargetDefault, NULL ); @@ -2409,14 +2408,14 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package) primary_folder[2] = 0; if (GetDiskFreeSpaceExW( primary_folder, &free, NULL, NULL )) { - sprintfW( buf, fmtW, free.QuadPart / 512 ); + swprintf( buf, ARRAY_SIZE(buf), fmtW, free.QuadPart / 512 ); msi_set_property( package->db, szPrimaryVolumeSpaceAvailable, buf, -1 ); } required = get_volume_space_required( package ); - sprintfW( buf, fmtW, required / 512 ); + swprintf( buf, ARRAY_SIZE(buf), fmtW, required / 512 ); msi_set_property( package->db, szPrimaryVolumeSpaceRequired, buf, -1 ); - sprintfW( buf, fmtW, (free.QuadPart - required) / 512 ); + swprintf( buf, ARRAY_SIZE(buf), fmtW, (free.QuadPart - required) / 512 ); msi_set_property( package->db, szPrimaryVolumeSpaceRemaining, buf, -1 ); msi_set_property( package->db, szPrimaryVolumePath, primary_folder, 2 ); } @@ -2457,10 +2456,10 @@ static BYTE *parse_value( MSIPACKAGE *package, const WCHAR *value, DWORD len, DW /* binary value type */ ptr = deformated; *type = REG_BINARY; - if (strlenW(ptr)%2) - *size = (strlenW(ptr)/2)+1; + if (lstrlenW(ptr)%2) + *size = (lstrlenW(ptr)/2)+1; else - *size = strlenW(ptr)/2; + *size = lstrlenW(ptr)/2; data = msi_alloc(*size); @@ -2469,7 +2468,7 @@ static BYTE *parse_value( MSIPACKAGE *package, const WCHAR *value, DWORD len, DW byte[4] = 0; count = 0; /* if uneven pad with a zero in front */ - if (strlenW(ptr)%2) + if (lstrlenW(ptr)%2) { byte[2]= '0'; byte[3]= *ptr; @@ -2535,7 +2534,7 @@ static BYTE *parse_value( MSIPACKAGE *package, const WCHAR *value, DWORD len, DW } } data = (BYTE *)msi_strdupW( ptr, len ); - if (len > strlenW( (const WCHAR *)data )) *type = REG_MULTI_SZ; + if (len > lstrlenW( (const WCHAR *)data )) *type = REG_MULTI_SZ; *size = (len + 1) * sizeof(WCHAR); } return data; @@ -2601,7 +2600,7 @@ static HKEY open_key( const MSICOMPONENT *comp, HKEY root, const WCHAR *path, BO if (!(subkey = strdupW( path ))) return NULL; p = subkey; - if ((q = strchrW( p, '\\' ))) *q = 0; + if ((q = wcschr( p, '\\' ))) *q = 0; if (create) res = RegCreateKeyExW( root, subkey, 0, NULL, 0, access, NULL, &hkey, NULL ); else @@ -2637,7 +2636,7 @@ static WCHAR **split_multi_string_values( const WCHAR *str, DWORD len, DWORD *co if (!str) return NULL; while ((p - str) < len) { - p += strlenW( p ) + 1; + p += lstrlenW( p ) + 1; (*count)++; } if (!(ret = msi_alloc( *count * sizeof(WCHAR *) ))) return NULL; @@ -2650,7 +2649,7 @@ static WCHAR **split_multi_string_values( const WCHAR *str, DWORD len, DWORD *co msi_free( ret ); return NULL; } - p += strlenW( p ) + 1; + p += lstrlenW( p ) + 1; i++; } return ret; @@ -2663,20 +2662,20 @@ static WCHAR *flatten_multi_string_values( WCHAR **left, DWORD left_count, unsigned int i; *size = sizeof(WCHAR); - for (i = 0; i < left_count; i++) *size += (strlenW( left[i] ) + 1) * sizeof(WCHAR); - for (i = 0; i < right_count; i++) *size += (strlenW( right[i] ) + 1) * sizeof(WCHAR); + for (i = 0; i < left_count; i++) *size += (lstrlenW( left[i] ) + 1) * sizeof(WCHAR); + for (i = 0; i < right_count; i++) *size += (lstrlenW( right[i] ) + 1) * sizeof(WCHAR); if (!(ret = p = msi_alloc( *size ))) return NULL; for (i = 0; i < left_count; i++) { - strcpyW( p, left[i] ); - p += strlenW( p ) + 1; + lstrcpyW( p, left[i] ); + p += lstrlenW( p ) + 1; } for (i = 0; i < right_count; i++) { - strcpyW( p, right[i] ); - p += strlenW( p ) + 1; + lstrcpyW( p, right[i] ); + p += lstrlenW( p ) + 1; } *p = 0; return ret; @@ -2692,7 +2691,7 @@ static DWORD remove_duplicate_values( WCHAR **old, DWORD old_count, { for (j = 0; j < old_count; j++) { - if (old[j] && !strcmpW( new[i], old[j] )) + if (old[j] && !wcscmp( new[i], old[j] )) { msi_free( old[j] ); for (k = j; k < old_count - 1; k++) { old[k] = old[k + 1]; } @@ -2835,9 +2834,9 @@ static UINT ITERATE_WriteRegistryValues(MSIRECORD *row, LPVOID param) return ERROR_SUCCESS; deformat_string(package, key , &deformated); - uikey = msi_alloc( (strlenW(deformated) + strlenW(szRoot) + 1) * sizeof(WCHAR) ); - strcpyW(uikey,szRoot); - strcatW(uikey,deformated); + uikey = msi_alloc( (lstrlenW(deformated) + lstrlenW(szRoot) + 1) * sizeof(WCHAR) ); + lstrcpyW(uikey,szRoot); + lstrcatW(uikey,deformated); if (!(hkey = open_key( comp, root_key, deformated, TRUE, KEY_QUERY_VALUE | KEY_SET_VALUE ))) { @@ -2948,7 +2947,7 @@ static void delete_key( const MSICOMPONENT *comp, HKEY root, const WCHAR *path ) if (!(subkey = strdupW( path ))) return; do { - if ((p = strrchrW( subkey, '\\' ))) + if ((p = wcsrchr( subkey, '\\' ))) { *p = 0; if (!p[1]) continue; /* trailing backslash */ @@ -3050,10 +3049,10 @@ static UINT ITERATE_RemoveRegistryValuesOnUninstall( MSIRECORD *row, LPVOID para return ERROR_SUCCESS; deformat_string( package, key_str, &deformated_key ); - size = strlenW( deformated_key ) + strlenW( root_key_str ) + 1; + size = lstrlenW( deformated_key ) + lstrlenW( root_key_str ) + 1; ui_key_str = msi_alloc( size * sizeof(WCHAR) ); - strcpyW( ui_key_str, root_key_str ); - strcatW( ui_key_str, deformated_key ); + lstrcpyW( ui_key_str, root_key_str ); + lstrcatW( ui_key_str, deformated_key ); deformat_string( package, name, &deformated_name ); @@ -3113,10 +3112,10 @@ static UINT ITERATE_RemoveRegistryValuesOnInstall( MSIRECORD *row, LPVOID param return ERROR_SUCCESS; deformat_string( package, key_str, &deformated_key ); - size = strlenW( deformated_key ) + strlenW( root_key_str ) + 1; + size = lstrlenW( deformated_key ) + lstrlenW( root_key_str ) + 1; ui_key_str = msi_alloc( size * sizeof(WCHAR) ); - strcpyW( ui_key_str, root_key_str ); - strcatW( ui_key_str, deformated_key ); + lstrcpyW( ui_key_str, root_key_str ); + lstrcatW( ui_key_str, deformated_key ); deformat_string( package, name, &deformated_name ); @@ -3292,16 +3291,16 @@ static LPWSTR resolve_keypath( MSIPACKAGE* package, MSICOMPONENT *cmp ) deformat_string(package, key , &deformated); deformat_string(package, name, &deformated_name); - len = strlenW(deformated) + 6; + len = lstrlenW(deformated) + 6; if (deformated_name) - len+=strlenW(deformated_name); + len+=lstrlenW(deformated_name); buffer = msi_alloc( len *sizeof(WCHAR)); if (deformated_name) - sprintfW(buffer,fmt2,root,deformated,deformated_name); + swprintf(buffer,len,fmt2,root,deformated,deformated_name); else - sprintfW(buffer,fmt,root,deformated); + swprintf(buffer,len,fmt,root,deformated); msi_free(deformated); msi_free(deformated_name); @@ -3427,13 +3426,13 @@ static WCHAR *build_full_keypath( MSIPACKAGE *package, MSICOMPONENT *comp ) if (comp->assembly) { static const WCHAR prefixW[] = {'<','\\',0}; - DWORD len = strlenW( prefixW ) + strlenW( comp->assembly->display_name ); + DWORD len = lstrlenW( prefixW ) + lstrlenW( comp->assembly->display_name ); WCHAR *keypath = msi_alloc( (len + 1) * sizeof(WCHAR) ); if (keypath) { - strcpyW( keypath, prefixW ); - strcatW( keypath, comp->assembly->display_name ); + lstrcpyW( keypath, prefixW ); + lstrcatW( keypath, comp->assembly->display_name ); } return keypath; } @@ -3522,12 +3521,12 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package) if (!(row = MSI_QueryGetRecord(package->db, query, file->Sequence))) return ERROR_FUNCTION_FAILED; - sprintfW(source, fmt, MSI_RecordGetInteger(row, 1)); - ptr2 = strrchrW(source, '\\') + 1; + swprintf(source, ARRAY_SIZE(source), fmt, MSI_RecordGetInteger(row, 1)); + ptr2 = wcsrchr(source, '\\') + 1; msiobj_release(&row->hdr); lstrcpyW(base, package->PackagePath); - ptr = strrchrW(base, '\\'); + ptr = wcsrchr(base, '\\'); *(ptr + 1) = '\0'; sourcepath = msi_resolve_file_source(package, file); @@ -3604,15 +3603,14 @@ static BOOL CALLBACK Typelib_EnumResNameProc( HMODULE hModule, LPCWSTR lpszType, return TRUE; } - sz = strlenW(tl_struct->source)+4; - sz *= sizeof(WCHAR); + sz = lstrlenW(tl_struct->source)+4; if ((INT_PTR)lpszName == 1) tl_struct->path = strdupW(tl_struct->source); else { - tl_struct->path = msi_alloc(sz); - sprintfW(tl_struct->path,fmt,tl_struct->source, lpszName); + tl_struct->path = msi_alloc(sz * sizeof(WCHAR)); + swprintf(tl_struct->path,sz,fmt,tl_struct->source, lpszName); } TRACE("trying %s\n", debugstr_w(tl_struct->path)); @@ -3842,10 +3840,10 @@ static WCHAR *get_link_file( MSIPACKAGE *package, MSIRECORD *row ) filename = msi_dup_record_field( row, 3 ); msi_reduce_to_long_filename( filename ); - extension = strrchrW( filename, '.' ); - if (!extension || strcmpiW( extension, szlnk )) + extension = wcsrchr( filename, '.' ); + if (!extension || wcsicmp( extension, szlnk )) { - int len = strlenW( filename ); + int len = lstrlenW( filename ); filename = msi_realloc( filename, len * sizeof(WCHAR) + sizeof(szlnk) ); memcpy( filename + len, szlnk, sizeof(szlnk) ); } @@ -3917,7 +3915,7 @@ static UINT ITERATE_CreateShortcuts(MSIRECORD *row, LPVOID param) } target = MSI_RecordGetString(row, 5); - if (strchrW(target, '[')) + if (wcschr(target, '[')) { deformat_string( package, target, &path ); TRACE("target path is %s\n", debugstr_w(path)); @@ -4148,7 +4146,7 @@ static UINT msi_publish_sourcelist(MSIPACKAGE *package, HKEY hkey) RegCloseKey(source); - buffer = strrchrW(package->PackagePath, '\\') + 1; + buffer = wcsrchr(package->PackagePath, '\\') + 1; r = MsiSourceListSetInfoW(package->ProductCode, NULL, package->Context, MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEW, buffer); @@ -4169,7 +4167,7 @@ static UINT msi_publish_sourcelist(MSIPACKAGE *package, HKEY hkey) LIST_FOR_EACH_ENTRY(info, &package->sourcelist_info, MSISOURCELISTINFO, entry) { - if (!strcmpW( info->property, INSTALLPROPERTY_LASTUSEDSOURCEW )) + if (!wcscmp( info->property, INSTALLPROPERTY_LASTUSEDSOURCEW )) msi_set_last_used_source(package->ProductCode, NULL, info->context, info->options, info->value); else @@ -4235,7 +4233,7 @@ static UINT msi_publish_product_properties(MSIPACKAGE *package, HKEY hkey) msi_reg_set_val_str(hkey, szClients, szColon); if (!(guids = msi_get_package_code(package->db))) return ERROR_OUTOFMEMORY; - if ((ptr = strchrW(guids, ';'))) *ptr = 0; + if ((ptr = wcschr(guids, ';'))) *ptr = 0; squash_guid(guids, packcode); msi_free( guids); msi_reg_set_val_str(hkey, INSTALLPROPERTY_PACKAGECODEW, packcode); @@ -4328,7 +4326,7 @@ static UINT msi_publish_patches( MSIPACKAGE *package ) LIST_FOR_EACH_ENTRY( patch, &package->patches, MSIPATCHINFO, entry ) { squash_guid( patch->patchcode, patch_squashed ); - len += strlenW( patch_squashed ) + 1; + len += lstrlenW( patch_squashed ) + 1; } p = all_patches = msi_alloc( (len + 1) * sizeof(WCHAR) ); @@ -4340,11 +4338,11 @@ static UINT msi_publish_patches( MSIPACKAGE *package ) HKEY patch_key; squash_guid( patch->patchcode, p ); - p += strlenW( p ) + 1; + p += lstrlenW( p ) + 1; res = RegSetValueExW( patches_key, patch_squashed, 0, REG_SZ, (const BYTE *)patch->transforms, - (strlenW(patch->transforms) + 1) * sizeof(WCHAR) ); + (lstrlenW(patch->transforms) + 1) * sizeof(WCHAR) ); if (res != ERROR_SUCCESS) goto done; @@ -4353,7 +4351,7 @@ static UINT msi_publish_patches( MSIPACKAGE *package ) goto done; res = RegSetValueExW( patch_key, szLocalPackage, 0, REG_SZ, (const BYTE *)patch->localfile, - (strlenW( patch->localfile ) + 1) * sizeof(WCHAR) ); + (lstrlenW( patch->localfile ) + 1) * sizeof(WCHAR) ); RegCloseKey( patch_key ); if (res != ERROR_SUCCESS) goto done; @@ -4437,7 +4435,7 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package) squash_guid(guid, packed); msi_free(guid); - if (!strcmpW(packed, package_code)) + if (!wcscmp(packed, package_code)) { TRACE("re-publishing product - new package\n"); republish = TRUE; @@ -4499,7 +4497,7 @@ static WCHAR *get_ini_file_name( MSIPACKAGE *package, MSIRECORD *row ) const WCHAR *dirprop; filename = msi_dup_record_field( row, 2 ); - if (filename && (ptr = strchrW( filename, '|' ))) + if (filename && (ptr = wcschr( filename, '|' ))) ptr++; else ptr = filename; @@ -4794,10 +4792,10 @@ static void register_dll( const WCHAR *dll, BOOL unregister ) STARTUPINFOW si; WCHAR *cmd; - if (!(cmd = msi_alloc( strlenW(dll) * sizeof(WCHAR) + sizeof(unregW) ))) return; + if (!(cmd = msi_alloc( lstrlenW(dll) * sizeof(WCHAR) + sizeof(unregW) ))) return; - if (unregister) sprintfW( cmd, unregW, dll ); - else sprintfW( cmd, regW, dll ); + if (unregister) swprintf( cmd, lstrlenW(dll) + ARRAY_SIZE(unregW), unregW, dll ); + else swprintf( cmd, lstrlenW(dll) + ARRAY_SIZE(unregW), regW, dll ); memset( &si, 0, sizeof(STARTUPINFOW) ); if (CreateProcessW( NULL, cmd, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi )) @@ -4961,7 +4959,7 @@ static UINT ACTION_PublishFeatures(MSIPACKAGE *package) size += 21; } if (feature->Feature_Parent) - size += strlenW( feature->Feature_Parent )+2; + size += lstrlenW( feature->Feature_Parent )+2; data = msi_alloc(size * sizeof(WCHAR)); @@ -4978,15 +4976,15 @@ static UINT ACTION_PublishFeatures(MSIPACKAGE *package) CLSIDFromString(component->ComponentId, &clsid); encode_base85_guid(&clsid,buf); TRACE("to %s\n",debugstr_w(buf)); - strcatW(data,buf); + lstrcatW(data,buf); } } if (feature->Feature_Parent) { static const WCHAR sep[] = {'\2',0}; - strcatW(data,sep); - strcatW(data,feature->Feature_Parent); + lstrcatW(data,sep); + lstrcatW(data,feature->Feature_Parent); } msi_reg_set_val_str( userdata, feature->Feature, data ); @@ -4994,7 +4992,7 @@ static UINT ACTION_PublishFeatures(MSIPACKAGE *package) size = 0; if (feature->Feature_Parent) - size = strlenW(feature->Feature_Parent)*sizeof(WCHAR); + size = lstrlenW(feature->Feature_Parent)*sizeof(WCHAR); if (!absent) { size += sizeof(WCHAR); @@ -5008,7 +5006,7 @@ static UINT ACTION_PublishFeatures(MSIPACKAGE *package) data[0] = 0x6; data[1] = 0; if (feature->Feature_Parent) - strcpyW( &data[1], feature->Feature_Parent ); + lstrcpyW( &data[1], feature->Feature_Parent ); RegSetValueExW(hkey,feature->Feature,0,REG_SZ, (LPBYTE)data,size); msi_free(data); @@ -5223,7 +5221,7 @@ static UINT msi_publish_install_properties(MSIPACKAGE *package, HKEY hkey) msi_reg_set_val_dword(hkey, szEstimatedSize, 0); GetLocalTime(&systime); - sprintfW(date, date_fmt, systime.wYear, systime.wMonth, systime.wDay); + swprintf(date, ARRAY_SIZE(date), date_fmt, systime.wYear, systime.wMonth, systime.wDay); msi_reg_set_val_str(hkey, INSTALLPROPERTY_INSTALLDATEW, date); langid = msi_get_property_int(package->db, szProductLanguage, 0); @@ -5316,7 +5314,7 @@ static UINT ITERATE_UnpublishIcon( MSIRECORD *row, LPVOID param ) { TRACE("removing icon file %s\n", debugstr_w(icon_path)); msi_delete_file( package, icon_path ); - if ((p = strrchrW( icon_path, '\\' ))) + if ((p = wcsrchr( icon_path, '\\' ))) { *p = 0; msi_remove_directory( package, icon_path ); @@ -5400,7 +5398,7 @@ static UINT ACTION_UnpublishProduct(MSIPACKAGE *package) LIST_FOR_EACH_ENTRY(patch, &package->patches, MSIPATCHINFO, entry) { MSIREG_DeleteUserDataPatchKey(patch->patchcode, package->Context); - if (!strcmpW( package->ProductCode, patch->products )) + if (!wcscmp( package->ProductCode, patch->products )) { TRACE("removing local patch package %s\n", debugstr_w(patch->localfile)); patch->delete_on_close = TRUE; @@ -5479,7 +5477,7 @@ UINT ACTION_ForceReboot(MSIPACKAGE *package) GetSystemDirectoryW(sysdir, ARRAY_SIZE(sysdir)); RegCreateKeyW(HKEY_LOCAL_MACHINE,RunOnce,&hkey); - snprintfW(buffer, ARRAY_SIZE(buffer), msiexec_fmt, sysdir, squashed_pc); + swprintf(buffer, ARRAY_SIZE(buffer), msiexec_fmt, sysdir, squashed_pc); msi_reg_set_val_str( hkey, squashed_pc, buffer ); RegCloseKey(hkey); @@ -5487,7 +5485,7 @@ UINT ACTION_ForceReboot(MSIPACKAGE *package) TRACE("Reboot command %s\n",debugstr_w(buffer)); RegCreateKeyW(HKEY_LOCAL_MACHINE,InstallRunOnce,&hkey); - sprintfW( buffer, install_fmt, package->ProductCode, squashed_pc ); + swprintf( buffer, ARRAY_SIZE(buffer), install_fmt, package->ProductCode, squashed_pc ); msi_reg_set_val_str( hkey, squashed_pc, buffer ); RegCloseKey(hkey); @@ -5674,10 +5672,10 @@ static UINT ACTION_ExecuteAction(MSIPACKAGE *package) package->LastActionResult = MSI_NULL_INTEGER; action = msi_dup_property(package->db, szEXECUTEACTION); - if (!action) action = msi_strdupW(szINSTALL, strlenW(szINSTALL)); + if (!action) action = msi_strdupW(szINSTALL, lstrlenW(szINSTALL)); /* Perform the action. Top-level actions trigger a sequence. */ - if (!strcmpW(action, szINSTALL)) + if (!wcscmp(action, szINSTALL)) { /* Send ACTIONSTART/INFO and INSTALLSTART. */ ui_actionstart(package, szINSTALL, NULL, NULL); @@ -5779,9 +5777,9 @@ WCHAR *msi_create_component_advertise_string( MSIPACKAGE *package, MSICOMPONENT TRACE("product=%s feature=%s component=%s\n", debugstr_w(productid_85), debugstr_w(feature), debugstr_w(component_85)); - sz = 20 + strlenW( feature ) + 20 + 3; + sz = 20 + lstrlenW( feature ) + 20 + 3; ret = msi_alloc_zero( sz * sizeof(WCHAR) ); - if (ret) sprintfW( ret, fmt, productid_85, feature, component ? '>' : '<', component_85 ); + if (ret) swprintf( ret, sz, fmt, productid_85, feature, component ? '>' : '<', component_85 ); return ret; } @@ -5828,21 +5826,21 @@ static UINT ITERATE_PublishComponent(MSIRECORD *rec, LPVOID param) text = MSI_RecordGetString( rec, 4 ); if (text) { - p = msi_alloc( (strlenW( advertise ) + strlenW( text ) + 1) * sizeof(WCHAR) ); - strcpyW( p, advertise ); - strcatW( p, text ); + p = msi_alloc( (lstrlenW( advertise ) + lstrlenW( text ) + 1) * sizeof(WCHAR) ); + lstrcpyW( p, advertise ); + lstrcatW( p, text ); msi_free( advertise ); advertise = p; } existing = msi_reg_get_val_str( hkey, qualifier ); - sz = strlenW( advertise ) + 1; + sz = lstrlenW( advertise ) + 1; if (existing) { for (p = existing; *p; p += len) { - len = strlenW( p ) + 1; - if (strcmpW( advertise, p )) sz += len; + len = lstrlenW( p ) + 1; + if (wcscmp( advertise, p )) sz += len; } } if (!(output = msi_alloc( (sz + 1) * sizeof(WCHAR) ))) @@ -5855,16 +5853,16 @@ static UINT ITERATE_PublishComponent(MSIRECORD *rec, LPVOID param) { for (p = existing; *p; p += len) { - len = strlenW( p ) + 1; - if (strcmpW( advertise, p )) + len = lstrlenW( p ) + 1; + if (wcscmp( advertise, p )) { memcpy( q, p, len * sizeof(WCHAR) ); q += len; } } } - strcpyW( q, advertise ); - q[strlenW( q ) + 1] = 0; + lstrcpyW( q, advertise ); + q[lstrlenW( q ) + 1] = 0; msi_reg_set_val_multi_str( hkey, qualifier, output ); @@ -5946,8 +5944,8 @@ static UINT ITERATE_UnpublishComponent( MSIRECORD *rec, LPVOID param ) qualifier = MSI_RecordGetString( rec, 2 ); squash_guid( compgroupid, squashed ); - strcpyW( keypath, szInstallerComponents ); - strcatW( keypath, squashed ); + lstrcpyW( keypath, szInstallerComponents ); + lstrcatW( keypath, squashed ); res = RegDeleteKeyW( HKEY_CURRENT_USER, keypath ); if (res != ERROR_SUCCESS) @@ -6068,16 +6066,16 @@ static UINT ITERATE_InstallService(MSIRECORD *rec, LPVOID param) if (!args || !args[0]) image_path = file->TargetPath; else { - int len = strlenW(file->TargetPath) + strlenW(args) + 2; + int len = lstrlenW(file->TargetPath) + lstrlenW(args) + 2; if (!(image_path = msi_alloc(len * sizeof(WCHAR)))) { ret = ERROR_OUTOFMEMORY; goto done; } - strcpyW(image_path, file->TargetPath); - strcatW(image_path, szSpace); - strcatW(image_path, args); + lstrcpyW(image_path, file->TargetPath); + lstrcatW(image_path, szSpace); + lstrcatW(image_path, args); } service = CreateServiceW(hscm, name, disp, GENERIC_ALL, serv_type, start_type, err_control, image_path, load_order, @@ -6160,7 +6158,7 @@ static LPCWSTR *msi_service_args_to_vector(LPWSTR args, DWORD *numargs) (*numargs)++; vector[*numargs - 1] = p; - if ((q = strstrW(p, separator))) + if ((q = wcsstr(p, separator))) { *q = '\0'; @@ -6618,12 +6616,12 @@ static UINT ITERATE_InstallODBCDriver( MSIRECORD *rec, LPVOID param ) lstrcpyW(ptr, desc); ptr += lstrlenW(ptr) + 1; - len = sprintfW(ptr, driver_fmt, driver_file->FileName); + len = swprintf(ptr, len - (ptr - driver), driver_fmt, driver_file->FileName); ptr += len + 1; if (setup_file) { - len = sprintfW(ptr, setup_fmt, setup_file->FileName); + len = swprintf(ptr, len - (ptr - driver), setup_fmt, setup_file->FileName); ptr += len + 1; } @@ -6637,7 +6635,7 @@ static UINT ITERATE_InstallODBCDriver( MSIRECORD *rec, LPVOID param ) driver_file->TargetPath = msi_build_directory_name( 2, dir, driver_file->FileName ); } driver_path = strdupW(driver_file->TargetPath); - ptr = strrchrW(driver_path, '\\'); + ptr = wcsrchr(driver_path, '\\'); if (ptr) *ptr = '\0'; if (!SQLInstallDriverExW(driver, driver_path, outpath, MAX_PATH, @@ -6714,18 +6712,18 @@ static UINT ITERATE_InstallODBCTranslator( MSIRECORD *rec, LPVOID param ) lstrcpyW(ptr, desc); ptr += lstrlenW(ptr) + 1; - len = sprintfW(ptr, translator_fmt, translator_file->FileName); + len = swprintf(ptr, len - (ptr - translator), translator_fmt, translator_file->FileName); ptr += len + 1; if (setup_file) { - len = sprintfW(ptr, setup_fmt, setup_file->FileName); + len = swprintf(ptr, len - (ptr - translator), setup_fmt, setup_file->FileName); ptr += len + 1; } *ptr = '\0'; translator_path = strdupW(translator_file->TargetPath); - ptr = strrchrW(translator_path, '\\'); + ptr = wcsrchr(translator_path, '\\'); if (ptr) *ptr = '\0'; if (!SQLInstallTranslatorExW(translator, translator_path, outpath, MAX_PATH, @@ -6787,7 +6785,7 @@ static UINT ITERATE_InstallODBCDataSource( MSIRECORD *rec, LPVOID param ) if (!attrs) return ERROR_OUTOFMEMORY; - len = sprintfW(attrs, attrs_fmt, desc); + len = swprintf(attrs, len, attrs_fmt, desc); attrs[len + 1] = 0; if (!SQLConfigDataSourceW(NULL, request, driver, attrs)) @@ -6963,14 +6961,14 @@ static UINT ITERATE_RemoveODBCDataSource( MSIRECORD *rec, LPVOID param ) if (registration == msidbODBCDataSourceRegistrationPerMachine) request = ODBC_REMOVE_SYS_DSN; else if (registration == msidbODBCDataSourceRegistrationPerUser) request = ODBC_REMOVE_DSN; - len = strlenW( attrs_fmt ) + strlenW( desc ) + 2; /* \0\0 */ + len = lstrlenW( attrs_fmt ) + lstrlenW( desc ) + 2; /* \0\0 */ attrs = msi_alloc( len * sizeof(WCHAR) ); if (!attrs) return ERROR_OUTOFMEMORY; FIXME("Use ODBCSourceAttribute table\n"); - len = sprintfW( attrs, attrs_fmt, desc ); + len = swprintf( attrs, len, attrs_fmt, desc ); attrs[len + 1] = 0; if (!SQLConfigDataSourceW( NULL, request, driver, attrs )) @@ -7081,7 +7079,7 @@ static UINT env_parse_flags( LPCWSTR *name, LPCWSTR *value, DWORD *flags ) if (*value) { LPCWSTR ptr = *value; - if (!strncmpW(ptr, prefix, prefix_len)) + if (!wcsncmp(ptr, prefix, prefix_len)) { if (ptr[prefix_len] == szSemiColon[0]) { @@ -7096,7 +7094,7 @@ static UINT env_parse_flags( LPCWSTR *name, LPCWSTR *value, DWORD *flags ) else if (lstrlenW(*value) >= prefix_len) { ptr += lstrlenW(ptr) - prefix_len; - if (!strcmpW( ptr, prefix )) + if (!wcscmp( ptr, prefix )) { if ((ptr-1) > *value && *(ptr-1) == szSemiColon[0]) { @@ -7203,15 +7201,15 @@ static UINT ITERATE_WriteEnvironmentString( MSIRECORD *rec, LPVOID param ) { if (flags & ENV_MOD_PREFIX) { - p = strrchrW( value, ';' ); + p = wcsrchr( value, ';' ); len_value = p - value; } else if (flags & ENV_MOD_APPEND) { - value = strchrW( value, ';' ) + 1; - len_value = strlenW( value ); + value = wcschr( value, ';' ) + 1; + len_value = lstrlenW( value ); } - else len_value = strlenW( value ); + else len_value = lstrlenW( value ); } res = open_env_key( flags, &env ); @@ -7268,7 +7266,7 @@ static UINT ITERATE_WriteEnvironmentString( MSIRECORD *rec, LPVOID param ) if (res != ERROR_SUCCESS) goto done; - if (flags & ENV_ACT_REMOVEMATCH && (!value || !strcmpW( data, value ))) + if (flags & ENV_ACT_REMOVEMATCH && (!value || !wcscmp( data, value ))) { action = 0x4; res = RegDeleteValueW(env, name); @@ -7297,7 +7295,7 @@ static UINT ITERATE_WriteEnvironmentString( MSIRECORD *rec, LPVOID param ) goto done; } - size = (len_value + 1 + strlenW( data ) + 1) * sizeof(WCHAR); + size = (len_value + 1 + lstrlenW( data ) + 1) * sizeof(WCHAR); if (!(p = newval = msi_alloc( size ))) { res = ERROR_OUTOFMEMORY; @@ -7312,11 +7310,11 @@ static UINT ITERATE_WriteEnvironmentString( MSIRECORD *rec, LPVOID param ) action |= 0x80000000; } - strcpyW( p, data ); + lstrcpyW( p, data ); if (flags & ENV_MOD_APPEND) { - p += strlenW( data ); + p += lstrlenW( data ); *p++ = ';'; memcpy( p, value, (len_value + 1) * sizeof(WCHAR) ); action |= 0x40000000; @@ -7410,15 +7408,15 @@ static UINT ITERATE_RemoveEnvironmentString( MSIRECORD *rec, LPVOID param ) { if (flags & ENV_MOD_PREFIX) { - p = strchrW( value, ';' ); + p = wcschr( value, ';' ); len_value = p - value; } else if (flags & ENV_MOD_APPEND) { - value = strchrW( value, ';' ) + 1; - len_value = strlenW( value ); + value = wcschr( value, ';' ) + 1; + len_value = lstrlenW( value ); } - else len_value = strlenW( value ); + else len_value = lstrlenW( value ); } r = open_env_key( flags, &env ); @@ -7469,7 +7467,7 @@ static UINT ITERATE_RemoveEnvironmentString( MSIRECORD *rec, LPVOID param ) else { TRACE("setting %s to %s\n", debugstr_w(name), debugstr_w(new_value)); - size = (strlenW( new_value ) + 1) * sizeof(WCHAR); + size = (lstrlenW( new_value ) + 1) * sizeof(WCHAR); res = RegSetValueExW( env, name, 0, type, (BYTE *)new_value, size ); if (res != ERROR_SUCCESS) WARN("failed to set %s to %s (%d)\n", debugstr_w(name), debugstr_w(new_value), res); @@ -7632,9 +7630,9 @@ static UINT ITERATE_RemoveExistingProducts( MSIRECORD *rec, LPVOID param ) deformat_string( package, MSI_RecordGetString( rec, 6 ), &features ); - len += strlenW( product ); + len += lstrlenW( product ); if (features) - len += strlenW( features ); + len += lstrlenW( features ); else len += ARRAY_SIZE( szAll ); @@ -7644,7 +7642,7 @@ static UINT ITERATE_RemoveExistingProducts( MSIRECORD *rec, LPVOID param ) msi_free( features ); return ERROR_OUTOFMEMORY; } - sprintfW( cmd, fmtW, product, features ? features : szAll ); + swprintf( cmd, len, fmtW, product, features ? features : szAll ); msi_free( product ); msi_free( features ); @@ -7962,7 +7960,7 @@ static UINT ACTION_HandleStandardAction(MSIPACKAGE *package, LPCWSTR action) i = 0; while (StandardActions[i].action != NULL) { - if (!strcmpW( StandardActions[i].action, action )) + if (!wcscmp( StandardActions[i].action, action )) { WCHAR description[100] = {0}, template[100] = {0}; @@ -8124,7 +8122,7 @@ UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR szPackagePath, LPCWSTR file; dir = strdupW(szPackagePath); - p = strrchrW(dir, '\\'); + p = wcsrchr(dir, '\\'); if (p) { *(++p) = 0; @@ -8174,7 +8172,7 @@ UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR szPackagePath, start_dummy_thread(&thread_info); productcode = msi_dup_property( package->db, szProductCode ); - if (strcmpiW( productcode, package->ProductCode )) + if (wcsicmp( productcode, package->ProductCode )) { TRACE( "product code changed %s -> %s\n", debugstr_w(package->ProductCode), debugstr_w(productcode) ); msi_free( package->ProductCode ); diff --git a/dll/win32/msi/appsearch.c b/dll/win32/msi/appsearch.c index 6b1768e8af2..dd58ccad702 100644 --- a/dll/win32/msi/appsearch.c +++ b/dll/win32/msi/appsearch.c @@ -29,7 +29,6 @@ #include "msidefs.h" #include "winver.h" #include "shlwapi.h" -#include "wine/unicode.h" #include "wine/debug.h" #include "msipriv.h" @@ -55,20 +54,20 @@ void msi_parse_version_string(LPCWSTR verStr, PDWORD ms, PDWORD ls) const WCHAR *ptr; int x1 = 0, x2 = 0, x3 = 0, x4 = 0; - x1 = atoiW(verStr); - ptr = strchrW(verStr, '.'); + x1 = wcstol(verStr, NULL, 10); + ptr = wcschr(verStr, '.'); if (ptr) { - x2 = atoiW(ptr + 1); - ptr = strchrW(ptr + 1, '.'); + x2 = wcstol(ptr + 1, NULL, 10); + ptr = wcschr(ptr + 1, '.'); } if (ptr) { - x3 = atoiW(ptr + 1); - ptr = strchrW(ptr + 1, '.'); + x3 = wcstol(ptr + 1, NULL, 10); + ptr = wcschr(ptr + 1, '.'); } if (ptr) - x4 = atoiW(ptr + 1); + x4 = wcstol(ptr + 1, NULL, 10); /* FIXME: byte-order dependent? */ *ms = x1 << 16 | x2; if (ls) *ls = x3 << 16 | x4; @@ -106,10 +105,10 @@ static UINT get_signature( MSIPACKAGE *package, MSISIGNATURE *sig, const WCHAR * /* get properties */ sig->File = msi_dup_record_field(row,2); - if ((p = strchrW(sig->File, '|'))) + if ((p = wcschr(sig->File, '|'))) { p++; - memmove(sig->File, p, (strlenW(p) + 1) * sizeof(WCHAR)); + memmove(sig->File, p, (lstrlenW(p) + 1) * sizeof(WCHAR)); } minVersion = msi_dup_record_field(row,3); @@ -287,7 +286,7 @@ static UINT search_components( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATU { if (type == msidbLocatorTypeFileName) { - ptr = strrchrW(path, '\\'); + ptr = wcsrchr(path, '\\'); *(ptr + 1) = '\0'; } else @@ -327,12 +326,12 @@ static void convert_reg_value( DWORD regType, const BYTE *value, DWORD sz, WCHAR /* escape leading pound with another */ *appValue = msi_alloc(sz + sizeof(WCHAR)); (*appValue)[0] = '#'; - strcpyW(*appValue + 1, (LPCWSTR)value); + lstrcpyW(*appValue + 1, (LPCWSTR)value); } else { *appValue = msi_alloc(sz); - strcpyW(*appValue, (LPCWSTR)value); + lstrcpyW(*appValue, (LPCWSTR)value); } break; case REG_DWORD: @@ -340,7 +339,7 @@ static void convert_reg_value( DWORD regType, const BYTE *value, DWORD sz, WCHAR * char if needed */ *appValue = msi_alloc(10 * sizeof(WCHAR)); - sprintfW(*appValue, dwordFmt, *(const DWORD *)value); + swprintf(*appValue, 10, dwordFmt, *(const DWORD *)value); break; case REG_EXPAND_SZ: sz = ExpandEnvironmentStringsW((LPCWSTR)value, NULL, 0); @@ -353,7 +352,7 @@ static void convert_reg_value( DWORD regType, const BYTE *value, DWORD sz, WCHAR lstrcpyW(*appValue, binPre); ptr = *appValue + lstrlenW(binPre); for (i = 0; i < sz; i++, ptr += 2) - sprintfW(ptr, binFmt, value[i]); + swprintf(ptr, 3, binFmt, value[i]); break; default: WARN("unimplemented for values of type %d\n", regType); @@ -463,7 +462,7 @@ static UINT search_reg( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE *sig } if ((regType == REG_SZ || regType == REG_EXPAND_SZ) && - (ptr = strchrW((LPWSTR)value, '"')) && (end = strchrW(++ptr, '"'))) + (ptr = wcschr((LPWSTR)value, '"')) && (end = wcschr(++ptr, '"'))) *end = '\0'; else ptr = (LPWSTR)value; @@ -501,7 +500,7 @@ static LPWSTR get_ini_field(LPWSTR buf, int field) return strdupW(buf); beg = buf; - while ((end = strchrW(beg, ',')) && i < field) + while ((end = wcschr(beg, ',')) && i < field) { beg = end + 1; while (*beg == ' ') @@ -510,7 +509,7 @@ static LPWSTR get_ini_field(LPWSTR buf, int field) i++; } - end = strchrW(beg, ','); + end = wcschr(beg, ','); if (!end) end = beg + lstrlenW(beg); @@ -600,13 +599,13 @@ static void expand_any_path( MSIPACKAGE *package, WCHAR *src, WCHAR *dst, size_t dst[0] = '\0'; /* Ignore the short portion of the path */ - if ((ptr = strchrW(src, '|'))) + if ((ptr = wcschr(src, '|'))) ptr++; else ptr = src; deformat_string(package, ptr, &deformatted); - if (!deformatted || strlenW(deformatted) > len - 1) + if (!deformatted || lstrlenW(deformatted) > len - 1) { msi_free(deformatted); return; @@ -624,7 +623,7 @@ static LANGID *parse_languages( const WCHAR *languages, DWORD *num_ids ) LANGID *ret; if (!str) return NULL; - for (p = q = str; (q = strchrW( q, ',' )); q++) count++; + for (p = q = str; (q = wcschr( q, ',' )); q++) count++; if (!(ret = msi_alloc( count * sizeof(LANGID) ))) { @@ -634,9 +633,9 @@ static LANGID *parse_languages( const WCHAR *languages, DWORD *num_ids ) i = 0; while (*p) { - q = strchrW( p, ',' ); + q = wcschr( p, ',' ); if (q) *q = 0; - ret[i] = atoiW( p ); + ret[i] = wcstol( p, NULL, 10 ); if (!q) break; p = q + 1; i++; @@ -808,7 +807,7 @@ static UINT recurse_search_directory( MSIPACKAGE *package, WCHAR **appValue, MSI * here. Add two because we might need to add a backslash if the dir name * isn't backslash-terminated. */ - len = dirLen + max(fileLen, strlenW(starDotStarW)) + 2; + len = dirLen + max(fileLen, lstrlenW(starDotStarW)) + 2; buf = msi_alloc(len * sizeof(WCHAR)); if (!buf) return ERROR_OUTOFMEMORY; @@ -844,8 +843,8 @@ static UINT recurse_search_directory( MSIPACKAGE *package, WCHAR **appValue, MSI if (hFind != INVALID_HANDLE_VALUE) { if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY && - strcmpW( findData.cFileName, szDot ) && - strcmpW( findData.cFileName, szDotDot )) + wcscmp( findData.cFileName, szDot ) && + wcscmp( findData.cFileName, szDotDot )) { lstrcpyW(subpath, dir); PathAppendW(subpath, findData.cFileName); @@ -854,8 +853,8 @@ static UINT recurse_search_directory( MSIPACKAGE *package, WCHAR **appValue, MSI while (rc == ERROR_SUCCESS && !*appValue && msi_find_next_file( package, hFind, &findData )) { - if (!strcmpW( findData.cFileName, szDot ) || - !strcmpW( findData.cFileName, szDotDot )) + if (!wcscmp( findData.cFileName, szDot ) || + !wcscmp( findData.cFileName, szDotDot )) continue; lstrcpyW(subpath, dir); @@ -889,7 +888,7 @@ static UINT check_directory( MSIPACKAGE *package, const WCHAR *dir, WCHAR **appV static BOOL is_full_path( const WCHAR *path ) { - WCHAR first = toupperW(path[0]); + WCHAR first = towupper(path[0]); BOOL ret; if (first >= 'A' && first <= 'Z' && path[1] == ':') @@ -1019,7 +1018,7 @@ static UINT search_dr( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE *sig if (sz) expand_any_path( package, path, expanded, MAX_PATH ); else - strcpyW(expanded, path); + lstrcpyW(expanded, path); if (parent) { @@ -1031,10 +1030,10 @@ static UINT search_dr( MSIPACKAGE *package, WCHAR **appValue, MSISIGNATURE *sig PathAddBackslashW(parent); } - strcpyW(path, parent); - strcatW(path, expanded); + lstrcpyW(path, parent); + lstrcatW(path, expanded); } - else if (sz) strcpyW(path, expanded); + else if (sz) lstrcpyW(path, expanded); PathAddBackslashW(path); @@ -1088,7 +1087,7 @@ static UINT ITERATE_AppSearch(MSIRECORD *row, LPVOID param) if (value) { r = msi_set_property( package->db, propName, value, -1 ); - if (r == ERROR_SUCCESS && !strcmpW( propName, szSourceDir )) + if (r == ERROR_SUCCESS && !wcscmp( propName, szSourceDir )) msi_reset_source_folders( package ); msi_free(value); diff --git a/dll/win32/msi/assembly.c b/dll/win32/msi/assembly.c index 2a293956c85..bd694333d2a 100644 --- a/dll/win32/msi/assembly.c +++ b/dll/win32/msi/assembly.c @@ -26,7 +26,6 @@ #include "winbase.h" #include "winreg.h" #include "wine/debug.h" -#include "wine/unicode.h" #include "msipriv.h" WINE_DEFAULT_DEBUG_CHANNEL(msi); @@ -43,7 +42,7 @@ static BOOL load_fusion_dlls( MSIPACKAGE *package ) WCHAR path[MAX_PATH]; DWORD len = GetSystemDirectoryW( path, MAX_PATH ); - strcpyW( path + len, szMscoree ); + lstrcpyW( path + len, szMscoree ); if (package->hmscoree || !(package->hmscoree = LoadLibraryW( path ))) return TRUE; if (!(pLoadLibraryShim = (void *)GetProcAddress( package->hmscoree, "LoadLibraryShim" ))) { @@ -176,13 +175,13 @@ static UINT get_assembly_name_attribute( MSIRECORD *rec, LPVOID param ) struct assembly_name *name = param; const WCHAR *attr = MSI_RecordGetString( rec, 2 ); const WCHAR *value = MSI_RecordGetString( rec, 3 ); - int len = strlenW( fmtW ) + strlenW( attr ) + strlenW( value ); + int len = lstrlenW( fmtW ) + lstrlenW( attr ) + lstrlenW( value ); if (!(name->attrs[name->index] = msi_alloc( len * sizeof(WCHAR) ))) return ERROR_OUTOFMEMORY; - if (!strcmpiW( attr, nameW )) strcpyW( name->attrs[name->index++], value ); - else sprintfW( name->attrs[name->index++], fmtW, attr, value ); + if (!wcsicmp( attr, nameW )) lstrcpyW( name->attrs[name->index++], value ); + else swprintf( name->attrs[name->index++], len, fmtW, attr, value ); return ERROR_SUCCESS; } @@ -216,7 +215,7 @@ static WCHAR *get_assembly_display_name( MSIDATABASE *db, const WCHAR *comp, MSI MSI_IterateRecords( view, NULL, get_assembly_name_attribute, &name ); len = 0; - for (i = 0; i < name.count; i++) len += strlenW( name.attrs[i] ) + 1; + for (i = 0; i < name.count; i++) len += lstrlenW( name.attrs[i] ) + 1; display_name = msi_alloc( (len + 1) * sizeof(WCHAR) ); if (display_name) @@ -224,8 +223,8 @@ static WCHAR *get_assembly_display_name( MSIDATABASE *db, const WCHAR *comp, MSI display_name[0] = 0; for (i = 0; i < name.count; i++) { - strcatW( display_name, name.attrs[i] ); - if (i < name.count - 1) strcatW( display_name, commaW ); + lstrcatW( display_name, name.attrs[i] ); + if (i < name.count - 1) lstrcatW( display_name, commaW ); } } @@ -427,7 +426,7 @@ static enum clr_version get_clr_version( MSIPACKAGE *package, const WCHAR *filen { UINT i; for (i = 0; i < CLR_VERSION_MAX; i++) - if (!strcmpW( strW, clr_version[i] )) version = i; + if (!wcscmp( strW, clr_version[i] )) version = i; } msi_free( strW ); } @@ -526,7 +525,7 @@ static WCHAR *build_local_assembly_path( const WCHAR *filename ) UINT i; WCHAR *ret; - if (!(ret = msi_alloc( (strlenW( filename ) + 1) * sizeof(WCHAR) ))) + if (!(ret = msi_alloc( (lstrlenW( filename ) + 1) * sizeof(WCHAR) ))) return NULL; for (i = 0; filename[i]; i++) diff --git a/dll/win32/msi/automation.c b/dll/win32/msi/automation.c index 80254e6df45..ba3a068a74b 100644 --- a/dll/win32/msi/automation.c +++ b/dll/win32/msi/automation.c @@ -32,7 +32,6 @@ #include "oleauto.h" #include "shlwapi.h" #include "wine/debug.h" -#include "wine/unicode.h" #include "msiserver.h" #include "msiserver_dispids.h" @@ -1976,7 +1975,7 @@ static HRESULT InstallerImpl_Version(WORD wFlags, if (FAILED(hr)) return hr; - sprintfW(version, format, verinfo.dwMajorVersion, verinfo.dwMinorVersion, + swprintf(version, ARRAY_SIZE(version), format, verinfo.dwMajorVersion, verinfo.dwMinorVersion, verinfo.dwBuildNumber, verinfo.dwPlatformID); V_VT(pVarResult) = VT_BSTR; diff --git a/dll/win32/msi/classes.c b/dll/win32/msi/classes.c index 7b0a4a4d0e6..4e0c1a68098 100644 --- a/dll/win32/msi/classes.c +++ b/dll/win32/msi/classes.c @@ -39,7 +39,6 @@ #include "wine/debug.h" #include "msipriv.h" #include "winuser.h" -#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(msi); @@ -87,7 +86,7 @@ static MSIAPPID *load_given_appid( MSIPACKAGE *package, LPCWSTR name ) /* check for appids already loaded */ LIST_FOR_EACH_ENTRY( appid, &package->appids, MSIAPPID, entry ) { - if (!strcmpiW( appid->AppID, name )) + if (!wcsicmp( appid->AppID, name )) { TRACE("found appid %s %p\n", debugstr_w(name), appid); return appid; @@ -143,9 +142,9 @@ static MSIPROGID *load_progid( MSIPACKAGE* package, MSIRECORD *row ) FilePath = msi_build_icon_path(package, FileName); - progid->IconPath = msi_alloc( (strlenW(FilePath)+10)* sizeof(WCHAR) ); + progid->IconPath = msi_alloc( (lstrlenW(FilePath)+10)* sizeof(WCHAR) ); - sprintfW(progid->IconPath,fmt,FilePath,icon_index); + swprintf(progid->IconPath,lstrlenW(FilePath)+10,fmt,FilePath,icon_index); msi_free(FilePath); } @@ -191,7 +190,7 @@ static MSIPROGID *load_given_progid(MSIPACKAGE *package, LPCWSTR name) /* check for progids already loaded */ LIST_FOR_EACH_ENTRY( progid, &package->progids, MSIPROGID, entry ) { - if (!strcmpiW( progid->ProgID, name )) + if (!wcsicmp( progid->ProgID, name )) { TRACE("found progid %s (%p)\n",debugstr_w(name), progid ); return progid; @@ -248,9 +247,9 @@ static MSICLASS *load_class( MSIPACKAGE* package, MSIRECORD *row ) FilePath = msi_build_icon_path(package, FileName); - cls->IconPath = msi_alloc( (strlenW(FilePath)+5)* sizeof(WCHAR) ); + cls->IconPath = msi_alloc( (lstrlenW(FilePath)+5)* sizeof(WCHAR) ); - sprintfW(cls->IconPath,fmt,FilePath,icon_index); + swprintf(cls->IconPath,lstrlenW(FilePath)+5,fmt,FilePath,icon_index); msi_free(FilePath); } @@ -321,7 +320,7 @@ static MSICLASS *load_given_class(MSIPACKAGE *package, LPCWSTR classid) /* check for classes already loaded */ LIST_FOR_EACH_ENTRY( cls, &package->classes, MSICLASS, entry ) { - if (!strcmpiW( cls->clsid, classid )) + if (!wcsicmp( cls->clsid, classid )) { TRACE("found class %s (%p)\n",debugstr_w(classid), cls); return cls; @@ -380,7 +379,7 @@ static MSIMIME *load_given_mime( MSIPACKAGE *package, LPCWSTR mime ) /* check for mime already loaded */ LIST_FOR_EACH_ENTRY( mt, &package->mimes, MSIMIME, entry ) { - if (!strcmpiW( mt->ContentType, mime )) + if (!wcsicmp( mt->ContentType, mime )) { TRACE("found mime %s (%p)\n",debugstr_w(mime), mt); return mt; @@ -451,7 +450,7 @@ static MSIEXTENSION *load_given_extension( MSIPACKAGE *package, LPCWSTR name ) /* check for extensions already loaded */ LIST_FOR_EACH_ENTRY( ext, &package->extensions, MSIEXTENSION, entry ) { - if (!strcmpiW( ext->Extension, name )) + if (!wcsicmp( ext->Extension, name )) { TRACE("extension %s already loaded %p\n", debugstr_w(name), ext); return ext; @@ -521,9 +520,9 @@ static UINT iterate_all_classes(MSIRECORD *rec, LPVOID param) LIST_FOR_EACH_ENTRY( cls, &package->classes, MSICLASS, entry ) { - if (strcmpiW( clsid, cls->clsid )) + if (wcsicmp( clsid, cls->clsid )) continue; - if (strcmpW( context, cls->Context )) + if (wcscmp( context, cls->Context )) continue; if (comp == cls->Component) { @@ -569,7 +568,7 @@ static UINT iterate_all_extensions(MSIRECORD *rec, LPVOID param) LIST_FOR_EACH_ENTRY( ext, &package->extensions, MSIEXTENSION, entry ) { - if (strcmpiW(extension, ext->Extension)) + if (wcsicmp(extension, ext->Extension)) continue; if (comp == ext->Component) { @@ -884,11 +883,12 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package) ptr = cls->FileTypeMask; while (ptr && *ptr) { - ptr2 = strchrW(ptr,';'); + ptr2 = wcschr(ptr,';'); if (ptr2) *ptr2 = 0; - keyname = msi_alloc( (strlenW(szFileType_fmt) + strlenW(cls->clsid) + 4) * sizeof(WCHAR)); - sprintfW( keyname, szFileType_fmt, cls->clsid, index ); + keyname = msi_alloc( (lstrlenW(szFileType_fmt) + lstrlenW(cls->clsid) + 4) * sizeof(WCHAR)); + swprintf( keyname, lstrlenW(szFileType_fmt) + lstrlenW(cls->clsid) + 4, + szFileType_fmt, cls->clsid, index ); msi_reg_set_subkey_val( HKEY_CLASSES_ROOT, keyname, NULL, ptr ); msi_free(keyname); @@ -984,11 +984,11 @@ UINT ACTION_UnregisterClassInfo( MSIPACKAGE *package ) } if (cls->FileTypeMask) { - filetype = msi_alloc( (strlenW( szFileType ) + strlenW( cls->clsid ) + 1) * sizeof(WCHAR) ); + filetype = msi_alloc( (lstrlenW( szFileType ) + lstrlenW( cls->clsid ) + 1) * sizeof(WCHAR) ); if (filetype) { - strcpyW( filetype, szFileType ); - strcatW( filetype, cls->clsid ); + lstrcpyW( filetype, szFileType ); + lstrcatW( filetype, cls->clsid ); res = RegDeleteTreeW( HKEY_CLASSES_ROOT, filetype ); msi_free( filetype ); @@ -1198,35 +1198,35 @@ static UINT register_verb(MSIPACKAGE *package, LPCWSTR progid, TRACE("Making Key %s\n",debugstr_w(keyname)); RegCreateKeyW(HKEY_CLASSES_ROOT, keyname, &key); - size = strlenW(component->FullKeypath); + size = lstrlenW(component->FullKeypath); if (verb->Argument) - size += strlenW(verb->Argument); + size += lstrlenW(verb->Argument); size += 4; command = msi_alloc(size * sizeof (WCHAR)); if (verb->Argument) - sprintfW(command, fmt, component->FullKeypath, verb->Argument); + swprintf(command, size, fmt, component->FullKeypath, verb->Argument); else - sprintfW(command, fmt2, component->FullKeypath); + swprintf(command, size, fmt2, component->FullKeypath); msi_reg_set_val_str( key, NULL, command ); msi_free(command); advertise = msi_create_component_advertise_string(package, component, extension->Feature->Feature); - size = strlenW(advertise); + size = lstrlenW(advertise); if (verb->Argument) - size += strlenW(verb->Argument); + size += lstrlenW(verb->Argument); size += 4; command = msi_alloc_zero(size * sizeof (WCHAR)); - strcpyW(command,advertise); + lstrcpyW(command,advertise); if (verb->Argument) { - strcatW(command,szSpace); - strcatW(command,verb->Argument); + lstrcatW(command,szSpace); + lstrcatW(command,verb->Argument); } msi_reg_set_val_multi_str( key, szCommand, command ); @@ -1312,11 +1312,11 @@ UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package) ext->action = INSTALLSTATE_LOCAL; - extension = msi_alloc( (strlenW( ext->Extension ) + 2) * sizeof(WCHAR) ); + extension = msi_alloc( (lstrlenW( ext->Extension ) + 2) * sizeof(WCHAR) ); if (extension) { extension[0] = '.'; - strcpyW( extension + 1, ext->Extension ); + lstrcpyW( extension + 1, ext->Extension ); res = RegCreateKeyW( HKEY_CLASSES_ROOT, extension, &hkey ); msi_free( extension ); if (res != ERROR_SUCCESS) @@ -1343,10 +1343,10 @@ UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package) msi_reg_set_val_str( hkey, NULL, progid ); - newkey = msi_alloc( (strlenW(progid)+strlenW(szSN)+1) * sizeof(WCHAR)); + newkey = msi_alloc( (lstrlenW(progid)+lstrlenW(szSN)+1) * sizeof(WCHAR)); - strcpyW(newkey,progid); - strcatW(newkey,szSN); + lstrcpyW(newkey,progid); + lstrcatW(newkey,szSN); RegCreateKeyW(hkey,newkey,&hkey2); RegCloseKey(hkey2); @@ -1413,11 +1413,11 @@ UINT ACTION_UnregisterExtensionInfo( MSIPACKAGE *package ) ext->action = INSTALLSTATE_ABSENT; - extension = msi_alloc( (strlenW( ext->Extension ) + 2) * sizeof(WCHAR) ); + extension = msi_alloc( (lstrlenW( ext->Extension ) + 2) * sizeof(WCHAR) ); if (extension) { extension[0] = '.'; - strcpyW( extension + 1, ext->Extension ); + lstrcpyW( extension + 1, ext->Extension ); res = RegDeleteTreeW( HKEY_CLASSES_ROOT, extension ); msi_free( extension ); if (res != ERROR_SUCCESS) @@ -1435,11 +1435,11 @@ UINT ACTION_UnregisterExtensionInfo( MSIPACKAGE *package ) else progid = ext->ProgIDText; - progid_shell = msi_alloc( (strlenW( progid ) + strlenW( shellW ) + 1) * sizeof(WCHAR) ); + progid_shell = msi_alloc( (lstrlenW( progid ) + lstrlenW( shellW ) + 1) * sizeof(WCHAR) ); if (progid_shell) { - strcpyW( progid_shell, progid ); - strcatW( progid_shell, shellW ); + lstrcpyW( progid_shell, progid ); + lstrcatW( progid_shell, shellW ); res = RegDeleteTreeW( HKEY_CLASSES_ROOT, progid_shell ); msi_free( progid_shell ); if (res != ERROR_SUCCESS) @@ -1487,16 +1487,16 @@ UINT ACTION_RegisterMIMEInfo(MSIPACKAGE *package) TRACE("Registering MIME type %s\n", debugstr_w(mt->ContentType)); - if (mt->Extension) extension = msi_alloc( (strlenW( mt->Extension->Extension ) + 2) * sizeof(WCHAR) ); - key = msi_alloc( (strlenW( mt->ContentType ) + strlenW( szMIMEDatabase ) + 1) * sizeof(WCHAR) ); + if (mt->Extension) extension = msi_alloc( (lstrlenW( mt->Extension->Extension ) + 2) * sizeof(WCHAR) ); + key = msi_alloc( (lstrlenW( mt->ContentType ) + lstrlenW( szMIMEDatabase ) + 1) * sizeof(WCHAR) ); if (extension && key) { extension[0] = '.'; - strcpyW( extension + 1, mt->Extension->Extension ); + lstrcpyW( extension + 1, mt->Extension->Extension ); - strcpyW( key, szMIMEDatabase ); - strcatW( key, mt->ContentType ); + lstrcpyW( key, szMIMEDatabase ); + lstrcatW( key, mt->ContentType ); msi_reg_set_subkey_val( HKEY_CLASSES_ROOT, key, szExtension, extension ); if (mt->clsid) @@ -1541,11 +1541,11 @@ UINT ACTION_UnregisterMIMEInfo( MSIPACKAGE *package ) TRACE("Unregistering MIME type %s\n", debugstr_w(mime->ContentType)); - mime_key = msi_alloc( (strlenW( szMIMEDatabase ) + strlenW( mime->ContentType ) + 1) * sizeof(WCHAR) ); + mime_key = msi_alloc( (lstrlenW( szMIMEDatabase ) + lstrlenW( mime->ContentType ) + 1) * sizeof(WCHAR) ); if (mime_key) { - strcpyW( mime_key, szMIMEDatabase ); - strcatW( mime_key, mime->ContentType ); + lstrcpyW( mime_key, szMIMEDatabase ); + lstrcatW( mime_key, mime->ContentType ); res = RegDeleteKeyW( HKEY_CLASSES_ROOT, mime_key ); if (res != ERROR_SUCCESS) WARN("Failed to delete MIME key %d\n", res); diff --git a/dll/win32/msi/cond.y b/dll/win32/msi/cond.y index fccb61489be..73aada5fad3 100644 --- a/dll/win32/msi/cond.y +++ b/dll/win32/msi/cond.y @@ -22,8 +22,6 @@ #define COBJMACROS -#include "config.h" - #include #include #include @@ -314,7 +312,7 @@ value: if( !szNum ) YYABORT; $$.type = VALUE_INTEGER; - $$.u.integer = atoiW( szNum ); + $$.u.integer = wcstol( szNum, NULL, 10 ); cond_free( szNum ); } | COND_DOLLARS identifier @@ -417,7 +415,7 @@ static WCHAR *strstriW( const WCHAR *str, const WCHAR *sub ) LPWSTR strlower, sublower, r; strlower = CharLowerW( strdupW( str ) ); sublower = CharLowerW( strdupW( sub ) ); - r = strstrW( strlower, sublower ); + r = wcsstr( strlower, sublower ); if (r) r = (LPWSTR)str + (r - strlower); msi_free( strlower ); @@ -433,7 +431,7 @@ static BOOL str_is_number( LPCWSTR str ) return FALSE; for (i = 0; i < lstrlenW( str ); i++) - if (!isdigitW(str[i])) + if (!iswdigit(str[i])) return FALSE; return TRUE; @@ -452,44 +450,44 @@ static INT compare_substring( LPCWSTR a, INT operator, LPCWSTR b ) return 1; /* if both strings contain only numbers, use integer comparison */ - lhs = atoiW(a); - rhs = atoiW(b); + lhs = wcstol(a, NULL, 10); + rhs = wcstol(b, NULL, 10); if (str_is_number(a) && str_is_number(b)) return compare_int( lhs, operator, rhs ); switch (operator) { case COND_SS: - return strstrW( a, b ) != 0; + return wcsstr( a, b ) != 0; case COND_ISS: return strstriW( a, b ) != 0; case COND_LHS: { - int l = strlenW( a ); - int r = strlenW( b ); + int l = lstrlenW( a ); + int r = lstrlenW( b ); if (r > l) return 0; - return !strncmpW( a, b, r ); + return !wcsncmp( a, b, r ); } case COND_RHS: { - int l = strlenW( a ); - int r = strlenW( b ); + int l = lstrlenW( a ); + int r = lstrlenW( b ); if (r > l) return 0; - return !strncmpW( a + (l - r), b, r ); + return !wcsncmp( a + (l - r), b, r ); } case COND_ILHS: { - int l = strlenW( a ); - int r = strlenW( b ); + int l = lstrlenW( a ); + int r = lstrlenW( b ); if (r > l) return 0; - return !strncmpiW( a, b, r ); + return !wcsnicmp( a, b, r ); } case COND_IRHS: { - int l = strlenW( a ); - int r = strlenW( b ); + int l = lstrlenW( a ); + int r = lstrlenW( b ); if (r > l) return 0; - return !strncmpiW( a + (l - r), b, r ); + return !wcsnicmp( a + (l - r), b, r ); } default: ERR("invalid substring operator\n"); @@ -508,35 +506,35 @@ static INT compare_string( LPCWSTR a, INT operator, LPCWSTR b, BOOL convert ) if (!b) b = szEmpty; if (convert && str_is_number(a) && str_is_number(b)) - return compare_int( atoiW(a), operator, atoiW(b) ); + return compare_int( wcstol(a, NULL, 10), operator, wcstol(b, NULL, 10) ); /* a or b may be NULL */ switch (operator) { case COND_LT: - return strcmpW( a, b ) < 0; + return wcscmp( a, b ) < 0; case COND_GT: - return strcmpW( a, b ) > 0; + return wcscmp( a, b ) > 0; case COND_EQ: - return strcmpW( a, b ) == 0; + return wcscmp( a, b ) == 0; case COND_NE: - return strcmpW( a, b ) != 0; + return wcscmp( a, b ) != 0; case COND_GE: - return strcmpW( a, b ) >= 0; + return wcscmp( a, b ) >= 0; case COND_LE: - return strcmpW( a, b ) <= 0; + return wcscmp( a, b ) <= 0; case COND_ILT: - return strcmpiW( a, b ) < 0; + return wcsicmp( a, b ) < 0; case COND_IGT: - return strcmpiW( a, b ) > 0; + return wcsicmp( a, b ) > 0; case COND_IEQ: - return strcmpiW( a, b ) == 0; + return wcsicmp( a, b ) == 0; case COND_INE: - return strcmpiW( a, b ) != 0; + return wcsicmp( a, b ) != 0; case COND_IGE: - return strcmpiW( a, b ) >= 0; + return wcsicmp( a, b ) >= 0; case COND_ILE: - return strcmpiW( a, b ) <= 0; + return wcsicmp( a, b ) <= 0; default: ERR("invalid string operator\n"); return 0; @@ -619,7 +617,7 @@ static int COND_GetOperator( COND_input *cond ) while ( 1 ) { len = lstrlenW( table[i].str ); - if ( !len || 0 == strncmpW( table[i].str, p, len ) ) + if ( !len || 0 == wcsncmp( table[i].str, p, len ) ) break; i++; } @@ -668,7 +666,7 @@ static int COND_GetOne( struct cond_str *str, COND_input *cond ) if (ch == '"' ) { - LPCWSTR p = strchrW( str->data + 1, '"' ); + LPCWSTR p = wcschr( str->data + 1, '"' ); if (!p) return COND_ERROR; len = p - str->data + 1; rc = COND_LITER; @@ -688,18 +686,18 @@ static int COND_GetOne( struct cond_str *str, COND_input *cond ) if ( len == 3 ) { - if ( !strncmpiW( str->data, szNot, len ) ) + if ( !wcsnicmp( str->data, szNot, len ) ) rc = COND_NOT; - else if( !strncmpiW( str->data, szAnd, len ) ) + else if( !wcsnicmp( str->data, szAnd, len ) ) rc = COND_AND; - else if( !strncmpiW( str->data, szXor, len ) ) + else if( !wcsnicmp( str->data, szXor, len ) ) rc = COND_XOR; - else if( !strncmpiW( str->data, szEqv, len ) ) + else if( !wcsnicmp( str->data, szEqv, len ) ) rc = COND_EQV; - else if( !strncmpiW( str->data, szImp, len ) ) + else if( !wcsnicmp( str->data, szImp, len ) ) rc = COND_IMP; } - else if( (len == 2) && !strncmpiW( str->data, szOr, len ) ) + else if( (len == 2) && !wcsnicmp( str->data, szOr, len ) ) rc = COND_OR; } else if( COND_IsNumber( ch ) ) diff --git a/dll/win32/msi/create.c b/dll/win32/msi/create.c index 2777954aa7d..6133159dce6 100644 --- a/dll/win32/msi/create.c +++ b/dll/win32/msi/create.c @@ -24,7 +24,6 @@ #include "winbase.h" #include "winerror.h" #include "wine/debug.h" -#include "wine/unicode.h" #include "msi.h" #include "msiquery.h" #include "objbase.h" @@ -152,7 +151,7 @@ static UINT check_columns( const column_info *col_info ) /* check for two columns with the same name */ for( c1 = col_info; c1; c1 = c1->next ) for( c2 = c1->next; c2; c2 = c2->next ) - if (!strcmpW( c1->column, c2->column )) + if (!wcscmp( c1->column, c2->column )) return ERROR_BAD_QUERY_SYNTAX; return ERROR_SUCCESS; diff --git a/dll/win32/msi/custom.c b/dll/win32/msi/custom.c index 6da8ab1b3de..fc0246f2063 100644 --- a/dll/win32/msi/custom.c +++ b/dll/win32/msi/custom.c @@ -18,10 +18,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" -#include "wine/port.h" -#include "wine/asm.h" - #define COBJMACROS #include @@ -36,6 +32,7 @@ #include "msipriv.h" #include "winemsi_s.h" +#include "wine/asm.h" #include "wine/heap.h" #include "wine/debug.h" #include "wine/unicode.h" @@ -129,7 +126,7 @@ BOOL msi_action_is_unique( const MSIPACKAGE *package, const WCHAR *action ) for (i = 0; i < package->unique_actions_count; i++) { - if (!strcmpW( package->unique_actions[i], action )) return TRUE; + if (!wcscmp( package->unique_actions[i], action )) return TRUE; } return FALSE; } @@ -191,7 +188,7 @@ static LPWSTR msi_get_deferred_action(LPCWSTR action, LPCWSTR actiondata, lstrlenW(format) - 7; deferred = msi_alloc(len * sizeof(WCHAR)); - sprintfW(deferred, format, actiondata, usersid, prodcode, action); + swprintf(deferred, len, format, actiondata, usersid, prodcode, action); return deferred; } @@ -200,15 +197,15 @@ static void set_deferred_action_props( MSIPACKAGE *package, const WCHAR *deferre static const WCHAR sep[] = {'<','=','>',0}; const WCHAR *end, *beg = deferred_data + 1; - end = strstrW(beg, sep); + end = wcsstr(beg, sep); msi_set_property( package->db, szCustomActionData, beg, end - beg ); beg = end + 3; - end = strstrW(beg, sep); + end = wcsstr(beg, sep); msi_set_property( package->db, szUserSID, beg, end - beg ); beg = end + 3; - end = strchrW(beg, ']'); + end = wcschr(beg, ']'); msi_set_property( package->db, szProductCode, beg, end - beg ); } @@ -229,7 +226,7 @@ WCHAR *msi_create_temp_file( MSIDATABASE *db ) if (!(db->tempfolder = strdupW( tmp ))) return NULL; } - if ((ret = msi_alloc( (strlenW( db->tempfolder ) + 20) * sizeof(WCHAR) ))) + if ((ret = msi_alloc( (lstrlenW( db->tempfolder ) + 20) * sizeof(WCHAR) ))) { if (!GetTempFileNameW( db->tempfolder, szMsi, 0, ret )) { @@ -299,7 +296,7 @@ static MSIBINARY *get_temp_binary(MSIPACKAGE *package, LPCWSTR source) LIST_FOR_EACH_ENTRY( binary, &package->binaries, MSIBINARY, entry ) { - if (!strcmpW( binary->source, source )) + if (!wcscmp( binary->source, source )) return binary; } @@ -536,7 +533,7 @@ UINT CDECL __wine_msi_call_dll_function(DWORD client_pid, const GUID *guid) { WCHAR endpoint[12]; - sprintfW(endpoint, endpoint_fmtW, client_pid); + swprintf(endpoint, ARRAY_SIZE(endpoint), endpoint_fmtW, client_pid); status = RpcStringBindingComposeW(NULL, ncalrpcW, NULL, endpoint, NULL, &binding_str); if (status != RPC_S_OK) { @@ -621,7 +618,8 @@ static DWORD custom_start_server(MSIPACKAGE *package, DWORD arch) (arch == SCS_64BIT_BINARY && package->custom_server_64_process)) return ERROR_SUCCESS; - sprintfW(buffer, pipe_name, GetCurrentProcessId(), arch == SCS_32BIT_BINARY ? 32 : 64); + swprintf(buffer, ARRAY_SIZE(buffer), pipe_name, + GetCurrentProcessId(), arch == SCS_32BIT_BINARY ? 32 : 64); pipe = CreateNamedPipeW(buffer, PIPE_ACCESS_DUPLEX, 0, 1, sizeof(DWORD64), sizeof(GUID), 0, NULL); if (pipe == INVALID_HANDLE_VALUE) @@ -634,8 +632,8 @@ static DWORD custom_start_server(MSIPACKAGE *package, DWORD arch) GetSystemWow64DirectoryW(path, MAX_PATH - ARRAY_SIZE(msiexecW)); else GetSystemDirectoryW(path, MAX_PATH - ARRAY_SIZE(msiexecW)); - strcatW(path, msiexecW); - sprintfW(cmdline, argsW, path, GetCurrentProcessId()); + lstrcatW(path, msiexecW); + swprintf(cmdline, ARRAY_SIZE(cmdline), argsW, path, GetCurrentProcessId()); if (wow64 && arch == SCS_64BIT_BINARY) { @@ -760,7 +758,7 @@ static msi_custom_action_info *do_msidbCustomActionTypeDll( { WCHAR endpoint[12]; - sprintfW(endpoint, endpoint_fmtW, GetCurrentProcessId()); + swprintf(endpoint, ARRAY_SIZE(endpoint), endpoint_fmtW, GetCurrentProcessId()); status = RpcServerUseProtseqEpW(ncalrpcW, RPC_C_PROTSEQ_MAX_REQS_DEFAULT, endpoint, NULL); if (status != RPC_S_OK) @@ -839,14 +837,14 @@ static HANDLE execute_command( const WCHAR *app, WCHAR *arg, const WCHAR *dir ) return INVALID_HANDLE_VALUE; } - if (arg) len_arg = strlenW( arg ); + if (arg) len_arg = lstrlenW( arg ); if (!(cmd = msi_alloc( (len_exe + len_arg + 4) * sizeof(WCHAR) ))) { msi_free( exe ); return INVALID_HANDLE_VALUE; } p = cmd; - if (strchrW( exe, ' ' )) + if (wcschr( exe, ' ' )) { *p++ = '\"'; memcpy( p, exe, len_exe * sizeof(WCHAR) ); @@ -856,7 +854,7 @@ static HANDLE execute_command( const WCHAR *app, WCHAR *arg, const WCHAR *dir ) } else { - strcpyW( p, exe ); + lstrcpyW( p, exe ); p += len_exe; } if (arg) @@ -976,15 +974,15 @@ static UINT HANDLE_CustomType23( MSIPACKAGE *package, const WCHAR *source, const HANDLE handle; if (!(dir = msi_dup_property( package->db, szOriginalDatabase ))) return ERROR_OUTOFMEMORY; - if (!(p = strrchrW( dir, '\\' )) && !(p = strrchrW( dir, '/' ))) + if (!(p = wcsrchr( dir, '\\' )) && !(p = wcsrchr( dir, '/' ))) { msi_free( dir ); return ERROR_FUNCTION_FAILED; } *p = 0; len_dir = p - dir; - len_src = strlenW( source ); - len_tgt = strlenW( target ); + len_src = lstrlenW( source ); + len_tgt = lstrlenW( target ); if (!(arg = msi_alloc( (len + len_dir + len_src + len_tgt + 5) * sizeof(WCHAR) ))) { msi_free( dir ); @@ -999,7 +997,7 @@ static UINT HANDLE_CustomType23( MSIPACKAGE *package, const WCHAR *source, const len += len_src; arg[len++] = '"'; arg[len++] = ' '; - strcpyW( arg + len, target ); + lstrcpyW( arg + len, target ); TRACE("installing %s concurrently\n", debugstr_w(source)); @@ -1332,7 +1330,7 @@ UINT ACTION_CustomAction(MSIPACKAGE *package, const WCHAR *action) int len; /* deferred action: [properties]Action */ - if ((ptr = strrchrW(action, ']'))) + if ((ptr = wcsrchr(action, ']'))) { deferred_data = action; action = ptr + 1; @@ -1431,7 +1429,7 @@ UINT ACTION_CustomAction(MSIPACKAGE *package, const WCHAR *action) len = deformat_string( package, target, &deformated ); rc = msi_set_property( package->db, source, deformated, len ); - if (rc == ERROR_SUCCESS && !strcmpW( source, szSourceDir )) + if (rc == ERROR_SUCCESS && !wcscmp( source, szSourceDir )) msi_reset_source_folders( package ); msi_free(deformated); break; diff --git a/dll/win32/msi/database.c b/dll/win32/msi/database.c index 11ed27d9f20..776fe53e163 100644 --- a/dll/win32/msi/database.c +++ b/dll/win32/msi/database.c @@ -28,7 +28,6 @@ #include "winreg.h" #include "winnls.h" #include "wine/debug.h" -#include "wine/unicode.h" #include "msi.h" #include "msiquery.h" #include "msipriv.h" @@ -251,7 +250,7 @@ UINT MSI_OpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIDATABASE **pdb) goto end; } - if (!strchrW( save_path, '\\' )) + if (!wcschr( save_path, '\\' )) { GetCurrentDirectoryW( MAX_PATH, path ); lstrcatW( path, szBackSlash ); @@ -456,7 +455,7 @@ static LPWSTR msi_build_createsql_prelude(LPWSTR table) if (!prelude) return NULL; - sprintfW(prelude, create_fmt, table); + swprintf(prelude, size, create_fmt, table); return prelude; } @@ -492,7 +491,7 @@ static LPWSTR msi_build_createsql_columns(LPWSTR *columns_data, LPWSTR *types, D comma[0] = ','; ptr = &types[i][1]; - len = atolW(ptr); + len = wcstol(ptr, NULL, 10); extra[0] = '\0'; switch (types[i][0]) @@ -503,14 +502,14 @@ static LPWSTR msi_build_createsql_columns(LPWSTR *columns_data, LPWSTR *types, D case 'L': lstrcatW(extra, localizable); type = type_char; - sprintfW(size, size_fmt, ptr); + swprintf(size, ARRAY_SIZE(size), size_fmt, ptr); break; case 's': lstrcpyW(extra, type_notnull); /* fall through */ case 'S': type = type_char; - sprintfW(size, size_fmt, ptr); + swprintf(size, ARRAY_SIZE(size), size_fmt, ptr); break; case 'i': lstrcpyW(extra, type_notnull); @@ -539,7 +538,7 @@ static LPWSTR msi_build_createsql_columns(LPWSTR *columns_data, LPWSTR *types, D return NULL; } - sprintfW(expanded, column_fmt, columns_data[i], type, size, extra, comma); + swprintf(expanded, ARRAY_SIZE(expanded), column_fmt, columns_data[i], type, size, extra, comma); sql_size += lstrlenW(expanded); p = msi_realloc(columns, sql_size * sizeof(WCHAR)); @@ -573,7 +572,7 @@ static LPWSTR msi_build_createsql_postlude(LPWSTR *primary_keys, DWORD num_keys) for (i = 0, ptr = keys; i < num_keys; i++) { - ptr += sprintfW(ptr, key_fmt, primary_keys[i]); + ptr += swprintf(ptr, size - (ptr - keys), key_fmt, primary_keys[i]); } /* remove final ', ' */ @@ -584,7 +583,7 @@ static LPWSTR msi_build_createsql_postlude(LPWSTR *primary_keys, DWORD num_keys) if (!postlude) goto done; - sprintfW(postlude, postlude_fmt, keys); + swprintf(postlude, size, postlude_fmt, keys); done: msi_free(keys); @@ -644,7 +643,7 @@ static LPWSTR msi_import_stream_filename(LPCWSTR path, LPCWSTR name) lstrcpyW( fullname, path ); /* chop off extension from path */ - ptr = strrchrW(fullname, '.'); + ptr = wcsrchr(fullname, '.'); if (!ptr) { msi_free (fullname); @@ -673,7 +672,7 @@ static UINT construct_record(DWORD num_columns, LPWSTR *types, break; case 'I': case 'i': if (*data[i]) - MSI_RecordSetInteger(*rec, i + 1, atoiW(data[i])); + MSI_RecordSetInteger(*rec, i + 1, wcstol(data[i], NULL, 10)); break; case 'V': case 'v': if (*data[i]) @@ -790,9 +789,9 @@ static UINT MSI_DatabaseImport(MSIDATABASE *db, LPCWSTR folder, LPCWSTR file) msi_parse_line( &ptr, &labels, &num_labels, &len ); if (num_columns == 1 && !columns[0][0] && num_labels == 1 && !labels[0][0] && - num_types == 2 && !strcmpW( types[1], forcecodepage )) + num_types == 2 && !wcscmp( types[1], forcecodepage )) { - r = msi_set_string_table_codepage( db->strings, atoiW( types[0] ) ); + r = msi_set_string_table_codepage( db->strings, wcstol( types[0], NULL, 10 ) ); goto done; } @@ -824,7 +823,7 @@ static UINT MSI_DatabaseImport(MSIDATABASE *db, LPCWSTR folder, LPCWSTR file) records = temp_records; } - if (!strcmpW(labels[0], suminfo)) + if (!wcscmp(labels[0], suminfo)) { r = msi_add_suminfo( db, records, num_records, num_columns ); if (r != ERROR_SUCCESS) @@ -966,11 +965,11 @@ static UINT msi_export_stream( const WCHAR *folder, const WCHAR *table, MSIRECOR if (r != ERROR_SUCCESS) return r; - len = (sz + strlenW( folder ) + strlenW( table ) + ARRAY_SIZE( fmt ) + 1) * sizeof(WCHAR); - if (!(path = msi_alloc( len ))) + len = sz + lstrlenW( folder ) + lstrlenW( table ) + ARRAY_SIZE( fmt ) + 1; + if (!(path = msi_alloc( len * sizeof(WCHAR) ))) return ERROR_OUTOFMEMORY; - len = sprintfW( path, fmt, folder, table ); + len = swprintf( path, len, fmt, folder, table ); if (!CreateDirectoryW( path, NULL ) && GetLastError() != ERROR_ALREADY_EXISTS) { msi_free( path ); @@ -978,7 +977,7 @@ static UINT msi_export_stream( const WCHAR *folder, const WCHAR *table, MSIRECOR } path[len++] = '\\'; - strcpyW( path + len, stream ); + lstrcpyW( path + len, stream ); file = CreateFileW( path, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL ); msi_free( path ); @@ -1108,14 +1107,14 @@ static UINT MSI_DatabaseExport( MSIDATABASE *db, LPCWSTR table, LPCWSTR folder, if (handle == INVALID_HANDLE_VALUE) return ERROR_FUNCTION_FAILED; - if (!strcmpW( table, forcecodepage )) + if (!wcscmp( table, forcecodepage )) { UINT codepage = msi_get_string_table_codepage( db->strings ); r = msi_export_forcecodepage( handle, codepage ); goto done; } - if (!strcmpW( table, summaryinformation )) + if (!wcscmp( table, summaryinformation )) { r = msi_export_summaryinformation( db, handle ); goto done; @@ -1288,7 +1287,7 @@ static BOOL merge_type_match(LPCWSTR type1, LPCWSTR type2) ((type2[0] == 'L') || (type2[0] == 'S'))) return TRUE; - return !strcmpW( type1, type2 ); + return !wcscmp( type1, type2 ); } static UINT merge_verify_colnames(MSIQUERY *dbview, MSIQUERY *mergeview) @@ -1313,7 +1312,7 @@ static UINT merge_verify_colnames(MSIQUERY *dbview, MSIQUERY *mergeview) if (!MSI_RecordGetString(mergerec, i)) break; - if (strcmpW( MSI_RecordGetString( dbrec, i ), MSI_RecordGetString( mergerec, i ) )) + if (wcscmp( MSI_RecordGetString( dbrec, i ), MSI_RecordGetString( mergerec, i ) )) { r = ERROR_DATATYPE_MISMATCH; goto done; @@ -1379,7 +1378,7 @@ static UINT merge_verify_primary_keys(MSIDATABASE *db, MSIDATABASE *mergedb, for (i = 1; i <= count; i++) { - if (strcmpW( MSI_RecordGetString( dbrec, i ), MSI_RecordGetString( mergerec, i ) )) + if (wcscmp( MSI_RecordGetString( dbrec, i ), MSI_RecordGetString( mergerec, i ) )) { r = ERROR_DATATYPE_MISMATCH; goto done; @@ -1407,7 +1406,7 @@ static LPWSTR get_key_value(MSIQUERY *view, LPCWSTR key, MSIRECORD *rec) do { str = msi_dup_record_field(colnames, ++i); - cmp = strcmpW( key, str ); + cmp = wcscmp( key, str ); msi_free(str); } while (cmp); @@ -1497,7 +1496,7 @@ static LPWSTR create_diff_row_query(MSIDATABASE *merge, MSIQUERY *view, goto done; } - sprintfW(clause + oldsize - 1, setptr, key, val); + swprintf(clause + oldsize - 1, size - (oldsize - 1), setptr, key, val); msi_free(val); } @@ -1506,7 +1505,7 @@ static LPWSTR create_diff_row_query(MSIDATABASE *merge, MSIQUERY *view, if (!query) goto done; - sprintfW(query, fmt, table, clause); + swprintf(query, size, fmt, table, clause); done: msi_free(clause); diff --git a/dll/win32/msi/dialog.c b/dll/win32/msi/dialog.c index d0a8c821fd7..f35ae6f2466 100644 --- a/dll/win32/msi/dialog.c +++ b/dll/win32/msi/dialog.c @@ -40,7 +40,6 @@ #include "shellapi.h" #include "wine/debug.h" -#include "wine/unicode.h" #include "msipriv.h" #include "msiserver.h" @@ -204,7 +203,7 @@ static msi_control *msi_dialog_find_control( msi_dialog *dialog, LPCWSTR name ) if( !dialog->hwnd ) return NULL; LIST_FOR_EACH_ENTRY( control, &dialog->controls, msi_control, entry ) - if( !strcmpW( control->name, name ) ) /* FIXME: case sensitive? */ + if( !wcscmp( control->name, name ) ) /* FIXME: case sensitive? */ return control; return NULL; } @@ -218,7 +217,7 @@ static msi_control *msi_dialog_find_control_by_type( msi_dialog *dialog, LPCWSTR if( !dialog->hwnd ) return NULL; LIST_FOR_EACH_ENTRY( control, &dialog->controls, msi_control, entry ) - if( !strcmpW( control->type, type ) ) /* FIXME: case sensitive? */ + if( !wcscmp( control->type, type ) ) /* FIXME: case sensitive? */ return control; return NULL; } @@ -278,7 +277,7 @@ static LPWSTR msi_dialog_get_style( LPCWSTR p, LPCWSTR *rest ) if( !p ) return NULL; - while ((first = strchrW( p, '{' )) && (q = strchrW( first + 1, '}' ))) + while ((first = wcschr( p, '{' )) && (q = wcschr( first + 1, '}' ))) { p = first + 1; if( *p != '\\' && *p != '&' ) @@ -315,8 +314,8 @@ static UINT msi_dialog_add_font( MSIRECORD *rec, LPVOID param ) /* create a font and add it to the list */ name = MSI_RecordGetString( rec, 1 ); - font = msi_alloc( FIELD_OFFSET( msi_font, name[strlenW( name ) + 1] )); - strcpyW( font->name, name ); + font = msi_alloc( FIELD_OFFSET( msi_font, name[lstrlenW( name ) + 1] )); + lstrcpyW( font->name, name ); list_add_head( &dialog->fonts, &font->entry ); font->color = MSI_RecordGetInteger( rec, 4 ); @@ -355,7 +354,7 @@ static msi_font *msi_dialog_find_font( msi_dialog *dialog, LPCWSTR name ) msi_font *font = NULL; LIST_FOR_EACH_ENTRY( font, &dialog->fonts, msi_font, entry ) - if( !strcmpW( font->name, name ) ) /* FIXME: case sensitive? */ + if( !wcscmp( font->name, name ) ) /* FIXME: case sensitive? */ break; return font; @@ -420,11 +419,11 @@ static msi_control *dialog_create_window( msi_dialog *dialog, MSIRECORD *rec, DW style |= WS_CHILD; - control = msi_alloc( FIELD_OFFSET( msi_control, name[strlenW( name ) + 1] )); + control = msi_alloc( FIELD_OFFSET( msi_control, name[lstrlenW( name ) + 1] )); if (!control) return NULL; - strcpyW( control->name, name ); + lstrcpyW( control->name, name ); list_add_tail( &dialog->controls, &control->entry ); control->handler = NULL; control->update = NULL; @@ -557,7 +556,7 @@ static void msi_dialog_update_controls( msi_dialog *dialog, LPCWSTR property ) LIST_FOR_EACH_ENTRY( control, &dialog->controls, msi_control, entry ) { - if ( control->property && !strcmpW( control->property, property ) && control->update ) + if ( control->property && !wcscmp( control->property, property ) && control->update ) control->update( dialog, control ); } } @@ -576,7 +575,7 @@ static void msi_dialog_update_all_controls( msi_dialog *dialog ) static void msi_dialog_set_property( MSIPACKAGE *package, LPCWSTR property, LPCWSTR value ) { UINT r = msi_set_property( package->db, property, value, -1 ); - if (r == ERROR_SUCCESS && !strcmpW( property, szSourceDir )) + if (r == ERROR_SUCCESS && !wcscmp( property, szSourceDir )) msi_reset_source_folders( package ); } @@ -614,7 +613,7 @@ static void dialog_handle_event( msi_dialog *dialog, const WCHAR *control, ctrl = msi_dialog_find_control( dialog, control ); if (!ctrl) return; - if( !strcmpW( attribute, szText ) ) + if( !wcscmp( attribute, szText ) ) { const WCHAR *font_text, *text = NULL; WCHAR *font, *text_fmt = NULL; @@ -631,7 +630,7 @@ static void dialog_handle_event( msi_dialog *dialog, const WCHAR *control, msi_free( text_fmt ); msi_dialog_check_messages( NULL ); } - else if( !strcmpW( attribute, szProgress ) ) + else if( !wcscmp( attribute, szProgress ) ) { DWORD func, val1, val2, units; @@ -686,12 +685,12 @@ static void dialog_handle_event( msi_dialog *dialog, const WCHAR *control, break; } } - else if ( !strcmpW( attribute, szProperty ) ) + else if ( !wcscmp( attribute, szProperty ) ) { MSIFEATURE *feature = msi_seltree_get_selected_feature( ctrl ); if (feature) msi_dialog_set_property( dialog->package, ctrl->property, feature->Directory ); } - else if ( !strcmpW( attribute, szSelectionPath ) ) + else if ( !wcscmp( attribute, szSelectionPath ) ) { BOOL indirect = ctrl->attributes & msidbControlAttributesIndirect; LPWSTR path = msi_dialog_dup_property( dialog, ctrl->property, indirect ); @@ -716,9 +715,9 @@ static void event_subscribe( msi_dialog *dialog, const WCHAR *event, const WCHAR LIST_FOR_EACH_ENTRY( sub, &dialog->package->subscriptions, struct subscriber, entry ) { if (sub->dialog == dialog && - !strcmpiW( sub->event, event ) && - !strcmpiW( sub->control, control ) && - !strcmpiW( sub->attribute, attribute )) + !wcsicmp( sub->event, event ) && + !wcsicmp( sub->control, control ) && + !wcsicmp( sub->attribute, attribute )) { TRACE("already subscribed\n"); return; @@ -780,7 +779,7 @@ static msi_control *msi_dialog_add_control( msi_dialog *dialog, name = MSI_RecordGetString( rec, 2 ); control_type = MSI_RecordGetString( rec, 3 ); attributes = MSI_RecordGetInteger( rec, 8 ); - if (strcmpW( control_type, szScrollableText )) text = MSI_RecordGetString( rec, 10 ); + if (wcscmp( control_type, szScrollableText )) text = MSI_RecordGetString( rec, 10 ); TRACE("%s, %s, %08x, %s, %08x\n", debugstr_w(szCls), debugstr_w(name), attributes, debugstr_w(text), style); @@ -920,14 +919,14 @@ static UINT msi_dialog_set_property_event( msi_dialog *dialog, LPCWSTR event, LP LPWSTR p, prop, arg_fmt = NULL; UINT len; - len = strlenW( event ); + len = lstrlenW( event ); prop = msi_alloc( len * sizeof(WCHAR) ); - strcpyW( prop, &event[1] ); - p = strchrW( prop, ']' ); + lstrcpyW( prop, &event[1] ); + p = wcschr( prop, ']' ); if (p && (p[1] == 0 || p[1] == ' ')) { *p = 0; - if (strcmpW( szNullArg, arg )) + if (wcscmp( szNullArg, arg )) deformat_string( dialog->package, arg, &arg_fmt ); msi_dialog_set_property( dialog->package, prop, arg_fmt ); msi_dialog_update_controls( dialog, prop ); @@ -1180,11 +1179,11 @@ static UINT msi_dialog_line_control( msi_dialog *dialog, MSIRECORD *rec ) dialog_map_events( dialog, name ); - control = msi_alloc( FIELD_OFFSET(msi_control, name[strlenW( name ) + 1] )); + control = msi_alloc( FIELD_OFFSET(msi_control, name[lstrlenW( name ) + 1] )); if (!control) return ERROR_OUTOFMEMORY; - strcpyW( control->name, name ); + lstrcpyW( control->name, name ); list_add_head( &dialog->controls, &control->entry ); control->handler = NULL; control->property = NULL; @@ -1572,15 +1571,15 @@ static UINT msi_dialog_set_control_condition( MSIRECORD *rec, LPVOID param ) TRACE("%s control %s\n", debugstr_w(action), debugstr_w(name)); /* FIXME: case sensitive? */ - if (!strcmpW( action, szHide )) + if (!wcscmp( action, szHide )) ShowWindow(control->hwnd, SW_HIDE); - else if (!strcmpW( action, szShow )) + else if (!wcscmp( action, szShow )) ShowWindow(control->hwnd, SW_SHOW); - else if (!strcmpW( action, szDisable )) + else if (!wcscmp( action, szDisable )) EnableWindow(control->hwnd, FALSE); - else if (!strcmpW( action, szEnable )) + else if (!wcscmp( action, szEnable )) EnableWindow(control->hwnd, TRUE); - else if (!strcmpW( action, szDefault )) + else if (!wcscmp( action, szDefault )) SetFocus(control->hwnd); else FIXME("Unhandled action %s\n", debugstr_w(action)); @@ -1653,7 +1652,7 @@ static void msi_dialog_combobox_update( msi_dialog *dialog, msi_control *control for (j = 0; j < info->num_items; j++) { tmp = (LPWSTR) SendMessageW( control->hwnd, CB_GETITEMDATA, j, 0 ); - if (!strcmpW( value, tmp )) + if (!wcscmp( value, tmp )) break; } @@ -1754,15 +1753,15 @@ static UINT msi_dialog_edit_control( msi_dialog *dialog, MSIRECORD *rec ) text = MSI_RecordGetString( rec, 10 ); if ( text ) { - begin = strchrW( text, '{' ); - end = strchrW( text, '}' ); + begin = wcschr( text, '{' ); + end = wcschr( text, '}' ); if ( begin && end && end > begin && begin[0] >= '0' && begin[0] <= '9' && end - begin < MAX_NUM_DIGITS) { lstrcpynW( num, begin + 1, end - begin ); - limit = atolW( num ); + limit = wcstol( num, NULL, 10 ); SendMessageW( control->hwnd, EM_SETLIMITTEXT, limit, 0 ); } @@ -1927,7 +1926,7 @@ msi_maskedit_set_text( struct msi_maskedit_info *info, LPCWSTR text ) p = text; for( i = 0; i < info->num_groups; i++ ) { - if( info->group[i].len < strlenW( p ) ) + if( info->group[i].len < lstrlenW( p ) ) { LPWSTR chunk = strdupW( p ); chunk[ info->group[i].len ] = 0; @@ -1958,7 +1957,7 @@ static struct msi_maskedit_info * msi_dialog_parse_groups( LPCWSTR mask ) if( !info ) return info; - p = strchrW(mask, '<'); + p = wcschr(mask, '<'); if( p ) p++; else @@ -2305,7 +2304,7 @@ static UINT msi_dialog_create_radiobutton( MSIRECORD *rec, LPVOID param ) return ERROR_FUNCTION_FAILED; control->handler = msi_dialog_radiogroup_handler; - if (group->propval && !strcmpW( control->name, group->propval )) + if (group->propval && !wcscmp( control->name, group->propval )) SendMessageW(control->hwnd, BM_SETCHECK, BST_CHECKED, 0); prop = MSI_RecordGetString( rec, 1 ); @@ -2570,7 +2569,7 @@ msi_seltree_add_child_features( MSIPACKAGE *package, HWND hwnd, LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry ) { - if ( parent && feature->Feature_Parent && strcmpW( parent, feature->Feature_Parent )) + if ( parent && feature->Feature_Parent && wcscmp( parent, feature->Feature_Parent )) continue; else if ( parent && !feature->Feature_Parent ) continue; @@ -2994,7 +2993,7 @@ static void msi_dialog_update_directory_list( msi_dialog *dialog, msi_control *c if ( wfd.dwFileAttributes != FILE_ATTRIBUTE_DIRECTORY ) continue; - if ( !strcmpW( wfd.cFileName, szDot ) || !strcmpW( wfd.cFileName, szDotDot ) ) + if ( !wcscmp( wfd.cFileName, szDot ) || !wcscmp( wfd.cFileName, szDotDot ) ) continue; item.mask = LVIF_TEXT; @@ -3045,10 +3044,10 @@ static WCHAR *get_unique_folder_name( const WCHAR *root, int *ret_len ) int len, count = 2; len = LoadStringW( msi_hInstance, IDS_NEWFOLDER, newfolder, ARRAY_SIZE(newfolder) ); - len += strlenW(root) + 1; + len += lstrlenW(root) + 1; if (!(path = msi_alloc( (len + 4) * sizeof(WCHAR) ))) return NULL; - strcpyW( path, root ); - strcatW( path, newfolder ); + lstrcpyW( path, root ); + lstrcatW( path, newfolder ); for (;;) { @@ -3058,11 +3057,11 @@ static WCHAR *get_unique_folder_name( const WCHAR *root, int *ret_len ) msi_free( path ); return NULL; } - len = sprintfW( path, fmtW, root, newfolder, count++ ) + 1; + swprintf( path, len + 4, fmtW, root, newfolder, count++ ); } - ptr = strrchrW( path, '\\' ) + 1; - *ret_len = len - (ptr - path); + ptr = wcsrchr( path, '\\' ) + 1; + *ret_len = lstrlenW(ptr); memmove( path, ptr, *ret_len * sizeof(WCHAR) ); return path; } @@ -3133,7 +3132,7 @@ static UINT msi_dialog_dirlist_handler( msi_dialog *dialog, msi_control *control prop = msi_dialog_dup_property( dialog, control->property, indirect ); path = msi_dialog_dup_property( dialog, prop, TRUE ); - if (!(new_path = msi_alloc( (strlenW(path) + strlenW(text) + 2) * sizeof(WCHAR) ))) + if (!(new_path = msi_alloc( (lstrlenW(path) + lstrlenW(text) + 2) * sizeof(WCHAR) ))) { msi_free( prop ); msi_free( path ); @@ -3191,7 +3190,7 @@ static BOOL str_is_number( LPCWSTR str ) int i; for (i = 0; i < lstrlenW( str ); i++) - if (!isdigitW(str[i])) + if (!iswdigit(str[i])) return FALSE; return TRUE; @@ -3218,9 +3217,9 @@ static void msi_dialog_vcl_add_columns( msi_dialog *dialog, msi_control *control if (!text) return; - while ((begin = strchrW( begin, '{' )) && count < 5) + while ((begin = wcschr( begin, '{' )) && count < 5) { - if (!(end = strchrW( begin, '}' ))) + if (!(end = wcschr( begin, '}' ))) return; num = msi_alloc( (end-begin+1)*sizeof(WCHAR) ); @@ -3231,7 +3230,7 @@ static void msi_dialog_vcl_add_columns( msi_dialog *dialog, msi_control *control begin += end - begin + 1; /* empty braces or '0' hides the column */ - if ( !num[0] || !strcmpW( num, szZero ) ) + if ( !num[0] || !wcscmp( num, szZero ) ) { count++; msi_free( num ); @@ -3241,14 +3240,14 @@ static void msi_dialog_vcl_add_columns( msi_dialog *dialog, msi_control *control /* the width must be a positive number * if a width is invalid, all remaining columns are hidden */ - if ( !strncmpW( num, negative, 1 ) || !str_is_number( num ) ) { + if ( !wcsncmp( num, negative, 1 ) || !str_is_number( num ) ) { msi_free( num ); return; } ZeroMemory( &lvc, sizeof(lvc) ); lvc.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM; - lvc.cx = atolW( num ); + lvc.cx = wcstol( num, NULL, 10 ); lvc.pszText = msi_dialog_get_uitext( dialog, column_keys[count] ); SendMessageW( control->hwnd, LVM_INSERTCOLUMNW, count++, (LPARAM)&lvc ); @@ -3467,16 +3466,16 @@ static UINT msi_dialog_hyperlink_handler( msi_dialog *dialog, msi_control *contr p = item.szUrl; while (*p && *p != '<') p++; if (!*p++) return ERROR_SUCCESS; - if (toupperW( *p++ ) != 'A' || !isspaceW( *p++ )) return ERROR_SUCCESS; - while (*p && isspaceW( *p )) p++; + if (towupper( *p++ ) != 'A' || !iswspace( *p++ )) return ERROR_SUCCESS; + while (*p && iswspace( *p )) p++; - len = strlenW( p ); - if (len > len_href && !strncmpiW( p, hrefW, len_href )) + len = lstrlenW( p ); + if (len > len_href && !wcsnicmp( p, hrefW, len_href )) { p += len_href; - while (*p && isspaceW( *p )) p++; + while (*p && iswspace( *p )) p++; if (!*p || *p++ != '=') return ERROR_SUCCESS; - while (*p && isspaceW( *p )) p++; + while (*p && iswspace( *p )) p++; if (*p == '\"' || *p == '\'') quote = *p++; q = p; @@ -3487,7 +3486,7 @@ static UINT msi_dialog_hyperlink_handler( msi_dialog *dialog, msi_control *contr } else { - while (*q && *q != '>' && !isspaceW( *q )) q++; + while (*q && *q != '>' && !iswspace( *q )) q++; if (!*q) return ERROR_SUCCESS; } item.szUrl[q - item.szUrl] = 0; @@ -3501,7 +3500,7 @@ static UINT msi_dialog_hyperlink( msi_dialog *dialog, MSIRECORD *rec ) msi_control *control; DWORD style = WS_CHILD | WS_TABSTOP | WS_GROUP; const WCHAR *text = MSI_RecordGetString( rec, 10 ); - int len = strlenW( text ); + int len = lstrlenW( text ); LITEM item; control = msi_dialog_add_control( dialog, rec, WC_LINK, style ); @@ -3515,7 +3514,7 @@ static UINT msi_dialog_hyperlink( msi_dialog *dialog, MSIRECORD *rec ) item.iLink = 0; item.state = LIS_ENABLED; item.stateMask = LIS_ENABLED; - if (len < L_MAX_URL_LENGTH) strcpyW( item.szUrl, text ); + if (len < L_MAX_URL_LENGTH) lstrcpyW( item.szUrl, text ); else item.szUrl[0] = 0; SendMessageW( control->hwnd, LM_SETITEM, 0, (LPARAM)&item ); @@ -3557,7 +3556,7 @@ static UINT msi_dialog_create_controls( MSIRECORD *rec, LPVOID param ) /* find and call the function that can create this type of control */ control_type = MSI_RecordGetString( rec, 3 ); for( i = 0; i < ARRAY_SIZE( msi_dialog_handler ); i++ ) - if (!strcmpiW( msi_dialog_handler[i].control_type, control_type )) + if (!wcsicmp( msi_dialog_handler[i].control_type, control_type )) break; if( i != ARRAY_SIZE( msi_dialog_handler )) msi_dialog_handler[i].func( dialog, rec ); @@ -3615,7 +3614,7 @@ static INT msi_dialog_get_sans_serif_height( HWND hwnd ) { memset( &lf, 0, sizeof lf ); lf.lfHeight = MulDiv(12, GetDeviceCaps(hdc, LOGPIXELSY), 72); - strcpyW( lf.lfFaceName, szSansSerif ); + lstrcpyW( lf.lfFaceName, szSansSerif ); hFont = CreateFontIndirectW(&lf); if (hFont) { @@ -4013,10 +4012,10 @@ static msi_dialog *dialog_create( MSIPACKAGE *package, const WCHAR *name, msi_di if (!hMsiHiddenWindow) dialog_register_class(); /* allocate the structure for the dialog to use */ - dialog = msi_alloc_zero( FIELD_OFFSET( msi_dialog, name[strlenW( name ) + 1] )); + dialog = msi_alloc_zero( FIELD_OFFSET( msi_dialog, name[lstrlenW( name ) + 1] )); if( !dialog ) return NULL; - strcpyW( dialog->name, name ); + lstrcpyW( dialog->name, name ); dialog->parent = parent; dialog->package = package; dialog->event_handler = event_handler; @@ -4115,7 +4114,7 @@ static void event_cleanup_subscriptions( MSIPACKAGE *package, const WCHAR *dialo { struct subscriber *sub = LIST_ENTRY( item, struct subscriber, entry ); - if (strcmpW( sub->dialog->name, dialog )) continue; + if (wcscmp( sub->dialog->name, dialog )) continue; list_remove( &sub->entry ); free_subscriber( sub ); } @@ -4359,13 +4358,13 @@ static UINT event_end_dialog( msi_dialog *dialog, const WCHAR *argument ) static const WCHAR ignoreW[] = {'I','g','n','o','r','e',0}; static const WCHAR returnW[] = {'R','e','t','u','r','n',0}; - if (!strcmpW( argument, exitW )) + if (!wcscmp( argument, exitW )) dialog->retval = IDCANCEL; - else if (!strcmpW( argument, retryW )) + else if (!wcscmp( argument, retryW )) dialog->retval = IDRETRY; - else if (!strcmpW( argument, ignoreW )) + else if (!wcscmp( argument, ignoreW )) dialog->retval = IDOK; - else if (!strcmpW( argument, returnW )) + else if (!wcscmp( argument, returnW )) dialog->retval = 0; else { @@ -4447,7 +4446,7 @@ static UINT event_add_local( msi_dialog *dialog, const WCHAR *argument ) LIST_FOR_EACH_ENTRY( feature, &dialog->package->features, MSIFEATURE, entry ) { - if (!strcmpW( argument, feature->Feature ) || !strcmpW( argument, szAll )) + if (!wcscmp( argument, feature->Feature ) || !wcscmp( argument, szAll )) { if (feature->ActionRequest != INSTALLSTATE_LOCAL) msi_set_property( dialog->package->db, szPreselected, szOne, -1 ); @@ -4463,7 +4462,7 @@ static UINT event_remove( msi_dialog *dialog, const WCHAR *argument ) LIST_FOR_EACH_ENTRY( feature, &dialog->package->features, MSIFEATURE, entry ) { - if (!strcmpW( argument, feature->Feature ) || !strcmpW( argument, szAll )) + if (!wcscmp( argument, feature->Feature ) || !wcscmp( argument, szAll )) { if (feature->ActionRequest != INSTALLSTATE_ABSENT) msi_set_property( dialog->package->db, szPreselected, szOne, -1 ); @@ -4479,7 +4478,7 @@ static UINT event_add_source( msi_dialog *dialog, const WCHAR *argument ) LIST_FOR_EACH_ENTRY( feature, &dialog->package->features, MSIFEATURE, entry ) { - if (!strcmpW( argument, feature->Feature ) || !strcmpW( argument, szAll )) + if (!wcscmp( argument, feature->Feature ) || !wcscmp( argument, szAll )) { if (feature->ActionRequest != INSTALLSTATE_SOURCE) msi_set_property( dialog->package->db, szPreselected, szOne, -1 ); @@ -4497,7 +4496,7 @@ void msi_event_fire( MSIPACKAGE *package, const WCHAR *event, MSIRECORD *rec ) LIST_FOR_EACH_ENTRY( sub, &package->subscriptions, struct subscriber, entry ) { - if (strcmpiW( sub->event, event )) continue; + if (wcsicmp( sub->event, event )) continue; dialog_handle_event( sub->dialog, sub->control, sub->attribute, rec ); } } @@ -4581,7 +4580,7 @@ INT ACTION_DialogBox( MSIPACKAGE *package, const WCHAR *dialog ) static UINT event_set_install_level( msi_dialog *dialog, const WCHAR *argument ) { - int level = atolW( argument ); + int level = wcstol( argument, NULL, 10 ); TRACE("setting install level to %d\n", level); return MSI_SetInstallLevel( dialog->package, level ); @@ -4662,7 +4661,7 @@ static UINT dialog_event_handler( msi_dialog *dialog, const WCHAR *event, const for (i = 0; control_events[i].event; i++) { - if (!strcmpW( control_events[i].event, event )) + if (!wcscmp( control_events[i].event, event )) return control_events[i].handler( dialog, argument ); } FIXME("unhandled event %s arg(%s)\n", debugstr_w(event), debugstr_w(argument)); diff --git a/dll/win32/msi/files.c b/dll/win32/msi/files.c index 68b8954f57f..aba714b317d 100644 --- a/dll/win32/msi/files.c +++ b/dll/win32/msi/files.c @@ -45,7 +45,6 @@ #include "shlwapi.h" #include "patchapi.h" #include "wine/debug.h" -#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(msi); @@ -206,10 +205,10 @@ BOOL msi_create_full_path( MSIPACKAGE *package, const WCHAR *path ) WCHAR *new_path; int len; - if (!(new_path = msi_alloc( (strlenW( path ) + 1) * sizeof(WCHAR) ))) return FALSE; - strcpyW( new_path, path ); + if (!(new_path = msi_alloc( (lstrlenW( path ) + 1) * sizeof(WCHAR) ))) return FALSE; + lstrcpyW( new_path, path ); - while ((len = strlenW( new_path )) && new_path[len - 1] == '\\') + while ((len = lstrlenW( new_path )) && new_path[len - 1] == '\\') new_path[len - 1] = 0; while (!msi_create_directory( package, new_path )) @@ -222,7 +221,7 @@ BOOL msi_create_full_path( MSIPACKAGE *package, const WCHAR *path ) ret = FALSE; break; } - if (!(slash = strrchrW( new_path, '\\' ))) + if (!(slash = wcsrchr( new_path, '\\' ))) { ret = FALSE; break; @@ -436,8 +435,8 @@ 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 ((p = strrchrW(pathW, '\\'))) *p = 0; - len = strlenW( pathW ) + 16; + if ((p = wcsrchr(pathW, '\\'))) *p = 0; + len = lstrlenW( pathW ) + 16; if (!(tmpfileW = msi_alloc(len * sizeof(WCHAR)))) { msi_free( pathW ); @@ -490,7 +489,7 @@ static MSIFILE *find_file( MSIPACKAGE *package, UINT disk_id, const WCHAR *filen { if (file->disk_id == disk_id && file->state != msifs_installed && - !strcmpiW( filename, file->File )) return file; + !wcsicmp( filename, file->File )) return file; } return NULL; } @@ -670,7 +669,7 @@ static MSIFILEPATCH *find_filepatch( MSIPACKAGE *package, UINT disk_id, const WC LIST_FOR_EACH_ENTRY( patch, &package->filepatches, MSIFILEPATCH, entry ) { - if (!patch->extracted && patch->disk_id == disk_id && !strcmpW( key, patch->File->File )) + if (!patch->extracted && patch->disk_id == disk_id && !wcscmp( key, patch->File->File )) return patch; } return NULL; @@ -923,7 +922,7 @@ static WCHAR *wildcard_to_file( const WCHAR *wildcard, const WCHAR *filename ) WCHAR *path; DWORD dirlen, pathlen; - ptr = strrchrW(wildcard, '\\'); + ptr = wcsrchr(wildcard, '\\'); dirlen = ptr - wildcard + 1; pathlen = dirlen + lstrlenW(filename) + 1; @@ -964,8 +963,8 @@ static BOOL add_wildcard( FILE_LIST *files, const WCHAR *source, WCHAR *dest ) return FALSE; new->source = strdupW(source); - ptr = strrchrW(dest, '\\') + 1; - filename = strrchrW(new->source, '\\') + 1; + ptr = wcsrchr(dest, '\\') + 1; + filename = wcsrchr(new->source, '\\') + 1; new->sourcename = filename; @@ -993,7 +992,7 @@ static BOOL add_wildcard( FILE_LIST *files, const WCHAR *source, WCHAR *dest ) LIST_FOR_EACH_ENTRY(file, &files->entry, FILE_LIST, entry) { - if (strcmpW( source, file->source ) < 0) + if (wcscmp( source, file->source ) < 0) { list_add_before(&file->entry, &new->entry); return TRUE; @@ -1039,7 +1038,7 @@ static BOOL move_files_wildcard( MSIPACKAGE *package, const WCHAR *source, WCHAR /* only the first wildcard match gets renamed to dest */ file = LIST_ENTRY(list_head(&files.entry), FILE_LIST, entry); - size = (strrchrW(file->dest, '\\') - file->dest) + lstrlenW(file->destname) + 2; + size = (wcsrchr(file->dest, '\\') - file->dest) + lstrlenW(file->destname) + 2; file->dest = msi_realloc(file->dest, size * sizeof(WCHAR)); if (!file->dest) { @@ -1048,11 +1047,11 @@ static BOOL move_files_wildcard( MSIPACKAGE *package, const WCHAR *source, WCHAR } /* file->dest may be shorter after the reallocation, so add a NULL - * terminator. This is needed for the call to strrchrW, as there will no + * terminator. This is needed for the call to wcsrchr, as there will no * longer be a NULL terminator within the bounds of the allocation in this case. */ file->dest[size - 1] = '\0'; - lstrcpyW(strrchrW(file->dest, '\\') + 1, file->destname); + lstrcpyW(wcsrchr(file->dest, '\\') + 1, file->destname); while (!list_empty(&files.entry)) { @@ -1074,8 +1073,8 @@ done: void msi_reduce_to_long_filename( WCHAR *filename ) { - WCHAR *p = strchrW( filename, '|' ); - if (p) memmove( filename, p + 1, (strlenW( p + 1 ) + 1) * sizeof(WCHAR) ); + WCHAR *p = wcschr( filename, '|' ); + if (p) memmove( filename, p + 1, (lstrlenW( p + 1 ) + 1) * sizeof(WCHAR) ); } static UINT ITERATE_MoveFiles( MSIRECORD *rec, LPVOID param ) @@ -1134,7 +1133,7 @@ static UINT ITERATE_MoveFiles( MSIRECORD *rec, LPVOID param ) lstrcatW(source, sourcename); } - wildcards = strchrW(source, '*') || strchrW(source, '?'); + wildcards = wcschr(source, '*') || wcschr(source, '?'); if (MSI_RecordIsNull(rec, 4)) { @@ -1143,7 +1142,7 @@ static UINT ITERATE_MoveFiles( MSIRECORD *rec, LPVOID param ) WCHAR *p; if (sourcename) destname = strdupW(sourcename); - else if ((p = strrchrW(sourcedir, '\\'))) + else if ((p = wcsrchr(sourcedir, '\\'))) destname = strdupW(p + 1); else destname = strdupW(sourcedir); @@ -1231,9 +1230,9 @@ static WCHAR *get_duplicate_filename( MSIPACKAGE *package, MSIRECORD *row, const if (MSI_RecordIsNull( row, 4 )) { - len = strlenW( src ) + 1; + len = lstrlenW( src ) + 1; if (!(dst_name = msi_alloc( len * sizeof(WCHAR)))) return NULL; - strcpyW( dst_name, strrchrW( src, '\\' ) + 1 ); + lstrcpyW( dst_name, wcsrchr( src, '\\' ) + 1 ); } else { @@ -1247,7 +1246,7 @@ static WCHAR *get_duplicate_filename( MSIPACKAGE *package, MSIRECORD *row, const { WCHAR *p; dst_path = strdupW( src ); - p = strrchrW( dst_path, '\\' ); + p = wcsrchr( dst_path, '\\' ); if (p) *p = 0; } else diff --git a/dll/win32/msi/font.c b/dll/win32/msi/font.c index 08dcc149579..f26d3fd99c3 100644 --- a/dll/win32/msi/font.c +++ b/dll/win32/msi/font.c @@ -25,7 +25,6 @@ #include "winreg.h" #include "wine/debug.h" #include "msipriv.h" -#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(msi); @@ -190,9 +189,9 @@ static WCHAR *font_name_from_file( MSIPACKAGE *package, const WCHAR *filename ) msi_free( name ); return NULL; } - ret = msi_alloc( (strlenW( name ) + strlenW( truetypeW ) + 1 ) * sizeof(WCHAR) ); - strcpyW( ret, name ); - strcatW( ret, truetypeW ); + ret = msi_alloc( (lstrlenW( name ) + lstrlenW( truetypeW ) + 1 ) * sizeof(WCHAR) ); + lstrcpyW( ret, name ); + lstrcatW( ret, truetypeW ); msi_free( name ); } return ret; @@ -206,20 +205,20 @@ WCHAR *msi_get_font_file_version( MSIPACKAGE *package, const WCHAR *filename ) if ((version = load_ttf_name_id( package, filename, NAME_ID_VERSION ))) { int len, major = 0, minor = 0; - if ((p = strchrW( version, ';' ))) *p = 0; + if ((p = wcschr( version, ';' ))) *p = 0; p = version; - while (*p && !isdigitW( *p )) p++; - if ((q = strchrW( p, '.' ))) + while (*p && !iswdigit( *p )) p++; + if ((q = wcschr( p, '.' ))) { - major = atoiW( p ); + major = wcstol( p, NULL, 10 ); p = ++q; - while (*q && isdigitW( *q )) q++; - if (!*q || *q == ' ') minor = atoiW( p ); + while (*q && iswdigit( *q )) q++; + if (!*q || *q == ' ') minor = wcstol( p, NULL, 10 ); else major = 0; } - len = strlenW( fmtW ) + 20; + len = lstrlenW( fmtW ) + 20; ret = msi_alloc( len * sizeof(WCHAR) ); - sprintfW( ret, fmtW, major, minor ); + swprintf( ret, len, fmtW, major, minor ); msi_free( version ); } return ret; @@ -277,7 +276,7 @@ static UINT ITERATE_RegisterFonts(MSIRECORD *row, LPVOID param) /* the UI chunk */ uirow = MSI_CreateRecord( 1 ); uipath = strdupW( file->TargetPath ); - p = strrchrW(uipath,'\\'); + p = wcsrchr(uipath,'\\'); if (p) p++; else p = uipath; MSI_RecordSetStringW( uirow, 1, p ); @@ -360,7 +359,7 @@ static UINT ITERATE_UnregisterFonts( MSIRECORD *row, LPVOID param ) /* the UI chunk */ uirow = MSI_CreateRecord( 1 ); uipath = strdupW( file->TargetPath ); - p = strrchrW( uipath,'\\' ); + p = wcsrchr( uipath,'\\' ); if (p) p++; else p = uipath; MSI_RecordSetStringW( uirow, 1, p ); diff --git a/dll/win32/msi/format.c b/dll/win32/msi/format.c index deda22595f0..340f5d5657f 100644 --- a/dll/win32/msi/format.c +++ b/dll/win32/msi/format.c @@ -36,7 +36,6 @@ #include "msipriv.h" #include "winemsi_s.h" #include "wine/exception.h" -#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(msi); @@ -163,7 +162,7 @@ static WCHAR *deformat_index( FORMAT *format, FORMSTR *str, int *ret_len ) if (!(val = msi_alloc( (str->len + 1) * sizeof(WCHAR) ))) return NULL; lstrcpynW(val, get_formstr_data(format, str), str->len + 1); - field = atoiW( val ); + field = wcstol( val, NULL, 10 ); msi_free( val ); if (MSI_RecordIsNull( format->record, field ) || @@ -222,7 +221,7 @@ static WCHAR *deformat_component( FORMAT *format, FORMSTR *str, int *ret_len ) else ret = strdupW( msi_get_target_folder( format->package, comp->Directory ) ); - if (ret) *ret_len = strlenW( ret ); + if (ret) *ret_len = lstrlenW( ret ); else *ret_len = 0; msi_free( key ); return ret; @@ -240,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 = strlenW( ret ); + if ((ret = strdupW( file->TargetPath ))) len = lstrlenW( ret ); goto done; } if (!(len = GetShortPathNameW(file->TargetPath, NULL, 0))) { - if ((ret = strdupW( file->TargetPath ))) len = strlenW( ret ); + if ((ret = strdupW( file->TargetPath ))) len = lstrlenW( ret ); goto done; } len++; @@ -352,14 +351,14 @@ static WCHAR *build_default_format( const MSIRECORD *record ) for (i = 1; i <= count; i++) { - size += sprintfW( buf, fmt, i, i ); + size += swprintf( buf, ARRAY_SIZE(buf), fmt, i, i ); if (!(tmp = msi_realloc( ret, size * sizeof(*ret) ))) { msi_free( ret ); return NULL; } ret = tmp; - strcatW( ret, buf ); + lstrcatW( ret, buf ); } return ret; } diff --git a/dll/win32/msi/insert.c b/dll/win32/msi/insert.c index f1185eebaeb..098287d6039 100644 --- a/dll/win32/msi/insert.c +++ b/dll/win32/msi/insert.c @@ -24,7 +24,6 @@ #include "winbase.h" #include "winerror.h" #include "wine/debug.h" -#include "wine/unicode.h" #include "msi.h" #include "msiquery.h" #include "objbase.h" @@ -117,7 +116,7 @@ static BOOL msi_columns_in_order(MSIINSERTVIEW *iv, UINT col_count) iv->sv->ops->get_column_info(iv->sv, i, &a, NULL, NULL, NULL); iv->table->ops->get_column_info(iv->table, i, &b, NULL, NULL, NULL); - if (strcmpW( a, b )) return FALSE; + if (wcscmp( a, b )) return FALSE; } return TRUE; } @@ -161,7 +160,7 @@ static UINT msi_arrange_record(MSIINSERTVIEW *iv, MSIRECORD **values) if (r != ERROR_SUCCESS) goto err; - if (!strcmpW( a, b )) + if (!wcscmp( a, b )) { MSI_RecordCopyField(*values, colidx, padded, i); break; diff --git a/dll/win32/msi/install.c b/dll/win32/msi/install.c index 5356451e294..ebacd9a6130 100644 --- a/dll/win32/msi/install.c +++ b/dll/win32/msi/install.c @@ -37,7 +37,6 @@ #include "wine/heap.h" #include "wine/debug.h" #include "wine/exception.h" -#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(msi); @@ -166,7 +165,7 @@ UINT msi_strcpy_to_awstring( const WCHAR *str, int len, awstring *awbuf, DWORD * if (!sz) return ERROR_SUCCESS; - if (len < 0) len = strlenW( str ); + if (len < 0) len = lstrlenW( str ); if (awbuf->unicode && awbuf->str.w) { @@ -197,7 +196,7 @@ UINT msi_strncpyWtoA(const WCHAR *str, int lenW, char *buf, DWORD *sz, BOOL remo if (!sz) return buf ? ERROR_INVALID_PARAMETER : ERROR_SUCCESS; - if (lenW < 0) lenW = strlenW(str); + if (lenW < 0) lenW = lstrlenW(str); lenA = WideCharToMultiByte(CP_ACP, 0, str, lenW + 1, NULL, 0, NULL, NULL); WideCharToMultiByte(CP_ACP, 0, str, lenW + 1, buf, *sz, NULL, NULL); lenA--; @@ -219,7 +218,7 @@ UINT msi_strncpyW(const WCHAR *str, int len, WCHAR *buf, DWORD *sz) if (!sz) return buf ? ERROR_INVALID_PARAMETER : ERROR_SUCCESS; - if (len < 0) len = strlenW(str); + if (len < 0) len = lstrlenW(str); if (buf) memcpy(buf, str, min(len + 1, *sz) * sizeof(WCHAR)); if (buf && len >= *sz) @@ -239,7 +238,7 @@ const WCHAR *msi_get_target_folder( MSIPACKAGE *package, const WCHAR *name ) if (!folder->ResolvedTarget) { MSIFOLDER *parent = folder; - while (parent->Parent && strcmpW( parent->Parent, parent->Directory )) + while (parent->Parent && wcscmp( parent->Parent, parent->Directory )) { parent = msi_get_loaded_folder( package, parent->Parent ); } @@ -370,11 +369,11 @@ WCHAR *msi_resolve_source_folder( MSIPACKAGE *package, const WCHAR *name, MSIFOL TRACE("working to resolve %s\n", debugstr_w(name)); - if (!strcmpW( name, szSourceDir )) name = szTargetDir; + if (!wcscmp( name, szSourceDir )) name = szTargetDir; if (!(f = msi_get_loaded_folder( package, name ))) return NULL; /* special resolving for root dir */ - if (!strcmpW( name, szTargetDir ) && !f->ResolvedSource) + if (!wcscmp( name, szTargetDir ) && !f->ResolvedSource) { f->ResolvedSource = get_source_root( package ); } @@ -548,7 +547,7 @@ static void set_target_path( MSIPACKAGE *package, MSIFOLDER *folder, const WCHAR WCHAR *target_path; if (!(target_path = msi_normalize_path( path ))) return; - if (strcmpW( target_path, folder->ResolvedTarget )) + if (wcscmp( target_path, folder->ResolvedTarget )) { msi_free( folder->ResolvedTarget ); folder->ResolvedTarget = target_path; @@ -936,7 +935,7 @@ UINT MSI_SetFeatureStateW( MSIPACKAGE *package, LPCWSTR szFeature, INSTALLSTATE /* update all the features that are children of this feature */ LIST_FOR_EACH_ENTRY( child, &package->features, MSIFEATURE, entry ) { - if (child->Feature_Parent && !strcmpW( szFeature, child->Feature_Parent )) + if (child->Feature_Parent && !wcscmp( szFeature, child->Feature_Parent )) MSI_SetFeatureStateW(package, child->Feature, iState); } @@ -1031,7 +1030,7 @@ UINT WINAPI MsiSetFeatureAttributesW( MSIHANDLE handle, LPCWSTR name, DWORD attr return ERROR_INVALID_HANDLE; costing = msi_dup_property( package->db, szCostingComplete ); - if (!costing || !strcmpW( costing, szOne )) + if (!costing || !wcscmp( costing, szOne )) { msi_free( costing ); msiobj_release( &package->hdr ); @@ -1318,7 +1317,7 @@ static UINT MSI_GetFeatureInfo( MSIPACKAGE *package, LPCWSTR name, LPDWORD attrs if (attrs) *attrs = map_feature_attributes( feature->Attributes ); if (title_len) { - if (feature->Title) len = strlenW( feature->Title ); + if (feature->Title) len = lstrlenW( feature->Title ); else len = 0; if (*title_len <= len) { @@ -1327,14 +1326,14 @@ static UINT MSI_GetFeatureInfo( MSIPACKAGE *package, LPCWSTR name, LPDWORD attrs } else if (title) { - if (feature->Title) strcpyW( title, feature->Title ); + if (feature->Title) lstrcpyW( title, feature->Title ); else *title = 0; *title_len = len; } } if (help_len) { - if (feature->Description) len = strlenW( feature->Description ); + if (feature->Description) len = lstrlenW( feature->Description ); else len = 0; if (*help_len <= len) { @@ -1343,7 +1342,7 @@ static UINT MSI_GetFeatureInfo( MSIPACKAGE *package, LPCWSTR name, LPDWORD attrs } else if (help) { - if (feature->Description) strcpyW( help, feature->Description ); + if (feature->Description) lstrcpyW( help, feature->Description ); else *help = 0; *help_len = len; } @@ -1588,7 +1587,7 @@ UINT MSI_SetInstallLevel( MSIPACKAGE *package, int iInstallLevel ) if (iInstallLevel < 1) return MSI_SetFeatureStates( package ); - len = sprintfW( level, fmt, iInstallLevel ); + len = swprintf( level, ARRAY_SIZE(level), fmt, iInstallLevel ); r = msi_set_property( package->db, szInstallLevel, level, len ); if ( r == ERROR_SUCCESS ) r = MSI_SetFeatureStates( package ); diff --git a/dll/win32/msi/media.c b/dll/win32/msi/media.c index e334c5b6eac..05a751092a3 100644 --- a/dll/win32/msi/media.c +++ b/dll/win32/msi/media.c @@ -31,7 +31,6 @@ #include "winreg.h" #include "shlwapi.h" #include "objidl.h" -#include "wine/unicode.h" #include "resource.h" WINE_DEFAULT_DEBUG_CHANNEL(msi); @@ -59,7 +58,7 @@ static BOOL source_matches_volume(MSIMEDIAINFO *mi, LPCWSTR source_root) const WCHAR *p; int len, len2; - strcpyW(root, source_root); + lstrcpyW(root, source_root); PathStripToRootW(root); PathAddBackslashW(root); @@ -69,12 +68,12 @@ static BOOL source_matches_volume(MSIMEDIAINFO *mi, LPCWSTR source_root) return FALSE; } - len = strlenW( volume_name ); - len2 = strlenW( mi->volume_label ); + len = lstrlenW( volume_name ); + len2 = lstrlenW( mi->volume_label ); if (len2 > len) return FALSE; p = volume_name + len - len2; - return !strcmpiW( mi->volume_label, p ); + return !wcsicmp( mi->volume_label, p ); } static UINT msi_change_media(MSIPACKAGE *package, MSIMEDIAINFO *mi) @@ -309,10 +308,10 @@ static WCHAR *get_cabinet_filename(MSIMEDIAINFO *mi) int len; WCHAR *ret; - len = strlenW(mi->sourcedir) + strlenW(mi->cabinet) + 1; + len = lstrlenW(mi->sourcedir) + lstrlenW(mi->cabinet) + 1; if (!(ret = msi_alloc(len * sizeof(WCHAR)))) return NULL; - strcpyW(ret, mi->sourcedir); - strcatW(ret, mi->cabinet); + lstrcpyW(ret, mi->sourcedir); + lstrcatW(ret, mi->cabinet); return ret; } @@ -342,7 +341,7 @@ static INT_PTR cabinet_next_cabinet(FDINOTIFICATIONTYPE fdint, goto done; } - if (strcmpiW( mi->cabinet, cab )) + if (wcsicmp( mi->cabinet, cab )) { char *next_cab; ULONG length; @@ -467,8 +466,8 @@ static INT_PTR cabinet_copy_file(FDINOTIFICATIONTYPE fdint, TRACE("file in use, scheduling rename operation\n"); if (!(tmppathW = strdupW( path ))) return ERROR_OUTOFMEMORY; - if ((p = strrchrW(tmppathW, '\\'))) *p = 0; - len = strlenW( tmppathW ) + 16; + if ((p = wcsrchr(tmppathW, '\\'))) *p = 0; + len = lstrlenW( tmppathW ) + 16; if (!(tmpfileW = msi_alloc(len * sizeof(WCHAR)))) { msi_free( tmppathW ); @@ -671,7 +670,7 @@ static UINT get_drive_type(const WCHAR *path) { WCHAR root[MAX_PATH + 1]; - strcpyW(root, path); + lstrcpyW(root, path); PathStripToRootW(root); PathAddBackslashW(root); @@ -681,7 +680,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, szOriginalDatabase ); - if (UrlIsW( orig_db, URLIS_URL ) && (ret = strdupW( orig_db )) && (p = strrchrW( ret, '/'))) p[1] = 0; + if (UrlIsW( orig_db, URLIS_URL ) && (ret = strdupW( orig_db )) && (p = wcsrchr( ret, '/'))) p[1] = 0; msi_free( orig_db ); return ret; } @@ -793,7 +792,7 @@ static UINT find_published_source(MSIPACKAGE *package, MSIMEDIAINFO *mi) MSISOURCETYPE_NETWORK, index++, volume, &volumesz) == ERROR_SUCCESS) { - if (check_all || !strncmpiW(source, volume, strlenW(source))) + if (check_all || !wcsnicmp(source, volume, lstrlenW(source))) { lstrcpyW(cabinet_file, volume); PathAddBackslashW(cabinet_file); @@ -832,11 +831,11 @@ static UINT find_published_source(MSIPACKAGE *package, MSIMEDIAINFO *mi) mi->disk_id = id; msi_free( mi->volume_label ); if (!(mi->volume_label = msi_alloc( ++volumesz * sizeof(WCHAR) ))) return ERROR_OUTOFMEMORY; - strcpyW( mi->volume_label, volume ); + lstrcpyW( mi->volume_label, volume ); msi_free( mi->disk_prompt ); if (!(mi->disk_prompt = msi_alloc( ++promptsz * sizeof(WCHAR) ))) return ERROR_OUTOFMEMORY; - strcpyW( mi->disk_prompt, prompt ); + lstrcpyW( mi->disk_prompt, prompt ); if (source_matches_volume(mi, source)) { @@ -875,20 +874,20 @@ UINT ready_media( MSIPACKAGE *package, BOOL compressed, MSIMEDIAINFO *mi ) WCHAR temppath[MAX_PATH], *p, *url; msi_free( cabinet_file ); - if (!(url = msi_alloc( (strlenW( base_url ) + strlenW( mi->cabinet ) + 1) * sizeof(WCHAR) ))) + if (!(url = msi_alloc( (lstrlenW( base_url ) + lstrlenW( mi->cabinet ) + 1) * sizeof(WCHAR) ))) { return ERROR_OUTOFMEMORY; } - strcpyW( url, base_url ); - strcatW( url, mi->cabinet ); + lstrcpyW( url, base_url ); + lstrcatW( url, mi->cabinet ); if ((rc = msi_download_file( url, temppath )) != ERROR_SUCCESS) { ERR("failed to download %s (%u)\n", debugstr_w(url), rc); msi_free( url ); return rc; } - if ((p = strrchrW( temppath, '\\' ))) *p = 0; - strcpyW( mi->sourcedir, temppath ); + if ((p = wcsrchr( temppath, '\\' ))) *p = 0; + lstrcpyW( mi->sourcedir, temppath ); PathAddBackslashW( mi->sourcedir ); msi_free( mi->cabinet ); mi->cabinet = strdupW( p + 1 ); @@ -901,7 +900,7 @@ UINT ready_media( MSIPACKAGE *package, BOOL compressed, MSIMEDIAINFO *mi ) if (mi->volume_label) { /* assume first volume is in the drive */ - if (mi->last_volume && strcmpiW( mi->last_volume, mi->volume_label )) + if (mi->last_volume && wcsicmp( mi->last_volume, mi->volume_label )) { WCHAR *source = msi_dup_property( package->db, szSourceDir ); BOOL match = source_matches_volume( mi, source ); @@ -951,12 +950,12 @@ UINT msi_add_cabinet_stream( MSIPACKAGE *package, UINT disk_id, IStorage *storag } } if (!(cab = msi_alloc( sizeof(*cab) ))) return ERROR_OUTOFMEMORY; - if (!(cab->stream = msi_alloc( (strlenW( name ) + 1) * sizeof(WCHAR ) ))) + if (!(cab->stream = msi_alloc( (lstrlenW( name ) + 1) * sizeof(WCHAR ) ))) { msi_free( cab ); return ERROR_OUTOFMEMORY; } - strcpyW( cab->stream, name ); + lstrcpyW( cab->stream, name ); cab->disk_id = disk_id; cab->storage = storage; IStorage_AddRef( storage ); diff --git a/dll/win32/msi/msi.c b/dll/win32/msi/msi.c index 7b6455b4a26..24bcf9c4edf 100644 --- a/dll/win32/msi/msi.c +++ b/dll/win32/msi/msi.c @@ -48,7 +48,6 @@ #include "wine/debug.h" #include "wine/exception.h" -#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(msi); @@ -387,14 +386,14 @@ static UINT MSI_ApplyPatchW(LPCWSTR szPatchPackage, LPCWSTR szProductCode, LPCWS if (!szCommandLine) cmd_ptr = empty; - size = strlenW(cmd_ptr) + strlenW(fmt) + strlenW(szPatchPackage) + 1; + size = lstrlenW(cmd_ptr) + lstrlenW(fmt) + lstrlenW(szPatchPackage) + 1; cmd = msi_alloc(size * sizeof(WCHAR)); if (!cmd) { msi_free(codes); return ERROR_OUTOFMEMORY; } - sprintfW(cmd, fmt, cmd_ptr, szPatchPackage); + swprintf(cmd, size, fmt, cmd_ptr, szPatchPackage); if (szProductCode) r = MsiConfigureProductExW(szProductCode, INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT, cmd); @@ -632,7 +631,7 @@ static UINT MSI_ApplicablePatchXML( MSIPACKAGE *package, IXMLDOMDocument *desc ) IXMLDOMNode_Release( node ); if (hr == S_OK) { - if (!strcmpW( s, product_code )) r = ERROR_SUCCESS; + if (!wcscmp( s, product_code )) r = ERROR_SUCCESS; SysFreeString( s ); } } @@ -809,7 +808,7 @@ static UINT open_package( const WCHAR *product, const WCHAR *usersid, if ((localpath = msi_reg_get_val_str( props, szLocalPackage ))) { - strcpyW( sourcepath, localpath ); + lstrcpyW( sourcepath, localpath ); msi_free( localpath ); } RegCloseKey( props ); @@ -821,7 +820,7 @@ static UINT open_package( const WCHAR *product, const WCHAR *usersid, sz = sizeof(filename); MsiSourceListGetInfoW( product, usersid, context, MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEW, filename, &sz ); - strcatW( sourcepath, filename ); + lstrcatW( sourcepath, filename ); } if (GetFileAttributesW( sourcepath ) == INVALID_FILE_ATTRIBUTES) return ERROR_INSTALL_SOURCE_ABSENT; @@ -929,7 +928,7 @@ UINT WINAPI MsiConfigureProductExW(LPCWSTR szProduct, int iInstallLevel, MsiSourceListGetInfoW(szProduct, NULL, context, MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEW, filename, &sz); - strcatW(sourcepath, filename); + lstrcatW(sourcepath, filename); r = MSI_InstallPackage( package, sourcepath, commandline ); @@ -1106,7 +1105,7 @@ static WCHAR *reg_get_value( HKEY hkey, const WCHAR *name, DWORD *type ) DWORD val; if (!msi_reg_get_val_dword( hkey, name, &val )) return NULL; - sprintfW( temp, fmt, val ); + swprintf( temp, ARRAY_SIZE(temp), fmt, val ); return strdupW( temp ); } @@ -1152,22 +1151,22 @@ static UINT MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute, context = MSIINSTALLCONTEXT_MACHINE; } - if (!strcmpW( szAttribute, INSTALLPROPERTY_HELPLINKW ) || - !strcmpW( szAttribute, INSTALLPROPERTY_HELPTELEPHONEW ) || - !strcmpW( szAttribute, INSTALLPROPERTY_INSTALLDATEW ) || - !strcmpW( szAttribute, INSTALLPROPERTY_INSTALLEDPRODUCTNAMEW ) || - !strcmpW( szAttribute, INSTALLPROPERTY_INSTALLLOCATIONW ) || - !strcmpW( szAttribute, INSTALLPROPERTY_INSTALLSOURCEW ) || - !strcmpW( szAttribute, INSTALLPROPERTY_LOCALPACKAGEW ) || - !strcmpW( szAttribute, INSTALLPROPERTY_PUBLISHERW ) || - !strcmpW( szAttribute, INSTALLPROPERTY_URLINFOABOUTW ) || - !strcmpW( szAttribute, INSTALLPROPERTY_URLUPDATEINFOW ) || - !strcmpW( szAttribute, INSTALLPROPERTY_VERSIONMINORW ) || - !strcmpW( szAttribute, INSTALLPROPERTY_VERSIONMAJORW ) || - !strcmpW( szAttribute, INSTALLPROPERTY_VERSIONSTRINGW ) || - !strcmpW( szAttribute, INSTALLPROPERTY_PRODUCTIDW ) || - !strcmpW( szAttribute, INSTALLPROPERTY_REGCOMPANYW ) || - !strcmpW( szAttribute, INSTALLPROPERTY_REGOWNERW )) + if (!wcscmp( szAttribute, INSTALLPROPERTY_HELPLINKW ) || + !wcscmp( szAttribute, INSTALLPROPERTY_HELPTELEPHONEW ) || + !wcscmp( szAttribute, INSTALLPROPERTY_INSTALLDATEW ) || + !wcscmp( szAttribute, INSTALLPROPERTY_INSTALLEDPRODUCTNAMEW ) || + !wcscmp( szAttribute, INSTALLPROPERTY_INSTALLLOCATIONW ) || + !wcscmp( szAttribute, INSTALLPROPERTY_INSTALLSOURCEW ) || + !wcscmp( szAttribute, INSTALLPROPERTY_LOCALPACKAGEW ) || + !wcscmp( szAttribute, INSTALLPROPERTY_PUBLISHERW ) || + !wcscmp( szAttribute, INSTALLPROPERTY_URLINFOABOUTW ) || + !wcscmp( szAttribute, INSTALLPROPERTY_URLUPDATEINFOW ) || + !wcscmp( szAttribute, INSTALLPROPERTY_VERSIONMINORW ) || + !wcscmp( szAttribute, INSTALLPROPERTY_VERSIONMAJORW ) || + !wcscmp( szAttribute, INSTALLPROPERTY_VERSIONSTRINGW ) || + !wcscmp( szAttribute, INSTALLPROPERTY_PRODUCTIDW ) || + !wcscmp( szAttribute, INSTALLPROPERTY_REGCOMPANYW ) || + !wcscmp( szAttribute, INSTALLPROPERTY_REGOWNERW )) { if (!prodkey) { @@ -1180,9 +1179,9 @@ static UINT MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute, goto done; } - if (!strcmpW( szAttribute, INSTALLPROPERTY_INSTALLEDPRODUCTNAMEW )) + if (!wcscmp( szAttribute, INSTALLPROPERTY_INSTALLEDPRODUCTNAMEW )) szAttribute = display_name; - else if (!strcmpW( szAttribute, INSTALLPROPERTY_VERSIONSTRINGW )) + else if (!wcscmp( szAttribute, INSTALLPROPERTY_VERSIONSTRINGW )) szAttribute = display_version; val = reg_get_value(userdata, szAttribute, &type); @@ -1190,16 +1189,16 @@ static UINT MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute, val = empty; RegCloseKey(userdata); } - else if (!strcmpW( szAttribute, INSTALLPROPERTY_INSTANCETYPEW ) || - !strcmpW( szAttribute, INSTALLPROPERTY_TRANSFORMSW ) || - !strcmpW( szAttribute, INSTALLPROPERTY_LANGUAGEW ) || - !strcmpW( szAttribute, INSTALLPROPERTY_PRODUCTNAMEW ) || - !strcmpW( szAttribute, INSTALLPROPERTY_ASSIGNMENTTYPEW ) || - !strcmpW( szAttribute, INSTALLPROPERTY_PACKAGECODEW ) || - !strcmpW( szAttribute, INSTALLPROPERTY_VERSIONW ) || - !strcmpW( szAttribute, INSTALLPROPERTY_PRODUCTICONW ) || - !strcmpW( szAttribute, INSTALLPROPERTY_PACKAGENAMEW ) || - !strcmpW( szAttribute, INSTALLPROPERTY_AUTHORIZED_LUA_APPW )) + else if (!wcscmp( szAttribute, INSTALLPROPERTY_INSTANCETYPEW ) || + !wcscmp( szAttribute, INSTALLPROPERTY_TRANSFORMSW ) || + !wcscmp( szAttribute, INSTALLPROPERTY_LANGUAGEW ) || + !wcscmp( szAttribute, INSTALLPROPERTY_PRODUCTNAMEW ) || + !wcscmp( szAttribute, INSTALLPROPERTY_ASSIGNMENTTYPEW ) || + !wcscmp( szAttribute, INSTALLPROPERTY_PACKAGECODEW ) || + !wcscmp( szAttribute, INSTALLPROPERTY_VERSIONW ) || + !wcscmp( szAttribute, INSTALLPROPERTY_PRODUCTICONW ) || + !wcscmp( szAttribute, INSTALLPROPERTY_PACKAGENAMEW ) || + !wcscmp( szAttribute, INSTALLPROPERTY_AUTHORIZED_LUA_APPW )) { if (!prodkey) { @@ -1207,10 +1206,10 @@ static UINT MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute, goto done; } - if (!strcmpW( szAttribute, INSTALLPROPERTY_ASSIGNMENTTYPEW )) + if (!wcscmp( szAttribute, INSTALLPROPERTY_ASSIGNMENTTYPEW )) szAttribute = assignment; - if (!strcmpW( szAttribute, INSTALLPROPERTY_PACKAGENAMEW )) + if (!wcscmp( szAttribute, INSTALLPROPERTY_PACKAGENAMEW )) { res = RegOpenKeyW(prodkey, sourcelist, &source); if (res != ERROR_SUCCESS) @@ -1233,7 +1232,7 @@ static UINT MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute, } if (val != empty && type != REG_DWORD && - !strcmpW( szAttribute, INSTALLPROPERTY_PACKAGECODEW )) + !wcscmp( szAttribute, INSTALLPROPERTY_PACKAGECODEW )) { if (lstrlenW( val ) != SQUASHED_GUID_SIZE - 1) badconfig = TRUE; @@ -1254,7 +1253,7 @@ static UINT MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute, if (pcchValueBuf) { - int len = strlenW( val ); + int len = lstrlenW( val ); /* If szBuffer (szValue->str) is NULL, there's no need to copy the value * out. Also, *pcchValueBuf may be uninitialized in this case, so we @@ -1405,7 +1404,7 @@ static UINT msi_copy_outval(LPWSTR val, LPWSTR out, LPDWORD size) if (out) { - if (strlenW(val) >= *size) + if (lstrlenW(val) >= *size) { r = ERROR_MORE_DATA; if (*size > 0) @@ -1491,23 +1490,23 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid, goto done; } - if (!strcmpW( szProperty, INSTALLPROPERTY_HELPLINKW ) || - !strcmpW( szProperty, INSTALLPROPERTY_HELPTELEPHONEW ) || - !strcmpW( szProperty, INSTALLPROPERTY_INSTALLDATEW ) || - !strcmpW( szProperty, INSTALLPROPERTY_INSTALLEDPRODUCTNAMEW ) || - !strcmpW( szProperty, INSTALLPROPERTY_INSTALLLOCATIONW ) || - !strcmpW( szProperty, INSTALLPROPERTY_INSTALLSOURCEW ) || - !strcmpW( szProperty, INSTALLPROPERTY_LOCALPACKAGEW ) || - !strcmpW( szProperty, INSTALLPROPERTY_PUBLISHERW ) || - !strcmpW( szProperty, INSTALLPROPERTY_URLINFOABOUTW ) || - !strcmpW( szProperty, INSTALLPROPERTY_URLUPDATEINFOW ) || - !strcmpW( szProperty, INSTALLPROPERTY_VERSIONMINORW ) || - !strcmpW( szProperty, INSTALLPROPERTY_VERSIONMAJORW ) || - !strcmpW( szProperty, INSTALLPROPERTY_VERSIONSTRINGW ) || - !strcmpW( szProperty, INSTALLPROPERTY_PRODUCTIDW ) || - !strcmpW( szProperty, INSTALLPROPERTY_REGCOMPANYW ) || - !strcmpW( szProperty, INSTALLPROPERTY_REGOWNERW ) || - !strcmpW( szProperty, INSTALLPROPERTY_INSTANCETYPEW )) + if (!wcscmp( szProperty, INSTALLPROPERTY_HELPLINKW ) || + !wcscmp( szProperty, INSTALLPROPERTY_HELPTELEPHONEW ) || + !wcscmp( szProperty, INSTALLPROPERTY_INSTALLDATEW ) || + !wcscmp( szProperty, INSTALLPROPERTY_INSTALLEDPRODUCTNAMEW ) || + !wcscmp( szProperty, INSTALLPROPERTY_INSTALLLOCATIONW ) || + !wcscmp( szProperty, INSTALLPROPERTY_INSTALLSOURCEW ) || + !wcscmp( szProperty, INSTALLPROPERTY_LOCALPACKAGEW ) || + !wcscmp( szProperty, INSTALLPROPERTY_PUBLISHERW ) || + !wcscmp( szProperty, INSTALLPROPERTY_URLINFOABOUTW ) || + !wcscmp( szProperty, INSTALLPROPERTY_URLUPDATEINFOW ) || + !wcscmp( szProperty, INSTALLPROPERTY_VERSIONMINORW ) || + !wcscmp( szProperty, INSTALLPROPERTY_VERSIONMAJORW ) || + !wcscmp( szProperty, INSTALLPROPERTY_VERSIONSTRINGW ) || + !wcscmp( szProperty, INSTALLPROPERTY_PRODUCTIDW ) || + !wcscmp( szProperty, INSTALLPROPERTY_REGCOMPANYW ) || + !wcscmp( szProperty, INSTALLPROPERTY_REGOWNERW ) || + !wcscmp( szProperty, INSTALLPROPERTY_INSTANCETYPEW )) { val = reg_get_value(props, package, &type); if (!val) @@ -1520,9 +1519,9 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid, msi_free(val); - if (!strcmpW( szProperty, INSTALLPROPERTY_INSTALLEDPRODUCTNAMEW )) + if (!wcscmp( szProperty, INSTALLPROPERTY_INSTALLEDPRODUCTNAMEW )) szProperty = displayname; - else if (!strcmpW( szProperty, INSTALLPROPERTY_VERSIONSTRINGW )) + else if (!wcscmp( szProperty, INSTALLPROPERTY_VERSIONSTRINGW )) szProperty = displayversion; val = reg_get_value(props, szProperty, &type); @@ -1531,14 +1530,14 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid, r = msi_copy_outval(val, szValue, pcchValue); } - else if (!strcmpW( szProperty, INSTALLPROPERTY_TRANSFORMSW ) || - !strcmpW( szProperty, INSTALLPROPERTY_LANGUAGEW ) || - !strcmpW( szProperty, INSTALLPROPERTY_PRODUCTNAMEW ) || - !strcmpW( szProperty, INSTALLPROPERTY_PACKAGECODEW ) || - !strcmpW( szProperty, INSTALLPROPERTY_VERSIONW ) || - !strcmpW( szProperty, INSTALLPROPERTY_PRODUCTICONW ) || - !strcmpW( szProperty, INSTALLPROPERTY_PACKAGENAMEW ) || - !strcmpW( szProperty, INSTALLPROPERTY_AUTHORIZED_LUA_APPW )) + else if (!wcscmp( szProperty, INSTALLPROPERTY_TRANSFORMSW ) || + !wcscmp( szProperty, INSTALLPROPERTY_LANGUAGEW ) || + !wcscmp( szProperty, INSTALLPROPERTY_PRODUCTNAMEW ) || + !wcscmp( szProperty, INSTALLPROPERTY_PACKAGECODEW ) || + !wcscmp( szProperty, INSTALLPROPERTY_VERSIONW ) || + !wcscmp( szProperty, INSTALLPROPERTY_PRODUCTICONW ) || + !wcscmp( szProperty, INSTALLPROPERTY_PACKAGENAMEW ) || + !wcscmp( szProperty, INSTALLPROPERTY_AUTHORIZED_LUA_APPW )) { if (!prod && !classes) goto done; @@ -1556,7 +1555,7 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid, r = msi_copy_outval(val, szValue, pcchValue); } - else if (!strcmpW( szProperty, INSTALLPROPERTY_PRODUCTSTATEW )) + else if (!wcscmp( szProperty, INSTALLPROPERTY_PRODUCTSTATEW )) { if (dwContext == MSIINSTALLCONTEXT_MACHINE) { @@ -1590,7 +1589,7 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid, r = msi_copy_outval(val, szValue, pcchValue); } - else if (!strcmpW( szProperty, INSTALLPROPERTY_ASSIGNMENTTYPEW )) + else if (!wcscmp( szProperty, INSTALLPROPERTY_ASSIGNMENTTYPEW )) { if (!prod && !classes) goto done; @@ -1734,7 +1733,7 @@ UINT WINAPI MsiGetPatchInfoExW(LPCWSTR szPatchCode, LPCWSTR szProductCode, if (dwContext == MSIINSTALLCONTEXT_MACHINE && szUserSid) return ERROR_INVALID_PARAMETER; - if (szUserSid && !strcmpW( szUserSid, szLocalSid )) + if (szUserSid && !wcscmp( szUserSid, szLocalSid )) return ERROR_INVALID_PARAMETER; if (MSIREG_OpenUserDataProductKey(szProductCode, dwContext, NULL, @@ -1755,7 +1754,7 @@ UINT WINAPI MsiGetPatchInfoExW(LPCWSTR szPatchCode, LPCWSTR szProductCode, if (res != ERROR_SUCCESS) goto done; - if (!strcmpW( szProperty, INSTALLPROPERTY_TRANSFORMSW )) + if (!wcscmp( szProperty, INSTALLPROPERTY_TRANSFORMSW )) { if (MSIREG_OpenProductKey(szProductCode, NULL, dwContext, &prod, FALSE) != ERROR_SUCCESS) @@ -1774,21 +1773,21 @@ UINT WINAPI MsiGetPatchInfoExW(LPCWSTR szPatchCode, LPCWSTR szProductCode, &udpatch, FALSE) != ERROR_SUCCESS) goto done; - if (!strcmpW( szProperty, INSTALLPROPERTY_LOCALPACKAGEW )) + if (!wcscmp( szProperty, INSTALLPROPERTY_LOCALPACKAGEW )) { if (dwContext == MSIINSTALLCONTEXT_USERMANAGED) szProperty = szManagedPackage; datakey = udpatch; } - else if (!strcmpW( szProperty, INSTALLPROPERTY_INSTALLDATEW )) + else if (!wcscmp( szProperty, INSTALLPROPERTY_INSTALLDATEW )) { datakey = patch; szProperty = szInstalled; } - else if (!strcmpW( szProperty, INSTALLPROPERTY_UNINSTALLABLEW ) || - !strcmpW( szProperty, INSTALLPROPERTY_PATCHSTATEW ) || - !strcmpW( szProperty, INSTALLPROPERTY_DISPLAYNAMEW ) || - !strcmpW( szProperty, INSTALLPROPERTY_MOREINFOURLW )) + else if (!wcscmp( szProperty, INSTALLPROPERTY_UNINSTALLABLEW ) || + !wcscmp( szProperty, INSTALLPROPERTY_PATCHSTATEW ) || + !wcscmp( szProperty, INSTALLPROPERTY_DISPLAYNAMEW ) || + !wcscmp( szProperty, INSTALLPROPERTY_MOREINFOURLW )) { datakey = patch; } @@ -1894,7 +1893,7 @@ UINT WINAPI MsiGetPatchInfoW( LPCWSTR patch, LPCWSTR attr, LPWSTR buffer, LPDWOR if (!patch || !attr) return ERROR_INVALID_PARAMETER; - if (strcmpW( INSTALLPROPERTY_LOCALPACKAGEW, attr )) + if (wcscmp( INSTALLPROPERTY_LOCALPACKAGEW, attr )) return ERROR_UNKNOWN_PROPERTY; index = 0; @@ -2832,7 +2831,7 @@ static BOOL open_userdata_comp_key( const WCHAR *comp, const WCHAR *usersid, MSI } if (ctx & (MSIINSTALLCONTEXT_USERMANAGED|MSIINSTALLCONTEXT_USERUNMANAGED)) { - if (usersid && !strcmpiW( usersid, szAllSid )) + if (usersid && !wcsicmp( usersid, szAllSid )) { FIXME( "only looking at the current user\n" ); usersid = NULL; @@ -3039,7 +3038,7 @@ static UINT query_feature_state( const WCHAR *product, const WCHAR *squashed, co } path = msi_reg_get_val_str( hkey, squashed ); if (!path) missing = TRUE; - else if (strlenW( path ) > 2 && + else if (lstrlenW( path ) > 2 && path[0] >= '0' && path[0] <= '9' && path[1] >= '0' && path[1] <= '9') { @@ -3245,11 +3244,11 @@ static UINT get_file_version( const WCHAR *path, WCHAR *verbuf, DWORD *verlen, { if (VerQueryValueW( version, szVersionResource, (LPVOID *)&ffi, &len ) && len > 0) { - sprintfW( tmp, szVersionFormat, + swprintf( tmp, ARRAY_SIZE(tmp), szVersionFormat, HIWORD(ffi->dwFileVersionMS), LOWORD(ffi->dwFileVersionMS), HIWORD(ffi->dwFileVersionLS), LOWORD(ffi->dwFileVersionLS) ); if (verbuf) lstrcpynW( verbuf, tmp, *verlen ); - len = strlenW( tmp ); + len = lstrlenW( tmp ); if (*verlen > len) ret = ERROR_SUCCESS; *verlen = len; } @@ -3263,9 +3262,9 @@ static UINT get_file_version( const WCHAR *path, WCHAR *verbuf, DWORD *verlen, { if (VerQueryValueW( version, szLangResource, (LPVOID *)&lang, &len ) && len > 0) { - sprintfW( tmp, szLangFormat, *lang ); + swprintf( tmp, ARRAY_SIZE(tmp), szLangFormat, *lang ); if (langbuf) lstrcpynW( langbuf, tmp, *langlen ); - len = strlenW( tmp ); + len = lstrlenW( tmp ); if (*langlen > len) ret = ERROR_SUCCESS; *langlen = len; } @@ -3300,11 +3299,11 @@ UINT WINAPI MsiGetFileVersionW( LPCWSTR path, LPWSTR verbuf, LPDWORD verlen, int len; WCHAR *version = msi_get_font_file_version( NULL, path ); if (!version) return ERROR_FILE_INVALID; - len = strlenW( version ); + len = lstrlenW( version ); if (len >= *verlen) ret = ERROR_MORE_DATA; else if (verbuf) { - strcpyW( verbuf, version ); + lstrcpyW( verbuf, version ); ret = ERROR_SUCCESS; } *verlen = len; @@ -3486,7 +3485,7 @@ static UINT MSI_ProvideQualifiedComponentEx(LPCWSTR szComponent, RegCloseKey( hkey ); if (!components) return ERROR_FILE_NOT_FOUND; - if (strlenW( components ) < BASE85_SIZE || !decode_base85_guid( components, &guid )) + if (lstrlenW( components ) < BASE85_SIZE || !decode_base85_guid( components, &guid )) { msi_free( components ); return ERROR_FILE_NOT_FOUND; @@ -4049,7 +4048,7 @@ UINT WINAPI MsiReinstallFeatureW( LPCWSTR szProduct, LPCWSTR szFeature, DWORD dw sz = sizeof(filename); MsiSourceListGetInfoW( szProduct, NULL, context, MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEW, filename, &sz ); - strcatW( sourcepath, filename ); + lstrcatW( sourcepath, filename ); if (dwReinstallMode & REINSTALLMODE_PACKAGE) r = MSI_OpenPackageW( sourcepath, 0, &package ); @@ -4059,14 +4058,14 @@ UINT WINAPI MsiReinstallFeatureW( LPCWSTR szProduct, LPCWSTR szFeature, DWORD dw if (r != ERROR_SUCCESS) return r; - sz = (strlenW( fmtW ) + strlenW( szReinstallMode ) + strlenW( reinstallmode )) * sizeof(WCHAR); - sz += (strlenW( szReinstall ) + strlenW( szFeature )) * sizeof(WCHAR); + sz = (lstrlenW( fmtW ) + lstrlenW( szReinstallMode ) + lstrlenW( reinstallmode )) * sizeof(WCHAR); + sz += (lstrlenW( szReinstall ) + lstrlenW( szFeature )) * sizeof(WCHAR); if (!(cmdline = msi_alloc( sz ))) { msiobj_release( &package->hdr ); return ERROR_OUTOFMEMORY; } - sprintfW( cmdline, fmtW, szReinstallMode, reinstallmode, szReinstall, szFeature ); + swprintf( cmdline, sz / sizeof(WCHAR), fmtW, szReinstallMode, reinstallmode, szReinstall, szFeature ); r = MSI_InstallPackage( package, sourcepath, cmdline ); msiobj_release( &package->hdr ); diff --git a/dll/win32/msi/msipriv.h b/dll/win32/msi/msipriv.h index 3d5df922f23..7519cccaeb5 100644 --- a/dll/win32/msi/msipriv.h +++ b/dll/win32/msi/msipriv.h @@ -852,10 +852,10 @@ extern BOOL decode_streamname(LPCWSTR in, LPWSTR out) DECLSPEC_HIDDEN; extern UINT msi_get_stream( MSIDATABASE *, const WCHAR *, IStream ** ) DECLSPEC_HIDDEN; extern UINT MSI_OpenDatabaseW( LPCWSTR, LPCWSTR, MSIDATABASE ** ) DECLSPEC_HIDDEN; extern UINT MSI_DatabaseOpenViewW(MSIDATABASE *, LPCWSTR, MSIQUERY ** ) DECLSPEC_HIDDEN; -extern UINT MSI_OpenQuery( MSIDATABASE *, MSIQUERY **, LPCWSTR, ... ) DECLSPEC_HIDDEN; +extern UINT WINAPIV MSI_OpenQuery( MSIDATABASE *, MSIQUERY **, LPCWSTR, ... ) DECLSPEC_HIDDEN; typedef UINT (*record_func)( MSIRECORD *, LPVOID ); extern UINT MSI_IterateRecords( MSIQUERY *, LPDWORD, record_func, LPVOID ) DECLSPEC_HIDDEN; -extern MSIRECORD *MSI_QueryGetRecord( MSIDATABASE *db, LPCWSTR query, ... ) DECLSPEC_HIDDEN; +extern MSIRECORD * WINAPIV MSI_QueryGetRecord( MSIDATABASE *db, LPCWSTR query, ... ) DECLSPEC_HIDDEN; extern UINT MSI_DatabaseGetPrimaryKeys( MSIDATABASE *, LPCWSTR, MSIRECORD ** ) DECLSPEC_HIDDEN; /* view internals */ diff --git a/dll/win32/msi/msiquery.c b/dll/win32/msi/msiquery.c index f04e98257c4..146fde40ff7 100644 --- a/dll/win32/msi/msiquery.c +++ b/dll/win32/msi/msiquery.c @@ -27,7 +27,6 @@ #include "winerror.h" #include "wine/debug.h" #include "wine/exception.h" -#include "wine/unicode.h" #include "msi.h" #include "msiquery.h" #include "objbase.h" @@ -74,9 +73,9 @@ UINT VIEW_find_column( MSIVIEW *table, LPCWSTR name, LPCWSTR table_name, UINT *n NULL, &haystack_table_name ); if( r != ERROR_SUCCESS ) return r; - x = strcmpW( name, col_name ); + x = wcscmp( name, col_name ); if( table_name ) - x |= strcmpW( table_name, haystack_table_name ); + x |= wcscmp( table_name, haystack_table_name ); if( !x ) { *n = i; @@ -138,7 +137,7 @@ UINT MSI_DatabaseOpenViewW(MSIDATABASE *db, return r; } -UINT MSI_OpenQuery( MSIDATABASE *db, MSIQUERY **view, LPCWSTR fmt, ... ) +UINT WINAPIV MSI_OpenQuery( MSIDATABASE *db, MSIQUERY **view, LPCWSTR fmt, ... ) { UINT r; int size = 100, res; @@ -147,11 +146,11 @@ UINT MSI_OpenQuery( MSIDATABASE *db, MSIQUERY **view, LPCWSTR fmt, ... ) /* construct the string */ for (;;) { - va_list va; + __ms_va_list va; query = msi_alloc( size*sizeof(WCHAR) ); - va_start(va, fmt); - res = vsnprintfW(query, size, fmt, va); - va_end(va); + __ms_va_start(va, fmt); + res = vswprintf(query, size, fmt, va); + __ms_va_end(va); if (res == -1) size *= 2; else if (res >= size) size = res + 1; else break; @@ -201,7 +200,7 @@ UINT MSI_IterateRecords( MSIQUERY *view, LPDWORD count, } /* return a single record from a query */ -MSIRECORD *MSI_QueryGetRecord( MSIDATABASE *db, LPCWSTR fmt, ... ) +MSIRECORD * WINAPIV MSI_QueryGetRecord( MSIDATABASE *db, LPCWSTR fmt, ... ) { MSIRECORD *rec = NULL; MSIQUERY *view = NULL; @@ -212,11 +211,11 @@ MSIRECORD *MSI_QueryGetRecord( MSIDATABASE *db, LPCWSTR fmt, ... ) /* construct the string */ for (;;) { - va_list va; + __ms_va_list va; query = msi_alloc( size*sizeof(WCHAR) ); - va_start(va, fmt); - res = vsnprintfW(query, size, fmt, va); - va_end(va); + __ms_va_start(va, fmt); + res = vswprintf(query, size, fmt, va); + __ms_va_end(va); if (res == -1) size *= 2; else if (res >= size) size = res + 1; else break; @@ -592,7 +591,7 @@ static UINT msi_set_record_type_string( MSIRECORD *rec, UINT field, if (type & MSITYPE_NULLABLE) szType[0] &= ~0x20; - sprintfW( &szType[1], fmt, (type&0xff) ); + swprintf( &szType[1], ARRAY_SIZE(szType) - 1, fmt, (type&0xff) ); TRACE("type %04x -> %s\n", type, debugstr_w(szType) ); diff --git a/dll/win32/msi/package.c b/dll/win32/msi/package.c index 7438ad82a1e..f54352f4f23 100644 --- a/dll/win32/msi/package.c +++ b/dll/win32/msi/package.c @@ -45,7 +45,6 @@ #include "wine/heap.h" #include "wine/debug.h" #include "wine/exception.h" -#include "wine/unicode.h" #include "msipriv.h" #include "winemsi_s.h" @@ -563,12 +562,12 @@ static LPWSTR get_fusion_filename(MSIPACKAGE *package) size = ARRAY_SIZE(path); if (!RegQueryValueExW(hkey, installpath, NULL, &type, (BYTE *)path, &size)) { - len = strlenW(path) + strlenW(fusion) + 2; + len = lstrlenW(path) + lstrlenW(fusion) + 2; if (!(filename = msi_alloc(len * sizeof(WCHAR)))) return NULL; - strcpyW(filename, path); - strcatW(filename, szBackSlash); - strcatW(filename, fusion); + lstrcpyW(filename, path); + lstrcatW(filename, szBackSlash); + lstrcatW(filename, fusion); if (GetFileAttributesW(filename) != INVALID_FILE_ATTRIBUTES) { TRACE( "found %s\n", debugstr_w(filename) ); @@ -584,15 +583,15 @@ static LPWSTR get_fusion_filename(MSIPACKAGE *package) { RegCloseKey(hkey); GetWindowsDirectoryW(windir, MAX_PATH); - len = strlenW(windir) + strlenW(subdir) + strlenW(v2050727) + strlenW(fusion) + 3; + len = lstrlenW(windir) + lstrlenW(subdir) + lstrlenW(v2050727) + lstrlenW(fusion) + 3; if (!(filename = msi_alloc(len * sizeof(WCHAR)))) return NULL; - strcpyW(filename, windir); - strcatW(filename, szBackSlash); - strcatW(filename, subdir); - strcatW(filename, v2050727); - strcatW(filename, szBackSlash); - strcatW(filename, fusion); + lstrcpyW(filename, windir); + lstrcatW(filename, szBackSlash); + lstrcatW(filename, subdir); + lstrcatW(filename, v2050727); + lstrcatW(filename, szBackSlash); + lstrcatW(filename, fusion); if (GetFileAttributesW(filename) != INVALID_FILE_ATTRIBUTES) { TRACE( "found %s\n", debugstr_w(filename) ); @@ -651,7 +650,7 @@ static void set_msi_assembly_prop(MSIPACKAGE *package) if (!VerQueryValueW(version, translation, (LPVOID *)&translate, &val_len)) goto done; - sprintfW(buf, verfmt, translate[0].wLanguage, translate[0].wCodePage); + swprintf(buf, ARRAY_SIZE(buf), verfmt, translate[0].wLanguage, translate[0].wCodePage); if (!VerQueryValueW(version, buf, (LPVOID *)&verstr, &val_len)) goto done; @@ -765,91 +764,91 @@ static VOID set_installer_properties(MSIPACKAGE *package) */ SHGetFolderPathW(NULL, CSIDL_COMMON_APPDATA, NULL, 0, pth); - strcatW(pth, szBackSlash); + lstrcatW(pth, szBackSlash); msi_set_property( package->db, szCommonAppDataFolder, pth, -1 ); SHGetFolderPathW(NULL, CSIDL_FAVORITES, NULL, 0, pth); - strcatW(pth, szBackSlash); + lstrcatW(pth, szBackSlash); msi_set_property( package->db, szFavoritesFolder, pth, -1 ); SHGetFolderPathW(NULL, CSIDL_FONTS, NULL, 0, pth); - strcatW(pth, szBackSlash); + lstrcatW(pth, szBackSlash); msi_set_property( package->db, szFontsFolder, pth, -1 ); SHGetFolderPathW(NULL, CSIDL_SENDTO, NULL, 0, pth); - strcatW(pth, szBackSlash); + lstrcatW(pth, szBackSlash); msi_set_property( package->db, szSendToFolder, pth, -1 ); SHGetFolderPathW(NULL, CSIDL_STARTMENU, NULL, 0, pth); - strcatW(pth, szBackSlash); + lstrcatW(pth, szBackSlash); msi_set_property( package->db, szStartMenuFolder, pth, -1 ); SHGetFolderPathW(NULL, CSIDL_STARTUP, NULL, 0, pth); - strcatW(pth, szBackSlash); + lstrcatW(pth, szBackSlash); msi_set_property( package->db, szStartupFolder, pth, -1 ); SHGetFolderPathW(NULL, CSIDL_TEMPLATES, NULL, 0, pth); - strcatW(pth, szBackSlash); + lstrcatW(pth, szBackSlash); msi_set_property( package->db, szTemplateFolder, pth, -1 ); SHGetFolderPathW(NULL, CSIDL_DESKTOP, NULL, 0, pth); - strcatW(pth, szBackSlash); + lstrcatW(pth, szBackSlash); msi_set_property( package->db, szDesktopFolder, pth, -1 ); /* FIXME: set to AllUsers profile path if ALLUSERS is set */ SHGetFolderPathW(NULL, CSIDL_PROGRAMS, NULL, 0, pth); - strcatW(pth, szBackSlash); + lstrcatW(pth, szBackSlash); msi_set_property( package->db, szProgramMenuFolder, pth, -1 ); SHGetFolderPathW(NULL, CSIDL_ADMINTOOLS, NULL, 0, pth); - strcatW(pth, szBackSlash); + lstrcatW(pth, szBackSlash); msi_set_property( package->db, szAdminToolsFolder, pth, -1 ); SHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, 0, pth); - strcatW(pth, szBackSlash); + lstrcatW(pth, szBackSlash); msi_set_property( package->db, szAppDataFolder, pth, -1 ); SHGetFolderPathW(NULL, CSIDL_SYSTEM, NULL, 0, pth); - strcatW(pth, szBackSlash); + lstrcatW(pth, szBackSlash); msi_set_property( package->db, szSystemFolder, pth, -1 ); msi_set_property( package->db, szSystem16Folder, pth, -1 ); SHGetFolderPathW(NULL, CSIDL_LOCAL_APPDATA, NULL, 0, pth); - strcatW(pth, szBackSlash); + lstrcatW(pth, szBackSlash); msi_set_property( package->db, szLocalAppDataFolder, pth, -1 ); SHGetFolderPathW(NULL, CSIDL_MYPICTURES, NULL, 0, pth); - strcatW(pth, szBackSlash); + lstrcatW(pth, szBackSlash); msi_set_property( package->db, szMyPicturesFolder, pth, -1 ); SHGetFolderPathW(NULL, CSIDL_PERSONAL, NULL, 0, pth); - strcatW(pth, szBackSlash); + lstrcatW(pth, szBackSlash); msi_set_property( package->db, szPersonalFolder, pth, -1 ); SHGetFolderPathW(NULL, CSIDL_WINDOWS, NULL, 0, pth); - strcatW(pth, szBackSlash); + lstrcatW(pth, szBackSlash); msi_set_property( package->db, szWindowsFolder, pth, -1 ); SHGetFolderPathW(NULL, CSIDL_PRINTHOOD, NULL, 0, pth); - strcatW(pth, szBackSlash); + lstrcatW(pth, szBackSlash); msi_set_property( package->db, szPrintHoodFolder, pth, -1 ); SHGetFolderPathW(NULL, CSIDL_NETHOOD, NULL, 0, pth); - strcatW(pth, szBackSlash); + lstrcatW(pth, szBackSlash); msi_set_property( package->db, szNetHoodFolder, pth, -1 ); SHGetFolderPathW(NULL, CSIDL_RECENT, NULL, 0, pth); - strcatW(pth, szBackSlash); + lstrcatW(pth, szBackSlash); msi_set_property( package->db, szRecentFolder, pth, -1 ); /* Physical Memory is specified in MB. Using total amount. */ msex.dwLength = sizeof(msex); GlobalMemoryStatusEx( &msex ); - len = sprintfW( bufstr, szIntFormat, (int)(msex.ullTotalPhys / 1024 / 1024) ); + len = swprintf( bufstr, ARRAY_SIZE(bufstr), szIntFormat, (int)(msex.ullTotalPhys / 1024 / 1024) ); msi_set_property( package->db, szPhysicalMemory, bufstr, len ); SHGetFolderPathW(NULL, CSIDL_WINDOWS, NULL, 0, pth); - ptr = strchrW(pth,'\\'); + ptr = wcschr(pth,'\\'); if (ptr) *(ptr + 1) = 0; msi_set_property( package->db, szWindowsVolume, pth, -1 ); @@ -864,7 +863,7 @@ static VOID set_installer_properties(MSIPACKAGE *package) OSVersion.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXW); GetVersionExW((OSVERSIONINFOW *)&OSVersion); verval = OSVersion.dwMinorVersion + OSVersion.dwMajorVersion * 100; - len = sprintfW( verstr, szFormat, verval ); + len = swprintf( verstr, ARRAY_SIZE(verstr), szFormat, verval ); switch (OSVersion.dwPlatformId) { case VER_PLATFORM_WIN32_WINDOWS: @@ -872,25 +871,25 @@ static VOID set_installer_properties(MSIPACKAGE *package) break; case VER_PLATFORM_WIN32_NT: msi_set_property( package->db, szVersionNT, verstr, len ); - len = sprintfW( bufstr, szFormat,OSVersion.wProductType ); + len = swprintf( bufstr, ARRAY_SIZE(bufstr), szFormat,OSVersion.wProductType ); msi_set_property( package->db, szMsiNTProductType, bufstr, len ); break; } - len = sprintfW( bufstr, szFormat, OSVersion.dwBuildNumber ); + len = swprintf( bufstr, ARRAY_SIZE(bufstr), szFormat, OSVersion.dwBuildNumber ); msi_set_property( package->db, szWindowsBuild, bufstr, len ); - len = sprintfW( bufstr, szFormat, OSVersion.wServicePackMajor ); + len = swprintf( bufstr, ARRAY_SIZE(bufstr), szFormat, OSVersion.wServicePackMajor ); msi_set_property( package->db, szServicePackLevel, bufstr, len ); - len = sprintfW( bufstr, szFormat2, MSI_MAJORVERSION, MSI_MINORVERSION ); + len = swprintf( bufstr, ARRAY_SIZE(bufstr), szFormat2, MSI_MAJORVERSION, MSI_MINORVERSION ); msi_set_property( package->db, szVersionMsi, bufstr, len ); - len = sprintfW( bufstr, szFormat, MSI_MAJORVERSION * 100 ); + len = swprintf( bufstr, ARRAY_SIZE(bufstr), szFormat, MSI_MAJORVERSION * 100 ); msi_set_property( package->db, szVersionDatabase, bufstr, len ); RegOpenKeyExW(HKEY_LOCAL_MACHINE, szCurrentVersion, 0, KEY_QUERY_VALUE | KEY_WOW64_64KEY, &hkey); GetNativeSystemInfo( &sys_info ); - len = sprintfW( bufstr, szIntFormat, sys_info.wProcessorLevel ); + len = swprintf( bufstr, ARRAY_SIZE(bufstr), szIntFormat, sys_info.wProcessorLevel ); msi_set_property( package->db, szIntel, bufstr, len ); if (sys_info.u.s.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL) { @@ -947,11 +946,11 @@ static VOID set_installer_properties(MSIPACKAGE *package) /* Screen properties. */ dc = GetDC(0); - len = sprintfW( bufstr, szIntFormat, GetDeviceCaps(dc, HORZRES) ); + len = swprintf( bufstr, ARRAY_SIZE(bufstr), szIntFormat, GetDeviceCaps(dc, HORZRES) ); msi_set_property( package->db, szScreenX, bufstr, len ); - len = sprintfW( bufstr, szIntFormat, GetDeviceCaps(dc, VERTRES) ); + len = swprintf( bufstr, ARRAY_SIZE(bufstr), szIntFormat, GetDeviceCaps(dc, VERTRES) ); msi_set_property( package->db, szScreenY, bufstr, len ); - len = sprintfW( bufstr, szIntFormat, GetDeviceCaps(dc, BITSPIXEL) ); + len = swprintf( bufstr, ARRAY_SIZE(bufstr), szIntFormat, GetDeviceCaps(dc, BITSPIXEL) ); msi_set_property( package->db, szColorBits, bufstr, len ); ReleaseDC(0, dc); @@ -991,14 +990,14 @@ static VOID set_installer_properties(MSIPACKAGE *package) set_msi_assembly_prop( package ); langid = GetUserDefaultLangID(); - len = sprintfW( bufstr, szIntFormat, langid ); + len = swprintf( bufstr, ARRAY_SIZE(bufstr), szIntFormat, langid ); msi_set_property( package->db, szUserLanguageID, bufstr, len ); langid = GetSystemDefaultLangID(); - len = sprintfW( bufstr, szIntFormat, langid ); + len = swprintf( bufstr, ARRAY_SIZE(bufstr), szIntFormat, langid ); msi_set_property( package->db, szSystemLangID, bufstr, len ); - len = sprintfW( bufstr, szIntFormat, MsiQueryProductStateW(package->ProductCode) ); + len = swprintf( bufstr, ARRAY_SIZE(bufstr), szIntFormat, MsiQueryProductStateW(package->ProductCode) ); msi_set_property( package->db, szProductState, bufstr, len ); len = 0; @@ -1115,7 +1114,7 @@ MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db ) set_installer_properties( package ); package->ui_level = gUILevel; - len = sprintfW( uilevel, fmtW, gUILevel & INSTALLUILEVEL_MASK ); + len = swprintf( uilevel, ARRAY_SIZE(uilevel), fmtW, gUILevel & INSTALLUILEVEL_MASK ); msi_set_property( package->db, szUILevel, uilevel, len ); r = msi_load_suminfo_properties( package ); @@ -1180,14 +1179,14 @@ UINT msi_create_empty_local_file( LPWSTR path, LPCWSTR suffix ) time = GetTickCount(); GetWindowsDirectoryW( path, MAX_PATH ); - strcatW( path, szInstaller ); + lstrcatW( path, szInstaller ); CreateDirectoryW( path, NULL ); - len = strlenW(path); + len = lstrlenW(path); for (i = 0; i < 0x10000; i++) { - offset = snprintfW( path + len, MAX_PATH - len, fmt, (time + i) & 0xffff ); - memcpy( path + len + offset, suffix, (strlenW( suffix ) + 1) * sizeof(WCHAR) ); + offset = swprintf( path + len, MAX_PATH - len, fmt, (time + i) & 0xffff ); + memcpy( path + len + offset, suffix, (lstrlenW( suffix ) + 1) * sizeof(WCHAR) ); handle = CreateFileW( path, GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, 0 ); if (handle != INVALID_HANDLE_VALUE) @@ -1205,11 +1204,11 @@ UINT msi_create_empty_local_file( LPWSTR path, LPCWSTR suffix ) static enum platform parse_platform( const WCHAR *str ) { - if (!str[0] || !strcmpW( str, szIntel )) return PLATFORM_INTEL; - else if (!strcmpW( str, szIntel64 )) return PLATFORM_INTEL64; - else if (!strcmpW( str, szX64 ) || !strcmpW( str, szAMD64 )) return PLATFORM_X64; - else if (!strcmpW( str, szARM )) return PLATFORM_ARM; - else if (!strcmpW( str, szARM64 )) return PLATFORM_ARM64; + if (!str[0] || !wcscmp( str, szIntel )) return PLATFORM_INTEL; + else if (!wcscmp( str, szIntel64 )) return PLATFORM_INTEL64; + else if (!wcscmp( str, szX64 ) || !wcscmp( str, szAMD64 )) return PLATFORM_X64; + else if (!wcscmp( str, szARM )) return PLATFORM_ARM; + else if (!wcscmp( str, szARM64 )) return PLATFORM_ARM64; return PLATFORM_UNKNOWN; } @@ -1227,7 +1226,7 @@ static UINT parse_suminfo( MSISUMMARYINFO *si, MSIPACKAGE *package ) TRACE("template: %s\n", debugstr_w(template)); - p = strchrW( template, ';' ); + p = wcschr( template, ';' ); if (!p) { WARN("invalid template string %s\n", debugstr_w(template)); @@ -1236,12 +1235,12 @@ static UINT parse_suminfo( MSISUMMARYINFO *si, MSIPACKAGE *package ) } *p = 0; platform = template; - if ((q = strchrW( platform, ',' ))) *q = 0; + if ((q = wcschr( platform, ',' ))) *q = 0; package->platform = parse_platform( platform ); while (package->platform == PLATFORM_UNKNOWN && q) { platform = q + 1; - if ((q = strchrW( platform, ',' ))) *q = 0; + if ((q = wcschr( platform, ',' ))) *q = 0; package->platform = parse_platform( platform ); } if (package->platform == PLATFORM_UNKNOWN) @@ -1257,7 +1256,7 @@ static UINT parse_suminfo( MSISUMMARYINFO *si, MSIPACKAGE *package ) return ERROR_SUCCESS; } count = 1; - for (q = p; (q = strchrW( q, ',' )); q++) count++; + for (q = p; (q = wcschr( q, ',' )); q++) count++; package->langids = msi_alloc( count * sizeof(LANGID) ); if (!package->langids) @@ -1269,9 +1268,9 @@ static UINT parse_suminfo( MSISUMMARYINFO *si, MSIPACKAGE *package ) i = 0; while (*p) { - q = strchrW( p, ',' ); + q = wcschr( p, ',' ); if (q) *q = 0; - package->langids[i] = atoiW( p ); + package->langids[i] = wcstol( p, NULL, 10 ); if (!q) break; p = q + 1; i++; @@ -1337,7 +1336,7 @@ static WCHAR *get_property( MSIDATABASE *db, const WCHAR *prop ) MSIRECORD *rec; WCHAR *ret = NULL; - sprintfW(query, select_query, prop); + swprintf(query, ARRAY_SIZE(query), select_query, prop); if (MSI_DatabaseOpenViewW( db, query, &view ) != ERROR_SUCCESS) { return NULL; @@ -1388,7 +1387,7 @@ static UINT get_registered_local_package( const WCHAR *product, WCHAR *localfile if (!filename) return ERROR_FUNCTION_FAILED; - strcpyW( localfile, filename ); + lstrcpyW( localfile, filename ); msi_free( filename ); return ERROR_SUCCESS; } @@ -1471,7 +1470,7 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, DWORD dwOptions, MSIPACKAGE **pPackage) localfile[0] = 0; if( szPackage[0] == '#' ) { - handle = atoiW(&szPackage[1]); + handle = wcstol(&szPackage[1], NULL, 10); if (!(db = msihandle2msiinfo(handle, MSIHANDLETYPE_DATABASE))) return ERROR_INVALID_HANDLE; } @@ -1543,7 +1542,7 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, DWORD dwOptions, MSIPACKAGE **pPackage) { WCHAR *cache_version = get_product_version( db ); if (!product_version != !cache_version || - (product_version && strcmpW(product_version, cache_version))) + (product_version && wcscmp(product_version, cache_version))) { msiobj_release( &db->hdr ); msi_free(product_version); @@ -2041,11 +2040,11 @@ INT MSI_ProcessMessage( MSIPACKAGE *package, INSTALLMESSAGE eMessageType, MSIREC return 0; } - template = msi_alloc((strlenW(template_rec) + strlenW(template_prefix) + 1) * sizeof(WCHAR)); + template = msi_alloc((lstrlenW(template_rec) + lstrlenW(template_prefix) + 1) * sizeof(WCHAR)); if (!template) return ERROR_OUTOFMEMORY; - strcpyW(template, template_prefix); - strcatW(template, template_rec); + lstrcpyW(template, template_prefix); + lstrcatW(template, template_rec); MSI_RecordSetStringW(record, 0, template); msi_free(template_prefix); @@ -2071,11 +2070,10 @@ INT MSI_ProcessMessage( MSIPACKAGE *package, INSTALLMESSAGE eMessageType, MSIREC { static const WCHAR template_s[] = {'{','{','%','s',':',' ','}','}','%','s',0}; - WCHAR *template; - - template = msi_alloc((strlenW(package->LastAction) + strlenW(package->LastActionTemplate) + 7) * sizeof(WCHAR)); + size_t len = lstrlenW(package->LastAction) + lstrlenW(package->LastActionTemplate) + 7; + WCHAR *template = msi_alloc(len * sizeof(WCHAR)); if (!template) return ERROR_OUTOFMEMORY; - sprintfW(template, template_s, package->LastAction, package->LastActionTemplate); + swprintf(template, len, template_s, package->LastAction, package->LastActionTemplate); MSI_RecordSetStringW(record, 0, template); msi_free(template); } @@ -2205,22 +2203,22 @@ UINT msi_set_property( MSIDATABASE *db, const WCHAR *name, const WCHAR *value, i if (!name[0]) return value ? ERROR_FUNCTION_FAILED : ERROR_SUCCESS; - if (value && len < 0) len = strlenW( value ); + if (value && len < 0) len = lstrlenW( value ); rc = msi_get_property( db, name, 0, &sz ); if (!value || (!*value && !len)) { - sprintfW( query, delete_query, name ); + swprintf( query, ARRAY_SIZE(query), delete_query, name ); } else if (rc == ERROR_MORE_DATA || rc == ERROR_SUCCESS) { - sprintfW( query, update_query, name ); + swprintf( query, ARRAY_SIZE(query), update_query, name ); row = MSI_CreateRecord(1); msi_record_set_string( row, 1, value, len ); } else { - strcpyW( query, insert_query ); + lstrcpyW( query, insert_query ); row = MSI_CreateRecord(2); msi_record_set_string( row, 1, name, -1 ); msi_record_set_string( row, 2, value, len ); @@ -2264,7 +2262,7 @@ UINT WINAPI MsiSetPropertyW( MSIHANDLE hInstall, LPCWSTR szName, LPCWSTR szValue } ret = msi_set_property( package->db, szName, szValue, -1 ); - if (ret == ERROR_SUCCESS && !strcmpW( szName, szSourceDir )) + if (ret == ERROR_SUCCESS && !wcscmp( szName, szSourceDir )) msi_reset_source_folders( package ); msiobj_release( &package->hdr ); @@ -2289,7 +2287,7 @@ static MSIRECORD *msi_get_property_row( MSIDATABASE *db, LPCWSTR name ) if (!name || !*name) return NULL; - if (!strcmpW(name, szDate)) + if (!wcscmp(name, szDate)) { length = GetDateFormatW(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, NULL, 0); if (!length) @@ -2307,7 +2305,7 @@ static MSIRECORD *msi_get_property_row( MSIDATABASE *db, LPCWSTR name ) msi_free(buffer); return row; } - else if (!strcmpW(name, szTime)) + else if (!wcscmp(name, szTime)) { length = GetTimeFormatW(LOCALE_USER_DEFAULT, TIME_NOTIMEMARKER, NULL, NULL, NULL, 0); if (!length) @@ -2404,7 +2402,7 @@ LPWSTR msi_dup_property(MSIDATABASE *db, LPCWSTR prop) int msi_get_property_int( MSIDATABASE *db, LPCWSTR prop, int def ) { LPWSTR str = msi_dup_property( db, prop ); - int val = str ? atoiW(str) : def; + int val = str ? wcstol(str, NULL, 10) : def; msi_free(str); return val; } @@ -2459,7 +2457,7 @@ UINT WINAPI MsiGetPropertyA(MSIHANDLE hinst, const char *name, char *buf, DWORD midl_user_free(value); return ERROR_OUTOFMEMORY; } - strcpyW(tmp, value); + lstrcpyW(tmp, value); r = msi_strncpyWtoA(tmp, len, buf, sz, TRUE); @@ -2522,7 +2520,7 @@ UINT WINAPI MsiGetPropertyW(MSIHANDLE hinst, const WCHAR *name, WCHAR *buf, DWOR midl_user_free(value); return ERROR_OUTOFMEMORY; } - strcpyW(tmp, value); + lstrcpyW(tmp, value); r = msi_strncpyW(tmp, len, buf, sz); @@ -2728,7 +2726,7 @@ UINT msi_package_add_info(MSIPACKAGE *package, DWORD context, DWORD options, LIST_FOR_EACH_ENTRY( info, &package->sourcelist_info, MSISOURCELISTINFO, entry ) { - if (!strcmpW( info->value, value )) return ERROR_SUCCESS; + if (!wcscmp( info->value, value )) return ERROR_SUCCESS; } info = msi_alloc(sizeof(MSISOURCELISTINFO)); diff --git a/dll/win32/msi/patch.c b/dll/win32/msi/patch.c index bd9b7b87df4..35b8463858e 100644 --- a/dll/win32/msi/patch.c +++ b/dll/win32/msi/patch.c @@ -27,7 +27,6 @@ #include "objbase.h" #include "shlwapi.h" #include "wine/debug.h" -#include "wine/unicode.h" #include "msipriv.h" WINE_DEFAULT_DEBUG_CHANNEL(msi); @@ -71,7 +70,7 @@ static struct transform_desc *parse_transform_desc( const WCHAR *str ) if (!(ret = msi_alloc_zero( sizeof(*ret) ))) return NULL; - q = strchrW( p, '}' ); + q = wcschr( p, '}' ); if (*p != '{' || !q) goto error; len = q - p + 1; @@ -80,14 +79,14 @@ static struct transform_desc *parse_transform_desc( const WCHAR *str ) ret->product_code_from[len] = 0; p = q + 1; - if (!(q = strchrW( p, ';' ))) goto error; + if (!(q = wcschr( p, ';' ))) goto error; len = q - p; if (!(ret->version_from = msi_alloc( (len + 1) * sizeof(WCHAR) ))) goto error; memcpy( ret->version_from, p, len * sizeof(WCHAR) ); ret->version_from[len] = 0; p = q + 1; - q = strchrW( p, '}' ); + q = wcschr( p, '}' ); if (*p != '{' || !q) goto error; len = q - p + 1; @@ -96,14 +95,14 @@ static struct transform_desc *parse_transform_desc( const WCHAR *str ) ret->product_code_to[len] = 0; p = q + 1; - if (!(q = strchrW( p, ';' ))) goto error; + if (!(q = wcschr( p, ';' ))) goto error; len = q - p; if (!(ret->version_to = msi_alloc( (len + 1) * sizeof(WCHAR) ))) goto error; memcpy( ret->version_to, p, len * sizeof(WCHAR) ); ret->version_to[len] = 0; p = q + 1; - q = strchrW( p, '}' ); + q = wcschr( p, '}' ); if (*p != '{' || !q) goto error; len = q - p + 1; @@ -173,7 +172,7 @@ static UINT check_transform_applicable( MSIPACKAGE *package, IStorage *transform if (wanted_flags & MSITRANSFORM_VALIDATE_LANGUAGE) { - if (!template[0] || ((p = strchrW( template, ';' )) && match_language( package, atoiW( p + 1 ) ))) + if (!template[0] || ((p = wcschr( template, ';' )) && match_language( package, wcstol( p + 1, NULL, 10 ) ))) { valid_flags |= MSITRANSFORM_VALIDATE_LANGUAGE; } @@ -189,7 +188,7 @@ static UINT check_transform_applicable( MSIPACKAGE *package, IStorage *transform msiobj_release( &si->hdr ); return ERROR_INSTALL_PACKAGE_INVALID; } - if (!strcmpW( desc->product_code_from, product_code_installed )) + if (!wcscmp( desc->product_code_from, product_code_installed )) { valid_flags |= MSITRANSFORM_VALIDATE_PRODUCT; } @@ -245,7 +244,7 @@ static UINT check_transform_applicable( MSIPACKAGE *package, IStorage *transform msiobj_release( &si->hdr ); return ERROR_INSTALL_PACKAGE_INVALID; } - if (!strcmpW( desc->upgrade_code, upgrade_code_installed )) + if (!wcscmp( desc->upgrade_code, upgrade_code_installed )) valid_flags |= MSITRANSFORM_VALIDATE_UPGRADECODE; msi_free( upgrade_code_installed ); } @@ -303,7 +302,7 @@ UINT msi_check_patch_applicable( MSIPACKAGE *package, MSISUMMARYINFO *si ) guids = msi_split_string( guid_list, ';' ); for (i = 0; guids[i] && ret != ERROR_SUCCESS; i++) { - if (!strcmpW( guids[i], product_code )) ret = ERROR_SUCCESS; + if (!wcscmp( guids[i], product_code )) ret = ERROR_SUCCESS; } msi_free( guids ); msi_free( guid_list ); @@ -333,7 +332,7 @@ static UINT msi_parse_patch_summary( MSISUMMARYINFO *si, MSIPATCHINFO **patch ) msi_free( pi ); return ERROR_PATCH_PACKAGE_INVALID; } - if (!(p = strchrW( p + 1, '}' ))) + if (!(p = wcschr( p + 1, '}' ))) { msi_free( pi->patchcode ); msi_free( pi ); @@ -526,7 +525,7 @@ static UINT patch_update_file_sequence( MSIDATABASE *db, const struct patch_offs LIST_FOR_EACH_ENTRY( po, &pos->files, struct patch_offset, entry ) { - if (!strcmpiW( file, po->name )) + if (!wcsicmp( file, po->name )) { MSI_RecordSetInteger( rec, 8, seq + pos->offset_to_apply ); r = MSI_ViewModify( view, MSIMODIFY_UPDATE, rec ); @@ -557,7 +556,7 @@ static UINT patch_update_filepatch_sequence( MSIDATABASE *db, const struct patch LIST_FOR_EACH_ENTRY( po, &pos->patches, struct patch_offset, entry ) { - if (seq == po->sequence && !strcmpiW( file, po->name )) + if (seq == po->sequence && !wcsicmp( file, po->name )) { MSIQUERY *delete_view, *insert_view; MSIRECORD *rec2; @@ -858,7 +857,7 @@ static DWORD is_uninstallable( MSIDATABASE *db ) if (MSI_ViewFetch( view, &rec ) == ERROR_SUCCESS) { const WCHAR *value = MSI_RecordGetString( rec, 1 ); - ret = atoiW( value ); + ret = wcstol( value, NULL, 10 ); msiobj_release( &rec->hdr ); } @@ -1005,17 +1004,17 @@ UINT msi_apply_transforms( MSIPACKAGE *package ) if (!PathIsRelativeW( xforms[i] )) transform = xforms[i]; else { - WCHAR *p = strrchrW( package->PackagePath, '\\' ); + WCHAR *p = wcsrchr( package->PackagePath, '\\' ); DWORD len = p - package->PackagePath + 1; - if (!(transform = msi_alloc( (len + strlenW( xforms[i] ) + 1) * sizeof(WCHAR)) )) + if (!(transform = msi_alloc( (len + lstrlenW( xforms[i] ) + 1) * sizeof(WCHAR)) )) { msi_free( xforms ); msi_free( xform_list ); return ERROR_OUTOFMEMORY; } memcpy( transform, package->PackagePath, len * sizeof(WCHAR) ); - memcpy( transform + len, xforms[i], (strlenW( xforms[i] ) + 1) * sizeof(WCHAR) ); + memcpy( transform + len, xforms[i], (lstrlenW( xforms[i] ) + 1) * sizeof(WCHAR) ); } r = MSI_DatabaseApplyTransformW( package->db, transform, 0 ); if (transform != xforms[i]) msi_free( transform ); diff --git a/dll/win32/msi/record.c b/dll/win32/msi/record.c index cca63083d18..0a352adcd87 100644 --- a/dll/win32/msi/record.c +++ b/dll/win32/msi/record.c @@ -27,7 +27,6 @@ #include "winuser.h" #include "winerror.h" #include "wine/debug.h" -#include "wine/unicode.h" #include "msi.h" #include "msiquery.h" #include "msipriv.h" @@ -582,7 +581,7 @@ UINT msi_record_set_string( MSIRECORD *rec, UINT field, const WCHAR *value, int MSI_FreeField( &rec->fields[field] ); - if (value && len < 0) len = strlenW( value ); + if (value && len < 0) len = lstrlenW( value ); if (value && len) { diff --git a/dll/win32/msi/registry.c b/dll/win32/msi/registry.c index 8b90254914a..4d439d0b304 100644 --- a/dll/win32/msi/registry.c +++ b/dll/win32/msi/registry.c @@ -32,7 +32,6 @@ #include "msi.h" #include "msipriv.h" #include "wincrypt.h" -#include "wine/unicode.h" #include "winver.h" #include "winuser.h" #include "sddl.h" @@ -338,15 +337,15 @@ DWORD msi_version_str_to_dword(LPCWSTR p) if (!p) return version; - major = atoiW(p); + major = wcstol(p, NULL, 10); - p = strchrW(p, '.'); + p = wcschr(p, '.'); if (p) { - minor = atoiW(p+1); - p = strchrW(p+1, '.'); + minor = wcstol(p+1, NULL, 10); + p = wcschr(p+1, '.'); if (p) - build = atoiW(p+1); + build = wcstol(p+1, NULL, 10); } return MAKELONG(build, MAKEWORD(minor, major)); @@ -456,8 +455,8 @@ UINT MSIREG_OpenUninstallKey(const WCHAR *product, enum platform platform, HKEY access |= KEY_WOW64_32KEY; else access |= KEY_WOW64_64KEY; - strcpyW(keypath, szUninstall); - strcatW(keypath, product); + lstrcpyW(keypath, szUninstall); + lstrcatW(keypath, product); if (create) return RegCreateKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, key, NULL); return RegOpenKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, access, key); } @@ -492,14 +491,14 @@ UINT MSIREG_OpenProductKey(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINSTALLCONTE if (context == MSIINSTALLCONTEXT_MACHINE) { - strcpyW(keypath, szInstaller_LocalClassesProd); - strcatW( keypath, squashed_pc ); + lstrcpyW(keypath, szInstaller_LocalClassesProd); + lstrcatW( keypath, squashed_pc ); } else if (context == MSIINSTALLCONTEXT_USERUNMANAGED) { root = HKEY_CURRENT_USER; - strcpyW(keypath, szUserProducts); - strcatW( keypath, squashed_pc ); + lstrcpyW(keypath, szUserProducts); + lstrcatW( keypath, squashed_pc ); } else { @@ -512,7 +511,7 @@ UINT MSIREG_OpenProductKey(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINSTALLCONTE } szUserSid = usersid; } - sprintfW( keypath, szInstaller_LocalManagedProd_fmt, szUserSid, squashed_pc ); + swprintf( keypath, ARRAY_SIZE(keypath), szInstaller_LocalManagedProd_fmt, szUserSid, squashed_pc ); LocalFree(usersid); } if (create) return RegCreateKeyExW(root, keypath, 0, NULL, 0, access, NULL, key, NULL); @@ -526,8 +525,8 @@ UINT MSIREG_DeleteUserProductKey(LPCWSTR szProduct) if (!squash_guid( szProduct, squashed_pc )) return ERROR_FUNCTION_FAILED; TRACE("%s squashed %s\n", debugstr_w(szProduct), debugstr_w(squashed_pc)); - strcpyW(keypath, szUserProducts); - strcatW( keypath, squashed_pc ); + lstrcpyW(keypath, szUserProducts); + lstrcatW( keypath, squashed_pc ); return RegDeleteTreeW(HKEY_CURRENT_USER, keypath); } @@ -538,8 +537,8 @@ UINT MSIREG_OpenUserPatchesKey(LPCWSTR szPatch, HKEY *key, BOOL create) if (!squash_guid( szPatch, squashed_pc )) return ERROR_FUNCTION_FAILED; TRACE("%s squashed %s\n", debugstr_w(szPatch), debugstr_w(squashed_pc)); - strcpyW(keypath, szUserPatches); - strcatW( keypath, squashed_pc ); + lstrcpyW(keypath, szUserPatches); + lstrcatW( keypath, squashed_pc ); if (create) return RegCreateKeyW(HKEY_CURRENT_USER, keypath, key); return RegOpenKeyW(HKEY_CURRENT_USER, keypath, key); @@ -557,14 +556,14 @@ UINT MSIREG_OpenFeaturesKey(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINSTALLCONT if (context == MSIINSTALLCONTEXT_MACHINE) { - strcpyW(keypath, szInstaller_LocalClassesFeat); - strcatW( keypath, squashed_pc ); + lstrcpyW(keypath, szInstaller_LocalClassesFeat); + lstrcatW( keypath, squashed_pc ); } else if (context == MSIINSTALLCONTEXT_USERUNMANAGED) { root = HKEY_CURRENT_USER; - strcpyW(keypath, szUserFeatures); - strcatW( keypath, squashed_pc ); + lstrcpyW(keypath, szUserFeatures); + lstrcatW( keypath, squashed_pc ); } else { @@ -577,7 +576,7 @@ UINT MSIREG_OpenFeaturesKey(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINSTALLCONT } szUserSid = usersid; } - sprintfW( keypath, szInstaller_LocalManagedFeat_fmt, szUserSid, squashed_pc ); + swprintf( keypath, ARRAY_SIZE(keypath), szInstaller_LocalManagedFeat_fmt, szUserSid, squashed_pc ); LocalFree(usersid); } if (create) return RegCreateKeyExW(root, keypath, 0, NULL, 0, access, NULL, key, NULL); @@ -591,8 +590,8 @@ UINT MSIREG_DeleteUserFeaturesKey(LPCWSTR szProduct) if (!squash_guid( szProduct, squashed_pc )) return ERROR_FUNCTION_FAILED; TRACE("%s squashed %s\n", debugstr_w(szProduct), debugstr_w(squashed_pc)); - strcpyW(keypath, szUserFeatures); - strcatW( keypath, squashed_pc ); + lstrcpyW(keypath, szUserFeatures); + lstrcatW( keypath, squashed_pc ); return RegDeleteTreeW(HKEY_CURRENT_USER, keypath); } @@ -604,8 +603,8 @@ static UINT MSIREG_OpenInstallerFeaturesKey(LPCWSTR szProduct, HKEY *key, BOOL c if (!squash_guid( szProduct, squashed_pc )) return ERROR_FUNCTION_FAILED; TRACE("%s squashed %s\n", debugstr_w(szProduct), debugstr_w(squashed_pc)); - strcpyW(keypath, szInstaller_Features); - strcatW( keypath, squashed_pc ); + lstrcpyW(keypath, szInstaller_Features); + lstrcatW( keypath, squashed_pc ); if (create) return RegCreateKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, key, NULL); return RegOpenKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, access, key); @@ -622,7 +621,7 @@ UINT MSIREG_OpenUserDataFeaturesKey(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINS if (context == MSIINSTALLCONTEXT_MACHINE) { - sprintfW( keypath, szUserDataFeatures_fmt, szLocalSid, squashed_pc ); + swprintf( keypath, ARRAY_SIZE(keypath), szUserDataFeatures_fmt, szLocalSid, squashed_pc ); } else { @@ -635,7 +634,7 @@ UINT MSIREG_OpenUserDataFeaturesKey(LPCWSTR szProduct, LPCWSTR szUserSid, MSIINS } szUserSid = usersid; } - sprintfW( keypath, szUserDataFeatures_fmt, szUserSid, squashed_pc ); + swprintf( keypath, ARRAY_SIZE(keypath), szUserDataFeatures_fmt, szUserSid, squashed_pc ); LocalFree(usersid); } if (create) return RegCreateKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, key, NULL); @@ -651,15 +650,15 @@ UINT MSIREG_OpenUserComponentsKey(LPCWSTR szComponent, HKEY *key, BOOL create) if (!squash_guid( szComponent, squashed_cc)) return ERROR_FUNCTION_FAILED; TRACE("%s squashed %s\n", debugstr_w(szComponent), debugstr_w(squashed_cc)); - strcpyW(keypath, szUserComponents); - strcatW( keypath, squashed_cc ); + lstrcpyW(keypath, szUserComponents); + lstrcatW( keypath, squashed_cc ); if (create) return RegCreateKeyW(HKEY_CURRENT_USER, keypath, key); ret = RegOpenKeyW(HKEY_CURRENT_USER, keypath, key); if (ret != ERROR_FILE_NOT_FOUND) return ret; - strcpyW(keypath, szInstaller_Components); - strcatW( keypath, squashed_cc ); + lstrcpyW(keypath, szInstaller_Components); + lstrcatW( keypath, squashed_cc ); return RegOpenKeyExW( HKEY_LOCAL_MACHINE, keypath, 0, access, key ); } @@ -678,11 +677,11 @@ UINT MSIREG_OpenUserDataComponentKey(LPCWSTR szComponent, LPCWSTR szUserSid, HKE ERR("Failed to retrieve user SID\n"); return ERROR_FUNCTION_FAILED; } - sprintfW( keypath, szUserDataComp_fmt, usersid, squashed_comp ); + swprintf( keypath, ARRAY_SIZE(keypath), szUserDataComp_fmt, usersid, squashed_comp ); LocalFree(usersid); } else - sprintfW( keypath, szUserDataComp_fmt, szUserSid, squashed_comp ); + swprintf( keypath, ARRAY_SIZE(keypath), szUserDataComp_fmt, szUserSid, squashed_comp ); if (create) return RegCreateKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, key, NULL); return RegOpenKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, access, key); @@ -705,11 +704,11 @@ UINT MSIREG_DeleteUserDataComponentKey(LPCWSTR szComponent, LPCWSTR szUserSid) ERR("Failed to retrieve user SID\n"); return ERROR_FUNCTION_FAILED; } - sprintfW(keypath, szUserDataComponents_fmt, usersid); + swprintf(keypath, ARRAY_SIZE(keypath), szUserDataComponents_fmt, usersid); LocalFree(usersid); } else - sprintfW(keypath, szUserDataComponents_fmt, szUserSid); + swprintf(keypath, ARRAY_SIZE(keypath), szUserDataComponents_fmt, szUserSid); if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey)) return ERROR_SUCCESS; r = RegDeleteTreeW( hkey, squashed_comp ); @@ -726,9 +725,9 @@ UINT MSIREG_OpenUserDataProductKey(LPCWSTR szProduct, MSIINSTALLCONTEXT dwContex TRACE("%s squashed %s\n", debugstr_w(szProduct), debugstr_w(squashed_pc)); if (dwContext == MSIINSTALLCONTEXT_MACHINE) - sprintfW( keypath, szUserDataProd_fmt, szLocalSid, squashed_pc ); + swprintf( keypath, ARRAY_SIZE(keypath), szUserDataProd_fmt, szLocalSid, squashed_pc ); else if (szUserSid) - sprintfW( keypath, szUserDataProd_fmt, szUserSid, squashed_pc ); + swprintf( keypath, ARRAY_SIZE(keypath), szUserDataProd_fmt, szUserSid, squashed_pc ); else { if (!(usersid = get_user_sid())) @@ -736,7 +735,7 @@ UINT MSIREG_OpenUserDataProductKey(LPCWSTR szProduct, MSIINSTALLCONTEXT dwContex ERR("Failed to retrieve user SID\n"); return ERROR_FUNCTION_FAILED; } - sprintfW( keypath, szUserDataProd_fmt, usersid, squashed_pc ); + swprintf( keypath, ARRAY_SIZE(keypath), szUserDataProd_fmt, usersid, squashed_pc ); LocalFree(usersid); } if (create) return RegCreateKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, key, NULL); @@ -752,7 +751,7 @@ UINT MSIREG_OpenUserDataPatchKey(LPCWSTR szPatch, MSIINSTALLCONTEXT dwContext, H TRACE("%s squashed %s\n", debugstr_w(szPatch), debugstr_w(squashed_patch)); if (dwContext == MSIINSTALLCONTEXT_MACHINE) - sprintfW( keypath, szUserDataPatch_fmt, szLocalSid, squashed_patch ); + swprintf( keypath, ARRAY_SIZE(keypath), szUserDataPatch_fmt, szLocalSid, squashed_patch ); else { if (!(usersid = get_user_sid())) @@ -760,7 +759,7 @@ UINT MSIREG_OpenUserDataPatchKey(LPCWSTR szPatch, MSIINSTALLCONTEXT dwContext, H ERR("Failed to retrieve user SID\n"); return ERROR_FUNCTION_FAILED; } - sprintfW( keypath, szUserDataPatch_fmt, usersid, squashed_patch ); + swprintf( keypath, ARRAY_SIZE(keypath), szUserDataPatch_fmt, usersid, squashed_patch ); LocalFree(usersid); } if (create) return RegCreateKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, key, NULL); @@ -778,7 +777,7 @@ UINT MSIREG_DeleteUserDataPatchKey(LPCWSTR patch, MSIINSTALLCONTEXT context) TRACE("%s squashed %s\n", debugstr_w(patch), debugstr_w(squashed_patch)); if (context == MSIINSTALLCONTEXT_MACHINE) - sprintfW(keypath, szUserDataPatches_fmt, szLocalSid); + swprintf(keypath, ARRAY_SIZE(keypath), szUserDataPatches_fmt, szLocalSid); else { if (!(usersid = get_user_sid())) @@ -786,7 +785,7 @@ UINT MSIREG_DeleteUserDataPatchKey(LPCWSTR patch, MSIINSTALLCONTEXT context) ERR("Failed to retrieve user SID\n"); return ERROR_FUNCTION_FAILED; } - sprintfW(keypath, szUserDataPatches_fmt, usersid); + swprintf(keypath, ARRAY_SIZE(keypath), szUserDataPatches_fmt, usersid); LocalFree(usersid); } if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey)) return ERROR_SUCCESS; @@ -804,7 +803,7 @@ UINT MSIREG_OpenUserDataProductPatchesKey(LPCWSTR product, MSIINSTALLCONTEXT con TRACE("%s squashed %s\n", debugstr_w(product), debugstr_w(squashed_product)); if (context == MSIINSTALLCONTEXT_MACHINE) - sprintfW( keypath, szUserDataProductPatches_fmt, szLocalSid, squashed_product ); + swprintf( keypath, ARRAY_SIZE(keypath), szUserDataProductPatches_fmt, szLocalSid, squashed_product ); else { if (!(usersid = get_user_sid())) @@ -812,7 +811,7 @@ UINT MSIREG_OpenUserDataProductPatchesKey(LPCWSTR product, MSIINSTALLCONTEXT con ERR("Failed to retrieve user SID\n"); return ERROR_FUNCTION_FAILED; } - sprintfW( keypath, szUserDataProductPatches_fmt, usersid, squashed_product ); + swprintf( keypath, ARRAY_SIZE(keypath), szUserDataProductPatches_fmt, usersid, squashed_product ); LocalFree(usersid); } if (create) return RegCreateKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, key, NULL); @@ -828,9 +827,9 @@ UINT MSIREG_OpenInstallProps(LPCWSTR szProduct, MSIINSTALLCONTEXT dwContext, LPC TRACE("%s squashed %s\n", debugstr_w(szProduct), debugstr_w(squashed_pc)); if (dwContext == MSIINSTALLCONTEXT_MACHINE) - sprintfW( keypath, szInstallProperties_fmt, szLocalSid, squashed_pc ); + swprintf( keypath, ARRAY_SIZE(keypath), szInstallProperties_fmt, szLocalSid, squashed_pc ); else if (szUserSid) - sprintfW( keypath, szInstallProperties_fmt, szUserSid, squashed_pc ); + swprintf( keypath, ARRAY_SIZE(keypath), szInstallProperties_fmt, szUserSid, squashed_pc ); else { if (!(usersid = get_user_sid())) @@ -838,7 +837,7 @@ UINT MSIREG_OpenInstallProps(LPCWSTR szProduct, MSIINSTALLCONTEXT dwContext, LPC ERR("Failed to retrieve user SID\n"); return ERROR_FUNCTION_FAILED; } - sprintfW( keypath, szInstallProperties_fmt, usersid, squashed_pc ); + swprintf( keypath, ARRAY_SIZE(keypath), szInstallProperties_fmt, usersid, squashed_pc ); LocalFree(usersid); } if (create) return RegCreateKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, key, NULL); @@ -856,7 +855,7 @@ UINT MSIREG_DeleteUserDataProductKey(LPCWSTR szProduct, MSIINSTALLCONTEXT contex TRACE("%s squashed %s\n", debugstr_w(szProduct), debugstr_w(squashed_pc)); if (context == MSIINSTALLCONTEXT_MACHINE) - sprintfW(keypath, szUserDataProducts_fmt, szLocalSid); + swprintf(keypath, ARRAY_SIZE(keypath), szUserDataProducts_fmt, szLocalSid); else { if (!(usersid = get_user_sid())) @@ -864,7 +863,7 @@ UINT MSIREG_DeleteUserDataProductKey(LPCWSTR szProduct, MSIINSTALLCONTEXT contex ERR("Failed to retrieve user SID\n"); return ERROR_FUNCTION_FAILED; } - sprintfW(keypath, szUserDataProducts_fmt, usersid); + swprintf(keypath, ARRAY_SIZE(keypath), szUserDataProducts_fmt, usersid); LocalFree(usersid); } @@ -898,7 +897,7 @@ UINT MSIREG_OpenPatchesKey(LPCWSTR szPatch, HKEY *key, BOOL create) if (!squash_guid( szPatch, squashed_pc )) return ERROR_FUNCTION_FAILED; TRACE("%s squashed %s\n", debugstr_w(szPatch), debugstr_w(squashed_pc)); - sprintfW( keypath, szInstaller_Patches, squashed_pc ); + swprintf( keypath, ARRAY_SIZE(keypath), szInstaller_Patches, squashed_pc ); if (create) return RegCreateKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, key, NULL); return RegOpenKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, access, key); @@ -912,8 +911,8 @@ UINT MSIREG_OpenUpgradeCodesKey(LPCWSTR szUpgradeCode, HKEY *key, BOOL create) if (!squash_guid( szUpgradeCode, squashed_uc )) return ERROR_FUNCTION_FAILED; TRACE("%s squashed %s\n", debugstr_w(szUpgradeCode), debugstr_w(squashed_uc)); - strcpyW(keypath, szInstaller_UpgradeCodes); - strcatW( keypath, squashed_uc ); + lstrcpyW(keypath, szInstaller_UpgradeCodes); + lstrcatW( keypath, squashed_uc ); if (create) return RegCreateKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, key, NULL); return RegOpenKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, access, key); @@ -926,8 +925,8 @@ UINT MSIREG_OpenUserUpgradeCodesKey(LPCWSTR szUpgradeCode, HKEY* key, BOOL creat if (!squash_guid( szUpgradeCode, squashed_uc )) return ERROR_FUNCTION_FAILED; TRACE("%s squashed %s\n", debugstr_w(szUpgradeCode), debugstr_w(squashed_uc)); - strcpyW(keypath, szInstaller_UserUpgradeCodes); - strcatW( keypath, squashed_uc ); + lstrcpyW(keypath, szInstaller_UserUpgradeCodes); + lstrcatW( keypath, squashed_uc ); if (create) return RegCreateKeyW(HKEY_CURRENT_USER, keypath, key); return RegOpenKeyW(HKEY_CURRENT_USER, keypath, key); @@ -956,8 +955,8 @@ UINT MSIREG_DeleteUserUpgradeCodesKey(LPCWSTR szUpgradeCode) if (!squash_guid( szUpgradeCode, squashed_uc )) return ERROR_FUNCTION_FAILED; TRACE("%s squashed %s\n", debugstr_w(szUpgradeCode), debugstr_w(squashed_uc)); - strcpyW(keypath, szInstaller_UserUpgradeCodes); - strcatW( keypath, squashed_uc ); + lstrcpyW(keypath, szInstaller_UserUpgradeCodes); + lstrcatW( keypath, squashed_uc ); return RegDeleteTreeW(HKEY_CURRENT_USER, keypath); } @@ -1001,8 +1000,8 @@ UINT MSIREG_OpenClassesUpgradeCodesKey(LPCWSTR szUpgradeCode, HKEY *key, BOOL cr if (!squash_guid( szUpgradeCode, squashed_uc )) return ERROR_FUNCTION_FAILED; TRACE("%s squashed %s\n", debugstr_w(szUpgradeCode), debugstr_w(squashed_uc)); - strcpyW(keypath, szInstaller_ClassesUpgradeCode); - strcatW( keypath, squashed_uc ); + lstrcpyW(keypath, szInstaller_ClassesUpgradeCode); + lstrcatW( keypath, squashed_uc ); if (create) return RegCreateKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, key, NULL); return RegOpenKeyExW(HKEY_LOCAL_MACHINE, keypath, 0, access, key); @@ -1059,8 +1058,8 @@ UINT WINAPI MsiDecomposeDescriptorW( LPCWSTR szDescriptor, LPWSTR szProduct, TRACE("product %s\n", debugstr_guid( &product )); - if (!(p = strchrW( &szDescriptor[20], '>' ))) - p = strchrW( &szDescriptor[20], '<' ); + if (!(p = wcschr( &szDescriptor[20], '>' ))) + p = wcschr( &szDescriptor[20], '<' ); if (!p) return ERROR_INVALID_PARAMETER; @@ -1344,15 +1343,15 @@ static UINT fetch_user_component( const WCHAR *usersid, DWORD ctx, DWORD index, len_user = ARRAY_SIZE( user ); while (!RegEnumKeyExW( key_users, i, user, &len_user, NULL, NULL, NULL, NULL )) { - if ((strcmpW( usersid, szAllSid ) && strcmpW( usersid, user )) || - !strcmpW( szLocalSid, user )) + if ((wcscmp( usersid, szAllSid ) && wcscmp( usersid, user )) || + !wcscmp( szLocalSid, user )) { i++; len_user = ARRAY_SIZE( user ); continue; } - strcpyW( path, user ); - strcatW( path, componentsW ); + lstrcpyW( path, user ); + lstrcatW( path, componentsW ); if (RegOpenKeyExW( key_users, path, 0, access, &key_components )) { i++; @@ -1385,7 +1384,7 @@ found: else if (sid) { *sid_len = len_user; - strcpyW( sid, user ); + lstrcpyW( sid, user ); } } if (guid) unsquash_guid( component, guid ); @@ -2126,7 +2125,7 @@ UINT WINAPI MsiEnumPatchesExW(LPCWSTR szProductCode, LPCWSTR szUserSid, if (!szProductCode || !squash_guid( szProductCode, squashed_pc )) return ERROR_INVALID_PARAMETER; - if (szUserSid && !strcmpW( szUserSid, szLocalSid )) + if (szUserSid && !wcscmp( szUserSid, szLocalSid )) return ERROR_INVALID_PARAMETER; if (dwContext & MSIINSTALLCONTEXT_MACHINE && szUserSid) @@ -2319,7 +2318,7 @@ static UINT fetch_machine_product( const WCHAR *match, DWORD index, DWORD *idx, len = ARRAY_SIZE( product ); while (!RegEnumKeyExW( key, i, product, &len, NULL, NULL, NULL, NULL )) { - if (match && strcmpW( match, product )) + if (match && wcscmp( match, product )) { i++; len = ARRAY_SIZE( product ); @@ -2391,14 +2390,14 @@ static UINT fetch_user_product( const WCHAR *match, const WCHAR *usersid, DWORD len_user = ARRAY_SIZE( user ); while (!RegEnumKeyExW( key_users, i, user, &len_user, NULL, NULL, NULL, NULL )) { - if (strcmpW( usersid, user ) && strcmpW( usersid, szAllSid )) + if (wcscmp( usersid, user ) && wcscmp( usersid, szAllSid )) { i++; len_user = ARRAY_SIZE( user ); continue; } - strcpyW( path, user ); - strcatW( path, subkey ); + lstrcpyW( path, user ); + lstrcatW( path, subkey ); if (RegOpenKeyExW( key_users, path, 0, access, &key_products )) { i++; @@ -2408,7 +2407,7 @@ static UINT fetch_user_product( const WCHAR *match, const WCHAR *usersid, DWORD len_product = ARRAY_SIZE( product ); while (!RegEnumKeyExW( key_products, j, product, &len_product, NULL, NULL, NULL, NULL )) { - if (match && strcmpW( match, product )) + if (match && wcscmp( match, product )) { j++; len_product = ARRAY_SIZE( product ); @@ -2438,7 +2437,7 @@ found: if (installed_ctx) *installed_ctx = ctx; if (sid) { - strcpyW( sid, user ); + lstrcpyW( sid, user ); *sid_len = len_user; } r = ERROR_SUCCESS; diff --git a/dll/win32/msi/script.c b/dll/win32/msi/script.c index c70790f5386..67ad8b51c52 100644 --- a/dll/win32/msi/script.c +++ b/dll/win32/msi/script.c @@ -30,7 +30,6 @@ #include "activscp.h" #include "oleauto.h" #include "wine/debug.h" -#include "wine/unicode.h" #include "msiserver.h" @@ -136,7 +135,7 @@ static HRESULT WINAPI MsiActiveScriptSite_GetItemInfo(IActiveScriptSite* iface, } /* Are we looking for the session object? */ - if (!strcmpW(szSession, pstrName)) { + if (!wcscmp(szSession, pstrName)) { if (dwReturnMask & SCRIPTINFO_ITYPEINFO) { HRESULT hr = get_typeinfo(Session_tid, ppti); if (SUCCEEDED(hr)) diff --git a/dll/win32/msi/source.c b/dll/win32/msi/source.c index ed1c6b66a4b..89c04d9f7dd 100644 --- a/dll/win32/msi/source.c +++ b/dll/win32/msi/source.c @@ -34,7 +34,6 @@ #include "wincrypt.h" #include "winver.h" #include "winuser.h" -#include "wine/unicode.h" #include "sddl.h" WINE_DEFAULT_DEBUG_CHANNEL(msi); @@ -273,10 +272,10 @@ UINT WINAPI MsiSourceListEnumMediaDisksW(LPCWSTR szProductCodeOrPatchCode, goto done; if (pdwDiskId) - *pdwDiskId = atolW(value); + *pdwDiskId = wcstol(value, NULL, 10); ptr2 = data; - ptr = strchrW(data, ';'); + ptr = wcschr(data, ';'); if (!ptr) ptr = data; else @@ -286,7 +285,7 @@ UINT WINAPI MsiSourceListEnumMediaDisksW(LPCWSTR szProductCodeOrPatchCode, { if (type == REG_DWORD) { - sprintfW(convert, fmt, *data); + swprintf(convert, ARRAY_SIZE(convert), fmt, *data); size = lstrlenW(convert); ptr2 = convert; } @@ -308,7 +307,7 @@ UINT WINAPI MsiSourceListEnumMediaDisksW(LPCWSTR szProductCodeOrPatchCode, if (type == REG_DWORD) { - sprintfW(convert, fmt, *ptr); + swprintf(convert, ARRAY_SIZE(convert), fmt, *ptr); size = lstrlenW(convert); ptr = convert; } @@ -459,7 +458,7 @@ UINT WINAPI MsiSourceListEnumSourcesW(LPCWSTR szProductCodeOrPatch, LPCWSTR szUs goto done; } - sprintfW(name, format, dwIndex + 1); + swprintf(name, ARRAY_SIZE(name), format, dwIndex + 1); res = RegQueryValueExW(subkey, name, 0, 0, (LPBYTE)szSource, pcchSource); if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA) @@ -569,8 +568,8 @@ UINT WINAPI MsiSourceListGetInfoW( LPCWSTR szProduct, LPCWSTR szUserSid, if (rc != ERROR_SUCCESS) return rc; - if (!strcmpW( szProperty, INSTALLPROPERTY_MEDIAPACKAGEPATHW ) || - !strcmpW( szProperty, INSTALLPROPERTY_DISKPROMPTW )) + if (!wcscmp( szProperty, INSTALLPROPERTY_MEDIAPACKAGEPATHW ) || + !wcscmp( szProperty, INSTALLPROPERTY_DISKPROMPTW )) { rc = OpenMediaSubkey(sourcekey, &media, FALSE); if (rc != ERROR_SUCCESS) @@ -579,14 +578,14 @@ UINT WINAPI MsiSourceListGetInfoW( LPCWSTR szProduct, LPCWSTR szUserSid, return ERROR_SUCCESS; } - if (!strcmpW( szProperty, INSTALLPROPERTY_MEDIAPACKAGEPATHW )) + if (!wcscmp( szProperty, INSTALLPROPERTY_MEDIAPACKAGEPATHW )) szProperty = mediapack; RegQueryValueExW(media, szProperty, 0, 0, (LPBYTE)szValue, pcchValue); RegCloseKey(media); } - else if (!strcmpW( szProperty, INSTALLPROPERTY_LASTUSEDSOURCEW ) || - !strcmpW( szProperty, INSTALLPROPERTY_LASTUSEDTYPEW )) + else if (!wcscmp( szProperty, INSTALLPROPERTY_LASTUSEDSOURCEW ) || + !wcscmp( szProperty, INSTALLPROPERTY_LASTUSEDTYPEW )) { rc = RegQueryValueExW(sourcekey, INSTALLPROPERTY_LASTUSEDSOURCEW, 0, 0, NULL, &size); @@ -610,7 +609,7 @@ UINT WINAPI MsiSourceListGetInfoW( LPCWSTR szProduct, LPCWSTR szUserSid, return ERROR_SUCCESS; } - if (!strcmpW( szProperty, INSTALLPROPERTY_LASTUSEDTYPEW )) + if (!wcscmp( szProperty, INSTALLPROPERTY_LASTUSEDTYPEW )) { if (*source != 'n' && *source != 'u' && *source != 'm') { @@ -624,7 +623,7 @@ UINT WINAPI MsiSourceListGetInfoW( LPCWSTR szProduct, LPCWSTR szUserSid, } else { - ptr = strrchrW(source, ';'); + ptr = wcsrchr(source, ';'); if (!ptr) ptr = source; else @@ -633,7 +632,7 @@ UINT WINAPI MsiSourceListGetInfoW( LPCWSTR szProduct, LPCWSTR szUserSid, output_out: if (szValue) { - if (strlenW(ptr) < *pcchValue) + if (lstrlenW(ptr) < *pcchValue) lstrcpyW(szValue, ptr); else rc = ERROR_MORE_DATA; @@ -642,7 +641,7 @@ output_out: *pcchValue = lstrlenW(ptr); msi_free(source); } - else if (!strcmpW( szProperty, INSTALLPROPERTY_PACKAGENAMEW )) + else if (!wcscmp( szProperty, INSTALLPROPERTY_PACKAGENAMEW )) { *pcchValue = *pcchValue * sizeof(WCHAR); rc = RegQueryValueExW(sourcekey, INSTALLPROPERTY_PACKAGENAMEW, 0, 0, @@ -737,8 +736,8 @@ UINT msi_set_last_used_source(LPCWSTR product, LPCWSTR usersid, return r; } - size = (lstrlenW(format) + lstrlenW(value) + 7) * sizeof(WCHAR); - buffer = msi_alloc(size); + size = lstrlenW(format) + lstrlenW(value) + 7; + buffer = msi_alloc(size * sizeof(WCHAR)); if (!buffer) return ERROR_OUTOFMEMORY; @@ -749,7 +748,7 @@ UINT msi_set_last_used_source(LPCWSTR product, LPCWSTR usersid, return r; } - sprintfW(buffer, format, typechar, index, value); + swprintf(buffer, size, format, typechar, index, value); size = (lstrlenW(buffer) + 1) * sizeof(WCHAR); r = RegSetValueExW(source, INSTALLPROPERTY_LASTUSEDSOURCEW, 0, @@ -795,22 +794,22 @@ UINT WINAPI MsiSourceListSetInfoW( LPCWSTR szProduct, LPCWSTR szUserSid, } property = szProperty; - if (!strcmpW( szProperty, INSTALLPROPERTY_MEDIAPACKAGEPATHW )) + if (!wcscmp( szProperty, INSTALLPROPERTY_MEDIAPACKAGEPATHW )) property = media_package; rc = OpenSourceKey(szProduct, &sourcekey, MSICODE_PRODUCT, dwContext, FALSE); if (rc != ERROR_SUCCESS) return rc; - if (strcmpW( szProperty, INSTALLPROPERTY_LASTUSEDSOURCEW ) && + if (wcscmp( szProperty, INSTALLPROPERTY_LASTUSEDSOURCEW ) && dwOptions & (MSISOURCETYPE_NETWORK | MSISOURCETYPE_URL)) { RegCloseKey(sourcekey); return ERROR_INVALID_PARAMETER; } - if (!strcmpW( szProperty, INSTALLPROPERTY_MEDIAPACKAGEPATHW ) || - !strcmpW( szProperty, INSTALLPROPERTY_DISKPROMPTW )) + if (!wcscmp( szProperty, INSTALLPROPERTY_MEDIAPACKAGEPATHW ) || + !wcscmp( szProperty, INSTALLPROPERTY_DISKPROMPTW )) { rc = OpenMediaSubkey(sourcekey, &media, TRUE); if (rc == ERROR_SUCCESS) @@ -819,7 +818,7 @@ UINT WINAPI MsiSourceListSetInfoW( LPCWSTR szProduct, LPCWSTR szUserSid, RegCloseKey(media); } } - else if (!strcmpW( szProperty, INSTALLPROPERTY_PACKAGENAMEW )) + else if (!wcscmp( szProperty, INSTALLPROPERTY_PACKAGENAMEW )) { DWORD size = (lstrlenW(szValue) + 1) * sizeof(WCHAR); rc = RegSetValueExW(sourcekey, INSTALLPROPERTY_PACKAGENAMEW, 0, @@ -827,7 +826,7 @@ UINT WINAPI MsiSourceListSetInfoW( LPCWSTR szProduct, LPCWSTR szUserSid, if (rc != ERROR_SUCCESS) rc = ERROR_UNKNOWN_PROPERTY; } - else if (!strcmpW( szProperty, INSTALLPROPERTY_LASTUSEDSOURCEW )) + else if (!wcscmp( szProperty, INSTALLPROPERTY_LASTUSEDSOURCEW )) { if (!(dwOptions & (MSISOURCETYPE_NETWORK | MSISOURCETYPE_URL))) rc = ERROR_INVALID_PARAMETER; @@ -989,7 +988,7 @@ static void add_source_to_list(struct list *sourcelist, media_info *info, /* update the rest of the list */ if (found) - sprintfW(iter->szIndex, fmt, ++iter->index); + swprintf(iter->szIndex, ARRAY_SIZE(iter->szIndex), fmt, ++iter->index); else if (index) (*index)++; } @@ -1027,7 +1026,7 @@ static UINT fill_source_list(struct list *sourcelist, HKEY sourcekey, DWORD *cou } lstrcpyW(entry->szIndex, name); - entry->index = atoiW(name); + entry->index = wcstol(name, NULL, 10); size++; r = RegEnumValueW(sourcekey, index, name, &size, NULL, @@ -1134,13 +1133,13 @@ UINT WINAPI MsiSourceListAddSourceExW( LPCWSTR szProduct, LPCWSTR szUserSid, } else if (dwIndex > count || dwIndex == 0) { - sprintfW(name, fmt, count + 1); + swprintf(name, ARRAY_SIZE(name), fmt, count + 1); rc = RegSetValueExW(typekey, name, 0, REG_EXPAND_SZ, (LPBYTE)source, size); goto done; } else { - sprintfW(name, fmt, dwIndex); + swprintf(name, ARRAY_SIZE(name), fmt, dwIndex); info = msi_alloc(sizeof(media_info)); if (!info) { @@ -1244,7 +1243,7 @@ UINT WINAPI MsiSourceListAddMediaDiskW(LPCWSTR szProduct, LPCWSTR szUserSid, OpenMediaSubkey(sourcekey, &mediakey, TRUE); - sprintfW(szIndex, fmt, dwDiskId); + swprintf(szIndex, ARRAY_SIZE(szIndex), fmt, dwDiskId); size = 2; if (szVolumeLabel) size += lstrlenW(szVolumeLabel); diff --git a/dll/win32/msi/sql.y b/dll/win32/msi/sql.y index 2101c680eb3..50092abacf9 100644 --- a/dll/win32/msi/sql.y +++ b/dll/win32/msi/sql.y @@ -20,9 +20,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ - -#include "config.h" - #include #include #include @@ -32,7 +29,6 @@ #include "query.h" #include "wine/list.h" #include "wine/debug.h" -#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(msi); @@ -746,15 +742,15 @@ number: static LPWSTR parser_add_table( void *info, LPCWSTR list, LPCWSTR table ) { static const WCHAR space[] = {' ',0}; - DWORD len = strlenW( list ) + strlenW( table ) + 2; + DWORD len = lstrlenW( list ) + lstrlenW( table ) + 2; LPWSTR ret; ret = parser_alloc( info, len * sizeof(WCHAR) ); if( ret ) { - strcpyW( ret, list ); - strcatW( ret, space ); - strcatW( ret, table ); + lstrcpyW( ret, list ); + lstrcatW( ret, space ); + lstrcatW( ret, table ); } return ret; } @@ -978,7 +974,7 @@ static BOOL SQL_MarkPrimaryKeys( column_info **cols, found = FALSE; for( c = *cols, idx = 0; c && !found; c = c->next, idx++ ) { - if( strcmpW( k->column, c->column ) ) + if( wcscmp( k->column, c->column ) ) continue; c->type |= MSITYPE_KEY; found = TRUE; diff --git a/dll/win32/msi/streams.c b/dll/win32/msi/streams.c index 777eb98cffa..6f8a436b5e4 100644 --- a/dll/win32/msi/streams.c +++ b/dll/win32/msi/streams.c @@ -33,7 +33,6 @@ #include "query.h" #include "wine/debug.h" -#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(msidb); @@ -615,7 +614,7 @@ UINT msi_commit_streams( MSIDATABASE *db ) for (i = 0; i < db->num_streams; i++) { name = msi_string_lookup( db->strings, db->streams[i].str_index, NULL ); - if (!strcmpW( name, szSumInfo )) continue; + if (!wcscmp( name, szSumInfo )) continue; if (!(encname = encode_streamname( FALSE, name ))) return ERROR_OUTOFMEMORY; TRACE("saving stream %s as %s\n", debugstr_w(name), debugstr_w(encname)); diff --git a/dll/win32/msi/string.c b/dll/win32/msi/string.c index 9dec32d73fe..5c6432ba1ed 100644 --- a/dll/win32/msi/string.c +++ b/dll/win32/msi/string.c @@ -29,7 +29,6 @@ #include "winbase.h" #include "winerror.h" #include "wine/debug.h" -#include "wine/unicode.h" #include "msi.h" #include "msiquery.h" #include "objbase.h" @@ -311,7 +310,7 @@ int msi_add_string( string_table *st, const WCHAR *data, int len, BOOL persisten if( !data ) return 0; - if (len < 0) len = strlenW( data ); + if (len < 0) len = lstrlenW( data ); if( !data[0] && !len ) return 0; @@ -404,7 +403,7 @@ UINT msi_string2id( const string_table *st, const WCHAR *str, int len, UINT *id { int i, c, low = 0, high = st->sortcount - 1; - if (len < 0) len = strlenW( str ); + if (len < 0) len = lstrlenW( str ); while (low <= high) { diff --git a/dll/win32/msi/suminfo.c b/dll/win32/msi/suminfo.c index d590ad46f68..666bb1ea1ae 100644 --- a/dll/win32/msi/suminfo.c +++ b/dll/win32/msi/suminfo.c @@ -31,7 +31,6 @@ #include "shlwapi.h" #include "wine/debug.h" #include "wine/exception.h" -#include "wine/unicode.h" #include "msi.h" #include "msiquery.h" #include "msidefs.h" @@ -999,31 +998,31 @@ static void parse_filetime( LPCWSTR str, FILETIME *ft ) /* YYYY/MM/DD hh:mm:ss */ - while (isspaceW( *p )) p++; + while (iswspace( *p )) p++; - lt.wYear = strtolW( p, &end, 10 ); + lt.wYear = wcstol( p, &end, 10 ); if (*end != '/') return; p = end + 1; - lt.wMonth = strtolW( p, &end, 10 ); + lt.wMonth = wcstol( p, &end, 10 ); if (*end != '/') return; p = end + 1; - lt.wDay = strtolW( p, &end, 10 ); + lt.wDay = wcstol( p, &end, 10 ); if (*end != ' ') return; p = end + 1; - while (isspaceW( *p )) p++; + while (iswspace( *p )) p++; - lt.wHour = strtolW( p, &end, 10 ); + lt.wHour = wcstol( p, &end, 10 ); if (*end != ':') return; p = end + 1; - lt.wMinute = strtolW( p, &end, 10 ); + lt.wMinute = wcstol( p, &end, 10 ); if (*end != ':') return; p = end + 1; - lt.wSecond = strtolW( p, &end, 10 ); + lt.wSecond = wcstol( p, &end, 10 ); TzSpecificLocalTimeToSystemTime( NULL, <, &utc ); SystemTimeToFileTime( &utc, ft ); @@ -1032,7 +1031,7 @@ static void parse_filetime( LPCWSTR str, FILETIME *ft ) static UINT parse_prop( LPCWSTR prop, LPCWSTR value, UINT *pid, INT *int_value, FILETIME *ft_value, awcstring *str_value ) { - *pid = atoiW( prop ); + *pid = wcstol( prop, NULL, 10); switch (*pid) { #ifdef __REACTOS__ @@ -1048,7 +1047,7 @@ static UINT parse_prop( LPCWSTR prop, LPCWSTR value, UINT *pid, INT *int_value, case PID_SECURITY: #endif case PID_PAGECOUNT: - *int_value = atoiW( value ); + *int_value = wcstol( value, NULL, 10); break; case PID_LASTPRINTED: diff --git a/dll/win32/msi/table.c b/dll/win32/msi/table.c index 57114baa749..c0ffa99e1d6 100644 --- a/dll/win32/msi/table.c +++ b/dll/win32/msi/table.c @@ -35,7 +35,6 @@ #include "query.h" #include "wine/debug.h" -#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(msidb); @@ -493,7 +492,7 @@ static MSITABLE *find_cached_table( MSIDATABASE *db, LPCWSTR name ) MSITABLE *t; LIST_FOR_EACH_ENTRY( t, &db->tables, MSITABLE, entry ) - if( !strcmpW( name, t->name ) ) + if( !wcscmp( name, t->name ) ) return t; return NULL; @@ -523,12 +522,12 @@ static UINT get_defaulttablecolumns( MSIDATABASE *db, LPCWSTR name, MSICOLUMNINF TRACE("%s\n", debugstr_w(name)); - if (!strcmpW( name, szTables )) + if (!wcscmp( name, szTables )) { p = _Tables_cols; n = 1; } - else if (!strcmpW( name, szColumns )) + else if (!wcscmp( name, szColumns )) { p = _Columns_cols; n = 4; @@ -606,7 +605,7 @@ static UINT get_table( MSIDATABASE *db, LPCWSTR name, MSITABLE **table_ret ) table->persistent = MSICONDITION_TRUE; lstrcpyW( table->name, name ); - if (!strcmpW( name, szTables ) || !strcmpW( name, szColumns )) + if (!wcscmp( name, szTables ) || !wcscmp( name, szColumns )) table->persistent = MSICONDITION_NONE; r = table_get_column_info( db, name, &table->colinfo, &table->col_count ); @@ -972,8 +971,8 @@ BOOL TABLE_Exists( MSIDATABASE *db, LPCWSTR name ) UINT r, table_id, i; MSITABLE *table; - if( !strcmpW( name, szTables ) || !strcmpW( name, szColumns ) || - !strcmpW( name, szStreams ) || !strcmpW( name, szStorages ) ) + if( !wcscmp( name, szTables ) || !wcscmp( name, szColumns ) || + !wcscmp( name, szStreams ) || !wcscmp( name, szStorages ) ) return TRUE; r = msi_string2id( db->strings, name, -1, &table_id ); @@ -1097,10 +1096,10 @@ static UINT get_stream_name( const MSITABLEVIEW *tv, UINT row, WCHAR **pstname ) switch( n ) { case 2: - sprintfW( number, fmt, ival-0x8000 ); + swprintf( number, ARRAY_SIZE(number), fmt, ival-0x8000 ); break; case 4: - sprintfW( number, fmt, ival^0x80000000 ); + swprintf( number, ARRAY_SIZE(number), fmt, ival^0x80000000 ); break; default: ERR( "oops - unknown column width %d\n", n ); @@ -2063,7 +2062,7 @@ static UINT TABLE_add_column(struct tagMSIVIEW *view, LPCWSTR table, UINT number msitable = find_cached_table(tv->db, table); for (i = 0; i < msitable->col_count; i++) { - if (!strcmpW( msitable->colinfo[i].colname, column )) + if (!wcscmp( msitable->colinfo[i].colname, column )) { InterlockedIncrement(&msitable->colinfo[i].ref_count); break; @@ -2154,9 +2153,9 @@ UINT TABLE_CreateView( MSIDATABASE *db, LPCWSTR name, MSIVIEW **view ) TRACE("%p %s %p\n", db, debugstr_w(name), view ); - if ( !strcmpW( name, szStreams ) ) + if ( !wcscmp( name, szStreams ) ) return STREAMS_CreateView( db, view ); - else if ( !strcmpW( name, szStorages ) ) + else if ( !wcscmp( name, szStorages ) ) return STORAGES_CreateView( db, view ); sz = FIELD_OFFSET( MSITABLEVIEW, name[lstrlenW( name ) + 1] ); @@ -2615,7 +2614,7 @@ static UINT msi_table_load_transform( MSIDATABASE *db, IStorage *stg, UINT number = MSI_NULL_INTEGER; UINT row = 0; - if (!strcmpW( name, szColumns )) + if (!wcscmp( name, szColumns )) { MSI_RecordGetStringW( rec, 1, table, &sz ); number = MSI_RecordGetInteger( rec, 2 ); @@ -2627,7 +2626,7 @@ static UINT msi_table_load_transform( MSIDATABASE *db, IStorage *stg, if ( number == MSI_NULL_INTEGER ) { /* reset the column number on a new table */ - if (strcmpW( coltable, table )) + if (wcscmp( coltable, table )) { colcol = 0; lstrcpyW( coltable, table ); @@ -2673,7 +2672,7 @@ static UINT msi_table_load_transform( MSIDATABASE *db, IStorage *stg, WARN("failed to insert row %u\n", r); } - if (!strcmpW( name, szColumns )) + if (!wcscmp( name, szColumns )) msi_update_table_columns( db, table ); msiobj_release( &rec->hdr ); @@ -2736,8 +2735,8 @@ UINT msi_table_apply_transform( MSIDATABASE *db, IStorage *stg ) if ( name[0] != 0x4840 ) continue; - if ( !strcmpW( name+1, szStringPool ) || - !strcmpW( name+1, szStringData ) ) + if ( !wcscmp( name+1, szStringPool ) || + !wcscmp( name+1, szStringData ) ) continue; transform = msi_alloc_zero( sizeof(TRANSFORMDATA) ); @@ -2748,11 +2747,11 @@ UINT msi_table_apply_transform( MSIDATABASE *db, IStorage *stg ) transform->name = strdupW( name + 1 ); - if ( !strcmpW( transform->name, szTables ) ) + if ( !wcscmp( transform->name, szTables ) ) tables = transform; - else if (!strcmpW( transform->name, szColumns ) ) + else if (!wcscmp( transform->name, szColumns ) ) columns = transform; - else if (!strcmpW( transform->name, szProperty )) + else if (!wcscmp( transform->name, szProperty )) property_update = TRUE; TRACE("transform contains stream %s\n", debugstr_w(name)); @@ -2788,8 +2787,8 @@ UINT msi_table_apply_transform( MSIDATABASE *db, IStorage *stg ) { transform = LIST_ENTRY( list_head( &transforms ), TRANSFORMDATA, entry ); - if ( strcmpW( transform->name, szColumns ) && - strcmpW( transform->name, szTables ) && + if ( wcscmp( transform->name, szColumns ) && + wcscmp( transform->name, szTables ) && ret == ERROR_SUCCESS ) { ret = msi_table_load_transform( db, stg, strings, transform, bytes_per_strref ); diff --git a/dll/win32/msi/tokenize.c b/dll/win32/msi/tokenize.c index e429495ae17..4ebc9b81fb4 100644 --- a/dll/win32/msi/tokenize.c +++ b/dll/win32/msi/tokenize.c @@ -22,7 +22,6 @@ #include "windef.h" #include "winbase.h" -#include "wine/unicode.h" #include "query.h" #include "sql.tab.h" @@ -124,11 +123,11 @@ static const Keyword aKeywordTable[] = { /* ** Comparison function for binary search. */ -static int compKeyword(const void *m1, const void *m2){ +static int __cdecl compKeyword(const void *m1, const void *m2){ const Keyword *k1 = m1, *k2 = m2; int ret, len = min( k1->len, k2->len ); - if ((ret = strncmpiW( k1->name, k2->name, len ))) return ret; + if ((ret = wcsnicmp( k1->name, k2->name, len ))) return ret; if (k1->len < k2->len) return -1; else if (k1->len > k2->len) return 1; return 0; diff --git a/dll/win32/msi/upgrade.c b/dll/win32/msi/upgrade.c index 034d891c1f9..60b5c74f40b 100644 --- a/dll/win32/msi/upgrade.c +++ b/dll/win32/msi/upgrade.c @@ -36,7 +36,6 @@ #include "msidefs.h" #include "msipriv.h" #include "winuser.h" -#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(msi); @@ -47,7 +46,7 @@ static BOOL check_language(DWORD lang1, LPCWSTR lang2, DWORD attributes) if (!lang2 || lang2[0]==0) return TRUE; - langdword = atoiW(lang2); + langdword = wcstol(lang2, NULL, 10); if (attributes & msidbUpgradeAttributesLanguagesExclusive) return (lang1 != langdword); @@ -68,7 +67,7 @@ static BOOL find_product( const WCHAR *list, const WCHAR *product ) while (*q && *q != '}') q++; if (*q != '}') return FALSE; q++; - if (q - p < strlenW( product )) return FALSE; + if (q - p < lstrlenW( product )) return FALSE; if (!memcmp( p, product, (q - p) * sizeof(WCHAR) )) return TRUE; p = q + 1; while (*p && *p != ';') p++; @@ -92,19 +91,19 @@ static void append_productcode( MSIPACKAGE *package, const WCHAR *action_prop, c return; } - if (prop) len += strlenW( prop ); - len += strlenW( product ) + 2; + if (prop) len += lstrlenW( prop ); + len += lstrlenW( product ) + 2; if (!(newprop = msi_alloc( len * sizeof(WCHAR) ))) return; if (prop) { - strcpyW( newprop, prop ); - strcatW( newprop, szSemiColon ); + lstrcpyW( newprop, prop ); + lstrcatW( newprop, szSemiColon ); } else newprop[0] = 0; - strcatW( newprop, product ); + lstrcatW( newprop, product ); r = msi_set_property( package->db, action_prop, newprop, -1 ); - if (r == ERROR_SUCCESS && !strcmpW( action_prop, szSourceDir )) + if (r == ERROR_SUCCESS && !wcscmp( action_prop, szSourceDir )) msi_reset_source_folders( package ); TRACE( "related product property %s now %s\n", debugstr_w(action_prop), debugstr_w(newprop) ); diff --git a/dll/win32/msi/where.c b/dll/win32/msi/where.c index 66de85bec94..07064f0f980 100644 --- a/dll/win32/msi/where.c +++ b/dll/win32/msi/where.c @@ -26,7 +26,6 @@ #include "winbase.h" #include "winerror.h" #include "wine/debug.h" -#include "wine/unicode.h" #include "msi.h" #include "msiquery.h" #include "objbase.h" @@ -187,7 +186,7 @@ static UINT parse_column(MSIWHEREVIEW *wv, union ext_column *column, NULL, &table_name); if (r != ERROR_SUCCESS) return r; - if (strcmpW(table_name, column->unparsed.table) != 0) + if (wcscmp(table_name, column->unparsed.table) != 0) continue; } @@ -200,7 +199,7 @@ static UINT parse_column(MSIWHEREVIEW *wv, union ext_column *column, if(r != ERROR_SUCCESS ) return r; - if(strcmpW(col_name, column->unparsed.column)) + if(wcscmp(col_name, column->unparsed.column)) continue; column->parsed.column = i; column->parsed.table = table; @@ -587,7 +586,7 @@ static UINT STRCMP_Evaluate( MSIWHEREVIEW *wv, const UINT rows[], const struct c else if( r_str && ! l_str ) sr = -1; else - sr = strcmpW( l_str, r_str ); + sr = wcscmp( l_str, r_str ); *val = ( expr->op == OP_EQ && ( sr == 0 ) ) || ( expr->op == OP_NE && ( sr != 0 ) ); @@ -682,7 +681,7 @@ static UINT check_condition( MSIWHEREVIEW *wv, MSIRECORD *record, JOINTABLE **ta return r; } -static int compare_entry( const void *left, const void *right ) +static int __cdecl compare_entry( const void *left, const void *right ) { const MSIROWENTRY *le = *(const MSIROWENTRY**)left; const MSIROWENTRY *re = *(const MSIROWENTRY**)right; @@ -1247,7 +1246,7 @@ UINT WHERE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPWSTR tables, { JOINTABLE *table; - if ((ptr = strchrW(tables, ' '))) + if ((ptr = wcschr(tables, ' '))) *ptr = '\0'; table = msi_alloc(sizeof(JOINTABLE));