Hot File

Command line tool with source code to add native resources to any executable

View: 448    Dowload: 0   Comment: 0   Post by: hanhga  
Author: none   Category: Development Tools   Fields: Computers - Technology

0 point/4 review File has been tested

This command line tool adds any file as a resource to another executable you specify. The tool accepts arguments like a file or directory with files to be added as a resource, with the type and name for each of the resource. The complete source code is provided.

Introduction

Background

This tool can be helpful for executables produced with managed technologies like .NET, where the resource files are not natively embedded. There are some situations when you do want that your managed application have native resources.

For example, if you wish to use the res:// protocol to load an HTML file from your managed executable (assembly). You can create a post build stepn and run this tool to add the native resources to the managed application.

Using the tool

Command line syntax:

AddResource.exe ExePath ResFile [ResName] [ResType]

Arguments description:

  • ExePath - path of the executable file to add resources to.
  • ResFile - path of the file or directory of files to be added as a resource(s).
  • ResName - (optional) name of the resource; if omitted, the application will use the filename as the resource name. If ResFile denotes a directory, then ResName is ignored.
  • ResType - (optional) type of the resource; if omitted, the application will try to use one of the default resource types based on the ResFile file extension. For example, an 'index.html' file will use the RT_HTML resource type.

Note that if ResName or ResType refers to a resource ID (satisfies the IS_INTRESOURCE(x) macro), it will be used like a resource ID not as a resource string. For example, if (for a strange reason) you want to have a resource type of 23 as string, you won't be able to do that. If you don't know understand what this note says about the difference between a resource name as string and resource name as integer, ignore it, as 99.99% you won't need it.

Example

AddResource.exe myManagedApp.exe Help.htm help.htm 23

It is equivalent to omitting the resource type:

AddResource.exe myManagedApp.exe Help.htm help.htm

because the value of RT_HTML is 23.

If you have a directory with files you want to add as a resource, you pass the directory path.

AddResource.exe myManagedApp.exe U:\Projects\myManagedApp/Resources

Each file from the directory will be added as a resource using the resource name, the filename, and the resource type will be determined based on the file type.

The application automatically maps HTML files to RT_HTML, BMP files to RT_BITMAP, and ICO files to RT_ICON. The file type is determined by its extension. Any other type of file is automatically added to the RT_HTML type.

For example:

Let's say you have in a directory the following files: Index.htm, Image1.jpg, Image2.bmp. Index.htm is mapped to RT_HTM, Image1.jpg to RT_HTML, and Image2.bmp to RT_BITMAP.

Points of interest

The AddResource tool maps the source resource file in its address space using the Win32 file mapping API, and calls Win32 API resource functions to update the target executable. It uses a mutex to synchronize the update on the same executable. Check the source code for more.

Please feel free to add any comments \ suggestions, I'll be happy to help.

Command line tool with source code to add native resources to any executable

Command line tool with source code to add native resources to any executable Posted on 07-04-2014  This command line tool adds any file as a resource to another executable you specify. The tool accepts arguments like a file or directory with files to be added as a resource, with the type and name for each of the resource. The complete source code is provided. 5/10 448

Comment:

To comment you must be logged in members.

Files with category

  • Changes in Programmer Tools' Infrastructure

    View: 3021    Download: 0   Comment: 0   Author: none  

    Changes in Programmer Tools' Infrastructure

    Category: Development Tools
    Fields: Other

    0.75/6 review
    The article describes some observations concerning changes in the infrastructure of tools used by programmers in everyday work. First of all, these changes are related to the release of Visual Studio 2010.

  • An Overview of the NuGet Ecosystem

    View: 3461    Download: 0   Comment: 0   Author: none  

    An Overview of the NuGet Ecosystem

    Category: Development Tools
    Fields: none

    0.5625/8 review
    NuGet is a free, open source package management system for .NET and consists out of a few client tools (NuGet Command Line and NuGet Visual Studio Extension) and the official NuGet Gallery hosted at http://www.nuget.org/. Combined, these tools and...

  • Folder Listener: A Tool to Watch File System Activity in any Folder

    View: 3200    Download: 5   Comment: 0   Author: none  

    Folder Listener: A Tool to Watch File System Activity in any Folder

    Category: Development Tools
    Fields: none

    1.5/3 review
    Most of the time when you are doing some development or testing, you might need to know what changes are made in a particular folder. This requirement frequently arises when you are testing /developing software that copies /delete files in the...

  • Generating synchronous method stubs from asynchronous method pairs

    View: 2824    Download: 0   Comment: 0   Author: none  

    Generating synchronous method stubs from asynchronous method pairs

    Category: Development Tools
    Fields: Other

    0/4 review
    During the development of a GSM Modem API, I found I was repeating a lot of code for encapsulating the synchronous versions of asynchronous method templates. The common pattern for such code implements asynchronous methods with the same name as the...

  • How to Minify js and CSS file using Visual Studio 2012

    View: 1805    Download: 0   Comment: 0   Author: none  

    How to Minify js and CSS file using Visual Studio 2012

    Category: Development Tools
    Fields: Other

    1.125/4 review
    In my previous article I have talked about what is Microsoft’s Web Optimization Framework and how to use this framework in Asp.net web form application. There are two pillars of this framework bundling and minification. So this framework...

  • A New Approach to Designing Web Applications

    View: 3758    Download: 0   Comment: 0   Author: none  

    A New Approach to Designing Web Applications

    Category: Development Tools
    Fields: Other

    0/8 review
    With all the hay being made about UML modeling, you'd think that was the only way to design an application. I've got news for you. It's the wrong approach. Now, before you flame me for my heresy, read the rest of this paragraph. Much like the 60%...

  • How to install SNMP extension agent DLL

    View: 2158    Download: 0   Comment: 0   Author: none  

    How to install SNMP extension agent DLL

    Category: Development Tools
    Fields: none

    0/20 review
    This tutorial is the second part of my previous article "How to develop a SNMP extension agent DLL". Here I shall explain how to install the developed SNMP extension agent DLL in Windows 2000. This agent DLL is from the previous part of this...

  • The Web Developer Checklist : A One-Stop-Shop for Improving the Web

    View: 2639    Download: 0   Comment: 0   Author: none  

    The Web Developer Checklist : A One-Stop-Shop for Improving the Web

    Category: Development Tools
    Fields: Education - Schools

    0/1 review
    I’ve been searching for some time for a single resource that I could go to check a variety of best-practices and methods of improving the performance of my sites and applications and I can now mark that off of my list.

 
Newsletter Email

File suggestion for you

File top downloads

logo codetitle
Codetitle.com - library source code to share, download the file to the community
Copyright © 2015. All rights reserved. codetitle.com Develope by Vinagon .Ltd