[DllImport("kernel32.dll", SetLastError=true)]
static extern bool UpdateResource(IntPtr hUpdate, string lpType, string lpName, ushort wLanguage, IntPtr lpData, uint cbData);
<DllImport("kernel32.dll", SetLastError = True)> _
Public Shared Function UpdateResource(ByVal hUpdate As IntPtr, ByVal lpType As String, ByVal lpName as String, ByVal wLanguage as UInt16, ByVal lpData as IntPtr, ByVal cbData as UInt16) As Boolean
End Function
None.
See BeginUpdateResource to get a handle for hUpdate, and EndUpdateResource to apply the update changes.
Sending NULL to lpData and 0 to cbData will delete the file indicated by hUpdate.
Most if not all windows resource names are actually numbers, not strings (but some utilities such as Resource Hacker do not show the data type of the resource name). I'm not actually sure if the data type is unsigned 16 bit, but that's the most conservative choice and it does work.
Please add some!
You can also send a byte[] to lpData with the content of the resource (with byte[] instead of IntPtr as the type for lpData), but I'm not sure how safe this is.
Please add some!
Do you know one? Please contribute it!