Repository navigation
Do not substitute current time for unparseable FILETIME. Rean IconIndex as signed - #49
Open
k1mb3rlyie wants to merge 1 commit into
Open
k1mb3rlyie wants to merge 1 commit into
k1mb3rlyie wants to merge 1 commit into
Conversation
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.
Pull request: pylnk3
Two correctness fixes, addressing issues #47 and [#48 (https://github.com//issues/48).
1.
convert_time_to_unixreturneddatetime.now()for out-of-range FILETIMEIssue : When a FILETIME cannot be represented as a
datetime, the function returned the current system time. Not limited to corrupt filesdatetime.fromtimestampalso rejects negative timestamps on Windows, and FILETIME0— the standard representation of an unset timestamp maps to unix time-11644473600. So on Windows, any shortcut with unset timestamps reported the current time. Two of the project's own test fixtures,send_to_fax.lnkanduwp_calc.lnk, have all three timestamps set to zero and are affectedStatus : This change catches
(OSError, ValueError, OverflowError)and returnsNone, so the failure is visible to the caller on every platform. It also makes the function deterministic — previously, parsing the same bytes twice a minute apart on Windows returned two values a minute apart.2.
IconIndexread as unsignedIssue :
IconIndexat header offset0x38is a signed 32-bit integer perMS-SHLLINK §2.1.
It was being read with
<I, so-1came back as4294967295and-7as4294967289.-1is not unusual, as it appears in shortcuts using resource-relative icon references.Status : Adds
read_signed_int/write_signed_intalongside the existing helpers and uses them for this field only. The write side matters too:write_intuses<Iand raisesstruct.erroron a negative value, so a link with a negative icon index could be read (incorrectly) but not saved at all.