FX::FXWinShellLink Struct Reference

#include <FXWinLinks.h>

List of all members.


Detailed Description

A POSIX-compatible Windows Shell Link.

In the process of adding node linking to Tn, I thought it would be nice for Tn to be able to understand and indeed generate Windows Shell Links (aka. Shortcuts) to better aid interoperability when running on Windows machines.

However, then I thought that often I am running inside Linux and have most of my files on both Windows and Linux living on a FAT32 drive. Surely many other people would be in a similar situation, so if Linux Tn could also work with Windows shortcuts then that would be really useful.

Thus began the painful process of reverse engineering! I was greatly aided in this process by "The Windows Shortcut File Format" by Jesse Hager (http://www.i2s-lab.com/Papers/The_Windows_Shortcut_File_Format.pdf) which proved almost entirely correct. It turned out however that it did not contain quite enough information for generating link files which the Windows explorer would actually read, so a day's worth of comparing binary views of various link files later and we have this class.

More or less, everything is covered. It's only been tested on Windows XP and really only with linking to files and directories - not to network shares or anything else really. Some fields I couldn't figure out - for example, each pathname part in the item id list has its created, modified & last accessed stored with it but not in FILETIME format nor in time_t, and worse still they seem to oscillate in a way such that later timestamps can have lower values (I'm guessing they've lost a high part of a FILETIME). And there are a few other fields I've just had to leave empty as well as totally omitting the distributed link tracker id at the end of the file, but it doesn't seem to matter.

Drive name translation:

On POSIX, drive name translation is performed via /etc/mtab so you can use this class and in theory, windows paths will become POSIX ones and vice versa. There is however some trickery involved here as drive letter assignment can be totally arbitrary on NT and we don't have access to the Windows registry, so here is the rule:

Does the mounted partition (of type vfat/msdosfs or ntfs) have a mount name containing "win" or "windows" or the letter 'c' to 'z' alone, in brackets or separated from the rest of the mount name by a space? If so, consider it a candidate by matching the base part of the target path with the file system of the mount. If the process fails, an exception is thrown.

One could go scanning superblocks of partitions and generating MSDOS drive letter assignments, but this author routinely overrides that and I suspect so do most people with dual boot (I have quad boot!) setups. The worst situation is when you have two Windows installations eg; x86 and x64 and you decided in your infinite wisdom to make the system drive on both C: - this means shortcuts mean different destinations depending on which system you are running, and you'd be right that this is lunacy (I tried it many years ago - it was more hassle than having a D system drive).

Most people will mount windows partitions in fairly logical places on POSIX, so the above scheme should work on most systems. It is unfortunately one of those things which cannot be guaranteed however and maybe someday I should add some mechanism for specifying a per-user mapping like via FX::FXRegistry.

See also:
FX::FXProcess::

Definition at line 94 of file FXWinLinks.h.

Public Member Functions

void write (FXStream s, const QFileInfo &whereTo)

Static Public Member Functions

static FXString read (const FXString &path, bool doDriveConversion=true)
static void write (const FXString &path, const QFileInfo &whereTo)

Public Attributes

FXAPI FX::FXWinShellLink::Header header
FXAPI FX::FXWinShellLink::ItemIdListTag itemIdList
FXAPI FX::FXWinShellLink::FileLocationTag fileLocation
StringTag description
StringTag relativePath
StringTag workingDir
StringTag cmdLineArgs
StringTag customIcon

Friends

FXAPI FXStreamoperator>> (FXStream &s, FXWinShellLink &i)

Classes

struct  FileLocationTag
struct  Header
struct  ItemIdListTag
struct  StringTag


The documentation for this struct was generated from the following file:
(C) 2002-2009 Niall Douglas. Some parts (C) to assorted authors.
Generated on Fri Nov 20 18:37:30 2009 for TnFOX by doxygen v1.4.7