[LNKTOOL][SHELL32] Add utility to create/dump .lnk files (#7745)

Unlike mkshelllink, this uses the native COM interface to create the link.
This commit is contained in:
Whindmar Saksit 2025-03-15 16:31:22 +01:00 committed by GitHub
parent 75c0dc0cd8
commit 96aa1eee17
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 919 additions and 10 deletions

View file

@ -25,6 +25,15 @@
#include <objbase.h>
#include <shtypes.h>
#ifndef _SHLWAPI_
#define LWSTDAPI_(type) EXTERN_C DECLSPEC_IMPORT type WINAPI
#define LWSTDAPIV_(type) EXTERN_C DECLSPEC_IMPORT type STDAPIVCALLTYPE
#else
#define LWSTDAPI_(type) type WINAPI
#define LWSTDAPIV_(type) type STDAPIVCALLTYPE
#endif
#define LWSTDAPI LWSTDAPI_(HRESULT)
#ifdef __cplusplus
extern "C" {
#endif /* defined(__cplusplus) */
@ -1897,6 +1906,14 @@ SHCreateStreamOnFileEx(
HRESULT WINAPI SHCreateStreamWrapper(LPBYTE,DWORD,DWORD,struct IStream**);
#ifndef _SHLWAPI_
LWSTDAPI IStream_Reset(_In_ struct IStream*);
#if !defined(IStream_Read) && defined(__cplusplus)
LWSTDAPI IStream_Read(_In_ struct IStream*, _Out_ void*, _In_ ULONG);
LWSTDAPI IStream_Write(_In_ struct IStream*, _In_ const void*, _In_ ULONG);
#endif
#endif
#endif /* NO_SHLWAPI_STREAM */
#ifndef NO_SHLWAPI_SHARED

View file

@ -127,6 +127,7 @@ SHELL_ErrorBox(H hwndOwner, UINT Error = GetLastError())
#endif
#ifdef __cplusplus
#ifdef DECLARE_CLASSFACTORY // ATL
template <typename T>
class CComCreatorCentralInstance
{
@ -456,6 +457,7 @@ HRESULT inline ShellObjectCreatorInit(T1 initArg1, T2 initArg2, T3 initArg3, T4
return hResult;
}
#endif // DECLARE_CLASSFACTORY (ATL)
template<class P, class R> static HRESULT SHILClone(P pidl, R *ppOut)
{