StorePackageResource

The StorePackageResource function stores resource metadata in the specified package.

BOOL StorePackageResource(
HPACKAGE hPackage, // handle to package file
UINT uID, // resource ID
UINT uType, // resource type
LPVOID lpvData, // resource data buffer
DWORD cbData // buffer size
);

Parameters

hPackage
[in] Handle to an open package file.
 
uID
[in] An unsigned integer which identifies the resource to be stored.
 
uType
[in] An unsigned integer that specifies the resource type.
 
One of the following values may be used:
Value Description
PACKAGE_RESOURCE_BINARY This resource contains a block of binary data. The format and type of data are application specific.
PACKAGE_RESOURCE_TEXT This resource contains a block of text. The text is not null terminated. This resource type is primarily used for text files.
PACKAGE_RESOURCE_STRING This resource is a string and is terminated with a null-byte.
lpvData
[in] A pointer to a buffer that contains the resource data. If this parameter is NULL and the resource specified by the uID parameter exists, the resource is removed from the package.
 
cbData
[in] Specifies the length of the specified buffer.

Return Values

If the StorePackageResource function succeeds, it will return a non-zero value.

If the function fails, it will return a value of zero. To get extended error information, call GetLastError.

Remarks

Valid resource IDs are in the range of 0000h - EFFFh. Values outside of this range are reserved for internal use and will result in an error.

If the specified resource type is PACKAGE_RESOURCE_STRING and the value of the cbData parameter is less than the length of the string, the string data is truncated. Any data beyond the terminating null byte is ignored, regardless of the value of the cbData parameter. If you need to store data which contains embedded nulls, use the PACKAGE_RESOURCE_BINARY type.

The maximum size of any one package resource is approximately 2 billion bytes.

Requirements

Windows NT/2000/XP: Requires Windows NT 4.0 SP3 or later.
Windows 95/98: Requires Windows 95 or later.
Header: Include apatch.h.
Library: Use apatch32.lib.

See Also

LoadPackageResource