Source code of Windows XP (NT5)
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.

67 lines
2.5 KiB

  1. #ifndef CONST_H
  2. #define CONST_H
  3. #include "oemshare.h"
  4. #define PREP_NO_ERROR (0) // nothing bad happened
  5. #define PREP_NO_MEMORY (1) // allocation failed
  6. #define PREP_BAD_PATH_ERROR (2) // problem scanning directory
  7. #define PREP_UNKNOWN_ERROR (3) // problem
  8. #define PREP_DEPTH_ERROR (4) // directory is too deep
  9. #define PREP_BAD_COMMAND (5) // error in command line syntax
  10. #define PREP_HASH_ERROR (6) // error computing file hash
  11. #define PREP_BUFFER_OVERFLOW (7) // an internal buffer was overrun
  12. #define PREP_NOT_PATCHABLE (8) // not worth patching (internal)
  13. #define PREP_INPUT_FILE_ERROR (9) // answer file is incorrect
  14. #define PREP_SCRIPT_FILE_ERROR (10) // cannot save to scriptfile
  15. #define PREP_PATCH_FILE_ERROR (11) // cannot create patch file
  16. #define PREP_DIRECTORY_ERROR (12) // cannot create the directories
  17. #define PREP_COPY_FILE_ERROR (13) // cannot copy files
  18. #define HASH_SIZE (13) // (10007) large, prime
  19. #define MAX_PATCH_TARGET_SIZE (10 * 1024 * 1024) // 10Mb max patch file size
  20. #define countof(a) (sizeof((a)) / sizeof((a)[0])) // a simple char counter
  21. typedef enum
  22. {
  23. DETERMINATION_EXISTING,
  24. DETERMINATION_ZERO_LENGTH,
  25. DETERMINATION_RENAMED,
  26. DETERMINATION_COPIED,
  27. DETERMINATION_DUPLICATED,
  28. DETERMINATION_PATCHED,
  29. DETERMINATION_UNMATCHED
  30. }
  31. DETERMINATION;
  32. static CONST ULONG g_iMajorVersion = 1;
  33. static CONST ULONG g_iMinorVersion = 0;
  34. static CONST WCHAR ANS_FILE_NAME[] = L"OEMPatch.ans";
  35. static CONST WCHAR LOG_FILE_NAME[] = L"OEMPatch.log";
  36. static CONST WCHAR PATCH_SUB_PATCH[] = L"\\Patch\\";
  37. static CONST WCHAR PATCH_SUB_EXCEPT[] = L"\\";
  38. static CONST WCHAR PATCH_EXT[] = L".jxw";
  39. static CONST ULONG FILE_LIMIT = 100;
  40. static CONST ULONG LANGUAGE_COMPLETE = 3;
  41. // need to be a prime number for hashing
  42. // this is the maximum allowed number of except file, typical to give a good hashing performance,
  43. // this number is 2 * number of actual files
  44. // check out http://www.utm.edu/research/primes/lists/small/10000.txt for prime numbers
  45. static CONST ULONG EXCEP_FILE_LIMIT = 349;
  46. // log file constants
  47. static CONST WCHAR SPACE[] = L" ";
  48. static CONST WCHAR BANNER[] = L"----------------------------------------\015\012";
  49. static CONST ULONG BANNER_LENGTH = 42;
  50. static CONST ULONG TIME_LENGTH = 12;
  51. // log file function
  52. VOID DisplayDebugMessage(IN BOOL blnTime,
  53. IN BOOL blnBanner,
  54. IN BOOL blnFlush,
  55. IN BOOL blnPrint,
  56. IN WCHAR* pwszWhat,
  57. ...);
  58. #endif // CONST_H