static void test_summary_binary(void) { const char *msifile = "winetest.msi"; MSIHANDLE hdb = 0, hsuminfo = 0; UINT r, type, count; INT ival; DWORD sz; char sval[20]; DeleteFile( msifile ); test_create_database_binary(); ok( INVALID_FILE_ATTRIBUTES != GetFileAttributes(msifile), "file doesn't exist!\n"); /* just MsiOpenDatabase should not create a file */ r = MsiOpenDatabase(msifile, MSIDBOPEN_READONLY, &hdb); ok(r == ERROR_SUCCESS, "MsiOpenDatabase failed\n"); r = MsiGetSummaryInformation(hdb, NULL, 0, &hsuminfo); ok(r == ERROR_SUCCESS, "MsiGetSummaryInformation failed\n"); /* * Check what reading PID_LASTPRINTED does... * The string value is written to the msi file * but it appears that we're not allowed to read it back again. * We can still read its type though...? */ sz = sizeof sval; sval[0] = 0; type = 0; r = MsiSummaryInfoGetProperty(hsuminfo, PID_LASTPRINTED, &type, NULL, NULL, sval, &sz); ok(r == ERROR_SUCCESS, "MsiSummaryInfoGetProperty failed\n"); ok(!lstrcmpA(sval, "") || !lstrcmpA(sval, "7"), "Expected empty string or \"7\", got \"%s\"\n", sval); todo_wine { ok(type == VT_LPSTR, "Expected VT_LPSTR, got %d\n", type); ok(sz == 0 || sz == 1, "Expected 0 or 1, got %d\n", sz); } ival = -1; r = MsiSummaryInfoGetProperty(hsuminfo, PID_WORDCOUNT, &type, &ival, NULL, NULL, NULL); ok(r == ERROR_SUCCESS, "MsiSummaryInfoGetProperty failed\n"); todo_wine ok( ival == 0, "value incorrect\n"); /* looks like msi adds some of its own values in here */ count = 0; r = MsiSummaryInfoGetPropertyCount( hsuminfo, &count ); ok(r == ERROR_SUCCESS, "getpropcount failed\n"); todo_wine ok(count == 10, "prop count incorrect\n"); MsiCloseHandle( hsuminfo ); MsiCloseHandle( hdb ); DeleteFile( msifile ); }
static void set_suminfo( const char *filename ) { UINT r; MSIHANDLE hsi, hdb; r = MsiOpenDatabaseA( filename, MSIDBOPEN_DIRECT, &hdb ); ok( r == ERROR_SUCCESS, "failed to open database %u\n", r ); r = MsiGetSummaryInformation( hdb, NULL, 7, &hsi ); ok( r == ERROR_SUCCESS, "failed to open summaryinfo %u\n", r ); r = MsiSummaryInfoSetProperty( hsi, 2, VT_LPSTR, 0, NULL, "Installation Database" ); ok( r == ERROR_SUCCESS, "failed to set summary info %u\n", r ); r = MsiSummaryInfoSetProperty( hsi, 3, VT_LPSTR, 0, NULL, "Installation Database" ); ok( r == ERROR_SUCCESS, "failed to set summary info %u\n", r ); r = MsiSummaryInfoSetProperty( hsi, 4, VT_LPSTR, 0, NULL, "WineHQ" ); ok( r == ERROR_SUCCESS, "failed to set summary info %u\n", r ); r = MsiSummaryInfoSetProperty( hsi, 7, VT_LPSTR, 0, NULL, ";1033" ); ok( r == ERROR_SUCCESS, "failed to set summary info %u\n", r ); r = MsiSummaryInfoSetProperty( hsi, 9, VT_LPSTR, 0, NULL, "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}" ); ok( r == ERROR_SUCCESS, "failed to set summary info %u\n", r ); r = MsiSummaryInfoSetProperty( hsi, 14, VT_I4, 100, NULL, NULL ); ok( r == ERROR_SUCCESS, "failed to set summary info %u\n", r ); r = MsiSummaryInfoSetProperty( hsi, 15, VT_I4, 0, NULL, NULL ); ok( r == ERROR_SUCCESS, "failed to set summary info %u\n", r ); r = MsiSummaryInfoPersist( hsi ); ok( r == ERROR_SUCCESS, "failed to persist suminfo %u\n", r ); r = MsiCloseHandle( hsi ); ok( r == ERROR_SUCCESS, "failed to close suminfo %u\n", r ); r = MsiCloseHandle( hdb ); ok( r == ERROR_SUCCESS, "failed to close database %u\n", r ); }
static void test_suminfo(void) { const char *msifile = "winetest.msi"; MSIHANDLE hdb = 0, hsuminfo; UINT r, count, type; DWORD sz; INT val; FILETIME ft; char buf[0x10]; DeleteFile(msifile); /* just MsiOpenDatabase should not create a file */ r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb); ok(r == ERROR_SUCCESS, "MsiOpenDatabase failed\n"); r = MsiGetSummaryInformation(hdb, NULL, 0, NULL); ok(r == ERROR_INVALID_PARAMETER, "MsiGetSummaryInformation wrong error\n"); r = MsiGetSummaryInformation(hdb, NULL, 0, &hsuminfo); ok(r == ERROR_SUCCESS, "MsiGetSummaryInformation failed\n"); r = MsiSummaryInfoGetPropertyCount(0, NULL); ok(r == ERROR_INVALID_HANDLE, "getpropcount failed\n"); r = MsiSummaryInfoGetPropertyCount(hsuminfo, NULL); ok(r == ERROR_SUCCESS, "getpropcount failed\n"); count = -1; r = MsiSummaryInfoGetPropertyCount(hsuminfo, &count); ok(r == ERROR_SUCCESS, "getpropcount failed\n"); ok(count == 0, "count should be zero\n"); r = MsiSummaryInfoGetProperty(hsuminfo, 0, NULL, NULL, NULL, 0, NULL); ok(r == ERROR_SUCCESS, "getpropcount failed\n"); r = MsiSummaryInfoGetProperty(hsuminfo, -1, NULL, NULL, NULL, 0, NULL); ok(r == ERROR_UNKNOWN_PROPERTY, "MsiSummaryInfoGetProperty wrong error\n"); r = MsiSummaryInfoGetProperty(hsuminfo, PID_SECURITY+1, NULL, NULL, NULL, 0, NULL); ok(r == ERROR_UNKNOWN_PROPERTY, "MsiSummaryInfoGetProperty wrong error\n"); type = -1; r = MsiSummaryInfoGetProperty(hsuminfo, 0, &type, NULL, NULL, 0, NULL); ok(r == ERROR_SUCCESS, "getpropcount failed\n"); ok(type == 0, "wrong type\n"); type = -1; val = 1234; r = MsiSummaryInfoGetProperty(hsuminfo, 0, &type, &val, NULL, 0, NULL); ok(r == ERROR_SUCCESS, "getpropcount failed\n"); ok(type == 0, "wrong type\n"); ok(val == 1234, "wrong val\n"); buf[0]='x'; buf[1]=0; sz = 0x10; r = MsiSummaryInfoGetProperty(hsuminfo, PID_REVNUMBER, &type, &val, NULL, buf, &sz); ok(r == ERROR_SUCCESS, "getpropcount failed\n"); ok(buf[0]=='x', "cleared buffer\n"); ok(sz == 0x10, "count wasn't zero\n"); ok(type == VT_EMPTY, "should be empty\n"); r = MsiSummaryInfoSetProperty(hsuminfo, PID_TITLE, VT_LPSTR, 0, NULL, "Mike"); ok(r == ERROR_FUNCTION_FAILED, "MsiSummaryInfoSetProperty wrong error\n"); r = MsiSummaryInfoSetProperty(hsuminfo, PID_TITLE, VT_LPSTR, 1, NULL, "JungAh"); ok(r == ERROR_FUNCTION_FAILED, "MsiSummaryInfoSetProperty wrong error\n"); r = MsiSummaryInfoSetProperty(hsuminfo, PID_TITLE, VT_LPSTR, 1, &ft, "Mike"); ok(r == ERROR_FUNCTION_FAILED, "MsiSummaryInfoSetProperty wrong error\n"); r = MsiSummaryInfoSetProperty(hsuminfo, PID_CODEPAGE, VT_I2, 1, &ft, "JungAh"); ok(r == ERROR_FUNCTION_FAILED, "MsiSummaryInfoSetProperty wrong error\n"); r = MsiCloseHandle(hsuminfo); ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n"); /* try again with the update count set */ r = MsiGetSummaryInformation(hdb, NULL, 1, &hsuminfo); ok(r == ERROR_SUCCESS, "MsiGetSummaryInformation failed\n"); r = MsiSummaryInfoSetProperty(hsuminfo, 0, VT_LPSTR, 1, NULL, NULL); ok(r == ERROR_DATATYPE_MISMATCH, "MsiSummaryInfoSetProperty wrong error\n"); r = MsiSummaryInfoSetProperty(hsuminfo, PID_CODEPAGE, VT_LPSTR, 1, NULL, NULL); ok(r == ERROR_DATATYPE_MISMATCH, "MsiSummaryInfoSetProperty wrong error\n"); r = MsiSummaryInfoSetProperty(hsuminfo, PID_TITLE, VT_I4, 0, NULL, "Mike"); ok(r == ERROR_DATATYPE_MISMATCH, "MsiSummaryInfoSetProperty wrong error\n"); r = MsiSummaryInfoSetProperty(hsuminfo, PID_AUTHOR, VT_I4, 0, NULL, "JungAh"); ok(r == ERROR_DATATYPE_MISMATCH, "MsiSummaryInfoSetProperty wrong error\n"); r = MsiSummaryInfoSetProperty(hsuminfo, PID_KEYWORDS, VT_I2, 0, NULL, "Mike"); ok(r == ERROR_DATATYPE_MISMATCH, "MsiSummaryInfoSetProperty wrong error\n"); r = MsiSummaryInfoSetProperty(hsuminfo, PID_COMMENTS, VT_FILETIME, 0, NULL, "JungAh"); ok(r == ERROR_DATATYPE_MISMATCH, "MsiSummaryInfoSetProperty wrong error\n"); r = MsiSummaryInfoSetProperty(hsuminfo, PID_TEMPLATE, VT_I2, 0, NULL, "Mike"); ok(r == ERROR_DATATYPE_MISMATCH, "MsiSummaryInfoSetProperty wrong error\n"); r = MsiSummaryInfoSetProperty(hsuminfo, PID_LASTAUTHOR, VT_LPSTR, 0, NULL, NULL); ok(r == ERROR_INVALID_PARAMETER, "MsiSummaryInfoSetProperty wrong error\n"); r = MsiSummaryInfoSetProperty(hsuminfo, PID_LASTSAVE_DTM, VT_FILETIME, 0, NULL, NULL); ok(r == ERROR_INVALID_PARAMETER, "MsiSummaryInfoSetProperty wrong error\n"); r = MsiSummaryInfoSetProperty(hsuminfo, PID_LASTAUTHOR, VT_LPWSTR, 0, NULL, "h\0i\0\0"); ok(r == ERROR_DATATYPE_MISMATCH, "MsiSummaryInfoSetProperty wrong error\n"); r = MsiSummaryInfoSetProperty(hsuminfo, PID_REVNUMBER, VT_I4, 0, NULL, "Jungah"); ok(r == ERROR_DATATYPE_MISMATCH, "MsiSummaryInfoSetProperty wrong error\n"); r = MsiSummaryInfoSetProperty(hsuminfo, PID_PAGECOUNT, VT_LPSTR, 1, NULL, NULL); ok(r == ERROR_DATATYPE_MISMATCH, "MsiSummaryInfoSetProperty wrong error\n"); r = MsiSummaryInfoSetProperty(hsuminfo, PID_TITLE, VT_LPSTR, 0, NULL, "Mike"); ok(r == ERROR_SUCCESS, "MsiSummaryInfoSetProperty failed\n"); sz = 2; strcpy(buf,"x"); r = MsiSummaryInfoGetProperty(hsuminfo, PID_TITLE, &type, NULL, NULL, buf, &sz ); ok(r == ERROR_MORE_DATA, "MsiSummaryInfoSetProperty failed\n"); ok(sz == 4, "count was wrong\n"); ok(type == VT_LPSTR, "type was wrong\n"); ok(!strcmp(buf,"M"), "buffer was wrong\n"); sz = 4; strcpy(buf,"x"); r = MsiSummaryInfoGetProperty(hsuminfo, PID_TITLE, &type, NULL, NULL, buf, &sz ); ok(r == ERROR_MORE_DATA, "MsiSummaryInfoSetProperty failed\n"); ok(sz == 4, "count was wrong\n"); ok(type == VT_LPSTR, "type was wrong\n"); ok(!strcmp(buf,"Mik"), "buffer was wrong\n"); r = MsiSummaryInfoSetProperty(hsuminfo, PID_TITLE, VT_LPSTR, 0, NULL, "JungAh"); ok(r == ERROR_SUCCESS, "MsiSummaryInfoSetProperty failed\n"); r = MsiSummaryInfoSetProperty(hsuminfo, PID_CODEPAGE, VT_I2, 1, &ft, "Mike"); ok(r == ERROR_FUNCTION_FAILED, "MsiSummaryInfoSetProperty wrong error\n"); r = MsiCloseHandle(hsuminfo); ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n"); /* try again with a higher update count */ r = MsiGetSummaryInformation(hdb, NULL, 10, &hsuminfo); ok(r == ERROR_SUCCESS, "MsiGetSummaryInformation failed\n"); r = MsiSummaryInfoSetProperty(hsuminfo, PID_TITLE, VT_LPSTR, 0, NULL, "JungAh"); ok(r == ERROR_SUCCESS, "MsiSummaryInfoSetProperty failed\n"); r = MsiSummaryInfoSetProperty(hsuminfo, PID_CODEPAGE, VT_LPSTR, 1, NULL, NULL); ok(r == ERROR_DATATYPE_MISMATCH, "MsiSummaryInfoSetProperty wrong error\n"); r = MsiSummaryInfoSetProperty(hsuminfo, PID_CODEPAGE, VT_I2, 1, NULL, NULL); ok(r == ERROR_SUCCESS, "MsiSummaryInfoSetProperty wrong error\n"); r = MsiSummaryInfoSetProperty(hsuminfo, PID_CODEPAGE, VT_I2, 1, &ft, "Mike"); ok(r == ERROR_SUCCESS, "MsiSummaryInfoSetProperty wrong error\n"); r = MsiSummaryInfoSetProperty(hsuminfo, PID_AUTHOR, VT_LPSTR, 1, &ft, "Mike"); ok(r == ERROR_SUCCESS, "MsiSummaryInfoSetProperty wrong error\n"); r = MsiSummaryInfoPersist(hsuminfo); ok(r == ERROR_SUCCESS, "MsiSummaryInfoPersist failed\n"); MsiDatabaseCommit(hdb); r = MsiCloseHandle(hsuminfo); ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n"); r = MsiCloseHandle(hdb); ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n"); r = DeleteFile(msifile); ok(r, "DeleteFile failed\n"); }