T
tsahiasher
hi,
i'm trying to use the Win32 API UpdateResource function to add a file
to an exe file, but somehow i'm getting a NullReferenceException when i
call the function. here is a piece of the code:
GCHandle gch = GCHandle.Alloc(fileBuffComp);
if (UpdateResource(hResource, "FILE", fileName, MakeLangId(0x09,
0x01),
/* */(IntPtr)gch, compFileLen) == false) {
throw new Win32Exception(Marshal.GetLastWin32Error());
}
where fileBuffComp is a byte array containing the file, after i read it
from disk (and compressed it with #ZipLib). the function is declared
like this:
[DllImport("kernel32.dll", SetLastError=true)]
static extern bool UpdateResource(IntPtr hUpdate, String lpType,
String lpName,
ushort wLanguage, IntPtr lpData, uint cbData);
any ideas?
i'm trying to use the Win32 API UpdateResource function to add a file
to an exe file, but somehow i'm getting a NullReferenceException when i
call the function. here is a piece of the code:
GCHandle gch = GCHandle.Alloc(fileBuffComp);
if (UpdateResource(hResource, "FILE", fileName, MakeLangId(0x09,
0x01),
/* */(IntPtr)gch, compFileLen) == false) {
throw new Win32Exception(Marshal.GetLastWin32Error());
}
where fileBuffComp is a byte array containing the file, after i read it
from disk (and compressed it with #ZipLib). the function is declared
like this:
[DllImport("kernel32.dll", SetLastError=true)]
static extern bool UpdateResource(IntPtr hUpdate, String lpType,
String lpName,
ushort wLanguage, IntPtr lpData, uint cbData);
any ideas?