Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

cmwrapr2.c

Go to the documentation of this file.
00001 /*++ 00002 00003 Copyright (c) 1991 Microsoft Corporation 00004 00005 Module Name: 00006 00007 cmwrapr2.c 00008 00009 Abstract: 00010 00011 This module contains the source for wrapper routines called by the 00012 hive code, which in turn call the appropriate NT routines. But not 00013 callable from user mode. 00014 00015 Author: 00016 00017 Steven R. Wood (stevewo) 21-Apr-1992 00018 00019 Revision History: 00020 00021 --*/ 00022 00023 #include "cmp.h" 00024 00025 #ifdef ALLOC_PRAGMA 00026 #pragma alloc_text(PAGE,CmpFileSetSize) 00027 #endif 00028 00029 extern REGISTRY_COMMAND CommandArea; 00030 extern KEVENT StartRegistryCommand; 00031 extern KEVENT EndRegistryCommand; 00032 00033 // 00034 // Write-Control: 00035 // CmpNoWrite is initially true. When set this way write and flush 00036 // do nothing, simply returning success. When cleared to FALSE, I/O 00037 // is enabled. This change is made after the I/O system is started 00038 // AND autocheck (chkdsk) has done its thing. 00039 // 00040 00041 extern BOOLEAN CmpNoWrite; 00042 00043 00044 BOOLEAN 00045 CmpFileSetSize( 00046 PHHIVE Hive, 00047 ULONG FileType, 00048 ULONG FileSize 00049 ) 00050 /*++ 00051 00052 Routine Description: 00053 00054 This routine sets the size of a file. It must not return until 00055 the size is guaranteed, therefore, it does a flush. 00056 00057 It is environment specific. 00058 00059 This routine will force execution to the correct thread context. 00060 00061 Arguments: 00062 00063 Hive - Hive we are doing I/O for 00064 00065 FileType - which supporting file to use 00066 00067 FileSize - 32 bit value to set the file's size to 00068 00069 Return Value: 00070 00071 FALSE if failure 00072 TRUE if success 00073 00074 --*/ 00075 { 00076 NTSTATUS status; 00077 REGISTRY_COMMAND Command; 00078 00079 ASSERT(FIELD_OFFSET(CMHIVE, Hive) == 0); 00080 00081 // 00082 // Wake up worker thread to do real work for us. 00083 // 00084 Command.Command = REG_CMD_FILE_SET_SIZE; 00085 Command.Hive = Hive; 00086 Command.FileType = FileType; 00087 Command.FileSize = FileSize; 00088 CmpLockRegistryExclusive(); 00089 CmpWorker(&Command); 00090 status = Command.Status; 00091 CmpUnlockRegistry(); 00092 00093 if (!NT_SUCCESS(status)) { 00094 CMLOG(CML_MAJOR, CMS_IO_ERROR) { 00095 KdPrint(("CmpFileSetSize:\n\t")); 00096 KdPrint(("Failure: status = %08lx ", status)); 00097 } 00098 return FALSE; 00099 } 00100 00101 return TRUE; 00102 }

Generated on Sat May 15 19:39:29 2004 for test by doxygen 1.3.7