Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
8bfc0877
Commit
8bfc0877
authored
May 31, 2010
by
Hans Leidekker
Committed by
Alexandre Julliard
May 31, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Don't keep handles open to the patch database in MSI_ApplyPatchW.
parent
a4d25f12
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
39 deletions
+51
-39
msi.c
dlls/msi/msi.c
+51
-39
No files found.
dlls/msi/msi.c
View file @
8bfc0877
...
@@ -299,13 +299,56 @@ done:
...
@@ -299,13 +299,56 @@ done:
return
r
;
return
r
;
}
}
static
UINT
get_patch_product_codes
(
LPCWSTR
szPatchPackage
,
WCHAR
**
product_codes
)
{
MSIHANDLE
patch
,
info
=
0
;
UINT
r
,
type
;
DWORD
size
;
static
WCHAR
empty
[]
=
{
0
};
WCHAR
*
codes
;
r
=
MsiOpenDatabaseW
(
szPatchPackage
,
MSIDBOPEN_READONLY
,
&
patch
);
if
(
r
!=
ERROR_SUCCESS
)
return
r
;
r
=
MsiGetSummaryInformationW
(
patch
,
NULL
,
0
,
&
info
);
if
(
r
!=
ERROR_SUCCESS
)
goto
done
;
size
=
0
;
r
=
MsiSummaryInfoGetPropertyW
(
info
,
PID_TEMPLATE
,
&
type
,
NULL
,
NULL
,
empty
,
&
size
);
if
(
r
!=
ERROR_MORE_DATA
||
!
size
||
type
!=
VT_LPSTR
)
{
ERR
(
"Failed to read product codes from patch
\n
"
);
r
=
ERROR_FUNCTION_FAILED
;
goto
done
;
}
codes
=
msi_alloc
(
++
size
*
sizeof
(
WCHAR
)
);
if
(
!
codes
)
{
r
=
ERROR_OUTOFMEMORY
;
goto
done
;
}
r
=
MsiSummaryInfoGetPropertyW
(
info
,
PID_TEMPLATE
,
&
type
,
NULL
,
NULL
,
codes
,
&
size
);
if
(
r
!=
ERROR_SUCCESS
)
msi_free
(
codes
);
else
*
product_codes
=
codes
;
done:
MsiCloseHandle
(
info
);
MsiCloseHandle
(
patch
);
return
r
;
}
static
UINT
MSI_ApplyPatchW
(
LPCWSTR
szPatchPackage
,
LPCWSTR
szProductCode
,
LPCWSTR
szCommandLine
)
static
UINT
MSI_ApplyPatchW
(
LPCWSTR
szPatchPackage
,
LPCWSTR
szProductCode
,
LPCWSTR
szCommandLine
)
{
{
MSIHANDLE
patch
=
0
,
info
=
0
;
UINT
r
;
UINT
r
=
ERROR_SUCCESS
,
type
;
DWORD
size
;
DWORD
size
=
0
;
LPCWSTR
cmd_ptr
=
szCommandLine
;
LPCWSTR
cmd_ptr
=
szCommandLine
;
LPWSTR
beg
,
end
,
cmd
=
NULL
,
codes
=
NULL
;
LPWSTR
beg
,
end
,
cmd
,
codes
=
NULL
;
BOOL
succeeded
=
FALSE
;
BOOL
succeeded
=
FALSE
;
static
const
WCHAR
patcheq
[]
=
{
'P'
,
'A'
,
'T'
,
'C'
,
'H'
,
'='
,
0
};
static
const
WCHAR
patcheq
[]
=
{
'P'
,
'A'
,
'T'
,
'C'
,
'H'
,
'='
,
0
};
...
@@ -314,34 +357,8 @@ static UINT MSI_ApplyPatchW(LPCWSTR szPatchPackage, LPCWSTR szProductCode, LPCWS
...
@@ -314,34 +357,8 @@ static UINT MSI_ApplyPatchW(LPCWSTR szPatchPackage, LPCWSTR szProductCode, LPCWS
if
(
!
szPatchPackage
||
!
szPatchPackage
[
0
])
if
(
!
szPatchPackage
||
!
szPatchPackage
[
0
])
return
ERROR_INVALID_PARAMETER
;
return
ERROR_INVALID_PARAMETER
;
if
(
!
szProductCode
)
if
(
!
szProductCode
&&
(
r
=
get_patch_product_codes
(
szPatchPackage
,
&
codes
)))
{
return
r
;
r
=
MsiOpenDatabaseW
(
szPatchPackage
,
MSIDBOPEN_READONLY
,
&
patch
);
if
(
r
!=
ERROR_SUCCESS
)
return
r
;
r
=
MsiGetSummaryInformationW
(
patch
,
NULL
,
0
,
&
info
);
if
(
r
!=
ERROR_SUCCESS
)
goto
done
;
r
=
MsiSummaryInfoGetPropertyW
(
info
,
PID_TEMPLATE
,
&
type
,
NULL
,
NULL
,
empty
,
&
size
);
if
(
r
!=
ERROR_MORE_DATA
||
!
size
||
type
!=
VT_LPSTR
)
{
ERR
(
"Failed to read product codes from patch
\n
"
);
goto
done
;
}
codes
=
msi_alloc
(
++
size
*
sizeof
(
WCHAR
));
if
(
!
codes
)
{
r
=
ERROR_OUTOFMEMORY
;
goto
done
;
}
r
=
MsiSummaryInfoGetPropertyW
(
info
,
PID_TEMPLATE
,
&
type
,
NULL
,
NULL
,
codes
,
&
size
);
if
(
r
!=
ERROR_SUCCESS
)
goto
done
;
}
if
(
!
szCommandLine
)
if
(
!
szCommandLine
)
cmd_ptr
=
empty
;
cmd_ptr
=
empty
;
...
@@ -350,8 +367,8 @@ static UINT MSI_ApplyPatchW(LPCWSTR szPatchPackage, LPCWSTR szProductCode, LPCWS
...
@@ -350,8 +367,8 @@ static UINT MSI_ApplyPatchW(LPCWSTR szPatchPackage, LPCWSTR szProductCode, LPCWS
cmd
=
msi_alloc
(
size
*
sizeof
(
WCHAR
));
cmd
=
msi_alloc
(
size
*
sizeof
(
WCHAR
));
if
(
!
cmd
)
if
(
!
cmd
)
{
{
r
=
ERROR_OUTOFMEMORY
;
msi_free
(
codes
)
;
goto
done
;
return
ERROR_OUTOFMEMORY
;
}
}
lstrcpyW
(
cmd
,
cmd_ptr
);
lstrcpyW
(
cmd
,
cmd_ptr
);
...
@@ -380,13 +397,8 @@ static UINT MSI_ApplyPatchW(LPCWSTR szPatchPackage, LPCWSTR szProductCode, LPCWS
...
@@ -380,13 +397,8 @@ static UINT MSI_ApplyPatchW(LPCWSTR szPatchPackage, LPCWSTR szProductCode, LPCWS
r
=
ERROR_SUCCESS
;
r
=
ERROR_SUCCESS
;
}
}
done:
msi_free
(
cmd
);
msi_free
(
cmd
);
msi_free
(
codes
);
msi_free
(
codes
);
MsiCloseHandle
(
info
);
MsiCloseHandle
(
patch
);
return
r
;
return
r
;
}
}
...
...
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