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.

108 lines
2.8 KiB

  1. #include "resource.h"
  2. #include <sys\types.h>
  3. #include <sys\stat.h>
  4. #include <time.h>
  5. #define SRCHATTR (FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_NORMAL)
  6. #define MAX_OPTIONS 8
  7. #define MAX_MAX_PATH 1024
  8. #define CMDOPTION_RECURSIVE L"R"
  9. #define CMDOPTION_QUITE L"Q"
  10. #define CMDOPTION_QUOTE L"F"
  11. #define CMDOPTION_TIME L"T"
  12. #define CMDOPTION_USAGE L"?"
  13. #define CMDOPTION_DEFAULT L""
  14. #define EXIT_FAILURE_2 2
  15. #define OI_RECURSIVE 0
  16. #define OI_QUITE 1
  17. #define OI_QUOTE 2
  18. #define OI_TIME 3
  19. #define OI_USAGE 4
  20. #define OI_DEFAULT 5
  21. #define SAFE_FREE( p ) if( (p) != NULL ) \
  22. { \
  23. free(p); \
  24. p=NULL; \
  25. }
  26. #define UNC_FORMAT L"\\\\?\\"
  27. #define NEW_LINE L"\n"
  28. #define EMPTY_SPACE L" "
  29. #define INVALID_DIRECTORY_CHARACTERS L"*/?<>|"
  30. #define NULL_U_STRING L"\0"
  31. #define SIZE_OF_ARRAY_IN_CHARS(x) \
  32. GetBufferSize(x)/sizeof(WCHAR)
  33. #define SIZE_OF_ARRAY_IN_BYTES(x) \
  34. GetBufferSize(x)
  35. struct dirtag
  36. {
  37. WCHAR *szDirectoryName;
  38. struct dirtag *next;
  39. };
  40. typedef struct dirtag* DIRECTORY;
  41. extern enum exeKind exeType( LPWSTR f);
  42. extern WCHAR *strExeType(enum exeKind exenum);
  43. DWORD FindforFile(IN LPWSTR lpszDirectory,
  44. IN LPWSTR lpszPattern,
  45. IN BOOL bQuite,
  46. IN BOOL bQuote,
  47. IN BOOL bTime
  48. );
  49. DWORD FindforFileRecursive(IN LPWSTR lpszDirectory,
  50. IN PTARRAY Pattern,
  51. IN BOOL bQuiet,
  52. IN BOOL bQuote,
  53. IN BOOL bTime
  54. );
  55. DWORD Where( LPWSTR lpszPattern,
  56. IN BOOL bQuite,
  57. IN BOOL bQuote,
  58. IN BOOL bTime);
  59. BOOL Match ( LPWSTR pat,
  60. LPWSTR text
  61. );
  62. DWORD
  63. found (
  64. LPWSTR p,
  65. BOOL bQuite,
  66. BOOL bQuote,
  67. BOOL bTime
  68. );
  69. DWORD DisplayHelpUsage();
  70. DWORD GetFileDateTimeandSize( LPWSTR wszFileName, DWORD *dwSize, LPWSTR wszDate, LPWSTR wszTime );
  71. DWORD ProcessOptions( IN DWORD argc,
  72. IN LPCWSTR argv[],
  73. OUT LPWSTR *lpszRecursive,
  74. OUT PBOOL pbQuite,
  75. OUT PBOOL pbQuote,
  76. OUT PBOOL pbTime,
  77. OUT PTARRAY pArrVal,
  78. OUT PBOOL pbUsage);
  79. DWORD Push( OUT DIRECTORY *dir, IN LPWSTR szPath );
  80. BOOL Pop( IN DIRECTORY *dir, OUT LPWSTR *lpszDirectory);
  81. LPWSTR DivideToken( LPTSTR szString );
  82. BOOL GetRecursiveDirectory( IN LPCWSTR pwszOption, IN LPCWSTR pwszValue, OUT LPVOID pData, IN DWORD* pdwIncrement );
  83. DWORD FreeList( DIRECTORY dir );