From ec28271f5534e129814b792640f20884527f8041 Mon Sep 17 00:00:00 2001 From: Jan Zerebecki Date: Tue, 6 Nov 2007 20:24:37 +0100 Subject: [PATCH] push 1d2af488ca7d2fda04a17f3641858328ea5bc9a2 --- .gitignore | 4 + Makefile.in | 2 + configure | 3 + configure.ac | 1 + dlls/Makefile.in | 1 + dlls/advapi32/security.c | 2 +- dlls/comctl32/tests/progress.c | 16 + dlls/credui/credui_main.c | 2 +- dlls/cryptnet/cryptnet_main.c | 1 + dlls/d3dx8/d3dx8.spec | 4 +- dlls/d3dx8/math.c | 24 + dlls/d3dx8/tests/math.c | 28 +- dlls/dwmapi/dwmapi.spec | 2 +- dlls/dwmapi/dwmapi_main.c | 10 + dlls/gdi32/path.c | 3 +- dlls/gdi32/tests/path.c | 31 + dlls/hnetcfg/hnetcfg.c | 1 + dlls/inetcomm/tests/Makefile.in | 14 + .../resources.h => dlls/inetcomm/tests/mimeole.c | 47 +- dlls/kernel32/tests/sync.c | 1 - dlls/mshtml/htmldoc.c | 1 + dlls/mshtml/mshtml_private.h | 5 +- dlls/mshtml/navigate.c | 49 +- dlls/mshtml/nsembed.c | 43 + dlls/mshtml/nsiface.idl | 27 + dlls/mshtml/persist.c | 2 +- dlls/mshtml/task.c | 7 +- dlls/mshtml/tests/dom.c | 30 +- dlls/mshtml/txtrange.c | 161 ++- dlls/msi/action.c | 3 + dlls/msi/create.c | 1 + dlls/msi/msi_main.c | 5 +- dlls/msi/tests/package.c | 1493 ++++++++++++++++++-- dlls/riched20/editor.c | 1 + dlls/riched20/tests/editor.c | 2 - dlls/rpcrt4/tests/server.c | 12 + dlls/rpcrt4/tests/server.idl | 1 + dlls/rsaenh/mpi.c | 5 +- dlls/rsaenh/tomcrypt.h | 3 - dlls/setupapi/devinst.c | 1 + dlls/setupapi/query.c | 11 +- dlls/shell32/trash.c | 4 +- dlls/shell32/xdg.c | 2 +- dlls/user32/winproc.c | 50 +- dlls/wined3d/context.c | 33 +- dlls/wined3d/directx.c | 3 + dlls/wined3d/glsl_shader.c | 445 ++++-- dlls/wined3d/pixelshader.c | 29 +- dlls/wined3d/surface.c | 2 +- dlls/wined3d/vertexshader.c | 7 +- dlls/wined3d/wined3d_private.h | 17 +- dlls/winhttp/main.c | 1 + dlls/winspool.drv/info.c | 9 +- dlls/wintrust/register.c | 1 + dlls/wsock32/socket.c | 24 +- include/d3dx8math.h | 3 + include/wine/wined3d_gl.h | 1 + programs/net/En.rc | 3 + programs/net/Makefile.in | 2 +- programs/net/net.c | 45 + programs/net/resources.h | 3 + programs/winetest/Makefile.in | 3 + programs/winetest/winetest.rc | 1 + server/event.c | 5 +- server/handle.c | 2 +- server/handle.h | 2 + server/mapping.c | 5 +- server/mutex.c | 5 +- server/semaphore.c | 5 +- tools/widl/typegen.c | 4 +- 70 files changed, 2429 insertions(+), 347 deletions(-) create mode 100644 dlls/inetcomm/tests/Makefile.in copy programs/net/resources.h => dlls/inetcomm/tests/mimeole.c (57%) diff --git a/.gitignore b/.gitignore index c33da3f1b63..b442c453c8d 100644 --- a/.gitignore +++ b/.gitignore @@ -187,6 +187,9 @@ dlls/imm.dll16 dlls/imm32/libimm32.def dlls/imm32/version.res dlls/inetcomm/libinetcomm.def +dlls/inetcomm/tests/*.ok +dlls/inetcomm/tests/inetcomm_crosstest.exe +dlls/inetcomm/tests/testlist.c dlls/infosoft/tests/*.ok dlls/infosoft/tests/infosoft_crosstest.exe dlls/infosoft/tests/testlist.c @@ -719,6 +722,7 @@ programs/winetest/dsound_test.exe programs/winetest/gdi32_test.exe programs/winetest/gdiplus_test.exe programs/winetest/hlink_test.exe +programs/winetest/inetcomm_test.exe programs/winetest/infosoft_test.exe programs/winetest/iphlpapi_test.exe programs/winetest/itss_test.exe diff --git a/Makefile.in b/Makefile.in index 640142a30b0..69120bed358 100644 --- a/Makefile.in +++ b/Makefile.in @@ -258,6 +258,7 @@ ALL_MAKEFILES = \ dlls/imagehlp/Makefile \ dlls/imm32/Makefile \ dlls/inetcomm/Makefile \ + dlls/inetcomm/tests/Makefile \ dlls/infosoft/Makefile \ dlls/infosoft/tests/Makefile \ dlls/inkobj/Makefile \ @@ -637,6 +638,7 @@ dlls/imaadp32.acm/Makefile: dlls/imaadp32.acm/Makefile.in dlls/Makedll.rules dlls/imagehlp/Makefile: dlls/imagehlp/Makefile.in dlls/Makedll.rules dlls/imm32/Makefile: dlls/imm32/Makefile.in dlls/Makedll.rules dlls/inetcomm/Makefile: dlls/inetcomm/Makefile.in dlls/Makedll.rules +dlls/inetcomm/tests/Makefile: dlls/inetcomm/tests/Makefile.in dlls/Maketest.rules dlls/infosoft/Makefile: dlls/infosoft/Makefile.in dlls/Makedll.rules dlls/infosoft/tests/Makefile: dlls/infosoft/tests/Makefile.in dlls/Maketest.rules dlls/inkobj/Makefile: dlls/inkobj/Makefile.in dlls/Makedll.rules diff --git a/configure b/configure index 12c1388b96f..07924377b00 100755 --- a/configure +++ b/configure @@ -20735,6 +20735,8 @@ ac_config_files="$ac_config_files dlls/imm32/Makefile" ac_config_files="$ac_config_files dlls/inetcomm/Makefile" +ac_config_files="$ac_config_files dlls/inetcomm/tests/Makefile" + ac_config_files="$ac_config_files dlls/infosoft/Makefile" ac_config_files="$ac_config_files dlls/infosoft/tests/Makefile" @@ -21929,6 +21931,7 @@ do "dlls/imagehlp/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/imagehlp/Makefile" ;; "dlls/imm32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/imm32/Makefile" ;; "dlls/inetcomm/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/inetcomm/Makefile" ;; + "dlls/inetcomm/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/inetcomm/tests/Makefile" ;; "dlls/infosoft/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/infosoft/Makefile" ;; "dlls/infosoft/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/infosoft/tests/Makefile" ;; "dlls/inkobj/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/inkobj/Makefile" ;; diff --git a/configure.ac b/configure.ac index 597856aed31..20f579696a9 100644 --- a/configure.ac +++ b/configure.ac @@ -1685,6 +1685,7 @@ AC_CONFIG_FILES([dlls/imaadp32.acm/Makefile]) AC_CONFIG_FILES([dlls/imagehlp/Makefile]) AC_CONFIG_FILES([dlls/imm32/Makefile]) AC_CONFIG_FILES([dlls/inetcomm/Makefile]) +AC_CONFIG_FILES([dlls/inetcomm/tests/Makefile]) AC_CONFIG_FILES([dlls/infosoft/Makefile]) AC_CONFIG_FILES([dlls/infosoft/tests/Makefile]) AC_CONFIG_FILES([dlls/inkobj/Makefile]) diff --git a/dlls/Makefile.in b/dlls/Makefile.in index 759c84201be..9faa096fcb7 100644 --- a/dlls/Makefile.in +++ b/dlls/Makefile.in @@ -269,6 +269,7 @@ TESTSUBDIRS = \ gdi32/tests \ gdiplus/tests \ hlink/tests \ + inetcomm/tests \ infosoft/tests \ iphlpapi/tests \ itss/tests \ diff --git a/dlls/advapi32/security.c b/dlls/advapi32/security.c index 1c55d0aff49..bd2ac0679e5 100644 --- a/dlls/advapi32/security.c +++ b/dlls/advapi32/security.c @@ -137,7 +137,7 @@ typedef struct WELLKOWNRID DWORD Rid; } WELLKNOWNRID; -WELLKNOWNRID WellKnownRids[] = { +static const WELLKNOWNRID WellKnownRids[] = { { WinAccountAdministratorSid, DOMAIN_USER_RID_ADMIN }, { WinAccountGuestSid, DOMAIN_USER_RID_GUEST }, { WinAccountKrbtgtSid, DOMAIN_USER_RID_KRBTGT }, diff --git a/dlls/comctl32/tests/progress.c b/dlls/comctl32/tests/progress.c index a13d01a1699..42c1e8df5d6 100644 --- a/dlls/comctl32/tests/progress.c +++ b/dlls/comctl32/tests/progress.c @@ -33,6 +33,21 @@ static HWND hProgressParentWnd, hProgressWnd; static const char progressTestClass[] = "ProgressBarTestClass"; +/* try to make sure pending X events have been processed before continuing */ +static void flush_events(void) +{ + MSG msg; + int diff = 100; + DWORD time = GetTickCount() + diff; + + while (diff > 0) + { + if (MsgWaitForMultipleObjects( 0, NULL, FALSE, min(10,diff), QS_ALLINPUT ) == WAIT_TIMEOUT) break; + while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessage( &msg ); + diff = time - GetTickCount(); + } +} + static LRESULT CALLBACK ProgressTestWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch(msg) { @@ -113,6 +128,7 @@ static void init(void) ShowWindow(hProgressParentWnd, SW_SHOWNORMAL); ok(GetUpdateRect(hProgressParentWnd, NULL, FALSE), "GetUpdateRect: There should be a region that needs to be updated\n"); + flush_events(); update_window(hProgressParentWnd); } diff --git a/dlls/credui/credui_main.c b/dlls/credui/credui_main.c index 93d5b8842b0..f9e24eb5eaf 100644 --- a/dlls/credui/credui_main.c +++ b/dlls/credui/credui_main.c @@ -45,7 +45,7 @@ struct pending_credentials static HINSTANCE hinstCredUI; -struct list pending_credentials_list = LIST_INIT(pending_credentials_list); +static struct list pending_credentials_list = LIST_INIT(pending_credentials_list); static CRITICAL_SECTION csPendingCredentials; static CRITICAL_SECTION_DEBUG critsect_debug = diff --git a/dlls/cryptnet/cryptnet_main.c b/dlls/cryptnet/cryptnet_main.c index 487da9df170..0ad302dd743 100644 --- a/dlls/cryptnet/cryptnet_main.c +++ b/dlls/cryptnet/cryptnet_main.c @@ -31,6 +31,7 @@ #include "winnt.h" #include "winnls.h" #include "wininet.h" +#include "objbase.h" #define CERT_REVOCATION_PARA_HAS_EXTRA_FIELDS #include "wincrypt.h" diff --git a/dlls/d3dx8/d3dx8.spec b/dlls/d3dx8/d3dx8.spec index ca5759d294b..3d69e208021 100644 --- a/dlls/d3dx8/d3dx8.spec +++ b/dlls/d3dx8/d3dx8.spec @@ -44,8 +44,8 @@ @ stdcall D3DXMatrixPerspectiveOffCenterLH(ptr long long long long long long) @ stdcall D3DXMatrixOrthoRH(ptr long long long long) @ stdcall D3DXMatrixOrthoLH(ptr long long long long) -@ stub D3DXMatrixOrthoOffCenterRH -@ stub D3DXMatrixOrthoOffCenterLH +@ stdcall D3DXMatrixOrthoOffCenterRH(ptr long long long long long long) +@ stdcall D3DXMatrixOrthoOffCenterLH(ptr long long long long long long) @ stub D3DXMatrixShadow @ stub D3DXMatrixReflect @ stub D3DXQuaternionToAxisAngle diff --git a/dlls/d3dx8/math.c b/dlls/d3dx8/math.c index 7070895e604..1f14d5c03b2 100644 --- a/dlls/d3dx8/math.c +++ b/dlls/d3dx8/math.c @@ -126,6 +126,30 @@ D3DXMATRIX* WINAPI D3DXMatrixOrthoLH(D3DXMATRIX *pout, FLOAT w, FLOAT h, FLOAT z return pout; } +D3DXMATRIX* WINAPI D3DXMatrixOrthoOffCenterLH(D3DXMATRIX *pout, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf) +{ + D3DXMatrixIdentity(pout); + pout->m[0][0] = 2.0f / (r - l); + pout->m[1][1] = 2.0f / (t - b); + pout->m[2][2] = 1.0f / (zf -zn); + pout->m[3][0] = -1.0f -2.0f *l / (r - l); + pout->m[3][1] = 1.0f + 2.0f * t / (b - t); + pout->m[3][2] = zn / (zn -zf); + return pout; +} + +D3DXMATRIX* WINAPI D3DXMatrixOrthoOffCenterRH(D3DXMATRIX *pout, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf) +{ + D3DXMatrixIdentity(pout); + pout->m[0][0] = 2.0f / (r - l); + pout->m[1][1] = 2.0f / (t - b); + pout->m[2][2] = 1.0f / (zn -zf); + pout->m[3][0] = -1.0f -2.0f *l / (r - l); + pout->m[3][1] = 1.0f + 2.0f * t / (b - t); + pout->m[3][2] = zn / (zn -zf); + return pout; +} + D3DXMATRIX* WINAPI D3DXMatrixOrthoRH(D3DXMATRIX *pout, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf) { D3DXMatrixIdentity(pout); diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c index f84426d510c..c3cef3b865b 100644 --- a/dlls/d3dx8/tests/math.c +++ b/dlls/d3dx8/tests/math.c @@ -223,14 +223,34 @@ static void D3DXMatrixTest(void) expect_mat(expectedmat,gotmat); /*____________D3DXMatrixOrthoLH_______________*/ - D3DXMatrixIdentity(&expectedmat); - expectedmat.m[0][0] = 0.8f; expectedmat.m[1][1] = 0.270270f; expectedmat.m[2][2] = -0.151515f; expectedmat.m[3][2] = -0.484848f; + expectedmat.m[0][0] = 0.8f; expectedmat.m[0][1] = 0.0f; expectedmat.m[0][2] = 0.0f; expectedmat.m[0][3] = 0.0f; + expectedmat.m[1][0] = 0.0f; expectedmat.m[1][1] = 0.270270f; expectedmat.m[1][2] = 0.0f; expectedmat.m[1][3] = 0.0f; + expectedmat.m[2][0] = 0.0f; expectedmat.m[2][1] = 0.0f; expectedmat.m[2][2] = -0.151515f; expectedmat.m[2][3] = 0.0f; + expectedmat.m[3][0] = 0.0f; expectedmat.m[3][1] = 0.0f; expectedmat.m[3][2] = -0.484848f; expectedmat.m[3][3] = 1.0f; D3DXMatrixOrthoLH(&gotmat, 2.5f, 7.4f, -3.2f, -9.8f); expect_mat(expectedmat,gotmat); +/*____________D3DXMatrixOrthoOffCenterLH_______________*/ + expectedmat.m[0][0] = 3.636364f; expectedmat.m[0][1] = 0.0f; expectedmat.m[0][2] = 0.0f; expectedmat.m[0][3] = 0.0f; + expectedmat.m[1][0] = 0.0f; expectedmat.m[1][1] = 0.180180f; expectedmat.m[1][2] = 0.0; expectedmat.m[1][3] = 0.0f; + expectedmat.m[2][0] = 0.0f; expectedmat.m[2][1] = 0.0f; expectedmat.m[2][2] = -0.045662f; expectedmat.m[2][3] = 0.0f; + expectedmat.m[3][0] = -1.727272f; expectedmat.m[3][1] = -0.567568f; expectedmat.m[3][2] = 0.424658f; expectedmat.m[3][3] = 1.0f; + D3DXMatrixOrthoOffCenterLH(&gotmat, 0.2f, 0.75f, -2.4f, 8.7f, 9.3, -12.6); + expect_mat(expectedmat,gotmat); + +/*____________D3DXMatrixOrthoOffCenterRH_______________*/ + expectedmat.m[0][0] = 3.636364f; expectedmat.m[0][1] = 0.0f; expectedmat.m[0][2] = 0.0f; expectedmat.m[0][3] = 0.0f; + expectedmat.m[1][0] = 0.0f; expectedmat.m[1][1] = 0.180180f; expectedmat.m[1][2] = 0.0; expectedmat.m[1][3] = 0.0f; + expectedmat.m[2][0] = 0.0f; expectedmat.m[2][1] = 0.0f; expectedmat.m[2][2] = 0.045662f; expectedmat.m[2][3] = 0.0f; + expectedmat.m[3][0] = -1.727272f; expectedmat.m[3][1] = -0.567568f; expectedmat.m[3][2] = 0.424658f; expectedmat.m[3][3] = 1.0f; + D3DXMatrixOrthoOffCenterRH(&gotmat, 0.2f, 0.75f, -2.4f, 8.7f, 9.3, -12.6); + expect_mat(expectedmat,gotmat); + /*____________D3DXMatrixOrthoRH_______________*/ - D3DXMatrixIdentity(&expectedmat); - expectedmat.m[0][0] = 0.8f; expectedmat.m[1][1] = 0.270270f; expectedmat.m[2][2] = 0.151515f; expectedmat.m[3][2] = -0.484848f; + expectedmat.m[0][0] = 0.8f; expectedmat.m[0][1] = 0.0f; expectedmat.m[0][2] = 0.0f; expectedmat.m[0][3] = 0.0f; + expectedmat.m[1][0] = 0.0f; expectedmat.m[1][1] = 0.270270f; expectedmat.m[1][2] = 0.0f; expectedmat.m[1][3] = 0.0f; + expectedmat.m[2][0] = 0.0f; expectedmat.m[2][1] = 0.0f; expectedmat.m[2][2] = 0.151515f; expectedmat.m[2][3] = 0.0f; + expectedmat.m[3][0] = 0.0f; expectedmat.m[3][1] = 0.0f; expectedmat.m[3][2] = -0.484848f; expectedmat.m[3][3] = 1.0f; D3DXMatrixOrthoRH(&gotmat, 2.5f, 7.4f, -3.2f, -9.8f); expect_mat(expectedmat,gotmat); diff --git a/dlls/dwmapi/dwmapi.spec b/dlls/dwmapi/dwmapi.spec index ebe7494ec12..d6d675a58ea 100644 --- a/dlls/dwmapi/dwmapi.spec +++ b/dlls/dwmapi/dwmapi.spec @@ -1,6 +1,6 @@ 100 stub @ 101 stub @ -102 stub DwmEnableComposition +102 stdcall DwmEnableComposition (long) 103 stub @ 104 stub @ 105 stub @ diff --git a/dlls/dwmapi/dwmapi_main.c b/dlls/dwmapi/dwmapi_main.c index 009f1949973..dd8714ba160 100644 --- a/dlls/dwmapi/dwmapi_main.c +++ b/dlls/dwmapi/dwmapi_main.c @@ -59,3 +59,13 @@ HRESULT WINAPI DwmIsCompositionEnabled(BOOL *enabled) *enabled = FALSE; return S_OK; } + +/********************************************************************** + * DwmEnableComposition (DWMAPI.102) + */ +HRESULT WINAPI DwmEnableComposition(UINT uCompositionAction) +{ + FIXME("(%d) stub\n", uCompositionAction); + + return S_OK; +} diff --git a/dlls/gdi32/path.c b/dlls/gdi32/path.c index 683bdba0a2e..553f4755760 100644 --- a/dlls/gdi32/path.c +++ b/dlls/gdi32/path.c @@ -235,9 +235,8 @@ BOOL WINAPI CloseFigure(HDC hdc) } else { - /* FIXME: Shouldn't we draw a line to the beginning of the - figure? */ /* Set PT_CLOSEFIGURE on the last entry and start a new stroke */ + /* It is not necessary to draw a line, PT_CLOSEFIGURE is a virtual closing line itself */ if(dc->path.numEntriesUsed) { dc->path.pFlags[dc->path.numEntriesUsed-1]|=PT_CLOSEFIGURE; diff --git a/dlls/gdi32/tests/path.c b/dlls/gdi32/tests/path.c index 33497bc3c6c..67532985e85 100644 --- a/dlls/gdi32/tests/path.c +++ b/dlls/gdi32/tests/path.c @@ -391,10 +391,41 @@ done: ReleaseDC(0, hdc); } +static void test_closefigure(void) { + BOOL retb; + int nSize, nSizeWitness; + HDC hdc = GetDC(0); + + BeginPath(hdc); + MoveToEx(hdc, 95, 95, NULL); + LineTo(hdc, 95, 0); + LineTo(hdc, 0, 95); + + retb = CloseFigure(hdc); + EndPath(hdc); + nSize = GetPath(hdc, NULL, NULL, 0); + + AbortPath(hdc); + + BeginPath(hdc); + MoveToEx(hdc, 95, 95, NULL); + LineTo(hdc, 95, 0); + LineTo(hdc, 0, 95); + + EndPath(hdc); + nSizeWitness = GetPath(hdc, NULL, NULL, 0); + + /* This test shows CloseFigure does not have to add a point at the end of the path */ + ok(nSize == nSizeWitness, "Wrong number of points, no point should be added by CloseFigure\n"); + + ReleaseDC(0, hdc); +} + START_TEST(path) { test_widenpath(); test_arcto(); test_anglearc(); test_polydraw(); + test_closefigure(); } diff --git a/dlls/hnetcfg/hnetcfg.c b/dlls/hnetcfg/hnetcfg.c index a95b4437d4b..3487bc305ec 100644 --- a/dlls/hnetcfg/hnetcfg.c +++ b/dlls/hnetcfg/hnetcfg.c @@ -20,6 +20,7 @@ #include "windef.h" #include "winbase.h" +#include "objbase.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(hnetcfg); diff --git a/dlls/inetcomm/tests/Makefile.in b/dlls/inetcomm/tests/Makefile.in new file mode 100644 index 00000000000..93e8b3bf1f4 --- /dev/null +++ b/dlls/inetcomm/tests/Makefile.in @@ -0,0 +1,14 @@ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +TESTDLL = inetcomm.dll +IMPORTS = inetcomm ole32 kernel32 +EXTRALIBS = + +CTESTS = \ + mimeole.c + +@MAKE_TEST_RULES@ + +@DEPENDENCIES@ # everything below this line is overwritten by make depend diff --git a/programs/net/resources.h b/dlls/inetcomm/tests/mimeole.c similarity index 57% copy from programs/net/resources.h copy to dlls/inetcomm/tests/mimeole.c index 4c1c1671ea7..d1281931796 100644 --- a/programs/net/resources.h +++ b/dlls/inetcomm/tests/mimeole.c @@ -1,5 +1,7 @@ /* - * Copyright 2007 Tim Schwartz + * MimeOle tests + * + * Copyright 2007 Huw Davies * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -16,17 +18,32 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#define STRING_USAGE 101 -#define STRING_START_USAGE 102 -#define STRING_STOP_USAGE 103 -#define STRING_STOP_DEP 104 -#define STRING_CANT_STOP 105 -#define STRING_NO_SCM 106 -#define STRING_NO_SVCHANDLE 107 -#define STRING_START_SVC 108 -#define STRING_START_SVC_SUCCESS 109 -#define STRING_START_SVC_FAIL 110 -#define STRING_STOP_SVC 111 -#define STRING_STOP_SVC_SUCCESS 112 -#define STRING_STOP_SVC_FAIL 113 -#define STRING_HELP_USAGE 114 +#define COBJMACROS + +#include "windows.h" +#include "ole2.h" +#include "mimeole.h" + +#include +#include + +#include "wine/test.h" + + +static void test_CreateVirtualStream(void) +{ + HRESULT hr; + IStream *pstm; + + hr = MimeOleCreateVirtualStream(&pstm); + ok(hr == S_OK, "ret %08x\n", hr); + + IStream_Release(pstm); +} + +START_TEST(mimeole) +{ + OleInitialize(NULL); + test_CreateVirtualStream(); + OleUninitialize(); +} diff --git a/dlls/kernel32/tests/sync.c b/dlls/kernel32/tests/sync.c index 716e56e5a26..616404e8241 100644 --- a/dlls/kernel32/tests/sync.c +++ b/dlls/kernel32/tests/sync.c @@ -278,7 +278,6 @@ static void test_event_security(void) InitializeAcl(&acl, sizeof(acl), ACL_REVISION); SetSecurityDescriptorDacl(&sd, TRUE, &acl, FALSE); handle = CreateEventA(&sa, FALSE, FALSE, __FILE__ ": Test Event"); - todo_wine ok(handle != NULL, "CreateEventW with blank sd failed with error %d\n", GetLastError()); CloseHandle(handle); } diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index 4ea29125e5b..e9df70e505f 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -1185,6 +1185,7 @@ HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject) ret->window = NULL; ret->option_factory = NULL; + list_init(&ret->bindings); list_init(&ret->selection_list); list_init(&ret->range_list); diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 14ae1be8adf..2a8627c1957 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -140,6 +140,7 @@ struct HTMLDocument { BSCallback *bscallback; IMoniker *mon; LPOLESTR url; + struct list bindings; HWND hwnd; HWND tooltips_hwnd; @@ -260,6 +261,8 @@ struct BSCallback { HTMLDocument *doc; nsProtocolStream *nsstream; + + struct list entry; }; typedef struct { @@ -417,7 +420,7 @@ void init_nsevents(NSContainer*); nsresult get_nsinterface(nsISupports*,REFIID,void**); BSCallback *create_bscallback(IMoniker*); -HRESULT start_binding(BSCallback*); +HRESULT start_binding(HTMLDocument*,BSCallback*); HRESULT load_stream(BSCallback*,IStream*); void set_document_bscallback(HTMLDocument*,BSCallback*); void set_current_mon(HTMLDocument*,IMoniker*); diff --git a/dlls/mshtml/navigate.c b/dlls/mshtml/navigate.c index 659ba2281c2..5e05a647105 100644 --- a/dlls/mshtml/navigate.c +++ b/dlls/mshtml/navigate.c @@ -29,6 +29,7 @@ #include "winuser.h" #include "ole2.h" #include "hlguids.h" +#include "shlguid.h" #include "wine/debug.h" #include "wine/unicode.h" @@ -222,7 +223,7 @@ static HRESULT read_stream_data(BSCallback *This, IStream *stream) FIXME("OnStartRequest failed: %08x\n", nsres); /* events are reset when a new document URI is loaded, so re-initialise them here */ - if(This->doc && This->doc->nscontainer) + if(This->doc && This->doc->bscallback == This && This->doc->nscontainer) init_nsevents(This->doc->nscontainer); } @@ -328,6 +329,7 @@ static ULONG WINAPI BindStatusCallback_Release(IBindStatusCallback *iface) IMoniker_Release(This->mon); if(This->binding) IBinding_Release(This->binding); + list_remove(&This->entry); mshtml_free(This->headers); mshtml_free(This); } @@ -345,6 +347,9 @@ static HRESULT WINAPI BindStatusCallback_OnStartBinding(IBindStatusCallback *ifa IBinding_AddRef(pbind); This->binding = pbind; + if(This->doc) + list_add_head(&This->doc->bindings, &This->entry); + add_nsrequest(This); return S_OK; @@ -414,7 +419,12 @@ static HRESULT WINAPI BindStatusCallback_OnStopBinding(IBindStatusCallback *ifac } } - if(This->doc && !This->doc->nscontainer) { + list_remove(&This->entry); + + if(FAILED(hresult)) + return S_OK; + + if(This->doc && This->doc->bscallback == This && !This->doc->nscontainer) { task_t *task = mshtml_alloc(sizeof(task_t)); task->doc = This->doc; @@ -670,6 +680,8 @@ BSCallback *create_bscallback(IMoniker *mon) ret->binding = NULL; ret->doc = NULL; + list_init(&ret->entry); + if(mon) IMoniker_AddRef(mon); ret->mon = mon; @@ -677,6 +689,27 @@ BSCallback *create_bscallback(IMoniker *mon) return ret; } +/* Calls undocumented 84 cmd of CGID_ShellDocView */ +static void call_docview_84(HTMLDocument *doc) +{ + IOleCommandTarget *olecmd; + VARIANT var; + HRESULT hres; + + if(!doc->client) + return; + + hres = IOleClientSite_QueryInterface(doc->client, &IID_IOleCommandTarget, (void**)&olecmd); + if(FAILED(hres)) + return; + + VariantInit(&var); + hres = IOleCommandTarget_Exec(olecmd, &CGID_ShellDocView, 84, 0, NULL, &var); + IOleCommandTarget_Release(olecmd); + if(SUCCEEDED(hres) && V_VT(&var) != VT_NULL) + FIXME("handle result\n"); +} + static void parse_post_data(nsIInputStream *post_data_stream, LPWSTR *headers_ret, HGLOBAL *post_data_ret, ULONG *post_data_len_ret) { @@ -796,12 +829,15 @@ void hlink_frame_navigate(HTMLDocument *doc, IHlinkFrame *hlink_frame, IBindStatusCallback_Release(STATUSCLB(callback)); } -HRESULT start_binding(BSCallback *bscallback) +HRESULT start_binding(HTMLDocument *doc, BSCallback *bscallback) { IStream *str = NULL; IBindCtx *bctx; HRESULT hres; + bscallback->doc = doc; + call_docview_84(bscallback->doc); + hres = CreateAsyncBindCtx(0, STATUSCLB(bscallback), NULL, &bctx); if(FAILED(hres)) { WARN("CreateAsyncBindCtx failed: %08x\n", hres); @@ -828,6 +864,8 @@ HRESULT start_binding(BSCallback *bscallback) void set_document_bscallback(HTMLDocument *doc, BSCallback *callback) { + BSCallback *iter; + if(doc->bscallback) { if(doc->bscallback->binding) IBinding_Abort(doc->bscallback->binding); @@ -835,6 +873,11 @@ void set_document_bscallback(HTMLDocument *doc, BSCallback *callback) IBindStatusCallback_Release(STATUSCLB(doc->bscallback)); } + LIST_FOR_EACH_ENTRY(iter, &doc->bindings, BSCallback, entry) { + iter->doc = NULL; + list_remove(&iter->entry); + } + doc->bscallback = callback; if(callback) { diff --git a/dlls/mshtml/nsembed.c b/dlls/mshtml/nsembed.c index 8cead970ce4..9b8740da367 100644 --- a/dlls/mshtml/nsembed.c +++ b/dlls/mshtml/nsembed.c @@ -45,6 +45,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml); #define NS_EDITORCONTROLLER_CONTRACTID "@mozilla.org/editor/editorcontroller;1" #define NS_ARRAY_CONTRACTID "@mozilla.org/array;1" #define NS_VARIANT_CONTRACTID "@mozilla.org/variant;1" +#define NS_PREFERENCES_CONTRACTID "@mozilla.org/preferences;1" #define APPSTARTUP_TOPIC "app-startup" @@ -253,8 +254,39 @@ static BOOL load_wine_gecko(PRUnichar *gre_path) return ret; } +static void set_lang(nsIPrefBranch *pref) +{ + char langs[100]; + DWORD res, size, type; + HKEY hkey; + nsresult nsres; + + static const WCHAR international_keyW[] = + {'S','o','f','t','w','a','r','e', + '\\','M','i','c','r','o','s','o','f','t', + '\\','I','n','t','e','r','n','e','t',' ','E','x','p','l','o','r','e','r', + '\\','I','n','t','e','r','n','a','t','i','o','n','a','l',0}; + + res = RegOpenKeyW(HKEY_CURRENT_USER, international_keyW, &hkey); + if(res != ERROR_SUCCESS) + return; + + size = sizeof(langs); + res = RegQueryValueExA(hkey, "AcceptLanguage", 0, &type, (LPBYTE)langs, &size); + RegCloseKey(hkey); + if(res != ERROR_SUCCESS || type != REG_SZ) + return; + + TRACE("Setting lang %s\n", debugstr_a(langs)); + + nsres = nsIPrefBranch_SetCharPref(pref, "intl.accept_languages", langs); + if(NS_FAILED(nsres)) + ERR("SetCharPref failed: %08x\n", nsres); +} + static void set_profile(void) { + nsIPrefBranch *pref; nsIProfile *profile; PRBool exists = FALSE; nsresult nsres; @@ -280,6 +312,17 @@ static void set_profile(void) ERR("SetCurrentProfile failed: %08x\n", nsres); nsIProfile_Release(profile); + + nsres = nsIServiceManager_GetServiceByContractID(pServMgr, NS_PREFERENCES_CONTRACTID, + &IID_nsIPrefBranch, (void**)&pref); + if(NS_FAILED(nsres)) { + ERR("Could not get preference service: %08x\n", nsres); + return; + } + + set_lang(pref); + + nsIPrefBranch_Release(pref); } static BOOL init_xpcom(const PRUnichar *gre_path) diff --git a/dlls/mshtml/nsiface.idl b/dlls/mshtml/nsiface.idl index 8b00fbdce12..aac9a879606 100644 --- a/dlls/mshtml/nsiface.idl +++ b/dlls/mshtml/nsiface.idl @@ -1506,6 +1506,33 @@ interface nsIFile : nsISupports [ object, + uuid(56c35506-f14b-11d3-99d3-ddbfac2ccf65) + /* FROZEN */ +] +interface nsIPrefBranch : nsISupports +{ + nsresult GetRoot(char **aRoot); + nsresult GetPrefType(const char *aPrefName, PRInt32 *_retval); + nsresult GetBoolPref(const char *aPrefName, PRBool *_retval); + nsresult SetBoolPref(const char *aPrefName, PRInt32 aValue); + nsresult GetCharPref(const char *aPrefName, char **_retval); + nsresult SetCharPref(const char *aPrefName, const char *aValue); + nsresult GetIntPref(const char *aPrefName, PRInt32 *_retval); + nsresult SetIntPref(const char *aPrefName, PRInt32 aValue); + nsresult GetComplexValue(const char *aPrefName, const nsIID *aType, void **aValue); + nsresult SetComplexValue(const char *aPrefName, const nsIID *aType, nsISupports *aValue); + nsresult ClearUserPref(const char *aPrefName); + nsresult LockPref(const char *aPrefName); + nsresult PrefHasUserValue(const char *aPrefName, PRBool *_retval); + nsresult PrefIsLocked(const char *aPrefName, PRBool *_retval); + nsresult UnlockPref(const char *aPrefName); + nsresult DeleteBranch(const char *aStartingAt); + nsresult GetChildList(const char *aStartingAt, PRUint32 *aCount, char ***aChildArray); + nsresult ResetBranch(const char *aStartingAt); +} + +[ + object, uuid(15fd6940-8ea7-11d3-93ad-00104ba0fd40) /* FROZEN */ ] diff --git a/dlls/mshtml/persist.c b/dlls/mshtml/persist.c index 70da02ee40b..8a4ad254d73 100644 --- a/dlls/mshtml/persist.c +++ b/dlls/mshtml/persist.c @@ -429,7 +429,7 @@ static HRESULT WINAPI PersistMoniker_Load(IPersistMoniker *iface, BOOL fFullyAva return hres; if(!bind_complete) - return start_binding(This->bscallback); + return start_binding(This, This->bscallback); return S_OK; } diff --git a/dlls/mshtml/task.c b/dlls/mshtml/task.c index 5204a893cae..3a94cbca343 100644 --- a/dlls/mshtml/task.c +++ b/dlls/mshtml/task.c @@ -211,9 +211,10 @@ static void set_progress(HTMLDocument *doc) } } -static void task_start_binding(BSCallback *bscallback) +static void task_start_binding(HTMLDocument *doc, BSCallback *bscallback) { - start_binding(bscallback); + if(doc) + start_binding(doc, bscallback); IBindStatusCallback_Release(STATUSCLB(bscallback)); } @@ -230,7 +231,7 @@ static void process_task(task_t *task) set_progress(task->doc); break; case TASK_START_BINDING: - task_start_binding(task->bscallback); + task_start_binding(task->doc, task->bscallback); break; default: ERR("Wrong task_id %d\n", task->task_id); diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index efc0259dda4..b3accc76010 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -497,12 +497,14 @@ static void _test_range_moveend(unsigned line, IHTMLTxtRange *range, LPWSTR unit } #define test_range_put_text(r,t) _test_range_put_text(__LINE__,r,t) -static void _test_range_put_text(unsigned line, IHTMLTxtRange *range, LPCWSTR text) +static void _test_range_put_text(unsigned line, IHTMLTxtRange *range, const char *text) { HRESULT hres; + BSTR bstr = a2bstr(text); - hres = IHTMLTxtRange_put_text(range, (BSTR)text); + hres = IHTMLTxtRange_put_text(range, bstr); ok_(__FILE__,line) (hres == S_OK, "put_text failed: %08x\n", hres); + SysFreeString(bstr); _test_range_text(line, range, NULL); } @@ -759,6 +761,14 @@ static void test_txtrange(IHTMLDocument2 *doc) test_range_text(range, NULL); test_range_moveend(range, characterW, 3, 3); test_range_text(range, "c 1"); + test_range_expand(range, texteditW, VARIANT_TRUE, "test abc 123\r\nit's text"); + test_range_collapse(range, TRUE); + test_range_move(range, characterW, 4, 4); + test_range_moveend(range, characterW, 1, 1); + test_range_text(range, " "); + test_range_move(range, wordW, 1, 1); + test_range_moveend(range, characterW, 2, 2); + test_range_text(range, "ab"); IHTMLTxtRange_Release(range); @@ -838,7 +848,7 @@ static void test_txtrange(IHTMLDocument2 *doc) test_range_collapse(range, TRUE); test_range_expand(range, wordW, VARIANT_TRUE, "test "); - test_range_put_text(range, wordW); + test_range_put_text(range, "word"); test_range_text(body_range, "wordabc 123\r\nit's text"); test_range_text(range, NULL); test_range_moveend(range, characterW, 3, 3); @@ -878,6 +888,20 @@ static void test_txtrange(IHTMLDocument2 *doc) test_range_expand(range, texteditW, VARIANT_TRUE, "wordabc 123\r\nit's text"); test_range_move(range, characterW, 3, 3); test_range_expand(range, wordW, VARIANT_TRUE, "wordabc "); + test_range_moveend(range, characterW, -4, -4); + test_range_put_text(range, "abc def "); + test_range_expand(range, texteditW, VARIANT_TRUE, "abc def abc 123\r\nit's text"); + test_range_move(range, wordW, 1, 1); + test_range_movestart(range, characterW, -1, -1); + test_range_text(range, " "); + test_range_move(range, wordW, 1, 1); + test_range_moveend(range, characterW, 3, 3); + test_range_text(range, "def"); + test_range_put_text(range, "xyz"); + test_range_moveend(range, characterW, 1, 1); + test_range_move(range, wordW, 1, 1); + test_range_moveend(range, characterW, 2, 2); + test_range_text(range, "ab"); IHTMLTxtRange_Release(range); } diff --git a/dlls/mshtml/txtrange.c b/dlls/mshtml/txtrange.c index edafc9c7535..0ad3621e0f1 100644 --- a/dlls/mshtml/txtrange.c +++ b/dlls/mshtml/txtrange.c @@ -122,7 +122,7 @@ static int string_to_nscmptype(LPCWSTR str) static PRUint16 get_node_type(nsIDOMNode *node) { - PRUint16 type = 0xfff; + PRUint16 type = 0; if(node) nsIDOMNode_GetNodeType(node, &type); @@ -190,6 +190,8 @@ static void wstrbuf_append_nodetxt(wstrbuf_t *buf, LPCWSTR str, int len) const WCHAR *s = str; WCHAR *d; + TRACE("%s\n", debugstr_wn(str, len)); + if(buf->len+len >= buf->size) { buf->size = 2*buf->len+len; buf->buf = mshtml_realloc(buf->buf, buf->size * sizeof(WCHAR)); @@ -262,6 +264,9 @@ static BOOL fill_nodestr(dompos_t *pos) nsIDOMText_Release(text); nsAString_GetData(&pos->str, &pos->p, NULL); + if(pos->off == -1) + pos->off = *pos->p ? strlenW(pos->p)-1 : 0; + return TRUE; } @@ -416,7 +421,7 @@ static void set_range_pos(HTMLTxtRange *This, BOOL start, dompos_t *pos) else nsres = nsIDOMRange_SetStartBefore(This->nsrange, pos->node); }else { - if(pos->type == TEXT_NODE) + if(pos->type == TEXT_NODE && pos->p[pos->off+1]) nsres = nsIDOMRange_SetEnd(This->nsrange, pos->node, pos->off+1); else nsres = nsIDOMRange_SetEndAfter(This->nsrange, pos->node); @@ -520,6 +525,27 @@ static WCHAR get_pos_char(const dompos_t *pos) return 0; } +static void end_space(const dompos_t *pos, dompos_t *new_pos) +{ + const WCHAR *p; + + *new_pos = *pos; + dompos_addref(new_pos); + + if(pos->type != TEXT_NODE) + return; + + p = new_pos->p+new_pos->off; + + if(!*p || !isspace(*p)) + return; + + while(p[1] && isspace(p[1])) + p++; + + new_pos->off = p - new_pos->p; +} + static WCHAR next_char(const dompos_t *pos, dompos_t *new_pos) { nsIDOMNode *iter, *tmp; @@ -528,7 +554,13 @@ static WCHAR next_char(const dompos_t *pos, dompos_t *new_pos) WCHAR cspace = 0; if(pos->type == TEXT_NODE && pos->off != -1 && pos->p[pos->off]) { - p = pos->p+pos->off+1; + p = pos->p+pos->off; + + if(isspace(*p)) + while(isspaceW(*++p)); + else + p++; + if(*p && isspaceW(*p)) { cspace = ' '; while(p[1] && isspaceW(p[1])) @@ -540,7 +572,7 @@ static WCHAR next_char(const dompos_t *pos, dompos_t *new_pos) new_pos->off = p - pos->p; dompos_addref(new_pos); - return *p; + return cspace ? cspace : *p; }else { last_space = *pos; last_space.off = p - pos->p; @@ -719,8 +751,7 @@ static long move_next_chars(long cnt, const dompos_t *pos, BOOL col, const dompo ret++; if(ret >= cnt) { - *new_pos = *pos; - dompos_addref(new_pos); + end_space(pos, new_pos); return ret; } @@ -771,75 +802,102 @@ static long move_prev_chars(HTMLTxtRange *This, long cnt, const dompos_t *pos, B ret++; - if(bound_pos && dompos_cmp(&iter, bound_pos)) + if(bound_pos && dompos_cmp(&iter, bound_pos)) { *bounded = TRUE; + cnt--; + } } *new_pos = iter; - return ret; + return bounded && *bounded ? ret+1 : ret; } -static BOOL find_next_space(const dompos_t *pos, dompos_t *ret) +static long find_prev_space(HTMLTxtRange *This, const dompos_t *pos, BOOL first_space, dompos_t *ret) { dompos_t iter, tmp; WCHAR c; - c = next_char(pos, &iter); - if(!c) { + c = prev_char(This, pos, &iter); + if(!c || (first_space && isspaceW(c))) { *ret = iter; return FALSE; } - while(c && !isspaceW(c)) { + while(1) { tmp = iter; - c = next_char(&tmp, &iter); + c = prev_char(This, &tmp, &iter); + if(!c || isspaceW(c)) { + dompos_release(&iter); + break; + } dompos_release(&tmp); } - *ret = iter; + *ret = tmp; return TRUE; } -static long find_prev_space(HTMLTxtRange *This, const dompos_t *pos, BOOL first_space, dompos_t *ret) +static int find_word_end(const dompos_t *pos, dompos_t *ret) { dompos_t iter, tmp; + int cnt = 1; WCHAR c; + c = get_pos_char(pos); + if(isspaceW(c)) { + *ret = *pos; + dompos_addref(ret); + return 0; + } - c = prev_char(This, pos, &iter); - if(!c || (first_space && isspaceW(c))) { + c = next_char(pos, &iter); + if(!c) { *ret = iter; - return FALSE; + return 0; + } + if(c == '\n') { + *ret = *pos; + dompos_addref(ret); + return 0; } - while(1) { + while(c && !isspaceW(c)) { tmp = iter; - c = prev_char(This, &tmp, &iter); - if(!c || isspaceW(c)) { + c = next_char(&tmp, &iter); + if(c == '\n') { dompos_release(&iter); - break; + iter = tmp; + }else { + cnt++; + dompos_release(&tmp); } - dompos_release(&tmp); } - *ret = tmp; - return TRUE; + *ret = iter; + return cnt; } static long move_next_words(long cnt, const dompos_t *pos, dompos_t *new_pos) { dompos_t iter, tmp; long ret = 0; + WCHAR c; - iter = *pos; - dompos_addref(&iter); - - while(ret < cnt) { - if(!find_next_space(&iter, &tmp)) - break; - + c = get_pos_char(pos); + if(isspaceW(c)) { + end_space(pos, &iter); ret++; - dompos_release(&iter); - iter = tmp; + }else { + c = next_char(pos, &iter); + if(c && isspaceW(c)) + ret++; + } + + while(c && ret < cnt) { + tmp = iter; + c = next_char(&tmp, &iter); + dompos_release(&tmp); + if(isspaceW(c)) + ret++; } *new_pos = iter; @@ -1192,26 +1250,30 @@ static HRESULT WINAPI HTMLTxtRange_expand(IHTMLTxtRange *iface, BSTR Unit, VARIA switch(unit) { case RU_WORD: { - dompos_t end_pos, start_pos, new_pos; + dompos_t end_pos, start_pos, new_start_pos, new_end_pos; + PRBool collapsed; + + nsIDOMRange_GetCollapsed(This->nsrange, &collapsed); get_cur_pos(This, TRUE, &start_pos); get_cur_pos(This, FALSE, &end_pos); - if(!isspaceW(get_pos_char(&end_pos))) { - if(find_next_space(&end_pos, &new_pos)) { - set_range_pos(This, FALSE, &new_pos); - *Success = VARIANT_TRUE; - } - dompos_release(&new_pos); + if(find_word_end(&end_pos, &new_end_pos) || collapsed) { + set_range_pos(This, FALSE, &new_end_pos); + *Success = VARIANT_TRUE; } - if(find_prev_space(This, &start_pos, TRUE, &new_pos)) { - set_range_pos(This, TRUE, &new_pos); - *Success = VARIANT_TRUE; + if(start_pos.type && (get_pos_char(&end_pos) || !dompos_cmp(&new_end_pos, &end_pos))) { + if(find_prev_space(This, &start_pos, TRUE, &new_start_pos)) { + set_range_pos(This, TRUE, &new_start_pos); + *Success = VARIANT_TRUE; + } + dompos_release(&new_start_pos); } - dompos_release(&new_pos); + dompos_release(&new_end_pos); dompos_release(&end_pos); + dompos_release(&start_pos); break; } @@ -1268,11 +1330,9 @@ static HRESULT WINAPI HTMLTxtRange_move(IHTMLTxtRange *iface, BSTR Unit, if(unit == RU_UNKNOWN) return E_INVALIDARG; - IHTMLTxtRange_collapse(HTMLTXTRANGE(This), TRUE); - if(!Count) { *ActualCount = 0; - return S_OK; + return IHTMLTxtRange_collapse(HTMLTXTRANGE(This), TRUE); } switch(unit) { @@ -1284,8 +1344,9 @@ static HRESULT WINAPI HTMLTxtRange_move(IHTMLTxtRange *iface, BSTR Unit, if(Count > 0) { *ActualCount = move_next_chars(Count, &cur_pos, TRUE, NULL, NULL, &new_pos); set_range_pos(This, FALSE, &new_pos); - IHTMLTxtRange_collapse(HTMLTXTRANGE(This), FALSE); dompos_release(&new_pos); + + IHTMLTxtRange_collapse(HTMLTXTRANGE(This), FALSE); }else { *ActualCount = -move_prev_chars(This, -Count, &cur_pos, FALSE, NULL, NULL, &new_pos); set_range_pos(This, TRUE, &new_pos); @@ -1305,8 +1366,8 @@ static HRESULT WINAPI HTMLTxtRange_move(IHTMLTxtRange *iface, BSTR Unit, if(Count > 0) { *ActualCount = move_next_words(Count, &cur_pos, &new_pos); set_range_pos(This, FALSE, &new_pos); - IHTMLTxtRange_collapse(HTMLTXTRANGE(This), FALSE); dompos_release(&new_pos); + IHTMLTxtRange_collapse(HTMLTXTRANGE(This), FALSE); }else { *ActualCount = -move_prev_words(This, -Count, &cur_pos, &new_pos); set_range_pos(This, TRUE, &new_pos); diff --git a/dlls/msi/action.c b/dlls/msi/action.c index aaf8fdfe59d..ec2bbea9cb2 100644 --- a/dlls/msi/action.c +++ b/dlls/msi/action.c @@ -1727,6 +1727,8 @@ UINT MSI_SetFeatureStates(MSIPACKAGE *package) {'I','N','S','T','A','L','L','L','E','V','E','L',0}; static const WCHAR szAddLocal[] = {'A','D','D','L','O','C','A','L',0}; + static const WCHAR szAddSource[] = + {'A','D','D','S','O','U','R','C','E',0}; static const WCHAR szRemove[] = {'R','E','M','O','V','E',0}; static const WCHAR szReinstall[] = @@ -1766,6 +1768,7 @@ UINT MSI_SetFeatureStates(MSIPACKAGE *package) */ override |= process_state_property(package,szAddLocal,INSTALLSTATE_LOCAL); override |= process_state_property(package,szRemove,INSTALLSTATE_ABSENT); + override |= process_state_property(package,szAddSource,INSTALLSTATE_SOURCE); override |= process_state_property(package,szReinstall,INSTALLSTATE_LOCAL); if (!override) diff --git a/dlls/msi/create.c b/dlls/msi/create.c index ed6b43a46c6..ae9f69c68f6 100644 --- a/dlls/msi/create.c +++ b/dlls/msi/create.c @@ -135,6 +135,7 @@ static const MSIVIEWOPS create_ops = NULL, NULL, NULL, + NULL, }; static UINT check_columns( column_info *col_info ) diff --git a/dlls/msi/msi_main.c b/dlls/msi/msi_main.c index cf3f30cded2..2c32b3bc3f9 100644 --- a/dlls/msi/msi_main.c +++ b/dlls/msi/msi_main.c @@ -44,10 +44,11 @@ INSTALLUI_HANDLERW gUIHandlerW = NULL; DWORD gUIFilter = 0; LPVOID gUIContext = NULL; WCHAR gszLogFile[MAX_PATH]; -WCHAR msi_path[MAX_PATH]; -ITypeLib *msi_typelib = NULL; HINSTANCE msi_hInstance; +static WCHAR msi_path[MAX_PATH]; +static ITypeLib *msi_typelib; + /* * Dll lifetime tracking declaration */ diff --git a/dlls/msi/tests/package.c b/dlls/msi/tests/package.c index 9b4ae440da0..6574a800ccf 100644 --- a/dlls/msi/tests/package.c +++ b/dlls/msi/tests/package.c @@ -187,6 +187,29 @@ static UINT create_property_table( MSIHANDLE hdb ) "PRIMARY KEY `Property`)" ); } +static UINT create_install_execute_sequence_table( MSIHANDLE hdb ) +{ + return run_query( hdb, + "CREATE TABLE `InstallExecuteSequence` (" + "`Action` CHAR(72) NOT NULL, " + "`Condition` CHAR(255), " + "`Sequence` SHORT " + "PRIMARY KEY `Action`)" ); +} + +static UINT create_media_table( MSIHANDLE hdb ) +{ + return run_query( hdb, + "CREATE TABLE `Media` (" + "`DiskId` SHORT NOT NULL, " + "`LastSequence` SHORT NOT NULL, " + "`DiskPrompt` CHAR(64), " + "`Cabinet` CHAR(255), " + "`VolumeLabel` CHAR(32), " + "`Source` CHAR(72) " + "PRIMARY KEY `DiskId`)" ); +} + static UINT add_component_entry( MSIHANDLE hdb, const char *values ) { char insert[] = "INSERT INTO `Component` " @@ -331,6 +354,38 @@ static UINT add_property_entry( MSIHANDLE hdb, const char *values ) return r; } +static UINT add_install_execute_sequence_entry( MSIHANDLE hdb, const char *values ) +{ + char insert[] = "INSERT INTO `InstallExecuteSequence` " + "(`Action`, `Condition`, `Sequence`) " + "VALUES( %s )"; + char *query; + UINT sz, r; + + sz = strlen(values) + sizeof insert; + query = HeapAlloc(GetProcessHeap(),0,sz); + sprintf(query,insert,values); + r = run_query( hdb, query ); + HeapFree(GetProcessHeap(), 0, query); + return r; +} + +static UINT add_media_entry( MSIHANDLE hdb, const char *values ) +{ + char insert[] = "INSERT INTO `Media` " + "(`DiskId`, `LastSequence`, `DiskPrompt`, `Cabinet`, `VolumeLabel`, `Source`) " + "VALUES( %s )"; + char *query; + UINT sz, r; + + sz = strlen(values) + sizeof insert; + query = HeapAlloc(GetProcessHeap(),0,sz); + sprintf(query,insert,values); + r = run_query( hdb, query ); + HeapFree(GetProcessHeap(), 0, query); + return r; +} + static UINT set_summary_info(MSIHANDLE hdb) { UINT res; @@ -1930,6 +1985,9 @@ static void test_formatrecord2(void) DeleteFile(msifile); } +/* FIXME: state is INSTALLSTATE_UNKNOWN if any features are removed and the + * feature in question is not in ADD* + */ static void test_states(void) { MSIHANDLE hpkg; @@ -1943,6 +2001,63 @@ static void test_states(void) r = add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'"); ok( r == ERROR_SUCCESS, "cannot add directory: %d\n", r ); + r = create_property_table( hdb ); + ok( r == ERROR_SUCCESS, "cannot create Property table: %d\n", r ); + + r = add_property_entry( hdb, "'ProductCode', '{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}'" ); + ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r ); + + r = add_property_entry( hdb, "'ProductLanguage', '1033'" ); + ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r ); + + r = add_property_entry( hdb, "'ProductName', 'MSITEST'" ); + ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r ); + + r = add_property_entry( hdb, "'ProductVersion', '1.1.1'" ); + ok( r == ERROR_SUCCESS, "cannot add property entry: %d\n", r ); + + r = create_install_execute_sequence_table( hdb ); + ok( r == ERROR_SUCCESS, "cannot create InstallExecuteSequence table: %d\n", r ); + + r = add_install_execute_sequence_entry( hdb, "'CostInitialize', '', '800'" ); + ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r ); + + r = add_install_execute_sequence_entry( hdb, "'FileCost', '', '900'" ); + ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r ); + + r = add_install_execute_sequence_entry( hdb, "'CostFinalize', '', '1000'" ); + ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r ); + + r = add_install_execute_sequence_entry( hdb, "'InstallValidate', '', '1400'" ); + ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r ); + + r = add_install_execute_sequence_entry( hdb, "'InstallInitialize', '', '1500'" ); + ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r ); + + r = add_install_execute_sequence_entry( hdb, "'ProcessComponents', '', '1600'" ); + ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r ); + + r = add_install_execute_sequence_entry( hdb, "'UnpublishFeatures', '', '1800'" ); + ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r ); + + r = add_install_execute_sequence_entry( hdb, "'RegisterProduct', '', '6100'" ); + ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r ); + + r = add_install_execute_sequence_entry( hdb, "'PublishFeatures', '', '6300'" ); + ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r ); + + r = add_install_execute_sequence_entry( hdb, "'PublishProduct', '', '6400'" ); + ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r ); + + r = add_install_execute_sequence_entry( hdb, "'InstallFinalize', '', '6600'" ); + ok( r == ERROR_SUCCESS, "cannot add install execute sequence entry: %d\n", r ); + + r = create_media_table( hdb ); + ok( r == ERROR_SUCCESS, "cannot create media table: %d\n", r ); + + r = add_media_entry( hdb, "'1', '3', '', '', 'DISK1', ''"); + ok( r == ERROR_SUCCESS, "cannot add media entry: %d\n", r ); + r = create_feature_table( hdb ); ok( r == ERROR_SUCCESS, "cannot create Feature table: %d\n", r ); @@ -2009,6 +2124,46 @@ static void test_states(void) r = add_component_entry( hdb, "'kappa', '{D6B93DC3-8DA5-4769-9888-42BFE156BB8B}', 'TARGETDIR', 1, '', 'kappa_file'" ); ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r ); + /* msidbFeatureAttributesFavorLocal:removed */ + r = add_feature_entry( hdb, "'six', '', '', '', 2, 1, '', 0" ); + ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r ); + + /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesLocalOnly */ + r = add_component_entry( hdb, "'lambda', '{6528C5E4-02A4-4636-A214-7A66A6C35B64}', 'TARGETDIR', 0, '', 'lambda_file'" ); + ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r ); + + /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSourceOnly */ + r = add_component_entry( hdb, "'mu', '{97014BAB-6C56-4013-9A63-2BF913B42519}', 'TARGETDIR', 1, '', 'mu_file'" ); + ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r ); + + /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesOptional */ + r = add_component_entry( hdb, "'nu', '{943DD0D8-5808-4954-8526-3B8493FEDDCD}', 'TARGETDIR', 2, '', 'nu_file'" ); + ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r ); + + /* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSharedDllRefCount */ + r = add_component_entry( hdb, "'xi', '{D6CF9EF7-6FCF-4930-B34B-F938AEFF9BDB}', 'TARGETDIR', 8, '', 'xi_file'" ); + ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r ); + + /* msidbFeatureAttributesFavorSource:removed */ + r = add_feature_entry( hdb, "'seven', '', '', '', 2, 1, '', 1" ); + ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r ); + + /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesLocalOnly */ + r = add_component_entry( hdb, "'omicron', '{7B57521D-15DB-4141-9AA6-01D934A4433F}', 'TARGETDIR', 0, '', 'omicron_file'" ); + ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r ); + + /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSourceOnly */ + r = add_component_entry( hdb, "'pi', '{FB85346B-378E-4492-8769-792305471C81}', 'TARGETDIR', 1, '', 'pi_file'" ); + ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r ); + + /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesOptional */ + r = add_component_entry( hdb, "'rho', '{798F2047-7B0C-4783-8BB0-D703E554114B}', 'TARGETDIR', 2, '', 'rho_file'" ); + ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r ); + + /* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSharedDllRefCount */ + r = add_component_entry( hdb, "'sigma', '{5CE9DDA8-B67B-4736-9D93-99D61C5B93E7}', 'TARGETDIR', 8, '', 'sigma_file'" ); + ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r ); + r = create_feature_components_table( hdb ); ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r ); @@ -2045,6 +2200,30 @@ static void test_states(void) r = add_feature_components_entry( hdb, "'five', 'eta'" ); ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r ); + r = add_feature_components_entry( hdb, "'six', 'lambda'" ); + ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r ); + + r = add_feature_components_entry( hdb, "'six', 'mu'" ); + ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r ); + + r = add_feature_components_entry( hdb, "'six', 'nu'" ); + ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r ); + + r = add_feature_components_entry( hdb, "'six', 'xi'" ); + ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r ); + + r = add_feature_components_entry( hdb, "'seven', 'omicron'" ); + ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r ); + + r = add_feature_components_entry( hdb, "'seven', 'pi'" ); + ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r ); + + r = add_feature_components_entry( hdb, "'seven', 'rho'" ); + ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r ); + + r = add_feature_components_entry( hdb, "'seven', 'sigma'" ); + ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r ); + r = create_file_table( hdb ); ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r ); @@ -2079,10 +2258,46 @@ static void test_states(void) r = add_file_entry( hdb, "'kappa_file', 'kappa', 'kappa.txt', 0, '', '1033', 8192, 1" ); ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r); + r = add_file_entry( hdb, "'lambda_file', 'lambda', 'lambda.txt', 100, '', '1033', 8192, 1" ); + ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r); + + r = add_file_entry( hdb, "'mu_file', 'mu', 'mu.txt', 100, '', '1033', 8192, 1" ); + ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r); + + r = add_file_entry( hdb, "'nu_file', 'nu', 'nu.txt', 100, '', '1033', 8192, 1" ); + ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r); + + r = add_file_entry( hdb, "'xi_file', 'xi', 'xi.txt', 100, '', '1033', 8192, 1" ); + ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r); + + r = add_file_entry( hdb, "'omicron_file', 'omicron', 'omicron.txt', 100, '', '1033', 8192, 1" ); + ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r); + + r = add_file_entry( hdb, "'pi_file', 'pi', 'pi.txt', 100, '', '1033', 8192, 1" ); + ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r); + + r = add_file_entry( hdb, "'rho_file', 'rho', 'rho.txt', 100, '', '1033', 8192, 1" ); + ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r); + + r = add_file_entry( hdb, "'sigma_file', 'sigma', 'sigma.txt', 100, '', '1033', 8192, 1" ); + ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r); + + MsiDatabaseCommit(hdb); + + /* these properties must not be in the saved msi file */ + r = add_property_entry( hdb, "'ADDLOCAL', 'one,four'"); + ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r ); + + r = add_property_entry( hdb, "'ADDSOURCE', 'two,three'"); + ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r ); + + r = add_property_entry( hdb, "'REMOVE', 'six,seven'"); + ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r ); + hpkg = package_from_db( hdb ); ok( hpkg, "failed to create package\n"); - MsiCloseHandle( hdb ); + MsiCloseHandle(hdb); state = 0xdeadbee; action = 0xdeadbee; @@ -2121,6 +2336,20 @@ static void test_states(void) state = 0xdeadbee; action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "six", &state, &action); + ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r ); + ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state); + ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "seven", &state, &action); + ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r ); + ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state); + ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; r = MsiGetComponentState(hpkg, "alpha", &state, &action); ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r ); ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state); @@ -2189,6 +2418,62 @@ static void test_states(void) ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state); ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action); + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "lambda", &state, &action); + ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r ); + ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state); + ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "mu", &state, &action); + ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r ); + ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state); + ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "nu", &state, &action); + ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r ); + ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state); + ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "xi", &state, &action); + ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r ); + ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state); + ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "omicron", &state, &action); + ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r ); + ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state); + ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "pi", &state, &action); + ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r ); + ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state); + ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "rho", &state, &action); + ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r ); + ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state); + ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "sigma", &state, &action); + ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r ); + ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state); + ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action); + r = MsiDoAction( hpkg, "CostInitialize"); ok( r == ERROR_SUCCESS, "cost init failed\n"); @@ -2229,6 +2514,20 @@ static void test_states(void) state = 0xdeadbee; action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "six", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "seven", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; r = MsiGetComponentState(hpkg, "alpha", &state, &action); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); @@ -2297,224 +2596,1260 @@ static void test_states(void) ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); - r = MsiDoAction( hpkg, "FileCost"); - ok( r == ERROR_SUCCESS, "file cost failed\n"); - state = 0xdeadbee; action = 0xdeadbee; - r = MsiGetFeatureState(hpkg, "one", &state, &action); + r = MsiGetComponentState(hpkg, "lambda", &state, &action); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); state = 0xdeadbee; action = 0xdeadbee; - r = MsiGetFeatureState(hpkg, "two", &state, &action); + r = MsiGetComponentState(hpkg, "mu", &state, &action); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); state = 0xdeadbee; action = 0xdeadbee; - r = MsiGetFeatureState(hpkg, "three", &state, &action); + r = MsiGetComponentState(hpkg, "nu", &state, &action); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); state = 0xdeadbee; action = 0xdeadbee; - r = MsiGetFeatureState(hpkg, "four", &state, &action); + r = MsiGetComponentState(hpkg, "xi", &state, &action); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); state = 0xdeadbee; action = 0xdeadbee; - r = MsiGetFeatureState(hpkg, "five", &state, &action); + r = MsiGetComponentState(hpkg, "omicron", &state, &action); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); state = 0xdeadbee; action = 0xdeadbee; - r = MsiGetComponentState(hpkg, "alpha", &state, &action); + r = MsiGetComponentState(hpkg, "pi", &state, &action); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); state = 0xdeadbee; action = 0xdeadbee; - r = MsiGetComponentState(hpkg, "beta", &state, &action); + r = MsiGetComponentState(hpkg, "rho", &state, &action); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); state = 0xdeadbee; action = 0xdeadbee; - r = MsiGetComponentState(hpkg, "gamma", &state, &action); + r = MsiGetComponentState(hpkg, "sigma", &state, &action); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + r = MsiDoAction( hpkg, "FileCost"); + ok( r == ERROR_SUCCESS, "file cost failed\n"); + state = 0xdeadbee; action = 0xdeadbee; - r = MsiGetComponentState(hpkg, "theta", &state, &action); + r = MsiGetFeatureState(hpkg, "one", &state, &action); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); state = 0xdeadbee; action = 0xdeadbee; - r = MsiGetComponentState(hpkg, "delta", &state, &action); + r = MsiGetFeatureState(hpkg, "two", &state, &action); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); state = 0xdeadbee; action = 0xdeadbee; - r = MsiGetComponentState(hpkg, "epsilon", &state, &action); + r = MsiGetFeatureState(hpkg, "three", &state, &action); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); state = 0xdeadbee; action = 0xdeadbee; - r = MsiGetComponentState(hpkg, "zeta", &state, &action); + r = MsiGetFeatureState(hpkg, "four", &state, &action); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); state = 0xdeadbee; action = 0xdeadbee; - r = MsiGetComponentState(hpkg, "iota", &state, &action); + r = MsiGetFeatureState(hpkg, "five", &state, &action); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); state = 0xdeadbee; action = 0xdeadbee; - r = MsiGetComponentState(hpkg, "eta", &state, &action); + r = MsiGetFeatureState(hpkg, "six", &state, &action); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); state = 0xdeadbee; action = 0xdeadbee; - r = MsiGetComponentState(hpkg, "kappa", &state, &action); + r = MsiGetFeatureState(hpkg, "seven", &state, &action); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); - r = MsiDoAction( hpkg, "CostFinalize"); - ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r); - - state = 0xdeadbee; - action = 0xdeadbee; - r = MsiGetFeatureState(hpkg, "one", &state, &action); - ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); - ok( state == INSTALLSTATE_ABSENT, "Expected one INSTALLSTATE_ABSENT, got %d\n", state); - ok( action == INSTALLSTATE_LOCAL, "Expected one INSTALLSTATE_LOCAL, got %d\n", action); - - state = 0xdeadbee; - action = 0xdeadbee; - r = MsiGetFeatureState(hpkg, "two", &state, &action); - ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); - ok( state == INSTALLSTATE_ABSENT, "Expected two INSTALLSTATE_ABSENT, got %d\n", state); - ok( action == INSTALLSTATE_SOURCE, "Expected two INSTALLSTATE_SOURCE, got %d\n", action); - - state = 0xdeadbee; - action = 0xdeadbee; - r = MsiGetFeatureState(hpkg, "three", &state, &action); - ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); - ok( state == INSTALLSTATE_ABSENT, "Expected three INSTALLSTATE_ABSENT, got %d\n", state); - ok( action == INSTALLSTATE_LOCAL, "Expected three INSTALLSTATE_LOCAL, got %d\n", action); - - state = 0xdeadbee; - action = 0xdeadbee; - r = MsiGetFeatureState(hpkg, "four", &state, &action); - ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); - ok( state == INSTALLSTATE_ABSENT, "Expected four INSTALLSTATE_ABSENT, got %d\n", state); - ok( action == INSTALLSTATE_LOCAL, "Expected four INSTALLSTATE_LOCAL, got %d\n", action); - - state = 0xdeadbee; - action = 0xdeadbee; - r = MsiGetFeatureState(hpkg, "five", &state, &action); - ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); - ok( state == INSTALLSTATE_ABSENT, "Expected five INSTALLSTATE_ABSENT, got %d\n", state); - ok( action == INSTALLSTATE_UNKNOWN, "Expected five INSTALLSTATE_UNKNOWN, got %d\n", action); - state = 0xdeadbee; action = 0xdeadbee; r = MsiGetComponentState(hpkg, "alpha", &state, &action); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); - ok( state == INSTALLSTATE_ABSENT, "Expected alpha INSTALLSTATE_ABSENT, got %d\n", state); - ok( action == INSTALLSTATE_LOCAL, "Expected alpha INSTALLSTATE_LOCAL, got %d\n", action); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); state = 0xdeadbee; action = 0xdeadbee; r = MsiGetComponentState(hpkg, "beta", &state, &action); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); - ok( state == INSTALLSTATE_ABSENT, "Expected beta INSTALLSTATE_ABSENT, got %d\n", state); - ok( action == INSTALLSTATE_SOURCE, "Expected beta INSTALLSTATE_SOURCE, got %d\n", action); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); state = 0xdeadbee; action = 0xdeadbee; r = MsiGetComponentState(hpkg, "gamma", &state, &action); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); - ok( state == INSTALLSTATE_ABSENT, "Expected gamma INSTALLSTATE_ABSENT, got %d\n", state); - ok( action == INSTALLSTATE_LOCAL, "Expected gamma INSTALLSTATE_LOCAL, got %d\n", action); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); state = 0xdeadbee; action = 0xdeadbee; r = MsiGetComponentState(hpkg, "theta", &state, &action); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); - ok( state == INSTALLSTATE_ABSENT, "Expected theta INSTALLSTATE_ABSENT, got %d\n", state); - ok( action == INSTALLSTATE_LOCAL, "Expected theta INSTALLSTATE_LOCAL, got %d\n", action); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); state = 0xdeadbee; action = 0xdeadbee; r = MsiGetComponentState(hpkg, "delta", &state, &action); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); - ok( state == INSTALLSTATE_ABSENT, "Expected delta INSTALLSTATE_ABSENT, got %d\n", state); - ok( action == INSTALLSTATE_LOCAL, "Expected delta INSTALLSTATE_LOCAL, got %d\n", action); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); state = 0xdeadbee; action = 0xdeadbee; r = MsiGetComponentState(hpkg, "epsilon", &state, &action); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); - ok( state == INSTALLSTATE_ABSENT, "Expected epsilon INSTALLSTATE_ABSENT, got %d\n", state); - ok( action == INSTALLSTATE_SOURCE, "Expected epsilon INSTALLSTATE_SOURCE, got %d\n", action); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); state = 0xdeadbee; action = 0xdeadbee; r = MsiGetComponentState(hpkg, "zeta", &state, &action); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); - ok( state == INSTALLSTATE_ABSENT, "Expected zeta INSTALLSTATE_ABSENT, got %d\n", state); - ok( action == INSTALLSTATE_SOURCE, "Expected zeta INSTALLSTATE_SOURCE, got %d\n", action); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); state = 0xdeadbee; action = 0xdeadbee; r = MsiGetComponentState(hpkg, "iota", &state, &action); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); - ok( state == INSTALLSTATE_ABSENT, "Expected iota INSTALLSTATE_ABSENT, got %d\n", state); - ok( action == INSTALLSTATE_LOCAL, "Expected iota INSTALLSTATE_LOCAL, got %d\n", action); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); state = 0xdeadbee; action = 0xdeadbee; r = MsiGetComponentState(hpkg, "eta", &state, &action); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); - ok( state == INSTALLSTATE_ABSENT, "Expected eta INSTALLSTATE_ABSENT, got %d\n", state); - ok( action == INSTALLSTATE_LOCAL, "Expected eta INSTALLSTATE_LOCAL, got %d\n", action); - + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "kappa", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "lambda", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "mu", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "nu", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "xi", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "omicron", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "pi", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "rho", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "sigma", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + r = MsiDoAction( hpkg, "CostFinalize"); + ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "one", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state); + ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "two", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state); + ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "three", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state); + ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "four", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state); + ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "five", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "six", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state); + todo_wine + { + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + } + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "seven", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state); + todo_wine + { + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + } + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "alpha", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state); + ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "beta", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state); + ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "gamma", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state); + ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "theta", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state); + ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "delta", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state); + ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "epsilon", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state); + ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "zeta", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state); + ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "iota", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state); + ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "eta", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state); + ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action); + state = 0xdeadbee; action = 0xdeadbee; r = MsiGetComponentState(hpkg, "kappa", &state, &action); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); - ok( state == INSTALLSTATE_ABSENT, "Expected kappa INSTALLSTATE_ABSENT, got %d\n", state); - ok( action == INSTALLSTATE_UNKNOWN, "Expected kappa INSTALLSTATE_UNKNOWN, got %d\n", action); + ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "lambda", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state); + todo_wine + { + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + } + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "mu", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state); + todo_wine + { + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + } + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "nu", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state); + todo_wine + { + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + } + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "xi", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state); + todo_wine + { + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + } + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "omicron", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state); + todo_wine + { + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + } + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "pi", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state); + todo_wine + { + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + } + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "rho", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state); + todo_wine + { + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + } + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "sigma", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state); + todo_wine + { + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + } MsiCloseHandle( hpkg ); - DeleteFileA( msifile ); + + /* publish the features and components */ + r = MsiInstallProduct(msifile, "ADDLOCAL=one,four ADDSOURCE=two,three REMOVE=six,seven"); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + + r = MsiOpenDatabase(msifile, MSIDBOPEN_DIRECT, &hdb); + ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r); + + /* these properties must not be in the saved msi file */ + r = add_property_entry( hdb, "'ADDLOCAL', 'one,four'"); + ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r ); + + r = add_property_entry( hdb, "'ADDSOURCE', 'two,three'"); + ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r ); + + r = add_property_entry( hdb, "'REMOVE', 'six,seven'"); + ok( r == ERROR_SUCCESS, "cannot add property: %d\n", r ); + + hpkg = package_from_db( hdb ); + ok( hpkg, "failed to create package\n"); + + MsiCloseHandle(hdb); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "one", &state, &action); + ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r ); + ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state); + ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "two", &state, &action); + ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r ); + ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state); + ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "three", &state, &action); + ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r ); + ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state); + ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "four", &state, &action); + ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r ); + ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state); + ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "five", &state, &action); + ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r ); + ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state); + ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "six", &state, &action); + ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r ); + ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state); + ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "seven", &state, &action); + ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r ); + ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state); + ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "alpha", &state, &action); + ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r ); + ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state); + ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "beta", &state, &action); + ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r ); + ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state); + ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "gamma", &state, &action); + ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r ); + ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state); + ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "theta", &state, &action); + ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r ); + ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state); + ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "delta", &state, &action); + ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r ); + ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state); + ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "epsilon", &state, &action); + ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r ); + ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state); + ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "zeta", &state, &action); + ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r ); + ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state); + ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "iota", &state, &action); + ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r ); + ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state); + ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "eta", &state, &action); + ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r ); + ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state); + ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "kappa", &state, &action); + ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r ); + ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state); + ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "lambda", &state, &action); + ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r ); + ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state); + ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "mu", &state, &action); + ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r ); + ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state); + ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "nu", &state, &action); + ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r ); + ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state); + ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "xi", &state, &action); + ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r ); + ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state); + ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "omicron", &state, &action); + ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r ); + ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state); + ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "pi", &state, &action); + ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r ); + ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state); + ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "rho", &state, &action); + ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r ); + ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state); + ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "sigma", &state, &action); + ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r ); + ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state); + ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action); + + r = MsiDoAction( hpkg, "CostInitialize"); + ok( r == ERROR_SUCCESS, "cost init failed\n"); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "one", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "two", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "three", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "four", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "five", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "six", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "seven", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "alpha", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "beta", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "gamma", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "theta", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "delta", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "epsilon", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "zeta", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "iota", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "eta", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "kappa", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "lambda", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "mu", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "nu", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "xi", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "omicron", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "pi", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "rho", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "sigma", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + r = MsiDoAction( hpkg, "FileCost"); + ok( r == ERROR_SUCCESS, "file cost failed\n"); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "one", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "two", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "three", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "four", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "five", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "six", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "seven", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "alpha", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "beta", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "gamma", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "theta", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "delta", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "epsilon", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "zeta", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "iota", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "eta", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "kappa", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "lambda", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "mu", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "nu", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "xi", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "omicron", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "pi", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "rho", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "sigma", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + r = MsiDoAction( hpkg, "CostFinalize"); + ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "one", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + todo_wine + { + ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state); + } + ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "two", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + todo_wine + { + ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state); + } + ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "three", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + todo_wine + { + ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); + } + ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "four", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + todo_wine + { + ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); + } + ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "five", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + todo_wine + { + ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state); + } + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "six", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state); + todo_wine + { + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + } + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "seven", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state); + todo_wine + { + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + } + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "alpha", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + todo_wine + { + ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); + } + ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "beta", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + todo_wine + { + ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state); + } + ok( action == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "gamma", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + todo_wine + { + ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); + } + ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "theta", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + todo_wine + { + ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); + } + ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "delta", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + todo_wine + { + ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); + } + ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "epsilon", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + todo_wine + { + ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + } + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "zeta", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + todo_wine + { + ok( state == INSTALLSTATE_SOURCE, "Expected INSTALLSTATE_SOURCE, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + } + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "iota", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + todo_wine + { + ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); + } + ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "eta", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + todo_wine + { + ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); + } + ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "kappa", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "lambda", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state); + todo_wine + { + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + } + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "mu", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state); + todo_wine + { + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + } + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "nu", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state); + todo_wine + { + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + } + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "xi", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state); + todo_wine + { + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + } + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "omicron", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state); + todo_wine + { + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + } + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "pi", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state); + todo_wine + { + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + } + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "rho", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state); + todo_wine + { + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + } + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetComponentState(hpkg, "sigma", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state); + todo_wine + { + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + } + + MsiCloseHandle(hpkg); + + /* uninstall the product */ + r = MsiInstallProduct(msifile, "REMOVE=ALL"); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + + DeleteFileA(msifile); } static void test_getproperty(void) diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index f626e8fbded..b1444c0f94c 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -1929,6 +1929,7 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, ME_CommitUndo(editor); ME_EmptyUndoStack(editor); ME_SetSelection(editor, 0, 0); + editor->nModifyStep = 0; ME_UpdateRepaint(editor); return 1; } diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c index f5902ed824b..c5bde6a627b 100644 --- a/dlls/riched20/tests/editor.c +++ b/dlls/riched20/tests/editor.c @@ -1546,10 +1546,8 @@ static void test_EM_GETMODIFY(void) SendMessage(hwndRichEdit, EM_SETMODIFY, FALSE, 0); SendMessage(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)TestItem2); result = SendMessage(hwndRichEdit, EM_GETMODIFY, 0, 0); - todo_wine { ok (result == 0, "EM_GETMODIFY returned non-zero for WM_SETTEXT\n"); - } /* clear the text */ SendMessage(hwndRichEdit, EM_SETMODIFY, FALSE, 0); diff --git a/dlls/rpcrt4/tests/server.c b/dlls/rpcrt4/tests/server.c index b01967d5a4f..ad0dd73c560 100644 --- a/dlls/rpcrt4/tests/server.c +++ b/dlls/rpcrt4/tests/server.c @@ -487,6 +487,16 @@ s_sum_pcarr2(int n, int **pa) return s_sum_conf_array(*pa, n); } +int +s_sum_L1_norms(int n, vector_t *vs) +{ + int i; + int sum = 0; + for (i = 0; i < n; ++i) + sum += abs(vs[i].x) + abs(vs[i].y) + abs(vs[i].z); + return sum; +} + void s_stop(void) { @@ -983,6 +993,8 @@ array_tests(void) make_pyramid_doub_carr(4, &dc); ok(check_pyramid_doub_carr(dc), "RPC make_pyramid_doub_carr\n"); free_pyramid_doub_carr(dc); + + ok(sum_L1_norms(2, vs) == 21, "RPC sum_L1_norms\n"); } static void diff --git a/dlls/rpcrt4/tests/server.idl b/dlls/rpcrt4/tests/server.idl index c566b8f6e60..c054196c4ec 100644 --- a/dlls/rpcrt4/tests/server.idl +++ b/dlls/rpcrt4/tests/server.idl @@ -298,6 +298,7 @@ cpp_quote("#endif") void get_name([in,out] name_t *name); int sum_pcarr2(int n, [size_is(, n)] int **pa); + int sum_L1_norms(int n, [size_is(n)] vector_t *vs); void stop(void); } diff --git a/dlls/rsaenh/mpi.c b/dlls/rsaenh/mpi.c index a7408a4243c..c6f083b6e2e 100644 --- a/dlls/rsaenh/mpi.c +++ b/dlls/rsaenh/mpi.c @@ -31,6 +31,9 @@ #include #include "tomcrypt.h" +/* table of first PRIME_SIZE primes */ +static const mp_digit __prime_tab[]; + /* Known optimal configurations CPU /Compiler /MUL CUTOFF/SQR CUTOFF ------------------------------------------------------------- @@ -3808,7 +3811,7 @@ mp_zero (mp_int * a) memset (a->dp, 0, sizeof (mp_digit) * a->alloc); } -const mp_digit __prime_tab[] = { +static const mp_digit __prime_tab[] = { 0x0002, 0x0003, 0x0005, 0x0007, 0x000B, 0x000D, 0x0011, 0x0013, 0x0017, 0x001D, 0x001F, 0x0025, 0x0029, 0x002B, 0x002F, 0x0035, 0x003B, 0x003D, 0x0043, 0x0047, 0x0049, 0x004F, 0x0053, 0x0059, diff --git a/dlls/rsaenh/tomcrypt.h b/dlls/rsaenh/tomcrypt.h index b9e29d9d5a0..53c2f40b39a 100644 --- a/dlls/rsaenh/tomcrypt.h +++ b/dlls/rsaenh/tomcrypt.h @@ -473,9 +473,6 @@ int mp_exptmod(const mp_int *a, const mp_int *b, mp_int *c, mp_int *d); /* number of primes */ #define PRIME_SIZE 256 -/* table of first PRIME_SIZE primes */ -extern const mp_digit __prime_tab[]; - /* result=1 if a is divisible by one of the first PRIME_SIZE primes */ int mp_prime_is_divisible(const mp_int *a, int *result); diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c index 9f27333833c..4819495f8db 100644 --- a/dlls/setupapi/devinst.c +++ b/dlls/setupapi/devinst.c @@ -164,6 +164,7 @@ static void SETUPDI_FreeInterfaceInstances(struct InterfaceInstances *instances) } HeapFree(GetProcessHeap(), 0, ifaceInfo->referenceString); HeapFree(GetProcessHeap(), 0, ifaceInfo->symbolicLink); + HeapFree(GetProcessHeap(), 0, ifaceInfo); } HeapFree(GetProcessHeap(), 0, instances->instances); } diff --git a/dlls/setupapi/query.c b/dlls/setupapi/query.c index 68193d72600..c5dce78319a 100644 --- a/dlls/setupapi/query.c +++ b/dlls/setupapi/query.c @@ -625,7 +625,7 @@ BOOL WINAPI SetupQueryInfOriginalFileInformationA( if (OriginalFileInfo->cbSize != sizeof(*OriginalFileInfo)) { - ERR("incorrect OriginalFileInfo->cbSize of %d\n", OriginalFileInfo->cbSize); + WARN("incorrect OriginalFileInfo->cbSize of %d\n", OriginalFileInfo->cbSize); SetLastError( ERROR_INVALID_USER_BUFFER ); return FALSE; } @@ -635,9 +635,9 @@ BOOL WINAPI SetupQueryInfOriginalFileInformationA( AlternativePlatformInfo, &OriginalFileInfoW); if (ret) { - WideCharToMultiByte(CP_ACP, 0, OriginalFileInfoW.OriginalInfName, MAX_PATH, + WideCharToMultiByte(CP_ACP, 0, OriginalFileInfoW.OriginalInfName, -1, OriginalFileInfo->OriginalInfName, MAX_PATH, NULL, NULL); - WideCharToMultiByte(CP_ACP, 0, OriginalFileInfoW.OriginalCatalogName, MAX_PATH, + WideCharToMultiByte(CP_ACP, 0, OriginalFileInfoW.OriginalCatalogName, -1, OriginalFileInfo->OriginalCatalogName, MAX_PATH, NULL, NULL); } @@ -663,8 +663,9 @@ BOOL WINAPI SetupQueryInfOriginalFileInformationW( if (OriginalFileInfo->cbSize != sizeof(*OriginalFileInfo)) { - ERR("incorrect OriginalFileInfo->cbSize of %d\n", OriginalFileInfo->cbSize); - return ERROR_INVALID_USER_BUFFER; + WARN("incorrect OriginalFileInfo->cbSize of %d\n", OriginalFileInfo->cbSize); + SetLastError(ERROR_INVALID_USER_BUFFER); + return FALSE; } inf_path = (LPWSTR)&InfInformation->VersionData[0]; diff --git a/dlls/shell32/trash.c b/dlls/shell32/trash.c index 8a6de4c2310..14d6f90f898 100644 --- a/dlls/shell32/trash.c +++ b/dlls/shell32/trash.c @@ -138,7 +138,7 @@ static BOOL TRASH_EnsureInitialized(void) return TRUE; } -static BOOL file_good_for_bucket(TRASH_BUCKET *pBucket, struct stat *file_stat) +static BOOL file_good_for_bucket(const TRASH_BUCKET *pBucket, const struct stat *file_stat) { if (pBucket->device != file_stat->st_dev) return FALSE; @@ -486,7 +486,7 @@ static INT CALLBACK free_item_callback(void *item, void *lParam) return TRUE; } -static HDPA enum_bucket_trashinfos(TRASH_BUCKET *bucket, int *count) +static HDPA enum_bucket_trashinfos(const TRASH_BUCKET *bucket, int *count) { HDPA ret = DPA_Create(32); struct dirent *entry; diff --git a/dlls/shell32/xdg.c b/dlls/shell32/xdg.c index 108d92abc19..3b1a1bc1201 100644 --- a/dlls/shell32/xdg.c +++ b/dlls/shell32/xdg.c @@ -508,7 +508,7 @@ struct tagXDG_PARSED_FILE PARSED_GROUP *groups; }; -static BOOL parsed_str_eq(PARSED_STRING *str1, const char *str2) +static BOOL parsed_str_eq(const PARSED_STRING *str1, const char *str2) { if (strncmp(str1->str, str2, str1->len) != 0) return FALSE; diff --git a/dlls/user32/winproc.c b/dlls/user32/winproc.c index 7d6fa36c316..32b9cb1d434 100644 --- a/dlls/user32/winproc.c +++ b/dlls/user32/winproc.c @@ -778,12 +778,12 @@ LRESULT WINPROC_CallProcAtoW( winproc_callback_t callback, HWND hwnd, UINT msg, MDICREATESTRUCTW mdi_cs; DWORD name_lenA = 0, name_lenW = 0, class_lenA = 0, class_lenW = 0; - if (HIWORD(csA->lpszClass)) + if (!IS_INTRESOURCE(csA->lpszClass)) { class_lenA = strlen(csA->lpszClass) + 1; RtlMultiByteToUnicodeSize( &class_lenW, csA->lpszClass, class_lenA ); } - if (HIWORD(csA->lpszName)) + if (!IS_INTRESOURCE(csA->lpszName)) { name_lenA = strlen(csA->lpszName) + 1; RtlMultiByteToUnicodeSize( &name_lenW, csA->lpszName, name_lenA ); @@ -825,12 +825,12 @@ LRESULT WINPROC_CallProcAtoW( winproc_callback_t callback, HWND hwnd, UINT msg, memcpy( &csW, csA, sizeof(csW) ); - if (HIWORD(csA->szTitle)) + if (!IS_INTRESOURCE(csA->szTitle)) { title_lenA = strlen(csA->szTitle) + 1; RtlMultiByteToUnicodeSize( &title_lenW, csA->szTitle, title_lenA ); } - if (HIWORD(csA->szClass)) + if (!IS_INTRESOURCE(csA->szClass)) { class_lenA = strlen(csA->szClass) + 1; RtlMultiByteToUnicodeSize( &class_lenW, csA->szClass, class_lenA ); @@ -1032,37 +1032,35 @@ static LRESULT WINPROC_CallProcWtoA( winproc_callback_t callback, HWND hwnd, UIN { case WM_NCCREATE: case WM_CREATE: - { /* csW->lpszName and csW->lpszClass are NOT supposed to be atoms - * at this point. - */ - char buffer[1024], *cls, *name; + { + char buffer[1024], *cls; CREATESTRUCTW *csW = (CREATESTRUCTW *)lParam; CREATESTRUCTA csA = *(CREATESTRUCTA *)csW; MDICREATESTRUCTA mdi_cs; - DWORD name_lenA, name_lenW, class_lenA, class_lenW; - - class_lenW = strlenW(csW->lpszClass) * sizeof(WCHAR); - RtlUnicodeToMultiByteSize(&class_lenA, csW->lpszClass, class_lenW); + DWORD name_lenA = 0, name_lenW = 0, class_lenA = 0, class_lenW = 0; - if (csW->lpszName) + if (!IS_INTRESOURCE(csW->lpszClass)) + { + class_lenW = (strlenW(csW->lpszClass) + 1) * sizeof(WCHAR); + RtlUnicodeToMultiByteSize(&class_lenA, csW->lpszClass, class_lenW); + } + if (!IS_INTRESOURCE(csW->lpszName)) { - name_lenW = strlenW(csW->lpszName) * sizeof(WCHAR); + name_lenW = (strlenW(csW->lpszName) + 1) * sizeof(WCHAR); RtlUnicodeToMultiByteSize(&name_lenA, csW->lpszName, name_lenW); } - else - name_lenW = name_lenA = 0; - - if (!(cls = get_buffer( buffer, sizeof(buffer), class_lenA + name_lenA + 2 ))) break; - RtlUnicodeToMultiByteN(cls, class_lenA, NULL, csW->lpszClass, class_lenW); - cls[class_lenA] = 0; - csA.lpszClass = cls; + if (!(cls = get_buffer( buffer, sizeof(buffer), class_lenA + name_lenA ))) break; - if (csW->lpszName) + if (class_lenA) + { + RtlUnicodeToMultiByteN(cls, class_lenA, NULL, csW->lpszClass, class_lenW); + csA.lpszClass = cls; + } + if (name_lenA) { - name = cls + class_lenA + 1; + char *name = cls + class_lenA; RtlUnicodeToMultiByteN(name, name_lenA, NULL, csW->lpszName, name_lenW); - name[name_lenA] = 0; csA.lpszName = name; } @@ -1149,12 +1147,12 @@ static LRESULT WINPROC_CallProcWtoA( winproc_callback_t callback, HWND hwnd, UIN memcpy( &csA, csW, sizeof(csA) ); - if (HIWORD(csW->szTitle)) + if (!IS_INTRESOURCE(csW->szTitle)) { title_lenW = (strlenW(csW->szTitle) + 1) * sizeof(WCHAR); RtlUnicodeToMultiByteSize( &title_lenA, csW->szTitle, title_lenW ); } - if (HIWORD(csW->szClass)) + if (!IS_INTRESOURCE(csW->szClass)) { class_lenW = (strlenW(csW->szClass) + 1) * sizeof(WCHAR); RtlUnicodeToMultiByteSize( &class_lenA, csW->szClass, class_lenW ); diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index dc64a5cb0ea..8311ab5be9d 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -674,7 +674,7 @@ static WineD3DContext *findThreadContextForSwapChain(IWineD3DSwapChain *swapchai * Returns: The needed context * *****************************************************************************/ -static inline WineD3DContext *FindContext(IWineD3DDeviceImpl *This, IWineD3DSurface *target, DWORD tid) { +static inline WineD3DContext *FindContext(IWineD3DDeviceImpl *This, IWineD3DSurface *target, DWORD tid, GLint *buffer) { IWineD3DSwapChain *swapchain = NULL; HRESULT hr; BOOL readTexture = wined3d_settings.offscreen_rendering_mode != ORM_FBO && This->render_offscreen; @@ -693,15 +693,12 @@ static inline WineD3DContext *FindContext(IWineD3DDeviceImpl *This, IWineD3DSurf * rendering. No context change is needed in that case */ - if (wined3d_settings.offscreen_rendering_mode == ORM_BACKBUFFER) { - if(((IWineD3DSwapChainImpl *) swapchain)->backBuffer) { - glDrawBuffer(GL_BACK); - checkGLcall("glDrawBuffer(GL_BACK)"); - } else { - glDrawBuffer(GL_FRONT); - checkGLcall("glDrawBuffer(GL_FRONT)"); - } - } else if(wined3d_settings.offscreen_rendering_mode == ORM_PBUFFER) { + if(((IWineD3DSwapChainImpl *) swapchain)->frontBuffer == target) { + *buffer = GL_FRONT; + } else { + *buffer = GL_BACK; + } + if(wined3d_settings.offscreen_rendering_mode == ORM_PBUFFER) { if(This->pbufferContext && tid == This->pbufferContext->tid) { This->pbufferContext->tid = 0; } @@ -719,6 +716,7 @@ static inline WineD3DContext *FindContext(IWineD3DDeviceImpl *This, IWineD3DSurf } else { TRACE("Rendering offscreen\n"); This->render_offscreen = TRUE; + *buffer = This->offscreenBuffer; switch(wined3d_settings.offscreen_rendering_mode) { case ORM_FBO: @@ -784,8 +782,6 @@ static inline WineD3DContext *FindContext(IWineD3DDeviceImpl *This, IWineD3DSurf */ context = findThreadContextForSwapChain(This->swapchains[0], tid); } - glDrawBuffer(This->offscreenBuffer); - checkGLcall("glDrawBuffer(This->offscreenBuffer)"); break; } @@ -849,11 +845,11 @@ void ActivateContext(IWineD3DDeviceImpl *This, IWineD3DSurface *target, ContextU DWORD dirtyState, idx; BYTE shift; WineD3DContext *context; + GLint drawBuffer=0; TRACE("(%p): Selecting context for render target %p, thread %d\n", This, target, tid); - if(This->lastActiveRenderTarget != target || tid != This->lastThread) { - context = FindContext(This, target, tid); + context = FindContext(This, target, tid, &drawBuffer); This->lastActiveRenderTarget = target; This->lastThread = tid; } else { @@ -874,6 +870,15 @@ void ActivateContext(IWineD3DDeviceImpl *This, IWineD3DSurface *target, ContextU /* We only need ENTER_GL for the gl calls made below and for the helper functions which make GL calls */ ENTER_GL(); + /* Select the right draw buffer. It is selected in FindContext. */ + if(drawBuffer && context->last_draw_buffer != drawBuffer) { + TRACE("Drawing to buffer: %#x\n", drawBuffer); + context->last_draw_buffer = drawBuffer; + + glDrawBuffer(drawBuffer); + checkGLcall("glDrawBuffer"); + } + switch(usage) { case CTXUSAGE_RESOURCELOAD: /* This does not require any special states to be set up */ diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 55b40e9f8da..a77ea96ca7c 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -757,6 +757,9 @@ BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info) { glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB, &gl_max); gl_info->ps_glsl_constantsF = gl_max / 4; TRACE_(d3d_caps)("Max ARB_FRAGMENT_SHADER float constants: %u\n", gl_info->ps_glsl_constantsF); + glGetIntegerv(GL_MAX_VARYING_FLOATS_ARB, &gl_max); + gl_info->max_glsl_varyings = gl_max; + TRACE_(d3d_caps)("Max GLSL varyings: %u (%u 4 component varyings)\n", gl_max, gl_max / 4); } if (gl_info->supported[EXT_VERTEX_SHADER]) { gl_info->vs_ati_version = VS_VERSION_11; diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 14ac4e39e8e..37b8df81327 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -523,6 +523,21 @@ void shader_generate_glsl_declarations( if(!pshader) { shader_addline(buffer, "uniform vec4 posFixup;\n"); + /* Predeclaration; This function is added at link time based on the pixel shader. + * VS 3.0 shaders have an array OUT[] the shader writes to, earlier versions don't have + * that. We know the input to the reorder function at vertex shader compile time, so + * we can deal with that. The reorder function for a 1.x and 2.x vertex shader can just + * read gl_FrontColor. The output depends on the pixel shader. The reorder function for a + * 1.x and 2.x pshader or for fixed function will write gl_FrontColor, and for a 3.0 shader + * it will write to the varying array. Here we depend on the shader optimizer on sorting that + * out. The nvidia driver only does that if the parameter is inout instead of out, hence the + * inout. + */ + if(This->baseShader.hex_version >= WINED3DVS_VERSION(3, 0)) { + shader_addline(buffer, "void order_ps_input(in vec4[%u]);\n", MAX_REG_OUTPUT); + } else { + shader_addline(buffer, "void order_ps_input();\n"); + } } else { IWineD3DPixelShaderImpl *ps_impl = (IWineD3DPixelShaderImpl *) This; @@ -616,16 +631,24 @@ void shader_generate_glsl_declarations( shader_addline(buffer, "vec4 T%lu = gl_TexCoord[%lu];\n", i, i); } - /* Declare input register temporaries */ - for (i=0; i < This->baseShader.limits.packed_input; i++) { - if (reg_maps->packed_input[i]) - shader_addline(buffer, "vec4 IN%lu;\n", i); + /* Declare input register varyings. Only pixel shader, vertex shaders have that declared in the + * helper function shader that is linked in at link time + */ + if(pshader && This->baseShader.hex_version >= WINED3DVS_VERSION(3, 0)) { + if(use_vs(device)) { + shader_addline(buffer, "varying vec4 IN[%lu];\n", GL_LIMITS(glsl_varyings) / 4); + } else { + /* TODO: Write a replacement shader for the fixed function vertex pipeline, so this isn't needed. + * For fixed function vertex processing + 3.0 pixel shader we need a separate function in the + * pixel shader that reads the fixed function color into the packed input registers. + */ + shader_addline(buffer, "vec4 IN[%lu];\n", GL_LIMITS(glsl_varyings) / 4); + } } /* Declare output register temporaries */ - for (i = 0; i < This->baseShader.limits.packed_output; i++) { - if (reg_maps->packed_output[i]) - shader_addline(buffer, "vec4 OUT%lu;\n", i); + if(This->baseShader.limits.packed_output) { + shader_addline(buffer, "vec4 OUT[%lu];\n", This->baseShader.limits.packed_output); } /* Declare temporary variables */ @@ -774,9 +797,16 @@ static void shader_glsl_get_register_name( case WINED3DSPR_INPUT: if (pshader) { /* Pixel shaders >= 3.0 */ - if (WINED3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) >= 3) - sprintf(tmpStr, "IN%u", reg); - else { + if (WINED3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) >= 3) { + if (param & WINED3DSHADER_ADDRMODE_RELATIVE) { + glsl_src_param_t rel_param; + shader_glsl_add_src_param(arg, addr_token, 0, WINED3DSP_WRITEMASK_0, &rel_param); + + sprintf(tmpStr, "IN[%s + %u]", rel_param.param_str, reg); + } else { + sprintf(tmpStr, "IN[%u]", reg); + } + } else { if (reg==0) strcpy(tmpStr, "gl_Color"); else @@ -863,7 +893,7 @@ static void shader_glsl_get_register_name( case WINED3DSPR_TEXCRDOUT: /* Vertex shaders >= 3.0: WINED3DSPR_OUTPUT */ if (WINED3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) >= 3) - sprintf(tmpStr, "OUT%u", reg); + sprintf(tmpStr, "OUT[%u]", reg); else sprintf(tmpStr, "gl_TexCoord[%u]", reg); break; @@ -1818,13 +1848,50 @@ void shader_glsl_sincos(SHADER_OPCODE_ARG* arg) { void shader_glsl_loop(SHADER_OPCODE_ARG* arg) { glsl_src_param_t src1_param; IWineD3DBaseShaderImpl* shader = (IWineD3DBaseShaderImpl*) arg->shader; + DWORD regtype = shader_get_regtype(arg->src[1]); + DWORD reg = arg->src[1] & WINED3DSP_REGNUM_MASK; + const DWORD *control_values = NULL; + local_constant *constant; shader_glsl_add_src_param(arg, arg->src[1], arg->src_addr[1], WINED3DSP_WRITEMASK_ALL, &src1_param); - shader_addline(arg->buffer, "for (tmpInt%u = 0, aL%u = %s.y; tmpInt%u < %s.x; tmpInt%u++, aL%u += %s.z) {\n", - shader->baseShader.cur_loop_depth, shader->baseShader.cur_loop_regno, - src1_param.reg_name, shader->baseShader.cur_loop_depth, src1_param.reg_name, - shader->baseShader.cur_loop_depth, shader->baseShader.cur_loop_regno, src1_param.reg_name); + /* Try to hardcode the loop control parameters if possible. Direct3D 9 class hardware doesn't support real + * varying indexing, but Microsoft designed this feature for Shader model 2.x+. If the loop control is + * known at compile time, the GLSL compiler can unroll the loop, and replace indirect addressing with direct + * addressing. + */ + if(regtype == WINED3DSPR_CONSTINT) { + LIST_FOR_EACH_ENTRY(constant, &shader->baseShader.constantsI, local_constant, entry) { + if(constant->idx == reg) { + control_values = constant->value; + break; + } + } + } + + if(control_values) { + if(control_values[2] > 0) { + shader_addline(arg->buffer, "for (aL%u = %d; aL%u < (%d * %d + %d); aL%u += %d) {\n", + shader->baseShader.cur_loop_depth, control_values[1], + shader->baseShader.cur_loop_depth, control_values[0], control_values[2], control_values[1], + shader->baseShader.cur_loop_depth, control_values[2]); + } else if(control_values[2] == 0) { + shader_addline(arg->buffer, "for (aL%u = %d, tmpInt%u = 0; tmpInt%u < %d; tmpInt%u++) {\n", + shader->baseShader.cur_loop_depth, control_values[1], shader->baseShader.cur_loop_depth, + shader->baseShader.cur_loop_depth, control_values[0], + shader->baseShader.cur_loop_depth); + } else { + shader_addline(arg->buffer, "for (aL%u = %d; aL%u > (%d * %d + %d); aL%u += %d) {\n", + shader->baseShader.cur_loop_depth, control_values[1], + shader->baseShader.cur_loop_depth, control_values[0], control_values[2], control_values[1], + shader->baseShader.cur_loop_depth, control_values[2]); + } + } else { + shader_addline(arg->buffer, "for (tmpInt%u = 0, aL%u = %s.y; tmpInt%u < %s.x; tmpInt%u++, aL%u += %s.z) {\n", + shader->baseShader.cur_loop_depth, shader->baseShader.cur_loop_regno, + src1_param.reg_name, shader->baseShader.cur_loop_depth, src1_param.reg_name, + shader->baseShader.cur_loop_depth, shader->baseShader.cur_loop_regno, src1_param.reg_name); + } shader->baseShader.cur_loop_depth++; shader->baseShader.cur_loop_regno++; @@ -2493,9 +2560,11 @@ void pshader_glsl_dp2add(SHADER_OPCODE_ARG* arg) { void pshader_glsl_input_pack( SHADER_BUFFER* buffer, - semantic* semantics_in) { + semantic* semantics_in, + IWineD3DPixelShader *iface) { unsigned int i; + IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *) iface; for (i = 0; i < MAX_REG_INPUT; i++) { @@ -2512,30 +2581,30 @@ void pshader_glsl_input_pack( switch(usage) { + case WINED3DDECLUSAGE_TEXCOORD: + if(usage_idx < 8 && This->vertexprocessing == pretransformed) { + shader_addline(buffer, "IN[%u]%s = gl_TexCoord[%u]%s;\n", + i, reg_mask, usage_idx, reg_mask); + } else { + shader_addline(buffer, "IN[%u]%s = vec4(0.0, 0.0, 0.0, 0.0)%s;\n", + i, reg_mask, reg_mask); + } + break; + case WINED3DDECLUSAGE_COLOR: if (usage_idx == 0) - shader_addline(buffer, "IN%u%s = vec4(gl_Color)%s;\n", + shader_addline(buffer, "IN[%u]%s = vec4(gl_Color)%s;\n", i, reg_mask, reg_mask); else if (usage_idx == 1) - shader_addline(buffer, "IN%u%s = vec4(gl_SecondaryColor)%s;\n", + shader_addline(buffer, "IN[%u]%s = vec4(gl_SecondaryColor)%s;\n", i, reg_mask, reg_mask); else - shader_addline(buffer, "IN%u%s = vec4(unsupported_color_input)%s;\n", + shader_addline(buffer, "IN[%u]%s = vec4(0.0, 0.0, 0.0, 0.0)%s;\n", i, reg_mask, reg_mask); break; - case WINED3DDECLUSAGE_TEXCOORD: - shader_addline(buffer, "IN%u%s = vec4(gl_TexCoord[%u])%s;\n", - i, reg_mask, usage_idx, reg_mask ); - break; - - case WINED3DDECLUSAGE_FOG: - shader_addline(buffer, "IN%u%s = vec4(gl_FogFragCoord)%s;\n", - i, reg_mask, reg_mask); - break; - default: - shader_addline(buffer, "IN%u%s = vec4(unsupported_input)%s;\n", + shader_addline(buffer, "IN[%u]%s = vec4(0.0, 0.0, 0.0, 0.0)%s;\n", i, reg_mask, reg_mask); } } @@ -2545,60 +2614,6 @@ void pshader_glsl_input_pack( * Vertex Shader Specific Code begins here ********************************************/ -void vshader_glsl_output_unpack( - SHADER_BUFFER* buffer, - semantic* semantics_out) { - - unsigned int i; - - for (i = 0; i < MAX_REG_OUTPUT; i++) { - - DWORD usage_token = semantics_out[i].usage; - DWORD register_token = semantics_out[i].reg; - DWORD usage, usage_idx; - char reg_mask[6]; - - /* Uninitialized */ - if (!usage_token) continue; - - usage = (usage_token & WINED3DSP_DCL_USAGE_MASK) >> WINED3DSP_DCL_USAGE_SHIFT; - usage_idx = (usage_token & WINED3DSP_DCL_USAGEINDEX_MASK) >> WINED3DSP_DCL_USAGEINDEX_SHIFT; - shader_glsl_get_write_mask(register_token, reg_mask); - - switch(usage) { - - case WINED3DDECLUSAGE_COLOR: - if (usage_idx == 0) - shader_addline(buffer, "gl_FrontColor%s = OUT%u%s;\n", reg_mask, i, reg_mask); - else if (usage_idx == 1) - shader_addline(buffer, "gl_FrontSecondaryColor%s = OUT%u%s;\n", reg_mask, i, reg_mask); - else - shader_addline(buffer, "unsupported_color_output%s = OUT%u%s;\n", reg_mask, i, reg_mask); - break; - - case WINED3DDECLUSAGE_POSITION: - shader_addline(buffer, "gl_Position%s = OUT%u%s;\n", reg_mask, i, reg_mask); - break; - - case WINED3DDECLUSAGE_TEXCOORD: - shader_addline(buffer, "gl_TexCoord[%u]%s = OUT%u%s;\n", - usage_idx, reg_mask, i, reg_mask); - break; - - case WINED3DDECLUSAGE_PSIZE: - shader_addline(buffer, "gl_PointSize = OUT%u.x;\n", i); - break; - - case WINED3DDECLUSAGE_FOG: - shader_addline(buffer, "gl_FogFragCoord = OUT%u%s;\n", i, reg_mask); - break; - - default: - shader_addline(buffer, "unsupported_output%s = OUT%u%s;\n", reg_mask, i, reg_mask); - } - } -} - static void add_glsl_program_entry(IWineD3DDeviceImpl *device, struct glsl_shader_prog_link *entry) { glsl_program_key_t *key; @@ -2637,6 +2652,252 @@ void delete_glsl_program_entry(IWineD3DDevice *iface, struct glsl_shader_prog_li HeapFree(GetProcessHeap(), 0, entry); } +static void handle_ps3_input(SHADER_BUFFER *buffer, semantic *semantics_in, semantic *semantics_out, WineD3D_GL_Info *gl_info) { + unsigned int i, j; + DWORD usage_token, usage_token_out; + DWORD register_token, register_token_out; + DWORD usage, usage_idx, usage_out, usage_idx_out; + DWORD *set; + char reg_mask[6], reg_mask_out[6]; + + set = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*set) * (GL_LIMITS(glsl_varyings) / 4)); + + for(i = 0; i < min(MAX_REG_INPUT, GL_LIMITS(glsl_varyings) / 4); i++) { + usage_token = semantics_in[i].usage; + if (!usage_token) continue; + register_token = semantics_in[i].reg; + + usage = (usage_token & WINED3DSP_DCL_USAGE_MASK) >> WINED3DSP_DCL_USAGE_SHIFT; + usage_idx = (usage_token & WINED3DSP_DCL_USAGEINDEX_MASK) >> WINED3DSP_DCL_USAGEINDEX_SHIFT; + set[i] = shader_glsl_get_write_mask(register_token, reg_mask); + + if(!semantics_out) { + switch(usage) { + case WINED3DDECLUSAGE_COLOR: + if (usage_idx == 0) + shader_addline(buffer, "IN[%u]%s = gl_FrontColor%s;\n", i, reg_mask, reg_mask); + else if (usage_idx == 1) + shader_addline(buffer, "IN[%u]%s = gl_FrontSecondaryColor%s;\n", i, reg_mask, reg_mask); + else + shader_addline(buffer, "IN[%u]%s = vec4(0.0, 0.0, 0.0, 0.0)%s;\n", i, reg_mask, reg_mask); + break; + + case WINED3DDECLUSAGE_TEXCOORD: + if (usage_idx < 8) { + shader_addline(buffer, "IN[%u]%s = gl_TexCoord[%u]%s;\n", + i, reg_mask, usage_idx, reg_mask); + } else { + shader_addline(buffer, "IN[%u]%s = vec4(0.0, 0.0, 0.0, 0.0)%s;\n", i, reg_mask, reg_mask); + } + break; + + case WINED3DDECLUSAGE_FOG: + shader_addline(buffer, "IN[%u] = vec4(gl_FogFragCoord, 0.0, 0.0, 0.0)%s;\n", i, reg_mask, reg_mask); + break; + + default: + shader_addline(buffer, "IN[%u]%s = vec4(0.0, 0.0, 0.0, 0.0)%s;\n", i, reg_mask, reg_mask); + } + } else { + BOOL found = FALSE; + for(j = 0; j < MAX_REG_OUTPUT; j++) { + usage_token_out = semantics_out[j].usage; + if (!usage_token_out) continue; + register_token_out = semantics_out[j].reg; + + usage_out = (usage_token_out & WINED3DSP_DCL_USAGE_MASK) >> WINED3DSP_DCL_USAGE_SHIFT; + usage_idx_out = (usage_token_out & WINED3DSP_DCL_USAGEINDEX_MASK) >> WINED3DSP_DCL_USAGEINDEX_SHIFT; + shader_glsl_get_write_mask(register_token_out, reg_mask_out); + + if(usage == usage_out && + usage_idx == usage_idx_out) { + shader_addline(buffer, "IN[%u]%s = OUT[%u]%s;\n", i, reg_mask, j, reg_mask); + found = TRUE; + } + } + if(!found) { + shader_addline(buffer, "IN[%u]%s = vec4(0.0, 0.0, 0.0, 0.0)%s;\n", i, reg_mask, reg_mask); + } + } + } + + /* This is solely to make the compiler / linker happy and avoid warning about undefined + * varyings. It shouldn't result in any real code executed on the GPU, since all read + * input varyings are assigned above, if the optimizer works properly. + */ + for(i = 0; i < GL_LIMITS(glsl_varyings) / 4; i++) { + if(set[i] != WINED3DSP_WRITEMASK_ALL) { + unsigned int size = 0; + memset(reg_mask, 0, sizeof(reg_mask)); + if(!(set[i] & WINED3DSP_WRITEMASK_0)) { + reg_mask[size] = 'x'; + size++; + } + if(!(set[i] & WINED3DSP_WRITEMASK_1)) { + reg_mask[size] = 'y'; + size++; + } + if(!(set[i] & WINED3DSP_WRITEMASK_2)) { + reg_mask[size] = 'z'; + size++; + } + if(!(set[i] & WINED3DSP_WRITEMASK_3)) { + reg_mask[size] = 'w'; + size++; + } + switch(size) { + case 1: + shader_addline(buffer, "IN[%u].%s = 0.0;\n", i, reg_mask); + break; + case 2: + shader_addline(buffer, "IN[%u].%s = vec2(0.0, 0.0);\n", i, reg_mask); + break; + case 3: + shader_addline(buffer, "IN[%u].%s = vec3(0.0, 0.0, 0.0);\n", i, reg_mask); + break; + case 4: + shader_addline(buffer, "IN[%u].%s = vec4(0.0, 0.0, 0.0, 0.0);\n", i, reg_mask); + break; + } + } + } + + HeapFree(GetProcessHeap(), 0, set); +} + +static GLhandleARB generate_param_reorder_function(IWineD3DVertexShader *vertexshader, + IWineD3DPixelShader *pixelshader, + WineD3D_GL_Info *gl_info) { + GLhandleARB ret = 0; + IWineD3DVertexShaderImpl *vs = (IWineD3DVertexShaderImpl *) vertexshader; + IWineD3DPixelShaderImpl *ps = (IWineD3DPixelShaderImpl *) pixelshader; + DWORD vs_major = vs ? WINED3DSHADER_VERSION_MAJOR(vs->baseShader.hex_version) : 0; + DWORD ps_major = ps ? WINED3DSHADER_VERSION_MAJOR(ps->baseShader.hex_version) : 0; + unsigned int i; + SHADER_BUFFER buffer; + DWORD usage_token; + DWORD register_token; + DWORD usage, usage_idx; + char reg_mask[6]; + semantic *semantics_out, *semantics_in; + + buffer.buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, SHADER_PGMSIZE); + buffer.bsize = 0; + buffer.lineNo = 0; + buffer.newline = TRUE; + + if(vs_major < 3 && ps_major < 3) { + /* That one is easy: The vertex shader writes to the builtin varyings, the pixel shader reads from them */ + shader_addline(&buffer, "void order_ps_input() { /* do nothing */ }\n"); + } else if(ps_major < 3 && vs_major >= 3) { + /* The vertex shader writes to its own varyings, the pixel shader needs them in the builtin ones */ + semantics_out = vs->semantics_out; + + shader_addline(&buffer, "void order_ps_input(in vec4 OUT[%u]) {\n", MAX_REG_OUTPUT); + for(i = 0; i < MAX_REG_OUTPUT; i++) { + usage_token = semantics_out[i].usage; + if (!usage_token) continue; + register_token = semantics_out[i].reg; + + usage = (usage_token & WINED3DSP_DCL_USAGE_MASK) >> WINED3DSP_DCL_USAGE_SHIFT; + usage_idx = (usage_token & WINED3DSP_DCL_USAGEINDEX_MASK) >> WINED3DSP_DCL_USAGEINDEX_SHIFT; + shader_glsl_get_write_mask(register_token, reg_mask); + + switch(usage) { + case WINED3DDECLUSAGE_COLOR: + if (usage_idx == 0) + shader_addline(&buffer, "gl_FrontColor%s = OUT[%u]%s;\n", reg_mask, i, reg_mask); + else if (usage_idx == 1) + shader_addline(&buffer, "gl_FrontSecondaryColor%s = OUT[%u]%s;\n", reg_mask, i, reg_mask); + break; + + case WINED3DDECLUSAGE_POSITION: + shader_addline(&buffer, "gl_Position%s = OUT[%u]%s;\n", reg_mask, i, reg_mask); + break; + + case WINED3DDECLUSAGE_TEXCOORD: + if (usage_idx < 8) { + shader_addline(&buffer, "gl_TexCoord[%u]%s = OUT[%u]%s;\n", + usage_idx, reg_mask, i, reg_mask); + } + break; + + case WINED3DDECLUSAGE_PSIZE: + shader_addline(&buffer, "gl_PointSize = OUT[%u].x;\n", i); + break; + + case WINED3DDECLUSAGE_FOG: + shader_addline(&buffer, "gl_FogFragCoord = OUT[%u].%c;\n", i, reg_mask[1]); + break; + + default: + break; + } + } + shader_addline(&buffer, "}\n"); + + } else if(ps_major >= 3 && vs_major >= 3) { + semantics_out = vs->semantics_out; + semantics_in = ps->semantics_in; + + /* This one is tricky: a 3.0 pixel shader reads from a 3.0 vertex shader */ + shader_addline(&buffer, "varying vec4 IN[%lu];\n", GL_LIMITS(glsl_varyings) / 4); + shader_addline(&buffer, "void order_ps_input(in vec4 OUT[%u]) {\n", MAX_REG_OUTPUT); + + /* First, sort out position and point size. Those are not passed to the pixel shader */ + for(i = 0; i < MAX_REG_OUTPUT; i++) { + usage_token = semantics_out[i].usage; + if (!usage_token) continue; + register_token = semantics_out[i].reg; + + usage = (usage_token & WINED3DSP_DCL_USAGE_MASK) >> WINED3DSP_DCL_USAGE_SHIFT; + usage_idx = (usage_token & WINED3DSP_DCL_USAGEINDEX_MASK) >> WINED3DSP_DCL_USAGEINDEX_SHIFT; + shader_glsl_get_write_mask(register_token, reg_mask); + + switch(usage) { + case WINED3DDECLUSAGE_POSITION: + shader_addline(&buffer, "gl_Position%s = OUT[%u]%s;\n", reg_mask, i, reg_mask); + break; + + case WINED3DDECLUSAGE_PSIZE: + shader_addline(&buffer, "gl_PointSize = OUT[%u].x;\n", i); + break; + + default: + break; + } + } + + /* Then, fix the pixel shader input */ + handle_ps3_input(&buffer, semantics_in, semantics_out, gl_info); + + shader_addline(&buffer, "}\n"); + } else if(ps_major >= 3 && vs_major < 3) { + semantics_in = ps->semantics_in; + + shader_addline(&buffer, "varying vec4 IN[%lu];\n", GL_LIMITS(glsl_varyings) / 4); + shader_addline(&buffer, "void order_ps_input() {\n"); + /* The vertex shader wrote to the builtin varyings. There is no need to figure out position and + * point size, but we depend on the optimizers kindness to find out that the pixel shader doesn't + * read gl_TexCoord and gl_ColorX, otherwise we'll run out of varyings + */ + handle_ps3_input(&buffer, semantics_in, NULL, gl_info); + shader_addline(&buffer, "}\n"); + } else { + ERR("Unexpected vertex and pixel shader version condition: vs: %d, ps: %d\n", vs_major, ps_major); + } + + ret = GL_EXTCALL(glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB)); + checkGLcall("glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB)"); + GL_EXTCALL(glShaderSourceARB(ret, 1, (const char**)&buffer.buffer, NULL)); + checkGLcall("glShaderSourceARB(ret, 1, (const char**)&buffer.buffer, NULL)"); + GL_EXTCALL(glCompileShaderARB(ret)); + checkGLcall("glCompileShaderARB(ret)"); + + HeapFree(GetProcessHeap(), 0, buffer.buffer); + return ret; +} + /** Sets the GLSL program ID for the given pixel and vertex shader combination. * It sets the programId on the current StateBlock (because it should be called * inside of the DrawPrimitive() part of the render loop). @@ -2652,6 +2913,7 @@ static void set_glsl_shader_program(IWineD3DDevice *iface, BOOL use_ps, BOOL use IWineD3DVertexShader *vshader = This->stateBlock->vertexShader; struct glsl_shader_prog_link *entry = NULL; GLhandleARB programId = 0; + GLhandleARB reorder_shader_id = 0; int i; char glsl_name[8]; @@ -2697,12 +2959,23 @@ static void set_glsl_shader_program(IWineD3DDevice *iface, BOOL use_ps, BOOL use * in order to make the bindings work, and it has to be done prior * to linking the GLSL program. */ for (i = 0; i < max_attribs; ++i) { - snprintf(tmp_name, sizeof(tmp_name), "attrib%i", i); - GL_EXTCALL(glBindAttribLocationARB(programId, i, tmp_name)); + if (((IWineD3DBaseShaderImpl*)vshader)->baseShader.reg_maps.attributes[i]) { + snprintf(tmp_name, sizeof(tmp_name), "attrib%i", i); + GL_EXTCALL(glBindAttribLocationARB(programId, i, tmp_name)); + } } checkGLcall("glBindAttribLocationARB"); list_add_head(&((IWineD3DBaseShaderImpl *)vshader)->baseShader.linked_programs, &entry->vshader_entry); + + reorder_shader_id = generate_param_reorder_function(vshader, pshader, gl_info); + TRACE("Attaching GLSL shader object %u to program %u\n", reorder_shader_id, programId); + GL_EXTCALL(glAttachObjectARB(programId, reorder_shader_id)); + checkGLcall("glAttachObjectARB"); + /* Flag the reorder function for deletion, then it will be freed automatically when the program + * is destroyed + */ + GL_EXTCALL(glDeleteObjectARB(reorder_shader_id)); } /* Attach GLSL pshader */ diff --git a/dlls/wined3d/pixelshader.c b/dlls/wined3d/pixelshader.c index 4c31d554112..f46084e23b3 100644 --- a/dlls/wined3d/pixelshader.c +++ b/dlls/wined3d/pixelshader.c @@ -361,8 +361,19 @@ static inline VOID IWineD3DPixelShaderImpl_GenerateShader( shader_generate_glsl_declarations( (IWineD3DBaseShader*) This, reg_maps, &buffer, &GLINFO_LOCATION); /* Pack 3.0 inputs */ - if (This->baseShader.hex_version >= WINED3DPS_VERSION(3,0)) - pshader_glsl_input_pack(&buffer, This->semantics_in); + if (This->baseShader.hex_version >= WINED3DPS_VERSION(3,0) && + !use_vs((IWineD3DDeviceImpl *) This->baseShader.device)) { + + if(((IWineD3DDeviceImpl *) This->baseShader.device)->strided_streams.u.s.position_transformed) { + This->vertexprocessing = pretransformed; + } else if(!use_vs((IWineD3DDeviceImpl *) This->baseShader.device)) { + This->vertexprocessing = fixedfunction; + } else { + This->vertexprocessing = vertexshader; + } + + pshader_glsl_input_pack(&buffer, This->semantics_in, iface); + } /* Base Shader Body */ shader_generate_main( (IWineD3DBaseShader*) This, &buffer, reg_maps, pFunction); @@ -605,6 +616,20 @@ static HRESULT WINAPI IWineD3DPixelShaderImpl_CompileShader(IWineD3DPixelShader goto recompile; } } + if(This->baseShader.hex_version >= WINED3DPS_VERSION(3,0)) { + if(((IWineD3DDeviceImpl *) This->baseShader.device)->strided_streams.u.s.position_transformed && + This->vertexprocessing != pretransformed) { + WARN("Recompiling shader because pretransformed vertices are provided, which wasn't the case before\n"); + goto recompile; + } else if(!use_vs((IWineD3DDeviceImpl *) This->baseShader.device) && + This->vertexprocessing != fixedfunction) { + WARN("Recompiling shader because fixed function vp is in use, which wasn't the case before\n"); + goto recompile; + } else if(This->vertexprocessing != vertexshader) { + WARN("Recompiling shader because vertex shaders are in use, which wasn't the case before\n"); + goto recompile; + } + } return WINED3D_OK; diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 3d22e42cc40..4aa386fd077 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -1407,7 +1407,7 @@ HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BOOL use_ if (device->render_targets && device->render_targets[0]) { IWineD3DSurfaceImpl* render_target = (IWineD3DSurfaceImpl*)device->render_targets[0]; - if(render_target->resource.usage & WINED3DUSAGE_RENDERTARGET) + if((render_target->resource.usage & WINED3DUSAGE_RENDERTARGET) && (render_target->resource.format == WINED3DFMT_P8)) p8_render_target = TRUE; } diff --git a/dlls/wined3d/vertexshader.c b/dlls/wined3d/vertexshader.c index 45065a60b69..5c9da19df3f 100644 --- a/dlls/wined3d/vertexshader.c +++ b/dlls/wined3d/vertexshader.c @@ -324,8 +324,11 @@ static VOID IWineD3DVertexShaderImpl_GenerateShader( shader_generate_main( (IWineD3DBaseShader*) This, &buffer, reg_maps, pFunction); /* Unpack 3.0 outputs */ - if (This->baseShader.hex_version >= WINED3DVS_VERSION(3,0)) - vshader_glsl_output_unpack(&buffer, This->semantics_out); + if (This->baseShader.hex_version >= WINED3DVS_VERSION(3,0)) { + shader_addline(&buffer, "order_ps_input(OUT);\n"); + } else { + shader_addline(&buffer, "order_ps_input();\n"); + } /* If this shader doesn't use fog copy the z coord to the fog coord so that we can use table fog */ if (!reg_maps->fog) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index cac31a8cb69..89688fcf897 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -493,6 +493,7 @@ struct WineD3DContext { DWORD tid; /* Thread ID which owns this context at the moment */ /* Stores some inforation about the context state for optimization */ + GLint last_draw_buffer; BOOL last_was_rhw; /* true iff last draw_primitive was in xyzrhw mode */ BOOL last_was_pshader; BOOL last_was_vshader; @@ -1871,12 +1872,8 @@ extern void pshader_glsl_texreg2rgb(SHADER_OPCODE_ARG* arg); extern void pshader_glsl_dp2add(SHADER_OPCODE_ARG* arg); extern void pshader_glsl_input_pack( SHADER_BUFFER* buffer, - semantic* semantics_out); - -/** GLSL Vertex Shader Prototypes */ -extern void vshader_glsl_output_unpack( - SHADER_BUFFER* buffer, - semantic* semantics_out); + semantic* semantics_out, + IWineD3DPixelShader *iface); /***************************************************************************** * IDirect3DBaseShader implementation structure @@ -2066,6 +2063,13 @@ extern const IWineD3DVertexShaderVtbl IWineD3DVertexShader_Vtbl; /***************************************************************************** * IDirect3DPixelShader implementation structure */ + +enum vertexprocessing_mode { + fixedfunction, + vertexshader, + pretransformed +}; + typedef struct IWineD3DPixelShaderImpl { /* IUnknown parts */ const IWineD3DPixelShaderVtbl *lpVtbl; @@ -2094,6 +2098,7 @@ typedef struct IWineD3DPixelShaderImpl { char vpos_uniform; BOOL render_offscreen; UINT height; + enum vertexprocessing_mode vertexprocessing; #if 0 /* needs reworking */ PSHADERINPUTDATA input; diff --git a/dlls/winhttp/main.c b/dlls/winhttp/main.c index b8739d24298..8f26859fb8c 100644 --- a/dlls/winhttp/main.c +++ b/dlls/winhttp/main.c @@ -22,6 +22,7 @@ #include "windef.h" #include "winbase.h" +#include "objbase.h" #include "winhttp.h" #include "wine/debug.h" diff --git a/dlls/winspool.drv/info.c b/dlls/winspool.drv/info.c index e560f6af6da..c4381d48921 100644 --- a/dlls/winspool.drv/info.c +++ b/dlls/winspool.drv/info.c @@ -486,18 +486,21 @@ static BOOL add_printer_driver(const char *name) di3a.pConfigFile = driver_nt; di3a.pDefaultDataType = default_data_type; - if (AddPrinterDriverA(NULL, 3, (LPBYTE)&di3a)) + if (AddPrinterDriverA(NULL, 3, (LPBYTE)&di3a) || + (GetLastError() == ERROR_PRINTER_DRIVER_ALREADY_INSTALLED )) { di3a.cVersion = 0; di3a.pEnvironment = env_9x; di3a.pDriverPath = driver_9x; di3a.pConfigFile = driver_9x; - if (AddPrinterDriverA(NULL, 3, (LPBYTE)&di3a)) + if (AddPrinterDriverA(NULL, 3, (LPBYTE)&di3a) || + (GetLastError() == ERROR_PRINTER_DRIVER_ALREADY_INSTALLED )) { return TRUE; } } - ERR("Failed adding driver %s: %u\n", debugstr_a(di3a.pDriverPath), GetLastError()); + ERR("Failed adding driver %s (%s): %u\n", debugstr_a(di3a.pDriverPath), + debugstr_a(di3a.pEnvironment), GetLastError()); return FALSE; } diff --git a/dlls/wintrust/register.c b/dlls/wintrust/register.c index a3e18e0d4c2..16578150c3b 100644 --- a/dlls/wintrust/register.c +++ b/dlls/wintrust/register.c @@ -26,6 +26,7 @@ #include "winuser.h" #include "winreg.h" #include "winnls.h" +#include "objbase.h" #include "guiddef.h" #include "wintrust.h" diff --git a/dlls/wsock32/socket.c b/dlls/wsock32/socket.c index 28b526cf674..d326443a6fd 100644 --- a/dlls/wsock32/socket.c +++ b/dlls/wsock32/socket.c @@ -441,11 +441,9 @@ DWORD WINAPI WsControl(DWORD protocol, if (!pcbResponseInfoLen) return ERROR_BAD_ENVIRONMENT; - GetIpForwardTable(NULL, &routeTableSize, FALSE); - if (!routeTableSize) { - *pcbResponseInfoLen = 0; - return WSCTL_SUCCESS; - } + ret = GetIpForwardTable(NULL, &routeTableSize, FALSE); + if (ret != ERROR_INSUFFICIENT_BUFFER) + return ret; numRoutes = (routeTableSize - sizeof(MIB_IPFORWARDTABLE)) / sizeof(MIB_IPFORWARDROW) + 1; if (*pcbResponseInfoLen < sizeof(IPRouteEntry) * numRoutes) @@ -494,11 +492,9 @@ DWORD WINAPI WsControl(DWORD protocol, if (!pcbResponseInfoLen) return ERROR_BAD_ENVIRONMENT; - GetIpNetTable(NULL, &arpTableSize, FALSE); - if (!arpTableSize) { - *pcbResponseInfoLen = 0; - return WSCTL_SUCCESS; - } + ret = GetIpNetTable(NULL, &arpTableSize, FALSE); + if (ret != ERROR_INSUFFICIENT_BUFFER) + return ret; numEntries = (arpTableSize - sizeof(MIB_IPNETTABLE)) / sizeof(MIB_IPNETROW) + 1; if (*pcbResponseInfoLen < sizeof(MIB_IPNETROW) * numEntries) @@ -536,11 +532,9 @@ DWORD WINAPI WsControl(DWORD protocol, if (!pcbResponseInfoLen) return ERROR_BAD_ENVIRONMENT; - GetTcpTable(NULL, &tcpTableSize, FALSE); - if (!tcpTableSize) { - *pcbResponseInfoLen = 0; - return WSCTL_SUCCESS; - } + ret = GetTcpTable(NULL, &tcpTableSize, FALSE); + if (ret != ERROR_INSUFFICIENT_BUFFER) + return ret; numEntries = (tcpTableSize - sizeof(MIB_TCPTABLE)) / sizeof(MIB_TCPROW) + 1; if (*pcbResponseInfoLen < sizeof(MIB_TCPROW) * numEntries) diff --git a/include/d3dx8math.h b/include/d3dx8math.h index f17fd5c94cc..bd1dc4fb8e9 100644 --- a/include/d3dx8math.h +++ b/include/d3dx8math.h @@ -63,6 +63,9 @@ D3DXMATRIX* WINAPI D3DXMatrixLookAtLH(D3DXMATRIX *pout, CONST D3DXVECTOR3 *peye, D3DXMATRIX* WINAPI D3DXMatrixLookAtRH(D3DXMATRIX *pout, CONST D3DXVECTOR3 *peye, CONST D3DXVECTOR3 *pat, CONST D3DXVECTOR3 *pup); D3DXMATRIX* WINAPI D3DXMatrixMultiply(D3DXMATRIX *pout, CONST D3DXMATRIX *pm1, CONST D3DXMATRIX *pm2); D3DXMATRIX* WINAPI D3DXMatrixOrthoLH(D3DXMATRIX *pout, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf); +D3DXMATRIX* WINAPI D3DXMatrixOrthoOffCenterLH(D3DXMATRIX *pout, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf); +D3DXMATRIX* WINAPI D3DXMatrixOrthoOffCenterRH(D3DXMATRIX *pout, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf); +D3DXMATRIX* WINAPI D3DXMatrixOrthoLH(D3DXMATRIX *pout, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf); D3DXMATRIX* WINAPI D3DXMatrixOrthoRH(D3DXMATRIX *pout, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf); D3DXMATRIX* WINAPI D3DXMatrixPerspectiveFovLH(D3DXMATRIX *pout, FLOAT fovy, FLOAT aspect, FLOAT zn, FLOAT zf); D3DXMATRIX* WINAPI D3DXMatrixPerspectiveFovRH(D3DXMATRIX *pout, FLOAT fovy, FLOAT aspect, FLOAT zn, FLOAT zf); diff --git a/include/wine/wined3d_gl.h b/include/wine/wined3d_gl.h index 5354fef4267..8694f374c9b 100644 --- a/include/wine/wined3d_gl.h +++ b/include/wine/wined3d_gl.h @@ -3723,6 +3723,7 @@ typedef struct _WineD3D_GL_Info { UINT max_blends; UINT max_anisotropy; UINT max_aux_buffers; + UINT max_glsl_varyings; unsigned max_vshader_constantsF; unsigned max_pshader_constantsF; diff --git a/programs/net/En.rc b/programs/net/En.rc index f3d8f4fc126..aff6d1df763 100644 --- a/programs/net/En.rc +++ b/programs/net/En.rc @@ -37,4 +37,7 @@ STRINGTABLE STRING_STOP_SVC_SUCCESS, "The %s service was stopped successfully.\n" STRING_STOP_SVC_FAIL, "The %s service failed to stop.\n" STRING_HELP_USAGE, "The syntax of this command is:\n\nNET HELP command\n -or-\nNET command /HELP\n\n Commands available are:\n NET HELP NET START NET STOP\n" + STRING_NO_ENTRIES, "There are no entries in the list.\n" + STRING_USE_HEADER, "\nStatus Local Remote\n---------------------------------------------------------------\n" + STRING_USE_ENTRY, "%s %S %S Open resources: %lu\n" } diff --git a/programs/net/Makefile.in b/programs/net/Makefile.in index 5364f4e8f9c..8ababf7f9a8 100644 --- a/programs/net/Makefile.in +++ b/programs/net/Makefile.in @@ -4,7 +4,7 @@ SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = net.exe APPMODE = -mconsole -IMPORTS = user32 advapi32 kernel32 +IMPORTS = netapi32 user32 advapi32 kernel32 C_SRCS = net.c diff --git a/programs/net/net.c b/programs/net/net.c index 4bc365279dd..f27c8531011 100644 --- a/programs/net/net.c +++ b/programs/net/net.c @@ -19,6 +19,7 @@ #include #include #include +#include #include "resources.h" #define NET_START 0001 @@ -36,6 +37,45 @@ int output_string(int msg, ...) return 0; } +static BOOL net_use(int argc, char *argv[]) +{ + USE_INFO_2 *buffer, *connection; + DWORD read, total, resume_handle, rc, i; + const char *status_description[] = { "OK", "Paused", "Disconnected", "An error occurred", + "A network error occurred", "Connection is being made", + "Reconnecting" }; + resume_handle = 0; + buffer = NULL; + + if(argc<3) + { + do { + rc = NetUseEnum(NULL, 2, (BYTE **) &buffer, 2048, &read, &total, &resume_handle); + if (rc != ERROR_MORE_DATA && rc != ERROR_SUCCESS) + { + break; + } + + if(total == 0) + { + output_string(STRING_NO_ENTRIES); + break; + } + + output_string(STRING_USE_HEADER); + for (i = 0, connection = buffer; i < read; ++i, ++connection) + output_string(STRING_USE_ENTRY, status_description[connection->ui2_status], connection->ui2_local, + connection->ui2_remote, connection->ui2_refcount); + + if (buffer != NULL) NetApiBufferFree(buffer); + } while (rc == ERROR_MORE_DATA); + + return TRUE; + } + + return FALSE; +} + static BOOL StopService(SC_HANDLE SCManager, SC_HANDLE serviceHandle) { LPENUM_SERVICE_STATUS dependencies = NULL; @@ -159,5 +199,10 @@ int main(int argc, char *argv[]) return 0; } + if(!strcasecmp(argv[1], "use")) + { + if(!net_use(argc, argv)) return 1; + } + return 0; } diff --git a/programs/net/resources.h b/programs/net/resources.h index 4c1c1671ea7..c5199fd932d 100644 --- a/programs/net/resources.h +++ b/programs/net/resources.h @@ -30,3 +30,6 @@ #define STRING_STOP_SVC_SUCCESS 112 #define STRING_STOP_SVC_FAIL 113 #define STRING_HELP_USAGE 114 +#define STRING_NO_ENTRIES 115 +#define STRING_USE_HEADER 116 +#define STRING_USE_ENTRY 117 diff --git a/programs/winetest/Makefile.in b/programs/winetest/Makefile.in index 2d4b12b0724..2cc17d1c71b 100644 --- a/programs/winetest/Makefile.in +++ b/programs/winetest/Makefile.in @@ -42,6 +42,7 @@ TESTBINS = \ gdi32_test.exe \ gdiplus_test.exe \ hlink_test.exe \ + inetcomm_test.exe \ infosoft_test.exe \ iphlpapi_test.exe \ itss_test.exe \ @@ -137,6 +138,8 @@ gdiplus_test.exe: $(DLLDIR)/gdiplus/tests/gdiplus_test.exe$(DLLEXT) cp $(DLLDIR)/gdiplus/tests/gdiplus_test.exe$(DLLEXT) $@ && $(STRIP) $@ hlink_test.exe: $(DLLDIR)/hlink/tests/hlink_test.exe$(DLLEXT) cp $(DLLDIR)/hlink/tests/hlink_test.exe$(DLLEXT) $@ && $(STRIP) $@ +inetcomm_test.exe: $(DLLDIR)/inetcomm/tests/inetcomm_test.exe$(DLLEXT) + cp $(DLLDIR)/inetcomm/tests/inetcomm_test.exe$(DLLEXT) $@ && $(STRIP) $@ infosoft_test.exe: $(DLLDIR)/infosoft/tests/infosoft_test.exe$(DLLEXT) cp $(DLLDIR)/infosoft/tests/infosoft_test.exe$(DLLEXT) $@ && $(STRIP) $@ iphlpapi_test.exe: $(DLLDIR)/iphlpapi/tests/iphlpapi_test.exe$(DLLEXT) diff --git a/programs/winetest/winetest.rc b/programs/winetest/winetest.rc index de1f7e9579d..58ae0626e5b 100644 --- a/programs/winetest/winetest.rc +++ b/programs/winetest/winetest.rc @@ -100,6 +100,7 @@ dsound_test.exe TESTRES "dsound_test.exe" gdi32_test.exe TESTRES "gdi32_test.exe" gdiplus_test.exe TESTRES "gdiplus_test.exe" hlink_test.exe TESTRES "hlink_test.exe" +inetcomm_test.exe TESTRES "inetcomm_test.exe" infosoft_test.exe TESTRES "infosoft_test.exe" iphlpapi_test.exe TESTRES "iphlpapi_test.exe" itss_test.exe TESTRES "itss_test.exe" diff --git a/server/event.c b/server/event.c index 99d0f4b2182..624159b15c4 100644 --- a/server/event.c +++ b/server/event.c @@ -187,7 +187,10 @@ DECL_HANDLER(create_event) if ((event = create_event( root, &name, req->attributes, req->manual_reset, req->initial_state, sd ))) { - reply->handle = alloc_handle( current->process, event, req->access, req->attributes ); + if (get_error() == STATUS_OBJECT_NAME_EXISTS) + reply->handle = alloc_handle( current->process, event, req->access, req->attributes ); + else + reply->handle = alloc_handle_no_access_check( current->process, event, req->access, req->attributes ); release_object( event ); } diff --git a/server/handle.c b/server/handle.c index 30facbe1e81..9b148109900 100644 --- a/server/handle.c +++ b/server/handle.c @@ -226,7 +226,7 @@ static obj_handle_t alloc_entry( struct handle_table *table, void *obj, unsigned /* allocate a handle for an object, incrementing its refcount */ /* return the handle, or 0 on error */ -static obj_handle_t alloc_handle_no_access_check( struct process *process, void *ptr, unsigned int access, unsigned int attr ) +obj_handle_t alloc_handle_no_access_check( struct process *process, void *ptr, unsigned int access, unsigned int attr ) { struct object *obj = ptr; diff --git a/server/handle.h b/server/handle.h index db19590b63f..fc34ee79e5c 100644 --- a/server/handle.h +++ b/server/handle.h @@ -36,6 +36,8 @@ struct unicode_str; /* that the thing pointed to starts with a struct object... */ extern obj_handle_t alloc_handle( struct process *process, void *obj, unsigned int access, unsigned int attr ); +extern obj_handle_t alloc_handle_no_access_check( struct process *process, void *ptr, + unsigned int access, unsigned int attr ); extern int close_handle( struct process *process, obj_handle_t handle ); extern struct object *get_handle_obj( struct process *process, obj_handle_t handle, unsigned int access, const struct object_ops *ops ); diff --git a/server/mapping.c b/server/mapping.c index bd21a501bac..9f062d0b0f5 100644 --- a/server/mapping.c +++ b/server/mapping.c @@ -415,7 +415,10 @@ DECL_HANDLER(create_mapping) if ((obj = create_mapping( root, &name, req->attributes, req->size, req->protect, req->file_handle, sd ))) { - reply->handle = alloc_handle( current->process, obj, req->access, req->attributes ); + if (get_error() == STATUS_OBJECT_NAME_EXISTS) + reply->handle = alloc_handle( current->process, obj, req->access, req->attributes ); + else + reply->handle = alloc_handle_no_access_check( current->process, obj, req->access, req->attributes ); release_object( obj ); } diff --git a/server/mutex.c b/server/mutex.c index 979f21f0d7d..0193422bc7a 100644 --- a/server/mutex.c +++ b/server/mutex.c @@ -212,7 +212,10 @@ DECL_HANDLER(create_mutex) if ((mutex = create_mutex( root, &name, req->attributes, req->owned, sd ))) { - reply->handle = alloc_handle( current->process, mutex, req->access, req->attributes ); + if (get_error() == STATUS_OBJECT_NAME_EXISTS) + reply->handle = alloc_handle( current->process, mutex, req->access, req->attributes ); + else + reply->handle = alloc_handle_no_access_check( current->process, mutex, req->access, req->attributes ); release_object( mutex ); } diff --git a/server/semaphore.c b/server/semaphore.c index 09445e1a64c..14121709729 100644 --- a/server/semaphore.c +++ b/server/semaphore.c @@ -187,7 +187,10 @@ DECL_HANDLER(create_semaphore) if ((sem = create_semaphore( root, &name, req->attributes, req->initial, req->max, sd ))) { - reply->handle = alloc_handle( current->process, sem, req->access, req->attributes ); + if (get_error() == STATUS_OBJECT_NAME_EXISTS) + reply->handle = alloc_handle( current->process, sem, req->access, req->attributes ); + else + reply->handle = alloc_handle_no_access_check( current->process, sem, req->access, req->attributes ); release_object( sem ); } diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c index 2cb8dc9bcdc..bb75a0a62a6 100644 --- a/tools/widl/typegen.c +++ b/tools/widl/typegen.c @@ -1535,9 +1535,7 @@ static size_t write_array_tfs(FILE *file, const attr_list_t *attrs, type_t *type has_pointer = TRUE; align = 0; - size = type_memsize(type, &align); - if (size == 0) /* conformant array */ - size = type_memsize(type->ref, &align); + size = type_memsize((is_conformant_array(type) ? type->ref : type), &align); start_offset = *typestring_offset; update_tfsoff(type, start_offset, file); -- 2.11.4.GIT