From 18dc168d7b57584c31d5c22b082f0b8be956a91a Mon Sep 17 00:00:00 2001 From: Jan Zerebecki Date: Sat, 20 Dec 2008 14:23:32 +0100 Subject: [PATCH] push 084dff4372cac27ae9a08371ef0349bdb4820d62 --- dlls/crypt32/decode.c | 24 +-- dlls/crypt32/encode.c | 7 +- dlls/crypt32/filestore.c | 2 +- dlls/crypt32/tests/encode.c | 5 + dlls/crypt32/tests/store.c | 114 +++++++++++ dlls/cryptui/main.c | 79 +++++--- dlls/d3dxof/tests/d3dxof.c | 2 +- dlls/dinput/device.c | 34 ---- dlls/dinput/device_private.h | 11 -- dlls/dmusic/Makefile.in | 4 +- dlls/dmusic/dmusic_private.h | 24 +-- dlls/dmusic/port.c | 111 ++++++++++- dlls/dmusic/portdownload.c | 111 ----------- dlls/dmusic/thru.c | 77 -------- dlls/mscoree/mscoree.spec | 2 +- dlls/mscoree/mscoree_main.c | 6 + dlls/mshtml/htmldoc.c | 3 + dlls/mshtml/htmlstyle.c | 4 +- dlls/mshtml/tests/dom.c | 4 + dlls/mshtml/tests/htmldoc.c | 5 + dlls/msi/tests/msi.c | 4 +- dlls/msvcrt/tests/file.c | 2 +- dlls/msxml3/domdoc.c | 50 +++++ dlls/msxml3/httprequest.c | 2 +- dlls/msxml3/msxml_private.h | 1 - dlls/msxml3/tests/domdoc.c | 10 + dlls/msxml3/xmlelem.c | 4 +- dlls/riched20/editor.c | 133 ++++++++----- dlls/riched20/editor.h | 2 + dlls/riched20/editstr.h | 1 - dlls/riched20/paint.c | 207 ++++++++------------ dlls/riched20/wrap.c | 18 +- dlls/winealsa.drv/midi.c | 27 ++- dlls/wined3d/arb_program_shader.c | 118 +++++------ dlls/wined3d/baseshader.c | 34 ++-- dlls/wined3d/device.c | 34 ++-- dlls/wined3d/glsl_shader.c | 402 ++++++++++++++++++++++++++------------ dlls/wined3d/indexbuffer.c | 2 +- dlls/wined3d/stateblock.c | 25 ++- dlls/wined3d/utils.c | 10 + dlls/wined3d/wined3d_private.h | 9 +- dlls/winex11.drv/xinerama.c | 2 +- include/mscoree.idl | 2 + tools/winemaker | 2 +- 44 files changed, 958 insertions(+), 772 deletions(-) delete mode 100644 dlls/dmusic/portdownload.c delete mode 100644 dlls/dmusic/thru.c diff --git a/dlls/crypt32/decode.c b/dlls/crypt32/decode.c index 632369fc1d8..fa06510a350 100644 --- a/dlls/crypt32/decode.c +++ b/dlls/crypt32/decode.c @@ -376,26 +376,10 @@ static BOOL CRYPT_AsnDecodeSequenceItems(struct AsnDecodeSequenceItem items[], } else { - if (itemLen == CMSG_INDEFINITE_LENGTH) - { - if (itemDecoded > itemEncodedLen - 2 || - *(ptr + itemDecoded) != 0 || - *(ptr + itemDecoded + 1) != 0) - { - TRACE("expected 0 TLV\n"); - SetLastError(CRYPT_E_ASN1_CORRUPT); - ret = FALSE; - } - else - itemDecoded += 2; - } - if (ret) - { - ptr += itemDecoded; - decoded += itemDecoded; - TRACE("item %d: decoded %d bytes\n", i, - itemDecoded); - } + ptr += itemDecoded; + decoded += itemDecoded; + TRACE("item %d: decoded %d bytes\n", i, + itemDecoded); } } else if (items[i].optional && diff --git a/dlls/crypt32/encode.c b/dlls/crypt32/encode.c index 12ab05fc0b6..2440d1696f1 100644 --- a/dlls/crypt32/encode.c +++ b/dlls/crypt32/encode.c @@ -796,7 +796,7 @@ BOOL WINAPI CRYPT_AsnEncodeOid(DWORD dwCertEncodingType, const char *ptr; int val1, val2; - if (sscanf(pszObjId, "%d.%d.%n", &val1, &val2, &firstPos) != 2) + if (sscanf(pszObjId, "%d.%d%n", &val1, &val2, &firstPos) != 2) { SetLastError(CRYPT_E_ASN1_ERROR); return FALSE; @@ -804,6 +804,11 @@ BOOL WINAPI CRYPT_AsnEncodeOid(DWORD dwCertEncodingType, bytesNeeded++; firstByte = val1 * 40 + val2; ptr = pszObjId + firstPos; + if (*ptr == '.') + { + ptr++; + firstPos++; + } while (ret && *ptr) { int pos; diff --git a/dlls/crypt32/filestore.c b/dlls/crypt32/filestore.c index cfa29b33563..a33b828cebc 100644 --- a/dlls/crypt32/filestore.c +++ b/dlls/crypt32/filestore.c @@ -338,7 +338,7 @@ PWINECRYPT_CERTSTORE CRYPT_FileNameOpenStoreW(HCRYPTPROV hCryptProv, CERT_QUERY_CONTENT_FLAG_CERT | CERT_QUERY_CONTENT_FLAG_SERIALIZED_STORE | CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED, - CERT_QUERY_FORMAT_FLAG_BINARY, 0, NULL, &contentType, NULL, + CERT_QUERY_FORMAT_FLAG_ALL, 0, NULL, &contentType, NULL, &memStore, NULL, NULL); if (ret) { diff --git a/dlls/crypt32/tests/encode.c b/dlls/crypt32/tests/encode.c index 952e2468936..bb60798388e 100644 --- a/dlls/crypt32/tests/encode.c +++ b/dlls/crypt32/tests/encode.c @@ -2536,17 +2536,22 @@ static CERT_EXTENSION criticalExt = { oid_basic_constraints2, TRUE, { 8, crit_ext_data } }; static CERT_EXTENSION nonCriticalExt = { oid_basic_constraints2, FALSE, { 8, noncrit_ext_data } }; +static CHAR oid_short[] = "1.1"; +static CERT_EXTENSION extWithShortOid = + { oid_short, FALSE, { 0, NULL } }; static const BYTE ext0[] = { 0x30,0x00 }; static const BYTE ext1[] = { 0x30,0x14,0x30,0x12,0x06,0x03,0x55,0x1d,0x13,0x01,0x01, 0xff,0x04,0x08,0x30,0x06,0x01,0x01,0xff,0x02,0x01,0x01 }; static const BYTE ext2[] = { 0x30,0x11,0x30,0x0f,0x06,0x03,0x55,0x1d,0x13,0x04, 0x08,0x30,0x06,0x01,0x01,0xff,0x02,0x01,0x01 }; +static const BYTE ext3[] = { 0x30,0x07,0x30,0x05,0x06,0x01,0x29,0x04,0x00 }; static const struct encodedExtensions exts[] = { { { 0, NULL }, ext0 }, { { 1, &criticalExt }, ext1 }, { { 1, &nonCriticalExt }, ext2 }, + { { 1, &extWithShortOid }, ext3 } }; static void test_encodeExtensions(DWORD dwEncoding) diff --git a/dlls/crypt32/tests/store.c b/dlls/crypt32/tests/store.c index 450b754953b..ae2112399af 100644 --- a/dlls/crypt32/tests/store.c +++ b/dlls/crypt32/tests/store.c @@ -1251,9 +1251,71 @@ static BOOL initFileFromData(LPCWSTR filename, const BYTE *pb, DWORD cb) ret = FALSE; return ret; } + +static const BYTE base64SPC[] = +"MIICJQYJKoZIhvcNAQcCoIICFjCCAhICAQExADALBgkqhkiG9w0BBwGgggH6MIIB" +"9jCCAV+gAwIBAgIQnP8+EF4opr9OxH7h4uBPWTANBgkqhkiG9w0BAQQFADAUMRIw" +"EAYDVQQDEwlKdWFuIExhbmcwHhcNMDgxMjEyMTcxMDE0WhcNMzkxMjMxMjM1OTU5" +"WjAUMRIwEAYDVQQDEwlKdWFuIExhbmcwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJ" +"AoGBALCgNjyNvOic0FOfjxvi43HbM+D5joDkhiGSXe+gbZlf8f16k07kkObFEunz" +"mdB5coscmA7gyqiWNN4ZUyr2cA3lCbnpGPA/0IblyyOcuGIFmmCzeZaVa5ZG6xZP" +"K7L7o+73Qo6jXVbGhBGnMZ7Q9sAn6s2933olnStnejnqwV0NAgMBAAGjSTBHMEUG" +"A1UdAQQ+MDyAEFKbKEdXYyx+CWKcV6vxM6ShFjAUMRIwEAYDVQQDEwlKdWFuIExh" +"bmeCEJz/PhBeKKa/TsR+4eLgT1kwDQYJKoZIhvcNAQEEBQADgYEALpkgLgW3mEaK" +"idPQ3iPJYLG0Ub1wraqEl9bd42hrhzIdcDzlQgxnm8/5cHYVxIF/C20x/HJplb1R" +"G6U1ipFe/q8byWD/9JpiBKMGPi9YlUTgXHfS9d4S/QWO1h9Z7KeipBYhoslQpHXu" +"y9bUr8Adqi6SzgHpCnMu53dxgxUD1r4xAA=="; +/* Same as base64SPC, but as a wide-char string */ +static const WCHAR utf16Base64SPC[] = { +'M','I','I','C','J','Q','Y','J','K','o','Z','I','h','v','c','N','A', +'Q','c','C','o','I','I','C','F','j','C','C','A','h','I','C','A','Q', +'E','x','A','D','A','L','B','g','k','q','h','k','i','G','9','w','0', +'B','B','w','G','g','g','g','H','6','M','I','I','B','9','j','C','C', +'A','V','+','g','A','w','I','B','A','g','I','Q','n','P','8','+','E', +'F','4','o','p','r','9','O','x','H','7','h','4','u','B','P','W','T', +'A','N','B','g','k','q','h','k','i','G','9','w','0','B','A','Q','Q', +'F','A','D','A','U','M','R','I','w','E','A','Y','D','V','Q','Q','D', +'E','w','l','K','d','W','F','u','I','E','x','h','b','m','c','w','H', +'h','c','N','M','D','g','x','M','j','E','y','M','T','c','x','M','D', +'E','0','W','h','c','N','M','z','k','x','M','j','M','x','M','j','M', +'1','O','T','U','5','W','j','A','U','M','R','I','w','E','A','Y','D', +'V','Q','Q','D','E','w','l','K','d','W','F','u','I','E','x','h','b', +'m','c','w','g','Z','8','w','D','Q','Y','J','K','o','Z','I','h','v', +'c','N','A','Q','E','B','B','Q','A','D','g','Y','0','A','M','I','G', +'J','A','o','G','B','A','L','C','g','N','j','y','N','v','O','i','c', +'0','F','O','f','j','x','v','i','4','3','H','b','M','+','D','5','j', +'o','D','k','h','i','G','S','X','e','+','g','b','Z','l','f','8','f', +'1','6','k','0','7','k','k','O','b','F','E','u','n','z','m','d','B', +'5','c','o','s','c','m','A','7','g','y','q','i','W','N','N','4','Z', +'U','y','r','2','c','A','3','l','C','b','n','p','G','P','A','/','0', +'I','b','l','y','y','O','c','u','G','I','F','m','m','C','z','e','Z', +'a','V','a','5','Z','G','6','x','Z','P','K','7','L','7','o','+','7', +'3','Q','o','6','j','X','V','b','G','h','B','G','n','M','Z','7','Q', +'9','s','A','n','6','s','2','9','3','3','o','l','n','S','t','n','e', +'j','n','q','w','V','0','N','A','g','M','B','A','A','G','j','S','T', +'B','H','M','E','U','G','A','1','U','d','A','Q','Q','+','M','D','y', +'A','E','F','K','b','K','E','d','X','Y','y','x','+','C','W','K','c', +'V','6','v','x','M','6','S','h','F','j','A','U','M','R','I','w','E', +'A','Y','D','V','Q','Q','D','E','w','l','K','d','W','F','u','I','E', +'x','h','b','m','e','C','E','J','z','/','P','h','B','e','K','K','a', +'/','T','s','R','+','4','e','L','g','T','1','k','w','D','Q','Y','J', +'K','o','Z','I','h','v','c','N','A','Q','E','E','B','Q','A','D','g', +'Y','E','A','L','p','k','g','L','g','W','3','m','E','a','K','i','d', +'P','Q','3','i','P','J','Y','L','G','0','U','b','1','w','r','a','q', +'E','l','9','b','d','4','2','h','r','h','z','I','d','c','D','z','l', +'Q','g','x','n','m','8','/','5','c','H','Y','V','x','I','F','/','C', +'2','0','x','/','H','J','p','l','b','1','R','G','6','U','1','i','p', +'F','e','/','q','8','b','y','W','D','/','9','J','p','i','B','K','M', +'G','P','i','9','Y','l','U','T','g','X','H','f','S','9','d','4','S', +'/','Q','W','O','1','h','9','Z','7','K','e','i','p','B','Y','h','o', +'s','l','Q','p','H','X','u','y','9','b','U','r','8','A','d','q','i', +'6','S','z','g','H','p','C','n','M','u','5','3','d','x','g','x','U', +'D','1','r','4','x','A','A','=','=',0 }; + static void testFileNameStore(void) { static const WCHAR szPrefix[] = { 'c','e','r',0 }; + static const WCHAR spcPrefix[] = { 's','p','c',0 }; static const WCHAR szDot[] = { '.',0 }; WCHAR filename[MAX_PATH]; HCERTSTORE store; @@ -1387,6 +1449,58 @@ static void testFileNameStore(void) sizeof(serializedStoreWithCertAndCRL)); } DeleteFileW(filename); + + if (!GetTempFileNameW(szDot, spcPrefix, 0, filename)) + return; + DeleteFileW(filename); + + if (initFileFromData(filename, base64SPC, sizeof(base64SPC))) + { + PCCERT_CONTEXT cert; + PCCRL_CONTEXT crl; + + store = CertOpenStore(CERT_STORE_PROV_FILENAME_W, 0, 0, + CERT_STORE_READONLY_FLAG, filename); + ok(store != NULL, "CertOpenStore failed: %08x\n", GetLastError()); + + cert = CertEnumCertificatesInStore(store, NULL); + ok(cert != NULL, "CertEnumCertificatesInStore failed: %08x\n", + GetLastError()); + cert = CertEnumCertificatesInStore(store, cert); + ok(!cert, "Expected only one cert\n"); + if (pCertEnumCRLsInStore) + { + crl = pCertEnumCRLsInStore(store, NULL); + ok(!crl, "Expected no CRLs\n"); + } + + CertCloseStore(store, 0); + DeleteFileW(filename); + } + if (initFileFromData(filename, (BYTE *)utf16Base64SPC, + sizeof(utf16Base64SPC))) + { + PCCERT_CONTEXT cert; + PCCRL_CONTEXT crl; + + store = CertOpenStore(CERT_STORE_PROV_FILENAME_W, 0, 0, + CERT_STORE_READONLY_FLAG, filename); + ok(store != NULL, "CertOpenStore failed: %08x\n", GetLastError()); + + cert = CertEnumCertificatesInStore(store, NULL); + ok(cert != NULL, "CertEnumCertificatesInStore failed: %08x\n", + GetLastError()); + cert = CertEnumCertificatesInStore(store, cert); + ok(!cert, "Expected only one cert\n"); + if (pCertEnumCRLsInStore) + { + crl = pCertEnumCRLsInStore(store, NULL); + ok(!crl, "Expected no CRLs\n"); + } + + CertCloseStore(store, 0); + DeleteFileW(filename); + } } static const BYTE signedContent[] = { diff --git a/dlls/cryptui/main.c b/dlls/cryptui/main.c index 169d0cd33dc..82a877f0456 100644 --- a/dlls/cryptui/main.c +++ b/dlls/cryptui/main.c @@ -1157,7 +1157,6 @@ struct detail_data BOOL *pfPropertiesChanged; int cFields; struct field_value_data *fields; - HIMAGELIST imageList; }; typedef void (*add_fields_func)(HWND hwnd, struct detail_data *data); @@ -1860,9 +1859,16 @@ static void add_known_usage(HWND lv, PCCRYPT_OID_INFO info) SendMessageW(lv, LVM_INSERTITEMW, 0, (LPARAM)&item); } -static void show_cert_usages(HWND hwnd, struct detail_data *data) +struct edit_cert_data { - PCCERT_CONTEXT cert = data->pCertViewInfo->pCertContext; + PCCERT_CONTEXT cert; + BOOL *pfPropertiesChanged; + HIMAGELIST imageList; +}; + +static void show_cert_usages(HWND hwnd, struct edit_cert_data *data) +{ + PCCERT_CONTEXT cert = data->cert; HWND lv = GetDlgItem(hwnd, IDC_CERTIFICATE_USAGES); PCERT_ENHKEY_USAGE usage; DWORD size; @@ -1949,9 +1955,9 @@ static void show_cert_usages(HWND hwnd, struct detail_data *data) BM_CLICK, 0, 0); } -static void set_general_cert_properties(HWND hwnd, struct detail_data *data) +static void set_general_cert_properties(HWND hwnd, struct edit_cert_data *data) { - PCCERT_CONTEXT cert = data->pCertViewInfo->pCertContext; + PCCERT_CONTEXT cert = data->cert; WCHAR *str; if ((str = get_cert_property_as_string(cert, CERT_FRIENDLY_NAME_PROP_ID))) @@ -2021,27 +2027,25 @@ static BOOL CALLBACK refresh_propsheet_pages(HWND hwnd, LPARAM lParam) static void apply_general_changes(HWND hwnd) { WCHAR buf[MAX_DESCRIPTION + 1]; - struct detail_data *data = - (struct detail_data *)GetWindowLongPtrW(hwnd, DWLP_USER); + struct edit_cert_data *data = + (struct edit_cert_data *)GetWindowLongPtrW(hwnd, DWLP_USER); SendMessageW(GetDlgItem(hwnd, IDC_FRIENDLY_NAME), WM_GETTEXT, sizeof(buf) / sizeof(buf[0]), (LPARAM)buf); - set_cert_string_property(data->pCertViewInfo->pCertContext, - CERT_FRIENDLY_NAME_PROP_ID, buf); + set_cert_string_property(data->cert, CERT_FRIENDLY_NAME_PROP_ID, buf); SendMessageW(GetDlgItem(hwnd, IDC_DESCRIPTION), WM_GETTEXT, sizeof(buf) / sizeof(buf[0]), (LPARAM)buf); - set_cert_string_property(data->pCertViewInfo->pCertContext, - CERT_DESCRIPTION_PROP_ID, buf); + set_cert_string_property(data->cert, CERT_DESCRIPTION_PROP_ID, buf); if (IsDlgButtonChecked(hwnd, IDC_ENABLE_ALL_PURPOSES)) { /* Setting a NULL usage removes the enhanced key usage property. */ - CertSetEnhancedKeyUsage(data->pCertViewInfo->pCertContext, NULL); + CertSetEnhancedKeyUsage(data->cert, NULL); } else if (IsDlgButtonChecked(hwnd, IDC_DISABLE_ALL_PURPOSES)) { CERT_ENHKEY_USAGE usage = { 0, NULL }; - CertSetEnhancedKeyUsage(data->pCertViewInfo->pCertContext, &usage); + CertSetEnhancedKeyUsage(data->cert, &usage); } else if (IsDlgButtonChecked(hwnd, IDC_ENABLE_SELECTED_PURPOSES)) { @@ -2078,7 +2082,7 @@ static void apply_general_changes(HWND hwnd) } } } - CertSetEnhancedKeyUsage(data->pCertViewInfo->pCertContext, &usage); + CertSetEnhancedKeyUsage(data->cert, &usage); HeapFree(GetProcessHeap(), 0, usage.rgpszUsageIdentifier); } EnumChildWindows(GetParent(GetParent(hwnd)), refresh_propsheet_pages, 0); @@ -2090,7 +2094,6 @@ static LRESULT CALLBACK cert_properties_general_dlg_proc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) { PROPSHEETPAGEW *page; - struct detail_data *data; TRACE("(%p, %08x, %08lx, %08lx)\n", hwnd, msg, wp, lp); @@ -2099,15 +2102,36 @@ static LRESULT CALLBACK cert_properties_general_dlg_proc(HWND hwnd, UINT msg, case WM_INITDIALOG: { HWND description = GetDlgItem(hwnd, IDC_DESCRIPTION); + struct detail_data *detailData; + struct edit_cert_data *editData; page = (PROPSHEETPAGEW *)lp; - data = (struct detail_data *)page->lParam; + detailData = (struct detail_data *)page->lParam; SendMessageW(GetDlgItem(hwnd, IDC_FRIENDLY_NAME), EM_SETLIMITTEXT, MAX_FRIENDLY_NAME, 0); SendMessageW(description, EM_SETLIMITTEXT, MAX_DESCRIPTION, 0); ShowScrollBar(description, SB_VERT, FALSE); - set_general_cert_properties(hwnd, data); - SetWindowLongPtrW(hwnd, DWLP_USER, (LPARAM)data); + editData = HeapAlloc(GetProcessHeap(), 0, + sizeof(struct edit_cert_data)); + if (editData) + { + editData->imageList = ImageList_Create(16, 16, + ILC_COLOR4 | ILC_MASK, 4, 0); + if (editData->imageList) + { + HBITMAP bmp; + COLORREF backColor = RGB(255, 0, 255); + + bmp = LoadBitmapW(hInstance, MAKEINTRESOURCEW(IDB_CHECKS)); + ImageList_AddMasked(editData->imageList, bmp, backColor); + DeleteObject(bmp); + ImageList_SetBkColor(editData->imageList, CLR_NONE); + } + editData->cert = detailData->pCertViewInfo->pCertContext; + editData->pfPropertiesChanged = detailData->pfPropertiesChanged; + SetWindowLongPtrW(hwnd, DWLP_USER, (LPARAM)editData); + set_general_cert_properties(hwnd, editData); + } break; } case WM_NOTIFY: @@ -2172,6 +2196,7 @@ static UINT CALLBACK cert_properties_general_callback(HWND hwnd, UINT msg, { HWND lv; int cItem, i; + struct edit_cert_data *data; switch (msg) { @@ -2196,6 +2221,12 @@ static UINT CALLBACK cert_properties_general_callback(HWND hwnd, UINT msg, } } } + data = (struct edit_cert_data *)GetWindowLongPtrW(hwnd, DWLP_USER); + if (data) + { + ImageList_Destroy(data->imageList); + HeapFree(GetProcessHeap(), 0, data); + } break; } return 1; @@ -2359,7 +2390,6 @@ static UINT CALLBACK detail_callback(HWND hwnd, UINT msg, case PSPCB_RELEASE: data = (struct detail_data *)page->lParam; free_detail_fields(data); - ImageList_Destroy(data->imageList); HeapFree(GetProcessHeap(), 0, data); break; } @@ -2379,17 +2409,6 @@ static BOOL init_detail_page(PCCRYPTUI_VIEWCERTIFICATE_STRUCTW pCertViewInfo, data->pfPropertiesChanged = pfPropertiesChanged; data->cFields = 0; data->fields = NULL; - data->imageList = ImageList_Create(16, 16, ILC_COLOR4 | ILC_MASK, 4, 0); - if (data->imageList) - { - HBITMAP bmp; - COLORREF backColor = RGB(255, 0, 255); - - bmp = LoadBitmapW(hInstance, MAKEINTRESOURCEW(IDB_CHECKS)); - ImageList_AddMasked(data->imageList, bmp, backColor); - DeleteObject(bmp); - ImageList_SetBkColor(data->imageList, CLR_NONE); - } memset(page, 0, sizeof(PROPSHEETPAGEW)); page->dwSize = sizeof(PROPSHEETPAGEW); page->dwFlags = PSP_USECALLBACK; diff --git a/dlls/d3dxof/tests/d3dxof.c b/dlls/d3dxof/tests/d3dxof.c index 3315721416c..f70758630f4 100644 --- a/dlls/d3dxof/tests/d3dxof.c +++ b/dlls/d3dxof/tests/d3dxof.c @@ -227,7 +227,7 @@ static void test_dump(void) goto exit; } - printf("Load %d (%d) bytes\n", cbSize, strlen(pvData)); + printf("Load %d bytes\n", cbSize); hr = pDirectXFileCreate(&lpDirectXFile); ok(hr == DXFILE_OK, "DirectXFileCreate: %x\n", hr); diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c index aaf55778e66..ebc87ebddda 100644 --- a/dlls/dinput/device.c +++ b/dlls/dinput/device.c @@ -532,40 +532,6 @@ int find_property(const DataFormat *df, LPCDIPROPHEADER ph) return -1; } - -BOOL DIEnumDevicesCallbackAtoW(LPCDIDEVICEOBJECTINSTANCEA lpddi, LPVOID lpvRef) { - DIDEVICEOBJECTINSTANCEW ddtmp; - device_enumobjects_AtoWcb_data* data; - - data = (device_enumobjects_AtoWcb_data*) lpvRef; - - memset(&ddtmp, 0, sizeof(ddtmp)); - - ddtmp.dwSize = sizeof(DIDEVICEINSTANCEW); - ddtmp.guidType = lpddi->guidType; - ddtmp.dwOfs = lpddi->dwOfs; - ddtmp.dwType = lpddi->dwType; - ddtmp.dwFlags = lpddi->dwFlags; - MultiByteToWideChar(CP_ACP, 0, lpddi->tszName, -1, ddtmp.tszName, MAX_PATH); - - if (lpddi->dwSize == sizeof(DIDEVICEINSTANCEA)) { - /** - * if dwSize < sizeof(DIDEVICEINSTANCEA of DInput version >= 5) - * force feedback and other newer data aren't available - */ - ddtmp.dwFFMaxForce = lpddi->dwFFMaxForce; - ddtmp.dwFFForceResolution = lpddi->dwFFForceResolution; - ddtmp.wCollectionNumber = lpddi->wCollectionNumber; - ddtmp.wDesignatorIndex = lpddi->wDesignatorIndex; - ddtmp.wUsagePage = lpddi->wUsagePage; - ddtmp.wUsage = lpddi->wUsage; - ddtmp.dwDimension = lpddi->dwDimension; - ddtmp.wExponent = lpddi->wExponent; - ddtmp.wReserved = lpddi->wReserved; - } - return data->lpCallBack(&ddtmp, data->lpvRef); -} - /****************************************************************************** * queue_event - add new event to the ring queue */ diff --git a/dlls/dinput/device_private.h b/dlls/dinput/device_private.h index dd06a4b50d3..346338201e2 100644 --- a/dlls/dinput/device_private.h +++ b/dlls/dinput/device_private.h @@ -104,17 +104,6 @@ typedef struct LPDIRECTINPUTEFFECT ref; } effect_list_item; -/** - * Callback Data used by specific callback - * for EnumObject on 'W' interfaces - */ -typedef struct { - LPDIENUMDEVICEOBJECTSCALLBACKW lpCallBack; - LPVOID lpvRef; -} device_enumobjects_AtoWcb_data; - -extern BOOL DIEnumDevicesCallbackAtoW(LPCDIDEVICEOBJECTINSTANCEA, LPVOID); - extern const GUID DInput_Wine_Keyboard_GUID; extern const GUID DInput_Wine_Mouse_GUID; diff --git a/dlls/dmusic/Makefile.in b/dlls/dmusic/Makefile.in index 3b1b9628214..e84696a18ff 100644 --- a/dlls/dmusic/Makefile.in +++ b/dlls/dmusic/Makefile.in @@ -15,9 +15,7 @@ C_SRCS = \ downloadedinstrument.c \ instrument.c \ port.c \ - portdownload.c \ - regsvr.c \ - thru.c + regsvr.c RC_SRCS = version.rc diff --git a/dlls/dmusic/dmusic_private.h b/dlls/dmusic/dmusic_private.h index cda8d544db6..2de7e8a11b1 100644 --- a/dlls/dmusic/dmusic_private.h +++ b/dlls/dmusic/dmusic_private.h @@ -132,22 +132,13 @@ struct IDirectMusicDownloadImpl { }; /***************************************************************************** - * IDirectMusicPortDownloadImpl implementation structure - */ -struct IDirectMusicPortDownloadImpl { - /* IUnknown fields */ - const IDirectMusicPortDownloadVtbl *lpVtbl; - LONG ref; - - /* IDirectMusicPortDownloadImpl fields */ -}; - -/***************************************************************************** * IDirectMusicPortImpl implementation structure */ struct IDirectMusicPortImpl { /* IUnknown fields */ const IDirectMusicPortVtbl *lpVtbl; + const IDirectMusicPortDownloadVtbl *lpDownloadVtbl; + const IDirectMusicThruVtbl *lpThruVtbl; LONG ref; /* IDirectMusicPortImpl fields */ @@ -166,17 +157,6 @@ extern HRESULT WINAPI IDirectMusicPortImpl_Activate (LPDIRECTMUSICPORT iface, BO extern HRESULT WINAPI DMUSIC_CreateDirectMusicPortImpl (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter, LPDMUS_PORTPARAMS pPortParams, LPDMUS_PORTCAPS pPortCaps); /***************************************************************************** - * IDirectMusicThruImpl implementation structure - */ -struct IDirectMusicThruImpl { - /* IUnknown fields */ - const IDirectMusicThruVtbl *lpVtbl; - LONG ref; - - /* IDirectMusicThruImpl fields */ -}; - -/***************************************************************************** * IReferenceClockImpl implementation structure */ struct IReferenceClockImpl { diff --git a/dlls/dmusic/port.c b/dlls/dmusic/port.c index 6b7f85e3ebf..7773d2873e2 100644 --- a/dlls/dmusic/port.c +++ b/dlls/dmusic/port.c @@ -26,7 +26,13 @@ static HRESULT WINAPI IDirectMusicPortImpl_QueryInterface (LPDIRECTMUSICPORT ifa IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface; TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj); - if (IsEqualIID (riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirectMusicPort)) { + if (IsEqualIID (riid, &IID_IUnknown) || + IsEqualGUID(riid, &IID_IDirectMusicPort) || + IsEqualGUID(riid, &IID_IDirectMusicPort8) || + IsEqualGUID(riid, &IID_IDirectMusicPortDownload) || + IsEqualGUID(riid, &IID_IDirectMusicPortDownload8) || + IsEqualGUID(riid, &IID_IDirectMusicThru) || + IsEqualGUID(riid, &IID_IDirectMusicThru8)) { IUnknown_AddRef(iface); *ppobj = This; return S_OK; @@ -236,6 +242,107 @@ static const IDirectMusicPortVtbl DirectMusicPort_Vtbl = { IDirectMusicPortImpl_GetFormat }; +/* IDirectMusicPortDownload IUnknown parts follow: */ +static HRESULT WINAPI IDirectMusicPortDownloadImpl_QueryInterface (LPDIRECTMUSICPORTDOWNLOAD iface, REFIID riid, LPVOID *ppobj) { + ICOM_THIS_MULTI(IDirectMusicPortImpl, lpDownloadVtbl, iface); + TRACE("(%p/%p)->(%s, %p)\n", This, iface, debugstr_dmguid(riid), ppobj); + return IUnknown_QueryInterface((IUnknown *)&(This->lpVtbl), riid, ppobj); +} + +static ULONG WINAPI IDirectMusicPortDownloadImpl_AddRef (LPDIRECTMUSICPORTDOWNLOAD iface) { + ICOM_THIS_MULTI(IDirectMusicPortImpl, lpDownloadVtbl, iface); + TRACE("(%p/%p)->()\n", This, iface); + return IUnknown_AddRef((IUnknown *)&(This->lpVtbl)); +} + +static ULONG WINAPI IDirectMusicPortDownloadImpl_Release (LPDIRECTMUSICPORTDOWNLOAD iface) { + ICOM_THIS_MULTI(IDirectMusicPortImpl, lpDownloadVtbl, iface); + TRACE("(%p/%p)->()\n", This, iface); + return IUnknown_Release((IUnknown *)&(This->lpVtbl)); +} + +/* IDirectMusicPortDownload Interface follow: */ +static HRESULT WINAPI IDirectMusicPortDownloadImpl_GetBuffer (LPDIRECTMUSICPORTDOWNLOAD iface, DWORD dwDLId, IDirectMusicDownload** ppIDMDownload) { + ICOM_THIS_MULTI(IDirectMusicPortImpl, lpDownloadVtbl, iface); + FIXME("(%p/%p)->(%d, %p): stub\n", This, iface, dwDLId, ppIDMDownload); + return S_OK; +} + +static HRESULT WINAPI IDirectMusicPortDownloadImpl_AllocateBuffer (LPDIRECTMUSICPORTDOWNLOAD iface, DWORD dwSize, IDirectMusicDownload** ppIDMDownload) { + ICOM_THIS_MULTI(IDirectMusicPortImpl, lpDownloadVtbl, iface); + FIXME("(%p/%p)->(%d, %p): stub\n", This, iface, dwSize, ppIDMDownload); + return S_OK; +} + +static HRESULT WINAPI IDirectMusicPortDownloadImpl_GetDLId (LPDIRECTMUSICPORTDOWNLOAD iface, DWORD* pdwStartDLId, DWORD dwCount) { + ICOM_THIS_MULTI(IDirectMusicPortImpl, lpDownloadVtbl, iface); + FIXME("(%p/%p)->(%p, %d): stub\n", This, iface, pdwStartDLId, dwCount); + return S_OK; +} + +static HRESULT WINAPI IDirectMusicPortDownloadImpl_GetAppend (LPDIRECTMUSICPORTDOWNLOAD iface, DWORD* pdwAppend) { + IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface; + FIXME("(%p/%p)->(%p): stub\n", This, iface, pdwAppend); + return S_OK; +} + +static HRESULT WINAPI IDirectMusicPortDownloadImpl_Download (LPDIRECTMUSICPORTDOWNLOAD iface, IDirectMusicDownload* pIDMDownload) { + IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface; + FIXME("(%p/%p)->(%p): stub\n", This, iface, pIDMDownload); + return S_OK; +} + +static HRESULT WINAPI IDirectMusicPortDownloadImpl_Unload (LPDIRECTMUSICPORTDOWNLOAD iface, IDirectMusicDownload* pIDMDownload) { + IDirectMusicPortImpl *This = (IDirectMusicPortImpl *)iface; + FIXME("(%p/%p)->(%p): stub\n", This, iface, pIDMDownload); + return S_OK; +} + +static const IDirectMusicPortDownloadVtbl DirectMusicPortDownload_Vtbl = { + IDirectMusicPortDownloadImpl_QueryInterface, + IDirectMusicPortDownloadImpl_AddRef, + IDirectMusicPortDownloadImpl_Release, + IDirectMusicPortDownloadImpl_GetBuffer, + IDirectMusicPortDownloadImpl_AllocateBuffer, + IDirectMusicPortDownloadImpl_GetDLId, + IDirectMusicPortDownloadImpl_GetAppend, + IDirectMusicPortDownloadImpl_Download, + IDirectMusicPortDownloadImpl_Unload +}; + +/* IDirectMusicThru IUnknown parts follow: */ +static HRESULT WINAPI IDirectMusicThruImpl_QueryInterface (LPDIRECTMUSICTHRU iface, REFIID riid, LPVOID *ppobj) { + ICOM_THIS_MULTI(IDirectMusicPortImpl, lpThruVtbl, iface); + TRACE("(%p/%p)->(%s, %p)\n", This, iface, debugstr_dmguid(riid), ppobj); + return IUnknown_QueryInterface((IUnknown *)&(This->lpVtbl), riid, ppobj); +} + +static ULONG WINAPI IDirectMusicThruImpl_AddRef (LPDIRECTMUSICTHRU iface) { + ICOM_THIS_MULTI(IDirectMusicPortImpl, lpThruVtbl, iface); + TRACE("(%p/%p)->()\n", This, iface); + return IUnknown_AddRef((IUnknown *)&(This->lpVtbl)); +} + +static ULONG WINAPI IDirectMusicThruImpl_Release (LPDIRECTMUSICTHRU iface) { + ICOM_THIS_MULTI(IDirectMusicPortImpl, lpThruVtbl, iface); + TRACE("(%p/%p)->()\n", This, iface); + return IUnknown_Release((IUnknown *)&(This->lpVtbl)); +} + +/* IDirectMusicThru Interface follow: */ +static HRESULT WINAPI IDirectMusicThruImpl_ThruChannel (LPDIRECTMUSICTHRU iface, DWORD dwSourceChannelGroup, DWORD dwSourceChannel, DWORD dwDestinationChannelGroup, DWORD dwDestinationChannel, LPDIRECTMUSICPORT pDestinationPort) { + ICOM_THIS_MULTI(IDirectMusicPortImpl, lpThruVtbl, iface); + FIXME("(%p/%p)->(%d, %d, %d, %d, %p): stub\n", This, iface, dwSourceChannelGroup, dwSourceChannel, dwDestinationChannelGroup, dwDestinationChannel, pDestinationPort); + return S_OK; +} + +static const IDirectMusicThruVtbl DirectMusicThru_Vtbl = { + IDirectMusicThruImpl_QueryInterface, + IDirectMusicThruImpl_AddRef, + IDirectMusicThruImpl_Release, + IDirectMusicThruImpl_ThruChannel +}; + HRESULT WINAPI DMUSIC_CreateDirectMusicPortImpl (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter, LPDMUS_PORTPARAMS pPortParams, LPDMUS_PORTCAPS pPortCaps) { IDirectMusicPortImpl *obj; HRESULT hr = E_FAIL; @@ -248,6 +355,8 @@ HRESULT WINAPI DMUSIC_CreateDirectMusicPortImpl (LPCGUID lpcGUID, LPVOID *ppobj, return E_OUTOFMEMORY; } obj->lpVtbl = &DirectMusicPort_Vtbl; + obj->lpDownloadVtbl = &DirectMusicPortDownload_Vtbl; + obj->lpThruVtbl = &DirectMusicThru_Vtbl; obj->ref = 0; /* will be inited by QueryInterface */ obj->fActive = FALSE; obj->params = *pPortParams; diff --git a/dlls/dmusic/portdownload.c b/dlls/dmusic/portdownload.c deleted file mode 100644 index 8549e8ef066..00000000000 --- a/dlls/dmusic/portdownload.c +++ /dev/null @@ -1,111 +0,0 @@ -/* IDirectMusicPortDownloadImpl Implementation - * - * Copyright (C) 2003-2004 Rok Mandeljc - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include "dmusic_private.h" - -WINE_DEFAULT_DEBUG_CHANNEL(dmusic); - -/* IDirectMusicPortDownload IUnknown parts follow: */ -static HRESULT WINAPI IDirectMusicPortDownloadImpl_QueryInterface (LPDIRECTMUSICPORTDOWNLOAD iface, REFIID riid, LPVOID *ppobj) { - IDirectMusicPortDownloadImpl *This = (IDirectMusicPortDownloadImpl *)iface; - TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj); - - if (IsEqualIID (riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirectMusicPortDownload)) { - IUnknown_AddRef(iface); - *ppobj = This; - return S_OK; - } - WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj); - return E_NOINTERFACE; -} - -static ULONG WINAPI IDirectMusicPortDownloadImpl_AddRef (LPDIRECTMUSICPORTDOWNLOAD iface) { - IDirectMusicPortDownloadImpl *This = (IDirectMusicPortDownloadImpl *)iface; - ULONG refCount = InterlockedIncrement(&This->ref); - - TRACE("(%p)->(ref before=%u)\n", This, refCount - 1); - - DMUSIC_LockModule(); - - return refCount; -} - -static ULONG WINAPI IDirectMusicPortDownloadImpl_Release (LPDIRECTMUSICPORTDOWNLOAD iface) { - IDirectMusicPortDownloadImpl *This = (IDirectMusicPortDownloadImpl *)iface; - ULONG refCount = InterlockedDecrement(&This->ref); - - TRACE("(%p)->(ref before=%u)\n", This, refCount + 1); - - if (!refCount) { - HeapFree(GetProcessHeap(), 0, This); - } - - DMUSIC_UnlockModule(); - - return refCount; -} - -/* IDirectMusicPortDownload Interface follow: */ -static HRESULT WINAPI IDirectMusicPortDownloadImpl_GetBuffer (LPDIRECTMUSICPORTDOWNLOAD iface, DWORD dwDLId, IDirectMusicDownload** ppIDMDownload) { - IDirectMusicPortDownloadImpl *This = (IDirectMusicPortDownloadImpl *)iface; - FIXME("(%p, %d, %p): stub\n", This, dwDLId, ppIDMDownload); - return S_OK; -} - -static HRESULT WINAPI IDirectMusicPortDownloadImpl_AllocateBuffer (LPDIRECTMUSICPORTDOWNLOAD iface, DWORD dwSize, IDirectMusicDownload** ppIDMDownload) { - IDirectMusicPortDownloadImpl *This = (IDirectMusicPortDownloadImpl *)iface; - FIXME("(%p, %d, %p): stub\n", This, dwSize, ppIDMDownload); - return S_OK; -} - -static HRESULT WINAPI IDirectMusicPortDownloadImpl_GetDLId (LPDIRECTMUSICPORTDOWNLOAD iface, DWORD* pdwStartDLId, DWORD dwCount) { - IDirectMusicPortDownloadImpl *This = (IDirectMusicPortDownloadImpl *)iface; - FIXME("(%p, %p, %d): stub\n", This, pdwStartDLId, dwCount); - return S_OK; -} - -static HRESULT WINAPI IDirectMusicPortDownloadImpl_GetAppend (LPDIRECTMUSICPORTDOWNLOAD iface, DWORD* pdwAppend) { - IDirectMusicPortDownloadImpl *This = (IDirectMusicPortDownloadImpl *)iface; - FIXME("(%p, %p): stub\n", This, pdwAppend); - return S_OK; -} - -static HRESULT WINAPI IDirectMusicPortDownloadImpl_Download (LPDIRECTMUSICPORTDOWNLOAD iface, IDirectMusicDownload* pIDMDownload) { - IDirectMusicPortDownloadImpl *This = (IDirectMusicPortDownloadImpl *)iface; - FIXME("(%p, %p): stub\n", This, pIDMDownload); - return S_OK; -} - -static HRESULT WINAPI IDirectMusicPortDownloadImpl_Unload (LPDIRECTMUSICPORTDOWNLOAD iface, IDirectMusicDownload* pIDMDownload) { - IDirectMusicPortDownloadImpl *This = (IDirectMusicPortDownloadImpl *)iface; - FIXME("(%p, %p): stub\n", This, pIDMDownload); - return S_OK; -} - -static const IDirectMusicPortDownloadVtbl DirectMusicPortDownload_Vtbl = { - IDirectMusicPortDownloadImpl_QueryInterface, - IDirectMusicPortDownloadImpl_AddRef, - IDirectMusicPortDownloadImpl_Release, - IDirectMusicPortDownloadImpl_GetBuffer, - IDirectMusicPortDownloadImpl_AllocateBuffer, - IDirectMusicPortDownloadImpl_GetDLId, - IDirectMusicPortDownloadImpl_GetAppend, - IDirectMusicPortDownloadImpl_Download, - IDirectMusicPortDownloadImpl_Unload -}; diff --git a/dlls/dmusic/thru.c b/dlls/dmusic/thru.c deleted file mode 100644 index 6def88a6dfe..00000000000 --- a/dlls/dmusic/thru.c +++ /dev/null @@ -1,77 +0,0 @@ -/* IDirectMusicThru Implementation - * - * Copyright (C) 2003-2004 Rok Mandeljc - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include "dmusic_private.h" - -WINE_DEFAULT_DEBUG_CHANNEL(dmusic); - -/* IDirectMusicThru IUnknown parts follow: */ -static HRESULT WINAPI IDirectMusicThruImpl_QueryInterface (LPDIRECTMUSICTHRU iface, REFIID riid, LPVOID *ppobj) { - IDirectMusicThruImpl *This = (IDirectMusicThruImpl *)iface; - TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj); - - if (IsEqualIID (riid, &IID_IUnknown) || - IsEqualIID (riid, &IID_IDirectMusicThru)) { - IUnknown_AddRef(iface); - *ppobj = This; - return S_OK; - } - WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj); - return E_NOINTERFACE; -} - -static ULONG WINAPI IDirectMusicThruImpl_AddRef (LPDIRECTMUSICTHRU iface) { - IDirectMusicThruImpl *This = (IDirectMusicThruImpl *)iface; - ULONG refCount = InterlockedIncrement(&This->ref); - - TRACE("(%p)->(ref before=%u)\n", This, refCount - 1); - - DMUSIC_LockModule(); - - return refCount; -} - -static ULONG WINAPI IDirectMusicThruImpl_Release (LPDIRECTMUSICTHRU iface) { - IDirectMusicThruImpl *This = (IDirectMusicThruImpl *)iface; - ULONG refCount = InterlockedDecrement(&This->ref); - - TRACE("(%p)->(ref before=%u)\n", This, refCount + 1); - - if (!refCount) { - HeapFree(GetProcessHeap(), 0, This); - } - - DMUSIC_UnlockModule(); - - return refCount; -} - -/* IDirectMusicThru Interface follow: */ -static HRESULT WINAPI IDirectMusicThruImpl_ThruChannel (LPDIRECTMUSICTHRU iface, DWORD dwSourceChannelGroup, DWORD dwSourceChannel, DWORD dwDestinationChannelGroup, DWORD dwDestinationChannel, LPDIRECTMUSICPORT pDestinationPort) { - IDirectMusicThruImpl *This = (IDirectMusicThruImpl *)iface; - FIXME("(%p, %d, %d, %d, %d, %p): stub\n", This, dwSourceChannelGroup, dwSourceChannel, dwDestinationChannelGroup, dwDestinationChannel, pDestinationPort); - return S_OK; -} - -static const IDirectMusicThruVtbl DirectMusicThru_Vtbl = { - IDirectMusicThruImpl_QueryInterface, - IDirectMusicThruImpl_AddRef, - IDirectMusicThruImpl_Release, - IDirectMusicThruImpl_ThruChannel -}; diff --git a/dlls/mscoree/mscoree.spec b/dlls/mscoree/mscoree.spec index 0195b621df8..03fbc1c532e 100644 --- a/dlls/mscoree/mscoree.spec +++ b/dlls/mscoree/mscoree.spec @@ -70,7 +70,7 @@ @ stdcall LoadLibraryShim(ptr ptr ptr ptr) @ stub LoadLibraryWithPolicyShim @ stdcall LoadStringRCEx(long long ptr long long ptr) -@ stub LockClrVersion +@ stdcall LockClrVersion(ptr ptr ptr) @ stub MetaDataGetDispenser @ stdcall ND_CopyObjDst(ptr ptr long long) @ stdcall ND_CopyObjSrc(ptr long ptr long) diff --git a/dlls/mscoree/mscoree_main.c b/dlls/mscoree/mscoree_main.c index 78ef1d3be56..386f4f76707 100644 --- a/dlls/mscoree/mscoree_main.c +++ b/dlls/mscoree/mscoree_main.c @@ -257,6 +257,12 @@ HRESULT WINAPI LoadLibraryShim( LPCWSTR szDllName, LPCWSTR szVersion, LPVOID pvR return S_OK; } +HRESULT WINAPI LockClrVersion(FLockClrVersionCallback hostCallback, FLockClrVersionCallback *pBeginHostSetup, FLockClrVersionCallback *pEndHostSetup) +{ + FIXME("(%p %p %p): stub\n", hostCallback, pBeginHostSetup, pEndHostSetup); + return S_OK; +} + HRESULT WINAPI CoInitializeCor(DWORD fFlags) { FIXME("(0x%08x): stub\n", fFlags); diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index 0f4bcf4fe3c..8e5981bfeea 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -138,6 +138,9 @@ static HRESULT WINAPI HTMLDocument_QueryInterface(IHTMLDocument2 *iface, REFIID }else if(IsEqualGUID(&IID_IPersistPropertyBag, riid)) { TRACE("(%p)->(IID_IPersistPropertyBag %p) returning NULL\n", This, ppvObject); return E_NOINTERFACE; + }else if(IsEqualGUID(&IID_IMarshal, riid)) { + TRACE("(%p)->(IID_IMarshal %p) returning NULL\n", This, ppvObject); + return E_NOINTERFACE; }else if(dispex_query_interface(&This->dispex, riid, ppvObject)) { return *ppvObject ? S_OK : E_NOINTERFACE; } diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c index 705f44a4638..fa4ad519461 100644 --- a/dlls/mshtml/htmlstyle.c +++ b/dlls/mshtml/htmlstyle.c @@ -1734,8 +1734,8 @@ static HRESULT WINAPI HTMLStyle_get_left(IHTMLStyle *iface, VARIANT *p) static HRESULT WINAPI HTMLStyle_get_position(IHTMLStyle *iface, BSTR *p) { HTMLStyle *This = HTMLSTYLE_THIS(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + TRACE("(%p)->(%p)\n", This, p); + return IHTMLStyle2_get_position(HTMLSTYLE2(This), p); } static HRESULT WINAPI HTMLStyle_put_zIndex(IHTMLStyle *iface, VARIANT v) diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index 7ba6e863d2e..aa8dbb8d4e6 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -2299,6 +2299,10 @@ static void test_default_style(IHTMLStyle *style) test_disp((IUnknown*)style, &DIID_DispHTMLStyle); test_ifaces((IUnknown*)style, style_iids); + hres = IHTMLStyle_get_position(style, &str); + ok(hres == S_OK, "get_position failed: %08x\n", hres); + ok(!str, "str=%s\n", dbgstr_w(str)); + str = (void*)0xdeadbeef; hres = IHTMLStyle_get_fontFamily(style, &str); ok(hres == S_OK, "get_fontFamily failed: %08x\n", hres); diff --git a/dlls/mshtml/tests/htmldoc.c b/dlls/mshtml/tests/htmldoc.c index 84803fb31bb..ed69725ee40 100644 --- a/dlls/mshtml/tests/htmldoc.c +++ b/dlls/mshtml/tests/htmldoc.c @@ -3766,6 +3766,11 @@ static void test_QueryInterface(IUnknown *unk) hres = IUnknown_QueryInterface(unk, &IID_UndocumentedScriptIface, (void**)&qi); ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres); ok(qi == NULL, "qi=%p, expected NULL\n", qi); + + qi = (void*)0xdeadbeef; + hres = IUnknown_QueryInterface(unk, &IID_IMarshal, (void**)&qi); + ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres); + ok(qi == NULL, "qi=%p, expected NULL\n", qi); } static void init_test(enum load_state_t ls) { diff --git a/dlls/msi/tests/msi.c b/dlls/msi/tests/msi.c index 7201329e969..3396f5c5bd4 100644 --- a/dlls/msi/tests/msi.c +++ b/dlls/msi/tests/msi.c @@ -7940,7 +7940,7 @@ static void test_MsiEnumPatchesEx(void) ok(context == MSIINSTALLCONTEXT_USERMANAGED, "Expected MSIINSTALLCONTEXT_USERMANAGED, got %d\n", context); ok(size == lstrlenA(usersid) * sizeof(WCHAR), - "Expected %d, got %d\n", lstrlenA(usersid) * sizeof(WCHAR), size); + "Got %d\n", size); /* pcchTargetUserSid is exactly the length of szTargetUserSid */ lstrcpyA(patchcode, "apple"); @@ -7961,7 +7961,7 @@ static void test_MsiEnumPatchesEx(void) ok(!strncmp(targetsid, usersid, lstrlenA(usersid) - 1), "Expected \"%s\", got \"%s\"\n", usersid, targetsid); ok(size == lstrlenA(usersid) * sizeof(WCHAR), - "Expected %d, got %d\n", lstrlenA(usersid) * sizeof(WCHAR), size); + "Got %d\n", size); /* pcchTargetUserSid has enough room for NULL terminator */ lstrcpyA(patchcode, "apple"); diff --git a/dlls/msvcrt/tests/file.c b/dlls/msvcrt/tests/file.c index 38f16c1e24d..66a0035b4a8 100644 --- a/dlls/msvcrt/tests/file.c +++ b/dlls/msvcrt/tests/file.c @@ -338,7 +338,7 @@ static void test_asciimode2(void) ok(getc(fp) == '0', "first char not 0\n"); memset(ibuf, 0, sizeof(ibuf)); i = fread(ibuf, 1, sizeof(ibuf), fp); - ok(i == sizeof(ibuf), "fread i %d != sizeof(ibuf) %d\n", i, sizeof(ibuf)); + ok(i == sizeof(ibuf), "fread i %d != sizeof(ibuf)\n", i); ok(0 == strncmp(ibuf, obuf+1, sizeof(ibuf)), "ibuf != obuf\n"); fclose(fp); unlink("ascii2.tst"); diff --git a/dlls/msxml3/domdoc.c b/dlls/msxml3/domdoc.c index f71b1344ac6..a24f16fa97e 100644 --- a/dlls/msxml3/domdoc.c +++ b/dlls/msxml3/domdoc.c @@ -57,6 +57,7 @@ typedef struct _domdoc const struct IPersistStreamVtbl *lpvtblIPersistStream; const struct IObjectWithSiteVtbl *lpvtblIObjectWithSite; const struct IObjectSafetyVtbl *lpvtblIObjectSafety; + const struct ISupportErrorInfoVtbl *lpvtblISupportErrorInfo; LONG ref; VARIANT_BOOL async; VARIANT_BOOL validating; @@ -248,6 +249,10 @@ static inline domdoc *impl_from_IObjectSafety(IObjectSafety *iface) return (domdoc *)((char*)iface - FIELD_OFFSET(domdoc, lpvtblIObjectSafety)); } +static inline domdoc *impl_from_ISupportErrorInfo(ISupportErrorInfo *iface) +{ + return (domdoc *)((char*)iface - FIELD_OFFSET(domdoc, lpvtblISupportErrorInfo)); +} /************************************************************************ * xmldoc implementation of IPersistStream. @@ -375,6 +380,46 @@ static const IPersistStreamVtbl xmldoc_IPersistStream_VTable = xmldoc_IPersistStream_GetSizeMax, }; +/* ISupportErrorInfo interface */ +static HRESULT WINAPI support_error_QueryInterface( + ISupportErrorInfo *iface, + REFIID riid, void** ppvObj ) +{ + domdoc *This = impl_from_ISupportErrorInfo(iface); + return IXMLDocument_QueryInterface((IXMLDocument *)This, riid, ppvObj); +} + +static ULONG WINAPI support_error_AddRef( + ISupportErrorInfo *iface ) +{ + domdoc *This = impl_from_ISupportErrorInfo(iface); + return IXMLDocument_AddRef((IXMLDocument *)This); +} + +static ULONG WINAPI support_error_Release( + ISupportErrorInfo *iface ) +{ + domdoc *This = impl_from_ISupportErrorInfo(iface); + return IXMLDocument_Release((IXMLDocument *)This); +} + +static HRESULT WINAPI support_error_InterfaceSupportsErrorInfo( + ISupportErrorInfo *iface, + REFIID riid ) +{ + FIXME("(%p)->(%s)\n", iface, debugstr_guid(riid)); + return S_FALSE; +} + +static const struct ISupportErrorInfoVtbl support_error_vtbl = +{ + support_error_QueryInterface, + support_error_AddRef, + support_error_Release, + support_error_InterfaceSupportsErrorInfo +}; + +/* IXMLDOMDocument2 interface */ static HRESULT WINAPI domdoc_QueryInterface( IXMLDOMDocument2 *iface, REFIID riid, void** ppvObject ) { domdoc *This = impl_from_IXMLDOMDocument2( iface ); @@ -402,6 +447,10 @@ static HRESULT WINAPI domdoc_QueryInterface( IXMLDOMDocument2 *iface, REFIID rii { *ppvObject = (IObjectWithSite*)&(This->lpvtblIObjectWithSite); } + else if( IsEqualGUID( riid, &IID_ISupportErrorInfo )) + { + *ppvObject = &This->lpvtblISupportErrorInfo; + } else if(dispex_query_interface(&This->dispex, riid, ppvObject)) { return *ppvObject ? S_OK : E_NOINTERFACE; @@ -2138,6 +2187,7 @@ HRESULT DOMDocument_create_from_xmldoc(xmlDocPtr xmldoc, IXMLDOMDocument2 **docu doc->lpvtblIPersistStream = &xmldoc_IPersistStream_VTable; doc->lpvtblIObjectWithSite = &domdocObjectSite; doc->lpvtblIObjectSafety = &domdocObjectSafetyVtbl; + doc->lpvtblISupportErrorInfo = &support_error_vtbl; doc->ref = 1; doc->async = 0; doc->validating = 0; diff --git a/dlls/msxml3/httprequest.c b/dlls/msxml3/httprequest.c index 3c962772d2d..c5395738427 100644 --- a/dlls/msxml3/httprequest.c +++ b/dlls/msxml3/httprequest.c @@ -75,7 +75,7 @@ static ULONG WINAPI httprequest_AddRef(IXMLHTTPRequest *iface) return InterlockedIncrement( &This->ref ); } -ULONG WINAPI httprequest_Release(IXMLHTTPRequest *iface) +static ULONG WINAPI httprequest_Release(IXMLHTTPRequest *iface) { httprequest *This = impl_from_IXMLHTTPRequest( iface ); ULONG ref; diff --git a/dlls/msxml3/msxml_private.h b/dlls/msxml3/msxml_private.h index e33b994d512..917543de706 100644 --- a/dlls/msxml3/msxml_private.h +++ b/dlls/msxml3/msxml_private.h @@ -67,7 +67,6 @@ extern HRESULT xmldoc_add_orphan( xmlDocPtr doc, xmlNodePtr node ); extern HRESULT xmldoc_remove_orphan( xmlDocPtr doc, xmlNodePtr node ); extern HRESULT XMLElement_create( IUnknown *pUnkOuter, xmlNodePtr node, LPVOID *ppObj ); -extern HRESULT XMLElementCollection_create( IUnknown *pUnkOuter, xmlNodePtr node, LPVOID *ppObj ); extern xmlDocPtr parse_xml(char *ptr, int len); diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c index 73ba9321a12..0c8c14786ab 100644 --- a/dlls/msxml3/tests/domdoc.c +++ b/dlls/msxml3/tests/domdoc.c @@ -400,6 +400,7 @@ static void test_domdoc( void ) IXMLDOMAttribute *node_attr = NULL; IXMLDOMNode *nodeChild = NULL; IXMLDOMProcessingInstruction *nodePI = NULL; + ISupportErrorInfo *support_error = NULL; VARIANT_BOOL b; VARIANT var; BSTR str; @@ -862,6 +863,15 @@ static void test_domdoc( void ) IXMLDOMProcessingInstruction_Release(nodePI); } + r = IXMLDOMDocument_QueryInterface( doc, &IID_ISupportErrorInfo, (LPVOID*)&support_error ); + ok( r == S_OK, "ret %08x\n", r ); + if(r == S_OK) + { + r = ISupportErrorInfo_InterfaceSupportsErrorInfo( support_error, &IID_IXMLDOMDocument ); + todo_wine ok( r == S_OK, "ret %08x\n", r ); + ISupportErrorInfo_Release( support_error ); + } + r = IXMLDOMDocument_Release( doc ); ok( r == 0, "document ref count incorrect\n"); diff --git a/dlls/msxml3/xmlelem.c b/dlls/msxml3/xmlelem.c index 8166e6ac5bb..0105a0a243b 100644 --- a/dlls/msxml3/xmlelem.c +++ b/dlls/msxml3/xmlelem.c @@ -38,6 +38,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(msxml); #ifdef HAVE_LIBXML2 +static HRESULT XMLElementCollection_create( IUnknown *pUnkOuter, xmlNodePtr node, LPVOID *ppObj ); + /********************************************************************** * IXMLElement */ @@ -732,7 +734,7 @@ static const struct IEnumVARIANTVtbl xmlelem_collection_IEnumVARIANTvtbl = xmlelem_collection_IEnumVARIANT_Clone }; -HRESULT XMLElementCollection_create(IUnknown *pUnkOuter, xmlNodePtr node, LPVOID *ppObj) +static HRESULT XMLElementCollection_create(IUnknown *pUnkOuter, xmlNodePtr node, LPVOID *ppObj) { xmlelem_collection *collection; xmlNodePtr ptr; diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index a9994bc9820..696061a3bb8 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -2605,7 +2605,6 @@ ME_TextEditor *ME_MakeEditor(HWND hWnd) { ed->pCursors[2] = ed->pCursors[0]; ed->pCursors[3] = ed->pCursors[1]; ed->nLastTotalLength = ed->nTotalLength = 0; - ed->nHeight = 0; ed->nUDArrowX = -1; ed->nSequence = 0; ed->rgbBackColor = -1; @@ -2725,11 +2724,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) } -#define UNSUPPORTED_MSG(e) \ - case e: \ - FIXME(#e ": stub\n"); \ - return DefWindowProcW(hWnd, msg, wParam, lParam); - static const char * const edit_messages[] = { "EM_GETSEL", "EM_SETSEL", @@ -2869,18 +2863,60 @@ get_msg_name(UINT msg) static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL unicode) { - ME_TextEditor *editor = (ME_TextEditor *)GetWindowLongPtrW(hWnd, 0); - - TRACE("hwnd %p msg %04x (%s) %lx %lx, unicode %d\n", + ME_TextEditor *editor; + HRESULT hresult; + LRESULT lresult; + + TRACE("enter hwnd %p msg %04x (%s) %lx %lx, unicode %d\n", hWnd, msg, get_msg_name(msg), wParam, lParam, unicode); - - if (!editor && msg != WM_NCCREATE && msg != WM_NCDESTROY) { - ERR("called with invalid hWnd %p - application bug?\n", hWnd); - return 0; + + editor = (ME_TextEditor *)GetWindowLongPtrW(hWnd, 0); + if (!editor) + { + if (msg == WM_NCCREATE) + { + CREATESTRUCTW *pcs = (CREATESTRUCTW *)lParam; + TRACE("WM_NCCREATE: style 0x%08x\n", pcs->style); + editor = ME_MakeEditor(hWnd); + SetWindowLongPtrW(hWnd, 0, (LONG_PTR)editor); + return TRUE; + } + else if (msg != WM_NCDESTROY) + { + ERR("called with invalid hWnd %p - application bug?\n", hWnd); + return 0; + } } + lresult = ME_HandleMessage(editor, msg, wParam, lParam, unicode, &hresult); + + if (hresult == S_FALSE) + lresult = DefWindowProcW(hWnd, msg, wParam, lParam); + + TRACE("exit hwnd %p msg %04x (%s) %lx %lx, unicode %d -> %lu\n", + hWnd, msg, get_msg_name(msg), wParam, lParam, unicode, lresult); + + return lresult; +} + +#define UNSUPPORTED_MSG(e) \ + case e: \ + FIXME(#e ": stub\n"); \ + *phresult = S_FALSE; \ + return 0; + +/* Handle messages for windowless and windoweded richedit controls. + * + * The LRESULT that is returned is a return value for window procs, + * and the phresult parameter is the COM return code needed by the + * text services interface. */ +LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam, + LPARAM lParam, BOOL unicode, HRESULT* phresult) +{ + *phresult = S_OK; + switch(msg) { - + UNSUPPORTED_MSG(EM_DISPLAYBAND) UNSUPPORTED_MSG(EM_FINDWORDBREAK) UNSUPPORTED_MSG(EM_FMTLINES) @@ -2924,7 +2960,7 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, { int vk = (int)((LPMSG)lParam)->wParam; /* if style says we want return key */ - if((vk == VK_RETURN) && (GetWindowLongW(hWnd, GWL_STYLE) & ES_WANTRETURN)) + if((vk == VK_RETURN) && (GetWindowLongW(editor->hWnd, GWL_STYLE) & ES_WANTRETURN)) { code |= DLGC_WANTMESSAGE; } @@ -2936,14 +2972,6 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, } return code; } - case WM_NCCREATE: - { - CREATESTRUCTW *pcs = (CREATESTRUCTW *)lParam; - TRACE("WM_NCCREATE: style 0x%08x\n", pcs->style); - editor = ME_MakeEditor(hWnd); - SetWindowLongPtrW(hWnd, 0, (LONG_PTR)editor); - return TRUE; - } case EM_EMPTYUNDOBUFFER: ME_EmptyUndoStack(editor); return 0; @@ -2990,7 +3018,7 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, /* these flags are equivalent to the ES_* counterparts */ DWORD mask = ECO_VERTICAL | ECO_AUTOHSCROLL | ECO_AUTOVSCROLL | ECO_NOHIDESEL | ECO_READONLY | ECO_WANTRETURN | ECO_SELECTIONBAR; - DWORD settings = GetWindowLongW(hWnd, GWL_STYLE) & mask; + DWORD settings = GetWindowLongW(editor->hWnd, GWL_STYLE) & mask; return settings; } @@ -3002,7 +3030,7 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, */ DWORD mask = ECO_VERTICAL | ECO_AUTOHSCROLL | ECO_AUTOVSCROLL | ECO_NOHIDESEL | ECO_READONLY | ECO_WANTRETURN | ECO_SELECTIONBAR; - DWORD raw = GetWindowLongW(hWnd, GWL_STYLE); + DWORD raw = GetWindowLongW(editor->hWnd, GWL_STYLE); DWORD settings = mask & raw; DWORD oldSettings = settings; DWORD changedSettings; @@ -3021,7 +3049,7 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, case ECOOP_XOR: settings ^= lParam; } - SetWindowLongW(hWnd, GWL_STYLE, (raw & ~mask) | (settings & mask)); + SetWindowLongW(editor->hWnd, GWL_STYLE, (raw & ~mask) | (settings & mask)); changedSettings = oldSettings ^ settings; @@ -3171,8 +3199,8 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, editor->rgbBackColor = lParam; editor->hbrBackground = CreateSolidBrush(editor->rgbBackColor); } - InvalidateRect(hWnd, NULL, TRUE); - UpdateWindow(hWnd); + InvalidateRect(editor->hWnd, NULL, TRUE); + UpdateWindow(editor->hWnd); return lColor; } case EM_GETMODIFY: @@ -3188,12 +3216,12 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, } case EM_SETREADONLY: { - long nStyle = GetWindowLongW(hWnd, GWL_STYLE); + long nStyle = GetWindowLongW(editor->hWnd, GWL_STYLE); if (wParam) nStyle |= ES_READONLY; else nStyle &= ~ES_READONLY; - SetWindowLongW(hWnd, GWL_STYLE, nStyle); + SetWindowLongW(editor->hWnd, GWL_STYLE, nStyle); return 0; } case EM_SETEVENTMASK: @@ -3348,9 +3376,9 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, if (!wParam) wParam = (WPARAM)GetStockObject(SYSTEM_FONT); GetObjectW((HGDIOBJ)wParam, sizeof(LOGFONTW), &lf); - hDC = GetDC(hWnd); + hDC = GetDC(editor->hWnd); ME_CharFormatFromLogFont(hDC, &lf, &fmt); - ReleaseDC(hWnd, hDC); + ReleaseDC(editor->hWnd, hDC); ME_SetCharFormat(editor, 0, ME_GetTextLength(editor), &fmt); ME_SetDefaultCharFormat(editor, &fmt); @@ -3379,7 +3407,7 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, int len = -1; /* uses default style! */ - if (!(GetWindowLongW(hWnd, GWL_STYLE) & ES_MULTILINE)) + if (!(GetWindowLongW(editor->hWnd, GWL_STYLE) & ES_MULTILINE)) { WCHAR * p; @@ -3772,19 +3800,19 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, SCROLLINFO si; ME_SetDefaultFormatRect(editor); - if (GetWindowLongW(hWnd, GWL_STYLE) & WS_HSCROLL) + if (GetWindowLongW(editor->hWnd, GWL_STYLE) & WS_HSCROLL) { /* Squelch the default horizontal scrollbar it would make */ ShowScrollBar(editor->hWnd, SB_HORZ, FALSE); } si.cbSize = sizeof(si); si.fMask = SIF_PAGE | SIF_RANGE; - if (GetWindowLongW(hWnd, GWL_STYLE) & ES_DISABLENOSCROLL) + if (GetWindowLongW(editor->hWnd, GWL_STYLE) & ES_DISABLENOSCROLL) si.fMask |= SIF_DISABLENOSCROLL; si.nMax = (si.fMask & SIF_DISABLENOSCROLL) ? 1 : 0; si.nMin = 0; si.nPage = 0; - SetScrollInfo(hWnd, SB_VERT, &si, TRUE); + SetScrollInfo(editor->hWnd, SB_VERT, &si, TRUE); ME_CommitUndo(editor); ME_WrapMarkedParagraphs(editor); @@ -3793,7 +3821,7 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, } case WM_DESTROY: ME_DestroyEditor(editor); - SetWindowLongPtrW(hWnd, 0, 0); + SetWindowLongPtrW(editor->hWnd, 0, 0); return 0; case WM_SETCURSOR: { @@ -3806,10 +3834,10 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, if ((editor->nEventMask & ENM_MOUSEEVENTS) && !ME_FilterEvent(editor, msg, &wParam, &lParam)) return 0; - SetFocus(hWnd); + SetFocus(editor->hWnd); ME_LButtonDown(editor, (short)LOWORD(lParam), (short)HIWORD(lParam), ME_CalculateClickCount(editor, msg, wParam, lParam)); - SetCapture(hWnd); + SetCapture(editor->hWnd); ME_LinkNotify(editor,msg,wParam,lParam); if (!ME_SetCursor(editor)) goto do_default; break; @@ -3818,15 +3846,15 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, if ((editor->nEventMask & ENM_MOUSEEVENTS) && !ME_FilterEvent(editor, msg, &wParam, &lParam)) return 0; - if (GetCapture() == hWnd) + if (GetCapture() == editor->hWnd) ME_MouseMove(editor, (short)LOWORD(lParam), (short)HIWORD(lParam)); ME_LinkNotify(editor,msg,wParam,lParam); /* Set cursor if mouse is captured, since WM_SETCURSOR won't be received. */ - if (GetCapture() == hWnd) + if (GetCapture() == editor->hWnd) ME_SetCursor(editor); break; case WM_LBUTTONUP: - if (GetCapture() == hWnd) + if (GetCapture() == editor->hWnd) ReleaseCapture(); if (editor->nSelectionType == stDocument) editor->nSelectionType = stPosition; @@ -3856,7 +3884,7 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, RECT rc; PAINTSTRUCT ps; - hDC = BeginPaint(hWnd, &ps); + hDC = BeginPaint(editor->hWnd, &ps); /* Erase area outside of the formatting rectangle */ if (ps.rcPaint.top < editor->rcFormat.top) { @@ -3885,7 +3913,7 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, } ME_PaintContent(editor, hDC, FALSE, &ps.rcPaint); - EndPaint(hWnd, &ps); + EndPaint(editor->hWnd, &ps); } break; case WM_SETFOCUS: @@ -3903,7 +3931,7 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, { HDC hDC = (HDC)wParam; RECT rc; - if (GetUpdateRect(hWnd,&rc,TRUE)) + if (GetUpdateRect(editor->hWnd,&rc,TRUE)) { FillRect(hDC, &rc, editor->hbrBackground); } @@ -4014,12 +4042,12 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, { if (lParam) { - DWORD exstyle = GetWindowLongW(hWnd, GWL_EXSTYLE); + DWORD exstyle = GetWindowLongW(editor->hWnd, GWL_EXSTYLE); int border = (exstyle & WS_EX_CLIENTEDGE) ? 1 : 0; RECT clientRect; RECT *rc = (RECT *)lParam; - GetClientRect(hWnd, &clientRect); + GetClientRect(editor->hWnd, &clientRect); if (wParam == 0) { editor->rcFormat.top = max(0, rc->top - border); @@ -4053,12 +4081,12 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, ME_SendRequestResize(editor, TRUE); return 0; case WM_SETREDRAW: - return DefWindowProcW(hWnd, msg, wParam, lParam); + goto do_default; case WM_SIZE: { RECT clientRect; - GetClientRect(hWnd, &clientRect); + GetClientRect(editor->hWnd, &clientRect); if (editor->bDefaultFormatRect) { ME_SetDefaultFormatRect(editor); } else { @@ -4067,7 +4095,7 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, } editor->prevClientRect = clientRect; ME_RewrapRepaint(editor); - return DefWindowProcW(hWnd, msg, wParam, lParam); + goto do_default; } /* IME messages to make richedit controls IME aware */ case WM_IME_SETCONTEXT: @@ -4088,7 +4116,7 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, HIMC hIMC; ME_Style *style = ME_GetInsertStyle(editor, 0); - hIMC = ImmGetContext(hWnd); + hIMC = ImmGetContext(editor->hWnd); ME_DeleteSelection(editor); ME_CommitUndo(editor); ME_SaveTempStyle(editor); @@ -4204,7 +4232,8 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, break; default: do_default: - return DefWindowProcW(hWnd, msg, wParam, lParam); + *phresult = S_FALSE; + break; } return 0L; } diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h index b3918bf203d..df82073af67 100644 --- a/dlls/riched20/editor.h +++ b/dlls/riched20/editor.h @@ -271,6 +271,8 @@ void ME_DeleteReObject(REOBJECT* reo); /* editor.c */ ME_TextEditor *ME_MakeEditor(HWND hWnd); void ME_DestroyEditor(ME_TextEditor *editor); +LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam, + LPARAM lParam, BOOL unicode, HRESULT* phresult); void ME_SendOldNotify(ME_TextEditor *editor, int nCode); void ME_LinkNotify(ME_TextEditor *editor, UINT msg, WPARAM wParam, LPARAM lParam); int ME_GetTextW(ME_TextEditor *editor, WCHAR *buffer, int nStart, int nChars, BOOL bCRLF); diff --git a/dlls/riched20/editstr.h b/dlls/riched20/editstr.h index 0c8435bdad4..cde05f933ee 100644 --- a/dlls/riched20/editstr.h +++ b/dlls/riched20/editstr.h @@ -333,7 +333,6 @@ typedef struct tagME_TextEditor int nCursors; SIZE sizeWindow; int nTotalLength, nLastTotalLength; - int nHeight; int nUDArrowX; int nSequence; COLORREF rgbBackColor; diff --git a/dlls/riched20/paint.c b/dlls/riched20/paint.c index 521f646402f..94a1f87d9cf 100644 --- a/dlls/riched20/paint.c +++ b/dlls/riched20/paint.c @@ -23,10 +23,12 @@ WINE_DEFAULT_DEBUG_CHANNEL(richedit); -void ME_PaintContent(ME_TextEditor *editor, HDC hDC, BOOL bOnlyNew, const RECT *rcUpdate) { +void ME_PaintContent(ME_TextEditor *editor, HDC hDC, BOOL bOnlyNew, const RECT *rcUpdate) +{ ME_DisplayItem *item; ME_Context c; int yoffset; + int ys, ye; editor->nSequence++; yoffset = ME_GetYScrollPos(editor); @@ -34,115 +36,70 @@ void ME_PaintContent(ME_TextEditor *editor, HDC hDC, BOOL bOnlyNew, const RECT * SetBkMode(hDC, TRANSPARENT); ME_MoveCaret(editor); /* Calls ME_WrapMarkedParagraphs */ item = editor->pBuffer->pFirst->next; - c.pt.y -= yoffset; - while(item != editor->pBuffer->pLast) { - int yTextOffset = 0; - int ys, ye; + /* This context point is an offset for the paragraph positions stored + * during wrapping. It shouldn't be modified during painting. */ + c.pt.x = c.rcView.left; + c.pt.y = c.rcView.top - yoffset; + while(item != editor->pBuffer->pLast) + { assert(item->type == diParagraph); + + ys = c.pt.y + item->member.para.pt.y; if (item->member.para.pCell != item->member.para.next_para->member.para.pCell) { ME_Cell *cell = NULL; cell = &ME_FindItemBack(item->member.para.next_para, diCell)->member.cell; - ye = cell->pt.y + cell->nHeight - yoffset; + ye = c.pt.y + cell->pt.y + cell->nHeight; } else { - ye = c.pt.y + item->member.para.nHeight; + ye = ys + item->member.para.nHeight; } - if (!(item->member.para.nFlags & MEPF_ROWEND) && + if (item->member.para.pCell && !(item->member.para.nFlags & MEPF_ROWEND) && item->member.para.pCell != item->member.para.prev_para->member.para.pCell) { - ME_DisplayItem *cell; - if (item->member.para.prev_para->member.para.nFlags & MEPF_ROWSTART) - cell = item->member.para.pCell; - else - cell = item->member.para.prev_para->member.para.pCell; - assert(cell); /* the border shifts the text down */ - yTextOffset = cell->member.cell.yTextOffset; - ye += yTextOffset; + ys -= item->member.para.pCell->member.cell.yTextOffset; } + if (!bOnlyNew || (item->member.para.nFlags & MEPF_REPAINT)) { /* Draw the pargraph if any of the paragraph is in the update region. */ BOOL bPaint = (rcUpdate == NULL); - ys = c.pt.y; if (rcUpdate) - bPaint = ys + c.rcView.top < rcUpdate->bottom && - ye + c.rcView.top > rcUpdate->top; + bPaint = ys < rcUpdate->bottom && ye > rcUpdate->top; if (bPaint) { - c.pt.y += yTextOffset; ME_DrawParagraph(&c, item); /* Clear the repaint flag if the whole paragraph is in the * update region. */ - if (!rcUpdate || (rcUpdate->top <= ys + c.rcView.top && - rcUpdate->bottom >= ye + c.rcView.top)) + if (!rcUpdate || (rcUpdate->top <= ys && rcUpdate->bottom >= ye)) item->member.para.nFlags &= ~MEPF_REPAINT; } } - if (item->member.para.pCell) - { - ME_Cell *cell = &item->member.para.pCell->member.cell; - ME_DisplayItem *next_para = item->member.para.next_para; - c.pt.x = cell->pt.x + cell->nWidth; - if (item->member.para.pCell == next_para->member.para.pCell && - !(next_para->member.para.nFlags & (MEPF_ROWSTART|MEPF_ROWEND))) - { - c.pt.y = ye; - } else { - if (next_para->member.para.nFlags & MEPF_ROWSTART) - { - cell = &ME_FindItemFwd(next_para, diCell)->member.cell; - } - else if (next_para->member.para.nFlags & MEPF_ROWEND) - { - cell = &cell->next_cell->member.cell; - } - else - { - cell = &next_para->member.para.pCell->member.cell; - } - c.pt.y = cell->pt.y - yoffset; - } - } else if (!(item->member.para.nFlags & MEPF_ROWSTART)) { - c.pt.y = ye; - } item = item->member.para.next_para; } - if (c.pt.y < c.rcView.bottom - c.rcView.top) + if (c.pt.y + editor->nTotalLength < c.rcView.bottom) { /* Fill space after the end of the text. */ - int xs = c.rcView.left, xe = c.rcView.right; - int ys = c.rcView.top + c.pt.y, ye = c.rcView.bottom; + RECT rc; + rc.top = c.pt.y + editor->nTotalLength; + rc.left = c.rcView.left; + rc.bottom = c.rcView.bottom; + rc.right = c.rcView.right; if (bOnlyNew) { /* Only erase region drawn from previous call to ME_PaintContent */ - int y1 = editor->nTotalLength-yoffset, y2 = editor->nLastTotalLength-yoffset; - if (y1nTotalLength < editor->nLastTotalLength) + rc.bottom = c.pt.y + editor->nLastTotalLength; else - ys = ye; /* empty fill area */ + SetRectEmpty(&rc); } - if (rcUpdate) - { - /* Clip to update region */ - xs = max(xs, rcUpdate->left); - xe = min(xe, rcUpdate->right); - ys = max(ys, rcUpdate->top); - ye = min(ye, rcUpdate->bottom); - } + IntersectRect(&rc, &rc, rcUpdate); - if (xe > xs && ye > ys) - { - RECT rc; - rc.left = xs; - rc.top = ys; - rc.right = xe; - rc.bottom = ye; + if (!IsRectEmpty(&rc)) FillRect(hDC, &rc, c.editor->hbrBackground); - } } if (editor->nTotalLength != editor->nLastTotalLength) ME_SendRequestResize(editor, FALSE); @@ -451,7 +408,7 @@ static void ME_DrawRun(ME_Context *c, int x, int y, ME_DisplayItem *rundi, ME_Pa if (runofs >= nSelFrom && runofs < nSelTo) { ME_HighlightSpace(c, x, y, wszSpace, 1, run->style, 0, 0, 1, - c->rcView.top + c->pt.y + start->member.row.pt.y, + c->pt.y + para->pt.y + start->member.row.pt.y, start->member.row.nHeight); } return; @@ -463,7 +420,7 @@ static void ME_DrawRun(ME_Context *c, int x, int y, ME_DisplayItem *rundi, ME_Pa * an unwanted symbol can be inserted instead. */ ME_DrawTextWithStyle(c, x, y, wszSpace, 1, run->style, run->nWidth, nSelFrom-runofs, nSelTo-runofs, - c->rcView.top + c->pt.y + start->member.row.pt.y, + c->pt.y + para->pt.y + start->member.row.pt.y, start->member.row.nHeight); return; } @@ -478,7 +435,7 @@ static void ME_DrawRun(ME_Context *c, int x, int y, ME_DisplayItem *rundi, ME_Pa ME_DrawTextWithStyle(c, x, y, szMasked->szData, ME_StrVLen(szMasked), run->style, run->nWidth, nSelFrom-runofs,nSelTo-runofs, - c->rcView.top + c->pt.y + start->member.row.pt.y, + c->pt.y + para->pt.y + start->member.row.pt.y, start->member.row.nHeight); ME_DestroyString(szMasked); } @@ -486,7 +443,7 @@ static void ME_DrawRun(ME_Context *c, int x, int y, ME_DisplayItem *rundi, ME_Pa ME_DrawTextWithStyle(c, x, y, run->strText->szData, ME_StrVLen(run->strText), run->style, run->nWidth, nSelFrom-runofs,nSelTo-runofs, - c->rcView.top + c->pt.y + start->member.row.pt.y, + c->pt.y + para->pt.y + start->member.row.pt.y, start->member.row.nHeight); } } @@ -742,11 +699,11 @@ static void ME_DrawTableBorders(ME_Context *c, ME_DisplayItem *paragraph) int width; BOOL atTop = (para->pCell != para->prev_para->member.para.pCell); BOOL atBottom = (para->pCell != para->next_para->member.para.pCell); - int top = c->rcView.top + (atTop ? cell->pt.y : para->pt.y) - ME_GetYScrollPos(c->editor); + int top = c->pt.y + (atTop ? cell->pt.y : para->pt.y); int bottom = (atBottom ? - c->rcView.top + cell->pt.y + cell->nHeight - ME_GetYScrollPos(c->editor): + c->pt.y + cell->pt.y + cell->nHeight : top + para->nHeight + (atTop ? cell->yTextOffset : 0)); - rc.left = c->rcView.left + cell->pt.x; + rc.left = c->pt.x + cell->pt.x; rc.right = rc.left + cell->nWidth; if (atTop) { /* Erase gap before text if not all borders are the same height. */ @@ -759,7 +716,7 @@ static void ME_DrawTableBorders(ME_Context *c, ME_DisplayItem *paragraph) } } /* Draw cell borders. - * The borders borders are draw in is left, top, bottom, right in order + * The order borders are draw in is left, top, bottom, right in order * to be consistent with native richedit. This is noticeable from the * overlap of borders of different colours. */ if (!(para->nFlags & MEPF_ROWEND)) { @@ -812,7 +769,7 @@ static void ME_DrawTableBorders(ME_Context *c, ME_DisplayItem *paragraph) ME_DisplayItem *nextEndCell; nextEndCell = ME_FindItemBack(ME_GetTableRowEnd(paraAfterRow), diCell); assert(nextEndCell && !nextEndCell->member.cell.next_cell); - rc.left = c->rcView.left + nextEndCell->member.cell.pt.x; + rc.left = c->pt.x + nextEndCell->member.cell.pt.x; /* FIXME: Native draws FROM the bottom of the table rather than * TO the bottom of the table in this case, but just doing so here * will cause the next row to erase the border. */ @@ -874,12 +831,12 @@ static void ME_DrawTableBorders(ME_Context *c, ME_DisplayItem *paragraph) oldpen = SelectObject(c->hDC, pen); /* Find the start relative to the text */ - firstX = c->rcView.left + ME_FindItemFwd(paragraph, diRun)->member.run.pt.x; + firstX = c->pt.x + ME_FindItemFwd(paragraph, diRun)->member.run.pt.x; /* Go back by the horizontal gap, which is stored in dxOffset */ firstX -= ME_twips2pointsX(c, para->pFmt->dxOffset); /* The left edge, stored in dxStartIndent affected just the first edge */ startX = firstX - ME_twips2pointsX(c, para->pFmt->dxStartIndent); - rowY = c->rcView.top + c->pt.y; + rowY = c->pt.y + para->pt.y; if (para->pFmt->dwMask & PFM_SPACEBEFORE) rowY += ME_twips2pointsY(c, para->pFmt->dySpaceBefore); nHeight = ME_FindItemFwd(paragraph, diStartRow)->member.row.nHeight; @@ -928,45 +885,45 @@ void ME_DrawParagraph(ME_Context *c, ME_DisplayItem *paragraph) ME_Run *run; ME_Paragraph *para = NULL; RECT rc, bounds; - int y = c->rcView.top + c->pt.y; + int y; int height = 0, baseline = 0, no=0; BOOL visible = FALSE; - c->pt.x = c->rcView.left; - rc.left = c->rcView.left; + rc.left = c->pt.x; rc.right = c->rcView.right; - for (p = paragraph; p!=paragraph->member.para.next_para; p = p->next) { + + assert(paragraph); + para = ¶graph->member.para; + y = c->pt.y + para->pt.y; + if (para->pCell) + { + ME_Cell *cell = ¶->pCell->member.cell; + rc.left = c->pt.x + cell->pt.x; + rc.right = rc.left + cell->nWidth; + } + if (para->nFlags & MEPF_ROWSTART) { + ME_Cell *cell = ¶->next_para->member.para.pCell->member.cell; + rc.right = c->pt.x + cell->pt.x; + } else if (para->nFlags & MEPF_ROWEND) { + ME_Cell *cell = ¶->prev_para->member.para.pCell->member.cell; + rc.left = c->pt.x + cell->pt.x + cell->nWidth; + } + ME_DrawParaDecoration(c, para, y, &bounds); + y += bounds.top; + rc.left += bounds.left; + rc.right -= bounds.right; + + for (p = paragraph->next; p != para->next_para; p = p->next) + { switch(p->type) { case diParagraph: - para = &p->member.para; - assert(para); - if (para->pCell) - { - ME_Cell *cell = ¶->pCell->member.cell; - rc.left = c->rcView.left + cell->pt.x; - rc.right = rc.left + cell->nWidth; - } - if (para->nFlags & MEPF_ROWSTART) { - ME_Cell *cell = ¶->next_para->member.para.pCell->member.cell; - rc.right = c->rcView.left + cell->pt.x; - } else if (para->nFlags & MEPF_ROWEND) { - ME_Cell *cell = ¶->prev_para->member.para.pCell->member.cell; - rc.left = c->rcView.left + cell->pt.x + cell->nWidth; - } - ME_DrawParaDecoration(c, para, y, &bounds); - y += bounds.top; + assert(FALSE); break; case diStartRow: - /* we should have seen a diParagraph before */ - assert(para); y += height; rc.top = y; - if (para->nFlags & MEPF_ROWSTART) { - ME_Cell *cell = ¶->next_para->member.para.pCell->member.cell; - rc.bottom = y + cell->nHeight; - } else if (para->nFlags & MEPF_ROWEND) { - ME_Cell *cell = ¶->prev_para->member.para.pCell->member.cell; - rc.bottom = y + cell->nHeight; + if (para->nFlags & (MEPF_ROWSTART|MEPF_ROWEND)) { + rc.bottom = y + para->nHeight; } else { rc.bottom = y + p->member.row.nHeight; } @@ -991,9 +948,10 @@ void ME_DrawParagraph(ME_Context *c, ME_DisplayItem *paragraph) assert(para); run = &p->member.run; if (visible && me_debug) { - rc.left = c->rcView.left + run->pt.x; + RECT rc; + rc.left = c->pt.x + run->pt.x; rc.right = rc.left + run->nWidth; - rc.top = c->rcView.top + c->pt.y + run->pt.y; + rc.top = c->pt.y + para->pt.y + run->pt.y; rc.bottom = rc.bottom + height; TRACE("rc = (%d, %d, %d, %d)\n", rc.left, rc.top, rc.right, rc.bottom); if (run->nFlags & MERF_SKIPPED) @@ -1002,30 +960,27 @@ void ME_DrawParagraph(ME_Context *c, ME_DisplayItem *paragraph) FrameRect(c->hDC, &rc, GetSysColorBrush(COLOR_GRAYTEXT)); } if (visible) - ME_DrawRun(c, c->rcView.left + run->pt.x, - c->rcView.top + c->pt.y + run->pt.y + baseline, - p, ¶graph->member.para); + ME_DrawRun(c, c->pt.x + run->pt.x, + c->pt.y + para->pt.y + run->pt.y + baseline, p, para); if (me_debug) { /* I'm using %ls, hope wsprintfW is not going to use wrong (4-byte) WCHAR version */ const WCHAR wszRunDebug[] = {'[','%','d',':','%','x',']',' ','%','l','s',0}; WCHAR buf[2560]; POINT pt; - pt.x = run->pt.x; - pt.y = c->rcView.top + c->pt.y + run->pt.y; + pt.x = c->pt.x + run->pt.x; + pt.y = c->pt.y + para->pt.y + run->pt.y; wsprintfW(buf, wszRunDebug, no, p->member.run.nFlags, p->member.run.strText->szData); ME_DebugWrite(c->hDC, &pt, buf); } - /* c->pt.x += p->member.run.nWidth; */ break; case diCell: /* Clear any space at the bottom of the cell after the text. */ - if (para->nFlags & MEPF_ROWSTART) + if (para->nFlags & (MEPF_ROWSTART|MEPF_ROWEND)) break; y += height; - rc.top = y; - rc.bottom = c->rcView.top + p->member.cell.pt.y - + p->member.cell.nHeight - ME_GetYScrollPos(c->editor); + rc.top = c->pt.y + para->pt.y + para->nHeight; + rc.bottom = c->pt.y + p->member.cell.pt.y + p->member.cell.nHeight; if (RectVisible(c->hDC, &rc)) { FillRect(c->hDC, &rc, c->editor->hbrBackground); @@ -1101,7 +1056,7 @@ void ME_Scroll(ME_TextEditor *editor, int value, int type) hWnd = editor->hWnd; winStyle = GetWindowLongW(hWnd, GWL_STYLE); bScrollBarIsVisible = (winStyle & WS_VSCROLL) != 0; - bScrollBarWillBeVisible = (editor->nHeight > editor->sizeWindow.cy) + bScrollBarWillBeVisible = (editor->nTotalLength > editor->sizeWindow.cy) || (winStyle & ES_DISABLENOSCROLL); if (bScrollBarIsVisible != bScrollBarWillBeVisible) { @@ -1127,7 +1082,7 @@ void ME_UpdateScrollBar(ME_TextEditor *editor) hWnd = editor->hWnd; si.cbSize = sizeof(si); bScrollBarWasVisible = ME_GetYScrollVisible(editor); - bScrollBarWillBeVisible = editor->nHeight > editor->sizeWindow.cy; + bScrollBarWillBeVisible = editor->nTotalLength > editor->sizeWindow.cy; si.fMask = SIF_PAGE | SIF_RANGE | SIF_POS; if (GetWindowLongW(hWnd, GWL_STYLE) & ES_DISABLENOSCROLL) diff --git a/dlls/riched20/wrap.c b/dlls/riched20/wrap.c index d989a2da1cd..7eb844c733f 100644 --- a/dlls/riched20/wrap.c +++ b/dlls/riched20/wrap.c @@ -578,17 +578,14 @@ BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor) ME_Context c; BOOL bModified = FALSE; int yStart = -1; - int yLastPos = 0; ME_InitContext(&c, editor, GetDC(editor->hWnd)); c.pt.x = 0; - editor->nHeight = 0; item = editor->pBuffer->pFirst->next; while(item != editor->pBuffer->pLast) { BOOL bRedraw = FALSE; assert(item->type == diParagraph); - editor->nHeight = max(editor->nHeight, item->member.para.pt.y); if ((item->member.para.nFlags & MEPF_REWRAP) || (item->member.para.pt.y != c.pt.y)) bRedraw = TRUE; @@ -605,8 +602,6 @@ BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor) bModified = bModified | bRedraw; - yLastPos = max(yLastPos, c.pt.y); - if (item->member.para.nFlags & MEPF_ROWSTART) { ME_DisplayItem *cell = ME_FindItemFwd(item, diCell); @@ -698,7 +693,8 @@ BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor) c.pt.x = cell->pt.x + cell->nWidth; c.pt.y = cell->pt.y; cell->next_cell->member.cell.pt = c.pt; - c.pt.y += cell->yTextOffset; + if (!(item->member.para.next_para->member.para.nFlags & MEPF_ROWEND)) + c.pt.y += cell->yTextOffset; } else { @@ -718,18 +714,10 @@ BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor) editor->nTotalLength = c.pt.y; editor->pBuffer->pLast->member.para.pt.x = 0; - editor->pBuffer->pLast->member.para.pt.y = yLastPos; + editor->pBuffer->pLast->member.para.pt.y = c.pt.y; ME_DestroyContext(&c, editor->hWnd); - /* Each paragraph may contain multiple rows, which should be scrollable, even - if the containing paragraph has pt.y == 0 */ - item = editor->pBuffer->pFirst; - while ((item = ME_FindItemFwd(item, diStartRow)) != NULL) { - assert(item->type == diStartRow); - editor->nHeight = max(editor->nHeight, item->member.row.pt.y); - } - if (bModified || editor->nTotalLength < editor->nLastTotalLength) ME_InvalidateMarkedParagraphs(editor); return bModified; diff --git a/dlls/winealsa.drv/midi.c b/dlls/winealsa.drv/midi.c index dedfe0215ce..c1bcb1067a7 100644 --- a/dlls/winealsa.drv/midi.c +++ b/dlls/winealsa.drv/midi.c @@ -374,27 +374,34 @@ static DWORD WINAPI midRecThread(LPVOID arg) break; case SND_SEQ_EVENT_SYSEX: { + int pos = 0; int len = ev->data.ext.len; LPBYTE ptr = (BYTE*) ev->data.ext.ptr; LPMIDIHDR lpMidiHdr; - /* FIXME: Should handle sysex greater than lpMidiHdr->dwBufferLength */ EnterCriticalSection(&crit_sect); - if ((lpMidiHdr = MidiInDev[wDevID].lpQueueHdr) != NULL) { - if (lpMidiHdr->dwBytesRecorded + len <= lpMidiHdr->dwBufferLength) { - memcpy(lpMidiHdr->lpData + lpMidiHdr->dwBytesRecorded, ptr, len); - lpMidiHdr->dwBytesRecorded += len; - if (*(ptr + (len-1)) == 0xF7) { + while (len) { + if ((lpMidiHdr = MidiInDev[wDevID].lpQueueHdr) != NULL) { + int copylen = min(len, lpMidiHdr->dwBufferLength - lpMidiHdr->dwBytesRecorded); + memcpy(lpMidiHdr->lpData + lpMidiHdr->dwBytesRecorded, ptr + pos, copylen); + lpMidiHdr->dwBytesRecorded += copylen; + len -= copylen; + pos += copylen; + /* We check if we reach the end of buffer or the end of sysex before notifying + * to handle the case where ALSA splitted the sysex into several events */ + if ((lpMidiHdr->dwBytesRecorded == lpMidiHdr->dwBufferLength) || + (*(BYTE*)(lpMidiHdr->lpData + lpMidiHdr->dwBytesRecorded - 1) == 0xF7)) { lpMidiHdr->dwFlags &= ~MHDR_INQUEUE; lpMidiHdr->dwFlags |= MHDR_DONE; MidiInDev[wDevID].lpQueueHdr = (LPMIDIHDR)lpMidiHdr->lpNext; if (MIDI_NotifyClient(wDevID, MIM_LONGDATA, (DWORD_PTR)lpMidiHdr, dwTime) != MMSYSERR_NOERROR) WARN("Couldn't notify client\n"); } - } else - FIXME("No enough space in the buffer to store sysex!\n"); - } else - FIXME("Sysex received but no buffer to store it!\n"); + } else { + FIXME("Sysex data received but no buffer to store it!\n"); + break; + } + } LeaveCriticalSection(&crit_sect); } break; diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c index b31590ae199..ca6ca583da2 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -1152,8 +1152,8 @@ static void pshader_hw_texreg2ar(const SHADER_OPCODE_ARG *arg) sprintf(dst_str, "T%u", reg1); pshader_gen_input_modifier_line(arg->shader, buffer, arg->src[0], 0, src_str); - shader_addline(buffer, "MOV TMP.r, %s.a;\n", src_str); - shader_addline(buffer, "MOV TMP.g, %s.r;\n", src_str); + shader_addline(buffer, "MOV TMP.x, %s.w;\n", src_str); + shader_addline(buffer, "MOV TMP.y, %s.x;\n", src_str); flags = reg1 < MAX_TEXTURES ? deviceImpl->stateBlock->textureState[reg1][WINED3DTSS_TEXTURETRANSFORMFLAGS] : 0; shader_hw_sample(arg, reg1, dst_str, "TMP", flags & WINED3DTTFF_PROJECTED, FALSE); } @@ -1168,8 +1168,8 @@ static void pshader_hw_texreg2gb(const SHADER_OPCODE_ARG *arg) sprintf(dst_str, "T%u", reg1); pshader_gen_input_modifier_line(arg->shader, buffer, arg->src[0], 0, src_str); - shader_addline(buffer, "MOV TMP.r, %s.g;\n", src_str); - shader_addline(buffer, "MOV TMP.g, %s.b;\n", src_str); + shader_addline(buffer, "MOV TMP.x, %s.y;\n", src_str); + shader_addline(buffer, "MOV TMP.y, %s.z;\n", src_str); shader_hw_sample(arg, reg1, dst_str, "TMP", FALSE, FALSE); } @@ -1221,20 +1221,20 @@ static void pshader_hw_texbem(const SHADER_OPCODE_ARG *arg) /* Sampling the perturbation map in Tsrc was done already, including the signedness correction if needed */ shader_addline(buffer, "SWZ TMP2, bumpenvmat%d, x, z, 0, 0;\n", reg_dest_code); - shader_addline(buffer, "DP3 TMP.r, TMP2, T%u;\n", src); + shader_addline(buffer, "DP3 TMP.x, TMP2, T%u;\n", src); shader_addline(buffer, "SWZ TMP2, bumpenvmat%d, y, w, 0, 0;\n", reg_dest_code); - shader_addline(buffer, "DP3 TMP.g, TMP2, T%u;\n", src); + shader_addline(buffer, "DP3 TMP.y, TMP2, T%u;\n", src); /* with projective textures, texbem only divides the static texture coord, not the displacement, * so we can't let the GL handle this. */ if (((IWineD3DDeviceImpl*) This->baseShader.device)->stateBlock->textureState[reg_dest_code][WINED3DTSS_TEXTURETRANSFORMFLAGS] & WINED3DTTFF_PROJECTED) { - shader_addline(buffer, "RCP TMP2.a, %s.a;\n", reg_coord); - shader_addline(buffer, "MUL TMP2.rg, %s, TMP2.a;\n", reg_coord); - shader_addline(buffer, "ADD TMP.rg, TMP, TMP2;\n"); + shader_addline(buffer, "RCP TMP2.w, %s.w;\n", reg_coord); + shader_addline(buffer, "MUL TMP2.xy, %s, TMP2.w;\n", reg_coord); + shader_addline(buffer, "ADD TMP.xy, TMP, TMP2;\n"); } else { - shader_addline(buffer, "ADD TMP.rg, TMP, %s;\n", reg_coord); + shader_addline(buffer, "ADD TMP.xy, TMP, %s;\n", reg_coord); } shader_hw_sample(arg, reg_dest_code, reg_coord, "TMP", FALSE, FALSE); @@ -1406,15 +1406,15 @@ static void pshader_hw_texdepth(const SHADER_OPCODE_ARG *arg) /* According to the msdn, the source register(must be r5) is unusable after * the texdepth instruction, so we're free to modify it */ - shader_addline(buffer, "MIN %s.g, %s.g, one.g;\n", dst_name, dst_name); + shader_addline(buffer, "MIN %s.y, %s.y, one.y;\n", dst_name, dst_name); /* How to deal with the special case dst_name.g == 0? if r != 0, then * the r * (1 / 0) will give infinity, which is clamped to 1.0, the correct * result. But if r = 0.0, then 0 * inf = 0, which is incorrect. */ - shader_addline(buffer, "RCP %s.g, %s.g;\n", dst_name, dst_name); - shader_addline(buffer, "MUL TMP.x, %s.r, %s.g;\n", dst_name, dst_name); - shader_addline(buffer, "MIN TMP.x, TMP.x, one.r;\n"); + shader_addline(buffer, "RCP %s.y, %s.y;\n", dst_name, dst_name); + shader_addline(buffer, "MUL TMP.x, %s.x, %s.y;\n", dst_name, dst_name); + shader_addline(buffer, "MIN TMP.x, TMP.x, one.x;\n"); shader_addline(buffer, "MAX result.depth, TMP.x, 0.0;\n"); } @@ -1496,7 +1496,7 @@ static void pshader_hw_texm3x2depth(const SHADER_OPCODE_ARG *arg) */ shader_addline(buffer, "RCP TMP.y, TMP.y;\n"); shader_addline(buffer, "MUL TMP.x, TMP.x, TMP.y;\n"); - shader_addline(buffer, "MIN TMP.x, TMP.x, one.r;\n"); + shader_addline(buffer, "MIN TMP.x, TMP.x, one.x;\n"); shader_addline(buffer, "MAX result.depth, TMP.x, 0.0;\n"); } @@ -1930,8 +1930,8 @@ static GLuint shader_arb_generate_pshader(IWineD3DPixelShader *iface, SHADER_BUF break; case FOG_LINEAR: shader_addline(buffer, "MAD_SAT TMP_FOG, fragment.fogcoord, state.fog.params.y, state.fog.params.z;\n"); - shader_addline(buffer, "LRP result.color.rgb, TMP_FOG.x, %s, state.fog.color;\n", fragcolor); - shader_addline(buffer, "MOV result.color.a, %s.a;\n", fragcolor); + shader_addline(buffer, "LRP result.color.xyz, TMP_FOG.x, %s, state.fog.color;\n", fragcolor); + shader_addline(buffer, "MOV result.color.w, %s.w;\n", fragcolor); break; case FOG_EXP: FIXME("Implement EXP fog in ARB\n"); @@ -2510,7 +2510,7 @@ static const char *get_argreg(SHADER_BUFFER *buffer, DWORD argnum, unsigned int if(argnum == 2) ret = "arg2"; } if(arg & WINED3DTA_ALPHAREPLICATE) { - shader_addline(buffer, "MOV arg%u, %s.a;\n", argnum, ret); + shader_addline(buffer, "MOV arg%u, %s.w;\n", argnum, ret); if(argnum == 0) ret = "arg0"; if(argnum == 1) ret = "arg1"; if(argnum == 2) ret = "arg2"; @@ -2525,8 +2525,8 @@ static void gen_ffp_instr(SHADER_BUFFER *buffer, unsigned int stage, BOOL color, BOOL mul_final_dest = FALSE; if(color && alpha) dstmask = ""; - else if(color) dstmask = ".rgb"; - else dstmask = ".a"; + else if(color) dstmask = ".xyz"; + else dstmask = ".w"; if(dst == tempreg) dstreg = "tempreg"; else dstreg = "ret"; @@ -2582,42 +2582,42 @@ static void gen_ffp_instr(SHADER_BUFFER *buffer, unsigned int stage, BOOL color, case WINED3DTOP_BLENDCURRENTALPHA: arg0 = get_argreg(buffer, 0, stage, WINED3DTA_CURRENT); - shader_addline(buffer, "LRP %s%s, %s.a, %s, %s;\n", dstreg, dstmask, arg0, arg1, arg2); + shader_addline(buffer, "LRP %s%s, %s.w, %s, %s;\n", dstreg, dstmask, arg0, arg1, arg2); break; case WINED3DTOP_BLENDFACTORALPHA: arg0 = get_argreg(buffer, 0, stage, WINED3DTA_TFACTOR); - shader_addline(buffer, "LRP %s%s, %s.a, %s, %s;\n", dstreg, dstmask, arg0, arg1, arg2); + shader_addline(buffer, "LRP %s%s, %s.w, %s, %s;\n", dstreg, dstmask, arg0, arg1, arg2); break; case WINED3DTOP_BLENDTEXTUREALPHA: arg0 = get_argreg(buffer, 0, stage, WINED3DTA_TEXTURE); - shader_addline(buffer, "LRP %s%s, %s.a, %s, %s;\n", dstreg, dstmask, arg0, arg1, arg2); + shader_addline(buffer, "LRP %s%s, %s.w, %s, %s;\n", dstreg, dstmask, arg0, arg1, arg2); break; case WINED3DTOP_BLENDDIFFUSEALPHA: arg0 = get_argreg(buffer, 0, stage, WINED3DTA_DIFFUSE); - shader_addline(buffer, "LRP %s%s, %s.a, %s, %s;\n", dstreg, dstmask, arg0, arg1, arg2); + shader_addline(buffer, "LRP %s%s, %s.w, %s, %s;\n", dstreg, dstmask, arg0, arg1, arg2); break; case WINED3DTOP_BLENDTEXTUREALPHAPM: arg0 = get_argreg(buffer, 0, stage, WINED3DTA_TEXTURE); - shader_addline(buffer, "SUB arg0.a, const.x, %s.a;\n", arg0); - shader_addline(buffer, "MAD_SAT %s%s, %s, arg0.a, %s;\n", dstreg, dstmask, arg2, arg1); + shader_addline(buffer, "SUB arg0.w, const.x, %s.w;\n", arg0); + shader_addline(buffer, "MAD_SAT %s%s, %s, arg0.w, %s;\n", dstreg, dstmask, arg2, arg1); break; /* D3DTOP_PREMODULATE ???? */ case WINED3DTOP_MODULATEINVALPHA_ADDCOLOR: - shader_addline(buffer, "SUB arg0.a, const.x, %s;\n", arg1); - shader_addline(buffer, "MAD_SAT %s%s, arg0.a, %s, %s;\n", dstreg, dstmask, arg2, arg1); + shader_addline(buffer, "SUB arg0.w, const.x, %s;\n", arg1); + shader_addline(buffer, "MAD_SAT %s%s, arg0.w, %s, %s;\n", dstreg, dstmask, arg2, arg1); break; case WINED3DTOP_MODULATEALPHA_ADDCOLOR: - shader_addline(buffer, "MAD_SAT %s%s, %s.a, %s, %s;\n", dstreg, dstmask, arg1, arg2, arg1); + shader_addline(buffer, "MAD_SAT %s%s, %s.w, %s, %s;\n", dstreg, dstmask, arg1, arg2, arg1); break; case WINED3DTOP_MODULATEINVCOLOR_ADDALPHA: shader_addline(buffer, "SUB arg0, const.x, %s;\n", arg1); - shader_addline(buffer, "MAD_SAT %s%s, arg0, %s, %s.a;\n", dstreg, dstmask, arg2, arg1); + shader_addline(buffer, "MAD_SAT %s%s, arg0, %s, %s.w;\n", dstreg, dstmask, arg2, arg1); break; case WINED3DTOP_MODULATECOLOR_ADDALPHA: - shader_addline(buffer, "MAD_SAT %s%s, %s, %s, %s.a;\n", dstreg, dstmask, arg1, arg2, arg1); + shader_addline(buffer, "MAD_SAT %s%s, %s, %s, %s.w;\n", dstreg, dstmask, arg1, arg2, arg1); break; case WINED3DTOP_DOTPRODUCT3: @@ -2802,20 +2802,20 @@ static GLuint gen_arbfp_ffp_shader(const struct ffp_frag_settings *settings, IWi (settings->op[stage - 1].cop == WINED3DTOP_BUMPENVMAP || settings->op[stage - 1].cop == WINED3DTOP_BUMPENVMAPLUMINANCE)) { shader_addline(&buffer, "SWZ arg1, bumpmat%u, x, z, 0, 0;\n", stage - 1); - shader_addline(&buffer, "DP3 ret.r, arg1, tex%u;\n", stage - 1); + shader_addline(&buffer, "DP3 ret.x, arg1, tex%u;\n", stage - 1); shader_addline(&buffer, "SWZ arg1, bumpmat%u, y, w, 0, 0;\n", stage - 1); - shader_addline(&buffer, "DP3 ret.g, arg1, tex%u;\n", stage - 1); + shader_addline(&buffer, "DP3 ret.y, arg1, tex%u;\n", stage - 1); /* with projective textures, texbem only divides the static texture coord, not the displacement, * so multiply the displacement with the dividing parameter before passing it to TXP */ if (settings->op[stage].projected != proj_none) { if(settings->op[stage].projected == proj_count4) { - shader_addline(&buffer, "MOV ret.a, fragment.texcoord[%u].a;\n", stage); - shader_addline(&buffer, "MUL ret.rgb, ret, fragment.texcoord[%u].a, fragment.texcoord[%u];\n", stage, stage); + shader_addline(&buffer, "MOV ret.w, fragment.texcoord[%u].w;\n", stage); + shader_addline(&buffer, "MUL ret.xyz, ret, fragment.texcoord[%u].w, fragment.texcoord[%u];\n", stage, stage); } else { - shader_addline(&buffer, "MOV ret.a, fragment.texcoord[%u].b;\n", stage); - shader_addline(&buffer, "MAD ret.rgb, ret, fragment.texcoord[%u].b, fragment.texcoord[%u];\n", stage, stage); + shader_addline(&buffer, "MOV ret.w, fragment.texcoord[%u].z;\n", stage); + shader_addline(&buffer, "MAD ret.xyz, ret, fragment.texcoord[%u].z, fragment.texcoord[%u];\n", stage, stage); } } else { shader_addline(&buffer, "ADD ret, ret, fragment.texcoord[%u];\n", stage); @@ -2824,13 +2824,13 @@ static GLuint gen_arbfp_ffp_shader(const struct ffp_frag_settings *settings, IWi shader_addline(&buffer, "%s%s tex%u, ret, texture[%u], %s;\n", instr, sat, stage, stage, textype); if(settings->op[stage - 1].cop == WINED3DTOP_BUMPENVMAPLUMINANCE) { - shader_addline(&buffer, "MAD_SAT ret.r, tex%u.b, luminance%u.r, luminance%u.g;\n", + shader_addline(&buffer, "MAD_SAT ret.x, tex%u.z, luminance%u.x, luminance%u.y;\n", stage - 1, stage - 1, stage - 1); - shader_addline(&buffer, "MUL tex%u, tex%u, ret.r;\n", stage, stage); + shader_addline(&buffer, "MUL tex%u, tex%u, ret.x;\n", stage, stage); } } else if(settings->op[stage].projected == proj_count3) { shader_addline(&buffer, "MOV ret, fragment.texcoord[%u];\n", stage); - shader_addline(&buffer, "MOV ret.a, ret.b;\n"); + shader_addline(&buffer, "MOV ret.w, ret.z;\n"); shader_addline(&buffer, "%s%s tex%u, ret, texture[%u], %s;\n", instr, sat, stage, stage, textype); } else { @@ -2876,7 +2876,7 @@ static GLuint gen_arbfp_ffp_shader(const struct ffp_frag_settings *settings, IWi settings->op[stage].cop, settings->op[stage].carg0, settings->op[stage].carg1, settings->op[stage].carg2); if(stage == 0) { - shader_addline(&buffer, "MOV ret.a, fragment.color.primary.a;\n"); + shader_addline(&buffer, "MOV ret.w, fragment.color.primary.w;\n"); } } else if(op_equal) { gen_ffp_instr(&buffer, stage, TRUE, TRUE, settings->op[stage].dst, @@ -2895,7 +2895,7 @@ static GLuint gen_arbfp_ffp_shader(const struct ffp_frag_settings *settings, IWi if(settings->sRGB_write) { shader_addline(&buffer, "MAD ret, fragment.color.secondary, specular_enable, %s;\n", final_combiner_src); arbfp_add_sRGB_correction(&buffer, "ret", "arg0", "arg1", "arg2", "tempreg"); - shader_addline(&buffer, "MOV result.color.a, ret.a;\n"); + shader_addline(&buffer, "MOV result.color.w, ret.w;\n"); } else { shader_addline(&buffer, "MAD result.color, fragment.color.secondary, specular_enable, %s;\n", final_combiner_src); } @@ -3219,11 +3219,11 @@ static BOOL gen_planar_yuv_read(SHADER_BUFFER *buffer, enum yuv_fixup yuv_fixup, const char *tex, *texinstr; if (yuv_fixup == YUV_FIXUP_UYVY) { - chroma = 'r'; - *luminance = 'a'; + chroma = 'x'; + *luminance = 'w'; } else { - chroma = 'a'; - *luminance = 'r'; + chroma = 'w'; + *luminance = 'x'; } switch(textype) { case GL_TEXTURE_2D: tex = "2D"; texinstr = "TXP"; break; @@ -3249,8 +3249,8 @@ static BOOL gen_planar_yuv_read(SHADER_BUFFER *buffer, enum yuv_fixup yuv_fixup, * So we have to get the sampling x position in non-normalized coordinates in integers */ if(textype != GL_TEXTURE_RECTANGLE_ARB) { - shader_addline(buffer, "MUL texcrd.rg, fragment.texcoord[0], size.x;\n"); - shader_addline(buffer, "MOV texcrd.a, size.x;\n"); + shader_addline(buffer, "MUL texcrd.xy, fragment.texcoord[0], size.x;\n"); + shader_addline(buffer, "MOV texcrd.w, size.x;\n"); } else { shader_addline(buffer, "MOV texcrd, fragment.texcoord[0];\n"); } @@ -3272,9 +3272,9 @@ static BOOL gen_planar_yuv_read(SHADER_BUFFER *buffer, enum yuv_fixup yuv_fixup, /* Put the value into either of the chroma values */ shader_addline(buffer, "SGE temp.x, texcrd2.x, coef.y;\n"); - shader_addline(buffer, "MUL chroma.r, luminance.%c, temp.x;\n", chroma); + shader_addline(buffer, "MUL chroma.x, luminance.%c, temp.x;\n", chroma); shader_addline(buffer, "SLT temp.x, texcrd2.x, coef.y;\n"); - shader_addline(buffer, "MUL chroma.g, luminance.%c, temp.x;\n", chroma); + shader_addline(buffer, "MUL chroma.y, luminance.%c, temp.x;\n", chroma); /* Sample pixel 2. If we read an even pixel(SLT above returned 1), sample * the pixel right to the current one. Otherwise, sample the left pixel. @@ -3286,9 +3286,9 @@ static BOOL gen_planar_yuv_read(SHADER_BUFFER *buffer, enum yuv_fixup yuv_fixup, /* Put the value into the other chroma */ shader_addline(buffer, "SGE temp.x, texcrd2.x, coef.y;\n"); - shader_addline(buffer, "MAD chroma.g, luminance.%c, temp.x, chroma.g;\n", chroma); + shader_addline(buffer, "MAD chroma.y, luminance.%c, temp.x, chroma.y;\n", chroma); shader_addline(buffer, "SLT temp.x, texcrd2.x, coef.y;\n"); - shader_addline(buffer, "MAD chroma.r, luminance.%c, temp.x, chroma.r;\n", chroma); + shader_addline(buffer, "MAD chroma.x, luminance.%c, temp.x, chroma.x;\n", chroma); /* TODO: If filtering is enabled, sample a 2nd pair of pixels left or right of * the current one and lerp the two U and V values @@ -3408,7 +3408,7 @@ static BOOL gen_yv12_read(SHADER_BUFFER *buffer, GLenum textype, char *luminance } /* Read the texture, put the result into the output register */ shader_addline(buffer, "TEX temp, texcrd, texture[0], %s;\n", tex); - shader_addline(buffer, "MOV chroma.r, temp.a;\n"); + shader_addline(buffer, "MOV chroma.x, temp.w;\n"); /* The other chroma value is 1/6th of the texture lower, from 5/6th to 6/6th * No need to clamp because we're just reusing the already clamped value from above @@ -3419,7 +3419,7 @@ static BOOL gen_yv12_read(SHADER_BUFFER *buffer, GLenum textype, char *luminance shader_addline(buffer, "MAD texcrd.y, size.y, coef.w, texcrd.y;\n"); } shader_addline(buffer, "TEX temp, texcrd, texture[0], %s;\n", tex); - shader_addline(buffer, "MOV chroma.g, temp.a;\n"); + shader_addline(buffer, "MOV chroma.y, temp.w;\n"); /* Sample the luminance value. It is in the top 2/3rd of the texture, so scale the y coordinate. * Clamp the y coordinate to prevent the chroma values from bleeding into the sampled luminance @@ -3541,12 +3541,12 @@ static GLuint gen_yuv_shader(IWineD3DDeviceImpl *device, enum yuv_fixup yuv_fixu * http://www.fourcc.org/fccyvrgb.php. Note that the chroma * ranges from -0.5 to 0.5 */ - shader_addline(&buffer, "SUB chroma.rg, chroma, coef.y;\n"); + shader_addline(&buffer, "SUB chroma.xy, chroma, coef.y;\n"); - shader_addline(&buffer, "MAD result.color.r, chroma.r, yuv_coef.x, luminance.%c;\n", luminance_component); - shader_addline(&buffer, "MAD temp.r, -chroma.g, yuv_coef.y, luminance.%c;\n", luminance_component); - shader_addline(&buffer, "MAD result.color.g, -chroma.r, yuv_coef.z, temp.r;\n"); - shader_addline(&buffer, "MAD result.color.b, chroma.g, yuv_coef.w, luminance.%c;\n", luminance_component); + shader_addline(&buffer, "MAD result.color.x, chroma.x, yuv_coef.x, luminance.%c;\n", luminance_component); + shader_addline(&buffer, "MAD temp.x, -chroma.y, yuv_coef.y, luminance.%c;\n", luminance_component); + shader_addline(&buffer, "MAD result.color.y, -chroma.x, yuv_coef.z, temp.x;\n"); + shader_addline(&buffer, "MAD result.color.z, chroma.y, yuv_coef.w, luminance.%c;\n", luminance_component); shader_addline(&buffer, "END\n"); ENTER_GL(); diff --git a/dlls/wined3d/baseshader.c b/dlls/wined3d/baseshader.c index 93f86b24217..ade458627f4 100644 --- a/dlls/wined3d/baseshader.c +++ b/dlls/wined3d/baseshader.c @@ -588,7 +588,7 @@ static void shader_dump_param(const DWORD param, const DWORD addr_token, int inp { static const char * const rastout_reg_names[] = { "oPos", "oFog", "oPts" }; static const char * const misctype_reg_names[] = { "vPos", "vFace"}; - char swizzle_reg_chars[4]; + const char *swizzle_reg_chars = "xyzw"; DWORD reg = param & WINED3DSP_REGNUM_MASK; DWORD regtype = shader_get_regtype(param); @@ -597,14 +597,6 @@ static void shader_dump_param(const DWORD param, const DWORD addr_token, int inp /* There are some minor differences between pixel and vertex shaders */ char pshader = shader_is_pshader_version(shader_version); - /* For one, we'd prefer color components to be shown for pshaders. - * FIXME: use the swizzle function for this */ - - swizzle_reg_chars[0] = pshader? 'r': 'x'; - swizzle_reg_chars[1] = pshader? 'g': 'y'; - swizzle_reg_chars[2] = pshader? 'b': 'z'; - swizzle_reg_chars[3] = pshader? 'a': 'w'; - if (input) { if ( (modifier == WINED3DSPSM_NEG) || (modifier == WINED3DSPSM_BIASNEG) || @@ -709,10 +701,10 @@ static void shader_dump_param(const DWORD param, const DWORD addr_token, int inp } else { /** operand input */ DWORD swizzle = (param & WINED3DSP_SWIZZLE_MASK) >> WINED3DSP_SWIZZLE_SHIFT; - DWORD swizzle_r = swizzle & 0x03; - DWORD swizzle_g = (swizzle >> 2) & 0x03; - DWORD swizzle_b = (swizzle >> 4) & 0x03; - DWORD swizzle_a = (swizzle >> 6) & 0x03; + DWORD swizzle_x = swizzle & 0x03; + DWORD swizzle_y = (swizzle >> 2) & 0x03; + DWORD swizzle_z = (swizzle >> 4) & 0x03; + DWORD swizzle_w = (swizzle >> 6) & 0x03; if (0 != modifier) { switch (modifier) { @@ -740,16 +732,16 @@ static void shader_dump_param(const DWORD param, const DWORD addr_token, int inp * RRGGBBAA */ if ((WINED3DVS_NOSWIZZLE >> WINED3DVS_SWIZZLE_SHIFT) != swizzle) { - if (swizzle_r == swizzle_g && - swizzle_r == swizzle_b && - swizzle_r == swizzle_a) { - TRACE(".%c", swizzle_reg_chars[swizzle_r]); + if (swizzle_x == swizzle_y && + swizzle_x == swizzle_z && + swizzle_x == swizzle_w) { + TRACE(".%c", swizzle_reg_chars[swizzle_x]); } else { TRACE(".%c%c%c%c", - swizzle_reg_chars[swizzle_r], - swizzle_reg_chars[swizzle_g], - swizzle_reg_chars[swizzle_b], - swizzle_reg_chars[swizzle_a]); + swizzle_reg_chars[swizzle_x], + swizzle_reg_chars[swizzle_y], + swizzle_reg_chars[swizzle_z], + swizzle_reg_chars[swizzle_w]); } } } diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 09f47395170..36fbcba5405 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -2181,17 +2181,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface, WINED3DPR ENTER_GL(); - { /* Set a default viewport */ - WINED3DVIEWPORT vp; - vp.X = 0; - vp.Y = 0; - vp.Width = pPresentationParameters->BackBufferWidth; - vp.Height = pPresentationParameters->BackBufferHeight; - vp.MinZ = 0.0f; - vp.MaxZ = 1.0f; - IWineD3DDevice_SetViewport((IWineD3DDevice *)This, &vp); - } - /* Initialize the current view state */ This->view_ident = 1; This->contexts[0]->last_was_rhw = 0; @@ -7081,16 +7070,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Reset(IWineD3DDevice* iface, WINED3DPRE (pPresentationParameters->BackBufferWidth != swapchain->presentParms.BackBufferWidth || pPresentationParameters->BackBufferHeight != swapchain->presentParms.BackBufferHeight)) { - WINED3DVIEWPORT vp; UINT i; - vp.X = 0; - vp.Y = 0; - vp.Width = pPresentationParameters->BackBufferWidth; - vp.Height = pPresentationParameters->BackBufferHeight; - vp.MinZ = 0; - vp.MaxZ = 1; - if(!pPresentationParameters->Windowed) { DisplayModeChanged = TRUE; } @@ -7104,10 +7085,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Reset(IWineD3DDevice* iface, WINED3DPRE if(This->auto_depth_stencil_buffer) { updateSurfaceDesc((IWineD3DSurfaceImpl *)This->auto_depth_stencil_buffer, pPresentationParameters); } - - - /* Now set the new viewport */ - IWineD3DDevice_SetViewport(iface, &vp); } if((pPresentationParameters->Windowed && !swapchain->presentParms.Windowed) || @@ -7148,6 +7125,17 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Reset(IWineD3DDevice* iface, WINED3DPRE This->exStyle = exStyle; } + TRACE("Resetting stateblock\n"); + IWineD3DStateBlock_Release((IWineD3DStateBlock *)This->updateStateBlock); + IWineD3DStateBlock_Release((IWineD3DStateBlock *)This->stateBlock); + + /* Note: No parent needed for initial internal stateblock */ + hr = IWineD3DDevice_CreateStateBlock(iface, WINED3DSBT_INIT, (IWineD3DStateBlock **)&This->stateBlock, NULL); + if (FAILED(hr)) ERR("Resetting the stateblock failed with error 0x%08x\n", hr); + else TRACE("Created stateblock %p\n", This->stateBlock); + This->updateStateBlock = This->stateBlock; + IWineD3DStateBlock_AddRef((IWineD3DStateBlock *)This->updateStateBlock); + hr = IWineD3DStateBlock_InitStartupStateBlock((IWineD3DStateBlock *) This->stateBlock); if(FAILED(hr)) { ERR("Resetting the stateblock failed with error 0x%08x\n", hr); diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index b9a0e2ef854..2aceb9068b9 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -29,6 +29,7 @@ */ #include "config.h" +#include #include #include "wined3d_private.h" @@ -54,11 +55,35 @@ typedef struct { DWORD coord_mask; } glsl_sample_function_t; +enum heap_node_op +{ + HEAP_NODE_TRAVERSE_LEFT, + HEAP_NODE_TRAVERSE_RIGHT, + HEAP_NODE_POP, +}; + +struct constant_entry +{ + unsigned int idx; + unsigned int version; +}; + +struct constant_heap +{ + struct constant_entry *entries; + unsigned int *positions; + unsigned int size; +}; + /* GLSL shader private data */ struct shader_glsl_priv { struct hash_table_t *glsl_program_lookup; - const struct glsl_shader_prog_link *glsl_program; + struct glsl_shader_prog_link *glsl_program; + struct constant_heap vconst_heap; + struct constant_heap pconst_heap; + unsigned char *stack; GLhandleARB depth_blt_program[tex_type_count]; + UINT next_constant_version; }; /* Struct to maintain data about a linked GLSL program */ @@ -79,6 +104,7 @@ struct glsl_shader_prog_link { GLhandleARB vshader; IWineD3DPixelShader *pshader; struct ps_compile_args ps_args; + UINT constant_version; }; typedef struct { @@ -189,107 +215,166 @@ static void shader_glsl_load_vsamplers(const WineD3D_GL_Info *gl_info, IWineD3DS } } -/** - * Loads floating point constants (aka uniforms) into the currently set GLSL program. - * When constant_list == NULL, it will load all the constants. - */ -static void shader_glsl_load_constantsF(IWineD3DBaseShaderImpl *This, const WineD3D_GL_Info *gl_info, - unsigned int max_constants, const float *constants, const GLhandleARB *constant_locations, - const struct list *constant_list) +static inline void walk_constant_heap(const WineD3D_GL_Info *gl_info, const float *constants, + const GLhandleARB *constant_locations, const struct constant_heap *heap, unsigned char *stack, DWORD version) { - const constants_entry *constant; - const local_constant *lconst; - GLhandleARB tmp_loc; - DWORD i, j, k; - const DWORD *idx; - - if (TRACE_ON(d3d_shader)) { - LIST_FOR_EACH_ENTRY(constant, constant_list, constants_entry, entry) { - idx = constant->idx; - j = constant->count; - while (j--) { - i = *idx++; - tmp_loc = constant_locations[i]; - if (tmp_loc != -1) { - TRACE_(d3d_constants)("Loading constants %i: %f, %f, %f, %f\n", i, - constants[i * 4 + 0], constants[i * 4 + 1], - constants[i * 4 + 2], constants[i * 4 + 3]); + int stack_idx = 0; + unsigned int heap_idx = 1; + unsigned int idx; + + if (heap->entries[heap_idx].version <= version) return; + + idx = heap->entries[heap_idx].idx; + if (constant_locations[idx] != -1) GL_EXTCALL(glUniform4fvARB(constant_locations[idx], 1, &constants[idx * 4])); + stack[stack_idx] = HEAP_NODE_TRAVERSE_LEFT; + + while (stack_idx >= 0) + { + /* Note that we fall through to the next case statement. */ + switch(stack[stack_idx]) + { + case HEAP_NODE_TRAVERSE_LEFT: + { + unsigned int left_idx = heap_idx << 1; + if (left_idx < heap->size && heap->entries[left_idx].version > version) + { + heap_idx = left_idx; + idx = heap->entries[heap_idx].idx; + if (constant_locations[idx] != -1) + GL_EXTCALL(glUniform4fvARB(constant_locations[idx], 1, &constants[idx * 4])); + + stack[stack_idx++] = HEAP_NODE_TRAVERSE_RIGHT; + stack[stack_idx] = HEAP_NODE_TRAVERSE_LEFT; + break; } } + + case HEAP_NODE_TRAVERSE_RIGHT: + { + unsigned int right_idx = (heap_idx << 1) + 1; + if (right_idx < heap->size && heap->entries[right_idx].version > version) + { + heap_idx = right_idx; + idx = heap->entries[heap_idx].idx; + if (constant_locations[idx] != -1) + GL_EXTCALL(glUniform4fvARB(constant_locations[idx], 1, &constants[idx * 4])); + + stack[stack_idx++] = HEAP_NODE_POP; + stack[stack_idx] = HEAP_NODE_TRAVERSE_LEFT; + break; + } + } + + case HEAP_NODE_POP: + { + heap_idx >>= 1; + --stack_idx; + break; + } } } + checkGLcall("walk_constant_heap()"); +} - /* 1.X pshaders have the constants clamped to [-1;1] implicitly. */ - if (WINED3DSHADER_VERSION_MAJOR(This->baseShader.reg_maps.shader_version) == 1 - && shader_is_pshader_version(This->baseShader.reg_maps.shader_version)) +static inline void apply_clamped_constant(const WineD3D_GL_Info *gl_info, GLint location, const GLfloat *data) +{ + GLfloat clamped_constant[4]; + + if (location == -1) return; + + clamped_constant[0] = data[0] < -1.0f ? -1.0f : data[0] > 1.0 ? 1.0 : data[0]; + clamped_constant[1] = data[1] < -1.0f ? -1.0f : data[1] > 1.0 ? 1.0 : data[1]; + clamped_constant[2] = data[2] < -1.0f ? -1.0f : data[2] > 1.0 ? 1.0 : data[2]; + clamped_constant[3] = data[3] < -1.0f ? -1.0f : data[3] > 1.0 ? 1.0 : data[3]; + + GL_EXTCALL(glUniform4fvARB(location, 1, clamped_constant)); +} + +static inline void walk_constant_heap_clamped(const WineD3D_GL_Info *gl_info, const float *constants, + const GLhandleARB *constant_locations, const struct constant_heap *heap, unsigned char *stack, DWORD version) +{ + int stack_idx = 0; + unsigned int heap_idx = 1; + unsigned int idx; + + if (heap->entries[heap_idx].version <= version) return; + + idx = heap->entries[heap_idx].idx; + apply_clamped_constant(gl_info, constant_locations[idx], &constants[idx * 4]); + stack[stack_idx] = HEAP_NODE_TRAVERSE_LEFT; + + while (stack_idx >= 0) { - float lcl_const[4]; - - LIST_FOR_EACH_ENTRY(constant, constant_list, constants_entry, entry) { - idx = constant->idx; - j = constant->count; - while (j--) { - i = *idx++; - tmp_loc = constant_locations[i]; - if (tmp_loc != -1) { - /* We found this uniform name in the program - go ahead and send the data */ - k = i * 4; - if(constants[k + 0] < -1.0) lcl_const[0] = -1.0; - else if(constants[k + 0] > 1.0) lcl_const[0] = 1.0; - else lcl_const[0] = constants[k + 0]; - if(constants[k + 1] < -1.0) lcl_const[1] = -1.0; - else if(constants[k + 1] > 1.0) lcl_const[1] = 1.0; - else lcl_const[1] = constants[k + 1]; - if(constants[k + 2] < -1.0) lcl_const[2] = -1.0; - else if(constants[k + 2] > 1.0) lcl_const[2] = 1.0; - else lcl_const[2] = constants[k + 2]; - if(constants[k + 3] < -1.0) lcl_const[3] = -1.0; - else if(constants[k + 3] > 1.0) lcl_const[3] = 1.0; - else lcl_const[3] = constants[k + 3]; - - GL_EXTCALL(glUniform4fvARB(tmp_loc, 1, lcl_const)); + /* Note that we fall through to the next case statement. */ + switch(stack[stack_idx]) + { + case HEAP_NODE_TRAVERSE_LEFT: + { + unsigned int left_idx = heap_idx << 1; + if (left_idx < heap->size && heap->entries[left_idx].version > version) + { + heap_idx = left_idx; + idx = heap->entries[heap_idx].idx; + apply_clamped_constant(gl_info, constant_locations[idx], &constants[idx * 4]); + + stack[stack_idx++] = HEAP_NODE_TRAVERSE_RIGHT; + stack[stack_idx] = HEAP_NODE_TRAVERSE_LEFT; + break; } } - } - } else { - LIST_FOR_EACH_ENTRY(constant, constant_list, constants_entry, entry) { - idx = constant->idx; - j = constant->count; - while (j--) { - i = *idx++; - tmp_loc = constant_locations[i]; - if (tmp_loc != -1) { - /* We found this uniform name in the program - go ahead and send the data */ - GL_EXTCALL(glUniform4fvARB(tmp_loc, 1, constants + (i * 4))); + + case HEAP_NODE_TRAVERSE_RIGHT: + { + unsigned int right_idx = (heap_idx << 1) + 1; + if (right_idx < heap->size && heap->entries[right_idx].version > version) + { + heap_idx = right_idx; + idx = heap->entries[heap_idx].idx; + apply_clamped_constant(gl_info, constant_locations[idx], &constants[idx * 4]); + + stack[stack_idx++] = HEAP_NODE_POP; + stack[stack_idx] = HEAP_NODE_TRAVERSE_LEFT; + break; } } + + case HEAP_NODE_POP: + { + heap_idx >>= 1; + --stack_idx; + break; + } } } - checkGLcall("glUniform4fvARB()"); + checkGLcall("walk_constant_heap_clamped()"); +} - if(!This->baseShader.load_local_constsF) { +/* Loads floating point constants (aka uniforms) into the currently set GLSL program. */ +static void shader_glsl_load_constantsF(IWineD3DBaseShaderImpl *This, const WineD3D_GL_Info *gl_info, + const float *constants, const GLhandleARB *constant_locations, const struct constant_heap *heap, + unsigned char *stack, UINT version) +{ + const local_constant *lconst; + + /* 1.X pshaders have the constants clamped to [-1;1] implicitly. */ + if (WINED3DSHADER_VERSION_MAJOR(This->baseShader.reg_maps.shader_version) == 1 + && shader_is_pshader_version(This->baseShader.reg_maps.shader_version)) + walk_constant_heap_clamped(gl_info, constants, constant_locations, heap, stack, version); + else + walk_constant_heap(gl_info, constants, constant_locations, heap, stack, version); + + if (!This->baseShader.load_local_constsF) + { TRACE("No need to load local float constants for this shader\n"); return; } - /* Load immediate constants */ - if (TRACE_ON(d3d_shader)) { - LIST_FOR_EACH_ENTRY(lconst, &This->baseShader.constantsF, local_constant, entry) { - tmp_loc = constant_locations[lconst->idx]; - if (tmp_loc != -1) { - const GLfloat *values = (const GLfloat *)lconst->value; - TRACE_(d3d_constants)("Loading local constants %i: %f, %f, %f, %f\n", lconst->idx, - values[0], values[1], values[2], values[3]); - } - } - } /* Immediate constants are clamped to [-1;1] at shader creation time if needed */ - LIST_FOR_EACH_ENTRY(lconst, &This->baseShader.constantsF, local_constant, entry) { - tmp_loc = constant_locations[lconst->idx]; - if (tmp_loc != -1) { - /* We found this uniform name in the program - go ahead and send the data */ - GL_EXTCALL(glUniform4fvARB(tmp_loc, 1, (const GLfloat *)lconst->value)); - } + LIST_FOR_EACH_ENTRY(lconst, &This->baseShader.constantsF, local_constant, entry) + { + GLhandleARB location = constant_locations[lconst->idx]; + /* We found this uniform name in the program - go ahead and send the data */ + if (location != -1) GL_EXTCALL(glUniform4fvARB(location, 1, (const GLfloat *)lconst->value)); } checkGLcall("glUniform4fvARB()"); } @@ -381,7 +466,11 @@ static void shader_glsl_load_constantsB(IWineD3DBaseShaderImpl *This, const Wine } } - +static void reset_program_constant_version(void *value, void *context) +{ + struct glsl_shader_prog_link *entry = (struct glsl_shader_prog_link *)value; + entry->constant_version = 0; +} /** * Loads the app-supplied constants into the currently set GLSL program. @@ -392,14 +481,13 @@ static void shader_glsl_load_constants( char useVertexShader) { IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) device; - const struct shader_glsl_priv *priv = (struct shader_glsl_priv *)deviceImpl->shader_priv; + struct shader_glsl_priv *priv = (struct shader_glsl_priv *)deviceImpl->shader_priv; IWineD3DStateBlockImpl* stateBlock = deviceImpl->stateBlock; const WineD3D_GL_Info *gl_info = &deviceImpl->adapter->gl_info; - const GLhandleARB *constant_locations; - const struct list *constant_list; GLhandleARB programId; - const struct glsl_shader_prog_link *prog = priv->glsl_program; + struct glsl_shader_prog_link *prog = priv->glsl_program; + UINT constant_version; int i; if (!prog) { @@ -407,16 +495,14 @@ static void shader_glsl_load_constants( return; } programId = prog->programId; + constant_version = prog->constant_version; if (useVertexShader) { IWineD3DBaseShaderImpl* vshader = (IWineD3DBaseShaderImpl*) stateBlock->vertexShader; - constant_locations = prog->vuniformF_locations; - constant_list = &stateBlock->set_vconstantsF; - /* Load DirectX 9 float constants/uniforms for vertex shader */ - shader_glsl_load_constantsF(vshader, gl_info, GL_LIMITS(vshader_constantsF), - stateBlock->vertexShaderConstantF, constant_locations, constant_list); + shader_glsl_load_constantsF(vshader, gl_info, stateBlock->vertexShaderConstantF, + prog->vuniformF_locations, &priv->vconst_heap, priv->stack, constant_version); /* Load DirectX 9 integer constants/uniforms for vertex shader */ if(vshader->baseShader.uses_int_consts) { @@ -439,12 +525,9 @@ static void shader_glsl_load_constants( IWineD3DBaseShaderImpl* pshader = (IWineD3DBaseShaderImpl*) stateBlock->pixelShader; - constant_locations = prog->puniformF_locations; - constant_list = &stateBlock->set_pconstantsF; - /* Load DirectX 9 float constants/uniforms for pixel shader */ - shader_glsl_load_constantsF(pshader, gl_info, GL_LIMITS(pshader_constantsF), - stateBlock->pixelShaderConstantF, constant_locations, constant_list); + shader_glsl_load_constantsF(pshader, gl_info, stateBlock->pixelShaderConstantF, + prog->puniformF_locations, &priv->pconst_heap, priv->stack, constant_version); /* Load DirectX 9 integer constants/uniforms for pixel shader */ if(pshader->baseShader.uses_int_consts) { @@ -496,49 +579,71 @@ static void shader_glsl_load_constants( GL_EXTCALL(glUniform4fvARB(prog->ycorrection_location, 1, correction_params)); } } + + if (priv->next_constant_version == UINT_MAX) + { + TRACE("Max constant version reached, resetting to 0.\n"); + hash_table_for_each_entry(priv->glsl_program_lookup, reset_program_constant_version, NULL); + priv->next_constant_version = 1; + } + else + { + prog->constant_version = priv->next_constant_version++; + } +} + +static inline void update_heap_entry(struct constant_heap *heap, unsigned int idx, + unsigned int heap_idx, DWORD new_version) +{ + struct constant_entry *entries = heap->entries; + unsigned int *positions = heap->positions; + unsigned int parent_idx; + + while (heap_idx > 1) + { + parent_idx = heap_idx >> 1; + + if (new_version <= entries[parent_idx].version) break; + + entries[heap_idx] = entries[parent_idx]; + positions[entries[parent_idx].idx] = heap_idx; + heap_idx = parent_idx; + } + + entries[heap_idx].version = new_version; + entries[heap_idx].idx = idx; + positions[idx] = heap_idx; } static void shader_glsl_update_float_vertex_constants(IWineD3DDevice *iface, UINT start, UINT count) { IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; + struct shader_glsl_priv *priv = (struct shader_glsl_priv *)This->shader_priv; + struct constant_heap *heap = &priv->vconst_heap; UINT i; for (i = start; i < count + start; ++i) { if (!This->stateBlock->changed.vertexShaderConstantsF[i]) - { - constants_entry *ptr = LIST_ENTRY(list_head(&This->stateBlock->set_vconstantsF), - constants_entry, entry); - - if (!ptr || ptr->count >= sizeof(ptr->idx) / sizeof(*ptr->idx)) - { - ptr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(constants_entry)); - list_add_head(&This->stateBlock->set_vconstantsF, &ptr->entry); - } - ptr->idx[ptr->count++] = i; - } + update_heap_entry(heap, i, heap->size++, priv->next_constant_version); + else + update_heap_entry(heap, i, heap->positions[i], priv->next_constant_version); } } static void shader_glsl_update_float_pixel_constants(IWineD3DDevice *iface, UINT start, UINT count) { IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; + struct shader_glsl_priv *priv = (struct shader_glsl_priv *)This->shader_priv; + struct constant_heap *heap = &priv->pconst_heap; UINT i; for (i = start; i < count + start; ++i) { if (!This->stateBlock->changed.pixelShaderConstantsF[i]) - { - constants_entry *ptr = LIST_ENTRY(list_head(&This->stateBlock->set_pconstantsF), - constants_entry, entry); - - if (!ptr || ptr->count >= sizeof(ptr->idx) / sizeof(*ptr->idx)) - { - ptr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(constants_entry)); - list_add_head(&This->stateBlock->set_pconstantsF, &ptr->entry); - } - ptr->idx[ptr->count++] = i; - } + update_heap_entry(heap, i, heap->size++, priv->next_constant_version); + else + update_heap_entry(heap, i, heap->positions[i], priv->next_constant_version); } } @@ -3215,6 +3320,7 @@ static void set_glsl_shader_program(IWineD3DDevice *iface, BOOL use_ps, BOOL use entry->vshader = vshader_id; entry->pshader = pshader; entry->ps_args = compile_args; + entry->constant_version = 0; /* Add the hash table entry */ add_glsl_program_entry(priv, entry); @@ -3578,10 +3684,64 @@ static BOOL glsl_program_key_compare(const void *keya, const void *keyb) (memcmp(&ka->ps_args, &kb->ps_args, sizeof(kb->ps_args)) == 0); } +static BOOL constant_heap_init(struct constant_heap *heap, unsigned int constant_count) +{ + SIZE_T size = (constant_count + 1) * sizeof(*heap->entries) + constant_count * sizeof(*heap->positions); + void *mem = HeapAlloc(GetProcessHeap(), 0, size); + + if (!mem) + { + ERR("Failed to allocate memory\n"); + return FALSE; + } + + heap->entries = mem; + heap->entries[1].version = 0; + heap->positions = (unsigned int *)(heap->entries + constant_count + 1); + heap->size = 1; + + return TRUE; +} + +static void constant_heap_free(struct constant_heap *heap) +{ + HeapFree(GetProcessHeap(), 0, heap->entries); +} + static HRESULT shader_glsl_alloc(IWineD3DDevice *iface) { IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; + const WineD3D_GL_Info *gl_info = &This->adapter->gl_info; struct shader_glsl_priv *priv = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct shader_glsl_priv)); + SIZE_T stack_size = wined3d_log2i(max(GL_LIMITS(vshader_constantsF), GL_LIMITS(pshader_constantsF))) + 1; + + priv->stack = HeapAlloc(GetProcessHeap(), 0, stack_size * sizeof(*priv->stack)); + if (!priv->stack) + { + ERR("Failed to allocate memory.\n"); + HeapFree(GetProcessHeap(), 0, priv); + return E_OUTOFMEMORY; + } + + if (!constant_heap_init(&priv->vconst_heap, GL_LIMITS(vshader_constantsF))) + { + ERR("Failed to initialize vertex shader constant heap\n"); + HeapFree(GetProcessHeap(), 0, priv->stack); + HeapFree(GetProcessHeap(), 0, priv); + return E_OUTOFMEMORY; + } + + if (!constant_heap_init(&priv->pconst_heap, GL_LIMITS(pshader_constantsF))) + { + ERR("Failed to initialize pixel shader constant heap\n"); + constant_heap_free(&priv->vconst_heap); + HeapFree(GetProcessHeap(), 0, priv->stack); + HeapFree(GetProcessHeap(), 0, priv); + return E_OUTOFMEMORY; + } + priv->glsl_program_lookup = hash_table_create(glsl_program_key_hash, glsl_program_key_compare); + priv->next_constant_version = 1; + This->shader_priv = priv; return WINED3D_OK; } @@ -3601,6 +3761,8 @@ static void shader_glsl_free(IWineD3DDevice *iface) { } hash_table_destroy(priv->glsl_program_lookup, NULL, NULL); + constant_heap_free(&priv->pconst_heap); + constant_heap_free(&priv->vconst_heap); HeapFree(GetProcessHeap(), 0, This->shader_priv); This->shader_priv = NULL; diff --git a/dlls/wined3d/indexbuffer.c b/dlls/wined3d/indexbuffer.c index 0737892d1df..2325f70ee53 100644 --- a/dlls/wined3d/indexbuffer.c +++ b/dlls/wined3d/indexbuffer.c @@ -108,7 +108,7 @@ static DWORD WINAPI IWineD3DIndexBufferImpl_GetPriority(IWineD3DIndexBuffer *ifa } static void WINAPI IWineD3DIndexBufferImpl_PreLoad(IWineD3DIndexBuffer *iface) { - FIXME("iface %p stub!\n", iface); + TRACE("iface %p.\n", iface); } static void WINAPI IWineD3DIndexBufferImpl_UnLoad(IWineD3DIndexBuffer *iface) { diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index b0cb027677e..e1d4627e2d9 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -57,9 +57,6 @@ HRESULT allocate_shader_constants(IWineD3DStateBlockImpl* object) { object->contained_ps_consts_f = HeapAlloc(GetProcessHeap(), 0, sizeof(DWORD) * GL_LIMITS(pshader_constantsF)); if (!object->contained_ps_consts_f) goto fail; - list_init(&object->set_vconstantsF); - list_init(&object->set_pconstantsF); - return WINED3D_OK; fail: @@ -252,7 +249,6 @@ static ULONG WINAPI IWineD3DStateBlockImpl_Release(IWineD3DStateBlock *iface) { TRACE("(%p) : Releasing from %d\n", This, refCount + 1); if (!refCount) { - constants_entry *constant, *constant2; int counter; /* type 0 represents the primary stateblock, so free all the resources */ @@ -294,15 +290,6 @@ static ULONG WINAPI IWineD3DStateBlockImpl_Release(IWineD3DStateBlock *iface) { HeapFree(GetProcessHeap(), 0, This->changed.pixelShaderConstantsF); HeapFree(GetProcessHeap(), 0, This->contained_vs_consts_f); HeapFree(GetProcessHeap(), 0, This->contained_ps_consts_f); - - LIST_FOR_EACH_ENTRY_SAFE(constant, constant2, &This->set_vconstantsF, constants_entry, entry) { - HeapFree(GetProcessHeap(), 0, constant); - } - - LIST_FOR_EACH_ENTRY_SAFE(constant, constant2, &This->set_pconstantsF, constants_entry, entry) { - HeapFree(GetProcessHeap(), 0, constant); - } - HeapFree(GetProcessHeap(), 0, This); } return refCount; @@ -1244,6 +1231,8 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStat /* check the return values, because the GetBackBuffer call isn't valid for ddraw */ hr = IWineD3DDevice_GetSwapChain(device, 0, &swapchain); if( hr == WINED3D_OK && swapchain != NULL) { + WINED3DVIEWPORT vp; + hr = IWineD3DSwapChain_GetBackBuffer(swapchain, 0, WINED3DBACKBUFFER_TYPE_MONO, &backbuffer); if( hr == WINED3D_OK && backbuffer != NULL) { IWineD3DSurface_GetDesc(backbuffer, &desc); @@ -1258,6 +1247,16 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStat ERR("This should never happen, expect rendering issues!\n"); } } + + /* Set the default viewport */ + vp.X = 0; + vp.Y = 0; + vp.Width = ((IWineD3DSwapChainImpl *)swapchain)->presentParms.BackBufferWidth; + vp.Height = ((IWineD3DSwapChainImpl *)swapchain)->presentParms.BackBufferHeight; + vp.MinZ = 0.0f; + vp.MaxZ = 1.0f; + IWineD3DDevice_SetViewport(device, &vp); + IWineD3DSwapChain_Release(swapchain); } diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index b9c4bf233eb..95ee0ec1392 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -1723,6 +1723,16 @@ void hash_table_destroy(struct hash_table_t *table, void (*free_value)(void *val HeapFree(GetProcessHeap(), 0, table); } +void hash_table_for_each_entry(struct hash_table_t *table, void (*callback)(void *value, void *context), void *context) +{ + unsigned int i = 0; + + for (i = 0; i < table->entry_count; ++i) + { + callback(table->entries[i].value, context); + } +} + static inline struct hash_table_entry_t *hash_table_get_by_idx(const struct hash_table_t *table, const void *key, unsigned int idx) { diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index d433b537a21..7e422fb6dc5 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -153,6 +153,7 @@ struct hash_table_t { struct hash_table_t *hash_table_create(hash_function_t *hash_function, compare_function_t *compare_function); void hash_table_destroy(struct hash_table_t *table, void (*free_value)(void *value, void *cb), void *cb); +void hash_table_for_each_entry(struct hash_table_t *table, void (*callback)(void *value, void *context), void *context); void *hash_table_get(const struct hash_table_t *table, const void *key); void hash_table_put(struct hash_table_t *table, void *key, void *value); void hash_table_remove(struct hash_table_t *table, void *key); @@ -1784,12 +1785,6 @@ typedef struct SAVEDSTATES { BOOL scissorRect; } SAVEDSTATES; -typedef struct { - struct list entry; - DWORD count; - DWORD idx[13]; -} constants_entry; - struct StageState { DWORD stage; DWORD state; @@ -1808,8 +1803,6 @@ struct IWineD3DStateBlockImpl /* Array indicating whether things have been set or changed */ SAVEDSTATES changed; - struct list set_vconstantsF; - struct list set_pconstantsF; /* Vertex Shader Declaration */ IWineD3DVertexDeclaration *vertexDecl; diff --git a/dlls/winex11.drv/xinerama.c b/dlls/winex11.drv/xinerama.c index f3af0c3172d..08500261cbe 100644 --- a/dlls/winex11.drv/xinerama.c +++ b/dlls/winex11.drv/xinerama.c @@ -111,7 +111,7 @@ static int query_screens(void) { int i, count, event_base, error_base; XineramaScreenInfo *screens; - RECT rc_work; + RECT rc_work = {0, 0, 0, 0}; if (!monitors) /* first time around */ load_xinerama(); diff --git a/include/mscoree.idl b/include/mscoree.idl index 5877eb6650c..aed31da4bdf 100644 --- a/include/mscoree.idl +++ b/include/mscoree.idl @@ -27,6 +27,8 @@ cpp_quote("HRESULT WINAPI GetCORSystemDirectory(LPWSTR,DWORD,DWORD*);") cpp_quote("HRESULT WINAPI GetCORVersion(LPWSTR,DWORD,DWORD*);") cpp_quote("HRESULT WINAPI GetRequestedRuntimeInfo(LPCWSTR,LPCWSTR,LPCWSTR,DWORD,DWORD,LPWSTR,DWORD,DWORD*,LPWSTR,DWORD,DWORD*);") cpp_quote("HRESULT WINAPI LoadLibraryShim(LPCWSTR,LPCWSTR,LPVOID,HMODULE*);") +cpp_quote("typedef HRESULT (__stdcall *FLockClrVersionCallback)();") +cpp_quote("HRESULT WINAPI LockClrVersion(FLockClrVersionCallback,FLockClrVersionCallback*,FLockClrVersionCallback*);") typedef void* HDOMAINENUM; diff --git a/tools/winemaker b/tools/winemaker index b70e08dc117..918cd2a065b 100755 --- a/tools/winemaker +++ b/tools/winemaker @@ -1103,7 +1103,7 @@ sub search_from($$) my $directory=get_directory_contents $dirname; my $found; foreach my $dentry (@$directory) { - if ($dentry =~ /^$component$/i or + if ($dentry =~ /^\Q$component\E$/i or (defined $renamed and $dentry =~ /^$renamed$/i) ) { $dirname.="$dentry/"; -- 2.11.4.GIT