NT4/private/ntos/config/cmwrapr2.c
2020-09-30 17:12:29 +02:00

100 lines
2.0 KiB
C
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*++
Copyright (c) 1991 Microsoft Corporation
Module Name:
cmwrapr2.c
Abstract:
This module contains the source for wrapper routines called by the
hive code, which in turn call the appropriate NT routines. But not
callable from user mode.
Author:
Steven R. Wood (stevewo) 21-Apr-1992
Revision History:
--*/
#include "cmp.h"
#ifdef ALLOC_PRAGMA
#pragma alloc_text(PAGE,CmpFileSetSize)
#endif
extern REGISTRY_COMMAND CommandArea;
extern KEVENT StartRegistryCommand;
extern KEVENT EndRegistryCommand;
//
// Write-Control:
// CmpNoWrite is initially true. When set this way write and flush
// do nothing, simply returning success. When cleared to FALSE, I/O
// is enabled. This change is made after the I/O system is started
// AND autocheck (chkdsk) has done its thing.
//
extern BOOLEAN CmpNoWrite;
BOOLEAN
CmpFileSetSize(
PHHIVE Hive,
ULONG FileType,
ULONG FileSize
)
/*++
Routine Description:
This routine sets the size of a file. It must not return until
the size is guaranteed, therefore, it does a flush.
It is environment specific.
This routine will force execution to the correct thread context.
Arguments:
Hive - Hive we are doing I/O for
FileType - which supporting file to use
FileSize - 32 bit value to set the file's size to
Return Value:
FALSE if failure
TRUE if success
--*/
{
NTSTATUS status;
REGISTRY_COMMAND Command;
ASSERT(FIELD_OFFSET(CMHIVE, Hive) == 0);
//
// Wake up worker thread to do real work for us.
//
Command.Command = REG_CMD_FILE_SET_SIZE;
Command.Hive = Hive;
Command.FileType = FileType;
Command.FileSize = FileSize;
status = CmpWorkerCommand(&Command);
if (!NT_SUCCESS(status)) {
CMLOG(CML_MAJOR, CMS_IO_ERROR) {
KdPrint(("CmpFileSetSize:\n\t"));
KdPrint(("Failure: status = %08lx ", status));
}
return FALSE;
}
return TRUE;
}