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
8dd3d389
Commit
8dd3d389
authored
Oct 20, 2009
by
Hans Leidekker
Committed by
Alexandre Julliard
Oct 20, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Create the local copy before opening the database.
parent
33d9f37f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
59 deletions
+57
-59
action.c
dlls/msi/action.c
+3
-58
database.c
dlls/msi/database.c
+5
-0
msipriv.h
dlls/msi/msipriv.h
+1
-0
package.c
dlls/msi/package.c
+48
-1
No files found.
dlls/msi/action.c
View file @
8dd3d389
...
...
@@ -3802,63 +3802,6 @@ static UINT ACTION_UnpublishFeatures(MSIPACKAGE *package)
return
ERROR_SUCCESS
;
}
static
UINT
msi_get_local_package_name
(
LPWSTR
path
)
{
static
const
WCHAR
szInstaller
[]
=
{
'\\'
,
'I'
,
'n'
,
's'
,
't'
,
'a'
,
'l'
,
'l'
,
'e'
,
'r'
,
'\\'
,
0
};
static
const
WCHAR
fmt
[]
=
{
'%'
,
'x'
,
'.'
,
'm'
,
's'
,
'i'
,
0
};
DWORD
time
,
len
,
i
;
HANDLE
handle
;
time
=
GetTickCount
();
GetWindowsDirectoryW
(
path
,
MAX_PATH
);
lstrcatW
(
path
,
szInstaller
);
CreateDirectoryW
(
path
,
NULL
);
len
=
lstrlenW
(
path
);
for
(
i
=
0
;
i
<
0x10000
;
i
++
)
{
snprintfW
(
&
path
[
len
],
MAX_PATH
-
len
,
fmt
,
(
time
+
i
)
&
0xffff
);
handle
=
CreateFileW
(
path
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_NEW
,
FILE_ATTRIBUTE_NORMAL
,
0
);
if
(
handle
!=
INVALID_HANDLE_VALUE
)
{
CloseHandle
(
handle
);
break
;
}
if
(
GetLastError
()
!=
ERROR_FILE_EXISTS
&&
GetLastError
()
!=
ERROR_SHARING_VIOLATION
)
return
ERROR_FUNCTION_FAILED
;
}
return
ERROR_SUCCESS
;
}
static
UINT
msi_make_package_local
(
MSIPACKAGE
*
package
,
HKEY
hkey
)
{
WCHAR
packagefile
[
MAX_PATH
];
UINT
r
;
r
=
msi_get_local_package_name
(
packagefile
);
if
(
r
!=
ERROR_SUCCESS
)
return
r
;
TRACE
(
"Copying to local package %s
\n
"
,
debugstr_w
(
packagefile
));
r
=
CopyFileW
(
package
->
db
->
path
,
packagefile
,
FALSE
);
if
(
!
r
)
{
ERR
(
"Unable to copy package (%s -> %s) (error %d)
\n
"
,
debugstr_w
(
package
->
db
->
path
),
debugstr_w
(
packagefile
),
GetLastError
());
return
ERROR_FUNCTION_FAILED
;
}
msi_reg_set_val_str
(
hkey
,
INSTALLPROPERTY_LOCALPACKAGEW
,
packagefile
);
return
ERROR_SUCCESS
;
}
static
UINT
msi_publish_install_properties
(
MSIPACKAGE
*
package
,
HKEY
hkey
)
{
LPWSTR
prop
,
val
,
key
;
...
...
@@ -3990,7 +3933,9 @@ static UINT ACTION_RegisterProduct(MSIPACKAGE *package)
if
(
rc
!=
ERROR_SUCCESS
)
goto
done
;
msi_make_package_local
(
package
,
props
);
msi_reg_set_val_str
(
props
,
INSTALLPROPERTY_LOCALPACKAGEW
,
package
->
db
->
localfile
);
msi_free
(
package
->
db
->
localfile
);
package
->
db
->
localfile
=
NULL
;
rc
=
msi_publish_install_properties
(
package
,
hkey
);
if
(
rc
!=
ERROR_SUCCESS
)
...
...
dlls/msi/database.c
View file @
8dd3d389
...
...
@@ -65,6 +65,11 @@ static VOID MSI_CloseDatabase( MSIOBJECTHDR *arg )
DeleteFileW
(
db
->
deletefile
);
msi_free
(
db
->
deletefile
);
}
if
(
db
->
localfile
)
{
DeleteFileW
(
db
->
localfile
);
msi_free
(
db
->
localfile
);
}
}
UINT
MSI_OpenDatabaseW
(
LPCWSTR
szDBPath
,
LPCWSTR
szPersist
,
MSIDATABASE
**
pdb
)
...
...
dlls/msi/msipriv.h
View file @
8dd3d389
...
...
@@ -76,6 +76,7 @@ typedef struct tagMSIDATABASE
UINT
bytes_per_strref
;
LPWSTR
path
;
LPWSTR
deletefile
;
LPWSTR
localfile
;
LPCWSTR
mode
;
struct
list
tables
;
struct
list
transforms
;
...
...
dlls/msi/package.c
View file @
8dd3d389
...
...
@@ -870,6 +870,38 @@ LPCWSTR msi_download_file( LPCWSTR szUrl, LPWSTR filename )
return
filename
;
}
static
UINT
msi_get_local_package_name
(
LPWSTR
path
)
{
static
const
WCHAR
szInstaller
[]
=
{
'\\'
,
'I'
,
'n'
,
's'
,
't'
,
'a'
,
'l'
,
'l'
,
'e'
,
'r'
,
'\\'
,
0
};
static
const
WCHAR
fmt
[]
=
{
'%'
,
'x'
,
'.'
,
'm'
,
's'
,
'i'
,
0
};
DWORD
time
,
len
,
i
;
HANDLE
handle
;
time
=
GetTickCount
();
GetWindowsDirectoryW
(
path
,
MAX_PATH
);
strcatW
(
path
,
szInstaller
);
CreateDirectoryW
(
path
,
NULL
);
len
=
strlenW
(
path
);
for
(
i
=
0
;
i
<
0x10000
;
i
++
)
{
snprintfW
(
&
path
[
len
],
MAX_PATH
-
len
,
fmt
,
(
time
+
i
)
&
0xffff
);
handle
=
CreateFileW
(
path
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_NEW
,
FILE_ATTRIBUTE_NORMAL
,
0
);
if
(
handle
!=
INVALID_HANDLE_VALUE
)
{
CloseHandle
(
handle
);
break
;
}
if
(
GetLastError
()
!=
ERROR_FILE_EXISTS
&&
GetLastError
()
!=
ERROR_SHARING_VIOLATION
)
return
ERROR_FUNCTION_FAILED
;
}
return
ERROR_SUCCESS
;
}
UINT
MSI_OpenPackageW
(
LPCWSTR
szPackage
,
MSIPACKAGE
**
pPackage
)
{
static
const
WCHAR
OriginalDatabase
[]
=
...
...
@@ -880,7 +912,7 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, MSIPACKAGE **pPackage)
MSIHANDLE
handle
;
LPWSTR
ptr
,
base_url
=
NULL
;
UINT
r
;
WCHAR
temppath
[
MAX_PATH
];
WCHAR
temppath
[
MAX_PATH
]
,
localfile
[
MAX_PATH
]
;
LPCWSTR
file
=
szPackage
;
TRACE
(
"%s %p
\n
"
,
debugstr_w
(
szPackage
),
pPackage
);
...
...
@@ -921,6 +953,19 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, MSIPACKAGE **pPackage)
else
file
=
copy_package_to_temp
(
szPackage
,
temppath
);
r
=
msi_get_local_package_name
(
localfile
);
if
(
r
!=
ERROR_SUCCESS
)
return
r
;
TRACE
(
"Copying to local package %s
\n
"
,
debugstr_w
(
localfile
));
if
(
!
CopyFileW
(
file
,
localfile
,
FALSE
))
{
ERR
(
"Unable to copy package (%s -> %s) (error %u)
\n
"
,
debugstr_w
(
file
),
debugstr_w
(
localfile
),
GetLastError
());
return
GetLastError
();
}
r
=
MSI_OpenDatabaseW
(
file
,
MSIDBOPEN_READONLY
,
&
db
);
if
(
r
!=
ERROR_SUCCESS
)
{
...
...
@@ -932,6 +977,8 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, MSIPACKAGE **pPackage)
return
r
;
}
db
->
localfile
=
strdupW
(
localfile
);
}
package
=
MSI_CreatePackage
(
db
,
base_url
);
...
...
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