home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tolkit45.zip / os2tk45 / samples / mm / mcispy / mcispy.h < prev    next >
Text File  |  1999-05-11  |  14KB  |  276 lines

  1. /*********************** START OF SPECIFICATIONS *******************************
  2. *
  3. * SOURCE FILE NAME: MCISPY.H
  4. *
  5. * DESCRIPTIVE NAME: MCI Spy Dialog Definitions
  6. *
  7. *
  8. * FUNCTION: Component Global Data Structures, and Constant definitions
  9. *
  10. *
  11. *********************** END OF SPECIFICATIONS ********************************/
  12. #define DEVICECHARS             9   /* Max Chars in Device Name       */
  13. #define HM_RESOURCEID           0   /* Help Resource ID               */
  14. #define MAX_SYSINFO_RETURN      512 /* Maximum sysinfo return size    */
  15. #define MAXDEVICES              20  /* Max Number of physical devices */
  16. #define MAX_MCI_MSGS            59  /* Max Number of MCI Messages     */
  17. #define NUM_COMMON_FLAGS         9  /* Max Number of Common Flags     */
  18. #define MAXOPENS                20  /* Maximum Number of Simult Opens */
  19.  
  20. /* Device Specific data table */
  21.  
  22. typedef struct _deviceData
  23.   {
  24.    SZ     szPhysicalDevName[DEVICECHARS];/* Physical device name     */
  25.    SZ     szProductInfo[MAX_PRODINFO];   /* Product Information      */
  26.    SZ     szLogDevName[30];              /* Logical Device Name      */
  27.   }PHYSDEV_DATA;
  28.  
  29. typedef struct _MCIMessageTable {
  30.     USHORT  usMsg;                      /* MCI Message Value         */
  31.     SZ      szMessage[80];              /* MCI Message String        */
  32.     BOOL    fExclude;                   /* Filter Toggle Flag        */
  33. }MCIMessageTable ;
  34.  
  35. typedef struct _MCIDevTypTable {
  36.     USHORT  usDevType;                 /* Device Type ID             */
  37.     SZ      szDevType[24] ;            /* Device Type String         */
  38. }MCIDevTypTable ;
  39.  
  40. typedef struct _OpenPID {
  41.   ULONG  ulDevId;                     /* Open Device Id      */
  42.   ULONG  ulPID;                       /* Process Id          */
  43.   BOOL   fExclude;                    /* Filter Toggle Flag  */
  44.   USHORT usDevTyp;                    /* Device Type Const   */
  45. }OPENPID;
  46.  
  47. typedef struct _OpenPIDAl {
  48.   SZ     szAlias[124];                /* Open Device Alias   */
  49.   ULONG  ulPID;                       /* Process Id          */
  50.   BOOL   fExclude;                    /* Filter Toggle Flag  */
  51.   SZ     szDevTyp[30];                /* Device Type String  */
  52. }OPENPIDAL;
  53.  
  54. /* Maximum number of open devices is assumed to be 30. Modify
  55. ** this number as necessary
  56. */
  57. typedef struct _OpenList {
  58.   OPENPID      ulOpenList[20];   /* Device Ids of open list    */
  59.   OPENPIDAL    szAlias[20];      /* Alias(es) of  open list    */
  60.   ULONG      ulNumOpen;          /* Total Number of Opens      */
  61. }OPEN_LIST;
  62.  
  63. /* Shared Memory Packet structure. This Structure is allocated by the
  64. ** stub MDM and passed to the application.
  65. */
  66.  
  67. typedef struct _ThreadBlk {
  68.   USHORT    wMsg;                      /* MCI Message     */
  69.   USHORT    wDevID;                    /* Device ID       */
  70.   ULONG     dwParam1;                  /* Message Flags   */
  71.   ULONG     dwParam2;                  /* Message Data    */
  72.   USHORT    wUserParm;                 /* User parameter  */
  73.   SZ        szCmd[1024];               /* String Command  */
  74.   PVOID     pvNotPacket;               /* Notify Packet Base Address */
  75.   ULONG     ulPID;                     /* Process Id      */
  76.   ULONG     ulReturnCode;              /* Return Code     */
  77.   HEV       SysSndsEvtSem;             /* System Sounds   */
  78.   HEV       SysSndsSyncSem;            /* System Sounds   */
  79. }THREAD_BLOCK;
  80.  
  81. typedef struct _spyblock {
  82.   HWND            hwndc1, hwnd1;                   /* Window Handles        */
  83.   HWND            hwndMLE;                         /* Cmnd monitor MLE      */
  84.   HWND            hwndHelpInstance;                /* Help Inst habdle      */
  85.   HAB             hab;                             /* Anchor Block          */
  86.   QMSG            qmsg;                            /* Message Queue         */
  87.   HMQ             hmq;                             /* Handle to Queue       */
  88.   HPS             hps;                             /* Presentation Space    */
  89.   IPT             ipt;                             /* MLE Insertion point   */
  90.   HFILE           hfileLog;                        /* Script file handle    */
  91.   HMTX            hmtxPrntSem;                     /* Print Semaphore       */
  92.   CHAR            szLogFile[254];                  /* Log File name         */
  93.   PVOID           pvPacket;                        /* Shared Memory pointer */
  94.   FONTMETRICS     fm;                              /* Font metrics struct   */
  95.   PHYSDEV_DATA    PhysicalDevData[MAXDEVICES] ;    /* Audio Device Info     */
  96.   USHORT          usNumDevices ;                   /* Total Number of devices */
  97.   OPEN_LIST       OpenList;                        /* List of Open Instances */
  98.   BOOL            fNoCmd,fNoStr,fNoDrv;            /* API Filter Flags      */
  99.   BOOL            fNoLog;                          /* Message Logging Flag  */
  100.   BOOL            fDevTypFil;                      /* Device Type     Flag  */
  101.   BOOL            fDevIdFil;                       /* Device Id       Flag  */
  102.   ULONG           ulDevTypFil[MAXDEVICES];         /* Filter Dev Types      */
  103.   SZ              szDevTypFil[MAXDEVICES][30];     /* Filter Dev Types      */
  104.   SZ              szTitle[160];                    /* Title Text            */
  105.   USHORT          usNumFilDevs;                    /* Number Of Filter Devs */
  106.   LONG (* APIENTRY QueryOpenInstance) (OPEN_LIST *, BOOL);/* PFN QueryOpenInstance*/
  107.   LONG (* APIENTRY SystemSounds) (BOOL);           /* PFN SystemSounds  */
  108. }MCISPY_BLOCK;
  109.  
  110. /* MCISPY Internal function prototypes  */
  111.  
  112. FNWP   AboutDlgProc           ;     /* Product Info Dialog Procedure       */
  113. FNWP   FilterMsgDlgProc       ;     /* Filter Messages Dialog Procedure    */
  114. FNWP   FilterDevTypDlgProc    ;     /* Filter Device Type Dialog Procedure */
  115. FNWP   FilterDevIdDlgProc     ;     /* Filter Device Id  Dialog Procedure  */
  116. FNWP   SpyWinProc             ;     /* Main Window Procedure               */
  117. FNWP   ViewInstDevDlgProc     ;     /* Installed Devices Dialog Procedure  */
  118. FNWP   ShowFlagDlgProc        ;     /* Show MCI Flag Value Dialog Proc     */
  119. VOID   Initialize(MCISPY_BLOCK * ); /* MCISPY Application Initialization   */
  120. VOID   Terminate (HMQ hmq);         /* MCISPY Application Termination      */
  121.  
  122.  
  123. VOID   RegisterSpyWithMDM (MCISPY_BLOCK *)  ;     /* MCISPY Application Registration     */
  124.  
  125. PSZ    LongToString (LONG );             /* Conversion helper     */
  126.  
  127. LONG   mprintf(PSZ format, ...);         /* Error Print routine   */
  128.  
  129. VOID   GetSharedMemory(MCISPY_BLOCK *);  /* Obtain Shared Memory  */
  130.  
  131. void   DisplayMCIMsg (MCISPY_BLOCK *);   /* Display MCI Messages  */
  132.  
  133. void   DisplayMCIString (MCISPY_BLOCK * pSpyBlock); /* String Interface */
  134.  
  135. APIRET OpenFile(PSZ szFileName,ULONG *pFileHandle); /* Open Log File   */
  136.  
  137. APIRET Write2File(HFILE FileHandle,PSZ buffer);     /* Write to a Log file */
  138.  
  139. RC     OpenFileDlg (HWND hwndOwner,PSZ pszTitle,PSZ FileName, PSZ FullFile);
  140.  
  141. VOID   QueryInstalledDevices (MCISPY_BLOCK * pSpyBlock);
  142.  
  143. /* Application Constant Definitions */
  144.  
  145. #define WND_FRM                 2000
  146. #define IDM_PRODUCTINFO         106                    /* Product Info    */
  147. #define IDR_BITMAP              108                    /* Bitmap          */
  148. #define IDC_BITMAP              109                    /* Bitmap          */
  149. #define IDM_HELP                300                    /* Help Menu       */
  150. #define IDM_HELP_GEN            301                    /* General help    */
  151. #define IDM_HELP_KEYS           302                    /* Keys Help       */
  152. #define IDM_HELP_PRODINFO       303                    /* Product Info    */
  153. #define IDM_HELP_USING          304                    /* Using Help      */
  154. #define IDM_HELP_INDEX          305                    /* Help Index      */
  155. #define ID_ACTLIST              003                    /* List box ID     */
  156. #define IDM_OPEN                325                    /* Menu Script     */
  157. #define IDM_SAVE                326                    /* Menu Script     */
  158. #define IDM_CLOSE               327                    /* Menu Script     */
  159. #define IDM_LOG                 328                    /* Menu Script     */
  160. #define IDM_FILE                329                    /* Menu Script     */
  161. #define IDM_IDEVS               333                    /* Menu Script     */
  162. #define IDM_VFILMSG             334                    /* Menu Script     */
  163. #define IDM_VIEW                336                    /* Menu Options    */
  164. #define IDM_INSTDATA            338                    /* Menu Options    */
  165. #define IDM_FILMSG              340                    /* Menu Script     */
  166. #define IDM_FILDEVTYP           341                    /* Menu Script     */
  167. #define IDM_FILDEVID            342                    /* Menu Script     */
  168. #define IDM_EDIT                344                    /* Menu Script     */
  169. #define IDM_EDCOPY              345                    /* Menu Script     */
  170. #define IDM_EDCLEAR             346                    /* Menu Script     */
  171. #define IDM_EDDISCARD           347                    /* Menu Script     */
  172. #define IDM_EDFONT              348                    /* Menu Script     */
  173. #define IDM_NOSTR               349                    /* Menu Script     */
  174. #define IDM_NOCMD               350                    /* Menu Script     */
  175. #define IDM_NONOTIFY            351                    /* Menu Script     */
  176. #define IDM_FLAGS               352                    /* Menu Script     */
  177. #define IDM_NOSYS               353                    /* Menu Script     */
  178. #define ID_INSTLDHNDLRS         759                     /* Instl Hndlrs    */
  179. #define ID_DEVNAMESDLG          760                     /* Instl Hndlr Dlg */
  180. #define ID_FILTERMSG            761                     /* Instl Hndlr Dlg */
  181. #define ID_INSTINFODLG          762                     /* Instl Hndlr Dlg */
  182. #define ID_INSTLSTDLG           763                     /* Instl Hndlr Dlg */
  183. #define ID_FILTERDEVIDS         766                     /* Instl Hndlr Dlg */
  184. #define ID_FILTERDEVTYP         767                     /* Instl Hndlr Dlg */
  185. #define ID_FLAGSDLG             768                     /* Instl Hndlr Dlg */
  186. #define LI_FILTERMSG            400                    /* Protocol List ID */
  187. #define LI_DEVNAMES             401                    /* Protocol List ID */
  188. #define LI_OPENINST             402                    /* Active Hndlrs LID*/
  189. #define LI_MSGS                 403                    /* Active Hndlrs LID*/
  190. #define LI_FLAGS                404                    /* Active Hndlrs LID*/
  191. #define LI_FILTERDEVS           405                    /* Active Hndlrs LID*/
  192. #define PB_HELP                 505                    /* Help Button      */
  193. #define PB_OK                   506                    /* OK Button        */
  194. #define PB_ALL                  510                    /* OK Button        */
  195. #define PB_NONE                 511                    /* OK Button        */
  196. #define PB_TIMERON              512                    /* OK Button        */
  197. #define PB_TIMEROFF             513                    /* OK Button        */
  198. #define PB_ACTON                514                    /* OK Button        */
  199. #define PB_ACTOFF               515                    /* OK Button        */
  200. #define PB_CLEAR                516                    /* OK Button        */
  201. #define EF_FLAG                 700                    /* Static Text ID   */
  202.  
  203. #define MSG_BOX_ID              623                    /* Msg Box ID        */
  204. #define SPY_NOTIFY              0x5001                 /* Command Interface */
  205. #define SPY_STRING              0x5002                 /* String Interface  */
  206. #define SPY_DRIVER              0x5003                 /* Driver Notify     */
  207. #define SPY_ERRRC               0x5004                 /* Error Conditions  */
  208. #define SPY_DEVICE              0x5005                 /* Resource Managemt */
  209.  
  210. /* MCISPY Help Manager  definitions */
  211.  
  212. #define  MAINHELPTABLE           700    /* Main Help Table ID    */
  213. #define  HELP_MAIN               703
  214. #define  INDEXHELP               801
  215. #define  GENERALHELP             802
  216. #define  USINGHELP               803
  217. #define  HELPPRODINFO            804
  218. #define  GENHLP                  29
  219. #define  KEYSHELP                23
  220. #define  FILTERMSGHLP            30
  221. #define  FILTERDEVTYPHLP         31
  222. #define  FILTERDEVIDHLP          32
  223. #define  SHOWFLAGHLP             33
  224. #define  INSTDEVHLP              34
  225. #define  STDHLP                  35
  226. #define  HELP_SUBTABLE_SPY       36
  227. #define  SPYHLP                  37
  228.  
  229. #define HELP_TABLE              807  //Window ID
  230.  
  231. #define  InsertListItem(LboxID,     \
  232.                         InsertOrder,\
  233.                         Text)       \
  234.          (WinSendDlgItemMsg (hwnd,                      \
  235.                              LboxID,                    \
  236.                              LM_INSERTITEM,             \
  237.                              MPFROMSHORT(InsertOrder),  \
  238.                              MPFROMP(Text)))
  239. #define  InitMLE(hwnd,     \
  240.                  MLEBuffer) \
  241.          (WinSendMsg (hwnd,                \
  242.                       MLM_SETIMPORTEXPORT, \
  243.                       MPFROMP(MLEBuffer),  \
  244.                       MPFROMSHORT((USHORT)sizeof(MLEBuffer))))
  245.  
  246. #define  SetMLEFormat(hwnd)         \
  247.          (WinSendMsg (hwnd,         \
  248.                       MLM_FORMAT,   \
  249.                       MPFROMSHORT(MLFIE_NOTRANS),\
  250.                       MPFROMSHORT(0)))
  251.  
  252.  
  253. #define ImportMLE(hwnd,            \
  254.                   pt,              \
  255.                   MLEBuffer)       \
  256.         (WinSendMsg (hwnd,         \
  257.                      MLM_IMPORT,   \
  258.                      MPFROMP(&pt), \
  259.                      MPFROMSHORT((USHORT)strlen(MLEBuffer))))
  260.  
  261.  
  262. #define DeleteMLE(hwnd,                       \
  263.                   MLEBuffer)                  \
  264.         (WinSendMsg (hwnd,                    \
  265.                      MLM_DELETE,              \
  266.                      MPFROMLONG(ipt),         \
  267.                      MPFROMLONG((ULONG)sizeof(MLEBuffer))))
  268.  
  269.  
  270.  
  271. #define CopyMLE(hwnd)                        \
  272.         (WinSendMsg (hwnd,                   \
  273.                      MLM_COPY,               \
  274.                      MPFROMLONG(0),          \
  275.                      MPFROMLONG(0)))
  276.