Example #1
0
 void ReadSetup()
 {
     //ConnSetupFailedRep frep = new ConnSetupFailedRep ();
     //setup = new ConnSetupSuccessRep ();
     xrr.ReadSetupResponse();
     setup = xrr.succ;
 }
Example #2
0
        public object MarshalNativeToManaged(IntPtr pNativeData)
        {
            ConnSetupSuccessRep rep = new ConnSetupSuccessRep();

            Trace.WriteLine("m");

            GCHandle gch;

            gch = GCHandle.Alloc(rep);

            IntPtr startPtr = gch.AddrOfPinnedObject();
            int    sz       = Marshal.SizeOf(rep);

            Trace.WriteLine(sz);

            for (int i = 0; i != sz; i++)
            {
                Marshal.WriteByte(startPtr, i, Marshal.ReadByte(pNativeData, i));
            }

            gch.Free();

            Trace.WriteLine("vendorlen: " + rep.VendorLen);

            /*
             * IntPtr newSz = new IntPtr (sz + rep.VendorLen);
             * Marshal.ReAllocHGlobal (startPtr, newSz);
             */

            //IntPtr nu = Marshal.AllocHGlobal (new IntPtr (rep.VendorLen));
            //for (int i = 0 ; i != rep.VendorLen ; i++) {
            //	Marshal.WriteByte (nu, i, Marshal.ReadByte (pNativeData, i));
            //}

            IntPtr nu  = new IntPtr((int)pNativeData + 40);
            string str = Marshal.PtrToStringAnsi(nu, rep.VendorLen);

            Trace.WriteLine("str: " + str);
            //rep.Vendor = str;

            //Marshal.PtrToStructure(ptr, typeof()

            //Marshal.ReAllocCoTaskMem (pNativeData, sz + 40);
            //Marshal.ReAllocHGlobal (pNativeData, new IntPtr (sz + 40));



            return(rep);
        }
Example #3
0
		public object MarshalNativeToManaged (IntPtr pNativeData)
		{
			ConnSetupSuccessRep rep = new ConnSetupSuccessRep ();
			Trace.WriteLine ("m");

			GCHandle gch;
			
			gch = GCHandle.Alloc (rep);
			
			IntPtr startPtr = gch.AddrOfPinnedObject ();
			int sz = Marshal.SizeOf (rep);

			Trace.WriteLine (sz);

			for (int i = 0 ; i != sz ; i++) {
				Marshal.WriteByte (startPtr, i, Marshal.ReadByte (pNativeData, i));
			}
			
			gch.Free ();
			
			Trace.WriteLine ("vendorlen: " + rep.VendorLen);

			/*
			IntPtr newSz = new IntPtr (sz + rep.VendorLen);
			Marshal.ReAllocHGlobal (startPtr, newSz);
			*/

			//IntPtr nu = Marshal.AllocHGlobal (new IntPtr (rep.VendorLen));
			//for (int i = 0 ; i != rep.VendorLen ; i++) {
			//	Marshal.WriteByte (nu, i, Marshal.ReadByte (pNativeData, i));
			//}

			IntPtr nu = new IntPtr ((int)pNativeData + 40);
			string str = Marshal.PtrToStringAnsi (nu, rep.VendorLen);
			Trace.WriteLine ("str: " + str);
			//rep.Vendor = str;
			
			//Marshal.PtrToStructure(ptr, typeof()
			
			//Marshal.ReAllocCoTaskMem (pNativeData, sz + 40);
			//Marshal.ReAllocHGlobal (pNativeData, new IntPtr (sz + 40));



			return rep;
		}
Example #4
0
		void ReadSetup ()
		{
			//ConnSetupFailedRep frep = new ConnSetupFailedRep ();
			//setup = new ConnSetupSuccessRep ();
			xrr.ReadSetupResponse ();
			setup = xrr.succ;
		}