Autosyncing with Wine HEAD

svn path=/trunk/; revision=32862
This commit is contained in:
The Wine Synchronizer 2008-04-04 16:43:16 +00:00
parent b6f11d466c
commit bd382346bb
71 changed files with 11394 additions and 1029 deletions

View file

@ -35,6 +35,7 @@
#define REG_VAL_EXISTS(key, value) !RegQueryValueEx(key, value, NULL, NULL, NULL, NULL)
#define OPEN_GUID_KEY() !RegOpenKey(HKEY_LOCAL_MACHINE, GUID_KEY, &guid)
static HMODULE hAdvPack;
static HRESULT (WINAPI *pCloseINFEngine)(HINF);
static HRESULT (WINAPI *pDelNode)(LPCSTR,DWORD);
static HRESULT (WINAPI *pGetVersionFromFile)(LPCSTR,LPDWORD,LPDWORD,BOOL);
@ -66,7 +67,7 @@ static void get_progfiles_dir(void)
static BOOL init_function_pointers(void)
{
HMODULE hAdvPack = LoadLibraryA("advpack.dll");
hAdvPack = LoadLibraryA("advpack.dll");
if (!hAdvPack)
return FALSE;
@ -521,7 +522,7 @@ static void setperusersecvalues_test(void)
/* set initial values */
lstrcpy(peruser.szGUID, "guid");
hr = pSetPerUserSecValues(&peruser);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(OPEN_GUID_KEY(), "Expected guid key to exist\n");
ok(check_reg_str(guid, NULL, "displayname"), "Expected displayname\n");
ok(check_reg_str(guid, "ComponentID", "compid"), "Expected compid\n");
@ -538,7 +539,7 @@ static void setperusersecvalues_test(void)
/* raise the version, but bRollback is FALSE, so vals not saved */
lstrcpy(peruser.szVersion, "2,1,1,1");
hr = pSetPerUserSecValues(&peruser);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(check_reg_str(guid, NULL, "displayname"), "Expected displayname\n");
ok(check_reg_str(guid, "ComponentID", "compid"), "Expected compid\n");
ok(check_reg_str(guid, "Locale", "locale"), "Expected locale\n");
@ -555,7 +556,7 @@ static void setperusersecvalues_test(void)
peruser.bRollback = TRUE;
lstrcpy(peruser.szVersion, "3,1,1,1");
hr = pSetPerUserSecValues(&peruser);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(check_reg_str(guid, NULL, "displayname"), "Expected displayname\n");
ok(check_reg_str(guid, "ComponentID", "compid"), "Expected compid\n");
ok(check_reg_str(guid, "Locale", "locale"), "Expected locale\n");
@ -594,4 +595,6 @@ START_TEST(advpack)
setperusersecvalues_test();
translateinfstring_test();
translateinfstringex_test();
FreeLibrary(hAdvPack);
}

View file

@ -1,17 +1,18 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<group>
<module name="advpack_winetest" type="win32cui" installbase="bin" installname="advpack_winetest.exe" allowwarnings="true" entrypoint="0">
<include base="advpack_winetest">.</include>
<define name="WINVER">0x600</define>
<define name="_WIN32_WINNT">0x600</define>
<library>wine</library>
<library>cabinet</library>
<library>user32</library>
<library>advapi32</library>
<library>kernel32</library>
<library>ntdll</library>
<file>advpack.c</file>
<file>files.c</file>
<file>install.c</file>
<file>testlist.c</file>
<library>wine</library>
<library>cabinet</library>
<library>advapi32</library>
<library>kernel32</library>
<library>ntdll</library>
</module>
</group>

View file

@ -560,4 +560,6 @@ START_TEST(files)
test_AdvInstallFile();
delete_test_files();
FreeLibrary(hAdvPack);
}

View file

@ -23,6 +23,7 @@
#include <advpub.h>
#include "wine/test.h"
static HMODULE hAdvPack;
/* function pointers */
static HRESULT (WINAPI *pRunSetupCommand)(HWND, LPCSTR, LPCSTR, LPCSTR, LPCSTR, HANDLE*, DWORD, LPVOID);
static HRESULT (WINAPI *pLaunchINFSection)(HWND, HINSTANCE, LPSTR, INT);
@ -32,7 +33,7 @@ static char CURR_DIR[MAX_PATH];
static BOOL init_function_pointers(void)
{
HMODULE hAdvPack = LoadLibraryA("advpack.dll");
hAdvPack = LoadLibraryA("advpack.dll");
if (!hAdvPack)
return FALSE;
@ -273,4 +274,6 @@ START_TEST(install)
test_RunSetupCommand();
test_LaunchINFSection();
test_LaunchINFSectionEx();
FreeLibrary(hAdvPack);
}

View file

@ -1,15 +1,16 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<group>
<module name="cabinet_winetest" type="win32cui" installbase="bin" installname="cabinet_winetest.exe" allowwarnings="true" entrypoint="0">
<include base="cabinet_winetest">.</include>
<define name="WINVER">0x600</define>
<define name="_WIN32_WINNT">0x600</define>
<library>wine</library>
<library>cabinet</library>
<library>user32</library>
<library>kernel32</library>
<library>ntdll</library>
<file>extract.c</file>
<file>fdi.c</file>
<file>testlist.c</file>
<library>wine</library>
<library>cabinet</library>
<library>kernel32</library>
<library>ntdll</library>
</module>
</group>

View file

@ -28,7 +28,7 @@
#define MEDIA_SIZE 999999999
#define FOLDER_THRESHOLD 900000
/* The following defintions were copied from dlls/cabinet/cabinet.h
/* The following definitions were copied from dlls/cabinet/cabinet.h
* because they are undocumented in windows.
*/

View file

@ -92,10 +92,6 @@ static void test_FDICreate(void)
HFDI hfdi;
ERF erf;
erf.erfOper = 0xcafefeed;
erf.erfType = 0xdeadbabe;
erf.fError = 0xdecaface;
/* native crashes if pfnalloc is NULL */
/* FDICreate does not crash with a NULL pfnfree,
@ -104,6 +100,9 @@ static void test_FDICreate(void)
if (0)
{
SetLastError(0xdeadbeef);
erf.erfOper = 0xcafefeed;
erf.erfType = 0xdeadbabe;
erf.fError = 0xdecaface;
hfdi = FDICreate(fdi_alloc, NULL, fdi_open, fdi_read,
fdi_write, fdi_close, fdi_seek,
cpuUNKNOWN, &erf);
@ -118,99 +117,121 @@ static void test_FDICreate(void)
}
SetLastError(0xdeadbeef);
erf.erfOper = 0xcafefeed;
erf.erfType = 0xdeadbabe;
erf.fError = 0xdecaface;
hfdi = FDICreate(fdi_alloc, fdi_free, NULL, fdi_read,
fdi_write, fdi_close, fdi_seek,
cpuUNKNOWN, &erf);
ok(hfdi != NULL, "Expected non-NULL context\n");
ok(GetLastError() == 0xdeadbeef,
"Expected 0xdeadbeef, got %d\n", GetLastError());
ok(erf.erfOper == 0xcafefeed, "Expected 0xcafefeed, got %d\n", erf.erfOper);
ok(erf.erfType == 0xdeadbabe, "Expected 0xdeadbabe, got %d\n", erf.erfType);
ok(erf.fError == 0xdecaface, "Expected 0xdecaface, got %d\n", erf.fError);
ok((erf.erfOper == 0xcafefeed || erf.erfOper == 0 /* Vista */), "Expected 0xcafefeed or 0, got %d\n", erf.erfOper);
ok((erf.erfType == 0xdeadbabe || erf.erfType == 0 /* Vista */), "Expected 0xdeadbabe or 0, got %d\n", erf.erfType);
ok((erf.fError == 0xdecaface || erf.fError == 0 /* Vista */), "Expected 0xdecaface or 0, got %d\n", erf.fError);
FDIDestroy(hfdi);
SetLastError(0xdeadbeef);
erf.erfOper = 0xcafefeed;
erf.erfType = 0xdeadbabe;
erf.fError = 0xdecaface;
hfdi = FDICreate(fdi_alloc, fdi_free, fdi_open, NULL,
fdi_write, fdi_close, fdi_seek,
cpuUNKNOWN, &erf);
ok(hfdi != NULL, "Expected non-NULL context\n");
ok(GetLastError() == 0xdeadbeef,
"Expected 0xdeadbeef, got %d\n", GetLastError());
ok(erf.erfOper == 0xcafefeed, "Expected 0xcafefeed, got %d\n", erf.erfOper);
ok(erf.erfType == 0xdeadbabe, "Expected 0xdeadbabe, got %d\n", erf.erfType);
ok(erf.fError == 0xdecaface, "Expected 0xdecaface, got %d\n", erf.fError);
ok((erf.erfOper == 0xcafefeed || erf.erfOper == 0 /* Vista */), "Expected 0xcafefeed or 0, got %d\n", erf.erfOper);
ok((erf.erfType == 0xdeadbabe || erf.erfType == 0 /* Vista */), "Expected 0xdeadbabe or 0, got %d\n", erf.erfType);
ok((erf.fError == 0xdecaface || erf.fError == 0 /* Vista */), "Expected 0xdecaface or 0, got %d\n", erf.fError);
FDIDestroy(hfdi);
SetLastError(0xdeadbeef);
erf.erfOper = 0xcafefeed;
erf.erfType = 0xdeadbabe;
erf.fError = 0xdecaface;
hfdi = FDICreate(fdi_alloc, fdi_free, fdi_open, fdi_read,
NULL, fdi_close, fdi_seek,
cpuUNKNOWN, &erf);
ok(hfdi != NULL, "Expected non-NULL context\n");
ok(GetLastError() == 0xdeadbeef,
"Expected 0xdeadbeef, got %d\n", GetLastError());
ok(erf.erfOper == 0xcafefeed, "Expected 0xcafefeed, got %d\n", erf.erfOper);
ok(erf.erfType == 0xdeadbabe, "Expected 0xdeadbabe, got %d\n", erf.erfType);
ok(erf.fError == 0xdecaface, "Expected 0xdecaface, got %d\n", erf.fError);
ok((erf.erfOper == 0xcafefeed || erf.erfOper == 0 /* Vista */), "Expected 0xcafefeed or 0, got %d\n", erf.erfOper);
ok((erf.erfType == 0xdeadbabe || erf.erfType == 0 /* Vista */), "Expected 0xdeadbabe or 0, got %d\n", erf.erfType);
ok((erf.fError == 0xdecaface || erf.fError == 0 /* Vista */), "Expected 0xdecaface or 0, got %d\n", erf.fError);
FDIDestroy(hfdi);
SetLastError(0xdeadbeef);
erf.erfOper = 0xcafefeed;
erf.erfType = 0xdeadbabe;
erf.fError = 0xdecaface;
hfdi = FDICreate(fdi_alloc, fdi_free, fdi_open, fdi_read,
fdi_write, NULL, fdi_seek,
cpuUNKNOWN, &erf);
ok(hfdi != NULL, "Expected non-NULL context\n");
ok(GetLastError() == 0xdeadbeef,
"Expected 0xdeadbeef, got %d\n", GetLastError());
ok(erf.erfOper == 0xcafefeed, "Expected 0xcafefeed, got %d\n", erf.erfOper);
ok(erf.erfType == 0xdeadbabe, "Expected 0xdeadbabe, got %d\n", erf.erfType);
ok(erf.fError == 0xdecaface, "Expected 0xdecaface, got %d\n", erf.fError);
ok((erf.erfOper == 0xcafefeed || erf.erfOper == 0 /* Vista */), "Expected 0xcafefeed or 0, got %d\n", erf.erfOper);
ok((erf.erfType == 0xdeadbabe || erf.erfType == 0 /* Vista */), "Expected 0xdeadbabe or 0, got %d\n", erf.erfType);
ok((erf.fError == 0xdecaface || erf.fError == 0 /* Vista */), "Expected 0xdecaface or 0, got %d\n", erf.fError);
FDIDestroy(hfdi);
SetLastError(0xdeadbeef);
erf.erfOper = 0xcafefeed;
erf.erfType = 0xdeadbabe;
erf.fError = 0xdecaface;
hfdi = FDICreate(fdi_alloc, fdi_free, fdi_open, fdi_read,
fdi_write, fdi_close, NULL,
cpuUNKNOWN, &erf);
ok(hfdi != NULL, "Expected non-NULL context\n");
ok(GetLastError() == 0xdeadbeef,
"Expected 0xdeadbeef, got %d\n", GetLastError());
ok(erf.erfOper == 0xcafefeed, "Expected 0xcafefeed, got %d\n", erf.erfOper);
ok(erf.erfType == 0xdeadbabe, "Expected 0xdeadbabe, got %d\n", erf.erfType);
ok(erf.fError == 0xdecaface, "Expected 0xdecaface, got %d\n", erf.fError);
ok((erf.erfOper == 0xcafefeed || erf.erfOper == 0 /* Vista */), "Expected 0xcafefeed or 0, got %d\n", erf.erfOper);
ok((erf.erfType == 0xdeadbabe || erf.erfType == 0 /* Vista */), "Expected 0xdeadbabe or 0, got %d\n", erf.erfType);
ok((erf.fError == 0xdecaface || erf.fError == 0 /* Vista */), "Expected 0xdecaface or 0, got %d\n", erf.fError);
FDIDestroy(hfdi);
SetLastError(0xdeadbeef);
erf.erfOper = 0xcafefeed;
erf.erfType = 0xdeadbabe;
erf.fError = 0xdecaface;
hfdi = FDICreate(fdi_alloc, fdi_free, fdi_open, fdi_read,
fdi_write, fdi_close, fdi_seek,
cpuUNKNOWN, NULL);
ok(hfdi != NULL, "Expected non-NULL context\n");
/* XP sets hfdi to a non-NULL value, but Vista sets it to NULL! */
ok(GetLastError() == 0xdeadbeef,
"Expected 0xdeadbeef, got %d\n", GetLastError());
ok(erf.erfOper == 0xcafefeed, "Expected 0xcafefeed, got %d\n", erf.erfOper);
ok(erf.erfType == 0xdeadbabe, "Expected 0xdeadbabe, got %d\n", erf.erfType);
ok(erf.fError == 0xdecaface, "Expected 0xdecaface, got %d\n", erf.fError);
/* NULL is passed to FDICreate instead of &erf, so don't retest the erf member values. */
FDIDestroy(hfdi);
/* bad cpu type */
SetLastError(0xdeadbeef);
erf.erfOper = 0xcafefeed;
erf.erfType = 0xdeadbabe;
erf.fError = 0xdecaface;
hfdi = FDICreate(fdi_alloc, fdi_free, fdi_open, fdi_read,
fdi_write, fdi_close, fdi_seek,
0xcafebabe, &erf);
ok(hfdi != NULL, "Expected non-NULL context\n");
ok(GetLastError() == 0xdeadbeef,
"Expected 0xdeadbeef, got %d\n", GetLastError());
ok(erf.erfOper == 0xcafefeed, "Expected 0xcafefeed, got %d\n", erf.erfOper);
ok(erf.erfType == 0xdeadbabe, "Expected 0xdeadbabe, got %d\n", erf.erfType);
ok(erf.fError == 0xdecaface, "Expected 0xdecaface, got %d\n", erf.fError);
ok((erf.erfOper == 0xcafefeed || erf.erfOper == 0 /* Vista */), "Expected 0xcafefeed or 0, got %d\n", erf.erfOper);
ok((erf.erfType == 0xdeadbabe || erf.erfType == 0 /* Vista */), "Expected 0xdeadbabe or 0, got %d\n", erf.erfType);
ok((erf.fError == 0xdecaface || erf.fError == 0 /* Vista */), "Expected 0xdecaface or 0, got %d\n", erf.fError);
FDIDestroy(hfdi);
/* pfnalloc fails */
SetLastError(0xdeadbeef);
erf.erfOper = 0xcafefeed;
erf.erfType = 0xdeadbabe;
erf.fError = 0xdecaface;
hfdi = FDICreate(fdi_alloc_bad, fdi_free, fdi_open, fdi_read,
fdi_write, fdi_close, fdi_seek,
cpuUNKNOWN, &erf);

View file

@ -1,15 +1,17 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<group>
<module name="comcat_winetest" type="win32cui" installbase="bin" installname="comcat_winetest.exe" allowwarnings="true" entrypoint="0">
<include base="comcat_winetest">.</include>
<define name="WINVER">0x600</define>
<define name="_WIN32_WINNT">0x600</define>
<file>comcat.c</file>
<file>testlist.c</file>
<library>wine</library>
<library>ole32</library>
<library>advapi32</library>
<library>kernel32</library>
<library>uuid</library>
<library>ntdll</library>
<file>comcat.c</file>
<file>testlist.c</file>
</module>
</group>

View file

@ -187,10 +187,23 @@ static LRESULT CALLBACK ComboExTestWndProc(HWND hWnd, UINT msg, WPARAM wParam, L
return 0L;
}
static void init(void) {
static int init(void)
{
HMODULE hComctl32;
BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
WNDCLASSA wc;
INITCOMMONCONTROLSEX iccex;
InitCommonControls();
hComctl32 = GetModuleHandleA("comctl32.dll");
pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
if (!pInitCommonControlsEx)
{
skip("InitCommonControlsEx() is missing. Skipping the tests\n");
return 0;
}
iccex.dwSize = sizeof(iccex);
iccex.dwICC = ICC_USEREX_CLASSES;
pInitCommonControlsEx(&iccex);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.cbClsExtra = 0;
@ -209,7 +222,7 @@ static void init(void) {
assert(hComboExParentWnd != NULL);
hMainHinst = GetModuleHandleA(NULL);
return 1;
}
static void cleanup(void)
@ -227,7 +240,8 @@ static void cleanup(void)
START_TEST(comboex)
{
init();
if (!init())
return;
test_comboboxex();

View file

@ -5,14 +5,6 @@
<include base="comctl32_winetest">.</include>
<define name="WINVER">0x600</define>
<define name="_WIN32_WINNT">0x600</define>
<library>wine</library>
<library>comctl32</library>
<library>ole32</library>
<library>user32</library>
<library>gdi32</library>
<library>advapi32</library>
<library>kernel32</library>
<library>ntdll</library>
<file>comboex.c</file>
<file>datetime.c</file>
<file>dpa.c</file>
@ -36,5 +28,13 @@
<file>updown.c</file>
<file>rsrc.rc</file>
<file>testlist.c</file>
<library>wine</library>
<library>comctl32</library>
<library>ole32</library>
<library>user32</library>
<library>gdi32</library>
<library>advapi32</library>
<library>kernel32</library>
<library>ntdll</library>
</module>
</group>

View file

@ -112,6 +112,7 @@ static const struct message test_dtm_set_range_swap_min_max_seq[] = {
static const struct message test_dtm_set_and_get_system_time_seq[] = {
{ DTM_SETSYSTEMTIME, sent|wparam, 0x00000001 },
{ 0x0090, sent|optional }, /* Vista */
{ WM_DESTROY, sent|wparam|lparam, 0x00000000, 0x00000000 },
{ WM_NCDESTROY, sent|wparam|lparam, 0x00000000, 0x00000000 },
{ DTM_SETSYSTEMTIME, sent|wparam, 0x00000001 },
@ -125,6 +126,7 @@ static const struct message test_dtm_set_and_get_system_time_seq[] = {
};
static const struct message destroy_window_seq[] = {
{ 0x0090, sent|optional }, /* Vista */
{ WM_DESTROY, sent|wparam|lparam, 0x00000000, 0x00000000 },
{ WM_NCDESTROY, sent|wparam|lparam, 0x00000000, 0x00000000 },
{ 0 }
@ -191,6 +193,8 @@ static HWND create_datetime_control(DWORD style, DWORD exstyle)
static void test_dtm_set_format(HWND hWndDateTime)
{
CHAR txt[256];
SYSTEMTIME systime;
LRESULT r;
r = SendMessage(hWndDateTime, DTM_SETFORMAT, 0, (LPARAM)NULL);
@ -201,6 +205,17 @@ static void test_dtm_set_format(HWND hWndDateTime)
expect(1, r);
ok_sequence(sequences, DATETIME_SEQ_INDEX, test_dtm_set_format_seq, "test_dtm_set_format", FALSE);
r = SendMessage(hWndDateTime, DTM_SETFORMAT, 0,
(LPARAM)"'hh' hh");
expect(1, r);
ZeroMemory(&systime, sizeof(systime));
systime.wYear = 2000;
systime.wMonth = systime.wDay = 1;
r = SendMessage(hWndDateTime, DTM_SETSYSTEMTIME, 0, (LPARAM)&systime);
expect(1, r);
GetWindowText(hWndDateTime, txt, 256);
todo_wine ok(strcmp(txt, "hh 12") == 0, "String mismatch (\"%s\" vs \"hh 12\")\n", txt);
flush_sequences(sequences, NUM_MSG_SEQUENCES);
}
@ -311,7 +326,7 @@ static void test_dtm_set_and_get_range(HWND hWndDateTime)
/* initialize st[0] to lowest possible value */
fill_systime_struct(&st[0], 1601, 1, 0, 1, 0, 0, 0, 0);
/* intialize st[1] to all invalid numbers */
/* initialize st[1] to all invalid numbers */
fill_systime_struct(&st[1], 0, 0, 7, 0, 24, 60, 60, 1000);
r = SendMessage(hWndDateTime, DTM_SETRANGE, GDTR_MIN, (LPARAM)st);
@ -560,7 +575,21 @@ static void test_datetime_control(void)
START_TEST(datetime)
{
InitCommonControls();
HMODULE hComctl32;
BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
INITCOMMONCONTROLSEX iccex;
hComctl32 = GetModuleHandleA("comctl32.dll");
pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
if (!pInitCommonControlsEx)
{
skip("InitCommonControlsEx() is missing. Skipping the tests\n");
return;
}
iccex.dwSize = sizeof(iccex);
iccex.dwICC = ICC_DATE_CLASSES;
pInitCommonControlsEx(&iccex);
init_msg_sequences(sequences, NUM_MSG_SEQUENCES);
test_datetime_control();

View file

@ -219,7 +219,7 @@ static void test_dpa(void)
/* Set item with out of bound index */
ok(pDPA_SetPtr(dpa, 1, (PVOID)6), "\n");
/* Fill the greated gap */
/* Fill the created gap */
ok(pDPA_SetPtr(dpa, 0, (PVOID)5), "\n");
rc=CheckDPA(dpa, 0x56, &dw);
ok(rc, "dw=0x%x\n", dw);
@ -454,6 +454,4 @@ START_TEST(dpa)
test_dpa();
else
trace("skipping tests\n");
FreeLibrary(hcomctl32);
}

View file

@ -1156,7 +1156,7 @@ static void test_hdm_index_messages(HWND hParent)
ok_sequence(sequences, HEADER_SEQ_INDEX, orderArray_seq, "set_get_orderArray sequence testing", FALSE);
/* check if the array order is set correctly and the size of the array is corret. */
/* check if the array order is set correctly and the size of the array is correct. */
expect(2, iSize);
expect(lpiarray[0], lpiarrayReceived[0]);
expect(lpiarray[1], lpiarrayReceived[1]);
@ -1480,10 +1480,24 @@ static LRESULT CALLBACK HeaderTestWndProc(HWND hWnd, UINT msg, WPARAM wParam, LP
return 0L;
}
static void init(void) {
static int init(void)
{
HMODULE hComctl32;
BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
WNDCLASSA wc;
INITCOMMONCONTROLSEX iccex;
InitCommonControls();
hComctl32 = GetModuleHandleA("comctl32.dll");
pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
if (!pInitCommonControlsEx)
{
skip("InitCommonControlsEx() is missing. Skipping the tests\n");
return 0;
}
iccex.dwSize = sizeof(iccex);
iccex.dwICC = ICC_USEREX_CLASSES;
pInitCommonControlsEx(&iccex);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.cbClsExtra = 0;
@ -1503,13 +1517,15 @@ static void init(void) {
NULL, NULL, GetModuleHandleA(NULL), 0);
assert(hHeaderParentWnd != NULL);
ShowWindow(hHeaderParentWnd, SW_SHOW);
return 1;
}
START_TEST(header)
{
HWND parent_hwnd;
init();
if (!init())
return;
test_header_control();
test_header_order();

View file

@ -539,6 +539,44 @@ static void test_checkboxes(void)
r = SendMessage(hwnd, LVM_GETITEMA, 0, (LPARAM) &item);
ok(item.state == 0x1aaa, "state %x\n", item.state);
/* Toggle checkbox tests (bug 9934) */
memset (&item, 0xcc, sizeof(item));
item.mask = LVIF_STATE;
item.iItem = 3;
item.iSubItem = 0;
item.state = LVIS_FOCUSED;
item.stateMask = LVIS_FOCUSED;
r = SendMessage(hwnd, LVM_SETITEM, 0, (LPARAM) &item);
expect(1, r);
item.iItem = 3;
item.mask = LVIF_STATE;
item.stateMask = 0xffff;
r = SendMessage(hwnd, LVM_GETITEMA, 0, (LPARAM) &item);
ok(item.state == 0x1aab, "state %x\n", item.state);
r = SendMessage(hwnd, WM_KEYDOWN, VK_SPACE, 0);
expect(0, r);
r = SendMessage(hwnd, WM_KEYUP, VK_SPACE, 0);
expect(0, r);
item.iItem = 3;
item.mask = LVIF_STATE;
item.stateMask = 0xffff;
r = SendMessage(hwnd, LVM_GETITEMA, 0, (LPARAM) &item);
ok(item.state == 0x2aab, "state %x\n", item.state);
r = SendMessage(hwnd, WM_KEYDOWN, VK_SPACE, 0);
expect(0, r);
r = SendMessage(hwnd, WM_KEYUP, VK_SPACE, 0);
expect(0, r);
item.iItem = 3;
item.mask = LVIF_STATE;
item.stateMask = 0xffff;
r = SendMessage(hwnd, LVM_GETITEMA, 0, (LPARAM) &item);
ok(item.state == 0x1aab, "state %x\n", item.state);
DestroyWindow(hwnd);
}
@ -547,7 +585,7 @@ static void insert_column(HWND hwnd, int idx)
LVCOLUMN column;
DWORD rc;
memset(&column, 0xaa, sizeof(column));
memset(&column, 0xcc, sizeof(column));
column.mask = LVCF_SUBITEM;
column.iSubItem = idx;
@ -562,7 +600,7 @@ static void insert_item(HWND hwnd, int idx)
LVITEMA item;
DWORD rc;
memset(&item, 0xaa, sizeof (item));
memset(&item, 0xcc, sizeof (item));
item.mask = LVIF_TEXT;
item.iItem = idx;
item.iSubItem = 0;
@ -593,7 +631,7 @@ static void test_items(void)
insert_column(hwnd, 1);
/* Insert an item with just a param */
memset (&item, 0xaa, sizeof (item));
memset (&item, 0xcc, sizeof (item));
item.mask = LVIF_PARAM;
item.iItem = 0;
item.iSubItem = 0;
@ -602,7 +640,7 @@ static void test_items(void)
ok(r == 0, "ret %d\n", r);
/* Test getting of the param */
memset (&item, 0xaa, sizeof (item));
memset (&item, 0xcc, sizeof (item));
item.mask = LVIF_PARAM;
item.iItem = 0;
item.iSubItem = 0;
@ -611,7 +649,7 @@ static void test_items(void)
ok(item.lParam == lparamTest, "got lParam %lx, expected %lx\n", item.lParam, lparamTest);
/* Set up a subitem */
memset (&item, 0xaa, sizeof (item));
memset (&item, 0xcc, sizeof (item));
item.mask = LVIF_TEXT;
item.iItem = 0;
item.iSubItem = 1;
@ -620,7 +658,7 @@ static void test_items(void)
ok(r != 0, "ret %d\n", r);
/* Query param from subitem: returns main item param */
memset (&item, 0xaa, sizeof (item));
memset (&item, 0xcc, sizeof (item));
item.mask = LVIF_PARAM;
item.iItem = 0;
item.iSubItem = 1;
@ -629,7 +667,7 @@ static void test_items(void)
ok(item.lParam == lparamTest, "got lParam %lx, expected %lx\n", item.lParam, lparamTest);
/* Set up param on first subitem: no effect */
memset (&item, 0xaa, sizeof (item));
memset (&item, 0xcc, sizeof (item));
item.mask = LVIF_PARAM;
item.iItem = 0;
item.iSubItem = 1;
@ -638,7 +676,7 @@ static void test_items(void)
ok(r == 0, "ret %d\n", r);
/* Query param from subitem again: should still return main item param */
memset (&item, 0xaa, sizeof (item));
memset (&item, 0xcc, sizeof (item));
item.mask = LVIF_PARAM;
item.iItem = 0;
item.iSubItem = 1;
@ -647,7 +685,7 @@ static void test_items(void)
ok(item.lParam == lparamTest, "got lParam %lx, expected %lx\n", item.lParam, lparamTest);
/**** Some tests of state highlighting ****/
memset (&item, 0xaa, sizeof (item));
memset (&item, 0xcc, sizeof (item));
item.mask = LVIF_STATE;
item.iItem = 0;
item.iSubItem = 0;
@ -660,7 +698,7 @@ static void test_items(void)
r = SendMessage(hwnd, LVM_SETITEM, 0, (LPARAM) &item);
ok(r != 0, "ret %d\n", r);
memset (&item, 0xaa, sizeof (item));
memset (&item, 0xcc, sizeof (item));
item.mask = LVIF_STATE;
item.iItem = 0;
item.iSubItem = 0;
@ -687,7 +725,7 @@ static void test_columns(void)
ok(hwnd != NULL, "failed to create listview window\n");
/* Add a column with no mask */
memset(&column, 0xaa, sizeof(column));
memset(&column, 0xcc, sizeof(column));
column.mask = 0;
rc = ListView_InsertColumn(hwnd, 0, &column);
ok(rc==0, "Inserting column with no mask failed with %d\n", rc);
@ -1040,6 +1078,19 @@ static void test_item_position(void)
START_TEST(listview)
{
HMODULE hComctl32;
BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
hComctl32 = GetModuleHandleA("comctl32.dll");
pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
if (pInitCommonControlsEx)
{
INITCOMMONCONTROLSEX iccex;
iccex.dwSize = sizeof(iccex);
iccex.dwICC = ICC_LISTVIEW_CLASSES;
pInitCommonControlsEx(&iccex);
}
else
InitCommonControls();
init_msg_sequences(sequences, NUM_MSG_SEQUENCES);

View file

@ -281,6 +281,7 @@ static const struct message destroy_monthcal_parent_msgs_seq[] = {
/* expected message sequence for child*/
static const struct message destroy_monthcal_child_msgs_seq[] = {
{ 0x0090, sent|optional }, /* Vista */
{ WM_SHOWWINDOW, sent|wparam|lparam, 0, 0},
{ WM_WINDOWPOSCHANGING, sent|wparam, 0},
{ WM_WINDOWPOSCHANGED, sent|wparam, 0},
@ -290,6 +291,7 @@ static const struct message destroy_monthcal_child_msgs_seq[] = {
};
static const struct message destroy_monthcal_multi_sel_style_seq[] = {
{ 0x0090, sent|optional }, /* Vista */
{ WM_DESTROY, sent|wparam|lparam, 0, 0},
{ WM_NCDESTROY, sent|wparam|lparam, 0, 0},
{ 0 }
@ -297,6 +299,7 @@ static const struct message destroy_monthcal_multi_sel_style_seq[] = {
/* expected message sequence for parent window*/
static const struct message destroy_parent_seq[] = {
{ 0x0090, sent|optional }, /* Vista */
{ WM_WINDOWPOSCHANGING, sent|wparam, 0},
{ WM_WINDOWPOSCHANGED, sent|wparam, 0},
{ WM_NCACTIVATE, sent|wparam|lparam, 0, 0},
@ -316,7 +319,6 @@ static void test_monthcal(void)
SYSTEMTIME st[2], st1[2];
int res, month_range;
InitCommonControls();
hwnd = CreateWindowA(MONTHCAL_CLASSA, "MonthCal", WS_POPUP | WS_VISIBLE, CW_USEDEFAULT,
0, 300, 300, 0, 0, NULL, NULL);
ok(hwnd != NULL, "Failed to create MonthCal\n");
@ -479,8 +481,6 @@ static HWND create_monthcal_control(DWORD style, HWND parent_window)
struct subclass_info *info;
HWND hwnd;
InitCommonControls();
info = HeapAlloc(GetProcessHeap(), 0, sizeof(struct subclass_info));
if (!info)
return NULL;
@ -720,7 +720,7 @@ static void test_monthcal_unicode(HWND hwnd)
static void test_monthcal_HitTest(HWND hwnd)
{
MCHITTESTINFO mchit;
int res;
UINT res;
SYSTEMTIME st;
memset(&mchit, 0, sizeof(MCHITTESTINFO));
@ -912,7 +912,7 @@ static void test_monthcal_todaylink(HWND hwnd)
MCHITTESTINFO mchit;
SYSTEMTIME st_test, st_new;
BOOL error = FALSE;
int res;
UINT res;
memset(&mchit, 0, sizeof(MCHITTESTINFO));
@ -1110,7 +1110,22 @@ static void test_monthcal_MaxSelDay(HWND hwnd)
START_TEST(monthcal)
{
HMODULE hComctl32;
BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
INITCOMMONCONTROLSEX iccex;
HWND hwnd, parent_wnd;
hComctl32 = GetModuleHandleA("comctl32.dll");
pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
if (!pInitCommonControlsEx)
{
skip("InitCommonControlsEx() is missing. Skipping the tests\n");
return;
}
iccex.dwSize = sizeof(iccex);
iccex.dwICC = ICC_DATE_CLASSES;
pInitCommonControlsEx(&iccex);
test_monthcal();
init_msg_sequences(sequences, NUM_MSG_SEQUENCES);

View file

@ -90,9 +90,21 @@ static void update_window(HWND hWnd)
static void init(void)
{
HMODULE hComctl32;
BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
WNDCLASSA wc;
RECT rect;
hComctl32 = GetModuleHandleA("comctl32.dll");
pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
if (pInitCommonControlsEx)
{
INITCOMMONCONTROLSEX iccex;
iccex.dwSize = sizeof(iccex);
iccex.dwICC = ICC_PROGRESS_CLASS;
pInitCommonControlsEx(&iccex);
}
else
InitCommonControls();
wc.style = CS_HREDRAW | CS_VREDRAW;

View file

@ -17,6 +17,10 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
/* make sure the structures work with a comctl32 v5.x */
#define _WIN32_WINNT 0x500
#define _WIN32_IE 0x500
#include <assert.h>
#include <stdarg.h>
@ -252,6 +256,21 @@ rbsize_result_t rbsize_results[] = {
{ {328, 0, 511, 20}, 0x00, 183}, { {511, 0, 672, 20}, 0x00, 161},
{ { 0, 20, 672, 40}, 0x00, 200},
}, },
{ {0, 0, 672, 56}, 56, 2, {28, 28, }, 5, {
{ { 0, 0, 114, 28}, 0x00, 40}, { {114, 0, 328, 28}, 0x00, 214},
{ {328, 0, 511, 28}, 0x00, 183}, { {511, 0, 672, 28}, 0x00, 161},
{ { 0, 28, 672, 56}, 0x00, 200},
}, },
{ {0, 0, 672, 40}, 40, 2, {20, 20, }, 5, {
{ { 0, 0, 114, 20}, 0x00, 40}, { {114, 0, 328, 20}, 0x00, 214},
{ {328, 0, 511, 20}, 0x00, 183}, { {511, 0, 672, 20}, 0x00, 161},
{ { 0, 20, 672, 40}, 0x00, 200},
}, },
{ {0, 0, 672, 56}, 56, 2, {28, 28, }, 5, {
{ { 0, 0, 114, 28}, 0x00, 40}, { {114, 0, 328, 28}, 0x00, 214},
{ {328, 0, 511, 28}, 0x00, 183}, { {511, 0, 672, 28}, 0x00, 161},
{ { 0, 28, 672, 56}, 0x00, 200},
}, },
{ {0, 0, 672, 0}, 0, 0, {0, }, 0, {{{0, 0, 0, 0}, 0, 0},
}, },
{ {0, 0, 672, 65}, 65, 1, {65, }, 3, {
@ -329,6 +348,8 @@ static void layout_test(void)
{
HWND hRebar = NULL;
REBARBANDINFO rbi;
HIMAGELIST himl;
REBARINFO ri;
rebuild_rebar(&hRebar);
check_sizes();
@ -406,6 +427,27 @@ static void layout_test(void)
SendMessageA(hRebar, RB_MINIMIZEBAND, 0, 0);
check_sizes();
/* an image will increase the band height */
himl = ImageList_LoadImage(LoadLibrary("comctl32"), MAKEINTRESOURCE(121), 24, 2, CLR_NONE, IMAGE_BITMAP, LR_DEFAULTCOLOR);
ri.cbSize = sizeof(ri);
ri.fMask = RBIM_IMAGELIST;
ri.himl = himl;
ok(SendMessage(hRebar, RB_SETBARINFO, 0, (LPARAM)&ri), "RB_SETBARINFO failed\n");
rbi.fMask = RBBIM_IMAGE;
rbi.iImage = 1;
SendMessage(hRebar, RB_SETBANDINFO, 1, (LPARAM)&rbi);
check_sizes();
/* after removing it everything is back to normal*/
rbi.iImage = -1;
SendMessage(hRebar, RB_SETBANDINFO, 1, (LPARAM)&rbi);
check_sizes();
/* Only -1 means that the image is not present. Other invalid values increase the height */
rbi.iImage = -2;
SendMessage(hRebar, RB_SETBANDINFO, 1, (LPARAM)&rbi);
check_sizes();
/* VARHEIGHT resizing test on a horizontal rebar */
rebuild_rebar(&hRebar);
SetWindowLong(hRebar, GWL_STYLE, GetWindowLong(hRebar, GWL_STYLE) | RBS_AUTOSIZE);
@ -786,11 +828,24 @@ static void bandinfo_test(void)
START_TEST(rebar)
{
HMODULE hComctl32;
BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
INITCOMMONCONTROLSEX iccex;
WNDCLASSA wc;
MSG msg;
RECT rc;
InitCommonControls();
/* LoadLibrary is needed. This file has no references to functions in comctl32 */
hComctl32 = LoadLibraryA("comctl32.dll");
pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
if (!pInitCommonControlsEx)
{
skip("InitCommonControlsEx() is missing. Skipping the tests\n");
return;
}
iccex.dwSize = sizeof(iccex);
iccex.dwICC = ICC_COOL_CLASSES;
pInitCommonControlsEx(&iccex);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.cbClsExtra = 0;
@ -825,4 +880,6 @@ START_TEST(rebar)
DispatchMessageA(&msg);
}
DestroyWindow(hMainWnd);
FreeLibrary(hComctl32);
}

View file

@ -40,6 +40,8 @@ static BOOL g_fExpectedHotItemOld;
static BOOL g_fExpectedHotItemNew;
static DWORD g_dwExpectedDispInfoMask;
#define expect(EXPECTED,GOT) ok((GOT)==(EXPECTED), "Expected %d, got %d\n", (EXPECTED), (GOT))
#define check_rect(name, val, exp) ok(val.top == exp.top && val.bottom == exp.bottom && \
val.left == exp.left && val.right == exp.right, "invalid rect (" name ") (%d,%d) (%d,%d) - expected (%d,%d) (%d,%d)\n", \
val.left, val.top, val.right, val.bottom, exp.left, exp.top, exp.right, exp.bottom);
@ -1088,6 +1090,38 @@ static void test_setrows(void)
DestroyWindow(hToolbar);
}
static void test_getstring(void)
{
HWND hToolbar = NULL;
char str[10];
WCHAR strW[10];
static const char answer[] = "STR";
static const WCHAR answerW[] = { 'S','T','R',0 };
INT r;
hToolbar = CreateWindowExA(0, TOOLBARCLASSNAME, NULL, WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, hMainWnd, (HMENU)5, GetModuleHandle(NULL), NULL);
ok(hToolbar != NULL, "Toolbar creation problem\n");
r = SendMessage(hToolbar, TB_GETSTRING, MAKEWPARAM(0, 0), (LPARAM)NULL);
expect(-1, r);
r = SendMessage(hToolbar, TB_GETSTRINGW, MAKEWPARAM(0, 0), (LPARAM)NULL);
expect(-1, r);
r = SendMessage(hToolbar, TB_ADDSTRING, 0, (LPARAM)answer);
expect(0, r);
r = SendMessage(hToolbar, TB_GETSTRING, MAKEWPARAM(0, 0), (LPARAM)NULL);
expect(lstrlenA(answer), r);
r = SendMessage(hToolbar, TB_GETSTRINGW, MAKEWPARAM(0, 0), (LPARAM)NULL);
expect(lstrlenA(answer), r);
r = SendMessage(hToolbar, TB_GETSTRING, MAKEWPARAM(sizeof(str), 0), (LPARAM)str);
expect(lstrlenA(answer), r);
expect(0, lstrcmp(answer, str));
r = SendMessage(hToolbar, TB_GETSTRINGW, MAKEWPARAM(sizeof(strW), 0), (LPARAM)strW);
expect(lstrlenA(answer), r);
expect(0, lstrcmpW(answerW, strW));
DestroyWindow(hToolbar);
}
START_TEST(toolbar)
{
WNDCLASSA wc;
@ -1122,6 +1156,7 @@ START_TEST(toolbar)
test_createtoolbarex();
test_dispinfo();
test_setrows();
test_getstring();
PostQuitMessage(0);
while(GetMessageA(&msg,0,0,0)) {

View file

@ -1,5 +1,6 @@
/*
* Copyright 2005 Dmitry Timoshkov
* Copyright 2008 Jason Edmeades
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -60,9 +61,181 @@ static void test_create_tooltip(void)
DestroyWindow(parent);
}
/* try to make sure pending X events have been processed before continuing */
static void flush_events(int waitTime)
{
MSG msg;
int diff = waitTime;
DWORD time = GetTickCount() + waitTime;
while (diff > 0)
{
if (MsgWaitForMultipleObjects( 0, NULL, FALSE, min(100,diff), QS_ALLEVENTS) == WAIT_TIMEOUT) break;
while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessage( &msg );
diff = time - GetTickCount();
}
}
static int CD_Stages;
static LRESULT CD_Result;
static HWND g_hwnd;
#define TEST_CDDS_PREPAINT 0x00000001
#define TEST_CDDS_POSTPAINT 0x00000002
#define TEST_CDDS_PREERASE 0x00000004
#define TEST_CDDS_POSTERASE 0x00000008
#define TEST_CDDS_ITEMPREPAINT 0x00000010
#define TEST_CDDS_ITEMPOSTPAINT 0x00000020
#define TEST_CDDS_ITEMPREERASE 0x00000040
#define TEST_CDDS_ITEMPOSTERASE 0x00000080
#define TEST_CDDS_SUBITEM 0x00000100
static LRESULT CALLBACK CustomDrawWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg) {
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_NOTIFY:
if (((NMHDR *)lParam)->code == NM_CUSTOMDRAW) {
NMTTCUSTOMDRAW *ttcd = (NMTTCUSTOMDRAW*) lParam;
ok(ttcd->nmcd.hdr.hwndFrom == g_hwnd, "Unexpected hwnd source %x (%x)\n",
(int)ttcd->nmcd.hdr.hwndFrom, (int) g_hwnd);
ok(ttcd->nmcd.hdr.idFrom == 0x1234ABCD, "Unexpected id %x\n", (int)ttcd->nmcd.hdr.idFrom);
switch (ttcd->nmcd.dwDrawStage) {
case CDDS_PREPAINT : CD_Stages |= TEST_CDDS_PREPAINT; break;
case CDDS_POSTPAINT : CD_Stages |= TEST_CDDS_POSTPAINT; break;
case CDDS_PREERASE : CD_Stages |= TEST_CDDS_PREERASE; break;
case CDDS_POSTERASE : CD_Stages |= TEST_CDDS_POSTERASE; break;
case CDDS_ITEMPREPAINT : CD_Stages |= TEST_CDDS_ITEMPREPAINT; break;
case CDDS_ITEMPOSTPAINT: CD_Stages |= TEST_CDDS_ITEMPOSTPAINT; break;
case CDDS_ITEMPREERASE : CD_Stages |= TEST_CDDS_ITEMPREERASE; break;
case CDDS_ITEMPOSTERASE: CD_Stages |= TEST_CDDS_ITEMPOSTERASE; break;
case CDDS_SUBITEM : CD_Stages |= TEST_CDDS_SUBITEM; break;
default: CD_Stages = -1;
}
if (ttcd->nmcd.dwDrawStage == CDDS_PREPAINT) return CD_Result;
}
/* drop through */
default:
return DefWindowProcA(hWnd, msg, wParam, lParam);
}
return 0L;
}
static void test_customdraw(void) {
static struct {
LRESULT FirstReturnValue;
int ExpectedCalls;
} expectedResults[] = {
/* Valid notification responses */
{CDRF_DODEFAULT, TEST_CDDS_PREPAINT},
{CDRF_SKIPDEFAULT, TEST_CDDS_PREPAINT},
{CDRF_NOTIFYPOSTPAINT, TEST_CDDS_PREPAINT | TEST_CDDS_POSTPAINT},
/* Invalid notification responses */
{CDRF_NOTIFYITEMDRAW, TEST_CDDS_PREPAINT},
{CDRF_NOTIFYPOSTERASE, TEST_CDDS_PREPAINT},
{CDRF_NOTIFYSUBITEMDRAW, TEST_CDDS_PREPAINT},
{CDRF_NEWFONT, TEST_CDDS_PREPAINT}
};
int iterationNumber;
WNDCLASSA wc;
LRESULT lResult;
/* Create a class to use the custom draw wndproc */
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = GetModuleHandleA(NULL);
wc.hIcon = NULL;
wc.hCursor = LoadCursorA(NULL, IDC_ARROW);
wc.hbrBackground = GetSysColorBrush(COLOR_WINDOW);
wc.lpszMenuName = NULL;
wc.lpszClassName = "CustomDrawClass";
wc.lpfnWndProc = CustomDrawWndProc;
RegisterClass(&wc);
for (iterationNumber = 0;
iterationNumber < sizeof(expectedResults)/sizeof(expectedResults[0]);
iterationNumber++) {
HWND parent, hwndTip;
TOOLINFO toolInfo = { 0 };
/* Create a main window */
parent = CreateWindowEx(0, "CustomDrawClass", NULL,
WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX |
WS_MAXIMIZEBOX | WS_VISIBLE,
50, 50,
300, 300,
NULL, NULL, NULL, 0);
ok(parent != NULL, "Creation of main window failed\n");
/* Make it show */
ShowWindow(parent, SW_SHOWNORMAL);
flush_events(100);
/* Create Tooltip */
hwndTip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS,
NULL, TTS_NOPREFIX | TTS_ALWAYSTIP,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
parent, NULL, GetModuleHandleA(NULL), 0);
ok(hwndTip != NULL, "Creation of tooltip window failed\n");
/* Set up parms for the wndproc to handle */
CD_Stages = 0;
CD_Result = expectedResults[iterationNumber].FirstReturnValue;
g_hwnd = hwndTip;
/* Make it topmost, as per the MSDN */
SetWindowPos(hwndTip, HWND_TOPMOST, 0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
/* Create a tool */
toolInfo.cbSize = sizeof(TOOLINFO);
toolInfo.hwnd = parent;
toolInfo.hinst = GetModuleHandleA(NULL);
toolInfo.uFlags = TTF_SUBCLASS;
toolInfo.uId = (UINT_PTR)0x1234ABCD;
toolInfo.lpszText = (LPSTR)"This is a test tooltip";
toolInfo.lParam = 0xdeadbeef;
GetClientRect (parent, &toolInfo.rect);
lResult = SendMessage(hwndTip, TTM_ADDTOOL, 0, (LPARAM)&toolInfo);
ok(lResult, "Adding the tool to the tooltip failed\n");
/* Make tooltip appear quickly */
SendMessage(hwndTip, TTM_SETDELAYTIME, (WPARAM)TTDT_INITIAL, (LPARAM)MAKELONG(1,0));
/* Put cursor inside window, tooltip will appear immediately */
SetCursorPos(100, 100);
flush_events(200);
/* Check CustomDraw results */
ok(CD_Stages == expectedResults[iterationNumber].ExpectedCalls,
"CustomDraw run %d stages %x, expected %x\n", iterationNumber, CD_Stages,
expectedResults[iterationNumber].ExpectedCalls);
/* Clean up */
DestroyWindow(hwndTip);
DestroyWindow(parent);
}
}
START_TEST(tooltips)
{
InitCommonControls();
test_create_tooltip();
test_customdraw();
}

View file

@ -649,10 +649,23 @@ static LRESULT CALLBACK MyWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa
START_TEST(treeview)
{
HMODULE hComctl32;
BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
WNDCLASSA wc;
MSG msg;
hComctl32 = GetModuleHandleA("comctl32.dll");
pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
if (pInitCommonControlsEx)
{
INITCOMMONCONTROLSEX iccex;
iccex.dwSize = sizeof(iccex);
iccex.dwICC = ICC_TREEVIEW_CLASSES;
pInitCommonControlsEx(&iccex);
}
else
InitCommonControls();
init_msg_sequences(MsgSequences, NUM_MSG_SEQUENCES);
wc.style = CS_HREDRAW | CS_VREDRAW;

View file

@ -1,15 +1,17 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<group>
<module name="comdlg32_winetest" type="win32cui" installbase="bin" installname="comdlg32_winetest.exe" allowwarnings="true" entrypoint="0">
<include base="comdlg32_winetest">.</include>
<define name="WINVER">0x600</define>
<define name="_WIN32_WINNT">0x600</define>
<file>filedlg.c</file>
<file>printdlg.c</file>
<file>testlist.c</file>
<library>wine</library>
<library>comdlg32</library>
<library>user32</library>
<library>kernel32</library>
<library>ntdll</library>
<file>filedlg.c</file>
<file>printdlg.c</file>
<file>testlist.c</file>
</module>
</group>

View file

@ -26,6 +26,7 @@
#include "winerror.h"
#include "wingdi.h"
#include "winuser.h"
#include "objbase.h"
#include "cderr.h"
#include "commdlg.h"

View file

@ -31,6 +31,9 @@
<directory name="icmp">
<xi:include href="icmp/icmp.rbuild" />
</directory>
<directory name="imm32">
<xi:include href="imm32/imm32.rbuild" />
</directory>
<directory name="kernel32">
<xi:include href="kernel32/kernel32.rbuild" />
</directory>
@ -73,6 +76,9 @@
<directory name="riched20">
<xi:include href="riched20/riched20.rbuild" />
</directory>
<directory name="riched32">
<xi:include href="riched32/riched32.rbuild" />
</directory>
<directory name="rpcrt4">
<xi:include href="rpcrt4/rpcrt4.rbuild" />
</directory>

View file

@ -2,7 +2,7 @@
* Implementation of hyperlinking (hlink.dll)
*
* Copyright 2006 Mike McCormack
* Copyright 2007 Jacek Caban for CodeWeavers
* Copyright 2007-2008 Jacek Caban for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -28,6 +28,34 @@
#include "wine/test.h"
#define DEFINE_EXPECT(func) \
static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
#define SET_EXPECT(func) \
expect_ ## func = TRUE
#define CHECK_EXPECT2(func) \
do { \
ok(expect_ ##func, "unexpected call " #func "\n"); \
called_ ## func = TRUE; \
}while(0)
#define CHECK_EXPECT(func) \
do { \
CHECK_EXPECT2(func); \
expect_ ## func = FALSE; \
}while(0)
#define CHECK_CALLED(func) \
do { \
ok(called_ ## func, "expected " #func "\n"); \
expect_ ## func = called_ ## func = FALSE; \
}while(0)
DEFINE_EXPECT(IsSystemMoniker);
DEFINE_EXPECT(BindToStorage);
DEFINE_EXPECT(GetDisplayName);
static const char *debugstr_w(LPCWSTR str)
{
static char buf[1024];
@ -37,6 +65,18 @@ static const char *debugstr_w(LPCWSTR str)
return buf;
}
static const char *debugstr_guid(REFIID riid)
{
static char buf[50];
sprintf(buf, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
riid->Data1, riid->Data2, riid->Data3, riid->Data4[0],
riid->Data4[1], riid->Data4[2], riid->Data4[3], riid->Data4[4],
riid->Data4[5], riid->Data4[6], riid->Data4[7]);
return buf;
}
static void test_HlinkIsShortcut(void)
{
int i;
@ -292,7 +332,11 @@ static void test_persist(void)
hr = HlinkCreateFromString(url, NULL, NULL, NULL,
0, NULL, &IID_IHlink, (LPVOID*) &lnk);
ok(hr == S_OK, "IHlinCreateFromString failed with error 0x%08x\n", hr);
ok(hr == S_OK, "IHlinkCreateFromString failed with error 0x%08x\n", hr);
if (!lnk) {
skip("Can't create lnk, skipping test_persist. Was wineprefixcreate run properly?\n");
return;
}
test_persist_save_data("url only", lnk, expected_hlink_data, sizeof(expected_hlink_data));
IHlink_Release(lnk);
@ -444,6 +488,422 @@ static void test_HlinkCreateExtensionServices(void)
IAuthenticate_Release(authenticate);
}
static void test_HlinkParseDisplayName(void)
{
IMoniker *mon = NULL;
LPWSTR name;
DWORD issys;
ULONG eaten = 0;
IBindCtx *bctx;
HRESULT hres;
static const WCHAR winehq_urlW[] =
{'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g',
'/','s','i','t','e','/','a','b','o','u','t',0};
static const WCHAR invalid_urlW[] = {'t','e','s','t',':','1','2','3','a','b','c',0};
static const WCHAR clsid_nameW[] = {'c','l','s','i','d',':',
'2','0','D','0','4','F','E','0','-','3','A','E','A','-','1','0','6','9','-','A','2','D','8',
'-','0','8','0','0','2','B','3','0','3','0','9','D',':',0};
CreateBindCtx(0, &bctx);
hres = HlinkParseDisplayName(bctx, winehq_urlW, FALSE, &eaten, &mon);
ok(hres == S_OK, "HlinkParseDisplayName failed: %08x\n", hres);
ok(eaten == sizeof(winehq_urlW)/sizeof(WCHAR)-1, "eaten=%d\n", eaten);
ok(mon != NULL, "mon == NULL\n");
hres = IMoniker_GetDisplayName(mon, bctx, 0, &name);
ok(hres == S_OK, "GetDiasplayName failed: %08x\n", hres);
ok(!lstrcmpW(name, winehq_urlW), "wrong display name %s\n", debugstr_w(name));
CoTaskMemFree(name);
hres = IMoniker_IsSystemMoniker(mon, &issys);
ok(hres == S_OK, "IsSystemMoniker failed: %08x\n", hres);
ok(issys == MKSYS_URLMONIKER, "issys=%x\n", issys);
IMoniker_Release(mon);
hres = HlinkParseDisplayName(bctx, clsid_nameW, FALSE, &eaten, &mon);
ok(hres == S_OK, "HlinkParseDisplayName failed: %08x\n", hres);
ok(eaten == sizeof(clsid_nameW)/sizeof(WCHAR)-1, "eaten=%d\n", eaten);
ok(mon != NULL, "mon == NULL\n");
hres = IMoniker_IsSystemMoniker(mon, &issys);
ok(hres == S_OK, "IsSystemMoniker failed: %08x\n", hres);
ok(issys == MKSYS_CLASSMONIKER, "issys=%x\n", issys);
IMoniker_Release(mon);
hres = HlinkParseDisplayName(bctx, invalid_urlW, FALSE, &eaten, &mon);
ok(hres == S_OK, "HlinkParseDisplayName failed: %08x\n", hres);
ok(eaten == sizeof(invalid_urlW)/sizeof(WCHAR)-1, "eaten=%d\n", eaten);
ok(mon != NULL, "mon == NULL\n");
hres = IMoniker_GetDisplayName(mon, bctx, 0, &name);
ok(hres == S_OK, "GetDiasplayName failed: %08x\n", hres);
ok(!lstrcmpW(name, invalid_urlW), "wrong display name %s\n", debugstr_w(name));
CoTaskMemFree(name);
hres = IMoniker_IsSystemMoniker(mon, &issys);
ok(hres == S_OK, "IsSystemMoniker failed: %08x\n", hres);
ok(issys == MKSYS_FILEMONIKER, "issys=%x\n", issys);
IBindCtx_Release(bctx);
}
static IBindCtx *_bctx;
static HRESULT WINAPI ServiceProvider_QueryInterface(IServiceProvider *iface, REFIID riid, void **ppv)
{
ok(0, "unexpected call\n");
return E_NOINTERFACE;
}
static ULONG WINAPI ServiceProvider_AddRef(IServiceProvider *iface)
{
return 2;
}
static ULONG WINAPI ServiceProvider_Release(IServiceProvider *iface)
{
return 1;
}
static HRESULT WINAPI ServiceProvider_QueryService(IServiceProvider *iface,
REFGUID guidService, REFIID riid, void **ppv)
{
ok(0, "unexpected service %s\n", debugstr_guid(guidService));
return E_NOINTERFACE;
}
static IServiceProviderVtbl ServiceProviderVtbl = {
ServiceProvider_QueryInterface,
ServiceProvider_AddRef,
ServiceProvider_Release,
ServiceProvider_QueryService
};
static IServiceProvider ServiceProvider = { &ServiceProviderVtbl };
static HRESULT WINAPI BindStatusCallback_QueryInterface(IBindStatusCallback *iface, REFIID riid, void **ppv)
{
*ppv = NULL;
if(IsEqualGUID(riid, &IID_IServiceProvider)) {
*ppv = &ServiceProvider;
return S_OK;
}
ok(0, "unexpected interface %s\n", debugstr_guid(riid));
return E_NOINTERFACE;
}
static ULONG WINAPI BindStatusCallback_AddRef(IBindStatusCallback *iface)
{
return 2;
}
static ULONG WINAPI BindStatusCallback_Release(IBindStatusCallback *iface)
{
return 1;
}
static HRESULT WINAPI BindStatusCallback_OnStartBinding(IBindStatusCallback *iface, DWORD dwReserved,
IBinding *pib)
{
ok(0, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI BindStatusCallback_GetPriority(IBindStatusCallback *iface, LONG *pnPriority)
{
ok(0, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI BindStatusCallback_OnLowResource(IBindStatusCallback *iface, DWORD reserved)
{
ok(0, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI BindStatusCallback_OnProgress(IBindStatusCallback *iface, ULONG ulProgress,
ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText)
{
ok(0, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI BindStatusCallback_OnStopBinding(IBindStatusCallback *iface, HRESULT hresult, LPCWSTR szError)
{
ok(0, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI BindStatusCallback_GetBindInfo(IBindStatusCallback *iface, DWORD *grfBINDF, BINDINFO *pbindinfo)
{
ok(0, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI BindStatusCallback_OnDataAvailable(IBindStatusCallback *iface, DWORD grfBSCF,
DWORD dwSize, FORMATETC* pformatetc, STGMEDIUM* pstgmed)
{
ok(0, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI BindStatusCallback_OnObjectAvailable(IBindStatusCallback *iface, REFIID riid, IUnknown *punk)
{
ok(0, "unexpected call\n");
return E_NOTIMPL;
}
static IBindStatusCallbackVtbl BindStatusCallbackVtbl = {
BindStatusCallback_QueryInterface,
BindStatusCallback_AddRef,
BindStatusCallback_Release,
BindStatusCallback_OnStartBinding,
BindStatusCallback_GetPriority,
BindStatusCallback_OnLowResource,
BindStatusCallback_OnProgress,
BindStatusCallback_OnStopBinding,
BindStatusCallback_GetBindInfo,
BindStatusCallback_OnDataAvailable,
BindStatusCallback_OnObjectAvailable
};
static IBindStatusCallback BindStatusCallback = { &BindStatusCallbackVtbl };
static HRESULT WINAPI Moniker_QueryInterface(IMoniker *iface, REFIID riid, void **ppv)
{
*ppv = NULL;
ok(0, "unexpected riid: %s\n", debugstr_guid(riid));
return E_NOINTERFACE;
}
static ULONG WINAPI Moniker_AddRef(IMoniker *iface)
{
return 2;
}
static ULONG WINAPI Moniker_Release(IMoniker *iface)
{
return 1;
}
static HRESULT WINAPI Moniker_GetClassID(IMoniker *iface, CLSID *pClassID)
{
ok(0, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI Moniker_IsDirty(IMoniker *iface)
{
ok(0, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI Moniker_Load(IMoniker *iface, IStream *pStm)
{
ok(0, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI Moniker_Save(IMoniker *iface, IStream *pStm, BOOL fClearDirty)
{
ok(0, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI Moniker_GetSizeMax(IMoniker *iface, ULARGE_INTEGER *pcbSize)
{
ok(0, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI Moniker_BindToObject(IMoniker *iface, IBindCtx *pcb, IMoniker *pmkToLeft,
REFIID riidResult, void **ppvResult)
{
ok(0, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI Moniker_BindToStorage(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft,
REFIID riid, void **ppv)
{
IUnknown *unk;
HRESULT hres;
static OLECHAR BSCBHolder[] = { '_','B','S','C','B','_','H','o','l','d','e','r','_',0 };
CHECK_EXPECT(BindToStorage);
ok(pbc == _bctx, "pbc != _bctx\n");
ok(pmkToLeft == NULL, "pmkToLeft=%p\n", pmkToLeft);
ok(IsEqualGUID(&IID_IUnknown, riid), "unexpected riid %s\n", debugstr_guid(riid));
ok(ppv != NULL, "ppv == NULL\n");
ok(*ppv == NULL, "*ppv=%p\n", *ppv);
hres = IBindCtx_GetObjectParam(pbc, BSCBHolder, &unk);
ok(hres == S_OK, "GetObjectParam failed: %08x\n", hres);
ok(unk != NULL, "unk == NULL\n");
IUnknown_Release(unk);
return S_OK;
}
static HRESULT WINAPI Moniker_Reduce(IMoniker *iface, IBindCtx *pbc, DWORD dwReduceHowFar,
IMoniker **ppmkToLeft, IMoniker **ppmkReduced)
{
ok(0, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI Moniker_ComposeWith(IMoniker *iface, IMoniker *pmkRight,
BOOL fOnlyIfNotGeneric, IMoniker **ppnkComposite)
{
ok(0, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI Moniker_Enum(IMoniker *iface, BOOL fForwrd, IEnumMoniker **ppenumMoniker)
{
ok(0, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI Moniker_IsEqual(IMoniker *iface, IMoniker *pmkOtherMoniker)
{
ok(0, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI Moniker_Hash(IMoniker *iface, DWORD *pdwHash)
{
ok(0, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI Moniker_IsRunning(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft,
IMoniker *pmkNewlyRunning)
{
ok(0, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI Moniker_GetTimeOfLastChange(IMoniker *iface, IBindCtx *pbc,
IMoniker *pmkToLeft, FILETIME *pFileTime)
{
ok(0, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI Moniker_Inverse(IMoniker *iface, IMoniker **ppmk)
{
ok(0, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI Moniker_CommonPrefixWith(IMoniker *iface, IMoniker *pmkOther,
IMoniker **ppmkPrefix)
{
ok(0, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI Moniker_RelativePathTo(IMoniker *iface, IMoniker *pmkOther,
IMoniker **pmkRelPath)
{
ok(0, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI Moniker_GetDisplayName(IMoniker *iface, IBindCtx *pbc,
IMoniker *pmkToLeft, LPOLESTR *ppszDisplayName)
{
static const WCHAR winehq_urlW[] =
{'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g',
'/','s','i','t','e','/','a','b','o','u','t',0};
CHECK_EXPECT(GetDisplayName);
ok(pbc != NULL, "pbc == NULL\n");
ok(pbc != _bctx, "pbc == _bctx\n");
ok(pmkToLeft == NULL, "pmkToLeft=%p\n", pmkToLeft);
*ppszDisplayName = CoTaskMemAlloc(sizeof(winehq_urlW));
memcpy(*ppszDisplayName, winehq_urlW, sizeof(winehq_urlW));
return S_OK;
}
static HRESULT WINAPI Moniker_ParseDisplayName(IMoniker *iface, IBindCtx *pbc,
IMoniker *pmkToLeft, LPOLESTR pszDisplayName, ULONG *pchEaten, IMoniker **ppmkOut)
{
ok(0, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI Moniker_IsSystemMoniker(IMoniker *iface, DWORD *pdwMksys)
{
CHECK_EXPECT2(IsSystemMoniker);
*pdwMksys = MKSYS_URLMONIKER;
return S_OK;
}
static IMonikerVtbl MonikerVtbl = {
Moniker_QueryInterface,
Moniker_AddRef,
Moniker_Release,
Moniker_GetClassID,
Moniker_IsDirty,
Moniker_Load,
Moniker_Save,
Moniker_GetSizeMax,
Moniker_BindToObject,
Moniker_BindToStorage,
Moniker_Reduce,
Moniker_ComposeWith,
Moniker_Enum,
Moniker_IsEqual,
Moniker_Hash,
Moniker_IsRunning,
Moniker_GetTimeOfLastChange,
Moniker_Inverse,
Moniker_CommonPrefixWith,
Moniker_RelativePathTo,
Moniker_GetDisplayName,
Moniker_ParseDisplayName,
Moniker_IsSystemMoniker
};
static IMoniker Moniker = { &MonikerVtbl };
static void test_HlinkResolveMonikerForData(void)
{
IBindCtx *bctx;
HRESULT hres;
CreateBindCtx(0, &bctx);
_bctx = bctx;
SET_EXPECT(IsSystemMoniker);
SET_EXPECT(GetDisplayName);
SET_EXPECT(BindToStorage);
hres = HlinkResolveMonikerForData(&Moniker, 0, bctx, 0, NULL, &BindStatusCallback, NULL);
ok(hres == S_OK, "HlinkResolveMonikerForData failed: %08x\n", hres);
CHECK_CALLED(IsSystemMoniker);
CHECK_CALLED(GetDisplayName);
CHECK_CALLED(BindToStorage);
IBindCtx_Release(bctx);
}
START_TEST(hlink)
{
CoInitialize(NULL);
@ -453,6 +913,8 @@ START_TEST(hlink)
test_persist();
test_special_reference();
test_HlinkCreateExtensionServices();
test_HlinkParseDisplayName();
test_HlinkResolveMonikerForData();
CoUninitialize();
}

View file

@ -5,13 +5,13 @@
<include base="hlink_winetest">.</include>
<define name="WINVER">0x600</define>
<define name="_WIN32_WINNT">0x600</define>
<file>hlink.c</file>
<file>testlist.c</file>
<library>wine</library>
<library>hlink</library>
<library>ole32</library>
<library>kernel32</library>
<library>uuid</library>
<library>ntdll</library>
<file>hlink.c</file>
<file>testlist.c</file>
</module>
</group>

View file

@ -0,0 +1,218 @@
/*
* Unit tests for imm32
*
* Copyright (c) 2008 Michael Jung
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdio.h>
#include "wine/test.h"
#include "winuser.h"
#include "imm.h"
#define NUMELEMS(array) (sizeof((array))/sizeof((array)[0]))
/*
* msgspy - record and analyse message traces sent to a certain window
*/
static struct _msg_spy {
HWND hwnd;
HHOOK get_msg_hook;
HHOOK call_wnd_proc_hook;
CWPSTRUCT msgs[32];
unsigned int i_msg;
} msg_spy;
static LRESULT CALLBACK get_msg_filter(int nCode, WPARAM wParam, LPARAM lParam)
{
if (HC_ACTION == nCode) {
MSG *msg = (MSG*)lParam;
if ((msg->hwnd == msg_spy.hwnd) &&
(msg_spy.i_msg < NUMELEMS(msg_spy.msgs)))
{
msg_spy.msgs[msg_spy.i_msg].hwnd = msg->hwnd;
msg_spy.msgs[msg_spy.i_msg].message = msg->message;
msg_spy.msgs[msg_spy.i_msg].wParam = msg->wParam;
msg_spy.msgs[msg_spy.i_msg].lParam = msg->lParam;
msg_spy.i_msg++;
}
}
return CallNextHookEx(msg_spy.get_msg_hook, nCode, wParam, lParam);
}
static LRESULT CALLBACK call_wnd_proc_filter(int nCode, WPARAM wParam,
LPARAM lParam)
{
if (HC_ACTION == nCode) {
CWPSTRUCT *cwp = (CWPSTRUCT*)lParam;
if ((cwp->hwnd == msg_spy.hwnd) &&
(msg_spy.i_msg < NUMELEMS(msg_spy.msgs)))
{
memcpy(&msg_spy.msgs[msg_spy.i_msg], cwp, sizeof(msg_spy.msgs[0]));
msg_spy.i_msg++;
}
}
return CallNextHookEx(msg_spy.call_wnd_proc_hook, nCode, wParam, lParam);
}
static void msg_spy_pump_msg_queue(void) {
MSG msg;
while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return;
}
static void msg_spy_flush_msgs(void) {
msg_spy_pump_msg_queue();
msg_spy.i_msg = 0;
}
static CWPSTRUCT* msg_spy_find_msg(UINT message) {
int i;
msg_spy_pump_msg_queue();
if (msg_spy.i_msg >= NUMELEMS(msg_spy.msgs))
fprintf(stdout, "%s:%d: msg_spy: message buffer overflow!\n",
__FILE__, __LINE__);
for (i = 0; i < msg_spy.i_msg; i++)
if (msg_spy.msgs[i].message == message)
return &msg_spy.msgs[i];
return NULL;
}
static void msg_spy_init(HWND hwnd) {
msg_spy.hwnd = hwnd;
msg_spy.get_msg_hook =
SetWindowsHookEx(WH_GETMESSAGE, get_msg_filter, GetModuleHandle(0),
GetCurrentThreadId());
msg_spy.call_wnd_proc_hook =
SetWindowsHookEx(WH_CALLWNDPROC, call_wnd_proc_filter,
GetModuleHandle(0), GetCurrentThreadId());
msg_spy.i_msg = 0;
msg_spy_flush_msgs();
}
static void msg_spy_cleanup() {
if (msg_spy.get_msg_hook)
UnhookWindowsHookEx(msg_spy.get_msg_hook);
if (msg_spy.call_wnd_proc_hook)
UnhookWindowsHookEx(msg_spy.call_wnd_proc_hook);
memset(&msg_spy, 0, sizeof(msg_spy));
}
/*
* imm32 test cases - Issue some IMM commands on a dummy window and analyse the
* messages being sent to this window in response.
*/
static const char wndcls[] = "winetest_imm32_wndcls";
static HWND hwnd;
static int init(void) {
WNDCLASSEX wc;
wc.cbSize = sizeof(WNDCLASSEX);
wc.style = 0;
wc.lpfnWndProc = DefWindowProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = GetModuleHandle(0);
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wc.lpszMenuName = NULL;
wc.lpszClassName = wndcls;
wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
if (!RegisterClassExA(&wc))
return 0;
hwnd = CreateWindowEx(WS_EX_CLIENTEDGE, wndcls, "Wine imm32.dll test",
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
240, 120, NULL, NULL, GetModuleHandle(0), NULL);
if (!hwnd)
return 0;
ShowWindow(hwnd, SW_SHOWNORMAL);
UpdateWindow(hwnd);
msg_spy_init(hwnd);
return 1;
}
static void cleanup(void) {
msg_spy_cleanup();
if (hwnd)
DestroyWindow(hwnd);
UnregisterClass(wndcls, GetModuleHandle(0));
}
static int test_ImmNotifyIME(void) {
static const char string[] = "wine";
char resstr[16] = "";
HIMC imc;
imc = ImmGetContext(hwnd);
msg_spy_flush_msgs();
ok(ImmNotifyIME(imc, NI_COMPOSITIONSTR, CPS_CANCEL, 0), "Canceling an "
"empty composition string succeeds.\n");
ok(!msg_spy_find_msg(WM_IME_COMPOSITION), "Windows does not post "
"WM_IME_COMPOSITION in response to NI_COMPOSITIONSTR / CPS_CANCEL, if "
"the composition string being canceled is empty.\n");
msg_spy_flush_msgs();
ImmSetCompositionString(imc, SCS_SETSTR, string, sizeof(string), NULL, 0);
ImmNotifyIME(imc, NI_COMPOSITIONSTR, CPS_CANCEL, 0);
ok(msg_spy_find_msg(WM_IME_COMPOSITION) != NULL, "Windows does post "
"WM_IME_COMPOSITION in response to NI_COMPOSITIONSTR / CPS_CANCEL, if "
"the composition string being canceled is non empty.\n");
ok(!ImmGetCompositionString(imc, GCS_COMPSTR, resstr, sizeof(resstr)),
"After being canceled the composition string is empty.\n");
msg_spy_flush_msgs();
ok(ImmNotifyIME(imc, NI_COMPOSITIONSTR, CPS_CANCEL, 0), "Canceling an "
"empty composition string succeeds.\n");
ok(!msg_spy_find_msg(WM_IME_COMPOSITION), "Windows does not post "
"WM_IME_COMPOSITION in response to NI_COMPOSITIONSTR / CPS_CANCEL, if "
"the composition string being canceled is empty.\n");
msg_spy_flush_msgs();
ImmReleaseContext(hwnd, imc);
return 0;
}
START_TEST(imm32) {
if (init())
test_ImmNotifyIME();
cleanup();
}

View file

@ -0,0 +1,16 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<group>
<module name="imm32_winetest" type="win32cui" installbase="bin" installname="imm32_winetest.exe" allowwarnings="true" entrypoint="0">
<include base="imm32_winetest">.</include>
<define name="WINVER">0x600</define>
<define name="_WIN32_WINNT">0x600</define>
<file>imm32.c</file>
<file>testlist.c</file>
<library>wine</library>
<library>imm32</library>
<library>user32</library>
<library>kernel32</library>
<library>ntdll</library>
</module>
</group>

View file

@ -0,0 +1,15 @@
/* Automatically generated file; DO NOT EDIT!! */
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#define STANDALONE
#include "wine/test.h"
extern void func_imm32(void);
const struct test winetest_testlist[] =
{
{ "imm32", func_imm32 },
{ 0, 0 }
};

View file

@ -1,13 +1,15 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<group>
<module name="lz32_winetest" type="win32cui" installbase="bin" installname="lz32_winetest.exe" allowwarnings="true" entrypoint="0">
<include base="lz32_winetest">.</include>
<define name="WINVER">0x600</define>
<define name="_WIN32_WINNT">0x600</define>
<file>lzexpand_main.c</file>
<file>testlist.c</file>
<library>wine</library>
<library>lz32</library>
<library>kernel32</library>
<library>ntdll</library>
<file>lzexpand_main.c</file>
<file>testlist.c</file>
</module>
</group>

View file

@ -54,10 +54,7 @@ static char filename2[] = "testfile.yyy";
a simple text file with the contents "This is a test file."
The file was created using COMPRESS.EXE from the Windows Server 2003
Resource Kit from Microsoft. The resource kit was retrieved from the
following URL:
http://www.microsoft.com/downloads/details.aspx?FamilyID=9d467a69-57ff-4ae7-96ee-b18c4790cffd&displaylang=en
Resource Kit from Microsoft.
*/
static const unsigned char compressed_file[] =
{0x53,0x5A,0x44,0x44,0x88,0xF0,0x27,0x33,0x41,

View file

@ -1,15 +1,17 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<group>
<module name="mapi32_winetest" type="win32cui" installbase="bin" installname="mapi32_winetest.exe" allowwarnings="true" entrypoint="0">
<include base="mapi32_winetest">.</include>
<define name="WINVER">0x600</define>
<define name="_WIN32_WINNT">0x600</define>
<library>wine</library>
<library>kernel32</library>
<library>uuid</library>
<library>ntdll</library>
<file>imalloc.c</file>
<file>prop.c</file>
<file>util.c</file>
<file>testlist.c</file>
<library>wine</library>
<library>kernel32</library>
<library>uuid</library>
<library>ntdll</library>
</module>
</group>

View file

@ -24,6 +24,7 @@
#include "winuser.h"
#include "winerror.h"
#include "winnt.h"
#include "initguid.h"
#include "mapiutil.h"
#include "mapitags.h"

View file

@ -1,15 +1,17 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<group>
<module name="mlang_winetest" type="win32cui" installbase="bin" installname="mlang_winetest.exe" allowwarnings="true" entrypoint="0">
<include base="mlang_winetest">.</include>
<define name="WINVER">0x600</define>
<define name="_WIN32_WINNT">0x600</define>
<file>mlang.c</file>
<file>testlist.c</file>
<library>wine</library>
<library>ole32</library>
<library>gdi32</library>
<library>kernel32</library>
<library>uuid</library>
<library>ntdll</library>
<file>mlang.c</file>
<file>testlist.c</file>
</module>
</group>

View file

@ -465,85 +465,138 @@ static DISPID get_dispid( IDispatch *disp, const char *name )
static void test_dispid(void)
{
ok( get_dispid( pInstaller, "CreateRecord" ) == 1, "dispid wrong\n");
ok( get_dispid( pInstaller, "OpenPackage" ) == 2, "dispid wrong\n");
todo_wine ok( get_dispid( pInstaller, "OpenProduct" ) == 3, "dispid wrong\n");
ok( get_dispid( pInstaller, "OpenDatabase" ) == 4, "dispid wrong\n");
todo_wine {
ok( get_dispid( pInstaller, "SummaryInformation" ) == 5, "dispid wrong\n");
ok( get_dispid( pInstaller, "UILevel" ) == 6, "dispid wrong\n");
ok( get_dispid( pInstaller, "EnableLog" ) == 7, "dispid wrong\n");
}
ok( get_dispid( pInstaller, "InstallProduct" ) == 8, "dispid wrong\n");
ok( get_dispid( pInstaller, "Version" ) == 9, "dispid wrong\n");
todo_wine {
ok( get_dispid( pInstaller, "LastErrorRecord" ) == 10, "dispid wrong\n");
}
ok( get_dispid( pInstaller, "RegistryValue" ) == 11, "dispid wrong\n");
todo_wine {
ok( get_dispid( pInstaller, "Environment" ) == 12, "dispid wrong\n");
ok( get_dispid( pInstaller, "FileAttributes" ) == 13, "dispid wrong\n");
DISPID dispid;
ok( get_dispid( pInstaller, "FileSize" ) == 15, "dispid wrong\n");
ok( get_dispid( pInstaller, "FileVersion" ) == 16, "dispid wrong\n");
dispid = get_dispid(pInstaller, "CreateRecord");
ok(dispid == 1, "Expected 1, got %d\n", dispid);
dispid = get_dispid(pInstaller, "OpenPackage");
ok(dispid == 2, "Expected 2, got %d\n", dispid);
dispid = get_dispid(pInstaller, "OpenDatabase");
ok(dispid == 4, "Expected 4, got %d\n", dispid);
dispid = get_dispid( pInstaller, "UILevel" );
ok(dispid == 6, "Expected 6, got %d\n", dispid);
dispid = get_dispid(pInstaller, "InstallProduct");
ok(dispid == 8, "Expected 8, got %d\n", dispid);
dispid = get_dispid(pInstaller, "Version");
ok(dispid == 9, "Expected 9, got %d\n", dispid);
dispid = get_dispid(pInstaller, "RegistryValue");
ok(dispid == 11, "Expected 11, got %d\n", dispid);
todo_wine
{
dispid = get_dispid(pInstaller, "OpenProduct");
ok(dispid == 3, "Expected 3, got %d\n", dispid);
dispid = get_dispid(pInstaller, "SummaryInformation");
ok(dispid == 5, "Expected 5, got %d\n", dispid);
dispid = get_dispid(pInstaller, "EnableLog");
ok(dispid == 7, "Expected 7, got %d\n", dispid);
dispid = get_dispid(pInstaller, "LastErrorRecord");
ok(dispid == 10, "Expected 10, got %d\n", dispid);
dispid = get_dispid(pInstaller, "Environment");
ok(dispid == 12, "Expected 12, got %d\n", dispid);
dispid = get_dispid(pInstaller, "FileAttributes");
ok(dispid == 13, "Expected 13, got %d\n", dispid);
dispid = get_dispid(pInstaller, "FileSize");
ok(dispid == 15, "Expected 15, got %d\n", dispid);
dispid = get_dispid(pInstaller, "FileVersion");
ok(dispid == 16, "Expected 16, got %d\n", dispid);
}
ok( get_dispid( pInstaller, "ProductState" ) == 17, "dispid wrong\n");
ok( get_dispid( pInstaller, "ProductInfo" ) == 18, "dispid wrong\n");
todo_wine {
ok( get_dispid( pInstaller, "ConfigureProduct" ) == 19, "dispid wrong\n");
ok( get_dispid( pInstaller, "ReinstallProduct" ) == 20 , "dispid wrong\n");
ok( get_dispid( pInstaller, "CollectUserInfo" ) == 21, "dispid wrong\n");
ok( get_dispid( pInstaller, "ApplyPatch" ) == 22, "dispid wrong\n");
ok( get_dispid( pInstaller, "FeatureParent" ) == 23, "dispid wrong\n");
ok( get_dispid( pInstaller, "FeatureState" ) == 24, "dispid wrong\n");
ok( get_dispid( pInstaller, "UseFeature" ) == 25, "dispid wrong\n");
ok( get_dispid( pInstaller, "FeatureUsageCount" ) == 26, "dispid wrong\n");
ok( get_dispid( pInstaller, "FeatureUsageDate" ) == 27, "dispid wrong\n");
ok( get_dispid( pInstaller, "ConfigureFeature" ) == 28, "dispid wrong\n");
ok( get_dispid( pInstaller, "ReinstallFeature" ) == 29, "dispid wrong\n");
ok( get_dispid( pInstaller, "ProvideComponent" ) == 30, "dispid wrong\n");
ok( get_dispid( pInstaller, "ComponentPath" ) == 31, "dispid wrong\n");
ok( get_dispid( pInstaller, "ProvideQualifiedComponent" ) == 32, "dispid wrong\n");
ok( get_dispid( pInstaller, "QualifierDescription" ) == 33, "dispid wrong\n");
ok( get_dispid( pInstaller, "ComponentQualifiers" ) == 34, "dispid wrong\n");
dispid = get_dispid(pInstaller, "ProductState");
ok(dispid == 17, "Expected 17, got %d\n", dispid);
dispid = get_dispid(pInstaller, "ProductInfo");
ok(dispid == 18, "Expected 18, got %d\n", dispid);
todo_wine
{
dispid = get_dispid(pInstaller, "ConfigureProduct");
ok(dispid == 19, "Expected 19, got %d\n", dispid);
dispid = get_dispid(pInstaller, "ReinstallProduct");
ok(dispid == 20 , "Expected 20, got %d\n", dispid);
dispid = get_dispid(pInstaller, "CollectUserInfo");
ok(dispid == 21, "Expected 21, got %d\n", dispid);
dispid = get_dispid(pInstaller, "ApplyPatch");
ok(dispid == 22, "Expected 22, got %d\n", dispid);
dispid = get_dispid(pInstaller, "FeatureParent");
ok(dispid == 23, "Expected 23, got %d\n", dispid);
dispid = get_dispid(pInstaller, "FeatureState");
ok(dispid == 24, "Expected 24, got %d\n", dispid);
dispid = get_dispid(pInstaller, "UseFeature");
ok(dispid == 25, "Expected 25, got %d\n", dispid);
dispid = get_dispid(pInstaller, "FeatureUsageCount");
ok(dispid == 26, "Expected 26, got %d\n", dispid);
dispid = get_dispid(pInstaller, "FeatureUsageDate");
ok(dispid == 27, "Expected 27, got %d\n", dispid);
dispid = get_dispid(pInstaller, "ConfigureFeature");
ok(dispid == 28, "Expected 28, got %d\n", dispid);
dispid = get_dispid(pInstaller, "ReinstallFeature");
ok(dispid == 29, "Expected 29, got %d\n", dispid);
dispid = get_dispid(pInstaller, "ProvideComponent");
ok(dispid == 30, "Expected 30, got %d\n", dispid);
dispid = get_dispid(pInstaller, "ComponentPath");
ok(dispid == 31, "Expected 31, got %d\n", dispid);
dispid = get_dispid(pInstaller, "ProvideQualifiedComponent");
ok(dispid == 32, "Expected 32, got %d\n", dispid);
dispid = get_dispid(pInstaller, "QualifierDescription");
ok(dispid == 33, "Expected 33, got %d\n", dispid);
dispid = get_dispid(pInstaller, "ComponentQualifiers");
ok(dispid == 34, "Expected 34, got %d\n", dispid);
}
ok( get_dispid( pInstaller, "Products" ) == 35, "dispid wrong\n");
todo_wine {
ok( get_dispid( pInstaller, "Features" ) == 36, "dispid wrong\n");
ok( get_dispid( pInstaller, "Components" ) == 37, "dispid wrong\n");
ok( get_dispid( pInstaller, "ComponentClients" ) == 38, "dispid wrong\n");
ok( get_dispid( pInstaller, "Patches" ) == 39, "dispid wrong\n");
dispid = get_dispid(pInstaller, "Products");
ok(dispid == 35, "Expected 35, got %d\n", dispid);
todo_wine
{
dispid = get_dispid(pInstaller, "Features");
ok(dispid == 36, "Expected 36, got %d\n", dispid);
dispid = get_dispid(pInstaller, "Components");
ok(dispid == 37, "Expected 37, got %d\n", dispid);
dispid = get_dispid(pInstaller, "ComponentClients");
ok(dispid == 38, "Expected 38, got %d\n", dispid);
dispid = get_dispid(pInstaller, "Patches");
ok(dispid == 39, "Expected 39, got %d\n", dispid);
}
ok( get_dispid( pInstaller, "RelatedProducts" ) == 40, "dispid wrong\n");
todo_wine {
ok( get_dispid( pInstaller, "PatchInfo" ) == 41, "dispid wrong\n");
ok( get_dispid( pInstaller, "PatchTransforms" ) == 42, "dispid wrong\n");
ok( get_dispid( pInstaller, "AddSource" ) == 43, "dispid wrong\n");
ok( get_dispid( pInstaller, "ClearSourceList" ) == 44, "dispid wrong\n");
ok( get_dispid( pInstaller, "ForceSourceListResolution" ) == 45, "dispid wrong\n");
ok( get_dispid( pInstaller, "ShortcutTarget" ) == 46, "dispid wrong\n");
ok( get_dispid( pInstaller, "FileHash" ) == 47, "dispid wrong\n");
ok( get_dispid( pInstaller, "FileSignatureInfo" ) == 48, "dispid wrong\n");
ok( get_dispid( pInstaller, "RemovePatches" ) == 49, "dispid wrong\n");
ok( get_dispid( pInstaller, "ApplyMultiplePatches" ) == 51, "dispid wrong\n");
ok( get_dispid( pInstaller, "ProductsEx" ) == 52, "dispid wrong\n");
ok( get_dispid( pInstaller, "PatchesEx" ) == 55, "dispid wrong\n");
ok( get_dispid( pInstaller, "ExtractPatchXMLData" ) == 57, "dispid wrong\n");
dispid = get_dispid(pInstaller, "RelatedProducts");
ok(dispid == 40, "Expected 40, got %d\n", dispid);
dispid = get_dispid(pInstaller, "RemovePatches");
ok(dispid == 49 || dispid == -1, "Expected 49 or -1, got %d\n", dispid);
dispid = get_dispid(pInstaller, "ApplyMultiplePatches");
ok(dispid == 51 || dispid == -1, "Expected 51 or -1, got %d\n", dispid);
dispid = get_dispid(pInstaller, "ProductsEx");
ok(dispid == 52 || dispid == -1, "Expected 52 or -1, got %d\n", dispid);
dispid = get_dispid(pInstaller, "PatchesEx");
ok(dispid == 55 || dispid == -1, "Expected 55 or -1, got %d\n", dispid);
dispid = get_dispid(pInstaller, "ExtractPatchXMLData");
ok(dispid == 57 || dispid == -1, "Expected 57 or -1, got %d\n", dispid);
todo_wine
{
dispid = get_dispid(pInstaller, "PatchInfo");
ok(dispid == 41, "Expected 41, got %d\n", dispid);
dispid = get_dispid(pInstaller, "PatchTransforms");
ok(dispid == 42, "Expected 42, got %d\n", dispid);
dispid = get_dispid(pInstaller, "AddSource");
ok(dispid == 43, "Expected 43, got %d\n", dispid);
dispid = get_dispid(pInstaller, "ClearSourceList");
ok(dispid == 44, "Expected 44, got %d\n", dispid);
dispid = get_dispid(pInstaller, "ForceSourceListResolution");
ok(dispid == 45, "Expected 45, got %d\n", dispid);
dispid = get_dispid(pInstaller, "ShortcutTarget");
ok(dispid == 46, "Expected 46, got %d\n", dispid);
dispid = get_dispid(pInstaller, "FileHash");
ok(dispid == 47, "Expected 47, got %d\n", dispid);
dispid = get_dispid(pInstaller, "FileSignatureInfo");
ok(dispid == 48, "Expected 48, got %d\n", dispid);
}
/* MSDN claims the following functions exist but IDispatch->GetIDsOfNames disagrees */
if (0)
{
get_dispid( pInstaller, "ProductElevated" );
get_dispid( pInstaller, "ProductInfoFromScript" );
get_dispid( pInstaller, "ProvideAssembly" );
get_dispid( pInstaller, "CreateAdvertiseScript" );
get_dispid( pInstaller, "AdvertiseProduct" );
get_dispid( pInstaller, "PatchFiles" );
}
dispid = get_dispid( pInstaller, "ProductElevated" );
ok(dispid == -1, "Expected -1, got %d\n", dispid);
dispid = get_dispid( pInstaller, "ProductInfoFromScript" );
ok(dispid == -1, "Expected -1, got %d\n", dispid);
dispid = get_dispid( pInstaller, "ProvideAssembly" );
ok(dispid == -1, "Expected -1, got %d\n", dispid);
dispid = get_dispid( pInstaller, "CreateAdvertiseScript" );
ok(dispid == -1, "Expected -1, got %d\n", dispid);
dispid = get_dispid( pInstaller, "AdvertiseProduct" );
ok(dispid == -1, "Expected -1, got %d\n", dispid);
dispid = get_dispid( pInstaller, "PatchFiles" );
ok(dispid == -1, "Expected -1, got %d\n", dispid);
}
/* Test basic IDispatch functions */
@ -1526,10 +1579,8 @@ static void test_Database(IDispatch *pDatabase, BOOL readonly)
ok(hr == DISP_E_EXCEPTION, "View_Modify failed, hresult 0x%08x\n", hr);
ok_exception(hr, szModifyModeRecord);
/* View::Modify with MSIMODIFY_REFRESH should undo our changes */
hr = View_Modify(pView, MSIMODIFY_REFRESH, pRecord);
/* Wine's MsiViewModify currently does not support MSIMODIFY_REFRESH */
todo_wine ok(hr == S_OK, "View_Modify failed, hresult 0x%08x\n", hr);
ok(hr == S_OK, "View_Modify failed, hresult 0x%08x\n", hr);
/* Record::StringDataGet, confirm that the record is back to its unmodified value */
memset(szString, 0, sizeof(szString));
@ -1762,6 +1813,7 @@ static void test_Installer_RegistryValue(void)
VARIANTARG vararg;
WCHAR szString[MAX_PATH];
HKEY hkey, hkey_sub;
HKEY curr_user = (HKEY)1;
HRESULT hr;
BOOL bRet;
@ -1769,16 +1821,16 @@ static void test_Installer_RegistryValue(void)
if (!RegOpenKeyW( HKEY_CURRENT_USER, szKey, &hkey )) delete_key( hkey );
/* Does our key exist? Shouldn't; check with all three possible value parameter types */
hr = Installer_RegistryValueE(HKEY_CURRENT_USER, szKey, &bRet);
hr = Installer_RegistryValueE(curr_user, szKey, &bRet);
ok(hr == S_OK, "Installer_RegistryValueE failed, hresult 0x%08x\n", hr);
ok(!bRet, "Registry key expected to not exist, but Installer_RegistryValue claims it does\n");
memset(szString, 0, sizeof(szString));
hr = Installer_RegistryValueW(HKEY_CURRENT_USER, szKey, NULL, szString);
hr = Installer_RegistryValueW(curr_user, szKey, NULL, szString);
ok(hr == DISP_E_BADINDEX, "Installer_RegistryValueW failed, hresult 0x%08x\n", hr);
memset(szString, 0, sizeof(szString));
hr = Installer_RegistryValueI(HKEY_CURRENT_USER, szKey, 0, szString, VT_BSTR);
hr = Installer_RegistryValueI(curr_user, szKey, 0, szString, VT_BSTR);
ok(hr == DISP_E_BADINDEX, "Installer_RegistryValueI failed, hresult 0x%08x\n", hr);
/* Create key */
@ -1807,87 +1859,87 @@ static void test_Installer_RegistryValue(void)
/* Does our key exist? It should, and make sure we retrieve the correct default value */
bRet = FALSE;
hr = Installer_RegistryValueE(HKEY_CURRENT_USER, szKey, &bRet);
hr = Installer_RegistryValueE(curr_user, szKey, &bRet);
ok(hr == S_OK, "Installer_RegistryValueE failed, hresult 0x%08x\n", hr);
ok(bRet, "Registry key expected to exist, but Installer_RegistryValue claims it does not\n");
memset(szString, 0, sizeof(szString));
hr = Installer_RegistryValueW(HKEY_CURRENT_USER, szKey, NULL, szString);
hr = Installer_RegistryValueW(curr_user, szKey, NULL, szString);
ok(hr == S_OK, "Installer_RegistryValueW failed, hresult 0x%08x\n", hr);
ok_w2("Default registry value \"%s\" does not match expected \"%s\"\n", szString, szOne);
/* Ask for the value of a nonexistent key */
memset(szString, 0, sizeof(szString));
hr = Installer_RegistryValueW(HKEY_CURRENT_USER, szKey, szExpand, szString);
hr = Installer_RegistryValueW(curr_user, szKey, szExpand, szString);
ok(hr == DISP_E_BADINDEX, "Installer_RegistryValueW failed, hresult 0x%08x\n", hr);
/* Get values of keys */
memset(szString, 0, sizeof(szString));
hr = Installer_RegistryValueW(HKEY_CURRENT_USER, szKey, szOne, szString);
hr = Installer_RegistryValueW(curr_user, szKey, szOne, szString);
ok(hr == S_OK, "Installer_RegistryValueW failed, hresult 0x%08x\n", hr);
ok_w2("Registry value \"%s\" does not match expected \"%s\"\n", szString, szOne);
VariantInit(&vararg);
V_VT(&vararg) = VT_BSTR;
V_BSTR(&vararg) = SysAllocString(szTwo);
hr = Installer_RegistryValue(HKEY_CURRENT_USER, szKey, vararg, &varresult, VT_I4);
hr = Installer_RegistryValue(curr_user, szKey, vararg, &varresult, VT_I4);
ok(hr == S_OK, "Installer_RegistryValue failed, hresult 0x%08x\n", hr);
ok(V_I4(&varresult) == 305419896, "Registry value %d does not match expected value\n", V_I4(&varresult));
VariantClear(&varresult);
memset(szString, 0, sizeof(szString));
hr = Installer_RegistryValueW(HKEY_CURRENT_USER, szKey, szThree, szString);
hr = Installer_RegistryValueW(curr_user, szKey, szThree, szString);
ok(hr == S_OK, "Installer_RegistryValueW failed, hresult 0x%08x\n", hr);
ok_w2("Registry value \"%s\" does not match expected \"%s\"\n", szString, szREG_BINARY);
memset(szString, 0, sizeof(szString));
hr = Installer_RegistryValueW(HKEY_CURRENT_USER, szKey, szFour, szString);
hr = Installer_RegistryValueW(curr_user, szKey, szFour, szString);
ok(hr == S_OK, "Installer_RegistryValueW failed, hresult 0x%08x\n", hr);
ok_w2("Registry value \"%s\" does not match expected \"%s\"\n", szString, szFour);
memset(szString, 0, sizeof(szString));
hr = Installer_RegistryValueW(HKEY_CURRENT_USER, szKey, szFive, szString);
hr = Installer_RegistryValueW(curr_user, szKey, szFive, szString);
ok(hr == S_OK, "Installer_RegistryValueW failed, hresult 0x%08x\n", hr);
ok_w2("Registry value \"%s\" does not match expected \"%s\"\n", szString, szFiveHi);
memset(szString, 0, sizeof(szString));
hr = Installer_RegistryValueW(HKEY_CURRENT_USER, szKey, szSix, szString);
hr = Installer_RegistryValueW(curr_user, szKey, szSix, szString);
ok(hr == S_OK, "Installer_RegistryValueW failed, hresult 0x%08x\n", hr);
ok_w2("Registry value \"%s\" does not match expected \"%s\"\n", szString, szREG_);
VariantInit(&vararg);
V_VT(&vararg) = VT_BSTR;
V_BSTR(&vararg) = SysAllocString(szSeven);
hr = Installer_RegistryValue(HKEY_CURRENT_USER, szKey, vararg, &varresult, VT_EMPTY);
hr = Installer_RegistryValue(curr_user, szKey, vararg, &varresult, VT_EMPTY);
ok(hr == S_OK, "Installer_RegistryValue failed, hresult 0x%08x\n", hr);
/* Get string class name for the key */
memset(szString, 0, sizeof(szString));
hr = Installer_RegistryValueI(HKEY_CURRENT_USER, szKey, 0, szString, VT_BSTR);
hr = Installer_RegistryValueI(curr_user, szKey, 0, szString, VT_BSTR);
ok(hr == S_OK, "Installer_RegistryValueI failed, hresult 0x%08x\n", hr);
ok_w2("Registry name \"%s\" does not match expected \"%s\"\n", szString, szBlank);
/* Get name of a value by positive number (RegEnumValue like), valid index */
memset(szString, 0, sizeof(szString));
hr = Installer_RegistryValueI(HKEY_CURRENT_USER, szKey, 2, szString, VT_BSTR);
hr = Installer_RegistryValueI(curr_user, szKey, 2, szString, VT_BSTR);
ok(hr == S_OK, "Installer_RegistryValueI failed, hresult 0x%08x\n", hr);
/* RegEnumValue order seems different on wine */
todo_wine ok_w2("Registry name \"%s\" does not match expected \"%s\"\n", szString, szTwo);
/* Get name of a value by positive number (RegEnumValue like), invalid index */
memset(szString, 0, sizeof(szString));
hr = Installer_RegistryValueI(HKEY_CURRENT_USER, szKey, 10, szString, VT_EMPTY);
hr = Installer_RegistryValueI(curr_user, szKey, 10, szString, VT_EMPTY);
ok(hr == S_OK, "Installer_RegistryValueI failed, hresult 0x%08x\n", hr);
/* Get name of a subkey by negative number (RegEnumValue like), valid index */
memset(szString, 0, sizeof(szString));
hr = Installer_RegistryValueI(HKEY_CURRENT_USER, szKey, -1, szString, VT_BSTR);
hr = Installer_RegistryValueI(curr_user, szKey, -1, szString, VT_BSTR);
ok(hr == S_OK, "Installer_RegistryValueI failed, hresult 0x%08x\n", hr);
ok_w2("Registry name \"%s\" does not match expected \"%s\"\n", szString, szEight);
/* Get name of a subkey by negative number (RegEnumValue like), invalid index */
memset(szString, 0, sizeof(szString));
hr = Installer_RegistryValueI(HKEY_CURRENT_USER, szKey, -10, szString, VT_EMPTY);
hr = Installer_RegistryValueI(curr_user, szKey, -10, szString, VT_EMPTY);
ok(hr == S_OK, "Installer_RegistryValueI failed, hresult 0x%08x\n", hr);
/* clean up */
@ -2116,6 +2168,12 @@ static void test_Installer_InstallProduct(void)
/* Installer::InstallProduct */
hr = Installer_InstallProduct(szMsifile, NULL);
if (hr == DISP_E_EXCEPTION)
{
skip("Installer object not supported.\n");
delete_test_files();
return;
}
ok(hr == S_OK, "Installer_InstallProduct failed, hresult 0x%08x\n", hr);
/* Installer::ProductState for our product code, which has been installed */
@ -2140,14 +2198,14 @@ static void test_Installer_InstallProduct(void)
/* Package name */
memset(szString, 0, sizeof(szString));
hr = Installer_ProductInfo(szProductCode, WINE_INSTALLPROPERTY_PACKAGENAMEW, szString);
todo_wine ok(hr == S_OK, "Installer_ProductInfo failed, hresult 0x%08x\n", hr);
ok(hr == S_OK, "Installer_ProductInfo failed, hresult 0x%08x\n", hr);
todo_wine ok_w2("Installer_ProductInfo returned %s but expected %s\n", szString, szMsifile);
/* Product name */
memset(szString, 0, sizeof(szString));
hr = Installer_ProductInfo(szProductCode, WINE_INSTALLPROPERTY_PRODUCTNAMEW, szString);
ok(hr == S_OK, "Installer_ProductInfo failed, hresult 0x%08x\n", hr);
ok_w2("Installer_ProductInfo returned %s but expected %s\n", szString, szMSITEST);
todo_wine ok_w2("Installer_ProductInfo returned %s but expected %s\n", szString, szMSITEST);
/* Installer::Products */
test_Installer_Products(TRUE);

View file

@ -1643,17 +1643,18 @@ static void test_msiimport(void)
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
r = add_table_to_db(hdb, endlines1);
todo_wine
if (r == ERROR_FUNCTION_FAILED)
{
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
/* win9x doesn't handle this case */
skip("endlines not handled correctly.\n");
MsiCloseHandle(hdb);
DeleteFileA(msifile);
return;
}
r = add_table_to_db(hdb, endlines2);
todo_wine
{
ok(r == ERROR_FUNCTION_FAILED,
"Expected ERROR_FUNCTION_FAILED, got %d\n", r);
}
query = "SELECT * FROM `TestTable`";
r = MsiDatabaseOpenView(hdb, query, &view);
@ -1752,7 +1753,8 @@ static void test_msiimport(void)
MsiCloseHandle(rec);
r = MsiViewFetch(view, &rec);
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);
r = MsiViewClose(view);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
@ -1761,15 +1763,10 @@ static void test_msiimport(void)
query = "SELECT * FROM `Table`";
r = MsiDatabaseOpenView(hdb, query, &view);
todo_wine
{
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
}
r = MsiViewGetColumnInfo(view, MSICOLINFO_NAMES, &rec);
count = MsiRecordGetFieldCount(rec);
todo_wine
{
ok(count == 6, "Expected 6, got %d\n", count);
ok(check_record(rec, 1, "A"), "Expected A\n");
ok(check_record(rec, 2, "B"), "Expected B\n");
@ -1777,13 +1774,10 @@ static void test_msiimport(void)
ok(check_record(rec, 4, "D"), "Expected D\n");
ok(check_record(rec, 5, "E"), "Expected E\n");
ok(check_record(rec, 6, "F"), "Expected F\n");
}
MsiCloseHandle(rec);
r = MsiViewGetColumnInfo(view, MSICOLINFO_TYPES, &rec);
count = MsiRecordGetFieldCount(rec);
todo_wine
{
ok(count == 6, "Expected 6, got %d\n", count);
ok(check_record(rec, 1, "s72"), "Expected s72\n");
ok(check_record(rec, 2, "s72"), "Expected s72\n");
@ -1791,7 +1785,6 @@ static void test_msiimport(void)
ok(check_record(rec, 4, "s72"), "Expected s72\n");
ok(check_record(rec, 5, "s72"), "Expected s72\n");
ok(check_record(rec, 6, "s72"), "Expected s72\n");
}
MsiCloseHandle(rec);
MsiViewClose(view);
@ -1799,20 +1792,12 @@ static void test_msiimport(void)
query = "SELECT * FROM `Table`";
r = MsiDatabaseOpenView(hdb, query, &view);
todo_wine
{
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
}
r = MsiViewExecute(view, 0);
todo_wine
{
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
}
r = MsiViewFetch(view, &rec);
todo_wine
{
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(check_record(rec, 1, "a"), "Expected 'a'\n");
ok(check_record(rec, 2, "b"), "Expected 'b'\n");
@ -1820,13 +1805,10 @@ static void test_msiimport(void)
ok(check_record(rec, 4, "d"), "Expected 'd'\n");
ok(check_record(rec, 5, "e"), "Expected 'e'\n");
ok(check_record(rec, 6, "f"), "Expected 'f'\n");
}
MsiCloseHandle(rec);
r = MsiViewFetch(view, &rec);
todo_wine
{
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(check_record(rec, 1, "g"), "Expected 'g'\n");
ok(check_record(rec, 2, "h"), "Expected 'h'\n");
@ -1834,16 +1816,12 @@ static void test_msiimport(void)
ok(check_record(rec, 4, "j"), "Expected 'j'\n");
ok(check_record(rec, 5, "k"), "Expected 'k'\n");
ok(check_record(rec, 6, "l"), "Expected 'l'\n");
}
MsiCloseHandle(rec);
r = MsiViewFetch(view, &rec);
todo_wine
{
ok(r == ERROR_NO_MORE_ITEMS,
"Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
}
MsiViewClose(view);
MsiCloseHandle(view);
@ -3235,6 +3213,11 @@ static void test_join(void)
MsiViewClose(hview);
MsiCloseHandle(hview);
query = "SELECT * FROM `Nonexistent`, `One`";
r = MsiDatabaseOpenView(hdb, query, &hview);
ok( r == ERROR_BAD_QUERY_SYNTAX,
"Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r );
MsiCloseHandle(hdb);
DeleteFile(msifile);
}
@ -4799,6 +4782,10 @@ static void test_order(void)
hdb = create_db();
ok(hdb, "failed to create db\n");
query = "CREATE TABLE `Empty` ( `A` SHORT NOT NULL PRIMARY KEY `A`)";
r = run_query(hdb, 0, query);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
query = "CREATE TABLE `Mesa` ( `A` SHORT NOT NULL, `B` SHORT, `C` SHORT PRIMARY KEY `A`)";
r = run_query(hdb, 0, query);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
@ -4984,6 +4971,18 @@ static void test_order(void)
r = MsiViewFetch(hview, &hrec);
ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
MsiViewClose(hview);
MsiCloseHandle(hview);
query = "SELECT * FROM `Empty` ORDER BY `A`";
r = MsiDatabaseOpenView(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);
r = MsiViewFetch(hview, &hrec);
ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
MsiViewClose(hview);
MsiCloseHandle(hview);
MsiCloseHandle(hdb);
@ -5255,10 +5254,7 @@ static void test_quotes(void)
write_file("import.idt", import_dat, (sizeof(import_dat) - 1) * sizeof(char));
r = MsiDatabaseImportA(hdb, CURR_DIR, "import.idt");
todo_wine
{
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
}
DeleteFileA("import.idt");
@ -5275,19 +5271,13 @@ static void test_quotes(void)
size = MAX_PATH;
r = MsiRecordGetString(hrec, 1, buf, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
todo_wine
{
ok(!lstrcmp(buf, "This is a new 'string' ok"),
"Expected \"This is a new 'string' ok\", got %s\n", buf);
}
MsiCloseHandle(hrec);
r = MsiViewFetch(hview, &hrec);
todo_wine
{
ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
}
MsiCloseHandle(hview);
@ -5501,6 +5491,360 @@ static void test_carriagereturn(void)
DeleteFileA(msifile);
}
static void test_noquotes(void)
{
MSIHANDLE hdb, hview, hrec;
const char *query;
char buf[MAX_PATH];
UINT r;
DWORD size;
DeleteFile(msifile);
r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
query = "CREATE TABLE Table ( `A` CHAR(72) NOT NULL PRIMARY KEY `A` )";
r = run_query(hdb, 0, query);
ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
query = "CREATE TABLE `Table` ( A CHAR(72) NOT NULL PRIMARY KEY `A` )";
r = run_query(hdb, 0, query);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
query = "CREATE TABLE `Table2` ( `A` CHAR(72) NOT NULL PRIMARY KEY A )";
r = run_query(hdb, 0, query);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
query = "CREATE TABLE `Table3` ( A CHAR(72) NOT NULL PRIMARY KEY A )";
r = run_query(hdb, 0, query);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
query = "SELECT * FROM `_Tables`";
r = MsiDatabaseOpenView(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);
r = MsiViewFetch(hview, &hrec);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
size = MAX_PATH;
r = MsiRecordGetStringA(hrec, 1, buf, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "Table"), "Expected \"Table\", got \"%s\"\n", buf);
MsiCloseHandle(hrec);
r = MsiViewFetch(hview, &hrec);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
size = MAX_PATH;
r = MsiRecordGetStringA(hrec, 1, buf, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "Table2"), "Expected \"Table2\", got \"%s\"\n", buf);
MsiCloseHandle(hrec);
r = MsiViewFetch(hview, &hrec);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
size = MAX_PATH;
r = MsiRecordGetStringA(hrec, 1, buf, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "Table3"), "Expected \"Table3\", got \"%s\"\n", buf);
MsiCloseHandle(hrec);
r = MsiViewFetch(hview, &hrec);
ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
MsiViewClose(hview);
MsiCloseHandle(hview);
query = "SELECT * FROM `_Columns`";
r = MsiDatabaseOpenView(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);
r = MsiViewFetch(hview, &hrec);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
size = MAX_PATH;
r = MsiRecordGetStringA(hrec, 1, buf, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "Table"), "Expected \"Table\", got \"%s\"\n", buf);
r = MsiRecordGetInteger(hrec, 2);
ok(r == 1, "Expected 1, got %d\n", r);
size = MAX_PATH;
r = MsiRecordGetStringA(hrec, 3, buf, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "A"), "Expected \"A\", got \"%s\"\n", buf);
MsiCloseHandle(hrec);
r = MsiViewFetch(hview, &hrec);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
size = MAX_PATH;
r = MsiRecordGetStringA(hrec, 1, buf, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "Table2"), "Expected \"Table2\", got \"%s\"\n", buf);
r = MsiRecordGetInteger(hrec, 2);
ok(r == 1, "Expected 1, got %d\n", r);
size = MAX_PATH;
r = MsiRecordGetStringA(hrec, 3, buf, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "A"), "Expected \"A\", got \"%s\"\n", buf);
MsiCloseHandle(hrec);
r = MsiViewFetch(hview, &hrec);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
size = MAX_PATH;
r = MsiRecordGetStringA(hrec, 1, buf, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "Table3"), "Expected \"Table3\", got \"%s\"\n", buf);
r = MsiRecordGetInteger(hrec, 2);
ok(r == 1, "Expected 1, got %d\n", r);
size = MAX_PATH;
r = MsiRecordGetStringA(hrec, 3, buf, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "A"), "Expected \"A\", got \"%s\"\n", buf);
MsiCloseHandle(hrec);
r = MsiViewFetch(hview, &hrec);
ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
MsiViewClose(hview);
MsiCloseHandle(hview);
query = "INSERT INTO Table ( `A` ) VALUES ( 'hi' )";
r = run_query(hdb, 0, query);
ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
query = "INSERT INTO `Table` ( A ) VALUES ( 'hi' )";
r = run_query(hdb, 0, query);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
query = "INSERT INTO `Table` ( `A` ) VALUES ( hi )";
r = run_query(hdb, 0, query);
ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
query = "SELECT * FROM Table WHERE `A` = 'hi'";
r = run_query(hdb, 0, query);
ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
query = "SELECT * FROM `Table` WHERE `A` = hi";
r = run_query(hdb, 0, query);
ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
query = "SELECT * FROM Table";
r = run_query(hdb, 0, query);
ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
query = "SELECT * FROM Table2";
r = MsiDatabaseOpenView(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);
r = MsiViewFetch(hview, &hrec);
ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
MsiViewClose(hview);
MsiCloseHandle(hview);
query = "SELECT * FROM `Table` WHERE A = 'hi'";
r = MsiDatabaseOpenView(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);
r = MsiViewFetch(hview, &hrec);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
size = MAX_PATH;
r = MsiRecordGetStringA(hrec, 1, buf, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, "hi"), "Expected \"hi\", got \"%s\"\n", buf);
MsiCloseHandle(hrec);
r = MsiViewFetch(hview, &hrec);
ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
MsiViewClose(hview);
MsiCloseHandle(hview);
MsiCloseHandle(hdb);
DeleteFileA(msifile);
}
static void read_file_data(LPCSTR filename, LPSTR buffer)
{
OFSTRUCT ofs;
HFILE file;
DWORD read;
file = OpenFile(filename, &ofs, OF_READ);
ZeroMemory(buffer, MAX_PATH);
ReadFile((HANDLE)file, buffer, MAX_PATH, &read, NULL);
CloseHandle((HANDLE)file);
}
static void test_forcecodepage(void)
{
MSIHANDLE hdb;
const char *query;
char buffer[MAX_PATH];
UINT r;
DeleteFile(msifile);
r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
query = "SELECT * FROM `_ForceCodepage`";
r = run_query(hdb, 0, query);
ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
query = "CREATE TABLE `Table` ( `A` CHAR(72) NOT NULL PRIMARY KEY `A` )";
r = run_query(hdb, 0, query);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
query = "SELECT * FROM `_ForceCodepage`";
r = run_query(hdb, 0, query);
ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
r = MsiDatabaseCommit(hdb);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
query = "SELECT * FROM `_ForceCodepage`";
r = run_query(hdb, 0, query);
ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
MsiCloseHandle(hdb);
r = MsiOpenDatabase(msifile, MSIDBOPEN_DIRECT, &hdb);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
query = "SELECT * FROM `_ForceCodepage`";
r = run_query(hdb, 0, query);
ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
r = MsiDatabaseExport(hdb, "_ForceCodepage", CURR_DIR, "forcecodepage.idt");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
read_file_data("forcecodepage.idt", buffer);
ok(!lstrcmpA(buffer, "\r\n\r\n0\t_ForceCodepage\r\n"),
"Expected \"\r\n\r\n0\t_ForceCodepage\r\n\", got \"%s\"", buffer);
MsiCloseHandle(hdb);
DeleteFileA(msifile);
DeleteFileA("forcecodepage.idt");
}
static void test_viewmodify_refresh(void)
{
MSIHANDLE hdb, hview, hrec;
const char *query;
char buffer[MAX_PATH];
UINT r;
DWORD size;
DeleteFile(msifile);
r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
query = "CREATE TABLE `Table` ( `A` CHAR(72) NOT NULL, `B` INT PRIMARY KEY `A` )";
r = run_query(hdb, 0, query);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
query = "INSERT INTO `Table` ( `A`, `B` ) VALUES ( 'hi', 1 )";
r = run_query(hdb, 0, query);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
query = "SELECT * FROM `Table`";
r = MsiDatabaseOpenView(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);
r = MsiViewFetch(hview, &hrec);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
query = "UPDATE `Table` SET `B` = 2 WHERE `A` = 'hi'";
r = run_query(hdb, 0, query);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
r = MsiViewModify(hview, MSIMODIFY_REFRESH, hrec);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
size = MAX_PATH;
r = MsiRecordGetStringA(hrec, 1, buffer, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buffer, "hi"), "Expected \"hi\", got \"%s\"\n", buffer);
ok(size == 2, "Expected 2, got %d\n", size);
r = MsiRecordGetInteger(hrec, 2);
ok(r == 2, "Expected 2, got %d\n", r);
MsiCloseHandle(hrec);
MsiViewClose(hview);
MsiCloseHandle(hview);
query = "INSERT INTO `Table` ( `A`, `B` ) VALUES ( 'hello', 3 )";
r = run_query(hdb, 0, query);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
query = "SELECT * FROM `Table` WHERE `B` = 3";
r = MsiDatabaseOpenView(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);
r = MsiViewFetch(hview, &hrec);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
query = "UPDATE `Table` SET `B` = 2 WHERE `A` = 'hello'";
r = run_query(hdb, 0, query);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
query = "INSERT INTO `Table` ( `A`, `B` ) VALUES ( 'hithere', 3 )";
r = run_query(hdb, 0, query);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
r = MsiViewModify(hview, MSIMODIFY_REFRESH, hrec);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
size = MAX_PATH;
r = MsiRecordGetStringA(hrec, 1, buffer, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buffer, "hello"), "Expected \"hello\", got \"%s\"\n", buffer);
ok(size == 5, "Expected 5, got %d\n", size);
r = MsiRecordGetInteger(hrec, 2);
ok(r == 2, "Expected 2, got %d\n", r);
MsiCloseHandle(hrec);
MsiViewClose(hview);
MsiCloseHandle(hview);
MsiCloseHandle(hdb);
DeleteFileA(msifile);
}
START_TEST(db)
{
test_msidatabase();
@ -5534,4 +5878,7 @@ START_TEST(db)
test_deleterow();
test_quotes();
test_carriagereturn();
test_noquotes();
test_forcecodepage();
test_viewmodify_refresh();
}

View file

@ -21,6 +21,7 @@
#include <stdio.h>
#include <windows.h>
#include <shlwapi.h>
#include <msi.h>
#include <msiquery.h>
@ -2176,6 +2177,7 @@ static void test_formatrecord_tables(void)
CHAR buf[MAX_PATH];
CHAR curr_dir[MAX_PATH];
CHAR expected[MAX_PATH];
CHAR root[MAX_PATH];
DWORD size;
UINT r;
@ -2304,48 +2306,57 @@ static void test_formatrecord_tables(void)
r = MsiDoAction(hpkg, "CostFinalize");
ok( r == ERROR_SUCCESS, "CostFinalize failed: %d\n", r);
size = MAX_PATH;
MsiGetProperty( hpkg, "ROOTDRIVE", root, &size );
sprintf( expected, "1: %sfrontal.txt ", root);
/* frontal full file key */
size = MAX_PATH;
MsiRecordSetString( hrec, 1, "[#frontal_file]" );
r = MsiFormatRecord( hpkg, hrec, buf, &size );
ok( r == ERROR_SUCCESS, "format record failed: %d\n", r);
ok( !lstrcmp( buf, "1: C:\\frontal.txt " ), "Expected '1: C:\\frontal.txt ', got %s\n", buf);
ok( !lstrcmp( buf, expected ), "Expected \"%s\", got \"%s\"\n", expected, buf);
/* frontal short file key */
size = MAX_PATH;
MsiRecordSetString( hrec, 1, "[!frontal_file]" );
r = MsiFormatRecord( hpkg, hrec, buf, &size );
ok( r == ERROR_SUCCESS, "format record failed: %d\n", r);
ok( !lstrcmp( buf, "1: C:\\frontal.txt " ), "Expected '1: C:\\frontal.txt ', got %s\n", buf);
ok( !lstrcmp( buf, expected ), "Expected \"%s\", got \"%s\"\n", expected, buf);
sprintf( expected, "1: %sI am a really long directory\\temporal.txt ", root);
/* temporal full file key */
size = MAX_PATH;
MsiRecordSetString( hrec, 1, "[#temporal_file]" );
r = MsiFormatRecord( hpkg, hrec, buf, &size );
ok( r == ERROR_SUCCESS, "format record failed: %d\n", r);
ok( !lstrcmp( buf, "1: C:\\I am a really long directory\\temporal.txt " ),
"Expected '1: C:\\I am a really long directory\\temporal.txt ', got %s\n", buf);
ok( !lstrcmp( buf, expected ), "Expected \"%s\", got \"%s\"\n", expected, buf);
/* temporal short file key */
size = MAX_PATH;
MsiRecordSetString( hrec, 1, "[!temporal_file]" );
r = MsiFormatRecord( hpkg, hrec, buf, &size );
ok( r == ERROR_SUCCESS, "format record failed: %d\n", r);
ok( !lstrcmp( buf, "1: C:\\I am a really long directory\\temporal.txt " ),
"Expected '1: C:\\I am a really long directory\\temporal.txt ', got %s\n", buf);
ok( !lstrcmp( buf, expected ), "Expected \"%s\", got \"%s\"\n", expected, buf);
/* custom action 51, files don't exist */
r = MsiDoAction( hpkg, "MyCustom" );
ok( r == ERROR_SUCCESS, "MyCustom failed: %d\n", r);
sprintf( expected, "%sI am a really long directory\\temporal.txt", root);
size = MAX_PATH;
r = MsiGetProperty( hpkg, "prop", buf, &size );
ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
ok( !lstrcmp( buf, "C:\\I am a really long directory\\temporal.txt" ),
"Expected 'C:\\I am a really long directory\\temporal.txt', got %s\n", buf);
ok( !lstrcmp( buf, expected ), "Expected \"%s\", got \"%s\"\n", expected, buf);
CreateDirectory( "C:\\I am a really long directory", NULL );
create_test_file( "C:\\I am a really long directory\\temporal.txt" );
sprintf( buf, "%sI am a really long directory", root );
CreateDirectory( buf, NULL );
lstrcat( buf, "\\temporal.txt" );
create_test_file( buf );
/* custom action 51, files exist */
r = MsiDoAction( hpkg, "MyCustom" );
@ -2356,8 +2367,7 @@ static void test_formatrecord_tables(void)
ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
todo_wine
{
ok( !lstrcmp( buf, "C:\\I am a really long directory\\temporal.txt" ),
"Expected 'C:\\I am a really long directory\\temporal.txt', got %s\n", buf);
ok( !lstrcmp( buf, expected ), "Expected \"%s\", got \"%s\"\n", expected, buf);
}
/* custom action 51, escaped text 1 */
@ -2387,13 +2397,14 @@ static void test_formatrecord_tables(void)
ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
ok( !lstrcmp( buf, "" ), "Expected '', got %s\n", buf);
sprintf( expected, "1: %sI am a really long directory\\ ", root);
/* component with INSTALLSTATE_LOCAL */
size = MAX_PATH;
MsiRecordSetString( hrec, 1, "[$temporal]" );
r = MsiFormatRecord( hpkg, hrec, buf, &size );
ok( r == ERROR_SUCCESS, "format record failed: %d\n", r);
ok( !lstrcmp( buf, "1: C:\\I am a really long directory\\ " ),
"Expected '1: C:\\I am a really long directory\\ ', got %s\n", buf);
ok( !lstrcmp( buf, expected ), "Expected \"%s\", got \"%s\"\n", expected, buf);
r = MsiSetComponentState( hpkg, "temporal", INSTALLSTATE_SOURCE );
ok( r == ERROR_SUCCESS, "failed to set install state: %d\n", r);
@ -2408,8 +2419,11 @@ static void test_formatrecord_tables(void)
ok( r == ERROR_SUCCESS, "format record failed: %d\n", r);
ok( !lstrcmp( buf, expected ), "Expected '%s', got %s\n", expected, buf);
DeleteFile( "C:\\I am a really long directory\\temporal.txt" );
RemoveDirectory( "C:\\I am a really long directory" );
sprintf( buf, "%sI am a really long directory\\temporal.txt", root );
DeleteFile( buf );
sprintf( buf, "%sI am a really long directory", root );
RemoveDirectory( buf );
MsiCloseHandle( hrec );
MsiCloseHandle( hpkg );

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<group>
<module name="msi_winetest" type="win32cui" installbase="bin" installname="msi_winetest.exe" allowwarnings="true">
<module name="msi_winetest" type="win32cui" installbase="bin" installname="msi_winetest.exe" allowwarnings="true" entrypoint="0">
<include base="msi_winetest">.</include>
<define name="WINVER">0x600</define>
<define name="_WIN32_WINNT">0x600</define>

View file

@ -922,10 +922,12 @@ static void test_settargetpath(void)
sprintf( tempdir, "%s\\subdir", buffer );
r = MsiSetTargetPath( hpkg, "TARGETDIR", buffer );
ok( r == ERROR_SUCCESS, "MsiSetTargetPath on file returned %d\n", r );
ok( r == ERROR_SUCCESS || r == ERROR_DIRECTORY,
"MsiSetTargetPath on file returned %d\n", r );
r = MsiSetTargetPath( hpkg, "TARGETDIR", tempdir );
ok( r == ERROR_SUCCESS, "MsiSetTargetPath on 'subdir' of file returned %d\n", r );
ok( r == ERROR_SUCCESS || r == ERROR_DIRECTORY,
"MsiSetTargetPath on 'subdir' of file returned %d\n", r );
DeleteFile( buffer );
@ -986,6 +988,9 @@ static void test_condition(void)
r = MsiEvaluateCondition(hpkg, "0");
ok( r == MSICONDITION_FALSE, "wrong return val\n");
r = MsiEvaluateCondition(hpkg, "-1");
ok( r == MSICONDITION_TRUE, "wrong return val\n");
r = MsiEvaluateCondition(hpkg, "0 = 0");
ok( r == MSICONDITION_TRUE, "wrong return val\n");
@ -1622,6 +1627,10 @@ static void test_condition(void)
r = MsiEvaluateCondition(hpkg, "X !=\"\" and (X =\"5.0\" or X =\"5.1\" or X =\"6.0\")");
ok( r == MSICONDITION_ERROR, "wrong return val (%d)\n", r);
/* feature doesn't exist */
r = MsiEvaluateCondition(hpkg, "&nofeature");
ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
MsiCloseHandle( hpkg );
DeleteFile(msifile);
}
@ -4697,7 +4706,8 @@ static void test_installprops(void)
CHAR path[MAX_PATH];
CHAR buf[MAX_PATH];
DWORD size, type;
HKEY hkey;
LANGID langid;
HKEY hkey1, hkey2;
UINT r;
GetCurrentDirectory(MAX_PATH, path);
@ -4717,25 +4727,46 @@ static void test_installprops(void)
ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", &hkey);
RegOpenKey(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\MS Setup (ACME)\\User Info", &hkey1);
RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", &hkey2);
size = MAX_PATH;
type = REG_SZ;
RegQueryValueEx(hkey, "RegisteredOwner", NULL, &type, (LPBYTE)path, &size);
*path = '\0';
if (RegQueryValueEx(hkey1, "DefName", NULL, &type, (LPBYTE)path, &size) != ERROR_SUCCESS)
{
size = MAX_PATH;
type = REG_SZ;
RegQueryValueEx(hkey2, "RegisteredOwner", NULL, &type, (LPBYTE)path, &size);
}
/* win9x doesn't set this */
if (*path)
{
size = MAX_PATH;
r = MsiGetProperty(hpkg, "USERNAME", buf, &size);
ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
}
size = MAX_PATH;
type = REG_SZ;
RegQueryValueEx(hkey, "RegisteredOrganization", NULL, &type, (LPBYTE)path, &size);
*path = '\0';
if (RegQueryValueEx(hkey1, "DefCompany", NULL, &type, (LPBYTE)path, &size) != ERROR_SUCCESS)
{
size = MAX_PATH;
type = REG_SZ;
RegQueryValueEx(hkey2, "RegisteredOrganization", NULL, &type, (LPBYTE)path, &size);
}
if (*path)
{
size = MAX_PATH;
r = MsiGetProperty(hpkg, "COMPANYNAME", buf, &size);
ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
ok( !lstrcmp(buf, path), "Expected %s, got %s\n", path, buf);
}
size = MAX_PATH;
r = MsiGetProperty(hpkg, "VersionDatabase", buf, &size);
@ -4762,7 +4793,16 @@ static void test_installprops(void)
ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
trace("PackageCode = %s\n", buf);
CloseHandle(hkey);
langid = GetUserDefaultLangID();
sprintf(path, "%d", langid);
size = MAX_PATH;
r = MsiGetProperty(hpkg, "UserLanguageID", buf, &size);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS< got %d\n", r);
ok( !lstrcmpA(buf, path), "Expected \"%s\", got \"%s\"\n", path, buf);
CloseHandle(hkey1);
CloseHandle(hkey2);
MsiCloseHandle(hpkg);
DeleteFile(msifile);
}
@ -5294,7 +5334,8 @@ static void test_complocator(void)
lstrcpyA(expected, CURR_DIR);
lstrcatA(expected, "\\abelisaurus");
ok(!lstrcmpA(prop, expected), "Expected %s, got %s\n", expected, prop);
ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
"Expected %s or empty string, got %s\n", expected, prop);
size = MAX_PATH;
r = MsiGetPropertyA(hpkg, "BACTROSAURUS", prop, &size);
@ -5317,7 +5358,8 @@ static void test_complocator(void)
lstrcpyA(expected, CURR_DIR);
lstrcatA(expected, "\\");
ok(!lstrcmpA(prop, expected), "Expected %s, got %s\n", expected, prop);
ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
"Expected %s or empty string, got %s\n", expected, prop);
size = MAX_PATH;
r = MsiGetPropertyA(hpkg, "FALCARIUS", prop, &size);
@ -5360,7 +5402,8 @@ static void test_complocator(void)
lstrcpyA(expected, CURR_DIR);
lstrcatA(expected, "\\");
ok(!lstrcmpA(prop, expected), "Expected %s, got %s\n", expected, prop);
ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
"Expected %s or empty string, got %s\n", expected, prop);
size = MAX_PATH;
r = MsiGetPropertyA(hpkg, "NEOSODON", prop, &size);
@ -5368,7 +5411,8 @@ static void test_complocator(void)
lstrcpyA(expected, CURR_DIR);
lstrcatA(expected, "\\neosodon\\");
ok(!lstrcmpA(prop, expected), "Expected %s, got %s\n", expected, prop);
ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
"Expected %s or empty string, got %s\n", expected, prop);
size = MAX_PATH;
r = MsiGetPropertyA(hpkg, "OLOROTITAN", prop, &size);

View file

@ -351,7 +351,35 @@ static void test_msirecord(void)
DeleteFile(filename); /* Delete it for sure, when everything else is closed. */
}
static void test_MsiRecordGetString(void)
{
MSIHANDLE rec;
CHAR buf[MAX_PATH];
DWORD sz;
UINT r;
rec = MsiCreateRecord(2);
ok(rec != 0, "Expected a valid handle\n");
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiRecordGetString(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);
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);
MsiCloseHandle(rec);
}
START_TEST(record)
{
test_msirecord();
test_MsiRecordGetString();
}

File diff suppressed because it is too large Load diff

View file

@ -391,10 +391,11 @@ static void test_summary_binary(void)
type = 0;
r = MsiSummaryInfoGetProperty(hsuminfo, PID_LASTPRINTED, &type, NULL, NULL, sval, &sz);
ok(r == ERROR_SUCCESS, "MsiSummaryInfoGetProperty failed\n");
ok(!strcmp(sval, ""), "Expected empty string, got %s\n", sval);
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, "Expected 0, got %d\n", sz);
ok(sz == 0 || sz == 1, "Expected 0 or 1, got %d\n", sz);
}
ival = -1;

View file

@ -244,6 +244,16 @@ static void run_userhandling_tests(void)
usri.usri1_password = sTestUserOldPass;
ret = pNetUserAdd(NULL, 1, (LPBYTE)&usri, NULL);
if (ret == NERR_Success || ret == NERR_UserExists)
{
/* Windows NT4 does create the user. Delete the user and also if it already existed
* due to a previous test run on NT4.
*/
trace("We are on NT4, we have to delete the user with the too long username\n");
ret = pNetUserDel(NULL, sTooLongName);
ok(ret == NERR_Success, "Deleting the user failed : %d\n", ret);
}
else
ok(ret == NERR_BadUsername, "Adding user with too long username returned 0x%08x\n", ret);
usri.usri1_name = sTestUserName;
@ -256,7 +266,10 @@ static void run_userhandling_tests(void)
usri.usri1_password = sTooLongPassword;
ret = pNetUserAdd(NULL, 1, (LPBYTE)&usri, NULL);
ok(ret == NERR_BadUsername,
/* NT4 doesn't have a problem with the username so it will report the too long password
* as the error. NERR_PasswordTooShort is reported for all kind of password related errors.
*/
ok(ret == NERR_BadUsername || ret == NERR_PasswordTooShort,
"Adding user with too long username/password returned 0x%08x\n", ret);
usri.usri1_name = sTestUserName;
@ -283,7 +296,7 @@ static void run_userhandling_tests(void)
ret = pNetUserChangePassword(NULL, sNonexistentUser, sTestUserOldPass,
sTestUserNewPass);
ok(ret == NERR_UserNotFound,
ok(ret == NERR_UserNotFound || ret == ERROR_INVALID_PASSWORD,
"Changing password for nonexistent user returned 0x%08x.\n", ret);
ret = pNetUserChangePassword(NULL, sTestUserName, sTestUserOldPass,

View file

@ -1,17 +1,18 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<group>
<module name="netapi32_winetest" type="win32cui" installbase="bin" installname="netapi32_winetest.exe" allowwarnings="true" entrypoint="0">
<include base="netapi32_winetest">.</include>
<define name="WINVER">0x600</define>
<define name="_WIN32_WINNT">0x600</define>
<library>wine</library>
<library>netapi32</library>
<library>advapi32</library>
<library>kernel32</library>
<library>ntdll</library>
<file>access.c</file>
<file>apibuf.c</file>
<file>ds.c</file>
<file>wksta.c</file>
<file>testlist.c</file>
<library>wine</library>
<library>advapi32</library>
<library>kernel32</library>
<library>ntdll</library>
</module>
</group>

View file

@ -48,7 +48,7 @@ static int init_wksta_tests(void)
BOOL rc;
user_name[0] = 0;
dwSize = sizeof(user_name);
dwSize = sizeof(user_name)/sizeof(user_name[0]);
rc=GetUserNameW(user_name, &dwSize);
if (rc==FALSE && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED) {
skip("GetUserNameW is not implemented\n");
@ -57,7 +57,7 @@ static int init_wksta_tests(void)
ok(rc, "User Name Retrieved\n");
computer_name[0] = 0;
dwSize = sizeof(computer_name);
dwSize = sizeof(computer_name)/sizeof(computer_name[0]);
ok(GetComputerNameW(computer_name, &dwSize), "Computer Name Retrieved\n");
return 1;
}

View file

@ -1,14 +1,15 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<group>
<module name="odbccp32_winetest" type="win32cui" installbase="bin" installname="odbccp32_winetest.exe" allowwarnings="true" entrypoint="0">
<include base="odbccp32_winetest">.</include>
<define name="WINVER">0x600</define>
<define name="_WIN32_WINNT">0x600</define>
<library>wine</library>
<library>odbccp32</library>
<library>user32</library>
<library>kernel32</library>
<library>ntdll</library>
<file>misc.c</file>
<file>testlist.c</file>
<library>wine</library>
<library>odbccp32</library>
<library>kernel32</library>
<library>ntdll</library>
</module>
</group>

View file

@ -656,14 +656,60 @@ static void test_WM_GETTEXT(void)
{
HWND hwndRichEdit = new_richedit(NULL);
static const char text[] = "Hello. My name is RichEdit!";
static const char text2[] = "Hello. My name is RichEdit!\r";
static const char text2_after[] = "Hello. My name is RichEdit!\r\n";
char buffer[1024] = {0};
int result;
/* Baseline test with normal-sized buffer */
SendMessage(hwndRichEdit, WM_SETTEXT, 0, (LPARAM) text);
result = SendMessage(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM) buffer);
ok(result == lstrlen(buffer),
"WM_GETTEXT returned %d, expected %d\n", result, lstrlen(buffer));
SendMessage(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM) buffer);
result = strcmp(buffer,text);
ok(result == 0,
"WM_GETTEXT: settext and gettext differ. strcmp: %d\n", result);
/* Test for returned value of WM_GETTEXTLENGTH */
result = SendMessage(hwndRichEdit, WM_GETTEXTLENGTH, 0, 0);
ok(result == lstrlen(text),
"WM_GETTEXTLENGTH reports incorrect length %d, expected %d\n",
result, lstrlen(text));
/* Test for behavior in overflow case */
memset(buffer, 0, 1024);
result = SendMessage(hwndRichEdit, WM_GETTEXT, strlen(text), (LPARAM)buffer);
ok(result == 0,
"WM_GETTEXT returned %d, expected 0\n", result);
result = strcmp(buffer,text);
ok(result == 0,
"WM_GETTEXT: settext and gettext differ. strcmp: %d\n", result);
/* Baseline test with normal-sized buffer and carriage return */
SendMessage(hwndRichEdit, WM_SETTEXT, 0, (LPARAM) text2);
result = SendMessage(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM) buffer);
ok(result == lstrlen(buffer),
"WM_GETTEXT returned %d, expected %d\n", result, lstrlen(buffer));
result = strcmp(buffer,text2_after);
ok(result == 0,
"WM_GETTEXT: settext and gettext differ. strcmp: %d\n", result);
/* Test for returned value of WM_GETTEXTLENGTH */
result = SendMessage(hwndRichEdit, WM_GETTEXTLENGTH, 0, 0);
ok(result == lstrlen(text2_after),
"WM_GETTEXTLENGTH reports incorrect length %d, expected %d\n",
result, lstrlen(text2_after));
/* Test for behavior of CRLF conversion in case of overflow */
memset(buffer, 0, 1024);
result = SendMessage(hwndRichEdit, WM_GETTEXT, strlen(text2), (LPARAM)buffer);
ok(result == 0,
"WM_GETTEXT returned %d, expected 0\n", result);
result = strcmp(buffer,text2);
ok(result == 0,
"WM_GETTEXT: settext and gettext differ. strcmp: %d\n", result);
DestroyWindow(hwndRichEdit);
}
@ -1024,9 +1070,9 @@ static void test_WM_SETTEXT()
result = SendMessage(hwndRichEdit, WM_SETTEXT, 0, (LPARAM) a); \
ok (result == 1, "WM_SETTEXT returned %ld instead of 1\n", result); \
result = SendMessage(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM) buf); \
ok (result == strlen(buf), \
ok (result == lstrlen(buf), \
"WM_GETTEXT returned %ld instead of expected %u\n", \
result, strlen(buf)); \
result, lstrlen(buf)); \
result = strcmp(b, buf); \
ok(result == 0, \
"WM_SETTEXT round trip: strcmp = %ld\n", result);
@ -1116,6 +1162,33 @@ static void test_EM_SETTEXTEX(void)
ok(strcmp((const char *)buf, TestItem2_after) == 0,
"WM_GETTEXT did *not* see \\r converted to \\r\\n pairs.\n");
/* Baseline test for just-enough buffer space for string */
getText.cb = (lstrlenW(TestItem2) + 1) * sizeof(WCHAR);
getText.codepage = 1200; /* no constant for unicode */
getText.flags = GT_DEFAULT;
getText.lpDefaultChar = NULL;
getText.lpUsedDefChar = NULL;
memset(buf, 0, MAX_BUF_LEN);
SendMessage(hwndRichEdit, EM_GETTEXTEX, (WPARAM)&getText, (LPARAM) buf);
ok(lstrcmpW(buf, TestItem2) == 0,
"EM_GETTEXTEX results not what was set by EM_SETTEXTEX\n");
/* When there is enough space for one character, but not both, of the CRLF
pair at the end of the string, the CR is not copied at all. That is,
the caller must not see CRLF pairs truncated to CR at the end of the
string.
*/
getText.cb = (lstrlenW(TestItem2) + 1) * sizeof(WCHAR);
getText.codepage = 1200; /* no constant for unicode */
getText.flags = GT_USECRLF; /* <-- asking for CR -> CRLF conversion */
getText.lpDefaultChar = NULL;
getText.lpUsedDefChar = NULL;
memset(buf, 0, MAX_BUF_LEN);
SendMessage(hwndRichEdit, EM_GETTEXTEX, (WPARAM)&getText, (LPARAM) buf);
ok(lstrcmpW(buf, TestItem1) == 0,
"EM_GETTEXTEX results not what was set by EM_SETTEXTEX\n");
/* \r\n pairs get changed into \r */
setText.codepage = 1200; /* no constant for unicode */
getText.codepage = 1200; /* no constant for unicode */
@ -2443,8 +2516,10 @@ static void test_EM_GETTEXTLENGTHEX(void)
HWND hwnd;
GETTEXTLENGTHEX gtl;
int ret;
const char * base_string = "base string";
const char * test_string = "a\nb\n\n\r\n";
const char * test_string_after = "a";
const char * test_string_2 = "a\rtest\rstring";
char buffer[64] = {0};
/* single line */
@ -2462,6 +2537,18 @@ static void test_EM_GETTEXTLENGTHEX(void)
ret = SendMessageA(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)&gtl, 0);
ok(ret == 0, "ret %d\n",ret);
SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM) base_string);
gtl.flags = GTL_NUMCHARS | GTL_PRECISE | GTL_USECRLF;
gtl.codepage = CP_ACP;
ret = SendMessageA(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)&gtl, 0);
ok(ret == strlen(base_string), "ret %d\n",ret);
gtl.flags = GTL_NUMCHARS | GTL_PRECISE;
gtl.codepage = CP_ACP;
ret = SendMessageA(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)&gtl, 0);
ok(ret == strlen(base_string), "ret %d\n",ret);
SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM) test_string);
gtl.flags = GTL_NUMCHARS | GTL_PRECISE | GTL_USECRLF;
@ -2488,19 +2575,43 @@ static void test_EM_GETTEXTLENGTHEX(void)
gtl.flags = GTL_NUMCHARS | GTL_PRECISE | GTL_USECRLF;
gtl.codepage = CP_ACP;
ret = SendMessageA(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)&gtl, 0);
todo_wine ok(ret == 0, "ret %d\n",ret);
ok(ret == 0, "ret %d\n",ret);
gtl.flags = GTL_NUMCHARS | GTL_PRECISE;
gtl.codepage = CP_ACP;
ret = SendMessageA(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)&gtl, 0);
ok(ret == 0, "ret %d\n",ret);
SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM) base_string);
gtl.flags = GTL_NUMCHARS | GTL_PRECISE | GTL_USECRLF;
gtl.codepage = CP_ACP;
ret = SendMessageA(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)&gtl, 0);
ok(ret == strlen(base_string), "ret %d\n",ret);
gtl.flags = GTL_NUMCHARS | GTL_PRECISE;
gtl.codepage = CP_ACP;
ret = SendMessageA(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)&gtl, 0);
ok(ret == strlen(base_string), "ret %d\n",ret);
SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM) test_string_2);
gtl.flags = GTL_NUMCHARS | GTL_PRECISE | GTL_USECRLF;
gtl.codepage = CP_ACP;
ret = SendMessageA(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)&gtl, 0);
ok(ret == strlen(test_string_2) + 2, "ret %d\n",ret);
gtl.flags = GTL_NUMCHARS | GTL_PRECISE;
gtl.codepage = CP_ACP;
ret = SendMessageA(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)&gtl, 0);
ok(ret == strlen(test_string_2), "ret %d\n",ret);
SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM) test_string);
gtl.flags = GTL_NUMCHARS | GTL_PRECISE | GTL_USECRLF;
gtl.codepage = CP_ACP;
ret = SendMessageA(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)&gtl, 0);
todo_wine ok(ret == 10, "ret %d\n",ret);
ok(ret == 10, "ret %d\n",ret);
gtl.flags = GTL_NUMCHARS | GTL_PRECISE;
gtl.codepage = CP_ACP;

View file

@ -1,16 +1,17 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<group>
<module name="riched20_winetest" type="win32cui" installbase="bin" installname="riched20_winetest.exe" allowwarnings="true" entrypoint="0">
<include base="riched20_winetest">.</include>
<define name="WINVER">0x600</define>
<define name="_WIN32_WINNT">0x600</define>
<file>editor.c</file>
<file>testlist.c</file>
<library>wine</library>
<library>riched20</library>
<library>ole32</library>
<library>user32</library>
<library>gdi32</library>
<library>kernel32</library>
<library>ntdll</library>
<file>editor.c</file>
<file>testlist.c</file>
</module>
</group>

View file

@ -0,0 +1,166 @@
/*
* Unit test suite for rich edit control 1.0
*
* Copyright 2006 Google (Thomas Kho)
* Copyright 2007 Matt Finnicum
* Copyright 2007 Dmitry Timoshkov
* Copyright 2007 Alex Villacís Lasso
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
#include <assert.h>
#include <windef.h>
#include <winbase.h>
#include <wingdi.h>
#include <winuser.h>
#include <winnls.h>
#include <ole2.h>
#include <richedit.h>
#include <time.h>
#include <wine/test.h>
static HMODULE hmoduleRichEdit;
static HWND new_window(LPCTSTR lpClassName, DWORD dwStyle, HWND parent) {
HWND hwnd;
hwnd = CreateWindow(lpClassName, NULL, dwStyle|WS_POPUP|WS_HSCROLL|WS_VSCROLL
|WS_VISIBLE, 0, 0, 200, 60, parent, NULL,
hmoduleRichEdit, NULL);
ok(hwnd != NULL, "class: %s, error: %d\n", lpClassName, (int) GetLastError());
return hwnd;
}
static HWND new_richedit(HWND parent) {
return new_window(RICHEDIT_CLASS10A, ES_MULTILINE, parent);
}
static void test_WM_SETTEXT()
{
HWND hwndRichEdit = new_richedit(NULL);
const char * TestItem1 = "TestSomeText";
const char * TestItem2 = "TestSomeText\r";
const char * TestItem3 = "TestSomeText\rSomeMoreText\r";
const char * TestItem4 = "TestSomeText\n\nTestSomeText";
const char * TestItem5 = "TestSomeText\r\r\nTestSomeText";
const char * TestItem6 = "TestSomeText\r\r\n\rTestSomeText";
const char * TestItem7 = "TestSomeText\r\n\r\r\n\rTestSomeText";
const char * TestItem8 = "TestSomeText\r\n";
const char * TestItem9 = "TestSomeText\r\nSomeMoreText\r\n";
const char * TestItem10 = "TestSomeText\r\n\r\nTestSomeText";
const char * TestItem11 = "TestSomeText TestSomeText";
const char * TestItem12 = "TestSomeText \r\nTestSomeText";
const char * TestItem13 = "TestSomeText\r\n \r\nTestSomeText";
char buf[1024] = {0};
LRESULT result;
/* This test attempts to show that WM_SETTEXT on a riched32 control does not
attempt to modify the text that is pasted into the control, and should
return it as is. In particular, \r\r\n is NOT converted, unlike riched20.
Currently, builtin riched32 mangles solitary \r or \n when not part of
a \r\n pair.
*/
#define TEST_SETTEXT(a, b, is_todo) \
result = SendMessage(hwndRichEdit, WM_SETTEXT, 0, (LPARAM) a); \
ok (result == 1, "WM_SETTEXT returned %ld instead of 1\n", result); \
result = SendMessage(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM) buf); \
ok (result == lstrlen(buf), \
"WM_GETTEXT returned %ld instead of expected %u\n", \
result, lstrlen(buf)); \
result = strcmp(b, buf); \
if (is_todo) todo_wine { \
ok(result == 0, \
"WM_SETTEXT round trip: strcmp = %ld\n", result); \
} else { \
ok(result == 0, \
"WM_SETTEXT round trip: strcmp = %ld\n", result); \
}
TEST_SETTEXT(TestItem1, TestItem1, 0)
TEST_SETTEXT(TestItem2, TestItem2, 1)
TEST_SETTEXT(TestItem3, TestItem3, 1)
TEST_SETTEXT(TestItem4, TestItem4, 1)
TEST_SETTEXT(TestItem5, TestItem5, 1)
TEST_SETTEXT(TestItem6, TestItem6, 1)
TEST_SETTEXT(TestItem7, TestItem7, 1)
TEST_SETTEXT(TestItem8, TestItem8, 0)
TEST_SETTEXT(TestItem9, TestItem9, 0)
TEST_SETTEXT(TestItem10, TestItem10, 0)
TEST_SETTEXT(TestItem11, TestItem11, 0)
TEST_SETTEXT(TestItem12, TestItem12, 0)
TEST_SETTEXT(TestItem13, TestItem13, 0)
#undef TEST_SETTEXT
DestroyWindow(hwndRichEdit);
}
static void test_WM_GETTEXTLENGTH(void)
{
HWND hwndRichEdit = new_richedit(NULL);
static const char text3[] = "aaa\r\nbbb\r\nccc\r\nddd\r\neee";
static const char text4[] = "aaa\r\nbbb\r\nccc\r\nddd\r\neee\r\n";
int result;
/* Test for WM_GETTEXTLENGTH */
SendMessage(hwndRichEdit, WM_SETTEXT, 0, (LPARAM) text3);
result = SendMessage(hwndRichEdit, WM_GETTEXTLENGTH, 0, 0);
ok(result == lstrlen(text3),
"WM_GETTEXTLENGTH reports incorrect length %d, expected %d\n",
result, lstrlen(text3));
SendMessage(hwndRichEdit, WM_SETTEXT, 0, (LPARAM) text4);
result = SendMessage(hwndRichEdit, WM_GETTEXTLENGTH, 0, 0);
ok(result == lstrlen(text4),
"WM_GETTEXTLENGTH reports incorrect length %d, expected %d\n",
result, lstrlen(text4));
DestroyWindow(hwndRichEdit);
}
START_TEST( editor )
{
MSG msg;
time_t end;
/* Must explicitly LoadLibrary(). The test has no references to functions in
* RICHED32.DLL, so the linker doesn't actually link to it. */
hmoduleRichEdit = LoadLibrary("RICHED32.DLL");
ok(hmoduleRichEdit != NULL, "error: %d\n", (int) GetLastError());
test_WM_SETTEXT();
test_WM_GETTEXTLENGTH();
/* Set the environment variable WINETEST_RICHED32 to keep windows
* responsive and open for 30 seconds. This is useful for debugging.
*
* The message pump uses PeekMessage() to empty the queue and then sleeps for
* 50ms before retrying the queue. */
end = time(NULL) + 30;
if (getenv( "WINETEST_RICHED32" )) {
while (time(NULL) < end) {
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
} else {
Sleep(50);
}
}
}
OleFlushClipboard();
ok(FreeLibrary(hmoduleRichEdit) != 0, "error: %d\n", (int) GetLastError());
}

View file

@ -0,0 +1,16 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<group>
<module name="riched32_winetest" type="win32cui" installbase="bin" installname="riched32_winetest.exe" allowwarnings="true" entrypoint="0">
<include base="riched32_winetest">.</include>
<define name="WINVER">0x600</define>
<define name="_WIN32_WINNT">0x600</define>
<file>editor.c</file>
<file>testlist.c</file>
<library>wine</library>
<library>ole32</library>
<library>user32</library>
<library>kernel32</library>
<library>ntdll</library>
</module>
</group>

View file

@ -0,0 +1,15 @@
/* Automatically generated file; DO NOT EDIT!! */
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#define STANDALONE
#include "wine/test.h"
extern void func_editor(void);
const struct test winetest_testlist[] =
{
{ "editor", func_editor },
{ 0, 0 }
};

View file

@ -175,11 +175,19 @@ static void test_prov(void)
DWORD dwLen, dwInc;
dwLen = (DWORD)sizeof(DWORD);
SetLastError(0xdeadbeef);
result = CryptGetProvParam(hProv, PP_SIG_KEYSIZE_INC, (BYTE*)&dwInc, &dwLen, 0);
if (!result && GetLastError() == NTE_BAD_TYPE)
skip("PP_SIG_KEYSIZE_INC is not supported (win9x or NT)\n");
else
ok(result && dwInc==8, "%08x, %d\n", GetLastError(), dwInc);
dwLen = (DWORD)sizeof(DWORD);
SetLastError(0xdeadbeef);
result = CryptGetProvParam(hProv, PP_KEYX_KEYSIZE_INC, (BYTE*)&dwInc, &dwLen, 0);
if (!result && GetLastError() == NTE_BAD_TYPE)
skip("PP_KEYX_KEYSIZE_INC is not supported (win9x or NT)\n");
else
ok(result && dwInc==8, "%08x, %d\n", GetLastError(), dwInc);
}
@ -1823,7 +1831,11 @@ static void test_null_provider(void)
ok(result && dataLen == sizeof(dwParam) && (dwParam & CRYPT_SEC_DESCR),
"Expected CRYPT_SEC_DESCR to be set, got 0x%08X\n",dwParam);
dataLen = sizeof(keySpec);
SetLastError(0xdeadbeef);
result = CryptGetProvParam(prov, PP_KEYSPEC, (LPBYTE)&keySpec, &dataLen, 0);
if (!result && GetLastError() == NTE_BAD_TYPE)
skip("PP_KEYSPEC is not supported (win9x or NT)\n");
else
ok(result && keySpec == (AT_KEYEXCHANGE | AT_SIGNATURE),
"Expected AT_KEYEXCHANGE | AT_SIGNATURE, got %08x\n", keySpec);
/* PP_CONTAINER parameter */
@ -1834,9 +1846,13 @@ static void test_null_provider(void)
(result)? "TRUE":"FALSE",GetLastError(),dataLen);
/* PP_UNIQUE_CONTAINER parameter */
dataLen = sizeof(szName);
SetLastError(0xdeadbeef);
result = CryptGetProvParam(prov, PP_UNIQUE_CONTAINER, (LPBYTE)szName, &dataLen, 0);
if (!result && GetLastError() == NTE_BAD_TYPE)
skip("PP_UNIQUE_CONTAINER is not supported (win9x or NT)\n");
else
ok(result && dataLen == strlen(szContainer)+1 && strcmp(szContainer,szName) == 0,
"failed getting PP_CONTAINER. result = %s. Error 0x%08X. returned length = %d\n",
"failed getting PP_UNIQUE_CONTAINER. result = %s. Error 0x%08X. returned length = %d\n",
(result)? "TRUE":"FALSE",GetLastError(),dataLen);
result = CryptGetUserKey(prov, AT_KEYEXCHANGE, &key);
ok(!result && GetLastError() == NTE_NO_KEY,

View file

@ -5,11 +5,11 @@
<include base="rsaenh_winetest">.</include>
<define name="WINVER">0x600</define>
<define name="_WIN32_WINNT">0x600</define>
<file>rsaenh.c</file>
<file>testlist.c</file>
<library>wine</library>
<library>advapi32</library>
<library>kernel32</library>
<library>ntdll</library>
<file>rsaenh.c</file>
<file>testlist.c</file>
</module>
</group>

View file

@ -21,7 +21,7 @@
#include "wine/test.h"
/***********************************************************************
* Compability macros
* Compatibility macros
*/
#define DWORD_PTR UINT_PTR

View file

@ -0,0 +1,577 @@
/* Unit test suite for SHLWAPI ShCreateStreamOnFile functions.
*
* Copyright 2008 Reece H. Dunn
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define COBJMACROS
#include <stdarg.h>
#include <stdio.h>
#include "wine/test.h"
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "shlwapi.h"
/* Function pointers for the SHCreateStreamOnFile functions */
static HMODULE hShlwapi;
static HRESULT (WINAPI *pSHCreateStreamOnFileA)(LPCSTR file, DWORD mode, IStream **stream);
static HRESULT (WINAPI *pSHCreateStreamOnFileW)(LPCWSTR file, DWORD mode, IStream **stream);
static HRESULT (WINAPI *pSHCreateStreamOnFileEx)(LPCWSTR file, DWORD mode, DWORD attributes, BOOL create, IStream *template, IStream **stream);
static void test_IStream_invalid_operations(IStream * stream, DWORD mode)
{
HRESULT ret;
IStream * clone;
ULONG refcount;
ULARGE_INTEGER uzero;
ULARGE_INTEGER uret;
LARGE_INTEGER zero;
ULONG count;
char data[256];
U(uzero).HighPart = 0;
U(uzero).LowPart = 0;
U(uret).HighPart = 0;
U(uret).LowPart = 0;
U(zero).HighPart = 0;
U(zero).LowPart = 0;
/* IStream::Read */
/* IStream_Read from the COBJMACROS is undefined by shlwapi.h, replaced by the IStream_Read helper function. */
ret = stream->lpVtbl->Read(stream, NULL, 0, &count);
ok(ret == S_OK, "expected S_OK, got 0x%08x\n", ret);
ret = stream->lpVtbl->Read(stream, data, 5, NULL);
ok(ret == S_FALSE || ret == S_OK, "expected S_FALSE or S_OK, got 0x%08x\n", ret);
ret = stream->lpVtbl->Read(stream, data, 0, NULL);
ok(ret == S_OK, "expected S_OK, got 0x%08x\n", ret);
ret = stream->lpVtbl->Read(stream, data, 3, &count);
ok(ret == S_FALSE || ret == S_OK, "expected S_FALSE or S_OK, got 0x%08x\n", ret);
/* IStream::Write */
/* IStream_Write from the COBJMACROS is undefined by shlwapi.h, replaced by the IStream_Write helper function. */
ret = stream->lpVtbl->Write(stream, NULL, 0, &count);
if (mode == STGM_READ)
ok(ret == STG_E_ACCESSDENIED, "expected STG_E_ACCESSDENIED, got 0x%08x\n", ret);
else
ok(ret == S_OK, "expected S_OK, got 0x%08x\n", ret);
strcpy(data, "Hello");
ret = stream->lpVtbl->Write(stream, data, 5, NULL);
if (mode == STGM_READ)
ok(ret == STG_E_ACCESSDENIED, "expected STG_E_ACCESSDENIED, got 0x%08x\n", ret);
else
ok(ret == S_OK, "expected S_OK, got 0x%08x\n", ret);
strcpy(data, "Hello");
ret = stream->lpVtbl->Write(stream, data, 0, NULL);
if (mode == STGM_READ)
ok(ret == STG_E_ACCESSDENIED, "expected STG_E_ACCESSDENIED, got 0x%08x\n", ret);
else
ok(ret == S_OK, "expected S_OK, got 0x%08x\n", ret);
strcpy(data, "Hello");
ret = stream->lpVtbl->Write(stream, data, 0, &count);
if (mode == STGM_READ)
ok(ret == STG_E_ACCESSDENIED, "expected STG_E_ACCESSDENIED, got 0x%08x\n", ret);
else
ok(ret == S_OK, "expected S_OK, got 0x%08x\n", ret);
strcpy(data, "Hello");
ret = stream->lpVtbl->Write(stream, data, 3, &count);
if (mode == STGM_READ)
ok(ret == STG_E_ACCESSDENIED, "expected STG_E_ACCESSDENIED, got 0x%08x\n", ret);
else
ok(ret == S_OK, "expected S_OK, got 0x%08x\n", ret);
/* IStream::Seek */
ret = IStream_Seek(stream, zero, STREAM_SEEK_SET, NULL);
ok(ret == S_OK, "expected S_OK, got 0x%08x\n", ret);
ret = IStream_Seek(stream, zero, 20, NULL);
ok(ret == E_INVALIDARG, "expected E_INVALIDARG, got 0x%08x\n", ret);
/* IStream::CopyTo */
ret = IStream_CopyTo(stream, NULL, uzero, &uret, &uret);
ok(ret == S_OK, "expected S_OK, got 0x%08x\n", ret);
clone = NULL;
ret = IStream_CopyTo(stream, clone, uzero, &uret, &uret);
ok(ret == S_OK, "expected S_OK, got 0x%08x\n", ret);
ret = IStream_CopyTo(stream, stream, uzero, &uret, &uret);
ok(ret == S_OK, "expected S_OK, got 0x%08x\n", ret);
ret = IStream_CopyTo(stream, stream, uzero, &uret, NULL);
ok(ret == S_OK, "expected S_OK, got 0x%08x\n", ret);
ret = IStream_CopyTo(stream, stream, uzero, NULL, &uret);
ok(ret == S_OK, "expected S_OK, got 0x%08x\n", ret);
/* IStream::Commit */
ret = IStream_Commit(stream, STGC_DEFAULT);
ok(ret == S_OK, "expected S_OK, got 0x%08x\n", ret);
/* IStream::Revert */
ret = IStream_Revert(stream);
ok(ret == E_NOTIMPL, "expected E_NOTIMPL, got 0x%08x\n", ret);
/* IStream::LockRegion */
ret = IStream_LockRegion(stream, uzero, uzero, 0);
ok(ret == E_NOTIMPL /* XP */ || ret == S_OK /* Vista */,
"expected E_NOTIMPL or S_OK, got 0x%08x\n", ret);
/* IStream::UnlockRegion */
if (ret == E_NOTIMPL) /* XP */ {
ret = IStream_UnlockRegion(stream, uzero, uzero, 0);
ok(ret == E_NOTIMPL, "expected E_NOTIMPL, got 0x%08x\n", ret);
} else /* Vista */ {
ret = IStream_UnlockRegion(stream, uzero, uzero, 0);
ok(ret == S_OK, "expected S_OK, got 0x%08x\n", ret);
ret = IStream_UnlockRegion(stream, uzero, uzero, 0);
ok(ret == STG_E_LOCKVIOLATION, "expected STG_E_LOCKVIOLATION, got 0x%08x\n", ret);
}
/* IStream::Stat */
ret = IStream_Stat(stream, NULL, 0);
ok(ret == STG_E_INVALIDPOINTER, "expected STG_E_INVALIDPOINTER, got 0x%08x\n", ret);
/* IStream::Clone */
ret = IStream_Clone(stream, NULL);
ok(ret == E_NOTIMPL, "expected E_NOTIMPL, got 0x%08x\n", ret);
clone = NULL;
ret = IStream_Clone(stream, &clone);
ok(ret == E_NOTIMPL, "expected E_NOTIMPL, got 0x%08x\n", ret);
ok(clone == NULL, "expected a NULL IStream object, got %p\n", stream);
if (clone) {
refcount = IStream_Release(clone);
ok(refcount == 0, "expected 0, got %d\n", refcount);
}
}
static void test_SHCreateStreamOnFileA(DWORD mode)
{
IStream * stream;
HRESULT ret;
ULONG refcount;
static const char * test_file = "c:\\test.txt";
trace("SHCreateStreamOnFileA: testing mode %d\n", mode);
/* invalid arguments */
stream = NULL;
ret = (*pSHCreateStreamOnFileA)(NULL, mode, &stream);
todo_wine
ok(ret == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND), "SHCreateStreamOnFileA: expected HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND), got 0x%08x\n", ret);
ok(stream == NULL, "SHCreateStreamOnFileA: expected a NULL IStream object, got %p\n", stream);
#if 0 /* This test crashes on WinXP SP2 */
ret = (*pSHCreateStreamOnFileA)(test_file, mode, NULL);
ok(ret == E_INVALIDARG, "SHCreateStreamOnFileA: expected E_INVALIDARG, got 0x%08x\n", ret);
#endif
stream = NULL;
ret = (*pSHCreateStreamOnFileA)(test_file, mode | STGM_CONVERT, &stream);
ok(ret == E_INVALIDARG, "SHCreateStreamOnFileA: expected E_INVALIDARG, got 0x%08x\n", ret);
ok(stream == NULL, "SHCreateStreamOnFileA: expected a NULL IStream object, got %p\n", stream);
stream = NULL;
ret = (*pSHCreateStreamOnFileA)(test_file, mode | STGM_DELETEONRELEASE, &stream);
ok(ret == E_INVALIDARG, "SHCreateStreamOnFileA: expected E_INVALIDARG, got 0x%08x\n", ret);
ok(stream == NULL, "SHCreateStreamOnFileA: expected a NULL IStream object, got %p\n", stream);
stream = NULL;
ret = (*pSHCreateStreamOnFileA)(test_file, mode | STGM_TRANSACTED, &stream);
ok(ret == E_INVALIDARG, "SHCreateStreamOnFileA: expected E_INVALIDARG, got 0x%08x\n", ret);
ok(stream == NULL, "SHCreateStreamOnFileA: expected a NULL IStream object, got %p\n", stream);
/* file does not exist */
stream = NULL;
ret = (*pSHCreateStreamOnFileA)(test_file, mode | STGM_FAILIFTHERE, &stream);
todo_wine
ok(ret == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "SHCreateStreamOnFileA: expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got 0x%08x\n", ret);
ok(stream == NULL, "SHCreateStreamOnFileA: expected a NULL IStream object, got %p\n", stream);
stream = NULL;
ret = (*pSHCreateStreamOnFileA)(test_file, mode | STGM_CREATE, &stream);
todo_wine
ok(ret == S_OK, "SHCreateStreamOnFileA: expected S_OK, got 0x%08x\n", ret);
todo_wine
ok(stream != NULL, "SHCreateStreamOnFileA: expected a valid IStream object, got NULL\n");
if (stream) {
test_IStream_invalid_operations(stream, mode);
refcount = IStream_Release(stream);
ok(refcount == 0, "SHCreateStreamOnFileA: expected 0, got %d\n", refcount);
}
/* NOTE: don't delete the file, as it will be used for the file exists tests. */
/* file exists */
stream = NULL;
ret = (*pSHCreateStreamOnFileA)(test_file, mode | STGM_FAILIFTHERE, &stream);
todo_wine
ok(ret == S_OK, "SHCreateStreamOnFileA: expected S_OK, got 0x%08x\n", ret);
todo_wine
ok(stream != NULL, "SHCreateStreamOnFileA: expected a valid IStream object, got NULL\n");
if (stream) {
test_IStream_invalid_operations(stream, mode);
refcount = IStream_Release(stream);
ok(refcount == 0, "SHCreateStreamOnFileA: expected 0, got %d\n", refcount);
}
stream = NULL;
ret = (*pSHCreateStreamOnFileA)(test_file, mode | STGM_CREATE, &stream);
todo_wine
ok(ret == S_OK, "SHCreateStreamOnFileA: expected S_OK, got 0x%08x\n", ret);
todo_wine
ok(stream != NULL, "SHCreateStreamOnFileA: expected a valid IStream object, got NULL\n");
if (stream) {
test_IStream_invalid_operations(stream, mode);
refcount = IStream_Release(stream);
ok(refcount == 0, "SHCreateStreamOnFileA: expected 0, got %d\n", refcount);
ok(DeleteFileA(test_file), "SHCreateStreamOnFileA: could not delete file '%s', got error %d\n", test_file, GetLastError());
}
}
static void test_SHCreateStreamOnFileW(DWORD mode)
{
IStream * stream;
HRESULT ret;
ULONG refcount;
static const WCHAR test_file[] = { 'c', ':', '\\', 't', 'e', 's', 't', '.', 't', 'x', 't', '\0' };
trace("SHCreateStreamOnFileW: testing mode %d\n", mode);
/* invalid arguments */
stream = NULL;
ret = (*pSHCreateStreamOnFileW)(NULL, mode, &stream);
ok(ret == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) || /* XP */
ret == E_INVALIDARG /* Vista */,
"SHCreateStreamOnFileW: expected HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) or E_INVALIDARG, got 0x%08x\n", ret);
ok(stream == NULL, "SHCreateStreamOnFileW: expected a NULL IStream object, got %p\n", stream);
#if 0 /* This test crashes on WinXP SP2 */
ret = (*pSHCreateStreamOnFileW)(test_file, mode, NULL);
ok(ret == E_INVALIDARG, "SHCreateStreamOnFileW: expected E_INVALIDARG, got 0x%08x\n", ret);
#endif
stream = NULL;
ret = (*pSHCreateStreamOnFileW)(test_file, mode | STGM_CONVERT, &stream);
ok(ret == E_INVALIDARG, "SHCreateStreamOnFileW: expected E_INVALIDARG, got 0x%08x\n", ret);
ok(stream == NULL, "SHCreateStreamOnFileW: expected a NULL IStream object, got %p\n", stream);
stream = NULL;
ret = (*pSHCreateStreamOnFileW)(test_file, mode | STGM_DELETEONRELEASE, &stream);
ok(ret == E_INVALIDARG, "SHCreateStreamOnFileW: expected E_INVALIDARG, got 0x%08x\n", ret);
ok(stream == NULL, "SHCreateStreamOnFileW: expected a NULL IStream object, got %p\n", stream);
stream = NULL;
ret = (*pSHCreateStreamOnFileW)(test_file, mode | STGM_TRANSACTED, &stream);
ok(ret == E_INVALIDARG, "SHCreateStreamOnFileW: expected E_INVALIDARG, got 0x%08x\n", ret);
ok(stream == NULL, "SHCreateStreamOnFileW: expected a NULL IStream object, got %p\n", stream);
/* file does not exist */
stream = NULL;
ret = (*pSHCreateStreamOnFileW)(test_file, mode | STGM_FAILIFTHERE, &stream);
todo_wine
ok(ret == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "SHCreateStreamOnFileW: expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got 0x%08x\n", ret);
ok(stream == NULL, "SHCreateStreamOnFileW: expected a NULL IStream object, got %p\n", stream);
stream = NULL;
ret = (*pSHCreateStreamOnFileW)(test_file, mode | STGM_CREATE, &stream);
todo_wine
ok(ret == S_OK, "SHCreateStreamOnFileW: expected S_OK, got 0x%08x\n", ret);
todo_wine
ok(stream != NULL, "SHCreateStreamOnFileW: expected a valid IStream object, got NULL\n");
if (stream) {
test_IStream_invalid_operations(stream, mode);
refcount = IStream_Release(stream);
ok(refcount == 0, "SHCreateStreamOnFileW: expected 0, got %d\n", refcount);
}
/* NOTE: don't delete the file, as it will be used for the file exists tests. */
/* file exists */
stream = NULL;
ret = (*pSHCreateStreamOnFileW)(test_file, mode | STGM_FAILIFTHERE, &stream);
todo_wine
ok(ret == S_OK, "SHCreateStreamOnFileW: expected S_OK, got 0x%08x\n", ret);
todo_wine
ok(stream != NULL, "SHCreateStreamOnFileW: expected a valid IStream object, got NULL\n");
if (stream) {
test_IStream_invalid_operations(stream, mode);
refcount = IStream_Release(stream);
ok(refcount == 0, "SHCreateStreamOnFileW: expected 0, got %d\n", refcount);
}
stream = NULL;
ret = (*pSHCreateStreamOnFileW)(test_file, mode | STGM_CREATE, &stream);
todo_wine
ok(ret == S_OK, "SHCreateStreamOnFileW: expected S_OK, got 0x%08x\n", ret);
todo_wine
ok(stream != NULL, "SHCreateStreamOnFileW: expected a valid IStream object, got NULL\n");
if (stream) {
test_IStream_invalid_operations(stream, mode);
refcount = IStream_Release(stream);
ok(refcount == 0, "SHCreateStreamOnFileW: expected 0, got %d\n", refcount);
ok(DeleteFileW(test_file), "SHCreateStreamOnFileW: could not delete the test file, got error %d\n", GetLastError());
}
}
static void test_SHCreateStreamOnFileEx(DWORD mode, DWORD stgm)
{
IStream * stream;
IStream * template = NULL;
HRESULT ret;
ULONG refcount;
static const WCHAR test_file[] = { 'c', ':', '\\', 't', 'e', 's', 't', '.', 't', 'x', 't', '\0' };
trace("SHCreateStreamOnFileEx: testing mode %d, STGM flags %08x\n", mode, stgm);
/* invalid arguments */
stream = NULL;
ret = (*pSHCreateStreamOnFileEx)(NULL, mode, 0, FALSE, NULL, &stream);
ok(ret == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) || /* XP */
ret == E_INVALIDARG /* Vista */,
"SHCreateStreamOnFileEx: expected HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) or E_INVALIDARG, got 0x%08x\n", ret);
ok(stream == NULL, "SHCreateStreamOnFileEx: expected a NULL IStream object, got %p\n", stream);
stream = NULL;
ret = (*pSHCreateStreamOnFileEx)(test_file, mode, 0, FALSE, template, &stream);
todo_wine
ok(ret == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "SHCreateStreamOnFileEx: expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got 0x%08x\n", ret);
ok(stream == NULL, "SHCreateStreamOnFileEx: expected a NULL IStream object, got %p\n", stream);
#if 0 /* This test crashes on WinXP SP2 */
ret = (*pSHCreateStreamOnFileEx)(test_file, mode, 0, FALSE, NULL, NULL);
ok(ret == E_INVALIDARG, "SHCreateStreamOnFileEx: expected E_INVALIDARG, got 0x%08x\n", ret);
#endif
/* file does not exist */
stream = NULL;
ret = (*pSHCreateStreamOnFileEx)(test_file, mode | STGM_FAILIFTHERE | stgm, 0, FALSE, NULL, &stream);
if ((stgm & STGM_TRANSACTED) == STGM_TRANSACTED && mode == STGM_READ) {
ok(ret == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) /* XP */ || ret == E_INVALIDARG /* Vista */,
"SHCreateStreamOnFileEx: expected E_INVALIDARG or HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got 0x%08x\n", ret);
if (ret == E_INVALIDARG) {
skip("SHCreateStreamOnFileEx: STGM_TRANSACTED not supported in this configuration.\n");
return;
}
} else {
todo_wine
ok(ret == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "SHCreateStreamOnFileEx: expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got 0x%08x\n", ret);
}
ok(stream == NULL, "SHCreateStreamOnFileEx: expected a NULL IStream object, got %p\n", stream);
stream = NULL;
ret = (*pSHCreateStreamOnFileEx)(test_file, mode | STGM_FAILIFTHERE | stgm, 0, TRUE, NULL, &stream);
todo_wine
ok(ret == S_OK, "SHCreateStreamOnFileEx: expected S_OK, got 0x%08x\n", ret);
todo_wine
ok(stream != NULL, "SHCreateStreamOnFileEx: expected a valid IStream object, got NULL\n");
if (stream) {
test_IStream_invalid_operations(stream, mode);
refcount = IStream_Release(stream);
ok(refcount == 0, "SHCreateStreamOnFileEx: expected 0, got %d\n", refcount);
ok(DeleteFileW(test_file), "SHCreateStreamOnFileEx: could not delete the test file, got error %d\n", GetLastError());
}
stream = NULL;
ret = (*pSHCreateStreamOnFileEx)(test_file, mode | STGM_CREATE | stgm, 0, FALSE, NULL, &stream);
todo_wine
ok(ret == S_OK, "SHCreateStreamOnFileEx: expected S_OK, got 0x%08x\n", ret);
todo_wine
ok(stream != NULL, "SHCreateStreamOnFileEx: expected a valid IStream object, got NULL\n");
if (stream) {
test_IStream_invalid_operations(stream, mode);
refcount = IStream_Release(stream);
ok(refcount == 0, "SHCreateStreamOnFileEx: expected 0, got %d\n", refcount);
ok(DeleteFileW(test_file), "SHCreateStreamOnFileEx: could not delete the test file, got error %d\n", GetLastError());
}
stream = NULL;
ret = (*pSHCreateStreamOnFileEx)(test_file, mode | STGM_CREATE | stgm, 0, TRUE, NULL, &stream);
todo_wine
ok(ret == S_OK, "SHCreateStreamOnFileEx: expected S_OK, got 0x%08x\n", ret);
todo_wine
ok(stream != NULL, "SHCreateStreamOnFileEx: expected a valid IStream object, got NULL\n");
if (stream) {
test_IStream_invalid_operations(stream, mode);
refcount = IStream_Release(stream);
ok(refcount == 0, "SHCreateStreamOnFileEx: expected 0, got %d\n", refcount);
}
/* NOTE: don't delete the file, as it will be used for the file exists tests. */
/* file exists */
stream = NULL;
ret = (*pSHCreateStreamOnFileEx)(test_file, mode | STGM_FAILIFTHERE | stgm, 0, FALSE, NULL, &stream);
todo_wine
ok(ret == S_OK, "SHCreateStreamOnFileEx: expected S_OK, got 0x%08x\n", ret);
todo_wine
ok(stream != NULL, "SHCreateStreamOnFileEx: expected a valid IStream object, got NULL\n");
if (stream) {
test_IStream_invalid_operations(stream, mode);
refcount = IStream_Release(stream);
ok(refcount == 0, "SHCreateStreamOnFileEx: expected 0, got %d\n", refcount);
}
stream = NULL;
ret = (*pSHCreateStreamOnFileEx)(test_file, mode | STGM_FAILIFTHERE | stgm, 0, TRUE, NULL, &stream);
todo_wine
ok(ret == HRESULT_FROM_WIN32(ERROR_FILE_EXISTS), "SHCreateStreamOnFileEx: expected HRESULT_FROM_WIN32(ERROR_FILE_EXISTS), got 0x%08x\n", ret);
ok(stream == NULL, "SHCreateStreamOnFileEx: expected a NULL IStream object, got %p\n", stream);
stream = NULL;
ret = (*pSHCreateStreamOnFileEx)(test_file, mode | STGM_CREATE | stgm, 0, FALSE, NULL, &stream);
todo_wine
ok(ret == S_OK, "SHCreateStreamOnFileEx: expected S_OK, got 0x%08x\n", ret);
todo_wine
ok(stream != NULL, "SHCreateStreamOnFileEx: expected a valid IStream object, got NULL\n");
if (stream) {
test_IStream_invalid_operations(stream, mode);
refcount = IStream_Release(stream);
ok(refcount == 0, "SHCreateStreamOnFileEx: expected 0, got %d\n", refcount);
}
stream = NULL;
ret = (*pSHCreateStreamOnFileEx)(test_file, mode | STGM_CREATE | stgm, 0, TRUE, NULL, &stream);
todo_wine
ok(ret == S_OK, "SHCreateStreamOnFileEx: expected S_OK, got 0x%08x\n", ret);
todo_wine
ok(stream != NULL, "SHCreateStreamOnFileEx: expected a valid IStream object, got NULL\n");
if (stream) {
test_IStream_invalid_operations(stream, mode);
refcount = IStream_Release(stream);
ok(refcount == 0, "SHCreateStreamOnFileEx: expected 0, got %d\n", refcount);
}
todo_wine
ok(DeleteFileW(test_file), "SHCreateStreamOnFileEx: could not delete the test file, got error %d\n", GetLastError());
}
START_TEST(istream)
{
static const DWORD stgm_access[] = {
STGM_READ,
STGM_WRITE,
STGM_READWRITE
};
static const DWORD stgm_flags[] = {
0,
STGM_CONVERT,
STGM_DELETEONRELEASE,
STGM_CONVERT | STGM_DELETEONRELEASE,
STGM_TRANSACTED | STGM_CONVERT,
STGM_TRANSACTED | STGM_DELETEONRELEASE,
STGM_TRANSACTED | STGM_CONVERT | STGM_DELETEONRELEASE
};
int i, j;
hShlwapi = GetModuleHandleA("shlwapi.dll");
pSHCreateStreamOnFileA = (void*)GetProcAddress(hShlwapi, "SHCreateStreamOnFileA");
pSHCreateStreamOnFileW = (void*)GetProcAddress(hShlwapi, "SHCreateStreamOnFileW");
pSHCreateStreamOnFileEx = (void*)GetProcAddress(hShlwapi, "SHCreateStreamOnFileEx");
if (!pSHCreateStreamOnFileA)
skip("SHCreateStreamOnFileA not found.\n");
if (!pSHCreateStreamOnFileW)
skip("SHCreateStreamOnFileW not found.\n");
if (!pSHCreateStreamOnFileEx)
skip("SHCreateStreamOnFileEx not found.\n");
for (i = 0; i != sizeof(stgm_access)/sizeof(stgm_access[0]); i++) {
if (pSHCreateStreamOnFileA)
test_SHCreateStreamOnFileA(stgm_access[i]);
if (pSHCreateStreamOnFileW)
test_SHCreateStreamOnFileW(stgm_access[i]);
if (pSHCreateStreamOnFileEx) {
for (j = 0; j != sizeof(stgm_flags)/sizeof(stgm_flags[0]); j++)
test_SHCreateStreamOnFileEx(stgm_access[i], stgm_flags[j]);
}
}
}

View file

@ -76,11 +76,13 @@ static struct {
} TEST_PATH_IS_URL[] = {
{"http://foo/bar", TRUE},
{"c:\\foo\\bar", FALSE},
{"c:/foo/bar", FALSE},
{"foo://foo/bar", TRUE},
{"foo\\bar", FALSE},
{"foo.bar", FALSE},
{"bogusscheme:", TRUE},
{"http:partial", TRUE}
{"http:partial", TRUE},
{"www.winehq.org", FALSE}
};
struct {
@ -906,9 +908,9 @@ static void test_PathCanonicalizeA(void)
lstrcpy(dest, "test");
SetLastError(0xdeadbeef);
res = PathCanonicalizeA(dest, too_long);
ok(!res, "Expected failure\n");
todo_wine
{
ok(!res, "Expected failure\n");
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
}
ok(lstrlen(too_long) == LONG_LEN - 1, "Expected length LONG_LEN - 1, got %i\n", lstrlen(too_long));

View file

@ -5,6 +5,16 @@
<include base="shlwapi_winetest">.</include>
<define name="WINVER">0x600</define>
<define name="_WIN32_WINNT">0x600</define>
<file>clist.c</file>
<file>clsid.c</file>
<file>generated.c</file>
<file>istream.c</file>
<file>ordinal.c</file>
<file>path.c</file>
<file>shreg.c</file>
<file>string.c</file>
<file>url.c</file>
<file>testlist.c</file>
<library>wine</library>
<library>shlwapi</library>
<library>advapi32</library>
@ -13,14 +23,5 @@
<library>kernel32</library>
<library>uuid</library>
<library>ntdll</library>
<file>clist.c</file>
<file>clsid.c</file>
<file>generated.c</file>
<file>ordinal.c</file>
<file>path.c</file>
<file>shreg.c</file>
<file>string.c</file>
<file>url.c</file>
<file>testlist.c</file>
</module>
</group>

View file

@ -35,16 +35,24 @@
ok(ret == val, "Unexpected value of '" #expr "': " #fmt " instead of " #val "\n", ret); \
} while (0);
static HMODULE hShlwapi;
static LPSTR (WINAPI *pStrCpyNXA)(LPSTR,LPCSTR,int);
static LPWSTR (WINAPI *pStrCpyNXW)(LPWSTR,LPCWSTR,int);
static HRESULT (WINAPI *pStrRetToBSTR)(STRRET*,void*,BSTR*);
static BOOL (WINAPI *pIntlStrEqWorkerA)(BOOL,LPCSTR,LPCSTR,int);
static BOOL (WINAPI *pIntlStrEqWorkerW)(BOOL,LPCWSTR,LPCWSTR,int);
static DWORD (WINAPI *pSHAnsiToAnsi)(LPCSTR,LPSTR,int);
static DWORD (WINAPI *pSHUnicodeToUnicode)(LPCWSTR,LPWSTR,int);
static LPSTR (WINAPI *pStrCatBuffA)(LPSTR,LPCSTR,INT);
static LPWSTR (WINAPI *pStrCatBuffW)(LPWSTR,LPCWSTR,INT);
static LPSTR (WINAPI *pStrCpyNXA)(LPSTR,LPCSTR,int);
static LPWSTR (WINAPI *pStrCpyNXW)(LPWSTR,LPCWSTR,int);
static LPSTR (WINAPI *pStrFormatByteSize64A)(LONGLONG,LPSTR,UINT);
static LPSTR (WINAPI *pStrFormatKBSizeA)(LONGLONG,LPSTR,UINT);
static LPWSTR (WINAPI *pStrFormatKBSizeW)(LONGLONG,LPWSTR,UINT);
static BOOL (WINAPI *pStrIsIntlEqualA)(BOOL,LPCSTR,LPCSTR,int);
static BOOL (WINAPI *pIntlStrEqWorkerA)(BOOL,LPCSTR,LPCSTR,int);
static BOOL (WINAPI *pStrIsIntlEqualW)(BOOL,LPCWSTR,LPCWSTR,int);
static BOOL (WINAPI *pIntlStrEqWorkerW)(BOOL,LPCWSTR,LPCWSTR,int);
static HRESULT (WINAPI *pStrRetToBSTR)(STRRET*,void*,BSTR*);
static HRESULT (WINAPI *pStrRetToBufA)(STRRET*,LPCITEMIDLIST,LPSTR,UINT);
static HRESULT (WINAPI *pStrRetToBufW)(STRRET*,LPCITEMIDLIST,LPWSTR,UINT);
static INT (WINAPIV *pwnsprintfA)(LPSTR,INT,LPCSTR, ...);
static INT (WINAPIV *pwnsprintfW)(LPWSTR,INT,LPCWSTR, ...);
static int strcmpW(const WCHAR *str1, const WCHAR *str2)
{
@ -491,9 +499,15 @@ static void test_StrFormatByteSize64A(void)
char szBuff[256];
const StrFormatSizeResult* result = StrFormatSize_results;
if (!pStrFormatByteSize64A)
{
skip("StrFormatByteSize64A() is not available. Tests skipped\n");
return;
}
while(result->value)
{
StrFormatByteSize64A(result->value, szBuff, 256);
pStrFormatByteSize64A(result->value, szBuff, 256);
ok(!strcmp(result->byte_size_64, szBuff),
"Formatted %x%08x wrong: got %s, expected %s\n",
@ -509,9 +523,15 @@ static void test_StrFormatKBSizeW(void)
char szBuff[256];
const StrFormatSizeResult* result = StrFormatSize_results;
if (!pStrFormatKBSizeW)
{
skip("StrFormatKBSizeW() is not available. Tests skipped\n");
return;
}
while(result->value)
{
StrFormatKBSizeW(result->value, szBuffW, 256);
pStrFormatKBSizeW(result->value, szBuffW, 256);
WideCharToMultiByte(0,0,szBuffW,-1,szBuff,sizeof(szBuff)/sizeof(WCHAR),0,0);
ok(!strcmp(result->kb_size, szBuff),
"Formatted %x%08x wrong: got %s, expected %s\n",
@ -525,9 +545,15 @@ static void test_StrFormatKBSizeA(void)
char szBuff[256];
const StrFormatSizeResult* result = StrFormatSize_results;
if (!pStrFormatKBSizeA)
{
skip("StrFormatKBSizeA() is not available. Tests skipped\n");
return;
}
while(result->value)
{
StrFormatKBSizeA(result->value, szBuff, 256);
pStrFormatKBSizeA(result->value, szBuff, 256);
ok(!strcmp(result->kb_size, szBuff),
"Formatted %x%08x wrong: got %s, expected %s\n",
@ -561,20 +587,21 @@ static void test_StrCmpA(void)
ok(!ChrCmpIA('b', 'B'), "ChrCmpIA is not case-insensitive\n");
ok(ChrCmpIA('a', 'z'), "ChrCmpIA believes that a == z!\n");
pStrIsIntlEqualA = (void *)GetProcAddress(hShlwapi, "StrIsIntlEqualA");
pIntlStrEqWorkerA = (void *)GetProcAddress(hShlwapi, "IntlStrEqWorkerA");
if (!pStrIsIntlEqualA)
return;
if (pStrIsIntlEqualA)
{
ok(pStrIsIntlEqualA(FALSE, str1, str2, 5), "StrIsIntlEqualA(FALSE,...) isn't case-insensitive\n");
ok(!pStrIsIntlEqualA(TRUE, str1, str2, 5), "StrIsIntlEqualA(TRUE,...) isn't case-sensitive\n");
}
else
skip("StrIsIntlEqualA() is not available. Tests skipped\n");
if (!pIntlStrEqWorkerA)
return;
if (pIntlStrEqWorkerA)
{
ok(pIntlStrEqWorkerA(FALSE, str1, str2, 5), "IntlStrEqWorkerA(FALSE,...) isn't case-insensitive\n");
ok(!pIntlStrEqWorkerA(TRUE, str1, str2, 5), "pIntlStrEqWorkerA(TRUE,...) isn't case-sensitive\n");
}
else
skip("IntlStrEqWorkerA() is not available. Tests skipped\n");
}
static void test_StrCmpW(void)
@ -587,20 +614,21 @@ static void test_StrCmpW(void)
ok(!ChrCmpIW('b', 'B'), "ChrCmpIW is not case-insensitive\n");
ok(ChrCmpIW('a', 'z'), "ChrCmpIW believes that a == z!\n");
pStrIsIntlEqualW = (void *)GetProcAddress(hShlwapi, "StrIsIntlEqualW");
pIntlStrEqWorkerW = (void *)GetProcAddress(hShlwapi, "IntlStrEqWorkerW");
if (!pStrIsIntlEqualW)
return;
if (pStrIsIntlEqualW)
{
ok(pStrIsIntlEqualW(FALSE, str1, str2, 5), "StrIsIntlEqualW(FALSE,...) isn't case-insensitive\n");
ok(!pStrIsIntlEqualW(TRUE, str1, str2, 5), "StrIsIntlEqualW(TRUE,...) isn't case-sensitive\n");
}
else
skip("StrIsIntlEqualW() is not available. Tests skipped\n");
if (!pIntlStrEqWorkerW)
return;
if (pIntlStrEqWorkerW)
{
ok(pIntlStrEqWorkerW(FALSE, str1, str2, 5), "IntlStrEqWorkerW(FALSE,...) isn't case-insensitive\n");
ok(!pIntlStrEqWorkerW(TRUE, str1, str2, 5), "IntlStrEqWorkerW(TRUE,...) isn't case-sensitive\n");
}
else
skip("IntlStrEqWorkerW() is not available. Tests skipped\n");
}
static WCHAR *CoDupStrW(const char* src)
@ -619,8 +647,11 @@ static void test_StrRetToBSTR(void)
STRRET strret;
HRESULT ret;
pStrRetToBSTR = (void *)GetProcAddress(hShlwapi, "StrRetToBSTR");
if (!pStrRetToBSTR) return;
if (!pStrRetToBSTR)
{
skip("StrRetToBSTR() is not available. Tests skipped\n");
return;
}
strret.uType = STRRET_WSTR;
U(strret).pOleStr = CoDupStrW("Test");
@ -657,9 +688,11 @@ static void test_StrCpyNXA(void)
LPSTR lpszRes;
char dest[8];
pStrCpyNXA = (void *)GetProcAddress(hShlwapi, (LPSTR)399);
if (!pStrCpyNXA)
{
skip("StrCpyNXA() is not available. Tests skipped\n");
return;
}
memset(dest, '\n', sizeof(dest));
lpszRes = pStrCpyNXA(dest, lpSrc, sizeof(dest)/sizeof(dest[0]));
@ -676,14 +709,16 @@ static void test_StrCpyNXW(void)
LPWSTR lpszRes;
WCHAR dest[8];
pStrCpyNXW = (void *)GetProcAddress(hShlwapi, (LPSTR)400);
if (!pStrCpyNXW)
{
skip("StrCpyNXW() is not available. Tests skipped\n");
return;
}
memcpy(dest, lpInit, sizeof(lpInit));
lpszRes = pStrCpyNXW(dest, lpSrc, sizeof(dest)/sizeof(dest[0]));
ok(lpszRes == dest + 5 && !memcmp(dest, lpRes, sizeof(dest)),
"StrCpyNXA: expected %p, \"hello\\0\\n\\n\", got %p, \"%d,%d,%d,%d,%d,%d,%d,%d\"\n",
"StrCpyNXW: expected %p, \"hello\\0\\n\\n\", got %p, \"%d,%d,%d,%d,%d,%d,%d,%d\"\n",
dest + 5, lpszRes, dest[0], dest[1], dest[2], dest[3], dest[4], dest[5], dest[6], dest[7]);
}
@ -731,9 +766,11 @@ static void test_SHAnsiToAnsi(void)
char dest[8];
DWORD dwRet;
pSHAnsiToAnsi = (void *)GetProcAddress(hShlwapi, (LPSTR)345);
if (!pSHAnsiToAnsi)
{
skip("SHAnsiToAnsi() is not available. Tests skipped\n");
return;
}
memset(dest, '\n', sizeof(dest));
dwRet = pSHAnsiToAnsi("hello", dest, sizeof(dest)/sizeof(dest[0]));
@ -750,9 +787,11 @@ static void test_SHUnicodeToUnicode(void)
WCHAR dest[8];
DWORD dwRet;
pSHUnicodeToUnicode = (void *)GetProcAddress(hShlwapi, (LPSTR)346);
if (!pSHUnicodeToUnicode)
{
skip("SHUnicodeToUnicode() is not available. Tests skipped\n");
return;
}
memcpy(dest, lpInit, sizeof(lpInit));
dwRet = pSHUnicodeToUnicode(lpSrc, dest, sizeof(dest)/sizeof(dest[0]));
@ -782,46 +821,80 @@ static void test_StrXXX_overflows(void)
expect_eq(StrCpyNA(buf, str1, 10), buf, PCHAR, "%p");
expect_eq(buf[9], 0, CHAR, "%x");
expect_eq(buf[10], '\xbf', CHAR, "%x");
expect_eq(StrCatBuffA(buf, str1, 100), buf, PCHAR, "%p");
if (pStrCatBuffA)
{
expect_eq(pStrCatBuffA(buf, str1, 100), buf, PCHAR, "%p");
expect_eq(buf[99], 0, CHAR, "%x");
expect_eq(buf[100], '\xbf', CHAR, "%x");
}
else
skip("StrCatBuffA() is not available. Tests skipped\n");
memset(wbuf, 0xbf, sizeof(wbuf));
expect_eq(StrCpyNW(wbuf, wstr1, 10), wbuf, PWCHAR, "%p");
expect_eq(wbuf[9], 0, WCHAR, "%x");
expect_eq(wbuf[10], (WCHAR)0xbfbf, WCHAR, "%x");
expect_eq(StrCatBuffW(wbuf, wstr1, 100), wbuf, PWCHAR, "%p");
if (pStrCatBuffW)
{
expect_eq(pStrCatBuffW(wbuf, wstr1, 100), wbuf, PWCHAR, "%p");
expect_eq(wbuf[99], 0, WCHAR, "%x");
expect_eq(wbuf[100], (WCHAR)0xbfbf, WCHAR, "%x");
}
else
skip("StrCatBuffW() is not available. Tests skipped\n");
if (pStrRetToBufW)
{
memset(wbuf, 0xbf, sizeof(wbuf));
strret.uType = STRRET_WSTR;
U(strret).pOleStr = StrDupW(wstr1);
expect_eq(StrRetToBufW(&strret, NULL, wbuf, 10), S_OK, HRESULT, "%x");
expect_eq(pStrRetToBufW(&strret, NULL, wbuf, 10), S_OK, HRESULT, "%x");
expect_eq(wbuf[9], 0, WCHAR, "%x");
expect_eq(wbuf[10], (WCHAR)0xbfbf, WCHAR, "%x");
}
else
skip("StrRetToBufW() is not available. Tests skipped\n");
if (pStrRetToBufA)
{
memset(buf, 0xbf, sizeof(buf));
strret.uType = STRRET_CSTR;
StrCpyN(U(strret).cStr, str1, MAX_PATH);
expect_eq(StrRetToBufA(&strret, NULL, buf, 10), S_OK, HRESULT, "%x");
expect_eq(pStrRetToBufA(&strret, NULL, buf, 10), S_OK, HRESULT, "%x");
expect_eq(buf[9], 0, CHAR, "%x");
expect_eq(buf[10], (CHAR)0xbf, CHAR, "%x");
}
else
skip("StrRetToBufA() is not available. Tests skipped\n");
if (pwnsprintfA)
{
memset(buf, 0xbf, sizeof(buf));
ret = wnsprintfA(buf, 10, "%s", str1);
ret = pwnsprintfA(buf, 10, "%s", str1);
todo_wine ok(ret == 9, "Unexpected wsnprintfA return %d, expected 9\n", ret);
expect_eq(buf[9], 0, CHAR, "%x");
expect_eq(buf[10], (CHAR)0xbf, CHAR, "%x");
}
else
skip("wnsprintfA() is not available. Tests skipped\n");
if (pwnsprintfW)
{
memset(wbuf, 0xbf, sizeof(wbuf));
ret = wnsprintfW(wbuf, 10, fmt, wstr1);
ret = pwnsprintfW(wbuf, 10, fmt, wstr1);
todo_wine ok(ret == 9, "Unexpected wsnprintfW return %d, expected 9\n", ret);
expect_eq(wbuf[9], 0, WCHAR, "%x");
expect_eq(wbuf[10], (WCHAR)0xbfbf, WCHAR, "%x");
}
else
skip("wnsprintfW() is not available. Tests skipped\n");
}
START_TEST(string)
{
HMODULE hShlwapi;
TCHAR thousandDelim[8];
TCHAR decimalDelim[8];
CoInitialize(0);
@ -830,6 +903,24 @@ START_TEST(string)
GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, decimalDelim, 8);
hShlwapi = GetModuleHandleA("shlwapi");
pIntlStrEqWorkerA = (void *)GetProcAddress(hShlwapi, "IntlStrEqWorkerA");
pIntlStrEqWorkerW = (void *)GetProcAddress(hShlwapi, "IntlStrEqWorkerW");
pSHAnsiToAnsi = (void *)GetProcAddress(hShlwapi, (LPSTR)345);
pSHUnicodeToUnicode = (void *)GetProcAddress(hShlwapi, (LPSTR)346);
pStrCatBuffA = (void *)GetProcAddress(hShlwapi, "StrCatBuffA");
pStrCatBuffW = (void *)GetProcAddress(hShlwapi, "StrCatBuffW");
pStrCpyNXA = (void *)GetProcAddress(hShlwapi, (LPSTR)399);
pStrCpyNXW = (void *)GetProcAddress(hShlwapi, (LPSTR)400);
pStrFormatByteSize64A = (void *)GetProcAddress(hShlwapi, "StrFormatByteSize64A");
pStrFormatKBSizeA = (void *)GetProcAddress(hShlwapi, "StrFormatKBSizeA");
pStrFormatKBSizeW = (void *)GetProcAddress(hShlwapi, "StrFormatKBSizeW");
pStrIsIntlEqualA = (void *)GetProcAddress(hShlwapi, "StrIsIntlEqualA");
pStrIsIntlEqualW = (void *)GetProcAddress(hShlwapi, "StrIsIntlEqualW");
pStrRetToBSTR = (void *)GetProcAddress(hShlwapi, "StrRetToBSTR");
pStrRetToBufA = (void *)GetProcAddress(hShlwapi, "StrRetToBufA");
pStrRetToBufW = (void *)GetProcAddress(hShlwapi, "StrRetToBufW");
pwnsprintfA = (void *)GetProcAddress(hShlwapi, "wnsprintfA");
pwnsprintfW = (void *)GetProcAddress(hShlwapi, "wnsprintfW");
test_StrChrA();
test_StrChrW();

View file

@ -9,6 +9,7 @@
extern void func_clist(void);
extern void func_clsid(void);
extern void func_generated(void);
extern void func_istream(void);
extern void func_ordinal(void);
extern void func_path(void);
extern void func_shreg(void);
@ -20,6 +21,7 @@ const struct test winetest_testlist[] =
{ "clist", func_clist },
{ "clsid", func_clsid },
{ "generated", func_generated },
{ "istream", func_istream },
{ "ordinal", func_ordinal },
{ "path", func_path },
{ "shreg", func_shreg },

View file

@ -206,6 +206,7 @@ static const TEST_URL_COMBINE TEST_COMBINE[] = {
{"http://www.winehq.org/tests/../tests/", "/tests10/..", URL_DONT_SIMPLIFY, S_OK, "http://www.winehq.org/tests10/.."},
{"http://www.winehq.org/tests/../", "tests11", URL_DONT_SIMPLIFY, S_OK, "http://www.winehq.org/tests/../tests11"},
{"file:///C:\\dir\\file.txt", "test.txt", 0, S_OK, "file:///C:/dir/test.txt"},
{"C:\\winehq\\winehq.txt", "C:\\Test\\test.txt", 0, S_OK, "file:///C:/Test/test.txt"},
{"http://www.winehq.org/test/", "test%20file.txt", 0, S_OK, "http://www.winehq.org/test/test%20file.txt"},
{"http://www.winehq.org/test/", "test%20file.txt", URL_FILE_USE_PATHURL, S_OK, "http://www.winehq.org/test/test%20file.txt"},
{"http://www.winehq.org%2ftest/", "test%20file.txt", URL_FILE_USE_PATHURL, S_OK, "http://www.winehq.org%2ftest/test%20file.txt"},

View file

@ -19,7 +19,7 @@
#include "wine/test.h"
/***********************************************************************
* Compability macros
* Compatibility macros
*/
#define DWORD_PTR UINT_PTR

View file

@ -18,6 +18,7 @@
#define COBJMACROS
#define CONST_VTABLE
#define NONAMELESSUNION
#include <wine/test.h>
#include <stdarg.h>
@ -249,7 +250,7 @@ static void test_RegisterFormatEnumerator(void)
static const WCHAR url1[] = {'r','e','s',':','/','/','m','s','h','t','m','l','.','d','l','l',
'/','b','l','a','n','k','.','h','t','m',0};
static const WCHAR url2[] = {'i','n','d','e','x','.','h','t','m',0};
static const WCHAR url3[] = {'f','i','l','e',':','c',':','\\','I','n','d','e','x','.','h','t','m',0};
static const WCHAR url3[] = {'f','i','l','e',':','/','/','c',':','\\','I','n','d','e','x','.','h','t','m',0};
static const WCHAR url4[] = {'f','i','l','e',':','s','o','m','e','%','2','0','f','i','l','e',
'%','2','e','j','p','g',0};
static const WCHAR url5[] = {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q',
@ -258,7 +259,11 @@ static const WCHAR url6[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
static const WCHAR url7[] = {'f','t','p',':','/','/','w','i','n','e','h','q','.','o','r','g','/',
'f','i','l','e','.','t','e','s','t',0};
static const WCHAR url8[] = {'t','e','s','t',':','1','2','3','a','b','c',0};
static const WCHAR url9[] =
{'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g',
'/','s','i','t','e','/','a','b','o','u','t',0};
static const WCHAR url10[] = {'f','i','l','e',':','/','/','s','o','m','e','%','2','0','f','i','l','e',
'.','j','p','g',0};
static const WCHAR url4e[] = {'f','i','l','e',':','s','o','m','e',' ','f','i','l','e',
'.','j','p','g',0};
@ -417,6 +422,7 @@ static const WCHAR mimeAppPdf[] = {'a','p','p','l','i','c','a','t','i','o','n','
static const WCHAR mimeAppXMSDownload[] =
{'a','p','p','l','i','c','a','t','i','o','n','/','x','-','m','s','d','o','w','n','l','o','a','d',0};
static const WCHAR mimeAudioWav[] = {'a','u','d','i','o','/','w','a','v',0};
static const WCHAR mimeAudioBasic[] = {'a','u','d','i','o','/','b','a','s','i','c',0};
static const struct {
LPCWSTR url;
@ -513,6 +519,10 @@ static BYTE data78[] = {'R','I','F','F',0xff,0xff,0xff,0xff,'<','h','t','m','l',
static BYTE data79[] = {'%','!',0xff};
static BYTE data80[] = {'%','!'};
static BYTE data81[] = {'%','!','P','S','<','h','t','m','l','>'};
static BYTE data82[] = {'.','s','n','d',0};
static BYTE data83[] = {'.','s','n','d'};
static BYTE data84[] = {'.','s','n','d',0,'<','h','t','m','l','>',1,1};
static BYTE data85[] = {'.','S','N','D',0};
static const struct {
BYTE *data;
@ -599,7 +609,11 @@ static const struct {
{data78, sizeof(data78), mimeTextHtml},
{data79, sizeof(data79), mimeAppPostscript},
{data80, sizeof(data80), mimeTextPlain},
{data81, sizeof(data81), mimeTextHtml}
{data81, sizeof(data81), mimeTextHtml},
{data82, sizeof(data82), mimeAudioBasic},
{data83, sizeof(data83), mimeTextPlain},
{data84, sizeof(data84), mimeTextHtml},
{data85, sizeof(data85), mimeTextPlain}
};
static void test_FindMimeFromData(void)
@ -700,12 +714,13 @@ static void test_FindMimeFromData(void)
}
static const BYTE secid1[] = {'f','i','l','e',':',0,0,0,0};
static const BYTE secid4[] ={'f','i','l','e',':',3,0,0,0};
static const BYTE secid5[] = {'h','t','t','p',':','w','w','w','.','w','i','n','e','h','q',
'.','o','r','g',3,0,0,0};
static const BYTE secid6[] = {'a','b','o','u','t',':','b','l','a','n','k',3,0,0,0};
static const BYTE secid7[] = {'f','t','p',':','w','i','n','e','h','q','.','o','r','g',
3,0,0,0};
static const BYTE secid10[] =
{'f','i','l','e',':','s','o','m','e','%','2','0','f','i','l','e','.','j','p','g',3,0,0,0};
static struct secmgr_test {
LPCWSTR url;
@ -718,7 +733,7 @@ static struct secmgr_test {
{url1, 0, S_OK, sizeof(secid1), secid1, S_OK},
{url2, 100, 0x80041001, 0, NULL, E_INVALIDARG},
{url3, 0, S_OK, sizeof(secid1), secid1, S_OK},
{url4, 3, S_OK, sizeof(secid4), secid4, S_OK},
{url10,3, S_OK, sizeof(secid10),secid10,S_OK},
{url5, 3, S_OK, sizeof(secid5), secid5, S_OK},
{url6, 3, S_OK, sizeof(secid6), secid6, S_OK},
{url7, 3, S_OK, sizeof(secid7), secid7, S_OK}
@ -729,7 +744,7 @@ static void test_SecurityManager(void)
int i;
IInternetSecurityManager *secmgr = NULL;
BYTE buf[512];
DWORD zone, size;
DWORD zone, size, policy;
HRESULT hres;
hres = CoInternetCreateSecurityManager(NULL, &secmgr, 0);
@ -741,7 +756,8 @@ static void test_SecurityManager(void)
zone = 100;
hres = IInternetSecurityManager_MapUrlToZone(secmgr, secmgr_tests[i].url,
&zone, 0);
ok(hres == secmgr_tests[i].zone_hres,
ok(hres == secmgr_tests[i].zone_hres /* IE <=6 */
|| (FAILED(secmgr_tests[i].zone_hres) && hres == E_INVALIDARG), /* IE7 */
"[%d] MapUrlToZone failed: %08x, expected %08x\n",
i, hres, secmgr_tests[i].zone_hres);
if(SUCCEEDED(hres))
@ -782,9 +798,103 @@ static void test_SecurityManager(void)
ok(hres == E_INVALIDARG,
"GetSecurityId failed: %08x, expected E_INVALIDARG\n", hres);
hres = IInternetSecurityManager_ProcessUrlAction(secmgr, NULL, URLACTION_SCRIPT_RUN, (BYTE*)&policy,
sizeof(WCHAR), NULL, 0, 0, 0);
ok(hres == E_INVALIDARG, "ProcessUrlAction failed: %08x, expected E_INVALIDARG\n", hres);
IInternetSecurityManager_Release(secmgr);
}
static void test_url_action(IInternetSecurityManager *secmgr, IInternetZoneManager *zonemgr, DWORD action)
{
DWORD res, size, policy, reg_policy;
char buf[10];
HKEY hkey;
HRESULT hres;
res = RegOpenKeyA(HKEY_LOCAL_MACHINE,
"Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Zones\\3", &hkey);
if(res != ERROR_SUCCESS) {
ok(0, "Could not open zone key\n");
return;
}
wsprintf(buf, "%X", action);
size = sizeof(DWORD);
res = RegQueryValueExA(hkey, buf, NULL, NULL, (BYTE*)&reg_policy, &size);
RegCloseKey(hkey);
if(res != ERROR_SUCCESS || size != sizeof(DWORD)) {
policy = 0xdeadbeef;
hres = IInternetSecurityManager_ProcessUrlAction(secmgr, url9, action, (BYTE*)&policy,
sizeof(WCHAR), NULL, 0, 0, 0);
ok(hres == E_FAIL, "ProcessUrlAction(%x) failed: %08x, expected E_FAIL\n", action, hres);
ok(policy == 0xdeadbeef, "(%x) policy=%x\n", action, policy);
policy = 0xdeadbeef;
hres = IInternetZoneManager_GetZoneActionPolicy(zonemgr, 3, action, (BYTE*)&policy,
sizeof(DWORD), URLZONEREG_DEFAULT);
ok(hres == E_FAIL, "GetZoneActionPolicy failed: %08x, expected E_FAIL\n", hres);
ok(policy == 0xdeadbeef, "(%x) policy=%x\n", action, policy);
return;
}
policy = 0xdeadbeef;
hres = IInternetZoneManager_GetZoneActionPolicy(zonemgr, 3, action, (BYTE*)&policy,
sizeof(DWORD), URLZONEREG_DEFAULT);
ok(hres == S_OK, "GetZoneActionPolicy failed: %08x\n", hres);
ok(policy == reg_policy, "(%x) policy=%x, expected %x\n", action, policy, reg_policy);
if(policy != URLPOLICY_QUERY) {
policy = 0xdeadbeef;
hres = IInternetSecurityManager_ProcessUrlAction(secmgr, url9, action, (BYTE*)&policy,
sizeof(WCHAR), NULL, 0, 0, 0);
if(reg_policy == URLPOLICY_DISALLOW)
ok(hres == S_FALSE, "ProcessUrlAction(%x) failed: %08x, expected S_FALSE\n", action, hres);
else
ok(hres == S_OK, "ProcessUrlAction(%x) failed: %08x\n", action, hres);
ok(policy == 0xdeadbeef, "(%x) policy=%x\n", action, policy);
}
}
static void test_special_url_action(IInternetSecurityManager *secmgr, IInternetZoneManager *zonemgr, DWORD action)
{
DWORD policy;
HRESULT hres;
policy = 0xdeadbeef;
hres = IInternetZoneManager_GetZoneActionPolicy(zonemgr, 3, action, (BYTE*)&policy,
sizeof(DWORD), URLZONEREG_DEFAULT);
ok(hres == S_OK, "GetZoneActionPolicy failed: %08x\n", hres);
ok(policy == URLPOLICY_DISALLOW, "(%x) policy=%x, expected URLPOLIVY_DISALLOW\n", action, policy);
policy = 0xdeadbeef;
hres = IInternetSecurityManager_ProcessUrlAction(secmgr, url1, action, (BYTE*)&policy,
sizeof(WCHAR), NULL, 0, 0, 0);
ok(hres == S_FALSE, "ProcessUrlAction(%x) failed: %08x, expected S_FALSE\n", action, hres);
}
static void test_polices(void)
{
IInternetZoneManager *zonemgr = NULL;
IInternetSecurityManager *secmgr = NULL;
HRESULT hres;
hres = CoInternetCreateSecurityManager(NULL, &secmgr, 0);
ok(hres == S_OK, "CoInternetCreateSecurityManager failed: %08x\n", hres);
hres = CoInternetCreateZoneManager(NULL, &zonemgr, 0);
ok(hres == S_OK, "CoInternetCreateZoneManager failed: %08x\n", hres);
test_url_action(secmgr, zonemgr, URLACTION_SCRIPT_RUN);
test_url_action(secmgr, zonemgr, URLACTION_ACTIVEX_OVERRIDE_OBJECT_SAFETY);
test_url_action(secmgr, zonemgr, URLACTION_CHANNEL_SOFTDIST_PERMISSIONS);
test_url_action(secmgr, zonemgr, 0xdeadbeef);
test_special_url_action(secmgr, zonemgr, URLACTION_SCRIPT_OVERRIDE_SAFETY);
IInternetSecurityManager_Release(secmgr);
IInternetZoneManager_Release(zonemgr);
}
static void test_ZoneManager(void)
{
IInternetZoneManager *zonemgr = NULL;
@ -1174,6 +1284,50 @@ static void test_ReleaseBindInfo(void)
ok(bi.pUnk == &unk, "bi.pUnk=%p, expected %p\n", bi.pUnk, &unk);
}
static void test_CopyStgMedium(void)
{
STGMEDIUM src, dst;
HRESULT hres;
static WCHAR fileW[] = {'f','i','l','e',0};
memset(&src, 0xf0, sizeof(src));
memset(&dst, 0xe0, sizeof(dst));
src.tymed = TYMED_NULL;
src.pUnkForRelease = NULL;
hres = CopyStgMedium(&src, &dst);
ok(hres == S_OK, "CopyStgMedium failed: %08x\n", hres);
ok(dst.tymed == TYMED_NULL, "tymed=%d\n", dst.tymed);
ok(dst.u.hGlobal == (void*)0xf0f0f0f0, "u=%p\n", dst.u.hGlobal);
ok(!dst.pUnkForRelease, "pUnkForRelease=%p, expected NULL\n", dst.pUnkForRelease);
memset(&dst, 0xe0, sizeof(dst));
src.tymed = TYMED_ISTREAM;
src.u.pstm = NULL;
src.pUnkForRelease = NULL;
hres = CopyStgMedium(&src, &dst);
ok(hres == S_OK, "CopyStgMedium failed: %08x\n", hres);
ok(dst.tymed == TYMED_ISTREAM, "tymed=%d\n", dst.tymed);
ok(!dst.u.pstm, "pstm=%p\n", dst.u.pstm);
ok(!dst.pUnkForRelease, "pUnkForRelease=%p, expected NULL\n", dst.pUnkForRelease);
memset(&dst, 0xe0, sizeof(dst));
src.tymed = TYMED_FILE;
src.u.lpszFileName = fileW;
src.pUnkForRelease = NULL;
hres = CopyStgMedium(&src, &dst);
ok(hres == S_OK, "CopyStgMedium failed: %08x\n", hres);
ok(dst.tymed == TYMED_FILE, "tymed=%d\n", dst.tymed);
ok(dst.u.lpszFileName && dst.u.lpszFileName != fileW, "lpszFileName=%p\n", dst.u.lpszFileName);
ok(!lstrcmpW(dst.u.lpszFileName, fileW), "wrong file name\n");
ok(!dst.pUnkForRelease, "pUnkForRelease=%p, expected NULL\n", dst.pUnkForRelease);
hres = CopyStgMedium(&src, NULL);
ok(hres == E_POINTER, "CopyStgMedium failed: %08x, expected E_POINTER\n", hres);
hres = CopyStgMedium(NULL, &dst);
ok(hres == E_POINTER, "CopyStgMedium failed: %08x, expected E_POINTER\n", hres);
}
static void test_UrlMkGetSessionOption(void)
{
DWORD encoding, size;
@ -1271,6 +1425,54 @@ static void test_ObtainUserAgentString(void)
HeapFree(GetProcessHeap(), 0, str2);
}
static void test_MkParseDisplayNameEx(void)
{
IMoniker *mon = NULL;
LPWSTR name;
DWORD issys;
ULONG eaten = 0;
IBindCtx *bctx;
HRESULT hres;
static const WCHAR clsid_nameW[] = {'c','l','s','i','d',':',
'2','0','D','0','4','F','E','0','-','3','A','E','A','-','1','0','6','9','-','A','2','D','8',
'-','0','8','0','0','2','B','3','0','3','0','9','D',':',0};
CreateBindCtx(0, &bctx);
hres = MkParseDisplayNameEx(bctx, url9, &eaten, &mon);
ok(hres == S_OK, "MkParseDisplayNameEx failed: %08x\n", hres);
ok(eaten == sizeof(url9)/sizeof(WCHAR)-1, "eaten=%d\n", eaten);
ok(mon != NULL, "mon == NULL\n");
hres = IMoniker_GetDisplayName(mon, NULL, 0, &name);
ok(hres == S_OK, "GetDiasplayName failed: %08x\n", hres);
ok(!lstrcmpW(name, url9), "wrong display name %s\n", debugstr_w(name));
CoTaskMemFree(name);
hres = IMoniker_IsSystemMoniker(mon, &issys);
ok(hres == S_OK, "IsSystemMoniker failed: %08x\n", hres);
ok(issys == MKSYS_URLMONIKER, "issys=%x\n", issys);
IMoniker_Release(mon);
hres = MkParseDisplayNameEx(bctx, clsid_nameW, &eaten, &mon);
ok(hres == S_OK, "MkParseDisplayNameEx failed: %08x\n", hres);
ok(eaten == sizeof(clsid_nameW)/sizeof(WCHAR)-1, "eaten=%d\n", eaten);
ok(mon != NULL, "mon == NULL\n");
hres = IMoniker_IsSystemMoniker(mon, &issys);
ok(hres == S_OK, "IsSystemMoniker failed: %08x\n", hres);
ok(issys == MKSYS_CLASSMONIKER, "issys=%x\n", issys);
IMoniker_Release(mon);
hres = MkParseDisplayNameEx(bctx, url8, &eaten, &mon);
ok(FAILED(hres), "MkParseDisplayNameEx succeeded: %08x\n", hres);
IBindCtx_Release(bctx);
}
START_TEST(misc)
{
OleInitialize(NULL);
@ -1284,12 +1486,15 @@ START_TEST(misc)
test_CoInternetQueryInfo();
test_FindMimeFromData();
test_SecurityManager();
test_polices();
test_ZoneManager();
test_NameSpace();
test_MimeFilter();
test_ReleaseBindInfo();
test_CopyStgMedium();
test_UrlMkGetSessionOption();
test_ObtainUserAgentString();
test_MkParseDisplayNameEx();
OleUninitialize();
}

View file

@ -36,19 +36,18 @@
#define SET_EXPECT(func) \
expect_ ## func = TRUE
#define CHECK_EXPECT(func) \
do { \
ok(expect_ ##func, "unexpected call " #func "\n"); \
expect_ ## func = FALSE; \
called_ ## func = TRUE; \
}while(0)
#define CHECK_EXPECT2(func) \
do { \
ok(expect_ ##func, "unexpected call " #func "\n"); \
called_ ## func = TRUE; \
}while(0)
#define CHECK_EXPECT(func) \
do { \
CHECK_EXPECT2(func); \
expect_ ## func = FALSE; \
}while(0)
#define CHECK_CALLED(func) \
do { \
ok(called_ ## func, "expected " #func "\n"); \
@ -357,6 +356,8 @@ static HRESULT WINAPI ProtocolSink_Switch(IInternetProtocolSink *iface, PROTOCOL
CHECK_CALLED(ReportProgress_SENDINGREQUEST);
SET_EXPECT(OnResponse);
SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
if(bindf & BINDF_NEEDFILE)
SET_EXPECT(ReportProgress_CACHEFILENAMEAVAILABLE);
}
SET_EXPECT(ReportData);
@ -368,6 +369,8 @@ static HRESULT WINAPI ProtocolSink_Switch(IInternetProtocolSink *iface, PROTOCOL
state = 1;
CHECK_CALLED(OnResponse);
CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
if(bindf & BINDF_NEEDFILE)
CHECK_CALLED(ReportProgress_CACHEFILENAMEAVAILABLE);
}
SetEvent(event_complete);
@ -423,8 +426,10 @@ static HRESULT WINAPI ProtocolSink_ReportProgress(IInternetProtocolSink *iface,
if(szStatusText) {
if(binding_test)
ok(szStatusText == expect_wsz, "unexpected szStatusText\n");
else if(tested_protocol == FILE_TEST)
ok(!lstrcmpW(szStatusText, file_name), "szStatusText = \"%s\"\n", debugstr_w(szStatusText));
else
ok(!lstrcmpW(szStatusText, file_name), "szStatusText != file_name\n");
ok(szStatusText != NULL, "szStatusText == NULL\n");
}
break;
case BINDSTATUS_FINDINGRESOURCE:
@ -1408,6 +1413,8 @@ static void test_file_protocol(void) {
test_file_protocol_url(index_url);
bindf = BINDF_FROMURLMON;
test_file_protocol_url(index_url);
bindf = BINDF_FROMURLMON | BINDF_NEEDFILE;
test_file_protocol_url(index_url);
memcpy(buf, wszFile, sizeof(wszFile));
len = sizeof(wszFile)/sizeof(WCHAR)-1;
@ -1639,11 +1646,15 @@ static void test_http_protocol(void)
bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON;
test_http_protocol_url(winehq_url, FALSE);
trace("Testing http protocol (to file)...\n");
bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON | BINDF_NEEDFILE;
test_http_protocol_url(winehq_url, FALSE);
trace("Testing http protocol (post data)...\n");
http_post_test = TRUE;
/* Without this flag we get a ReportProgress_CACHEFILENAMEAVAILABLE
* notification with BINDVERB_POST */
bindf |= BINDF_NOWRITECACHE;
bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON | BINDF_NOWRITECACHE;
test_http_protocol_url(posttest_url, TRUE);
http_post_test = FALSE;
}
@ -1700,7 +1711,7 @@ static void test_mk_protocol(void)
ok(hres == INET_E_RESOURCE_NOT_FOUND, "Start failed: %08x, expected INET_E_RESOURCE_NOT_FOUND\n", hres);
CHECK_CALLED(GetBindInfo);
CHECK_CALLED(ReportProgress_DIRECTBIND);
CLEAR_CALLED(ReportProgress_DIRECTBIND);
CHECK_CALLED(ReportProgress_SENDINGREQUEST);
CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
CHECK_CALLED(ReportResult);

View file

@ -167,7 +167,7 @@ static HRESULT WINAPI statusclb_OnProgress(IBindStatusCallback *iface, ULONG ulP
ok(szStatusText != NULL, "szStatusText == NULL\n");
break;
default:
todo_wine { ok(0, "unexpexted code %d\n", ulStatusCode); }
todo_wine { ok(0, "unexpected code %d\n", ulStatusCode); }
};
return S_OK;
}

View file

@ -23,6 +23,7 @@
#include <stdio.h>
#define COBJMACROS
#define NONAMELESSUNION
#define CONST_VTABLE
#include "windef.h"
@ -37,7 +38,7 @@
static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
#define SET_EXPECT(func) \
expect_ ## func = TRUE
do { called_ ## func = FALSE; expect_ ## func = TRUE; } while(0)
#define CHECK_EXPECT2(func) \
do { \
@ -89,6 +90,7 @@ DEFINE_EXPECT(OnProgress_MIMETYPEAVAILABLE);
DEFINE_EXPECT(OnProgress_BEGINDOWNLOADDATA);
DEFINE_EXPECT(OnProgress_DOWNLOADINGDATA);
DEFINE_EXPECT(OnProgress_ENDDOWNLOADDATA);
DEFINE_EXPECT(OnProgress_CACHEFILENAMEAVAILABLE);
DEFINE_EXPECT(OnStopBinding);
DEFINE_EXPECT(OnDataAvailable);
DEFINE_EXPECT(OnObjectAvailable);
@ -104,6 +106,7 @@ DEFINE_EXPECT(Obj_OnProgress_BEGINSYNCOPERATION);
DEFINE_EXPECT(Obj_OnProgress_ENDSYNCOPERATION);
DEFINE_EXPECT(Obj_OnProgress_FINDINGRESOURCE);
DEFINE_EXPECT(Obj_OnProgress_CONNECTING);
DEFINE_EXPECT(Obj_OnProgress_CACHEFILENAMEAVAILABLE);
DEFINE_EXPECT(Start);
DEFINE_EXPECT(Read);
DEFINE_EXPECT(LockRequest);
@ -140,11 +143,13 @@ static const WCHAR wszWineHQSite[] =
static const WCHAR wszWineHQIP[] =
{'2','0','9','.','3','2','.','1','4','1','.','3',0};
static const WCHAR wszIndexHtml[] = {'i','n','d','e','x','.','h','t','m','l',0};
static const WCHAR cache_fileW[] = {'c',':','\\','c','a','c','h','e','.','h','t','m',0};
static const WCHAR dwl_htmlW[] = {'d','w','l','.','h','t','m','l',0};
static const WCHAR emptyW[] = {0};
static BOOL stopped_binding = FALSE, stopped_obj_binding = FALSE, emulate_protocol = FALSE,
data_available = FALSE, http_is_first = TRUE, bind_to_object = FALSE;
static DWORD read = 0, bindf = 0, prot_state = 0, thread_id;
data_available = FALSE, http_is_first = TRUE, bind_to_object = FALSE, filedwl_api;
static DWORD read = 0, bindf = 0, prot_state = 0, thread_id, tymed;
static CHAR mime_type[512];
static IInternetProtocolSink *protocol_sink = NULL;
static HANDLE complete_event, complete_event2;
@ -160,6 +165,8 @@ static LPCWSTR urls[] = {
MK_URL
};
static WCHAR file_url[INTERNET_MAX_URL_LENGTH];
static enum {
HTTP_TEST,
ABOUT_TEST,
@ -337,8 +344,9 @@ static DWORD WINAPI thread_proc(PVOID arg)
CHECK_CALLED(OnDataAvailable);
CHECK_CALLED(OnStopBinding);
SetEvent(complete_event2);
SET_EXPECT(Read);
SetEvent(complete_event2);
return 0;
}
@ -357,13 +365,14 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
read = 0;
ok(szUrl && !lstrcmpW(szUrl, urls[test_protocol]), "wrong url\n");
if(!filedwl_api) /* FIXME */
ok(szUrl && !lstrcmpW(szUrl, urls[test_protocol]), "wrong url %s\n", debugstr_w(szUrl));
ok(pOIProtSink != NULL, "pOIProtSink == NULL\n");
ok(pOIBindInfo != NULL, "pOIBindInfo == NULL\n");
ok(grfPI == 0, "grfPI=%d, expected 0\n", grfPI);
ok(dwReserved == 0, "dwReserved=%d, expected 0\n", dwReserved);
if(binding_hres != S_OK) {
if(!filedwl_api && binding_hres != S_OK) {
SET_EXPECT(OnStopBinding);
SET_EXPECT(Terminate);
hres = IInternetProtocolSink_ReportResult(pOIProtSink, binding_hres, 0, NULL);
@ -379,13 +388,16 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
hres = IInternetBindInfo_GetBindInfo(pOIBindInfo, &bindf, &bindinfo);
ok(hres == S_OK, "GetBindInfo failed: %08x\n", hres);
if(test_protocol == FILE_TEST || test_protocol == MK_TEST || test_protocol == HTTP_TEST) {
if(filedwl_api) {
ok(bindf == (BINDF_PULLDATA|BINDF_FROMURLMON|BINDF_NEEDFILE), "bindf=%08x\n", bindf);
}else if(tymed == TYMED_ISTREAM
&& (test_protocol == FILE_TEST || test_protocol == MK_TEST || test_protocol == HTTP_TEST)) {
ok(bindf == (BINDF_ASYNCHRONOUS|BINDF_ASYNCSTORAGE|BINDF_PULLDATA
|BINDF_FROMURLMON),
"bindf=%08x\n", bindf);
}else {
ok(bindf == (BINDF_ASYNCHRONOUS|BINDF_ASYNCSTORAGE|BINDF_PULLDATA|
BINDF_FROMURLMON|BINDF_NEEDFILE),
ok(bindf == (BINDF_ASYNCHRONOUS|BINDF_ASYNCSTORAGE|BINDF_PULLDATA
|BINDF_FROMURLMON|BINDF_NEEDFILE),
"bindf=%08x\n", bindf);
}
@ -513,7 +525,7 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
if(test_protocol == FILE_TEST) {
hres = IInternetProtocolSink_ReportProgress(pOIProtSink,
BINDSTATUS_CACHEFILENAMEAVAILABLE, emptyW);
BINDSTATUS_CACHEFILENAMEAVAILABLE, file_url+8);
ok(hres == S_OK,
"ReportProgress(BINDSTATUS_CACHEFILENAMEAVAILABLE) failed: %08x\n", hres);
@ -546,6 +558,8 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
if(test_protocol != FILE_TEST && test_protocol != MK_TEST)
SET_EXPECT(Obj_OnProgress_MIMETYPEAVAILABLE);
SET_EXPECT(Obj_OnProgress_BEGINDOWNLOADDATA);
if(test_protocol == FILE_TEST)
SET_EXPECT(Obj_OnProgress_CACHEFILENAMEAVAILABLE);
SET_EXPECT(Obj_OnProgress_ENDDOWNLOADDATA);
SET_EXPECT(Obj_OnProgress_CLASSIDAVAILABLE);
SET_EXPECT(Obj_OnProgress_BEGINSYNCOPERATION);
@ -560,8 +574,11 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
if(test_protocol != FILE_TEST && test_protocol != MK_TEST)
SET_EXPECT(OnProgress_MIMETYPEAVAILABLE);
SET_EXPECT(OnProgress_BEGINDOWNLOADDATA);
if(test_protocol == FILE_TEST)
SET_EXPECT(OnProgress_CACHEFILENAMEAVAILABLE);
SET_EXPECT(OnProgress_ENDDOWNLOADDATA);
SET_EXPECT(LockRequest);
if(!filedwl_api)
SET_EXPECT(OnDataAvailable);
SET_EXPECT(OnStopBinding);
}
@ -574,6 +591,8 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
if(test_protocol != FILE_TEST && test_protocol != MK_TEST)
CHECK_CALLED(Obj_OnProgress_MIMETYPEAVAILABLE);
CHECK_CALLED(Obj_OnProgress_BEGINDOWNLOADDATA);
if(test_protocol == FILE_TEST)
CHECK_CALLED(Obj_OnProgress_CACHEFILENAMEAVAILABLE);
CHECK_CALLED(Obj_OnProgress_ENDDOWNLOADDATA);
CHECK_CALLED(Obj_OnProgress_CLASSIDAVAILABLE);
CHECK_CALLED(Obj_OnProgress_BEGINSYNCOPERATION);
@ -588,8 +607,11 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
if(test_protocol != FILE_TEST && test_protocol != MK_TEST)
CHECK_CALLED(OnProgress_MIMETYPEAVAILABLE);
CHECK_CALLED(OnProgress_BEGINDOWNLOADDATA);
if(test_protocol == FILE_TEST)
CHECK_CALLED(OnProgress_CACHEFILENAMEAVAILABLE);
CHECK_CALLED(OnProgress_ENDDOWNLOADDATA);
CHECK_CALLED(LockRequest);
if(!filedwl_api)
CHECK_CALLED(OnDataAvailable);
CHECK_CALLED(OnStopBinding);
}
@ -648,6 +670,13 @@ static HRESULT WINAPI Protocol_Continue(IInternetProtocol *iface,
ok(hres == S_OK,
"ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE) failed: %08x\n", hres);
if(tymed == TYMED_FILE) {
hres = IInternetProtocolSink_ReportProgress(protocol_sink,
BINDSTATUS_CACHEFILENAMEAVAILABLE, cache_fileW);
ok(hres == S_OK,
"ReportProgress(BINDSTATUS_CACHEFILENAMEAVAILABLE) failed: %08x\n", hres);
}
bscf |= BSCF_FIRSTDATANOTIFICATION;
break;
}
@ -1133,8 +1162,13 @@ static HRESULT WINAPI statusclb_OnProgress(IBindStatusCallback *iface, ULONG ulP
else
CHECK_EXPECT(OnProgress_BEGINDOWNLOADDATA);
ok(szStatusText != NULL, "szStatusText == NULL\n");
if(szStatusText)
ok(!lstrcmpW(szStatusText, urls[test_protocol]), "wrong szStatusText\n");
if(szStatusText) {
if(filedwl_api) {
/* FIXME */
}else {
ok(!lstrcmpW(szStatusText, urls[test_protocol]), "wrong szStatusText %s\n", debugstr_w(szStatusText));
}
}
if(!bind_to_object)
ok(download_state == BEFORE_DOWNLOAD, "Download state was %d, expected BEFORE_DOWNLOAD\n",
download_state);
@ -1153,16 +1187,31 @@ static HRESULT WINAPI statusclb_OnProgress(IBindStatusCallback *iface, ULONG ulP
else
CHECK_EXPECT(OnProgress_ENDDOWNLOADDATA);
ok(szStatusText != NULL, "szStatusText == NULL\n");
if(szStatusText)
ok(!lstrcmpW(szStatusText, urls[test_protocol]), "wrong szStatusText\n");
if(szStatusText) {
if(filedwl_api) {
/* FIXME */
}else {
ok(!lstrcmpW(szStatusText, urls[test_protocol]), "wrong szStatusText %s\n", debugstr_w(szStatusText));
}
}
ok(download_state == DOWNLOADING, "Download state was %d, expected DOWNLOADING\n",
download_state);
download_state = END_DOWNLOAD;
break;
case BINDSTATUS_CACHEFILENAMEAVAILABLE:
if(test_protocol != HTTP_TEST) {
if(iface == &objbsc)
CHECK_EXPECT(Obj_OnProgress_CACHEFILENAMEAVAILABLE);
else
CHECK_EXPECT(OnProgress_CACHEFILENAMEAVAILABLE);
}else { /* FIXME */
CLEAR_CALLED(OnProgress_CACHEFILENAMEAVAILABLE);
CLEAR_CALLED(Obj_OnProgress_CACHEFILENAMEAVAILABLE);
}
ok(szStatusText != NULL, "szStatusText == NULL\n");
if(szStatusText && test_protocol == FILE_TEST)
ok(!lstrcmpW(INDEX_HTML+7, szStatusText), "wrong szStatusText\n");
ok(!lstrcmpW(file_url+8, szStatusText), "wrong szStatusText %s\n", debugstr_w(szStatusText));
break;
case BINDSTATUS_CLASSIDAVAILABLE:
{
@ -1193,7 +1242,7 @@ static HRESULT WINAPI statusclb_OnProgress(IBindStatusCallback *iface, ULONG ulP
ok(szStatusText == NULL, "Expected szStatusText to be NULL\n");
break;
default:
ok(0, "unexpexted code %d\n", ulStatusCode);
ok(0, "unexpected code %d\n", ulStatusCode);
};
return S_OK;
}
@ -1214,6 +1263,9 @@ static HRESULT WINAPI statusclb_OnStopBinding(IBindStatusCallback *iface, HRESUL
if (hresult == HRESULT_FROM_WIN32(ERROR_INTERNET_NAME_NOT_RESOLVED))
return S_OK;
if(filedwl_api)
ok(SUCCEEDED(hresult), "binding failed: %08x\n", hresult);
else
ok(hresult == binding_hres, "binding failed: %08x, expected %08x\n", hresult, binding_hres);
ok(szError == NULL, "szError should be NULL\n");
@ -1279,16 +1331,15 @@ static HRESULT WINAPI statusclb_OnDataAvailable(IBindStatusCallback *iface, DWOR
ok(pformatetc->ptd == NULL, "ptd = %p\n", pformatetc->ptd);
ok(pformatetc->dwAspect == 1, "dwAspect=%u\n", pformatetc->dwAspect);
ok(pformatetc->lindex == -1, "lindex=%d\n", pformatetc->lindex);
ok(pformatetc->tymed == TYMED_ISTREAM, "tymed=%u\n", pformatetc->tymed);
ok(pformatetc->tymed == tymed, "tymed=%u, expected %u\n", pformatetc->tymed, tymed);
}
ok(pstgmed != NULL, "stgmeg == NULL\n");
if(pstgmed) {
ok(pstgmed->tymed == TYMED_ISTREAM, "tymed=%u\n", pstgmed->tymed);
ok(U(*pstgmed).pstm != NULL, "pstm == NULL\n");
ok(pstgmed->tymed == tymed, "tymed=%u, expected %u\n", pstgmed->tymed, tymed);
ok(pstgmed->pUnkForRelease != NULL, "pUnkForRelease == NULL\n");
}
switch(pstgmed->tymed) {
case TYMED_ISTREAM:
if(grfBSCF & BSCF_FIRSTDATANOTIFICATION) {
hres = IStream_Write(U(*pstgmed).pstm, buf, 10, NULL);
ok(hres == STG_E_ACCESSDENIED,
@ -1302,11 +1353,20 @@ static HRESULT WINAPI statusclb_OnDataAvailable(IBindStatusCallback *iface, DWOR
}
ok(U(*pstgmed).pstm != NULL, "U(*pstgmed).pstm == NULL\n");
if(U(*pstgmed).pstm) {
do hres = IStream_Read(U(*pstgmed).pstm, buf, 512, &readed);
while(hres == S_OK);
ok(hres == S_FALSE || hres == E_PENDING, "IStream_Read returned %08x\n", hres);
break;
case TYMED_FILE:
if(test_protocol == FILE_TEST)
ok(!lstrcmpW(pstgmed->u.lpszFileName, INDEX_HTML+7),
"unexpected file name %s\n", debugstr_w(pstgmed->u.lpszFileName));
else if(emulate_protocol)
ok(!lstrcmpW(pstgmed->u.lpszFileName, cache_fileW),
"unexpected file name %s\n", debugstr_w(pstgmed->u.lpszFileName));
else
ok(pstgmed->u.lpszFileName != NULL, "lpszFileName == NULL\n");
}
if(test_protocol == HTTP_TEST && emulate_protocol && prot_state < 4 && (!bind_to_object || prot_state > 1))
@ -1325,9 +1385,6 @@ static HRESULT WINAPI statusclb_OnObjectAvailable(IBindStatusCallback *iface, RE
ok(IsEqualGUID(&IID_IUnknown, riid), "riid = %s\n", debugstr_guid(riid));
ok(punk != NULL, "punk == NULL\n");
if(0&&test_protocol == HTTP_TEST)
SetEvent(complete_event);
return S_OK;
}
@ -1441,8 +1498,6 @@ static HRESULT WINAPI PersistMoniker_Load(IPersistMoniker *iface, BOOL fFullyAva
CHECK_EXPECT(Load);
ok(GetCurrentThreadId() == thread_id, "wrong thread %d\n", GetCurrentThreadId());
trace("LOAD %p\n", pibc);
if(test_protocol == HTTP_TEST)
ok(!fFullyAvailable, "fFulyAvailable = %x\n", fFullyAvailable);
else
@ -1470,9 +1525,9 @@ static HRESULT WINAPI PersistMoniker_Load(IPersistMoniker *iface, BOOL fFullyAva
SET_EXPECT(GetBindInfo);
SET_EXPECT(OnStartBinding);
if(test_protocol == FILE_TEST)
SET_EXPECT(OnProgress_MIMETYPEAVAILABLE);
SET_EXPECT(OnProgress_BEGINDOWNLOADDATA);
if(test_protocol == FILE_TEST)
SET_EXPECT(OnProgress_CACHEFILENAMEAVAILABLE);
if(test_protocol != HTTP_TEST)
SET_EXPECT(OnProgress_ENDDOWNLOADDATA);
SET_EXPECT(LockRequest);
@ -1485,9 +1540,9 @@ static HRESULT WINAPI PersistMoniker_Load(IPersistMoniker *iface, BOOL fFullyAva
CHECK_CALLED(GetBindInfo);
CHECK_CALLED(OnStartBinding);
if(test_protocol == FILE_TEST)
todo_wine CHECK_CALLED(OnProgress_MIMETYPEAVAILABLE);
CHECK_CALLED(OnProgress_BEGINDOWNLOADDATA);
if(test_protocol == FILE_TEST)
CHECK_CALLED(OnProgress_CACHEFILENAMEAVAILABLE);
if(test_protocol != HTTP_TEST)
CHECK_CALLED(OnProgress_ENDDOWNLOADDATA);
CHECK_CALLED(LockRequest);
@ -1764,13 +1819,10 @@ static void test_bscholder(IBindStatusCallback *holder)
IHttpNegotiate_Release(http_negotiate_serv);
hres = IBindStatusCallback_QueryInterface(holder, &IID_IHttpNegotiate2, (void**)&http_negotiate2);
ok(hres == S_OK, "Could not get IHttpNegotiate2 interface: %08x\n", hres);
if(SUCCEEDED(hres)) {
hres = IHttpNegotiate2_GetRootSecurityId(http_negotiate2, (void*)0xdeadbeef, (void*)0xdeadbeef, 0);
ok(hres == E_FAIL, "GetRootSecurityId failed: %08x\n", hres);
IHttpNegotiate_Release(http_negotiate2);
SET_EXPECT(QueryInterface_IHttpNegotiate2);
hres = IServiceProvider_QueryService(serv_prov, &IID_IHttpNegotiate2, &IID_IHttpNegotiate2,
(void**)&http_negotiate2_serv);
@ -1784,6 +1836,10 @@ static void test_bscholder(IBindStatusCallback *holder)
CHECK_CALLED(GetRootSecurityId);
IHttpNegotiate_Release(http_negotiate2_serv);
IHttpNegotiate_Release(http_negotiate2);
}else {
skip("Could not get IHttpNegotiate2\n");
}
SET_EXPECT(OnProgress_FINDINGRESOURCE);
hres = IBindStatusCallback_OnProgress(holder, 0, 0, BINDSTATUS_FINDINGRESOURCE, NULL);
@ -1896,20 +1952,26 @@ static void test_RegisterBindStatusCallback(void)
IBindCtx_Release(bindctx);
}
static void init_bind_test(int protocol, BOOL emul, BOOL bto)
#define BINDTEST_EMULATE 1
#define BINDTEST_TOOBJECT 2
#define BINDTEST_FILEDWLAPI 4
static void init_bind_test(int protocol, DWORD flags, DWORD t)
{
test_protocol = protocol;
emulate_protocol = emul;
emulate_protocol = (flags & BINDTEST_EMULATE) != 0;
download_state = BEFORE_DOWNLOAD;
stopped_binding = FALSE;
stopped_obj_binding = FALSE;
data_available = FALSE;
mime_type[0] = 0;
binding_hres = S_OK;
bind_to_object = bto;
bind_to_object = (flags & BINDTEST_TOOBJECT) != 0;
tymed = t;
filedwl_api = (flags & BINDTEST_FILEDWLAPI) != 0;
}
static void test_BindToStorage(int protocol, BOOL emul)
static void test_BindToStorage(int protocol, BOOL emul, DWORD t)
{
IMoniker *mon;
HRESULT hres;
@ -1920,7 +1982,7 @@ static void test_BindToStorage(int protocol, BOOL emul)
IUnknown *unk = (IUnknown*)0x00ff00ff;
IBinding *bind;
init_bind_test(protocol, emul, FALSE);
init_bind_test(protocol, emul ? BINDTEST_EMULATE : 0, t);
SET_EXPECT(QueryInterface_IServiceProvider);
hres = CreateAsyncBindCtx(0, &bsc, NULL, &bctx);
@ -1937,16 +1999,13 @@ static void test_BindToStorage(int protocol, BOOL emul)
if(previousclb)
IBindStatusCallback_Release(previousclb);
hres = CreateURLMoniker(NULL, urls[test_protocol], &mon);
hres = CreateURLMoniker(NULL, test_protocol == FILE_TEST ? file_url : urls[test_protocol], &mon);
ok(SUCCEEDED(hres), "failed to create moniker: %08x\n", hres);
if(FAILED(hres)) {
IBindCtx_Release(bctx);
return;
}
if(test_protocol == FILE_TEST && INDEX_HTML[7] == '/')
memmove(INDEX_HTML+7, INDEX_HTML+8, lstrlenW(INDEX_HTML+7)*sizeof(WCHAR));
hres = IMoniker_QueryInterface(mon, &IID_IBinding, (void**)&bind);
ok(hres == E_NOINTERFACE, "IMoniker should not have IBinding interface\n");
if(SUCCEEDED(hres))
@ -1958,6 +2017,9 @@ static void test_BindToStorage(int protocol, BOOL emul)
"GetDisplayName got wrong name %s\n", debugstr_w(display_name));
CoTaskMemFree(display_name);
if(tymed == TYMED_FILE && (test_protocol == ABOUT_TEST || test_protocol == ITS_TEST))
binding_hres = INET_E_DATA_NOT_AVAILABLE;
SET_EXPECT(GetBindInfo);
SET_EXPECT(QueryInterface_IInternetProtocol);
if(!emulate_protocol)
@ -1967,9 +2029,12 @@ static void test_BindToStorage(int protocol, BOOL emul)
SET_EXPECT(Start);
if(test_protocol == HTTP_TEST)
SET_EXPECT(Terminate);
if(tymed != TYMED_FILE || (test_protocol != ABOUT_TEST && test_protocol != ITS_TEST))
SET_EXPECT(UnlockRequest);
}else {
if(test_protocol == HTTP_TEST) {
SET_EXPECT(QueryInterface_IInternetBindInfo);
SET_EXPECT(QueryService_IInternetBindInfo);
SET_EXPECT(QueryInterface_IHttpNegotiate);
SET_EXPECT(BeginningTransaction);
SET_EXPECT(QueryInterface_IHttpNegotiate2);
@ -1983,24 +2048,31 @@ static void test_BindToStorage(int protocol, BOOL emul)
SET_EXPECT(OnResponse);
SET_EXPECT(OnProgress_MIMETYPEAVAILABLE);
SET_EXPECT(OnProgress_BEGINDOWNLOADDATA);
if(test_protocol == FILE_TEST)
SET_EXPECT(OnProgress_CACHEFILENAMEAVAILABLE);
if(test_protocol == HTTP_TEST)
SET_EXPECT(OnProgress_DOWNLOADINGDATA);
SET_EXPECT(OnProgress_ENDDOWNLOADDATA);
if(tymed != TYMED_FILE || test_protocol != ABOUT_TEST)
SET_EXPECT(OnDataAvailable);
SET_EXPECT(OnStopBinding);
}
hres = IMoniker_BindToStorage(mon, bctx, NULL, &IID_IStream, (void**)&unk);
hres = IMoniker_BindToStorage(mon, bctx, NULL, tymed == TYMED_ISTREAM ? &IID_IStream : &IID_IUnknown, (void**)&unk);
if (test_protocol == HTTP_TEST && hres == HRESULT_FROM_WIN32(ERROR_INTERNET_NAME_NOT_RESOLVED))
{
trace( "Network unreachable, skipping tests\n" );
skip("Network unreachable, skipping tests\n");
return;
}
if (!SUCCEEDED(hres)) return;
if((bindf & BINDF_ASYNCHRONOUS) && !data_available) {
if(((bindf & BINDF_ASYNCHRONOUS) && !data_available)
|| (tymed == TYMED_FILE && test_protocol == FILE_TEST)) {
ok(hres == MK_S_ASYNCHRONOUS, "IMoniker_BindToStorage failed: %08x\n", hres);
ok(unk == NULL, "istr should be NULL\n");
}else if(tymed == TYMED_FILE && test_protocol == ABOUT_TEST) {
ok(hres == INET_E_DATA_NOT_AVAILABLE,
"IMoniker_BindToStorage failed: %08x, expected INET_E_DATA_NOT_AVAILABLE\n", hres);
ok(unk == NULL, "istr should be NULL\n");
}else {
ok(hres == S_OK, "IMoniker_BindToStorage failed: %08x\n", hres);
ok(unk != NULL, "unk == NULL\n");
@ -2008,6 +2080,9 @@ static void test_BindToStorage(int protocol, BOOL emul)
if(unk)
IUnknown_Release(unk);
if(FAILED(hres))
return;
while((bindf & BINDF_ASYNCHRONOUS) &&
!stopped_binding && GetMessage(&msg,NULL,0,0)) {
TranslateMessage(&msg);
@ -2021,11 +2096,17 @@ static void test_BindToStorage(int protocol, BOOL emul)
CHECK_CALLED(OnStartBinding);
if(emulate_protocol) {
CHECK_CALLED(Start);
if(test_protocol == HTTP_TEST)
if(test_protocol == HTTP_TEST) {
if(tymed == TYMED_FILE)
CLEAR_CALLED(Read);
CHECK_CALLED(Terminate);
}
if(tymed != TYMED_FILE || (test_protocol != ABOUT_TEST && test_protocol != ITS_TEST))
CHECK_CALLED(UnlockRequest);
}else {
if(test_protocol == HTTP_TEST) {
CLEAR_CALLED(QueryInterface_IInternetBindInfo);
CLEAR_CALLED(QueryService_IInternetBindInfo);
CHECK_CALLED(QueryInterface_IHttpNegotiate);
CHECK_CALLED(BeginningTransaction);
/* QueryInterface_IHttpNegotiate2 and GetRootSecurityId
@ -2046,9 +2127,12 @@ static void test_BindToStorage(int protocol, BOOL emul)
CHECK_CALLED(OnResponse);
CHECK_CALLED(OnProgress_MIMETYPEAVAILABLE);
CHECK_CALLED(OnProgress_BEGINDOWNLOADDATA);
if(test_protocol == FILE_TEST)
CHECK_CALLED(OnProgress_CACHEFILENAMEAVAILABLE);
if(test_protocol == HTTP_TEST)
CLEAR_CALLED(OnProgress_DOWNLOADINGDATA);
CHECK_CALLED(OnProgress_ENDDOWNLOADDATA);
if(tymed != TYMED_FILE || test_protocol != ABOUT_TEST)
CHECK_CALLED(OnDataAvailable);
CHECK_CALLED(OnStopBinding);
}
@ -2071,7 +2155,7 @@ static void test_BindToObject(int protocol, BOOL emul)
IUnknown *unk = (IUnknown*)0x00ff00ff;
IBinding *bind;
init_bind_test(protocol, emul, TRUE);
init_bind_test(protocol, BINDTEST_TOOBJECT | (emul ? BINDTEST_EMULATE : 0), TYMED_ISTREAM);
if(emul)
CoRegisterClassObject(&CLSID_HTMLDocument, (IUnknown *)&mime_cf,
@ -2084,16 +2168,13 @@ static void test_BindToObject(int protocol, BOOL emul)
if(FAILED(hres))
return;
hres = CreateURLMoniker(NULL, urls[test_protocol], &mon);
hres = CreateURLMoniker(NULL, test_protocol == FILE_TEST ? file_url : urls[test_protocol], &mon);
ok(SUCCEEDED(hres), "failed to create moniker: %08x\n", hres);
if(FAILED(hres)) {
IBindCtx_Release(bctx);
return;
}
if(test_protocol == FILE_TEST && INDEX_HTML[7] == '/')
memmove(INDEX_HTML+7, INDEX_HTML+8, lstrlenW(INDEX_HTML+7)*sizeof(WCHAR));
hres = IMoniker_QueryInterface(mon, &IID_IBinding, (void**)&bind);
ok(hres == E_NOINTERFACE, "IMoniker should not have IBinding interface\n");
if(SUCCEEDED(hres))
@ -2128,6 +2209,8 @@ static void test_BindToObject(int protocol, BOOL emul)
SET_EXPECT(OnResponse);
SET_EXPECT(Obj_OnProgress_MIMETYPEAVAILABLE);
SET_EXPECT(Obj_OnProgress_BEGINDOWNLOADDATA);
if(test_protocol == FILE_TEST)
SET_EXPECT(Obj_OnProgress_CACHEFILENAMEAVAILABLE);
if(test_protocol == HTTP_TEST)
SET_EXPECT(OnProgress_DOWNLOADINGDATA);
SET_EXPECT(Obj_OnProgress_ENDDOWNLOADDATA);
@ -2142,7 +2225,7 @@ static void test_BindToObject(int protocol, BOOL emul)
if (test_protocol == HTTP_TEST && hres == HRESULT_FROM_WIN32(ERROR_INTERNET_NAME_NOT_RESOLVED))
{
trace( "Network unreachable, skipping tests\n" );
skip( "Network unreachable, skipping tests\n" );
return;
}
@ -2193,12 +2276,18 @@ static void test_BindToObject(int protocol, BOOL emul)
CHECK_NOT_CALLED(Obj_OnProgress_CONNECTING);
}
}
if(test_protocol == HTTP_TEST || test_protocol == FILE_TEST)
if(test_protocol == HTTP_TEST || test_protocol == FILE_TEST) {
if(urls[test_protocol] == SHORT_RESPONSE_URL)
CLEAR_CALLED(Obj_OnProgress_SENDINGREQUEST);
else
CHECK_CALLED(Obj_OnProgress_SENDINGREQUEST);
}
if(test_protocol == HTTP_TEST)
CHECK_CALLED(OnResponse);
CHECK_CALLED(Obj_OnProgress_MIMETYPEAVAILABLE);
CHECK_CALLED(Obj_OnProgress_BEGINDOWNLOADDATA);
if(test_protocol == FILE_TEST)
CHECK_CALLED(Obj_OnProgress_CACHEFILENAMEAVAILABLE);
if(test_protocol == HTTP_TEST)
CLEAR_CALLED(OnProgress_DOWNLOADINGDATA);
CLEAR_CALLED(Obj_OnProgress_ENDDOWNLOADDATA);
@ -2224,18 +2313,106 @@ static void test_BindToObject(int protocol, BOOL emul)
http_is_first = FALSE;
}
static void test_URLDownloadToFile(DWORD prot, BOOL emul)
{
BOOL res;
HRESULT hres;
init_bind_test(prot, BINDTEST_FILEDWLAPI | (emul ? BINDTEST_EMULATE : 0), TYMED_FILE);
SET_EXPECT(GetBindInfo);
SET_EXPECT(QueryInterface_IInternetProtocol);
if(!emulate_protocol) {
SET_EXPECT(QueryInterface_IServiceProvider);
SET_EXPECT(QueryService_IInternetProtocol);
}
SET_EXPECT(OnStartBinding);
if(emulate_protocol) {
SET_EXPECT(Start);
SET_EXPECT(UnlockRequest);
}else {
if(test_protocol == HTTP_TEST) {
SET_EXPECT(QueryInterface_IHttpNegotiate);
SET_EXPECT(BeginningTransaction);
SET_EXPECT(QueryInterface_IHttpNegotiate2);
SET_EXPECT(GetRootSecurityId);
}
if(test_protocol == HTTP_TEST || test_protocol == FILE_TEST)
SET_EXPECT(OnProgress_SENDINGREQUEST);
if(test_protocol == HTTP_TEST)
SET_EXPECT(OnResponse);
SET_EXPECT(OnProgress_MIMETYPEAVAILABLE);
SET_EXPECT(OnProgress_BEGINDOWNLOADDATA);
if(test_protocol == FILE_TEST)
SET_EXPECT(OnProgress_CACHEFILENAMEAVAILABLE);
if(test_protocol == HTTP_TEST)
SET_EXPECT(OnProgress_DOWNLOADINGDATA);
SET_EXPECT(OnProgress_ENDDOWNLOADDATA);
SET_EXPECT(OnStopBinding);
}
hres = URLDownloadToFileW(NULL, test_protocol == FILE_TEST ? file_url : urls[test_protocol], dwl_htmlW, 0, &bsc);
ok(hres == S_OK, "URLDownloadToFile failed: %08x\n", hres);
CHECK_CALLED(GetBindInfo);
CHECK_CALLED(QueryInterface_IInternetProtocol);
if(!emulate_protocol) {
CHECK_CALLED(QueryInterface_IServiceProvider);
CHECK_CALLED(QueryService_IInternetProtocol);
}
CHECK_CALLED(OnStartBinding);
if(emulate_protocol) {
CHECK_CALLED(Start);
CHECK_CALLED(UnlockRequest);
}else {
if(test_protocol == HTTP_TEST) {
CHECK_CALLED(QueryInterface_IHttpNegotiate);
CHECK_CALLED(BeginningTransaction);
CHECK_CALLED(QueryInterface_IHttpNegotiate2);
CHECK_CALLED(GetRootSecurityId);
}
if(test_protocol == HTTP_TEST || test_protocol == FILE_TEST)
CHECK_CALLED(OnProgress_SENDINGREQUEST);
if(test_protocol == HTTP_TEST)
CHECK_CALLED(OnResponse);
CHECK_CALLED(OnProgress_MIMETYPEAVAILABLE);
CHECK_CALLED(OnProgress_BEGINDOWNLOADDATA);
if(test_protocol == FILE_TEST)
CHECK_CALLED(OnProgress_CACHEFILENAMEAVAILABLE);
if(test_protocol == HTTP_TEST)
CLEAR_CALLED(OnProgress_DOWNLOADINGDATA);
CHECK_CALLED(OnProgress_ENDDOWNLOADDATA);
CHECK_CALLED(OnStopBinding);
}
res = DeleteFileW(dwl_htmlW);
ok(res, "DeleteFile failed: %u\n", GetLastError());
if(prot != FILE_TEST || emul)
return;
hres = URLDownloadToFileW(NULL, urls[test_protocol], dwl_htmlW, 0, NULL);
ok(hres == S_OK, "URLDownloadToFile failed: %08x\n", hres);
res = DeleteFileW(dwl_htmlW);
ok(res, "DeleteFile failed: %u\n", GetLastError());
}
static void set_file_url(void)
{
int len;
static const WCHAR wszFile[] = {'f','i','l','e',':','/','/'};
memcpy(INDEX_HTML, wszFile, sizeof(wszFile));
memcpy(file_url, wszFile, sizeof(wszFile));
len = sizeof(wszFile)/sizeof(WCHAR);
INDEX_HTML[len++] = '/';
len += GetCurrentDirectoryW(sizeof(INDEX_HTML)/sizeof(WCHAR)-len, INDEX_HTML+len);
INDEX_HTML[len++] = '\\';
memcpy(INDEX_HTML+len, wszIndexHtml, sizeof(wszIndexHtml));
file_url[len++] = '/';
len += GetCurrentDirectoryW(sizeof(file_url)/sizeof(WCHAR)-len, file_url+len);
file_url[len++] = '\\';
memcpy(file_url+len, wszIndexHtml, sizeof(wszIndexHtml));
memcpy(INDEX_HTML, wszFile, sizeof(wszIndexHtml));
memmove(INDEX_HTML+7, file_url+8, (lstrlenW(file_url+8)+1)*sizeof(WCHAR));
}
static void create_file(void)
@ -2264,7 +2441,7 @@ static void test_ReportResult(HRESULT exhres)
IUnknown *unk = (void*)0xdeadbeef;
HRESULT hres;
init_bind_test(ABOUT_TEST, TRUE, FALSE);
init_bind_test(ABOUT_TEST, BINDTEST_EMULATE, TYMED_ISTREAM);
binding_hres = exhres;
hres = CreateURLMoniker(NULL, ABOUT_BLANK, &mon);
@ -2282,9 +2459,10 @@ static void test_ReportResult(HRESULT exhres)
hres = IMoniker_BindToStorage(mon, bctx, NULL, &IID_IStream, (void**)&unk);
if(SUCCEEDED(exhres))
ok(hres == S_OK, "BindToStorage failed: %08x\n", hres);
ok(hres == S_OK || hres == MK_S_ASYNCHRONOUS, "BindToStorage failed: %08x\n", hres);
else
ok(hres == exhres, "BindToStorage failed: %08x, expected %08x\n", hres, exhres);
ok(hres == exhres || hres == MK_S_ASYNCHRONOUS,
"BindToStorage failed: %08x, expected %08x or MK_S_ASYNCHRONOUS\n", hres, exhres);
CHECK_CALLED(GetBindInfo);
CHECK_CALLED(QueryInterface_IInternetProtocol);
@ -2313,7 +2491,8 @@ static void test_BindToStorage_fail(void)
ok(hres == S_OK, "CreateAsyncBindCtxEx failed: %08x\n", hres);
hres = IMoniker_BindToStorage(mon, bctx, NULL, &IID_IStream, (void**)&unk);
ok(hres == MK_E_SYNTAX, "hres=%08x, expected INET_E_SYNTAX\n", hres);
ok(hres == MK_E_SYNTAX || hres == INET_E_DATA_NOT_AVAILABLE,
"hres=%08x, expected MK_E_SYNTAX or INET_E_DATA_NOT_AVAILABLE\n", hres);
IBindCtx_Release(bctx);
@ -2323,11 +2502,44 @@ static void test_BindToStorage_fail(void)
test_ReportResult(S_FALSE);
}
static void gecko_installer_workaround(BOOL disable)
{
HKEY hkey;
DWORD res;
static BOOL has_url = FALSE;
static char url[2048];
if(!disable && !has_url)
return;
res = RegOpenKey(HKEY_CURRENT_USER, "Software\\Wine\\MSHTML", &hkey);
if(res != ERROR_SUCCESS)
return;
if(disable) {
DWORD type, size = sizeof(url);
res = RegQueryValueEx(hkey, "GeckoUrl", NULL, &type, (PVOID)url, &size);
if(res == ERROR_SUCCESS && type == REG_SZ)
has_url = TRUE;
RegDeleteValue(hkey, "GeckoUrl");
}else {
RegSetValueEx(hkey, "GeckoUrl", 0, REG_SZ, (PVOID)url, lstrlenA(url)+1);
}
RegCloseKey(hkey);
}
START_TEST(url)
{
gecko_installer_workaround(TRUE);
complete_event = CreateEvent(NULL, FALSE, FALSE, NULL);
complete_event2 = CreateEvent(NULL, FALSE, FALSE, NULL);
thread_id = GetCurrentThreadId();
create_file();
test_create();
test_CreateAsyncBindCtx();
@ -2336,65 +2548,111 @@ START_TEST(url)
test_BindToStorage_fail();
trace("synchronous http test (COM not initialised)...\n");
test_BindToStorage(HTTP_TEST, FALSE);
test_BindToStorage(HTTP_TEST, FALSE, TYMED_ISTREAM);
CoInitialize(NULL);
trace("synchronous http test...\n");
test_BindToStorage(HTTP_TEST, FALSE);
test_BindToStorage(HTTP_TEST, FALSE, TYMED_ISTREAM);
trace("synchronous http test (to object)...\n");
test_BindToObject(HTTP_TEST, FALSE);
trace("synchronous file test...\n");
create_file();
test_BindToStorage(FILE_TEST, FALSE);
test_BindToStorage(FILE_TEST, FALSE, TYMED_ISTREAM);
trace("synchronous file test (to object)...\n");
test_BindToObject(FILE_TEST, FALSE);
DeleteFileW(wszIndexHtml);
bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA;
trace("http test...\n");
test_BindToStorage(HTTP_TEST, FALSE);
test_BindToStorage(HTTP_TEST, FALSE, TYMED_ISTREAM);
trace("http test (to file)...\n");
test_BindToStorage(HTTP_TEST, FALSE, TYMED_FILE);
trace("http test (to object)...\n");
test_BindToObject(HTTP_TEST, FALSE);
trace("http test (short response)...\n");
http_is_first = TRUE;
urls[HTTP_TEST] = SHORT_RESPONSE_URL;
test_BindToStorage(HTTP_TEST, FALSE);
test_BindToStorage(HTTP_TEST, FALSE, TYMED_ISTREAM);
trace("http test (short response, to object)...\n");
test_BindToObject(HTTP_TEST, FALSE);
trace("emulated http test...\n");
test_BindToStorage(HTTP_TEST, TRUE);
test_BindToStorage(HTTP_TEST, TRUE, TYMED_ISTREAM);
trace("emulated http test (to object)...\n");
test_BindToObject(HTTP_TEST, TRUE);
trace("emulated http test (to file)...\n");
test_BindToStorage(HTTP_TEST, TRUE, TYMED_FILE);
trace("about test...\n");
test_BindToStorage(ABOUT_TEST, FALSE);
test_BindToStorage(ABOUT_TEST, FALSE, TYMED_ISTREAM);
trace("about test (to file)...\n");
test_BindToStorage(ABOUT_TEST, FALSE, TYMED_FILE);
trace("about test (to object)...\n");
test_BindToObject(ABOUT_TEST, FALSE);
trace("emulated about test...\n");
test_BindToStorage(ABOUT_TEST, TRUE);
test_BindToStorage(ABOUT_TEST, TRUE, TYMED_ISTREAM);
trace("emulated about test (to file)...\n");
test_BindToStorage(ABOUT_TEST, TRUE, TYMED_FILE);
trace("emulated about test (to object)...\n");
test_BindToObject(ABOUT_TEST, TRUE);
trace("file test...\n");
create_file();
test_BindToStorage(FILE_TEST, FALSE);
test_BindToStorage(FILE_TEST, FALSE, TYMED_ISTREAM);
trace("file test (to file)...\n");
test_BindToStorage(FILE_TEST, FALSE, TYMED_FILE);
trace("file test (to object)...\n");
test_BindToObject(FILE_TEST, FALSE);
DeleteFileW(wszIndexHtml);
trace("emulated file test...\n");
set_file_url();
test_BindToStorage(FILE_TEST, TRUE);
test_BindToStorage(FILE_TEST, TRUE, TYMED_ISTREAM);
trace("emulated file test (to file)...\n");
test_BindToStorage(FILE_TEST, TRUE, TYMED_FILE);
trace("emulated file test (to object)...\n");
test_BindToObject(FILE_TEST, TRUE);
trace("emulated its test...\n");
test_BindToStorage(ITS_TEST, TRUE);
test_BindToStorage(ITS_TEST, TRUE, TYMED_ISTREAM);
trace("emulated its test (to file)...\n");
test_BindToStorage(ITS_TEST, TRUE, TYMED_FILE);
trace("emulated mk test...\n");
test_BindToStorage(MK_TEST, TRUE);
test_BindToStorage(MK_TEST, TRUE, TYMED_ISTREAM);
trace("test URLDownloadToFile for file protocol...\n");
test_URLDownloadToFile(FILE_TEST, FALSE);
trace("test URLDownloadToFile for emulated file protocol...\n");
test_URLDownloadToFile(FILE_TEST, TRUE);
trace("test URLDownloadToFile for http protocol...\n");
test_URLDownloadToFile(HTTP_TEST, FALSE);
trace("test failures...\n");
test_BindToStorage_fail();
DeleteFileW(wszIndexHtml);
CloseHandle(complete_event);
CloseHandle(complete_event2);
CoUninitialize();
gecko_installer_workaround(FALSE);
}

View file

@ -5,18 +5,19 @@
<include base="urlmon_winetest">.</include>
<define name="WINVER">0x600</define>
<define name="_WIN32_WINNT">0x600</define>
<library>wine</library>
<library>urlmon</library>
<library>user32</library>
<library>kernel32</library>
<library>ole32</library>
<library>uuid</library>
<library>ntdll</library>
<file>generated.c</file>
<file>misc.c</file>
<file>protocol.c</file>
<file>stream.c</file>
<file>url.c</file>
<file>testlist.c</file>
<library>wine</library>
<library>urlmon</library>
<library>ole32</library>
<library>user32</library>
<library>advapi32</library>
<library>kernel32</library>
<library>uuid</library>
<library>ntdll</library>
</module>
</group>

View file

@ -128,7 +128,7 @@ static void test_GetWindowTheme(void)
"Expected E_HANDLE, got 0x%08x\n",
GetLastError());
/* Only do the bare minumum to get a valid hwnd */
/* Only do the bare minimum to get a valid hwnd */
hWnd = CreateWindowExA(0, "static", "", WS_POPUP, 0,0,100,100,0, 0, 0, NULL);
if (!hWnd) return;
@ -161,7 +161,7 @@ static void test_SetWindowTheme(void)
GetLastError());
}
/* Only do the bare minumum to get a valid hwnd */
/* Only do the bare minimum to get a valid hwnd */
hWnd = CreateWindowExA(0, "static", "", WS_POPUP, 0,0,100,100,0, 0, 0, NULL);
if (!hWnd) return;
@ -231,7 +231,7 @@ static void test_OpenThemeData(void)
GetLastError());
}
/* Only do the bare minumum to get a valid hdc */
/* Only do the bare minimum to get a valid hdc */
hWnd = CreateWindowExA(0, "static", "", WS_POPUP, 0,0,100,100,0, 0, 0, NULL);
if (!hWnd) return;
@ -417,8 +417,10 @@ static void test_GetCurrentThemeName(void)
/* Given number of characters for the theme name is too large */
SetLastError(0xdeadbeef);
hRes = pGetCurrentThemeName(currentTheme, sizeof(currentTheme), NULL, 0, NULL, 0);
todo_wine
ok( hRes == E_POINTER, "Expected E_POINTER, got 0x%08x\n", hRes);
if (bThemeActive)
ok( hRes == E_POINTER || hRes == S_OK, "Expected E_POINTER or S_OK, got 0x%08x\n", hRes);
else
ok( hRes == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes);
ok( GetLastError() == 0xdeadbeef,
"Expected 0xdeadbeef, got 0x%08x\n",
GetLastError());

View file

@ -1,13 +1,15 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<group>
<module name="uxtheme_winetest" type="win32cui" installbase="bin" installname="uxtheme_winetest.exe" allowwarnings="true" entrypoint="0">
<include base="uxtheme_winetest">.</include>
<define name="WINVER">0x600</define>
<define name="_WIN32_WINNT">0x600</define>
<file>system.c</file>
<file>testlist.c</file>
<library>wine</library>
<library>user32</library>
<library>kernel32</library>
<library>ntdll</library>
<file>system.c</file>
<file>testlist.c</file>
</module>
</group>

View file

@ -44,6 +44,18 @@
"ERROR_PATH_NOT_FOUND (NT4)/ERROR_FILE_NOT_FOUND (2k3)" \
"expected, got %u\n", GetLastError());
static void create_file(const CHAR *name)
{
HANDLE file;
DWORD written;
file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n", name);
WriteFile(file, name, strlen(name), &written, NULL);
WriteFile(file, "\n", strlen("\n"), &written, NULL);
CloseHandle(file);
}
static void test_info_size(void)
{ DWORD hdl, retval;
char mypath[MAX_PATH] = "";
@ -153,6 +165,19 @@ static void test_info_size(void)
}
else
trace("skipping GetModuleFileNameA(NULL,..) failed\n");
create_file("test.txt");
/* no version info */
SetLastError(0xdeadbeef);
hdl = 0xcafe;
retval = GetFileVersionInfoSizeA("test.txt", &hdl);
ok(retval == 0, "Expected 0, got %d\n", retval);
ok(hdl == 0, "Expected 0, got %d\n", hdl);
ok(GetLastError() == ERROR_RESOURCE_DATA_NOT_FOUND,
"Expected ERROR_RESOURCE_DATA_NOT_FOUND, got %d\n", GetLastError());
DeleteFileA("test.txt");
}
static void VersionDwordLong2String(DWORDLONG Version, LPSTR lpszVerString)
@ -451,7 +476,8 @@ static void test_VerQueryValue(void)
SetLastError(0xdeadbeef);
ret = VerQueryValue(ver, "String", (LPVOID*)&p, &len);
ok(!ret, "VerQueryValue should fail\n");
ok(GetLastError() == ERROR_RESOURCE_TYPE_NOT_FOUND,
ok(GetLastError() == ERROR_RESOURCE_TYPE_NOT_FOUND ||
GetLastError() == 0xdeadbeef /* Win9x, NT4, W2K */,
"VerQueryValue returned %u\n", GetLastError());
ok(p == (char *)0xdeadbeef, "expected 0xdeadbeef got %p\n", p);
ok(len == 0, "expected 0 got %x\n", len);
@ -517,7 +543,8 @@ todo_wine ok(len == 0, "VerQueryValue returned %u, expected 0\n", len);
SetLastError(0xdeadbeef);
ret = VerQueryValue(ver, buf, (LPVOID*)&p, &len);
ok(!ret, "VerQueryValue(%s) succeeded\n", buf);
ok(GetLastError() == ERROR_RESOURCE_TYPE_NOT_FOUND,
ok(GetLastError() == ERROR_RESOURCE_TYPE_NOT_FOUND ||
GetLastError() == 0xdeadbeef /* Win9x, NT4, W2K */,
"VerQueryValue returned %u\n", GetLastError());
ok(p == (char *)0xdeadbeef, "expected 0xdeadbeef got %p\n", p);
ok(len == 0, "expected 0 got %x\n", len);

View file

@ -1,15 +1,17 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<group>
<module name="version_winetest" type="win32cui" installbase="bin" installname="version_winetest.exe" allowwarnings="true" entrypoint="0">
<include base="version_winetest">.</include>
<define name="WINVER">0x600</define>
<define name="_WIN32_WINNT">0x600</define>
<library>wine</library>
<library>version</library>
<library>kernel32</library>
<library>ntdll</library>
<file>info.c</file>
<file>install.c</file>
<file>version.rc</file>
<file>testlist.c</file>
<library>wine</library>
<library>version</library>
<library>kernel32</library>
<library>ntdll</library>
</module>
</group>