GithubHelp home page GithubHelp logo

doytsujin / liblnk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from end2endzone/liblnk

0.0 2.0 0.0 585 KB

libLNK is a c++ library for creating Windows shortcuts (*.lnk files)

License: MIT License

PowerShell 1.52% Batchfile 3.22% CMake 2.18% C++ 93.00% C 0.06% NSIS 0.02%

liblnk's Introduction

libLNK logo

License: MIT Github Releases Build status Tests status

AppVeyor build statistics:

Build statistics

libLNK

libLNK is a c++ library for creating Windows shortcuts (*.lnk files).

It's main features are:

  • Supports shortcuts created by Windows XP and over.
  • Create new shortcuts or read properties of an existing shortcuts.
  • Support the following shotcut properties:
    • target (path to file or folder)
    • arguments
    • working directory (start in)
    • hot key (shortcut key)
    • window mode (normal, minimized or maximized)
    • description (comments)
    • icon

Background

libLNK was first released in XXXX. At the time, there were not much documentation of the format that was widely available.

The following links are references that were available at the time of the first public release:

libLNK implementation is a reverse engineering process to identify how the file format is working.

Note that the Shell Link (.LNK) binary file format is now properly documented and can be found on MSDN.

Usage

The library publishes multiple functions in the 'lnk' namespace. Each function is self explanatory to manipulate the Windows Shortcut binary file format:

bool isLink(const unsigned char * iBuffer, const unsigned long & iSize); 
bool getLinkInfo(const char * iFilePath, LinkInfo & oLinkInfo); 
bool createLink(const char * iFilePath, const LinkInfo & iLinkInfo); 
std::string getLinkCommand(const char * iFilePath); 

The library also publishes debuging API functions:

const char * getVersionString(); 
bool printLinkInfo(const char * iFilePath); 

Example

Create shortcut:

The following example creates a shortcut to the 'History.txt' file of 7-Zip. The file is located in 'C:\Program Files\7-Zip\History.txt'.

lnk::LinkInfo info;
info.target = "C:\\Program Files\\7-Zip\\History.txt";
info.arguments = "";
info.description = "manual shortcut created by libLNK library";
info.workingDirectory = "C:\\Program Files\\7-Zip";
info.customIcon.filename = "%SystemRoot%\\system32\\SHELL32.dll";
info.customIcon.index = 101; //empty recycle bin icon
info.hotKey = lnk::LNK_NO_HOTKEY;

const char * linkFilename = "Shortcut to 7-zip History.txt.lnk";
bool success = lnk::createLink(linkFilename, info);

Read shortcut properties

The following example read properties of the 'Calculator' shortcut of the 'Start Menu'.

lnk::LinkInfo info;
bool success = lnk::getLinkInfo("C:\\Users\\All Users\\Microsoft\\Windows\\Start Menu\\Programs\\Accessories\\Calculator.lnk", info);
printf("target=%s\n", info.target.c_str());
printf("network path=%s\n", info.networkPath.c_str());
printf("arguments=%s\n", info.arguments.c_str());
printf("description=%s\n", info.description.c_str());
printf("workingDirectory=%s\n", info.workingDirectory.c_str());
printf("icon.filename=%s\n", info.customIcon.filename.c_str());
printf("icon.index=%d\n", info.customIcon.index);

Outputs:

target=%windir%\system32\calc.exe
network path=
arguments=
description=Performs basic arithmetic tasks with an on-screen calculator.
workingDirectory=
icon.filename=%windir%\system32\calc.exe
icon.index=0

!!!ICI!!!

https://github.com/end2endzone/libLNK/blob/master/src/libLNK_unittest/TestLNK.cpp https://github.com/libyal/liblnk/wiki/Building

Command:

libLNK.exe --file=html5skeleton.html --output=.\outdir --headerfile=resourcehtml5skeleton.h
            --identifier=HtmlSample --chunksize=50

Installing

Please refer to file INSTALL.md for details on how installing/building the application.

Testing

libLNK comes with unit tests which tests for multiple combinations to validate the integrity of the library with multiple operating systems.

Test are build using the Google Test v1.6.0 framework. For more information on how googletest is working, see the google test documentation primer.

Test are automatically build when building the solution. Please see the 'build step' section for details on how to build the software.

Test can be executed from the following two locations:

  1. From the Visual Studio IDE:
    1. Select the project 'libLNK_unittest' as StartUp project.
    2. Hit CTRL+F5 (Start Without Debugging)
  2. From the output binaries folder:
    1. Open a file navigator and browse to the output folder(for example c:\projects\libLNK\cmake\build\bin\Release)
    2. Run the 'libLNK_unittest.exe' executable.

See also the latest test results at the beginning of the document.

Compatible with

libLNK is only available for the Windows platform and has been tested with the following version of Windows:

  • Windows XP
  • Windows 7

Versioning

We use Semantic Versioning 2.0.0 for versioning. For the versions available, see the tags on this repository.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details

liblnk's People

Contributors

end2endzone avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.