/usr/share/ecere/extras/createLink.ec is in ecere-extras 0.44.15-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | #define COBJMACROS
#define WIN32_LEAN_AND_MEAN
#define UNICODE
#define Method _Method
#define Array _Array
#define byte _byte
#define int64 _int64
#include <shlobj.h>
#undef Method
#undef Array
#undef byte
#undef int64
#ifdef ECERE_STATIC
import static "ecere"
#else
import "ecere"
#endif
bool CreateLink(char * lpszPathObj, char * lpszPathLink, char * lpszDesc)
{
HRESULT hres;
IShellLink* psl;
CoInitialize(NULL);
hres = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, &IID_IShellLink, (void *)&psl);
if (SUCCEEDED(hres))
{
IPersistFile * ppf;
uint16 pathObj[2048] = { 0 };
uint16 desc[2048] = { 0 };
UTF8toUTF16Buffer(lpszPathObj, pathObj, sizeof(pathObj) / sizeof(uint16));
UTF8toUTF16Buffer(lpszDesc, desc, sizeof(desc) / sizeof(uint16));
IShellLinkW_SetPath(psl, pathObj);
IShellLinkW_SetDescription(psl, desc);
//hres = IShellLinkA_QueryInterface(psl, &IID_IPersistFile, (void *)&ppf);
hres = IShellLinkW_QueryInterface(psl, &IID_IPersistFile, (void *)&ppf);
if(SUCCEEDED(hres))
{
WCHAR wsz[MAX_PATH];
MultiByteToWideChar(CP_ACP, 0, lpszPathLink, -1, wsz, MAX_PATH);
hres = IPersistFile_Save(ppf, wsz, TRUE);
IPersistFile_Release(ppf);
}
IShellLinkW_Release(psl);
}
return hres == 0;
}
|