Commit b040e4bc authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

When loading table data, split it up into rows.

parent 8d02010f
......@@ -500,13 +500,13 @@ UINT WINAPI MsiEnableLogW(DWORD dwLogMode, LPCWSTR szLogFile, BOOL fAppend)
INSTALLSTATE WINAPI MsiQueryProductStateA(LPCSTR szProduct)
{
FIXME("%s\n", debugstr_a(szProduct));
return 0;
return INSTALLSTATE_UNKNOWN;
}
INSTALLSTATE WINAPI MsiQueryProductStateW(LPCWSTR szProduct)
{
FIXME("%s\n", debugstr_w(szProduct));
return 0;
return INSTALLSTATE_UNKNOWN;
}
INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd)
......
......@@ -153,14 +153,20 @@ extern void free_cached_tables( MSIDATABASE *db );
extern UINT find_cached_table(MSIDATABASE *db, LPCWSTR name, MSITABLE **table);
extern UINT get_table(MSIDATABASE *db, LPCWSTR name, MSITABLE **table);
extern UINT load_string_table( MSIDATABASE *db );
extern UINT MSI_CommitTables( MSIDATABASE *db );
/* string table functions */
extern BOOL msi_addstring( string_table *st, UINT string_no, CHAR *data, UINT len, UINT refcount );
extern UINT msi_id2string( string_table *st, UINT string_no, LPWSTR buffer, UINT *sz );
extern UINT msi_id2stringW( string_table *st, UINT string_no, LPWSTR buffer, UINT *sz );
extern UINT msi_id2stringA( string_table *st, UINT string_no, LPSTR buffer, UINT *sz );
extern LPWSTR MSI_makestring( MSIDATABASE *db, UINT stringid);
extern UINT msi_string2id( string_table *st, LPCWSTR buffer, UINT *id );
extern string_table *msi_init_stringtable( int entries );
extern VOID msi_destroy_stringtable( string_table *st );
extern UINT msi_string_count( string_table *st );
extern UINT msi_id_refcount( string_table *st, UINT i );
extern UINT msi_string_totalsize( string_table *st );
UINT VIEW_find_column( MSIVIEW *view, LPWSTR name, UINT *n );
......
......@@ -361,8 +361,22 @@ UINT WINAPI MsiDatabaseGenerateTransformW( MSIHANDLE hdb, MSIHANDLE hdbref,
UINT WINAPI MsiDatabaseCommit( MSIHANDLE hdb )
{
FIXME("%ld\n", hdb);
return ERROR_SUCCESS;
MSIDATABASE *db;
UINT r;
TRACE("%ld\n", hdb);
db = msihandle2msiinfo( hdb, MSIHANDLETYPE_DATABASE );
if( !db )
return ERROR_INVALID_HANDLE;
/* FIXME: lock the database */
r = MSI_CommitTables( db );
/* FIXME: unlock the database */
return r;
}
UINT WINAPI MsiDatabaseGetPrimaryKeysA(MSIHANDLE hdb,
......@@ -406,4 +420,3 @@ UINT WINAPI MsiGetComponentStateW(MSIHANDLE hInstall, LPWSTR szFeature,
FIXME("%ld %s %p %p\n", hInstall, debugstr_w(szFeature), piInstalled, piAction);
return ERROR_CALL_NOT_IMPLEMENTED;
}
......@@ -123,7 +123,7 @@ int msi_addstring( string_table *st, UINT string_no, CHAR *data, UINT len, UINT
{
int n;
TRACE("[%2d] = %s\n", string_no, debugstr_an(data,len) );
/* TRACE("[%2d] = %s\n", string_no, debugstr_an(data,len) ); */
n = st_find_free_entry( st );
if( n < 0 )
......@@ -145,7 +145,35 @@ int msi_addstring( string_table *st, UINT string_no, CHAR *data, UINT len, UINT
return n;
}
UINT msi_id2string( string_table *st, UINT string_no, LPWSTR buffer, UINT *sz )
UINT msi_id2stringW( string_table *st, UINT string_no, LPWSTR buffer, UINT *sz )
{
UINT len;
LPSTR str;
TRACE("Finding string %d of %d\n", string_no, st->count);
if( string_no >= st->count )
return ERROR_FUNCTION_FAILED;
if( !st->strings[string_no].refcount )
return ERROR_FUNCTION_FAILED;
str = st->strings[string_no].str;
len = strlen( str );
if( !buffer )
{
*sz = MultiByteToWideChar(CP_ACP,0,str,len,NULL,0);
return ERROR_SUCCESS;
}
len = MultiByteToWideChar(CP_ACP,0,str,len+1,buffer,*sz);
if (!len) buffer[*sz-1] = 0;
else *sz = len;
return ERROR_SUCCESS;
}
UINT msi_id2stringA( string_table *st, UINT string_no, LPSTR buffer, UINT *sz )
{
UINT len;
LPSTR str;
......@@ -166,7 +194,8 @@ UINT msi_id2string( string_table *st, UINT string_no, LPWSTR buffer, UINT *sz )
return ERROR_SUCCESS;
}
len = MultiByteToWideChar(CP_ACP,0,str,len,buffer,*sz-1);
if (len >= *sz) len = *sz - 1;
memcpy( buffer, str, len );
buffer[len] = 0;
*sz = len+1;
......@@ -207,3 +236,27 @@ UINT msi_string2id( string_table *st, LPCWSTR buffer, UINT *id )
return r;
}
UINT msi_string_count( string_table *st )
{
return st->count;
}
UINT msi_id_refcount( string_table *st, UINT i )
{
if( i >= st->count )
return 0;
return st->strings[i].refcount;
}
UINT msi_string_totalsize( string_table *st )
{
UINT size = 0, i;
for( i=0; i<st->count; i++)
{
if( st->strings[i].str )
size += strlen( st->strings[i].str );
}
return size;
}
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