home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / sdktools / porttool / port.h < prev    next >
Text File  |  1997-10-05  |  3KB  |  70 lines

  1.  
  2. /******************************************************************************\
  3. *       This is a part of the Microsoft Source Code Samples. 
  4. *       Copyright (C) 1993-1997 Microsoft Corporation.
  5. *       All rights reserved. 
  6. *       This source code is only intended as a supplement to 
  7. *       Microsoft Development Tools and/or WinHelp documentation.
  8. *       See these sources for detailed information regarding the 
  9. *       Microsoft samples programs.
  10. \******************************************************************************/
  11.  
  12. // include windows.h before including this header file into your source
  13.  
  14. // define some string length constants
  15. #define    MAXTOKENLEN          100
  16. #define    MAXHELPLEN          100
  17. #define    MAXISSUELEN          1024
  18. #define    MAXSUGGESTLEN      1024
  19.  
  20. // define option flags
  21. #define    PT_IGNORETOKEN      0x00010000    // informs port.dll to ignore this token
  22. #define    PT_DEFAULT          0x00000000    // checks for everything
  23. #define    PT_NOAPIS          0x00000002    // do not check for APIs
  24. #define    PT_NOMESSAGES      0x00000004    // do not check for messages
  25. #define    PT_NOTYPES          0x00000008    // do not check for types
  26. #define    PT_NOSTRUCTURES      0x00000010    // do not check for structures
  27. #define    PT_NOMACROS          0x00000020    // do not check for macros
  28. #define    PT_NOCONSTANTS      0x00000040    // do not check for constants
  29. #define    PT_NOCUSTOM          0x00000080    // do not check for custom tokens
  30. #define    PT_IGNORECASE      0x00000100    // disable case sensitivity
  31.                         //   (not helpful for APIs and MSGs)
  32.  
  33.  
  34. // result structure returns results of line checked
  35. typedef struct tagResult
  36.     {
  37.     char    *lpszToken;
  38.     char    *lpszHelpStr;
  39.     char    *lpszIssue;
  40.     char    *lpszSuggest;
  41.     int     nPosToken;
  42.     }RESULT, * LPRESULT;
  43.  
  44.  
  45. // function checks a string for a matching token
  46. BOOL WINAPI CheckString (char *lpszSrc, DWORD fSearch, LPRESULT lpResult);
  47. //    lpszSrc  - source string to search
  48. //    fSearch  - search flags define how to check string
  49. //    lpResult - structure of data passed to/from DLL
  50. //
  51. // When calling this function you must pass a valid LPRESULT structure having
  52. //   allocated memory for each of the string pointer fields in the structure.
  53. //   It is recommended that you allocate enough memory to fulfill the max length
  54. //   for each field as defined by the constants above.    Also, you must indicate the
  55. //   actual length of each string allocated in the first WORD of each string.  The
  56. //   CheckString function will copy at most length-1 characters and zero terminate
  57. //   the string for you.
  58. //
  59. // New for version 2.2.  The option to ignore a specific issue for the duration of
  60. //   the DLL is loaded is now provided.  This is done by calling the CheckString
  61. //   function with the PT_IGNORETOKEN bit set in the search flags.  In this case,
  62. //   the CheckString function toggles the ignore state on a token matching the string
  63. //   lpszSrc passed to the function.  The lpResult parameter is ignored in this case.
  64. //   Successive calls with the PT_IGNORETOKEN bit can be used to toggle the state of
  65. //   any token to IGNORED or not IGNORED.
  66. //  NOTE: The PT_IGNORETOKEN flag cannot be reset by the DLL since the search flags
  67. //   parameter is passed by value.  The application that calls CheckString must reset
  68. //   the flag when the function returns.
  69. //
  70.