Kernel32BeginUpdateResource Method

Retrieves a handle that can be used by the UpdateResource(SafeModuleHandle, ResourceType, IntPtr, UInt16, IntPtr, UInt32) function to add, delete, or replace resources in a binary module.

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 IntPtr BeginUpdateResource(
	string fileName,
	bool deleteExistingResources
)

Parameters

fileName  String
The binary file in which to update resources.

An application must be able to obtain write-access to this file; the file referenced by pFileName cannot be currently executing.

If fileName does not specify a full path, the system searches for the file in the current directory.

deleteExistingResources  Boolean
Indicates whether to delete the fileName parameter's existing resources.

If this parameter is , existing resources are deleted and the updated file includes only resources added with the UpdateResource(SafeModuleHandle, ResourceType, IntPtr, UInt16, IntPtr, UInt32) function.

If this parameter is , the updated file includes existing resources unless they are explicitly deleted or replaced by using UpdateResource(SafeModuleHandle, ResourceType, IntPtr, UInt16, IntPtr, UInt32) function.

Return Value

IntPtr
If the function succeeds, the return value is a handle that can be used by the UpdateResource(SafeModuleHandle, ResourceType, IntPtr, UInt16, IntPtr, UInt32) and EndUpdateResource(SafeModuleHandle, Boolean) functions.

The return value is Zero if the specified file is not a PE (Portable-Executable), the file does not exist, or the file cannot be opened for writing.

To get extended error information, call GetLastWin32Error.

Remarks

See Also