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.

92 lines
2.0 KiB

  1. #include <nt.h>
  2. #include <ntrtl.h>
  3. #include <nturtl.h>
  4. #include <windef.h>
  5. #include <setupbat.h>
  6. #include <stdlib.h>
  7. #include <string.h>
  8. #include "msg.h"
  9. //
  10. // Define helper macro to deal with subtleties of NT-level programming.
  11. //
  12. #define INIT_OBJA(Obja,UnicodeString,UnicodeText) \
  13. \
  14. RtlInitUnicodeString((UnicodeString),(UnicodeText)); \
  15. \
  16. InitializeObjectAttributes( \
  17. (Obja), \
  18. (UnicodeString), \
  19. OBJ_CASE_INSENSITIVE, \
  20. NULL, \
  21. NULL \
  22. )
  23. //
  24. // Memory routines
  25. //
  26. #define MALLOC(size) RtlAllocateHeap(RtlProcessHeap(),0,(size))
  27. #define FREE(block) RtlFreeHeap(RtlProcessHeap(),0,(block))
  28. #define REALLOC(b,s) RtlReAllocateHeap(RtlProcessHeap(),0,(b),(s))
  29. //
  30. // Resonable approximation based on max win32 path len plus
  31. // \device\harddisk0\partition1 prefix
  32. //
  33. #define NTMAXPATH MAX_PATH+64
  34. //
  35. // Structures used to store info about $$RENAME.TXT
  36. //
  37. typedef struct _MYSECTION {
  38. PWSTR Name;
  39. PWCHAR Data;
  40. } MYSECTION, *PMYSECTION;
  41. typedef struct _MYTEXTFILE {
  42. PWCHAR Text;
  43. ULONG SectionCount;
  44. ULONG SectionArraySize;
  45. PMYSECTION Sections;
  46. } MYTEXTFILE, *PMYTEXTFILE;
  47. PMYTEXTFILE
  48. LoadRenameFile(
  49. IN PCWSTR DriveRootPath
  50. );
  51. VOID
  52. UnloadRenameFile(
  53. IN OUT PMYTEXTFILE *TextFile
  54. );
  55. BOOLEAN
  56. GetLineInSection(
  57. IN PWCHAR StartOfLine,
  58. OUT PWSTR LineBuffer,
  59. IN ULONG BufferSizeChars,
  60. OUT PWCHAR *StartOfNextLine
  61. );
  62. BOOLEAN
  63. ParseLine(
  64. IN OUT PWSTR Line,
  65. OUT PWSTR *LHS,
  66. OUT PWSTR *RHS
  67. );
  68. VOID
  69. ConcatenatePaths(
  70. IN OUT PWSTR Target,
  71. IN PCWSTR Path,
  72. IN ULONG TargetBufferSize
  73. );