Refactor shelllink.py for ITEMIDLIST structure and enhance IShellLink tests.#926
Merged
junkmd merged 5 commits intoenthought:mainfrom Feb 13, 2026
Merged
Conversation
…link.py`. - Replace the placeholder `ITEMIDLIST = c_int` with actual `Structure` definitions to match Windows API specifications. - Include `SHITEMID` with `cb` and `abID` fields.
- Add `test_set_and_get_idlist` to `Test_IShellLinkA` and `Test_IShellLinkW` in `test_shelllink.py`. - Verify setting and retrieving a manually constructed `ITEMIDLIST`. - Use `_CoTaskMemFree` to release the pointer returned by `GetIDList`.
…ist`. - Use `_Pointer[ITEMIDLIST]` for `ITEMIDLIST` pointers in `IShellLinkA` and `IShellLinkW`. - Specify `hints.Hresult` as the return type for `SetIDList`. - Import `_Pointer` from `ctypes` within the `TYPE_CHECKING` block.
…elllink.py`. - Add assertions using `ILIsEqual` in `Test_IShellLinkA` and `Test_IShellLinkW` to ensure correct `ITEMIDLIST` handling.
…in `test_shelllink.py`. - Assert that input `PIDL`s are not COM-allocated and output `PIDL`s are, ensuring proper `CoTaskMemFree` usage.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #926 +/- ##
==========================================
+ Coverage 88.39% 88.43% +0.03%
==========================================
Files 139 139
Lines 13502 13546 +44
==========================================
+ Hits 11935 11979 +44
Misses 1567 1567 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #924
Overview
This pull request changes
shelllink.pyto correctly defineITEMIDLISTandSHITEMIDasctypes.Structureobjects, matching the rules of the Windows API.It also adds thorough tests for
IShellLink::SetIDListandGetIDList, including reliable comparisons usingILIsEqualand careful checks of memory use.These changes make the COM type definitions more accurate and ensure that shell link operations work dependably.