Stablupd.exe Manipulate String Resources in an Executable |
Q196774
The information in this article applies to:
- Microsoft Win32 Application Programming Interface (API), used with:
- Microsoft Windows NT Server version 4.0
- Microsoft Windows NT Workstation version 4.0
- Microsoft Windows 95
- Microsoft Windows 98
- the operating system: Microsoft Windows 2000
SUMMARY
The Stablupd sample explains the internal format of string table resource in a Win32 executable. It shows how to manipulate the string resource.
The sample provides a set of functions to manipulate blocks of strings in a Win32 executable and a user interface (UI) to illustrate how to display and modify strings. You can modify the strings only on Windows NT; Windows 95 and Windows 98 do not allow modification of strings.
MORE INFORMATION
The following file is available for download from the Microsoft Download Center:
Release Date: Oct-13-2000
For additional information about how to download Microsoft Support files, click the article number below to view the article in the Microsoft Knowledge Base:
Q119591 How to Obtain Microsoft Support Files from Online Services
Microsoft used the most current virus detection software available on the date of posting to scan this file for viruses. Once posted, the file is housed on secure servers that prevent any unauthorized changes to the file.
String resources are stored in a Win32 executable as blocks of strings. Each block can have up to sixteen strings and represents the smallest granularity of string resource that can be loaded/updated. Each block is identified by an identifier (ID), starting with one (1). We use this ID when calling the FindResource, LoadResource and UpdateResource functions.
A string with ID, nStringID, is located in the block with ID, nBlockID, given by the following formula:
nBlockID = (nStringID / 16) + 1; // Note integer division.
Each block has sixteen strings, each represented as an ordered pair (LENGTH, TEXT). LENGTH is a WORD that specifies the size, in terms of the number of characters, in the TEXT that follows. TEXT follows LENGTH and contains the string in Unicode without the NULL terminating character. There may be no characters in TEXT, in which case LENGTH is zero.
An executable does not have a string table block with ID, nBlockID, if it does not have any strings with IDs: ((nBlockID - 1) * 16) through ((nBlockID * 16) - 1).
The format is the same in all platforms--Windows NT, Windows 95, and Windows 98. To modify the strings, the sample uses the UpdateResource function. Because this function is not implemented on Windows 95 and Windows 98, modification of strings is not allowed on these platforms.
Additional query words: kbDSupport
Keywords : kbfile kbsample kbOSWinNT400 kbOSWin2000 kbResource kbSDKPlatform kbString kbGrpDSUser kbOSWin95 kbOSWin98
Issue type : kbhowto
Technology : kbAudDeveloper kbWin32sSearch kbWin32API
Last Reviewed: December 17, 2000 |