See Index

RSRC Command line

RSRC Executable [-l LocLang] [-u UnlocLang] [-i Types] [-q]
     [   [-t|-d] TextOutput [-c UnlocExecutable]
       | [-a|-r] text-input [-s symbols] [-v]    ]

Executable

Win32 binary to analyse (default), to generate tokens (-t) or dump (-d) from, or containing resources to be replaced (-r) or appended to (-a).

-l LocLang

Restrict processing to the specified localized language. LangId should be specified as a full hex NLS Language id, for example use '-l 409' for US English. Required for replace (-r) operation.

-u UnlocLang

Specifies unlocalized language, defaults to 409 (US English).

-i Types

Restrict processing to listed types. Each type is indicated by a letter as below:

Letter Type Letter Type Letter Type
c Cursors g Message tables n INFs
b Bitmaps v Version info h HTML
i Icons a Accelerators x Binary data
m Menus f Font directories
d Dialogs t Fonts o All others
s Strings r RCDATA a All (default)

-q

Quiet. By default Rsrc displays summary statistics of types and languages of resources processed. -q suppresses all output except warning and error messages.

-t TextOutput

Generate tokens in checkin format.

-d TextOutput

Dump resources in Hex & ASCII format.

-c UnlocExecutable

Compare with unlocalized (English) resources - localised resources in executable are compared with English resources in UnlocExecutable. When the localised resource is bit for bit identical with the English resource RSRC writes a one line unloc token instead of the full resource. Valid only with tokenise (-t) option.

-a TextInput

Append resources from text input file. Every resource in the text file is added to the executable. Resources already in the executable are not removed. When a resource from the token file has the same type, id and language as one in the executable, the executable resource is replaced by the token resource.

-r TextInput

Replace English resources in executable by localised resources from text file. Requires -l parameter to specify localisation language. When a resource from the token file has the same type and id as one in the executable, and the executable resource is US English (409) and the localised resource is in the language specified on the -l parameter, the US English resource is removed.

-s Symbols

Symbol file (.dbg format). When RSRC updates the header checksum in executable, it will also do so in the named symbol file. Valid only with the replace (-r) and append (-a) options.

Miscellaneous options

-v

Update file and product version. By default any file and product version in the token file is ignored during update/append, the file and product versions from the original unlocalised resources are retained.

Definitions

Resource key

The combination of resource type, resource id and resource language. The resource key uniquely identifies the resource. A Win32 executable can contain any combination of languages, ids and types so long as no two resources have the same type, key and language.

Resource type

A numeric or string value. Some numeric values are predefined, for example menus and dialogs, but apps can and do use any value they choose.

Resource id

A numeric or string value. Used by an application to identify the resource when calling FindResource, LoadString etc.

Resource language

An NLS LANGID, i.e. a combination of primary and sub-language, such as 0409 (US English).

Unloc token

A line in the token file specifying a localised resource key followed by '=lang,cksum' where lang is the unlocalised language (usually 0409) and cksum is the checksum of the unlocalised resource. Used when the only difference between the localised and unlocalised resource is the language in the resource key.

Use during localisation checkin process

RSRC LocalisedExecutable -c UnlocExecutable -t Tokens -l LocLang [-u UnlocLang]

Extracts localized tokens for the specified langauge.

Where a resource in the localised executable is bit for bit identical to a resource in the unlocalized executable, the resource content is not written to the token file. In its place RSRC writes an unloc token giving the checksum of the resource and specifying the target language.

Warnings are generated if the localised executable contains resources in languages other than that specified by the -l parameter.

Unlocalised resources for comparison are looked up in the unlocalised executable in the language specified on the -u parameter, default 409 (US ENglish).

Use during the build to update a single language executable

RSRC Executable [-u UnlocLang] -r Tokens -l LocLang -s SymbolFile

Each localised resource in the token file is added to the executable.

Each corresponding unlocalized resource is removed from the executable.

For each unloc token the unlocalized resource is found in the executable and its language is updated to the target localized language recorded in the unloc token.

Tokens of other than the specified localised language are not processed, but generate warnings.

Warnings are generated for any resources not appearing in both the executable and token files.

Warnings are also generated for resources of other than the unlocalised language found in the original executable, and resources of other than the localised language in the token file.

The unlocalised language defaults to 409 (US English).

Use during the build to add resources to a multi-language executable

RSRC Executable [-u UnlocLang] -a Tokens [-l Language] -s SymbolFile

Localised resources from the token file are added to the executable.

For each unloc token the unlocalised resource is found in the executable and copied for the localised language recorded in the unloc token.

If '-l Languge' is specified, only tokens of that language are added. When used with the append (-a) option, '-l Language' applies only to the token file: pre-existing resources in the executable are not affected.

If a resource from the token file matches a resource already in the executable in type, name and language, the executable resource is replaced.

Warnings are generated if any token in the executable is replaced, or if the unlocalised resource corresponding to an unloc token is missing or has a checksum which differs from the unlocalised resource that was passed on the '-u' parameter when the toke file was created.

If the '-l Language' option is used, warnings are generated for any resources of other languages found in the token file.

Token format - resource key and header

A resource may be represented by one or more lines. When a resource is spread over more than one line, all lines except the first are indented by three spaces.

The first line of every resource starts with the resource key as follows:

type,id,language;

This is followed by the codepage recorded in the resource directory. Note that the codepage is not part of the resource key, and is not maintained consistently by all software. In particular:

Winnt.h documents the codepage as follows:

"Each resource data entry ... contains ... a CodePage that should be used when decoding code point values within the resource data. Typically for new applications the code page would be the unicode code page.'

In practise I have never seen the codepage value set to Unicode (1200).

If the '-c' (unlocalised comparison) parameter was provided on the rsrc command, and there was an unlocalised resource with the same type and id, the language and checksum of that unlocalised resource are appended.

Finally, the resource data is represented in one of the forms below, or as 'unloc' if the resource data exactly matches the unlocalised resource found in the file passed by 'c'.

There are thus three possible token key/header formats as follows:

type,id,language;codepage;resource-data

Resource recorded in full, either no '-c' parameter specified, or resource does not exist in unlocalised file.

type,id,language;codepage,unlocalised-checksum,language;resource-data

Resource recorded in full, '-c' parameter was specified, and localised resource image differed from unlocalised resource image.

type,id,language;codepage,unlocalised-checksum,language;'Unloc'

Resource recorded in full, '-c' parameter was specified, and localised resource image was identical to unlocalised resource image.

Token samples - default hex format

For most resource types, RSRC generates resources as a string of hex digits.

For example, the following represents an accelerator resource.

0009,0002,0409;00000000;Hex;00000020:030074008e00000003002e00840000000b0044008400000087002e0084000000

The resource is short, so its hex representation follows the length.

A larger binary resource is represented on multiple lines as follows:

000a,4000,0409;00000000;Hex;0000016a
   00000000:0000640100004c0000000114020000000000c000000000000046830000003508000050130852c8e0bd0170493f38ace1bd016044d085c9e0bd01003000000000000001000000000000000000000000000000590014001f0fe04fd020ea3a6910a2d808002b30309d190023563a5c000000000000000000000000000000000065
   00000080:7c15003100000000003025a49e308857696e6e74000015003100000000002f25d3863508466f6e747300000000490000001c000000010000001c0000003900000000000000480000001d0000000300000063de7d98100000005f535445504853544550485f00563a5c57494e4e545c466f6e7473000010000000050000a02400
   00000100:00004200000060000000030000a05800000000000000737465706800000000000000000000004255867d3048d211b5d8d085029b1cfa4119c94a9f4dd211871f0000000000004255867d3048d211b5d8d085029b1cfa4119c94a9f4dd211871f00000000000000000000

The hex representation is split onto multiple lines each of 128 bytes.

Warnings and errors

Index

  • -a TextInput
  • -c UnlocExecutable
  • -d TextOutput
  • -i Types
  • -l LocLang
  • -q
  • -r TextInput
  • -s Symbols
  • -t TextOutput
  • -u UnlocLang
  • -v
  • Definitions
  • RSRC Command line
  • Resource id
  • Resource key
  • Resource language
  • Resource type
  • Token format - resource key and header
  • Token samples - default hex format
  • Unloc token
  • Use during localisation checkin process
  • Use during the build to add resources to a multi-language executable
  • Use during the build to update a single language executable
  • Warnings and errors