diff --git a/dlls/msi/tests/record.c b/dlls/msi/tests/record.c index 2de43cb053f..5e64e247a02 100644 --- a/dlls/msi/tests/record.c +++ b/dlls/msi/tests/record.c @@ -25,6 +25,8 @@ #include "wine/test.h" static const char *msifile = "winetest-record.msi"; +static const WCHAR msifileW[] = + {'w','i','n','e','t','e','s','t','-','r','e','c','o','r','d','.','m','s','i',0}; static BOOL create_temp_file(char *name) { @@ -33,10 +35,10 @@ static BOOL create_temp_file(char *name) DWORD sz; HANDLE handle; - r = GetTempFileName(".", "msitest",0,name); + r = GetTempFileNameA(".", "msitest",0,name); if(!r) return r; - handle = CreateFile(name, GENERIC_READ|GENERIC_WRITE, + handle = CreateFileA(name, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if(handle==INVALID_HANDLE_VALUE) return 0; @@ -99,7 +101,7 @@ static void test_msirecord(void) ok(r==0, "size of null record is 0\n"); sz = sizeof buf; strcpy(buf,"x"); - r = MsiRecordGetString(h, 0, buf, &sz); + r = MsiRecordGetStringA(h, 0, buf, &sz); ok(r==ERROR_SUCCESS, "failed to get null string\n"); ok(sz==0, "null string too long\n"); ok(buf[0]==0, "null string not set\n"); @@ -123,7 +125,7 @@ static void test_msirecord(void) ok(r == 1, "failed to get integer\n"); /* same record, but add a null or empty string to it */ - r = MsiRecordSetString(h, 0, NULL); + r = MsiRecordSetStringA(h, 0, NULL); ok(r == ERROR_SUCCESS, "Failed to set null string at 0\n"); r = MsiRecordIsNull(h, 0); ok(r == TRUE, "null string not null field\n"); @@ -141,7 +143,7 @@ static void test_msirecord(void) ok(r == ERROR_SUCCESS, "Failed to get string at 0\n"); ok(bufW[0] == 0, "MsiRecordGetStringW returned the wrong string\n"); ok(sz == 0, "MsiRecordGetStringW returned the wrong length\n"); - r = MsiRecordSetString(h, 0, ""); + r = MsiRecordSetStringA(h, 0, ""); ok(r == ERROR_SUCCESS, "Failed to set empty string at 0\n"); r = MsiRecordIsNull(h, 0); ok(r == TRUE, "null string not null field\n"); @@ -161,7 +163,7 @@ static void test_msirecord(void) ok(sz == 0, "MsiRecordGetStringW returned the wrong length\n"); /* same record, but add a string to it */ - r = MsiRecordSetString(h,0,str); + r = MsiRecordSetStringA(h,0,str); ok(r == ERROR_SUCCESS, "Failed to set string at 0\n"); r = MsiRecordGetInteger(h, 0); ok(r == MSI_NULL_INTEGER, "should get invalid integer\n"); @@ -169,53 +171,53 @@ static void test_msirecord(void) ok(r==sizeof str-1, "size of string record is strlen\n"); buf[0]=0; sz = sizeof buf; - r = MsiRecordGetString(h,0,buf,&sz); + r = MsiRecordGetStringA(h,0,buf,&sz); ok(r == ERROR_SUCCESS, "Failed to get string at 0\n"); - ok(0==strcmp(buf,str), "MsiRecordGetString returned the wrong string\n"); - ok(sz == sizeof str-1, "MsiRecordGetString returned the wrong length\n"); + ok(0==strcmp(buf,str), "MsiRecordGetStringA returned the wrong string\n"); + ok(sz == sizeof str-1, "MsiRecordGetStringA returned the wrong length\n"); buf[0]=0; sz = sizeof str - 2; - r = MsiRecordGetString(h,0,buf,&sz); + r = MsiRecordGetStringA(h,0,buf,&sz); ok(r == ERROR_MORE_DATA, "small buffer should yield ERROR_MORE_DATA\n"); - ok(sz == sizeof str-1, "MsiRecordGetString returned the wrong length\n"); - ok(0==strncmp(buf,str,sizeof str-3), "MsiRecordGetString returned the wrong string\n"); + ok(sz == sizeof str-1, "MsiRecordGetStringA returned the wrong length\n"); + ok(0==strncmp(buf,str,sizeof str-3), "MsiRecordGetStringA returned the wrong string\n"); ok(buf[sizeof str - 3]==0, "string wasn't nul terminated\n"); buf[0]=0; sz = sizeof str; - r = MsiRecordGetString(h,0,buf,&sz); + r = MsiRecordGetStringA(h,0,buf,&sz); ok(r == ERROR_SUCCESS, "wrong error\n"); - ok(sz == sizeof str-1, "MsiRecordGetString returned the wrong length\n"); - ok(0==strcmp(buf,str), "MsiRecordGetString returned the wrong string\n"); + ok(sz == sizeof str-1, "MsiRecordGetStringA returned the wrong length\n"); + ok(0==strcmp(buf,str), "MsiRecordGetStringA returned the wrong string\n"); memset(bufW, 0, sizeof bufW); sz = 5; r = MsiRecordGetStringW(h,0,bufW,&sz); ok(r == ERROR_MORE_DATA, "wrong error\n"); - ok(sz == 5, "MsiRecordGetString returned the wrong length\n"); - ok(0==memcmp(bufW,strW,8), "MsiRecordGetString returned the wrong string\n"); + ok(sz == 5, "MsiRecordGetStringA returned the wrong length\n"); + ok(0==memcmp(bufW,strW,8), "MsiRecordGetStringA returned the wrong string\n"); sz = 0; bufW[0] = 'x'; r = MsiRecordGetStringW(h,0,bufW,&sz); ok(r == ERROR_MORE_DATA, "wrong error\n"); - ok(sz == 5, "MsiRecordGetString returned the wrong length\n"); - ok('x'==bufW[0], "MsiRecordGetString returned the wrong string\n"); + ok(sz == 5, "MsiRecordGetStringA returned the wrong length\n"); + ok('x'==bufW[0], "MsiRecordGetStringA returned the wrong string\n"); memset(buf, 0, sizeof buf); sz = 5; r = MsiRecordGetStringA(h,0,buf,&sz); ok(r == ERROR_MORE_DATA, "wrong error\n"); - ok(sz == 5, "MsiRecordGetString returned the wrong length\n"); - ok(0==memcmp(buf,str,4), "MsiRecordGetString returned the wrong string\n"); + ok(sz == 5, "MsiRecordGetStringA returned the wrong length\n"); + ok(0==memcmp(buf,str,4), "MsiRecordGetStringA returned the wrong string\n"); sz = 0; buf[0] = 'x'; r = MsiRecordGetStringA(h,0,buf,&sz); ok(r == ERROR_MORE_DATA, "wrong error\n"); - ok(sz == 5, "MsiRecordGetString returned the wrong length\n"); - ok('x'==buf[0], "MsiRecordGetString returned the wrong string\n"); + ok(sz == 5, "MsiRecordGetStringA returned the wrong length\n"); + ok('x'==buf[0], "MsiRecordGetStringA returned the wrong string\n"); /* same record, check we can wipe all the data */ r = MsiRecordClearData(h); @@ -226,55 +228,55 @@ static void test_msirecord(void) ok(r, "cleared record wasn't null\n"); /* same record, try converting strings to integers */ - i = MsiRecordSetString(h,0,"42"); + i = MsiRecordSetStringA(h,0,"42"); ok(i == ERROR_SUCCESS, "Failed to set string at 0\n"); i = MsiRecordGetInteger(h, 0); ok(i == 42, "should get invalid integer\n"); - i = MsiRecordSetString(h,0,"-42"); + i = MsiRecordSetStringA(h,0,"-42"); ok(i == ERROR_SUCCESS, "Failed to set string at 0\n"); i = MsiRecordGetInteger(h, 0); ok(i == -42, "should get invalid integer\n"); - i = MsiRecordSetString(h,0," 42"); + i = MsiRecordSetStringA(h,0," 42"); ok(i == ERROR_SUCCESS, "Failed to set string at 0\n"); i = MsiRecordGetInteger(h, 0); ok(i == MSI_NULL_INTEGER, "should get invalid integer\n"); - i = MsiRecordSetString(h,0,"42 "); + i = MsiRecordSetStringA(h,0,"42 "); ok(i == ERROR_SUCCESS, "Failed to set string at 0\n"); i = MsiRecordGetInteger(h, 0); ok(i == MSI_NULL_INTEGER, "should get invalid integer\n"); - i = MsiRecordSetString(h,0,"42.0"); + i = MsiRecordSetStringA(h,0,"42.0"); ok(i == ERROR_SUCCESS, "Failed to set string at 0\n"); i = MsiRecordGetInteger(h, 0); ok(i == MSI_NULL_INTEGER, "should get invalid integer\n"); - i = MsiRecordSetString(h,0,"0x42"); + i = MsiRecordSetStringA(h,0,"0x42"); ok(i == ERROR_SUCCESS, "Failed to set string at 0\n"); i = MsiRecordGetInteger(h, 0); ok(i == MSI_NULL_INTEGER, "should get invalid integer\n"); - i = MsiRecordSetString(h,0,"1000000000000000"); + i = MsiRecordSetStringA(h,0,"1000000000000000"); ok(i == ERROR_SUCCESS, "Failed to set string at 0\n"); i = MsiRecordGetInteger(h, 0); ok(i == -1530494976, "should get truncated integer\n"); - i = MsiRecordSetString(h,0,"2147483647"); + i = MsiRecordSetStringA(h,0,"2147483647"); ok(i == ERROR_SUCCESS, "Failed to set string at 0\n"); i = MsiRecordGetInteger(h, 0); ok(i == 2147483647, "should get maxint\n"); - i = MsiRecordSetString(h,0,"-2147483647"); + i = MsiRecordSetStringA(h,0,"-2147483647"); ok(i == ERROR_SUCCESS, "Failed to set string at 0\n"); i = MsiRecordGetInteger(h, 0); ok(i == -2147483647, "should get -maxint-1\n"); - i = MsiRecordSetString(h,0,"4294967297"); + i = MsiRecordSetStringA(h,0,"4294967297"); ok(i == ERROR_SUCCESS, "Failed to set string at 0\n"); i = MsiRecordGetInteger(h, 0); ok(i == 1, "should get one\n"); - i = MsiRecordSetString(h,0,"foo"); + i = MsiRecordSetStringA(h,0,"foo"); ok(i == ERROR_SUCCESS, "Failed to set string at 0\n"); i = MsiRecordGetInteger(h, 0); ok(i == MSI_NULL_INTEGER, "should get zero\n"); - i = MsiRecordSetString(h,0,""); + i = MsiRecordSetStringA(h,0,""); ok(i == ERROR_SUCCESS, "Failed to set string at 0\n"); i = MsiRecordGetInteger(h, 0); ok(i == MSI_NULL_INTEGER, "should get zero\n"); - i = MsiRecordSetString(h,0,"+1"); + i = MsiRecordSetStringA(h,0,"+1"); ok(i == ERROR_SUCCESS, "Failed to set string at 0\n"); i = MsiRecordGetInteger(h, 0); ok(i == MSI_NULL_INTEGER, "should get zero\n"); @@ -283,29 +285,29 @@ static void test_msirecord(void) r = MsiRecordSetInteger(h, 0, 32); ok(r == ERROR_SUCCESS, "Failed to set integer at 0 to 32\n"); sz = 1; - r = MsiRecordGetString(h, 0, NULL, &sz); + r = MsiRecordGetStringA(h, 0, NULL, &sz); ok(r == ERROR_SUCCESS, "failed to get string from integer\n"); ok(sz == 2, "length wrong\n"); buf[0]=0; sz = sizeof buf; - r = MsiRecordGetString(h, 0, buf, &sz); + r = MsiRecordGetStringA(h, 0, buf, &sz); ok(r == ERROR_SUCCESS, "failed to get string from integer\n"); ok(0==strcmp(buf,"32"), "failed to get string from integer\n"); r = MsiRecordSetInteger(h, 0, -32); ok(r == ERROR_SUCCESS, "Failed to set integer at 0 to 32\n"); buf[0]=0; sz = 1; - r = MsiRecordGetString(h, 0, NULL, &sz); + r = MsiRecordGetStringA(h, 0, NULL, &sz); ok(r == ERROR_SUCCESS, "failed to get string from integer\n"); ok(sz == 3, "length wrong\n"); sz = sizeof buf; - r = MsiRecordGetString(h, 0, buf, &sz); + r = MsiRecordGetStringA(h, 0, buf, &sz); ok(r == ERROR_SUCCESS, "failed to get string from integer\n"); ok(0==strcmp(buf,"-32"), "failed to get string from integer\n"); buf[0]=0; /* same record, now try streams */ - r = MsiRecordSetStream(h, 0, NULL); + r = MsiRecordSetStreamA(h, 0, NULL); ok(r == ERROR_INVALID_PARAMETER, "set NULL stream\n"); sz = sizeof buf; r = MsiRecordReadStream(h, 0, buf, &sz); @@ -328,13 +330,13 @@ static void test_msirecord(void) /* streams can't be inserted in field 0 for some reason */ h = MsiCreateRecord(2); ok(h, "couldn't create a two field record\n"); - r = MsiRecordSetStream(h, 0, filename); + r = MsiRecordSetStreamA(h, 0, filename); ok(r == ERROR_INVALID_PARAMETER, "added stream to field 0\n"); - r = MsiRecordSetStream(h, 1, filename); + r = MsiRecordSetStreamA(h, 1, filename); ok(r == ERROR_SUCCESS, "failed to add stream to record\n"); r = MsiRecordReadStream(h, 1, buf, NULL); ok(r == ERROR_INVALID_PARAMETER, "should return error\n"); - DeleteFile(filename); /* Windows 98 doesn't like this at all, so don't check return. */ + DeleteFileA(filename); /* Windows 98 doesn't like this at all, so don't check return. */ r = MsiRecordReadStream(h, 1, NULL, NULL); ok(r == ERROR_INVALID_PARAMETER, "should return error\n"); sz = sizeof buf; @@ -367,7 +369,7 @@ static void test_msirecord(void) ok(r == ERROR_SUCCESS, "failed to read stream\n"); ok(sz==0,"size non-zero at end of stream\n"); ok(buf[0]==0, "read something at end of the stream\n"); - r = MsiRecordSetStream(h, 1, NULL); + r = MsiRecordSetStreamA(h, 1, NULL); ok(r == ERROR_SUCCESS, "failed to reset stream\n"); sz = 0; r = MsiRecordReadStream(h, 1, NULL, &sz); @@ -379,7 +381,7 @@ static void test_msirecord(void) /* now close the stream record */ r = MsiCloseHandle(h); ok(r == ERROR_SUCCESS, "Failed to close handle\n"); - DeleteFile(filename); /* Delete it for sure, when everything else is closed. */ + DeleteFileA(filename); /* Delete it for sure, when everything else is closed. */ } static void test_MsiRecordGetString(void) @@ -393,20 +395,20 @@ static void test_MsiRecordGetString(void) ok(rec != 0, "Expected a valid handle\n"); sz = MAX_PATH; - r = MsiRecordGetString(rec, 1, NULL, &sz); + r = MsiRecordGetStringA(rec, 1, NULL, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n",r); ok(sz == 0, "Expected 0, got %d\n",sz); sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = MsiRecordGetString(rec, 1, buf, &sz); + r = MsiRecordGetStringA(rec, 1, buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf); ok(sz == 0, "Expected 0, got %d\n", sz); sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = MsiRecordGetString(rec, 10, buf, &sz); + r = MsiRecordGetStringA(rec, 10, buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf); ok(sz == 0, "Expected 0, got %d\n", sz); @@ -420,13 +422,13 @@ static void test_MsiRecordGetString(void) ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); sz = MAX_PATH; - r = MsiRecordGetString(rec, 1, NULL, &sz); + r = MsiRecordGetStringA(rec, 1, NULL, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n",r); ok(sz == 1, "Expected 1, got %d\n",sz); sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = MsiRecordGetString(rec, 1, buf, &sz); + r = MsiRecordGetStringA(rec, 1, buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "5"), "Expected \"5\", got \"%s\"\n", buf); ok(sz == 1, "Expectd 1, got %d\n", sz); @@ -436,7 +438,7 @@ static void test_MsiRecordGetString(void) sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = MsiRecordGetString(rec, 1, buf, &sz); + r = MsiRecordGetStringA(rec, 1, buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "-5"), "Expected \"-5\", got \"%s\"\n", buf); ok(sz == 2, "Expectd 2, got %d\n", sz); @@ -453,19 +455,19 @@ static void test_MsiRecordGetInteger(void) rec = MsiCreateRecord(1); ok(rec != 0, "Expected a valid handle\n"); - r = MsiRecordSetString(rec, 1, "5"); + r = MsiRecordSetStringA(rec, 1, "5"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); val = MsiRecordGetInteger(rec, 1); ok(val == 5, "Expected 5, got %d\n", val); - r = MsiRecordSetString(rec, 1, "-5"); + r = MsiRecordSetStringA(rec, 1, "-5"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); val = MsiRecordGetInteger(rec, 1); ok(val == -5, "Expected -5, got %d\n", val); - r = MsiRecordSetString(rec, 1, "5apple"); + r = MsiRecordSetStringA(rec, 1, "5apple"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); val = MsiRecordGetInteger(rec, 1); @@ -490,7 +492,7 @@ static void test_fieldzero(void) sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = MsiRecordGetString(rec, 0, buf, &sz); + r = MsiRecordGetStringA(rec, 0, buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf); ok(sz == 0, "Expectd 0, got %d\n", sz); @@ -509,7 +511,7 @@ static void test_fieldzero(void) sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = MsiRecordGetString(rec, 0, buf, &sz); + r = MsiRecordGetStringA(rec, 0, buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf); ok(sz == 0, "Expectd 0, got %d\n", sz); @@ -520,7 +522,7 @@ static void test_fieldzero(void) r = MsiRecordGetInteger(rec, 1); ok(r == 42, "Expected 42, got %d\n", r); - r = MsiRecordSetString(rec, 1, "bologna"); + r = MsiRecordSetStringA(rec, 1, "bologna"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); r = MsiRecordGetInteger(rec, 0); @@ -528,7 +530,7 @@ static void test_fieldzero(void) sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = MsiRecordGetString(rec, 0, buf, &sz); + r = MsiRecordGetStringA(rec, 0, buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf); ok(sz == 0, "Expectd 0, got %d\n", sz); @@ -538,20 +540,20 @@ static void test_fieldzero(void) sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = MsiRecordGetString(rec, 1, buf, &sz); + r = MsiRecordGetStringA(rec, 1, buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "bologna"), "Expected \"bologna\", got \"%s\"\n", buf); ok(sz == 7, "Expectd 7, got %d\n", sz); MsiCloseHandle(rec); - r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb); + r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATE, &hdb); ok(r == ERROR_SUCCESS, "MsiOpenDatabase failed\n"); query = "CREATE TABLE `drone` ( " "`id` INT, `name` CHAR(32), `number` CHAR(32) " "PRIMARY KEY `id`)"; - r = MsiDatabaseOpenView(hdb, query, &hview); + r = MsiDatabaseOpenViewA(hdb, query, &hview); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); r = MsiViewExecute(hview, 0); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); @@ -562,7 +564,7 @@ static void test_fieldzero(void) query = "INSERT INTO `drone` ( `id`, `name`, `number` )" "VALUES('1', 'Abe', '8675309')"; - r = MsiDatabaseOpenView(hdb, query, &hview); + r = MsiDatabaseOpenViewA(hdb, query, &hview); ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n"); r = MsiViewExecute(hview, 0); ok(r == ERROR_SUCCESS, "MsiViewExecute failed\n"); @@ -579,7 +581,7 @@ static void test_fieldzero(void) sz = MAX_PATH; lstrcpyA(buf, "apple"); - r = MsiRecordGetString(rec, 0, buf, &sz); + r = MsiRecordGetStringA(rec, 0, buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(!lstrcmpA(buf, "drone"), "Expected \"drone\", got \"%s\"\n", buf); ok(sz == 5, "Expectd 5, got %d\n", sz); @@ -593,7 +595,7 @@ static void test_fieldzero(void) ok(r == ERROR_INVALID_TABLE, "Expected ERROR_INVALID_TABLE, got %d\n", r); query = "SELECT * FROM `drone` WHERE `id` = 1"; - r = MsiDatabaseOpenView(hdb, query, &hview); + r = MsiDatabaseOpenViewA(hdb, query, &hview); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); r = MsiViewExecute(hview, 0); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);