Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

157 lines
4.5 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. Grabmi.h
  5. Abstract:
  6. Contains function prototypes, constants, and other
  7. items used throughout the application.
  8. Notes:
  9. ANSI & Unicode via TCHAR - runs on Win9x/NT/2K/XP etc.
  10. History:
  11. 07/18/00 jdoherty Created
  12. 12/16/00 jdoherty Modified to use SDBAPI routines
  13. 12/29/00 prashkud Modified to take space in the filepath
  14. 01/23/02 rparsons Re-wrote existing code
  15. --*/
  16. #ifndef _GRABMI_H
  17. #define _GRABMI_H
  18. #include <nt.h>
  19. #include <ntrtl.h>
  20. #include <nturtl.h>
  21. #include <windows.h>
  22. #include <tchar.h>
  23. #include <conio.h> // _tcprintf
  24. #include <stdio.h>
  25. #include <stdlib.h>
  26. #include <strsafe.h>
  27. #include "resource.h"
  28. //
  29. // Function prototypes for our functions stored in the SDB libraries.
  30. //
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #include "shimdb.h"
  34. typedef
  35. BOOL
  36. (SDBAPI
  37. *PFNSdbGrabMatchingInfoA)(
  38. LPCSTR szMatchingPath,
  39. DWORD dwFilter,
  40. LPCSTR szFile
  41. );
  42. typedef
  43. BOOL
  44. (SDBAPI
  45. *PFNSdbGrabMatchingInfoW)(
  46. LPCWSTR szMatchingPath,
  47. DWORD dwFilter,
  48. LPCWSTR szFile
  49. );
  50. }
  51. #endif // __cplusplus
  52. typedef
  53. GMI_RESULT
  54. (SDBAPI
  55. *PFNSdbGrabMatchingInfoExA)(
  56. LPCSTR szMatchingPath, // path to begin gathering information
  57. DWORD dwFilterAndFlags, // specifies the types of files to be added to matching
  58. LPCSTR szFile, // full path to file where information will be stored
  59. PFNGMIProgressCallback pfnCallback, // pointer to the callback function
  60. PVOID lpvCallbackParameter // an additional argument provided to the callback
  61. );
  62. typedef
  63. GMI_RESULT
  64. (SDBAPI
  65. *PFNSdbGrabMatchingInfoExW)(
  66. LPCWSTR szMatchingPath, // path to begin gathering information
  67. DWORD dwFilterAndFlags, // specifies the types of files to be added to matching
  68. LPCWSTR szFile, // full path to file where information will be stored
  69. PFNGMIProgressCallback pfnCallback, // pointer to the callback function
  70. LPVOID lpvCallbackParameter // an additional argument provided to the callback
  71. );
  72. BOOL
  73. CALLBACK
  74. _GrabmiCallback(
  75. LPVOID lpvCallbackParam, // application-defined parameter
  76. LPCTSTR lpszRoot, // root directory path
  77. LPCTSTR lpszRelative, // relative path
  78. PATTRINFO pAttrInfo, // attributes
  79. LPCWSTR pwszXML // resulting xml
  80. );
  81. //
  82. // Contains all the information we'll need to access throughout the app.
  83. //
  84. typedef struct _APPINFO {
  85. BOOL fDisplayFile; // indicates if we should display the file to the user
  86. TCHAR szCurrentDir[MAX_PATH]; // contains the path that we're currently running from
  87. TCHAR szSystemDir[MAX_PATH]; // contains the path to %windir%\system or %windir%\system32
  88. TCHAR szOutputFile[MAX_PATH]; // contains the path to the output file (user-specified)
  89. TCHAR szGrabPath[MAX_PATH]; // contains the path to the directory where we start scanning (user-specified)
  90. DWORD dwFilter; // indicates the type of information to be grabbed
  91. DWORD dwFilterFlags; // indicates how the information should be filtered
  92. DWORD dwLibraryFlags; // flags that indicate which library to load
  93. } APPINFO, *LPAPPINFO;
  94. //
  95. // Flags that determine which library is loaded on the current platform.
  96. //
  97. #define GRABMI_FLAG_NT 0x00000001
  98. #define GRABMI_FLAG_APPHELP 0x00000002
  99. //
  100. // The name of our output file if the user doesn't specify one.
  101. //
  102. #define MATCHINGINFO_FILENAME _T("matchinginfo.txt")
  103. //
  104. // The names of our libraries contaning Sdb API functions.
  105. //
  106. #define APPHELP_LIBRARY _T("apphelp.dll")
  107. #define SDBAPI_LIBRARY _T("sdbapi.dll")
  108. #define SDBAPIU_LIBRARY _T("sdbapiu.dll")
  109. //
  110. // The name of the function that we're getting a pointer to.
  111. //
  112. #define PFN_GMI _T("SdbGrabMatchingInfoEx")
  113. //
  114. // DebugPrintf related stuff.
  115. //
  116. typedef enum {
  117. dlNone = 0,
  118. dlPrint,
  119. dlError,
  120. dlWarning,
  121. dlInfo
  122. } DEBUGLEVEL;
  123. void
  124. __cdecl
  125. DebugPrintfEx(
  126. IN DEBUGLEVEL dwDetail,
  127. IN LPSTR pszFmt,
  128. ...
  129. );
  130. #define DPF DebugPrintfEx
  131. #endif // _GRABMI_H