private _Registers GetRegisters(_Registers r) { IntPtr buffer = Marshal.AllocHGlobal(Marshal.SizeOf(r)); Marshal.StructureToPtr(r, buffer, false); NativeMethods.fscc_get_registers(this._handle, buffer); r = (_Registers)Marshal.PtrToStructure(buffer, typeof(_Registers)); Marshal.FreeHGlobal(buffer); return(r); }
private void SetRegisters(_Registers r) { IntPtr buffer = Marshal.AllocHGlobal(Marshal.SizeOf(r)); Marshal.StructureToPtr(r, buffer, false); int e = NativeMethods.fscc_set_registers(this._handle, buffer); Marshal.FreeHGlobal(buffer); switch (e) { case 0: break; case (int)ErrorTypes.FSCC_TIMEOUT: throw new TimeoutException(); default: throw new SystemException(e.ToString()); } }