msi: Handle the CompLocator table in the AppSearch action.

oldstable
James Hawkins 2007-12-07 14:51:17 -06:00 committed by Alexandre Julliard
parent 44349af11a
commit e6431cd06e
2 changed files with 63 additions and 27 deletions

View File

@ -28,6 +28,7 @@
#include "msiquery.h"
#include "msidefs.h"
#include "winver.h"
#include "shlwapi.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "msipriv.h"
@ -157,30 +158,77 @@ static void ACTION_FreeSignature(MSISIGNATURE *sig)
static UINT ACTION_AppSearchComponents(MSIPACKAGE *package, LPWSTR *appValue, MSISIGNATURE *sig)
{
static const WCHAR query[] = {
's','e','l','e','c','t',' ','*',' ',
'f','r','o','m',' ',
'C','o','m','p','L','o','c','a','t','o','r',' ',
'w','h','e','r','e',' ','S','i','g','n','a','t','u','r','e','_',' ','=',' ',
'S','E','L','E','C','T',' ','*',' ',
'F','R','O','M',' ',
'`','C','o','m','p','L','o','c','a','t','o','r','`',' ',
'W','H','E','R','E',' ','`','S','i','g','n','a','t','u','r','e','_','`',' ','=',' ',
'\'','%','s','\'',0};
MSIRECORD *row;
LPWSTR guid;
static const WCHAR sigquery[] = {
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','S','i','g','n','a','t','u','r','e','`',' ',
'W','H','E','R','E',' ','`','S','i','g','n','a','t','u','r','e','`',' ','=',' ',
'\'','%','s','\'',0};
MSIRECORD *row, *rec;
LPCWSTR signature, guid;
BOOL sigpresent = TRUE;
BOOL isdir;
UINT type;
WCHAR path[MAX_PATH];
DWORD size = MAX_PATH;
LPWSTR ptr;
DWORD attr;
TRACE("%s\n", debugstr_w(sig->Name));
*appValue = NULL;
row = MSI_QueryGetRecord( package->db, query, sig->Name );
row = MSI_QueryGetRecord(package->db, query, sig->Name);
if (!row)
{
TRACE("failed to query CompLocator for %s\n", debugstr_w(sig->Name));
return ERROR_SUCCESS;
}
guid = msi_dup_record_field( row, 2 );
FIXME("AppSearch CompLocator (%s) unimplemented\n", debugstr_w(guid));
msi_free( guid );
msiobj_release( &row->hdr );
signature = MSI_RecordGetString(row, 1);
guid = MSI_RecordGetString(row, 2);
type = MSI_RecordGetInteger(row, 3);
rec = MSI_QueryGetRecord(package->db, sigquery, signature);
if (!rec)
sigpresent = FALSE;
*path = '\0';
MsiLocateComponentW(guid, path, &size);
if (!*path)
goto done;
attr = GetFileAttributesW(path);
if (attr == INVALID_FILE_ATTRIBUTES)
goto done;
isdir = (attr & FILE_ATTRIBUTE_DIRECTORY);
if (type != msidbLocatorTypeDirectory && sigpresent && !isdir)
{
*appValue = strdupW(path);
}
else if (!sigpresent && (type != msidbLocatorTypeDirectory || isdir))
{
if (type == msidbLocatorTypeFileName)
{
ptr = strrchrW(path, '\\');
*(ptr + 1) = '\0';
}
else
PathAddBackslashW(path);
*appValue = strdupW(path);
}
done:
if (rec) msiobj_release(&rec->hdr);
msiobj_release(&row->hdr);
return ERROR_SUCCESS;
}

View File

@ -5228,10 +5228,7 @@ static void test_complocator(void)
lstrcpyA(expected, CURR_DIR);
lstrcatA(expected, "\\abelisaurus");
todo_wine
{
ok(!lstrcmpA(prop, expected), "Expected %s, got %s\n", expected, prop);
}
ok(!lstrcmpA(prop, expected), "Expected %s, got %s\n", expected, prop);
size = MAX_PATH;
r = MsiGetPropertyA(hpkg, "BACTROSAURUS", prop, &size);
@ -5254,10 +5251,7 @@ static void test_complocator(void)
lstrcpyA(expected, CURR_DIR);
lstrcatA(expected, "\\");
todo_wine
{
ok(!lstrcmpA(prop, expected), "Expected %s, got %s\n", expected, prop);
}
ok(!lstrcmpA(prop, expected), "Expected %s, got %s\n", expected, prop);
size = MAX_PATH;
r = MsiGetPropertyA(hpkg, "FALCARIUS", prop, &size);
@ -5300,10 +5294,7 @@ static void test_complocator(void)
lstrcpyA(expected, CURR_DIR);
lstrcatA(expected, "\\");
todo_wine
{
ok(!lstrcmpA(prop, expected), "Expected %s, got %s\n", expected, prop);
}
ok(!lstrcmpA(prop, expected), "Expected %s, got %s\n", expected, prop);
size = MAX_PATH;
r = MsiGetPropertyA(hpkg, "NEOSODON", prop, &size);
@ -5311,10 +5302,7 @@ static void test_complocator(void)
lstrcpyA(expected, CURR_DIR);
lstrcatA(expected, "\\neosodon\\");
todo_wine
{
ok(!lstrcmpA(prop, expected), "Expected %s, got %s\n", expected, prop);
}
ok(!lstrcmpA(prop, expected), "Expected %s, got %s\n", expected, prop);
size = MAX_PATH;
r = MsiGetPropertyA(hpkg, "OLOROTITAN", prop, &size);