winemenubuilder: Ignore wine.desktop managed file types.

This commit is contained in:
Damjan Jovanovic 2009-06-02 19:15:58 +02:00 committed by Alexandre Julliard
parent 9339be641c
commit 77e0ee9013
1 changed files with 15 additions and 1 deletions

View File

@ -1549,6 +1549,20 @@ static BOOL write_freedesktop_mime_type_entry(const char *packages_dir, const ch
return ret;
}
static BOOL is_extension_blacklisted(LPCWSTR extension)
{
/* These are managed through external tools like wine.desktop, to evade malware created file type associations */
static const WCHAR comW[] = {'.','c','o','m',0};
static const WCHAR exeW[] = {'.','e','x','e',0};
static const WCHAR msiW[] = {'.','m','s','i',0};
if (!strcmpiW(extension, comW) ||
!strcmpiW(extension, exeW) ||
!strcmpiW(extension, msiW))
return TRUE;
return FALSE;
}
static BOOL generate_associations(const char *xdg_data_home, const char *packages_dir, const char *applications_dir)
{
struct list *nativeMimeTypes = NULL;
@ -1581,7 +1595,7 @@ static BOOL generate_associations(const char *xdg_data_home, const char *package
size *= 2;
} while (ret == ERROR_MORE_DATA);
if (ret == ERROR_SUCCESS && extensionW[0] == '.')
if (ret == ERROR_SUCCESS && extensionW[0] == '.' && !is_extension_blacklisted(extensionW))
{
char *extensionA = NULL;
WCHAR *commandW = NULL;