summaryrefslogtreecommitdiffstats
path: root/private/ntos/cntfs/views/initprop.c
diff options
context:
space:
mode:
authorAdam <you@example.com>2020-05-17 05:51:50 +0200
committerAdam <you@example.com>2020-05-17 05:51:50 +0200
commite611b132f9b8abe35b362e5870b74bce94a1e58e (patch)
treea5781d2ec0e085eeca33cf350cf878f2efea6fe5 /private/ntos/cntfs/views/initprop.c
downloadNT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.gz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.bz2
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.lz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.xz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.zst
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.zip
Diffstat (limited to 'private/ntos/cntfs/views/initprop.c')
-rw-r--r--private/ntos/cntfs/views/initprop.c122
1 files changed, 122 insertions, 0 deletions
diff --git a/private/ntos/cntfs/views/initprop.c b/private/ntos/cntfs/views/initprop.c
new file mode 100644
index 000000000..c1ab2066a
--- /dev/null
+++ b/private/ntos/cntfs/views/initprop.c
@@ -0,0 +1,122 @@
+/*++
+
+Copyright (c) 1989-1997 Microsoft Corporation
+
+Module Name:
+
+ initprop.h
+
+Abstract:
+
+ This module contains the initialization user FsCtls for the Ntfs Property
+ support.
+
+
+--*/
+
+#include <viewprop.h> // needs propset.h and ntfsprop.h
+
+#define Dbg DEBUG_TRACE_PROP_FSCTL
+
+
+VOID
+InitializePropertyData (
+ IN PPROPERTY_CONTEXT Context
+ )
+
+/*++
+
+Routine Description:
+
+ This routine initializes a blank stream for property access.
+
+ We set up the initial size, lay out an empty table and empty header.
+
+
+Arguments:
+
+ Context - Property Context for the call
+
+Return Value:
+
+ Nothing
+
+--*/
+{
+ PROPERTY_SET_HEADER PropertySetHeader;
+ PROPERTY_ID_TABLE IdTable;
+ PROPERTY_HEAP_HEADER HeapHeader;
+
+ //
+ // Set up header
+ //
+
+ PropertySetHeader.wByteOrder = 0xFFFE;
+ PropertySetHeader.wFormat = PSH_FORMAT_VERSION;
+ PropertySetHeader.dwOSVer = PSH_DWOSVER;
+ RtlZeroMemory( &PropertySetHeader.clsid, sizeof( CLSID ));
+ PropertySetHeader.reserved = 2; // BUGBUG ???
+ PropertySetHeader.IdTableOffset = LongAlign( sizeof( PROPERTY_SET_HEADER ));
+ PropertySetHeader.ValueHeapOffset = PropertySetHeader.IdTableOffset;
+
+ //
+ // Set up Id table
+ //
+
+ IdTable.PropertyCount = 0;
+ IdTable.MaximumPropertyCount = PIT_PROPERTY_DELTA;
+ PropertySetHeader.ValueHeapOffset +=
+ LongAlign( PROPERTY_ID_TABLE_SIZE( PIT_PROPERTY_DELTA ));
+
+ //
+ // Set up Heap header
+ //
+
+ HeapHeader.PropertyHeapLength = PHH_INITIAL_SIZE;
+ HeapHeader.PropertyHeapEntry[0].PropertyValueLength = PHH_INITIAL_SIZE - PROPERTY_HEAP_HEADER_SIZE;
+ HeapHeader.PropertyHeapEntry[0].PropertyId = PID_ILLEGAL;
+ HeapHeader.PropertyHeapEntry[0].PropertyNameLength = 0;
+
+ //
+ // Set the new size of the stream
+ //
+
+ NtOfsSetLength( Context->IrpContext, Context->Attribute,
+ PropertySetHeader.ValueHeapOffset + PHH_INITIAL_SIZE );
+
+
+ //
+ // Write out the header
+ //
+
+ LogFileFullFailCheck( Context->IrpContext );
+ NtOfsPutData( Context->IrpContext,
+ Context->Attribute,
+ 0,
+ sizeof( PROPERTY_SET_HEADER ),
+ &PropertySetHeader );
+
+
+ //
+ // Write out the table
+ //
+
+ LogFileFullFailCheck( Context->IrpContext );
+ NtOfsPutData( Context->IrpContext,
+ Context->Attribute,
+ PropertySetHeader.IdTableOffset,
+ sizeof( PROPERTY_ID_TABLE ),
+ &IdTable );
+
+ //
+ // Write out the heap and set the stream size
+ //
+
+ LogFileFullFailCheck( Context->IrpContext );
+ NtOfsPutData( Context->IrpContext,
+ Context->Attribute,
+ PropertySetHeader.ValueHeapOffset,
+ sizeof( PROPERTY_HEAP_HEADER ),
+ &HeapHeader );
+}
+