Convert RunningActions array into a list.

This commit is contained in:
Mike McCormack 2005-09-08 12:42:07 +00:00 committed by Alexandre Julliard
parent 2014da26fc
commit 0232c5c45f
3 changed files with 25 additions and 30 deletions

View File

@ -57,6 +57,7 @@ static const WCHAR cszTempFolder[]= {'T','e','m','p','F','o','l','d','e','r',0};
typedef struct tagMSIRUNNINGACTION
{
struct list entry;
HANDLE handle;
BOOL process;
LPWSTR name;
@ -301,22 +302,15 @@ static UINT store_binary_to_temp(MSIPACKAGE *package, LPCWSTR source,
static void file_running_action(MSIPACKAGE* package, HANDLE Handle,
BOOL process, LPCWSTR name)
{
MSIRUNNINGACTION *newbuf = NULL;
INT count;
count = package->RunningActionCount;
package->RunningActionCount++;
if (count != 0)
newbuf = HeapReAlloc(GetProcessHeap(),0,
package->RunningAction,
package->RunningActionCount * sizeof(MSIRUNNINGACTION));
else
newbuf = HeapAlloc(GetProcessHeap(),0, sizeof(MSIRUNNINGACTION));
MSIRUNNINGACTION *action;
newbuf[count].handle = Handle;
newbuf[count].process = process;
newbuf[count].name = strdupW(name);
action = HeapAlloc( GetProcessHeap(), 0, sizeof(MSIRUNNINGACTION) );
package->RunningAction = newbuf;
action->handle = Handle;
action->process = process;
action->name = strdupW(name);
list_add_tail( &package->RunningActions, &action->entry );
}
static UINT process_action_return_value(UINT type, HANDLE ThreadHandle)
@ -764,29 +758,30 @@ static UINT HANDLE_CustomType34(MSIPACKAGE *package, LPCWSTR source,
void ACTION_FinishCustomActions(MSIPACKAGE* package)
{
INT i;
struct list *item, *cursor;
DWORD rc;
for (i = 0; i < package->RunningActionCount; i++)
LIST_FOR_EACH_SAFE( item, cursor, &package->RunningActions )
{
TRACE("Checking on action %s\n",
debugstr_w(package->RunningAction[i].name));
MSIRUNNINGACTION *action = LIST_ENTRY( item, MSIRUNNINGACTION, entry );
if (package->RunningAction[i].process)
GetExitCodeProcess(package->RunningAction[i].handle, &rc);
TRACE("Checking on action %s\n", debugstr_w(action->name));
list_remove( &action->entry );
if (action->process)
GetExitCodeProcess( action->handle, &rc );
else
GetExitCodeThread(package->RunningAction[i].handle, &rc);
GetExitCodeThread( action->handle, &rc );
if (rc == STILL_ACTIVE)
{
TRACE("Waiting on action %s\n",
debugstr_w(package->RunningAction[i].name));
msi_dialog_check_messages(package->RunningAction[i].handle);
TRACE("Waiting on action %s\n", debugstr_w( action->name) );
msi_dialog_check_messages( action->handle );
}
HeapFree(GetProcessHeap(),0,package->RunningAction[i].name);
CloseHandle(package->RunningAction[i].handle);
CloseHandle( action->handle );
HeapFree( GetProcessHeap(), 0, action->name );
HeapFree( GetProcessHeap(), 0, action );
}
HeapFree(GetProcessHeap(),0,package->RunningAction);
}

View File

@ -201,8 +201,7 @@ typedef struct tagMSIPACKAGE
struct tagMSISCRIPT *script;
struct tagMSIRUNNINGACTION *RunningAction;
UINT RunningActionCount;
struct list RunningActions;
LPWSTR PackagePath;
LPWSTR msiFilePath;

View File

@ -392,6 +392,7 @@ MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db )
list_init( &package->mimes );
list_init( &package->extensions );
list_init( &package->progids );
list_init( &package->RunningActions );
/* OK, here is where we do a slew of things to the database to
* prep for all that is to come as a package */