From 0ce3d289839f6a3acbad41cd0263c3672bdc4b9b Mon Sep 17 00:00:00 2001 From: Jan Zerebecki Date: Mon, 29 Oct 2007 15:20:52 +0100 Subject: [PATCH] push 69013efb0c49d41e1c0194081f5591aabe0bd7c5 --- Makefile.in | 2 + configure | 3 + configure.ac | 1 + dlls/Makefile.in | 1 + dlls/acledit/acledit.spec | 2 +- dlls/acledit/main.c | 12 + dlls/advpack/tests/files.c | 12 +- dlls/comctl32/toolbar.c | 4 +- dlls/credui/credui_main.c | 3 + dlls/crypt32/cert.c | 2 +- dlls/cryptnet/cryptnet_main.c | 9 +- dlls/d3dx8/Makefile.in | 3 +- dlls/d3dx8/d3dx8.spec | 42 +-- dlls/d3dx8/math.c | 303 ++++++++++++++++ dlls/d3dx8/tests/Makefile.in | 2 +- dlls/d3dx8/tests/math.c | 233 ++++++++++-- dlls/dbghelp/module.c | 37 +- dlls/kernel32/comm.c | 30 +- dlls/{d3dx8/tests => mscat32}/Makefile.in | 10 +- dlls/{acledit => mscat32}/main.c | 39 +- dlls/mscat32/mscat32.spec | 34 ++ dlls/msdmo/dmoreg.c | 10 +- dlls/mshtml/protocol.c | 1 + dlls/msvcrt/tests/string.c | 29 +- dlls/ntdll/serial.c | 12 +- dlls/oleaut32/typelib16.c | 9 + dlls/oleaut32/variant.c | 3 + dlls/riched20/tests/editor.c | 32 ++ dlls/shdocvw/navigate.c | 4 +- dlls/shell32/dialogs.c | 5 +- dlls/shell32/shfldr.h | 2 +- dlls/shell32/shfldr_fs.c | 4 +- dlls/shlwapi/shlwapi.spec | 4 +- dlls/shlwapi/tests/url.c | 2 +- dlls/snmpapi/main.c | 6 +- dlls/urlmon/tests/url.c | 200 ++++++++++- dlls/winealsa.drv/alsa.c | 7 +- dlls/winealsa.drv/midi.c | 7 +- dlls/winealsa.drv/mixer.c | 6 +- dlls/winealsa.drv/wavein.c | 43 ++- dlls/winealsa.drv/waveinit.c | 48 ++- dlls/winealsa.drv/waveout.c | 5 +- dlls/wined3d/directx.c | 56 ++- dlls/wined3d/surface.c | 566 ++++++++++++++++-------------- dlls/wined3d/wined3d_main.c | 10 +- dlls/wined3d/wined3d_private.h | 1 + dlls/wininet/ftp.c | 80 ++++- dlls/wininet/http.c | 15 +- dlls/wininet/tests/ftp.c | 64 ++-- dlls/wininet/tests/http.c | 12 + include/d3dx8math.h | 25 ++ include/d3dx8math.inl | 40 ++- include/tapi.h | 3 + include/winbase.h | 2 +- include/wincrypt.h | 2 +- programs/wineboot/shutdown.c | 1 + programs/wineboot/wineboot_En.rc | 4 +- programs/wineboot/wineboot_Ko.rc | 4 +- programs/wineboot/wineboot_Sv.rc | 4 +- programs/winetest/Makefile.in | 2 +- programs/winetest/main.c | 22 ++ tools/widl/client.c | 12 +- tools/widl/proxy.c | 10 +- tools/widl/server.c | 13 +- tools/widl/write_msft.c | 4 +- tools/winapi/win32.api | 23 ++ 66 files changed, 1598 insertions(+), 600 deletions(-) create mode 100644 dlls/d3dx8/math.c copy dlls/{d3dx8/tests => mscat32}/Makefile.in (62%) copy dlls/{acledit => mscat32}/main.c (53%) create mode 100644 dlls/mscat32/mscat32.spec diff --git a/Makefile.in b/Makefile.in index 96d395b775c..71c51eb101c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -289,6 +289,7 @@ ALL_MAKEFILES = \ dlls/msacm32/Makefile \ dlls/msacm32/tests/Makefile \ dlls/msadp32.acm/Makefile \ + dlls/mscat32/Makefile \ dlls/mscms/Makefile \ dlls/mscms/tests/Makefile \ dlls/mscoree/Makefile \ @@ -665,6 +666,7 @@ dlls/msacm32.drv/Makefile: dlls/msacm32.drv/Makefile.in dlls/Makedll.rules dlls/msacm32/Makefile: dlls/msacm32/Makefile.in dlls/Makedll.rules dlls/msacm32/tests/Makefile: dlls/msacm32/tests/Makefile.in dlls/Maketest.rules dlls/msadp32.acm/Makefile: dlls/msadp32.acm/Makefile.in dlls/Makedll.rules +dlls/mscat32/Makefile: dlls/mscat32/Makefile.in dlls/Makedll.rules dlls/mscms/Makefile: dlls/mscms/Makefile.in dlls/Makedll.rules dlls/mscms/tests/Makefile: dlls/mscms/tests/Makefile.in dlls/Maketest.rules dlls/mscoree/Makefile: dlls/mscoree/Makefile.in dlls/Makedll.rules diff --git a/configure b/configure index 8a401b9a6f4..8c01e3d87d9 100755 --- a/configure +++ b/configure @@ -20797,6 +20797,8 @@ ac_config_files="$ac_config_files dlls/msacm32/tests/Makefile" ac_config_files="$ac_config_files dlls/msadp32.acm/Makefile" +ac_config_files="$ac_config_files dlls/mscat32/Makefile" + ac_config_files="$ac_config_files dlls/mscms/Makefile" ac_config_files="$ac_config_files dlls/mscms/tests/Makefile" @@ -21954,6 +21956,7 @@ do "dlls/msacm32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/msacm32/Makefile" ;; "dlls/msacm32/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/msacm32/tests/Makefile" ;; "dlls/msadp32.acm/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/msadp32.acm/Makefile" ;; + "dlls/mscat32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/mscat32/Makefile" ;; "dlls/mscms/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/mscms/Makefile" ;; "dlls/mscms/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/mscms/tests/Makefile" ;; "dlls/mscoree/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/mscoree/Makefile" ;; diff --git a/configure.ac b/configure.ac index 84a1e982bc6..3f8ff527ece 100644 --- a/configure.ac +++ b/configure.ac @@ -1716,6 +1716,7 @@ AC_CONFIG_FILES([dlls/msacm32.drv/Makefile]) AC_CONFIG_FILES([dlls/msacm32/Makefile]) AC_CONFIG_FILES([dlls/msacm32/tests/Makefile]) AC_CONFIG_FILES([dlls/msadp32.acm/Makefile]) +AC_CONFIG_FILES([dlls/mscat32/Makefile]) AC_CONFIG_FILES([dlls/mscms/Makefile]) AC_CONFIG_FILES([dlls/mscms/tests/Makefile]) AC_CONFIG_FILES([dlls/mscoree/Makefile]) diff --git a/dlls/Makefile.in b/dlls/Makefile.in index 77e26ffb897..04d386a4f7f 100644 --- a/dlls/Makefile.in +++ b/dlls/Makefile.in @@ -112,6 +112,7 @@ BASEDIRS = \ msacm32 \ msacm32.drv \ msadp32.acm \ + mscat32 \ mscms \ mscoree \ msdmo \ diff --git a/dlls/acledit/acledit.spec b/dlls/acledit/acledit.spec index e33cc596a54..e1a30a1c708 100644 --- a/dlls/acledit/acledit.spec +++ b/dlls/acledit/acledit.spec @@ -2,7 +2,7 @@ 2 stub EditOwnerInfo 3 stub EditPermissionInfo 4 stdcall DllMain(long long ptr) -5 stub FMExtensionProcW +5 stdcall FMExtensionProcW(long long long) 6 stub SedDiscretionaryAclEditor 7 stub SedSystemAclEditor 8 stub SedTakeOwnership diff --git a/dlls/acledit/main.c b/dlls/acledit/main.c index 7dd374c3fde..ec6166b1882 100644 --- a/dlls/acledit/main.c +++ b/dlls/acledit/main.c @@ -46,3 +46,15 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) } return TRUE; } + +/*********************************************************************** + * FMExtensionProcW (acledit.@) + * + */ + +LONG WINAPI FMExtensionProcW(HWND hWnd, WORD wEvent, LONG lParam) +{ + FIXME("%p, %d, 0x%x) stub\n", hWnd, wEvent, lParam); + return 0; + +} diff --git a/dlls/advpack/tests/files.c b/dlls/advpack/tests/files.c index cbbbd3afd87..71c1741d957 100644 --- a/dlls/advpack/tests/files.c +++ b/dlls/advpack/tests/files.c @@ -112,17 +112,23 @@ static BOOL check_ini_contents(LPSTR filename, BOOL add) GetPrivateProfileStringA("backup", "one", NULL, field, FIELD_LEN, filename); match = !lstrcmpA(field, "-1,0,0,0,0,0,-1"); - if ((add && !match) || (!add && match)) + if ((add && !match) || (!add && match)) { + trace("first test: got %s\n", field); ret = FALSE; + } GetPrivateProfileStringA("backup", "two", NULL, field, FIELD_LEN, filename); - if (lstrcmpA(field, "-1,0,0,0,0,0,-1")) + if (lstrcmpA(field, "-1,0,0,0,0,0,-1")) { + trace("second test: got %s\n", field); ret = FALSE; + } GetPrivateProfileStringA("backup", "three", NULL, field, FIELD_LEN, filename); match = !lstrcmpA(field, "-1,0,0,0,0,0,-1"); - if ((add && !match) || (!add && match)) + if ((add && !match) || (!add && match)) { + trace("third test: got %s\n", field); ret = FALSE; + } return ret; } diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c index 921c0ff27ca..429444e15ae 100644 --- a/dlls/comctl32/toolbar.c +++ b/dlls/comctl32/toolbar.c @@ -6332,7 +6332,7 @@ static LRESULT TOOLBAR_TTGetDispInfo (TOOLBAR_INFO *infoPtr, NMTTDISPINFOW *lpnm return 0; } } - else if (len > 0) + else if (tbgit.pszText[0]) { MultiByteToWideChar(CP_ACP, 0, tbgit.pszText, -1, lpnmtdi->lpszText, sizeof(lpnmtdi->szText)/sizeof(lpnmtdi->szText[0])); @@ -6374,7 +6374,7 @@ static LRESULT TOOLBAR_TTGetDispInfo (TOOLBAR_INFO *infoPtr, NMTTDISPINFOW *lpnm /* last resort: send notification on to app */ /* FIXME: find out what is really used here */ - return SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, 0, (LPARAM)lpnmtdi); + return SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, (WPARAM)lpnmtdi->hdr.idFrom, (LPARAM)lpnmtdi); } diff --git a/dlls/credui/credui_main.c b/dlls/credui/credui_main.c index 2f1a113563a..93d5b8842b0 100644 --- a/dlls/credui/credui_main.c +++ b/dlls/credui/credui_main.c @@ -170,7 +170,10 @@ static INT_PTR CALLBACK CredDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, GetWindowTextW(hwndUsername, user, len + 1); if (!user[0]) + { + HeapFree(GetProcessHeap(), 0, user); return TRUE; + } if (!strchrW(user, '\\') && !strchrW(user, '@')) { diff --git a/dlls/crypt32/cert.c b/dlls/crypt32/cert.c index 976589b7edc..844b0542a95 100644 --- a/dlls/crypt32/cert.c +++ b/dlls/crypt32/cert.c @@ -1242,7 +1242,7 @@ typedef BOOL (WINAPI *CertVerifyRevocationFunc)(DWORD, DWORD, DWORD, void **, DWORD, PCERT_REVOCATION_PARA, PCERT_REVOCATION_STATUS); BOOL WINAPI CertVerifyRevocation(DWORD dwEncodingType, DWORD dwRevType, - DWORD cContext, void *rgpvContext[], DWORD dwFlags, + DWORD cContext, PVOID rgpvContext[], DWORD dwFlags, PCERT_REVOCATION_PARA pRevPara, PCERT_REVOCATION_STATUS pRevStatus) { BOOL ret; diff --git a/dlls/cryptnet/cryptnet_main.c b/dlls/cryptnet/cryptnet_main.c index b83adb850e3..487da9df170 100644 --- a/dlls/cryptnet/cryptnet_main.c +++ b/dlls/cryptnet/cryptnet_main.c @@ -23,6 +23,7 @@ #include #define NONAMELESSUNION +#define NONAMELESSSTRUCT #include "windef.h" #include "wine/debug.h" @@ -353,7 +354,7 @@ static BOOL CRYPT_GetObjectFromFile(HANDLE hFile, PCRYPT_BLOB_ARRAY pObject) if ((ret = GetFileSizeEx(hFile, &size))) { - if (size.HighPart) + if (size.u.HighPart) { WARN("file too big\n"); SetLastError(ERROR_INVALID_DATA); @@ -363,11 +364,11 @@ static BOOL CRYPT_GetObjectFromFile(HANDLE hFile, PCRYPT_BLOB_ARRAY pObject) { CRYPT_DATA_BLOB blob; - blob.pbData = CryptMemAlloc(size.LowPart); + blob.pbData = CryptMemAlloc(size.u.LowPart); if (blob.pbData) { - blob.cbData = size.LowPart; - ret = ReadFile(hFile, blob.pbData, size.LowPart, &blob.cbData, + blob.cbData = size.u.LowPart; + ret = ReadFile(hFile, blob.pbData, size.u.LowPart, &blob.cbData, NULL); if (ret) { diff --git a/dlls/d3dx8/Makefile.in b/dlls/d3dx8/Makefile.in index f8159bb87b7..800bb541ad0 100644 --- a/dlls/d3dx8/Makefile.in +++ b/dlls/d3dx8/Makefile.in @@ -9,7 +9,8 @@ EXTRALIBS = -ldxguid -luuid C_SRCS = \ d3dx8_main.c \ - d3dxbuffer.c + d3dxbuffer.c \ + math.c @MAKE_DLL_RULES@ diff --git a/dlls/d3dx8/d3dx8.spec b/dlls/d3dx8/d3dx8.spec index 3293614a116..a64e1e40029 100644 --- a/dlls/d3dx8/d3dx8.spec +++ b/dlls/d3dx8/d3dx8.spec @@ -1,25 +1,25 @@ -@ stub D3DXVec2Normalize -@ stub D3DXVec2Hermite -@ stub D3DXVec2CatmullRom -@ stub D3DXVec2BaryCentric -@ stub D3DXVec2Transform -@ stub D3DXVec2TransformCoord -@ stub D3DXVec2TransformNormal -@ stub D3DXVec3Normalize -@ stub D3DXVec3Hermite -@ stub D3DXVec3CatmullRom -@ stub D3DXVec3BaryCentric -@ stub D3DXVec3Transform -@ stub D3DXVec3TransformCoord -@ stub D3DXVec3TransformNormal +@ stdcall D3DXVec2Normalize(ptr ptr) +@ stdcall D3DXVec2Hermite(ptr ptr ptr ptr ptr long) +@ stdcall D3DXVec2CatmullRom(ptr ptr ptr ptr long) +@ stdcall D3DXVec2BaryCentric(ptr ptr ptr ptr long long) +@ stdcall D3DXVec2Transform(ptr ptr ptr) +@ stdcall D3DXVec2TransformCoord(ptr ptr ptr) +@ stdcall D3DXVec2TransformNormal(ptr ptr ptr) +@ stdcall D3DXVec3Normalize(ptr ptr) +@ stdcall D3DXVec3Hermite(ptr ptr ptr ptr ptr long) +@ stdcall D3DXVec3CatmullRom(ptr ptr ptr ptr long) +@ stdcall D3DXVec3BaryCentric(ptr ptr ptr ptr long long) +@ stdcall D3DXVec3Transform(ptr ptr ptr) +@ stdcall D3DXVec3TransformCoord(ptr ptr ptr) +@ stdcall D3DXVec3TransformNormal(ptr ptr ptr) @ stub D3DXVec3Project @ stub D3DXVec3Unproject -@ stub D3DXVec4Cross -@ stub D3DXVec4Normalize -@ stub D3DXVec4Hermite -@ stub D3DXVec4CatmullRom -@ stub D3DXVec4BaryCentric -@ stub D3DXVec4Transform +@ stdcall D3DXVec4Cross(ptr ptr ptr) +@ stdcall D3DXVec4Normalize(ptr ptr) +@ stdcall D3DXVec4Hermite(ptr ptr ptr ptr ptr long) +@ stdcall D3DXVec4CatmullRom(ptr ptr ptr ptr long) +@ stdcall D3DXVec4BaryCentric(ptr ptr ptr ptr long long) +@ stdcall D3DXVec4Transform(ptr ptr ptr) @ stub D3DXMatrixfDeterminant @ stub D3DXMatrixMultiply @ stub D3DXMatrixTranspose @@ -53,7 +53,7 @@ @ stub D3DXQuaternionRotationAxis @ stub D3DXQuaternionRotationYawPitchRoll @ stub D3DXQuaternionMultiply -@ stub D3DXQuaternionNormalize +@ stdcall D3DXQuaternionNormalize(ptr ptr) @ stub D3DXQuaternionInverse @ stub D3DXQuaternionLn @ stub D3DXQuaternionExp diff --git a/dlls/d3dx8/math.c b/dlls/d3dx8/math.c new file mode 100644 index 00000000000..ff1b49301c7 --- /dev/null +++ b/dlls/d3dx8/math.c @@ -0,0 +1,303 @@ +/* + * Copyright 2007 David Adam + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include +#include +#include +#include +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" +#include "d3dx8.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(d3dx8); + +/*_________________D3DXQUATERNION________________*/ + +D3DXQUATERNION* WINAPI D3DXQuaternionNormalize(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq) +{ + FLOAT norm; + + norm = D3DXQuaternionLength(pq); + if ( !norm ) + { + pout->x = 0.0f; + pout->y = 0.0f; + pout->z = 0.0f; + pout->w = 0.0f; + } + else + { + pout->x = pq->x / norm; + pout->y = pq->y / norm; + pout->z = pq->z / norm; + pout->w = pq->w / norm; + } + return pout; +} +/*_________________D3DXVec2_____________________*/ + +D3DXVECTOR2* WINAPI D3DXVec2BaryCentric(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2, CONST D3DXVECTOR2 *pv3, FLOAT f, FLOAT g) +{ + pout->x = (1.0f-f-g) * (pv1->x) + f * (pv2->x) + g * (pv3->x); + pout->y = (1.0f-f-g) * (pv1->y) + f * (pv2->y) + g * (pv3->y); + return pout; +} + +D3DXVECTOR2* WINAPI D3DXVec2CatmullRom(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv0, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2, CONST D3DXVECTOR2 *pv3, FLOAT s) +{ + pout->x = 0.5f * (2.0f * pv1->x + (pv2->x - pv0->x) *s + (2.0f *pv0->x - 5.0f * pv1->x + 4.0f * pv2->x - pv3->x) * s * s + (pv3->x -3.0f * pv2->x + 3.0f * pv1->x - pv0->x) * s * s * s); + pout->y = 0.5f * (2.0f * pv1->y + (pv2->y - pv0->y) *s + (2.0f *pv0->y - 5.0f * pv1->y + 4.0f * pv2->y - pv3->y) * s * s + (pv3->y -3.0f * pv2->y + 3.0f * pv1->y - pv0->y) * s * s * s); + return pout; +} + +D3DXVECTOR2* WINAPI D3DXVec2Hermite(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pt1, CONST D3DXVECTOR2 *pv2, CONST D3DXVECTOR2 *pt2, FLOAT s) +{ + FLOAT h1, h2, h3, h4; + + h1 = 2.0f * s * s * s - 3.0f * s * s + 1.0f; + h2 = s * s * s - 2.0f * s * s + s; + h3 = -2.0f * s * s * s + 3.0f * s * s; + h4 = s * s * s - s * s; + + pout->x = h1 * (pv1->x) + h2 * (pt1->x) + h3 * (pv2->x) + h4 * (pt2->x); + pout->y = h1 * (pv1->y) + h2 * (pt1->y) + h3 * (pv2->y) + h4 * (pt2->y); + return pout; +} + +D3DXVECTOR2* WINAPI D3DXVec2Normalize(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv) +{ + FLOAT norm; + + norm = D3DXVec2Length(pv); + if ( !norm ) + { + pout->x = 0.0f; + pout->y = 0.0f; + } + else + { + pout->x = pv->x / norm; + pout->y = pv->y / norm; + } + return pout; +} + +D3DXVECTOR4* WINAPI D3DXVec2Transform(D3DXVECTOR4 *pout, CONST D3DXVECTOR2 *pv, CONST D3DXMATRIX *pm) +{ + pout->x = pm->m[0][0] * pv->x + pm->m[1][0] * pv->y + pm->m[3][0]; + pout->y = pm->m[0][1] * pv->x + pm->m[1][1] * pv->y + pm->m[3][1]; + pout->z = pm->m[0][2] * pv->x + pm->m[1][2] * pv->y + pm->m[3][2]; + pout->w = pm->m[0][3] * pv->x + pm->m[1][3] * pv->y + pm->m[3][3]; + return pout; +} + +D3DXVECTOR2* WINAPI D3DXVec2TransformCoord(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv, CONST D3DXMATRIX *pm) +{ + FLOAT norm; + + norm = pm->m[0][3] * pv->x + pm->m[1][3] * pv->y + pm->m[3][3]; + if ( norm ) + { + pout->x = (pm->m[0][0] * pv->x + pm->m[1][0] * pv->y + pm->m[3][0]) / norm; + pout->y = (pm->m[0][1] * pv->x + pm->m[1][1] * pv->y + pm->m[3][1]) / norm; + } + else + { + pout->x = 0.0f; + pout->y = 0.0f; + } + return pout; +} + +D3DXVECTOR2* WINAPI D3DXVec2TransformNormal(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv, CONST D3DXMATRIX *pm) +{ + pout->x = pm->m[0][0] * pv->x + pm->m[1][0] * pv->y; + pout->y = pm->m[0][1] * pv->x + pm->m[1][1] * pv->y; + return pout; +} + +/*_________________D3DXVec3_____________________*/ + +D3DXVECTOR3* WINAPI D3DXVec3BaryCentric(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2, CONST D3DXVECTOR3 *pv3, FLOAT f, FLOAT g) +{ + pout->x = (1.0f-f-g) * (pv1->x) + f * (pv2->x) + g * (pv3->x); + pout->y = (1.0f-f-g) * (pv1->y) + f * (pv2->y) + g * (pv3->y); + pout->z = (1.0f-f-g) * (pv1->z) + f * (pv2->z) + g * (pv3->z); + return pout; +} + +D3DXVECTOR3* WINAPI D3DXVec3CatmullRom( D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv0, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2, CONST D3DXVECTOR3 *pv3, FLOAT s) +{ + pout->x = 0.5f * (2.0f * pv1->x + (pv2->x - pv0->x) *s + (2.0f *pv0->x - 5.0f * pv1->x + 4.0f * pv2->x - pv3->x) * s * s + (pv3->x -3.0f * pv2->x + 3.0f * pv1->x - pv0->x) * s * s * s); + pout->y = 0.5f * (2.0f * pv1->y + (pv2->y - pv0->y) *s + (2.0f *pv0->y - 5.0f * pv1->y + 4.0f * pv2->y - pv3->y) * s * s + (pv3->y -3.0f * pv2->y + 3.0f * pv1->y - pv0->y) * s * s * s); + pout->z = 0.5f * (2.0f * pv1->z + (pv2->z - pv0->z) *s + (2.0f *pv0->z - 5.0f * pv1->z + 4.0f * pv2->z - pv3->z) * s * s + (pv3->z -3.0f * pv2->z + 3.0f * pv1->z - pv0->z) * s * s * s); + return pout; +} + +D3DXVECTOR3* WINAPI D3DXVec3Hermite(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pt1, CONST D3DXVECTOR3 *pv2, CONST D3DXVECTOR3 *pt2, FLOAT s) +{ + FLOAT h1, h2, h3, h4; + + h1 = 2.0f * s * s * s - 3.0f * s * s + 1.0f; + h2 = s * s * s - 2.0f * s * s + s; + h3 = -2.0f * s * s * s + 3.0f * s * s; + h4 = s * s * s - s * s; + + pout->x = h1 * (pv1->x) + h2 * (pt1->x) + h3 * (pv2->x) + h4 * (pt2->x); + pout->y = h1 * (pv1->y) + h2 * (pt1->y) + h3 * (pv2->y) + h4 * (pt2->y); + pout->z = h1 * (pv1->z) + h2 * (pt1->z) + h3 * (pv2->z) + h4 * (pt2->z); + return pout; +} + +D3DXVECTOR3* WINAPI D3DXVec3Normalize(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv) +{ + FLOAT norm; + + norm = D3DXVec3Length(pv); + if ( !norm ) + { + pout->x = 0.0f; + pout->y = 0.0f; + pout->z = 0.0f; + } + else + { + pout->x = pv->x / norm; + pout->y = pv->y / norm; + pout->z = pv->z / norm; + } + return pout; +} + +D3DXVECTOR4* WINAPI D3DXVec3Transform(D3DXVECTOR4 *pout, CONST D3DXVECTOR3 *pv, CONST D3DXMATRIX *pm) +{ + pout->x = pm->m[0][0] * pv->x + pm->m[1][0] * pv->y + pm->m[2][0] * pv->z + pm->m[3][0]; + pout->y = pm->m[0][1] * pv->x + pm->m[1][1] * pv->y + pm->m[2][1] * pv->z + pm->m[3][1]; + pout->z = pm->m[0][2] * pv->x + pm->m[1][2] * pv->y + pm->m[2][2] * pv->z + pm->m[3][2]; + pout->w = pm->m[0][3] * pv->x + pm->m[1][3] * pv->y + pm->m[2][3] * pv->z + pm->m[3][3]; + return pout; +} + +D3DXVECTOR3* WINAPI D3DXVec3TransformCoord(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv, CONST D3DXMATRIX *pm) +{ + FLOAT norm; + + norm = pm->m[0][3] * pv->x + pm->m[1][3] * pv->y + pm->m[2][3] *pv->z + pm->m[3][3]; + + if ( norm ) + { + pout->x = (pm->m[0][0] * pv->x + pm->m[1][0] * pv->y + pm->m[2][0] * pv->z + pm->m[3][0]) / norm; + pout->y = (pm->m[0][1] * pv->x + pm->m[1][1] * pv->y + pm->m[2][1] * pv->z + pm->m[3][1]) / norm; + pout->z = (pm->m[0][2] * pv->x + pm->m[1][2] * pv->y + pm->m[2][2] * pv->z + pm->m[3][2]) / norm; + } + else + { + pout->x = 0.0f; + pout->y = 0.0f; + pout->z = 0.0f; + } + return pout; +} + +D3DXVECTOR3* WINAPI D3DXVec3TransformNormal(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv, CONST D3DXMATRIX *pm) +{ + pout->x = pm->m[0][0] * pv->x + pm->m[1][0] * pv->y + pm->m[2][0] * pv->z; + pout->y = pm->m[0][1] * pv->x + pm->m[1][1] * pv->y + pm->m[2][1] * pv->z; + pout->z = pm->m[0][2] * pv->x + pm->m[1][2] * pv->y + pm->m[2][2] * pv->z; + return pout; + +} + +/*_________________D3DXVec4_____________________*/ + +D3DXVECTOR4* WINAPI D3DXVec4BaryCentric(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2, CONST D3DXVECTOR4 *pv3, FLOAT f, FLOAT g) +{ + pout->x = (1.0f-f-g) * (pv1->x) + f * (pv2->x) + g * (pv3->x); + pout->y = (1.0f-f-g) * (pv1->y) + f * (pv2->y) + g * (pv3->y); + pout->z = (1.0f-f-g) * (pv1->z) + f * (pv2->z) + g * (pv3->z); + pout->w = (1.0f-f-g) * (pv1->w) + f * (pv2->w) + g * (pv3->w); + return pout; +} + +D3DXVECTOR4* WINAPI D3DXVec4CatmullRom(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv0, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2, CONST D3DXVECTOR4 *pv3, FLOAT s) +{ + pout->x = 0.5f * (2.0f * pv1->x + (pv2->x - pv0->x) *s + (2.0f *pv0->x - 5.0f * pv1->x + 4.0f * pv2->x - pv3->x) * s * s + (pv3->x -3.0f * pv2->x + 3.0f * pv1->x - pv0->x) * s * s * s); + pout->y = 0.5f * (2.0f * pv1->y + (pv2->y - pv0->y) *s + (2.0f *pv0->y - 5.0f * pv1->y + 4.0f * pv2->y - pv3->y) * s * s + (pv3->y -3.0f * pv2->y + 3.0f * pv1->y - pv0->y) * s * s * s); + pout->z = 0.5f * (2.0f * pv1->z + (pv2->z - pv0->z) *s + (2.0f *pv0->z - 5.0f * pv1->z + 4.0f * pv2->z - pv3->z) * s * s + (pv3->z -3.0f * pv2->z + 3.0f * pv1->z - pv0->z) * s * s * s); + pout->w = 0.5f * (2.0f * pv1->w + (pv2->w - pv0->w) *s + (2.0f *pv0->w - 5.0f * pv1->w + 4.0f * pv2->w - pv3->w) * s * s + (pv3->w -3.0f * pv2->w + 3.0f * pv1->w - pv0->w) * s * s * s); + return pout; +} + +D3DXVECTOR4* WINAPI D3DXVec4Cross(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2, CONST D3DXVECTOR4 *pv3) +{ + pout->x = pv1->y * (pv2->z * pv3->w - pv3->z * pv2->w) - pv1->z * (pv2->y * pv3->w - pv3->y * pv2->w) + pv1->w * (pv2->y * pv3->z - pv2->z *pv3->y); + pout->y = -(pv1->x * (pv2->z * pv3->w - pv3->z * pv2->w) - pv1->z * (pv2->x * pv3->w - pv3->x * pv2->w) + pv1->w * (pv2->x * pv3->z - pv3->x * pv2->z)); + pout->z = pv1->x * (pv2->y * pv3->w - pv3->y * pv2->w) - pv1->y * (pv2->x *pv3->w - pv3->x * pv2->w) + pv1->w * (pv2->x * pv3->y - pv3->x * pv2->y); + pout->w = -(pv1->x * (pv2->y * pv3->z - pv3->y * pv2->z) - pv1->y * (pv2->x * pv3->z - pv3->x *pv2->z) + pv1->z * (pv2->x * pv3->y - pv3->x * pv2->y)); + return pout; +} + +D3DXVECTOR4* WINAPI D3DXVec4Hermite(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pt1, CONST D3DXVECTOR4 *pv2, CONST D3DXVECTOR4 *pt2, FLOAT s) +{ + FLOAT h1, h2, h3, h4; + + h1 = 2.0f * s * s * s - 3.0f * s * s + 1.0f; + h2 = s * s * s - 2.0f * s * s + s; + h3 = -2.0f * s * s * s + 3.0f * s * s; + h4 = s * s * s - s * s; + + pout->x = h1 * (pv1->x) + h2 * (pt1->x) + h3 * (pv2->x) + h4 * (pt2->x); + pout->y = h1 * (pv1->y) + h2 * (pt1->y) + h3 * (pv2->y) + h4 * (pt2->y); + pout->z = h1 * (pv1->z) + h2 * (pt1->z) + h3 * (pv2->z) + h4 * (pt2->z); + pout->w = h1 * (pv1->w) + h2 * (pt1->w) + h3 * (pv2->w) + h4 * (pt2->w); + return pout; +} + +D3DXVECTOR4* WINAPI D3DXVec4Normalize(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv) +{ + FLOAT norm; + + norm = D3DXVec4Length(pv); + if ( !norm ) + { + pout->x = 0.0f; + pout->y = 0.0f; + pout->z = 0.0f; + pout->w = 0.0f; + } + else + { + pout->x = pv->x / norm; + pout->y = pv->y / norm; + pout->z = pv->z / norm; + pout->w = pv->w / norm; + } + return pout; +} + +D3DXVECTOR4* WINAPI D3DXVec4Transform(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv, CONST D3DXMATRIX *pm) +{ + pout->x = pm->m[0][0] * pv->x + pm->m[1][0] * pv->y + pm->m[2][0] * pv->z + pm->m[3][0] * pv->w; + pout->y = pm->m[0][1] * pv->x + pm->m[1][1] * pv->y + pm->m[2][1] * pv->z + pm->m[3][1] * pv->w; + pout->z = pm->m[0][2] * pv->x + pm->m[1][2] * pv->y + pm->m[2][2] * pv->z + pm->m[3][2] * pv->w; + pout->w = pm->m[0][3] * pv->x + pm->m[1][3] * pv->y + pm->m[2][3] * pv->z + pm->m[3][3] * pv->w; + return pout; +} diff --git a/dlls/d3dx8/tests/Makefile.in b/dlls/d3dx8/tests/Makefile.in index 1cf574078b4..77737f7f926 100644 --- a/dlls/d3dx8/tests/Makefile.in +++ b/dlls/d3dx8/tests/Makefile.in @@ -3,7 +3,7 @@ TOPOBJDIR = ../../.. SRCDIR = @srcdir@ VPATH = @srcdir@ TESTDLL = d3dx8.dll -IMPORTS = kernel32 +IMPORTS = d3dx8 kernel32 EXTRALIBS = -ldxguid CTESTS = math.c diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c index 0e70183a3da..021dfe4f7d3 100644 --- a/dlls/d3dx8/tests/math.c +++ b/dlls/d3dx8/tests/math.c @@ -17,8 +17,7 @@ */ #include -#include "d3dx8math.h" -#include "d3dx8math.inl" +#include "d3dx8.h" #include "wine/test.h" @@ -28,7 +27,7 @@ #define expect_vec(expectedvec,gotvec) ok((fabs(expectedvec.x-gotvec.x)= name + 3 && !memcmp(ptr - 3, S_DotSoW, 3))) - return DMT_ELF; - else if (!strcmpiW(ptr, S_DotPdbW)) - return DMT_PDB; - } + int i = len; + + while (i && isdigit(name[i - 1])) i--; + + if (i && name[i - 1] == '.') + len = i - 1; + else + break; + } while (len); + + /* check for terminating .so or .so.[digit] */ + if (len > 3 && !memcmp(name + len - 3, S_DotSoW, 3)) + return DMT_ELF; + + if (len > 4 && !strncmpiW(name + len - 4, S_DotPdbW, 4)) + return DMT_PDB; + /* wine-[kp]thread is also an ELF module */ - else if (((len > 12 && name[len - 13] == '/') || len == 12) && - (!strcmpiW(name + len - 12, S_WinePThreadW) || - !strcmpiW(name + len - 12, S_WineKThreadW))) + if (((len > 12 && name[len - 13] == '/') || len == 12) && + (!strncmpiW(name + len - 12, S_WinePThreadW, 12) || + !strncmpiW(name + len - 12, S_WineKThreadW, 12))) { return DMT_ELF; } diff --git a/dlls/kernel32/comm.c b/dlls/kernel32/comm.c index 076b7610068..ea71a26784b 100644 --- a/dlls/kernel32/comm.c +++ b/dlls/kernel32/comm.c @@ -1301,19 +1301,21 @@ BOOL WINAPI SetCommConfig( } /*********************************************************************** - * SetDefaultCommConfigA (KERNEL32.@) + * SetDefaultCommConfigW (KERNEL32.@) * - * Initializes the default configuration for the specified communication - * device. (ascii) + * Initializes the default configuration for a communication device. + * + * PARAMS + * lpszDevice [I] Name of the device targeted for configuration + * lpCommConfig [I] PTR to a buffer with the configuration for the device + * dwSize [I] Number of bytes in the buffer * * RETURNS + * Failure: FALSE + * Success: TRUE, and default configuration saved * - * True if the device was found and the defaults set, false otherwise */ -BOOL WINAPI SetDefaultCommConfigW( - LPCWSTR lpszDevice, /* [in] The ascii name of the device targeted for configuration. */ - LPCOMMCONFIG lpCommConfig, /* [in] The default configuration for the device. */ - DWORD dwSize) /* [in] The number of bytes in the configuration structure. */ +BOOL WINAPI SetDefaultCommConfigW(LPCWSTR lpszDevice, LPCOMMCONFIG lpCommConfig, DWORD dwSize) { FARPROC lpfnSetDefaultCommConfig; HMODULE hConfigModule; @@ -1336,18 +1338,14 @@ BOOL WINAPI SetDefaultCommConfigW( /*********************************************************************** - * SetDefaultCommConfigW (KERNEL32.@) + * SetDefaultCommConfigA (KERNEL32.@) * - * Initializes the default configuration for the specified - * communication device. (unicode) + * Initializes the default configuration for a communication device. * - * RETURNS + * See SetDefaultCommConfigW. * */ -BOOL WINAPI SetDefaultCommConfigA( - LPCSTR lpszDevice, /* [in] The unicode name of the device targeted for configuration. */ - LPCOMMCONFIG lpCommConfig, /* [in] The default configuration for the device. */ - DWORD dwSize) /* [in] The number of bytes in the configuration structure. */ +BOOL WINAPI SetDefaultCommConfigA(LPCSTR lpszDevice, LPCOMMCONFIG lpCommConfig, DWORD dwSize) { BOOL r; LPWSTR lpDeviceW = NULL; diff --git a/dlls/d3dx8/tests/Makefile.in b/dlls/mscat32/Makefile.in similarity index 62% copy from dlls/d3dx8/tests/Makefile.in copy to dlls/mscat32/Makefile.in index 1cf574078b4..dc6c4c11862 100644 --- a/dlls/d3dx8/tests/Makefile.in +++ b/dlls/mscat32/Makefile.in @@ -1,13 +1,13 @@ TOPSRCDIR = @top_srcdir@ -TOPOBJDIR = ../../.. +TOPOBJDIR = ../.. SRCDIR = @srcdir@ VPATH = @srcdir@ -TESTDLL = d3dx8.dll +MODULE = mscat32.dll IMPORTS = kernel32 -EXTRALIBS = -ldxguid -CTESTS = math.c +C_SRCS = \ + main.c -@MAKE_TEST_RULES@ +@MAKE_DLL_RULES@ @DEPENDENCIES@ # everything below this line is overwritten by make depend diff --git a/dlls/acledit/main.c b/dlls/mscat32/main.c similarity index 53% copy from dlls/acledit/main.c copy to dlls/mscat32/main.c index 7dd374c3fde..7e61aa93ce8 100644 --- a/dlls/acledit/main.c +++ b/dlls/mscat32/main.c @@ -1,48 +1,47 @@ -/* - * Implementation of the AclEdit Interface +/* mscat32.dll - Backend for Microsoft's MakeCat command-line tool * - * Copyright 2006 Eric Pouech + * Copyright (C) 2007 Alexander N. Sørnes * - * This library is free software; you can redistribute it and/or + * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software + * License along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#include "config.h" +#include #include "windef.h" #include "winbase.h" -#include "winuser.h" - -#include "wine/unicode.h" #include "wine/debug.h" -WINE_DEFAULT_DEBUG_CHANNEL(acledit); +WINE_DEFAULT_DEBUG_CHANNEL(mscat); + -/***************************************************** - * DllMain - */ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { - TRACE("(%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved); + TRACE("(%p, %d, %p)\n",hinstDLL,fdwReason,lpvReserved); - switch (fdwReason) + if (fdwReason == DLL_WINE_PREATTACH) return FALSE; /* prefer native version */ + + if (fdwReason == DLL_PROCESS_ATTACH) { - case DLL_WINE_PREATTACH: - return FALSE; /* prefer native version */ - case DLL_PROCESS_ATTACH: DisableThreadLibraryCalls( hinstDLL ); - break; + /* FIXME: Initialisation */ + } + else if (fdwReason == DLL_PROCESS_DETACH) + { + /* FIXME: Cleanup */ } + return TRUE; } diff --git a/dlls/mscat32/mscat32.spec b/dlls/mscat32/mscat32.spec new file mode 100644 index 00000000000..5d277deca02 --- /dev/null +++ b/dlls/mscat32/mscat32.spec @@ -0,0 +1,34 @@ +@ stub CryptCATVerifyMember +@ stdcall CryptCATAdminAcquireContext(long ptr long) wintrust.CryptCATAdminAcquireContext +@ stdcall CryptCATAdminAddCatalog(long wstr wstr long) wintrust.CryptCATAdminAddCatalog +@ stdcall CryptCATAdminCalcHashFromFileHandle(long ptr ptr long) wintrust.CryptCATAdminCalcHashFromFileHandle +@ stdcall CryptCATAdminEnumCatalogFromHash(long ptr long long ptr) wintrust.CryptCATAdminEnumCatalogFromHash +@ stdcall CryptCATAdminReleaseCatalogContext(long long long) wintrust.CryptCATAdminReleaseCatalogContext +@ stdcall CryptCATAdminReleaseContext(long long) wintrust.CryptCATAdminReleaseContext +@ stub CryptCATCDFClose +@ stub CryptCATCDFEnumAttributes +@ stub CryptCATCDFEnumAttributesWithCDFTag +@ stub CryptCATCDFEnumCatAttributes +@ stub CryptCATCDFEnumMembers +@ stub CryptCATCDFEnumMembersByCDFTag +@ stub CryptCATCDFOpen +@ stub CryptCATCatalogInfoFromContext +@ stdcall CryptCATClose(long) wintrust.CryptCATClose +@ stub CryptCATEnumerateAttr +@ stub CryptCATEnumerateCatAttr +@ stdcall CryptCATEnumerateMember(long ptr) wintrust.CryptCATEnumerateMember +@ stub CryptCATGetAttrInfo +@ stub CryptCATGetCatAttrInfo +@ stub CryptCATGetMemberInfo +@ stub CryptCATHandleFromStore +@ stdcall CryptCATOpen(wstr long long long long) wintrust.CryptCATOpen +@ stub CryptCATPersistStore +@ stub CryptCATPutAttrInfo +@ stub CryptCATPutCatAttrInfo +@ stub CryptCATPutMemberInfo +@ stub CryptCATStoreFromHandle +@ stdcall -private DllRegisterServer() wintrust.mscat32DllRegisterServer +@ stdcall -private DllUnregisterServer() wintrust.mscat32DllUnregisterServer +@ stub IsCatalogFile +@ stub MsCatConstructHashTag +@ stub MsCatFreeHashTag diff --git a/dlls/msdmo/dmoreg.c b/dlls/msdmo/dmoreg.c index 25bb759a565..95602348ba5 100644 --- a/dlls/msdmo/dmoreg.c +++ b/dlls/msdmo/dmoreg.c @@ -509,19 +509,23 @@ static HRESULT WINAPI IEnumDMO_fnNext( { This->index++; + len = MAX_PATH; hres = RegEnumKeyExW(This->hkey, This->index, szNextKey, &len, NULL, NULL, NULL, &ft); if (hres != ERROR_SUCCESS) break; TRACE("found %s\n", debugstr_w(szNextKey)); - if (This->dwFlags & DMO_REGISTERF_IS_KEYED) + if (!(This->dwFlags & DMO_ENUMF_INCLUDE_KEYED)) { wsprintfW(szKey, szCat3Fmt, szDMORootKey, szNextKey, szDMOKeyed); hres = RegOpenKeyExW(HKEY_CLASSES_ROOT, szKey, 0, KEY_READ, &hkey); - if (ERROR_SUCCESS != hres) + if (ERROR_SUCCESS == hres) + { + RegCloseKey(hkey); + /* Skip Keyed entries */ continue; - RegCloseKey(hkey); + } } wsprintfW(szKey, szCat2Fmt, szDMORootKey, szNextKey); diff --git a/dlls/mshtml/protocol.c b/dlls/mshtml/protocol.c index 5f197fd1628..c87f42e61f6 100644 --- a/dlls/mshtml/protocol.c +++ b/dlls/mshtml/protocol.c @@ -602,6 +602,7 @@ static HRESULT WINAPI ResProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl, if(!hdll) { WARN("Could not open dll: %s\n", debugstr_w(url_dll)); IInternetProtocolSink_ReportResult(pOIProtSink, HRESULT_FROM_WIN32(GetLastError()), 0, NULL); + mshtml_free(url); return HRESULT_FROM_WIN32(GetLastError()); } diff --git a/dlls/msvcrt/tests/string.c b/dlls/msvcrt/tests/string.c index 66b018a457a..876415c57e7 100644 --- a/dlls/msvcrt/tests/string.c +++ b/dlls/msvcrt/tests/string.c @@ -127,14 +127,6 @@ static void test_codepage(int cp) #else /* RLE-encoded mbctype tables for given codepages */ -static int result_cp_1252_mbctype[] = { 0x0,66, 0x10,26, 0x0,6, 0x20,26, 0x0,8, 0x20,1, - 0x0,6, 0x10,1, 0x0,1, 0x10,1, 0x0,1, 0x10,1, 0x0,11, 0x20,1, 0x0,1, 0x20,1, 0x0,1, - 0x20,1, 0x10,1, 0x0,10, 0x20,1, 0x0,10, 0x20,1, 0x0,4, 0x20,1, 0x0,5, 0x10,23, 0x0,1, - 0x10,7, 0x20,24, 0x0,1, 32,8 }; -static int result_cp_1250_mbctype[] = { 0x0,66, 0x10,26, 0x0,6, 0x20,26, 0x0,15, 0x10,1, - 0x0,1, 0x10,4, 0x0,10, 0x20,1, 0x0,1, 0x20,4, 0x0,3, 0x10,1, 0x0,1, 0x10,1, 0x0,4, - 0x10,1, 0x0,4, 0x10,1, 0x0,3, 0x20,1, 0x0,1, 0x20,1, 0x0,3, 0x20,2, 0x0,1, 0x10,1, - 0x0,1, 0x20,2, 0x10,23, 0x0,1, 0x10,7, 0x20,24, 0x0,1, 0x20,7, 0,1 }; static int result_cp_932_mbctype[] = { 0x0,65, 0x8,1, 0x18,26, 0x8,6, 0x28,26, 0x8,4, 0x0,1, 0x8,1, 0xc,31, 0x8,1, 0xa,5, 0x9,58, 0xc,29, 0,3 }; static int result_cp_936_mbctype[] = { 0x0,65, 0x8,1, 0x18,26, 0x8,6, 0x28,26, 0x8,6, @@ -187,9 +179,24 @@ static void test_mbcp(void) unsigned char buf[16]; int step; - /* some two single-byte code pages*/ - test_codepage(1252); - test_codepage(1250); + /* _mbtype tests */ + + /* An SBCS codepage test. The ctype of characters on e.g. CP1252 or CP1250 differs slightly + * between versions of Windows. Also Windows 9x seems to ignore the codepage and always uses + * CP1252 (or the ACP?) so we test only a few ASCII characters */ + _setmbcp(1252); + expect_eq(_mbctype[10], 0, char, "%x"); + expect_eq(_mbctype[50], 0, char, "%x"); + expect_eq(_mbctype[66], _SBUP, char, "%x"); + expect_eq(_mbctype[100], _SBLOW, char, "%x"); + expect_eq(_mbctype[128], 0, char, "%x"); + _setmbcp(1250); + expect_eq(_mbctype[10], 0, char, "%x"); + expect_eq(_mbctype[50], 0, char, "%x"); + expect_eq(_mbctype[66], _SBUP, char, "%x"); + expect_eq(_mbctype[100], _SBLOW, char, "%x"); + expect_eq(_mbctype[128], 0, char, "%x"); + /* double byte code pages */ test_codepage_todo(932, todo_cp_932); test_codepage(936); diff --git a/dlls/ntdll/serial.c b/dlls/ntdll/serial.c index bd6f9cad39f..be398a57b6d 100644 --- a/dlls/ntdll/serial.c +++ b/dlls/ntdll/serial.c @@ -227,9 +227,9 @@ static NTSTATUS get_hand_flow(int fd, SERIAL_HANDFLOW* shf) #endif shf->ControlHandShake |= SERIAL_RTS_CONTROL; } - if (port.c_iflag & IXON) - shf->FlowReplace |= SERIAL_AUTO_RECEIVE; if (port.c_iflag & IXOFF) + shf->FlowReplace |= SERIAL_AUTO_RECEIVE; + if (port.c_iflag & IXON) shf->FlowReplace |= SERIAL_AUTO_TRANSMIT; shf->XonLimit = 10; @@ -611,13 +611,13 @@ static NTSTATUS set_handflow(int fd, const SERIAL_HANDFLOW* shf) #endif if (shf->FlowReplace & SERIAL_AUTO_RECEIVE) - port.c_iflag |= IXON; - else - port.c_iflag &= ~IXON; - if (shf->FlowReplace & SERIAL_AUTO_TRANSMIT) port.c_iflag |= IXOFF; else port.c_iflag &= ~IXOFF; + if (shf->FlowReplace & SERIAL_AUTO_TRANSMIT) + port.c_iflag |= IXON; + else + port.c_iflag &= ~IXON; if (tcsetattr(fd, TCSANOW, &port) == -1) { ERR("tcsetattr error '%s'\n", strerror(errno)); diff --git a/dlls/oleaut32/typelib16.c b/dlls/oleaut32/typelib16.c index a010f7de03a..31bbf93814b 100644 --- a/dlls/oleaut32/typelib16.c +++ b/dlls/oleaut32/typelib16.c @@ -153,6 +153,9 @@ HRESULT WINAPI LoadTypeLib16( *| OLE 2.1 NT 1993-95 ?? ??? *| OLE 2.3.1 W95 23 700 *| OLE2 4.0 NT4SP6 1993-98 40 4277 + *| OLE 2.1 W2K 2000 10 3029 + *| OLE 2.1 WXP 2002 10 3029 + *| OLE 2.1 Vista 2007 10 3029 */ DWORD WINAPI OaBuildVersion16(void) { @@ -171,6 +174,12 @@ DWORD WINAPI OaBuildVersion16(void) return MAKELONG(3024, 10); /* W98 SE */ case 0x00000004: /* NT4 */ return MAKELONG(4277, 40); /* NT4 SP6 */ + case 0x00000005: /* W2K */ + return MAKELONG(3029, 10); /* W2K SP4 */ + case 0x00000105: /* WXP */ + return MAKELONG(3029, 10); /* WXP SP2 */ + case 0x00000006: /* Vista */ + return MAKELONG(3029, 10); /* Vista */ default: FIXME("Version value not known yet. Please investigate it!\n"); return 0; diff --git a/dlls/oleaut32/variant.c b/dlls/oleaut32/variant.c index 0540e956eb2..c794b243c35 100644 --- a/dlls/oleaut32/variant.c +++ b/dlls/oleaut32/variant.c @@ -5875,7 +5875,10 @@ HRESULT WINAPI VarImp(LPVARIANT left, LPVARIANT right, LPVARIANT result) if (FAILED(hres)) goto VarImp_Exit; if (rightvt == VT_NULL) + { + memset( &rv, 0, sizeof(rv) ); V_VT(&rv) = resvt; + } else { hres = VariantCopy(&rv, right); diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c index 0c259b91311..3dfa28e7baa 100644 --- a/dlls/riched20/tests/editor.c +++ b/dlls/riched20/tests/editor.c @@ -1087,6 +1087,8 @@ static void test_EM_SETTEXTEX(void) getText.codepage = 1200; /* no constant for unicode */ getText.cb = MAX_BUF_LEN; getText.flags = GT_DEFAULT; + getText.lpDefaultChar = NULL; + getText.lpUsedDefaultChar = NULL; setText.flags = 0; SendMessage(hwndRichEdit, EM_SETTEXTEX, (WPARAM)&setText, (LPARAM) TestItem1); @@ -1101,6 +1103,8 @@ static void test_EM_SETTEXTEX(void) getText.codepage = 1200; /* no constant for unicode */ getText.cb = MAX_BUF_LEN; getText.flags = GT_DEFAULT; + getText.lpDefaultChar = NULL; + getText.lpUsedDefaultChar = NULL; setText.flags = 0; SendMessage(hwndRichEdit, EM_SETTEXTEX, (WPARAM)&setText, (LPARAM) TestItem2); SendMessage(hwndRichEdit, EM_GETTEXTEX, (WPARAM)&getText, (LPARAM) buf); @@ -1117,6 +1121,8 @@ static void test_EM_SETTEXTEX(void) getText.codepage = 1200; /* no constant for unicode */ getText.cb = MAX_BUF_LEN; getText.flags = GT_DEFAULT; + getText.lpDefaultChar = NULL; + getText.lpUsedDefaultChar = NULL; setText.flags = 0; SendMessage(hwndRichEdit, EM_SETTEXTEX, (WPARAM)&setText, (LPARAM) TestItem3); SendMessage(hwndRichEdit, EM_GETTEXTEX, (WPARAM)&getText, (LPARAM) buf); @@ -1128,6 +1134,8 @@ static void test_EM_SETTEXTEX(void) getText.codepage = 1200; /* no constant for unicode */ getText.cb = MAX_BUF_LEN; getText.flags = GT_DEFAULT; + getText.lpDefaultChar = NULL; + getText.lpUsedDefaultChar = NULL; setText.flags = 0; SendMessage(hwndRichEdit, EM_SETTEXTEX, (WPARAM)&setText, (LPARAM) TestItem3alt); SendMessage(hwndRichEdit, EM_GETTEXTEX, (WPARAM)&getText, (LPARAM) buf); @@ -1139,6 +1147,8 @@ static void test_EM_SETTEXTEX(void) getText.codepage = 1200; /* no constant for unicode */ getText.cb = MAX_BUF_LEN; getText.flags = GT_DEFAULT; + getText.lpDefaultChar = NULL; + getText.lpUsedDefaultChar = NULL; setText.flags = 0; SendMessage(hwndRichEdit, EM_SETTEXTEX, (WPARAM)&setText, (LPARAM) TestItem4); SendMessage(hwndRichEdit, EM_GETTEXTEX, (WPARAM)&getText, (LPARAM) buf); @@ -1747,6 +1757,8 @@ static void test_EM_REPLACESEL(void) getText.cb = 1024; getText.codepage = CP_ACP; getText.flags = GT_DEFAULT; + getText.lpDefaultChar = NULL; + getText.lpUsedDefaultChar = NULL; SendMessage(hwndRichEdit, EM_GETTEXTEX, (WPARAM)&getText, (LPARAM) buffer); ok(strcmp(buffer, "RichEdit1") == 0, "EM_GETTEXTEX results not what was set by EM_REPLACESEL\n"); @@ -1760,6 +1772,8 @@ static void test_EM_REPLACESEL(void) getText.cb = 1024; getText.codepage = CP_ACP; getText.flags = GT_DEFAULT; + getText.lpDefaultChar = NULL; + getText.lpUsedDefaultChar = NULL; SendMessage(hwndRichEdit, EM_GETTEXTEX, (WPARAM)&getText, (LPARAM) buffer); ok(strcmp(buffer, "RichEdit1\r") == 0, "EM_GETTEXTEX returned incorrect string\n"); @@ -1779,6 +1793,8 @@ static void test_EM_REPLACESEL(void) getText.cb = 1024; getText.codepage = CP_ACP; getText.flags = GT_DEFAULT; + getText.lpDefaultChar = NULL; + getText.lpUsedDefaultChar = NULL; SendMessage(hwndRichEdit, EM_GETTEXTEX, (WPARAM)&getText, (LPARAM) buffer); ok(strcmp(buffer, "RichEdit1\r") == 0, "EM_GETTEXTEX returned incorrect string\n"); @@ -1805,6 +1821,8 @@ static void test_EM_REPLACESEL(void) getText.cb = 1024; getText.codepage = CP_ACP; getText.flags = GT_DEFAULT; + getText.lpDefaultChar = NULL; + getText.lpUsedDefaultChar = NULL; SendMessage(hwndRichEdit, EM_GETTEXTEX, (WPARAM)&getText, (LPARAM) buffer); ok(strcmp(buffer, "\r\r") == 0, "EM_GETTEXTEX returned incorrect string\n"); @@ -1821,6 +1839,8 @@ static void test_EM_REPLACESEL(void) getText.cb = 1024; getText.codepage = CP_ACP; getText.flags = GT_DEFAULT; + getText.lpDefaultChar = NULL; + getText.lpUsedDefaultChar = NULL; SendMessage(hwndRichEdit, EM_GETTEXTEX, (WPARAM)&getText, (LPARAM) buffer); ok(strcmp(buffer, " ") == 0, "EM_GETTEXTEX returned incorrect string\n"); @@ -1837,6 +1857,8 @@ static void test_EM_REPLACESEL(void) getText.cb = 1024; getText.codepage = CP_ACP; getText.flags = GT_DEFAULT; + getText.lpDefaultChar = NULL; + getText.lpUsedDefaultChar = NULL; SendMessage(hwndRichEdit, EM_GETTEXTEX, (WPARAM)&getText, (LPARAM) buffer); ok(strcmp(buffer, "\r\r\r \r\r\r") == 0, "EM_GETTEXTEX returned incorrect string\n"); @@ -1853,6 +1875,8 @@ static void test_EM_REPLACESEL(void) getText.cb = 1024; getText.codepage = CP_ACP; getText.flags = GT_DEFAULT; + getText.lpDefaultChar = NULL; + getText.lpUsedDefaultChar = NULL; SendMessage(hwndRichEdit, EM_GETTEXTEX, (WPARAM)&getText, (LPARAM) buffer); ok(strcmp(buffer, " \r") == 0, "EM_GETTEXTEX returned incorrect string\n"); @@ -1869,6 +1893,8 @@ static void test_EM_REPLACESEL(void) getText.cb = 1024; getText.codepage = CP_ACP; getText.flags = GT_DEFAULT; + getText.lpDefaultChar = NULL; + getText.lpUsedDefaultChar = NULL; SendMessage(hwndRichEdit, EM_GETTEXTEX, (WPARAM)&getText, (LPARAM) buffer); ok(strcmp(buffer, " \r\r") == 0, "EM_GETTEXTEX returned incorrect string\n"); @@ -1885,6 +1911,8 @@ static void test_EM_REPLACESEL(void) getText.cb = 1024; getText.codepage = CP_ACP; getText.flags = GT_DEFAULT; + getText.lpDefaultChar = NULL; + getText.lpUsedDefaultChar = NULL; SendMessage(hwndRichEdit, EM_GETTEXTEX, (WPARAM)&getText, (LPARAM) buffer); ok(strcmp(buffer, "\rX\r\r\r") == 0, "EM_GETTEXTEX returned incorrect string\n"); @@ -1901,6 +1929,8 @@ static void test_EM_REPLACESEL(void) getText.cb = 1024; getText.codepage = CP_ACP; getText.flags = GT_DEFAULT; + getText.lpDefaultChar = NULL; + getText.lpUsedDefaultChar = NULL; SendMessage(hwndRichEdit, EM_GETTEXTEX, (WPARAM)&getText, (LPARAM) buffer); ok(strcmp(buffer, "\r\r") == 0, "EM_GETTEXTEX returned incorrect string\n"); @@ -1917,6 +1947,8 @@ static void test_EM_REPLACESEL(void) getText.cb = 1024; getText.codepage = CP_ACP; getText.flags = GT_DEFAULT; + getText.lpDefaultChar = NULL; + getText.lpUsedDefaultChar = NULL; SendMessage(hwndRichEdit, EM_GETTEXTEX, (WPARAM)&getText, (LPARAM) buffer); ok(strcmp(buffer, "\r\r\r\r\r\r ") == 0, "EM_GETTEXTEX returned incorrect string\n"); diff --git a/dlls/shdocvw/navigate.c b/dlls/shdocvw/navigate.c index ae6104b4331..fce2bb96499 100644 --- a/dlls/shdocvw/navigate.c +++ b/dlls/shdocvw/navigate.c @@ -526,7 +526,9 @@ HRESULT navigate_url(DocHost *This, LPCWSTR url, const VARIANT *Flags, if((Flags && V_VT(Flags) != VT_EMPTY) || (TargetFrameName && V_VT(TargetFrameName) != VT_EMPTY)) - FIXME("Unsupported arguments\n"); + FIXME("Unsupported args (Flags %p:%d; TargetFrameName %p:%d)\n", + Flags, Flags ? V_VT(Flags) : -1, TargetFrameName, + TargetFrameName ? V_VT(TargetFrameName) : -1); if(PostData) { TRACE("PostData vt=%d\n", V_VT(PostData)); diff --git a/dlls/shell32/dialogs.c b/dlls/shell32/dialogs.c index eb5c1a18ba2..76c3d6e9360 100644 --- a/dlls/shell32/dialogs.c +++ b/dlls/shell32/dialogs.c @@ -384,8 +384,7 @@ int WINAPI RestartDialogEx(HWND hWndOwner, LPCWSTR lpwstrReason, DWORD uFlags, D { TRACE("(%p)\n", hWndOwner); - /*FIXME: use uReason */ - + /* FIXME: use lpwstrReason */ if (ConfirmDialog(hWndOwner, IDS_RESTART_PROMPT, IDS_RESTART_TITLE)) { HANDLE hToken; @@ -400,7 +399,7 @@ int WINAPI RestartDialogEx(HWND hWndOwner, LPCWSTR lpwstrReason, DWORD uFlags, D AdjustTokenPrivileges(hToken, FALSE, &npr, 0, 0, 0); CloseHandle(hToken); } - ExitWindowsEx(EWX_REBOOT, 0); + ExitWindowsEx(EWX_REBOOT, uReason); } return 0; diff --git a/dlls/shell32/shfldr.h b/dlls/shell32/shfldr.h index 49502545ba6..56f81ddcd96 100644 --- a/dlls/shell32/shfldr.h +++ b/dlls/shell32/shfldr.h @@ -70,7 +70,7 @@ static inline int SHELL32_GUIDToStringW (REFGUID guid, LPWSTR str) } void SHELL_FS_ProcessDisplayFilename(LPWSTR szPath, DWORD dwFlags); -BOOL SHELL_FS_HideExtension(LPWSTR pwszPath); +BOOL SHELL_FS_HideExtension(LPCWSTR pwszPath); DEFINE_GUID( CLSID_UnixFolder, 0xcc702eb2, 0x7dc5, 0x11d9, 0xc6, 0x87, 0x00, 0x04, 0x23, 0x8a, 0x01, 0xcd ); DEFINE_GUID( CLSID_UnixDosFolder, 0x9d20aae8, 0x0625, 0x44b0, 0x9c, 0xa7, 0x71, 0x88, 0x9c, 0x22, 0x54, 0xd9 ); diff --git a/dlls/shell32/shfldr_fs.c b/dlls/shell32/shfldr_fs.c index 0fa690df1b2..0cc08b545ef 100644 --- a/dlls/shell32/shfldr_fs.c +++ b/dlls/shell32/shfldr_fs.c @@ -712,7 +712,7 @@ static const WCHAR NeverShowExtW[] = { 'N','e','v','e','r','S','h','o','w','E', * TRUE, if the filename's extension should be hidden * FALSE, otherwise. */ -BOOL SHELL_FS_HideExtension(LPWSTR szPath) +BOOL SHELL_FS_HideExtension(LPCWSTR szPath) { HKEY hKey; DWORD dwData; @@ -1170,7 +1170,7 @@ ISFHelper_fnAddFolder (ISFHelper * iface, HWND hwnd, LPCWSTR pwszName, * Builds a list of paths like the one used in SHFileOperation from a table of * PIDLs relative to the given base folder */ -static WCHAR *build_paths_list(LPCWSTR wszBasePath, int cidl, LPCITEMIDLIST *pidls) +static WCHAR *build_paths_list(LPCWSTR wszBasePath, int cidl, const LPCITEMIDLIST *pidls) { WCHAR *wszPathsList; WCHAR *wszListPos; diff --git a/dlls/shlwapi/shlwapi.spec b/dlls/shlwapi/shlwapi.spec index ce44553e395..8f8e8aa00de 100644 --- a/dlls/shlwapi/shlwapi.spec +++ b/dlls/shlwapi/shlwapi.spec @@ -391,7 +391,7 @@ 391 stdcall -noname WNetGetLastErrorWrapW(ptr ptr long ptr long) 392 stdcall -noname EndDialogWrap(ptr ptr) user32.EndDialog 393 stdcall -noname CreateDialogIndirectParamWrapW(long ptr long ptr long) user32.CreateDialogIndirectParamW -394 stdcall -noname SHChangeNotify(long long ptr ptr) +394 stdcall -noname SHChangeNotifyWrap(long long ptr ptr) 395 stub -noname MLWinHelpA 396 stub -noname MLHtmlHelpA 397 stub -noname MLWinHelpW @@ -422,7 +422,7 @@ 422 stdcall -noname SHGlobalCounterCreateNamedA(str long) 423 stdcall -noname SHGlobalCounterCreateNamedW(wstr long) 424 stdcall -noname SHGlobalCounterDecrement(long) -425 stdcall -noname DeleteMenuWrap(ptr long long) user32.DeleteMenuW +425 stdcall -noname DeleteMenuWrap(ptr long long) user32.DeleteMenu 426 stdcall -noname DestroyMenuWrap(long) user32.DestroyMenu 427 stdcall -noname TrackPopupMenuWrap(long long long long long long ptr) user32.TrackPopupMenu 428 stdcall -noname TrackPopupMenuExWrap(long long long long long ptr) user32.TrackPopupMenuEx diff --git a/dlls/shlwapi/tests/url.c b/dlls/shlwapi/tests/url.c index ebce1e502de..6d219c97188 100644 --- a/dlls/shlwapi/tests/url.c +++ b/dlls/shlwapi/tests/url.c @@ -242,7 +242,7 @@ static const struct { /* ################ */ -static const struct { +static struct { char url[30]; const char *expect; } TEST_URL_UNESCAPE[] = { diff --git a/dlls/snmpapi/main.c b/dlls/snmpapi/main.c index 34073c3bcbe..3686ed93a57 100644 --- a/dlls/snmpapi/main.c +++ b/dlls/snmpapi/main.c @@ -431,12 +431,10 @@ INT WINAPI SnmpUtilVarBindListCpy(SnmpVarBindList *dst, SnmpVarBindList *src) dst->len = 0; return SNMPAPI_NOERROR; } - size = src->len * sizeof(SnmpVarBind *); + size = src->len * sizeof(SnmpVarBind); if (!(dst->list = HeapAlloc(GetProcessHeap(), 0, size))) - { - HeapFree(GetProcessHeap(), 0, dst); return SNMPAPI_ERROR; - } + src_entry = src->list; dst_entry = dst->list; for (i = 0; i < src->len; i++) diff --git a/dlls/urlmon/tests/url.c b/dlls/urlmon/tests/url.c index 417861f31d1..cd8432d670d 100644 --- a/dlls/urlmon/tests/url.c +++ b/dlls/urlmon/tests/url.c @@ -29,6 +29,7 @@ #include "winbase.h" #include "urlmon.h" #include "wininet.h" +#include "mshtml.h" #include "wine/test.h" @@ -89,8 +90,12 @@ DEFINE_EXPECT(OnProgress_MIMETYPEAVAILABLE); DEFINE_EXPECT(OnProgress_BEGINDOWNLOADDATA); DEFINE_EXPECT(OnProgress_DOWNLOADINGDATA); DEFINE_EXPECT(OnProgress_ENDDOWNLOADDATA); +DEFINE_EXPECT(OnProgress_CLASSIDAVAILABLE); +DEFINE_EXPECT(OnProgress_BEGINSYNCOPERATION); +DEFINE_EXPECT(OnProgress_ENDSYNCOPERATION); DEFINE_EXPECT(OnStopBinding); DEFINE_EXPECT(OnDataAvailable); +DEFINE_EXPECT(OnObjectAvailable); DEFINE_EXPECT(Start); DEFINE_EXPECT(Read); DEFINE_EXPECT(LockRequest); @@ -989,6 +994,28 @@ static HRESULT WINAPI statusclb_OnProgress(IBindStatusCallback *iface, ULONG ulP if(szStatusText && test_protocol == FILE_TEST) ok(!lstrcmpW(INDEX_HTML+7, szStatusText), "wrong szStatusText\n"); break; + case BINDSTATUS_CLASSIDAVAILABLE: + { + CLSID clsid; + HRESULT hr; + CHECK_EXPECT(OnProgress_CLASSIDAVAILABLE); + hr = CLSIDFromString((LPOLESTR)szStatusText, &clsid); + ok(hr == S_OK, "CLSIDFromString failed with error 0x%08x\n", hr); + ok(IsEqualCLSID(&clsid, &CLSID_HTMLDocument), + "Expected clsid to be CLSID_HTMLDocument instead of {%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n", + clsid.Data1, clsid.Data2, clsid.Data3, + clsid.Data4[0], clsid.Data4[1], clsid.Data4[2], clsid.Data4[3], + clsid.Data4[4], clsid.Data4[5], clsid.Data4[6], clsid.Data4[7]); + break; + } + case BINDSTATUS_BEGINSYNCOPERATION: + CHECK_EXPECT(OnProgress_BEGINSYNCOPERATION); + ok(szStatusText == NULL, "Expected szStatusText to be NULL\n"); + break; + case BINDSTATUS_ENDSYNCOPERATION: + CHECK_EXPECT(OnProgress_ENDSYNCOPERATION); + ok(szStatusText == NULL, "Expected szStatusText to be NULL\n"); + break; default: ok(0, "unexpexted code %d\n", ulStatusCode); }; @@ -1103,8 +1130,8 @@ static HRESULT WINAPI statusclb_OnDataAvailable(IBindStatusCallback *iface, DWOR static HRESULT WINAPI statusclb_OnObjectAvailable(IBindStatusCallback *iface, REFIID riid, IUnknown *punk) { - ok(0, "unexpected call\n"); - return E_NOTIMPL; + CHECK_EXPECT(OnObjectAvailable); + return S_OK; } static const IBindStatusCallbackVtbl BindStatusCallbackVtbl = { @@ -1572,6 +1599,160 @@ static void test_BindToStorage(int protocol, BOOL emul) http_is_first = FALSE; } +static void test_BindToObject(int protocol, BOOL emul) +{ + IMoniker *mon; + HRESULT hres; + LPOLESTR display_name; + IBindCtx *bctx; + MSG msg; + IBindStatusCallback *previousclb; + IUnknown *unk = (IUnknown*)0x00ff00ff; + IBinding *bind; + + test_protocol = protocol; + emulate_protocol = emul; + download_state = BEFORE_DOWNLOAD; + stopped_binding = FALSE; + data_available = FALSE; + mime_type[0] = 0; + + SET_EXPECT(QueryInterface_IServiceProvider); + hres = CreateAsyncBindCtx(0, &bsc, NULL, &bctx); + ok(SUCCEEDED(hres), "CreateAsyncBindCtx failed: %08x\n\n", hres); + if(FAILED(hres)) + return; + CHECK_CALLED(QueryInterface_IServiceProvider); + + SET_EXPECT(QueryInterface_IServiceProvider); + hres = RegisterBindStatusCallback(bctx, &bsc, &previousclb, 0); + ok(SUCCEEDED(hres), "RegisterBindStatusCallback failed: %08x\n", hres); + ok(previousclb == &bsc, "previousclb(%p) != sclb(%p)\n", previousclb, &bsc); + CHECK_CALLED(QueryInterface_IServiceProvider); + if(previousclb) + IBindStatusCallback_Release(previousclb); + + hres = CreateURLMoniker(NULL, urls[test_protocol], &mon); + ok(SUCCEEDED(hres), "failed to create moniker: %08x\n", hres); + if(FAILED(hres)) { + IBindCtx_Release(bctx); + return; + } + + if(test_protocol == FILE_TEST && INDEX_HTML[7] == '/') + memmove(INDEX_HTML+7, INDEX_HTML+8, lstrlenW(INDEX_HTML+7)*sizeof(WCHAR)); + + hres = IMoniker_QueryInterface(mon, &IID_IBinding, (void**)&bind); + ok(hres == E_NOINTERFACE, "IMoniker should not have IBinding interface\n"); + if(SUCCEEDED(hres)) + IBinding_Release(bind); + + hres = IMoniker_GetDisplayName(mon, bctx, NULL, &display_name); + ok(hres == S_OK, "GetDisplayName failed %08x\n", hres); + ok(!lstrcmpW(display_name, urls[test_protocol]), "GetDisplayName got wrong name\n"); + + SET_EXPECT(QueryInterface_IServiceProvider); + SET_EXPECT(GetBindInfo); + SET_EXPECT(OnStartBinding); + if(emulate_protocol) { + SET_EXPECT(Start); + SET_EXPECT(UnlockRequest); + }else { + if(test_protocol == HTTP_TEST) { + SET_EXPECT(QueryInterface_IHttpNegotiate); + SET_EXPECT(BeginningTransaction); + SET_EXPECT(QueryInterface_IHttpNegotiate2); + SET_EXPECT(GetRootSecurityId); + SET_EXPECT(OnProgress_FINDINGRESOURCE); + SET_EXPECT(OnProgress_CONNECTING); + } + if(test_protocol == HTTP_TEST || test_protocol == FILE_TEST) + SET_EXPECT(OnProgress_SENDINGREQUEST); + if(test_protocol == HTTP_TEST) + SET_EXPECT(OnResponse); + SET_EXPECT(OnProgress_MIMETYPEAVAILABLE); + SET_EXPECT(OnProgress_BEGINDOWNLOADDATA); + if(test_protocol == HTTP_TEST) + SET_EXPECT(OnProgress_DOWNLOADINGDATA); + SET_EXPECT(OnProgress_ENDDOWNLOADDATA); + SET_EXPECT(OnProgress_CLASSIDAVAILABLE); + SET_EXPECT(OnProgress_BEGINSYNCOPERATION); + SET_EXPECT(OnProgress_ENDSYNCOPERATION); + SET_EXPECT(OnObjectAvailable); + SET_EXPECT(OnStopBinding); + } + + hres = IMoniker_BindToObject(mon, bctx, NULL, &IID_IUnknown, (void**)&unk); + if (test_protocol == HTTP_TEST && hres == HRESULT_FROM_WIN32(ERROR_INTERNET_NAME_NOT_RESOLVED)) + { + trace( "Network unreachable, skipping tests\n" ); + return; + } + todo_wine ok(SUCCEEDED(hres), "IMoniker_BindToObject failed with error 0x%08x\n", hres); + /* no point testing the calls if binding didn't even work */ + if (!SUCCEEDED(hres)) return; + + if((bindf & BINDF_ASYNCHRONOUS) && !data_available) { + ok(hres == MK_S_ASYNCHRONOUS, "IMoniker_BindToStorage failed: %08x\n", hres); + ok(unk == NULL, "istr should be NULL\n"); + }else { + ok(hres == S_OK, "IMoniker_BindToStorage failed: %08x\n", hres); + ok(unk != NULL, "unk == NULL\n"); + } + if(unk) + IUnknown_Release(unk); + + while((bindf & BINDF_ASYNCHRONOUS) && + !stopped_binding && GetMessage(&msg,NULL,0,0)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + + todo_wine CHECK_NOT_CALLED(QueryInterface_IServiceProvider); + CHECK_CALLED(GetBindInfo); + CHECK_CALLED(OnStartBinding); + if(emulate_protocol) { + CHECK_CALLED(Start); + CHECK_CALLED(UnlockRequest); + }else { + if(test_protocol == HTTP_TEST) { + CHECK_CALLED(QueryInterface_IHttpNegotiate); + CHECK_CALLED(BeginningTransaction); + /* QueryInterface_IHttpNegotiate2 and GetRootSecurityId + * called on WinXP but not on Win98 */ + CLEAR_CALLED(QueryInterface_IHttpNegotiate2); + CLEAR_CALLED(GetRootSecurityId); + if(http_is_first) { + CHECK_CALLED(OnProgress_FINDINGRESOURCE); + CHECK_CALLED(OnProgress_CONNECTING); + }else todo_wine { + CHECK_NOT_CALLED(OnProgress_FINDINGRESOURCE); + CHECK_NOT_CALLED(OnProgress_CONNECTING); + } + } + if(test_protocol == HTTP_TEST || test_protocol == FILE_TEST) + CHECK_CALLED(OnProgress_SENDINGREQUEST); + if(test_protocol == HTTP_TEST) + CHECK_CALLED(OnResponse); + CHECK_CALLED(OnProgress_MIMETYPEAVAILABLE); + CHECK_CALLED(OnProgress_BEGINDOWNLOADDATA); + if(test_protocol == HTTP_TEST) + CLEAR_CALLED(OnProgress_DOWNLOADINGDATA); + CHECK_CALLED(OnProgress_ENDDOWNLOADDATA); + CHECK_CALLED(OnProgress_CLASSIDAVAILABLE); + CHECK_CALLED(OnProgress_BEGINSYNCOPERATION); + CHECK_CALLED(OnProgress_ENDSYNCOPERATION); + CHECK_CALLED(OnObjectAvailable); + CHECK_CALLED(OnStopBinding); + } + + ok(IMoniker_Release(mon) == 0, "mon should be destroyed here\n"); + ok(IBindCtx_Release(bctx) == 0, "bctx should be destroyed here\n"); + + if(test_protocol == HTTP_TEST) + http_is_first = FALSE; +} + static void set_file_url(void) { int len; @@ -1639,31 +1820,40 @@ START_TEST(url) test_CreateAsyncBindCtxEx(); test_RegisterBindStatusCallback(); + trace("synchronous http test (COM not initialised)...\n"); + test_BindToStorage(HTTP_TEST, FALSE); + test_BindToStorage_fail(); + + CoInitialize(NULL); + trace("synchronous http test...\n"); test_BindToStorage(HTTP_TEST, FALSE); + test_BindToObject(HTTP_TEST, FALSE); trace("synchronous file test...\n"); create_file(); test_BindToStorage(FILE_TEST, FALSE); + test_BindToObject(FILE_TEST, FALSE); DeleteFileW(wszIndexHtml); bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA; trace("http test...\n"); test_BindToStorage(HTTP_TEST, FALSE); + test_BindToObject(HTTP_TEST, FALSE); trace("http test (short response)...\n"); http_is_first = TRUE; urls[HTTP_TEST] = SHORT_RESPONSE_URL; test_BindToStorage(HTTP_TEST, FALSE); + test_BindToObject(HTTP_TEST, FALSE); trace("emulated http test...\n"); test_BindToStorage(HTTP_TEST, TRUE); trace("about test...\n"); - CoInitialize(NULL); test_BindToStorage(ABOUT_TEST, FALSE); - CoUninitialize(); + test_BindToObject(ABOUT_TEST, FALSE); trace("emulated about test...\n"); test_BindToStorage(ABOUT_TEST, TRUE); @@ -1671,6 +1861,7 @@ START_TEST(url) trace("file test...\n"); create_file(); test_BindToStorage(FILE_TEST, FALSE); + test_BindToObject(FILE_TEST, FALSE); DeleteFileW(wszIndexHtml); trace("emulated file test...\n"); @@ -1687,4 +1878,5 @@ START_TEST(url) CloseHandle(complete_event); CloseHandle(complete_event2); + CoUninitialize(); } diff --git a/dlls/winealsa.drv/alsa.c b/dlls/winealsa.drv/alsa.c index b1945b292d2..50992af0545 100644 --- a/dlls/winealsa.drv/alsa.c +++ b/dlls/winealsa.drv/alsa.c @@ -645,11 +645,13 @@ void ALSA_TraceParameters(snd_pcm_hw_params_t * hw_params, snd_pcm_sw_params_t * else { snd_pcm_access_mask_t * acmask; - snd_pcm_access_mask_alloca(&acmask); + + acmask = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, snd_pcm_access_mask_sizeof()); snd_pcm_hw_params_get_access_mask(hw_params, acmask); for ( access = SND_PCM_ACCESS_MMAP_INTERLEAVED; access <= SND_PCM_ACCESS_LAST; access++) if (snd_pcm_access_mask_test(acmask, access)) TRACE("access=%s\n", snd_pcm_access_name(access)); + HeapFree( GetProcessHeap(), 0, acmask ); } if (format >= 0) @@ -661,11 +663,12 @@ void ALSA_TraceParameters(snd_pcm_hw_params_t * hw_params, snd_pcm_sw_params_t * { snd_pcm_format_mask_t * fmask; - snd_pcm_format_mask_alloca(&fmask); + fmask = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, snd_pcm_format_mask_sizeof()); snd_pcm_hw_params_get_format_mask(hw_params, fmask); for ( format = SND_PCM_FORMAT_S8; format <= SND_PCM_FORMAT_LAST ; format++) if ( snd_pcm_format_mask_test(fmask, format) ) TRACE("format=%s\n", snd_pcm_format_name(format)); + HeapFree( GetProcessHeap(), 0, fmask ); } do { diff --git a/dlls/winealsa.drv/midi.c b/dlls/winealsa.drv/midi.c index 26e1623221a..02657f54ae0 100644 --- a/dlls/winealsa.drv/midi.c +++ b/dlls/winealsa.drv/midi.c @@ -1249,9 +1249,8 @@ LONG ALSA_MidiInit(void) #if 0 /* Debug purpose */ snd_lib_error_set_handler(error_handler); #endif - - snd_seq_client_info_alloca(&cinfo); - snd_seq_port_info_alloca(&pinfo); + cinfo = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, snd_seq_client_info_sizeof() ); + pinfo = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, snd_seq_port_info_sizeof() ); /* First, search for all internal midi devices */ snd_seq_client_info_set_client(cinfo, -1); @@ -1281,6 +1280,8 @@ LONG ALSA_MidiInit(void) /* close file and exit */ midiCloseSeq(); + HeapFree( GetProcessHeap(), 0, cinfo ); + HeapFree( GetProcessHeap(), 0, pinfo ); TRACE("End\n"); #endif diff --git a/dlls/winealsa.drv/mixer.c b/dlls/winealsa.drv/mixer.c index daa45a1f85e..42ccd50e780 100644 --- a/dlls/winealsa.drv/mixer.c +++ b/dlls/winealsa.drv/mixer.c @@ -405,7 +405,9 @@ static void filllines(mixer *mmixer, snd_mixer_elem_t *mastelem, snd_mixer_elem_ static void ALSA_MixerInit(void) { int x, mixnum = 0; + snd_ctl_card_info_t *info; + info = HeapAlloc( GetProcessHeap(), 0, snd_ctl_card_info_sizeof()); for (x = 0; x < MAX_MIXERS; ++x) { int card, err, capcontrols = 0; @@ -413,9 +415,8 @@ static void ALSA_MixerInit(void) snd_ctl_t *ctl; snd_mixer_elem_t *elem, *mastelem = NULL, *headelem = NULL, *captelem = NULL, *pcmelem = NULL; - snd_ctl_card_info_t *info = NULL; - snd_ctl_card_info_alloca(&info); + memset(info, 0, snd_ctl_card_info_sizeof()); memset(&mixdev[mixnum], 0, sizeof(*mixdev)); snprintf(cardind, sizeof(cardind), "%d", x); card = snd_card_get_index(cardind); @@ -553,6 +554,7 @@ static void ALSA_MixerInit(void) snd_mixer_close(mixdev[mixnum].mix); } cards = mixnum; + HeapFree( GetProcessHeap(), 0, info ); /* There is no trouble with already assigning callbacks without initialising critsect: * Callbacks only occur when snd_mixer_handle_events is called (only happens in thread) diff --git a/dlls/winealsa.drv/wavein.c b/dlls/winealsa.drv/wavein.c index d2a5bc8c2b8..b221c0cbbaa 100644 --- a/dlls/winealsa.drv/wavein.c +++ b/dlls/winealsa.drv/wavein.c @@ -415,9 +415,7 @@ static DWORD widOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags) snd_pcm_t * pcm; int err; int dir; - - snd_pcm_hw_params_alloca(&hw_params); - snd_pcm_sw_params_alloca(&sw_params); + DWORD ret; /* JPW TODO - review this code */ TRACE("(%u, %p, %08X);\n", wDevID, lpDesc, dwFlags); @@ -474,6 +472,9 @@ static DWORD widOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags) wwi->format.Format.nChannels; } + hw_params = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, snd_pcm_hw_params_sizeof() ); + sw_params = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, snd_pcm_sw_params_sizeof() ); + snd_pcm_hw_params_any(pcm, hw_params); #define EXIT_ON_ERROR(f,e,txt) do \ @@ -482,8 +483,8 @@ static DWORD widOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags) if ( (err = (f) ) < 0) \ { \ WARN(txt ": %s\n", snd_strerror(err)); \ - snd_pcm_close(pcm); \ - return e; \ + ret = (e); \ + goto error; \ } \ } while(0) @@ -511,20 +512,20 @@ static DWORD widOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags) format = (wwi->format.Format.wBitsPerSample == 32) ? SND_PCM_FORMAT_FLOAT_LE : -1; } else if (wwi->format.Format.wFormatTag == WAVE_FORMAT_MULAW) { FIXME("unimplemented format: WAVE_FORMAT_MULAW\n"); - snd_pcm_close(pcm); - return WAVERR_BADFORMAT; + ret = WAVERR_BADFORMAT; + goto error; } else if (wwi->format.Format.wFormatTag == WAVE_FORMAT_ALAW) { FIXME("unimplemented format: WAVE_FORMAT_ALAW\n"); - snd_pcm_close(pcm); - return WAVERR_BADFORMAT; + ret = WAVERR_BADFORMAT; + goto error; } else if (wwi->format.Format.wFormatTag == WAVE_FORMAT_ADPCM) { FIXME("unimplemented format: WAVE_FORMAT_ADPCM\n"); - snd_pcm_close(pcm); - return WAVERR_BADFORMAT; + ret = WAVERR_BADFORMAT; + goto error; } else { ERR("invalid format: %0x04x\n", wwi->format.Format.wFormatTag); - snd_pcm_close(pcm); - return WAVERR_BADFORMAT; + ret = WAVERR_BADFORMAT; + goto error; } EXIT_ON_ERROR( snd_pcm_hw_params_set_format(pcm, hw_params, format), WAVERR_BADFORMAT, "unable to set required format"); @@ -534,13 +535,13 @@ static DWORD widOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags) err = snd_pcm_hw_params_set_rate_near(pcm, hw_params, &rate, &dir); if (err < 0) { WARN("Rate %d Hz not available for playback: %s\n", wwi->format.Format.nSamplesPerSec, snd_strerror(rate)); - snd_pcm_close(pcm); - return WAVERR_BADFORMAT; + ret = WAVERR_BADFORMAT; + goto error; } if (!ALSA_NearMatch(rate, wwi->format.Format.nSamplesPerSec)) { WARN("Rate doesn't match (requested %d Hz, got %d Hz)\n", wwi->format.Format.nSamplesPerSec, rate); - snd_pcm_close(pcm); - return WAVERR_BADFORMAT; + ret = WAVERR_BADFORMAT; + goto error; } dir=0; @@ -598,7 +599,15 @@ static DWORD widOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags) CloseHandle(wwi->hStartUpEvent); wwi->hStartUpEvent = INVALID_HANDLE_VALUE; + HeapFree( GetProcessHeap(), 0, hw_params ); + HeapFree( GetProcessHeap(), 0, sw_params ); return widNotifyClient(wwi, WIM_OPEN, 0L, 0L); + +error: + snd_pcm_close(pcm); + HeapFree( GetProcessHeap(), 0, hw_params ); + HeapFree( GetProcessHeap(), 0, sw_params ); + return ret; } diff --git a/dlls/winealsa.drv/waveinit.c b/dlls/winealsa.drv/waveinit.c index 86143b6ff9d..3e16c18cd02 100644 --- a/dlls/winealsa.drv/waveinit.c +++ b/dlls/winealsa.drv/waveinit.c @@ -81,6 +81,8 @@ static int ALSA_TestDeviceForWine(int card, int device, snd_pcm_stream_t stream const char *reason = NULL; unsigned int rrate; + hwparams = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, snd_pcm_hw_params_sizeof() ); + /* Note that the plug: device masks out a lot of info, we want to avoid that */ sprintf(pcmname, "hw:%d,%d", card, device); retcode = snd_pcm_open(&pcm, pcmname, streamtype, SND_PCM_NONBLOCK); @@ -92,8 +94,6 @@ static int ALSA_TestDeviceForWine(int card, int device, snd_pcm_stream_t stream goto exit; } - snd_pcm_hw_params_alloca(&hwparams); - retcode = snd_pcm_hw_params_any(pcm, hwparams); if (retcode < 0) { @@ -136,6 +136,7 @@ static int ALSA_TestDeviceForWine(int card, int device, snd_pcm_stream_t stream exit: if (pcm) snd_pcm_close(pcm); + HeapFree( GetProcessHeap(), 0, hwparams ); if (retcode != 0 && retcode != (-1 * ENOENT)) TRACE("Discarding card %d/device %d: %s [%d(%s)]\n", card, device, reason, retcode, snd_strerror(retcode)); @@ -252,21 +253,22 @@ static int ALSA_ComputeCaps(snd_ctl_t *ctl, snd_pcm_t *pcm, unsigned int ratemax = 0; unsigned int chmin = 0; unsigned int chmax = 0; - int dir = 0; + int rc, dir = 0; + + hw_params = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, snd_pcm_hw_params_sizeof() ); + fmask = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, snd_pcm_format_mask_sizeof() ); + acmask = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, snd_pcm_access_mask_sizeof() ); - snd_pcm_hw_params_alloca(&hw_params); - ALSA_RETURN_ONFAIL(snd_pcm_hw_params_any(pcm, hw_params)); + if ((rc = snd_pcm_hw_params_any(pcm, hw_params)) < 0) goto done; - snd_pcm_format_mask_alloca(&fmask); snd_pcm_hw_params_get_format_mask(hw_params, fmask); - snd_pcm_access_mask_alloca(&acmask); - ALSA_RETURN_ONFAIL(snd_pcm_hw_params_get_access_mask(hw_params, acmask)); + if ((rc = snd_pcm_hw_params_get_access_mask(hw_params, acmask)) < 0) goto done; - ALSA_RETURN_ONFAIL(snd_pcm_hw_params_get_rate_min(hw_params, &ratemin, &dir)); - ALSA_RETURN_ONFAIL(snd_pcm_hw_params_get_rate_max(hw_params, &ratemax, &dir)); - ALSA_RETURN_ONFAIL(snd_pcm_hw_params_get_channels_min(hw_params, &chmin)); - ALSA_RETURN_ONFAIL(snd_pcm_hw_params_get_channels_max(hw_params, &chmax)); + if ((rc = snd_pcm_hw_params_get_rate_min(hw_params, &ratemin, &dir)) < 0) goto done; + if ((rc = snd_pcm_hw_params_get_rate_max(hw_params, &ratemax, &dir)) < 0) goto done; + if ((rc = snd_pcm_hw_params_get_channels_min(hw_params, &chmin)) < 0) goto done; + if ((rc = snd_pcm_hw_params_get_channels_max(hw_params, &chmax)) < 0) goto done; #define X(r,v) \ if ( (r) >= ratemin && ( (r) <= ratemax || ratemax == -1) ) \ @@ -357,7 +359,14 @@ static int ALSA_ComputeCaps(snd_ctl_t *ctl, snd_pcm_t *pcm, WAVE_FORMAT_48S16 | WAVE_FORMAT_96S16) ) *flags |= DSCAPS_PRIMARY16BIT; - return(0); + rc = 0; + +done: + if (rc < 0) ERR("failed: %s(%d)\n", snd_strerror(rc), rc); + HeapFree( GetProcessHeap(), 0, hw_params ); + HeapFree( GetProcessHeap(), 0, fmask ); + HeapFree( GetProcessHeap(), 0, acmask ); + return rc; } /*---------------------------------------------------------------------------- @@ -375,14 +384,22 @@ static int ALSA_ComputeCaps(snd_ctl_t *ctl, snd_pcm_t *pcm, static int ALSA_AddCommonDevice(snd_ctl_t *ctl, snd_pcm_t *pcm, const char *pcmname, WINE_WAVEDEV *ww) { snd_pcm_info_t *infop; + int rc; - snd_pcm_info_alloca(&infop); - ALSA_RETURN_ONFAIL(snd_pcm_info(pcm, infop)); + infop = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, snd_pcm_info_sizeof() ); + if ((rc = snd_pcm_info(pcm, infop)) < 0) + { + HeapFree( GetProcessHeap(), 0, infop ); + return rc; + } if (pcm && pcmname) ww->pcmname = ALSA_strdup(pcmname); else + { + HeapFree( GetProcessHeap(), 0, infop ); return -1; + } if (ctl && snd_ctl_name(ctl)) ww->ctlname = ALSA_strdup(snd_ctl_name(ctl)); @@ -401,6 +418,7 @@ static int ALSA_AddCommonDevice(snd_ctl_t *ctl, snd_pcm_t *pcm, const char *pcmn ww->ds_caps.dwMaxSecondarySampleRate = DSBFREQUENCY_MAX; ww->ds_caps.dwPrimaryBuffers = 1; + HeapFree( GetProcessHeap(), 0, infop ); return 0; } diff --git a/dlls/winealsa.drv/waveout.c b/dlls/winealsa.drv/waveout.c index 2cbcd104fed..516aa3fb08b 100644 --- a/dlls/winealsa.drv/waveout.c +++ b/dlls/winealsa.drv/waveout.c @@ -579,8 +579,6 @@ static DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags) int dir=0; DWORD retcode = 0; - snd_pcm_sw_params_alloca(&sw_params); - TRACE("(%u, %p, %08X);\n", wDevID, lpDesc, dwFlags); if (lpDesc == NULL) { WARN("Invalid Parameter !\n"); @@ -670,6 +668,7 @@ static DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags) } \ } while(0) + sw_params = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, snd_pcm_sw_params_sizeof() ); snd_pcm_hw_params_malloc(&hw_params); if (! hw_params) { @@ -801,6 +800,7 @@ static DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags) wwo->format.Format.nSamplesPerSec, wwo->format.Format.nChannels, wwo->format.Format.nBlockAlign); + HeapFree( GetProcessHeap(), 0, sw_params ); wwo->pcm = pcm; wwo->hctl = hctl; if ( wwo->hw_params ) @@ -822,6 +822,7 @@ errexit: if ( hw_params ) snd_pcm_hw_params_free(hw_params); + HeapFree( GetProcessHeap(), 0, sw_params ); if (wwo->msgRing.ring_buffer_size > 0) ALSA_DestroyRingMessage(&wwo->msgRing); diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index ca1f44ee224..ce14eef0ef7 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -335,7 +335,13 @@ static void select_shader_mode( if (wined3d_settings.vs_mode == VS_NONE) { *vs_selected = SHADER_NONE; } else if (gl_info->supported[ARB_VERTEX_SHADER] && wined3d_settings.glslRequested) { - *vs_selected = SHADER_GLSL; + /* Geforce4 cards support GLSL but for vertex shaders only. Further its reported GLSL caps are + * wrong. This combined with the fact that glsl won't offer more features or performance, use ARB + * shaders only on this card. */ + if(gl_info->vs_nv_version < VS_VERSION_20) + *vs_selected = SHADER_ARB; + else + *vs_selected = SHADER_GLSL; } else if (gl_info->supported[ARB_VERTEX_PROGRAM]) { *vs_selected = SHADER_ARB; } else { @@ -723,24 +729,24 @@ BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info) { GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, &gl_max)); gl_info->ps_arb_constantsF = gl_max; TRACE_(d3d_caps)("Max ARB_FRAGMENT_PROGRAM float constants: %d\n", gl_info->ps_arb_constantsF); - GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_TEMPORARIES_ARB, &gl_max)); + GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB, &gl_max)); gl_info->ps_arb_max_temps = gl_max; - TRACE_(d3d_caps)("Max ARB_FRAGMENT_PROGRAM temporaries: %d\n", gl_info->ps_arb_max_temps); - GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_INSTRUCTIONS_ARB, &gl_max)); + TRACE_(d3d_caps)("Max ARB_FRAGMENT_PROGRAM native temporaries: %d\n", gl_info->ps_arb_max_temps); + GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB, &gl_max)); gl_info->ps_arb_max_instructions = gl_max; - TRACE_(d3d_caps)("Max ARB_FRAGMENT_PROGRAM instructions: %d\n", gl_info->ps_arb_max_instructions); + TRACE_(d3d_caps)("Max ARB_FRAGMENT_PROGRAM native instructions: %d\n", gl_info->ps_arb_max_instructions); } if (gl_info->supported[ARB_VERTEX_PROGRAM]) { gl_info->vs_arb_version = VS_VERSION_11; GL_EXTCALL(glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, &gl_max)); gl_info->vs_arb_constantsF = gl_max; TRACE_(d3d_caps)("Max ARB_VERTEX_PROGRAM float constants: %d\n", gl_info->vs_arb_constantsF); - GL_EXTCALL(glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_TEMPORARIES_ARB, &gl_max)); + GL_EXTCALL(glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB, &gl_max)); gl_info->vs_arb_max_temps = gl_max; - TRACE_(d3d_caps)("Max ARB_VERTEX_PROGRAM temporaries: %d\n", gl_info->vs_arb_max_temps); - GL_EXTCALL(glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_INSTRUCTIONS_ARB, &gl_max)); + TRACE_(d3d_caps)("Max ARB_VERTEX_PROGRAM native temporaries: %d\n", gl_info->vs_arb_max_temps); + GL_EXTCALL(glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB, &gl_max)); gl_info->vs_arb_max_instructions = gl_max; - TRACE_(d3d_caps)("Max ARB_VERTEX_PROGRAM instructions: %d\n", gl_info->vs_arb_max_instructions); + TRACE_(d3d_caps)("Max ARB_VERTEX_PROGRAM native instructions: %d\n", gl_info->vs_arb_max_instructions); } if (gl_info->supported[ARB_VERTEX_SHADER]) { glGetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB, &gl_max); @@ -2367,14 +2373,17 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, if (vs_selected_mode == SHADER_GLSL) { /* Nvidia Geforce6/7 or Ati R4xx/R5xx cards with GLSL support, support VS 3.0 but older Nvidia/Ati - models with GLSL support only support 2.0. In case of nvidia we can detect VS 2.0 support using - vs_nv_version which is based on NV_vertex_program. For Ati cards there's no easy way, so for - now only support 2.0/3.0 detection on Nvidia GeforceFX cards and default to 3.0 for everything else */ - if(GLINFO_LOCATION.vs_nv_version == VS_VERSION_20) + * models with GLSL support only support 2.0. In case of nvidia we can detect VS 2.0 support using + * vs_nv_version which is based on NV_vertex_program. + * For Ati cards there's no way using glsl (it abstracts the lowlevel info away) and also not + * using ARB_vertex_program. It is safe to assume that when a card supports pixel shader 2.0 it + * supports vertex shader 2.0 too and the way around. We can detect ps2.0 using the maximum number + * of native instructions, so use that here. For more info see the pixel shader versioning code below. */ + if((GLINFO_LOCATION.vs_nv_version == VS_VERSION_20) || (GLINFO_LOCATION.ps_arb_max_instructions <= 512)) *pCaps->VertexShaderVersion = WINED3DVS_VERSION(2,0); else *pCaps->VertexShaderVersion = WINED3DVS_VERSION(3,0); - TRACE_(d3d_caps)("Hardware vertex shader version 3.0 enabled (GLSL)\n"); + TRACE_(d3d_caps)("Hardware vertex shader version %d.%d enabled (GLSL)\n", (*pCaps->VertexShaderVersion >> 8) & 0xff, *pCaps->VertexShaderVersion & 0xff); } else if (vs_selected_mode == SHADER_ARB) { *pCaps->VertexShaderVersion = WINED3DVS_VERSION(1,1); TRACE_(d3d_caps)("Hardware vertex shader version 1.1 enabled (ARB_PROGRAM)\n"); @@ -2386,9 +2395,18 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, *pCaps->MaxVertexShaderConst = GL_LIMITS(vshader_constantsF); if (ps_selected_mode == SHADER_GLSL) { - /* See the comment about VS2.0/VS3.0 detection as we do the same here but then based on NV_fragment_program - in case of GeforceFX cards. */ - if(GLINFO_LOCATION.ps_nv_version == PS_VERSION_20) + /* Older DX9-class videocards (GeforceFX / Radeon >9500/X*00) only support pixel shader 2.0/2.0a/2.0b. + * In OpenGL the extensions related to GLSL abstract lowlevel GL info away which is needed + * to distinguish between 2.0 and 3.0 (and 2.0a/2.0b). In case of Nvidia we use their fragment + * program extensions. On other hardware including ATI GL_ARB_fragment_program offers the info + * in max native instructions. Intel and others also offer the info in this extension but they + * don't support GLSL (at least on Windows). + * + * PS2.0 requires at least 96 instructions, 2.0a/2.0b go upto 512. Assume that if the number + * of instructions is 512 or less we have to do with ps2.0 hardware. + * NOTE: ps3.0 hardware requires 512 or more instructions but ati and nvidia offer 'enough' (1024 vs 4096) on their most basic ps3.0 hardware. + */ + if((GLINFO_LOCATION.ps_nv_version == PS_VERSION_20) || (GLINFO_LOCATION.ps_arb_max_instructions <= 512)) *pCaps->PixelShaderVersion = WINED3DPS_VERSION(2,0); else *pCaps->PixelShaderVersion = WINED3DPS_VERSION(3,0); @@ -2405,7 +2423,7 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, * offer a way to query this. */ *pCaps->PixelShader1xMaxValue = 8.0; - TRACE_(d3d_caps)("Hardware pixel shader version 3.0 enabled (GLSL)\n"); + TRACE_(d3d_caps)("Hardware pixel shader version %d.%d enabled (GLSL)\n", (*pCaps->PixelShaderVersion >> 8) & 0xff, *pCaps->PixelShaderVersion & 0xff); } else if (ps_selected_mode == SHADER_ARB) { *pCaps->PixelShaderVersion = WINED3DPS_VERSION(1,4); *pCaps->PixelShader1xMaxValue = 8.0; @@ -2756,7 +2774,7 @@ BOOL InitAdapters(void) { else Adapters[0].TextureRam = Adapters[0].gl_info.vidmem; Adapters[0].UsedTextureRam = 0; - TRACE("Emulating %dMB of texture ram\n", Adapters[0].TextureRam); + TRACE("Emulating %dMB of texture ram\n", Adapters[0].TextureRam/(1024*1024)); /* Initialize the Adapter's DeviceName which is required for ChangeDisplaySettings and friends */ DisplayDevice.cb = sizeof(DisplayDevice); diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 4f891c823c0..43cf3a5000a 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -47,8 +47,17 @@ static void surface_download_data(IWineD3DSurfaceImpl *This) { TRACE("(%p) : Calling glGetCompressedTexImageARB level %d, format %#x, type %#x, data %p\n", This, This->glDescription.level, This->glDescription.glFormat, This->glDescription.glType, This->resource.allocatedMemory); - GL_EXTCALL(glGetCompressedTexImageARB(This->glDescription.target, This->glDescription.level, This->resource.allocatedMemory)); - checkGLcall("glGetCompressedTexImageARB()"); + if(This->Flags & SFLAG_PBO) { + GL_EXTCALL(glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, This->pbo)); + checkGLcall("glBindBufferARB"); + GL_EXTCALL(glGetCompressedTexImageARB(This->glDescription.target, This->glDescription.level, NULL)); + checkGLcall("glGetCompressedTexImageARB()"); + GL_EXTCALL(glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, 0)); + checkGLcall("glBindBufferARB"); + } else { + GL_EXTCALL(glGetCompressedTexImageARB(This->glDescription.target, This->glDescription.level, This->resource.allocatedMemory)); + checkGLcall("glGetCompressedTexImageARB()"); + } } } else { void *mem; @@ -624,7 +633,7 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, CONST RECT *rect, v static HRESULT WINAPI IWineD3DSurfaceImpl_LockRect(IWineD3DSurface *iface, WINED3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) { IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface; IWineD3DDeviceImpl *myDevice = This->resource.wineD3DDevice; - IWineD3DSwapChainImpl *swapchain = NULL; + IWineD3DSwapChain *swapchain = NULL; TRACE("(%p) : rect@%p flags(%08x), output lockedRect@%p, memory@%p\n", This, pRect, Flags, pLockedRect, This->resource.allocatedMemory); @@ -734,70 +743,41 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_LockRect(IWineD3DSurface *iface, WINED */ IWineD3DSurface_GetContainer(iface, &IID_IWineD3DSwapChain, (void **)&swapchain); if(swapchain || iface == myDevice->render_targets[0]) { - BOOL srcIsUpsideDown; + RECT *read_rect; - if(wined3d_settings.rendertargetlock_mode == RTL_DISABLE) { - static BOOL warned = FALSE; - if(!warned) { - ERR("The application tries to lock the render target, but render target locking is disabled\n"); - warned = TRUE; - } - if(swapchain) IWineD3DSwapChain_Release((IWineD3DSwapChain *) swapchain); - return WINED3D_OK; - } - - /* Activate the surface. Set it up for blitting now, although not necessarily needed for LockRect. - * Certain graphics drivers seem to dislike some enabled states when reading from opengl, the blitting usage - * should help here. Furthermore unlockrect will need the context set up for blitting. The context manager will find - * context->last_was_blit set on the unlock. - */ - ActivateContext(myDevice, iface, CTXUSAGE_BLIT); - ENTER_GL(); - - /* Select the correct read buffer, and give some debug output. - * There is no need to keep track of the current read buffer or reset it, every part of the code - * that reads sets the read buffer as desired. - */ - if(!swapchain) { - /* Locking the primary render target which is not on a swapchain(=offscreen render target). - * Read from the back buffer - */ - TRACE("Locking offscreen render target\n"); - glReadBuffer(myDevice->offscreenBuffer); - srcIsUpsideDown = TRUE; + if(This->lockedRect.left == 0 && + This->lockedRect.top == 0 && + This->lockedRect.right == This->currentDesc.Width && + This->lockedRect.bottom == This->currentDesc.Height) { + read_rect = NULL; } else { - GLenum buffer = surface_get_gl_buffer(iface, (IWineD3DSwapChain *)swapchain); - TRACE("Locking %#x buffer\n", buffer); - glReadBuffer(buffer); - checkGLcall("glReadBuffer"); - - IWineD3DSwapChain_Release((IWineD3DSwapChain *) swapchain); - srcIsUpsideDown = FALSE; + read_rect = &This->lockedRect; } switch(wined3d_settings.rendertargetlock_mode) { + case RTL_TEXDRAW: + case RTL_TEXTEX: + FIXME("Reading from render target with a texture isn't implemented yet, falling back to framebuffer reading\n"); +#if 0 + /* Disabled for now. LoadLocation prefers the texture over the drawable as the source. So if we copy to the + * texture first, then to sysmem, we'll avoid glReadPixels and use glCopyTexImage and glGetTexImage2D instead. + * This may be faster on some cards + */ + IWineD3DSurface_LoadLocation(iface, SFLAG_INTEXTURE, NULL /* No partial texture copy yet */); +#endif + /* drop through */ + case RTL_AUTO: case RTL_READDRAW: case RTL_READTEX: - read_from_framebuffer(This, &This->lockedRect, This->resource.allocatedMemory, pLockedRect->Pitch, srcIsUpsideDown); + IWineD3DSurface_LoadLocation(iface, SFLAG_INSYSMEM, read_rect); break; - case RTL_TEXDRAW: - case RTL_TEXTEX: - read_from_framebuffer(This, &This->lockedRect, This->resource.allocatedMemory, pLockedRect->Pitch, srcIsUpsideDown); - FIXME("Reading from render target with a texture isn't implemented yet, falling back to framebuffer reading\n"); + case RTL_DISABLE: break; } + if(swapchain) IWineD3DSwapChain_Release(swapchain); - LEAVE_GL(); - - /* Mark the local copy up to date if a full download was done */ - if(This->lockedRect.left == 0 && - This->lockedRect.top == 0 && - This->lockedRect.right == This->currentDesc.Width && - This->lockedRect.bottom == This->currentDesc.Height) { - This->Flags |= SFLAG_INSYSMEM; - } } else if(iface == myDevice->stencilBufferTarget) { /** the depth stencil in openGL has a format of GL_FLOAT * which should be good for WINED3DFMT_D16_LOCKABLE @@ -1101,57 +1081,11 @@ static void flush_to_framebuffer_drawpixels(IWineD3DSurfaceImpl *This) { return; } -static void flush_to_framebuffer_texture(IWineD3DSurfaceImpl *This) { - float glTexCoord[4]; - - glTexCoord[0] = (float) This->lockedRect.left / (float) This->pow2Width; /* left */ - glTexCoord[1] = (float) This->lockedRect.right / (float) This->pow2Width; /* right */ - glTexCoord[2] = (float) This->lockedRect.top / (float) This->pow2Height; /* top */ - glTexCoord[3] = (float) This->lockedRect.bottom / (float) This->pow2Height; /* bottom */ - - IWineD3DSurface_PreLoad((IWineD3DSurface *) This); - - ENTER_GL(); - - glBindTexture(GL_TEXTURE_2D, This->glDescription.textureName); - checkGLcall("glEnable glBindTexture"); - - /* No filtering for blts */ - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - checkGLcall("glTexParameteri"); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - checkGLcall("glTexParameteri"); - - /* Start drawing a quad */ - glBegin(GL_QUADS); - - glColor3d(1.0f, 1.0f, 1.0f); - glTexCoord2f(glTexCoord[0], glTexCoord[2]); - glVertex3f(This->lockedRect.left, This->lockedRect.top, 0.0); - - glTexCoord2f(glTexCoord[0], glTexCoord[3]); - glVertex3f(This->lockedRect.left, This->lockedRect.bottom, 0.0); - - glTexCoord2f(glTexCoord[1], glTexCoord[3]); - glVertex3d(This->lockedRect.right, This->lockedRect.bottom, 0.0); - - glTexCoord2f(glTexCoord[1], glTexCoord[2]); - glVertex3f(This->lockedRect.right, This->lockedRect.top, 0.0); - - glEnd(); - checkGLcall("glEnd"); - - /* Unbind the texture */ - glBindTexture(GL_TEXTURE_2D, 0); - checkGLcall("glEnable glBindTexture"); - - LEAVE_GL(); -} - static HRESULT WINAPI IWineD3DSurfaceImpl_UnlockRect(IWineD3DSurface *iface) { IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface; IWineD3DDeviceImpl *myDevice = This->resource.wineD3DDevice; IWineD3DSwapChainImpl *swapchain = NULL; + BOOL fullsurface; if (!(This->Flags & SFLAG_LOCKED)) { WARN("trying to Unlock an unlocked surf@%p\n", This); @@ -1189,53 +1123,47 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_UnlockRect(IWineD3DSurface *iface) { goto unlock_end; } - /* Activate the correct context for the render target */ - ActivateContext(myDevice, iface, CTXUSAGE_BLIT); - ENTER_GL(); - - if(!swapchain) { - /* Primary offscreen render target */ - TRACE("Offscreen render target\n"); - glDrawBuffer(myDevice->offscreenBuffer); - checkGLcall("glDrawBuffer(myDevice->offscreenBuffer)"); + if(This->dirtyRect.left == 0 && + This->dirtyRect.top == 0 && + This->dirtyRect.right == This->currentDesc.Width && + This->dirtyRect.bottom == This->currentDesc.Height) { + fullsurface = TRUE; } else { - GLenum buffer = surface_get_gl_buffer(iface, (IWineD3DSwapChain *)swapchain); - TRACE("Unlocking %#x buffer\n", buffer); - glDrawBuffer(buffer); - checkGLcall("glDrawBuffer"); - - IWineD3DSwapChain_Release((IWineD3DSwapChain *)swapchain); + /* TODO: Proper partial rectangle tracking */ + fullsurface = FALSE; + This->Flags |= SFLAG_INSYSMEM; } switch(wined3d_settings.rendertargetlock_mode) { + case RTL_READTEX: + case RTL_TEXTEX: + /* drop through */ + FIXME("Render target unlocking using textures temporarily disabled\n"); +#if 0 + IWineD3DSurface_LoadLocation(iface, SFLAG_INTEXTURE, NULL /* partial texture loading not supported yet */); +#endif case RTL_AUTO: case RTL_READDRAW: case RTL_TEXDRAW: - flush_to_framebuffer_drawpixels(This); - break; - - case RTL_READTEX: - case RTL_TEXTEX: - flush_to_framebuffer_texture(This); + IWineD3DSurface_LoadLocation(iface, SFLAG_INDRAWABLE, fullsurface ? NULL : &This->dirtyRect); break; } - if(!swapchain) { - glDrawBuffer(myDevice->offscreenBuffer); - checkGLcall("glDrawBuffer(myDevice->offscreenBuffer)"); - } else if(swapchain->backBuffer) { - glDrawBuffer(GL_BACK); - checkGLcall("glDrawBuffer(GL_BACK)"); - } else { - glDrawBuffer(GL_FRONT); - checkGLcall("glDrawBuffer(GL_FRONT)"); + + if(!fullsurface) { + /* Partial rectangle tracking is not commonly implemented, it is only done for render targets. Overwrite + * the flags to bring them back into a sane state. INSYSMEM was set before to tell LoadLocation where + * to read the rectangle from. Indrawable is set because all modifications from the partial sysmem copy + * are written back to the drawable, thus the surface is merged again in the drawable. The sysmem copy is + * not fully up to date because only a subrectangle was read in LockRect. + */ + This->Flags &= ~SFLAG_INSYSMEM; + This->Flags |= SFLAG_INDRAWABLE; } - LEAVE_GL(); This->dirtyRect.left = This->currentDesc.Width; This->dirtyRect.top = This->currentDesc.Height; This->dirtyRect.right = 0; This->dirtyRect.bottom = 0; - This->Flags |= SFLAG_INDRAWABLE; } else if(iface == myDevice->stencilBufferTarget) { FIXME("Depth Stencil buffer locking is not implemented\n"); } else { @@ -2078,12 +2006,6 @@ static inline void clear_unused_channels(IWineD3DSurfaceImpl *This) { static HRESULT WINAPI IWineD3DSurfaceImpl_LoadTexture(IWineD3DSurface *iface, BOOL srgb_mode) { IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface; - IWineD3DDeviceImpl *device = This->resource.wineD3DDevice; - GLenum format, internal, type; - CONVERT_TYPES convert; - int bpp; - int width, pitch, outpitch; - BYTE *mem; if (!(This->Flags & SFLAG_INTEXTURE)) { TRACE("Reloading because surface is dirty\n"); @@ -2096,137 +2018,32 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_LoadTexture(IWineD3DSurface *iface, BO (This->glCKey.dwColorSpaceLowValue != This->SrcBltCKey.dwColorSpaceLowValue) || (This->glCKey.dwColorSpaceHighValue != This->SrcBltCKey.dwColorSpaceHighValue)))) { TRACE("Reloading because of color keying\n"); + /* To perform the color key conversion we need a sysmem copy of + * the surface. Make sure we have it + */ + IWineD3DSurface_LoadLocation(iface, SFLAG_INSYSMEM, NULL); } else if(palette9_changed(This)) { TRACE("Reloading surface because the d3d8/9 palette was changed\n"); + /* TODO: This is not necessarily needed with hw palettized texture support */ + IWineD3DSurface_LoadLocation(iface, SFLAG_INSYSMEM, NULL); } else { TRACE("surface is already in texture\n"); return WINED3D_OK; } - This->Flags |= SFLAG_INTEXTURE; - /* Resources are placed in system RAM and do not need to be recreated when a device is lost. - * These resources are not bound by device size or format restrictions. Because of this, - * these resources cannot be accessed by the Direct3D device nor set as textures or render targets. - * However, these resources can always be created, locked, and copied. - */ + * These resources are not bound by device size or format restrictions. Because of this, + * these resources cannot be accessed by the Direct3D device nor set as textures or render targets. + * However, these resources can always be created, locked, and copied. + */ if (This->resource.pool == WINED3DPOOL_SCRATCH ) { FIXME("(%p) Operation not supported for scratch textures\n",This); return WINED3DERR_INVALIDCALL; } - d3dfmt_get_conv(This, TRUE /* We need color keying */, TRUE /* We will use textures */, &format, &internal, &type, &convert, &bpp, srgb_mode); - - if (This->Flags & SFLAG_INDRAWABLE) { - if (This->resource.format == WINED3DFMT_P8 || This->resource.format == WINED3DFMT_A8P8 || - This->resource.format == WINED3DFMT_DXT1 || This->resource.format == WINED3DFMT_DXT2 || - This->resource.format == WINED3DFMT_DXT3 || This->resource.format == WINED3DFMT_DXT4 || - This->resource.format == WINED3DFMT_DXT5) - FIXME("Format %d not supported\n", This->resource.format); - else { - GLint prevRead; - - ENTER_GL(); - glGetIntegerv(GL_READ_BUFFER, &prevRead); - vcheckGLcall("glGetIntegerv"); - glReadBuffer(This->resource.wineD3DDevice->offscreenBuffer); - vcheckGLcall("glReadBuffer"); - - if(!(This->Flags & SFLAG_ALLOCATED)) { - surface_allocate_surface(This, internal, This->pow2Width, - This->pow2Height, format, type); - } - - clear_unused_channels(This); - - glCopyTexSubImage2D(This->glDescription.target, - This->glDescription.level, - 0, 0, 0, 0, - This->currentDesc.Width, - This->currentDesc.Height); - checkGLcall("glCopyTexSubImage2D"); - - glReadBuffer(prevRead); - vcheckGLcall("glReadBuffer"); - - LEAVE_GL(); - - TRACE("Updated target %d\n", This->glDescription.target); - } - return WINED3D_OK; - } else - /* The only place where LoadTexture() might get called when isInDraw=1 - * is ActivateContext where lastActiveRenderTarget is preloaded. - */ - if(iface == device->lastActiveRenderTarget && device->isInDraw) - ERR("Reading back render target but SFLAG_INDRAWABLE not set\n"); - - /* Otherwise: System memory copy must be most up to date */ - - if(This->CKeyFlags & WINEDDSD_CKSRCBLT) { - This->Flags |= SFLAG_GLCKEY; - This->glCKey = This->SrcBltCKey; - } - else This->Flags &= ~SFLAG_GLCKEY; - - /* The width is in 'length' not in bytes */ - width = This->currentDesc.Width; - pitch = IWineD3DSurface_GetPitch(iface); - - if((convert != NO_CONVERSION) && This->resource.allocatedMemory) { - int height = This->currentDesc.Height; - - /* Stick to the alignment for the converted surface too, makes it easier to load the surface */ - outpitch = width * bpp; - outpitch = (outpitch + device->surface_alignment - 1) & ~(device->surface_alignment - 1); - - mem = HeapAlloc(GetProcessHeap(), 0, outpitch * height); - if(!mem) { - ERR("Out of memory %d, %d!\n", outpitch, height); - return WINED3DERR_OUTOFVIDEOMEMORY; - } - d3dfmt_convert_surface(This->resource.allocatedMemory, mem, pitch, width, height, outpitch, convert, This); - - This->Flags |= SFLAG_CONVERTED; - } else if( (This->resource.format == WINED3DFMT_P8) && (GL_SUPPORT(EXT_PALETTED_TEXTURE) || GL_SUPPORT(ARB_FRAGMENT_PROGRAM)) ) { - d3dfmt_p8_upload_palette(iface, convert); - This->Flags &= ~SFLAG_CONVERTED; - mem = This->resource.allocatedMemory; - } else { - This->Flags &= ~SFLAG_CONVERTED; - mem = This->resource.allocatedMemory; - } - - /* Make sure the correct pitch is used */ - glPixelStorei(GL_UNPACK_ROW_LENGTH, width); - - if ((This->Flags & SFLAG_NONPOW2) && !(This->Flags & SFLAG_OVERSIZE)) { - TRACE("non power of two support\n"); - if(!(This->Flags & SFLAG_ALLOCATED)) { - surface_allocate_surface(This, internal, This->pow2Width, This->pow2Height, format, type); - } - if (mem || (This->Flags & SFLAG_PBO)) { - surface_upload_data(This, internal, This->currentDesc.Width, This->currentDesc.Height, format, type, mem); - } - } else { - /* When making the realloc conditional, keep in mind that GL_APPLE_client_storage may be in use, and This->resource.allocatedMemory - * changed. So also keep track of memory changes. In this case the texture has to be reallocated - */ - if(!(This->Flags & SFLAG_ALLOCATED)) { - surface_allocate_surface(This, internal, This->glRect.right - This->glRect.left, This->glRect.bottom - This->glRect.top, format, type); - } - if (mem || (This->Flags & SFLAG_PBO)) { - surface_upload_data(This, internal, This->glRect.right - This->glRect.left, This->glRect.bottom - This->glRect.top, format, type, mem); - } - } - - /* Restore the default pitch */ - glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); - - /* Don't delete PBO memory */ - if((mem != This->resource.allocatedMemory) && !(This->Flags & SFLAG_PBO)) - HeapFree(GetProcessHeap(), 0, mem); + This->srgb = srgb_mode; + IWineD3DSurface_LoadLocation(iface, SFLAG_INTEXTURE, NULL /* no partial locking for textures yet */); #if 0 { @@ -3531,9 +3348,39 @@ static void WINAPI IWineD3DSurfaceImpl_ModifyLocation(IWineD3DSurface *iface, DW } } +/***************************************************************************** + * IWineD3DSurface::LoadLocation + * + * Copies the current surface data from wherever it is to the requested + * location. The location is one of the surface flags, SFLAG_INSYSMEM, + * SFLAG_INTEXTURE and SFLAG_INDRAWABLE. When the surface is current in + * multiple locations, the gl texture is prefered over the drawable, which is + * prefered over system memory. The PBO counts as system memory. If rect is + * not NULL, only the specified rectangle is copied(only supported for + * sysmem<->drawable copies at the moment). If rect is NULL, the destination + * location is marked up to date after the copy. + * + * Parameters: + * flag: Surface location flag to be updated + * rect: rectangle to be copied + * + * Returns: + * WINED3D_OK on success + * WINED3DERR_DEVICELOST on an internal error + * + *****************************************************************************/ static HRESULT WINAPI IWineD3DSurfaceImpl_LoadLocation(IWineD3DSurface *iface, DWORD flag, const RECT *rect) { IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface; + IWineD3DDeviceImpl *device = This->resource.wineD3DDevice; IWineD3DDeviceImpl *myDevice; + IWineD3DSwapChainImpl *swapchain; + BOOL srcIsUpsideDown; + RECT local_rect; + GLenum format, internal, type; + CONVERT_TYPES convert; + int bpp; + int width, pitch, outpitch; + BYTE *mem; TRACE("(%p)->(%s, %p)\n", iface, flag == SFLAG_INSYSMEM ? "SFLAG_INSYSMEM" : flag == SFLAG_INDRAWABLE ? "SFLAG_INDRAWABLE" : "SFLAG_INTEXTURE", @@ -3567,7 +3414,9 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_LoadLocation(IWineD3DSurface *iface, D } ENTER_GL(); - /* Make sure that a proper texture unit is selected, bind the texture and dirtify the sampler to restore the texture on the next draw */ + /* Make sure that a proper texture unit is selected, bind the texture + * and dirtify the sampler to restore the texture on the next draw + */ if (GL_SUPPORT(ARB_MULTITEXTURE)) { GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB)); checkGLcall("glActiveTextureARB"); @@ -3578,22 +3427,215 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_LoadLocation(IWineD3DSurface *iface, D surface_download_data(This); LEAVE_GL(); } else { - /* Download drawable to sysmem */ + if(wined3d_settings.rendertargetlock_mode == RTL_DISABLE) { + static BOOL warned = FALSE; + if(!warned) { + ERR("The application tries to lock the render target, but render target locking is disabled\n"); + warned = TRUE; + } + goto load_end; + } + + IWineD3DSurface_GetContainer(iface, &IID_IWineD3DSwapChain, (void **)&swapchain); + /* Activate the surface. Set it up for blitting now, although not necessarily needed for LockRect. + * Certain graphics drivers seem to dislike some enabled states when reading from opengl, the blitting usage + * should help here. Furthermore unlockrect will need the context set up for blitting. The context manager will find + * context->last_was_blit set on the unlock. + */ + ActivateContext(myDevice, iface, CTXUSAGE_BLIT); + ENTER_GL(); + + /* Select the correct read buffer, and give some debug output. + * There is no need to keep track of the current read buffer or reset it, every part of the code + * that reads sets the read buffer as desired. + */ + if(!swapchain) { + /* Locking the primary render target which is not on a swapchain(=offscreen render target). + * Read from the back buffer + */ + TRACE("Locking offscreen render target\n"); + glReadBuffer(myDevice->offscreenBuffer); + srcIsUpsideDown = TRUE; + } else { + GLenum buffer = surface_get_gl_buffer(iface, (IWineD3DSwapChain *)swapchain); + TRACE("Locking %#x buffer\n", buffer); + glReadBuffer(buffer); + checkGLcall("glReadBuffer"); + + IWineD3DSwapChain_Release((IWineD3DSwapChain *) swapchain); + srcIsUpsideDown = FALSE; + } + + /* TODO: Get rid of the extra rectangle comparison and construction of a full surface rectangle */ + if(!rect) { + local_rect.left = 0; + local_rect.top = 0; + local_rect.right = This->currentDesc.Width; + local_rect.bottom = This->currentDesc.Height; + } + /* TODO: Get rid of the extra GetPitch call, LockRect does that too. Cache the pitch */ + read_from_framebuffer(This, rect ? rect : &local_rect, + This->resource.allocatedMemory, + IWineD3DSurface_GetPitch(iface), + srcIsUpsideDown); + LEAVE_GL(); } } else if(flag == SFLAG_INDRAWABLE) { if(This->Flags & SFLAG_INTEXTURE) { /* Blit texture to drawable */ } else { - /* Load drawable from sysmem */ + /* Activate the correct context for the render target */ + ActivateContext(myDevice, iface, CTXUSAGE_BLIT); + ENTER_GL(); + + IWineD3DSurface_GetContainer(iface, &IID_IWineD3DSwapChain, (void **)&swapchain); + if(!swapchain) { + /* Primary offscreen render target */ + TRACE("Offscreen render target\n"); + glDrawBuffer(myDevice->offscreenBuffer); + checkGLcall("glDrawBuffer(myDevice->offscreenBuffer)"); + } else { + GLenum buffer = surface_get_gl_buffer(iface, (IWineD3DSwapChain *)swapchain); + TRACE("Unlocking %#x buffer\n", buffer); + glDrawBuffer(buffer); + checkGLcall("glDrawBuffer"); + + IWineD3DSwapChain_Release((IWineD3DSwapChain *)swapchain); + } + + flush_to_framebuffer_drawpixels(This); + if(!swapchain) { + glDrawBuffer(myDevice->offscreenBuffer); + checkGLcall("glDrawBuffer(myDevice->offscreenBuffer)"); + } else if(swapchain->backBuffer) { + glDrawBuffer(GL_BACK); + checkGLcall("glDrawBuffer(GL_BACK)"); + } else { + glDrawBuffer(GL_FRONT); + checkGLcall("glDrawBuffer(GL_FRONT)"); + } + LEAVE_GL(); } } else /* if(flag == SFLAG_INTEXTURE) */ { - if(This->Flags & SFLAG_INDRAWABLE) { - /* glCopyTexImage the drawable into the texture */ + d3dfmt_get_conv(This, TRUE /* We need color keying */, TRUE /* We will use textures */, &format, &internal, &type, &convert, &bpp, This->srgb); + + if (This->Flags & SFLAG_INDRAWABLE) { + if (This->resource.format == WINED3DFMT_P8 || This->resource.format == WINED3DFMT_A8P8 || + This->resource.format == WINED3DFMT_DXT1 || This->resource.format == WINED3DFMT_DXT2 || + This->resource.format == WINED3DFMT_DXT3 || This->resource.format == WINED3DFMT_DXT4 || + This->resource.format == WINED3DFMT_DXT5) + FIXME("Format %d not supported\n", This->resource.format); + else { + GLint prevRead; + + ENTER_GL(); + glGetIntegerv(GL_READ_BUFFER, &prevRead); + vcheckGLcall("glGetIntegerv"); + glReadBuffer(This->resource.wineD3DDevice->offscreenBuffer); + vcheckGLcall("glReadBuffer"); + + if(!(This->Flags & SFLAG_ALLOCATED)) { + surface_allocate_surface(This, internal, This->pow2Width, + This->pow2Height, format, type); + } + + clear_unused_channels(This); + + glCopyTexSubImage2D(This->glDescription.target, + This->glDescription.level, + 0, 0, 0, 0, + This->currentDesc.Width, + This->currentDesc.Height); + checkGLcall("glCopyTexSubImage2D"); + + glReadBuffer(prevRead); + vcheckGLcall("glReadBuffer"); + + LEAVE_GL(); + + TRACE("Updated target %d\n", This->glDescription.target); + } + return WINED3D_OK; } else { - /* Load the texture from sysmem */ + /* The only place where LoadTexture() might get called when isInDraw=1 + * is ActivateContext where lastActiveRenderTarget is preloaded. + */ + if(iface == device->lastActiveRenderTarget && device->isInDraw) + ERR("Reading back render target but SFLAG_INDRAWABLE not set\n"); + + /* Otherwise: System memory copy must be most up to date */ + + if(This->CKeyFlags & WINEDDSD_CKSRCBLT) { + This->Flags |= SFLAG_GLCKEY; + This->glCKey = This->SrcBltCKey; + } + else This->Flags &= ~SFLAG_GLCKEY; + + /* The width is in 'length' not in bytes */ + width = This->currentDesc.Width; + pitch = IWineD3DSurface_GetPitch(iface); + + if((convert != NO_CONVERSION) && This->resource.allocatedMemory) { + int height = This->currentDesc.Height; + + /* Stick to the alignment for the converted surface too, makes it easier to load the surface */ + outpitch = width * bpp; + outpitch = (outpitch + device->surface_alignment - 1) & ~(device->surface_alignment - 1); + + mem = HeapAlloc(GetProcessHeap(), 0, outpitch * height); + if(!mem) { + ERR("Out of memory %d, %d!\n", outpitch, height); + return WINED3DERR_OUTOFVIDEOMEMORY; + } + d3dfmt_convert_surface(This->resource.allocatedMemory, mem, pitch, width, height, outpitch, convert, This); + + This->Flags |= SFLAG_CONVERTED; + } else if( (This->resource.format == WINED3DFMT_P8) && (GL_SUPPORT(EXT_PALETTED_TEXTURE) || GL_SUPPORT(ARB_FRAGMENT_PROGRAM)) ) { + d3dfmt_p8_upload_palette(iface, convert); + This->Flags &= ~SFLAG_CONVERTED; + mem = This->resource.allocatedMemory; + } else { + This->Flags &= ~SFLAG_CONVERTED; + mem = This->resource.allocatedMemory; + } + + /* Make sure the correct pitch is used */ + glPixelStorei(GL_UNPACK_ROW_LENGTH, width); + + if ((This->Flags & SFLAG_NONPOW2) && !(This->Flags & SFLAG_OVERSIZE)) { + TRACE("non power of two support\n"); + if(!(This->Flags & SFLAG_ALLOCATED)) { + surface_allocate_surface(This, internal, This->pow2Width, This->pow2Height, format, type); + } + if (mem || (This->Flags & SFLAG_PBO)) { + surface_upload_data(This, internal, This->currentDesc.Width, This->currentDesc.Height, format, type, mem); + } + } else { + /* When making the realloc conditional, keep in mind that GL_APPLE_client_storage may be in use, and This->resource.allocatedMemory + * changed. So also keep track of memory changes. In this case the texture has to be reallocated + */ + if(!(This->Flags & SFLAG_ALLOCATED)) { + surface_allocate_surface(This, internal, This->glRect.right - This->glRect.left, This->glRect.bottom - This->glRect.top, format, type); + } + if (mem || (This->Flags & SFLAG_PBO)) { + surface_upload_data(This, internal, This->glRect.right - This->glRect.left, This->glRect.bottom - This->glRect.top, format, type, mem); + } + } + + /* Restore the default pitch */ + glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); + + /* Don't delete PBO memory */ + if((mem != This->resource.allocatedMemory) && !(This->Flags & SFLAG_PBO)) + HeapFree(GetProcessHeap(), 0, mem); } } + load_end: + if(rect == NULL) { + This->Flags |= flag; + } + return WINED3D_OK; } diff --git a/dlls/wined3d/wined3d_main.c b/dlls/wined3d/wined3d_main.c index ebe09bd2605..26e7f707cad 100644 --- a/dlls/wined3d/wined3d_main.c +++ b/dlls/wined3d/wined3d_main.c @@ -39,7 +39,7 @@ wined3d_settings_t wined3d_settings = VS_HW, /* Hardware by default */ PS_HW, /* Hardware by default */ VBO_HW, /* Hardware by default */ - FALSE, /* Use of GLSL disabled by default */ + TRUE, /* Use of GLSL enabled by default */ ORM_BACKBUFFER, /* Use the backbuffer to do offscreen rendering */ RTL_AUTO, /* Automatically determine best locking method */ 0, /* The default of memory is set in FillGLCaps */ @@ -184,14 +184,10 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv) } if ( !get_config_key( hkey, appkey, "UseGLSL", buffer, size) ) { - if (!strcmp(buffer,"enabled")) - { - TRACE("Use of GL Shading Language enabled for systems that support it\n"); - wined3d_settings.glslRequested = TRUE; - } - else + if (!strcmp(buffer,"disabled")) { TRACE("Use of GL Shading Language disabled\n"); + wined3d_settings.glslRequested = FALSE; } } if ( !get_config_key( hkey, appkey, "OffscreenRenderingMode", buffer, size) ) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index bee917d06a0..b86d0d0ec6f 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1107,6 +1107,7 @@ struct IWineD3DSurfaceImpl #define MAXLOCKCOUNT 50 /* After this amount of locks do not free the sysmem copy */ glDescriptor glDescription; + BOOL srgb; /* For GetDC */ wineD3DSurface_DIB dib; diff --git a/dlls/wininet/ftp.c b/dlls/wininet/ftp.c index bbaef8a5b5f..88d97ffe3a1 100644 --- a/dlls/wininet/ftp.c +++ b/dlls/wininet/ftp.c @@ -225,6 +225,12 @@ BOOL WINAPI FtpPutFileW(HINTERNET hConnect, LPCWSTR lpszLocalFile, goto lend; } + if (lpwfs->download_in_progress != NULL) + { + INTERNET_SetLastError(ERROR_FTP_TRANSFER_IN_PROGRESS); + goto lend; + } + if ((dwFlags & FTP_CONDITION_MASK) > FTP_TRANSFER_TYPE_BINARY) { INTERNET_SetLastError(ERROR_INVALID_PARAMETER); @@ -392,6 +398,12 @@ BOOL WINAPI FtpSetCurrentDirectoryW(HINTERNET hConnect, LPCWSTR lpszDirectory) goto lend; } + if (lpwfs->download_in_progress != NULL) + { + INTERNET_SetLastError(ERROR_FTP_TRANSFER_IN_PROGRESS); + goto lend; + } + TRACE("lpszDirectory(%s)\n", debugstr_w(lpszDirectory)); hIC = lpwfs->lpAppInfo; @@ -532,6 +544,12 @@ BOOL WINAPI FtpCreateDirectoryW(HINTERNET hConnect, LPCWSTR lpszDirectory) goto lend; } + if (lpwfs->download_in_progress != NULL) + { + INTERNET_SetLastError(ERROR_FTP_TRANSFER_IN_PROGRESS); + goto lend; + } + if (!lpszDirectory) { INTERNET_SetLastError(ERROR_INVALID_PARAMETER); @@ -676,6 +694,12 @@ HINTERNET WINAPI FtpFindFirstFileW(HINTERNET hConnect, goto lend; } + if (lpwfs->download_in_progress != NULL) + { + INTERNET_SetLastError(ERROR_FTP_TRANSFER_IN_PROGRESS); + goto lend; + } + hIC = lpwfs->lpAppInfo; if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC) { @@ -866,6 +890,12 @@ BOOL WINAPI FtpGetCurrentDirectoryW(HINTERNET hFtpSession, LPWSTR lpszCurrentDir goto lend; } + if (lpwfs->download_in_progress != NULL) + { + INTERNET_SetLastError(ERROR_FTP_TRANSFER_IN_PROGRESS); + goto lend; + } + hIC = lpwfs->lpAppInfo; if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC) { @@ -1044,10 +1074,12 @@ HINTERNET WINAPI FtpOpenFileW(HINTERNET hFtpSession, goto lend; } - if (lpwfs->download_in_progress != NULL) { - INTERNET_SetLastError(ERROR_FTP_TRANSFER_IN_PROGRESS); - goto lend; + if (lpwfs->download_in_progress != NULL) + { + INTERNET_SetLastError(ERROR_FTP_TRANSFER_IN_PROGRESS); + goto lend; } + hIC = lpwfs->lpAppInfo; if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC) { @@ -1255,8 +1287,9 @@ BOOL WINAPI FtpGetFileW(HINTERNET hInternet, LPCWSTR lpszRemoteFile, LPCWSTR lps goto lend; } - if (lpwfs->download_in_progress != NULL) { - INTERNET_SetLastError(ERROR_FTP_TRANSFER_IN_PROGRESS); + if (lpwfs->download_in_progress != NULL) + { + INTERNET_SetLastError(ERROR_FTP_TRANSFER_IN_PROGRESS); goto lend; } @@ -1332,15 +1365,16 @@ BOOL WINAPI FTP_FtpGetFileW(LPWININETFTPSESSIONW lpwfs, LPCWSTR lpszRemoteFile, /* Receive data */ FTP_RetrieveFileData(lpwfs, nDataSocket, hFile); + closesocket(nDataSocket); + nResCode = FTP_ReceiveResponse(lpwfs, dwContext); if (nResCode) { if (nResCode == 226) bSuccess = TRUE; - else + else FTP_SetResponseError(nResCode); } - closesocket(nDataSocket); } } @@ -1437,6 +1471,12 @@ BOOL WINAPI FtpDeleteFileW(HINTERNET hFtpSession, LPCWSTR lpszFileName) goto lend; } + if (lpwfs->download_in_progress != NULL) + { + INTERNET_SetLastError(ERROR_FTP_TRANSFER_IN_PROGRESS); + goto lend; + } + if (!lpszFileName) { INTERNET_SetLastError(ERROR_INVALID_PARAMETER); @@ -1576,6 +1616,12 @@ BOOL WINAPI FtpRemoveDirectoryW(HINTERNET hFtpSession, LPCWSTR lpszDirectory) goto lend; } + if (lpwfs->download_in_progress != NULL) + { + INTERNET_SetLastError(ERROR_FTP_TRANSFER_IN_PROGRESS); + goto lend; + } + if (!lpszDirectory) { INTERNET_SetLastError(ERROR_INVALID_PARAMETER); @@ -1720,6 +1766,12 @@ BOOL WINAPI FtpRenameFileW(HINTERNET hFtpSession, LPCWSTR lpszSrc, LPCWSTR lpszD goto lend; } + if (lpwfs->download_in_progress != NULL) + { + INTERNET_SetLastError(ERROR_FTP_TRANSFER_IN_PROGRESS); + goto lend; + } + if (!lpszSrc || !lpszDest) { INTERNET_SetLastError(ERROR_INVALID_PARAMETER); @@ -2957,7 +3009,7 @@ static void FTP_CloseFindNextHandle(LPWININETHANDLEHEADER hdr) * FTP_CloseFileTransferHandle (internal) * * Closes the file transfer handle. This also 'cleans' the data queue of - * the 'transfer conplete' message (this is a bit of a hack though :-/ ) + * the 'transfer complete' message (this is a bit of a hack though :-/ ) * */ static void FTP_CloseFileTransferHandle(LPWININETHANDLEHEADER hdr) @@ -2971,18 +3023,14 @@ static void FTP_CloseFileTransferHandle(LPWININETHANDLEHEADER hdr) WININET_Release(&lpwh->lpFtpSession->hdr); if (!lpwh->session_deleted) - lpwfs->download_in_progress = NULL; - - /* This just serves to flush the control socket of any spurrious lines written - to it (like '226 Transfer complete.'). + lpwfs->download_in_progress = NULL; - Wonder what to do if the server sends us an error code though... - */ - nResCode = FTP_ReceiveResponse(lpwfs, lpwfs->hdr.dwContext); - if (lpwh->nDataSocket != -1) closesocket(lpwh->nDataSocket); + nResCode = FTP_ReceiveResponse(lpwfs, lpwfs->hdr.dwContext); + if (nResCode > 0 && nResCode != 226) WARN("server reports failed transfer\n"); + HeapFree(GetProcessHeap(), 0, lpwh); } diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c index f496733c419..53d6fbac9e6 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c @@ -2589,6 +2589,9 @@ BOOL WINAPI HTTP_HttpSendRequestW(LPWININETHTTPREQW lpwhr, LPCWSTR lpszHeaders, BOOL loop_next; INTERNET_ASYNC_RESULT iar; static const WCHAR szClose[] = { 'C','l','o','s','e',0 }; + static const WCHAR szContentLength[] = + { 'C','o','n','t','e','n','t','-','L','e','n','g','t','h',':',' ','%','l','i','\r','\n',0 }; + WCHAR contentLengthStr[sizeof szContentLength/2 /* includes \r\n */ + 20 /* int */ ]; TRACE("--> %p\n", lpwhr); @@ -2599,16 +2602,8 @@ BOOL WINAPI HTTP_HttpSendRequestW(LPWININETHTTPREQW lpwhr, LPCWSTR lpszHeaders, HTTP_FixVerb(lpwhr); - /* if we are using optional stuff, we must add the fixed header of that option length */ - if (dwContentLength > 0) - { - static const WCHAR szContentLength[] = { - 'C','o','n','t','e','n','t','-','L','e','n','g','t','h',':',' ','%','l','i','\r','\n',0}; - WCHAR contentLengthStr[sizeof szContentLength/2 /* includes \n\r */ + 20 /* int */ ]; - sprintfW(contentLengthStr, szContentLength, dwContentLength); - HTTP_HttpAddRequestHeadersW(lpwhr, contentLengthStr, -1L, - HTTP_ADDREQ_FLAG_ADD | HTTP_ADDHDR_FLAG_REPLACE); - } + sprintfW(contentLengthStr, szContentLength, dwContentLength); + HTTP_HttpAddRequestHeadersW(lpwhr, contentLengthStr, -1L, HTTP_ADDREQ_FLAG_ADD | HTTP_ADDHDR_FLAG_REPLACE); do { diff --git a/dlls/wininet/tests/ftp.c b/dlls/wininet/tests/ftp.c index 7aa42db251d..9eab05d6f5c 100644 --- a/dlls/wininet/tests/ftp.c +++ b/dlls/wininet/tests/ftp.c @@ -301,16 +301,12 @@ static void test_getfile(void) /* Zero attributes */ SetLastError(0xdeadbeef); - bRet = FtpGetFileA(hFtp, "welcome.msg", "should_be_non_existing_deadbeef", FALSE, 0, FTP_TRANSFER_TYPE_UNKNOWN, 0); - ok ( bRet == FALSE, "Expected FtpGetFileA to fail\n"); - todo_wine - { - ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR, - "Expected ERROR_INTERNET_EXTENDED_ERROR, got %d\n", GetLastError()); - ok (GetFileAttributesA("should_be_non_existing_deadbeef") == INVALID_FILE_ATTRIBUTES, - "Local file should not have been created\n"); - } - DeleteFileA("should_be_non_existing_deadbeef"); + bRet = FtpGetFileA(hFtp, "welcome.msg", "should_be_existing_non_deadbeef", FALSE, 0, FTP_TRANSFER_TYPE_UNKNOWN, 0); + ok ( bRet == TRUE, "Expected FtpGetFileA to succeed\n"); + ok (GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError()); + ok (GetFileAttributesA("should_be_existing_non_deadbeef") != INVALID_FILE_ATTRIBUTES, + "Local file should have been created\n"); + DeleteFileA("should_be_existing_non_deadbeef"); /* Illegal condition flags */ SetLastError(0xdeadbeef); @@ -326,12 +322,14 @@ static void test_getfile(void) SetLastError(0xdeadbeef); bRet = FtpGetFileA(hFtp, "should_be_non_existing_deadbeef", "should_also_be_non_existing_deadbeef", FALSE, FILE_ATTRIBUTE_NORMAL, FTP_TRANSFER_TYPE_UNKNOWN, 0); ok ( bRet == FALSE, "Expected FtpGetFileA to fail\n"); + todo_wine + { ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR, "Expected ERROR_INTERNET_EXTENDED_ERROR, got %d\n", GetLastError()); /* Currently Wine always creates the local file (even on failure) which is not correct, hence the test */ - todo_wine ok (GetFileAttributesA("should_also_be_non_existing_deadbeef") == INVALID_FILE_ATTRIBUTES, "Local file should not have been created\n"); + } DeleteFileA("should_also_be_non_existing_deadbeef"); /* Same call as the previous but now the local file does exists. Windows just removes the file if the call fails @@ -346,32 +344,30 @@ static void test_getfile(void) SetLastError(0xdeadbeef); bRet = FtpGetFileA(hFtp, "should_be_non_existing_deadbeef", "should_also_be_non_existing_deadbeef", FALSE, FILE_ATTRIBUTE_NORMAL, FTP_TRANSFER_TYPE_UNKNOWN, 0); ok ( bRet == FALSE, "Expected FtpGetFileA to fail\n"); + todo_wine + { ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR, "Expected ERROR_INTERNET_EXTENDED_ERROR, got %d\n", GetLastError()); /* Currently Wine always creates the local file (even on failure) which is not correct, hence the test */ - todo_wine ok (GetFileAttributesA("should_also_be_non_existing_deadbeef") == INVALID_FILE_ATTRIBUTES, "Local file should not have been created\n"); + } DeleteFileA("should_also_be_non_existing_deadbeef"); - /* This one should fail */ + /* This one should succeed */ SetLastError(0xdeadbeef); - bRet = FtpGetFileA(hFtp, "welcome.msg", "should_be_non_existing_deadbeef", FALSE, FILE_ATTRIBUTE_NORMAL, FTP_TRANSFER_TYPE_UNKNOWN, 0); - ok ( bRet == FALSE, "Expected FtpGetFileA to fail\n"); - ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR, - "Expected ERROR_INTERNET_EXTENDED_ERROR, got %d\n", GetLastError()); + bRet = FtpGetFileA(hFtp, "welcome.msg", "should_be_existing_non_deadbeef", FALSE, FILE_ATTRIBUTE_NORMAL, FTP_TRANSFER_TYPE_UNKNOWN, 0); + ok ( bRet == TRUE, "Expected FtpGetFileA to fail\n"); + ok ( GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError()); - if (GetFileAttributesA("should_be_non_existing_deadbeef") != INVALID_FILE_ATTRIBUTES) + if (GetFileAttributesA("should_be_existing_non_deadbeef") != INVALID_FILE_ATTRIBUTES) { /* Should succeed as fFailIfExists is set to FALSE (meaning don't fail if local file exists) */ SetLastError(0xdeadbeef); bRet = FtpGetFileA(hFtp, "welcome.msg", "should_be_non_existing_deadbeef", FALSE, FILE_ATTRIBUTE_NORMAL, FTP_TRANSFER_TYPE_UNKNOWN, 0); - todo_wine - { ok ( bRet == TRUE, "Expected FtpGetFileA to succeed\n"); ok ( GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError()); - } /* Should fail as fFailIfExists is set to TRUE */ SetLastError(0xdeadbeef); @@ -387,7 +383,7 @@ static void test_getfile(void) ok ( GetLastError() == ERROR_FILE_EXISTS, "Expected ERROR_FILE_EXISTS, got %d\n", GetLastError()); - DeleteFileA("should_be_non_existing_deadbeef"); + DeleteFileA("should_be_existing_non_deadbeef"); } InternetCloseHandle(hFtp); @@ -478,13 +474,8 @@ static void test_openfile(void) SetLastError(0xdeadbeef); hOpenFile = FtpOpenFileA(hFtp, "welcome.msg", GENERIC_READ, FTP_TRANSFER_TYPE_ASCII, 0); - todo_wine - { - ok ( hOpenFile == NULL, "Expected FtpOpenFileA to fail\n"); - /* For some strange/unknown reason, win98 returns ERROR_FILE_NOT_FOUND */ - ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR || GetLastError() == ERROR_FILE_NOT_FOUND, - "Expected ERROR_INTERNET_EXTENDED_ERROR or ERROR_FILE_NOT_FOUND (win98), got %d\n", GetLastError()); - } + ok ( hOpenFile != NULL, "Expected FtpOpenFileA to succeed\n"); + ok ( GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", GetLastError()); if (hOpenFile) { @@ -496,14 +487,12 @@ static void test_openfile(void) SetLastError(0xdeadbeef); bRet = FtpCreateDirectoryA(hFtp, "new_directory_deadbeef"); ok ( bRet == FALSE, "Expected FtpCreateDirectoryA to fail\n"); - todo_wine ok ( GetLastError() == ERROR_FTP_TRANSFER_IN_PROGRESS, "Expected ERROR_FTP_TRANSFER_IN_PROGRESS, got %d\n", GetLastError()); SetLastError(0xdeadbeef); bRet = FtpDeleteFileA(hFtp, "non_existent_file_deadbeef"); ok ( bRet == FALSE, "Expected FtpDeleteFileA to fail\n"); - todo_wine ok ( GetLastError() == ERROR_FTP_TRANSFER_IN_PROGRESS, "Expected ERROR_FTP_TRANSFER_IN_PROGRESS, got %d\n", GetLastError()); @@ -529,7 +518,6 @@ static void test_openfile(void) SetLastError(0xdeadbeef); bRet = FtpPutFileA(hFtp, "now_existing_local", "non_existing_remote", FTP_TRANSFER_TYPE_UNKNOWN, 0); ok ( bRet == FALSE, "Expected FtpPutFileA to fail\n"); - todo_wine ok ( GetLastError() == ERROR_FTP_TRANSFER_IN_PROGRESS, "Expected ERROR_FTP_TRANSFER_IN_PROGRESS, got %d\n", GetLastError()); DeleteFileA("now_existing_local"); @@ -537,14 +525,12 @@ static void test_openfile(void) SetLastError(0xdeadbeef); bRet = FtpRemoveDirectoryA(hFtp, "should_be_non_existing_deadbeef_dir"); ok ( bRet == FALSE, "Expected FtpRemoveDirectoryA to fail\n"); - todo_wine ok ( GetLastError() == ERROR_FTP_TRANSFER_IN_PROGRESS, "Expected ERROR_FTP_TRANSFER_IN_PROGRESS, got %d\n", GetLastError()); SetLastError(0xdeadbeef); bRet = FtpRenameFileA(hFtp , "should_be_non_existing_deadbeef", "new"); ok ( bRet == FALSE, "Expected FtpRenameFileA to fail\n"); - todo_wine ok ( GetLastError() == ERROR_FTP_TRANSFER_IN_PROGRESS, "Expected ERROR_FTP_TRANSFER_IN_PROGRESS, got %d\n", GetLastError()); } @@ -845,14 +831,14 @@ static void test_multiple(void) } /* A correct call */ - bRet = FtpGetFileA(hFtp, "welcome.msg", "should_be_non_existing_deadbeef", FALSE, FILE_ATTRIBUTE_NORMAL, FTP_TRANSFER_TYPE_UNKNOWN, 0); - DeleteFileA("should_be_non_existing_deadbeef"); + bRet = FtpGetFileA(hFtp, "welcome.msg", "should_be_existing_non_deadbeef", FALSE, FILE_ATTRIBUTE_NORMAL, FTP_TRANSFER_TYPE_UNKNOWN, 0); + ok(bRet, "Expected FtpGetFileA to succeed\n"); + DeleteFileA("should_be_existing_non_deadbeef"); SetLastError(0xdeadbeef); hOpenFile = FtpOpenFileA(hFtp, "welcome.msg", GENERIC_READ, FTP_TRANSFER_TYPE_ASCII, 0); - ok ( hOpenFile == NULL, "Expected FtpOpenFileA to fail\n"); - ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR || GetLastError() == ERROR_FILE_NOT_FOUND, - "Expected ERROR_INTERNET_EXTENDED_ERROR or ERROR_FILE_NOT_FOUND (win98), got %d\n", GetLastError()); + ok(hOpenFile != NULL, "Expected FtpOpenFileA to succeed\n"); + ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", GetLastError()); InternetCloseHandle(hOpenFile); InternetCloseHandle(hFtp); diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c index 589fe8a4d58..a8f989b0acb 100644 --- a/dlls/wininet/tests/http.c +++ b/dlls/wininet/tests/http.c @@ -1302,6 +1302,17 @@ static DWORD CALLBACK server_thread(LPVOID param) send(c, notokmsg, sizeof notokmsg-1, 0); } + if (strstr(buffer, "/test5")) + { + if (strstr(buffer, "Content-Length: 0")) + { + send(c, okmsg, sizeof okmsg-1, 0); + send(c, page1, sizeof page1-1, 0); + } + else + send(c, notokmsg, sizeof notokmsg-1, 0); + } + if (strstr(buffer, "/quit")) { send(c, okmsg, sizeof okmsg-1, 0); @@ -1526,6 +1537,7 @@ static void test_http_connection(void) test_proxy_indirect(si.port); test_proxy_direct(si.port); test_header_handling_order(si.port); + test_basic_request(si.port, "/test5"); /* send the basic request again to shutdown the server thread */ test_basic_request(si.port, "/quit"); diff --git a/include/d3dx8math.h b/include/d3dx8math.h index 0d9416a66fa..a5fc09ea6c6 100644 --- a/include/d3dx8math.h +++ b/include/d3dx8math.h @@ -58,6 +58,31 @@ typedef struct D3DXCOLOR FLOAT r, g, b, a; } D3DXCOLOR, *LPD3DXCOLOR; +D3DXQUATERNION* WINAPI D3DXQuaternionNormalize(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq); + +D3DXVECTOR2* WINAPI D3DXVec2BaryCentric(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2, CONST D3DXVECTOR2 *pv3, FLOAT f, FLOAT g); +D3DXVECTOR2* WINAPI D3DXVec2CatmullRom(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv0, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2, CONST D3DXVECTOR2 *pv3, FLOAT s); +D3DXVECTOR2* WINAPI D3DXVec2Hermite(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pt1, CONST D3DXVECTOR2 *pv2, CONST D3DXVECTOR2 *pt2, FLOAT s); +D3DXVECTOR2* WINAPI D3DXVec2Normalize(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv); +D3DXVECTOR4* WINAPI D3DXVec2Transform(D3DXVECTOR4 *pout, CONST D3DXVECTOR2 *pv, CONST D3DXMATRIX *pm); +D3DXVECTOR2* WINAPI D3DXVec2TransformCoord(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv, CONST D3DXMATRIX *pm); +D3DXVECTOR2* WINAPI D3DXVec2TransformNormal(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv, CONST D3DXMATRIX *pm); + +D3DXVECTOR3* WINAPI D3DXVec3BaryCentric(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2, CONST D3DXVECTOR3 *pv3, FLOAT f, FLOAT g); +D3DXVECTOR3* WINAPI D3DXVec3CatmullRom( D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv0, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2, CONST D3DXVECTOR3 *pv3, FLOAT s); +D3DXVECTOR3* WINAPI D3DXVec3Hermite(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pt1, CONST D3DXVECTOR3 *pv2, CONST D3DXVECTOR3 *pt2, FLOAT s); +D3DXVECTOR3* WINAPI D3DXVec3Normalize(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv); +D3DXVECTOR4* WINAPI D3DXVec3Transform(D3DXVECTOR4 *pout, CONST D3DXVECTOR3 *pv, CONST D3DXMATRIX *pm); +D3DXVECTOR3* WINAPI D3DXVec3TransformCoord(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv, CONST D3DXMATRIX *pm); +D3DXVECTOR3* WINAPI D3DXVec3TransformNormal(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv, CONST D3DXMATRIX *pm); + +D3DXVECTOR4* WINAPI D3DXVec4BaryCentric(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2, CONST D3DXVECTOR4 *pv3, FLOAT f, FLOAT g); +D3DXVECTOR4* WINAPI D3DXVec4CatmullRom(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv0, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2, CONST D3DXVECTOR4 *pv3, FLOAT s); +D3DXVECTOR4* WINAPI D3DXVec4Cross(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2, CONST D3DXVECTOR4 *pv3); +D3DXVECTOR4* WINAPI D3DXVec4Hermite(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pt1, CONST D3DXVECTOR4 *pv2, CONST D3DXVECTOR4 *pt2, FLOAT s); +D3DXVECTOR4* WINAPI D3DXVec4Normalize(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv); +D3DXVECTOR4* WINAPI D3DXVec4Transform(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv, CONST D3DXMATRIX *pm); + #include #endif /* __D3DX8MATH_H__ */ diff --git a/include/d3dx8math.inl b/include/d3dx8math.inl index 4df1f9e0a84..22684a0a76f 100644 --- a/include/d3dx8math.inl +++ b/include/d3dx8math.inl @@ -319,26 +319,31 @@ static inline D3DXVECTOR4* D3DXVec4Subtract(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 } /*__________________D3DXMatrix____________________*/ +#ifdef NONAMELESSUNION +# define D3DX_U(x) (x).u +#else +# define D3DX_U(x) (x) +#endif static inline D3DXMATRIX* D3DXMatrixIdentity(D3DXMATRIX *pout) { if ( !pout ) return NULL; - pout->m[0][1] = 0.0f; - pout->m[0][2] = 0.0f; - pout->m[0][3] = 0.0f; - pout->m[1][0] = 0.0f; - pout->m[1][2] = 0.0f; - pout->m[1][3] = 0.0f; - pout->m[2][0] = 0.0f; - pout->m[2][1] = 0.0f; - pout->m[2][3] = 0.0f; - pout->m[3][0] = 0.0f; - pout->m[3][1] = 0.0f; - pout->m[3][2] = 0.0f; - pout->m[0][0] = 1.0f; - pout->m[1][1] = 1.0f; - pout->m[2][2] = 1.0f; - pout->m[3][3] = 1.0f; + D3DX_U(*pout).m[0][1] = 0.0f; + D3DX_U(*pout).m[0][2] = 0.0f; + D3DX_U(*pout).m[0][3] = 0.0f; + D3DX_U(*pout).m[1][0] = 0.0f; + D3DX_U(*pout).m[1][2] = 0.0f; + D3DX_U(*pout).m[1][3] = 0.0f; + D3DX_U(*pout).m[2][0] = 0.0f; + D3DX_U(*pout).m[2][1] = 0.0f; + D3DX_U(*pout).m[2][3] = 0.0f; + D3DX_U(*pout).m[3][0] = 0.0f; + D3DX_U(*pout).m[3][1] = 0.0f; + D3DX_U(*pout).m[3][2] = 0.0f; + D3DX_U(*pout).m[0][0] = 1.0f; + D3DX_U(*pout).m[1][1] = 1.0f; + D3DX_U(*pout).m[2][2] = 1.0f; + D3DX_U(*pout).m[3][3] = 1.0f; return pout; } @@ -354,11 +359,12 @@ static inline BOOL D3DXMatrixIsIdentity(D3DXMATRIX *pm) { for (j=0; j<4; j++) { - if ( fabs(pm->m[i][j] - testmatrix.m[i][j]) > 0.0001 ) equal = FALSE; + if ( fabs(D3DX_U(*pm).m[i][j] - D3DX_U(testmatrix).m[i][j]) > 0.0001 ) equal = FALSE; } } return equal; } +#undef D3DX_U /*__________________D3DXPLANE____________________*/ diff --git a/include/tapi.h b/include/tapi.h index 4d7dca08e73..9c5dc498090 100644 --- a/include/tapi.h +++ b/include/tapi.h @@ -900,6 +900,9 @@ DWORD WINAPI lineGetTranslateCaps(HLINEAPP,DWORD,LPLINETRANSLATECAPS); DWORD WINAPI lineHandoff(HCALL,LPCSTR,DWORD); DWORD WINAPI lineHold(HCALL); DWORD WINAPI lineInitialize(LPHLINEAPP,HINSTANCE,LINECALLBACK,LPCSTR,LPDWORD); +LONG WINAPI lineInitializeExA(LPHLINEAPP,HINSTANCE,LINECALLBACK,LPCSTR,LPDWORD,LPDWORD,LPLINEINITIALIZEEXPARAMS); +LONG WINAPI lineInitializeExW(LPHLINEAPP,HINSTANCE,LINECALLBACK,LPCWSTR,LPDWORD,LPDWORD,LPLINEINITIALIZEEXPARAMS); +#define lineInitializeEx WINELIB_NAME_AW(lineInitializeEx) DWORD WINAPI lineMakeCall(HLINE,LPHCALL,LPCSTR,DWORD,LPLINECALLPARAMS); DWORD WINAPI lineMonitorDigits(HCALL,DWORD); DWORD WINAPI lineMonitorMedia(HCALL,DWORD); diff --git a/include/winbase.h b/include/winbase.h index 7ca6e84830e..c2fab889044 100644 --- a/include/winbase.h +++ b/include/winbase.h @@ -1085,7 +1085,7 @@ typedef struct tagCOMMPROP { #define PST_LAT ((DWORD)0x101) #define PST_MODEM ((DWORD)0x06) #define PST_NETWORK_BRIDGE ((DWORD)0x100) -#define PST_PARALLEL_PORT ((DWORD)0x02) +#define PST_PARALLELPORT ((DWORD)0x02) #define PST_RS232 ((DWORD)0x01) #define PST_RS442 ((DWORD)0x03) #define PST_RS423 ((DWORD)0x04) diff --git a/include/wincrypt.h b/include/wincrypt.h index e913f6b97b6..41b9e2efd4f 100644 --- a/include/wincrypt.h +++ b/include/wincrypt.h @@ -3962,7 +3962,7 @@ BOOL WINAPI CertVerifyCTLUsage(DWORD dwEncodingType, DWORD dwSubjectType, PCTL_VERIFY_USAGE_STATUS pVerifyUsageStatus); BOOL WINAPI CertVerifyRevocation(DWORD dwEncodingType, DWORD dwRevType, - DWORD cContext, void *rgpvContext[], DWORD dwFlags, + DWORD cContext, PVOID rgpvContext[], DWORD dwFlags, PCERT_REVOCATION_PARA pRevPara, PCERT_REVOCATION_STATUS pRevStatus); BOOL WINAPI CryptExportPublicKeyInfo(HCRYPTPROV_OR_NCRYPT_KEY_HANDLE hCryptProv, DWORD dwKeySpec, diff --git a/programs/wineboot/shutdown.c b/programs/wineboot/shutdown.c index b3825e85ba1..b9705d80123 100644 --- a/programs/wineboot/shutdown.c +++ b/programs/wineboot/shutdown.c @@ -249,6 +249,7 @@ static DWORD_PTR send_end_session_messages( struct window_info *win, UINT count, HANDLE process_handle; DWORD ret; + /* FIXME: Use flags to implement EWX_FORCEIFHUNG! */ /* don't kill the desktop process */ if (win[0].pid == desktop_pid) return 1; diff --git a/programs/wineboot/wineboot_En.rc b/programs/wineboot/wineboot_En.rc index 45abe9c217c..7a3fa2a7b35 100644 --- a/programs/wineboot/wineboot_En.rc +++ b/programs/wineboot/wineboot_En.rc @@ -26,8 +26,8 @@ STYLE DS_MODALFRAME | DS_NOIDLEMSG | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSM CAPTION "Waiting for Program" FONT 8, "MS Shell Dlg" BEGIN - DEFPUSHBUTTON "Terminate Process",IDOK,51,49,71,15 - PUSHBUTTON "Cancel",IDCANCEL,129,49,50,15 + DEFPUSHBUTTON "Cancel",IDCANCEL,129,49,50,15 + PUSHBUTTON "Terminate Process",IDOK,51,49,71,15 LTEXT "A simulated log-off or shutdown is in progress, but this program isn't responding.", IDC_STATIC,7,7,172,19 LTEXT "If you terminate the process you may lose all unsaved data.", diff --git a/programs/wineboot/wineboot_Ko.rc b/programs/wineboot/wineboot_Ko.rc index 869a6afeb3b..d39f87399d1 100644 --- a/programs/wineboot/wineboot_Ko.rc +++ b/programs/wineboot/wineboot_Ko.rc @@ -28,8 +28,8 @@ STYLE DS_MODALFRAME | DS_NOIDLEMSG | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSM CAPTION "ÇÁ·Î±×·¥ ´ë±âÁß" FONT 8, "MS Shell Dlg" BEGIN - DEFPUSHBUTTON "ÇÁ·Î¼¼½º ³¡³»±â",IDOK,51,49,71,15 - PUSHBUTTON "Ãë¼Ò",IDCANCEL,129,49,50,15 + DEFPUSHBUTTON "Ãë¼Ò",IDCANCEL,129,49,50,15 + PUSHBUTTON "ÇÁ·Î¼¼½º ³¡³»±â",IDOK,51,49,71,15 LTEXT " ÀÌ ÇÁ·Î¼¼½º¿¡ ·Î±× ¿ÀÇÁ³ª Á¾·á¸¦ ½ÃµµÇßÀ¸³ª, ÀÌ ÇÁ·Î±×·¥Àº ¾Æ¹«·± ¹ÝÀÀÀÌ ¾ø½À´Ï´Ù.", IDC_STATIC,7,7,172,19 LTEXT "¸¸¾à ´ç½ÅÀÌ ÀÌ ÇÁ·Î¼¼½º¸¦ ³¡³½´Ù¸é ÀúÀå ÇÏÁö ¾ÊÀº ¸ðµç µ¥ÀÌÅ͸¦ ÀÒ¾î¹ö¸± °ÍÀÔ´Ï´Ù.", diff --git a/programs/wineboot/wineboot_Sv.rc b/programs/wineboot/wineboot_Sv.rc index eb6045011dd..6727c0117b3 100644 --- a/programs/wineboot/wineboot_Sv.rc +++ b/programs/wineboot/wineboot_Sv.rc @@ -26,8 +26,8 @@ STYLE DS_MODALFRAME | DS_NOIDLEMSG | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSM CAPTION "Väntar på program" FONT 8, "MS Shell Dlg" BEGIN - DEFPUSHBUTTON "Avsluta process",IDOK,51,49,71,15 - PUSHBUTTON "Avbryt",IDCANCEL,129,49,50,15 + DEFPUSHBUTTON "Avbryt",IDCANCEL,129,49,50,15 + PUSHBUTTON "Avsluta process",IDOK,51,49,71,15 LTEXT "En simulerad avloggning eller avstängning pågår, men det här programmet svarar inte.", IDC_STATIC,7,7,172,19 LTEXT "Om du avslutar processen kan du förlora allt osparat data.", diff --git a/programs/winetest/Makefile.in b/programs/winetest/Makefile.in index d640848d2e8..2d4b12b0724 100644 --- a/programs/winetest/Makefile.in +++ b/programs/winetest/Makefile.in @@ -4,7 +4,7 @@ SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = winetest.exe APPMODE = -mconsole -IMPORTS = comctl32 version user32 gdi32 wsock32 kernel32 +IMPORTS = comctl32 version user32 gdi32 advapi32 wsock32 kernel32 C_SRCS = \ gui.c \ diff --git a/programs/winetest/main.c b/programs/winetest/main.c index 54574b16750..41879b4ef41 100644 --- a/programs/winetest/main.c +++ b/programs/winetest/main.c @@ -612,6 +612,7 @@ usage (void) " -c console mode, no GUI\n" " -e preserve the environment\n" " -h print this message and exit\n" +" -p shutdown when the tests are done\n" " -q quiet mode, no output at all\n" " -o FILE put report into FILE, do not submit\n" " -s FILE submit FILE, do not run tests\n" @@ -624,6 +625,7 @@ int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst, char *logname = NULL; const char *cp, *submit = NULL; int reset_env = 1; + int poweroff = 0; int interactive = 1; /* initialize the revision information first */ @@ -645,8 +647,12 @@ int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst, reset_env = 0; break; case 'h': + case '?': usage (); exit (0); + case 'p': + poweroff = 1; + break; case 'q': report (R_QUIET); interactive = 0; @@ -718,5 +724,21 @@ int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst, } else run_tests (logname); report (R_STATUS, "Finished"); } + if (poweroff) + { + HANDLE hToken; + TOKEN_PRIVILEGES npr; + + /* enable the shutdown privilege for the current process */ + if (OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &hToken)) + { + LookupPrivilegeValueA(0, SE_SHUTDOWN_NAME, &npr.Privileges[0].Luid); + npr.PrivilegeCount = 1; + npr.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; + AdjustTokenPrivileges(hToken, FALSE, &npr, 0, 0, 0); + CloseHandle(hToken); + } + ExitWindowsEx(EWX_SHUTDOWN | EWX_POWEROFF | EWX_FORCEIFHUNG, SHTDN_REASON_MAJOR_OTHER | SHTDN_REASON_MINOR_OTHER); + } exit (0); } diff --git a/tools/widl/client.c b/tools/widl/client.c index 2d48d7a8dd5..696dd83108f 100644 --- a/tools/widl/client.c +++ b/tools/widl/client.c @@ -386,6 +386,7 @@ static void init_client(void) void write_client(ifref_list_t *ifaces) { unsigned int proc_offset = 0; + int expr_eval_routines; ifref_t *iface; if (!do_client) @@ -398,6 +399,10 @@ void write_client(ifref_list_t *ifaces) return; write_formatstringsdecl(client, indent, ifaces, need_stub); + expr_eval_routines = write_expr_eval_routines(client, client_token); + if (expr_eval_routines) + write_expr_eval_routine_list(client, client_token); + write_user_quad_list(client); if (ifaces) LIST_FOR_EACH_ENTRY( iface, ifaces, ifref_t, entry ) { @@ -411,8 +416,6 @@ void write_client(ifref_list_t *ifaces) if (iface->iface->funcs) { - int expr_eval_routines; - write_implicithandledecl(iface->iface); write_clientinterfacedecl(iface->iface); @@ -424,11 +427,6 @@ void write_client(ifref_list_t *ifaces) print_client("#endif\n"); fprintf(client, "\n"); - - expr_eval_routines = write_expr_eval_routines(client, iface->iface->name); - if (expr_eval_routines) - write_expr_eval_routine_list(client, iface->iface->name); - write_user_quad_list(client); write_stubdescriptor(iface->iface, expr_eval_routines); } } diff --git a/tools/widl/proxy.c b/tools/widl/proxy.c index 3c8d6efdc1e..aa9fe11de39 100644 --- a/tools/widl/proxy.c +++ b/tools/widl/proxy.c @@ -65,14 +65,14 @@ static void write_stubdescproto(void) print_proxy( "\n"); } -static void write_stubdesc(void) +static void write_stubdesc(int expr_eval_routines) { print_proxy( "static const MIDL_STUB_DESC Object_StubDesc =\n{\n"); indent++; print_proxy( "0,\n"); print_proxy( "NdrOleAllocate,\n"); print_proxy( "NdrOleFree,\n"); - print_proxy( "{0}, 0, 0, 0, 0,\n"); + print_proxy( "{0}, 0, 0, %s, 0,\n", expr_eval_routines ? "ExprEvalRoutines" : "0"); print_proxy( "__MIDL_TypeFormatString.Format,\n"); print_proxy( "1, /* -error bounds_check flag */\n"); print_proxy( "0x10001, /* Ndr library version */\n"); @@ -598,6 +598,7 @@ int need_stub_files(const ifref_list_t *ifaces) void write_proxies(ifref_list_t *ifaces) { ifref_t *cur; + int expr_eval_routines; char *file_id = proxy_token; int c; unsigned int proc_offset = 0; @@ -613,8 +614,11 @@ void write_proxies(ifref_list_t *ifaces) if (need_proxy(cur->iface)) write_proxy(cur->iface, &proc_offset); + expr_eval_routines = write_expr_eval_routines(proxy, proxy_token); + if (expr_eval_routines) + write_expr_eval_routine_list(proxy, proxy_token); write_user_quad_list(proxy); - write_stubdesc(); + write_stubdesc(expr_eval_routines); print_proxy( "#if !defined(__RPC_WIN32__)\n"); print_proxy( "#error Currently only Wine and WIN32 are supported.\n"); diff --git a/tools/widl/server.c b/tools/widl/server.c index 49ceb69603d..a52c7297c35 100644 --- a/tools/widl/server.c +++ b/tools/widl/server.c @@ -399,6 +399,7 @@ static void init_server(void) void write_server(ifref_list_t *ifaces) { unsigned int proc_offset = 0; + int expr_eval_routines; ifref_t *iface; if (!do_server) @@ -411,6 +412,10 @@ void write_server(ifref_list_t *ifaces) return; write_formatstringsdecl(server, indent, ifaces, need_stub); + expr_eval_routines = write_expr_eval_routines(server, server_token); + if (expr_eval_routines) + write_expr_eval_routine_list(server, server_token); + write_user_quad_list(server); if (ifaces) LIST_FOR_EACH_ENTRY( iface, ifaces, ifref_t, entry ) { @@ -424,8 +429,6 @@ void write_server(ifref_list_t *ifaces) if (iface->iface->funcs) { - int expr_eval_routines; - write_serverinterfacedecl(iface->iface); write_stubdescdecl(iface->iface); @@ -436,12 +439,6 @@ void write_server(ifref_list_t *ifaces) print_server("#endif\n"); fprintf(server, "\n"); - - expr_eval_routines = write_expr_eval_routines(server, iface->iface->name); - if (expr_eval_routines) - write_expr_eval_routine_list(server, iface->iface->name); - - write_user_quad_list(server); write_stubdescriptor(iface->iface, expr_eval_routines); write_dispatchtable(iface->iface); } diff --git a/tools/widl/write_msft.c b/tools/widl/write_msft.c index dd29c73864d..f5ea2f7f27b 100644 --- a/tools/widl/write_msft.c +++ b/tools/widl/write_msft.c @@ -2473,6 +2473,7 @@ int create_msft_typelib(typelib_t *typelib) int failed = 0; typelib_entry_t *entry; time_t cur_time; + char *time_override; unsigned int version = 5 << 24 | 1 << 16 | 164; /* 5.01.0164 */ GUID midl_time_guid = {0xde77ba63,0x517c,0x11d1,{0xa2,0xda,0x00,0x00,0xf8,0x77,0x3c,0xe9}}; GUID midl_version_guid = {0xde77ba64,0x517c,0x11d1,{0xa2,0xda,0x00,0x00,0xf8,0x77,0x3c,0xe9}}; @@ -2518,7 +2519,8 @@ int create_msft_typelib(typelib_t *typelib) /* midl adds two sets of custom data to the library: the current unix time and midl's version number */ - cur_time = time(NULL); + time_override = getenv( "WIDL_TIME_OVERRIDE"); + cur_time = time_override ? atol( time_override) : time(NULL); set_custdata(msft, &midl_time_guid, VT_UI4, &cur_time, &msft->typelib_header.CustomDataOffset); set_custdata(msft, &midl_version_guid, VT_UI4, &version, &msft->typelib_header.CustomDataOffset); diff --git a/tools/winapi/win32.api b/tools/winapi/win32.api index c3c33a6d82f..f0a6490b539 100644 --- a/tools/winapi/win32.api +++ b/tools/winapi/win32.api @@ -115,6 +115,8 @@ PACL * PACTRL_ACCESSW * PACTRL_AUDITW * PBOOL +PCREDENTIALA ** +PCREDENTIALW ** PDWORD PEXPLICIT_ACCESSA PEXPLICIT_ACCESSA * @@ -661,6 +663,12 @@ ULONG PBOOL PCREDUI_INFOW PCtxtHandle +PSTR * +PWSTR * + +%str + +PCSTR %wstr @@ -760,6 +768,8 @@ PCERT_NAME_INFO PCERT_PUBLIC_KEY_INFO PCERT_RDN_ATTR PCERT_RDN_VALUE_BLOB +PCERT_REVOCATION_PARA +PCERT_REVOCATION_STATUS PCMSG_STREAM_INFO PCRL_ENTRY * PCRL_INFO @@ -775,6 +785,7 @@ PFN_CERT_ENUM_SYSTEM_STORE PFN_CRYPT_ENUM_OID_INFO PSYSTEMTIME PVOID +PVOID[] SIP_ADD_NEWPROVIDER * SIP_DISPATCH_INFO * SIP_INDIRECT_DATA * @@ -804,13 +815,17 @@ LPWSTR BOOL DWORD +HCRYPTASYNC %ptr DWORD * LPVOID +LPVOID * PCERT_REVOCATION_PARA PCERT_REVOCATION_STATUS +PCRYPT_CREDENTIALS +PCRYPT_RETRIEVE_AUX_INFO PCRYPT_URL_ARRAY PCRYPT_URL_INFO PVOID[] @@ -819,6 +834,10 @@ PVOID[] LPCSTR +%wstr + +LPCWSTR + %%ctl3d32.dll %long @@ -3220,6 +3239,7 @@ PROCESSINFOCLASS RTL_ATOM SECTION_INFORMATION_CLASS SECTION_INHERIT +SECURITY_DESCRIPTOR_CONTROL SECURITY_IMPERSONATION_LEVEL SECURITY_INFORMATION SEMAPHORE_INFORMATION_CLASS @@ -4989,6 +5009,7 @@ HLINEAPP HPHONE HPHONEAPP HWND +LONG %ptr @@ -5012,6 +5033,7 @@ LPLINEDEVSTATUS LPLINEDIALPARAMS LPLINEEXTENSIONID LPLINEFORWARDLIST +LPLINEINITIALIZEEXPARAMS LPLINEGENERATETONE LPLINEMEDIACONTROLCALLSTATE LPLINEMEDIACONTROLDIGIT @@ -5076,6 +5098,7 @@ UINT %ptr BINDINFO * +CLSID * DWORD * FORMATETC * IBindCtx * -- 2.11.4.GIT