Commit 1505912c authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

msi: Allow setting NULL in MsiSetInteger().

parent f9f53fe6
...@@ -333,8 +333,17 @@ UINT MSI_RecordSetInteger( MSIRECORD *rec, UINT iField, int iVal ) ...@@ -333,8 +333,17 @@ UINT MSI_RecordSetInteger( MSIRECORD *rec, UINT iField, int iVal )
return ERROR_INVALID_PARAMETER; return ERROR_INVALID_PARAMETER;
MSI_FreeField( &rec->fields[iField] ); MSI_FreeField( &rec->fields[iField] );
rec->fields[iField].type = MSIFIELD_INT;
rec->fields[iField].u.iVal = iVal; if (iVal == MSI_NULL_INTEGER)
{
rec->fields[iField].type = MSIFIELD_NULL;
rec->fields[iField].u.szwVal = NULL;
}
else
{
rec->fields[iField].type = MSIFIELD_INT;
rec->fields[iField].u.iVal = iVal;
}
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
......
...@@ -162,6 +162,21 @@ static void test_msirecord(void) ...@@ -162,6 +162,21 @@ static void test_msirecord(void)
ok(bufW[0] == 0, "MsiRecordGetStringW returned the wrong string\n"); ok(bufW[0] == 0, "MsiRecordGetStringW returned the wrong string\n");
ok(sz == 0, "MsiRecordGetStringW returned the wrong length\n"); ok(sz == 0, "MsiRecordGetStringW returned the wrong length\n");
/* same record, but add a null integer to it */
r = MsiRecordSetInteger(h, 0, 1);
ok(r == ERROR_SUCCESS, "Failed to set integer at 0\n");
r = MsiRecordIsNull(h, 0);
ok(r == FALSE, "expected field to be non-null\n");
r = MsiRecordSetInteger(h, 0, MSI_NULL_INTEGER);
ok(r == ERROR_SUCCESS, "Failed to set integer at 0\n");
r = MsiRecordIsNull(h, 0);
ok(r == TRUE, "expected field to be null\n");
sz = sizeof buf;
r = MsiRecordGetStringA(h, 0, buf, &sz);
ok(r == ERROR_SUCCESS, "Failed to get string at 0\n");
ok(buf[0] == 0, "MsiRecordGetStringA returned the wrong string\n");
ok(sz == 0, "MsiRecordGetStringA returned the wrong length\n");
/* same record, but add a string to it */ /* same record, but add a string to it */
r = MsiRecordSetStringA(h,0,str); r = MsiRecordSetStringA(h,0,str);
ok(r == ERROR_SUCCESS, "Failed to set string at 0\n"); ok(r == ERROR_SUCCESS, "Failed to set string at 0\n");
...@@ -431,7 +446,7 @@ static void test_MsiRecordGetString(void) ...@@ -431,7 +446,7 @@ static void test_MsiRecordGetString(void)
r = MsiRecordGetStringA(rec, 1, buf, &sz); r = MsiRecordGetStringA(rec, 1, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "5"), "Expected \"5\", got \"%s\"\n", buf); ok(!lstrcmpA(buf, "5"), "Expected \"5\", got \"%s\"\n", buf);
ok(sz == 1, "Expectd 1, got %d\n", sz); ok(sz == 1, "Expected 1, got %d\n", sz);
r = MsiRecordSetInteger(rec, 1, -5); r = MsiRecordSetInteger(rec, 1, -5);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
...@@ -441,7 +456,7 @@ static void test_MsiRecordGetString(void) ...@@ -441,7 +456,7 @@ static void test_MsiRecordGetString(void)
r = MsiRecordGetStringA(rec, 1, buf, &sz); r = MsiRecordGetStringA(rec, 1, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "-5"), "Expected \"-5\", got \"%s\"\n", buf); ok(!lstrcmpA(buf, "-5"), "Expected \"-5\", got \"%s\"\n", buf);
ok(sz == 2, "Expectd 2, got %d\n", sz); ok(sz == 2, "Expected 2, got %d\n", sz);
MsiCloseHandle(rec); MsiCloseHandle(rec);
} }
......
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