/*
 ллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллл
 лл                                                                         лл
 лл                    Copyright (C) 1999 Symantec Corp.                    лл
 лл                           All Rights Reserved                           лл
 лл                                                                         лл
 лл      Information in this file is proprietary and confidential, and      лл
 лл        may not be copied, reproduced or distributed in any manner       лл
 лл     without the express written permission of Symantec Corp.            лл
 лл                                                                         лл
 ллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллл
*/

#ifndef _INC_PW                        // corresponding #endif is at end of file
   #define _INC_PW

/**********************************************************************/
/* Dependent Include Files                                            */
/**********************************************************************/

#ifndef _INC_WINDOWS                   // Dependent upon Windows.h
   #define STRICT
   #include <windows.h>                // Standard SDK header
#endif

#ifndef _INC_COMMDLG                   // Dependent upon CommDlg.h
   #include <commdlg.h>                // Standard SDK 3.1 header
#endif

#ifndef WIN32
   #ifndef _INC_PRINT                  // Dependent upon print.h for DEVMODE
      #include <print.h>               // Standard SDK 3.1 header
   #endif
#else
   #ifndef _WINDGDI_                   // Dependent upon WINGDI for DEVMODE
      #include <wingdi.h>              // WIN32 SDK header
   #endif
#endif

/**********************************************************************/
/* Typedefs                                                           */
/**********************************************************************/

// Prevent the inclusion of FBPTR dependent header files from forcing
//    the inclusion of FILEIO.H
#ifndef _FBPTR_DEFINED                 /* Prevent redefinition */
typedef struct FILEBUF FAR* FBPTR;     /* pointer to struct FILEBUF */
#define _FBPTR_DEFINED
#endif

// Prevent the inclusion of LPPW_CALLBACK_STRUCT dependent header
//    files from forcing the inclusion of CALLBACK.H
typedef struct tagPW_CALLBACK_STRUCT FAR*LPPW_CALLBACK_STRUCT;

//---------------------------------------------------------------------------
// types containing specific number are supposed to stay that size
//    (in bits), regardless of operating environment.  Other types
//    are suppossed to float in size with the operating environment.

// MSVC++ 6.0 defines these, so don't redefine
#ifndef _BASETSD_H_
typedef unsigned long         UINT32;
typedef          long         INT32;
#endif

typedef unsigned char         U8;      // Added to support TERMINAL_CAPABILITY struct, req'd for 2.0 TERMINALSET
typedef unsigned char __huge* HPU8;
typedef unsigned char __far*  LPU8;
typedef signed   char         I8;
typedef unsigned short        U16;
typedef          short        I16;
typedef unsigned long         U32;
typedef          long         I32;
typedef unsigned char         UINT8;
typedef signed   char         INT8;
typedef unsigned short        UINT16;
typedef          short        INT16;

typedef  U8                   FBCLR ;  // Foreground/Background color of a terminal character
                   //    Each nybble is an index into the ColorTable
                   // Foreground = (fbclr&0xF0)>>4
                   // Background = (fbclr*0x0F)
                   // LONG     ColorTable[16] =
                   // {  // 16 possible solid colors
                   //    0x00000000L,   // black
                   //    0x00800080L,   // dark purple
                   //    0x00800000L,   // dark blue
                   //    0x00808000L,   // dark cyan
                   //    0x00008000L,   // dark green
                   //    0x00008080L,   // dark yellow
                   //    0x00000080L,   // dark red
                   //    0x00B4B4B4L,   // light gray
                   //    0x00505050L,   // dark gray
                   //    0x00FF00FFL,   // bright purple
                   //    0x00FF0000L,   // bright blue
                   //    0x00FFFF00L,   // bright cyan
                   //    0x0000FF00L,   // bright green
                   //    0x0000FFFFL,   // bright yellow
                   //    0x000000FFL,   // bright red
                   //    0x00FFFFFFL    // bright white
                   // };

#define ASP_PROT_SUCCESS   2
#define ASP_PROT_FAIL      3

#define MODEMNETBYTES      192         // Number of bytes in the modem struct for network info

#define  MS             262
#define  RS             263
#define  BIGFONTMAP     264            // Resource types
#define  TERMPARMBIN    265
#define  EXTRAFONTMAP   266
                     // 267 available
#define  KBD84KEY       268
#define  KBD101KEY      269
#define  KBD102KEY      270
#define  FONTAVAIL      271
#define  KBD101NEW      272
#define  KBD84NEW       273
#define  KBDACCNEW      274
#define  KBDMETANEW     275
#define  KBDDOOR        276
#define  PROTO         1050
#define  CODEPAGE      6665

#define MAXFILENAME     260            // maximum length of file pathname

#define UNCHECK           0
#define CHECK             1
#define ENABLE            2
#define GRAY              3

#define LINE              0
#define TIME              1
#define ONLINE            2

#define NORM_MASK      0x01
#define ITAL_MASK      0x02
#define UNDL_MASK      0x04

#define PRN_AVAILABLE     0
#define PRN_AT_SCRIPT     1
#define PRN_AT_TERMNL     2

#define AL_RIGHT          1
#define AL_LEFT           2
#define AL_CNTR           3

#define RTS_HIGH          1
#define RTS_LOW           0

// Sound event constants
#define SOUND_XFER_COMPLETE      0
#define SOUND_XFER_ABORT         1
#define SOUND_CONNECT            2
#define SOUND_DISCONNECT         3
#define SOUND_FAX_RCV_COMPLETE   4
#define SOUND_FAX_SEND_COMPLETE  5
#define SOUND_FAX_SEND_FAILED    6
#define SOUND_CALLING_QUEUE      7
#define SOUND_MISC_ERROR         8
#define TOTAL_SOUND_EVENTS       9  // Set to total # of defines above

#define MAXFIELDITEMS           13

// Terminal Attribute Flags originally defined in COLORS.C, but now
//    referenced in TRM.H, NS.C, and DDIO\US\MAKEPARM.C
// If you change them, be sure to check these other files, particularly
//    TRM.H, as the dependencies are not just on value or order, but
//    on absolute value, as well.  (HMM 940130)

#define TPATTR_BLINK             1
#define TPATTR_REV               2
#define TPATTR_DIM               4
#define TPATTR_BOLD              8
#define TPATTR_ULINE            16

// States for RightMouseUse
#define RMU_NOTHING              0     // don't do a thing
#define RMU_MENU                 1     // make it a menu
#define RMU_DBL_CLICK            2     // double click for position

#define MAXRIGHTMOUSE           10     // Allow up to 10 menu items

/*
 ллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллл
 лл                                                                         лл
 лл WARNING!! For 32-bit compatibility, do NOT use any ints or unsigneds in лл
 лл the following structures -- until you see a message that terminates     лл
 лл this request.  All fields must be kept the same physical size for Win   лл
 лл 3.x and 95/NT. Thus use INT16, UINT16, WORD, BYTE, char, short, or long.лл
 лл                                                                         лл
 ллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллл
*/

typedef struct tagASCIISET{            // ASCII setup
   BYTE type;
   BYTE send_cr;
   BYTE send_lf;
   BYTE rcv_cr;
   BYTE rcv_lf;
   INT16 timeout;
   INT16 pace_char_time;
   INT16  line_pace_time;
   BYTE line_pace_char;
   BYTE strip_bit8;
   BYTE upload_display_text;
   BYTE dnload_display_text;
   BYTE expand_tabs;
   BYTE expand_tab_size;
   BYTE expand_blanks;
   BYTE use_line_pace_char;
   BYTE xfer_dup_new;
   BYTE xfer_del_aborts;
}ASCIISET;

typedef struct tagKERMITSET{           // KERMIT setup
   BYTE type;
   BYTE quotechar;
   BYTE padchar;
   BYTE eolchar;
   BYTE bit8char;
   BYTE startchar;
   INT16 size;
   BYTE padnum;
   BYTE ftype;
   BYTE chktype;
   BYTE repeatchar;
   BYTE att;
   BYTE xfer_dup_new;
   BYTE xfer_del_aborts;
}KERMITSET;

typedef struct tagZMODEMSET{           // ZMODEM setup
   BYTE type;
   BYTE overwrite_rcv;
   BYTE overwrite_send;
   BYTE recovery_rcv;
   BYTE recovery_send;
   BYTE unix_xlt;
   BYTE org_date;
   BYTE xmit_type;
   BYTE chktype;
}ZMODEMSET;

typedef struct tagXMODEMSET{           // XMODEM setup
   BYTE type;
   BYTE xfer_dup_new;
   BYTE xfer_del_aborts;
   BYTE xfer_relaxed;
}XMODEMSET;

typedef struct tagCISBFILESET{         // CISBFILESET setup
   BYTE type;
   BYTE xfer_dup_new;
   BYTE xfer_resume;
   BYTE xfer_del_aborts;
}CISBFILESET;

typedef struct tagDLPSET{              // DLP setup
   BYTE type;
   UINT16 caps;
   char autodown[12];
   BYTE xfer_dup_new;
   BYTE xfer_del_aborts;
   char fname[8];
   BYTE Extra[325];
}DLPSET;

typedef struct tagSCRIPTSET{           // script setup
   BYTE connect_type;
}SCRIPTSET;

// These are used now explicitly for parm.logopt and parm.ss.logopt
#define LOG_ONCONNECT   0x0100
#define LOG_APPEND      0x0200
#define LOG_QUERY       0x0400
#define LOG_NOFILE      0x1000

typedef struct tagMODEMSET{            // MODEM setup   NAMED FIELD
   char alias[25];                     // alias name of basis modem default
   BYTE baud_index;                    //
   BYTE dat_flow;                      // true if use hardflow
   BYTE soft_flow;                     // true if use softawre flow
   BYTE Drop_DTRtohangup;              // true if we are to drop DTR to Hangup the phone
   char cmdsuffix[10];
   BYTE deleted;
   BYTE isvoice;
   char vchip[16];                     //
   BYTE hard_data_flow;                //
   BYTE soft_data_flow;                //
   char faxinit[40];                   //
   char connect_adapt1[16];            //
   char connect_adapt2[16];            //
   char fax_data_1[26];                //
   char fax_data_2[26];                //
   BYTE userset_max_tx;                // index into IDS_FBAUD
   BYTE userset_max_rx;                //
   UINT max_tx;                        //
   UINT max_rx;                        //
   UINT hdlc_max_rx;                   //
   UINT hdlc_max_tx;                   //
   BYTE fclass;                        //
   BYTE fax_rate_locked;               //
   BYTE fax_serial_rate;               // 7=19200, 8=38400
   BYTE fax_auto_answer_type;          // 0=none, 1=FAA, 2=FAE
   int  firmware_manufacturer;         // modem response to AT+FMFR

   // Note: the following expect '0', '1', or '2' not 0, 1, or 2
   BYTE fborsend;                      // 0=use firmware default, 1=std, 2=reverse
   BYTE fborrecv;                      // 0=use firmware default, 1=std, 2=reverse
   BYTE fecmsend;                      // 0=none, 1=soft, 2=hard
   BYTE fecmrecv;                      // 0=none, 1=soft, 2=hard
   BYTE uartborsend;                   // 0=use firmware default, 1=std, 2=reverse
   BYTE uartborrecv;                   // 0=use firmware default, 1=std, 2=reverse
   BYTE renegsend;                     // 0=use firmware default, 1=not supported, 2=supported
   BYTE renegrecv;                     // 0=use firmware default, 1=not supported, 2=supported
   BYTE faabaud;                       // 1= change baud to 19200 in apadtive answer

   BYTE isfax;                         //
   BYTE answermode;                    //
   BYTE answer_rings;                  //
   int  comm_index;                    //

   BYTE access;                        //
   UINT16 current_data_rate;           // (changed from BYTE canfax)
   char cell_faxinit[40];              //
   BYTE cell_userset_max_tx;           //
   BYTE cell_userset_max_rx;           //
   BYTE cell_hard_data_flow;           //
   BYTE cell_soft_data_flow;           //

   BYTE bIsTapiConnection;             //
   DWORD dwTapiUniqueId;               //
   char szPortName[26];                //

   UINT16 parity;                      // 0=None, 1=Odd, 2=Even, 3=Mark, 4=Space  NEW PW4
   UINT16 stop_bits;                   //
   UINT16 data_bits;                   //
   UINT16 enable_faxes;                //
   UINT16 answer_method;               //
   BYTE   bTapiDCBRequest;             //
   DWORD  fax_capabilities;            //
   BYTE   active;                      //

   //       W A R N I N G ! ! !
   // These next 2 fields MUST stay together [at the end ?] of this
   // structure.  The reason seems to be a paradigm in DDIO\modem.c (look
   // for the definition and usage of MODEMSETNET in modem.c).
   char dllname[MAXFILENAME];
   char network[MODEMNETBYTES];
}MODEMSET;

typedef struct tagDIRCONSET{           //
   BYTE baud_index;                    //
   BYTE dat_flow;                      // true if use hardflow
   BYTE soft_flow;                     // true if use softawre flow
   BYTE Drop_DTRtohangup;              // true if we are to drop DTR to Hangup the phone
   UINT16 parity;                      // 0=None, 1=Odd, 2=Even, 3=Mark, 4=Space  NEW PW4
   UINT16 stop_bits;
   UINT16 data_bits;
}DIRCONSET;

typedef struct tagEMAILSET{            // EMAIL setup   NAMED FIELD
   char username[80];
   char useraddress[MAXFILENAME];
   char replyaddress[MAXFILENAME];
   char sigfile[MAXFILENAME];

   char mailserver[MAXFILENAME];
   BYTE deleteretrieved;
   BYTE fwd;
   char fwdmailserver[MAXFILENAME];
   char auth_logon[80];
   char auth_password[80];

   BYTE chkmail;
   BYTE bchkmailtime;
   int  chkmailtime;
   BYTE disconnect;

   BYTE sendnow;
   BYTE addtocondirout;
   BYTE addtocondirin;
   BYTE receiptread;

   BYTE relpyoriginal;
   BYTE relpyindent;
   BYTE readnext;
   BYTE quote;
   int  quoteline;
   char quoteprefix[8];
   BYTE quoteheaders;
   int  wrapcharcnt;

   BYTE deleteonexit;
   BYTE brecvwave;
   char recvwavefile[MAXFILENAME];
   BYTE brecvflash;
   BYTE encode;
   BYTE mime;

   char font[LF_FACESIZE];             // Font facename-
   int  fsize;
   int  fcharset;
   BYTE fbold;
   char database_path[MAXFILENAME];
}EMAILSET;

typedef struct tagNEWSSET{             // NEWS setup   NAMED FIELD
   char username[80];
   char useraddress[MAXFILENAME];
   char emailaddress[MAXFILENAME];
   char organizaion[80];
   char sigfile[MAXFILENAME];

   char newsserver[MAXFILENAME];
   char auth_logon[80];
   char auth_password[80];

   int  maxgroups;
   BYTE prompt_ifexceed;
   BYTE only_unread_headers;
   BYTE startgroups;
   BYTE bkillfilesactive;
   char savedpath[MAXFILENAME];

   int  wrapcharcnt;
   int  maxlines;
   BYTE relpyoriginal;
   BYTE relpyheaders;
   BYTE relpyquote;
   BYTE bquoteline;
   int  quoteline;
   char quoteprefix[8];

   BYTE sort;
   BYTE sortorder;
   BYTE bthreadedview;
   BYTE mime;
   BYTE encode;

   char font[LF_FACESIZE];             // Font facename-
   int  fsize;
   int  fcharset;
   BYTE fbold;

   BYTE database_purge;                //
   int  database_purge_days;           //
   BYTE database_compact;              //
   BYTE database_purge_startup;        //
   BYTE database_purge_shutdown;       //
   char database_path[MAXFILENAME];    //
   BYTE loginrequired;                 //
}NEWSSET;

#define  LEN_copyeolstr 8              // Length (including null) of copyeolstr
#define  LEN_pasteprefix 8             // Length (including null) of pasteprefix

typedef struct tagGENERALSET{          // GENERAL setup  NAMED FEILD
   char  scriptpath[MAXFILENAME];
   char  notesdir[MAXFILENAME];
   BYTE  should_gif;
   BYTE  xfer_abort_nocd;
   BYTE  rcv_prompt_protocol;
   char  upload[MAXFILENAME];
   char  dwnload[MAXFILENAME];
   char  capture[MAXFILENAME];
   BYTE  fileclipbrd_char;             // Character to send in between file clipboard filenames
   BYTE  chat_mode;                    // 0 = block mode, 1 = char mode, 2 = block + CRLF, 3 = char + CRLF
   BYTE  auto_download;                // 1 = auto_download
   BYTE  char_dblclk;                  // 0=char, 1=word, 2=char+LineEnd, 3=word+LineEnd
   BYTE  clip_long_names;              // 1 = look for NTFS style filenames when doing the file clipboard
   INT16 yeild;                        // Range of 0 to 100
   INT16 playback_speed;               // Range of 0 to MAX_PLAYBACK_RANGE (typically 100)
   BYTE  copyeol;                      // 0 if use contents of Enter key, 1 if use contents of copyeolstr
   char  copyeolstr[LEN_copyeolstr];   // String to put on end of pasted data
   BYTE  RightMouseUse;                // What right mouse button does
   UINT16 RightMouseMenu[MAXRIGHTMOUSE];  // Menu IDs of right mouse menu items
   char  pasteprefix[LEN_pasteprefix]; // String to put at the beginning of pasted data
   BYTE  xferflash;                    // Flash window after completion of xfer
   char  soundfile[TOTAL_SOUND_EVENTS][MAXFILENAME];  // TOTAL_SOUND_EVENTS -2
   UINT16 duplex;                      // 0=full, 1=half (replaced PARMET->duplex)
   INT16 break_len;                    // (replaced PARMET->break_len)
}GENERALSET;

#define MAX_URL_STRING     255

typedef struct tagWWWSTARTSET{

   /* Image Display */

   BYTE no_animation;
   BOOL use_system_browser;               // NEW PW4
   BOOL use_mult_window;                  // NEW PW4
   int font_size;                         // NEW PW4
   int font_family;                       // NEW PW4
}WWWSTARTSET;

typedef struct tagFONTSET{             // FONT setup   NAMED FIELD
   char facename[LF_FACESIZE];         // Font facename
   I8   size;                          // Font size in points (possibly negative)
   BYTE char_set;                      // Character set type (0-255)
   BYTE auto_size;                     // 0->SizeWindowToFont, 1->SizeFontToWindow, 2->none
}FONTSET;
typedef FONTSET FAR* LPNTFONT;         // Far pointer to Named Table Font structure

typedef struct tagTERMPHYSATTR
{
   FBCLR fbclr;                        // Foreground/Background color byte
   U8    rgbtAttr;                     // Bit mask (Bold font, uline font, blinking)
} TERMPHYSATTR;

typedef struct tagCOLORSET{            // COLOR setup   NAMED FIELD
   U8           nBlinkRate;
   TERMPHYSATTR rgTermPhysAttr[32];
}COLORSET;
typedef  COLORSET FAR *LPNTCOLSET;     // Long pointer to Named Table Colorset Structure

typedef struct tagPCOLORSET{           // PCOLOR setup   NAMED FIELD
   COLORREF    monitorrcv;
   COLORREF    monitorsend;
   COLORREF    scrollbar;
   COLORREF    terminal;
   char        pattern[41];
   int         border;
}PCOLORSET;

typedef struct tagFAXSET{              // FAX setup   NAMED FIELD
   char username[65];
   char usercompany[41];
   char faxnum[26];
   char voicenum[26];
   char stationid[21];
   char coverfile[MAXFILENAME];
   BYTE header_time;
   BYTE header_send_num;
   BYTE header_send_vnum;
   BYTE header_send_name;
   BYTE header_send_company;
   BYTE header_send_id;
   BYTE header_rcv_num;
   BYTE header_rcv_name;
   BYTE header_page_num;
   BYTE rings;
}FAXSET;


/*
лппппппппппппппппппппппппппппппппппппппппппппппппппппппппппппппппппппппп
л  TERMINAL_CAPABILITY
л
л  Each terminal has certain capabilities which are defined here.
л  Appropriate defines are in trm.h, not here, to reduce extraneous
л     symbol definition.
лммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммм
*/
typedef  U8                   XATTR;   // Extended attribute of a terminal character.  A bitmap
typedef  U8                   LATTR;   // Logical attribute of a terminal character.  A bitmap
typedef  LATTR FAR*           LPLATTR;

typedef  struct                        // REMINDER: Check this out when go to Win-32!
{
   U32   rgbtEmu;                      // Use with the rgbtEmu* defines in trm.h to determine
                   //    emulation characteristics

   U8    ExecFuncFamily;               // Defines which executable function array should be loaded on terminal initialization.
                   //    This is used in InitializeTerminal to get the correct executable function array loaded.
                   //    0: TTY family
                   //    1: VT52 family
                   //    2: DEC family
                   //    3: ANSIBBS family
                   //    4: DG family
                   //    5: ADDS family
                   //    6: ADM family
                   //    7: Televideo family
                   //    8: Heath 19
                   //    9: IBM31 family
                   //   10: Wyse family
                   //   11: No family-all noops for DLT emulations

   U8    BigFontFamily;                // Defines the kind of bigfont maps required.
                   //    0: No special bigfont maps, use unity
                   //    1: VT52 family
                   //    2: VT100-102 family
                   //    3: VT220+ and clone family
                   //    4: TV910-TV950 family
                   //    5: TV955 family
                   //    6: Wyse family
                   //    7: IBM31x family

   U8    ctVidBufs;                    // Number of byte planes required exclusive of the LineFlags buffer

   U8    nColorType;                   // Type of color scheme, (BBSCOL, DEC, TVWCOL).
                   //    If BBSCOL, it cannot be a big font terminal (in PW 1.00)

   U8    rgbtVidBufUse;                // The way that the video buffers are used.
                   //    See the defines rgbtVidBufUse_* in trm.h

   U8    enumVidBufUse;                // The way that the video buffers are used.
                   //    Disambiguate similar buffer configurations as defined in rgbtVidBufUse.

   U8    rgbtStatLines;                // Defines the number of status lines and what they are.
                   //    See defines for rgbtStatLines_* in trm.h

   LATTR lattrFontCapability;          // Defines what font support should be given.  For example,
                   //    although all terminals support underline fonts, some
                   //    do not support bold or dwide fonts.

   U8    nAdvancedSetupType;           // Defines what Advanced Setup options
                   //    should be displayed/processed
                   //    0: none
                   //    1: HiEnd DEC
                   //    2: IBM31x
                   //    3: TVW just Protected Attribute
                   //    4: 3 + Status Line
                   //    5: 4 + Block mode

   UINT16   fCanDo132               :  1; // Will support 132 columns
   UINT16   fCanDoProtected         :  1; // True if can set the logical attributes of protected characters.
                 //    If lpts->f.InWriteProtectedMode and this are true, then the PROTECT bit
                 //    in the lattr of the character will be set.
   UINT16   fCursorWraps            :  1; // True if the cursor is a wrapping cursor
   UINT16   fIsAnsi7or8             :  1; // True if Ansi 7 or 8 bit emulation can be set (eg a highend DEC terminal)
   UINT16   fNeedsShiftState        :  1; // True if needs ShiftKey state information
   UINT16   fSupportsDoubleFonts    :  1; // True if supports doublewide or doublehigh fonts
                 //    REMINDER: If this is set, then the termwrt() routine will
                 //    need to handle the double-wide stuff.  Typically
                 //    this is the DEC termwrt().  If this bit is ever set
                 //    for non-DEC terminals, this must be handled!
                 //    REMINDER: This bit set implies the use of LINEFLAGS
                 //    buffers, and so when used as a test it implies that
                 //    the LINEFLAGS buffer is available.
   UINT16   fUserCanSetScroll       :  1; // True if the user should be able to set the scroll flag.
   UINT16   fZmFullStringNeeded     :  1; // True if the Zmodem download string should be the full
                 //    string, ie **^XB00.  False if the string should be
                 //    the short string, ie ^XB00.
   UINT16                           :  0; // Padding to end of a UINT

}  TERMINAL_CAPABILITY;


typedef struct tagTERMINALSET{         // Terminal setup  NAMED FIELD
   UINT16 version;                     // Starts at 0x0200 for version PW 2.00; this structure will never be passed to a .DLT in less than version 2.0 form
                   //    so it is acceptable for the version stamp to be "off-the-end" of the 1.00 version structure.
                   // CRITICAL: "version" MUST BE at the beginning of the version 2.0 block
                   //    because it is used to calculate the length of this block.
   UINT16 offExtra;                    // Amount to be added to a pointer to TERMINALSET
                   //    to get a pointer to the ExtraBytes field.
   UINT16 lenExtra;                    // Length of the ExtraBytes field.
                   //    NOTE: total length of TERMINALSET is offExtra+lenExtra
   UINT16 usedExtra;                   // Number of bytes of ExtraBytes that are in use.
   INT16  nEmulation;                  // Number of the emulation in this
                   //    .DLT that this struct represents.  EG--If one DLL handles
                   //    3 different emulations, they would be numbered 0, 1, and 2.  The name is stored
                   //    in DDNamedTerminalTable.name, of which this TERMINALSET is a part.
                   //    NOTE: it is not defined unless the type field is TERMTYPE_DLT

   UINT16 protected_dim          :  1; // True if protected attribute implies dim
   UINT16 protected_rev          :  1; // True if protected attribute implies reversed
   UINT16 protected_ul           :  1; // True if protected attribute implies underlined
   UINT16 status_line            :  1; // True if terminal status line is to be shown
   UINT16 strip_bit8             :  1; // True if stripping bit 8
   UINT16 destroy_backspace      :  1; // True if destructive backspace
   UINT16 wrap                   :  1; // True if wrapping at end of line is desired
   UINT16 scroll                 :  1; // True if scrolling at end of screen is desired
   UINT16 cr_to_lf               :  1; // True if CR also sends LF
   UINT16 blk_cursor             :  1; // True if default cursor is a block cursor
   UINT16 ansi8bit               :  1; // True if an ansi 8bit terminal
   UINT16 cursor_in_view         :  1; // True if the viewport should move to keep the cursor in view
   UINT16 fStartInKeypadAppMode  :  1; // True if the highend DEC's should startup in Keypad Application Mode
   UINT16 fStartInCursorAppMode  :  1; // True if the highend DEC's should startup in Cursor Application Mode
   UINT16 fStartInVisibleAttrMode:  1; // True if TV starts in EmbeddedAttributeMode (attributes are visible)
   UINT16 fInBlockMode           :  1; // True if TVW user set block mode
   UINT16 ibm31xNullSuppressOn   :  1; // True if IBM user set Null Suppress ON or if in Block Mode.
   UINT16 ibm31xEnterKeyToCRLF   :  1; // True if IBM user set Enter to issue a CRLF.
   UINT16 fIsABaseEmulation      :  1; // True if this is a base emulation
   UINT16 fStartInISOLatin1      :  1; // True if the highend DECs should start in ISO-Latin 1 instead of DEC Multi-National
   UINT16 fANSIUseDECLineWrap    :  1; // True if the ANSIBBS emulation should use the DEC linewrap algorithm instead of the ANSIBBS one
   UINT16 fDisableHostPrinting   :  1; // True if the host printing sequences should be disabled
   UINT16 fDisableANSIBBSMusic   :  1; // True if ANSI should treat ESC M as a DEL LINE sequence instead of a Music sequence
   UINT16                        :  0; // Padding - do not extend for PW 2.00.  Start new field.

   BYTE type;                          // Base type of the terminal. 0 to NUMBER_TERMINALS-1 implies builtin to PW.
                   //    TERM_DLT implies an external terminal.  See szDLTName for filename.
                   //    NOTE: if type==TERM_DLT then szDLTName better NOT be NULL!
   BYTE rows;                          // Number of rows desired (1-?)
   BYTE cols;                          // Number of columns (80 or 132)
   BYTE tab_stops;                     // Default spacing of tab stops (eg 8)
   BYTE status_line_type;              // Arbitrary number for attribute  of status line desired,
                   //    eg normal=0, reversed=1, underlined=2
   BYTE answerback;                    // answer back 0=none 1=TRUE 2 = CIS-B+
   char answer_str[51];                // answerback string

   BYTE term_update;                   // type of screen updating to do:
                   //    UPDATE_INC, UPDATE_BLOCK, or UPDATE_DELAY

   BYTE  term_scroll;                  // NEW PW3.0 0->complete repaint of window, 1->scroll it
   INT16 scrollback_pgs;               // NEW PW3.0 Number of terminal scrollback pages

   BYTE wyse50blockmodetype;           // Type of Wyse50 blockmode, 0 or 1.
   BYTE ibm31xTurnAroundChar;          // Offset into named table that identifies the turnaround character (0-3).
   BYTE szDLTName[MAXFILENAME];        // Filename.Ext of the DLT containing the emulation.  The path is determined elsewhere,
                   //    but it will be probably be in the same directory as PW.EXE.  NULL implies PW.EXE.
   BYTE szKBDName[MAXFILENAME];        // If null, derive kbd resource from other fields.  If
                   //    ends in ".KBD" it is the keyboard file.  Else, it is
                   //    a basename to be compared with other basenames--once
                   //    a match is found, use that structures data to derive
                   //    the kbd resource.
   BYTE szBaseName[9];                 // Base name of emulation.  Only valid in original entries.
                   //    Original entries are those that ship inside PW, and the
                   //    autoloaded entries from DLT's
   TERMINAL_CAPABILITY tc;             // Capabilities of this emulation.  Replaces grgtc[] in PW1.00
   BYTE szACCName[MAXFILENAME];        // Name of the keyboard accerator file.  If NULL, use DEFAULT.ACC
                   //    if present, else use Resource.  If non-NULL, use name.  If
                   //    bad name, fall back to NULL case.
   BYTE print_raw;                     // print_raw New PW3.0

   // ----- ExtraBytes must always be at the END of the struct so it can be of variable length ----
   BYTE ExtraBytes[ MAXFILENAME ] ;             // Extra data for DLT, probably variable length in PW 3.0

}TERMINALSET;

typedef  TERMINALSET FAR *LPNTTS ;     // Long pointer to Named Table Terminal Structure

//----------------- New PW3.0 named tables -------------------

typedef struct tagTELNETSET{
   BYTE disableneg;
   BYTE binary;
   BYTE login;
   BYTE trmsize;
   char trmtype;
   BYTE speed;
   char xvalue[255];
}TELNETSET;

typedef struct tagPFTPSET{
   char defdir[MAXFILENAME];
   BYTE password[80];
   BYTE ondblclk;
   BYTE retainviewed;
   BYTE alarm;
   BYTE confirm;
   BYTE overwrite;
   BYTE details;
   BYTE gif;
   BYTE xfertype;
   BYTE cache;
   BYTE recovery;
   char localfilter[80];
   char remotefilter[80];
   BYTE pasv;
}PFTPSET;

//-----------------------------------------------------------

/*
 ллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллл
 лл                                                                         лл
 лл End of 32-bit compatibility size warning area. Resume normal variable   лл
 лл declarations.  (At your own risk, of course.)                           лл
 лл                                                                         лл
 ллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллл
*/

typedef struct {
   double  left;
   double  right;
   double  top;
   double  bottom;
} MARGININCH;

typedef struct tagPRINTERSET{      // Printer setup only for parm
   DEVMODE    dm;
   char       dmextra[1024];
   DEVNAMES   dn;
   char       dnextra[3*MAXFILENAME];
   char       pfont[40];
   int        pfsize;
   BYTE       pfcharset;
   char       header[66];
   char       footer[66];
   MARGININCH margin;
}PRINTERSET;

typedef struct tagMAIN{
   HWND hWnd;                          // Handle to rghWnd[MAINWIN]
   COMM_HANDLE hCid;                   // Handle to Open Comm Port
   COMM_HANDLE hCidSav;                // Handle to Port, but line is released
   COMSTAT comstat;                    // open comm status
   DCB dcb;                            // DCB of open comm port
   int gifstate;                       // switch state for online gif viewer
   HWND hSTATUSWnd;                    // Handle to Status window
   char szTempName[MAXFILENAME];       // temp filename, used in ShowXferBox
   int hConnection;                    // connection handle used by fapimanw
   BOOL bIsTapiLine;                   // Indicates the current connection is a TAPI line
   BOOL bLineFromFapi;
   BOOL bTapiCommandMode;
}MAIN;

/**********************************************************************/
/* End of PW.H                                                        */
/**********************************************************************/

#endif   // _INC_PW
