CopyMemory API not working 
Author Message
 CopyMemory API not working

Hi,

Can anyone help? I'm trying to get the CopyMemory (RtlMoveMemory) API to
work but it just keeps failing and terminating my application.

I changed the data types for Destination and Source from Any to String and
Integer as Any is not supported in .net

Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (ByRef
Destination As String, ByRef Source As Integer, ByVal Length As Integer)

Any ideas appreciated!

John



Tue, 08 Feb 2005 23:25:26 GMT  
 CopyMemory API not working
John,

Without the specific code, it is hard to determine the
problem.  That said, the error probably has to do with
the intended target or source data type.  Are they arrays
and if so what time? Strings are handled much differentlye
in NET as to earlier systems.  Please include a sample of
the code that includes the identification of the source
and target and the call.

HTH

Pat

Quote:
>-----Original Message-----
>Hi,

>Can anyone help? I'm trying to get the CopyMemory

(RtlMoveMemory) API to
Quote:
>work but it just keeps failing and terminating my
application.

>I changed the data types for Destination and Source from
Any to String and
>Integer as Any is not supported in .net

>Public Declare Sub CopyMemory Lib "kernel32"

Alias "RtlMoveMemory" (ByRef
Quote:
>Destination As String, ByRef Source As Integer, ByVal
Length As Integer)

>Any ideas appreciated!

>John

>.



Wed, 09 Feb 2005 01:44:16 GMT  
 CopyMemory API not working
CopyMemory will not work in dotnet because the memory is managed and can be
moved without notice. Therefore using any API that deals directly with
memory is a bad idea.


Quote:
> John,

> Without the specific code, it is hard to determine the
> problem.  That said, the error probably has to do with
> the intended target or source data type.  Are they arrays
> and if so what time? Strings are handled much differentlye
> in NET as to earlier systems.  Please include a sample of
> the code that includes the identification of the source
> and target and the call.

> HTH

> Pat

> >-----Original Message-----
> >Hi,

> >Can anyone help? I'm trying to get the CopyMemory
> (RtlMoveMemory) API to
> >work but it just keeps failing and terminating my
> application.

> >I changed the data types for Destination and Source from
> Any to String and
> >Integer as Any is not supported in .net

> >Public Declare Sub CopyMemory Lib "kernel32"
> Alias "RtlMoveMemory" (ByRef
> >Destination As String, ByRef Source As Integer, ByVal
> Length As Integer)

> >Any ideas appreciated!

> >John

> >.



Wed, 09 Feb 2005 03:02:08 GMT  
 CopyMemory API not working


Quote:
> CopyMemory will not work in dotnet because the memory is managed and
> can be moved without notice. Therefore using any API that deals
> directly with memory is a bad idea.

Can pin an object in memory so that it doesn't get moved around by the GC.  
See the GCHandle class for information.

--
If you don't like lunchmeat, please remove it from my e-mail address to
send me an e-mail



Wed, 09 Feb 2005 05:30:04 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. CopyMemory API Doesn't work compiled?

2. VB Class do not work with CopyMemory

3. get value of varptr() using copymemory api?

4. Copying an array of UDTs with CopyMemory API

5. CopyMemory API goes crazy!

6. DDEML API call an CopyMemory

7. DestroyWindow API call not working?

8. Calling Win32 API not working

9. user32 API's not working

10. Win API Call not working in vb.net app distributed to WIn 98

11. INIRead API Not working on Win98?

12. SENDMESSAGE api not working on win2000 server

 

 
Powered by phpBB® Forum Software