home *** CD-ROM | disk | FTP | other *** search
/ Troubleshooting Netware Systems / CSTRIAL0196.BIN / attach / msj / v10n05 / gotcha.exe / BASEDEFS.H < prev    next >
C/C++ Source or Header  |  1995-05-01  |  5KB  |  156 lines

  1. #ifdef WIN32
  2. #define WIN_NT
  3. #else
  4. #define WIN_DOS
  5. #endif
  6.  
  7. #define WM_MYCOMMAND (WM_USER+1000)
  8.  
  9. #ifdef WIN_DOS
  10. #define WINPROC        long _export FAR PASCAL
  11. #define MDIPROC        long _export FAR PASCAL
  12. #define DLGPROC        BOOL _export FAR PASCAL
  13. #define ENUMPROC       BOOL _export FAR PASCAL
  14. #define WINDOWS_PARAMS HWND hWnd, unsigned msg, WPARAM wParam, LONG lParam
  15. #define DIALOG_PARAMS  HWND hDlg, unsigned msg, WPARAM wParam, LONG lParam
  16. #define ENUM_PARAMS    HWND hWnd, LPARAM lParam
  17. #endif
  18.  
  19. #ifdef WIN_NT
  20. #define WINPROC        LRESULT CALLBACK
  21. #define MDIPROC        LRESULT CALLBACK
  22. #define DLGPROC        BOOL CALLBACK
  23. #define ENUMPROC       BOOL CALLBACK
  24. #define WINDOWS_PARAMS HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam
  25. #define DIALOG_PARAMS  HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam
  26. #define ENUM_PARAMS    HWND hWnd, LPARAM lParam
  27. #endif
  28.  
  29. #define CRACKER_VARS           \
  30.   HWND CRACKER_hWnd;           \
  31.   WORD CRACKER_wNotification;  \
  32.   WORD CRACKER_wID;
  33.  
  34. #ifdef WIN_DOS
  35. #define NOTIFYPARENT(hWndParent,wID,wNotifyCode)                     \
  36.   SendMessage ( hWndParent,                                          \
  37.                 WM_COMMAND,                                          \
  38.                 wID,                                                 \
  39.                 MAKELONG ( GetDlgItem(hWndParent,wID), wNotifyCode ) \
  40.               );
  41. #endif
  42.  
  43. #ifdef WIN_NT
  44. #define NOTIFYPARENT(hWndParent,wID,wNotifyCode)                     \
  45.   SendMessage ( hWndParent,                                          \
  46.                 WM_COMMAND,                                          \
  47.                 MAKELONG ( wID, wNotifyCode ),                       \
  48.                 GetDlgItem(hWndParent,wID)                           \                      \
  49.               );
  50. #endif
  51.  
  52. #ifdef WIN_DOS
  53. #define NOTIFYPARENTPOST(hWndParent,wID,wNotifyCode)                 \
  54.   PostMessage ( hWndParent,                                          \
  55.                 WM_COMMAND,                                          \
  56.                 wID,                                                 \
  57.                 MAKELONG ( GetDlgItem(hWndParent,wID), wNotifyCode ) \
  58.               );
  59. #endif
  60.  
  61. #ifdef WIN_NT
  62. #define NOTIFYPARENTPOST(hWndParent,wID,wNotifyCode)                 \
  63.   PostMessage ( hWndParent,                                          \
  64.                 WM_COMMAND,                                          \
  65.                 MAKELONG ( wID, wNotifyCode ),                       \
  66.                 GetDlgItem(hWndParent,wID)                           \                      \
  67.               );
  68. #endif
  69.  
  70.  
  71. #ifdef WIN_DOS
  72. #define CRACK_MESSAGEsc                      \
  73.   {                                          \
  74.   CRACKER_wID           = wParam;            \
  75.   CRACKER_wNotification = HIWORD (lParam );  \
  76.   CRACKER_hWnd          = LOWORD (lParam );  \
  77.   }                                      
  78. #endif
  79.  
  80. #ifdef WIN_NT
  81. #define CRACK_MESSAGEsc                      \
  82.   {                                          \
  83.   CRACKER_wID           = LOWORD (wParam );  \
  84.   CRACKER_wNotification = HIWORD (wParam );  \
  85.   CRACKER_hWnd          = (HWND)lParam;      \
  86.   }
  87. #endif
  88.  
  89. #ifdef WIN_DOS
  90. #define HICHUNK(lParam) HIWORD(lParam)
  91. #define LOCHUNK(lParam) LOWORD(lParam)
  92. #define MAKECHUNKsc(lParam,lo,hi) lParam=MAKELONG(lo,hi);
  93. #define HILOCHUNK DWORD
  94. #define HILOCHUNKPARAM(lParam) (lParam)
  95. #endif
  96.  
  97. #ifdef WIN_NT
  98.  
  99. typedef struct tagHILOCHUNK
  100.   {
  101.   LONG hi;
  102.   LONG lo;
  103.   }
  104. HILOCHUNK;
  105.  
  106. typedef HILOCHUNK FAR *LPHILOCHUNK;
  107.  
  108. #define HICHUNK(lParam) (((LPHILOCHUNK)(lParam))->hi)
  109. #define LOCHUNK(lParam) (((LPHILOCHUNK)(lParam))->lo)
  110. #define MAKECHUNKsc(lParam,low,high) {lParam.lo=(LONG)(low);lParam.hi=(LONG)(high);}
  111. #define HILOCHUNKPARAM(lParam) ((LONG)(&lParam))
  112. #endif
  113.  
  114. // MACROS FOR VARAIBLE DECLARATIONS 
  115.  
  116. #ifndef INMAIN
  117. #define GLOBAL extern
  118. #define GLOBALCHAR(p1,p2) char p1;
  119. #endif
  120. #ifdef INMAIN
  121. #define GLOBAL
  122. #define GLOBALCHAR(p1,p2) char p1 = p2;
  123. #endif
  124.  
  125. // Endian Independant storage facilities
  126.  
  127. typedef struct diWORDtag
  128.   {
  129.   BYTE   bLo;
  130.   BYTE   bHi;
  131.   }
  132. diWORD;
  133. typedef struct diLONGtag
  134.   {
  135.   diWORD diwLo;
  136.   diWORD diwHi;
  137.   }
  138. diLONG;
  139.  
  140. #define GETWORD(diWord) ((diWord).bHi*256+(diWord).bLo)
  141. #define GETLONG(diLong) (MAKELONG(GETWORD(diLong.diwLo),GETWORD(diLong.diwHi)))
  142.  
  143. #define MAKEdiWORD(diWord,wWord)            \
  144.   {                                         \
  145.   (diWord).bHi = (wWord)/256;                   \
  146.   (diWord).bLo = (wWord)%256;                   \
  147.   }                              
  148.  
  149. #define MAKEdiLONG(diLong,lLong)            \
  150.   {                                         \
  151.   MAKEdiWORD((diLong).diwHi, HIWORD(lLong));  \
  152.   MAKEdiWORD((diLong).diwLo, LOWORD(lLong));  \
  153.   }
  154.  
  155.  
  156.