Rebase against 6d05fae6f7ebab83a2f1c6621d9619bbe91833fd

This commit is contained in:
Alistair Leslie-Hughes 2019-05-29 09:41:06 +10:00
parent b9204d93c9
commit 8725e273cc
10 changed files with 104 additions and 480 deletions

View File

@ -1,115 +0,0 @@
From aff69d94c931851302d870316b05772193568e29 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Tue, 5 Feb 2019 10:00:26 +1100
Subject: [PATCH 1/2] bcrypt: Add BCryptDestroySecret/BCryptSecretAgreement
stubs
---
dlls/bcrypt/bcrypt.spec | 4 ++--
dlls/bcrypt/bcrypt_main.c | 16 ++++++++++++++++
dlls/ncrypt/ncrypt.spec | 4 ++--
include/bcrypt.h | 3 +++
4 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/dlls/bcrypt/bcrypt.spec b/dlls/bcrypt/bcrypt.spec
index 052a099..dfe08e7 100644
--- a/dlls/bcrypt/bcrypt.spec
+++ b/dlls/bcrypt/bcrypt.spec
@@ -11,7 +11,7 @@
@ stdcall BCryptDeriveKeyPBKDF2(ptr ptr long ptr long int64 ptr long long)
@ stdcall BCryptDestroyHash(ptr)
@ stdcall BCryptDestroyKey(ptr)
-@ stub BCryptDestroySecret
+@ stdcall BCryptDestroySecret(ptr)
@ stdcall BCryptDuplicateHash(ptr ptr ptr long long)
@ stdcall BCryptDuplicateKey(ptr ptr ptr long long)
@ stdcall BCryptEncrypt(ptr ptr long ptr ptr long ptr long ptr long)
@@ -44,7 +44,7 @@
@ stdcall BCryptRemoveContextFunction(long wstr long wstr)
@ stdcall BCryptRemoveContextFunctionProvider(long wstr long wstr wstr)
@ stub BCryptResolveProviders
-@ stub BCryptSecretAgreement
+@ stdcall BCryptSecretAgreement(ptr ptr ptr long)
@ stub BCryptSetAuditingInterface
@ stub BCryptSetContextFunctionProperty
@ stdcall BCryptSetProperty(ptr wstr ptr long long)
diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c
index b9c51a1..18783f0 100644
--- a/dlls/bcrypt/bcrypt_main.c
+++ b/dlls/bcrypt/bcrypt_main.c
@@ -1580,6 +1580,22 @@ NTSTATUS WINAPI BCryptDeriveKeyPBKDF2( BCRYPT_ALG_HANDLE handle, UCHAR *pwd, ULO
return STATUS_SUCCESS;
}
+NTSTATUS WINAPI BCryptSecretAgreement(BCRYPT_KEY_HANDLE handle, BCRYPT_KEY_HANDLE key, BCRYPT_SECRET_HANDLE *secret, ULONG flags)
+{
+ FIXME( "%p, %p, %p, %08x\n", handle, key, secret, flags );
+
+ if(secret)
+ *secret = (BCRYPT_SECRET_HANDLE *)0xDEADFEED;
+
+ return STATUS_SUCCESS;
+}
+
+NTSTATUS WINAPI BCryptDestroySecret(BCRYPT_SECRET_HANDLE secret)
+{
+ FIXME( "%p\n", secret );
+ return STATUS_SUCCESS;
+}
+
BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
{
switch (reason)
diff --git a/dlls/ncrypt/ncrypt.spec b/dlls/ncrypt/ncrypt.spec
index 85fa5c0..d4a32ed 100644
--- a/dlls/ncrypt/ncrypt.spec
+++ b/dlls/ncrypt/ncrypt.spec
@@ -12,7 +12,7 @@
@ stdcall BCryptDeriveKeyPBKDF2(ptr ptr long ptr long int64 ptr long long) bcrypt.BCryptDeriveKeyPBKDF2
@ stdcall BCryptDestroyHash(ptr) bcrypt.BCryptDestroyHash
@ stdcall BCryptDestroyKey(ptr) bcrypt.BCryptDestroyKey
-@ stub BCryptDestroySecret
+@ stdcall BCryptDestroySecret(ptr) bcrypt.BCryptDestroySecret
@ stdcall BCryptDuplicateHash(ptr ptr ptr long long) bcrypt.BCryptDuplicateHash
@ stdcall BCryptDuplicateKey(ptr ptr ptr long long) bcrypt.BCryptDuplicateKey
@ stdcall BCryptEncrypt(ptr ptr long ptr ptr long ptr long ptr long) bcrypt.BCryptEncrypt
@@ -46,7 +46,7 @@
@ stdcall BCryptRemoveContextFunction(long wstr long wstr) bcrypt.BCryptRemoveContextFunction
@ stdcall BCryptRemoveContextFunctionProvider(long wstr long wstr wstr) bcrypt.BCryptRemoveContextFunctionProvider
@ stub BCryptResolveProviders
-@ stub BCryptSecretAgreement
+@ stdcall BCryptSecretAgreement(ptr ptr ptr long) bcrypt.BCryptSecretAgreement
@ stub BCryptSetAuditingInterface
@ stub BCryptSetContextFunctionProperty
@ stdcall BCryptSetProperty(ptr wstr ptr long long) bcrypt.BCryptSetProperty
diff --git a/include/bcrypt.h b/include/bcrypt.h
index a0b0d52..f0185d1 100644
--- a/include/bcrypt.h
+++ b/include/bcrypt.h
@@ -211,6 +211,7 @@ typedef PVOID BCRYPT_ALG_HANDLE;
typedef PVOID BCRYPT_KEY_HANDLE;
typedef PVOID BCRYPT_HANDLE;
typedef PVOID BCRYPT_HASH_HANDLE;
+typedef PVOID BCRYPT_SECRET_HANDLE;
/* Flags for BCryptGenRandom */
#define BCRYPT_RNG_USE_ENTROPY_IN_BUFFER 0x00000001
@@ -231,6 +232,7 @@ NTSTATUS WINAPI BCryptDecrypt(BCRYPT_KEY_HANDLE, PUCHAR, ULONG, VOID *, PUCHAR,
NTSTATUS WINAPI BCryptDeriveKeyPBKDF2(BCRYPT_ALG_HANDLE, PUCHAR, ULONG, PUCHAR, ULONG, ULONGLONG, PUCHAR, ULONG, ULONG);
NTSTATUS WINAPI BCryptDestroyHash(BCRYPT_HASH_HANDLE);
NTSTATUS WINAPI BCryptDestroyKey(BCRYPT_KEY_HANDLE);
+NTSTATUS WINAPI BCryptDestroySecret(BCRYPT_SECRET_HANDLE);
NTSTATUS WINAPI BCryptDuplicateHash(BCRYPT_HASH_HANDLE, BCRYPT_HASH_HANDLE *, UCHAR *, ULONG, ULONG);
NTSTATUS WINAPI BCryptEncrypt(BCRYPT_KEY_HANDLE, PUCHAR, ULONG, VOID *, PUCHAR, ULONG, PUCHAR, ULONG, ULONG *, ULONG);
NTSTATUS WINAPI BCryptEnumAlgorithms(ULONG, ULONG *, BCRYPT_ALGORITHM_IDENTIFIER **, ULONG);
@@ -245,6 +247,7 @@ NTSTATUS WINAPI BCryptHash(BCRYPT_ALG_HANDLE, PUCHAR, ULONG, PUCHAR, ULONG, PUCH
NTSTATUS WINAPI BCryptHashData(BCRYPT_HASH_HANDLE, PUCHAR, ULONG, ULONG);
NTSTATUS WINAPI BCryptImportKeyPair(BCRYPT_ALG_HANDLE, BCRYPT_KEY_HANDLE, LPCWSTR, BCRYPT_KEY_HANDLE *, UCHAR *, ULONG, ULONG);
NTSTATUS WINAPI BCryptOpenAlgorithmProvider(BCRYPT_ALG_HANDLE *, LPCWSTR, LPCWSTR, ULONG);
+NTSTATUS WINAPI BCryptSecretAgreement(BCRYPT_KEY_HANDLE, BCRYPT_KEY_HANDLE, BCRYPT_SECRET_HANDLE *, ULONG);
NTSTATUS WINAPI BCryptSetProperty(BCRYPT_HANDLE, LPCWSTR, PUCHAR, ULONG, ULONG);
NTSTATUS WINAPI BCryptVerifySignature(BCRYPT_KEY_HANDLE, void *, UCHAR *, ULONG, UCHAR *, ULONG, ULONG);
--
1.9.1

View File

@ -1,92 +0,0 @@
From 01c7d3e8e745c3b443e0a8e712f32eadc56f59a8 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Tue, 5 Feb 2019 10:09:59 +1100
Subject: [PATCH 2/2] bcrypt: Add BCryptDeriveKey stub
---
dlls/bcrypt/bcrypt.spec | 2 +-
dlls/bcrypt/bcrypt_main.c | 7 +++++++
dlls/ncrypt/ncrypt.spec | 2 +-
include/bcrypt.h | 15 +++++++++++++++
4 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/dlls/bcrypt/bcrypt.spec b/dlls/bcrypt/bcrypt.spec
index dfe08e7..4946ee5 100644
--- a/dlls/bcrypt/bcrypt.spec
+++ b/dlls/bcrypt/bcrypt.spec
@@ -7,7 +7,7 @@
@ stdcall BCryptCreateHash(ptr ptr ptr long ptr long long)
@ stdcall BCryptDecrypt(ptr ptr long ptr ptr long ptr long ptr long)
@ stub BCryptDeleteContext
-@ stub BCryptDeriveKey
+@ stdcall BCryptDeriveKey(ptr wstr ptr ptr long ptr long)
@ stdcall BCryptDeriveKeyPBKDF2(ptr ptr long ptr long int64 ptr long long)
@ stdcall BCryptDestroyHash(ptr)
@ stdcall BCryptDestroyKey(ptr)
diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c
index 18783f0..399626d 100644
--- a/dlls/bcrypt/bcrypt_main.c
+++ b/dlls/bcrypt/bcrypt_main.c
@@ -1596,6 +1596,13 @@ NTSTATUS WINAPI BCryptDestroySecret(BCRYPT_SECRET_HANDLE secret)
return STATUS_SUCCESS;
}
+NTSTATUS WINAPI BCryptDeriveKey(BCRYPT_SECRET_HANDLE secret, LPCWSTR kdf, BCryptBufferDesc *parameter,
+ PUCHAR derived, ULONG derived_size, ULONG *result, ULONG flags)
+{
+ FIXME( "%p, %s, %p, %p, %d, %p, %08x\n", secret, debugstr_w(kdf), parameter, derived, derived_size, result, flags );
+ return STATUS_INTERNAL_ERROR;
+}
+
BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
{
switch (reason)
diff --git a/dlls/ncrypt/ncrypt.spec b/dlls/ncrypt/ncrypt.spec
index d4a32ed..d35f8a9 100644
--- a/dlls/ncrypt/ncrypt.spec
+++ b/dlls/ncrypt/ncrypt.spec
@@ -7,7 +7,7 @@
@ stdcall BCryptCreateHash(ptr ptr ptr long ptr long long) bcrypt.BCryptCreateHash
@ stdcall BCryptDecrypt(ptr ptr long ptr ptr long ptr long ptr long) bcrypt.BCryptDecrypt
@ stub BCryptDeleteContext
-@ stub BCryptDeriveKey
+@ stdcall BCryptDeriveKey(ptr wstr ptr ptr long ptr long) bcrypt.BCryptDeriveKey
@ stub BCryptDeriveKeyCapi
@ stdcall BCryptDeriveKeyPBKDF2(ptr ptr long ptr long int64 ptr long long) bcrypt.BCryptDeriveKeyPBKDF2
@ stdcall BCryptDestroyHash(ptr) bcrypt.BCryptDestroyHash
diff --git a/include/bcrypt.h b/include/bcrypt.h
index f0185d1..b1799d0 100644
--- a/include/bcrypt.h
+++ b/include/bcrypt.h
@@ -204,6 +204,20 @@ typedef struct _BCRYPT_KEY_DATA_BLOB_HEADER
ULONG cbKeyData;
} BCRYPT_KEY_DATA_BLOB_HEADER, *PBCRYPT_KEY_DATA_BLOB_HEADER;
+typedef struct _BCryptBuffer
+{
+ ULONG cbBuffer;
+ ULONG BufferType;
+ void *pvBuffer;
+} BCryptBuffer, *PBCryptBuffer;
+
+typedef struct _BCryptBufferDesc
+{
+ ULONG ulVersion;
+ ULONG cBuffers;
+ PBCryptBuffer pBuffers;
+} BCryptBufferDesc, *PBCryptBufferDesc;
+
#define BCRYPT_KEY_DATA_BLOB_MAGIC 0x4d42444b
#define BCRYPT_KEY_DATA_BLOB_VERSION1 1
@@ -229,6 +243,7 @@ typedef PVOID BCRYPT_SECRET_HANDLE;
NTSTATUS WINAPI BCryptCloseAlgorithmProvider(BCRYPT_ALG_HANDLE, ULONG);
NTSTATUS WINAPI BCryptCreateHash(BCRYPT_ALG_HANDLE, BCRYPT_HASH_HANDLE *, PUCHAR, ULONG, PUCHAR, ULONG, ULONG);
NTSTATUS WINAPI BCryptDecrypt(BCRYPT_KEY_HANDLE, PUCHAR, ULONG, VOID *, PUCHAR, ULONG, PUCHAR, ULONG, ULONG *, ULONG);
+NTSTATUS WINAPI BCryptDeriveKey(BCRYPT_SECRET_HANDLE, LPCWSTR, BCryptBufferDesc*, PUCHAR, ULONG, ULONG *, ULONG);
NTSTATUS WINAPI BCryptDeriveKeyPBKDF2(BCRYPT_ALG_HANDLE, PUCHAR, ULONG, PUCHAR, ULONG, ULONGLONG, PUCHAR, ULONG, ULONG);
NTSTATUS WINAPI BCryptDestroyHash(BCRYPT_HASH_HANDLE);
NTSTATUS WINAPI BCryptDestroyKey(BCRYPT_KEY_HANDLE);
--
1.9.1

View File

@ -1 +0,0 @@
Fixes: [46564] Add BCryptDestroySecret/BCryptSecretAgreement stubs.

View File

@ -52,7 +52,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "3139727a97a91b91e74d57ec97a8c19b0093b68e"
echo "6d05fae6f7ebab83a2f1c6621d9619bbe91833fd"
}
# Show version information
@ -92,7 +92,6 @@ patch_enable_all ()
enable_advapi32_Token_Integrity_Level="$1"
enable_api_ms_win_Stub_DLLs="$1"
enable_atl_AtlAxDialogBox="$1"
enable_bcrypt_BCryptSecretAgreement="$1"
enable_combase_GetRestrictedErrorInfo="$1"
enable_comctl32_Listview_DrawItem="$1"
enable_comctl32_alpha_bitmaps="$1"
@ -403,9 +402,6 @@ patch_enable ()
atl-AtlAxDialogBox)
enable_atl_AtlAxDialogBox="$2"
;;
bcrypt-BCryptSecretAgreement)
enable_bcrypt_BCryptSecretAgreement="$2"
;;
combase-GetRestrictedErrorInfo)
enable_combase_GetRestrictedErrorInfo="$2"
;;
@ -2244,23 +2240,6 @@ if test "$enable_atl_AtlAxDialogBox" -eq 1; then
) >> "$patchlist"
fi
# Patchset bcrypt-BCryptSecretAgreement
# |
# | This patchset fixes the following Wine bugs:
# | * [#46564] Add BCryptDestroySecret/BCryptSecretAgreement stubs.
# |
# | Modified files:
# | * dlls/bcrypt/bcrypt.spec, dlls/bcrypt/bcrypt_main.c, dlls/ncrypt/ncrypt.spec, include/bcrypt.h
# |
if test "$enable_bcrypt_BCryptSecretAgreement" -eq 1; then
patch_apply bcrypt-BCryptSecretAgreement/0001-bcrypt-Add-BCryptDestroySecret-BCryptSecretAgreement.patch
patch_apply bcrypt-BCryptSecretAgreement/0002-bcrypt-Add-BCryptDeriveKey-stub.patch
(
printf '%s\n' '+ { "Alistair Leslie-Hughes", "bcrypt: Add BCryptDestroySecret/BCryptSecretAgreement stubs.", 1 },';
printf '%s\n' '+ { "Alistair Leslie-Hughes", "bcrypt: Add BCryptDeriveKey stub.", 1 },';
) >> "$patchlist"
fi
# Patchset combase-GetRestrictedErrorInfo
# |
# | This patchset fixes the following Wine bugs:
@ -5373,7 +5352,6 @@ if test "$enable_riched20_IText_Interface" -eq 1; then
patch_apply riched20-IText_Interface/0003-riched20-Stub-for-ITextPara-interface-and-implement-.patch
patch_apply riched20-IText_Interface/0004-riched20-Fix-ME_RunOfsFromCharOfs-when-nCharOfs-strl.patch
patch_apply riched20-IText_Interface/0005-riched20-Implement-ITextRange-GetText.patch
patch_apply riched20-IText_Interface/0006-riched20-Implement-ITextRange-SetRange.patch
patch_apply riched20-IText_Interface/0007-riched20-Implement-ITextRange-IsEqual.patch
patch_apply riched20-IText_Interface/0008-riched20-Implement-ITextRange-GetStoryLength.patch
patch_apply riched20-IText_Interface/0009-riched20-Implement-ITextSelection-GetStoryLength.patch
@ -5384,7 +5362,6 @@ if test "$enable_riched20_IText_Interface" -eq 1; then
printf '%s\n' '+ { "Jactry Zeng", "riched20: Stub for ITextPara interface and implement ITextRange::GetPara.", 1 },';
printf '%s\n' '+ { "Jactry Zeng", "riched20: Fix ME_RunOfsFromCharOfs() when nCharOfs > strlen().", 1 },';
printf '%s\n' '+ { "Jactry Zeng", "riched20: Implement ITextRange::GetText.", 1 },';
printf '%s\n' '+ { "Jactry Zeng", "riched20: Implement ITextRange::SetRange.", 1 },';
printf '%s\n' '+ { "Jactry Zeng", "riched20: Implement ITextRange::IsEqual.", 1 },';
printf '%s\n' '+ { "Jactry Zeng", "riched20: Implement ITextRange::GetStoryLength.", 1 },';
printf '%s\n' '+ { "Jactry Zeng", "riched20: Implement ITextSelection::GetStoryLength.", 1 },';

View File

@ -1,4 +1,4 @@
From 25c7cb641ea4e2c051e58190ed6b094ac84861d9 Mon Sep 17 00:00:00 2001
From 31644e8202391d2395abd1b0d11fd42332742aad Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Fri, 13 May 2016 16:05:13 +0800
Subject: [PATCH] riched20/tests: Add a test to see what richedit class
@ -9,10 +9,10 @@ Subject: [PATCH] riched20/tests: Add a test to see what richedit class
1 file changed, 33 insertions(+)
diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c
index 2a6907b..6712ab1 100644
index f6158d9a3d1..28f9849cba0 100644
--- a/dlls/riched20/tests/editor.c
+++ b/dlls/riched20/tests/editor.c
@@ -8889,6 +8889,38 @@ static void test_EM_SELECTIONTYPE(void)
@@ -8957,6 +8957,38 @@ static void test_EM_SELECTIONTYPE(void)
DestroyWindow(hwnd);
}
@ -51,7 +51,7 @@ index 2a6907b..6712ab1 100644
START_TEST( editor )
{
BOOL ret;
@@ -8898,6 +8930,7 @@ START_TEST( editor )
@@ -8966,6 +8998,7 @@ START_TEST( editor )
ok(hmoduleRichEdit != NULL, "error: %d\n", (int) GetLastError());
is_lang_japanese = (PRIMARYLANGID(GetUserDefaultLangID()) == LANG_JAPANESE);
@ -60,5 +60,5 @@ index 2a6907b..6712ab1 100644
test_EM_FINDTEXT(FALSE);
test_EM_FINDTEXT(TRUE);
--
1.9.1
2.20.1

View File

@ -1,17 +1,17 @@
From 3d02c5ffcad36616c63a8814fe98f9b531fce27a Mon Sep 17 00:00:00 2001
From ad837ef7c71cdca27ce947100107bfe5c6982ff7 Mon Sep 17 00:00:00 2001
From: Jactry Zeng <wine@jactry.com>
Date: Fri, 8 Aug 2014 21:32:57 +0800
Subject: riched20: Implement IText{Selection, Range}::Set{Start, End}.
Subject: [PATCH] riched20: Implement IText{Selection, Range}::Set{Start, End}.
---
dlls/riched20/tests/richole.c | 135 ++++++++++++++++++++++++++++++++++++++++++
dlls/riched20/tests/richole.c | 135 ++++++++++++++++++++++++++++++++++
1 file changed, 135 insertions(+)
diff --git a/dlls/riched20/tests/richole.c b/dlls/riched20/tests/richole.c
index 6da3ce3..8047f4b 100644
index 70646202f04..77f93a55c14 100644
--- a/dlls/riched20/tests/richole.c
+++ b/dlls/riched20/tests/richole.c
@@ -3397,6 +3397,137 @@ static void test_Expand(void)
@@ -3808,6 +3808,137 @@ static void test_MoveEnd(void)
ITextRange_Release(range);
}
@ -149,7 +149,7 @@ index 6da3ce3..8047f4b 100644
START_TEST(richole)
{
/* Must explicitly LoadLibrary(). The test has no references to functions in
@@ -3409,12 +3540,16 @@ START_TEST(richole)
@@ -3820,6 +3951,8 @@ START_TEST(richole)
test_GetText();
test_ITextSelection_GetChar();
test_ITextSelection_GetStart_GetEnd();
@ -158,8 +158,9 @@ index 6da3ce3..8047f4b 100644
test_ITextSelection_Collapse();
test_ITextDocument_Range();
test_ITextRange_GetChar();
test_ITextRange_ScrollIntoView();
@@ -3827,6 +3960,8 @@ START_TEST(richole)
test_ITextRange_GetStart_GetEnd();
test_ITextRange_SetRange();
test_ITextRange_GetDuplicate();
+ test_ITextRange_SetStart();
+ test_ITextRange_SetEnd();
@ -167,5 +168,5 @@ index 6da3ce3..8047f4b 100644
test_GetClientSite();
test_IOleWindow_GetWindow();
--
2.7.1
2.20.1

View File

@ -1,137 +0,0 @@
From ac8cabefac07d17d2fdf33b26444b74e5c910abf Mon Sep 17 00:00:00 2001
From: Jactry Zeng <wine@jactry.com>
Date: Wed, 13 Aug 2014 17:17:14 +0800
Subject: riched20: Implement ITextRange::SetRange.
---
dlls/riched20/richole.c | 41 +++++++++++++++++++++++++----------------
dlls/riched20/tests/richole.c | 35 +++++++++++++++++++++++++++++++++++
2 files changed, 60 insertions(+), 16 deletions(-)
diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c
index 76f70a6..71fdf29 100644
--- a/dlls/riched20/richole.c
+++ b/dlls/riched20/richole.c
@@ -2016,6 +2016,23 @@ static HRESULT WINAPI ITextRange_fnSetIndex(ITextRange *me, LONG unit, LONG inde
return E_NOTIMPL;
}
+static void cp2range(ME_TextEditor *editor, LONG *cp1, LONG *cp2)
+{
+ int len = ME_GetTextLength(editor) + 1;
+ *cp1 = max(*cp1, 0);
+ *cp2 = max(*cp2, 0);
+ *cp1 = min(*cp1, len);
+ *cp2 = min(*cp2, len);
+ if (*cp1 > *cp2)
+ {
+ int tmp = *cp1;
+ *cp1 = *cp2;
+ *cp2 = tmp;
+ }
+ if (*cp1 == len)
+ *cp1 = *cp2 = len - 1;
+}
+
static HRESULT WINAPI ITextRange_fnSetRange(ITextRange *me, LONG anchor, LONG active)
{
ITextRangeImpl *This = impl_from_ITextRange(me);
@@ -2025,7 +2042,13 @@ static HRESULT WINAPI ITextRange_fnSetRange(ITextRange *me, LONG anchor, LONG ac
if (!This->child.reole)
return CO_E_RELEASED;
- return E_NOTIMPL;
+ cp2range(This->child.reole->editor, &anchor, &active);
+ if (anchor == This->start && active == This->end)
+ return S_FALSE;
+
+ This->start = anchor;
+ This->end = active;
+ return S_OK;
}
static HRESULT textrange_inrange(LONG start, LONG end, ITextRange *range, LONG *ret)
@@ -4317,26 +4340,12 @@ static HRESULT WINAPI ITextDocument2Old_fnRange(ITextDocument2Old *iface, LONG c
ITextRange **ppRange)
{
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
- const int len = ME_GetTextLength(This->editor) + 1;
TRACE("%p %p %d %d\n", This, ppRange, cp1, cp2);
if (!ppRange)
return E_INVALIDARG;
- cp1 = max(cp1, 0);
- cp2 = max(cp2, 0);
- cp1 = min(cp1, len);
- cp2 = min(cp2, len);
- if (cp1 > cp2)
- {
- LONG tmp;
- tmp = cp1;
- cp1 = cp2;
- cp2 = tmp;
- }
- if (cp1 == len)
- cp1 = cp2 = len - 1;
-
+ cp2range(This->editor, &cp1, &cp2);
return CreateITextRange(This, cp1, cp2, ppRange);
}
diff --git a/dlls/riched20/tests/richole.c b/dlls/riched20/tests/richole.c
index dfc6799..c98b536 100644
--- a/dlls/riched20/tests/richole.c
+++ b/dlls/riched20/tests/richole.c
@@ -4009,6 +4009,40 @@ static void test_ITextRange_GetText(void)
TEST_TXTRGE_GETTEXT(1, 1, NULL)
}
+static void test_ITextRange_SetRange(void)
+{
+ HWND w;
+ IRichEditOle *reOle = NULL;
+ ITextDocument *txtDoc = NULL;
+ ITextRange *txtRge = NULL;
+ HRESULT hres;
+ int start, end;
+ static const CHAR test_text1[] = "TestSomeText";
+
+ create_interfaces(&w, &reOle, &txtDoc, NULL);
+ SendMessageA(w, WM_SETTEXT, 0, (LPARAM)test_text1);
+ ITextDocument_Range(txtDoc, 0, 0, &txtRge);
+
+#define TEST_TXTRGE_SETRANGE(first, lim, expected_start, expected_end, expected_return) \
+ hres = ITextRange_SetRange(txtRge, first, lim); \
+ ok(hres == expected_return, "ITextRange_SetRange\n"); \
+ ITextRange_GetStart(txtRge, &start); \
+ ITextRange_GetEnd(txtRge, &end); \
+ ok(start == expected_start, "got wrong start value: %d\n", start); \
+ ok(end == expected_end, "got wrong end value: %d\n", end);
+
+ TEST_TXTRGE_SETRANGE(2, 4, 2, 4, S_OK)
+ TEST_TXTRGE_SETRANGE(2, 4, 2, 4, S_FALSE)
+ TEST_TXTRGE_SETRANGE(4, 2, 2, 4, S_FALSE)
+ TEST_TXTRGE_SETRANGE(14, 14, 12, 12, S_OK)
+ TEST_TXTRGE_SETRANGE(15, 15, 12, 12, S_FALSE)
+ TEST_TXTRGE_SETRANGE(14, 1, 1, 13, S_OK)
+ TEST_TXTRGE_SETRANGE(-1, 4, 0, 4, S_OK)
+
+ ITextRange_Release(txtRge);
+ release_interfaces(&w, &reOle, &txtDoc, NULL);
+}
+
START_TEST(richole)
{
/* Must explicitly LoadLibrary(). The test has no references to functions in
@@ -4036,6 +4070,7 @@ START_TEST(richole)
test_ITextRange_GetFont();
test_ITextRange_GetPara();
test_ITextRange_GetText();
+ test_ITextRange_SetRange();
test_GetClientSite();
test_IOleWindow_GetWindow();
test_IOleInPlaceSite_GetWindow();
--
2.7.4

View File

@ -1,18 +1,18 @@
From 52cb6b771a61011c39c4c8f402709d8d119d43f5 Mon Sep 17 00:00:00 2001
From 2d05fb15e16385684dfc1e9f1d2c51fa4d5830d9 Mon Sep 17 00:00:00 2001
From: Jactry Zeng <wine@jactry.com>
Date: Fri, 15 Aug 2014 14:27:21 +0800
Subject: riched20: Implement ITextRange::IsEqual.
Subject: [PATCH] riched20: Implement ITextRange::IsEqual.
---
dlls/riched20/tests/richole.c | 47 +++++++++++++++++++++++++++++++++++++++++++
dlls/riched20/tests/richole.c | 47 +++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)
diff --git a/dlls/riched20/tests/richole.c b/dlls/riched20/tests/richole.c
index 6e00b21..ae087b7 100644
index 4512085ea3..b2bb21d69b 100644
--- a/dlls/riched20/tests/richole.c
+++ b/dlls/riched20/tests/richole.c
@@ -3590,6 +3590,52 @@ static void test_ITextRange_SetRange(void)
release_interfaces(&w, &reOle, &txtDoc, NULL);
@@ -4113,6 +4113,52 @@ static void test_ITextRange_GetText(void)
TEST_TXTRGE_GETTEXT(1, 1, NULL)
}
+static void test_ITextRange_IsEqual2(void)
@ -64,14 +64,14 @@ index 6e00b21..ae087b7 100644
START_TEST(richole)
{
/* Must explicitly LoadLibrary(). The test has no references to functions in
@@ -3617,6 +3663,7 @@ START_TEST(richole)
@@ -4141,6 +4187,7 @@ START_TEST(richole)
test_ITextRange_GetFont();
test_ITextRange_GetPara();
test_ITextRange_GetText();
test_ITextRange_SetRange();
+ test_ITextRange_IsEqual2();
test_GetClientSite();
test_IOleWindow_GetWindow();
test_IOleInPlaceSite_GetWindow();
--
2.4.2
2.20.1

View File

@ -1,17 +1,17 @@
From e53964c35b8005bf77f9088276604e7b47fdf475 Mon Sep 17 00:00:00 2001
From a3c18216d981f2f46f3a2572d5ba17f278c259c2 Mon Sep 17 00:00:00 2001
From: Jactry Zeng <wine@jactry.com>
Date: Mon, 18 Aug 2014 14:38:50 +0800
Subject: riched20: Implement ITextRange::GetStoryLength.
Subject: [PATCH] riched20: Implement ITextRange::GetStoryLength.
---
dlls/riched20/tests/richole.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/dlls/riched20/tests/richole.c b/dlls/riched20/tests/richole.c
index ae087b7..55d27d4 100644
index b2bb21d69bc..5e105b3444a 100644
--- a/dlls/riched20/tests/richole.c
+++ b/dlls/riched20/tests/richole.c
@@ -3636,6 +3636,37 @@ static void test_ITextRange_IsEqual2(void)
@@ -4159,6 +4159,37 @@ static void test_ITextRange_IsEqual2(void)
release_interfaces(&w, &reOle, &txtDoc, NULL);
}
@ -49,14 +49,14 @@ index ae087b7..55d27d4 100644
START_TEST(richole)
{
/* Must explicitly LoadLibrary(). The test has no references to functions in
@@ -3664,6 +3695,7 @@ START_TEST(richole)
@@ -4188,6 +4219,7 @@ START_TEST(richole)
test_ITextRange_GetPara();
test_ITextRange_GetText();
test_ITextRange_SetRange();
test_ITextRange_IsEqual2();
+ test_ITextRange_GetStoryLength();
test_GetClientSite();
test_IOleWindow_GetWindow();
test_IOleInPlaceSite_GetWindow();
--
2.4.2
2.20.1

View File

@ -1,17 +1,17 @@
From 4611d3dd983d7707d845508ddde2d49e9daafec5 Mon Sep 17 00:00:00 2001
From 019c6b0afd77f665c8a79a85f0154bb5342d2a43 Mon Sep 17 00:00:00 2001
From: Andrew Eikum <aeikum@codeweavers.com>
Date: Fri, 1 Jun 2018 14:43:01 -0500
Subject: [PATCH 2/7] winepulse: Don't rely on pulseaudio callbacks for timing
Subject: [PATCH] winepulse: Don't rely on pulseaudio callbacks for timing
---
dlls/winepulse.drv/mmdevdrv.c | 505 +++++++++++++++++++-----------------------
1 file changed, 231 insertions(+), 274 deletions(-)
dlls/winepulse.drv/mmdevdrv.c | 500 ++++++++++++++++------------------
1 file changed, 232 insertions(+), 268 deletions(-)
diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c
index f192b1d..b750986 100644
index 64b65182d83..43cdcdbae4c 100644
--- a/dlls/winepulse.drv/mmdevdrv.c
+++ b/dlls/winepulse.drv/mmdevdrv.c
@@ -169,13 +169,16 @@ struct ACImpl {
@@ -172,13 +172,16 @@ struct ACImpl {
EDataFlow dataflow;
DWORD flags;
AUDCLNT_SHAREMODE share;
@ -31,7 +31,7 @@ index f192b1d..b750986 100644
pa_stream *stream;
pa_sample_spec ss;
@@ -636,107 +639,69 @@ static void pulse_attr_update(pa_stream *s, void *user) {
@@ -790,107 +793,69 @@ static void pulse_attr_update(pa_stream *s, void *user) {
dump_attr(attr);
}
@ -87,7 +87,7 @@ index f192b1d..b750986 100644
+ TRACE("prebuffering %u frames of silence\n",
+ (int)(to_write / pa_frame_size(&This->ss)));
+ buf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, to_write);
pa_stream_write(This->stream, buf, to_write, NULL, 0, PA_SEEK_RELATIVE);
write_buffer(This, buf, to_write, 0);
- This->held_bytes -= to_write;
- to_write = bytes - to_write;
- This->lcl_offs_bytes = 0;
@ -96,7 +96,7 @@ index f192b1d..b750986 100644
- to_write = bytes;
-
- TRACE("writing main chunk of %u bytes\n", to_write);
- pa_stream_write(This->stream, buf, to_write, NULL, 0, PA_SEEK_RELATIVE);
- write_buffer(This, buf, to_write, 0);
- This->lcl_offs_bytes += to_write;
- This->lcl_offs_bytes %= This->bufsize_bytes;
- This->held_bytes -= to_write;
@ -105,23 +105,27 @@ index f192b1d..b750986 100644
- This->pad = This->bufsize_bytes - bytes;
- else
- This->pad = 0;
-
- if (oldpad == This->pad)
- return;
-
- assert(oldpad > This->pad);
+ HeapFree(GetProcessHeap(), 0, buf);
+ }
- if (oldpad == This->pad)
- return;
- This->clock_written += oldpad - This->pad;
- TRACE("New pad: %zu (-%zu)\n", This->pad / pa_frame_size(&This->ss), (oldpad - This->pad) / pa_frame_size(&This->ss));
+ This->just_underran = FALSE;
+ }
}
- assert(oldpad > This->pad);
- if (This->event)
- SetEvent(This->event);
-}
+ buf = This->local_buffer + This->pa_offs_bytes;
+ TRACE("held: %u, avail: %u\n",
+ This->pa_held_bytes, bytes);
+ bytes = min(This->pa_held_bytes, bytes);
- This->clock_written += oldpad - This->pad;
- TRACE("New pad: %zu (-%zu)\n", This->pad / pa_frame_size(&This->ss), (oldpad - This->pad) / pa_frame_size(&This->ss));
- }
+
+ if(This->pa_offs_bytes + bytes > This->real_bufsize_bytes){
+ to_write = This->real_bufsize_bytes - This->pa_offs_bytes;
+ TRACE("writing small chunk of %u bytes\n", to_write);
@ -133,8 +137,9 @@ index f192b1d..b750986 100644
+ }else
+ to_write = bytes;
- if (This->event)
- SetEvent(This->event);
-static void pulse_underflow_callback(pa_stream *s, void *userdata)
-{
- WARN("Underflow\n");
+ TRACE("writing main chunk of %u bytes\n", to_write);
+ pa_stream_write(This->stream, buf, to_write, NULL, 0, PA_SEEK_RELATIVE);
+ This->pa_offs_bytes += to_write;
@ -142,18 +147,14 @@ index f192b1d..b750986 100644
+ This->pa_held_bytes -= to_write;
}
static void pulse_underflow_callback(pa_stream *s, void *userdata)
{
- WARN("Underflow\n");
-}
-
-/* Latency is periodically updated even when nothing is played,
- * because of PA_STREAM_AUTO_TIMING_UPDATE so use it as timer
- *
- * Perfect for passing all tests :)
- */
-static void pulse_latency_callback(pa_stream *s, void *userdata)
-{
+static void pulse_underflow_callback(pa_stream *s, void *userdata)
{
ACImpl *This = userdata;
- if (!This->pad && This->event)
- SetEvent(This->event);
@ -179,7 +180,7 @@ index f192b1d..b750986 100644
if (!(p = (ACPacket*)list_head(&This->packet_free_head))) {
p = (ACPacket*)list_head(&This->packet_filled_head);
if (!p->discont) {
@@ -744,11 +709,8 @@ static void pulse_rd_loop(ACImpl *This, size_t bytes)
@@ -898,11 +863,8 @@ static void pulse_rd_loop(ACImpl *This, size_t bytes)
next->discont = 1;
} else
p = (ACPacket*)list_tail(&This->packet_filled_head);
@ -192,7 +193,7 @@ index f192b1d..b750986 100644
}
QueryPerformanceCounter(&stamp);
QueryPerformanceFrequency(&freq);
@@ -769,12 +731,14 @@ static void pulse_rd_loop(ACImpl *This, size_t bytes)
@@ -923,12 +885,14 @@ static void pulse_rd_loop(ACImpl *This, size_t bytes)
This->peek_ofs += copy;
if(This->peek_len == This->peek_ofs)
This->peek_len = 0;
@ -210,7 +211,7 @@ index f192b1d..b750986 100644
dst += copy;
rem -= copy;
@@ -786,7 +750,11 @@ static void pulse_rd_loop(ACImpl *This, size_t bytes)
@@ -940,7 +904,11 @@ static void pulse_rd_loop(ACImpl *This, size_t bytes)
This->peek_buffer_len = src_len;
}
@ -223,7 +224,7 @@ index f192b1d..b750986 100644
This->peek_len = src_len - copy;
This->peek_ofs = 0;
}
@@ -795,21 +763,18 @@ static void pulse_rd_loop(ACImpl *This, size_t bytes)
@@ -949,21 +917,18 @@ static void pulse_rd_loop(ACImpl *This, size_t bytes)
}
}
@ -248,7 +249,7 @@ index f192b1d..b750986 100644
copy = rem;
if (copy > src_len)
@@ -828,23 +793,95 @@ static void pulse_rd_drop(ACImpl *This, size_t bytes)
@@ -982,23 +947,95 @@ static void pulse_rd_drop(ACImpl *This, size_t bytes)
}
}
@ -307,9 +308,7 @@ index f192b1d..b750986 100644
+ }
+ }else{
+ INT32 adjust = This->last_time + This->mmdev_period_usec - now;
- if (This->event)
- SetEvent(This->event);
+
+ adv_usec = now - This->last_time;
+
+ if(adjust > ((INT32)(This->mmdev_period_usec / 2)))
@ -344,7 +343,9 @@ index f192b1d..b750986 100644
+ TRACE("%p after update, adv usec: %d, held: %u, delay: %u\n",
+ This, (int)adv_usec,
+ (int)(This->held_bytes/ pa_frame_size(&This->ss)), delay);
+
- if (This->event)
- SetEvent(This->event);
+ pthread_mutex_unlock(&pulse_lock);
+ }
+
@ -352,7 +353,7 @@ index f192b1d..b750986 100644
}
static HRESULT pulse_stream_connect(ACImpl *This, UINT32 period_bytes) {
@@ -873,15 +910,16 @@ static HRESULT pulse_stream_connect(ACImpl *This, UINT32 period_bytes) {
@@ -1027,15 +1064,16 @@ static HRESULT pulse_stream_connect(ACImpl *This, UINT32 period_bytes) {
/* PulseAudio will fill in correct values */
attr.minreq = attr.fragsize = period_bytes;
@ -372,7 +373,7 @@ index f192b1d..b750986 100644
if (ret < 0) {
WARN("Returns %i\n", ret);
return AUDCLNT_E_ENDPOINT_CREATE_FAILED;
@@ -892,11 +930,9 @@ static HRESULT pulse_stream_connect(ACImpl *This, UINT32 period_bytes) {
@@ -1046,11 +1084,9 @@ static HRESULT pulse_stream_connect(ACImpl *This, UINT32 period_bytes) {
return AUDCLNT_E_ENDPOINT_CREATE_FAILED;
if (This->dataflow == eRender) {
@ -385,7 +386,7 @@ index f192b1d..b750986 100644
return S_OK;
}
@@ -1031,6 +1067,11 @@ static ULONG WINAPI AudioClient_Release(IAudioClient *iface)
@@ -1185,6 +1221,11 @@ static ULONG WINAPI AudioClient_Release(IAudioClient *iface)
TRACE("(%p) Refcount now %u\n", This, ref);
if (!ref) {
if (This->stream) {
@ -397,7 +398,7 @@ index f192b1d..b750986 100644
pthread_mutex_lock(&pulse_lock);
if (PA_STREAM_IS_GOOD(pa_stream_get_state(This->stream))) {
pa_stream_disconnect(This->stream);
@@ -1326,7 +1367,7 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient *iface,
@@ -1480,7 +1521,7 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient *iface,
{
ACImpl *This = impl_from_IAudioClient(iface);
HRESULT hr = S_OK;
@ -406,7 +407,7 @@ index f192b1d..b750986 100644
TRACE("(%p)->(%x, %x, %s, %s, %p, %s)\n", This, mode, flags,
wine_dbgstr_longlong(duration), wine_dbgstr_longlong(period), fmt, debugstr_guid(sessionguid));
@@ -1371,38 +1412,19 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient *iface,
@@ -1525,38 +1566,19 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient *iface,
if (FAILED(hr))
goto exit;
@ -453,7 +454,7 @@ index f192b1d..b750986 100644
if (SUCCEEDED(hr)) {
UINT32 unalign;
const pa_buffer_attr *attr = pa_stream_get_buffer_attr(This->stream);
@@ -1410,39 +1432,34 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient *iface,
@@ -1564,39 +1586,34 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient *iface,
/* Update frames according to new size */
dump_attr(attr);
if (This->dataflow == eRender) {
@ -506,7 +507,7 @@ index f192b1d..b750986 100644
}
}
}
@@ -1507,12 +1524,12 @@ static HRESULT WINAPI AudioClient_GetStreamLatency(IAudioClient *iface,
@@ -1661,12 +1678,12 @@ static HRESULT WINAPI AudioClient_GetStreamLatency(IAudioClient *iface,
attr = pa_stream_get_buffer_attr(This->stream);
if (This->dataflow == eRender){
lat = attr->minreq / pa_frame_size(&This->ss);
@ -520,7 +521,7 @@ index f192b1d..b750986 100644
pthread_mutex_unlock(&pulse_lock);
TRACE("Latency: %u ms\n", (DWORD)(*latency / 10000));
return S_OK;
@@ -1520,7 +1537,7 @@ static HRESULT WINAPI AudioClient_GetStreamLatency(IAudioClient *iface,
@@ -1674,7 +1691,7 @@ static HRESULT WINAPI AudioClient_GetStreamLatency(IAudioClient *iface,
static void ACImpl_GetRenderPad(ACImpl *This, UINT32 *out)
{
@ -529,7 +530,7 @@ index f192b1d..b750986 100644
}
static void ACImpl_GetCapturePad(ACImpl *This, UINT32 *out)
@@ -1532,7 +1549,7 @@ static void ACImpl_GetCapturePad(ACImpl *This, UINT32 *out)
@@ -1686,7 +1703,7 @@ static void ACImpl_GetCapturePad(ACImpl *This, UINT32 *out)
list_remove(&packet->entry);
}
if (out)
@ -538,7 +539,7 @@ index f192b1d..b750986 100644
}
static HRESULT WINAPI AudioClient_GetCurrentPadding(IAudioClient *iface,
@@ -1778,6 +1795,8 @@ static HRESULT WINAPI AudioClient_Start(IAudioClient *iface)
@@ -1932,6 +1949,8 @@ static HRESULT WINAPI AudioClient_Start(IAudioClient *iface)
return AUDCLNT_E_NOT_STOPPED;
}
@ -547,7 +548,7 @@ index f192b1d..b750986 100644
if (pa_stream_is_corked(This->stream)) {
o = pa_stream_cork(This->stream, 0, pulse_op_cb, &success);
if (o) {
@@ -1792,8 +1811,10 @@ static HRESULT WINAPI AudioClient_Start(IAudioClient *iface)
@@ -1946,8 +1965,10 @@ static HRESULT WINAPI AudioClient_Start(IAudioClient *iface)
if (SUCCEEDED(hr)) {
This->started = TRUE;
@ -560,7 +561,7 @@ index f192b1d..b750986 100644
}
pthread_mutex_unlock(&pulse_lock);
return hr;
@@ -1865,7 +1886,7 @@ static HRESULT WINAPI AudioClient_Reset(IAudioClient *iface)
@@ -2019,7 +2040,7 @@ static HRESULT WINAPI AudioClient_Reset(IAudioClient *iface)
if (This->dataflow == eRender) {
/* If there is still data in the render buffer it needs to be removed from the server */
int success = 0;
@ -569,7 +570,7 @@ index f192b1d..b750986 100644
pa_operation *o = pa_stream_flush(This->stream, pulse_op_cb, &success);
if (o) {
while(pa_operation_get_state(o) == PA_OPERATION_RUNNING)
@@ -1873,14 +1894,14 @@ static HRESULT WINAPI AudioClient_Reset(IAudioClient *iface)
@@ -2027,14 +2048,14 @@ static HRESULT WINAPI AudioClient_Reset(IAudioClient *iface)
pa_operation_unref(o);
}
}
@ -589,7 +590,7 @@ index f192b1d..b750986 100644
if ((p = This->locked_ptr)) {
This->locked_ptr = NULL;
@@ -2046,10 +2067,9 @@ static HRESULT WINAPI AudioRenderClient_GetBuffer(IAudioRenderClient *iface,
@@ -2200,10 +2221,9 @@ static HRESULT WINAPI AudioRenderClient_GetBuffer(IAudioRenderClient *iface,
UINT32 frames, BYTE **data)
{
ACImpl *This = impl_from_IAudioRenderClient(iface);
@ -602,7 +603,7 @@ index f192b1d..b750986 100644
TRACE("(%p)->(%u, %p)\n", This, frames, data);
@@ -2068,37 +2088,19 @@ static HRESULT WINAPI AudioRenderClient_GetBuffer(IAudioRenderClient *iface,
@@ -2222,37 +2242,19 @@ static HRESULT WINAPI AudioRenderClient_GetBuffer(IAudioRenderClient *iface,
return S_OK;
}
@ -648,7 +649,7 @@ index f192b1d..b750986 100644
}
silence_buffer(This->ss.format, *data, bytes);
@@ -2110,111 +2112,59 @@ static HRESULT WINAPI AudioRenderClient_GetBuffer(IAudioRenderClient *iface,
@@ -2264,12 +2266,13 @@ static HRESULT WINAPI AudioRenderClient_GetBuffer(IAudioRenderClient *iface,
static void pulse_wrap_buffer(ACImpl *This, BYTE *buffer, UINT32 written_bytes)
{
@ -665,14 +666,7 @@ index f192b1d..b750986 100644
memcpy(This->local_buffer, buffer + chunk_bytes,
written_bytes - chunk_bytes);
}
}
-static void pulse_free_noop(void *buf)
-{
-}
-
static HRESULT WINAPI AudioRenderClient_ReleaseBuffer(
IAudioRenderClient *iface, UINT32 written_frames, DWORD flags)
@@ -2280,88 +2283,42 @@ static HRESULT WINAPI AudioRenderClient_ReleaseBuffer(
{
ACImpl *This = impl_from_IAudioRenderClient(iface);
UINT32 written_bytes = written_frames * pa_frame_size(&This->ss);
@ -723,35 +717,32 @@ index f192b1d..b750986 100644
- /* nothing in PA, so send data immediately */
-
- TRACE("pre-writing %u bytes\n", to_write);
+ if(This->locked >= 0)
+ buffer = This->local_buffer + (This->lcl_offs_bytes + This->held_bytes) % This->real_bufsize_bytes;
+ else
+ buffer = This->tmp_buffer;
- e = pa_stream_write(This->stream, buffer, to_write, NULL, 0, PA_SEEK_RELATIVE);
-
- e = write_buffer(This, buffer, to_write, 0);
- if(e)
- ERR("pa_stream_write failed: 0x%x\n", e);
+ if(flags & AUDCLNT_BUFFERFLAGS_SILENT)
+ silence_buffer(This->ss.format, buffer, written_bytes);
-
- This->lcl_offs_bytes += to_write;
- This->lcl_offs_bytes %= This->bufsize_bytes;
- This->held_bytes -= to_write;
- }
-
- }else{
- if (This->locked_ptr) {
- if (flags & AUDCLNT_BUFFERFLAGS_SILENT)
- silence_buffer(This->ss.format, This->locked_ptr, written_bytes);
- pa_stream_write(This->stream, This->locked_ptr, written_bytes, NULL, 0, PA_SEEK_RELATIVE);
- } else {
- if (flags & AUDCLNT_BUFFERFLAGS_SILENT)
- silence_buffer(This->ss.format, This->tmp_buffer, written_bytes);
- pa_stream_write(This->stream, This->tmp_buffer, written_bytes, pulse_free_noop, 0, PA_SEEK_RELATIVE);
- }
- enum write_buffer_flags wr_flags = 0;
-
- if (flags & AUDCLNT_BUFFERFLAGS_SILENT) wr_flags |= WINEPULSE_WRITE_SILENT;
- if (!This->locked_ptr) wr_flags |= WINEPULSE_WRITE_NOFREE;
+ if(This->locked >= 0)
+ buffer = This->local_buffer + (This->lcl_offs_bytes + This->held_bytes) % This->real_bufsize_bytes;
+ else
+ buffer = This->tmp_buffer;
- write_buffer(This, This->locked_ptr ? This->locked_ptr : This->tmp_buffer, written_bytes, wr_flags);
- This->pad += written_bytes;
- }
-
+ if(flags & AUDCLNT_BUFFERFLAGS_SILENT)
+ silence_buffer(This->ss.format, buffer, written_bytes);
- if (!pa_stream_is_corked(This->stream)) {
- int success;
- pa_operation *o;
@ -780,7 +771,7 @@ index f192b1d..b750986 100644
return S_OK;
}
@@ -2286,13 +2236,13 @@ static HRESULT WINAPI AudioCaptureClient_GetBuffer(IAudioCaptureClient *iface,
@@ -2433,13 +2390,13 @@ static HRESULT WINAPI AudioCaptureClient_GetBuffer(IAudioCaptureClient *iface,
ACImpl_GetCapturePad(This, NULL);
if ((packet = This->locked_ptr)) {
@ -796,7 +787,7 @@ index f192b1d..b750986 100644
else
*devpos = This->clock_written / pa_frame_size(&This->ss);
}
@@ -2326,11 +2276,11 @@ static HRESULT WINAPI AudioCaptureClient_ReleaseBuffer(
@@ -2473,11 +2430,11 @@ static HRESULT WINAPI AudioCaptureClient_ReleaseBuffer(
if (done) {
ACPacket *packet = This->locked_ptr;
This->locked_ptr = NULL;
@ -811,7 +802,7 @@ index f192b1d..b750986 100644
list_add_tail(&This->packet_free_head, &packet->entry);
}
This->locked = 0;
@@ -2350,7 +2300,7 @@ static HRESULT WINAPI AudioCaptureClient_GetNextPacketSize(
@@ -2497,7 +2454,7 @@ static HRESULT WINAPI AudioCaptureClient_GetNextPacketSize(
pthread_mutex_lock(&pulse_lock);
ACImpl_GetCapturePad(This, NULL);
if (This->locked_ptr)
@ -820,7 +811,7 @@ index f192b1d..b750986 100644
else
*frames = 0;
pthread_mutex_unlock(&pulse_lock);
@@ -2442,7 +2392,14 @@ static HRESULT WINAPI AudioClock_GetPosition(IAudioClock *iface, UINT64 *pos,
@@ -2589,7 +2546,14 @@ static HRESULT WINAPI AudioClock_GetPosition(IAudioClock *iface, UINT64 *pos,
return hr;
}
@ -837,5 +828,5 @@ index f192b1d..b750986 100644
if (This->share == AUDCLNT_SHAREMODE_EXCLUSIVE)
*pos /= pa_frame_size(&This->ss);
--
1.9.1
2.20.1