Hi
Given the questions on "why" and VirtualAlloc,VirtualCopy I thought I'd
offer our use of them as well... Basically a C app and the cf app
communicate some data through the VirtualXXXX mechanism as follows:
<sample VB code>
Private ip As IntPtr '//at class level
ip = Win32Api.VirtualAlloc(0, 32, Win32Api.MEM_RESERVE,
Win32Api.PAGE_READWRITE Or Win32Api.PAGE_NOCACHE)
If ip.ToInt32() = 0 Then
'//"VirtualAlloc failed"
Else
If Win32Api.VirtualCopy(ip, PHYS_ADDR, 32, Win32Api.PAGE_READWRITE
Or Win32Api.PAGE_NOCACHE) = True Then
'//TODO Ensure the GC will not write over this memory
Else
'// "VirtualCopy failed"
End If
End If
</sample VB code>
...where ip is an IntPtr that contains data I can marshal into a predefined
struct... the C app uses the same mechanism except of course it writes the
data/pointer...
Cheers
Daniel