Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
d7bbe884
Commit
d7bbe884
authored
Mar 02, 2024
by
Zebediah Figura
Committed by
Alexandre Julliard
Mar 04, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Store component cost in 512-byte units.
This avoids overflow when component costs exceed 4 GB.
parent
9725a228
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
14 deletions
+14
-14
action.c
dlls/msi/action.c
+7
-7
install.c
dlls/msi/install.c
+1
-2
msi.c
dlls/msi/msi.c
+2
-2
msipriv.h
dlls/msi/msipriv.h
+2
-1
package.c
dlls/msi/tests/package.c
+2
-2
No files found.
dlls/msi/action.c
View file @
d7bbe884
...
...
@@ -2070,7 +2070,7 @@ static UINT calculate_file_cost( MSIPACKAGE *package )
if
(
msi_get_file_attributes
(
package
,
file
->
TargetPath
)
==
INVALID_FILE_ATTRIBUTES
)
{
comp
->
Cost
+=
file
->
FileSize
;
comp
->
cost
+=
cost_from_size
(
file
->
FileSize
)
;
continue
;
}
file_size
=
msi_get_disk_file_size
(
package
,
file
->
TargetPath
);
...
...
@@ -2082,7 +2082,7 @@ static UINT calculate_file_cost( MSIPACKAGE *package )
{
if
(
msi_compare_file_versions
(
file_version
,
file
->
Version
)
<
0
)
{
comp
->
Cost
+=
file
->
FileSize
-
file_size
;
comp
->
cost
+=
cost_from_size
(
file
->
FileSize
-
file_size
)
;
}
free
(
file_version
);
continue
;
...
...
@@ -2091,7 +2091,7 @@ static UINT calculate_file_cost( MSIPACKAGE *package )
{
if
(
msi_compare_font_versions
(
font_version
,
file
->
Version
)
<
0
)
{
comp
->
Cost
+=
file
->
FileSize
-
file_size
;
comp
->
cost
+=
cost_from_size
(
file
->
FileSize
-
file_size
)
;
}
free
(
font_version
);
continue
;
...
...
@@ -2099,7 +2099,7 @@ static UINT calculate_file_cost( MSIPACKAGE *package )
}
if
(
file_size
!=
file
->
FileSize
)
{
comp
->
Cost
+=
file
->
FileSize
-
file_size
;
comp
->
cost
+=
cost_from_size
(
file
->
FileSize
-
file_size
)
;
}
}
...
...
@@ -2217,7 +2217,7 @@ static ULONGLONG get_volume_space_required( MSIPACKAGE *package )
LIST_FOR_EACH_ENTRY
(
comp
,
&
package
->
components
,
MSICOMPONENT
,
entry
)
{
if
(
comp
->
Action
==
INSTALLSTATE_LOCAL
)
ret
+=
comp
->
C
ost
;
if
(
comp
->
Action
==
INSTALLSTATE_LOCAL
)
ret
+=
comp
->
c
ost
;
}
return
ret
;
}
...
...
@@ -2292,10 +2292,10 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package)
msi_set_property
(
package
->
db
,
L"PrimaryVolumeSpaceAvailable"
,
buf
,
-
1
);
}
required
=
get_volume_space_required
(
package
);
swprintf
(
buf
,
ARRAY_SIZE
(
buf
),
L"%lu"
,
required
/
512
);
swprintf
(
buf
,
ARRAY_SIZE
(
buf
),
L"%lu"
,
required
);
msi_set_property
(
package
->
db
,
L"PrimaryVolumeSpaceRequired"
,
buf
,
-
1
);
swprintf
(
buf
,
ARRAY_SIZE
(
buf
),
L"%lu"
,
(
free
.
QuadPart
-
required
)
/
512
);
swprintf
(
buf
,
ARRAY_SIZE
(
buf
),
L"%lu"
,
(
free
.
QuadPart
/
512
)
-
required
);
msi_set_property
(
package
->
db
,
L"PrimaryVolumeSpaceRemaining"
,
buf
,
-
1
);
msi_set_property
(
package
->
db
,
L"PrimaryVolumePath"
,
primary_folder
,
2
);
}
...
...
dlls/msi/install.c
View file @
d7bbe884
...
...
@@ -1147,7 +1147,7 @@ static INT feature_cost( MSIFEATURE *feature )
LIST_FOR_EACH_ENTRY
(
cl
,
&
feature
->
Components
,
ComponentList
,
entry
)
{
cost
+=
cl
->
component
->
C
ost
;
cost
+=
cl
->
component
->
c
ost
;
}
return
cost
;
}
...
...
@@ -1197,7 +1197,6 @@ UINT MSI_GetFeatureCost( MSIPACKAGE *package, MSIFEATURE *feature, MSICOSTTREE t
break
;
}
*
cost
/=
512
;
return
ERROR_SUCCESS
;
}
...
...
dlls/msi/msi.c
View file @
d7bbe884
...
...
@@ -2028,7 +2028,7 @@ UINT WINAPI MsiEnumComponentCostsW( MSIHANDLE handle, const WCHAR *component, DW
GetWindowsDirectoryW
(
path
,
MAX_PATH
);
if
(
component
&&
component
[
0
])
{
if
(
msi_is_global_assembly
(
comp
))
*
temp
=
comp
->
C
ost
;
if
(
msi_is_global_assembly
(
comp
))
*
temp
=
comp
->
c
ost
;
if
(
!
comp
->
Enabled
||
!
comp
->
KeyPath
)
{
*
cost
=
0
;
...
...
@@ -2037,7 +2037,7 @@ UINT WINAPI MsiEnumComponentCostsW( MSIHANDLE handle, const WCHAR *component, DW
}
else
if
((
file
=
msi_get_loaded_file
(
package
,
comp
->
KeyPath
)))
{
*
cost
=
co
st_from_size
(
comp
->
Cost
)
;
*
cost
=
co
mp
->
cost
;
*
buflen
=
set_drive
(
drive
,
file
->
TargetPath
[
0
]
);
r
=
ERROR_SUCCESS
;
}
...
...
dlls/msi/msipriv.h
View file @
d7bbe884
...
...
@@ -532,7 +532,8 @@ typedef struct tagMSICOMPONENT
INSTALLSTATE
Action
;
BOOL
ForceLocalState
;
BOOL
Enabled
;
INT
Cost
;
/* Cost is in 512-byte units, as returned from MsiEnumComponentCosts() et al. */
int
cost
;
INT
RefCount
;
LPWSTR
FullKeypath
;
LPWSTR
AdvertiseString
;
...
...
dlls/msi/tests/package.c
View file @
d7bbe884
...
...
@@ -8607,7 +8607,7 @@ static void test_costs(void)
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %u
\n
"
,
r
);
ok
(
len
==
2
,
"expected len == 2, got %lu
\n
"
,
len
);
ok
(
drive
[
0
],
"expected a drive
\n
"
);
todo_wine
ok
(
cost
==
12000024
,
"got %d
\n
"
,
cost
);
ok
(
cost
==
12000024
,
"got %d
\n
"
,
cost
);
ok
(
!
temp
,
"expected temp == 0, got %d
\n
"
,
temp
);
len
=
sizeof
(
drive
);
...
...
@@ -8651,7 +8651,7 @@ static void test_costs(void)
cost
=
0xdead
;
r
=
MsiGetFeatureCostA
(
hpkg
,
"one"
,
MSICOSTTREE_SELFONLY
,
INSTALLSTATE_LOCAL
,
&
cost
);
ok
(
!
r
,
"got %u
\n
"
,
r
);
todo_wine
ok
(
cost
==
12000024
,
"got %d
\n
"
,
cost
);
ok
(
cost
==
12000024
,
"got %d
\n
"
,
cost
);
MsiCloseHandle
(
hpkg
);
error:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment