This file is indexed.

/usr/share/ecere/extras/windowsShortcut.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#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;
}

bool GetLinkTarget(char * lpszPathObj, char ** lpszPathLink)
{
    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 };

        UTF8toUTF16Buffer(lpszPathObj, pathObj, sizeof(pathObj) / sizeof(uint16));

        hres = IShellLinkW_QueryInterface(psl, &IID_IPersistFile, (void *)&ppf);

        if(SUCCEEDED(hres))
        {
            WCHAR wsz[MAX_PATH];
            if(MultiByteToWideChar(CP_ACP, 0, lpszPathObj, -1, wsz, MAX_PATH))
            {
               if(SUCCEEDED(IPersistFile_Load(ppf, wsz, STGM_READ)))
               {
                  WCHAR szTarget[MAX_PATH];
                  if(NOERROR == IShellLinkW_GetPath(psl, szTarget, MAX_PATH, NULL, 0))
                  {
                     char pathTarget[2048] = { 0 };
                     UTF16toUTF8Buffer(szTarget, pathTarget, sizeof(pathTarget) / sizeof(uint16));
                     *lpszPathLink = CopyString(pathTarget);
                  }
               }
            }
            IPersistFile_Release(ppf);
        }
        IShellLinkW_Release(psl);
    }
    CoUninitialize();
    return hres == 0;
}