Kernel32UpdateResource(SafeModuleHandle, String, IntPtr, 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.
Namespace: DevCase.Win32.NativeMethodsAssembly: 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,
string resourceType,
IntPtr resourceId,
ushort languageId,
IntPtr data,
uint size
)
<DllImportAttribute("Kernel32.dll", CharSet := CharSet.Auto, BestFitMapping := false,
ThrowOnUnmappableChar := true, SetLastError := true>]
Public Shared Function UpdateResource (
hUpdate As SafeModuleHandle,
resourceType As String,
resourceId As IntPtr,
languageId As UShort,
data As IntPtr,
size As UInteger
) As Boolean
Dim hUpdate As SafeModuleHandle
Dim resourceType As String
Dim resourceId As IntPtr
Dim languageId As UShort
Dim data As IntPtr
Dim size As UInteger
Dim returnValue As Boolean
returnValue = Kernel32.UpdateResource(hUpdate,
resourceType, resourceId, languageId,
data, size)
public:
[DllImportAttribute(L"Kernel32.dll", CharSet = CharSet::Auto, BestFitMapping = false,
ThrowOnUnmappableChar = true, SetLastError = true)]
static bool UpdateResource(
SafeModuleHandle^ hUpdate,
[InAttribute] String^ resourceType,
[InAttribute] IntPtr resourceId,
unsigned short languageId,
IntPtr data,
unsigned int size
)
[<DllImportAttribute("Kernel32.dll", CharSet = CharSet.Auto, BestFitMapping = false,
ThrowOnUnmappableChar = true, SetLastError = true)>]
static member UpdateResource :
hUpdate : SafeModuleHandle *
resourceType : string *
resourceId : IntPtr *
languageId : uint16 *
data : IntPtr *
size : uint32 -> bool
No code example is currently available or this language may not be supported.
- hUpdate SafeModuleHandle
-
A module handle returned by the BeginUpdateResource(String, Boolean) function,
referencing the file to be updated.
- resourceType String
-
The resource type to be updated.
- resourceId IntPtr
-
The integer identifier of the resource.
- 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.
Boolean
Returns
if the function succeeds;
otherwise.
To get extended error information, call
GetLastWin32Error.