Kernel32UpdateResource(SafeModuleHandle, ResourceType, String, UInt16, IntPtr, UInt32) Method

Adds, deletes, or replaces a resource in a portable executable (PE) file.

There are some restrictions on resource updates in files that contain Resource Configuration (RC Config) data: language-neutral (LN) files and language-specific resource (.mui) files.

Definition

Namespace: DevCase.Win32.NativeMethods
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("Kernel32.dll", CharSet = CharSet.Auto, BestFitMapping = false, 
	ThrowOnUnmappableChar = true, SetLastError = true)]
public static bool UpdateResource(
	SafeModuleHandle hUpdate,
	ResourceType resourceType,
	string resourceName,
	ushort languageId,
	IntPtr data,
	uint size
)

Parameters

hUpdate  SafeModuleHandle
A module handle returned by the BeginUpdateResource(String, Boolean) function, referencing the file to be updated.
resourceType  ResourceType
The resource type to be updated.
resourceName  String
The name of the resource to be updated.
languageId  UInt16
The language identifier of the resource to be updated.
data  IntPtr
The resource data to be inserted into the file indicated by hUpdate parameter.

If the resource is one of the predefined types, the data must be valid and properly aligned.

Note that this is the raw binary data to be stored in the file indicated by hUpdate parameter, not the data provided by LoadIcon, LoadString, or other resource-specific load functions.

All data containing strings or text must be in Unicode format. data parameter must not point to ANSI data.

If data parameter is Zero and size parameter is 0, the specified resource is deleted from the file indicated by hUpdate parameter.

size  UInt32
The size, in bytes, of the resource data at data parameter.

Return Value

Boolean
Returns if the function succeeds; otherwise.

To get extended error information, call GetLastWin32Error.

Remarks

See Also