This basic implementation is sufficient to fix .NET applications that use System.Security.Principal.WindowsIdentity.AuthenticationType.
--
v2: secur32: Implement basic functionality for LsaGetLogonSessionData.
https://gitlab.winehq.org/wine/wine/-/merge_requests/907
VariantCopyInd allows pvargDest == pvargSrc in order to dereference in place
To avoid confusing the source values and a partially-written destination,
wine's implementation makes a shallow copy and uses that as pSrc.
However, the call to VARIANT_CopyIRecordInfo did not use this,
leading to it copying from the zeroed-out memory it just allocated.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/897
Apex Legends game periodically (every 30 seconds) calls this function
with up to 22k virtual addresses. All but 1 of them is valid. Due to
amount of queries addresses, and cost of seek+read, this causes this
function to take up to about 50ms. So framerate drops from ~150 FPS to
20FPS for about a second.
As far as I can see, returning 0 entries from this function, still makes
Apex Legend work.
But keep code correct, and optimise it by:
1. Opening pagemap file once, and never closing it. This eliminates
repeated fopen/fseek/fread/fclose sequences, which helps even in queries
with small amount of virtual addresses.
2. Using pread, instead of seek+read.
3. Only performing pagemap read when the address is valid.
Future work might recognize continues pages in the query, and perform a
batch read of multiple pagemap entries, instead one page at a time, but
for now it is not necassary.
This change get_working_set_ex peek wall clock runtime from 57ms to
0.29ms.
Tested on Linux, but similar change done for the BSD part.
`Signed-off-by: Witold Baryluk <witold.baryluk(a)gmail.com>`
--
v17: ntdll: Keep pagemap file open after first use of NtQueryVirtualMemory(MemoryWorkingSetExInformation)
https://gitlab.winehq.org/wine/wine/-/merge_requests/852
Apex Legends game periodically (every 30 seconds) calls this function
with up to 22k virtual addresses. All but 1 of them is valid. Due to
amount of queries addresses, and cost of seek+read, this causes this
function to take up to about 50ms. So framerate drops from ~150 FPS to
20FPS for about a second.
As far as I can see, returning 0 entries from this function, still makes
Apex Legend work.
But keep code correct, and optimise it by:
1. Opening pagemap file once, and never closing it. This eliminates
repeated fopen/fseek/fread/fclose sequences, which helps even in queries
with small amount of virtual addresses.
2. Using pread, instead of seek+read.
3. Only performing pagemap read when the address is valid.
Future work might recognize continues pages in the query, and perform a
batch read of multiple pagemap entries, instead one page at a time, but
for now it is not necassary.
This change get_working_set_ex peek wall clock runtime from 57ms to
0.29ms.
Tested on Linux, but similar change done for the BSD part.
`Signed-off-by: Witold Baryluk <witold.baryluk(a)gmail.com>`
--
v16: ntdll: Keep pagemap file open after first use of NtQueryVirtualMemory(MemoryWorkingSetExInformation)
https://gitlab.winehq.org/wine/wine/-/merge_requests/852
On Wed Sep 21 21:29:50 2022 +0000, Alexandre Julliard wrote:
> > Code should be obvious, but question for the last commit: should I
> open with `O_CLOEXEC` ?
> Yes, you should. grep for O_CLOEXEC to see how this is handled in other
> places when not supported.
Makes sense. Done.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/852#note_9007
This implements the _RunAndWait member function and the constructor of the _StructuredTaskCollection, which enables the tests for that class to run.
Also adds a throw of a missing_wait exception to the destructor when chores are scheduled and _RunAndWait was not called.
Remaining stuff after this:
- Task collection cancelling + IsCancelling function (next MR)
- Cancellation token support (requires RE'ing the _CancellationTokenState class, currently in progress)
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/906
--
v4: mf/tests: Dump image samples with a BMP header and RGB data.
mf/tests: Rename transform frame dumps to BMP.
mf/tests: Check all produced output IMFSample at the same time.
mf/tests: Factor IMFSample attributes checks in check_mf_sample.
mf/tests: Factor IMFSample checks in a check_mf_sample helper.
mf/tests: Introduce a new dump_mf_sample helper.
mf/tests: Introduce a new load_resource helper.
mf/tests: Factor IMFTransform_ProcessOutput checks together.
mf/tests: Use separate variables for input / output samples.
mf: Validate sample copier ProcessOutput count parameter.
winegstreamer: Avoid accessing NULL pointer if transform didn't provide a sample.
https://gitlab.winehq.org/wine/wine/-/merge_requests/887
--
v3: mf/tests: Dump image samples with a BMP header and RGB data.
mf/tests: Rename transform frame dumps to BMP.
mf/tests: Check all produced output IMFSample at the same time.
mf/tests: Factor IMFSample attributes checks in check_mf_sample.
mf/tests: Factor IMFSample checks in a check_mf_sample helper.
mf/tests: Introduce a new dump_mf_sample helper.
mf/tests: Introduce a new load_resource helper.
mf/tests: Factor IMFTransform_ProcessOutput checks together.
mf/tests: Use separate variables for input / output samples.
mf: Validate sample copier ProcessOutput count parameter.
https://gitlab.winehq.org/wine/wine/-/merge_requests/887
Since struct _IAVIStreamImpl has a pointer to a WAVEFORMATEX,
GCC 12.2 emits warning when dereferencing that pointer when
the block has been allocated with sizeof(PCMWAVEFORMAT).
The warning is fixed by always allocating with sizeof(WAVEFORMATEX).
This will overallocate in case of a PCM stream.
The alternative would have been to store in struct _IAVIStreamImpl
a pointer to PCMWAVEFORMAT instead, and add the casting to a
WAVEFORMATEX when needed. That would clutter the code IMO since most
of the ACM APIs expect a LPWAVEFORMATEX.
/home/eric/work/wine/dlls/avifil32/acmstream.c: In function 'AVIFILE_OpenCompressor':
/home/eric/work/wine/dlls/avifil32/acmstream.c:105:24: warning: array subscript 'struct tWAVEFORMATEX[0]' is partly outside array bounds of 'unsigned char[16]' [-Warray-bounds]
105 | This->lpOutFormat->wFormatTag = WAVE_FORMAT_PCM;
| ^~
/home/eric/work/wine/dlls/avifil32/acmstream.c:101:27: note: object of size 16 allocated by 'HeapAlloc'
101 | This->lpOutFormat = HeapAlloc(GetProcessHeap(), 0, This->cbOutFormat);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com>
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/904
On Mon Sep 19 20:51:28 2022 +0000, Alexandre Julliard wrote:
> This should be handled already by LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR. If
> that doesn't work in your case you'll need to investigate why, but we
> can't change the global search path for this.
as far as I can tell LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR is for LoadLibrary not the private search_dll_file function in loader.c (which is where the problem originates from)
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/842#note_8876
Map known HRESULT values into their FACILITY_VBS counterparts
Unless the callee provided its own Description (e.g. via SetErrorInfo)
VBscript maps certain well-known HRESULT values into its own error facility
and messages, changing Err.Number and also setting Err.Source to itself
(unless already provided, in which case it is left alone)
e.g. if the invoked method returns E_NOINTERFACE,
The VBScript Err object should show
Err.Number: 0x1AE
Err.Source: Microsoft VBScript runtime error
Err.Description: Class doesn't support Automation
Rather than the original HRESULT
Err.Number: 0x80004002
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/899
Fix bugs in FileSystemObject text-file handling
OpenTextFile(...,ForWriting,True) should either create a new file,
or open and truncate an existing one
OpenTextFile(...,ForAppending,?,True) should write a BOM
if appending to an existing-but-empty file
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/898
DC attributes are not deallocated when free_dc_attr is called on them but are instead queued for reassignment. If we don't make use of the designated allocator to allocate DC attributes, we essentially keep adding memory to the queue indefinitely and, at the same time, not allowing room for reassignment.
The above essentially leads to a leak which is quite noticeable in applications making use heavy use of gdiplus.
https://bugs.winehq.org/show_bug.cgi?id=53645
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/885
Changes since prior MR:
- Check if HWND is valid after sending `WM_GETOBJECT` and getting a 0 return value.
- Block on thread calling `UiaNodeFromHandle()` rather than the marshaling thread.
- Squash `IWineUiaNode::get_prop_val` commit into commit where it is actually used.
--
v3: uiautomationcore: Add tests for UiaNodeFromHandle.
uiautomationcore: Create UI Automation client thread.
https://gitlab.winehq.org/wine/wine/-/merge_requests/846
This fixes data race in ARM/ARM64 platforms, and prevents potential
memory access reordering by the compiler.
--
v2: msvcp90: Use atomic write for releasing threadsafe_queue spin lock.
https://gitlab.winehq.org/wine/wine/-/merge_requests/882
--
v2: mf/tests: Dump image samples with a BMP header and RGB data.
mf/tests: Rename transform frame dumps to BMP.
mf/tests: Check all produced output IMFSample at the same time.
mf/tests: Factor IMFSample attributes checks in check_mf_sample.
mf/tests: Factor IMFSample checks in a check_mf_sample helper.
mf/tests: Introduce a new dump_mf_sample helper.
mf/tests: Introduce a new load_resource helper.
mf/tests: Factor IMFTransform_ProcessOutput checks together.
mf/tests: Use separate variables for input / output samples.
mf: Validate sample copier ProcessOutput count parameter.
https://gitlab.winehq.org/wine/wine/-/merge_requests/887
--
v2: mshtml: Silence a FIXME when parameter is missing.
mshtml: Create non-gecko events properly from type string.
mshtml: Implement url prop for StorageEvent.
include/mshtml: Move some forward interface declarations to match Windows SDK.
mshtml: Override document.URL's name when adding it from the mshtml typelib.
https://gitlab.winehq.org/wine/wine/-/merge_requests/856
> You should only call `NtGetCurrentProcessorNumber()` once. Otherwise, the processor number can change if the thread is preempted and then re-scheduled to another processor. This leads to inconsistent values between the return value and the `process_number->Number` output.
It's not that `KeGetCurrentProcessorNumberEx()` will be highly useful, since the driver can't block scheduling by raising IRQL to DISPATCH_LEVEL. Still, it's better to at least return consistent values even if they are stale.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/824#note_8782
Jinoh Kang (@iamahuman) commented about dlls/ntoskrnl.exe/ntoskrnl.c:
>
> +/***********************************************************************
> + * KeGetCurrentProcessorNumberEx (NTOSKRNL.EXE.@)
> + */
> +ULONG WINAPI KeGetCurrentProcessorNumberEx(PPROCESSOR_NUMBER process_number)
> +{
> + FIXME("%p semi-stub\n", process_number);
> +
> + if (process_number)
> + {
> + process_number->Group = 0;
> + process_number->Reserved = 0;
> + process_number->Number = NtGetCurrentProcessorNumber();
> + }
> +
> + return NtGetCurrentProcessorNumber();
You should only call `NtGetCurrentProcessorNumber()` once. Otherwise, the processor number can change if the thread is preempted and then re-scheduled to another processor. This leads to inconsistent values between the return value and the `process_number->Number` output.
In general, you should treat `NtGetCurrentProcessorNumber()` as being volatile.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/824#note_8781
Enforce proper atomic update so that other threads do not read stale
data from IO_STATUS_BLOCK.
Signed-off-by: Jinoh Kang <jinoh.kang.kr(a)gmail.com>
--
v5: ntdll: Fix reading stale Information from IOSB.
https://gitlab.winehq.org/wine/wine/-/merge_requests/155
Enforce proper atomic update so that other threads do not read stale
data from IO_STATUS_BLOCK.
Signed-off-by: Jinoh Kang <jinoh.kang.kr(a)gmail.com>
--
v4: ntdll: Fix reading stale Information from IOSB.
https://gitlab.winehq.org/wine/wine/-/merge_requests/155
When initializing a jsstr_inline_t with a len < 3, the size passed
for the allocation is smaller then the size of the structure
(as the later is rounded up to the alignment = 4 bytes).
GCC 12.2 complains about this when dereferencing the pointer to
the structure as the size passed for allocation is smaller than the
size of the structure.
The warning is fixed by using flexible array member in
jsstr_inline_t. Given the rounding behavior in memory allocation, this
should not change the size of allocated blocks.
Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com>
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/876
Apex Legends game periodically (every 30 seconds) calls this function
with up to 22k virtual addresses. All but 1 of them is valid. Due to
amount of queries addresses, and cost of seek+read, this causes this
function to take up to about 50ms. So framerate drops from ~150 FPS to
20FPS for about a second.
As far as I can see, returning 0 entries from this function, still makes
Apex Legend work.
But keep code correct, and optimise it by:
1. Opening pagemap file once, and never closing it. This eliminates
repeated fopen/fseek/fread/fclose sequences, which helps even in queries
with small amount of virtual addresses.
2. Using pread, instead of seek+read.
3. Only performing pagemap read when the address is valid.
Future work might recognize continues pages in the query, and perform a
batch read of multiple pagemap entries, instead one page at a time, but
for now it is not necassary.
This change get_working_set_ex peek wall clock runtime from 57ms to
0.29ms.
Tested on Linux, but similar change done for the BSD part.
`Signed-off-by: Witold Baryluk <witold.baryluk(a)gmail.com>`
--
v12: ntdll: Keep pagemap file open after first use of NtQueryVirtualMemory(MemoryWorkingSetExInformation)
https://gitlab.winehq.org/wine/wine/-/merge_requests/852
Apex Legends game periodically (every 30 seconds) calls this function
with up to 22k virtual addresses. All but 1 of them is valid. Due to
amount of queries addresses, and cost of seek+read, this causes this
function to take up to about 50ms. So framerate drops from ~150 FPS to
20FPS for about a second.
As far as I can see, returning 0 entries from this function, still makes
Apex Legend work.
But keep code correct, and optimise it by:
1. Opening pagemap file once, and never closing it. This eliminates
repeated fopen/fseek/fread/fclose sequences, which helps even in queries
with small amount of virtual addresses.
2. Using pread, instead of seek+read.
3. Only performing pagemap read when the address is valid.
Future work might recognize continues pages in the query, and perform a
batch read of multiple pagemap entries, instead one page at a time, but
for now it is not necassary.
This change get_working_set_ex peek wall clock runtime from 57ms to
0.29ms.
Tested on Linux, but similar change done for the BSD part.
`Signed-off-by: Witold Baryluk <witold.baryluk(a)gmail.com>`
--
v11: ntdll: Keep pagemap file open after first use of NtQueryVirtualMemory(MemoryWorkingSetExInformation)
https://gitlab.winehq.org/wine/wine/-/merge_requests/852
Apex Legends game periodically (every 30 seconds) calls this function
with up to 22k virtual addresses. All but 1 of them is valid. Due to
amount of queries addresses, and cost of seek+read, this causes this
function to take up to about 50ms. So framerate drops from ~150 FPS to
20FPS for about a second.
As far as I can see, returning 0 entries from this function, still makes
Apex Legend work.
But keep code correct, and optimise it by:
1. Opening pagemap file once, and never closing it. This eliminates
repeated fopen/fseek/fread/fclose sequences, which helps even in queries
with small amount of virtual addresses.
2. Using pread, instead of seek+read.
3. Only performing pagemap read when the address is valid.
Future work might recognize continues pages in the query, and perform a
batch read of multiple pagemap entries, instead one page at a time, but
for now it is not necassary.
This change get_working_set_ex peek wall clock runtime from 57ms to
0.29ms.
Tested on Linux, but similar change done for the BSD part.
`Signed-off-by: Witold Baryluk <witold.baryluk(a)gmail.com>`
--
v10: ntdll: Keep pagemap file open after first use of NtQueryVirtualMemory(MemoryWorkingSetExInformation)
https://gitlab.winehq.org/wine/wine/-/merge_requests/852
Apex Legends game periodically (every 30 seconds) calls this function
with up to 22k virtual addresses. All but 1 of them is valid. Due to
amount of queries addresses, and cost of seek+read, this causes this
function to take up to about 50ms. So framerate drops from ~150 FPS to
20FPS for about a second.
As far as I can see, returning 0 entries from this function, still makes
Apex Legend work.
But keep code correct, and optimise it by:
1. Opening pagemap file once, and never closing it. This eliminates
repeated fopen/fseek/fread/fclose sequences, which helps even in queries
with small amount of virtual addresses.
2. Using pread, instead of seek+read.
3. Only performing pagemap read when the address is valid.
Future work might recognize continues pages in the query, and perform a
batch read of multiple pagemap entries, instead one page at a time, but
for now it is not necassary.
This change get_working_set_ex peek wall clock runtime from 57ms to
0.29ms.
Tested on Linux, but similar change done for the BSD part.
`Signed-off-by: Witold Baryluk <witold.baryluk(a)gmail.com>`
--
v9: ntdll: Keep pagemap file open after first use of NtQueryVirtualMemory(MemoryWorkingSetExInformation)
ntdll: Use pread in NtQueryVirtualMemory(MemoryWorkingSetExInformation)
ntdll: Do not use hardcoded page shift in NtQueryVirtualMemory(MemoryWorkingSetExInformation)
ntdll: Speed up NtQueryVirtualMemory(MemoryWorkingSetExInformation) by conditional page check
https://gitlab.winehq.org/wine/wine/-/merge_requests/852