J
Joe Martin
Has anyone made use of PKWare's PKCDL.DLL for the Implode and Explode
functions?
I have been able to successfully define everything correctly and even
get the invoked function (Explode) to run properly. This means data is
being exploded properly, confirmed with CRC values and reviewing the
actual data.
However just before the unmanaged function exits, I get a null exception
error. I am using:
ReadHandler rh = new ReadHandler(this.ReadData);
WriteHandler wh = new WriteHandler(this.WriteData);
IntPtr buffer = Marshal.AllocHGlobal(bufferSize)
try {
object data = this;
// Invoke DLL here...
PkCdl.Explode(rh, wh, buffer, ref data);
} finally {
Marshal.FreeHGlobal(buffer);
}
to allocate the needed buffer for the DLL. In the corresponding
ReadData/WriteData callback methods, I use the Marshal.Copy() methods to
move data in/out of managed memory.
Now somewhere along the way an the exception happens inside the
try..finally (shown above).
If this rings a bell with anyone, I will gladly supply complete sample
code and would be more than interested in hearing your thoughts.
Thanks,
Joe Martin
functions?
I have been able to successfully define everything correctly and even
get the invoked function (Explode) to run properly. This means data is
being exploded properly, confirmed with CRC values and reviewing the
actual data.
However just before the unmanaged function exits, I get a null exception
error. I am using:
ReadHandler rh = new ReadHandler(this.ReadData);
WriteHandler wh = new WriteHandler(this.WriteData);
IntPtr buffer = Marshal.AllocHGlobal(bufferSize)
try {
object data = this;
// Invoke DLL here...
PkCdl.Explode(rh, wh, buffer, ref data);
} finally {
Marshal.FreeHGlobal(buffer);
}
to allocate the needed buffer for the DLL. In the corresponding
ReadData/WriteData callback methods, I use the Marshal.Copy() methods to
move data in/out of managed memory.
Now somewhere along the way an the exception happens inside the
try..finally (shown above).
If this rings a bell with anyone, I will gladly supply complete sample
code and would be more than interested in hearing your thoughts.
Thanks,
Joe Martin