Index: dll/win32/shell32/shelllink.cpp =================================================================== --- dll/win32/shell32/shelllink.cpp (Revision 58870) +++ dll/win32/shell32/shelllink.cpp (Arbeitskopie) @@ -4,6 +4,7 @@ * Copyright 1998 Juergen Schmied * Copyright 2005 Mike McCormack * Copyright 2009 Andrew Hill + * Copyright 2013 Dominik Hornung * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -45,23 +46,6 @@ #include "pshpack1.h" -struct LINK_HEADER -{ - DWORD dwSize; /* 0x00 size of the header - 0x4c */ - GUID MagicGuid; /* 0x04 is CLSID_ShellLink */ - DWORD dwFlags; /* 0x14 describes elements following */ - DWORD dwFileAttr; /* 0x18 attributes of the target file */ - FILETIME Time1; /* 0x1c */ - FILETIME Time2; /* 0x24 */ - FILETIME Time3; /* 0x2c */ - DWORD dwFileLength; /* 0x34 File length */ - DWORD nIcon; /* 0x38 icon number */ - DWORD fStartup; /* 0x3c startup type */ - DWORD wHotKey; /* 0x40 hotkey */ - DWORD Unknown5; /* 0x44 */ - DWORD Unknown6; /* 0x48 */ -}; - struct LOCATION_INFO { DWORD dwTotalSize; @@ -491,17 +475,17 @@ if (!stm) return STG_E_INVALIDPOINTER; - LINK_HEADER hdr; + SHELL_LINK_HEADER ShlLnkHeader; ULONG dwBytesRead = 0; - HRESULT hr = stm->Read(&hdr, sizeof(hdr), &dwBytesRead); + HRESULT hr = stm->Read(&ShlLnkHeader, sizeof(ShlLnkHeader), &dwBytesRead); if (FAILED(hr)) return hr; - if (dwBytesRead != sizeof(hdr)) + if (dwBytesRead != sizeof(ShlLnkHeader)) return E_FAIL; - if (hdr.dwSize != sizeof(hdr)) + if (ShlLnkHeader.dwSize != sizeof(ShlLnkHeader)) return E_FAIL; - if (!IsEqualIID(hdr.MagicGuid, CLSID_ShellLink)) + if (!IsEqualIID(ShlLnkHeader.clsid, CLSID_ShellLink)) return E_FAIL; /* free all the old stuff */ @@ -526,12 +510,12 @@ sComponent = NULL; BOOL unicode = FALSE; - iShowCmd = hdr.fStartup; - wHotKey = (WORD)hdr.wHotKey; - iIcoNdx = hdr.nIcon; - FileTimeToSystemTime (&hdr.Time1, &time1); - FileTimeToSystemTime (&hdr.Time2, &time2); - FileTimeToSystemTime (&hdr.Time3, &time3); + iShowCmd = ShlLnkHeader.nShowCommand; + wHotKey = ShlLnkHeader.wHotKey; + iIcoNdx = ShlLnkHeader.nIconIndex; + FileTimeToSystemTime (&ShlLnkHeader.ftCreationTime, &time1); + FileTimeToSystemTime (&ShlLnkHeader.ftLastAccessTime, &time2); + FileTimeToSystemTime (&ShlLnkHeader.ftLastWriteTime, &time3); if (TRACE_ON(shell)) { WCHAR sTemp[MAX_PATH]; @@ -547,7 +531,7 @@ } /* load all the new stuff */ - if (hdr.dwFlags & SLDF_HAS_ID_LIST) + if (ShlLnkHeader.dwFlags & SLDF_HAS_ID_LIST) { hr = ILLoadFromStream(stm, &pPidl); if (FAILED(hr)) @@ -556,15 +540,15 @@ pdump(pPidl); /* load the location information */ - if (hdr.dwFlags & SLDF_HAS_LINK_INFO) + if (ShlLnkHeader.dwFlags & SLDF_HAS_LINK_INFO) hr = Stream_LoadLocation(stm, &volume, &sPath); if (FAILED(hr)) goto end; - if (hdr.dwFlags & SLDF_UNICODE) + if (ShlLnkHeader.dwFlags & SLDF_UNICODE) unicode = TRUE; - if (hdr.dwFlags & SLDF_HAS_NAME) + if (ShlLnkHeader.dwFlags & SLDF_HAS_NAME) { hr = Stream_LoadString(stm, unicode, &sDescription); TRACE("Description -> %s\n", debugstr_w(sDescription)); @@ -572,7 +556,7 @@ if (FAILED(hr)) goto end; - if (hdr.dwFlags & SLDF_HAS_RELPATH) + if (ShlLnkHeader.dwFlags & SLDF_HAS_RELPATH) { hr = Stream_LoadString(stm, unicode, &sPathRel); TRACE("Relative Path-> %s\n", debugstr_w(sPathRel)); @@ -580,7 +564,7 @@ if (FAILED(hr)) goto end; - if (hdr.dwFlags & SLDF_HAS_WORKINGDIR) + if (ShlLnkHeader.dwFlags & SLDF_HAS_WORKINGDIR) { hr = Stream_LoadString(stm, unicode, &sWorkDir); PathRemoveBackslash(sWorkDir); @@ -589,7 +573,7 @@ if (FAILED(hr)) goto end; - if (hdr.dwFlags & SLDF_HAS_ARGS) + if (ShlLnkHeader.dwFlags & SLDF_HAS_ARGS) { hr = Stream_LoadString(stm, unicode, &sArgs); TRACE("Arguments -> %s\n", debugstr_w(sArgs)); @@ -597,7 +581,7 @@ if (FAILED(hr)) goto end; - if (hdr.dwFlags & SLDF_HAS_ICONLOCATION) + if (ShlLnkHeader.dwFlags & SLDF_HAS_ICONLOCATION) { hr = Stream_LoadString(stm, unicode, &sIcoPath); TRACE("Icon file -> %s\n", debugstr_w(sIcoPath)); @@ -606,7 +590,7 @@ goto end; #if (NTDDI_VERSION < NTDDI_LONGHORN) - if (hdr.dwFlags & SLDF_HAS_LOGO3ID) + if (ShlLnkHeader.dwFlags & SLDF_HAS_LOGO3ID) { hr = Stream_LoadAdvertiseInfo(stm, &sProduct); TRACE("Product -> %s\n", debugstr_w(sProduct)); @@ -615,12 +599,12 @@ goto end; #endif - if (hdr.dwFlags & SLDF_HAS_DARWINID) + if (ShlLnkHeader.dwFlags & SLDF_HAS_DARWINID) { hr = Stream_LoadAdvertiseInfo(stm, &sComponent); TRACE("Component -> %s\n", debugstr_w(sComponent)); } - if (hdr.dwFlags & SLDF_RUNAS_USER) + if (ShlLnkHeader.dwFlags & SLDF_RUNAS_USER) { bRunAs = TRUE; } @@ -763,43 +747,43 @@ { TRACE("%p %p %x\n", this, stm, fClearDirty); - LINK_HEADER header; - memset(&header, 0, sizeof(header)); - header.dwSize = sizeof(header); - header.fStartup = iShowCmd; - header.MagicGuid = CLSID_ShellLink; + SHELL_LINK_HEADER ShlLnkHeader; + memset(&ShlLnkHeader, 0, sizeof(ShlLnkHeader)); + ShlLnkHeader.dwSize = sizeof(ShlLnkHeader); + ShlLnkHeader.nShowCommand = iShowCmd; + ShlLnkHeader.clsid = CLSID_ShellLink; - header.wHotKey = wHotKey; - header.nIcon = iIcoNdx; - header.dwFlags = SLDF_UNICODE; /* strings are in unicode */ + ShlLnkHeader.wHotKey = wHotKey; + ShlLnkHeader.nIconIndex = iIcoNdx; + ShlLnkHeader.dwFlags = SLDF_UNICODE; /* strings are in unicode */ if (pPidl) - header.dwFlags |= SLDF_HAS_ID_LIST; + ShlLnkHeader.dwFlags |= SLDF_HAS_ID_LIST; if (sPath) - header.dwFlags |= SLDF_HAS_LINK_INFO; + ShlLnkHeader.dwFlags |= SLDF_HAS_LINK_INFO; if (sDescription) - header.dwFlags |= SLDF_HAS_NAME; + ShlLnkHeader.dwFlags |= SLDF_HAS_NAME; if (sWorkDir) - header.dwFlags |= SLDF_HAS_WORKINGDIR; + ShlLnkHeader.dwFlags |= SLDF_HAS_WORKINGDIR; if (sArgs) - header.dwFlags |= SLDF_HAS_ARGS; + ShlLnkHeader.dwFlags |= SLDF_HAS_ARGS; if (sIcoPath) - header.dwFlags |= SLDF_HAS_ICONLOCATION; + ShlLnkHeader.dwFlags |= SLDF_HAS_ICONLOCATION; #if (NTDDI_VERSION < NTDDI_LONGHORN) if (sProduct) - header.dwFlags |= SLDF_HAS_LOGO3ID; + ShlLnkHeader.dwFlags |= SLDF_HAS_LOGO3ID; #endif if (sComponent) - header.dwFlags |= SLDF_HAS_DARWINID; + ShlLnkHeader.dwFlags |= SLDF_HAS_DARWINID; if (bRunAs) - header.dwFlags |= SLDF_RUNAS_USER; + ShlLnkHeader.dwFlags |= SLDF_RUNAS_USER; - SystemTimeToFileTime (&time1, &header.Time1); - SystemTimeToFileTime (&time2, &header.Time2); - SystemTimeToFileTime (&time3, &header.Time3); + SystemTimeToFileTime (&time1, &ShlLnkHeader.ftCreationTime); + SystemTimeToFileTime (&time2, &ShlLnkHeader.ftLastAccessTime); + SystemTimeToFileTime (&time3, &ShlLnkHeader.ftLastWriteTime); /* write the Shortcut header */ ULONG count; - HRESULT hr = stm->Write(&header, sizeof(header), &count); + HRESULT hr = stm->Write(&ShlLnkHeader, sizeof(ShlLnkHeader), &count); if (FAILED(hr)) { ERR("Write failed\n"); Index: include/psdk/sdkddkver.h =================================================================== --- include/psdk/sdkddkver.h (Revision 58870) +++ include/psdk/sdkddkver.h (Arbeitskopie) @@ -98,6 +98,7 @@ #define NTDDI_WS08SP3 NTDDI_WIN6SP3 #define NTDDI_WS08SP4 NTDDI_WIN6SP4 #define NTDDI_WIN7 0x06010000 +#define NTDDI_WIN8 0x06020000 /* Version Fields in NTDDI_VERSION */ #define OSVERSION_MASK 0xFFFF0000UL Index: include/psdk/shlobj.h =================================================================== --- include/psdk/shlobj.h (Revision 58870) +++ include/psdk/shlobj.h (Arbeitskopie) @@ -1394,6 +1394,7 @@ void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2); typedef enum { + SLDF_DEFAULT = 0x00000000, SLDF_HAS_ID_LIST = 0x00000001, SLDF_HAS_LINK_INFO = 0x00000002, SLDF_HAS_NAME = 0x00000004, @@ -1414,8 +1415,23 @@ SLDF_RUN_WITH_SHIMLAYER = 0x00020000, SLDF_FORCE_NO_LINKTRACK = 0x00040000, SLDF_ENABLE_TARGET_METADATA = 0x00080000, + SLDF_DISABLE_LINK_PATH_TRACKING = 0x00100000, SLDF_DISABLE_KNOWNFOLDER_RELATIVE_TRACKING = 0x00200000, - SLDF_VALID = 0x003ff7ff, +#if (NTDDI_VERSION >= NTDDI_WIN7) + SLDF_NO_KF_ALIAS = 0x00400000, + SLDF_ALLOW_LINK_TO_LINK = 0x00800000, + SLDF_UNALIAS_ON_SAVE = 0x01000000, + SLDF_PREFER_ENVIRONMENT_PATH = 0x02000000, + SLDF_KEEP_LOCAL_IDLIST_FOR_UNC_TARGET = 0x04000000, +#if (NTDDI_VERSION >= NTDDI_WIN8) + SLDF_PERSIST_VOLUME_ID_RELATIVE = 0x08000000, + SLDF_VALID = 0x0ffff7ff, /* Windows 8 */ +#else + SLDF_VALID = 0x07fff7ff, /* Windows 7 */ +#endif +#else + SLDF_VALID = 0x003ff7ff, /* Windows Vista */ +#endif SLDF_RESERVED = 0x80000000, } SHELL_LINK_DATA_FLAGS; Index: include/psdk/shlobj_undoc.h =================================================================== --- include/psdk/shlobj_undoc.h (Revision 58870) +++ include/psdk/shlobj_undoc.h (Arbeitskopie) @@ -836,6 +836,39 @@ #define SHCreateWorkerWindow SHCreateWorkerWindowA #endif +/***************************************************************************** + * Shell Link + */ +#include + +typedef struct tagSHELL_LINK_HEADER +{ + /* The size of this structure (always 0x0000004C) */ + DWORD dwSize; + /* CLSID = class identifier (always 00021401-0000-0000-C000-000000000046) */ + CLSID clsid; + /* Flags (SHELL_LINK_DATA_FLAGS) */ + DWORD dwFlags; + /* Informations about the link target: */ + DWORD dwFileAttributes; + FILETIME ftCreationTime; + FILETIME ftLastAccessTime; + FILETIME ftLastWriteTime; + DWORD nFileSizeLow; /* only the least significant 32 bits */ + /* The index of an icon (signed?) */ + DWORD nIconIndex; + /* The expected window state of an application launched by the link */ + DWORD nShowCommand; + /* The keystrokes used to launch the application */ + WORD wHotKey; + /* Reserved (must be zero) */ + WORD wReserved1; + DWORD dwReserved2; + DWORD dwReserved3; +} SHELL_LINK_HEADER, *LPSHELL_LINK_HEADER; + +#include + #ifdef __cplusplus } /* extern "C" */ #endif /* defined(__cplusplus) */