2005-06-16 17:51:44 +02:00
|
|
|
/*
|
|
|
|
* Implementation of the Microsoft Installer (msi.dll)
|
|
|
|
*
|
|
|
|
* Copyright 2005 Aric Stewart 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
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2005-06-16 17:51:44 +02:00
|
|
|
*/
|
|
|
|
|
2010-04-02 10:37:50 +02:00
|
|
|
/* Actions handled in this module:
|
|
|
|
*
|
2005-06-16 17:51:44 +02:00
|
|
|
* RegisterClassInfo
|
|
|
|
* RegisterProgIdInfo
|
|
|
|
* RegisterExtensionInfo
|
|
|
|
* RegisterMIMEInfo
|
2010-04-02 10:37:50 +02:00
|
|
|
* UnRegisterClassInfo
|
2010-04-02 10:38:57 +02:00
|
|
|
* UnRegisterProgIdInfo
|
2005-06-16 17:51:44 +02:00
|
|
|
* UnRegisterExtensionInfo (TODO)
|
|
|
|
* UnRegisterMIMEInfo (TODO)
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winerror.h"
|
|
|
|
#include "winreg.h"
|
|
|
|
#include "wine/debug.h"
|
|
|
|
#include "msipriv.h"
|
|
|
|
#include "winuser.h"
|
|
|
|
#include "wine/unicode.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(msi);
|
|
|
|
|
2005-08-24 11:45:18 +02:00
|
|
|
static MSIAPPID *load_appid( MSIPACKAGE* package, MSIRECORD *row )
|
2005-06-16 17:51:44 +02:00
|
|
|
{
|
|
|
|
LPCWSTR buffer;
|
2005-08-24 11:45:18 +02:00
|
|
|
MSIAPPID *appid;
|
2005-06-16 17:51:44 +02:00
|
|
|
|
|
|
|
/* fill in the data */
|
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
appid = msi_alloc_zero( sizeof(MSIAPPID) );
|
2005-08-24 11:45:18 +02:00
|
|
|
if (!appid)
|
|
|
|
return NULL;
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-10-27 14:36:12 +02:00
|
|
|
appid->AppID = msi_dup_record_field( row, 1 );
|
2005-08-24 11:45:18 +02:00
|
|
|
TRACE("loading appid %s\n", debugstr_w( appid->AppID ));
|
2005-06-16 17:51:44 +02:00
|
|
|
|
|
|
|
buffer = MSI_RecordGetString(row,2);
|
2005-08-24 11:45:18 +02:00
|
|
|
deformat_string( package, buffer, &appid->RemoteServerName );
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-10-27 14:36:12 +02:00
|
|
|
appid->LocalServer = msi_dup_record_field(row,3);
|
|
|
|
appid->ServiceParameters = msi_dup_record_field(row,4);
|
|
|
|
appid->DllSurrogate = msi_dup_record_field(row,5);
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-08-24 11:45:18 +02:00
|
|
|
appid->ActivateAtStorage = !MSI_RecordIsNull(row,6);
|
|
|
|
appid->RunAsInteractiveUser = !MSI_RecordIsNull(row,7);
|
|
|
|
|
|
|
|
list_add_tail( &package->appids, &appid->entry );
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-08-24 11:45:18 +02:00
|
|
|
return appid;
|
2005-06-16 17:51:44 +02:00
|
|
|
}
|
|
|
|
|
2005-08-24 11:45:18 +02:00
|
|
|
static MSIAPPID *load_given_appid( MSIPACKAGE *package, LPCWSTR name )
|
2005-06-16 17:51:44 +02:00
|
|
|
{
|
|
|
|
MSIRECORD *row;
|
2005-08-24 11:45:18 +02:00
|
|
|
MSIAPPID *appid;
|
2005-06-16 17:51:44 +02:00
|
|
|
static const WCHAR ExecSeqQuery[] =
|
|
|
|
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
|
|
|
|
'`','A','p','p','I','d','`',' ','W','H','E','R','E',' ',
|
|
|
|
'`','A','p','p','I','d','`',' ','=',' ','\'','%','s','\'',0};
|
|
|
|
|
2005-08-24 11:45:18 +02:00
|
|
|
if (!name)
|
|
|
|
return NULL;
|
2005-06-16 17:51:44 +02:00
|
|
|
|
|
|
|
/* check for appids already loaded */
|
2005-08-24 11:45:18 +02:00
|
|
|
LIST_FOR_EACH_ENTRY( appid, &package->appids, MSIAPPID, entry )
|
|
|
|
{
|
|
|
|
if (lstrcmpiW( appid->AppID, name )==0)
|
2005-06-16 17:51:44 +02:00
|
|
|
{
|
2005-08-24 11:45:18 +02:00
|
|
|
TRACE("found appid %s %p\n", debugstr_w(name), appid);
|
|
|
|
return appid;
|
2005-06-16 17:51:44 +02:00
|
|
|
}
|
2005-08-24 11:45:18 +02:00
|
|
|
}
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-08-25 11:50:19 +02:00
|
|
|
row = MSI_QueryGetRecord(package->db, ExecSeqQuery, name);
|
2005-06-16 17:51:44 +02:00
|
|
|
if (!row)
|
2005-08-24 11:45:18 +02:00
|
|
|
return NULL;
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-08-24 11:45:18 +02:00
|
|
|
appid = load_appid(package, row);
|
2005-06-16 17:51:44 +02:00
|
|
|
msiobj_release(&row->hdr);
|
|
|
|
|
2005-08-24 11:45:18 +02:00
|
|
|
return appid;
|
2005-06-16 17:51:44 +02:00
|
|
|
}
|
|
|
|
|
2005-09-06 11:26:18 +02:00
|
|
|
static MSIPROGID *load_given_progid(MSIPACKAGE *package, LPCWSTR progid);
|
2005-08-25 12:22:32 +02:00
|
|
|
static MSICLASS *load_given_class( MSIPACKAGE *package, LPCWSTR classid );
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-09-06 11:26:18 +02:00
|
|
|
static MSIPROGID *load_progid( MSIPACKAGE* package, MSIRECORD *row )
|
2005-06-16 17:51:44 +02:00
|
|
|
{
|
2005-09-06 11:26:18 +02:00
|
|
|
MSIPROGID *progid;
|
2005-06-16 17:51:44 +02:00
|
|
|
LPCWSTR buffer;
|
|
|
|
|
|
|
|
/* fill in the data */
|
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
progid = msi_alloc_zero( sizeof(MSIPROGID) );
|
2005-09-06 11:26:18 +02:00
|
|
|
if (!progid)
|
|
|
|
return NULL;
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-09-06 11:26:18 +02:00
|
|
|
list_add_tail( &package->progids, &progid->entry );
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-10-27 14:36:12 +02:00
|
|
|
progid->ProgID = msi_dup_record_field(row,1);
|
2005-09-06 11:26:18 +02:00
|
|
|
TRACE("loading progid %s\n",debugstr_w(progid->ProgID));
|
2005-06-16 17:51:44 +02:00
|
|
|
|
|
|
|
buffer = MSI_RecordGetString(row,2);
|
2005-09-06 11:26:18 +02:00
|
|
|
progid->Parent = load_given_progid(package,buffer);
|
|
|
|
if (progid->Parent == NULL && buffer)
|
2005-06-16 17:51:44 +02:00
|
|
|
FIXME("Unknown parent ProgID %s\n",debugstr_w(buffer));
|
|
|
|
|
|
|
|
buffer = MSI_RecordGetString(row,3);
|
2005-09-06 11:26:18 +02:00
|
|
|
progid->Class = load_given_class(package,buffer);
|
|
|
|
if (progid->Class == NULL && buffer)
|
2005-06-16 17:51:44 +02:00
|
|
|
FIXME("Unknown class %s\n",debugstr_w(buffer));
|
|
|
|
|
2005-10-27 14:36:12 +02:00
|
|
|
progid->Description = msi_dup_record_field(row,4);
|
2005-06-16 17:51:44 +02:00
|
|
|
|
|
|
|
if (!MSI_RecordIsNull(row,6))
|
|
|
|
{
|
|
|
|
INT icon_index = MSI_RecordGetInteger(row,6);
|
2005-10-27 14:36:12 +02:00
|
|
|
LPCWSTR FileName = MSI_RecordGetString(row,5);
|
2005-06-16 17:51:44 +02:00
|
|
|
LPWSTR FilePath;
|
|
|
|
static const WCHAR fmt[] = {'%','s',',','%','i',0};
|
|
|
|
|
2005-09-22 12:33:57 +02:00
|
|
|
FilePath = build_icon_path(package,FileName);
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
progid->IconPath = msi_alloc( (strlenW(FilePath)+10)* sizeof(WCHAR) );
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-09-06 11:26:18 +02:00
|
|
|
sprintfW(progid->IconPath,fmt,FilePath,icon_index);
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(FilePath);
|
2005-06-16 17:51:44 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
buffer = MSI_RecordGetString(row,5);
|
|
|
|
if (buffer)
|
2005-09-22 12:33:57 +02:00
|
|
|
progid->IconPath = build_icon_path(package,buffer);
|
2005-06-16 17:51:44 +02:00
|
|
|
}
|
|
|
|
|
2005-09-06 11:26:18 +02:00
|
|
|
progid->CurVer = NULL;
|
|
|
|
progid->VersionInd = NULL;
|
2005-06-16 17:51:44 +02:00
|
|
|
|
|
|
|
/* if we have a parent then we may be that parents CurVer */
|
2005-09-06 11:26:18 +02:00
|
|
|
if (progid->Parent && progid->Parent != progid)
|
2005-06-16 17:51:44 +02:00
|
|
|
{
|
2005-09-06 11:26:18 +02:00
|
|
|
MSIPROGID *parent = progid->Parent;
|
|
|
|
|
2005-09-08 13:03:55 +02:00
|
|
|
while (parent->Parent && parent->Parent != parent)
|
2005-09-06 11:26:18 +02:00
|
|
|
parent = parent->Parent;
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2007-12-31 19:06:07 +01:00
|
|
|
/* FIXME: need to determine if we are really the CurVer */
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-09-06 11:26:18 +02:00
|
|
|
progid->CurVer = parent;
|
2005-09-08 13:03:55 +02:00
|
|
|
parent->VersionInd = progid;
|
2005-06-16 17:51:44 +02:00
|
|
|
}
|
|
|
|
|
2005-09-06 11:26:18 +02:00
|
|
|
return progid;
|
2005-06-16 17:51:44 +02:00
|
|
|
}
|
|
|
|
|
2005-09-06 11:26:18 +02:00
|
|
|
static MSIPROGID *load_given_progid(MSIPACKAGE *package, LPCWSTR name)
|
2005-06-16 17:51:44 +02:00
|
|
|
{
|
2005-09-06 11:26:18 +02:00
|
|
|
MSIPROGID *progid;
|
2005-06-16 17:51:44 +02:00
|
|
|
MSIRECORD *row;
|
|
|
|
static const WCHAR ExecSeqQuery[] =
|
|
|
|
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
|
|
|
|
'`','P','r','o','g','I','d','`',' ','W','H','E','R','E',' ',
|
|
|
|
'`','P','r','o','g','I','d','`',' ','=',' ','\'','%','s','\'',0};
|
|
|
|
|
2005-09-06 11:26:18 +02:00
|
|
|
if (!name)
|
|
|
|
return NULL;
|
2005-06-16 17:51:44 +02:00
|
|
|
|
|
|
|
/* check for progids already loaded */
|
2005-09-06 11:26:18 +02:00
|
|
|
LIST_FOR_EACH_ENTRY( progid, &package->progids, MSIPROGID, entry )
|
|
|
|
{
|
|
|
|
if (strcmpiW( progid->ProgID,name )==0)
|
2005-06-16 17:51:44 +02:00
|
|
|
{
|
2005-09-06 11:26:18 +02:00
|
|
|
TRACE("found progid %s (%p)\n",debugstr_w(name), progid );
|
|
|
|
return progid;
|
2005-06-16 17:51:44 +02:00
|
|
|
}
|
2005-09-06 11:26:18 +02:00
|
|
|
}
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-09-06 11:26:18 +02:00
|
|
|
row = MSI_QueryGetRecord( package->db, ExecSeqQuery, name );
|
|
|
|
if (!row)
|
|
|
|
return NULL;
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-09-06 11:26:18 +02:00
|
|
|
progid = load_progid(package, row);
|
2005-06-16 17:51:44 +02:00
|
|
|
msiobj_release(&row->hdr);
|
|
|
|
|
2005-09-06 11:26:18 +02:00
|
|
|
return progid;
|
2005-06-16 17:51:44 +02:00
|
|
|
}
|
|
|
|
|
2005-08-25 12:22:32 +02:00
|
|
|
static MSICLASS *load_class( MSIPACKAGE* package, MSIRECORD *row )
|
2005-06-16 17:51:44 +02:00
|
|
|
{
|
2005-08-25 12:22:32 +02:00
|
|
|
MSICLASS *cls;
|
2005-09-12 17:28:00 +02:00
|
|
|
DWORD i;
|
2005-06-16 17:51:44 +02:00
|
|
|
LPCWSTR buffer;
|
|
|
|
|
|
|
|
/* fill in the data */
|
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
cls = msi_alloc_zero( sizeof(MSICLASS) );
|
2005-08-25 12:22:32 +02:00
|
|
|
if (!cls)
|
|
|
|
return NULL;
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-09-02 13:21:22 +02:00
|
|
|
list_add_tail( &package->classes, &cls->entry );
|
|
|
|
|
2005-10-27 14:36:12 +02:00
|
|
|
cls->clsid = msi_dup_record_field( row, 1 );
|
2005-09-12 17:28:00 +02:00
|
|
|
TRACE("loading class %s\n",debugstr_w(cls->clsid));
|
2005-10-27 14:36:12 +02:00
|
|
|
cls->Context = msi_dup_record_field( row, 2 );
|
2005-06-16 17:51:44 +02:00
|
|
|
buffer = MSI_RecordGetString(row,3);
|
2005-08-25 12:22:32 +02:00
|
|
|
cls->Component = get_loaded_component(package, buffer);
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-10-27 14:36:12 +02:00
|
|
|
cls->ProgIDText = msi_dup_record_field(row,4);
|
2005-09-06 11:26:18 +02:00
|
|
|
cls->ProgID = load_given_progid(package, cls->ProgIDText);
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-10-27 14:36:12 +02:00
|
|
|
cls->Description = msi_dup_record_field(row,5);
|
2005-06-16 17:51:44 +02:00
|
|
|
|
|
|
|
buffer = MSI_RecordGetString(row,6);
|
|
|
|
if (buffer)
|
2005-08-25 12:22:32 +02:00
|
|
|
cls->AppID = load_given_appid(package, buffer);
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-10-27 14:36:12 +02:00
|
|
|
cls->FileTypeMask = msi_dup_record_field(row,7);
|
2005-06-16 17:51:44 +02:00
|
|
|
|
|
|
|
if (!MSI_RecordIsNull(row,9))
|
|
|
|
{
|
|
|
|
|
|
|
|
INT icon_index = MSI_RecordGetInteger(row,9);
|
2005-10-27 14:36:12 +02:00
|
|
|
LPCWSTR FileName = MSI_RecordGetString(row,8);
|
2005-06-16 17:51:44 +02:00
|
|
|
LPWSTR FilePath;
|
|
|
|
static const WCHAR fmt[] = {'%','s',',','%','i',0};
|
|
|
|
|
2005-09-22 12:33:57 +02:00
|
|
|
FilePath = build_icon_path(package,FileName);
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
cls->IconPath = msi_alloc( (strlenW(FilePath)+5)* sizeof(WCHAR) );
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-08-25 12:22:32 +02:00
|
|
|
sprintfW(cls->IconPath,fmt,FilePath,icon_index);
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(FilePath);
|
2005-06-16 17:51:44 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
buffer = MSI_RecordGetString(row,8);
|
|
|
|
if (buffer)
|
2005-09-22 12:33:57 +02:00
|
|
|
cls->IconPath = build_icon_path(package,buffer);
|
2005-06-16 17:51:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!MSI_RecordIsNull(row,10))
|
|
|
|
{
|
|
|
|
i = MSI_RecordGetInteger(row,10);
|
|
|
|
if (i != MSI_NULL_INTEGER && i > 0 && i < 4)
|
|
|
|
{
|
|
|
|
static const WCHAR ole2[] = {'o','l','e','2','.','d','l','l',0};
|
|
|
|
static const WCHAR ole32[] = {'o','l','e','3','2','.','d','l','l',0};
|
|
|
|
|
|
|
|
switch(i)
|
|
|
|
{
|
|
|
|
case 1:
|
2005-08-25 12:22:32 +02:00
|
|
|
cls->DefInprocHandler = strdupW(ole2);
|
2005-06-16 17:51:44 +02:00
|
|
|
break;
|
|
|
|
case 2:
|
2005-08-25 12:22:32 +02:00
|
|
|
cls->DefInprocHandler32 = strdupW(ole32);
|
2005-06-16 17:51:44 +02:00
|
|
|
break;
|
|
|
|
case 3:
|
2005-08-25 12:22:32 +02:00
|
|
|
cls->DefInprocHandler = strdupW(ole2);
|
|
|
|
cls->DefInprocHandler32 = strdupW(ole32);
|
2005-06-16 17:51:44 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-10-27 14:36:12 +02:00
|
|
|
cls->DefInprocHandler32 = msi_dup_record_field( row, 10);
|
2005-08-25 12:22:32 +02:00
|
|
|
reduce_to_longfilename(cls->DefInprocHandler32);
|
2005-06-16 17:51:44 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
buffer = MSI_RecordGetString(row,11);
|
2005-08-25 12:22:32 +02:00
|
|
|
deformat_string(package,buffer,&cls->Argument);
|
2005-06-16 17:51:44 +02:00
|
|
|
|
|
|
|
buffer = MSI_RecordGetString(row,12);
|
2005-08-25 12:22:32 +02:00
|
|
|
cls->Feature = get_loaded_feature(package,buffer);
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-08-25 12:22:32 +02:00
|
|
|
cls->Attributes = MSI_RecordGetInteger(row,13);
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-08-25 12:22:32 +02:00
|
|
|
return cls;
|
2005-06-16 17:51:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* the Class table has 3 primary keys. Generally it is only
|
|
|
|
* referenced through the first CLSID key. However when loading
|
|
|
|
* all of the classes we need to make sure we do not ignore rows
|
|
|
|
* with other Context and ComponentIndexs
|
|
|
|
*/
|
2005-08-25 12:22:32 +02:00
|
|
|
static MSICLASS *load_given_class(MSIPACKAGE *package, LPCWSTR classid)
|
2005-06-16 17:51:44 +02:00
|
|
|
{
|
2005-08-25 12:22:32 +02:00
|
|
|
MSICLASS *cls;
|
2005-06-16 17:51:44 +02:00
|
|
|
MSIRECORD *row;
|
|
|
|
static const WCHAR ExecSeqQuery[] =
|
|
|
|
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
|
|
|
|
'`','C','l','a','s','s','`',' ','W','H','E','R','E',' ',
|
|
|
|
'`','C','L','S','I','D','`',' ','=',' ','\'','%','s','\'',0};
|
|
|
|
|
|
|
|
if (!classid)
|
2005-08-25 12:22:32 +02:00
|
|
|
return NULL;
|
2005-06-16 17:51:44 +02:00
|
|
|
|
|
|
|
/* check for classes already loaded */
|
2005-08-25 12:22:32 +02:00
|
|
|
LIST_FOR_EACH_ENTRY( cls, &package->classes, MSICLASS, entry )
|
|
|
|
{
|
2005-09-12 17:28:00 +02:00
|
|
|
if (lstrcmpiW( cls->clsid, classid )==0)
|
2005-06-16 17:51:44 +02:00
|
|
|
{
|
2005-08-25 12:22:32 +02:00
|
|
|
TRACE("found class %s (%p)\n",debugstr_w(classid), cls);
|
|
|
|
return cls;
|
2005-06-16 17:51:44 +02:00
|
|
|
}
|
2005-08-25 12:22:32 +02:00
|
|
|
}
|
|
|
|
|
2005-06-16 17:51:44 +02:00
|
|
|
row = MSI_QueryGetRecord(package->db, ExecSeqQuery, classid);
|
|
|
|
if (!row)
|
2005-08-25 12:22:32 +02:00
|
|
|
return NULL;
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-08-25 12:22:32 +02:00
|
|
|
cls = load_class(package, row);
|
2005-06-16 17:51:44 +02:00
|
|
|
msiobj_release(&row->hdr);
|
|
|
|
|
2005-08-25 12:22:32 +02:00
|
|
|
return cls;
|
2005-06-16 17:51:44 +02:00
|
|
|
}
|
|
|
|
|
2005-08-29 11:38:39 +02:00
|
|
|
static MSIEXTENSION *load_given_extension( MSIPACKAGE *package, LPCWSTR extension );
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-08-26 10:47:31 +02:00
|
|
|
static MSIMIME *load_mime( MSIPACKAGE* package, MSIRECORD *row )
|
2005-06-16 17:51:44 +02:00
|
|
|
{
|
|
|
|
LPCWSTR buffer;
|
2005-08-26 10:47:31 +02:00
|
|
|
MSIMIME *mt;
|
2005-06-16 17:51:44 +02:00
|
|
|
|
|
|
|
/* fill in the data */
|
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
mt = msi_alloc_zero( sizeof(MSIMIME) );
|
2005-08-26 10:47:31 +02:00
|
|
|
if (!mt)
|
|
|
|
return mt;
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-10-27 14:36:12 +02:00
|
|
|
mt->ContentType = msi_dup_record_field( row, 1 );
|
2005-08-26 10:47:31 +02:00
|
|
|
TRACE("loading mime %s\n", debugstr_w(mt->ContentType));
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-08-26 10:47:31 +02:00
|
|
|
buffer = MSI_RecordGetString( row, 2 );
|
2005-08-29 11:38:39 +02:00
|
|
|
mt->Extension = load_given_extension( package, buffer );
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-10-27 14:36:12 +02:00
|
|
|
mt->clsid = msi_dup_record_field( row, 3 );
|
2005-09-12 17:28:00 +02:00
|
|
|
mt->Class = load_given_class( package, mt->clsid );
|
2005-08-27 12:01:03 +02:00
|
|
|
|
|
|
|
list_add_tail( &package->mimes, &mt->entry );
|
2005-08-29 11:38:39 +02:00
|
|
|
|
2005-08-26 10:47:31 +02:00
|
|
|
return mt;
|
2005-06-16 17:51:44 +02:00
|
|
|
}
|
|
|
|
|
2005-08-26 10:47:31 +02:00
|
|
|
static MSIMIME *load_given_mime( MSIPACKAGE *package, LPCWSTR mime )
|
2005-06-16 17:51:44 +02:00
|
|
|
{
|
|
|
|
MSIRECORD *row;
|
|
|
|
static const WCHAR ExecSeqQuery[] =
|
|
|
|
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
|
|
|
|
'`','M','I','M','E','`',' ','W','H','E','R','E',' ',
|
|
|
|
'`','C','o','n','t','e','n','t','T','y','p','e','`',' ','=',' ',
|
|
|
|
'\'','%','s','\'',0};
|
2005-08-26 10:47:31 +02:00
|
|
|
MSIMIME *mt;
|
2005-06-16 17:51:44 +02:00
|
|
|
|
|
|
|
if (!mime)
|
2005-08-26 10:47:31 +02:00
|
|
|
return NULL;
|
2005-06-16 17:51:44 +02:00
|
|
|
|
|
|
|
/* check for mime already loaded */
|
2005-08-26 10:47:31 +02:00
|
|
|
LIST_FOR_EACH_ENTRY( mt, &package->mimes, MSIMIME, entry )
|
|
|
|
{
|
|
|
|
if (strcmpiW(mt->ContentType,mime)==0)
|
2005-06-16 17:51:44 +02:00
|
|
|
{
|
2005-08-26 10:47:31 +02:00
|
|
|
TRACE("found mime %s (%p)\n",debugstr_w(mime), mt);
|
|
|
|
return mt;
|
2005-06-16 17:51:44 +02:00
|
|
|
}
|
2005-08-26 10:47:31 +02:00
|
|
|
}
|
2005-06-16 17:51:44 +02:00
|
|
|
|
|
|
|
row = MSI_QueryGetRecord(package->db, ExecSeqQuery, mime);
|
|
|
|
if (!row)
|
2005-08-26 10:47:31 +02:00
|
|
|
return NULL;
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-08-26 10:47:31 +02:00
|
|
|
mt = load_mime(package, row);
|
2005-06-16 17:51:44 +02:00
|
|
|
msiobj_release(&row->hdr);
|
|
|
|
|
2005-08-26 10:47:31 +02:00
|
|
|
return mt;
|
2005-06-16 17:51:44 +02:00
|
|
|
}
|
|
|
|
|
2005-08-29 11:38:39 +02:00
|
|
|
static MSIEXTENSION *load_extension( MSIPACKAGE* package, MSIRECORD *row )
|
2005-06-16 17:51:44 +02:00
|
|
|
{
|
2005-08-29 11:38:39 +02:00
|
|
|
MSIEXTENSION *ext;
|
2005-06-16 17:51:44 +02:00
|
|
|
LPCWSTR buffer;
|
|
|
|
|
|
|
|
/* fill in the data */
|
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
ext = msi_alloc_zero( sizeof(MSIEXTENSION) );
|
2005-09-02 13:21:22 +02:00
|
|
|
if (!ext)
|
|
|
|
return NULL;
|
|
|
|
|
2005-09-02 16:39:13 +02:00
|
|
|
list_init( &ext->verbs );
|
|
|
|
|
2005-09-02 13:21:22 +02:00
|
|
|
list_add_tail( &package->extensions, &ext->entry );
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-10-27 14:36:12 +02:00
|
|
|
ext->Extension = msi_dup_record_field( row, 1 );
|
2005-08-29 11:38:39 +02:00
|
|
|
TRACE("loading extension %s\n", debugstr_w(ext->Extension));
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-08-29 11:38:39 +02:00
|
|
|
buffer = MSI_RecordGetString( row, 2 );
|
|
|
|
ext->Component = get_loaded_component( package,buffer );
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-10-27 14:36:12 +02:00
|
|
|
ext->ProgIDText = msi_dup_record_field( row, 3 );
|
2005-09-06 11:26:18 +02:00
|
|
|
ext->ProgID = load_given_progid( package, ext->ProgIDText );
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-08-29 11:38:39 +02:00
|
|
|
buffer = MSI_RecordGetString( row, 4 );
|
|
|
|
ext->Mime = load_given_mime( package, buffer );
|
2005-06-16 17:51:44 +02:00
|
|
|
|
|
|
|
buffer = MSI_RecordGetString(row,5);
|
2005-08-29 11:38:39 +02:00
|
|
|
ext->Feature = get_loaded_feature( package, buffer );
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-08-29 11:38:39 +02:00
|
|
|
return ext;
|
2005-06-16 17:51:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* While the extension table has 2 primary keys, this function is only looking
|
2007-12-31 19:06:07 +01:00
|
|
|
* at the Extension key which is what is referenced as a foreign key
|
2005-06-16 17:51:44 +02:00
|
|
|
*/
|
2005-08-29 11:38:39 +02:00
|
|
|
static MSIEXTENSION *load_given_extension( MSIPACKAGE *package, LPCWSTR name )
|
2005-06-16 17:51:44 +02:00
|
|
|
{
|
|
|
|
MSIRECORD *row;
|
2005-08-29 11:38:39 +02:00
|
|
|
MSIEXTENSION *ext;
|
2005-06-16 17:51:44 +02:00
|
|
|
static const WCHAR ExecSeqQuery[] =
|
|
|
|
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
|
|
|
|
'`','E','x','t','e','n','s','i','o','n','`',' ',
|
|
|
|
'W','H','E','R','E',' ',
|
|
|
|
'`','E','x','t','e','n','s','i','o','n','`',' ','=',' ',
|
|
|
|
'\'','%','s','\'',0};
|
|
|
|
|
2005-08-29 11:38:39 +02:00
|
|
|
if (!name)
|
|
|
|
return NULL;
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2008-10-27 07:52:49 +01:00
|
|
|
if (name[0] == '.')
|
|
|
|
name++;
|
|
|
|
|
2005-06-16 17:51:44 +02:00
|
|
|
/* check for extensions already loaded */
|
2005-08-29 11:38:39 +02:00
|
|
|
LIST_FOR_EACH_ENTRY( ext, &package->extensions, MSIEXTENSION, entry )
|
|
|
|
{
|
|
|
|
if (strcmpiW( ext->Extension, name )==0)
|
2005-06-16 17:51:44 +02:00
|
|
|
{
|
2005-08-29 11:38:39 +02:00
|
|
|
TRACE("extension %s already loaded %p\n", debugstr_w(name), ext);
|
|
|
|
return ext;
|
2005-06-16 17:51:44 +02:00
|
|
|
}
|
2005-08-29 11:38:39 +02:00
|
|
|
}
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-08-29 11:38:39 +02:00
|
|
|
row = MSI_QueryGetRecord( package->db, ExecSeqQuery, name );
|
2005-06-16 17:51:44 +02:00
|
|
|
if (!row)
|
2005-08-29 11:38:39 +02:00
|
|
|
return NULL;
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-08-29 11:38:39 +02:00
|
|
|
ext = load_extension(package, row);
|
2005-06-16 17:51:44 +02:00
|
|
|
msiobj_release(&row->hdr);
|
|
|
|
|
2005-08-29 11:38:39 +02:00
|
|
|
return ext;
|
2005-06-16 17:51:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static UINT iterate_load_verb(MSIRECORD *row, LPVOID param)
|
|
|
|
{
|
2009-01-15 09:46:57 +01:00
|
|
|
MSIPACKAGE* package = param;
|
2005-09-02 16:39:13 +02:00
|
|
|
MSIVERB *verb;
|
2005-06-16 17:51:44 +02:00
|
|
|
LPCWSTR buffer;
|
2005-09-02 16:39:13 +02:00
|
|
|
MSIEXTENSION *extension;
|
2005-06-16 17:51:44 +02:00
|
|
|
|
|
|
|
buffer = MSI_RecordGetString(row,1);
|
2005-09-02 16:39:13 +02:00
|
|
|
extension = load_given_extension( package, buffer );
|
|
|
|
if (!extension)
|
|
|
|
{
|
2005-06-16 17:51:44 +02:00
|
|
|
ERR("Verb unable to find loaded extension %s\n", debugstr_w(buffer));
|
2005-09-02 16:39:13 +02:00
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* fill in the data */
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
verb = msi_alloc_zero( sizeof(MSIVERB) );
|
2005-09-02 16:39:13 +02:00
|
|
|
if (!verb)
|
|
|
|
return ERROR_OUTOFMEMORY;
|
|
|
|
|
2005-10-27 14:36:12 +02:00
|
|
|
verb->Verb = msi_dup_record_field(row,2);
|
2005-09-02 16:39:13 +02:00
|
|
|
TRACE("loading verb %s\n",debugstr_w(verb->Verb));
|
|
|
|
verb->Sequence = MSI_RecordGetInteger(row,3);
|
2005-06-16 17:51:44 +02:00
|
|
|
|
|
|
|
buffer = MSI_RecordGetString(row,4);
|
2005-09-02 16:39:13 +02:00
|
|
|
deformat_string(package,buffer,&verb->Command);
|
2005-06-16 17:51:44 +02:00
|
|
|
|
|
|
|
buffer = MSI_RecordGetString(row,5);
|
2005-09-02 16:39:13 +02:00
|
|
|
deformat_string(package,buffer,&verb->Argument);
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2007-12-31 19:06:07 +01:00
|
|
|
/* associate the verb with the correct extension */
|
2005-09-02 16:39:13 +02:00
|
|
|
list_add_tail( &extension->verbs, &verb->entry );
|
2005-06-16 17:51:44 +02:00
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static UINT iterate_all_classes(MSIRECORD *rec, LPVOID param)
|
|
|
|
{
|
2005-08-22 11:15:23 +02:00
|
|
|
MSICOMPONENT *comp;
|
2005-06-16 17:51:44 +02:00
|
|
|
LPCWSTR clsid;
|
|
|
|
LPCWSTR context;
|
|
|
|
LPCWSTR buffer;
|
2009-01-15 09:46:57 +01:00
|
|
|
MSIPACKAGE* package = param;
|
2005-08-25 12:22:32 +02:00
|
|
|
MSICLASS *cls;
|
2005-06-16 17:51:44 +02:00
|
|
|
BOOL match = FALSE;
|
|
|
|
|
|
|
|
clsid = MSI_RecordGetString(rec,1);
|
|
|
|
context = MSI_RecordGetString(rec,2);
|
|
|
|
buffer = MSI_RecordGetString(rec,3);
|
2005-08-22 11:15:23 +02:00
|
|
|
comp = get_loaded_component(package,buffer);
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-08-25 12:22:32 +02:00
|
|
|
LIST_FOR_EACH_ENTRY( cls, &package->classes, MSICLASS, entry )
|
2005-06-16 17:51:44 +02:00
|
|
|
{
|
2005-09-12 17:28:00 +02:00
|
|
|
if (strcmpiW( clsid, cls->clsid ))
|
2005-06-16 17:51:44 +02:00
|
|
|
continue;
|
2005-08-25 12:22:32 +02:00
|
|
|
if (strcmpW( context, cls->Context ))
|
2005-06-16 17:51:44 +02:00
|
|
|
continue;
|
2005-08-25 12:22:32 +02:00
|
|
|
if (comp == cls->Component)
|
2005-06-16 17:51:44 +02:00
|
|
|
{
|
|
|
|
match = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!match)
|
|
|
|
load_class(package, rec);
|
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static VOID load_all_classes(MSIPACKAGE *package)
|
|
|
|
{
|
|
|
|
UINT rc = ERROR_SUCCESS;
|
|
|
|
MSIQUERY *view;
|
|
|
|
|
|
|
|
static const WCHAR ExecSeqQuery[] =
|
|
|
|
{'S','E','L','E','C','T',' ','*',' ', 'F','R','O','M',' ',
|
|
|
|
'`','C','l','a','s','s','`',0};
|
|
|
|
|
|
|
|
rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view);
|
|
|
|
if (rc != ERROR_SUCCESS)
|
|
|
|
return;
|
|
|
|
|
|
|
|
rc = MSI_IterateRecords(view, NULL, iterate_all_classes, package);
|
|
|
|
msiobj_release(&view->hdr);
|
|
|
|
}
|
|
|
|
|
|
|
|
static UINT iterate_all_extensions(MSIRECORD *rec, LPVOID param)
|
|
|
|
{
|
2005-08-22 11:15:23 +02:00
|
|
|
MSICOMPONENT *comp;
|
2005-06-16 17:51:44 +02:00
|
|
|
LPCWSTR buffer;
|
|
|
|
LPCWSTR extension;
|
2009-01-15 09:46:57 +01:00
|
|
|
MSIPACKAGE* package = param;
|
2005-06-16 17:51:44 +02:00
|
|
|
BOOL match = FALSE;
|
2005-08-29 11:38:39 +02:00
|
|
|
MSIEXTENSION *ext;
|
2005-06-16 17:51:44 +02:00
|
|
|
|
|
|
|
extension = MSI_RecordGetString(rec,1);
|
|
|
|
buffer = MSI_RecordGetString(rec,2);
|
2005-08-22 11:15:23 +02:00
|
|
|
comp = get_loaded_component(package,buffer);
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-08-29 11:38:39 +02:00
|
|
|
LIST_FOR_EACH_ENTRY( ext, &package->extensions, MSIEXTENSION, entry )
|
2005-06-16 17:51:44 +02:00
|
|
|
{
|
2005-08-29 11:38:39 +02:00
|
|
|
if (strcmpiW(extension,ext->Extension))
|
2005-06-16 17:51:44 +02:00
|
|
|
continue;
|
2005-08-29 11:38:39 +02:00
|
|
|
if (comp == ext->Component)
|
2005-06-16 17:51:44 +02:00
|
|
|
{
|
|
|
|
match = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!match)
|
|
|
|
load_extension(package, rec);
|
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static VOID load_all_extensions(MSIPACKAGE *package)
|
|
|
|
{
|
|
|
|
UINT rc = ERROR_SUCCESS;
|
|
|
|
MSIQUERY *view;
|
|
|
|
|
|
|
|
static const WCHAR ExecSeqQuery[] =
|
|
|
|
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
|
|
|
|
'`','E','x','t','e','n','s','i','o','n','`',0};
|
|
|
|
|
|
|
|
rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view);
|
|
|
|
if (rc != ERROR_SUCCESS)
|
|
|
|
return;
|
|
|
|
|
|
|
|
rc = MSI_IterateRecords(view, NULL, iterate_all_extensions, package);
|
|
|
|
msiobj_release(&view->hdr);
|
|
|
|
}
|
|
|
|
|
|
|
|
static UINT iterate_all_progids(MSIRECORD *rec, LPVOID param)
|
|
|
|
{
|
|
|
|
LPCWSTR buffer;
|
2009-01-15 09:46:57 +01:00
|
|
|
MSIPACKAGE* package = param;
|
2005-06-16 17:51:44 +02:00
|
|
|
|
|
|
|
buffer = MSI_RecordGetString(rec,1);
|
|
|
|
load_given_progid(package,buffer);
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static VOID load_all_progids(MSIPACKAGE *package)
|
|
|
|
{
|
|
|
|
UINT rc = ERROR_SUCCESS;
|
|
|
|
MSIQUERY *view;
|
|
|
|
|
|
|
|
static const WCHAR ExecSeqQuery[] =
|
|
|
|
{'S','E','L','E','C','T',' ','`','P','r','o','g','I','d','`',' ',
|
|
|
|
'F','R','O','M',' ', '`','P','r','o','g','I','d','`',0};
|
|
|
|
|
|
|
|
rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view);
|
|
|
|
if (rc != ERROR_SUCCESS)
|
|
|
|
return;
|
|
|
|
|
|
|
|
rc = MSI_IterateRecords(view, NULL, iterate_all_progids, package);
|
|
|
|
msiobj_release(&view->hdr);
|
|
|
|
}
|
|
|
|
|
|
|
|
static VOID load_all_verbs(MSIPACKAGE *package)
|
|
|
|
{
|
|
|
|
UINT rc = ERROR_SUCCESS;
|
|
|
|
MSIQUERY *view;
|
|
|
|
|
|
|
|
static const WCHAR ExecSeqQuery[] =
|
|
|
|
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
|
|
|
|
'`','V','e','r','b','`',0};
|
|
|
|
|
|
|
|
rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view);
|
|
|
|
if (rc != ERROR_SUCCESS)
|
|
|
|
return;
|
|
|
|
|
|
|
|
rc = MSI_IterateRecords(view, NULL, iterate_load_verb, package);
|
|
|
|
msiobj_release(&view->hdr);
|
|
|
|
}
|
|
|
|
|
|
|
|
static UINT iterate_all_mimes(MSIRECORD *rec, LPVOID param)
|
|
|
|
{
|
|
|
|
LPCWSTR buffer;
|
2009-01-15 09:46:57 +01:00
|
|
|
MSIPACKAGE* package = param;
|
2005-06-16 17:51:44 +02:00
|
|
|
|
|
|
|
buffer = MSI_RecordGetString(rec,1);
|
|
|
|
load_given_mime(package,buffer);
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static VOID load_all_mimes(MSIPACKAGE *package)
|
|
|
|
{
|
|
|
|
UINT rc = ERROR_SUCCESS;
|
|
|
|
MSIQUERY *view;
|
|
|
|
|
|
|
|
static const WCHAR ExecSeqQuery[] =
|
|
|
|
{'S','E','L','E','C','T',' ',
|
|
|
|
'`','C','o','n','t','e','n','t','T','y','p','e','`',
|
|
|
|
' ','F','R','O','M',' ',
|
|
|
|
'`','M','I','M','E','`',0};
|
|
|
|
|
|
|
|
rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view);
|
|
|
|
if (rc != ERROR_SUCCESS)
|
|
|
|
return;
|
|
|
|
|
|
|
|
rc = MSI_IterateRecords(view, NULL, iterate_all_mimes, package);
|
|
|
|
msiobj_release(&view->hdr);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void load_classes_and_such(MSIPACKAGE *package)
|
|
|
|
{
|
|
|
|
TRACE("Loading all the class info and related tables\n");
|
|
|
|
|
|
|
|
/* check if already loaded */
|
2005-08-25 12:22:32 +02:00
|
|
|
if (!list_empty( &package->classes ) ||
|
2005-08-29 11:38:39 +02:00
|
|
|
!list_empty( &package->mimes ) ||
|
|
|
|
!list_empty( &package->extensions ) ||
|
2005-09-06 11:26:18 +02:00
|
|
|
!list_empty( &package->progids ) )
|
2005-06-16 17:51:44 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
load_all_classes(package);
|
|
|
|
load_all_extensions(package);
|
|
|
|
load_all_progids(package);
|
|
|
|
/* these loads must come after the other loads */
|
|
|
|
load_all_verbs(package);
|
|
|
|
load_all_mimes(package);
|
|
|
|
}
|
|
|
|
|
2005-09-06 11:26:18 +02:00
|
|
|
static void mark_progid_for_install( MSIPACKAGE* package, MSIPROGID *progid )
|
2005-06-16 17:51:44 +02:00
|
|
|
{
|
2005-09-06 11:26:18 +02:00
|
|
|
MSIPROGID *child;
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-09-06 11:26:18 +02:00
|
|
|
if (!progid)
|
2005-06-16 17:51:44 +02:00
|
|
|
return;
|
|
|
|
|
2006-05-24 12:29:06 +02:00
|
|
|
if (progid->InstallMe)
|
2005-06-16 17:51:44 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
progid->InstallMe = TRUE;
|
|
|
|
|
|
|
|
/* all children if this is a parent also install */
|
2005-09-06 11:26:18 +02:00
|
|
|
LIST_FOR_EACH_ENTRY( child, &package->progids, MSIPROGID, entry )
|
|
|
|
{
|
|
|
|
if (child->Parent == progid)
|
|
|
|
mark_progid_for_install( package, child );
|
|
|
|
}
|
2005-06-16 17:51:44 +02:00
|
|
|
}
|
|
|
|
|
2010-04-02 10:37:50 +02:00
|
|
|
static void mark_progid_for_uninstall( MSIPACKAGE *package, MSIPROGID *progid )
|
|
|
|
{
|
|
|
|
MSIPROGID *child;
|
|
|
|
|
|
|
|
if (!progid)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!progid->InstallMe)
|
|
|
|
return;
|
|
|
|
|
|
|
|
progid->InstallMe = FALSE;
|
|
|
|
|
|
|
|
LIST_FOR_EACH_ENTRY( child, &package->progids, MSIPROGID, entry )
|
|
|
|
{
|
|
|
|
if (child->Parent == progid)
|
|
|
|
mark_progid_for_uninstall( package, child );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-08-26 10:47:31 +02:00
|
|
|
static void mark_mime_for_install( MSIMIME *mime )
|
2005-06-16 17:51:44 +02:00
|
|
|
{
|
2005-08-26 10:47:31 +02:00
|
|
|
if (!mime)
|
2005-06-16 17:51:44 +02:00
|
|
|
return;
|
|
|
|
mime->InstallMe = TRUE;
|
|
|
|
}
|
|
|
|
|
2007-05-31 23:19:28 +02:00
|
|
|
static UINT register_appid(const MSIAPPID *appid, LPCWSTR app )
|
2005-06-16 17:51:44 +02:00
|
|
|
{
|
2005-09-15 11:31:41 +02:00
|
|
|
static const WCHAR szRemoteServerName[] =
|
|
|
|
{'R','e','m','o','t','e','S','e','r','v','e','r','N','a','m','e',0};
|
|
|
|
static const WCHAR szLocalService[] =
|
|
|
|
{'L','o','c','a','l','S','e','r','v','i','c','e',0};
|
|
|
|
static const WCHAR szService[] =
|
|
|
|
{'S','e','r','v','i','c','e','P','a','r','a','m','e','t','e','r','s',0};
|
|
|
|
static const WCHAR szDLL[] =
|
|
|
|
{'D','l','l','S','u','r','r','o','g','a','t','e',0};
|
|
|
|
static const WCHAR szActivate[] =
|
|
|
|
{'A','c','t','i','v','a','t','e','A','s','S','t','o','r','a','g','e',0};
|
|
|
|
static const WCHAR szY[] = {'Y',0};
|
|
|
|
static const WCHAR szRunAs[] = {'R','u','n','A','s',0};
|
|
|
|
static const WCHAR szUser[] =
|
|
|
|
{'I','n','t','e','r','a','c','t','i','v','e',' ','U','s','e','r',0};
|
|
|
|
|
2005-06-16 17:51:44 +02:00
|
|
|
HKEY hkey2,hkey3;
|
|
|
|
|
|
|
|
RegCreateKeyW(HKEY_CLASSES_ROOT,szAppID,&hkey2);
|
2005-08-24 11:45:18 +02:00
|
|
|
RegCreateKeyW( hkey2, appid->AppID, &hkey3 );
|
2005-09-15 11:31:41 +02:00
|
|
|
RegCloseKey(hkey2);
|
2005-09-14 17:42:27 +02:00
|
|
|
msi_reg_set_val_str( hkey3, NULL, app );
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-08-24 11:45:18 +02:00
|
|
|
if (appid->RemoteServerName)
|
2005-09-14 17:42:27 +02:00
|
|
|
msi_reg_set_val_str( hkey3, szRemoteServerName, appid->RemoteServerName );
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-08-24 11:45:18 +02:00
|
|
|
if (appid->LocalServer)
|
2005-09-14 17:42:27 +02:00
|
|
|
msi_reg_set_val_str( hkey3, szLocalService, appid->LocalServer );
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-08-24 11:45:18 +02:00
|
|
|
if (appid->ServiceParameters)
|
2005-09-14 17:42:27 +02:00
|
|
|
msi_reg_set_val_str( hkey3, szService, appid->ServiceParameters );
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-08-24 11:45:18 +02:00
|
|
|
if (appid->DllSurrogate)
|
2005-09-14 17:42:27 +02:00
|
|
|
msi_reg_set_val_str( hkey3, szDLL, appid->DllSurrogate );
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-08-24 11:45:18 +02:00
|
|
|
if (appid->ActivateAtStorage)
|
2005-09-14 17:42:27 +02:00
|
|
|
msi_reg_set_val_str( hkey3, szActivate, szY );
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-08-24 11:45:18 +02:00
|
|
|
if (appid->RunAsInteractiveUser)
|
2005-09-14 17:42:27 +02:00
|
|
|
msi_reg_set_val_str( hkey3, szRunAs, szUser );
|
2005-06-16 17:51:44 +02:00
|
|
|
|
|
|
|
RegCloseKey(hkey3);
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
UINT ACTION_RegisterClassInfo(MSIPACKAGE *package)
|
|
|
|
{
|
|
|
|
static const WCHAR szFileType_fmt[] = {'F','i','l','e','T','y','p','e','\\','%','s','\\','%','i',0};
|
2010-04-02 10:37:50 +02:00
|
|
|
MSIRECORD *uirow;
|
2005-06-16 17:51:44 +02:00
|
|
|
HKEY hkey,hkey2,hkey3;
|
2005-08-25 12:22:32 +02:00
|
|
|
MSICLASS *cls;
|
2005-06-16 17:51:44 +02:00
|
|
|
|
|
|
|
load_classes_and_such(package);
|
2010-04-02 10:37:50 +02:00
|
|
|
if (RegCreateKeyW(HKEY_CLASSES_ROOT, szCLSID, &hkey) != ERROR_SUCCESS)
|
2005-06-16 17:51:44 +02:00
|
|
|
return ERROR_FUNCTION_FAILED;
|
|
|
|
|
2005-08-25 12:22:32 +02:00
|
|
|
LIST_FOR_EACH_ENTRY( cls, &package->classes, MSICLASS, entry )
|
2005-06-16 17:51:44 +02:00
|
|
|
{
|
2005-08-22 11:15:23 +02:00
|
|
|
MSICOMPONENT *comp;
|
2005-08-23 12:03:17 +02:00
|
|
|
MSIFILE *file;
|
2006-08-02 13:41:13 +02:00
|
|
|
DWORD size;
|
2005-06-16 17:51:44 +02:00
|
|
|
LPWSTR argument;
|
2005-08-22 16:09:17 +02:00
|
|
|
MSIFEATURE *feature;
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-08-25 12:22:32 +02:00
|
|
|
comp = cls->Component;
|
2005-08-22 11:15:23 +02:00
|
|
|
if ( !comp )
|
2005-06-16 17:51:44 +02:00
|
|
|
continue;
|
|
|
|
|
2005-08-25 12:22:32 +02:00
|
|
|
feature = cls->Feature;
|
2010-02-16 11:45:05 +01:00
|
|
|
if (!feature)
|
|
|
|
continue;
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2010-02-16 11:45:05 +01:00
|
|
|
if (feature->ActionRequest != INSTALLSTATE_LOCAL &&
|
|
|
|
feature->ActionRequest != INSTALLSTATE_ADVERTISED )
|
2005-06-16 17:51:44 +02:00
|
|
|
{
|
2010-04-02 10:37:50 +02:00
|
|
|
TRACE("Feature %s not scheduled for installation, skipping registration of class %s\n",
|
2010-02-16 11:45:05 +01:00
|
|
|
debugstr_w(feature->Feature), debugstr_w(cls->clsid));
|
2005-06-16 17:51:44 +02:00
|
|
|
continue;
|
|
|
|
}
|
2010-04-02 10:38:12 +02:00
|
|
|
feature->Action = feature->ActionRequest;
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2010-04-02 10:37:50 +02:00
|
|
|
file = get_loaded_file( package, comp->KeyPath );
|
|
|
|
if (!file)
|
|
|
|
{
|
|
|
|
TRACE("COM server not provided, skipping class %s\n", debugstr_w(cls->clsid));
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2005-09-12 17:28:00 +02:00
|
|
|
TRACE("Registering class %s (%p)\n", debugstr_w(cls->clsid), cls);
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-08-25 12:22:32 +02:00
|
|
|
cls->Installed = TRUE;
|
2005-09-06 11:26:18 +02:00
|
|
|
mark_progid_for_install( package, cls->ProgID );
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-09-12 17:28:00 +02:00
|
|
|
RegCreateKeyW( hkey, cls->clsid, &hkey2 );
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-08-25 12:22:32 +02:00
|
|
|
if (cls->Description)
|
2005-09-14 17:42:27 +02:00
|
|
|
msi_reg_set_val_str( hkey2, NULL, cls->Description );
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-08-25 12:22:32 +02:00
|
|
|
RegCreateKeyW( hkey2, cls->Context, &hkey3 );
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2006-08-02 13:41:13 +02:00
|
|
|
/*
|
|
|
|
* FIXME: Implement install on demand (advertised components).
|
|
|
|
*
|
|
|
|
* ole32.dll should call msi.MsiProvideComponentFromDescriptor()
|
|
|
|
* when it needs an InProcServer that doesn't exist.
|
|
|
|
* The component advertise string should be in the "InProcServer" value.
|
2005-06-16 17:51:44 +02:00
|
|
|
*/
|
2006-08-02 13:41:13 +02:00
|
|
|
size = lstrlenW( file->TargetPath )+1;
|
|
|
|
if (cls->Argument)
|
|
|
|
size += lstrlenW(cls->Argument)+1;
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2006-08-02 13:41:13 +02:00
|
|
|
argument = msi_alloc( size * sizeof(WCHAR) );
|
|
|
|
lstrcpyW( argument, file->TargetPath );
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2006-08-02 13:41:13 +02:00
|
|
|
if (cls->Argument)
|
2005-06-16 17:51:44 +02:00
|
|
|
{
|
2006-08-02 13:41:13 +02:00
|
|
|
lstrcatW( argument, szSpace );
|
|
|
|
lstrcatW( argument, cls->Argument );
|
2005-06-16 17:51:44 +02:00
|
|
|
}
|
|
|
|
|
2006-08-02 13:41:13 +02:00
|
|
|
msi_reg_set_val_str( hkey3, NULL, argument );
|
|
|
|
msi_free(argument);
|
|
|
|
|
2005-06-16 17:51:44 +02:00
|
|
|
RegCloseKey(hkey3);
|
|
|
|
|
2005-09-06 11:26:18 +02:00
|
|
|
if (cls->ProgID || cls->ProgIDText)
|
2005-06-16 17:51:44 +02:00
|
|
|
{
|
|
|
|
LPCWSTR progid;
|
|
|
|
|
2005-09-06 11:26:18 +02:00
|
|
|
if (cls->ProgID)
|
|
|
|
progid = cls->ProgID->ProgID;
|
2005-06-16 17:51:44 +02:00
|
|
|
else
|
2005-08-25 12:22:32 +02:00
|
|
|
progid = cls->ProgIDText;
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-09-15 11:31:41 +02:00
|
|
|
msi_reg_set_subkey_val( hkey2, szProgID, NULL, progid );
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-09-06 11:26:18 +02:00
|
|
|
if (cls->ProgID && cls->ProgID->VersionInd)
|
2005-06-16 17:51:44 +02:00
|
|
|
{
|
2005-09-15 11:31:41 +02:00
|
|
|
msi_reg_set_subkey_val( hkey2, szVIProgID, NULL,
|
|
|
|
cls->ProgID->VersionInd->ProgID );
|
2005-06-16 17:51:44 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-08-25 12:22:32 +02:00
|
|
|
if (cls->AppID)
|
2006-08-02 13:41:13 +02:00
|
|
|
{
|
2005-08-25 12:22:32 +02:00
|
|
|
MSIAPPID *appid = cls->AppID;
|
2005-09-14 17:42:27 +02:00
|
|
|
msi_reg_set_val_str( hkey2, szAppID, appid->AppID );
|
2005-08-25 12:22:32 +02:00
|
|
|
register_appid( appid, cls->Description );
|
2005-06-16 17:51:44 +02:00
|
|
|
}
|
|
|
|
|
2005-08-25 12:22:32 +02:00
|
|
|
if (cls->IconPath)
|
2005-09-15 11:31:41 +02:00
|
|
|
msi_reg_set_subkey_val( hkey2, szDefaultIcon, NULL, cls->IconPath );
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-08-25 12:22:32 +02:00
|
|
|
if (cls->DefInprocHandler)
|
2010-04-02 10:37:50 +02:00
|
|
|
msi_reg_set_subkey_val( hkey2, szInprocHandler, NULL, cls->DefInprocHandler );
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-08-25 12:22:32 +02:00
|
|
|
if (cls->DefInprocHandler32)
|
2010-04-02 10:37:50 +02:00
|
|
|
msi_reg_set_subkey_val( hkey2, szInprocHandler32, NULL, cls->DefInprocHandler32 );
|
2005-06-16 17:51:44 +02:00
|
|
|
|
|
|
|
RegCloseKey(hkey2);
|
|
|
|
|
|
|
|
/* if there is a FileTypeMask, register the FileType */
|
2005-08-25 12:22:32 +02:00
|
|
|
if (cls->FileTypeMask)
|
2005-06-16 17:51:44 +02:00
|
|
|
{
|
|
|
|
LPWSTR ptr, ptr2;
|
|
|
|
LPWSTR keyname;
|
|
|
|
INT index = 0;
|
2005-08-25 12:22:32 +02:00
|
|
|
ptr = cls->FileTypeMask;
|
2005-06-16 17:51:44 +02:00
|
|
|
while (ptr && *ptr)
|
|
|
|
{
|
|
|
|
ptr2 = strchrW(ptr,';');
|
|
|
|
if (ptr2)
|
|
|
|
*ptr2 = 0;
|
2005-09-20 13:59:14 +02:00
|
|
|
keyname = msi_alloc( (strlenW(szFileType_fmt) + strlenW(cls->clsid) + 4) * sizeof(WCHAR));
|
2005-09-12 17:28:00 +02:00
|
|
|
sprintfW( keyname, szFileType_fmt, cls->clsid, index );
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-09-15 11:31:41 +02:00
|
|
|
msi_reg_set_subkey_val( HKEY_CLASSES_ROOT, keyname, NULL, ptr );
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(keyname);
|
2005-06-16 17:51:44 +02:00
|
|
|
|
|
|
|
if (ptr2)
|
|
|
|
ptr = ptr2+1;
|
|
|
|
else
|
|
|
|
ptr = NULL;
|
|
|
|
|
|
|
|
index ++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
uirow = MSI_CreateRecord(1);
|
2005-09-12 17:28:00 +02:00
|
|
|
MSI_RecordSetStringW( uirow, 1, cls->clsid );
|
2005-06-16 17:51:44 +02:00
|
|
|
ui_actiondata(package,szRegisterClassInfo,uirow);
|
|
|
|
msiobj_release(&uirow->hdr);
|
|
|
|
}
|
|
|
|
|
|
|
|
RegCloseKey(hkey);
|
2010-04-02 10:37:50 +02:00
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
UINT ACTION_UnregisterClassInfo( MSIPACKAGE *package )
|
|
|
|
{
|
|
|
|
static const WCHAR szFileType[] = {'F','i','l','e','T','y','p','e','\\',0};
|
|
|
|
MSIRECORD *uirow;
|
|
|
|
MSICLASS *cls;
|
|
|
|
HKEY hkey, hkey2;
|
|
|
|
|
|
|
|
load_classes_and_such( package );
|
|
|
|
if (RegOpenKeyW( HKEY_CLASSES_ROOT, szCLSID, &hkey ) != ERROR_SUCCESS)
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
|
|
|
|
LIST_FOR_EACH_ENTRY( cls, &package->classes, MSICLASS, entry )
|
|
|
|
{
|
|
|
|
MSIFEATURE *feature;
|
|
|
|
MSICOMPONENT *comp;
|
|
|
|
LPWSTR filetype;
|
|
|
|
LONG res;
|
|
|
|
|
|
|
|
comp = cls->Component;
|
|
|
|
if (!comp)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
feature = cls->Feature;
|
|
|
|
if (!feature)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (feature->ActionRequest != INSTALLSTATE_ABSENT)
|
|
|
|
{
|
|
|
|
TRACE("Feature %s not scheduled for removal, skipping unregistration of class %s\n",
|
|
|
|
debugstr_w(feature->Feature), debugstr_w(cls->clsid));
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
feature->Action = feature->ActionRequest;
|
|
|
|
|
|
|
|
TRACE("Unregistering class %s (%p)\n", debugstr_w(cls->clsid), cls);
|
|
|
|
|
|
|
|
cls->Installed = FALSE;
|
|
|
|
mark_progid_for_uninstall( package, cls->ProgID );
|
|
|
|
|
|
|
|
res = RegDeleteTreeW( hkey, cls->clsid );
|
|
|
|
if (res != ERROR_SUCCESS)
|
|
|
|
WARN("Failed to delete class key %d\n", res);
|
|
|
|
|
|
|
|
if (cls->AppID)
|
|
|
|
{
|
|
|
|
res = RegOpenKeyW( HKEY_CLASSES_ROOT, szAppID, &hkey2 );
|
|
|
|
if (res == ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
res = RegDeleteKeyW( hkey2, cls->AppID->AppID );
|
|
|
|
if (res != ERROR_SUCCESS)
|
|
|
|
WARN("Failed to delete appid key %d\n", res);
|
|
|
|
RegCloseKey( hkey2 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (cls->FileTypeMask)
|
|
|
|
{
|
|
|
|
filetype = msi_alloc( (strlenW( szFileType ) + strlenW( cls->clsid ) + 1) * sizeof(WCHAR) );
|
|
|
|
if (filetype)
|
|
|
|
{
|
|
|
|
strcpyW( filetype, szFileType );
|
|
|
|
strcatW( filetype, cls->clsid );
|
|
|
|
res = RegDeleteTreeW( HKEY_CLASSES_ROOT, filetype );
|
|
|
|
msi_free( filetype );
|
|
|
|
|
|
|
|
if (res != ERROR_SUCCESS)
|
|
|
|
WARN("Failed to delete file type %d\n", res);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
uirow = MSI_CreateRecord( 1 );
|
|
|
|
MSI_RecordSetStringW( uirow, 1, cls->clsid );
|
|
|
|
ui_actiondata( package, szUnregisterClassInfo, uirow );
|
|
|
|
msiobj_release( &uirow->hdr );
|
|
|
|
}
|
|
|
|
|
|
|
|
RegCloseKey( hkey );
|
|
|
|
return ERROR_SUCCESS;
|
2005-06-16 17:51:44 +02:00
|
|
|
}
|
|
|
|
|
2007-05-31 23:19:28 +02:00
|
|
|
static LPCWSTR get_clsid_of_progid( const MSIPROGID *progid )
|
2005-06-16 17:51:44 +02:00
|
|
|
{
|
2005-10-30 20:17:06 +01:00
|
|
|
while (progid)
|
2005-06-16 17:51:44 +02:00
|
|
|
{
|
2005-10-30 20:17:06 +01:00
|
|
|
if (progid->Class)
|
|
|
|
return progid->Class->clsid;
|
2008-05-02 10:45:32 +02:00
|
|
|
if (progid->Parent == progid)
|
|
|
|
break;
|
2005-10-30 20:17:06 +01:00
|
|
|
progid = progid->Parent;
|
2005-06-16 17:51:44 +02:00
|
|
|
}
|
2005-10-30 20:17:06 +01:00
|
|
|
return NULL;
|
2005-06-16 17:51:44 +02:00
|
|
|
}
|
|
|
|
|
2007-05-31 23:19:28 +02:00
|
|
|
static UINT register_progid( const MSIPROGID* progid )
|
2005-06-16 17:51:44 +02:00
|
|
|
{
|
2010-04-02 10:37:50 +02:00
|
|
|
static const WCHAR szCurVer[] = {'C','u','r','V','e','r',0};
|
2005-10-30 20:17:06 +01:00
|
|
|
HKEY hkey = 0;
|
|
|
|
UINT rc;
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-10-30 20:17:06 +01:00
|
|
|
rc = RegCreateKeyW( HKEY_CLASSES_ROOT, progid->ProgID, &hkey );
|
|
|
|
if (rc == ERROR_SUCCESS)
|
2005-06-16 17:51:44 +02:00
|
|
|
{
|
2005-10-30 20:17:06 +01:00
|
|
|
LPCWSTR clsid = get_clsid_of_progid( progid );
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-10-30 20:17:06 +01:00
|
|
|
if (clsid)
|
|
|
|
msi_reg_set_subkey_val( hkey, szCLSID, NULL, clsid );
|
|
|
|
else
|
|
|
|
ERR("%s has no class\n", debugstr_w( progid->ProgID ) );
|
2005-06-16 17:51:44 +02:00
|
|
|
|
|
|
|
if (progid->Description)
|
2005-09-14 17:42:27 +02:00
|
|
|
msi_reg_set_val_str( hkey, NULL, progid->Description );
|
2005-06-16 17:51:44 +02:00
|
|
|
|
|
|
|
if (progid->IconPath)
|
2005-09-15 11:31:41 +02:00
|
|
|
msi_reg_set_subkey_val( hkey, szDefaultIcon, NULL, progid->IconPath );
|
2005-06-16 17:51:44 +02:00
|
|
|
|
|
|
|
/* write out the current version */
|
2005-09-06 11:26:18 +02:00
|
|
|
if (progid->CurVer)
|
2005-09-15 11:31:41 +02:00
|
|
|
msi_reg_set_subkey_val( hkey, szCurVer, NULL, progid->CurVer->ProgID );
|
2005-06-16 17:51:44 +02:00
|
|
|
|
|
|
|
RegCloseKey(hkey);
|
|
|
|
}
|
2005-10-30 20:17:06 +01:00
|
|
|
else
|
|
|
|
ERR("failed to create key %s\n", debugstr_w( progid->ProgID ) );
|
|
|
|
|
2005-06-16 17:51:44 +02:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
UINT ACTION_RegisterProgIdInfo(MSIPACKAGE *package)
|
|
|
|
{
|
2005-09-06 11:26:18 +02:00
|
|
|
MSIPROGID *progid;
|
2005-06-16 17:51:44 +02:00
|
|
|
MSIRECORD *uirow;
|
|
|
|
|
|
|
|
load_classes_and_such(package);
|
|
|
|
|
2005-09-06 11:26:18 +02:00
|
|
|
LIST_FOR_EACH_ENTRY( progid, &package->progids, MSIPROGID, entry )
|
2005-06-16 17:51:44 +02:00
|
|
|
{
|
|
|
|
/* check if this progid is to be installed */
|
2005-09-06 11:26:18 +02:00
|
|
|
if (progid->Class && progid->Class->Installed)
|
|
|
|
progid->InstallMe = TRUE;
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-09-06 11:26:18 +02:00
|
|
|
if (!progid->InstallMe)
|
2005-06-16 17:51:44 +02:00
|
|
|
{
|
|
|
|
TRACE("progid %s not scheduled to be installed\n",
|
2005-09-06 11:26:18 +02:00
|
|
|
debugstr_w(progid->ProgID));
|
2005-06-16 17:51:44 +02:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2005-09-06 11:26:18 +02:00
|
|
|
TRACE("Registering progid %s\n", debugstr_w(progid->ProgID));
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-10-30 20:17:06 +01:00
|
|
|
register_progid( progid );
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-10-30 20:17:06 +01:00
|
|
|
uirow = MSI_CreateRecord( 1 );
|
2005-09-06 11:26:18 +02:00
|
|
|
MSI_RecordSetStringW( uirow, 1, progid->ProgID );
|
|
|
|
ui_actiondata( package, szRegisterProgIdInfo, uirow );
|
|
|
|
msiobj_release( &uirow->hdr );
|
2005-06-16 17:51:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2010-04-02 10:38:57 +02:00
|
|
|
UINT ACTION_UnregisterProgIdInfo( MSIPACKAGE *package )
|
|
|
|
{
|
|
|
|
MSIPROGID *progid;
|
|
|
|
MSIRECORD *uirow;
|
|
|
|
LONG res;
|
|
|
|
|
|
|
|
load_classes_and_such( package );
|
|
|
|
|
|
|
|
LIST_FOR_EACH_ENTRY( progid, &package->progids, MSIPROGID, entry )
|
|
|
|
{
|
|
|
|
/* check if this progid is to be removed */
|
|
|
|
if (progid->Class && !progid->Class->Installed)
|
|
|
|
progid->InstallMe = FALSE;
|
|
|
|
|
|
|
|
if (progid->InstallMe)
|
|
|
|
{
|
|
|
|
TRACE("progid %s not scheduled to be removed\n", debugstr_w(progid->ProgID));
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
TRACE("Unregistering progid %s\n", debugstr_w(progid->ProgID));
|
|
|
|
|
|
|
|
res = RegDeleteTreeW( HKEY_CLASSES_ROOT, progid->ProgID );
|
|
|
|
if (res != ERROR_SUCCESS)
|
|
|
|
WARN("Failed to delete progid key %d\n", res);
|
|
|
|
|
|
|
|
uirow = MSI_CreateRecord( 1 );
|
|
|
|
MSI_RecordSetStringW( uirow, 1, progid->ProgID );
|
|
|
|
ui_actiondata( package, szUnregisterProgIdInfo, uirow );
|
|
|
|
msiobj_release( &uirow->hdr );
|
|
|
|
}
|
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2005-06-16 17:51:44 +02:00
|
|
|
static UINT register_verb(MSIPACKAGE *package, LPCWSTR progid,
|
2007-05-31 23:19:28 +02:00
|
|
|
MSICOMPONENT* component, const MSIEXTENSION* extension,
|
2005-06-16 17:51:44 +02:00
|
|
|
MSIVERB* verb, INT* Sequence )
|
|
|
|
{
|
|
|
|
LPWSTR keyname;
|
|
|
|
HKEY key;
|
|
|
|
static const WCHAR szShell[] = {'s','h','e','l','l',0};
|
|
|
|
static const WCHAR szCommand[] = {'c','o','m','m','a','n','d',0};
|
|
|
|
static const WCHAR fmt[] = {'\"','%','s','\"',' ','%','s',0};
|
|
|
|
static const WCHAR fmt2[] = {'\"','%','s','\"',0};
|
|
|
|
LPWSTR command;
|
|
|
|
DWORD size;
|
|
|
|
LPWSTR advertise;
|
|
|
|
|
|
|
|
keyname = build_directory_name(4, progid, szShell, verb->Verb, szCommand);
|
|
|
|
|
|
|
|
TRACE("Making Key %s\n",debugstr_w(keyname));
|
|
|
|
RegCreateKeyW(HKEY_CLASSES_ROOT, keyname, &key);
|
|
|
|
size = strlenW(component->FullKeypath);
|
|
|
|
if (verb->Argument)
|
|
|
|
size += strlenW(verb->Argument);
|
|
|
|
size += 4;
|
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
command = msi_alloc(size * sizeof (WCHAR));
|
2005-06-16 17:51:44 +02:00
|
|
|
if (verb->Argument)
|
|
|
|
sprintfW(command, fmt, component->FullKeypath, verb->Argument);
|
|
|
|
else
|
|
|
|
sprintfW(command, fmt2, component->FullKeypath);
|
|
|
|
|
2005-09-14 17:42:27 +02:00
|
|
|
msi_reg_set_val_str( key, NULL, command );
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(command);
|
2005-06-16 17:51:44 +02:00
|
|
|
|
|
|
|
advertise = create_component_advertise_string(package, component,
|
2005-08-22 16:09:17 +02:00
|
|
|
extension->Feature->Feature);
|
2005-06-16 17:51:44 +02:00
|
|
|
|
|
|
|
size = strlenW(advertise);
|
|
|
|
|
|
|
|
if (verb->Argument)
|
2005-08-22 16:09:17 +02:00
|
|
|
size += strlenW(verb->Argument);
|
2005-06-16 17:51:44 +02:00
|
|
|
size += 4;
|
|
|
|
|
2006-04-18 19:29:03 +02:00
|
|
|
command = msi_alloc_zero(size * sizeof (WCHAR));
|
2005-06-16 17:51:44 +02:00
|
|
|
|
|
|
|
strcpyW(command,advertise);
|
|
|
|
if (verb->Argument)
|
|
|
|
{
|
|
|
|
strcatW(command,szSpace);
|
|
|
|
strcatW(command,verb->Argument);
|
|
|
|
}
|
|
|
|
|
2005-09-14 17:42:27 +02:00
|
|
|
msi_reg_set_val_multi_str( key, szCommand, command );
|
2005-06-16 17:51:44 +02:00
|
|
|
|
|
|
|
RegCloseKey(key);
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(keyname);
|
|
|
|
msi_free(advertise);
|
|
|
|
msi_free(command);
|
2005-06-16 17:51:44 +02:00
|
|
|
|
|
|
|
if (verb->Command)
|
|
|
|
{
|
|
|
|
keyname = build_directory_name(3, progid, szShell, verb->Verb);
|
2005-09-15 11:31:41 +02:00
|
|
|
msi_reg_set_subkey_val( HKEY_CLASSES_ROOT, keyname, NULL, verb->Command );
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(keyname);
|
2005-06-16 17:51:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (verb->Sequence != MSI_NULL_INTEGER)
|
|
|
|
{
|
|
|
|
if (*Sequence == MSI_NULL_INTEGER || verb->Sequence < *Sequence)
|
|
|
|
{
|
|
|
|
*Sequence = verb->Sequence;
|
|
|
|
keyname = build_directory_name(2, progid, szShell);
|
2005-09-15 11:31:41 +02:00
|
|
|
msi_reg_set_subkey_val( HKEY_CLASSES_ROOT, keyname, NULL, verb->Verb );
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(keyname);
|
2005-06-16 17:51:44 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package)
|
|
|
|
{
|
|
|
|
static const WCHAR szContentType[] =
|
|
|
|
{'C','o','n','t','e','n','t',' ','T','y','p','e',0 };
|
|
|
|
HKEY hkey;
|
2005-08-29 11:38:39 +02:00
|
|
|
MSIEXTENSION *ext;
|
2005-06-16 17:51:44 +02:00
|
|
|
MSIRECORD *uirow;
|
|
|
|
BOOL install_on_demand = TRUE;
|
|
|
|
|
|
|
|
load_classes_and_such(package);
|
|
|
|
|
|
|
|
/* We need to set install_on_demand based on if the shell handles advertised
|
|
|
|
* shortcuts and the like. Because Mike McCormack is working on this i am
|
|
|
|
* going to default to TRUE
|
|
|
|
*/
|
|
|
|
|
2005-08-29 11:38:39 +02:00
|
|
|
LIST_FOR_EACH_ENTRY( ext, &package->extensions, MSIEXTENSION, entry )
|
2005-06-16 17:51:44 +02:00
|
|
|
{
|
2005-09-09 16:49:08 +02:00
|
|
|
LPWSTR extension;
|
2005-08-22 16:09:17 +02:00
|
|
|
MSIFEATURE *feature;
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-08-29 11:38:39 +02:00
|
|
|
if (!ext->Component)
|
2005-06-16 17:51:44 +02:00
|
|
|
continue;
|
|
|
|
|
2005-08-29 11:38:39 +02:00
|
|
|
feature = ext->Feature;
|
2010-02-16 11:45:05 +01:00
|
|
|
if (!feature)
|
|
|
|
continue;
|
2005-08-22 11:15:23 +02:00
|
|
|
|
2005-06-16 17:51:44 +02:00
|
|
|
/*
|
|
|
|
* yes. MSDN says that these are based on _Feature_ not on
|
|
|
|
* Component. So verify the feature is to be installed
|
|
|
|
*/
|
2010-02-16 11:45:05 +01:00
|
|
|
if (feature->ActionRequest != INSTALLSTATE_LOCAL &&
|
|
|
|
!(install_on_demand && feature->ActionRequest == INSTALLSTATE_ADVERTISED))
|
2005-06-16 17:51:44 +02:00
|
|
|
{
|
2010-02-16 11:45:05 +01:00
|
|
|
TRACE("Feature %s not scheduled for installation, skipping registration of extension %s\n",
|
|
|
|
debugstr_w(feature->Feature), debugstr_w(ext->Extension));
|
2005-06-16 17:51:44 +02:00
|
|
|
continue;
|
|
|
|
}
|
2010-04-02 10:38:12 +02:00
|
|
|
feature->Action = feature->ActionRequest;
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-08-29 11:38:39 +02:00
|
|
|
TRACE("Registering extension %s (%p)\n", debugstr_w(ext->Extension), ext);
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-08-29 11:38:39 +02:00
|
|
|
ext->Installed = TRUE;
|
2005-06-16 17:51:44 +02:00
|
|
|
|
|
|
|
/* this is only registered if the extension has at least 1 verb
|
|
|
|
* according to MSDN
|
|
|
|
*/
|
2005-09-06 11:26:18 +02:00
|
|
|
if (ext->ProgID && !list_empty( &ext->verbs ) )
|
|
|
|
mark_progid_for_install( package, ext->ProgID );
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-08-29 11:38:39 +02:00
|
|
|
mark_mime_for_install(ext->Mime);
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
extension = msi_alloc( (lstrlenW( ext->Extension ) + 2)*sizeof(WCHAR) );
|
2005-06-16 17:51:44 +02:00
|
|
|
extension[0] = '.';
|
2005-09-09 16:49:08 +02:00
|
|
|
lstrcpyW(extension+1,ext->Extension);
|
2005-06-16 17:51:44 +02:00
|
|
|
|
|
|
|
RegCreateKeyW(HKEY_CLASSES_ROOT,extension,&hkey);
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free( extension );
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-08-29 11:38:39 +02:00
|
|
|
if (ext->Mime)
|
2005-09-14 17:42:27 +02:00
|
|
|
msi_reg_set_val_str( hkey, szContentType, ext->Mime->ContentType );
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-09-06 11:26:18 +02:00
|
|
|
if (ext->ProgID || ext->ProgIDText)
|
2005-06-16 17:51:44 +02:00
|
|
|
{
|
|
|
|
static const WCHAR szSN[] =
|
|
|
|
{'\\','S','h','e','l','l','N','e','w',0};
|
|
|
|
HKEY hkey2;
|
|
|
|
LPWSTR newkey;
|
|
|
|
LPCWSTR progid;
|
2005-09-02 16:39:13 +02:00
|
|
|
MSIVERB *verb;
|
2005-06-16 17:51:44 +02:00
|
|
|
INT Sequence = MSI_NULL_INTEGER;
|
|
|
|
|
2005-09-06 11:26:18 +02:00
|
|
|
if (ext->ProgID)
|
|
|
|
progid = ext->ProgID->ProgID;
|
2005-06-16 17:51:44 +02:00
|
|
|
else
|
2005-08-29 11:38:39 +02:00
|
|
|
progid = ext->ProgIDText;
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-09-14 17:42:27 +02:00
|
|
|
msi_reg_set_val_str( hkey, NULL, progid );
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
newkey = msi_alloc( (strlenW(progid)+strlenW(szSN)+1) * sizeof(WCHAR));
|
2005-06-16 17:51:44 +02:00
|
|
|
|
|
|
|
strcpyW(newkey,progid);
|
|
|
|
strcatW(newkey,szSN);
|
|
|
|
RegCreateKeyW(hkey,newkey,&hkey2);
|
|
|
|
RegCloseKey(hkey2);
|
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(newkey);
|
2005-06-16 17:51:44 +02:00
|
|
|
|
|
|
|
/* do all the verbs */
|
2005-09-02 16:39:13 +02:00
|
|
|
LIST_FOR_EACH_ENTRY( verb, &ext->verbs, MSIVERB, entry )
|
|
|
|
{
|
2005-08-29 11:38:39 +02:00
|
|
|
register_verb( package, progid, ext->Component,
|
2005-09-02 16:39:13 +02:00
|
|
|
ext, verb, &Sequence);
|
|
|
|
}
|
2005-06-16 17:51:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
RegCloseKey(hkey);
|
|
|
|
|
|
|
|
uirow = MSI_CreateRecord(1);
|
2005-08-29 11:38:39 +02:00
|
|
|
MSI_RecordSetStringW( uirow, 1, ext->Extension );
|
2005-06-16 17:51:44 +02:00
|
|
|
ui_actiondata(package,szRegisterExtensionInfo,uirow);
|
|
|
|
msiobj_release(&uirow->hdr);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
UINT ACTION_RegisterMIMEInfo(MSIPACKAGE *package)
|
|
|
|
{
|
|
|
|
static const WCHAR szExten[] =
|
|
|
|
{'E','x','t','e','n','s','i','o','n',0 };
|
|
|
|
MSIRECORD *uirow;
|
2005-08-26 10:47:31 +02:00
|
|
|
MSIMIME *mt;
|
2005-06-16 17:51:44 +02:00
|
|
|
|
|
|
|
load_classes_and_such(package);
|
|
|
|
|
2005-08-26 10:47:31 +02:00
|
|
|
LIST_FOR_EACH_ENTRY( mt, &package->mimes, MSIMIME, entry )
|
2005-06-16 17:51:44 +02:00
|
|
|
{
|
2005-09-09 16:49:08 +02:00
|
|
|
LPWSTR extension;
|
2005-06-16 17:51:44 +02:00
|
|
|
LPCWSTR exten;
|
|
|
|
LPCWSTR mime;
|
|
|
|
static const WCHAR fmt[] =
|
|
|
|
{'M','I','M','E','\\','D','a','t','a','b','a','s','e','\\',
|
|
|
|
'C','o','n','t','e','n','t',' ','T','y','p','e','\\', '%','s',0};
|
|
|
|
LPWSTR key;
|
|
|
|
|
|
|
|
/*
|
2007-12-31 19:06:07 +01:00
|
|
|
* check if the MIME is to be installed. Either as requested by an
|
2005-06-16 17:51:44 +02:00
|
|
|
* extension or Class
|
|
|
|
*/
|
2005-08-26 10:47:31 +02:00
|
|
|
mt->InstallMe = (mt->InstallMe ||
|
|
|
|
(mt->Class && mt->Class->Installed) ||
|
2005-08-29 11:38:39 +02:00
|
|
|
(mt->Extension && mt->Extension->Installed));
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-08-26 10:47:31 +02:00
|
|
|
if (!mt->InstallMe)
|
2005-06-16 17:51:44 +02:00
|
|
|
{
|
|
|
|
TRACE("MIME %s not scheduled to be installed\n",
|
2005-08-26 10:47:31 +02:00
|
|
|
debugstr_w(mt->ContentType));
|
2005-06-16 17:51:44 +02:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2005-08-26 10:47:31 +02:00
|
|
|
mime = mt->ContentType;
|
2005-08-29 11:38:39 +02:00
|
|
|
exten = mt->Extension->Extension;
|
2005-09-09 16:49:08 +02:00
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
extension = msi_alloc( (lstrlenW( exten ) + 2)*sizeof(WCHAR) );
|
2005-06-16 17:51:44 +02:00
|
|
|
extension[0] = '.';
|
2005-09-09 16:49:08 +02:00
|
|
|
lstrcpyW(extension+1,exten);
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
key = msi_alloc( (strlenW(mime)+strlenW(fmt)+1) * sizeof(WCHAR) );
|
2005-06-16 17:51:44 +02:00
|
|
|
sprintfW(key,fmt,mime);
|
2005-09-15 11:31:41 +02:00
|
|
|
msi_reg_set_subkey_val( HKEY_CLASSES_ROOT, key, szExten, extension );
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(extension);
|
|
|
|
msi_free(key);
|
2005-06-16 17:51:44 +02:00
|
|
|
|
2005-09-12 17:28:00 +02:00
|
|
|
if (mt->clsid)
|
2005-06-16 17:51:44 +02:00
|
|
|
FIXME("Handle non null for field 3\n");
|
|
|
|
|
|
|
|
uirow = MSI_CreateRecord(2);
|
2005-08-26 10:47:31 +02:00
|
|
|
MSI_RecordSetStringW(uirow,1,mt->ContentType);
|
2005-06-16 17:51:44 +02:00
|
|
|
MSI_RecordSetStringW(uirow,2,exten);
|
|
|
|
ui_actiondata(package,szRegisterMIMEInfo,uirow);
|
|
|
|
msiobj_release(&uirow->hdr);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|