|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
CopyMemory(buffer, newBuffer, nBytes)?I need to copy the contents of one byte array to another one. I was
hoping to do it quickly uisng the CopyMemory api call. However, I'm getting: FatalExecutionEngineError was detected Message: The runtime has encountered a fatal error. The address of the error was at 0x7f47f8e4, on thread 0x12c4. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack. How do you set things up in order to do the copy? I suspect it might involve the 'managed' feature, but I'm not yet sure exactly how that works... Hello vb,
Check out the Array class. -Boo Show quoteHide quote > I need to copy the contents of one byte array to another one. I was > hoping to do it quickly uisng the CopyMemory api call. However, I'm > getting: > > FatalExecutionEngineError was detected > Message: The runtime has encountered a fatal error. The address of the > error was at 0x7f47f8e4, on thread 0x12c4. The error code is > 0xc0000005. This error may be a bug in the CLR or in the unsafe or > non-verifiable portions of user code. Common sources of this bug > include user marshaling errors for COM-interop or PInvoke, which may > corrupt the stack. > How do you set things up in order to do the copy? I suspect it might > involve the 'managed' feature, but I'm not yet sure exactly how that > works... > "GhostInAK" <p***@paco.net> schrieb: Namely 'Array.Copy' and 'Array.CopyTo'. Note that I'd recommend to use > Check out the Array class. 'Buffer.BlockCopy' as pointed out by Tom for the types it supports. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://dotnet.mvps.org/dotnet/faqs/> vb newbie wrote:
Show quoteHide quote > I need to copy the contents of one byte array to another one. I was Buffer.BlockCopy> hoping to do it quickly uisng the CopyMemory api call. However, I'm > getting: > > FatalExecutionEngineError was detected > Message: The runtime has encountered a fatal error. The address of the > error was at 0x7f47f8e4, on thread 0x12c4. The error code is > 0xc0000005. This error may be a bug in the CLR or in the unsafe or > non-verifiable portions of user code. Common sources of this bug > include user marshaling errors for COM-interop or PInvoke, which may > corrupt the stack. > > How do you set things up in order to do the copy? I suspect it might > involve the 'managed' feature, but I'm not yet sure exactly how that > works... Option Strict On Option Explicit On Imports System Module Module1 Sub Main() Dim array1() As Byte = {1, 2, 3, 4, 5} Dim array2(4) As Byte Buffer.BlockCopy(array1, 0, array2, 0, 5) For Each b As Byte In array2 Console.WriteLine(b) Next End Sub End Module Calling RtlMoveMemory in VB.NET is something that should really be avoided - as it is generally not safe. Addresses can be relocated on the heap unless you pin them, and that can cause performance/memory issues if not managed carefully. -- Tom Shelton
Prevent form minimize
Threading a ShowDialog? - progress form. is there any way to find the position of mouse click on a form dialog to choose folder in vb .net 2005 Minimizing the Console Window SQL datasources Command Prompt or Windows How To Redistribute Office 2003 DLLS OPEN A FILE FOR READ ONLY SQL datasources |
|||||||||||||||||||||||