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.
--
v6: dlls/oleaut32: Fix nonsensical memory access in ITypeLib2_Constructor_SLTG()
dlls/oleaut32: Avoid ptr arithmetic in MSFT_DoVars()
dlls/oleaut32: Avoid ptr arithmetic in ITypeLib2_Constructor_SLTG()
dlls/oleaut32: Fix GetRefTypeInfo() test
dlls/oleaut32: Shink down ITypeLibComp_fnBind() verbosity some
dlls/oleaut32: ptr_size should be a ULONG
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.
--
v4: dmimi: Connect default collection to MIDI bandtrack.
dmime: Handle IStream EOF correctly in MIDI parser.
https://gitlab.winehq.org/wine/wine/-/merge_requests/7230
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