Skip to content

Commit

Permalink
Merge pull request #62 from icnocop/master
Browse files Browse the repository at this point in the history
signed InstallerLib with a strong name
  • Loading branch information
dblock committed Feb 16, 2014
2 parents 2b4eb53 + bf80460 commit 2000eff
Show file tree
Hide file tree
Showing 24 changed files with 7,394 additions and 103 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -12,6 +12,8 @@ Bugs
Misc
--------

* Added a password unprotected strong key (dni.key) and signing InstallerLib.dll - [@icnocop](https://github.com/icnocop).

2.3 (1/6/2013)
==============

Expand Down
2 changes: 1 addition & 1 deletion Documentation/Content/ThirdPartyLicenses.aml
Expand Up @@ -56,7 +56,7 @@
<linkText>http://resourcelib.codeplex.com/</linkText>
<linkUri>http://resourcelib.codeplex.com/</linkUri>
</externalLink> for more information.
<code language="text" source="..\ThirdParty\ResourceLib\license.txt" />
<code language="text" source="..\ThirdParty\ResourceLib\LICENSE" />
</para>
</content>
</section>
Expand Down
5 changes: 5 additions & 0 deletions InstallerLib/InstallerLib.csproj
Expand Up @@ -22,6 +22,8 @@
</SccAuxPath>
<SccProvider>
</SccProvider>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>dni.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down Expand Up @@ -131,6 +133,9 @@
<Name>CabLib</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="dni.snk" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
Binary file added InstallerLib/dni.snk
Binary file not shown.
77 changes: 77 additions & 0 deletions ThirdParty/ResourceLib/CHANGELOG.md
@@ -0,0 +1,77 @@
### Next Release

* [#9](https://github.com/dblock/resourcelib/pull/9): Added a strong signature to the .NET assembly - [@dwmkerr](https://github.com/dwmkerr).

### 1.4 (3/3/2013)

**New Features**

* [#2](https://github.com/dblock/resourcelib/pull/2): Added `VersionResource.FileFlags` - [@alaendle](https://github.com/alaendle).

**Misc**

* Updated solution to Visual Studio 2010 - [@redwyre](https://github.com/redwyre).
* Added NUGet references for `NUnit`, `NUnit.Runners`, and `MSBuildTasks` - [@redwyre](https://github.com/redwyre).
* Added more options to build.cmd: `code`, `code_and_test` and `run_test_only` - [@redwyre](https://github.com/redwyre).
* Documentation rewritten in markdown - [@dblock](https://github.com/dblock).

### 1.3 (5/28/2012

**Misc**

* First release off [Github](https://github.com/dblock/resourcelib).
* Added `LoadException` that is thrown on a resource enumeration failure that contains both the resource load (inner) exception and the outer Win32 resource enumeration (outer) exception.
* Added `ResourceId.TypeName` that returns the string representation of the resource type when the ID represents one.
* Added documentation on contributing and setting up a development environment.

**Bugs**

* Bug: `ManifestResource.LoadFrom(string filename, ManifestType manifestType)` broken.
* Bug: `ManifestResource.Manifest` fails to load Unicode XML manifests with BOM.
* Bug: `DeviceIndependentBitmap.Image` cuts bitmap height in half.
* Bug: `RT_MENU` broken for extended `MENUEX` resources.

### 1.2 (9/22/2009)

**New Features**

* Added support for `RT_MANIFEST`, Windows SxS XML resources.
* Added support for `RT_GROUP_CURSOR` and `RT_CURSOR` cursor resources, including loading .cur files and manipulating hotspot information.
* Added support for `RT_BITMAP`, bitmap resources.
* Added support for `RT_DIALOG`, dialog resources.
* Added support for `RT_STRING`, string resources.
* Added support for `RT_MENU`, menu resources.
* Added support for `RT_ACCELERATOR`, accelerator resources.
* Added limited support for `RT_FONTDIR` and `RT_FONT`, font resources.

**Misc**

* Added support for version resources with an omitted `VS_FIXEDFILEINFO`.
* Added `Resource.TypeName` that provides a string representation of the resource type.
* Added `StringTable.CodePage` and `StringTable.LanguageID` properties.
* Added `GenericResource.Data` read-only data bytes for unsupported resource types.
* Interface change: renamed `StringResource` to `StringTableEntry` to accommodate for actual string resource support.
* Interface change: added `ResourceId` that represents well-known and custom resources alike and provides comparison and hashing that works for all resource Id types. Both `Resource.Name` and `Resource.Type` now return `ResourceId` and public interfaces that accepted an `IntPtr` now require a `ResourceId`.
* Interface change: `GroupIconResource` was renamed to `IconDirectoryResource`.
* `Resource.Name` is no longer read-only.
* `IconImage` was extended and renamed to `DeviceIndependentBitmap`. The latter supports separating mask and color, etc.
* Automatically appending a second null-terminator to `StringResource` when required. Internal storage is now always with two null terminators.
* Added VersionResource.ToString() that returns a standard resource file string representation of the version resource and all its tables.

**Bugs**

* Bug: error deleting an English version resource which was loaded as language-neutral.
* Bug: custom resources with literal string names return an invalid value in ` Resource.Name` and `Resource.Type`.
* Bug: `StringResource` length in its header is incorrect after the value is updated.
* Bug: `VersionResource.Write` erroneously included padding in the structure size.

### 1.1 (2/19/2009)

* First release off [CodePlex](http://resourcelib.codeplex.com).
* Added support for `RT_GROUP_ICON` and `RT_ICON`, icon resources.

### 1.0 (6/30/2008)

* First release, [ CodeProject Article](http://www.codeproject.com/KB/library/ResourceLib.aspx).
* Support for `RT_VERSION` and `VS_VERSIONINFO`, version resources.

63 changes: 63 additions & 0 deletions ThirdParty/ResourceLib/Docs/Accelerator.md
@@ -0,0 +1,63 @@
Accelerator (RT_ACCELERATOR)
============================

An accelerator is a keystroke defined by the application to give the user a quick way to perform a task.

When `ResourceInfo` encouters a resource of type 9 (`RT_ACCELERATOR`), it creates an object of type `AcceleratorResource` which contains a collection of instances of `Accelerator`.

Reading Accelerator Resources
-----------------------------

The following example loads all accelerator resources from a file.

``` csharp
string filename = Path.Combine(Environment.GetEnvironmentVariable("WINDIR"), "explorer.exe");
using (ResourceInfo ri = new ResourceInfo())
{
ri.Load(filename);
foreach(AcceleratorResource rc in ri[Kernel32.ResourceTypes.RT_ACCELERATOR])
{
Console.WriteLine("AcceleratorResource: {0}, {1}", rc.Name, rc.TypeName);
Console.WriteLine(rc);
}
}
```

`Explorer.exe` contains the following accelerator table.

```
Resource: 251 of type RT_ACCELERATOR, 88 byte(s) [en-US]
251 ACCELERATORS
BEGIN
VK_F4, 305, ALT
VK_TAB, 41008, VIRTKEY , NOINVERT
VK_TAB, 41008, VIRTKEY , NOINVERT , SHIFT
VK_TAB, 41008, VIRTKEY , NOINVERT , CONTROL
VK_TAB, 41008, VIRTKEY , NOINVERT , SHIFT , CONTROL
VK_F5, 41061, VIRTKEY , NOINVERT
VK_F6, 41008, VIRTKEY , NOINVERT
VK_RETURN, 413, VIRTKEY , NOINVERT , ALT
Z, 416, VIRTKEY , NOINVERT , CONTROL
VK_F3, 41093, VIRTKEY , NOINVERT
M, 419, VIRTKEY , NOINVERT , ALT
END
```

Reading Specific Accelerator Resources
--------------------------------------

The following example loads a single accelerator resource directly, without enumerating all resources.

``` csharp
string filename = Path.Combine(Environment.GetEnvironmentVariable("WINDIR"), "explorer.exe");
AcceleratorResource rc = new AcceleratorResource();
rc.Name = new ResourceId(251);
rc.LoadFrom(filename);
Console.WriteLine("AcceleratorResource: {0}, {1}", rc.Name, rc.TypeName);
Console.WriteLine(rc);
```

Writing an Accelerator Table
----------------------------

In order to add an accelerator into an executable (`.exe` or `.dll`) create a new instance of `AcceleratorResource` or load an existing one and add instances of `Accelerator` to its `Accelerators` collection.
66 changes: 66 additions & 0 deletions ThirdParty/ResourceLib/Docs/Bitmap.md
@@ -0,0 +1,66 @@
Bitmap (RT_BITMAP)
==================

When `ResourceInfo` encouters a resource of type 2 (`RT_BITMAP`), it creates an object of type `BitmapResource` which contains a `DeviceIndependentBitmap`.

Reading Bitmap Resources
------------------------

The following example loads all bitmap resources from a file.

``` csharp
string filename = Path.Combine(Environment.SystemDirectory, "msftedit.dll");
using (ResourceInfo ri = new ResourceInfo())
{
ri.Load(filename);
foreach(BitmapResource rc in ri[Kernel32.ResourceTypes.RT_BITMAP])
{
Console.WriteLine("BitmapResource: {0}, {1}", rc.Name, rc.TypeName);
Console.WriteLine("DIB: {0}x{1} {2}", rc.Bitmap.Image.Width, rc.Bitmap.Image.Height,
rc.Bitmap.Header.PixelFormatString);
}
}
```

`Msftedit.dll` contains several 4-bit 16 color resources.

```
BitmapResource: 125, RT_BITMAP
DIB: 28x14 4-bit 16 Colors
BitmapResource: 126, RT_BITMAP
DIB: 28x14 4-bit 16 Colors
...
```

Reading Specific Bitmap Resources
---------------------------------

The following example loads a single bitmap resource directly, without enumerating all resources.

``` csharp
string filename = Path.Combine(Environment.SystemDirectory, "msftedit.dll");
BitmapResource rc = new BitmapResource();
rc.Name = new ResourceId(125);
rc.LoadFrom(filename);
Console.WriteLine("BitmapResource: {0}, {1}", rc.Name, rc.TypeName);
Console.WriteLine("DIB: {0}x{1} {2}", rc.Bitmap.Image.Width, rc.Bitmap.Image.Height, rc.Bitmap.Header.PixelFormatString);
```

`Msftedit.dll` contains a 4-bit 16 color resource under Id 125.

```
BitmapResource: 125, RT_BITMAP
DIB: 28x14 4-bit 16 Colors
```

Writing Bitmap Resources
------------------------

In order to embed an existing bitmap from a `.bmp` file into an executable (`.exe` or `.dll`) we load the `.bmp` file and assign it to a bitmap of a `BitmapResource`. The structure in a `.bmp` file consits of a `BITMAPFILEINFO` header followed by the device independent bitmap.

``` csharp
BitmapFile bitmapFile = new BitmapFile("Bitmap1.bmp");
BitmapResource bitmapResource = new BitmapResource();
bitmapResource.Name = new ResourceId("TEST");
bitmapResource.SaveTo("test.dll");
```
30 changes: 30 additions & 0 deletions ThirdParty/ResourceLib/Docs/Contributing.md
@@ -0,0 +1,30 @@
Contributing
============

You're encouraged to contribute to the ResourceLib project. The latest information about this project and source code can be found at [https://github.com/dblock/resourcelib](https://github.com/dblock/resourcelib).

Setting Up a Development Environment
------------------------------------

A development environment requires the following software.

* A GIT Client
* Microsoft Visual Studio 2010
* NuGet

Building the Project
--------------------

You can build all C# source code in Visual Studio. To build the entire project, use MSBuild from command line and type `build all`. This builds both Debug and Release .NET binaries as well as a final `.zip` package with all artifacts.

``` dos
c:\source\resourcelib> build all
```

A `Vestris.ResourceLib.zip` package is created in the `target` directory.

Patches
-------

Fork the project on Github, commit changes to your local repository, push changes to your fork, and make a pull request. Bonus points for topic branches.

53 changes: 53 additions & 0 deletions ThirdParty/ResourceLib/Docs/Cursor.md
@@ -0,0 +1,53 @@
Cursor (RT_CURSOR, RT_GROUP_CURSOR)
===================================

When `ResourceInfo` encouters a resource of type 12 (`RT_GROUP_CURSOR`), it creates an object of type `CursorDirectoryResource`. The latter creates a `CursorResource`, which loads an `DeviceIndependentBitmap`.

* A `CursorDirectoryResource` represents a collection of cursor resources.
* A `CursorResource` represents a single cursor with multiple images of type `DeviceIndependentBitmap`.
* A `DeviceIndependentBitmap` is not a resource, but raw data embedded in the file at an offset defined by the cursor resource and represents a single cursor bitmap. This data includes the image's XOR bitmap followed by its AND bitmap. These two bitmaps are used together to support transparency.

Reading Cursor Resources
------------------------

The following example loads a known cursor resource directly from `guitils.dll`, without enumerating all resources.

``` csharp
string filename = Path.Combine(Environment.GetEnvironmentVariable("WINDIR"), "gutils.dll");
CursorDirectoryResource rc = new CursorDirectoryResource();
rc.Name = new ResourceId("HORZLINE");
rc.LoadFrom(filename);
Console.WriteLine("CursorDirectoryResource: {0}, {1}", rc.Name, rc.TypeName);
foreach (CursorResource cursor in rc.Icons)
{
Console.WriteLine(" Cursor {0}: {1} ({2} byte(s)), hotspot @ {3}:{4}",
cursor.Header.nID, cursor.ToString(), cursor.ImageSize, cursor.HotSpotX, cursor.HotSpotY);
}
```

`GUtils.dll` contains two cursor groups, including "HORZLINE". The following output is generated from the example above.

```
CursorDirectoryResource: HORZLINE, RT_GROUP_CURSOR
Cursor 2: 32x0 1-bit B/W (308 byte(s)), hotspot @ 16:16
```

Writing Cursor Resources
------------------------

In order to embed an existing cursor from a `.cur` file into an executable (`.exe` or `.dll`) we load the `.cur` file and convert it to a `CursorDirectoryResource`. The structure in a `.cur` file is similar to the structure of the cursor in an executable with two major differences: the executable stores cursor hotspot information and the header contains the cursor Id, while a `.cur` header simply contains the offset of cursor data.

It's important to identify existing cursor resources in the executable and define the cursor Id. For example, if there're 2 existing `RT_GROUP_CURSOR` resources in the target binary, the added resource's Id must be 3.

``` csharp
CursorFile cursorFile = new CursorFile("Cursor1.ico");
CursorDirectoryResource cursorDirectoryResource = new CursorDirectoryResource(cursorFile);
cursorDirectoryResource.Name = new ResourceId("TEST");
cursorDirectoryResource.Language = ResourceUtil.USENGLISHLANGID;
cursorDirectoryResource.Icons[0].Id = 3;
cursorDirectoryResource.Icons[0].HotSpotX = 12;
cursorDirectoryResource.Icons[0].HotSpotY = 12;
cursorDirectoryResource.Icons[0].Language = ResourceUtil.USENGLISHLANGID;
cursorDirectoryResource.SaveTo("test.dll");
```

0 comments on commit 2000eff

Please sign in to comment.