// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Runtime.InteropServices; class MainClass { [DllImport("D:\\IDEProjects\\VisualStudio\\PtrPtrPtr\\Release\\PtrPtrPtr.dll")] private static extern IntPtr ptrptrptr(); public static void Main(string[] args) { IntPtr ppp = ptrptrptr(); IntPtr pp1 = Marshal.ReadIntPtr(ppp, 0); IntPtr pp2 = Marshal.ReadIntPtr(ppp, 4); IntPtr p1 = Marshal.ReadIntPtr(pp1, 0); IntPtr p2 = Marshal.ReadIntPtr(pp1, 4); IntPtr p3 = Marshal.ReadIntPtr(pp1, 8); IntPtr p4 = Marshal.ReadIntPtr(pp2, 0); IntPtr p5 = Marshal.ReadIntPtr(pp2, 4); IntPtr p6 = Marshal.ReadIntPtr(pp2, 8); string s1 = Marshal.PtrToStringAnsi(p1); string s2 = Marshal.PtrToStringAnsi(p2); string s3 = Marshal.PtrToStringAnsi(p3); string s4 = Marshal.PtrToStringAnsi(p4); string s5 = Marshal.PtrToStringAnsi(p5); string s6 = Marshal.PtrToStringAnsi(p6); Console.WriteLine(s1 + " " + s2 + " " + s3 + " " + s4 + " " + s5 + " " + s6); } }