On Fri Feb 7 20:18:51 2025 +0000, Nikolay Sivov wrote:
> What this needs first is tests, and then fixes would could normally
> touch more than just absolute minimum, like having some helpers etc. But
> only renaming local variables is not something we normally do.
Yes, three tests are fixed if you review.
> absolute minimum
That is why commits have been split up to make things trivially clear.
> But only renaming local variables is not something we normally do.
Except it isn't just renaming variables if you actually looked it over.
No offense but this attitude to new contributions explains a lot about why this code is so horrifically inconsistent and in disrepair. There are multiple buffer overflows and deref of invalid ptr's, both of which controllable by the user and other subtle bugs. A few have been addressed here.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7286#note_94040
This fixes https://bugs.winehq.org/show_bug.cgi?id=52094.
For reference, here's how current_modref is being passed around (before this patch):
```mermaid
graph TB
fii["fixup_imports_ilonly<br><em style='color:#ff0'>(directly sets current_modref)</em>"]
fi["fixup_imports<br><em style='color:#ff0'>(directly sets current_modref)</em>"]
pa["process_attach<br><em style='color:#ff0'>(directly sets current_modref)</em>"]
ld[load_dll]
id["import_dll<br><em style='color:#0f0'>(directly uses current_modref)</em>"]
bin["build_import_name<br><em style='color:#0f0'>(directly uses current_modref)</em>"]
foe["find_ordinal_export<br><em style='color:#0f0'>(uses current_modref for relay)</em>"]
ffe["find_forwarded_export<br><em style='color:#0f0'>(directly uses current_modref)</em>"]
fne[find_named_export]
MI[MODULE_InitDLL]
fii --> ld
fi --> id
pa --> MI -.-> DllMain
id --> bin
id --> ld
id --> foe
id --> fne --> foe --> ffe --> foe
ffe --> fne
ffe --> bin
style DllMain color:red;
```
--
v9: ntdll: Properly track refcount with forwarded exports.
ntdll: Don't re-add a module dependency if it already exists.
https://gitlab.winehq.org/wine/wine/-/merge_requests/7
What this needs first is tests, and then fixes would could normally touch more than just absolute minimum, like having some helpers etc. But only renaming local variables is not something we normally do.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7286#note_94017
Make both method calls;
1. Consistently written with parameter names as per spec.
2. Fix parameter validation to be consistent with spec.
3. Fix szNameBuf parameter semantics as per spec.
4. Fix szNameBuf casing str search as per spec.
5. Factor out common code into TLB_ helpers vastly improves readability.
--
v3: dlls/oleaut32: Scope indexer to loops in fn[Is|Find]Name()
dlls/oleaut32: Factor out TLB_get_funcparams_by_name()
dlls/oleaut32: Factor out TLB_get_funcdesc_by_name()
dlls/oleaut32: Validate args of ITypeLib2_fnIsName()
dlls/oleaut32: fn(Is|Find)Name should set szNameBuf with correct case
dlls/oleaut32: Use consistent param identifiers in fnFindName
dlls/oleaut32: Mostly mirror fnFindName impl in typelib.c
https://gitlab.winehq.org/wine/wine/-/merge_requests/7286
* * *
BTW I did try to create tests to make sure we connect collection the same way Windows does it. Problem is `GUID_ConnectToDLSCollection` is not gettable. Then I tried to create a `IDirectMusicPerformance` implementation and intercept `DownloadInstrument`. Interestingly Windows `IDirectMusicSegment::Download` doesn't call `DownloadInstrument` at all, instead it downloads instruments through a private, undocumented interface. So there seems to be no way to test this.
--
v3: dmimi: Connect default collection to MIDI bandtrack.
dmime: Handle IStream EOF correctly in MIDI parser.
https://gitlab.winehq.org/wine/wine/-/merge_requests/7230
Make both method calls;
1. Consistently written with parameter names as per spec.
2. Fix parameter validation to be consistent with spec.
3. Fix szNameBuf parameter semantics as per spec.
4. Fix szNameBuf casing str search as per spec.
5. Factor out common code into TLB_ helpers vastly improves readability.
--
v2: dlls/oleaut32: Scope indexer to loops in fn[Is|Find]Name()
dlls/oleaut32: Factor out TLB_get_funcparams_by_name()
https://gitlab.winehq.org/wine/wine/-/merge_requests/7286
Make both method calls;
Consistently written with parameter names as per spec.
Fix parameter validation to be consistent with spec.
Fix szNameBuf parameter semantics as per spec.
Fix szNameBuf casing str search as per spec.
Factor out common code into TLB_ helpers vastly improves readability.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7286
Alfred Agrell (@Alcaro) commented about README.md:
> Make sure you have the USER_LDT, SYSVSHM, SYSVSEM, and SYSVMSG options
> turned on in your kernel.
>
> **Mac OS X info**:
Not gonna update this one?
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7283#note_93987
--
v4: server: When renaming, only fstat the source once.
server: Remove source when renaming to a hardlink of itself.
kernel32/tests: Test renaming a file into a hardlink of itself.
kernel32/tests: Use FindClose instead of CloseHandle when closing
https://gitlab.winehq.org/wine/wine/-/merge_requests/6855
Fix 3 calls to AppKit that were not being done from the main thread, found using Apple's [Main Thread Checker](https://developer.apple.com/documentation/xcode/diagnosing-memory-….
I used it with Wine by dlopen()ing `/Applications/Xcode.app/Contents/Developer/usr/lib/libMainThreadChecker.dylib` in `macdrv_init()`, commenting out the `SIGABRT` handler in `signal_x86_64.c`, and setting `MTC_CRASH_ON_REPORT=1` so the process will `abort()` and eventually generate a crash log+backtrace.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7282
* * *
BTW I did try to create tests to make sure we connect collection the same way Windows does it. Problem is `GUID_ConnectToDLSCollection` is not gettable. Then I tried to create a `IDirectMusicPerformance` implementation and intercept `DownloadInstrument`. Interestingly Windows `IDirectMusicSegment::Download` doesn't call `DownloadInstrument` at all, instead it downloads instruments through a private, undocumented interface. So there seems to be no way to test this.
--
v2: dmimi: Connect default collection to MIDI bandtrack.
dmime: Handle IStream EOF correctly in MIDI parser.
https://gitlab.winehq.org/wine/wine/-/merge_requests/7230