Works on any OS - although only really useful in Windows, this library can parse and write .lnk files, a shell link, that can be understood by Windows.
To get started, see the ShellLink struct.
The full specification of these files can be found at Microsoft's Website.
A simple example appears as follows:
use lnk::ShellLink; // ... ShellLink::new_simple(std::path::Path::new(r"C:\Windows\System32\notepad.exe"));
The FileAttributesFlags structure defines bits that specify the file attributes of the link target, if the target is a file system item. File attributes can be used if the link target is not available, or if accessing the target would be inefficient. It is possible for the target items attributes to be out of sync with this value.
The HotkeyFlags structure specifies input generated by a combination of keyboard keys being pressed.
An 8-bit unsigned integer that specifies bits that correspond to modifier keys on the keyboard.
The LinkFlags structure defines bits that specify which shell linkstructures are present in the file format after the ShellLinkHeaderstructure (section 2.1).
The LinkInfo structure specifies information necessary to resolve a linktarget if it is not found in its original location. This includes information about the volume that the target was stored on, the mapped drive letter, and a Universal Naming Convention (UNC)form of the path if one existed when the linkwas created. For more details about UNC paths, see [MS-DFSNM] section 22.214.171.124
The LinkTargetIDList structure specifies the target of the link. The presence of this optional structure is specified by the HasLinkTargetIDList bit (LinkFlagssection 2.1.1) in the ShellLinkHeader(section2.1).
A shell link
A ShellLinkHeader structure (section 2.1), which contains identification information, timestamps, and flags that specify the presence of optional structures.
The error type for shell link parsing errors.
ExtraData refers to a set of structures that convey additional information about a link target. These optional structures can be present in an extra data section that is appended to the basic Shell Link Binary File Format.
An 8-bit unsigned integer that specifies a virtual key code that corresponds to a key on the keyboard.
The expected window state of an application launched by the link.