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.

94 lines
1.9 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. cmwrapr2.c
  5. Abstract:
  6. This module contains the source for wrapper routines called by the
  7. hive code, which in turn call the appropriate NT routines. But not
  8. callable from user mode.
  9. Author:
  10. Steven R. Wood (stevewo) 21-Apr-1992
  11. Revision History:
  12. --*/
  13. #include "cmp.h"
  14. #ifdef ALLOC_PRAGMA
  15. #pragma alloc_text(PAGE,CmpFileSetSize)
  16. #endif
  17. extern KEVENT StartRegistryCommand;
  18. extern KEVENT EndRegistryCommand;
  19. //
  20. // Write-Control:
  21. // CmpNoWrite is initially true. When set this way write and flush
  22. // do nothing, simply returning success. When cleared to FALSE, I/O
  23. // is enabled. This change is made after the I/O system is started
  24. // AND autocheck (chkdsk) has done its thing.
  25. //
  26. extern BOOLEAN CmpNoWrite;
  27. BOOLEAN
  28. CmpFileSetSize(
  29. PHHIVE Hive,
  30. ULONG FileType,
  31. ULONG FileSize,
  32. ULONG OldFileSize
  33. )
  34. /*++
  35. Routine Description:
  36. This routine sets the size of a file. It must not return until
  37. the size is guaranteed, therefore, it does a flush.
  38. It is environment specific.
  39. This routine will force execution to the correct thread context.
  40. Arguments:
  41. Hive - Hive we are doing I/O for
  42. FileType - which supporting file to use
  43. FileSize - 32 bit value to set the file's size to
  44. Return Value:
  45. FALSE if failure
  46. TRUE if success
  47. --*/
  48. {
  49. NTSTATUS status;
  50. ASSERT(FIELD_OFFSET(CMHIVE, Hive) == 0);
  51. ASSERT_CM_LOCK_OWNED_EXCLUSIVE();
  52. //
  53. // Call the worker to do real work for us.
  54. //
  55. status = CmpDoFileSetSize(Hive,FileType,FileSize,OldFileSize);
  56. if (!NT_SUCCESS(status)) {
  57. CmKdPrintEx((DPFLTR_CONFIG_ID,CML_BUGCHECK,"CmpFileSetSize:\n\t"));
  58. CmKdPrintEx((DPFLTR_CONFIG_ID,CML_BUGCHECK,"Failure: status = %08lx ", status));
  59. return FALSE;
  60. }
  61. return TRUE;
  62. }