Commit ccd030c7 authored by James Hawkins's avatar James Hawkins Committed by Alexandre Julliard

msi: Add handling for the special _Storages table.

parent ae9b5791
...@@ -39,6 +39,7 @@ C_SRCS = \ ...@@ -39,6 +39,7 @@ C_SRCS = \
script.c \ script.c \
select.c \ select.c \
source.c \ source.c \
storages.c \
streams.c \ streams.c \
string.c \ string.c \
suminfo.c \ suminfo.c \
......
...@@ -326,7 +326,7 @@ UINT msi_view_get_row(MSIDATABASE *db, MSIVIEW *view, UINT row, MSIRECORD **rec) ...@@ -326,7 +326,7 @@ UINT msi_view_get_row(MSIDATABASE *db, MSIVIEW *view, UINT row, MSIRECORD **rec)
IStream_Release(stm); IStream_Release(stm);
} }
else else
ERR("failed to get stream\n"); WARN("failed to get stream\n");
continue; continue;
} }
......
...@@ -115,6 +115,8 @@ UINT ALTER_CreateView( MSIDATABASE *db, MSIVIEW **view, LPCWSTR name, column_inf ...@@ -115,6 +115,8 @@ UINT ALTER_CreateView( MSIDATABASE *db, MSIVIEW **view, LPCWSTR name, column_inf
UINT STREAMS_CreateView( MSIDATABASE *db, MSIVIEW **view ); UINT STREAMS_CreateView( MSIDATABASE *db, MSIVIEW **view );
UINT STORAGES_CreateView( MSIDATABASE *db, MSIVIEW **view );
int sqliteGetToken(const WCHAR *z, int *tokenType); int sqliteGetToken(const WCHAR *z, int *tokenType);
MSIRECORD *msi_query_merge_record( UINT fields, const column_info *vl, MSIRECORD *rec ); MSIRECORD *msi_query_merge_record( UINT fields, const column_info *vl, MSIRECORD *rec );
......
...@@ -2109,11 +2109,14 @@ UINT TABLE_CreateView( MSIDATABASE *db, LPCWSTR name, MSIVIEW **view ) ...@@ -2109,11 +2109,14 @@ UINT TABLE_CreateView( MSIDATABASE *db, LPCWSTR name, MSIVIEW **view )
UINT r, sz; UINT r, sz;
static const WCHAR Streams[] = {'_','S','t','r','e','a','m','s',0}; static const WCHAR Streams[] = {'_','S','t','r','e','a','m','s',0};
static const WCHAR Storages[] = {'_','S','t','o','r','a','g','e','s',0};
TRACE("%p %s %p\n", db, debugstr_w(name), view ); TRACE("%p %s %p\n", db, debugstr_w(name), view );
if ( !lstrcmpW( name, Streams ) ) if ( !lstrcmpW( name, Streams ) )
return STREAMS_CreateView( db, view ); return STREAMS_CreateView( db, view );
else if ( !lstrcmpW( name, Storages ) )
return STORAGES_CreateView( db, view );
sz = sizeof *tv + lstrlenW(name)*sizeof name[0] ; sz = sizeof *tv + lstrlenW(name)*sizeof name[0] ;
tv = msi_alloc_zero( sz ); tv = msi_alloc_zero( sz );
......
...@@ -6054,22 +6054,16 @@ static void test_storages_table(void) ...@@ -6054,22 +6054,16 @@ static void test_storages_table(void)
/* check the column types */ /* check the column types */
hrec = get_column_info(hdb, "SELECT * FROM `_Storages`", MSICOLINFO_TYPES); hrec = get_column_info(hdb, "SELECT * FROM `_Storages`", MSICOLINFO_TYPES);
ok(hrec, "failed to get column info hrecord\n"); ok(hrec, "failed to get column info hrecord\n");
todo_wine ok(check_record(hrec, 1, "s62"), "wrong hrecord type\n");
{ ok(check_record(hrec, 2, "V0"), "wrong hrecord type\n");
ok(check_record(hrec, 1, "s62"), "wrong hrecord type\n");
ok(check_record(hrec, 2, "V0"), "wrong hrecord type\n");
}
MsiCloseHandle(hrec); MsiCloseHandle(hrec);
/* now try the names */ /* now try the names */
hrec = get_column_info(hdb, "SELECT * FROM `_Storages`", MSICOLINFO_NAMES); hrec = get_column_info(hdb, "SELECT * FROM `_Storages`", MSICOLINFO_NAMES);
ok(hrec, "failed to get column info hrecord\n"); ok(hrec, "failed to get column info hrecord\n");
todo_wine ok(check_record(hrec, 1, "Name"), "wrong hrecord type\n");
{ ok(check_record(hrec, 2, "Data"), "wrong hrecord type\n");
ok(check_record(hrec, 1, "Name"), "wrong hrecord type\n");
ok(check_record(hrec, 2, "Data"), "wrong hrecord type\n");
}
MsiCloseHandle(hrec); MsiCloseHandle(hrec);
...@@ -6085,16 +6079,10 @@ static void test_storages_table(void) ...@@ -6085,16 +6079,10 @@ static void test_storages_table(void)
query = "INSERT INTO `_Storages` (`Name`, `Data`) VALUES (?, ?)"; query = "INSERT INTO `_Storages` (`Name`, `Data`) VALUES (?, ?)";
r = MsiDatabaseOpenView(hdb, query, &hview); r = MsiDatabaseOpenView(hdb, query, &hview);
todo_wine ok(r == ERROR_SUCCESS, "Failed to open database hview: %d\n", r);
{
ok(r == ERROR_SUCCESS, "Failed to open database hview: %d\n", r);
}
r = MsiViewExecute(hview, hrec); r = MsiViewExecute(hview, hrec);
todo_wine ok(r == ERROR_SUCCESS, "Failed to execute hview: %d\n", r);
{
ok(r == ERROR_SUCCESS, "Failed to execute hview: %d\n", r);
}
MsiCloseHandle(hrec); MsiCloseHandle(hrec);
MsiViewClose(hview); MsiViewClose(hview);
...@@ -6102,30 +6090,18 @@ static void test_storages_table(void) ...@@ -6102,30 +6090,18 @@ static void test_storages_table(void)
query = "SELECT `Name`, `Data` FROM `_Storages`"; query = "SELECT `Name`, `Data` FROM `_Storages`";
r = MsiDatabaseOpenView(hdb, query, &hview); r = MsiDatabaseOpenView(hdb, query, &hview);
todo_wine ok(r == ERROR_SUCCESS, "Failed to open database hview: %d\n", r);
{
ok(r == ERROR_SUCCESS, "Failed to open database hview: %d\n", r);
}
r = MsiViewExecute(hview, 0); r = MsiViewExecute(hview, 0);
todo_wine ok(r == ERROR_SUCCESS, "Failed to execute hview: %d\n", r);
{
ok(r == ERROR_SUCCESS, "Failed to execute hview: %d\n", r);
}
r = MsiViewFetch(hview, &hrec); r = MsiViewFetch(hview, &hrec);
todo_wine ok(r == ERROR_SUCCESS, "Failed to fetch hrecord: %d\n", r);
{
ok(r == ERROR_SUCCESS, "Failed to fetch hrecord: %d\n", r);
}
size = MAX_PATH; size = MAX_PATH;
r = MsiRecordGetString(hrec, 1, file, &size); r = MsiRecordGetString(hrec, 1, file, &size);
todo_wine ok(r == ERROR_SUCCESS, "Failed to get string: %d\n", r);
{ ok(!lstrcmp(file, "stgname"), "Expected \"stgname\", got \"%s\"\n", file);
ok(r == ERROR_SUCCESS, "Failed to get string: %d\n", r);
ok(!lstrcmp(file, "stgname"), "Expected \"stgname\", got \"%s\"\n", file);
}
size = MAX_PATH; size = MAX_PATH;
lstrcpyA(buf, "apple"); lstrcpyA(buf, "apple");
...@@ -6140,10 +6116,7 @@ static void test_storages_table(void) ...@@ -6140,10 +6116,7 @@ static void test_storages_table(void)
MsiCloseHandle(hrec); MsiCloseHandle(hrec);
r = MsiViewFetch(hview, &hrec); r = MsiViewFetch(hview, &hrec);
todo_wine ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
{
ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
}
MsiViewClose(hview); MsiViewClose(hview);
MsiCloseHandle(hview); MsiCloseHandle(hview);
...@@ -6160,28 +6133,21 @@ static void test_storages_table(void) ...@@ -6160,28 +6133,21 @@ static void test_storages_table(void)
MultiByteToWideChar(CP_ACP, 0, "stgname", -1, name, MAX_PATH); MultiByteToWideChar(CP_ACP, 0, "stgname", -1, name, MAX_PATH);
hr = IStorage_OpenStorage(stg, name, NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, hr = IStorage_OpenStorage(stg, name, NULL, STGM_READ | STGM_SHARE_EXCLUSIVE,
NULL, 0, &inner); NULL, 0, &inner);
todo_wine ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
{ ok(inner != NULL, "Expected non-NULL storage\n");
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(inner != NULL, "Expected non-NULL storage\n");
}
/* FIXME: remove when wine is fixed */ MultiByteToWideChar(CP_ACP, 0, "storage.bin", -1, name, MAX_PATH);
if (inner) hr = IStorage_OpenStream(inner, name, NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &stm);
{ ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
MultiByteToWideChar(CP_ACP, 0, "storage.bin", -1, name, MAX_PATH); ok(stm != NULL, "Expected non-NULL stream\n");
hr = IStorage_OpenStream(inner, name, NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &stm);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(stm != NULL, "Expected non-NULL stream\n");
hr = IStream_Read(stm, buf, MAX_PATH, &size); hr = IStream_Read(stm, buf, MAX_PATH, &size);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr); ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
ok(size == 8, "Expected 8, got %d\n", size); ok(size == 8, "Expected 8, got %d\n", size);
ok(!lstrcmpA(buf, "stgdata"), "Expected \"stgdata\", got \"%s\"\n", buf); ok(!lstrcmpA(buf, "stgdata"), "Expected \"stgdata\", got \"%s\"\n", buf);
IStream_Release(stm); IStream_Release(stm);
IStorage_Release(inner); IStorage_Release(inner);
}
IStorage_Release(stg); IStorage_Release(stg);
DeleteFileA(msifile); DeleteFileA(msifile);
......
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