mirror of
https://github.com/reactos/reactos.git
synced 2026-09-16 23:53:27 +08:00
Mike McCormack <mike@codeweavers.com> - add support for Edit boxes in MSI dialogs - run the message loop when waiting for threads or processes - fix the dialog font - allow waiting on a handle while running the message loop - implement checkboxes in dialogs - use TextStyle enumeration instead of numbers - fix MSI_IterateRecords to return the correct count - Add more dialog controls, do something when they're clicked on. - Implement MsiPreviewDialog. - Implement and document MsiLoadString. - Added stub implementations for MsiPreviewDialog and MsiPreviewBillboard. - Fix MsiModifyView and MsiViewGetColumnInfo to use MSIRECORD* not MSIHANDLE. - Implement, test and document MsiDecomposeDescriptor. - Handle a number as a parameter for custom action 19. - Move OpenQuery into msiquery.c and make it non-static. - Fix and test inserting records. - Fix refcounting, use Interlocked functions. - MsiEvaluateCondition returns an error when passed NULL as a condition. - Lock record in MsiViewExecute, move stubs to end. - Fix MsiRecordSetString for NULL strings and update test case. - Fix a bug caused by freeing memory too soon in the table code. - Update headers, add MsiGetUserInfoA stub implementation. - Fix a memory leak in MsiConfigureProductExW. - Indentation and style cleanup. - implement MsiOpenPackageEx, and forward MsiOpenPackage there - make a MSI_CreatePackage function and use it in MSI_OpenPackage - move MsiOpenPackageA down with the rest of the API functions Juan Lang <juan_lang@yahoo.com> - Partially implement AppSearch action. - If a full path isn't specified, search across all fixed drives. - Simplify AppSearch error checking. - Identifiers evaluate to true if they are non-empty, regardless of value. Aric Stewart <aric@codeweavers.com> - action.c is getting too big, so split out all the handling of CustomActions into custom.c. Cleaned up a lot of the handling of custom actions including scripting actions and processing return codes. - Mike McCormack pointed out that MsiFormatRecord is basically the same as internal function deformat_string. So broke deformat_string out and updated it to function as MsiFormatRecord and implemented MsiFormatRecord. - A number of random fixes to action.c including properly calculating the length for the LocalPackage name, not forcing a reboot when really we should just return ERROR_INSTALL_SUSPEND and handling REG_MULTI_SZ now that we can deformat the properly. - Move the guid squishing functions out of msi.c and make a new registry.c file. Also clean up all the various registry keys we need to open and create to this module and modify the functions for msi.c to call these functions. - Added a few more stub implementations. - Implement custom action type 19, Halt install and display error message. - Continued work to simplify the ProcessAction call, also split it into a ProcessAction and ProcessUIAction for future dialog box work. Also fix a bug in deformat_string where i was not freeing the created record. - Make a temp file for each dll saved for custom actions. This prevents name collisions from causing custom actions to fail. - Do not track the temp files for custom actions based on the name from the table because then we get conflicts and files not tracked or cleaned up. - Add the RegisterUser action. - Implement RegisterExtensionInfo and RegisterMIMEInfo. - Add logic to be able to resolve the SourceDir based on CurrentPath. Also add logic to get the source locations of a file if it is not in a cabinet. - Finish up the framework by stubbing out all the remaining Standard actions. - A fix to deformat_string so it only returns a null return if you provided a null buffer. - Eliminate the giant if.. else if block from ACTION_ProcessAction in favor of a table of handlers. - Return code of the install should not depend on the return code of the final action. - Update component installed states as they are installed so that conditions based on component states are at least a little more correct. - Add icon and argument when regestering clsids. - Add a stub for ResolveSource because we do that work just not in ResolveSource like we should. - When quering a Component state return the correct state. - Enable the updating of Feature and thus the resulting component states. - Run the end of install actions for suspend and user exit states as well. - Start putting in place a currently running state for future ui use. - Use the new registry functions in registry.c. - Do not force a reboot, just return ERROR_INSTALL_SUSPEND and write some keys to the registry. - Quite a few fixes: - Allow for the queing of custom actions to trigger on the InstallExecute or InstallExecuteAgain actions. - allow for the queing of custom actions to trigger on InstallFinalize. - Properly set the CustomActionData property for said queued actions. - Implement RegisterProduct. - Beginning implementation of ForceReboot. - Don't kill install if an item to be duplicated does not exist. - Write out SourceList and LastUsedSource for resuming installs. - Use regsvr32 to register self reg dlls. - Implementations for SelfRegModules and PublishFeatures. - Set default ACTION property for Install. - Deformat more than JUST properties properly. Allows for Files and Component paths in deformat. - Properly deformat a LaunchCondition failure dialog box. - Resolve and save registry Keypaths. - Write the Features published keys more correctly. Still some problems. - First implementation of the WriteIniValues action. - Custom actions can have null in their target parameters, handle that without crashing. Also enable deformating of lines greater than 256 characters. - Added some more suminfo stubs. - An implementation of MsiSummaryInfoGetPropertyW based off of MsiSummaryInfoGetPropertyA. - Added stubs for MsiGetShortcutTargetA/W. - Do a very basic first implementation of MsiConfigureProductExW for msiexec /@ when run as a reboot. - Also add a number of new stubs for the office xp and 2k3 install and startup process. - Fix a copy and paste error, check for a null value and discard unneeded errors. - Do not limit properties to 256 characters when evaluating them. - Setting a record to an empty string is the same as making it null. - First pass implement ion of MsiQueryProductState[A/W] as well as a few fixes for MsiGetComponentPath. - Actually start on an implemention for MsiGetComponentPathW that should handle all keypaths that are files. - A reworking of format.c to remove the recursion, clean things up and stabilize behavior to match windows. - Cleanup processing a bit more. - Allow for nested keys to work properly. - MsiGetProperty does not return any error on missing properties. - The new Insert fixes now properly require ?,? instead of just ? for the Insert call. This fix modifies the MSI_SetProperty query to be correct. Michael Stefaniuc <mstefani@redhat.de> - Do not check for non NULL pointer before HeapFree'ing it. It's redundant. Francois Gouget <fgouget@free.fr> - Assorted spelling fixes. Ulrich Czekalla <ulrich@codeweavers.com> - Handle 0 length buffers in MSI_FormatRecordW. - Remove unused buffer in deformat_string. Mike Hearn <mh@codeweavers.com> - Correctly ensure properties set from resolved directory paths are backslash terminated. Francois Gouget <fgouget@free.fr> - Assorted spelling fixes. Marcus Meissner <meissner@suse.de> - Initialize rc in create_component_directory(). Alexandre Julliard <julliard@winehq.org> - Avoid unnecessary run-time initializations. svn path=/trunk/; revision=13518
260 lines
6.1 KiB
C
260 lines
6.1 KiB
C
/*
|
|
* Implementation of the Microsoft Installer (msi.dll)
|
|
*
|
|
* Copyright 2002-2004 Mike McCormack for CodeWeavers
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
*/
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include "windef.h"
|
|
#include "winbase.h"
|
|
#include "winreg.h"
|
|
#include "shlwapi.h"
|
|
#include "wine/debug.h"
|
|
#include "msi.h"
|
|
#include "msiquery.h"
|
|
#include "msipriv.h"
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(msi);
|
|
|
|
static CRITICAL_SECTION MSI_handle_cs;
|
|
static CRITICAL_SECTION_DEBUG MSI_handle_cs_debug =
|
|
{
|
|
0, 0, &MSI_handle_cs,
|
|
{ &MSI_handle_cs_debug.ProcessLocksList,
|
|
&MSI_handle_cs_debug.ProcessLocksList },
|
|
0, 0, { 0, (DWORD)(__FILE__ ": MSI_handle_cs") }
|
|
};
|
|
static CRITICAL_SECTION MSI_handle_cs = { &MSI_handle_cs_debug, -1, 0, 0, 0, 0 };
|
|
|
|
static CRITICAL_SECTION MSI_object_cs;
|
|
static CRITICAL_SECTION_DEBUG MSI_object_cs_debug =
|
|
{
|
|
0, 0, &MSI_object_cs,
|
|
{ &MSI_object_cs_debug.ProcessLocksList,
|
|
&MSI_object_cs_debug.ProcessLocksList },
|
|
0, 0, { 0, (DWORD)(__FILE__ ": MSI_object_cs") }
|
|
};
|
|
static CRITICAL_SECTION MSI_object_cs = { &MSI_object_cs_debug, -1, 0, 0, 0, 0 };
|
|
|
|
typedef struct msi_handle_info_t
|
|
{
|
|
MSIOBJECTHDR *obj;
|
|
DWORD dwThreadId;
|
|
} msi_handle_info;
|
|
|
|
static msi_handle_info msihandletable[MSIMAXHANDLES];
|
|
|
|
MSIHANDLE alloc_msihandle( MSIOBJECTHDR *obj )
|
|
{
|
|
MSIHANDLE ret = 0;
|
|
UINT i;
|
|
|
|
EnterCriticalSection( &MSI_handle_cs );
|
|
|
|
/* find a slot */
|
|
for(i=0; i<MSIMAXHANDLES; i++)
|
|
if( !msihandletable[i].obj )
|
|
break;
|
|
if( (i>=MSIMAXHANDLES) || msihandletable[i].obj )
|
|
goto out;
|
|
|
|
msiobj_addref( obj );
|
|
msihandletable[i].obj = obj;
|
|
msihandletable[i].dwThreadId = GetCurrentThreadId();
|
|
ret = (MSIHANDLE) (i+1);
|
|
out:
|
|
TRACE("%p -> %ld\n", obj, ret );
|
|
|
|
LeaveCriticalSection( &MSI_handle_cs );
|
|
return ret;
|
|
}
|
|
|
|
void *msihandle2msiinfo(MSIHANDLE handle, UINT type)
|
|
{
|
|
MSIOBJECTHDR *ret = NULL;
|
|
|
|
EnterCriticalSection( &MSI_handle_cs );
|
|
handle--;
|
|
if( handle<0 )
|
|
goto out;
|
|
if( handle>=MSIMAXHANDLES )
|
|
goto out;
|
|
if( !msihandletable[handle].obj )
|
|
goto out;
|
|
if( msihandletable[handle].obj->magic != MSIHANDLE_MAGIC )
|
|
goto out;
|
|
if( type && (msihandletable[handle].obj->type != type) )
|
|
goto out;
|
|
ret = msihandletable[handle].obj;
|
|
msiobj_addref( ret );
|
|
|
|
out:
|
|
LeaveCriticalSection( &MSI_handle_cs );
|
|
|
|
return (void*) ret;
|
|
}
|
|
|
|
MSIHANDLE msiobj_findhandle( MSIOBJECTHDR *hdr )
|
|
{
|
|
MSIHANDLE ret = 0;
|
|
UINT i;
|
|
|
|
TRACE("%p\n", hdr);
|
|
|
|
EnterCriticalSection( &MSI_handle_cs );
|
|
for(i=0; (i<MSIMAXHANDLES) && !ret; i++)
|
|
if( msihandletable[i].obj == hdr )
|
|
ret = i+1;
|
|
LeaveCriticalSection( &MSI_handle_cs );
|
|
|
|
TRACE("%p -> %ld\n", hdr, ret);
|
|
|
|
msiobj_addref( hdr );
|
|
return ret;
|
|
}
|
|
|
|
void *alloc_msiobject(UINT type, UINT size, msihandledestructor destroy )
|
|
{
|
|
MSIOBJECTHDR *info;
|
|
|
|
info = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, size );
|
|
if( info )
|
|
{
|
|
info->magic = MSIHANDLE_MAGIC;
|
|
info->type = type;
|
|
info->refcount = 1;
|
|
info->destructor = destroy;
|
|
}
|
|
|
|
return info;
|
|
}
|
|
|
|
void msiobj_addref( MSIOBJECTHDR *info )
|
|
{
|
|
TRACE("%p\n", info);
|
|
|
|
if( !info )
|
|
return;
|
|
|
|
if( info->magic != MSIHANDLE_MAGIC )
|
|
{
|
|
ERR("Invalid handle!\n");
|
|
return;
|
|
}
|
|
|
|
InterlockedIncrement(&info->refcount);
|
|
}
|
|
|
|
void msiobj_lock( MSIOBJECTHDR *info )
|
|
{
|
|
EnterCriticalSection( &MSI_object_cs );
|
|
}
|
|
|
|
void msiobj_unlock( MSIOBJECTHDR *info )
|
|
{
|
|
LeaveCriticalSection( &MSI_object_cs );
|
|
}
|
|
|
|
int msiobj_release( MSIOBJECTHDR *info )
|
|
{
|
|
int ret;
|
|
|
|
TRACE("%p\n",info);
|
|
|
|
if( !info )
|
|
return -1;
|
|
|
|
if( info->magic != MSIHANDLE_MAGIC )
|
|
{
|
|
ERR("Invalid handle!\n");
|
|
return -1;
|
|
}
|
|
|
|
ret = InterlockedDecrement( &info->refcount );
|
|
if( ret==0 )
|
|
{
|
|
if( info->destructor )
|
|
info->destructor( info );
|
|
HeapFree( GetProcessHeap(), 0, info );
|
|
TRACE("object %p destroyed\n", info);
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
|
|
/***********************************************************
|
|
* MsiCloseHandle [MSI.@]
|
|
*/
|
|
UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
|
|
{
|
|
MSIOBJECTHDR *info;
|
|
UINT ret = ERROR_INVALID_HANDLE;
|
|
|
|
TRACE("%lx\n",handle);
|
|
|
|
EnterCriticalSection( &MSI_handle_cs );
|
|
|
|
info = msihandle2msiinfo(handle, 0);
|
|
if( !info )
|
|
goto out;
|
|
|
|
if( info->magic != MSIHANDLE_MAGIC )
|
|
{
|
|
ERR("Invalid handle!\n");
|
|
goto out;
|
|
}
|
|
|
|
msiobj_release( info );
|
|
msihandletable[handle-1].obj = NULL;
|
|
ret = ERROR_SUCCESS;
|
|
|
|
TRACE("handle %lx Destroyed\n", handle);
|
|
out:
|
|
LeaveCriticalSection( &MSI_handle_cs );
|
|
if( info )
|
|
msiobj_release( info );
|
|
|
|
return ret;
|
|
}
|
|
|
|
/***********************************************************
|
|
* MsiCloseAllHandles [MSI.@]
|
|
*
|
|
* Closes all handles owned by the current thread
|
|
*
|
|
* RETURNS:
|
|
* The number of handles closed
|
|
*/
|
|
UINT WINAPI MsiCloseAllHandles(void)
|
|
{
|
|
UINT i, n=0;
|
|
|
|
TRACE("\n");
|
|
|
|
for(i=0; i<MSIMAXHANDLES; i++)
|
|
{
|
|
if(msihandletable[i].dwThreadId == GetCurrentThreadId())
|
|
{
|
|
MsiCloseHandle( i+1 );
|
|
n++;
|
|
}
|
|
}
|
|
|
|
return n;
|
|
}
|