From 12bc5156e145af74a68d40f23f6fdb06f0a69a12 Mon Sep 17 00:00:00 2001 From: Jan Zerebecki Date: Fri, 29 Jun 2007 00:50:53 +0200 Subject: [PATCH] push de9d73dbaee742a034eeb59c7f14c4d9b9b67c94 --- dlls/advapi32/service.c | 14 +- dlls/advapi32/tests/Makefile.in | 3 +- dlls/advapi32/tests/service.c | 150 ++++++++++++ dlls/amstream/amstream.c | 2 +- dlls/crypt32/str.c | 7 +- dlls/dbghelp/msc.c | 15 +- dlls/ddraw/Makefile.in | 3 +- dlls/gdi32/painting.c | 1 + dlls/gdi32/tests/bitmap.c | 8 +- dlls/gdi32/tests/metafile.c | 2 +- dlls/iccvid/iccvid.c | 4 +- dlls/kernel32/tests/pipe.c | 2 +- dlls/kernel32/tests/virtual.c | 4 +- dlls/mshtml/editor.c | 43 +++- dlls/mshtml/tests/htmldoc.c | 1 + dlls/msi/action.c | 26 ++- dlls/msi/custom.c | 55 +++-- dlls/msi/handle.c | 131 ++++++++--- dlls/msi/msi.c | 55 +++-- dlls/msi/msipriv.h | 3 +- dlls/msi/registry.c | 59 +++++ dlls/msi/string.c | 22 +- dlls/msi/table.c | 120 ++++++---- dlls/msi/tests/automation.c | 2 +- dlls/msi/tests/msi.c | 191 +++++++++++++++ dlls/msxml3/nodemap.c | 2 +- dlls/ole32/dictionary.c | 4 +- dlls/ole32/tests/marshal.c | 2 +- dlls/oleaut32/tests/tmarshal.c | 4 +- dlls/oleaut32/tests/usrmarshal.c | 10 +- dlls/quartz/avidec.c | 4 +- dlls/quartz/enumregfilters.c | 4 +- dlls/quartz/filtergraph.c | 6 +- dlls/quartz/filtermapper.c | 2 +- dlls/quartz/regsvr.c | 4 +- dlls/riched20/reader.c | 2 +- dlls/rpcrt4/rpc_binding.c | 3 +- dlls/rpcrt4/rpc_binding.h | 4 +- dlls/rpcrt4/rpc_message.c | 8 +- dlls/rpcrt4/rpc_message.h | 4 +- dlls/rpcrt4/rpc_transport.c | 14 +- dlls/shlwapi/tests/string.c | 2 +- dlls/user32/tests/cursoricon.c | 2 +- dlls/wined3d/directx.c | 492 +++++++++++++++++---------------------- dlls/wined3d/glsl_shader.c | 2 +- dlls/wined3d/surface.c | 2 +- dlls/winedos/int31.c | 4 +- dlls/winex11.drv/x11drv.h | 1 + dlls/winex11.drv/x11drv_main.c | 3 +- dlls/winex11.drv/xdnd.c | 178 +++++++++++++- dlls/wininet/tests/url.c | 14 +- include/wine/wined3d_gl.h | 4 + programs/cmd/builtins.c | 2 +- programs/cmd/directory.c | 6 +- 54 files changed, 1212 insertions(+), 500 deletions(-) create mode 100644 dlls/advapi32/tests/service.c diff --git a/dlls/advapi32/service.c b/dlls/advapi32/service.c index 4808db15f18..09ab0deb4ee 100644 --- a/dlls/advapi32/service.c +++ b/dlls/advapi32/service.c @@ -238,6 +238,8 @@ static const WCHAR szDependencies[] = { 'D','e','p','e','n','d','e','n','c','i','e','s',0}; static const WCHAR szDependOnService[] = { 'D','e','p','e','n','d','O','n','S','e','r','v','i','c','e',0}; +static const WCHAR szObjectName[] = { + 'O','b','j','e','c','t','N','a','m','e',0}; struct reg_value { DWORD type; @@ -1317,6 +1319,8 @@ CreateServiceW( SC_HANDLE hSCManager, LPCWSTR lpServiceName, if( lpLoadOrderGroup ) service_set_string( &val[n++], szGroup, lpLoadOrderGroup ); + /* FIXME: lpDependencies is used to create both DependOnService and DependOnGroup + * There is no such key as what szDependencies refers to */ if( lpDependencies ) service_set_multi_string( &val[n++], szDependencies, lpDependencies ); @@ -1324,7 +1328,7 @@ CreateServiceW( SC_HANDLE hSCManager, LPCWSTR lpServiceName, FIXME("Don't know how to add a Password for a service.\n"); if( lpServiceStartName ) - service_set_string( &val[n++], szDependOnService, lpServiceStartName ); + service_set_string( &val[n++], szObjectName, lpServiceStartName ); r = service_write_values( hKey, val, n ); if( r != ERROR_SUCCESS ) @@ -1811,7 +1815,7 @@ BOOL WINAPI QueryServiceConfigA( SC_HANDLE hService, LPQUERY_SERVICE_CONFIGA con MAP_STR( lpDisplayName ); #undef MAP_STR - *needed = p - buffer; + *needed = p - (LPSTR)config; ret = TRUE; done: @@ -1876,7 +1880,7 @@ QueryServiceConfigW( SC_HANDLE hService, total += sizeof(WCHAR); sz = 0; - r = RegQueryValueExW( hKey, szStart, 0, &type, NULL, &sz ); + r = RegQueryValueExW( hKey, szObjectName, 0, &type, NULL, &sz ); if( ( r == ERROR_SUCCESS ) && ( type == REG_SZ ) ) total += sz; @@ -2209,6 +2213,8 @@ BOOL WINAPI ChangeServiceConfigW( SC_HANDLE hService, DWORD dwServiceType, if( lpLoadOrderGroup ) service_set_string( &val[n++], szGroup, lpLoadOrderGroup ); + /* FIXME: lpDependencies is used to create/change both DependOnService and DependOnGroup + * There is no such key as what szDependencies refers to */ if( lpDependencies ) service_set_multi_string( &val[n++], szDependencies, lpDependencies ); @@ -2216,7 +2222,7 @@ BOOL WINAPI ChangeServiceConfigW( SC_HANDLE hService, DWORD dwServiceType, FIXME("ignoring password\n"); if( lpServiceStartName ) - service_set_string( &val[n++], szDependOnService, lpServiceStartName ); + service_set_string( &val[n++], szObjectName, lpServiceStartName ); r = service_write_values( hsvc->hkey, val, n ); diff --git a/dlls/advapi32/tests/Makefile.in b/dlls/advapi32/tests/Makefile.in index e5d9a9fd863..2036759dc61 100644 --- a/dlls/advapi32/tests/Makefile.in +++ b/dlls/advapi32/tests/Makefile.in @@ -14,7 +14,8 @@ CTESTS = \ crypt_sha.c \ lsa.c \ registry.c \ - security.c + security.c \ + service.c @MAKE_TEST_RULES@ diff --git a/dlls/advapi32/tests/service.c b/dlls/advapi32/tests/service.c new file mode 100644 index 00000000000..7dde5f54036 --- /dev/null +++ b/dlls/advapi32/tests/service.c @@ -0,0 +1,150 @@ +/* + * Unit tests for service functions + * + * Copyright (c) 2007 Paul Vriens + * + * 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 "windef.h" +#include "winbase.h" +#include "winerror.h" +#include "winsvc.h" + +#include "wine/test.h" + +static void test_sequence(void) +{ + SC_HANDLE scm_handle, svc_handle; + BOOL ret; + QUERY_SERVICE_CONFIGA *config; + DWORD given, needed; + static const CHAR servicename [] = "Winetest"; + static const CHAR displayname [] = "Winetest dummy service"; + static const CHAR pathname [] = "we_dont_care.exe"; + static const CHAR dependencies[] = "Master1\0Master2\0+MasterGroup1\0\0"; + static const CHAR password [] = ""; + static const CHAR empty [] = ""; + static const CHAR localsystem [] = "LocalSystem"; + + SetLastError(0xdeadbeef); + scm_handle = OpenSCManagerA(NULL, NULL, GENERIC_ALL); + + if (!scm_handle && (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)) + { + skip("OpenSCManagerA is not implemented\n"); + return; + } + else if (!scm_handle && (GetLastError() == ERROR_ACCESS_DENIED)) + { + skip("Not enough rights to get a handle to the manager\n"); + return; + } + else + ok(scm_handle != NULL, "Could not get a handle to the manager: %d\n", GetLastError()); + + if (!scm_handle) return; + + /* Create a dummy service */ + SetLastError(0xdeadbeef); + svc_handle = CreateServiceA(scm_handle, servicename, displayname, GENERIC_ALL, + SERVICE_INTERACTIVE_PROCESS | SERVICE_WIN32_OWN_PROCESS, SERVICE_DISABLED, SERVICE_ERROR_IGNORE, + pathname, NULL, NULL, dependencies, NULL, password); + + if (!svc_handle && (GetLastError() == ERROR_SERVICE_EXISTS)) + { + /* We try and open the service and do the rest of the tests. Some could + * fail if the tests were changed between these runs. + */ + trace("Deletion probably didn't work last time\n"); + SetLastError(0xdeadbeef); + svc_handle = OpenServiceA(scm_handle, servicename, GENERIC_ALL); + if (!svc_handle && (GetLastError() == ERROR_ACCESS_DENIED)) + { + skip("Not enough rights to open the service\n"); + CloseServiceHandle(scm_handle); + return; + } + ok(svc_handle != NULL, "Could not open the service : %d\n", GetLastError()); + } + else if (!svc_handle && (GetLastError() == ERROR_ACCESS_DENIED)) + { + skip("Not enough rights to create the service\n"); + CloseServiceHandle(scm_handle); + return; + } + else + ok(svc_handle != NULL, "Could not create the service : %d\n", GetLastError()); + + if (!svc_handle) return; + + /* TODO: + * Before we do a QueryServiceConfig we should check the registry. This will make sure + * that the correct keys are used. + */ + + /* Request the size for the buffer */ + SetLastError(0xdeadbeef); + ret = QueryServiceConfigA(svc_handle, NULL, 0, &needed); + ok(!ret, "Expected failure\n"); + ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError()); + + config = HeapAlloc(GetProcessHeap(), 0, needed); + given = needed; + SetLastError(0xdeadbeef); + ret = QueryServiceConfigA(svc_handle, config, given, &needed); + ok(ret, "Expected success\n"); + todo_wine + { + ok(GetLastError() == ERROR_SUCCESS /* W2K3 */|| + GetLastError() == 0xdeadbeef /* NT4, XP, Vista */ || + GetLastError() == ERROR_IO_PENDING /* W2K */, + "Expected ERROR_SUCCESS, ERROR_IO_PENDING or 0xdeadbeef, got %d\n", GetLastError()); + ok(given == needed, "Expected the given (%d) and needed (%d) buffersizes to be equal\n", given, needed); + } + ok(config->dwServiceType == (SERVICE_INTERACTIVE_PROCESS | SERVICE_WIN32_OWN_PROCESS), + "Expected SERVICE_INTERACTIVE_PROCESS | SERVICE_WIN32_OWN_PROCESS, got %d\n", config->dwServiceType); + ok(config->dwStartType == SERVICE_DISABLED, "Expected SERVICE_DISABLED, got %d\n", config->dwStartType); + ok(config->dwErrorControl == SERVICE_ERROR_IGNORE, "Expected SERVICE_ERROR_IGNORE, got %d\n", config->dwErrorControl); + ok(!strcmp(config->lpBinaryPathName, pathname), "Expected '%s', got '%s'\n", pathname, config->lpBinaryPathName); + ok(!strcmp(config->lpLoadOrderGroup, empty), "Expected an empty string, got '%s'\n", config->lpLoadOrderGroup); + ok(config->dwTagId == 0, "Expected 0, got %d\n", config->dwTagId); + /* TODO: Show the double 0 terminated string */ + todo_wine + ok(!memcmp(config->lpDependencies, dependencies, sizeof(dependencies)), "Wrong string\n"); + if(config->lpServiceStartName) /* FIXME: Wine workaround, remove when fixed */ + ok(!strcmp(config->lpServiceStartName, localsystem), "Expected 'LocalSystem', got '%s'\n", config->lpServiceStartName); + if(config->lpDisplayName) /* FIXME: Wine workaround, remove when fixed */ + ok(!strcmp(config->lpDisplayName, displayname), "Expected '%s', got '%s'\n", displayname, config->lpDisplayName); + + SetLastError(0xdeadbeef); + ret = DeleteService(svc_handle); + ok(ret, "Expected success\n"); + ok(GetLastError() == ERROR_SUCCESS /* W2K3 */|| + GetLastError() == 0xdeadbeef /* NT4, XP, Vista */ || + GetLastError() == ERROR_IO_PENDING /* W2K */, + "Expected ERROR_SUCCESS, ERROR_IO_PENDING or 0xdeadbeef, got %d\n", GetLastError()); + + CloseServiceHandle(svc_handle); + CloseServiceHandle(scm_handle); +} + +START_TEST(service) +{ + /* Test the creation, querying and deletion of a service */ + test_sequence(); +} diff --git a/dlls/amstream/amstream.c b/dlls/amstream/amstream.c index 422239c518a..692403bce66 100644 --- a/dlls/amstream/amstream.c +++ b/dlls/amstream/amstream.c @@ -260,7 +260,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_AddMediaStream(IAMMultiMediaStream hr = MediaStream_create((IMultiMediaStream*)iface, PurposeId, This->StreamType, &pStream); if (SUCCEEDED(hr)) { - pNewStreams = (IMediaStream**)CoTaskMemAlloc((This->nbStreams+1)*sizeof(IMediaStream*)); + pNewStreams = CoTaskMemAlloc((This->nbStreams+1)*sizeof(IMediaStream*)); if (!pNewStreams) { IMediaStream_Release(pStream); diff --git a/dlls/crypt32/str.c b/dlls/crypt32/str.c index c524b2b6d5e..ef2d2e3815f 100644 --- a/dlls/crypt32/str.c +++ b/dlls/crypt32/str.c @@ -876,8 +876,6 @@ DWORD WINAPI CertGetNameStringW(PCCERT_CONTEXT pCertContext, DWORD dwType, sizeof(simpleAttributeOIDs[0]); i++) nameAttr = CertFindRDNAttr(simpleAttributeOIDs[i], info); } - else - ret = 0; if (!nameAttr) { PCERT_EXTENSION ext = CertFindExtension(altNameOID, @@ -895,13 +893,14 @@ DWORD WINAPI CertGetNameStringW(PCCERT_CONTEXT pCertContext, DWORD dwType, * Failing that, look for the first attribute. */ FIXME("CERT_NAME_SIMPLE_DISPLAY_TYPE: stub\n"); - ret = 0; } } } if (nameAttr) ret = CertRDNValueToStrW(nameAttr->dwValueType, &nameAttr->Value, - pszNameString, cchNameString); + pszNameString, cchNameString); + else + ret = 0; if (info) LocalFree(info); break; diff --git a/dlls/dbghelp/msc.c b/dlls/dbghelp/msc.c index 0bd353e3a74..e6542e9371f 100644 --- a/dlls/dbghelp/msc.c +++ b/dlls/dbghelp/msc.c @@ -342,14 +342,13 @@ static int codeview_add_type(unsigned int typeno, struct symt* dt) { cv_current_module->num_defined_types += 0x100; if (cv_current_module->defined_types) - cv_current_module->defined_types = (struct symt**) - HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, - cv_current_module->defined_types, + cv_current_module->defined_types = HeapReAlloc(GetProcessHeap(), + HEAP_ZERO_MEMORY, cv_current_module->defined_types, cv_current_module->num_defined_types * sizeof(struct symt*)); else - cv_current_module->defined_types = (struct symt**) - HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, - cv_current_module->num_defined_types * sizeof(struct symt*)); + cv_current_module->defined_types = HeapAlloc(GetProcessHeap(), + HEAP_ZERO_MEMORY, + cv_current_module->num_defined_types * sizeof(struct symt*)); if (cv_current_module->defined_types == NULL) return FALSE; } @@ -1124,8 +1123,8 @@ static struct codeview_linetab* codeview_snarf_linetab(struct module* module, * There is one header for each segment, so that we can reach in * and pull bits as required. */ - lt_hdr = (struct codeview_linetab*) - HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (nseg + 1) * sizeof(*lt_hdr)); + lt_hdr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + (nseg + 1) * sizeof(*lt_hdr)); if (lt_hdr == NULL) { goto leave; diff --git a/dlls/ddraw/Makefile.in b/dlls/ddraw/Makefile.in index b31c052f932..f25bfc0615b 100644 --- a/dlls/ddraw/Makefile.in +++ b/dlls/ddraw/Makefile.in @@ -5,8 +5,7 @@ VPATH = @srcdir@ MODULE = ddraw.dll IMPORTLIB = libddraw.$(IMPLIBEXT) IMPORTS = ole32 user32 gdi32 advapi32 kernel32 ntdll -EXTRAINCL = @X_CFLAGS@ -EXTRALIBS = -ldxguid -luuid @X_LIBS@ @X_PRE_LIBS@ @XLIB@ @X_EXTRA_LIBS@ +EXTRALIBS = -ldxguid -luuid C_SRCS = \ clipper.c \ diff --git a/dlls/gdi32/painting.c b/dlls/gdi32/painting.c index 98bae3366ab..1b30d6d5cc3 100644 --- a/dlls/gdi32/painting.c +++ b/dlls/gdi32/painting.c @@ -812,6 +812,7 @@ BOOL WINAPI AngleArc(HDC hdc, INT x, INT y, DWORD dwRadius, FLOAT eStartAngle, F dc->CursPosX = x2; dc->CursPosY = y2; } + GDI_ReleaseObj( hdc ); return result; } diff --git a/dlls/gdi32/tests/bitmap.c b/dlls/gdi32/tests/bitmap.c index 353e2c59a07..019bb35dbe2 100644 --- a/dlls/gdi32/tests/bitmap.c +++ b/dlls/gdi32/tests/bitmap.c @@ -1036,8 +1036,8 @@ static void test_GetDIBits_selected_DIB(UINT bpp) /* Create a DIB section with a color table */ - info = (BITMAPINFO *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(BITMAPINFOHEADER) + (1 << bpp) * sizeof(RGBQUAD)); - info2 = (BITMAPINFO *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(BITMAPINFOHEADER) + (1 << bpp) * sizeof(RGBQUAD)); + info = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(BITMAPINFOHEADER) + (1 << bpp) * sizeof(RGBQUAD)); + info2 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(BITMAPINFOHEADER) + (1 << bpp) * sizeof(RGBQUAD)); assert(info); assert(info2); @@ -1167,8 +1167,8 @@ static void test_GetDIBits_selected_DDB(BOOL monochrome) } SelectObject(ddb_dc, old_bmp); - info = (BITMAPINFO *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)); - info2 = (BITMAPINFO *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)); + info = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)); + info2 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)); assert(info); assert(info2); diff --git a/dlls/gdi32/tests/metafile.c b/dlls/gdi32/tests/metafile.c index 3cc27d6a7e8..72100c86e22 100644 --- a/dlls/gdi32/tests/metafile.c +++ b/dlls/gdi32/tests/metafile.c @@ -1403,7 +1403,7 @@ static void test_SetWinMetaFileBits(void) return; } - buffer = (BYTE *)HeapAlloc(GetProcessHeap(), 0, buffer_size); + buffer = HeapAlloc(GetProcessHeap(), 0, buffer_size); ok(buffer != NULL, "HeapAlloc failed\n"); if (!buffer) { diff --git a/dlls/iccvid/iccvid.c b/dlls/iccvid/iccvid.c index 1bb9b1dedbd..b3e98bf8298 100644 --- a/dlls/iccvid/iccvid.c +++ b/dlls/iccvid/iccvid.c @@ -457,13 +457,13 @@ static void decode_cinepak(cinepak_info *cvinfo, unsigned char *buf, int size, for(i = cvinfo->strip_num; i < strips; i++) { - if((cvinfo->v4_codebook[i] = (cvid_codebook *)ICCVID_Alloc(sizeof(cvid_codebook), 260)) == NULL) + if((cvinfo->v4_codebook[i] = ICCVID_Alloc(sizeof(cvid_codebook), 260)) == NULL) { ERR("CVID: codebook v4 alloc err\n"); return; } - if((cvinfo->v1_codebook[i] = (cvid_codebook *)ICCVID_Alloc(sizeof(cvid_codebook), 260)) == NULL) + if((cvinfo->v1_codebook[i] = ICCVID_Alloc(sizeof(cvid_codebook), 260)) == NULL) { ERR("CVID: codebook v1 alloc err\n"); return; diff --git a/dlls/kernel32/tests/pipe.c b/dlls/kernel32/tests/pipe.c index 81159ab7993..1850e777c0b 100644 --- a/dlls/kernel32/tests/pipe.c +++ b/dlls/kernel32/tests/pipe.c @@ -848,7 +848,7 @@ static DWORD CALLBACK named_pipe_client_func(LPVOID p) ret = GetTokenInformation(process_token, TokenPrivileges, NULL, 0, &Size); ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetTokenInformation(TokenPrivileges) failed with %d\n", GetLastError()); - Privileges = (TOKEN_PRIVILEGES *)HeapAlloc(GetProcessHeap(), 0, Size); + Privileges = HeapAlloc(GetProcessHeap(), 0, Size); ret = GetTokenInformation(process_token, TokenPrivileges, Privileges, Size, &Size); ok(ret, "GetTokenInformation(TokenPrivileges) failed with %d\n", GetLastError()); diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c index a033096b7ec..7727c655e72 100644 --- a/dlls/kernel32/tests/virtual.c +++ b/dlls/kernel32/tests/virtual.c @@ -81,8 +81,8 @@ static void test_VirtualAllocEx(void) return; } - src = (char *) HeapAlloc( GetProcessHeap(), 0, alloc_size ); - dst = (char *) HeapAlloc( GetProcessHeap(), 0, alloc_size ); + src = HeapAlloc( GetProcessHeap(), 0, alloc_size ); + dst = HeapAlloc( GetProcessHeap(), 0, alloc_size ); for (i = 0; i < alloc_size; i++) src[i] = i & 0xff; diff --git a/dlls/mshtml/editor.c b/dlls/mshtml/editor.c index 42df6ccc7fe..2a025673522 100644 --- a/dlls/mshtml/editor.c +++ b/dlls/mshtml/editor.c @@ -43,6 +43,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml); #define NSCMD_CHARPREVIOUS "cmd_charPrevious" #define NSCMD_COPY "cmd_copy" #define NSCMD_CUT "cmd_cut" +#define NSCMD_DELETECHARFORWARD "cmd_deleteCharForward" +#define NSCMD_DELETEWORDFORWARD "cmd_deleteWordForward" #define NSCMD_FONTCOLOR "cmd_fontColor" #define NSCMD_FONTFACE "cmd_fontFace" #define NSCMD_INDENT "cmd_indent" @@ -75,10 +77,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml); #define NSALIGN_LEFT "left" #define NSALIGN_RIGHT "right" -#define DOM_VK_LEFT VK_LEFT -#define DOM_VK_UP VK_UP -#define DOM_VK_RIGHT VK_RIGHT -#define DOM_VK_DOWN VK_DOWN +#define DOM_VK_LEFT VK_LEFT +#define DOM_VK_UP VK_UP +#define DOM_VK_RIGHT VK_RIGHT +#define DOM_VK_DOWN VK_DOWN +#define DOM_VK_DELETE VK_DELETE static const WCHAR wszFont[] = {'f','o','n','t',0}; static const WCHAR wszSize[] = {'s','i','z','e',0}; @@ -487,7 +490,8 @@ static void handle_arrow_key(HTMLDocument *This, nsIDOMKeyEvent *event, const ch if(b) i |= 2; - do_ns_editor_command(This->nscontainer, cmds[i]); + if(cmds[i]) + do_ns_editor_command(This->nscontainer, cmds[i]); nsIDOMKeyEvent_PreventDefault(event); } @@ -550,7 +554,18 @@ void handle_edit_event(HTMLDocument *This, nsIDOMEvent *event) handle_arrow_key(This, key_event, cmds); break; } - }; + case DOM_VK_DELETE: { + static const char *cmds[] = { + NSCMD_DELETECHARFORWARD, + NSCMD_DELETEWORDFORWARD, + NULL, NULL + }; + + TRACE("delete\n"); + handle_arrow_key(This, key_event, cmds); + break; + } + } nsIDOMKeyEvent_Release(key_event); } @@ -564,6 +579,17 @@ static void set_ns_fontname(NSContainer *This, const char *fontname) nsICommandParams_Release(nsparam); } +static HRESULT exec_delete(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out) +{ + TRACE("(%p)->(%p %p)\n", This, in, out); + + if(This->nscontainer) + do_ns_editor_command(This->nscontainer, NSCMD_DELETECHARFORWARD); + + update_doc(This, UPDATE_UI); + return S_OK; +} + static HRESULT exec_fontname(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out) { TRACE("(%p)->(%p %p)\n", This, in, out); @@ -968,6 +994,10 @@ HRESULT editor_exec_paste(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VAR static HRESULT query_edit_status(HTMLDocument *This, OLECMD *cmd) { switch(cmd->cmdID) { + case IDM_DELETE: + TRACE("CGID_MSHTML: IDM_DELETE\n"); + cmd->cmdf = query_ns_edit_status(This, NULL); + break; case IDM_FONTNAME: TRACE("CGID_MSHTML: IDM_FONTNAME\n"); cmd->cmdf = query_ns_edit_status(This, NULL); @@ -1018,6 +1048,7 @@ static HRESULT query_edit_status(HTMLDocument *This, OLECMD *cmd) } const cmdtable_t editmode_cmds[] = { + {IDM_DELETE, query_edit_status, exec_delete}, {IDM_FONTNAME, query_edit_status, exec_fontname}, {IDM_FONTSIZE, query_edit_status, exec_fontsize}, {IDM_FORECOLOR, query_edit_status, exec_forecolor}, diff --git a/dlls/mshtml/tests/htmldoc.c b/dlls/mshtml/tests/htmldoc.c index 0faa66e47e3..82bbbed54b3 100644 --- a/dlls/mshtml/tests/htmldoc.c +++ b/dlls/mshtml/tests/htmldoc.c @@ -2705,6 +2705,7 @@ static void test_MSHTML_QueryStatus(IUnknown *unk, DWORD cmdf) test_QueryStatus(unk, &CGID_MSHTML, IDM_UNORDERLIST, cmdf); test_QueryStatus(unk, &CGID_MSHTML, IDM_INDENT, cmdf); test_QueryStatus(unk, &CGID_MSHTML, IDM_OUTDENT, cmdf); + test_QueryStatus(unk, &CGID_MSHTML, IDM_DELETE, cmdf); } static void test_OleCommandTarget(IUnknown *unk) diff --git a/dlls/msi/action.c b/dlls/msi/action.c index 01b5abbc0c0..b550e54d6e4 100644 --- a/dlls/msi/action.c +++ b/dlls/msi/action.c @@ -1982,8 +1982,11 @@ static LPWSTR msi_get_disk_file_version( LPCWSTR filename ) version = msi_alloc( versize ); GetFileVersionInfoW( filename, 0, versize, version ); - VerQueryValueW( version, name, (LPVOID*)&lpVer, &sz ); - msi_free( version ); + if (!VerQueryValueW( version, name, (LPVOID*)&lpVer, &sz )) + { + msi_free( version ); + return NULL; + } sprintfW( filever, name_fmt, HIWORD(lpVer->dwFileVersionMS), @@ -1991,6 +1994,8 @@ static LPWSTR msi_get_disk_file_version( LPCWSTR filename ) HIWORD(lpVer->dwFileVersionLS), LOWORD(lpVer->dwFileVersionLS)); + msi_free( version ); + return strdupW( filever ); } @@ -3237,12 +3242,17 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package) /* for registry stuff */ HKEY hkey=0; HKEY hukey=0; + HKEY hudkey=0, props=0; static const WCHAR szProductLanguage[] = {'P','r','o','d','u','c','t','L','a','n','g','u','a','g','e',0}; static const WCHAR szARPProductIcon[] = {'A','R','P','P','R','O','D','U','C','T','I','C','O','N',0}; static const WCHAR szProductVersion[] = {'P','r','o','d','u','c','t','V','e','r','s','i','o','n',0}; + static const WCHAR szInstallProperties[] = + {'I','n','s','t','a','l','l','P','r','o','p','e','r','t','i','e','s',0}; + static const WCHAR szWindowsInstaller[] = + {'W','i','n','d','o','w','s','I','n','s','t','a','l','l','e','r',0}; DWORD langid; LPWSTR buffer; DWORD size; @@ -3267,6 +3277,15 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package) if (rc != ERROR_SUCCESS) goto end; + rc = MSIREG_OpenUserDataProductKey(package->ProductCode,&hudkey,TRUE); + if (rc != ERROR_SUCCESS) + goto end; + + rc = RegCreateKeyW(hudkey, szInstallProperties, &props); + if (rc != ERROR_SUCCESS) + goto end; + + msi_reg_set_val_dword( props, szWindowsInstaller, 1 ); buffer = msi_dup_property( package, INSTALLPROPERTY_PRODUCTNAMEW ); msi_reg_set_val_str( hukey, INSTALLPROPERTY_PRODUCTNAMEW, buffer ); @@ -3330,9 +3349,10 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package) } end: - RegCloseKey(hkey); RegCloseKey(hukey); + RegCloseKey(hudkey); + RegCloseKey(props); return rc; } diff --git a/dlls/msi/custom.c b/dlls/msi/custom.c index 2ea73f9b678..cd38af6fd7a 100644 --- a/dlls/msi/custom.c +++ b/dlls/msi/custom.c @@ -493,6 +493,7 @@ static UINT wait_process_handle(MSIPACKAGE* package, UINT type, typedef struct _msi_custom_action_info { struct list entry; + LONG refs; MSIPACKAGE *package; LPWSTR source; LPWSTR target; @@ -502,20 +503,31 @@ typedef struct _msi_custom_action_info { GUID guid; } msi_custom_action_info; -static void free_custom_action_data( msi_custom_action_info *info ) +static void release_custom_action_data( msi_custom_action_info *info ) { EnterCriticalSection( &msi_custom_action_cs ); - list_remove( &info->entry ); + + if (!--info->refs) + { + list_remove( &info->entry ); + if (info->handle) + CloseHandle( info->handle ); + msi_free( info->action ); + msi_free( info->source ); + msi_free( info->target ); + msiobj_release( &info->package->hdr ); + msi_free( info ); + } + LeaveCriticalSection( &msi_custom_action_cs ); - if (info->handle) - CloseHandle( info->handle ); - msi_free( info->action ); - msi_free( info->source ); - msi_free( info->target ); - msiobj_release( &info->package->hdr ); - msi_free( info ); } +/* must be called inside msi_custom_action_cs if info is in the pending custom actions list */ +static void addref_custom_action_data( msi_custom_action_info *info ) +{ + info->refs++; + } + static UINT wait_thread_handle( msi_custom_action_info *info ) { UINT rc = ERROR_SUCCESS; @@ -529,7 +541,7 @@ static UINT wait_thread_handle( msi_custom_action_info *info ) if (!(info->type & msidbCustomActionTypeContinue)) rc = custom_get_thread_return( info->package, info->handle ); - free_custom_action_data( info ); + release_custom_action_data( info ); } else { @@ -550,6 +562,7 @@ static msi_custom_action_info *find_action_by_guid( const GUID *guid ) { if (IsEqualGUID( &info->guid, guid )) { + addref_custom_action_data( info ); found = TRUE; break; } @@ -657,7 +670,7 @@ static DWORD WINAPI ACTION_CallDllFunction( const GUID *guid ) if (info->type & msidbCustomActionTypeAsync && info->type & msidbCustomActionTypeContinue) - free_custom_action_data( info ); + release_custom_action_data( info ); return r; } @@ -694,6 +707,8 @@ static DWORD WINAPI ACTION_CAInstallPackage(const GUID *guid) r = MsiInstallProductW(info->source, info->target); MsiSetInternalUI(old_level, NULL); + release_custom_action_data(info); + return r; } @@ -722,6 +737,7 @@ static msi_custom_action_info *do_msidbCustomActionTypeDll( return NULL; msiobj_addref( &package->hdr ); + info->refs = 2; /* 1 for our caller and 1 for thread we created */ info->package = package; info->type = type; info->target = strdupW( target ); @@ -736,7 +752,9 @@ static msi_custom_action_info *do_msidbCustomActionTypeDll( info->handle = CreateThread( NULL, 0, DllThread, &info->guid, 0, NULL ); if (!info->handle) { - free_custom_action_data( info ); + /* release both references */ + release_custom_action_data( info ); + release_custom_action_data( info ); return NULL; } @@ -753,6 +771,7 @@ static msi_custom_action_info *do_msidbCAConcurrentInstall( return NULL; msiobj_addref( &package->hdr ); + info->refs = 2; /* 1 for our caller and 1 for thread we created */ info->package = package; info->type = type; info->target = strdupW( target ); @@ -767,7 +786,9 @@ static msi_custom_action_info *do_msidbCAConcurrentInstall( info->handle = CreateThread( NULL, 0, ConcurrentInstallThread, &info->guid, 0, NULL ); if (!info->handle) { - free_custom_action_data( info ); + /* release both references */ + release_custom_action_data( info ); + release_custom_action_data( info ); return NULL; } @@ -1103,7 +1124,7 @@ static DWORD WINAPI ACTION_CallScript( const GUID *guid ) if (info->type & msidbCustomActionTypeAsync && info->type & msidbCustomActionTypeContinue) - free_custom_action_data( info ); + release_custom_action_data( info ); return S_OK; } @@ -1133,6 +1154,7 @@ static msi_custom_action_info *do_msidbCustomActionTypeScript( return NULL; msiobj_addref( &package->hdr ); + info->refs = 2; /* 1 for our caller and 1 for thread we created */ info->package = package; info->type = type; info->target = strdupW( function ); @@ -1147,7 +1169,9 @@ static msi_custom_action_info *do_msidbCustomActionTypeScript( info->handle = CreateThread( NULL, 0, ScriptThread, &info->guid, 0, NULL ); if (!info->handle) { - free_custom_action_data( info ); + /* release both references */ + release_custom_action_data( info ); + release_custom_action_data( info ); return NULL; } @@ -1329,7 +1353,6 @@ void ACTION_FinishCustomActions(const MSIPACKAGE* package) { if (DuplicateHandle(GetCurrentProcess(), info->handle, GetCurrentProcess(), &wait_handles[handle_count], SYNCHRONIZE, FALSE, 0)) handle_count++; - free_custom_action_data( info ); } } diff --git a/dlls/msi/handle.c b/dlls/msi/handle.c index 6af3c4110f5..ae42d84729b 100644 --- a/dlls/msi/handle.c +++ b/dlls/msi/handle.c @@ -18,6 +18,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#define COBJMACROS + #include #include "windef.h" @@ -53,12 +55,16 @@ static CRITICAL_SECTION MSI_object_cs = { &MSI_object_cs_debug, -1, 0, 0, 0, 0 } typedef struct msi_handle_info_t { - MSIOBJECTHDR *obj; + BOOL remote; + union { + MSIOBJECTHDR *obj; + IUnknown *unk; + } u; DWORD dwThreadId; } msi_handle_info; static msi_handle_info *msihandletable = NULL; -static int msihandletable_size = 0; +static unsigned int msihandletable_size = 0; void msi_free_handle_table(void) { @@ -67,16 +73,13 @@ void msi_free_handle_table(void) msihandletable_size = 0; } -MSIHANDLE alloc_msihandle( MSIOBJECTHDR *obj ) +static MSIHANDLE alloc_handle_table_entry(void) { - MSIHANDLE ret = 0; UINT i; - EnterCriticalSection( &MSI_handle_cs ); - /* find a slot */ for(i=0; iu.obj = obj; + entry->dwThreadId = GetCurrentThreadId(); + entry->remote = FALSE; + } + + LeaveCriticalSection( &MSI_handle_cs ); - msiobj_addref( obj ); - msihandletable[i].obj = obj; - msihandletable[i].dwThreadId = GetCurrentThreadId(); - ret = (MSIHANDLE) (i+1); -out: TRACE("%p -> %ld\n", obj, ret ); + return ret; +} + +MSIHANDLE alloc_msi_remote_handle( IUnknown *unk ) +{ + msi_handle_info *entry; + MSIHANDLE ret; + + EnterCriticalSection( &MSI_handle_cs ); + + ret = alloc_handle_table_entry(); + if (ret) + { + entry = &msihandletable[ ret - 1 ]; + IUnknown_AddRef( unk ); + entry->u.unk = unk; + entry->dwThreadId = GetCurrentThreadId(); + entry->remote = TRUE; + } + LeaveCriticalSection( &MSI_handle_cs ); + + TRACE("%p -> %ld\n", unk, ret); + return ret; } @@ -116,17 +158,17 @@ void *msihandle2msiinfo(MSIHANDLE handle, UINT type) EnterCriticalSection( &MSI_handle_cs ); handle--; - if( handle<0 ) + if( handle >= msihandletable_size ) goto out; - if( handle>=msihandletable_size ) + if( msihandletable[handle].remote) goto out; - if( !msihandletable[handle].obj ) + if( !msihandletable[handle].u.obj ) goto out; - if( msihandletable[handle].obj->magic != MSIHANDLE_MAGIC ) + if( msihandletable[handle].u.obj->magic != MSIHANDLE_MAGIC ) goto out; - if( type && (msihandletable[handle].obj->type != type) ) + if( type && (msihandletable[handle].u.obj->type != type) ) goto out; - ret = msihandletable[handle].obj; + ret = msihandletable[handle].u.obj; msiobj_addref( ret ); out: @@ -135,6 +177,26 @@ out: return (void*) ret; } +IUnknown *msi_get_remote( MSIHANDLE handle ) +{ + IUnknown *unk = NULL; + + EnterCriticalSection( &MSI_handle_cs ); + handle--; + if( handle>=msihandletable_size ) + goto out; + if( !msihandletable[handle].remote) + goto out; + unk = msihandletable[handle].u.unk; + if( unk ) + IUnknown_AddRef( unk ); + +out: + LeaveCriticalSection( &MSI_handle_cs ); + + return unk; +} + void *alloc_msiobject(UINT type, UINT size, msihandledestructor destroy ) { MSIOBJECTHDR *info; @@ -205,7 +267,7 @@ int msiobj_release( MSIOBJECTHDR *info ) */ UINT WINAPI MsiCloseHandle(MSIHANDLE handle) { - MSIOBJECTHDR *info; + MSIOBJECTHDR *info = NULL; UINT ret = ERROR_INVALID_HANDLE; TRACE("%lx\n",handle); @@ -215,21 +277,34 @@ UINT WINAPI MsiCloseHandle(MSIHANDLE handle) EnterCriticalSection( &MSI_handle_cs ); - info = msihandle2msiinfo(handle, 0); - if( !info ) + handle--; + if (handle >= msihandletable_size) goto out; - if( info->magic != MSIHANDLE_MAGIC ) + if (msihandletable[handle].remote) { - ERR("Invalid handle!\n"); - goto out; + IUnknown_Release( msihandletable[handle].u.unk ); + } + else + { + info = msihandletable[handle].u.obj; + if( !info ) + goto out; + + if( info->magic != MSIHANDLE_MAGIC ) + { + ERR("Invalid handle!\n"); + goto out; + } } - msiobj_release( info ); - msihandletable[handle-1].obj = NULL; + msihandletable[handle].u.obj = NULL; + msihandletable[handle].remote = 0; + msihandletable[handle].dwThreadId = 0; + ret = ERROR_SUCCESS; - TRACE("handle %lx Destroyed\n", handle); + TRACE("handle %lx destroyed\n", handle+1); out: LeaveCriticalSection( &MSI_handle_cs ); if( info ) diff --git a/dlls/msi/msi.c b/dlls/msi/msi.c index 2042695ef6a..5e20ce2e39c 100644 --- a/dlls/msi/msi.c +++ b/dlls/msi/msi.c @@ -762,46 +762,57 @@ INSTALLSTATE WINAPI MsiQueryProductStateA(LPCSTR szProduct) INSTALLSTATE WINAPI MsiQueryProductStateW(LPCWSTR szProduct) { UINT rc; - INSTALLSTATE rrc = INSTALLSTATE_UNKNOWN; - HKEY hkey = 0; - static const WCHAR szWindowsInstaller[] = { - 'W','i','n','d','o','w','s','I','n','s','t','a','l','l','e','r',0 }; + INSTALLSTATE state = INSTALLSTATE_UNKNOWN; + HKEY hkey = 0, props = 0; DWORD sz; + BOOL userkey_exists = FALSE; + + static const int GUID_LEN = 38; + static const WCHAR szInstallProperties[] = { + 'I','n','s','t','a','l','l','P','r','o','p','e','r','t','i','e','s',0 + }; + static const WCHAR szWindowsInstaller[] = { + 'W','i','n','d','o','w','s','I','n','s','t','a','l','l','e','r',0 + }; TRACE("%s\n", debugstr_w(szProduct)); - if (!szProduct) + if (!szProduct || !*szProduct || lstrlenW(szProduct) != GUID_LEN) return INSTALLSTATE_INVALIDARG; rc = MSIREG_OpenUserProductsKey(szProduct,&hkey,FALSE); + if (rc == ERROR_SUCCESS) + { + userkey_exists = TRUE; + state = INSTALLSTATE_ADVERTISED; + RegCloseKey(hkey); + } + + rc = MSIREG_OpenUserDataProductKey(szProduct,&hkey,FALSE); if (rc != ERROR_SUCCESS) goto end; - RegCloseKey(hkey); - - rc = MSIREG_OpenUninstallKey(szProduct,&hkey,FALSE); + rc = RegOpenKeyW(hkey, szInstallProperties, &props); if (rc != ERROR_SUCCESS) goto end; - sz = sizeof(rrc); - rc = RegQueryValueExW(hkey,szWindowsInstaller,NULL,NULL,(LPVOID)&rrc, &sz); + sz = sizeof(state); + rc = RegQueryValueExW(props,szWindowsInstaller,NULL,NULL,(LPVOID)&state, &sz); if (rc != ERROR_SUCCESS) goto end; - switch (rrc) - { - case 1: - /* default */ - rrc = INSTALLSTATE_DEFAULT; - break; - default: - FIXME("Unknown install state read from registry (%i)\n",rrc); - rrc = INSTALLSTATE_UNKNOWN; - break; - } + if (state) + state = INSTALLSTATE_DEFAULT; + else + state = INSTALLSTATE_UNKNOWN; + + if (state == INSTALLSTATE_DEFAULT && !userkey_exists) + state = INSTALLSTATE_ABSENT; + end: + RegCloseKey(props); RegCloseKey(hkey); - return rrc; + return state; } INSTALLUILEVEL WINAPI MsiSetInternalUI(INSTALLUILEVEL dwUILevel, HWND *phWnd) diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h index 3dd0cb33d44..be5f2b1ebbb 100644 --- a/dlls/msi/msipriv.h +++ b/dlls/msi/msipriv.h @@ -577,7 +577,7 @@ extern MSICONDITION MSI_DatabaseIsTablePersistent( MSIDATABASE *db, LPCWSTR tabl extern UINT read_raw_stream_data( MSIDATABASE *db, LPCWSTR stname, USHORT **pdata, UINT *psz ); extern UINT read_stream_data( IStorage *stg, LPCWSTR stname, - USHORT **pdata, UINT *psz ); + BYTE **pdata, UINT *psz ); extern UINT write_stream_data( IStorage *stg, LPCWSTR stname, LPCVOID data, UINT sz, BOOL bTable ); @@ -675,6 +675,7 @@ extern UINT MSIREG_OpenComponents(HKEY* key); extern UINT MSIREG_OpenUserComponentsKey(LPCWSTR szComponent, HKEY* key, BOOL create); extern UINT MSIREG_OpenComponentsKey(LPCWSTR szComponent, HKEY* key, BOOL create); extern UINT MSIREG_OpenProductsKey(LPCWSTR szProduct, HKEY* key, BOOL create); +extern UINT MSIREG_OpenUserDataProductKey(LPCWSTR szProduct, HKEY* key, BOOL create); extern UINT MSIREG_OpenUserFeaturesKey(LPCWSTR szProduct, HKEY* key, BOOL create); extern UINT MSIREG_OpenUserComponentsKey(LPCWSTR szComponent, HKEY* key, BOOL create); extern UINT MSIREG_OpenUpgradeCodesKey(LPCWSTR szProduct, HKEY* key, BOOL create); diff --git a/dlls/msi/registry.c b/dlls/msi/registry.c index 14a475451c6..21e0804ecc6 100644 --- a/dlls/msi/registry.c +++ b/dlls/msi/registry.c @@ -36,6 +36,7 @@ #include "wine/unicode.h" #include "winver.h" #include "winuser.h" +#include "sddl.h" WINE_DEFAULT_DEBUG_CHANNEL(msi); @@ -140,6 +141,15 @@ static const WCHAR szInstaller_UserUpgradeCodes_fmt[] = { 'U','p','g','r','a','d','e','C','o','d','e','s','\\', '%','s',0}; +static const WCHAR szUserDataProd_fmt[] = { +'S','o','f','t','w','a','r','e','\\', +'M','i','c','r','o','s','o','f','t','\\', +'W','i','n','d','o','w','s','\\', +'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', +'I','n','s','t','a','l','l','e','r','\\', +'U','s','e','r','D','a','t','a','\\', +'%','s','\\','P','r','o','d','u','c','t','s','\\','%','s',0}; + #define SQUISH_GUID_SIZE 33 @@ -501,6 +511,55 @@ UINT MSIREG_OpenUserComponentsKey(LPCWSTR szComponent, HKEY* key, BOOL create) return rc; } +static UINT get_user_sid(LPWSTR *usersid) +{ + HANDLE token; + BYTE buf[1024]; + DWORD size; + PTOKEN_USER user; + + if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token)) + return ERROR_FUNCTION_FAILED; + + size = sizeof(buf); + if (!GetTokenInformation(token, TokenUser, (void *)buf, size, &size)) + return ERROR_FUNCTION_FAILED; + + user = (PTOKEN_USER)buf; + if (!ConvertSidToStringSidW(user->User.Sid, usersid)) + return ERROR_FUNCTION_FAILED; + + return ERROR_SUCCESS; +} + +UINT MSIREG_OpenUserDataProductKey(LPCWSTR szProduct, HKEY *key, BOOL create) +{ + UINT rc; + WCHAR squished_pc[GUID_SIZE]; + WCHAR keypath[0x200]; + LPWSTR usersid; + + TRACE("%s\n", debugstr_w(szProduct)); + squash_guid(szProduct, squished_pc); + TRACE("squished (%s)\n", debugstr_w(squished_pc)); + + rc = get_user_sid(&usersid); + if (rc != ERROR_SUCCESS || !usersid) + { + ERR("Failed to retrieve user SID: %d\n", rc); + return rc; + } + + sprintfW(keypath, szUserDataProd_fmt, usersid, squished_pc); + + if (create) + rc = RegCreateKeyW(HKEY_LOCAL_MACHINE, keypath, key); + else + rc = RegOpenKeyW(HKEY_LOCAL_MACHINE, keypath, key); + + return rc; +} + UINT MSIREG_OpenProducts(HKEY* key) { return RegCreateKeyW(HKEY_LOCAL_MACHINE,szInstaller_Products,key); diff --git a/dlls/msi/string.c b/dlls/msi/string.c index 932b6240149..fe1f5cc7c1b 100644 --- a/dlls/msi/string.c +++ b/dlls/msi/string.c @@ -81,6 +81,12 @@ static string_table *init_stringtable( int entries, UINT codepage ) string_table *st; int i; + if (codepage != CP_ACP && !IsValidCodePage(codepage)) + { + ERR("invalid codepage %d\n", codepage); + return NULL; + } + st = msi_alloc( sizeof (string_table) ); if( !st ) return NULL; @@ -269,7 +275,6 @@ int msi_addstringW( string_table *st, UINT n, const WCHAR *data, int len, UINT r str = msi_alloc( (len+1)*sizeof(WCHAR) ); if( !str ) return -1; - TRACE("%d\n",__LINE__); memcpy( str, data, len*sizeof(WCHAR) ); str[len] = 0; @@ -516,27 +521,26 @@ string_table *msi_load_string_table( IStorage *stg, UINT *bytes_per_strref ) UINT r, datasize = 0, poolsize = 0, codepage; DWORD i, count, offset, len, n, refs; - static const USHORT large_str_sig[] = { 0x0000, 0x8000 }; - - r = read_stream_data( stg, szStringPool, &pool, &poolsize ); + r = read_stream_data( stg, szStringPool, (BYTE **)&pool, &poolsize ); if( r != ERROR_SUCCESS) goto end; - r = read_stream_data( stg, szStringData, (USHORT**)&data, &datasize ); + r = read_stream_data( stg, szStringData, (BYTE **)&data, &datasize ); if( r != ERROR_SUCCESS) goto end; - if ( !memcmp(pool, large_str_sig, sizeof(large_str_sig)) ) + if ( (poolsize > 4) && (pool[1] & 0x8000) ) *bytes_per_strref = LONG_STR_BYTES; else *bytes_per_strref = sizeof(USHORT); - /* FIXME: don't know where the codepage is in large str tables */ count = poolsize/4; - if( poolsize > 4 && *bytes_per_strref != LONG_STR_BYTES ) - codepage = pool[0] | ( pool[1] << 16 ); + if( poolsize > 4 ) + codepage = pool[0] | ( (pool[1] & ~0x8000) << 16 ); else codepage = CP_ACP; st = init_stringtable( count, codepage ); + if (!st) + goto end; offset = 0; n = 1; diff --git a/dlls/msi/table.c b/dlls/msi/table.c index cf706d8adf2..3541c2da48e 100644 --- a/dlls/msi/table.c +++ b/dlls/msi/table.c @@ -125,6 +125,8 @@ void msi_table_set_strref(UINT bytes_per_strref) static inline UINT bytes_per_column( const MSICOLUMNINFO *col ) { + if( MSITYPE_IS_BINARY(col->type) ) + return 2; if( col->type & MSITYPE_STRING ) return _Columns_cols[1].offset; if( (col->type & 0xff) > 4 ) @@ -261,7 +263,7 @@ void enum_stream_names( IStorage *stg ) } UINT read_stream_data( IStorage *stg, LPCWSTR stname, - USHORT **pdata, UINT *psz ) + BYTE **pdata, UINT *psz ) { HRESULT r; UINT ret = ERROR_FUNCTION_FAILED; @@ -504,7 +506,7 @@ static UINT read_table_from_storage( MSITABLE *t, IStorage *stg ) row_size = msi_table_get_row_size( t->colinfo, t->col_count ); /* if we can't read the table, just assume that it's empty */ - read_stream_data( stg, t->name, (USHORT **)&rawdata, &rawsize ); + read_stream_data( stg, t->name, &rawdata, &rawsize ); if( !rawdata ) return ERROR_SUCCESS; @@ -1750,14 +1752,27 @@ MSICONDITION MSI_DatabaseIsTablePersistent( MSIDATABASE *db, LPCWSTR table ) return MSICONDITION_FALSE; } +static UINT read_raw_int(const BYTE *data, UINT col, UINT bytes) +{ + UINT ret = 0, i; + + for (i = 0; i < bytes; i++) + ret += (data[col + i] << i * 8); + + return ret; +} + static MSIRECORD *msi_get_transform_record( const MSITABLEVIEW *tv, const string_table *st, - const USHORT *rawdata ) + const BYTE *rawdata, UINT bytes_per_strref ) { UINT i, val, ofs = 0; - USHORT mask = *rawdata++; + USHORT mask; MSICOLUMNINFO *columns = tv->columns; MSIRECORD *rec; + mask = rawdata[0] | (rawdata[1] << 8); + rawdata += 2; + rec = MSI_CreateRecord( tv->num_cols ); if( !rec ) return rec; @@ -1765,43 +1780,46 @@ static MSIRECORD *msi_get_transform_record( const MSITABLEVIEW *tv, const string TRACE("row ->\n"); for( i=0; inum_cols; i++ ) { - UINT n = bytes_per_column( &columns[i] ); - if ( (mask&1) && (i>=(mask>>8)) ) break; /* all keys must be present */ if ( (~mask&1) && (~columns[i].type & MSITYPE_KEY) && ((1<columns[i].type) ) { - case 2: - val = rawdata[ofs]; - if( (columns[i].type & MSITYPE_STRING) && - ! MSITYPE_IS_BINARY(tv->columns[i].type) ) - { - LPCWSTR sval = msi_string_lookup_id( st, val ); - MSI_RecordSetStringW( rec, i+1, sval ); - TRACE(" field %d [%s]\n", i+1, debugstr_w(sval)); - } - else + LPCWSTR sval; + + val = read_raw_int(rawdata, ofs, bytes_per_strref); + sval = msi_string_lookup_id( st, val ); + MSI_RecordSetStringW( rec, i+1, sval ); + TRACE(" field %d [%s]\n", i+1, debugstr_w(sval)); + ofs += bytes_per_strref; + } + else + { + UINT n = bytes_per_column( &columns[i] ); + switch( n ) { + case 2: + val = read_raw_int(rawdata, ofs, n); if (val) MSI_RecordSetInteger( rec, i+1, val^0x8000 ); TRACE(" field %d [0x%04x]\n", i+1, val ); + break; + case 4: + val = read_raw_int(rawdata, ofs, n); + if (val) + MSI_RecordSetInteger( rec, i+1, val^0x80000000 ); + TRACE(" field %d [0x%08x]\n", i+1, val ); + break; + default: + ERR("oops - unknown column width %d\n", n); + break; } - break; - case 4: - val = (rawdata[ofs] + (rawdata[ofs + 1]<<16)); - if (val) - MSI_RecordSetInteger( rec, i+1, val^0x80000000 ); - TRACE(" field %d [0x%08x]\n", i+1, val ); - break; - default: - ERR("oops - unknown column width %d\n", n); - break; + ofs += n; } - ofs += n/2; } return rec; } @@ -1927,10 +1945,11 @@ static UINT msi_table_find_row( MSITABLEVIEW *tv, MSIRECORD *rec, UINT *row ) } static UINT msi_table_load_transform( MSIDATABASE *db, IStorage *stg, - string_table *st, LPCWSTR name ) + string_table *st, LPCWSTR name, + UINT bytes_per_strref ) { UINT rawsize = 0; - USHORT *rawdata = NULL; + BYTE *rawdata = NULL; MSITABLEVIEW *tv = NULL; UINT r, n, sz, i, mask; MSIRECORD *rec = NULL; @@ -1962,9 +1981,9 @@ static UINT msi_table_load_transform( MSIDATABASE *db, IStorage *stg, /* interpret the data */ r = ERROR_SUCCESS; - for( n=0; n < (rawsize/2); ) + for( n=0; n < rawsize; ) { - mask = rawdata[n]; + mask = rawdata[n] | (rawdata[n+1] << 8); if (mask&1) { @@ -1972,23 +1991,37 @@ static UINT msi_table_load_transform( MSIDATABASE *db, IStorage *stg, * if the low bit is set, columns are continuous and * the number of columns is specified in the high byte */ - sz = 2 + tv->row_size; + sz = 2; + for( i=0; inum_cols; i++ ) + { + if( (tv->columns[i].type & MSITYPE_STRING) && + ! MSITYPE_IS_BINARY(tv->columns[i].type) ) + sz += bytes_per_strref; + else + sz += bytes_per_column( &tv->columns[i] ); + } } else { /* - * If the low bit is not set, rowdata[n] is a bitmask. + * If the low bit is not set, mask is a bitmask. * Excepting for key fields, which are always present, * each bit indicates that a field is present in the transform record. * - * rawdata[n] == 0 is a special case ... only the keys will be present + * mask == 0 is a special case ... only the keys will be present * and it means that this row should be deleted. */ sz = 2; for( i=0; inum_cols; i++ ) { if( (tv->columns[i].type & MSITYPE_KEY) || ((1<columns[i] ); + { + if( (tv->columns[i].type & MSITYPE_STRING) && + ! MSITYPE_IS_BINARY(tv->columns[i].type) ) + sz += bytes_per_strref; + else + sz += bytes_per_column( &tv->columns[i] ); + } } } @@ -1996,11 +2029,11 @@ static UINT msi_table_load_transform( MSIDATABASE *db, IStorage *stg, if ( (n+sz) > rawsize ) { ERR("borked.\n"); - dump_table( st, rawdata, rawsize ); + dump_table( st, (USHORT *)rawdata, rawsize ); break; } - rec = msi_get_transform_record( tv, st, &rawdata[n] ); + rec = msi_get_transform_record( tv, st, &rawdata[n], bytes_per_strref ); if (rec) { if ( mask & 1 ) @@ -2056,7 +2089,7 @@ static UINT msi_table_load_transform( MSIDATABASE *db, IStorage *stg, msiobj_release( &rec->hdr ); } - n += sz/2; + n += sz; } err: @@ -2082,10 +2115,11 @@ UINT msi_table_apply_transform( MSIDATABASE *db, IStorage *stg ) WCHAR name[0x40]; string_table *strings; UINT ret = ERROR_FUNCTION_FAILED; + UINT bytes_per_strref; TRACE("%p %p\n", db, stg ); - strings = msi_load_string_table( stg, &db->bytes_per_strref ); + strings = msi_load_string_table( stg, &bytes_per_strref ); if( !strings ) goto end; @@ -2097,11 +2131,11 @@ UINT msi_table_apply_transform( MSIDATABASE *db, IStorage *stg ) * Apply _Tables and _Columns transforms first so that * the table metadata is correct, and empty tables exist. */ - ret = msi_table_load_transform( db, stg, strings, szTables ); + ret = msi_table_load_transform( db, stg, strings, szTables, bytes_per_strref ); if (ret != ERROR_SUCCESS && ret != ERROR_INVALID_TABLE) goto end; - ret = msi_table_load_transform( db, stg, strings, szColumns ); + ret = msi_table_load_transform( db, stg, strings, szColumns, bytes_per_strref ); if (ret != ERROR_SUCCESS && ret != ERROR_INVALID_TABLE) goto end; @@ -2126,7 +2160,7 @@ UINT msi_table_apply_transform( MSIDATABASE *db, IStorage *stg ) !lstrcmpW( name+1, szTables ) ) continue; - ret = msi_table_load_transform( db, stg, strings, name+1 ); + ret = msi_table_load_transform( db, stg, strings, name+1, bytes_per_strref ); } if ( ret == ERROR_SUCCESS ) diff --git a/dlls/msi/tests/automation.c b/dlls/msi/tests/automation.c index 7308671c16c..0189062291d 100644 --- a/dlls/msi/tests/automation.c +++ b/dlls/msi/tests/automation.c @@ -2215,7 +2215,7 @@ static void test_Installer_InstallProduct(LPCWSTR szPath) ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); res = find_registry_key(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData", "05FA3C1F65B896A40AC00077F34EF203", &hkey); - todo_wine ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); if (res == ERROR_SUCCESS) { res = delete_registry_key(hkey, "05FA3C1F65B896A40AC00077F34EF203"); diff --git a/dlls/msi/tests/msi.c b/dlls/msi/tests/msi.c index 4e5db4f3dd9..08b66203afe 100644 --- a/dlls/msi/tests/msi.c +++ b/dlls/msi/tests/msi.c @@ -22,6 +22,7 @@ #include #include #include +#include #include "wine/test.h" @@ -260,6 +261,195 @@ static void test_filehash(void) DeleteFile(name); } +/* copied from dlls/msi/registry.c */ +BOOL squash_guid(LPCWSTR in, LPWSTR out) +{ + DWORD i,n=1; + GUID guid; + + if (FAILED(CLSIDFromString((LPOLESTR)in, &guid))) + return FALSE; + + for(i=0; i<8; i++) + out[7-i] = in[n++]; + n++; + for(i=0; i<4; i++) + out[11-i] = in[n++]; + n++; + for(i=0; i<4; i++) + out[15-i] = in[n++]; + n++; + for(i=0; i<2; i++) + { + out[17+i*2] = in[n++]; + out[16+i*2] = in[n++]; + } + n++; + for( ; i<8; i++) + { + out[17+i*2] = in[n++]; + out[16+i*2] = in[n++]; + } + out[32]=0; + return TRUE; +} + +static void create_test_guid(LPSTR prodcode, LPSTR squashed) +{ + WCHAR guidW[MAX_PATH]; + WCHAR squashedW[MAX_PATH]; + GUID guid; + HRESULT hr; + int size; + + hr = CoCreateGuid(&guid); + ok(hr == S_OK, "Expected S_OK, got %d\n", hr); + + size = StringFromGUID2(&guid, (LPOLESTR)guidW, MAX_PATH); + ok(size == 39, "Expected 39, got %d\n", hr); + + WideCharToMultiByte(CP_ACP, 0, guidW, size, prodcode, MAX_PATH, NULL, NULL); + squash_guid(guidW, squashedW); + WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL); +} + +static void get_user_sid(LPSTR *usersid) +{ + HANDLE token; + BYTE buf[1024]; + DWORD size; + PTOKEN_USER user; + + OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token); + size = sizeof(buf); + GetTokenInformation(token, TokenUser, (void *)buf, size, &size); + user = (PTOKEN_USER)buf; + ConvertSidToStringSid(user->User.Sid, usersid); +} + +static void test_MsiQueryProductState(void) +{ + CHAR prodcode[MAX_PATH]; + CHAR prod_squashed[MAX_PATH]; + CHAR keypath[MAX_PATH*2]; + LPSTR usersid; + INSTALLSTATE state; + LONG res; + HKEY userkey, localkey, props; + DWORD data; + + create_test_guid(prodcode, prod_squashed); + get_user_sid(&usersid); + + /* NULL prodcode */ + state = MsiQueryProductStateA(NULL); + ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state); + + /* empty prodcode */ + state = MsiQueryProductStateA(""); + ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state); + + /* garbage prodcode */ + state = MsiQueryProductStateA("garbage"); + ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state); + + /* guid without brackets */ + state = MsiQueryProductStateA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D"); + ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state); + + /* guid with brackets */ + state = MsiQueryProductStateA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}"); + ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + + /* same length as guid, but random */ + state = MsiQueryProductStateA("A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93"); + ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + + /* created guid cannot possibly be an installed product code */ + state = MsiQueryProductStateA(prodcode); + ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + + lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Products\\"); + lstrcatA(keypath, prod_squashed); + + res = RegCreateKeyA(HKEY_CURRENT_USER, keypath, &userkey); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + + /* user product key exists */ + state = MsiQueryProductStateA(prodcode); + ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state); + + lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\"); + lstrcatA(keypath, prodcode); + + res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + + /* local uninstall key exists */ + state = MsiQueryProductStateA(prodcode); + ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state); + + data = 1; + res = RegSetValueExA(localkey, "WindowsInstaller", 0, REG_DWORD, (const BYTE *)&data, sizeof(DWORD)); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + + /* WindowsInstaller value exists */ + state = MsiQueryProductStateA(prodcode); + ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state); + + RegDeleteValueA(localkey, "WindowsInstaller"); + RegDeleteKeyA(localkey, ""); + + lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\"); + lstrcatA(keypath, usersid); + lstrcatA(keypath, "\\Products\\"); + lstrcatA(keypath, prod_squashed); + + res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &localkey); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + + /* local product key exists */ + state = MsiQueryProductStateA(prodcode); + ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state); + + res = RegCreateKeyA(localkey, "InstallProperties", &props); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + + /* install properties key exists */ + state = MsiQueryProductStateA(prodcode); + ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state); + + data = 1; + res = RegSetValueExA(props, "WindowsInstaller", 0, REG_DWORD, (const BYTE *)&data, sizeof(DWORD)); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + + /* WindowsInstaller value exists */ + state = MsiQueryProductStateA(prodcode); + ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state); + + data = 2; + res = RegSetValueExA(props, "WindowsInstaller", 0, REG_DWORD, (const BYTE *)&data, sizeof(DWORD)); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + + /* WindowsInstaller value is not 1 */ + state = MsiQueryProductStateA(prodcode); + ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state); + + RegDeleteKeyA(userkey, ""); + + /* user product key does not exist */ + state = MsiQueryProductStateA(prodcode); + ok(state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state); + + LocalFree(usersid); + RegDeleteValueA(props, "WindowsInstaller"); + RegDeleteKeyA(props, ""); + RegDeleteKeyA(localkey, ""); + RegCloseKey(userkey); + RegCloseKey(localkey); + RegCloseKey(props); +} + START_TEST(msi) { HMODULE hmod = GetModuleHandle("msi.dll"); @@ -278,4 +468,5 @@ START_TEST(msi) test_null(); test_getcomponentpath(); test_filehash(); + test_MsiQueryProductState(); } diff --git a/dlls/msxml3/nodemap.c b/dlls/msxml3/nodemap.c index fa17787315e..94b3f627fd6 100644 --- a/dlls/msxml3/nodemap.c +++ b/dlls/msxml3/nodemap.c @@ -150,7 +150,7 @@ xmlChar *xmlChar_from_wchar( LPWSTR str ) xmlChar *xmlstr; len = WideCharToMultiByte( CP_UTF8, 0, str, -1, NULL, 0, NULL, NULL ); - xmlstr = (xmlChar*) HeapAlloc( GetProcessHeap(), 0, len ); + xmlstr = HeapAlloc( GetProcessHeap(), 0, len ); if ( xmlstr ) WideCharToMultiByte( CP_UTF8, 0, str, -1, (LPSTR) xmlstr, len, NULL, NULL ); return xmlstr; diff --git a/dlls/ole32/dictionary.c b/dlls/ole32/dictionary.c index 6e114786385..593a4ff1588 100644 --- a/dlls/ole32/dictionary.c +++ b/dlls/ole32/dictionary.c @@ -126,8 +126,8 @@ void dictionary_insert(struct dictionary *d, const void *k, const void *v) } else { - struct dictionary_entry *elem = (struct dictionary_entry *) - HeapAlloc(GetProcessHeap(), 0, sizeof(struct dictionary_entry)); + struct dictionary_entry *elem = HeapAlloc(GetProcessHeap(), 0, + sizeof(struct dictionary_entry)); if (!elem) return; diff --git a/dlls/ole32/tests/marshal.c b/dlls/ole32/tests/marshal.c index b089913bafd..ba7793a5cfd 100644 --- a/dlls/ole32/tests/marshal.c +++ b/dlls/ole32/tests/marshal.c @@ -1615,7 +1615,7 @@ static void test_proxybuffer(REFIID riid) LPVOID lpvtbl; ULONG refs; CLSID clsid; - HeapUnknown *pUnkOuter = (HeapUnknown *)HeapAlloc(GetProcessHeap(), 0, sizeof(*pUnkOuter)); + HeapUnknown *pUnkOuter = HeapAlloc(GetProcessHeap(), 0, sizeof(*pUnkOuter)); pUnkOuter->lpVtbl = &HeapUnknown_Vtbl; pUnkOuter->refs = 1; diff --git a/dlls/oleaut32/tests/tmarshal.c b/dlls/oleaut32/tests/tmarshal.c index f7400e4ab1c..c96fb33d618 100644 --- a/dlls/oleaut32/tests/tmarshal.c +++ b/dlls/oleaut32/tests/tmarshal.c @@ -579,7 +579,7 @@ static HRESULT register_current_module_typelib(void) static IWidget *Widget_Create(void) { - Widget *This = (Widget *)HeapAlloc(GetProcessHeap(), 0, sizeof(*This)); + Widget *This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This)); HRESULT hr; ITypeLib *pTypeLib; @@ -698,7 +698,7 @@ static IKindaEnumWidget *KindaEnumWidget_Create(void) { KindaEnum *This; - This = (KindaEnum *)HeapAlloc(GetProcessHeap(), 0, sizeof(*This)); + This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This)); if (!This) return NULL; This->lpVtbl = &KindaEnumWidget_VTable; This->refs = 1; diff --git a/dlls/oleaut32/tests/usrmarshal.c b/dlls/oleaut32/tests/usrmarshal.c index 21714c44332..633a382fba1 100644 --- a/dlls/oleaut32/tests/usrmarshal.c +++ b/dlls/oleaut32/tests/usrmarshal.c @@ -192,7 +192,7 @@ static void test_marshal_LPSAFEARRAY(void) ok(size == 68, "size should be 68 bytes, not %ld\n", size); size = LPSAFEARRAY_UserSize(&umcb.Flags, 0, &lpsa); ok(size == 64, "size should be 64 bytes, not %ld\n", size); - buffer = (unsigned char *)HeapAlloc(GetProcessHeap(), 0, size); + buffer = HeapAlloc(GetProcessHeap(), 0, size); LPSAFEARRAY_UserMarshal(&umcb.Flags, buffer, &lpsa); check_safearray(buffer, lpsa); @@ -215,7 +215,7 @@ static void test_marshal_LPSAFEARRAY(void) size = LPSAFEARRAY_UserSize(&umcb.Flags, 0, &lpsa); ok(size == 4, "size should be 4 bytes, not %ld\n", size); - buffer = (unsigned char *)HeapAlloc(GetProcessHeap(), 0, size); + buffer = HeapAlloc(GetProcessHeap(), 0, size); LPSAFEARRAY_UserMarshal(&umcb.Flags, buffer, &lpsa); check_safearray(buffer, lpsa); @@ -238,7 +238,7 @@ static void test_marshal_LPSAFEARRAY(void) ok(size == 128, "size should be 128 bytes, not %ld\n", size); size = LPSAFEARRAY_UserSize(&umcb.Flags, 0, &lpsa); ok(size == 128, "size should be 128 bytes, not %ld\n", size); - buffer = (unsigned char *)HeapAlloc(GetProcessHeap(), 0, size); + buffer = HeapAlloc(GetProcessHeap(), 0, size); LPSAFEARRAY_UserMarshal(&umcb.Flags, buffer, &lpsa); check_safearray(buffer, lpsa); @@ -260,7 +260,7 @@ static void test_marshal_LPSAFEARRAY(void) size = LPSAFEARRAY_UserSize(&umcb.Flags, 0, &lpsa); ok(size == 432, "size %ld\n", size); - buffer = (unsigned char *)HeapAlloc(GetProcessHeap(), 0, size); + buffer = HeapAlloc(GetProcessHeap(), 0, size); LPSAFEARRAY_UserMarshal(&umcb.Flags, buffer, &lpsa); check_safearray(buffer, lpsa); HeapFree(GetProcessHeap(), 0, buffer); @@ -283,7 +283,7 @@ static void test_marshal_LPSAFEARRAY(void) size = LPSAFEARRAY_UserSize(&umcb.Flags, 0, &lpsa); todo_wine ok(size == 1388, "size %ld\n", size); - buffer = (unsigned char *)HeapAlloc(GetProcessHeap(), 0, size); + buffer = HeapAlloc(GetProcessHeap(), 0, size); LPSAFEARRAY_UserMarshal(&umcb.Flags, buffer, &lpsa); check_safearray(buffer, lpsa); HeapFree(GetProcessHeap(), 0, buffer); diff --git a/dlls/quartz/avidec.c b/dlls/quartz/avidec.c index 7f32288e8be..9e033c12f56 100644 --- a/dlls/quartz/avidec.c +++ b/dlls/quartz/avidec.c @@ -196,13 +196,13 @@ static HRESULT AVIDec_ConnectInput(TransformFilterImpl* pTransformFilter, const /* Copy bitmap header from media type to 1 for input and 1 for output */ bih_size = format->bmiHeader.biSize + format->bmiHeader.biClrUsed * 4; - This->pBihIn = (BITMAPINFOHEADER*)CoTaskMemAlloc(bih_size); + This->pBihIn = CoTaskMemAlloc(bih_size); if (!This->pBihIn) { hr = E_OUTOFMEMORY; goto failed; } - This->pBihOut = (BITMAPINFOHEADER*)CoTaskMemAlloc(bih_size); + This->pBihOut = CoTaskMemAlloc(bih_size); if (!This->pBihOut) { hr = E_OUTOFMEMORY; diff --git a/dlls/quartz/enumregfilters.c b/dlls/quartz/enumregfilters.c index 2e93c7b1044..2816f08f866 100644 --- a/dlls/quartz/enumregfilters.c +++ b/dlls/quartz/enumregfilters.c @@ -67,7 +67,7 @@ HRESULT IEnumRegFiltersImpl_Construct(REGFILTER* pInRegFilters, const ULONG size for(i = 0; i < size; i++) { pRegFilters[i].Clsid = pInRegFilters[i].Clsid; - pRegFilters[i].Name = (WCHAR*)CoTaskMemAlloc((strlenW(pInRegFilters[i].Name)+1)*sizeof(WCHAR)); + pRegFilters[i].Name = CoTaskMemAlloc((strlenW(pInRegFilters[i].Name)+1)*sizeof(WCHAR)); if (!pRegFilters[i].Name) { while(i) @@ -152,7 +152,7 @@ static HRESULT WINAPI IEnumRegFiltersImpl_Next(IEnumRegFilters * iface, ULONG cF for(i = 0; i < cFetched; i++) { /* The string in the REGFILTER structure must be allocated in the same block as the REGFILTER structure itself */ - ppRegFilter[i] = (REGFILTER*)CoTaskMemAlloc(sizeof(REGFILTER)+(strlenW(This->RegFilters[i].Name)+1)*sizeof(WCHAR)); + ppRegFilter[i] = CoTaskMemAlloc(sizeof(REGFILTER)+(strlenW(This->RegFilters[i].Name)+1)*sizeof(WCHAR)); if (!ppRegFilter[i]) { while(i) diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c index 02728d5a802..df1929d67f6 100644 --- a/dlls/quartz/filtergraph.c +++ b/dlls/quartz/filtergraph.c @@ -327,11 +327,11 @@ static HRESULT WINAPI GraphBuilder_AddFilter(IGraphBuilder *iface, int i,j; WCHAR* wszFilterName = NULL; int duplicate_name = FALSE; - + TRACE("(%p/%p)->(%p, %s (%p))\n", This, iface, pFilter, debugstr_w(pName), pName); - wszFilterName = (WCHAR*) CoTaskMemAlloc( (pName ? strlenW(pName) + 6 : 5) * sizeof(WCHAR) ); - + wszFilterName = CoTaskMemAlloc( (pName ? strlenW(pName) + 6 : 5) * sizeof(WCHAR) ); + if (pName) { /* Check if name already exists */ diff --git a/dlls/quartz/filtermapper.c b/dlls/quartz/filtermapper.c index a45f477f4b3..7f36fd2f5b8 100644 --- a/dlls/quartz/filtermapper.c +++ b/dlls/quartz/filtermapper.c @@ -706,7 +706,7 @@ static HRESULT WINAPI FilterMapper2_RegisterFilter( regfilter2.dwVersion = 2; regfilter2.dwMerit = prf2->dwMerit; regfilter2.u.s1.cPins2 = prf2->u.s.cPins; - pregfp2 = (REGFILTERPINS2*) CoTaskMemAlloc(prf2->u.s.cPins * sizeof(REGFILTERPINS2)); + pregfp2 = CoTaskMemAlloc(prf2->u.s.cPins * sizeof(REGFILTERPINS2)); regfilter2.u.s1.rgPins2 = pregfp2; for (i = 0; i < prf2->u.s.cPins; i++) { diff --git a/dlls/quartz/regsvr.c b/dlls/quartz/regsvr.c index ced43bcac3e..20bc5c4e731 100644 --- a/dlls/quartz/regsvr.c +++ b/dlls/quartz/regsvr.c @@ -588,7 +588,7 @@ static HRESULT register_filters(struct regsvr_filter const *list) rf2.dwVersion = 2; rf2.dwMerit = list->merit; rf2.u.s1.cPins2 = i; - rf2.u.s1.rgPins2 = prfp2 = (REGFILTERPINS2*) CoTaskMemAlloc(i*sizeof(REGFILTERPINS2)); + rf2.u.s1.rgPins2 = prfp2 = CoTaskMemAlloc(i*sizeof(REGFILTERPINS2)); if (!prfp2) { hr = E_OUTOFMEMORY; break; @@ -600,7 +600,7 @@ static HRESULT register_filters(struct regsvr_filter const *list) for (nbmt = 0; list->pins[i].mediatypes[nbmt].majortype; nbmt++) ; /* Allocate a single buffer for regpintypes struct and clsids */ - lpMediatype = (REGPINTYPES*) CoTaskMemAlloc(nbmt*(sizeof(REGPINTYPES) + 2*sizeof(CLSID))); + lpMediatype = CoTaskMemAlloc(nbmt*(sizeof(REGPINTYPES) + 2*sizeof(CLSID))); if (!lpMediatype) { hr = E_OUTOFMEMORY; break; diff --git a/dlls/riched20/reader.c b/dlls/riched20/reader.c index 7fb641bd52e..0cf8ca7f561 100644 --- a/dlls/riched20/reader.c +++ b/dlls/riched20/reader.c @@ -2682,7 +2682,7 @@ static void RTFFlushCPOutputBuffer(RTF_Info *info) { int bufferMax = info->dwCPOutputCount * 2 * sizeof(WCHAR); - WCHAR *buffer = (WCHAR *)RTFAlloc(bufferMax); + WCHAR *buffer = RTFAlloc(bufferMax); int length; length = MultiByteToWideChar(info->codePage, 0, info->cpOutputBuffer, diff --git a/dlls/rpcrt4/rpc_binding.c b/dlls/rpcrt4/rpc_binding.c index 611041c0646..79ecedac47d 100644 --- a/dlls/rpcrt4/rpc_binding.c +++ b/dlls/rpcrt4/rpc_binding.c @@ -302,7 +302,7 @@ RPC_STATUS RPCRT4_OpenBinding(RpcBinding* Binding, RpcConnection** Connection, status = RPCRT4_CreateConnection(&NewConnection, Binding->server, Binding->Protseq, Binding->NetworkAddr, Binding->Endpoint, Binding->NetworkOptions, - Binding->AuthInfo, Binding->QOS, Binding); + Binding->AuthInfo, Binding->QOS); if (status != RPC_S_OK) return status; @@ -354,6 +354,7 @@ RPC_STATUS RPCRT4_OpenBinding(RpcBinding* Binding, RpcConnection** Connection, /* FIXME: do more checks? */ NewConnection->MaxTransmissionSize = response_hdr->bind_ack.max_tsize; + NewConnection->assoc_group_id = response_hdr->bind_ack.assoc_gid; NewConnection->ActiveInterface = *InterfaceId; RPCRT4_FreeHeader(response_hdr); } diff --git a/dlls/rpcrt4/rpc_binding.h b/dlls/rpcrt4/rpc_binding.h index 69b4001ba47..58f2d062c81 100644 --- a/dlls/rpcrt4/rpc_binding.h +++ b/dlls/rpcrt4/rpc_binding.h @@ -58,7 +58,6 @@ typedef struct _RpcAssoc LPSTR NetworkAddr; LPSTR Endpoint; LPWSTR NetworkOptions; - RpcAuthInfo *AuthInfo; /* id of this association group */ ULONG assoc_group_id; @@ -72,7 +71,6 @@ struct connection_ops; typedef struct _RpcConnection { struct _RpcConnection* Next; - struct _RpcBinding* Used; BOOL server; LPSTR NetworkAddr; LPSTR Endpoint; @@ -152,7 +150,7 @@ RpcConnection *RpcAssoc_GetIdleConnection(RpcAssoc *assoc, const RPC_SYNTAX_IDEN void RpcAssoc_ReleaseIdleConnection(RpcAssoc *assoc, RpcConnection *Connection); ULONG RpcAssoc_Release(RpcAssoc *assoc); -RPC_STATUS RPCRT4_CreateConnection(RpcConnection** Connection, BOOL server, LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, RpcAuthInfo* AuthInfo, RpcQualityOfService *QOS, RpcBinding* Binding); +RPC_STATUS RPCRT4_CreateConnection(RpcConnection** Connection, BOOL server, LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, RpcAuthInfo* AuthInfo, RpcQualityOfService *QOS); RPC_STATUS RPCRT4_DestroyConnection(RpcConnection* Connection); RPC_STATUS RPCRT4_OpenClientConnection(RpcConnection* Connection); RPC_STATUS RPCRT4_CloseConnection(RpcConnection* Connection); diff --git a/dlls/rpcrt4/rpc_message.c b/dlls/rpcrt4/rpc_message.c index bdd9d124bfb..6c3227269bb 100644 --- a/dlls/rpcrt4/rpc_message.c +++ b/dlls/rpcrt4/rpc_message.c @@ -178,8 +178,8 @@ RpcPktHdr *RPCRT4_BuildBindHeader(unsigned long DataRepresentation, unsigned short MaxTransmissionSize, unsigned short MaxReceiveSize, unsigned long AssocGroupId, - RPC_SYNTAX_IDENTIFIER *AbstractId, - RPC_SYNTAX_IDENTIFIER *TransferId) + const RPC_SYNTAX_IDENTIFIER *AbstractId, + const RPC_SYNTAX_IDENTIFIER *TransferId) { RpcPktHdr *header; @@ -240,10 +240,10 @@ RpcPktHdr *RPCRT4_BuildBindNackHeader(unsigned long DataRepresentation, RpcPktHdr *RPCRT4_BuildBindAckHeader(unsigned long DataRepresentation, unsigned short MaxTransmissionSize, unsigned short MaxReceiveSize, - LPSTR ServerAddress, + LPCSTR ServerAddress, unsigned long Result, unsigned long Reason, - RPC_SYNTAX_IDENTIFIER *TransferId) + const RPC_SYNTAX_IDENTIFIER *TransferId) { RpcPktHdr *header; unsigned long header_size; diff --git a/dlls/rpcrt4/rpc_message.h b/dlls/rpcrt4/rpc_message.h index 72465924c9f..a9a9f836807 100644 --- a/dlls/rpcrt4/rpc_message.h +++ b/dlls/rpcrt4/rpc_message.h @@ -25,9 +25,9 @@ #include "rpc_defs.h" RpcPktHdr *RPCRT4_BuildFaultHeader(unsigned long DataRepresentation, RPC_STATUS Status); -RpcPktHdr *RPCRT4_BuildBindHeader(unsigned long DataRepresentation, unsigned short MaxTransmissionSize, unsigned short MaxReceiveSize, unsigned long AssocGroupId, RPC_SYNTAX_IDENTIFIER *AbstractId, RPC_SYNTAX_IDENTIFIER *TransferId); +RpcPktHdr *RPCRT4_BuildBindHeader(unsigned long DataRepresentation, unsigned short MaxTransmissionSize, unsigned short MaxReceiveSize, unsigned long AssocGroupId, const RPC_SYNTAX_IDENTIFIER *AbstractId, const RPC_SYNTAX_IDENTIFIER *TransferId); RpcPktHdr *RPCRT4_BuildBindNackHeader(unsigned long DataRepresentation, unsigned char RpcVersion, unsigned char RpcVersionMinor); -RpcPktHdr *RPCRT4_BuildBindAckHeader(unsigned long DataRepresentation, unsigned short MaxTransmissionSize, unsigned short MaxReceiveSize, LPSTR ServerAddress, unsigned long Result, unsigned long Reason, RPC_SYNTAX_IDENTIFIER *TransferId); +RpcPktHdr *RPCRT4_BuildBindAckHeader(unsigned long DataRepresentation, unsigned short MaxTransmissionSize, unsigned short MaxReceiveSize, LPCSTR ServerAddress, unsigned long Result, unsigned long Reason, const RPC_SYNTAX_IDENTIFIER *TransferId); VOID RPCRT4_FreeHeader(RpcPktHdr *Header); RPC_STATUS RPCRT4_Send(RpcConnection *Connection, RpcPktHdr *Header, void *Buffer, unsigned int BufferLength); RPC_STATUS RPCRT4_Receive(RpcConnection *Connection, RpcPktHdr **Header, PRPC_MESSAGE pMsg); diff --git a/dlls/rpcrt4/rpc_transport.c b/dlls/rpcrt4/rpc_transport.c index b03d3ea6a1d..2bb891d1d05 100644 --- a/dlls/rpcrt4/rpc_transport.c +++ b/dlls/rpcrt4/rpc_transport.c @@ -250,7 +250,7 @@ static RPC_STATUS rpcrt4_protseq_ncalrpc_open_endpoint(RpcServerProtseq* protseq RpcConnection *Connection; r = RPCRT4_CreateConnection(&Connection, TRUE, protseq->Protseq, NULL, - endpoint, NULL, NULL, NULL, NULL); + endpoint, NULL, NULL, NULL); if (r != RPC_S_OK) return r; @@ -297,7 +297,7 @@ static RPC_STATUS rpcrt4_protseq_ncacn_np_open_endpoint(RpcServerProtseq *protse RpcConnection *Connection; r = RPCRT4_CreateConnection(&Connection, TRUE, protseq->Protseq, NULL, - endpoint, NULL, NULL, NULL, NULL); + endpoint, NULL, NULL, NULL); if (r != RPC_S_OK) return r; @@ -857,8 +857,7 @@ static RPC_STATUS rpcrt4_protseq_ncacn_ip_tcp_open_endpoint(RpcServerProtseq *pr } create_status = RPCRT4_CreateConnection((RpcConnection **)&tcpc, TRUE, protseq->Protseq, NULL, - endpoint, NULL, NULL, NULL, - NULL); + endpoint, NULL, NULL, NULL); if (create_status != RPC_S_OK) { close(sock); @@ -1354,8 +1353,7 @@ RPC_STATUS RPCRT4_CloseConnection(RpcConnection* Connection) RPC_STATUS RPCRT4_CreateConnection(RpcConnection** Connection, BOOL server, LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, - LPCWSTR NetworkOptions, RpcAuthInfo* AuthInfo, RpcQualityOfService *QOS, - RpcBinding* Binding) + LPCWSTR NetworkOptions, RpcAuthInfo* AuthInfo, RpcQualityOfService *QOS) { const struct connection_ops *ops; RpcConnection* NewConnection; @@ -1374,7 +1372,6 @@ RPC_STATUS RPCRT4_CreateConnection(RpcConnection** Connection, BOOL server, NewConnection->NetworkAddr = RPCRT4_strdupA(NetworkAddr); NewConnection->Endpoint = RPCRT4_strdupA(Endpoint); NewConnection->NetworkOptions = RPCRT4_strdupW(NetworkOptions); - NewConnection->Used = Binding; NewConnection->MaxTransmissionSize = RPC_MAX_PACKET_SIZE; memset(&NewConnection->ActiveInterface, 0, sizeof(NewConnection->ActiveInterface)); NewConnection->NextCallId = 1; @@ -1518,8 +1515,7 @@ RPC_STATUS RPCRT4_SpawnConnection(RpcConnection** Connection, RpcConnection* Old rpcrt4_conn_get_name(OldConnection), OldConnection->NetworkAddr, OldConnection->Endpoint, NULL, - OldConnection->AuthInfo, OldConnection->QOS, - NULL); + OldConnection->AuthInfo, OldConnection->QOS); if (err == RPC_S_OK) rpcrt4_conn_handoff(OldConnection, *Connection); return err; diff --git a/dlls/shlwapi/tests/string.c b/dlls/shlwapi/tests/string.c index c868e1e01d5..895d767611c 100644 --- a/dlls/shlwapi/tests/string.c +++ b/dlls/shlwapi/tests/string.c @@ -605,7 +605,7 @@ static void test_StrCmpW(void) static WCHAR *CoDupStrW(const char* src) { INT len = MultiByteToWideChar(CP_ACP, 0, src, -1, NULL, 0); - WCHAR* szTemp = (WCHAR*)CoTaskMemAlloc(len * sizeof(WCHAR)); + WCHAR* szTemp = CoTaskMemAlloc(len * sizeof(WCHAR)); MultiByteToWideChar(CP_ACP, 0, src, -1, szTemp, len); return szTemp; } diff --git a/dlls/user32/tests/cursoricon.c b/dlls/user32/tests/cursoricon.c index 6d9313885e1..84b9fe3e528 100644 --- a/dlls/user32/tests/cursoricon.c +++ b/dlls/user32/tests/cursoricon.c @@ -94,7 +94,7 @@ static void test_CopyImage_Bitmap(int depth) unsigned int i; /* Create a device-independent bitmap (DIB) */ - info = (BITMAPINFO *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)); + info = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)); info->bmiHeader.biSize = sizeof(info->bmiHeader); info->bmiHeader.biWidth = 2; info->bmiHeader.biHeight = 2; diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index f4074026408..171d96950d8 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -36,6 +36,88 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d); WINE_DECLARE_DEBUG_CHANNEL(d3d_caps); +/* Extension detection */ +static const struct { + const char *extension_string; + GL_SupportedExt extension; +} EXTENSION_MAP[] = { + /* APPLE */ + {"GL_APPLE_client_storage", APPLE_CLIENT_STORAGE}, + {"GL_APPLE_fence", APPLE_FENCE}, + + /* ATI */ + {"GL_ATI_separate_stencil", ATI_SEPARATE_STENCIL}, + {"GL_ATI_texture_env_combine3", ATI_TEXTURE_ENV_COMBINE3}, + {"GL_ATI_texture_mirror_once", ATI_TEXTURE_MIRROR_ONCE}, + {"GL_ATI_envmap_bumpmap", ATI_ENVMAP_BUMPMAP}, + + /* ARB */ + {"GL_ARB_draw_buffers", ARB_DRAW_BUFFERS}, + {"GL_ARB_fragment_program", ARB_FRAGMENT_PROGRAM}, + {"GL_ARB_fragment_shader", ARB_FRAGMENT_SHADER}, + {"GL_ARB_half_float_pixel", ARB_HALF_FLOAT_PIXEL}, + {"GL_ARB_imaging", ARB_IMAGING}, + {"GL_ARB_multisample", ARB_MULTISAMPLE}, /* needs GLX_ARB_MULTISAMPLE as well */ + {"GL_ARB_multitexture", ARB_MULTITEXTURE}, + {"GL_ARB_occlusion_query", ARB_OCCLUSION_QUERY}, + {"GL_ARB_pixel_buffer_object", ARB_PIXEL_BUFFER_OBJECT}, + {"GL_ARB_point_parameters", ARB_POINT_PARAMETERS}, + {"GL_ARB_point_sprite", ARB_POINT_SPRITE}, + {"GL_ARB_texture_border_clamp", ARB_TEXTURE_BORDER_CLAMP}, + {"GL_ARB_texture_compression", ARB_TEXTURE_COMPRESSION}, + {"GL_ARB_texture_cube_map", ARB_TEXTURE_CUBE_MAP}, + {"GL_ARB_texture_env_add", ARB_TEXTURE_ENV_ADD}, + {"GL_ARB_texture_env_combine", ARB_TEXTURE_ENV_COMBINE}, + {"GL_ARB_texture_env_dot3", ARB_TEXTURE_ENV_DOT3}, + {"GL_ARB_texture_float", ARB_TEXTURE_FLOAT}, + {"GL_ARB_texture_mirrored_repeat", ARB_TEXTURE_MIRRORED_REPEAT}, + {"GL_ARB_texture_non_power_of_two", ARB_TEXTURE_NON_POWER_OF_TWO}, + {"GL_ARB_vertex_blend", ARB_VERTEX_BLEND}, + {"GL_ARB_vertex_buffer_object", ARB_VERTEX_BUFFER_OBJECT}, + {"GL_ARB_vertex_program", ARB_VERTEX_PROGRAM}, + {"GL_ARB_vertex_shader", ARB_VERTEX_SHADER}, + + /* EXT */ + {"GL_EXT_blend_minmax", EXT_BLEND_MINMAX}, + {"GL_EXT_fog_coord", EXT_FOG_COORD}, + {"GL_EXT_framebuffer_blit", EXT_FRAMEBUFFER_BLIT}, + {"GL_EXT_framebuffer_object", EXT_FRAMEBUFFER_OBJECT}, + {"GL_EXT_paletted_texture", EXT_PALETTED_TEXTURE}, + {"GL_EXT_point_parameters", EXT_POINT_PARAMETERS}, + {"GL_EXT_secondary_color", EXT_SECONDARY_COLOR}, + {"GL_EXT_stencil_two_side", EXT_STENCIL_TWO_SIDE}, + {"GL_EXT_stencil_wrap", EXT_STENCIL_WRAP}, + {"GL_EXT_texture3D", EXT_TEXTURE3D}, + {"GL_EXT_texture_compression_s3tc", EXT_TEXTURE_COMPRESSION_S3TC}, + {"GL_EXT_texture_env_add", EXT_TEXTURE_ENV_ADD}, + {"GL_EXT_texture_env_combine", EXT_TEXTURE_ENV_COMBINE}, + {"GL_EXT_texture_env_dot3", EXT_TEXTURE_ENV_DOT3}, + {"GL_EXT_texture_sRGB", EXT_TEXTURE_SRGB}, + {"GL_EXT_texture_filter_anisotropic", EXT_TEXTURE_FILTER_ANISOTROPIC}, + {"GL_EXT_texture_lod", EXT_TEXTURE_LOD}, + {"GL_EXT_texture_lod_bias", EXT_TEXTURE_LOD_BIAS}, + {"GL_EXT_vertex_shader", EXT_VERTEX_SHADER}, + {"GL_EXT_vertex_weighting", EXT_VERTEX_WEIGHTING}, + + /* NV */ + {"GL_NV_fence", NV_FENCE}, + {"GL_NV_fog_distance", NV_FOG_DISTANCE}, + {"GL_NV_fragment_program", NV_FRAGMENT_PROGRAM}, + {"GL_NV_fragment_program2", NV_FRAGMENT_PROGRAM2}, + {"GL_NV_register_combiners", NV_REGISTER_COMBINERS}, + {"GL_NV_register_combiners2", NV_REGISTER_COMBINERS2}, + {"GL_NV_texgen_reflection", NV_TEXGEN_REFLECTION}, + {"GL_NV_texture_env_combine4", NV_TEXTURE_ENV_COMBINE4}, + {"GL_NV_texture_shader", NV_TEXTURE_SHADER}, + {"GL_NV_texture_shader2", NV_TEXTURE_SHADER2}, + {"GL_NV_texture_shader3", NV_TEXTURE_SHADER3}, + {"GL_NV_occlusion_query", NV_OCCLUSION_QUERY}, + {"GL_NV_vertex_program", NV_VERTEX_PROGRAM}, + {"GL_NV_vertex_program1_1", NV_VERTEX_PROGRAM1_1}, + {"GL_NV_vertex_program2", NV_VERTEX_PROGRAM2}, + {"GL_NV_vertex_program3", NV_VERTEX_PROGRAM3}, +}; + /********************************************************** * Utility functions follow **********************************************************/ @@ -556,292 +638,142 @@ BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info, Display* display) { memcpy(ThisExtn, Start, (GL_Extensions - Start)); TRACE_(d3d_caps)("- %s\n", ThisExtn); - /** - * ARB - */ - if (strcmp(ThisExtn, "GL_ARB_draw_buffers") == 0) { - glGetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &gl_max); - TRACE_(d3d_caps)(" FOUND: ARB_draw_buffers support - max buffers=%u\n", gl_max); - gl_info->supported[ARB_DRAW_BUFFERS] = TRUE; - gl_info->max_buffers = gl_max; - } else if (strcmp(ThisExtn, "GL_ARB_fragment_program") == 0) { - gl_info->ps_arb_version = PS_VERSION_11; - TRACE_(d3d_caps)(" FOUND: ARB Pixel Shader support - version=%02x\n", gl_info->ps_arb_version); - gl_info->supported[ARB_FRAGMENT_PROGRAM] = TRUE; - glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, &gl_max); - TRACE_(d3d_caps)(" FOUND: ARB Pixel Shader support - GL_MAX_TEXTURE_IMAGE_UNITS_ARB=%u\n", gl_max); - gl_info->max_fragment_samplers = min(MAX_FRAGMENT_SAMPLERS, gl_max); - GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, &gl_max)); - TRACE_(d3d_caps)(" FOUND: ARB Pixel Shader support - max float constants=%u\n", gl_max); - gl_info->ps_arb_constantsF = gl_max; - GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_TEMPORARIES_ARB, &gl_max)); - TRACE_(d3d_caps)(" FOUND: ARB Pixel Shader support - max temporaries=%u\n", gl_max); - gl_info->ps_arb_max_temps = gl_max; - GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_INSTRUCTIONS_ARB, &gl_max)); - TRACE_(d3d_caps)(" FOUND: ARB Pixel Shader support - max instructions=%u\n", gl_max); - gl_info->ps_arb_max_instructions = gl_max; - } else if (strcmp(ThisExtn, "GL_ARB_fragment_shader") == 0) { - gl_info->supported[ARB_FRAGMENT_SHADER] = TRUE; - glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB, &gl_max); - if(gl_info->gl_driver_version != (MAKEDWORD_VERSION(10, 8756))) - gl_max /= 4; - TRACE_(d3d_caps)(" FOUND: ARB_fragment_shader (GLSL) support - max float ps constants=%u\n", gl_max); - gl_info->ps_glsl_constantsF = gl_max; - } else if (strcmp(ThisExtn, "GL_ARB_imaging") == 0) { - TRACE_(d3d_caps)(" FOUND: ARB imaging support\n"); - gl_info->supported[ARB_IMAGING] = TRUE; - } else if (strcmp(ThisExtn, "GL_ARB_multisample") == 0) { - TRACE_(d3d_caps)(" FOUND: ARB Multisample support\n"); - gl_info->supported[ARB_MULTISAMPLE] = TRUE; - } else if (strcmp(ThisExtn, "GL_ARB_multitexture") == 0) { - glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &gl_max); - TRACE_(d3d_caps)(" FOUND: ARB Multitexture support - GL_MAX_TEXTURE_UNITS_ARB=%u\n", gl_max); - gl_info->supported[ARB_MULTITEXTURE] = TRUE; - gl_info->max_textures = min(MAX_TEXTURES, gl_max); - gl_info->max_texture_stages = min(MAX_TEXTURES, gl_max); - gl_info->max_fragment_samplers = max(gl_info->max_fragment_samplers, gl_max); - } else if (strcmp(ThisExtn, "GL_ARB_texture_cube_map") == 0) { - TRACE_(d3d_caps)(" FOUND: ARB Texture Cube Map support\n"); - gl_info->supported[ARB_TEXTURE_CUBE_MAP] = TRUE; - TRACE_(d3d_caps)(" IMPLIED: NVIDIA (NV) Texture Gen Reflection support\n"); - gl_info->supported[NV_TEXGEN_REFLECTION] = TRUE; - } else if (strcmp(ThisExtn, "GL_ARB_texture_compression") == 0) { - TRACE_(d3d_caps)(" FOUND: ARB Texture Compression support\n"); - gl_info->supported[ARB_TEXTURE_COMPRESSION] = TRUE; - } else if (strcmp(ThisExtn, "GL_ARB_texture_env_add") == 0) { - TRACE_(d3d_caps)(" FOUND: ARB Texture Env Add support\n"); - gl_info->supported[ARB_TEXTURE_ENV_ADD] = TRUE; - } else if (strcmp(ThisExtn, "GL_ARB_texture_env_combine") == 0) { - TRACE_(d3d_caps)(" FOUND: ARB Texture Env combine support\n"); - gl_info->supported[ARB_TEXTURE_ENV_COMBINE] = TRUE; - } else if (strcmp(ThisExtn, "GL_ARB_texture_env_dot3") == 0) { - TRACE_(d3d_caps)(" FOUND: ARB Dot3 support\n"); - gl_info->supported[ARB_TEXTURE_ENV_DOT3] = TRUE; - } else if (strcmp(ThisExtn, "GL_ARB_texture_float") == 0) { - TRACE_(d3d_caps)(" FOUND: ARB Float texture support\n"); - gl_info->supported[ARB_TEXTURE_FLOAT] = TRUE; - } else if (strcmp(ThisExtn, "GL_ARB_half_float_pixel") == 0) { - TRACE_(d3d_caps)(" FOUND: ARB Half-float pixel support\n"); - gl_info->supported[ARB_HALF_FLOAT_PIXEL] = TRUE; - } else if (strcmp(ThisExtn, "GL_ARB_texture_border_clamp") == 0) { - TRACE_(d3d_caps)(" FOUND: ARB Texture border clamp support\n"); - gl_info->supported[ARB_TEXTURE_BORDER_CLAMP] = TRUE; - } else if (strcmp(ThisExtn, "GL_ARB_texture_mirrored_repeat") == 0) { - TRACE_(d3d_caps)(" FOUND: ARB Texture mirrored repeat support\n"); - gl_info->supported[ARB_TEXTURE_MIRRORED_REPEAT] = TRUE; - } else if (strcmp(ThisExtn, "GL_ARB_texture_non_power_of_two") == 0) { - TRACE_(d3d_caps)(" FOUND: ARB NPOT texture support\n"); - gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO] = TRUE; - } else if (strcmp(ThisExtn, "GLX_ARB_multisample") == 0) { - TRACE_(d3d_caps)(" FOUND: ARB multisample support\n"); - gl_info->supported[ARB_MULTISAMPLE] = TRUE; - } else if (strcmp(ThisExtn, "GL_ARB_pixel_buffer_object") == 0) { - TRACE_(d3d_caps)(" FOUND: ARB Pixel Buffer support\n"); - gl_info->supported[ARB_PIXEL_BUFFER_OBJECT] = TRUE; - } else if (strcmp(ThisExtn, "GL_ARB_point_sprite") == 0) { - TRACE_(d3d_caps)(" FOUND: ARB point sprite support\n"); - gl_info->supported[ARB_POINT_SPRITE] = TRUE; - } else if (strstr(ThisExtn, "GL_ARB_vertex_program")) { - gl_info->vs_arb_version = VS_VERSION_11; - TRACE_(d3d_caps)(" FOUND: ARB Vertex Shader support - version=%02x\n", gl_info->vs_arb_version); - gl_info->supported[ARB_VERTEX_PROGRAM] = TRUE; - GL_EXTCALL(glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, &gl_max)); - TRACE_(d3d_caps)(" FOUND: ARB Vertex Shader support - max float constants=%u\n", gl_max); - gl_info->vs_arb_constantsF = gl_max; - GL_EXTCALL(glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_TEMPORARIES_ARB, &gl_max)); - TRACE_(d3d_caps)(" FOUND: ARB Vertex Shader support - max temporaries=%u\n", gl_max); - gl_info->vs_arb_max_temps = gl_max; - GL_EXTCALL(glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_INSTRUCTIONS_ARB, &gl_max)); - TRACE_(d3d_caps)(" FOUND: ARB Vertex Shader support - max instructions=%u\n", gl_max); - gl_info->vs_arb_max_instructions = gl_max; - } else if (strcmp(ThisExtn, "GL_ARB_vertex_shader") == 0) { - gl_info->supported[ARB_VERTEX_SHADER] = TRUE; - glGetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB, &gl_max); - if(gl_info->gl_driver_version != (MAKEDWORD_VERSION(10, 8756))) - gl_max /= 4; - TRACE_(d3d_caps)(" FOUND: ARB_vertex_shader (GLSL) support - max float vs constants=%u\n", gl_max); - gl_info->vs_glsl_constantsF = gl_max; - glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB, &gl_max); - TRACE_(d3d_caps)(" FOUND: ARB_vertex_shader (GLSL) support - GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB=%u\n", gl_max); - gl_info->max_vertex_samplers = gl_max; - glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB, &gl_max); - TRACE_(d3d_caps)(" FOUND: ARB_vertex_shader (GLSL) support - GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB=%u\n", gl_max); - gl_info->max_combined_samplers = gl_max; - } else if (strcmp(ThisExtn, "GL_ARB_vertex_blend") == 0) { - glGetIntegerv(GL_MAX_VERTEX_UNITS_ARB, &gl_max); - TRACE_(d3d_caps)(" FOUND: ARB Vertex Blend support GL_MAX_VERTEX_UNITS_ARB %d\n", gl_max); - gl_info->max_blends = gl_max; - gl_info->supported[ARB_VERTEX_BLEND] = TRUE; - } else if (strcmp(ThisExtn, "GL_ARB_vertex_buffer_object") == 0) { - TRACE_(d3d_caps)(" FOUND: ARB Vertex Buffer support\n"); - gl_info->supported[ARB_VERTEX_BUFFER_OBJECT] = TRUE; - } else if (strcmp(ThisExtn, "GL_ARB_occlusion_query") == 0) { - TRACE_(d3d_caps)(" FOUND: ARB Occlusion Query support\n"); - gl_info->supported[ARB_OCCLUSION_QUERY] = TRUE; - } else if (strcmp(ThisExtn, "GL_ARB_point_parameters") == 0) { - TRACE_(d3d_caps)(" FOUND: ARB Point parameters support\n"); - gl_info->supported[ARB_POINT_PARAMETERS] = TRUE; - /** - * EXT - */ - } else if (strcmp(ThisExtn, "GL_EXT_fog_coord") == 0) { - TRACE_(d3d_caps)(" FOUND: EXT Fog coord support\n"); - gl_info->supported[EXT_FOG_COORD] = TRUE; - } else if (strcmp(ThisExtn, "GL_EXT_framebuffer_object") == 0) { - TRACE_(d3d_caps)(" FOUND: EXT Frame Buffer Object support\n"); - gl_info->supported[EXT_FRAMEBUFFER_OBJECT] = TRUE; - } else if (strcmp(ThisExtn, "GL_EXT_framebuffer_blit") == 0) { - TRACE_(d3d_caps)(" FOUND: EXT Frame Buffer Blit support\n"); - gl_info->supported[EXT_FRAMEBUFFER_BLIT] = TRUE; - } else if (strcmp(ThisExtn, "GL_EXT_blend_minmax") == 0) { - TRACE_(d3d_caps)(" FOUND: EXT Blend minmax support\n"); - gl_info->supported[EXT_BLEND_MINMAX] = TRUE; - } else if (strcmp(ThisExtn, "GL_EXT_paletted_texture") == 0) { /* handle paletted texture extensions */ - TRACE_(d3d_caps)(" FOUND: EXT Paletted texture support\n"); - gl_info->supported[EXT_PALETTED_TEXTURE] = TRUE; - } else if (strcmp(ThisExtn, "GL_EXT_point_parameters") == 0) { - TRACE_(d3d_caps)(" FOUND: EXT Point parameters support\n"); - gl_info->supported[EXT_POINT_PARAMETERS] = TRUE; - } else if (strcmp(ThisExtn, "GL_EXT_secondary_color") == 0) { - TRACE_(d3d_caps)(" FOUND: EXT Secondary color support\n"); - gl_info->supported[EXT_SECONDARY_COLOR] = TRUE; - } else if (strcmp(ThisExtn, "GL_EXT_stencil_two_side") == 0) { - TRACE_(d3d_caps)(" FOUND: EXT Stencil two side support\n"); - gl_info->supported[EXT_STENCIL_TWO_SIDE] = TRUE; - } else if (strcmp(ThisExtn, "GL_EXT_stencil_wrap") == 0) { - TRACE_(d3d_caps)(" FOUND: EXT Stencil wrap support\n"); - gl_info->supported[EXT_STENCIL_WRAP] = TRUE; - } else if (strcmp(ThisExtn, "GL_EXT_texture3D") == 0) { - TRACE_(d3d_caps)(" FOUND: EXT_texture3D support\n"); - gl_info->supported[EXT_TEXTURE3D] = TRUE; - glGetIntegerv(GL_MAX_3D_TEXTURE_SIZE_EXT, &gl_max); - TRACE_(d3d_caps)("Max texture3D size: %d\n", gl_max); - gl_info->max_texture3d_size = gl_max; - } else if (strcmp(ThisExtn, "GL_EXT_texture_compression_s3tc") == 0) { - TRACE_(d3d_caps)(" FOUND: EXT Texture S3TC compression support\n"); - gl_info->supported[EXT_TEXTURE_COMPRESSION_S3TC] = TRUE; - } else if (strcmp(ThisExtn, "GL_EXT_texture_env_add") == 0) { - TRACE_(d3d_caps)(" FOUND: EXT Texture Env Add support\n"); - gl_info->supported[EXT_TEXTURE_ENV_ADD] = TRUE; - } else if (strcmp(ThisExtn, "GL_EXT_texture_env_combine") == 0) { - TRACE_(d3d_caps)(" FOUND: EXT Texture Env combine support\n"); - gl_info->supported[EXT_TEXTURE_ENV_COMBINE] = TRUE; - } else if (strcmp(ThisExtn, "GL_EXT_texture_env_dot3") == 0) { - TRACE_(d3d_caps)(" FOUND: EXT Dot3 support\n"); - gl_info->supported[EXT_TEXTURE_ENV_DOT3] = TRUE; - } else if (strcmp(ThisExtn, "GL_EXT_texture_sRGB") == 0) { - TRACE_(d3d_caps)(" FOUND: EXT sRGB support\n"); - gl_info->supported[EXT_TEXTURE_SRGB] = TRUE; - } else if (strcmp(ThisExtn, "GL_EXT_texture_filter_anisotropic") == 0) { - gl_info->supported[EXT_TEXTURE_FILTER_ANISOTROPIC] = TRUE; - glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &gl_max); - TRACE_(d3d_caps)(" FOUND: EXT Texture Anisotropic filter support. GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT %d\n", gl_max); - gl_info->max_anisotropy = gl_max; - } else if (strcmp(ThisExtn, "GL_EXT_texture_lod") == 0) { - TRACE_(d3d_caps)(" FOUND: EXT Texture LOD support\n"); - gl_info->supported[EXT_TEXTURE_LOD] = TRUE; - } else if (strcmp(ThisExtn, "GL_EXT_texture_lod_bias") == 0) { - TRACE_(d3d_caps)(" FOUND: EXT Texture LOD bias support\n"); - gl_info->supported[EXT_TEXTURE_LOD_BIAS] = TRUE; - } else if (strcmp(ThisExtn, "GL_EXT_vertex_weighting") == 0) { - TRACE_(d3d_caps)(" FOUND: EXT Vertex weighting support\n"); - gl_info->supported[EXT_VERTEX_WEIGHTING] = TRUE; - - /** - * NVIDIA - */ - } else if (strstr(ThisExtn, "GL_NV_fog_distance")) { - TRACE_(d3d_caps)(" FOUND: NVIDIA (NV) Fog Distance support\n"); - gl_info->supported[NV_FOG_DISTANCE] = TRUE; - } else if (strstr(ThisExtn, "GL_NV_fragment_program")) { - gl_info->ps_nv_version = (strcmp(ThisExtn, "GL_NV_fragment_program2") == 0) ? PS_VERSION_30 : PS_VERSION_20; - TRACE_(d3d_caps)(" FOUND: NVIDIA (NV) Pixel Shader support - version=%02x\n", gl_info->ps_nv_version); - } else if (strcmp(ThisExtn, "GL_NV_register_combiners") == 0) { - glGetIntegerv(GL_MAX_GENERAL_COMBINERS_NV, &gl_max); - gl_info->max_texture_stages = min(MAX_TEXTURES, gl_max); - TRACE_(d3d_caps)(" FOUND: NVIDIA (NV) Register combiners (1) support - GL_MAX_GENERAL_COMBINERS_NV=%d\n", gl_max); - gl_info->supported[NV_REGISTER_COMBINERS] = TRUE; - } else if (strcmp(ThisExtn, "GL_NV_register_combiners2") == 0) { - TRACE_(d3d_caps)(" FOUND: NVIDIA (NV) Register combiners (2) support\n"); - gl_info->supported[NV_REGISTER_COMBINERS2] = TRUE; - } else if (strcmp(ThisExtn, "GL_NV_texgen_reflection") == 0) { - TRACE_(d3d_caps)(" FOUND: NVIDIA (NV) Texture Gen Reflection support\n"); - gl_info->supported[NV_TEXGEN_REFLECTION] = TRUE; - } else if (strcmp(ThisExtn, "GL_NV_texture_env_combine4") == 0) { - TRACE_(d3d_caps)(" FOUND: NVIDIA (NV) Texture Env combine (4) support\n"); - gl_info->supported[NV_TEXTURE_ENV_COMBINE4] = TRUE; - } else if (strcmp(ThisExtn, "GL_NV_texture_shader") == 0) { - TRACE_(d3d_caps)(" FOUND: NVIDIA (NV) Texture Shader (1) support\n"); - gl_info->supported[NV_TEXTURE_SHADER] = TRUE; - } else if (strcmp(ThisExtn, "GL_NV_texture_shader2") == 0) { - TRACE_(d3d_caps)(" FOUND: NVIDIA (NV) Texture Shader (2) support\n"); - gl_info->supported[NV_TEXTURE_SHADER2] = TRUE; - /* Prevent both extensions to be used at the same time. I don't expect them to play nice together */ - gl_info->supported[ATI_ENVMAP_BUMPMAP] = FALSE; - } else if (strcmp(ThisExtn, "GL_NV_texture_shader3") == 0) { - TRACE_(d3d_caps)(" FOUND: NVIDIA (NV) Texture Shader (3) support\n"); - gl_info->supported[NV_TEXTURE_SHADER3] = TRUE; - } else if (strcmp(ThisExtn, "GL_NV_occlusion_query") == 0) { - TRACE_(d3d_caps)(" FOUND: NVIDIA (NV) Occlusion Query (3) support\n"); - gl_info->supported[NV_OCCLUSION_QUERY] = TRUE; - } else if (strstr(ThisExtn, "GL_NV_vertex_program")) { - if(strcmp(ThisExtn, "GL_NV_vertex_program3") == 0) - gl_info->vs_nv_version = VS_VERSION_30; - else if(strcmp(ThisExtn, "GL_NV_vertex_program2") == 0) - gl_info->vs_nv_version = VS_VERSION_20; - else if(strcmp(ThisExtn, "GL_NV_vertex_program1_1") == 0) - gl_info->vs_nv_version = VS_VERSION_11; - else - gl_info->vs_nv_version = VS_VERSION_10; - TRACE_(d3d_caps)(" FOUND: NVIDIA (NV) Vertex Shader support - version=%02x\n", gl_info->vs_nv_version); - gl_info->supported[NV_VERTEX_PROGRAM] = TRUE; - } else if (strstr(ThisExtn, "GL_NV_fence")) { - if(!gl_info->supported[APPLE_FENCE]) { - gl_info->supported[NV_FENCE] = TRUE; + for (i = 0; i < (sizeof(EXTENSION_MAP) / sizeof(*EXTENSION_MAP)); ++i) { + if (!strcmp(ThisExtn, EXTENSION_MAP[i].extension_string)) { + TRACE_(d3d_caps)(" FOUND: %s support\n", EXTENSION_MAP[i].extension_string); + gl_info->supported[EXTENSION_MAP[i].extension] = TRUE; + break; } + } - /** - * ATI + if (*GL_Extensions == ' ') GL_Extensions++; + } + + if (gl_info->supported[APPLE_FENCE]) { + /* GL_NV_fence and GL_APPLE_fence provide the same functionality basically. + * The apple extension interacts with some other apple exts. Disable the NV + * extension if the apple one is support to prevent confusion in other parts + * of the code */ - /** TODO */ - } else if (strcmp(ThisExtn, "GL_ATI_separate_stencil") == 0) { - TRACE_(d3d_caps)(" FOUND: ATI Separate stencil support\n"); - gl_info->supported[ATI_SEPARATE_STENCIL] = TRUE; - } else if (strcmp(ThisExtn, "GL_ATI_texture_env_combine3") == 0) { - TRACE_(d3d_caps)(" FOUND: ATI Texture Env combine (3) support\n"); - gl_info->supported[ATI_TEXTURE_ENV_COMBINE3] = TRUE; - } else if (strcmp(ThisExtn, "GL_ATI_texture_mirror_once") == 0) { - TRACE_(d3d_caps)(" FOUND: ATI Texture Mirror Once support\n"); - gl_info->supported[ATI_TEXTURE_MIRROR_ONCE] = TRUE; - } else if (strcmp(ThisExtn, "GL_EXT_vertex_shader") == 0) { - gl_info->vs_ati_version = VS_VERSION_11; - TRACE_(d3d_caps)(" FOUND: ATI (EXT) Vertex Shader support - version=%02x\n", gl_info->vs_ati_version); - gl_info->supported[EXT_VERTEX_SHADER] = TRUE; - } else if (strcmp(ThisExtn, "GL_ATI_envmap_bumpmap") == 0) { - TRACE_(d3d_caps)(" FOUND: ATI Environment Bump Mapping support\n"); - /* GL_ATI_envmap_bumpmap won't play nice with texture shaders, so disable it - * Won't occur in any real world situation though - */ - if(!gl_info->supported[NV_TEXTURE_SHADER2]) { - gl_info->supported[ATI_ENVMAP_BUMPMAP] = TRUE; - } - /** - * Apple + gl_info->supported[NV_FENCE] = FALSE; + } + if (gl_info->supported[ARB_TEXTURE_CUBE_MAP]) { + TRACE_(d3d_caps)(" IMPLIED: NVIDIA (NV) Texture Gen Reflection support\n"); + gl_info->supported[NV_TEXGEN_REFLECTION] = TRUE; + } + if (gl_info->supported[NV_TEXTURE_SHADER2]) { + /* GL_ATI_envmap_bumpmap won't play nice with texture shaders, so disable it + * Won't occur in any real world situation though */ - } else if (strstr(ThisExtn, "GL_APPLE_fence")) { - /* GL_NV_fence and GL_APPLE_fence provide the same functionality basically. - * The apple extension interacts with some other apple exts. Disable the NV - * extension if the apple one is support to prevent confusion in other parts - * of the code - */ - gl_info->supported[NV_FENCE] = FALSE; - gl_info->supported[APPLE_FENCE] = TRUE; - } else if (strstr(ThisExtn, "GL_APPLE_client_storage")) { - gl_info->supported[APPLE_CLIENT_STORAGE] = TRUE; + gl_info->supported[ATI_ENVMAP_BUMPMAP] = FALSE; + } + if (gl_info->supported[ARB_DRAW_BUFFERS]) { + glGetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &gl_max); + gl_info->max_buffers = gl_max; + TRACE_(d3d_caps)("Max draw buffers: %u\n", gl_max); + } + if (gl_info->supported[ARB_MULTITEXTURE]) { + glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &gl_max); + gl_info->max_textures = min(MAX_TEXTURES, gl_max); + TRACE_(d3d_caps)("Max textures: %d\n", gl_info->max_textures); + + if (gl_info->supported[NV_REGISTER_COMBINERS]) { + GLint tmp; + glGetIntegerv(GL_MAX_GENERAL_COMBINERS_NV, &tmp); + gl_info->max_texture_stages = min(MAX_TEXTURES, tmp); + } else { + gl_info->max_texture_stages = min(MAX_TEXTURES, gl_max); } + TRACE_(d3d_caps)("Max texture stages: %d\n", gl_info->max_texture_stages); - if (*GL_Extensions == ' ') GL_Extensions++; + if (gl_info->supported[ARB_FRAGMENT_PROGRAM]) { + GLint tmp; + glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, &tmp); + gl_info->max_fragment_samplers = min(MAX_FRAGMENT_SAMPLERS, tmp); + } else { + gl_info->max_fragment_samplers = max(gl_info->max_fragment_samplers, gl_max); + } + TRACE_(d3d_caps)("Max fragment samplers: %d\n", gl_info->max_fragment_samplers); + + if (gl_info->supported[ARB_VERTEX_SHADER]) { + GLint tmp; + glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB, &tmp); + gl_info->max_vertex_samplers = tmp; + glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB, &tmp); + gl_info->max_combined_samplers = tmp; + } else { + gl_info->max_combined_samplers = gl_info->max_fragment_samplers; + } + TRACE_(d3d_caps)("Max vertex samplers: %u\n", gl_info->max_vertex_samplers); + TRACE_(d3d_caps)("Max combined samplers: %u\n", gl_info->max_combined_samplers); + } + if (gl_info->supported[ARB_VERTEX_BLEND]) { + glGetIntegerv(GL_MAX_VERTEX_UNITS_ARB, &gl_max); + gl_info->max_blends = gl_max; + TRACE_(d3d_caps)("Max blends: %u\n", gl_info->max_blends); + } + if (gl_info->supported[EXT_TEXTURE3D]) { + glGetIntegerv(GL_MAX_3D_TEXTURE_SIZE_EXT, &gl_max); + gl_info->max_texture3d_size = gl_max; + TRACE_(d3d_caps)("Max texture3D size: %d\n", gl_info->max_texture3d_size); + } + if (gl_info->supported[EXT_TEXTURE_FILTER_ANISOTROPIC]) { + glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &gl_max); + gl_info->max_anisotropy = gl_max; + TRACE_(d3d_caps)("Max anisotropy: %d\n", gl_info->max_anisotropy); } + if (gl_info->supported[ARB_FRAGMENT_PROGRAM]) { + gl_info->ps_arb_version = PS_VERSION_11; + 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_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)); + gl_info->ps_arb_max_instructions = gl_max; + TRACE_(d3d_caps)("Max ARB_FRAGMENT_PROGRAM 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_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)); + gl_info->vs_arb_max_instructions = gl_max; + TRACE_(d3d_caps)("Max ARB_VERTEX_PROGRAM 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); + gl_info->vs_glsl_constantsF = gl_max / 4; + TRACE_(d3d_caps)("Max ARB_VERTEX_SHADER float constants: %u\n", gl_info->vs_glsl_constantsF); + } + if (gl_info->supported[ARB_FRAGMENT_SHADER]) { + glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB, &gl_max); + gl_info->ps_glsl_constantsF = gl_max / 4; + TRACE_(d3d_caps)("Max ARB_FRAGMENT_SHADER float constants: %u\n", gl_info->ps_glsl_constantsF); + } + if (gl_info->supported[EXT_VERTEX_SHADER]) { + gl_info->vs_ati_version = VS_VERSION_11; + } + if (gl_info->supported[NV_VERTEX_PROGRAM3]) { + gl_info->vs_nv_version = VS_VERSION_30; + } else if (gl_info->supported[NV_VERTEX_PROGRAM2]) { + gl_info->vs_nv_version = VS_VERSION_20; + } else if (gl_info->supported[NV_VERTEX_PROGRAM1_1]) { + gl_info->vs_nv_version = VS_VERSION_11; + } else if (gl_info->supported[NV_VERTEX_PROGRAM]) { + gl_info->vs_nv_version = VS_VERSION_10; + } + if (gl_info->supported[NV_FRAGMENT_PROGRAM2]) { + gl_info->ps_nv_version = PS_VERSION_30; + } else if (gl_info->supported[NV_FRAGMENT_PROGRAM]) { + gl_info->ps_nv_version = PS_VERSION_20; + } + } checkGLcall("extension detection\n"); @@ -850,8 +782,6 @@ BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info, Display* display) { * shaders), but 8 texture stages (register combiners). */ gl_info->max_sampler_stages = max(gl_info->max_fragment_samplers, gl_info->max_texture_stages); - if (!gl_info->max_combined_samplers) gl_info->max_combined_samplers = gl_info->max_fragment_samplers; - /* We can only use ORM_FBO when the hardware supports it. */ if (wined3d_settings.offscreen_rendering_mode == ORM_FBO && !gl_info->supported[EXT_FRAMEBUFFER_OBJECT]) { WARN_(d3d_caps)("GL_EXT_framebuffer_object not supported, falling back to PBuffer offscreen rendering mode.\n"); diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 4ab77028e42..11ede057ffe 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -65,7 +65,7 @@ void print_glsl_info_log(WineD3D_GL_Info *gl_info, GLhandleARB obj) { * that if there are errors. */ if (infologLength > 1) { - infoLog = (char *)HeapAlloc(GetProcessHeap(), 0, infologLength); + infoLog = HeapAlloc(GetProcessHeap(), 0, infologLength); GL_EXTCALL(glGetInfoLogARB(obj, infologLength, NULL, infoLog)); FIXME("Error received from GLSL shader #%u: %s\n", obj, debugstr_a(infoLog)); HeapFree(GetProcessHeap(), 0, infoLog); diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index c8e961a7eb6..027f8f1723e 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -1871,7 +1871,7 @@ static BOOL palette9_changed(IWineD3DSurfaceImpl *This) { return FALSE; } } else { - This->palette9 = (PALETTEENTRY *) HeapAlloc(GetProcessHeap(), 0, sizeof(PALETTEENTRY) * 256); + This->palette9 = HeapAlloc(GetProcessHeap(), 0, sizeof(PALETTEENTRY) * 256); } memcpy(This->palette9, &device->palettes[device->currentPalette], sizeof(PALETTEENTRY) * 256); return TRUE; diff --git a/dlls/winedos/int31.c b/dlls/winedos/int31.c index 5fa46c6a95a..dc7351ce5a4 100644 --- a/dlls/winedos/int31.c +++ b/dlls/winedos/int31.c @@ -1253,7 +1253,7 @@ void WINAPI DOSVM_Int31Handler( CONTEXT86 *context ) TRACE( "allocate memory block (%d bytes)\n", size ); - ptr = (BYTE *)DPMI_xalloc( size ); + ptr = DPMI_xalloc( size ); if (!ptr) { SET_AX( context, 0x8012 ); /* linear memory not available */ @@ -1285,7 +1285,7 @@ void WINAPI DOSVM_Int31Handler( CONTEXT86 *context ) TRACE( "resize memory block (0x%08x, %d bytes)\n", handle, size ); - ptr = (BYTE *)DPMI_xrealloc( (void *)handle, size ); + ptr = DPMI_xrealloc( (void *)handle, size ); if (!ptr) { SET_AX( context, 0x8012 ); /* linear memory not available */ diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 8de2e25492b..c5425820325 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -597,6 +597,7 @@ enum x11drv_atoms XATOM_text_plain, XATOM_text_rtf, XATOM_text_richtext, + XATOM_text_uri_list, NB_XATOMS }; diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index 15a362484d1..e4c8a879bdc 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -158,7 +158,8 @@ static const char * const atom_names[NB_XATOMS - FIRST_XATOM] = "text/html", "text/plain", "text/rtf", - "text/richtext" + "text/richtext", + "text/uri-list" }; /*********************************************************************** diff --git a/dlls/winex11.drv/xdnd.c b/dlls/winex11.drv/xdnd.c index f1d6d24e164..59410c56f4f 100644 --- a/dlls/winex11.drv/xdnd.c +++ b/dlls/winex11.drv/xdnd.c @@ -2,6 +2,7 @@ * XDND handler code * * Copyright 2003 Ulrich Czekalla + * Copyright 2007 Damjan Jovanovic * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -26,6 +27,7 @@ # include #endif #include +#include #include "windef.h" #include "winbase.h" @@ -35,6 +37,7 @@ #include "x11drv.h" #include "shlobj.h" /* DROPFILES */ +#include "wine/unicode.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(xdnd); @@ -56,6 +59,7 @@ static LPXDNDDATA XDNDData = NULL; static POINT XDNDxy = { 0, 0 }; static void X11DRV_XDND_InsertXDNDData(int property, int format, void* data, unsigned int len); +static int X11DRV_XDND_DeconstructTextURIList(int property, void* data, int len); static int X11DRV_XDND_DeconstructTextPlain(int property, void* data, int len); static int X11DRV_XDND_DeconstructTextHTML(int property, void* data, int len); static int X11DRV_XDND_MapFormat(unsigned int property, unsigned char *data, int len); @@ -64,6 +68,7 @@ static void X11DRV_XDND_ResolveProperty(Display *display, Window xwin, Time tm, static void X11DRV_XDND_SendDropFiles(HWND hwnd); static void X11DRV_XDND_FreeDragDropOp(void); static unsigned int X11DRV_XDND_UnixToDos(char** lpdest, char* lpsrc, int len); +static WCHAR* X11DRV_XDND_URIToDOS(char *encodedURI); static DROPFILES* X11DRV_XDND_BuildDropFiles(char* filename, unsigned int len, POINT pt); static CRITICAL_SECTION xdnd_cs; @@ -333,7 +338,9 @@ static int X11DRV_XDND_MapFormat(unsigned int property, unsigned char *data, int X11DRV_XDND_InsertXDNDData(property, property, xdata, len); count++; - if (property == x11drv_atom(text_plain)) + if (property == x11drv_atom(text_uri_list)) + count += X11DRV_XDND_DeconstructTextURIList(property, data, len); + else if (property == x11drv_atom(text_plain)) count += X11DRV_XDND_DeconstructTextPlain(property, data, len); else if (property == x11drv_atom(text_html)) count += X11DRV_XDND_DeconstructTextHTML(property, data, len); @@ -343,6 +350,92 @@ static int X11DRV_XDND_MapFormat(unsigned int property, unsigned char *data, int /************************************************************************** + * X11DRV_XDND_DeconstructTextURIList + * + * Interpret text/uri-list data and add records to linked list + */ +static int X11DRV_XDND_DeconstructTextURIList(int property, void* data, int len) +{ + char *uriList = (char*) data; + char *uri; + WCHAR *path; + + char *out = NULL; + int size = 0; + int capacity = 4096; + + int count = 0; + int start = 0; + int end = 0; + + out = HeapAlloc(GetProcessHeap(), 0, capacity); + if (out == NULL) + return 0; + + while (end < len) + { + while (end < len && uriList[end] != '\r') + ++end; + if (end == len) + break; + if (uriList[end+1] != '\n') + { + WARN("URI list line doesn't end in \\r\\n\n"); + break; + } + + uri = HeapAlloc(GetProcessHeap(), 0, end - start + 1); + if (uri == NULL) + break; + lstrcpynA(uri, &uriList[start], end - start + 1); + path = X11DRV_XDND_URIToDOS(uri); + TRACE("converted URI %s to DOS path %s\n", debugstr_a(uri), debugstr_w(path)); + HeapFree(GetProcessHeap(), 0, uri); + + if (path) + { + int pathSize = strlenW(path) + 1; + if (pathSize > capacity-size) + { + capacity = 2*capacity + pathSize; + out = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, out, capacity + 1); + if (out == NULL) + goto done; + } + WideCharToMultiByte(CP_ACP, 0, path, -1, &out[size], pathSize, 0, 0); + size += pathSize; + done: + HeapFree(GetProcessHeap(), 0, path); + if (out == NULL) + break; + } + + start = end + 2; + end = start; + } + if (out && end == len) + { + DROPFILES *dropFiles; + dropFiles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DROPFILES) + size + 1); + if (dropFiles) + { + dropFiles->pFiles = sizeof(DROPFILES); + dropFiles->pt.x = XDNDxy.x; + dropFiles->pt.y = XDNDxy.y; + dropFiles->fNC = 0; + dropFiles->fWide = FALSE; + out[size] = '\0'; + memcpy(((char*)dropFiles) + dropFiles->pFiles, out, size + 1); + X11DRV_XDND_InsertXDNDData(property, CF_HDROP, dropFiles, sizeof(DROPFILES) + size + 1); + count = 1; + } + } + HeapFree(GetProcessHeap(), 0, out); + return count; +} + + +/************************************************************************** * X11DRV_XDND_DeconstructTextPlain * * Interpret text/plain Data and add records to linked list @@ -566,3 +659,86 @@ static unsigned int X11DRV_XDND_UnixToDos(char** lpdest, char* lpsrc, int len) return lines; } + + +/************************************************************************** + * X11DRV_XDND_URIToDOS + */ +static WCHAR* X11DRV_XDND_URIToDOS(char *encodedURI) +{ + WCHAR *ret = NULL; + int i; + int j = 0; + char *uri = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, strlen(encodedURI) + 1); + if (uri == NULL) + return NULL; + for (i = 0; encodedURI[i]; ++i) + { + if (encodedURI[i] == '%') + { + if (encodedURI[i+1] && encodedURI[i+2]) + { + char buffer[3]; + int number; + buffer[0] = encodedURI[i+1]; + buffer[1] = encodedURI[i+2]; + buffer[2] = '\0'; + sscanf(buffer, "%x", &number); + uri[j++] = number; + i += 2; + } + else + { + WARN("invalid URI encoding in %s\n", debugstr_a(encodedURI)); + HeapFree(GetProcessHeap(), 0, uri); + return NULL; + } + } + else + uri[j++] = encodedURI[i]; + } + + /* Read http://www.freedesktop.org/wiki/Draganddropwarts and cry... */ + if (strncmp(uri, "file:/", 6) == 0) + { + if (uri[6] == '/') + { + if (uri[7] == '/') + { + /* file:///path/to/file (nautilus, thunar) */ + ret = wine_get_dos_file_name(&uri[7]); + } + else if (uri[7]) + { + /* file://hostname/path/to/file (X file drag spec) */ + char hostname[256]; + char *path = strchr(&uri[7], '/'); + if (path) + { + *path = '\0'; + if (strcmp(&uri[7], "localhost") == 0) + { + *path = '/'; + ret = wine_get_dos_file_name(path); + } + else if (gethostname(hostname, sizeof(hostname)) == 0) + { + if (strcmp(hostname, &uri[7]) == 0) + { + *path = '/'; + ret = wine_get_dos_file_name(path); + } + } + } + } + } + else if (uri[6]) + { + /* file:/path/to/file (konqueror) */ + ret = wine_get_dos_file_name(&uri[5]); + } + } + HeapFree(GetProcessHeap(), 0, uri); + return ret; +} + diff --git a/dlls/wininet/tests/url.c b/dlls/wininet/tests/url.c index 10b45c962a4..98442bbb841 100644 --- a/dlls/wininet/tests/url.c +++ b/dlls/wininet/tests/url.c @@ -569,7 +569,7 @@ static void InternetCreateUrlA_test(void) urlComp.lpszScheme = nhttp; urlComp.dwSchemeLength = strlen(urlComp.lpszScheme); len = strlen(CREATE_URL6) + 1; - szUrl = (char *)HeapAlloc(GetProcessHeap(), 0, len); + szUrl = HeapAlloc(GetProcessHeap(), 0, len); ret = InternetCreateUrlA(&urlComp, ICU_ESCAPE, szUrl, &len); ok(ret, "Expected success\n"); ok(len == strlen(CREATE_URL6), "Expected len %d, got %d\n", lstrlenA(CREATE_URL6) + 1, len); @@ -606,7 +606,7 @@ static void InternetCreateUrlA_test(void) urlComp.lpszExtraInfo = empty; urlComp.dwExtraInfoLength = 0; len = strlen(CREATE_URL1); - szUrl = (char *)HeapAlloc(GetProcessHeap(), 0, ++len); + szUrl = HeapAlloc(GetProcessHeap(), 0, ++len); ret = InternetCreateUrlA(&urlComp, ICU_ESCAPE, szUrl, &len); ok(ret, "Expected success\n"); ok(len == strlen(CREATE_URL1), "Expected len %d, got %d\n", lstrlenA(CREATE_URL1), len); @@ -631,7 +631,7 @@ static void InternetCreateUrlA_test(void) urlComp.lpszExtraInfo = empty; urlComp.dwExtraInfoLength = 0; len = strlen(CREATE_URL8); - szUrl = (char *)HeapAlloc(GetProcessHeap(), 0, ++len); + szUrl = HeapAlloc(GetProcessHeap(), 0, ++len); ret = InternetCreateUrlA(&urlComp, ICU_ESCAPE, szUrl, &len); ok(ret, "Expected success\n"); ok(len == strlen(CREATE_URL8), "Expected len %d, got %d\n", lstrlenA(CREATE_URL8), len); @@ -647,7 +647,7 @@ static void InternetCreateUrlA_test(void) urlComp.dwUrlPathLength = 5; len = strlen(CREATE_URL9); len++; /* work around bug in native wininet */ - szUrl = (char *)HeapAlloc(GetProcessHeap(), 0, ++len); + szUrl = HeapAlloc(GetProcessHeap(), 0, ++len); ret = InternetCreateUrlA(&urlComp, ICU_ESCAPE, szUrl, &len); ok(ret, "Expected success\n"); ok(len == strlen(CREATE_URL9), "Expected len %d, got %d\n", lstrlenA(CREATE_URL9), len); @@ -662,7 +662,7 @@ static void InternetCreateUrlA_test(void) urlComp.lpszUrlPath = blank; len = strlen(CREATE_URL10); len++; /* work around bug in native wininet */ - szUrl = (char *)HeapAlloc(GetProcessHeap(), 0, ++len); + szUrl = HeapAlloc(GetProcessHeap(), 0, ++len); ret = InternetCreateUrlA(&urlComp, ICU_ESCAPE, szUrl, &len); ok(ret, "Expected success\n"); ok(len == strlen(CREATE_URL10), "Expected len %d, got %d\n", lstrlenA(CREATE_URL10), len); @@ -675,7 +675,7 @@ static void InternetCreateUrlA_test(void) urlComp.nPort = 8080; urlComp.lpszScheme = about; len = strlen(CREATE_URL11); - szUrl = (char *)HeapAlloc(GetProcessHeap(), 0, ++len); + szUrl = HeapAlloc(GetProcessHeap(), 0, ++len); ret = InternetCreateUrlA(&urlComp, ICU_ESCAPE, szUrl, &len); ok(ret, "Expected success\n"); ok(len == strlen(CREATE_URL11), "Expected len %d, got %d\n", lstrlenA(CREATE_URL11), len); @@ -692,7 +692,7 @@ static void InternetCreateUrlA_test(void) urlComp.dwHostNameLength = 0; urlComp.nPort = 65535; len = strlen(CREATE_URL12); - szUrl = (char *)HeapAlloc(GetProcessHeap(), 0, ++len); + szUrl = HeapAlloc(GetProcessHeap(), 0, ++len); ret = InternetCreateUrlA(&urlComp, ICU_ESCAPE, szUrl, &len); ok(ret, "Expected success\n"); ok(len == strlen(CREATE_URL12), "Expected len %d, got %d\n", lstrlenA(CREATE_URL12), len); diff --git a/include/wine/wined3d_gl.h b/include/wine/wined3d_gl.h index 1d69e59f01e..b0e1bc576b6 100644 --- a/include/wine/wined3d_gl.h +++ b/include/wine/wined3d_gl.h @@ -1578,6 +1578,7 @@ typedef enum _GL_SupportedExt { /* NVIDIA */ NV_FOG_DISTANCE, NV_FRAGMENT_PROGRAM, + NV_FRAGMENT_PROGRAM2, NV_OCCLUSION_QUERY, NV_REGISTER_COMBINERS, NV_REGISTER_COMBINERS2, @@ -1587,6 +1588,9 @@ typedef enum _GL_SupportedExt { NV_TEXTURE_SHADER2, NV_TEXTURE_SHADER3, NV_VERTEX_PROGRAM, + NV_VERTEX_PROGRAM1_1, + NV_VERTEX_PROGRAM2, + NV_VERTEX_PROGRAM3, NV_FENCE, /* ATI */ ATI_SEPARATE_STENCIL, diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c index 2a075c53fdb..482d8701c9d 100644 --- a/programs/cmd/builtins.c +++ b/programs/cmd/builtins.c @@ -487,7 +487,7 @@ BOOL WCMD_delete (WCHAR *command, BOOL expectDir) { WINE_TRACE("Recursive, Adding to search list '%s'\n", wine_dbgstr_w(subParm)); /* Allocate memory, add to list */ - nextDir = (DIRECTORY_STACK *) HeapAlloc(GetProcessHeap(),0,sizeof(DIRECTORY_STACK)); + nextDir = HeapAlloc(GetProcessHeap(),0,sizeof(DIRECTORY_STACK)); if (allDirs == NULL) allDirs = nextDir; if (lastEntry != NULL) lastEntry->next = nextDir; lastEntry = nextDir; diff --git a/programs/cmd/directory.c b/programs/cmd/directory.c index d28421f0c42..0de5bb8d2c9 100644 --- a/programs/cmd/directory.c +++ b/programs/cmd/directory.c @@ -342,7 +342,7 @@ void WCMD_directory (WCHAR *cmd) { } WINE_TRACE("Using path '%s'\n", wine_dbgstr_w(path)); - thisEntry = (DIRECTORY_STACK *) HeapAlloc(GetProcessHeap(),0,sizeof(DIRECTORY_STACK)); + thisEntry = HeapAlloc(GetProcessHeap(),0,sizeof(DIRECTORY_STACK)); if (fullParms == NULL) fullParms = thisEntry; if (prevEntry != NULL) prevEntry->next = thisEntry; prevEntry = thisEntry; @@ -370,7 +370,7 @@ void WCMD_directory (WCHAR *cmd) { /* If just 'dir' entered, a '*' parameter is assumed */ if (fullParms == NULL) { WINE_TRACE("Inserting default '*'\n"); - fullParms = (DIRECTORY_STACK *) HeapAlloc(GetProcessHeap(),0, sizeof(DIRECTORY_STACK)); + fullParms = HeapAlloc(GetProcessHeap(),0, sizeof(DIRECTORY_STACK)); fullParms->next = NULL; fullParms->dirName = HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR) * (strlenW(cwd)+1)); strcpyW(fullParms->dirName, cwd); @@ -739,7 +739,7 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le WINE_TRACE("Recursive, Adding to search list '%s'\n", wine_dbgstr_w(string)); /* Allocate memory, add to list */ - thisDir = (DIRECTORY_STACK *) HeapAlloc(GetProcessHeap(),0,sizeof(DIRECTORY_STACK)); + thisDir = HeapAlloc(GetProcessHeap(),0,sizeof(DIRECTORY_STACK)); if (dirStack == NULL) dirStack = thisDir; if (lastEntry != NULL) lastEntry->next = thisDir; lastEntry = thisDir; -- 2.11.4.GIT