Annotation of os232sdk/toolkt20/c/samples/nead/nead.h, revision 1.1.1.1

1.1       root        1: /* This header file does all the necessary includes and defines all the
                      2:    structures and constants needed for the nead program                 */
                      3: 
                      4: #define INCL_WIN
                      5: #define INCL_WINHEAP
                      6: #define INCL_WINDIALOGS
                      7: #define INCL_GPIPRIMITIVES
                      8: 
                      9: #include <os2.h>
                     10: #include <dos.h>
                     11: #include <malloc.h>
                     12: #include <stdio.h>
                     13: #include <string.h>
                     14: 
                     15: /* The HoldFEA is used to hold individual EAs.  The member names correspond
                     16:    directly to those of the FEA structure.  Note however, that both szName
                     17:    and aValue are pointers to the values.  An additional field, next, is
                     18:    used to link the HoldFEA's together to form a linked list. */
                     19: 
                     20: struct _HoldFEA
                     21: {
                     22:    BYTE       fEA;       /* Flag byte */
                     23:    BYTE       cbName;
                     24:    USHORT     cbValue;
                     25:    CHAR      *szName;
                     26:    CHAR      *aValue;
                     27:    struct _HoldFEA *next;
                     28: };
                     29: typedef struct _HoldFEA HOLDFEA;
                     30: 
                     31: /* The DeleteList is used to hold the names of EAs that need to be explicitly
                     32:    deleted before the current EAs are written.  This is necessary because
                     33:    there does not exist a way to automatically delete all existing EAs
                     34:    associated with a file.  The next field allows the structures to be
                     35:    linked. */
                     36: 
                     37: struct _DeleteList
                     38: {
                     39:    CHAR *EAName;
                     40:    struct _DeleteList *next;
                     41: };
                     42: typedef struct _DeleteList DELETELIST;
                     43: 
                     44: /* The PassData struct is used to pass data, especially as the user data
                     45:    parameter for dialog box calls.  The Point field points to several types
                     46:    of data throughout the program.  Usually it points to either an asciiz
                     47:    name or a HoldData structure.  The rest of the fields are used for m-m
                     48:    recursive calls.  cbMulti is the length of the m-m field currently being
                     49:    considered.  usMultiOffset is the offset from the beginning of the
                     50:    EA (->aValue) to the start of the current m-m field.  usIndex is a count
                     51:    of the number of sub-fields in the current m-m.   */
                     52: 
                     53: struct _PassData
                     54: {
                     55:    CHAR   *Point;
                     56:    USHORT cbMulti;
                     57:    USHORT usMultiOffset;
                     58:    USHORT usIndex;
                     59:    BYTE   fFlag;
                     60: };
                     61: typedef struct _PassData PASSDATA;
                     62: 
                     63: /* The ReEnter structure is used to keep track of the static data for
                     64:    MultiTypeProc.  This structure is necessary since the proc is recursive
                     65:    and the static data is only available during the initialize message.
                     66:    The structure holds the two static variables and has a next field to
                     67:    allow the list to be linked. */
                     68: 
                     69: struct _ReEnter
                     70: {
                     71:    HOLDFEA *pFEA;
                     72:    PASSDATA FAR *pPDat;
                     73:    struct _ReEnter *next;
                     74: };
                     75: typedef struct _ReEnter REENTER;
                     76: 
                     77: /* This struct holds the static data that allows translation between the
                     78:    EA type and descriptor string, etc.  Data is global. */
                     79: 
                     80: struct _EADATA
                     81: {
                     82:    USHORT usPrefix;
                     83:    CHAR   szFormat[36];
                     84:    USHORT usFldType;
                     85: };
                     86: typedef struct _EADATA EADATA;
                     87: 
                     88: BOOL OpenFile(HWND,USHORT);
                     89: BOOL AddEA(HWND);
                     90: BOOL QueryEAs(CHAR *);
                     91: BOOL EditEAValue(HWND, PASSDATA *);
                     92: BOOL EAExists(CHAR *);
                     93: BOOL EditEA(HWND);
                     94: BOOL CheckEAIntegrity(CHAR *,USHORT);
                     95: MRESULT EXPENTRY OpenFileProc  (HWND, USHORT, MPARAM, MPARAM);
                     96: MRESULT EXPENTRY MainDlgProc   (HWND, USHORT, MPARAM, MPARAM);
                     97: MRESULT EXPENTRY AddEAProc     (HWND, USHORT, MPARAM, MPARAM);
                     98: MRESULT EXPENTRY AsciiEditProc (HWND, USHORT, MPARAM, MPARAM);
                     99: MRESULT EXPENTRY IconDlgProc   (HWND, USHORT, MPARAM, MPARAM);
                    100: MRESULT EXPENTRY MultiTypeProc (HWND, USHORT, MPARAM, MPARAM);
                    101: VOID  FillDirListBox  (HWND,CHAR *);
                    102: VOID  FillFileListBox (HWND);
                    103: VOID  Free_FEAList(HOLDFEA *,DELETELIST *);
                    104: VOID  ShowEAType(HWND);
                    105: VOID  DeleteCurEA(HWND);
                    106: VOID  WriteEAs(VOID);
                    107: VOID  ChangeName(HOLDFEA *,CHAR *);
                    108: VOID  MultiAdd(HWND, HOLDFEA *, PASSDATA FAR *);
                    109: SHORT ParseFileName (CHAR *, CHAR *);
                    110: USHORT LookupEAType(USHORT);
                    111: USHORT CurEAType(HOLDFEA *);
                    112: USHORT GetUSHORT(HOLDFEA *,USHORT);
                    113: HOLDFEA *GetCurFEA(HWND, HOLDFEA *);
                    114: CHAR *MultiTypeIndex(CHAR *, USHORT);
                    115: CHAR *EAValueString(CHAR *);
                    116: VOID GetMem(PPVOID, ULONG);
                    117: VOID ResizeMem(PVOID, ULONG, ULONG);
                    118: 
                    119: #define        FreeMem(p)      DosFreeMem(p)
                    120: 
                    121: #define ARGFILE             1
                    122: #define MAX_GEA             500L /* Max size for a GEA List              */
                    123: #define Ref_ASCIIZ          1    /* Reference type for DosEnumAttribute  */
                    124: #define MAXEANAME           255  /* Maximum length an EA Name can be     */
                    125: #define MAXEAVALUE         2048  /* Arbitrary max edit fld len of EA Val */
                    126: #define EATABLESIZE          12  /* Number of entries in ConvTable       */
                    127: #define GROWSIZE            512  /* Minimum size to increase the heap by */
                    128: #define FILE_ALL         0x0007  /* Read-only, sys, hidden, & normal     */
                    129: #define MAXSHOWSIZE          34  /* Number of chars to place in desc lbox*/
                    130: #define LENUSHORTBUF          6  /* Buf size needed to for ascii USHORT  */
                    131: 
                    132: /* Return values from ParseFileName */
                    133: #define FILE_INVALID          0  /* The filename was invalid */
                    134: #define FILE_PATH             1  /* The filename was a path  */
                    135: #define FILE_VALID            2  /* The filename was valid   */
                    136: 
                    137: /* definition of level specifiers. required for File Info */
                    138: 
                    139: #define GetInfoLevel1   1                   /* Get info from SFT */
                    140: #define GetInfoLevel2   2                   /* Get size of FEAlist */
                    141: #define GetInfoLevel3   3                   /* Get FEAlist given the GEAlist */
                    142: #define GetInfoLevel4   4                   /* Get whole FEAlist */
                    143: #define GetInfoLevel5   5                   /* Get FSDname */
                    144: 
                    145: #define SetInfoLevel1   1                   /* Set info in SFT */
                    146: #define SetInfoLevel2   2                   /* Set FEAlist */
                    147: 
                    148: #define     OPENMODE    OM_DENY_NONE+OM_READ_WRITE
                    149: #define     OPENFLAG    OF_OPEN_FILE
                    150: #define     CREATFLAG   OF_CREATE_FILE+OF_FAIL
                    151: #define     REPLFLG     OF_REPLACE_FILE
                    152: 
                    153: #define EA_LPBINARY     0xfffe /* Length preceeded binary            */
                    154: #define EA_LPASCII      0xfffd /* Length preceeded ascii             */
                    155: #define EA_ASCIIZ       0xfffc /* Asciiz                             */
                    156: #define EA_LPBITMAP     0xfffb /* Length preceeded bitmap            */
                    157: #define EA_LPMETAFILE   0xfffa /* metafile                           */
                    158: #define EA_LPICON       0xfff9 /* Length preceeded icon              */
                    159: #define EA_ASCIIZFN     0xffef /* Asciiz file name of associated dat */
                    160: #define EA_ASCIIZEA     0xffee /* Asciiz EA of associated data       */
                    161: #define EA_MVMT         0xffdf /* Multi-value multi-typed field      */
                    162: #define EA_MVST         0xffde /* Multy value single type field      */
                    163: #define EA_ASN1         0xffdd /* ASN.1 field                        */
                    164: 
                    165: #define  HM_VALIDFLAGS  0x0003
                    166: 
                    167: /****** Resource IDs *****/
                    168: 
                    169: #define IDR_EAD             1
                    170: #define IDD_MULTILIST       2
                    171: #define IDD_BITMAP          3
                    172: #define IDD_ASCIIZ          4
                    173: #define ID_MENU_MAIN        5
                    174: #define IDD_OPENBOX         6
                    175: #define IDD_PATH            7
                    176: #define IDD_FILEEDIT        8
                    177: #define IDD_DIRLIST         9
                    178: #define IDD_FILELIST       10
                    179: #define IDD_MAIN           11
                    180: #define IDD_FNAME          12
                    181: #define IDD_LBOX           13
                    182: #define IDD_EATYPE         14
                    183: #define IDD_ADD            15
                    184: #define IDD_DELETE         16
                    185: #define IDD_COPY           17
                    186: #define IDD_EDIT           18
                    187: #define IDD_PASTE          19
                    188: #define IDD_NEWFILE        20
                    189: #define IDD_WRITE          21
                    190: #define IDD_QUIT           22
                    191: #define IDD_ADDEA          23
                    192: #define IDD_EANAME         24
                    193: #define IDD_NEW            25
                    194: #define IDD_EXISTING       26
                    195: #define IDD_ASCIIEDIT      27
                    196: #define IDD_EAVALUE        28
                    197: #define IDD_ICONWIN        29
                    198: #define BMP_EMPTY          30
                    199: #define IDD_ICON           31
                    200: #define IDD_MULTIBOX       32
                    201: #define DID_DONE           33
                    202: #define IDD_TITLE          34
                    203: #define IDD_LPDATA         35
                    204: #define IDD_NEEDBIT        36
                    205: #define IDD_CODEPAGE       37
                    206: 
                    207: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.