diff --git a/reactos/lib/msi/helpers.c b/reactos/lib/msi/helpers.c index a47766b8a58..a2bfb0d7d67 100644 --- a/reactos/lib/msi/helpers.c +++ b/reactos/lib/msi/helpers.c @@ -221,40 +221,42 @@ LPWSTR resolve_folder(MSIPACKAGE *package, LPCWSTR name, BOOL source, if (!name) return NULL; + /* source directories appear to always be at the root */ + if (source) + { + path = msi_dup_property( package, cszSourceDir ); + if (!path) + { + path = msi_dup_property( package, cszDatabase ); + if (path) + { + p = strrchrW(path,'\\'); + if (p) + *(p+1) = 0; + } + } + if (folder) + *folder = get_loaded_folder( package, name ); + return path; + } + /* special resolving for Target and Source root dir */ if (strcmpW(name,cszTargetDir)==0 || strcmpW(name,cszSourceDir)==0) { - if (!source) + LPWSTR check_path; + check_path = msi_dup_property( package, cszTargetDir ); + if (!check_path) { - LPWSTR check_path; - check_path = msi_dup_property( package, cszTargetDir ); - if (!check_path) - { - check_path = msi_dup_property( package, cszRootDrive ); - if (set_prop) - MSI_SetPropertyW(package,cszTargetDir,check_path); - } + check_path = msi_dup_property( package, cszRootDrive ); + if (set_prop) + MSI_SetPropertyW(package,cszTargetDir,check_path); + } - /* correct misbuilt target dir */ - path = build_directory_name(2, check_path, NULL); - if (strcmpiW(path,check_path)!=0) - MSI_SetPropertyW(package,cszTargetDir,path); - msi_free(check_path); - } - else - { - path = msi_dup_property( package, cszSourceDir ); - if (!path) - { - path = msi_dup_property( package, cszDatabase ); - if (path) - { - p = strrchrW(path,'\\'); - if (p) - *(p+1) = 0; - } - } - } + /* correct misbuilt target dir */ + path = build_directory_name(2, check_path, NULL); + if (strcmpiW(path,check_path)!=0) + MSI_SetPropertyW(package,cszTargetDir,path); + msi_free(check_path); if (folder) *folder = get_loaded_folder( package, name ); return path; @@ -267,19 +269,13 @@ LPWSTR resolve_folder(MSIPACKAGE *package, LPCWSTR name, BOOL source, if (folder) *folder = f; - if (!source && f->ResolvedTarget) + if (f->ResolvedTarget) { path = strdupW( f->ResolvedTarget ); TRACE(" already resolved to %s\n",debugstr_w(path)); return path; } - else if (source && f->ResolvedSource) - { - path = strdupW( f->ResolvedSource ); - TRACE(" (source)already resolved to %s\n",debugstr_w(path)); - return path; - } - else if (!source && f->Property) + else if (f->Property) { path = build_directory_name( 2, f->Property, NULL ); @@ -296,25 +292,13 @@ LPWSTR resolve_folder(MSIPACKAGE *package, LPCWSTR name, BOOL source, TRACE(" ! Parent is %s\n", debugstr_w(parent)); p = resolve_folder(package, parent, source, set_prop, NULL); - if (!source) - { - TRACE(" TargetDefault = %s\n", debugstr_w(f->TargetDefault)); + TRACE(" TargetDefault = %s\n", debugstr_w(f->TargetDefault)); - path = build_directory_name( 3, p, f->TargetDefault, NULL ); - f->ResolvedTarget = strdupW( path ); - TRACE(" resolved into %s\n",debugstr_w(path)); - if (set_prop) - MSI_SetPropertyW(package,name,path); - } - else - { - if (f->SourceDefault && f->SourceDefault[0]!='.') - path = build_directory_name( 3, p, f->SourceDefault, NULL ); - else - path = strdupW(p); - TRACE(" (source)resolved into %s\n",debugstr_w(path)); - f->ResolvedSource = strdupW( path ); - } + path = build_directory_name( 3, p, f->TargetDefault, NULL ); + f->ResolvedTarget = strdupW( path ); + TRACE(" resolved into %s\n",debugstr_w(path)); + if (set_prop) + MSI_SetPropertyW(package,name,path); msi_free(p); } return path; diff --git a/reactos/lib/msi/msi_Ko.rc b/reactos/lib/msi/msi_Ko.rc index 0eabd0453b2..fb4be6bc672 100644 --- a/reactos/lib/msi/msi_Ko.rc +++ b/reactos/lib/msi/msi_Ko.rc @@ -22,12 +22,12 @@ LANGUAGE LANG_KOREAN, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE { - 5 "path %s not found" + 5 "%s °æ·Î¸¦ ãÀ»¼ö ¾ø½À´Ï´Ù" 9 "µð½ºÅ© %s »ðÀÔ" 10 "Àý¸øµÈ ¸Å°³º¯¼ö" - 11 "enter which folder contains %s" - 12 "install source for feature missing" - 13 "network drive for feature missing" - 14 "feature from:" - 15 "choose which folder contains %s" + 11 "%s¸¦ Æ÷ÇÔÇÏ´Â Æú´õ¸¦ ÀÔ·ÂÇϼ¼¿©" + 12 "ºüÁø ºÎºÐ(feature)À» À§ÇÑ ¼³Ä¡ ¿øº»" + 13 "ºüÁø ºÎºÐ(feature)À» À§ÇÑ ³×Æ®¿öÅ© µå¶óÀ̺ê" + 14 "ºÎºÐ(feature)¿¡¼­:" + 15 " %s¸¦ Æ÷ÇÔÇÏ´Â Æú´õ ¼±ÅÃ" } diff --git a/reactos/lib/msi/registry.c b/reactos/lib/msi/registry.c index 941608c2f3d..3af662b5ae4 100644 --- a/reactos/lib/msi/registry.c +++ b/reactos/lib/msi/registry.c @@ -773,7 +773,7 @@ UINT WINAPI MSI_EnumComponentQualifiers( LPCWSTR szComponent, DWORD iIndex, awstring *lpQualBuf, DWORD* pcchQual, awstring *lpAppBuf, DWORD* pcchAppBuf ) { - DWORD name_sz, val_sz, type, ofs; + DWORD name_sz, val_sz, name_max, val_max, type, ofs; LPWSTR name = NULL, val = NULL; UINT r, r2; HKEY key; @@ -789,40 +789,57 @@ UINT WINAPI MSI_EnumComponentQualifiers( LPCWSTR szComponent, DWORD iIndex, return ERROR_UNKNOWN_COMPONENT; /* figure out how big the name is we want to return */ - name_sz = 0; - if (pcchQual) - { - r = ERROR_OUTOFMEMORY; - name_sz = *pcchQual * 4; - name = msi_alloc( name_sz * sizeof(WCHAR) ); - if (!name) - goto end; - } - - /* figure out how big the value is */ - type = 0; - val_sz = 0; - r = RegEnumValueW( key, iIndex, NULL, NULL, - NULL, &type, NULL, &val_sz ); - if (r != ERROR_SUCCESS) + name_max = 0x10; + r = ERROR_OUTOFMEMORY; + name = msi_alloc( name_max * sizeof(WCHAR) ); + if (!name) goto end; - if (type != REG_MULTI_SZ) - { - ERR("component data has wrong type (%ld)\n", type); - goto end; - } - - /* the value size is in bytes */ - val_sz += sizeof(WCHAR); - val = msi_alloc( val_sz ); + val_max = 0x10; + r = ERROR_OUTOFMEMORY; + val = msi_alloc( val_max ); if (!val) goto end; - r = RegEnumValueW( key, iIndex, name, &name_sz, - NULL, &type, (LPBYTE)val, &val_sz ); - if (r != ERROR_SUCCESS) + /* loop until we allocate enough memory */ + while (1) + { + name_sz = name_max; + val_sz = val_max; + r = RegEnumValueW( key, iIndex, name, &name_sz, + NULL, &type, (LPBYTE)val, &val_sz ); + if (r == ERROR_SUCCESS) + break; + if (r != ERROR_MORE_DATA) + goto end; + + if (type != REG_MULTI_SZ) + { + ERR("component data has wrong type (%ld)\n", type); + goto end; + } + + r = ERROR_OUTOFMEMORY; + if ((name_sz+1) >= name_max) + { + name_max *= 2; + msi_free( name ); + name = msi_alloc( name_max * sizeof (WCHAR) ); + if (!name) + goto end; + continue; + } + if (val_sz > val_max) + { + val_max = val_sz + sizeof (WCHAR); + val = msi_alloc( val_max * sizeof (WCHAR) ); + if (!val) + goto end; + continue; + } + ERR("should be enough data, but isn't %ld %ld\n", name_sz, val_sz ); goto end; + } ofs = 0; r = MsiDecomposeDescriptorW( val, NULL, NULL, NULL, &ofs );