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
2b2fecf8
Commit
2b2fecf8
authored
Jan 07, 2005
by
Aric Stewart
Committed by
Alexandre Julliard
Jan 07, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make all custom type 1 actions happen in a seperate thread and close
all handles for that thread when it exits. Honors the concept of temporary MSI handles for custom actions.
parent
4a0f9998
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
56 deletions
+44
-56
action.c
dlls/msi/action.c
+44
-56
No files found.
dlls/msi/action.c
View file @
2b2fecf8
...
...
@@ -1413,40 +1413,40 @@ typedef struct
WCHAR
*
source
;
}
thread_struct
;
static
DWORD
WINAPI
DllThread
(
LPVOID
info
)
static
DWORD
WINAPI
ACTION_CallDllFunction
(
thread_struct
*
stuff
)
{
HANDLE
DLL
;
HANDLE
hModule
;
LPSTR
proc
;
thread_struct
*
stuff
;
CustomEntry
*
fn
;
stuff
=
(
thread_struct
*
)
info
;
TRACE
(
"
Asynchronous start
(%s, %s)
\n
"
,
debugstr_w
(
stuff
->
source
),
TRACE
(
"
calling function
(%s, %s)
\n
"
,
debugstr_w
(
stuff
->
source
),
debugstr_w
(
stuff
->
target
));
DLL
=
LoadLibraryW
(
stuff
->
source
);
if
(
DLL
)
hModule
=
LoadLibraryW
(
stuff
->
source
);
if
(
hModule
)
{
proc
=
strdupWtoA
(
stuff
->
target
);
fn
=
(
CustomEntry
*
)
GetProcAddress
(
DLL
,
proc
);
fn
=
(
CustomEntry
*
)
GetProcAddress
(
hModule
,
proc
);
if
(
fn
)
{
MSIHANDLE
hPackage
;
MSIPACKAGE
*
package
=
stuff
->
package
;
TRACE
(
"Calling function
\n
"
);
TRACE
(
"Calling function
%s
\n
"
,
proc
);
hPackage
=
msiobj_findhandle
(
&
package
->
hdr
);
if
(
!
hPackage
)
if
(
hPackage
)
{
fn
(
hPackage
);
msiobj_release
(
&
package
->
hdr
);
}
else
ERR
(
"Handle for object %p not found
\n
"
,
package
);
fn
(
hPackage
);
msiobj_release
(
&
package
->
hdr
);
}
else
ERR
(
"Cannot load functon
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
proc
);
FreeLibrary
(
DLL
);
FreeLibrary
(
hModule
);
}
else
ERR
(
"Unable to load library
\n
"
);
...
...
@@ -1457,13 +1457,30 @@ static DWORD WINAPI DllThread(LPVOID info)
return
0
;
}
static
DWORD
WINAPI
DllThread
(
LPVOID
info
)
{
thread_struct
*
stuff
;
DWORD
rc
=
0
;
TRACE
(
"MSI Thread (0x%lx) started for custom action
\n
"
,
GetCurrentThreadId
());
stuff
=
(
thread_struct
*
)
info
;
rc
=
ACTION_CallDllFunction
(
stuff
);
TRACE
(
"MSI Thread (0x%lx) finished
\n
"
,
GetCurrentThreadId
());
/* clse all handles for this thread */
MsiCloseAllHandles
();
return
rc
;
}
static
UINT
HANDLE_CustomType1
(
MSIPACKAGE
*
package
,
const
LPWSTR
source
,
const
LPWSTR
target
,
const
INT
type
)
{
WCHAR
tmp_file
[
MAX_PATH
];
CustomEntry
*
fn
;
HANDLE
DLL
;
LPSTR
proc
;
thread_struct
*
info
;
DWORD
ThreadId
;
HANDLE
ThreadHandle
;
store_binary_to_temp
(
package
,
source
,
tmp_file
);
...
...
@@ -1476,48 +1493,19 @@ static UINT HANDLE_CustomType1(MSIPACKAGE *package, const LPWSTR source,
strcatW
(
tmp_file
,
dot
);
}
i
f
(
type
&
0xc0
)
{
DWORD
ThreadId
;
HANDLE
ThreadHandle
;
thread_struct
*
info
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
info
)
);
i
nfo
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
info
)
);
msiobj_addref
(
&
package
->
hdr
);
info
->
package
=
package
;
info
->
target
=
dupstrW
(
target
)
;
info
->
source
=
dupstrW
(
tmp_file
);
msiobj_addref
(
&
package
->
hdr
);
info
->
package
=
package
;
info
->
target
=
dupstrW
(
target
);
info
->
source
=
dupstrW
(
tmp_file
);
TRACE
(
"Start Asynchronous execution of dll
\n
"
);
ThreadHandle
=
CreateThread
(
NULL
,
0
,
DllThread
,(
LPVOID
)
info
,
0
,
&
ThreadId
);
CloseHandle
(
ThreadHandle
);
/* FIXME: release the package if the CreateThread fails */
return
ERROR_SUCCESS
;
}
DLL
=
LoadLibraryW
(
tmp_file
);
if
(
DLL
)
{
proc
=
strdupWtoA
(
target
);
fn
=
(
CustomEntry
*
)
GetProcAddress
(
DLL
,
proc
);
if
(
fn
)
{
MSIHANDLE
hPackage
;
ThreadHandle
=
CreateThread
(
NULL
,
0
,
DllThread
,(
LPVOID
)
info
,
0
,
&
ThreadId
);
TRACE
(
"Calling function
\n
"
);
hPackage
=
msiobj_findhandle
(
&
package
->
hdr
);
if
(
!
hPackage
)
ERR
(
"Handle for object %p not found
\n
"
,
package
);
fn
(
hPackage
);
msiobj_release
(
&
package
->
hdr
);
}
else
ERR
(
"Cannot load functon
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
proc
);
FreeLibrary
(
DLL
);
}
else
ERR
(
"Unable to load library
\n
"
);
if
(
!
(
type
&
0xc0
))
WaitForSingleObject
(
ThreadHandle
,
INFINITE
);
CloseHandle
(
ThreadHandle
);
return
ERROR_SUCCESS
;
}
...
...
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