I'm trying to get some unmanaged code into csharp. I'm using Visual C# 2010.
Things seem to be going ok, except that when I get a struct from the unmanaged code, some of the strings seem to be missing a few characters in the beginning while others are not. There may be other problems too, but it's actually hard for me to check all the data in the test environment.
It would be greatly appreciated if anyone could please let me know if there are any obvious problems with the way I'm using the struct.
Here is the struct in c#. I used the "CLRInsideOut" program to convert the bulk of it for me. I was originally having a problem where an invalid function pointer was being passed in, so I switched the delegates to IntPtrs.
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential, CharSet = System.Runtime.InteropServices.CharSet.Ansi)]
public struct tODControl
{
/// char[60]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 60)]
public string info_path;
/// DWORD->unsigned int
public uint baud;
/// DWORD->unsigned int
public uint od_connect_speed;
/// INT16->short
public short od_com_address;
/// BYTE->unsigned char
public byte od_com_irq;
/// BYTE->unsigned char
public byte od_com_method;
/// BYTE->unsigned char
public byte od_com_flow_control;
/// WORD->unsigned short
public ushort od_com_rx_buf;
/// WORD->unsigned short
public ushort od_com_tx_buf;
/// BYTE->unsigned char
public byte od_com_fifo_trigger;
/// BOOL->int
public int od_com_no_fifo;
/// BOOL->int
public int od_no_fossil;
/// BOOL->int
public int od_use_socket;
/// INT16->short
public short port;
/// DWORD->unsigned int
public uint od_open_handle;
/// char[40]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 40)]
public string system_name;
/// char[40]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 40)]
public string sysop_name;
/// INT32->int
public int system_calls;
/// char[36]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 36)]
public string system_last_caller;
/// char[9]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 9)]
public string timelog_start_date;
/// INT16[24]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst = 24, ArraySubType = System.Runtime.InteropServices.UnmanagedType.I2)]
public short[] timelog_busyperhour;
/// INT16[7]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst = 7, ArraySubType = System.Runtime.InteropServices.UnmanagedType.I2)]
public short[] timelog_busyperday;
/// char[36]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 36)]
public string user_name;
/// char[26]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 26)]
public string user_location;
/// char[16]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 16)]
public string user_password;
/// char[16]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 16)]
public string user_dataphone;
/// char[16]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 16)]
public string user_homephone;
/// char[6]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 6)]
public string user_lasttime;
/// char[9]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 9)]
public string user_lastdate;
/// BYTE->unsigned char
public byte user_attribute;
/// BYTE[4]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = System.Runtime.InteropServices.UnmanagedType.I1)]
public byte[] user_flags;
/// DWORD->unsigned int
public uint user_net_credit;
/// DWORD->unsigned int
public uint user_pending;
/// WORD->unsigned short
public ushort user_messages;
/// DWORD->unsigned int
public uint user_lastread;
/// WORD->unsigned short
public ushort user_security;
/// DWORD->unsigned int
public uint user_numcalls;
/// DWORD->unsigned int
public uint user_uploads;
/// DWORD->unsigned int
public uint user_downloads;
/// DWORD->unsigned int
public uint user_upk;
/// DWORD->unsigned int
public uint user_downk;
/// DWORD->unsigned int
public uint user_todayk;
/// WORD->unsigned short
public ushort user_time_used;
/// WORD->unsigned short
public ushort user_screen_length;
/// BYTE->unsigned char
public byte user_last_pwdchange;
/// BYTE->unsigned char
public byte user_attrib2;
/// WORD->unsigned short
public ushort user_group;
/// BYTE->unsigned char
public byte event_status;
/// char[6]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 6)]
public string event_starttime;
/// BYTE->unsigned char
public byte event_errorlevel;
/// BYTE->unsigned char
public byte event_days;
/// BYTE->unsigned char
public byte event_force;
/// char[9]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 9)]
public string event_last_run;
/// BYTE->unsigned char
public byte user_netmailentered;
/// BYTE->unsigned char
public byte user_echomailentered;
/// char[6]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 6)]
public string user_logintime;
/// char[9]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 9)]
public string user_logindate;
/// INT16->short
public short user_timelimit;
/// INT32->int
public int user_loginsec;
/// INT32->int
public int user_credit;
/// WORD->unsigned short
public ushort user_num;
/// INT16->short
public short user_readthru;
/// INT16->short
public short user_numpages;
/// INT16->short
public short user_downlimit;
/// char[6]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 6)]
public string user_timeofcreation;
/// char[16]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 16)]
public string user_logonpassword;
/// BYTE->unsigned char
public byte user_wantchat;
/// BYTE->unsigned char
public byte user_ansi;
/// INT16->short
public short user_deducted_time;
/// char[450]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 450)]
public string user_menustack;
/// BYTE->unsigned char
public byte user_menustackpointer;
/// char[36]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 36)]
public string user_handle;
/// char[81]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 81)]
public string user_comment;
/// char[9]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 9)]
public string user_firstcall;
/// BYTE[200]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst = 200, ArraySubType = System.Runtime.InteropServices.UnmanagedType.I1)]
public byte[] user_combinedrecord;
/// char[9]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 9)]
public string user_birthday;
/// char[9]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 9)]
public string user_subdate;
/// BYTE->unsigned char
public byte user_screenwidth;
/// BYTE->unsigned char
public byte user_language;
/// BYTE->unsigned char
public byte user_date_format;
/// char[36]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 36)]
public string user_forward_to;
/// BYTE->unsigned char
public byte user_error_free;
/// BYTE->unsigned char
public byte sysop_next;
/// BYTE->unsigned char
public byte user_emsi_session;
/// char[41]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 41)]
public string user_emsi_crtdef;
/// char[41]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 41)]
public string user_emsi_protocols;
/// char[41]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 41)]
public string user_emsi_capabilities;
/// char[41]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 41)]
public string user_emsi_requests;
/// char[41]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 41)]
public string user_emsi_software;
/// BYTE->unsigned char
public byte user_hold_attr1;
/// BYTE->unsigned char
public byte user_hold_attr2;
/// BYTE->unsigned char
public byte user_hold_len;
/// char[78]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 78)]
public string user_reasonforchat;
/// char[12]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 12)]
public string user_callsign;
/// WORD->unsigned short
public ushort user_msg_area;
/// WORD->unsigned short
public ushort user_file_area;
/// char
public byte user_protocol;
/// WORD->unsigned short
public ushort user_file_group;
/// BYTE->unsigned char
public byte user_last_birthday_check;
/// char
public byte user_sex;
/// DWORD->unsigned int
public uint user_xi_record;
/// WORD->unsigned short
public ushort user_msg_group;
/// BYTE->unsigned char
public byte user_avatar;
/// char[51]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 51)]
public string user_org;
/// char[153]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 153)]
public string user_address;
/// INT32->int
public int user_pwd_crc;
/// INT32->int
public int user_logon_pwd_crc;
/// char[9]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 9)]
public string user_last_cost_menu;
/// WORD->unsigned short
public ushort user_menu_cost;
/// BYTE->unsigned char
public byte user_rip;
/// BYTE->unsigned char
public byte user_rip_ver;
/// BYTE->unsigned char
public byte user_attrib3;
/// BOOL->int
public int user_expert;
/// char[36]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 36)]
public string system_last_handle;
/// BYTE->unsigned char
public byte od_info_type;
/// BYTE->unsigned char
public byte od_extended_info;
/// WORD->unsigned short
public ushort od_node;
/// BYTE->unsigned char
public byte od_ra_info;
/// BOOL->int
public int od_always_clear;
/// BOOL->int
public int od_force_local;
/// BOOL->int
public int od_chat_active;
/// BOOL->int
public int od_current_statusline;
/// INT16->short
public short od_error;
/// BYTE->unsigned char
public byte od_last_input;
/// BOOL->int
public int od_logfile_disable;
/// char[80]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 80)]
public string od_logfile_name;
/// WORD->unsigned short
public ushort od_maxtime;
/// INT16->short
public short od_maxtime_deduction;
/// BOOL->int
public int od_okaytopage;
/// INT16->short
public short od_pagestartmin;
/// INT16->short
public short od_pageendmin;
/// BOOL->int
public int od_page_pausing;
/// INT16->short
public short od_page_statusline;
/// BOOL->int
public int od_user_keyboard_on;
/// BOOL->int
public int od_update_status_now;
/// INT16->short
public short od_cur_attrib;
/// char[8]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 8)]
public string od_box_chars;
/// char[1584]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 1584)]
public string od_cfg_text;
/// char[825]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 825)]
public string od_cfg_lines;
/// OD_COMPONENT*
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.SysUInt)]
public System.IntPtr od_config_file;
/// char*
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.SysUInt)]
public System.IntPtr od_config_filename;
/// _od_config_function
//public _od_config_function AnonymousMember1;
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.SysUInt)]
public System.IntPtr AnonymousMember1;
/// char
public byte od_color_char;
/// char
public byte od_color_delimiter;
/// char[396]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 396)]
public string od_color_names;
/// BOOL->int
public char od_clear_on_exit;
///// _od_cmd_line_handler
//public _od_cmd_line_handler AnonymousMember2;
///// _od_cmd_line_help_func
//public _od_cmd_line_help_func AnonymousMember3;
///// _od_default_personality
//public _od_default_personality AnonymousMember4;
/// _od_cmd_line_handler
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.SysUInt)]
public System.IntPtr AnonymousMember2;
/// _od_cmd_line_help_func
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.SysUInt)]
public System.IntPtr AnonymousMember3;
/// _od_default_personality
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.SysUInt)]
public System.IntPtr AnonymousMember4;
/// BOOL->int
public char od_default_rip_win;
/// WORD->unsigned short
public ushort od_disable;
/// char[40]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 40)]
public string od_disable_dtr;
/// BOOL->int
public char od_disable_inactivity;
/// BOOL->int
public char od_emu_simulate_modem;
/// BYTE[8]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = System.Runtime.InteropServices.UnmanagedType.I1)]
public byte[] od_errorlevel;
/// BOOL->int
public char od_full_color;
/// BOOL->int
public char od_full_put;
/// WORD->unsigned short
public ushort od_in_buf_size;
/// INT16->short
public short od_inactivity;
/// INT16->short
public short od_inactive_warning;
/// BOOL->int
public char od_internal_debug;
/// DWORD->unsigned int
public uint od_max_key_latency;
/// char
public byte od_list_pause;
/// char
public byte od_list_stop;
/// OD_COMPONENT*
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.SysUInt)]
public System.IntPtr od_logfile;
/// char*[14]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst = 14, ArraySubType = System.Runtime.InteropServices.UnmanagedType.SysUInt)]
public System.IntPtr[] od_logfile_messages;
/// OD_COMPONENT*
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.SysUInt)]
public System.IntPtr od_mps;
/// BOOL->int
public char od_nocopyright;
/// BOOL->int
public char od_noexit;
/// BOOL->int
public char od_no_ra_codes;
/// BYTE->unsigned char
public byte od_page_len;
/// char[40]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 40)]
public string od_prog_copyright;
/// char[40]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 40)]
public string od_prog_name;
/// char[40]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 40)]
public string od_prog_version;
/// DWORD->unsigned int
public uint od_reg_key;
/// char[36]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 36)]
public string od_reg_name;
/// BOOL->int
public char od_silent_mode;
/// BOOL->int
public char od_status_on;
/// BOOL->int
public char od_spawn_freeze_time;
/// BOOL->int
public char od_swapping_disable;
/// BOOL->int
public char od_swapping_noems;
/// char[80]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 80)]
public string od_swapping_path;
///// _od_no_file_func
//public _od_no_file_func AnonymousMember5;
///// _od_before_exit
//public _od_before_exit AnonymousMember6;
///// _od_cbefore_chat
//public _od_cbefore_chat AnonymousMember7;
///// _od_cafter_chat
//public _od_cafter_chat AnonymousMember8;
///// _od_cbefore_shell
//public _od_cbefore_shell AnonymousMember9;
///// _od_cafter_shell
//public _od_cafter_shell AnonymousMember10;
///// _od_config_callback
//public _od_config_callback AnonymousMember11;
///// _od_help_callback
//public _od_help_callback AnonymousMember12;
///// _od_ker_exec
//public _od_ker_exec AnonymousMember13;
///// _od_local_input
//public _od_local_input AnonymousMember14;
///// _od_time_msg_func
//public _od_time_msg_func AnonymousMember15;
/// _od_no_file_func
//public _od_no_file_func AnonymousMember5;
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.SysUInt)]
public System.IntPtr AnonymousMember5;
/// _od_before_exit
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.SysUInt)]
public System.IntPtr AnonymousMember6;
/// _od_cbefore_chat
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.SysUInt)]
public System.IntPtr AnonymousMember7;
/// _od_cafter_chat
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.SysUInt)]
public System.IntPtr AnonymousMember8;
/// _od_cbefore_shell
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.SysUInt)]
public System.IntPtr AnonymousMember9;
/// _od_cafter_shell
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.SysUInt)]
public System.IntPtr AnonymousMember10;
/// _od_config_callback
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.SysUInt)]
public System.IntPtr AnonymousMember11;
/// _od_help_callback
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.SysUInt)]
public System.IntPtr AnonymousMember12;
/// _od_ker_exec
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.SysUInt)]
public System.IntPtr AnonymousMember13;
/// _od_local_input
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.SysUInt)]
public System.IntPtr AnonymousMember14;
/// _od_time_msg_func
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.SysUInt)]
public System.IntPtr AnonymousMember15;
/// WORD->unsigned short
public ushort key_chat;
/// WORD->unsigned short
public ushort key_dosshell;
/// WORD->unsigned short
public ushort key_drop2bbs;
/// WORD->unsigned short
public ushort key_hangup;
/// WORD->unsigned short
public ushort key_keyboardoff;
/// WORD->unsigned short
public ushort key_lesstime;
/// WORD->unsigned short
public ushort key_lockout;
/// WORD->unsigned short
public ushort key_moretime;
/// WORD[9]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst = 9, ArraySubType = System.Runtime.InteropServices.UnmanagedType.U2)]
public ushort[] key_status;
/// WORD->unsigned short
public ushort key_sysopnext;
/// BYTE->unsigned char
public byte od_num_keys;
/// INT16[16]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = System.Runtime.InteropServices.UnmanagedType.I2)]
public short[] od_hot_key;
/// INT16->short
public short od_last_hot;
/// char*
public System.IntPtr od_after_chat;
/// char*
public System.IntPtr od_after_shell;
/// char*
public System.IntPtr od_before_chat;
/// char*
public System.IntPtr od_before_shell;
/// char*
public System.IntPtr od_chat_reason;
/// char*
public System.IntPtr od_continue;
/// char
public byte od_continue_yes;
/// char
public byte od_continue_no;
/// char
public byte od_continue_nonstop;
/// char*[7]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst = 7, ArraySubType = System.Runtime.InteropServices.UnmanagedType.SysUInt)]
public System.IntPtr[] od_day;
/// char*
public System.IntPtr od_hanging_up;
/// char*
public System.IntPtr od_exiting;
/// char*
public System.IntPtr od_help_text;
/// char*
public System.IntPtr od_help_text2;
/// char*
public System.IntPtr od_inactivity_timeout;
/// char*
public System.IntPtr od_inactivity_warning;
/// char*[12]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst = 12, ArraySubType = System.Runtime.InteropServices.UnmanagedType.SysUInt)]
public System.IntPtr[] od_month;
/// char*
public System.IntPtr od_no_keyboard;
/// char*
public System.IntPtr od_no_sysop;
/// char*
public System.IntPtr od_no_response;
/// char*
public System.IntPtr od_no_time;
/// char*
public System.IntPtr od_offline;
/// char*
public System.IntPtr od_paging;
/// char*
public System.IntPtr od_press_key;
/// char*
public System.IntPtr od_sending_rip;
/// char*[3]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = System.Runtime.InteropServices.UnmanagedType.SysUInt)]
public System.IntPtr[] od_status_line;
/// char*
public System.IntPtr od_sysop_next;
/// char*
public System.IntPtr od_time_left;
/// char*
public System.IntPtr od_time_warning;
/// char*
public System.IntPtr od_want_chat;
/// char*
public System.IntPtr od_cmd_line_help;
/// BYTE->unsigned char
public byte od_chat_color1;
/// BYTE->unsigned char
public byte od_chat_color2;
/// BYTE->unsigned char
public byte od_list_comment_col;
/// BYTE->unsigned char
public byte od_list_name_col;
/// BYTE->unsigned char
public byte od_list_offline_col;
/// BYTE->unsigned char
public byte od_list_size_col;
/// BYTE->unsigned char
public byte od_list_title_col;
/// BYTE->unsigned char
public byte od_local_win_col;
/// BYTE->unsigned char
public byte od_continue_col;
/// BYTE->unsigned char
public byte od_menu_title_col;
/// BYTE->unsigned char
public byte od_menu_border_col;
/// BYTE->unsigned char
public byte od_menu_text_col;
/// BYTE->unsigned char
public byte od_menu_key_col;
/// BYTE->unsigned char
public byte od_menu_highlight_col;
/// BYTE->unsigned char
public byte od_menu_highkey_col;
/// HICON->HICON__*
public System.IntPtr od_app_icon;
/// int
public int od_cmd_show;
}
Here is the struct in the unmanaged c++ code. I switched the typedefs to their appropriate types in the c# code.
typedef struct
{
/* Location or name of door information file (if one is to be used). */
char info_path[60];
/* Serial port settings. */
DWORD baud;
DWORD od_connect_speed;
INT16 od_com_address;
BYTE od_com_irq;
BYTE od_com_method;
BYTE od_com_flow_control;
WORD od_com_rx_buf;
WORD od_com_tx_buf;
BYTE od_com_fifo_trigger;
BOOL od_com_no_fifo;
BOOL od_no_fossil;
BOOL od_use_socket;
INT16 port;
DWORD od_open_handle;
/* Caller and system information. */
char system_name[40];
char sysop_name[40];
INT32 system_calls;
char system_last_caller[36];
char timelog_start_date[9];
INT16 timelog_busyperhour[24];
INT16 timelog_busyperday[7];
char user_name[36];
char user_location[26];
char user_password[16];
char user_dataphone[16];
char user_homephone[16];
char user_lasttime[6];
char user_lastdate[9];
BYTE user_attribute;
BYTE user_flags[4];
DWORD user_net_credit;
DWORD user_pending;
WORD user_messages;
DWORD user_lastread;
WORD user_security;
DWORD user_numcalls;
DWORD user_uploads;
DWORD user_downloads;
DWORD user_upk;
DWORD user_downk;
DWORD user_todayk;
WORD user_time_used;
WORD user_screen_length;
BYTE user_last_pwdchange;
BYTE user_attrib2;
WORD user_group;
BYTE event_status;
char event_starttime[6];
BYTE event_errorlevel;
BYTE event_days;
BYTE event_force;
char event_last_run[9];
BYTE user_netmailentered;
BYTE user_echomailentered;
char user_logintime[6];
char user_logindate[9];
INT16 user_timelimit;
INT32 user_loginsec;
INT32 user_credit;
WORD user_num;
INT16 user_readthru;
INT16 user_numpages;
INT16 user_downlimit;
char user_timeofcreation[6];
char user_logonpassword[16];
BYTE user_wantchat;
BYTE user_ansi;
INT16 user_deducted_time;
char user_menustack[50][9];
BYTE user_menustackpointer;
char user_handle[36];
char user_comment[81];
char user_firstcall[9];
BYTE user_combinedrecord[200];
char user_birthday[9];
char user_subdate[9];
BYTE user_screenwidth;
BYTE user_language;
BYTE user_date_format;
char user_forward_to[36];
BYTE user_error_free;
BYTE sysop_next;
BYTE user_emsi_session;
char user_emsi_crtdef[41];
char user_emsi_protocols[41];
char user_emsi_capabilities[41];
char user_emsi_requests[41];
char user_emsi_software[41];
BYTE user_hold_attr1;
BYTE user_hold_attr2;
BYTE user_hold_len;
char user_reasonforchat[78];
char user_callsign[12];
WORD user_msg_area;
WORD user_file_area;
char user_protocol;
WORD user_file_group;
BYTE user_last_birthday_check;
char user_sex;
DWORD user_xi_record;
WORD user_msg_group;
BYTE user_avatar;
char user_org[51];
char user_address[3][51];
INT32 user_pwd_crc;
INT32 user_logon_pwd_crc;
char user_last_cost_menu[9];
WORD user_menu_cost;
BYTE user_rip;
BYTE user_rip_ver;
BYTE user_attrib3;
BOOL user_expert;
char system_last_handle[36];
/* Door information file statistics. */
BYTE od_info_type;
BYTE od_extended_info;
WORD od_node;
BYTE od_ra_info;
/* Current program settings. */
BOOL od_always_clear;
BOOL od_force_local;
BOOL od_chat_active;
BOOL od_current_statusline;
INT16 od_error;
BYTE od_last_input;
BOOL od_logfile_disable;
char od_logfile_name[80];
WORD od_maxtime;
INT16 od_maxtime_deduction;
BOOL od_okaytopage;
INT16 od_pagestartmin;
INT16 od_pageendmin;
BOOL od_page_pausing;
INT16 od_page_statusline;
BOOL od_user_keyboard_on;
BOOL od_update_status_now;
INT16 od_cur_attrib;
/* OpenDoors customization settings. */
char od_box_chars[8];
char od_cfg_text[48][33];
char od_cfg_lines[25][33];
OD_COMPONENT *od_config_file;
char * od_config_filename;
void (*od_config_function)(char *keyword, char *options);
char od_color_char;
char od_color_delimiter;
char od_color_names[12][33];
BOOL od_clear_on_exit;
void (*od_cmd_line_handler)(char *pszKeyword, char *pszOptions);
void (*od_cmd_line_help_func)(void);
void (*od_default_personality)(BYTE operation);
BOOL od_default_rip_win;
WORD od_disable;
char od_disable_dtr[40];
BOOL od_disable_inactivity;
BOOL od_emu_simulate_modem;
BYTE od_errorlevel[8];
BOOL od_full_color;
BOOL od_full_put;
WORD od_in_buf_size;
INT16 od_inactivity;
INT16 od_inactive_warning;
BOOL od_internal_debug;
tODMilliSec od_max_key_latency;
char od_list_pause;
char od_list_stop;
OD_COMPONENT *od_logfile;
char *od_logfile_messages[14];
OD_COMPONENT *od_mps;
BOOL od_nocopyright;
BOOL od_noexit;
BOOL od_no_ra_codes;
BYTE od_page_len;
char od_prog_copyright[40];
char od_prog_name[40];
char od_prog_version[40];
DWORD od_reg_key;
char od_reg_name[36];
BOOL od_silent_mode;
BOOL od_status_on;
BOOL od_spawn_freeze_time;
BOOL od_swapping_disable;
BOOL od_swapping_noems;
char od_swapping_path[80];
/* Custom function hooks. */
void (*od_no_file_func)(void);
void (*od_before_exit)(void);
void (*od_cbefore_chat)(void);
void (*od_cafter_chat)(void);
void (*od_cbefore_shell)(void);
void (*od_cafter_shell)(void);
void (*od_config_callback)(void);
void (*od_help_callback)(void);
void (*od_ker_exec)(void);
void (*od_local_input)(INT16 key);
void (*od_time_msg_func)(char *string);
/* OpenDoors function key customizations. */
WORD key_chat;
WORD key_dosshell;
WORD key_drop2bbs;
WORD key_hangup;
WORD key_keyboardoff;
WORD key_lesstime;
WORD key_lockout;
WORD key_moretime;
WORD key_status[9];
WORD key_sysopnext;
/* Additional function keys. */
BYTE od_num_keys;
INT16 od_hot_key[16];
INT16 od_last_hot;
void (*od_hot_function[16])(void);
/* OpenDoors prompt customizations. */
char * od_after_chat;
char * od_after_shell;
char * od_before_chat;
char * od_before_shell;
char * od_chat_reason;
char * od_continue;
char od_continue_yes;
char od_continue_no;
char od_continue_nonstop;
char * od_day[7];
char * od_hanging_up;
char * od_exiting;
char * od_help_text;
char * od_help_text2;
char * od_inactivity_timeout;
char * od_inactivity_warning;
char * od_month[12];
char * od_no_keyboard;
char * od_no_sysop;
char * od_no_response;
char * od_no_time;
char * od_offline;
char * od_paging;
char * od_press_key;
char * od_sending_rip;
char * od_status_line[3];
char * od_sysop_next;
char * od_time_left;
char * od_time_warning;
char * od_want_chat;
char * od_cmd_line_help;
/* OpenDoors color customizations. */
BYTE od_chat_color1;
BYTE od_chat_color2;
BYTE od_list_comment_col;
BYTE od_list_name_col;
BYTE od_list_offline_col;
BYTE od_list_size_col;
BYTE od_list_title_col;
BYTE od_local_win_col;
BYTE od_continue_col;
BYTE od_menu_title_col;
BYTE od_menu_border_col;
BYTE od_menu_text_col;
BYTE od_menu_key_col;
BYTE od_menu_highlight_col;
BYTE od_menu_highkey_col;
/* Platform-specific settings. */
#ifdef ODPLAT_WIN32
HICON od_app_icon;
int od_cmd_show;
#endif /* ODPLAT_WIN32 */
} tODControl;
Here is the call to the function that is supposed to return the struct.
tODControl ds = new tODControl(); ds = (tODControl) System.Runtime.InteropServices.Marshal.PtrToStructure(NativeMethods.od_control_get(), typeof(tODControl));
(Sorry the struct is so big.)
Thanks!
d913


Sign In
Create Account


Back to top









