Commit e7dd9b3f authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

msi: Use wide character string literals in classes.c.

parent 2672646e
...@@ -52,7 +52,7 @@ static MSIAPPID *load_appid( MSIPACKAGE* package, MSIRECORD *row ) ...@@ -52,7 +52,7 @@ static MSIAPPID *load_appid( MSIPACKAGE* package, MSIRECORD *row )
appid = msi_alloc_zero( sizeof(MSIAPPID) ); appid = msi_alloc_zero( sizeof(MSIAPPID) );
if (!appid) if (!appid)
return NULL; return NULL;
appid->AppID = msi_dup_record_field( row, 1 ); appid->AppID = msi_dup_record_field( row, 1 );
TRACE("loading appid %s\n", debugstr_w( appid->AppID )); TRACE("loading appid %s\n", debugstr_w( appid->AppID ));
...@@ -67,16 +67,12 @@ static MSIAPPID *load_appid( MSIPACKAGE* package, MSIRECORD *row ) ...@@ -67,16 +67,12 @@ static MSIAPPID *load_appid( MSIPACKAGE* package, MSIRECORD *row )
appid->RunAsInteractiveUser = !MSI_RecordIsNull(row,7); appid->RunAsInteractiveUser = !MSI_RecordIsNull(row,7);
list_add_tail( &package->appids, &appid->entry ); list_add_tail( &package->appids, &appid->entry );
return appid; return appid;
} }
static MSIAPPID *load_given_appid( MSIPACKAGE *package, LPCWSTR name ) static MSIAPPID *load_given_appid( MSIPACKAGE *package, LPCWSTR name )
{ {
static const WCHAR query[] = {
'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};
MSIRECORD *row; MSIRECORD *row;
MSIAPPID *appid; MSIAPPID *appid;
...@@ -92,8 +88,8 @@ static MSIAPPID *load_given_appid( MSIPACKAGE *package, LPCWSTR name ) ...@@ -92,8 +88,8 @@ static MSIAPPID *load_given_appid( MSIPACKAGE *package, LPCWSTR name )
return appid; return appid;
} }
} }
row = MSI_QueryGetRecord(package->db, query, name); row = MSI_QueryGetRecord(package->db, L"SELECT * FROM `AppId` WHERE `AppId` = '%s'", name);
if (!row) if (!row)
return NULL; return NULL;
...@@ -135,17 +131,14 @@ static MSIPROGID *load_progid( MSIPACKAGE* package, MSIRECORD *row ) ...@@ -135,17 +131,14 @@ static MSIPROGID *load_progid( MSIPACKAGE* package, MSIRECORD *row )
if (!MSI_RecordIsNull(row,6)) if (!MSI_RecordIsNull(row,6))
{ {
INT icon_index = MSI_RecordGetInteger(row,6); INT icon_index = MSI_RecordGetInteger(row,6);
LPCWSTR FileName = MSI_RecordGetString(row,5); LPCWSTR FileName = MSI_RecordGetString(row,5);
LPWSTR FilePath; LPWSTR FilePath;
static const WCHAR fmt[] = {'%','s',',','%','i',0};
FilePath = msi_build_icon_path(package, FileName); FilePath = msi_build_icon_path(package, FileName);
progid->IconPath = msi_alloc( (lstrlenW(FilePath)+10)* sizeof(WCHAR) );
swprintf(progid->IconPath,lstrlenW(FilePath)+10,fmt,FilePath,icon_index);
progid->IconPath = msi_alloc( (lstrlenW(FilePath) + 10) * sizeof(WCHAR) );
swprintf( progid->IconPath, lstrlenW(FilePath) + 10, L"%s,%d", FilePath, icon_index );
msi_free(FilePath); msi_free(FilePath);
} }
else else
...@@ -171,16 +164,12 @@ static MSIPROGID *load_progid( MSIPACKAGE* package, MSIRECORD *row ) ...@@ -171,16 +164,12 @@ static MSIPROGID *load_progid( MSIPACKAGE* package, MSIRECORD *row )
progid->CurVer = parent; progid->CurVer = parent;
parent->VersionInd = progid; parent->VersionInd = progid;
} }
return progid; return progid;
} }
static MSIPROGID *load_given_progid(MSIPACKAGE *package, LPCWSTR name) static MSIPROGID *load_given_progid(MSIPACKAGE *package, LPCWSTR name)
{ {
static const WCHAR query[] = {
'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};
MSIPROGID *progid; MSIPROGID *progid;
MSIRECORD *row; MSIRECORD *row;
...@@ -196,8 +185,8 @@ static MSIPROGID *load_given_progid(MSIPACKAGE *package, LPCWSTR name) ...@@ -196,8 +185,8 @@ static MSIPROGID *load_given_progid(MSIPACKAGE *package, LPCWSTR name)
return progid; return progid;
} }
} }
row = MSI_QueryGetRecord( package->db, query, name ); row = MSI_QueryGetRecord( package->db, L"SELECT * FROM `ProgId` WHERE `ProgId` = '%s'", name );
if (!row) if (!row)
return NULL; return NULL;
...@@ -240,17 +229,14 @@ static MSICLASS *load_class( MSIPACKAGE* package, MSIRECORD *row ) ...@@ -240,17 +229,14 @@ static MSICLASS *load_class( MSIPACKAGE* package, MSIRECORD *row )
if (!MSI_RecordIsNull(row,9)) if (!MSI_RecordIsNull(row,9))
{ {
INT icon_index = MSI_RecordGetInteger(row,9); INT icon_index = MSI_RecordGetInteger(row,9);
LPCWSTR FileName = MSI_RecordGetString(row,8); LPCWSTR FileName = MSI_RecordGetString(row,8);
LPWSTR FilePath; LPWSTR FilePath;
static const WCHAR fmt[] = {'%','s',',','%','i',0};
FilePath = msi_build_icon_path(package, FileName); FilePath = msi_build_icon_path(package, FileName);
cls->IconPath = msi_alloc( (lstrlenW(FilePath)+5)* sizeof(WCHAR) );
swprintf(cls->IconPath,lstrlenW(FilePath)+5,fmt,FilePath,icon_index);
cls->IconPath = msi_alloc( (lstrlenW(FilePath) + 5) * sizeof(WCHAR) );
swprintf( cls->IconPath, lstrlenW(FilePath) + 5, L"%s,%d", FilePath, icon_index );
msi_free(FilePath); msi_free(FilePath);
} }
else else
...@@ -265,20 +251,17 @@ static MSICLASS *load_class( MSIPACKAGE* package, MSIRECORD *row ) ...@@ -265,20 +251,17 @@ static MSICLASS *load_class( MSIPACKAGE* package, MSIRECORD *row )
i = MSI_RecordGetInteger(row,10); i = MSI_RecordGetInteger(row,10);
if (i != MSI_NULL_INTEGER && i > 0 && i < 4) 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) switch(i)
{ {
case 1: case 1:
cls->DefInprocHandler = strdupW(ole2); cls->DefInprocHandler = strdupW(L"ole2.dll");
break; break;
case 2: case 2:
cls->DefInprocHandler32 = strdupW(ole32); cls->DefInprocHandler32 = strdupW(L"ole32.dll");
break; break;
case 3: case 3:
cls->DefInprocHandler = strdupW(ole2); cls->DefInprocHandler = strdupW(L"ole2.dll");
cls->DefInprocHandler32 = strdupW(ole32); cls->DefInprocHandler32 = strdupW(L"ole32.dll");
break; break;
} }
} }
...@@ -300,23 +283,19 @@ static MSICLASS *load_class( MSIPACKAGE* package, MSIRECORD *row ) ...@@ -300,23 +283,19 @@ static MSICLASS *load_class( MSIPACKAGE* package, MSIRECORD *row )
} }
/* /*
* the Class table has 3 primary keys. Generally it is only * the Class table has 3 primary keys. Generally it is only
* referenced through the first CLSID key. However when loading * referenced through the first CLSID key. However when loading
* all of the classes we need to make sure we do not ignore rows * all of the classes we need to make sure we do not ignore rows
* with other Context and ComponentIndexs * with other Context and ComponentIndexs
*/ */
static MSICLASS *load_given_class(MSIPACKAGE *package, LPCWSTR classid) static MSICLASS *load_given_class(MSIPACKAGE *package, LPCWSTR classid)
{ {
static const WCHAR query[] = {
'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};
MSICLASS *cls; MSICLASS *cls;
MSIRECORD *row; MSIRECORD *row;
if (!classid) if (!classid)
return NULL; return NULL;
/* check for classes already loaded */ /* check for classes already loaded */
LIST_FOR_EACH_ENTRY( cls, &package->classes, MSICLASS, entry ) LIST_FOR_EACH_ENTRY( cls, &package->classes, MSICLASS, entry )
{ {
...@@ -327,7 +306,7 @@ static MSICLASS *load_given_class(MSIPACKAGE *package, LPCWSTR classid) ...@@ -327,7 +306,7 @@ static MSICLASS *load_given_class(MSIPACKAGE *package, LPCWSTR classid)
} }
} }
row = MSI_QueryGetRecord(package->db, query, classid); row = MSI_QueryGetRecord( package->db, L"SELECT * FROM `Class` WHERE `CLSID` = '%s'", classid );
if (!row) if (!row)
return NULL; return NULL;
...@@ -349,7 +328,7 @@ static MSIMIME *load_mime( MSIPACKAGE* package, MSIRECORD *row ) ...@@ -349,7 +328,7 @@ static MSIMIME *load_mime( MSIPACKAGE* package, MSIRECORD *row )
if (!mt) if (!mt)
return mt; return mt;
mt->ContentType = msi_dup_record_field( row, 1 ); mt->ContentType = msi_dup_record_field( row, 1 );
TRACE("loading mime %s\n", debugstr_w(mt->ContentType)); TRACE("loading mime %s\n", debugstr_w(mt->ContentType));
extension = MSI_RecordGetString( row, 2 ); extension = MSI_RecordGetString( row, 2 );
...@@ -366,16 +345,12 @@ static MSIMIME *load_mime( MSIPACKAGE* package, MSIRECORD *row ) ...@@ -366,16 +345,12 @@ static MSIMIME *load_mime( MSIPACKAGE* package, MSIRECORD *row )
static MSIMIME *load_given_mime( MSIPACKAGE *package, LPCWSTR mime ) static MSIMIME *load_given_mime( MSIPACKAGE *package, LPCWSTR mime )
{ {
static const WCHAR query[] = {
'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};
MSIRECORD *row; MSIRECORD *row;
MSIMIME *mt; MSIMIME *mt;
if (!mime) if (!mime)
return NULL; return NULL;
/* check for mime already loaded */ /* check for mime already loaded */
LIST_FOR_EACH_ENTRY( mt, &package->mimes, MSIMIME, entry ) LIST_FOR_EACH_ENTRY( mt, &package->mimes, MSIMIME, entry )
{ {
...@@ -385,8 +360,8 @@ static MSIMIME *load_given_mime( MSIPACKAGE *package, LPCWSTR mime ) ...@@ -385,8 +360,8 @@ static MSIMIME *load_given_mime( MSIPACKAGE *package, LPCWSTR mime )
return mt; return mt;
} }
} }
row = MSI_QueryGetRecord(package->db, query, mime); row = MSI_QueryGetRecord( package->db, L"SELECT * FROM `MIME` WHERE `ContentType` = '%s'", mime );
if (!row) if (!row)
return NULL; return NULL;
...@@ -434,10 +409,6 @@ static MSIEXTENSION *load_extension( MSIPACKAGE* package, MSIRECORD *row ) ...@@ -434,10 +409,6 @@ static MSIEXTENSION *load_extension( MSIPACKAGE* package, MSIRECORD *row )
*/ */
static MSIEXTENSION *load_given_extension( MSIPACKAGE *package, LPCWSTR name ) static MSIEXTENSION *load_given_extension( MSIPACKAGE *package, LPCWSTR name )
{ {
static const WCHAR query[] = {
'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};
MSIEXTENSION *ext; MSIEXTENSION *ext;
MSIRECORD *row; MSIRECORD *row;
...@@ -456,8 +427,8 @@ static MSIEXTENSION *load_given_extension( MSIPACKAGE *package, LPCWSTR name ) ...@@ -456,8 +427,8 @@ static MSIEXTENSION *load_given_extension( MSIPACKAGE *package, LPCWSTR name )
return ext; return ext;
} }
} }
row = MSI_QueryGetRecord( package->db, query, name ); row = MSI_QueryGetRecord( package->db, L"SELECT * FROM `Extension` WHERE `Extension` = '%s'", name );
if (!row) if (!row)
return NULL; return NULL;
...@@ -499,7 +470,7 @@ static UINT iterate_load_verb(MSIRECORD *row, LPVOID param) ...@@ -499,7 +470,7 @@ static UINT iterate_load_verb(MSIRECORD *row, LPVOID param)
/* associate the verb with the correct extension */ /* associate the verb with the correct extension */
list_add_tail( &extension->verbs, &verb->entry ); list_add_tail( &extension->verbs, &verb->entry );
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
...@@ -530,7 +501,7 @@ static UINT iterate_all_classes(MSIRECORD *rec, LPVOID param) ...@@ -530,7 +501,7 @@ static UINT iterate_all_classes(MSIRECORD *rec, LPVOID param)
break; break;
} }
} }
if (!match) if (!match)
load_class(package, rec); load_class(package, rec);
...@@ -539,12 +510,10 @@ static UINT iterate_all_classes(MSIRECORD *rec, LPVOID param) ...@@ -539,12 +510,10 @@ static UINT iterate_all_classes(MSIRECORD *rec, LPVOID param)
static UINT load_all_classes( MSIPACKAGE *package ) static UINT load_all_classes( MSIPACKAGE *package )
{ {
static const WCHAR query[] = {
'S','E','L','E','C','T',' ','*',' ', 'F','R','O','M',' ','`','C','l','a','s','s','`',0};
MSIQUERY *view; MSIQUERY *view;
UINT rc; UINT rc;
rc = MSI_DatabaseOpenViewW(package->db, query, &view); rc = MSI_DatabaseOpenViewW( package->db, L"SELECT * FROM `Class`", &view );
if (rc != ERROR_SUCCESS) if (rc != ERROR_SUCCESS)
return ERROR_SUCCESS; return ERROR_SUCCESS;
...@@ -585,12 +554,10 @@ static UINT iterate_all_extensions(MSIRECORD *rec, LPVOID param) ...@@ -585,12 +554,10 @@ static UINT iterate_all_extensions(MSIRECORD *rec, LPVOID param)
static UINT load_all_extensions( MSIPACKAGE *package ) static UINT load_all_extensions( MSIPACKAGE *package )
{ {
static const WCHAR query[] = {
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','`','E','x','t','e','n','s','i','o','n','`',0};
MSIQUERY *view; MSIQUERY *view;
UINT rc; UINT rc;
rc = MSI_DatabaseOpenViewW( package->db, query, &view ); rc = MSI_DatabaseOpenViewW( package->db, L"SELECT * FROM `Extension`", &view );
if (rc != ERROR_SUCCESS) if (rc != ERROR_SUCCESS)
return ERROR_SUCCESS; return ERROR_SUCCESS;
...@@ -611,13 +578,10 @@ static UINT iterate_all_progids(MSIRECORD *rec, LPVOID param) ...@@ -611,13 +578,10 @@ static UINT iterate_all_progids(MSIRECORD *rec, LPVOID param)
static UINT load_all_progids( MSIPACKAGE *package ) static UINT load_all_progids( MSIPACKAGE *package )
{ {
static const WCHAR query[] = {
'S','E','L','E','C','T',' ','`','P','r','o','g','I','d','`',' ','F','R','O','M',' ',
'`','P','r','o','g','I','d','`',0};
MSIQUERY *view; MSIQUERY *view;
UINT rc; UINT rc;
rc = MSI_DatabaseOpenViewW(package->db, query, &view); rc = MSI_DatabaseOpenViewW( package->db, L"SELECT `ProgId` FROM `ProgId`", &view );
if (rc != ERROR_SUCCESS) if (rc != ERROR_SUCCESS)
return ERROR_SUCCESS; return ERROR_SUCCESS;
...@@ -628,12 +592,10 @@ static UINT load_all_progids( MSIPACKAGE *package ) ...@@ -628,12 +592,10 @@ static UINT load_all_progids( MSIPACKAGE *package )
static UINT load_all_verbs( MSIPACKAGE *package ) static UINT load_all_verbs( MSIPACKAGE *package )
{ {
static const WCHAR query[] = {
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','`','V','e','r','b','`',0};
MSIQUERY *view; MSIQUERY *view;
UINT rc; UINT rc;
rc = MSI_DatabaseOpenViewW(package->db, query, &view); rc = MSI_DatabaseOpenViewW( package->db, L"SELECT * FROM `Verb`", &view );
if (rc != ERROR_SUCCESS) if (rc != ERROR_SUCCESS)
return ERROR_SUCCESS; return ERROR_SUCCESS;
...@@ -654,13 +616,10 @@ static UINT iterate_all_mimes(MSIRECORD *rec, LPVOID param) ...@@ -654,13 +616,10 @@ static UINT iterate_all_mimes(MSIRECORD *rec, LPVOID param)
static UINT load_all_mimes( MSIPACKAGE *package ) static UINT load_all_mimes( MSIPACKAGE *package )
{ {
static const WCHAR query[] = {
'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};
MSIQUERY *view; MSIQUERY *view;
UINT rc; UINT rc;
rc = MSI_DatabaseOpenViewW(package->db, query, &view); rc = MSI_DatabaseOpenViewW( package->db, L"SELECT `ContentType` FROM `MIME`", &view );
if (rc != ERROR_SUCCESS) if (rc != ERROR_SUCCESS)
return ERROR_SUCCESS; return ERROR_SUCCESS;
...@@ -699,45 +658,30 @@ static UINT load_classes_and_such( MSIPACKAGE *package ) ...@@ -699,45 +658,30 @@ static UINT load_classes_and_such( MSIPACKAGE *package )
static UINT register_appid(const MSIAPPID *appid, LPCWSTR app ) static UINT register_appid(const MSIAPPID *appid, LPCWSTR app )
{ {
static const WCHAR szRemoteServerName[] = HKEY hkey2, hkey3;
{'R','e','m','o','t','e','S','e','r','v','e','r','N','a','m','e',0};
static const WCHAR szLocalService[] = RegCreateKeyW( HKEY_CLASSES_ROOT, L"AppID", &hkey2 );
{'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};
HKEY hkey2,hkey3;
RegCreateKeyW(HKEY_CLASSES_ROOT,szAppID,&hkey2);
RegCreateKeyW( hkey2, appid->AppID, &hkey3 ); RegCreateKeyW( hkey2, appid->AppID, &hkey3 );
RegCloseKey(hkey2); RegCloseKey(hkey2);
msi_reg_set_val_str( hkey3, NULL, app ); msi_reg_set_val_str( hkey3, NULL, app );
if (appid->RemoteServerName) if (appid->RemoteServerName)
msi_reg_set_val_str( hkey3, szRemoteServerName, appid->RemoteServerName ); msi_reg_set_val_str( hkey3, L"RemoteServerName", appid->RemoteServerName );
if (appid->LocalServer) if (appid->LocalServer)
msi_reg_set_val_str( hkey3, szLocalService, appid->LocalServer ); msi_reg_set_val_str( hkey3, L"LocalService", appid->LocalServer );
if (appid->ServiceParameters) if (appid->ServiceParameters)
msi_reg_set_val_str( hkey3, szService, appid->ServiceParameters ); msi_reg_set_val_str( hkey3, L"ServiceParameters", appid->ServiceParameters );
if (appid->DllSurrogate) if (appid->DllSurrogate)
msi_reg_set_val_str( hkey3, szDLL, appid->DllSurrogate ); msi_reg_set_val_str( hkey3, L"DllSurrogate", appid->DllSurrogate );
if (appid->ActivateAtStorage) if (appid->ActivateAtStorage)
msi_reg_set_val_str( hkey3, szActivate, szY ); msi_reg_set_val_str( hkey3, L"ActivateAtStorage", L"Y" );
if (appid->RunAsInteractiveUser) if (appid->RunAsInteractiveUser)
msi_reg_set_val_str( hkey3, szRunAs, szUser ); msi_reg_set_val_str( hkey3, L"RunAs", L"Interactive User" );
RegCloseKey(hkey3); RegCloseKey(hkey3);
return ERROR_SUCCESS; return ERROR_SUCCESS;
...@@ -745,7 +689,6 @@ static UINT register_appid(const MSIAPPID *appid, LPCWSTR app ) ...@@ -745,7 +689,6 @@ static UINT register_appid(const MSIAPPID *appid, LPCWSTR app )
UINT ACTION_RegisterClassInfo(MSIPACKAGE *package) UINT ACTION_RegisterClassInfo(MSIPACKAGE *package)
{ {
static const WCHAR szFileType_fmt[] = {'F','i','l','e','T','y','p','e','\\','%','s','\\','%','i',0};
REGSAM access = KEY_ALL_ACCESS; REGSAM access = KEY_ALL_ACCESS;
MSIRECORD *uirow; MSIRECORD *uirow;
HKEY hkey, hkey2, hkey3; HKEY hkey, hkey2, hkey3;
...@@ -753,7 +696,7 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package) ...@@ -753,7 +696,7 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package)
UINT r; UINT r;
if (package->script == SCRIPT_NONE) if (package->script == SCRIPT_NONE)
return msi_schedule_action(package, SCRIPT_INSTALL, szRegisterClassInfo); return msi_schedule_action( package, SCRIPT_INSTALL, L"RegisterClassInfo" );
r = load_classes_and_such( package ); r = load_classes_and_such( package );
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
...@@ -764,7 +707,7 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package) ...@@ -764,7 +707,7 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package)
else else
access |= KEY_WOW64_64KEY; access |= KEY_WOW64_64KEY;
if (RegCreateKeyExW( HKEY_CLASSES_ROOT, szCLSID, 0, NULL, 0, access, NULL, &hkey, NULL )) if (RegCreateKeyExW( HKEY_CLASSES_ROOT, L"CLSID", 0, NULL, 0, access, NULL, &hkey, NULL ))
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
LIST_FOR_EACH_ENTRY( cls, &package->classes, MSICLASS, entry ) LIST_FOR_EACH_ENTRY( cls, &package->classes, MSICLASS, entry )
...@@ -830,7 +773,7 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package) ...@@ -830,7 +773,7 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package)
if (cls->Argument) if (cls->Argument)
{ {
lstrcatW( argument, szSpace ); lstrcatW( argument, L" " );
lstrcatW( argument, cls->Argument ); lstrcatW( argument, cls->Argument );
} }
...@@ -848,11 +791,11 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package) ...@@ -848,11 +791,11 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package)
else else
progid = cls->ProgIDText; progid = cls->ProgIDText;
msi_reg_set_subkey_val( hkey2, szProgID, NULL, progid ); msi_reg_set_subkey_val( hkey2, L"ProgID", NULL, progid );
if (cls->ProgID && cls->ProgID->VersionInd) if (cls->ProgID && cls->ProgID->VersionInd)
{ {
msi_reg_set_subkey_val( hkey2, szVIProgID, NULL, msi_reg_set_subkey_val( hkey2, L"VersionIndependentProgID", NULL,
cls->ProgID->VersionInd->ProgID ); cls->ProgID->VersionInd->ProgID );
} }
} }
...@@ -860,18 +803,18 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package) ...@@ -860,18 +803,18 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package)
if (cls->AppID) if (cls->AppID)
{ {
MSIAPPID *appid = cls->AppID; MSIAPPID *appid = cls->AppID;
msi_reg_set_val_str( hkey2, szAppID, appid->AppID ); msi_reg_set_val_str( hkey2, L"AppID", appid->AppID );
register_appid( appid, cls->Description ); register_appid( appid, cls->Description );
} }
if (cls->IconPath) if (cls->IconPath)
msi_reg_set_subkey_val( hkey2, szDefaultIcon, NULL, cls->IconPath ); msi_reg_set_subkey_val( hkey2, L"DefaultIcon", NULL, cls->IconPath );
if (cls->DefInprocHandler) if (cls->DefInprocHandler)
msi_reg_set_subkey_val( hkey2, szInprocHandler, NULL, cls->DefInprocHandler ); msi_reg_set_subkey_val( hkey2, L"InprocHandler", NULL, cls->DefInprocHandler );
if (cls->DefInprocHandler32) if (cls->DefInprocHandler32)
msi_reg_set_subkey_val( hkey2, szInprocHandler32, NULL, cls->DefInprocHandler32 ); msi_reg_set_subkey_val( hkey2, L"InprocHandler32", NULL, cls->DefInprocHandler32 );
RegCloseKey(hkey2); RegCloseKey(hkey2);
/* if there is a FileTypeMask, register the FileType */ /* if there is a FileTypeMask, register the FileType */
...@@ -886,9 +829,9 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package) ...@@ -886,9 +829,9 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package)
ptr2 = wcschr(ptr,';'); ptr2 = wcschr(ptr,';');
if (ptr2) if (ptr2)
*ptr2 = 0; *ptr2 = 0;
keyname = msi_alloc( (lstrlenW(szFileType_fmt) + lstrlenW(cls->clsid) + 4) * sizeof(WCHAR)); keyname = msi_alloc( (lstrlenW(L"FileType\\%s\\%d") + lstrlenW(cls->clsid) + 4) * sizeof(WCHAR));
swprintf( keyname, lstrlenW(szFileType_fmt) + lstrlenW(cls->clsid) + 4, swprintf( keyname, lstrlenW(L"FileType\\%s\\%d") + lstrlenW(cls->clsid) + 4,
szFileType_fmt, cls->clsid, index ); L"FileType\\%s\\%d", cls->clsid, index );
msi_reg_set_subkey_val( HKEY_CLASSES_ROOT, keyname, NULL, ptr ); msi_reg_set_subkey_val( HKEY_CLASSES_ROOT, keyname, NULL, ptr );
msi_free(keyname); msi_free(keyname);
...@@ -913,7 +856,6 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package) ...@@ -913,7 +856,6 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package)
UINT ACTION_UnregisterClassInfo( MSIPACKAGE *package ) UINT ACTION_UnregisterClassInfo( MSIPACKAGE *package )
{ {
static const WCHAR szFileType[] = {'F','i','l','e','T','y','p','e','\\',0};
REGSAM access = KEY_ALL_ACCESS; REGSAM access = KEY_ALL_ACCESS;
MSIRECORD *uirow; MSIRECORD *uirow;
MSICLASS *cls; MSICLASS *cls;
...@@ -921,7 +863,7 @@ UINT ACTION_UnregisterClassInfo( MSIPACKAGE *package ) ...@@ -921,7 +863,7 @@ UINT ACTION_UnregisterClassInfo( MSIPACKAGE *package )
UINT r; UINT r;
if (package->script == SCRIPT_NONE) if (package->script == SCRIPT_NONE)
return msi_schedule_action(package, SCRIPT_INSTALL, szUnregisterClassInfo); return msi_schedule_action( package, SCRIPT_INSTALL, L"UnregisterClassInfo" );
r = load_classes_and_such( package ); r = load_classes_and_such( package );
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
...@@ -932,7 +874,7 @@ UINT ACTION_UnregisterClassInfo( MSIPACKAGE *package ) ...@@ -932,7 +874,7 @@ UINT ACTION_UnregisterClassInfo( MSIPACKAGE *package )
else else
access |= KEY_WOW64_64KEY; access |= KEY_WOW64_64KEY;
if (RegCreateKeyExW( HKEY_CLASSES_ROOT, szCLSID, 0, NULL, 0, access, NULL, &hkey, NULL )) if (RegCreateKeyExW( HKEY_CLASSES_ROOT, L"CLSID", 0, NULL, 0, access, NULL, &hkey, NULL ))
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
LIST_FOR_EACH_ENTRY( cls, &package->classes, MSICLASS, entry ) LIST_FOR_EACH_ENTRY( cls, &package->classes, MSICLASS, entry )
...@@ -973,7 +915,7 @@ UINT ACTION_UnregisterClassInfo( MSIPACKAGE *package ) ...@@ -973,7 +915,7 @@ UINT ACTION_UnregisterClassInfo( MSIPACKAGE *package )
if (cls->AppID) if (cls->AppID)
{ {
res = RegOpenKeyW( HKEY_CLASSES_ROOT, szAppID, &hkey2 ); res = RegOpenKeyW( HKEY_CLASSES_ROOT, L"AppID", &hkey2 );
if (res == ERROR_SUCCESS) if (res == ERROR_SUCCESS)
{ {
res = RegDeleteKeyW( hkey2, cls->AppID->AppID ); res = RegDeleteKeyW( hkey2, cls->AppID->AppID );
...@@ -984,10 +926,10 @@ UINT ACTION_UnregisterClassInfo( MSIPACKAGE *package ) ...@@ -984,10 +926,10 @@ UINT ACTION_UnregisterClassInfo( MSIPACKAGE *package )
} }
if (cls->FileTypeMask) if (cls->FileTypeMask)
{ {
filetype = msi_alloc( (lstrlenW( szFileType ) + lstrlenW( cls->clsid ) + 1) * sizeof(WCHAR) ); filetype = msi_alloc( (lstrlenW( L"FileType\\" ) + lstrlenW( cls->clsid ) + 1) * sizeof(WCHAR) );
if (filetype) if (filetype)
{ {
lstrcpyW( filetype, szFileType ); lstrcpyW( filetype, L"FileType\\" );
lstrcatW( filetype, cls->clsid ); lstrcatW( filetype, cls->clsid );
res = RegDeleteTreeW( HKEY_CLASSES_ROOT, filetype ); res = RegDeleteTreeW( HKEY_CLASSES_ROOT, filetype );
msi_free( filetype ); msi_free( filetype );
...@@ -1021,7 +963,6 @@ static LPCWSTR get_clsid_of_progid( const MSIPROGID *progid ) ...@@ -1021,7 +963,6 @@ static LPCWSTR get_clsid_of_progid( const MSIPROGID *progid )
static UINT register_progid( const MSIPROGID* progid ) static UINT register_progid( const MSIPROGID* progid )
{ {
static const WCHAR szCurVer[] = {'C','u','r','V','e','r',0};
HKEY hkey = 0; HKEY hkey = 0;
UINT rc; UINT rc;
...@@ -1031,7 +972,7 @@ static UINT register_progid( const MSIPROGID* progid ) ...@@ -1031,7 +972,7 @@ static UINT register_progid( const MSIPROGID* progid )
LPCWSTR clsid = get_clsid_of_progid( progid ); LPCWSTR clsid = get_clsid_of_progid( progid );
if (clsid) if (clsid)
msi_reg_set_subkey_val( hkey, szCLSID, NULL, clsid ); msi_reg_set_subkey_val( hkey, L"CLSID", NULL, clsid );
else else
TRACE("%s has no class\n", debugstr_w( progid->ProgID ) ); TRACE("%s has no class\n", debugstr_w( progid->ProgID ) );
...@@ -1039,11 +980,11 @@ static UINT register_progid( const MSIPROGID* progid ) ...@@ -1039,11 +980,11 @@ static UINT register_progid( const MSIPROGID* progid )
msi_reg_set_val_str( hkey, NULL, progid->Description ); msi_reg_set_val_str( hkey, NULL, progid->Description );
if (progid->IconPath) if (progid->IconPath)
msi_reg_set_subkey_val( hkey, szDefaultIcon, NULL, progid->IconPath ); msi_reg_set_subkey_val( hkey, L"DefaultIcon", NULL, progid->IconPath );
/* write out the current version */ /* write out the current version */
if (progid->CurVer) if (progid->CurVer)
msi_reg_set_subkey_val( hkey, szCurVer, NULL, progid->CurVer->ProgID ); msi_reg_set_subkey_val( hkey, L"CurVer", NULL, progid->CurVer->ProgID );
RegCloseKey(hkey); RegCloseKey(hkey);
} }
...@@ -1089,7 +1030,7 @@ UINT ACTION_RegisterProgIdInfo(MSIPACKAGE *package) ...@@ -1089,7 +1030,7 @@ UINT ACTION_RegisterProgIdInfo(MSIPACKAGE *package)
UINT r; UINT r;
if (package->script == SCRIPT_NONE) if (package->script == SCRIPT_NONE)
return msi_schedule_action(package, SCRIPT_INSTALL, szRegisterProgIdInfo); return msi_schedule_action( package, SCRIPT_INSTALL, L"RegisterProgIdInfo" );
r = load_classes_and_such( package ); r = load_classes_and_such( package );
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
...@@ -1152,7 +1093,7 @@ UINT ACTION_UnregisterProgIdInfo( MSIPACKAGE *package ) ...@@ -1152,7 +1093,7 @@ UINT ACTION_UnregisterProgIdInfo( MSIPACKAGE *package )
UINT r; UINT r;
if (package->script == SCRIPT_NONE) if (package->script == SCRIPT_NONE)
return msi_schedule_action(package, SCRIPT_INSTALL, szUnregisterProgIdInfo); return msi_schedule_action( package, SCRIPT_INSTALL, L"UnregisterProgIdInfo" );
r = load_classes_and_such( package ); r = load_classes_and_such( package );
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
...@@ -1180,21 +1121,17 @@ UINT ACTION_UnregisterProgIdInfo( MSIPACKAGE *package ) ...@@ -1180,21 +1121,17 @@ UINT ACTION_UnregisterProgIdInfo( MSIPACKAGE *package )
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
static UINT register_verb(MSIPACKAGE *package, LPCWSTR progid, static UINT register_verb(MSIPACKAGE *package, LPCWSTR progid,
MSICOMPONENT* component, const MSIEXTENSION* extension, MSICOMPONENT* component, const MSIEXTENSION* extension,
MSIVERB* verb, INT* Sequence ) MSIVERB* verb, INT* Sequence )
{ {
LPWSTR keyname; LPWSTR keyname;
HKEY key; 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; LPWSTR command;
DWORD size; DWORD size;
LPWSTR advertise; LPWSTR advertise;
keyname = msi_build_directory_name(4, progid, szShell, verb->Verb, szCommand); keyname = msi_build_directory_name(4, progid, L"shell", verb->Verb, L"command");
TRACE("Making Key %s\n",debugstr_w(keyname)); TRACE("Making Key %s\n",debugstr_w(keyname));
RegCreateKeyW(HKEY_CLASSES_ROOT, keyname, &key); RegCreateKeyW(HKEY_CLASSES_ROOT, keyname, &key);
...@@ -1205,9 +1142,9 @@ static UINT register_verb(MSIPACKAGE *package, LPCWSTR progid, ...@@ -1205,9 +1142,9 @@ static UINT register_verb(MSIPACKAGE *package, LPCWSTR progid,
command = msi_alloc(size * sizeof (WCHAR)); command = msi_alloc(size * sizeof (WCHAR));
if (verb->Argument) if (verb->Argument)
swprintf(command, size, fmt, component->FullKeypath, verb->Argument); swprintf(command, size, L"\"%s\" %s", component->FullKeypath, verb->Argument);
else else
swprintf(command, size, fmt2, component->FullKeypath); swprintf(command, size, L"\"%s\"", component->FullKeypath);
msi_reg_set_val_str( key, NULL, command ); msi_reg_set_val_str( key, NULL, command );
msi_free(command); msi_free(command);
...@@ -1225,12 +1162,12 @@ static UINT register_verb(MSIPACKAGE *package, LPCWSTR progid, ...@@ -1225,12 +1162,12 @@ static UINT register_verb(MSIPACKAGE *package, LPCWSTR progid,
lstrcpyW(command,advertise); lstrcpyW(command,advertise);
if (verb->Argument) if (verb->Argument)
{ {
lstrcatW(command,szSpace); lstrcatW(command, L" ");
lstrcatW(command,verb->Argument); lstrcatW(command, verb->Argument);
} }
msi_reg_set_val_multi_str( key, szCommand, command ); msi_reg_set_val_multi_str( key, L"command", command );
RegCloseKey(key); RegCloseKey(key);
msi_free(keyname); msi_free(keyname);
msi_free(advertise); msi_free(advertise);
...@@ -1238,7 +1175,7 @@ static UINT register_verb(MSIPACKAGE *package, LPCWSTR progid, ...@@ -1238,7 +1175,7 @@ static UINT register_verb(MSIPACKAGE *package, LPCWSTR progid,
if (verb->Command) if (verb->Command)
{ {
keyname = msi_build_directory_name( 3, progid, szShell, verb->Verb ); keyname = msi_build_directory_name( 3, progid, L"shell", verb->Verb );
msi_reg_set_subkey_val( HKEY_CLASSES_ROOT, keyname, NULL, verb->Command ); msi_reg_set_subkey_val( HKEY_CLASSES_ROOT, keyname, NULL, verb->Command );
msi_free(keyname); msi_free(keyname);
} }
...@@ -1248,7 +1185,7 @@ static UINT register_verb(MSIPACKAGE *package, LPCWSTR progid, ...@@ -1248,7 +1185,7 @@ static UINT register_verb(MSIPACKAGE *package, LPCWSTR progid,
if (*Sequence == MSI_NULL_INTEGER || verb->Sequence < *Sequence) if (*Sequence == MSI_NULL_INTEGER || verb->Sequence < *Sequence)
{ {
*Sequence = verb->Sequence; *Sequence = verb->Sequence;
keyname = msi_build_directory_name( 2, progid, szShell ); keyname = msi_build_directory_name( 2, progid, L"shell" );
msi_reg_set_subkey_val( HKEY_CLASSES_ROOT, keyname, NULL, verb->Verb ); msi_reg_set_subkey_val( HKEY_CLASSES_ROOT, keyname, NULL, verb->Verb );
msi_free(keyname); msi_free(keyname);
} }
...@@ -1258,7 +1195,6 @@ static UINT register_verb(MSIPACKAGE *package, LPCWSTR progid, ...@@ -1258,7 +1195,6 @@ static UINT register_verb(MSIPACKAGE *package, LPCWSTR progid,
UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package) UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package)
{ {
static const WCHAR szContentType[] = {'C','o','n','t','e','n','t',' ','T','y','p','e',0};
HKEY hkey = NULL; HKEY hkey = NULL;
MSIEXTENSION *ext; MSIEXTENSION *ext;
MSIRECORD *uirow; MSIRECORD *uirow;
...@@ -1267,7 +1203,7 @@ UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package) ...@@ -1267,7 +1203,7 @@ UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package)
UINT r; UINT r;
if (package->script == SCRIPT_NONE) if (package->script == SCRIPT_NONE)
return msi_schedule_action(package, SCRIPT_INSTALL, szRegisterExtensionInfo); return msi_schedule_action( package, SCRIPT_INSTALL, L"RegisterExtensionInfo" );
r = load_classes_and_such( package ); r = load_classes_and_such( package );
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
...@@ -1277,12 +1213,12 @@ UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package) ...@@ -1277,12 +1213,12 @@ UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package)
* shortcuts and the like. Because Mike McCormack is working on this i am * shortcuts and the like. Because Mike McCormack is working on this i am
* going to default to TRUE * going to default to TRUE
*/ */
LIST_FOR_EACH_ENTRY( ext, &package->extensions, MSIEXTENSION, entry ) LIST_FOR_EACH_ENTRY( ext, &package->extensions, MSIEXTENSION, entry )
{ {
LPWSTR extension; LPWSTR extension;
MSIFEATURE *feature; MSIFEATURE *feature;
if (!ext->Component) if (!ext->Component)
continue; continue;
...@@ -1296,7 +1232,7 @@ UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package) ...@@ -1296,7 +1232,7 @@ UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package)
if (!feature) if (!feature)
continue; continue;
/* /*
* yes. MSDN says that these are based on _Feature_ not on * yes. MSDN says that these are based on _Feature_ not on
* Component. So verify the feature is to be installed * Component. So verify the feature is to be installed
*/ */
...@@ -1324,18 +1260,16 @@ UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package) ...@@ -1324,18 +1260,16 @@ UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package)
} }
if (ext->Mime) if (ext->Mime)
msi_reg_set_val_str( hkey, szContentType, ext->Mime->ContentType ); msi_reg_set_val_str( hkey, L"Content Type", ext->Mime->ContentType );
if (ext->ProgID || ext->ProgIDText) if (ext->ProgID || ext->ProgIDText)
{ {
static const WCHAR szSN[] =
{'\\','S','h','e','l','l','N','e','w',0};
HKEY hkey2; HKEY hkey2;
LPWSTR newkey; LPWSTR newkey;
LPCWSTR progid; LPCWSTR progid;
MSIVERB *verb; MSIVERB *verb;
INT Sequence = MSI_NULL_INTEGER; INT Sequence = MSI_NULL_INTEGER;
if (ext->ProgID) if (ext->ProgID)
progid = ext->ProgID->ProgID; progid = ext->ProgID->ProgID;
else else
...@@ -1343,11 +1277,11 @@ UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package) ...@@ -1343,11 +1277,11 @@ UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package)
msi_reg_set_val_str( hkey, NULL, progid ); msi_reg_set_val_str( hkey, NULL, progid );
newkey = msi_alloc( (lstrlenW(progid)+lstrlenW(szSN)+1) * sizeof(WCHAR)); newkey = msi_alloc( (lstrlenW(progid) + lstrlenW(L"\\ShellNew") + 1) * sizeof(WCHAR));
lstrcpyW(newkey,progid); lstrcpyW(newkey, progid);
lstrcatW(newkey,szSN); lstrcatW(newkey, L"\\ShellNew");
RegCreateKeyW(hkey,newkey,&hkey2); RegCreateKeyW(hkey, newkey, &hkey2);
RegCloseKey(hkey2); RegCloseKey(hkey2);
msi_free(newkey); msi_free(newkey);
...@@ -1359,7 +1293,7 @@ UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package) ...@@ -1359,7 +1293,7 @@ UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package)
ext, verb, &Sequence); ext, verb, &Sequence);
} }
} }
RegCloseKey(hkey); RegCloseKey(hkey);
uirow = MSI_CreateRecord(1); uirow = MSI_CreateRecord(1);
...@@ -1378,7 +1312,7 @@ UINT ACTION_UnregisterExtensionInfo( MSIPACKAGE *package ) ...@@ -1378,7 +1312,7 @@ UINT ACTION_UnregisterExtensionInfo( MSIPACKAGE *package )
UINT r; UINT r;
if (package->script == SCRIPT_NONE) if (package->script == SCRIPT_NONE)
return msi_schedule_action(package, SCRIPT_INSTALL, szUnregisterExtensionInfo); return msi_schedule_action( package, SCRIPT_INSTALL, L"UnregisterExtensionInfo" );
r = load_classes_and_such( package ); r = load_classes_and_such( package );
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
...@@ -1426,7 +1360,6 @@ UINT ACTION_UnregisterExtensionInfo( MSIPACKAGE *package ) ...@@ -1426,7 +1360,6 @@ UINT ACTION_UnregisterExtensionInfo( MSIPACKAGE *package )
if (ext->ProgID || ext->ProgIDText) if (ext->ProgID || ext->ProgIDText)
{ {
static const WCHAR shellW[] = {'\\','s','h','e','l','l',0};
LPCWSTR progid; LPCWSTR progid;
LPWSTR progid_shell; LPWSTR progid_shell;
...@@ -1435,11 +1368,11 @@ UINT ACTION_UnregisterExtensionInfo( MSIPACKAGE *package ) ...@@ -1435,11 +1368,11 @@ UINT ACTION_UnregisterExtensionInfo( MSIPACKAGE *package )
else else
progid = ext->ProgIDText; progid = ext->ProgIDText;
progid_shell = msi_alloc( (lstrlenW( progid ) + lstrlenW( shellW ) + 1) * sizeof(WCHAR) ); progid_shell = msi_alloc( (lstrlenW( progid ) + lstrlenW( L"\\shell" ) + 1) * sizeof(WCHAR) );
if (progid_shell) if (progid_shell)
{ {
lstrcpyW( progid_shell, progid ); lstrcpyW( progid_shell, progid );
lstrcatW( progid_shell, shellW ); lstrcatW( progid_shell, L"\\shell" );
res = RegDeleteTreeW( HKEY_CLASSES_ROOT, progid_shell ); res = RegDeleteTreeW( HKEY_CLASSES_ROOT, progid_shell );
msi_free( progid_shell ); msi_free( progid_shell );
if (res != ERROR_SUCCESS) if (res != ERROR_SUCCESS)
...@@ -1458,13 +1391,12 @@ UINT ACTION_UnregisterExtensionInfo( MSIPACKAGE *package ) ...@@ -1458,13 +1391,12 @@ UINT ACTION_UnregisterExtensionInfo( MSIPACKAGE *package )
UINT ACTION_RegisterMIMEInfo(MSIPACKAGE *package) UINT ACTION_RegisterMIMEInfo(MSIPACKAGE *package)
{ {
static const WCHAR szExtension[] = {'E','x','t','e','n','s','i','o','n',0};
MSIRECORD *uirow; MSIRECORD *uirow;
MSIMIME *mt; MSIMIME *mt;
UINT r; UINT r;
if (package->script == SCRIPT_NONE) if (package->script == SCRIPT_NONE)
return msi_schedule_action(package, SCRIPT_INSTALL, szRegisterMIMEInfo); return msi_schedule_action( package, SCRIPT_INSTALL, L"RegisterMIMEInfo" );
r = load_classes_and_such( package ); r = load_classes_and_such( package );
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
...@@ -1474,7 +1406,7 @@ UINT ACTION_RegisterMIMEInfo(MSIPACKAGE *package) ...@@ -1474,7 +1406,7 @@ UINT ACTION_RegisterMIMEInfo(MSIPACKAGE *package)
{ {
LPWSTR extension = NULL, key; LPWSTR extension = NULL, key;
/* /*
* check if the MIME is to be installed. Either as requested by an * check if the MIME is to be installed. Either as requested by an
* extension or Class * extension or Class
*/ */
...@@ -1488,19 +1420,20 @@ UINT ACTION_RegisterMIMEInfo(MSIPACKAGE *package) ...@@ -1488,19 +1420,20 @@ UINT ACTION_RegisterMIMEInfo(MSIPACKAGE *package)
TRACE("Registering MIME type %s\n", debugstr_w(mt->ContentType)); TRACE("Registering MIME type %s\n", debugstr_w(mt->ContentType));
if (mt->Extension) extension = msi_alloc( (lstrlenW( mt->Extension->Extension ) + 2) * sizeof(WCHAR) ); if (mt->Extension) extension = msi_alloc( (lstrlenW( mt->Extension->Extension ) + 2) * sizeof(WCHAR) );
key = msi_alloc( (lstrlenW( mt->ContentType ) + lstrlenW( szMIMEDatabase ) + 1) * sizeof(WCHAR) ); key = msi_alloc( (lstrlenW( mt->ContentType ) +
lstrlenW( L"MIME\\Database\\Content Type\\" ) + 1) * sizeof(WCHAR) );
if (extension && key) if (extension && key)
{ {
extension[0] = '.'; extension[0] = '.';
lstrcpyW( extension + 1, mt->Extension->Extension ); lstrcpyW( extension + 1, mt->Extension->Extension );
lstrcpyW( key, szMIMEDatabase ); lstrcpyW( key, L"MIME\\Database\\Content Type\\" );
lstrcatW( key, mt->ContentType ); lstrcatW( key, mt->ContentType );
msi_reg_set_subkey_val( HKEY_CLASSES_ROOT, key, szExtension, extension ); msi_reg_set_subkey_val( HKEY_CLASSES_ROOT, key, L"Extension", extension );
if (mt->clsid) if (mt->clsid)
msi_reg_set_subkey_val( HKEY_CLASSES_ROOT, key, szCLSID, mt->clsid ); msi_reg_set_subkey_val( HKEY_CLASSES_ROOT, key, L"CLSID", mt->clsid );
} }
msi_free( extension ); msi_free( extension );
msi_free( key ); msi_free( key );
...@@ -1521,7 +1454,7 @@ UINT ACTION_UnregisterMIMEInfo( MSIPACKAGE *package ) ...@@ -1521,7 +1454,7 @@ UINT ACTION_UnregisterMIMEInfo( MSIPACKAGE *package )
UINT r; UINT r;
if (package->script == SCRIPT_NONE) if (package->script == SCRIPT_NONE)
return msi_schedule_action(package, SCRIPT_INSTALL, szUnregisterMIMEInfo); return msi_schedule_action( package, SCRIPT_INSTALL, L"UnregisterMIMEInfo" );
r = load_classes_and_such( package ); r = load_classes_and_such( package );
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
...@@ -1541,10 +1474,11 @@ UINT ACTION_UnregisterMIMEInfo( MSIPACKAGE *package ) ...@@ -1541,10 +1474,11 @@ UINT ACTION_UnregisterMIMEInfo( MSIPACKAGE *package )
TRACE("Unregistering MIME type %s\n", debugstr_w(mime->ContentType)); TRACE("Unregistering MIME type %s\n", debugstr_w(mime->ContentType));
mime_key = msi_alloc( (lstrlenW( szMIMEDatabase ) + lstrlenW( mime->ContentType ) + 1) * sizeof(WCHAR) ); mime_key = msi_alloc( (lstrlenW( L"MIME\\Database\\Content Type\\" ) +
lstrlenW( mime->ContentType ) + 1) * sizeof(WCHAR) );
if (mime_key) if (mime_key)
{ {
lstrcpyW( mime_key, szMIMEDatabase ); lstrcpyW( mime_key, L"MIME\\Database\\Content Type\\" );
lstrcatW( mime_key, mime->ContentType ); lstrcatW( mime_key, mime->ContentType );
res = RegDeleteKeyW( HKEY_CLASSES_ROOT, mime_key ); res = RegDeleteKeyW( HKEY_CLASSES_ROOT, mime_key );
if (res != ERROR_SUCCESS) if (res != ERROR_SUCCESS)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment