File:  [OS/2 SDKs] / os232sdk / toolkt20 / c / samples / spy / spy.h
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Thu Aug 9 12:26:30 2018 UTC (7 years, 9 months ago) by root
Branches: msft, MAIN
CVS tags: os2sdk-1990, HEAD
Microsoft OS/2 SDK 2.0 05-30-1990

/* Put in include to dummy memory allocator */
#include "allocmem.h"

/****** Resource IDs *****/

#define IDR_SPY    1
#define IDR_SPYR   2
#define IDD_DLGSPY  0x001
#define IDD_MessagesDlg  0x002
#define IDD_OutputsDlg  0x003
#define IDD_WindowsDlg  0x004
#define IDD_SaveListDlg 0x005
#define IDD_About1Dlg   0x006
#define IDD_ListNearDlg 0x008
#define IDD_MsgQueueDlg 0x009
#define IDD_SendMsgDlg   0x00A

/****** Menu command IDs *****/
/* (by convention, hi byte is menu index, lo byte is dispatch table index) */

/* Top level Menu Ids */
#define MNU_SPY         0x1000
#define MNU_WINDOWS     0x1100
#define MNU_WNDSEL      0x1110
#define MNU_WNDDUMP     0x1120
#define MNU_MESSAGES    0x1200
#define MNU_HOOKS       0x1300
#define MNU_SNDOUTPUT   0x1310
#define MNU_OUTPUTS     0x1400
#define MNU_HELP        0x1500


/* Spy Menu */
#define CMD_ACTIVE      0x0100
#define CMD_EXIT        0x0101
#define CMD_CLRWIN      0x0102
#define CMD_SAVEWIN     0x0103
#define CMD_SAVEOPT     0x0104

/* Window Menu */
#define CMD_WINDOWS     0x0200
#define CMD_QUEUES      0x0201
#define CMD_WNMSSEL     0x0202
#define CMD_WNMSDSL     0x0203
#define CMD_ALLWNDWS    0x0204
#define CMD_ALLFRAMES   0x0205
#define CMD_WNDPWIN     0x0206
#define CMD_WNDPALL     0x0207
#define CMD_DACCEL      0x0208

/* Message Menu */
#define CMD_MESSAGES    0x0300
#define CMD_MGDABLE     0x0301
#define CMD_MGEABLE     0x0302
#define CMD_ALPHASORT   0x0303
#define CMD_SENDMSG     0x0304

/* Hooks Menu */
#define CMD_INPUTHOOK   0x0400
#define CMD_SENDMSGHOOK 0x0401
#define CMD_SENDEXTEND  0x0402
#define CMD_SENDSTACK   0x0403

/* Outputs Menu */
#define CMD_OUTSCREEN   0x0500
#define CMD_OUTTERM     0x0501
#define CMD_OUTFILE     0x0502
#define CMD_OUTPUTS     0x0503

/* Help Menu */
#define CMD_HOWHELP         0x0600
#define CMD_HELPEXTENDED    0x0601
#define CMD_HELPKEYS        0x0602
#define CMD_HELPINDEX       0x0603
#define CMD_ABOUT           0x0604

/* From the Main Dialog */
#define DID_SPYLIST     0x0001


/* From the Options Dialog */
#define DID_OMSGLIST    0x0100
#define DID_MALL        0x0101
#define DID_MNONE       0x0102
#define DID_MCON        0x0103
#define DID_MCOFF       0x0104
#define DID_MMON        0x0105
#define DID_MMOFF       0x0106
#define DID_MFON        0x0107
#define DID_MFOFF       0x0108
#define DID_MSGEDIT     0x0109

#define DID_OINPUT      0x0120
#define DID_OSENDMSG    0x0121
#define DID_OTHERMSGS   0x0122

#define DID_WINDOW      0x0110
#define DID_DEBUG       0x0111
#define DID_FILE        0x0112
#define DID_WINDOWLINES 0x0113
#define DID_FILENAME    0x0114

/* From the Windows Dialog */
#define DID_WSELALL     0x0200
#define DID_WUNSELALL   0x0201
#define DID_WSELMOUSE   0x0202

#define DID_WINDOWLIST  0x0203
#define DID_WHANDLE     0x0204
#define DID_WTEXT       0x0205
#define DID_WCLASS      0x0206
#define DID_WPARENT     0x0207
#define DID_WCHILD      0x0208
#define DID_WOWNER      0x0209
#define DID_WRECT       0x020a
#define DID_WID         0x020b
#define DID_WSTYLE      0x020c
#define DID_WCSTYLE     0x020d
#define DID_WPFNWP      0x020e
#define DID_WHMQ        0x020f
#define DID_WPID        0x0210
#define DID_WTID        0x0211
#define DID_WOLINE1     0x0212
#define DID_WOLINE2     0x0213
#define DID_WOLINE3     0x0214
#define DID_WOLINE4     0x0215

/* From the save file dialog */
#define DID_APPEND              0x0300

/* From the About dialog */
#define DID_ICON                0x0500
#define DID_ICONR               0x0501

/* From the Send Message dialog */
#define DID_HWND                0x0600
#define DID_SELHWND             0x0601
#define DID_COMMAND             0x0602
#define DID_MPARAM1             0x0603
#define DID_MPARAM2             0x0604
#define DID_RESULT              0x0605
#define DID_STRING1             0x0606
#define DID_STRING2             0x0607
#define DID_POST                0x0608
#define DID_SEND                0x0609

/*
 * Define data structures
 */
typedef struct _SPYOPT { /* Spy Options */
    /* Now define the output options */
    /* In options dialog */
    BOOL        fWindow;
    BOOL        fDebugOutput;
    BOOL        fFile;
    SHORT       cWindowLines;
    HFILE       hfileSpy;               /* if all lines go to file */

    /* SendMsg Hook Output options */
    USHORT      bHooks;                 /* Which hooks are enabled */
    BOOL        fSendExtend;            /* Should extended data be displayed */
    BOOL        fSendStack;             /* Should call stack be displayed */

    /* In Save file dialog */
    BOOL        fAppend;

    /* In Message Dialog */
    BOOL        fDispOtherMsgs;         /* Undefined messages displayed? */
    BOOL        fAlphaSortMsgList;      /* Should the message list be sorted */

} SPYOPT;       /* spyoptions */

typedef struct _spystr {

    /* Define file names at end, will define as seperate strings in os2.ini */
    CHAR        szFileName[100];
    char        szSaveFileName[100];
} SPYSTR;       /* Strings are seperated from options */

typedef struct _IDTONAME {
    USHORT  id;             /* id of window */
    char    *szIdName;      /* String with text of ID */
} IDTONAME;

/*
 * Define the system defined limits
 */
/* This is a real hack, estimate size of WND Structure */
#define SIZEOFWND   34
#define MAXMSGBYTES 100

/*
 * Define Message output information
 */

#define MSGI_ENABLED    0x0001
#define MSGI_MOUSE      0x0002  /* Mouse type messages */
#define MSGI_KEY        0x0004  /* Key type messages */
#define MSGI_FREQ       0x0010  /* Frequent messages generaly ignored */


typedef struct _MSGI {

    USHORT  msg;
    char    *szMsg;
    USHORT  wOptions;
    UCHAR   bMPTypes;
    SHORT   iListBox;
} MSGI;

/*
 * Now define all of the global strutures that are exported from
 * the initializition file
 */
extern SPYOPT       spyopt;
extern SPYSTR       spystr;
extern MSGI         rgmsgi[];
extern SHORT        cmsgi;          /* Count of message info items */
extern IDTONAME     rgidtoname[];
extern SHORT        cToName;        /* Count of items in cToName */


/*
 * External definitions used between source files
 */

extern HAB         hab;
extern HMQ         hmqSpy;
extern HWND        hwndSpy;
extern HWND        hwndSpyFrame;
extern HWND        hwndSpyList;
extern HWND        hwndWindowLB;
extern HWND        hwndMessageLB;
extern HWND        hwndHelpInstance;
extern HHEAP       hHeap;
extern SHORT       cxBorder;
extern SHORT       cyBorder;

extern HPOINTER    hptrArrow;
extern HPOINTER    hptrSelWin;

extern BOOL        fDebug;
extern USHORT      iCurItemFocus;              /* Index to item that has the focus */
extern BOOL        fSpyActive;                 /* Any non-zero is true */
extern BOOL        fTrackingListBox;           /* Tracking windows active ? */
extern BOOL        fAllFrames;                 /* Are we processing all frames ? */
extern BOOL        fAllWindows;                /* Are we processing all windows ? */

extern HWND        hwndWinDlgDisp;             /* hwnds info in Window Dialog */



/*
 * simple structure for sorting Hwnds in dumping
 */
typedef struct _spwd {
    HWND    hwnd;
    SHORT   index;
} SPWD;

#define     MAXSPYDUMP  1000         /* Max of a thousand windows */
extern SHORT wDumpCount;             /* Count of which window is being dumped */
extern SPWD  *pspwd;


/*
 * Data definitions for Dumping Accelerator tables, etc
 */
// Define some simple accel table stuff
typedef struct _aftos {
    USHORT      usBit;
    char        *szBit;
} AFTOS;

extern AFTOS aaftos[];
extern SHORT caftos;

// Vkey to string table
typedef struct _vktos {
    char        *szVkey;
} VKTOS;


extern VKTOS avktos[];
extern USHORT ivktosMin;        // Min index that has data.
extern USHORT cvktos;           // count of items in table.

/*
 * External function definitions
 */
/*
 * Spy.c
 */
extern MRESULT EXPENTRY SpyWndProc(HWND, USHORT, MPARAM, MPARAM);
extern USHORT  UConvertStringToNum(char *);
extern void    OutputString(char [], SHORT);
extern MSGI    *PmsgiFromMsg(USHORT);

/*
 * Message.c
 */
extern MRESULT EXPENTRY SpyMsgDlgProc(HWND, USHORT, MPARAM, MPARAM);
extern void    UpdateHooksMsgTable(void);
extern void    EnableOrDisableMsg(BOOL);
extern MRESULT EXPENTRY SendMsgDlgProc(HWND, USHORT, MPARAM, MPARAM);

/*
 * Options.c
 */
extern MRESULT EXPENTRY SpyOutputsDlgProc(HWND, USHORT, MPARAM, MPARAM);
extern MRESULT EXPENTRY SpySaveListDlgProc(HWND, USHORT, MPARAM, MPARAM);
extern MRESULT EXPENTRY AboutWndProc(HWND, USHORT, MPARAM, MPARAM);

/*
 * Queue.c
 */
extern MRESULT EXPENTRY SpyQueuesDlgProc(HWND, USHORT, MPARAM, MPARAM);
extern void    EnableOrDisableMsg(BOOL);
extern void    UpdateHooksMsgTable(void);

/*
 * Window.c
 */
extern MRESULT EXPENTRY SpyWindowsDlgProc(HWND, USHORT, MPARAM, MPARAM);
extern void    DumpOneWindowInfo(void);
extern SHORT   DumpAllWindowsInfo(HWND, SHORT);
extern void    DumpFrameAcclTable(void);
extern void    DumpWindowIndex(SHORT);
extern void    SelOrDeselWithMouse(BOOL);
extern HWND    HwndSelWinWithMouse(HWND, void (*)(HWND, HWND), BOOL);

/*
 * SpyUtil.asm
 */
extern  BOOL FGuessValidPointer (PVOID pVoid, SHORT cbStruct,
        ULONG ulMemFlags);

unix.superglobalmegacorp.com

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