00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
#ifndef _NTFS_
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 typedef struct _FILE_REFERENCE {
00043
00044
00045
00046
00047
00048 ULONG
SegmentNumberLowPart;
00049 USHORT SegmentNumberHighPart;
00050
00051
00052
00053
00054
00055
00056
00057
00058 USHORT SequenceNumber;
00059
00060 }
FILE_REFERENCE, *
PFILE_REFERENCE;
00061
00062
#endif
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110 typedef struct _FCB *
OBJECT_HANDLE;
00111 typedef struct _SCB *
ATTRIBUTE_HANDLE;
00112 typedef struct _SCB *
INDEX_HANDLE;
00113 typedef struct _READ_CONTEXT *
PREAD_CONTEXT;
00114 typedef ULONG
SECURITY_ID;
00115 typedef struct _CI_CALL_BACK CI_CALL_BACK, *
PCI_CALL_BACK;
00116 typedef struct _VIEW_CALL_BACK VIEW_CALL_BACK, *
PVIEW_CALL_BACK;
00117 typedef struct _IRP_CONTEXT *
PIRP_CONTEXT;
00118
00119
00120
00121
00122
00123
00124 typedef struct _MAP_HANDLE {
00125
00126
00127
00128
00129
00130 LONGLONG
FileOffset;
00131 ULONG
Length;
00132
00133
00134
00135
00136
00137 PVOID
Buffer;
00138
00139
00140
00141
00142
00143 PVOID
Bcb;
00144
00145 }
MAP_HANDLE, *
PMAP_HANDLE;
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155 typedef struct _QUICK_INDEX_HINT {
00156 LONGLONG
HintData[3];
00157 }
QUICK_INDEX_HINT, *
PQUICK_INDEX_HINT;
00158
00159
00160
00161
00162
00163 typedef struct {
00164 ULONG KeyLength;
00165 PVOID
Key;
00166 }
INDEX_KEY, *
PINDEX_KEY;
00167
00168 typedef struct {
00169 ULONG DataLength;
00170 PVOID Data;
00171 }
INDEX_DATA, *
PINDEX_DATA;
00172
00173 typedef struct {
00174 INDEX_KEY KeyPart;
00175 INDEX_DATA DataPart;
00176 }
INDEX_ROW, *
PINDEX_ROW;
00177
00178
00179
00180
00181
00182
00183
00184 typedef FSRTL_COMPARISON_RESULT (*
PCOLLATION_FUNCTION) (
00185 IN
PINDEX_KEY Key1,
00186 IN
PINDEX_KEY Key2,
00187 IN PVOID CollationData
00188 );
00189
00190 typedef struct _UPCASE_TABLE_AND_KEY {
00191
00192
00193
00194
00195
00196
00197 PWCH
UpcaseTable;
00198
00199
00200
00201
00202
00203 ULONG
UpcaseTableSize;
00204
00205
00206
00207
00208
00209 INDEX_KEY Key;
00210
00211 }
UPCASE_TABLE_AND_KEY, *
PUPCASE_TABLE_AND_KEY;
00212
00213
00214
00215
00216
00217
00218 typedef struct _WAIT_FOR_NEW_LENGTH {
00219
00220
00221
00222
00223
00224 LIST_ENTRY
WaitList;
00225
00226
00227
00228
00229
00230 LONGLONG
Length;
00231
00232
00233
00234
00235
00236 KEVENT Event;
00237
00238
00239
00240
00241
00242
00243 PIRP Irp;
00244
00245
00246
00247
00248
00249 ATTRIBUTE_HANDLE Stream;
00250
00251
00252
00253
00254
00255
00256
00257 NTSTATUS Status;
00258
00259
00260
00261
00262
00263 ULONG
Flags;
00264
00265 }
WAIT_FOR_NEW_LENGTH, *
PWAIT_FOR_NEW_LENGTH;
00266
00267 #define NTFS_WAIT_FLAG_ASYNC (0x00000001)
00268
00269
00270
00271
00272
00273
FSRTL_COMPARISON_RESULT
00274
NtOfsCollateUlong (
00275 IN PINDEX_KEY Key1,
00276 IN PINDEX_KEY Key2,
00277 IN PVOID CollationData
00278 );
00279
00280
FSRTL_COMPARISON_RESULT
00281
NtOfsCollateUlongs (
00282 IN PINDEX_KEY Key1,
00283 IN PINDEX_KEY Key2,
00284 IN PVOID CollationData
00285 );
00286
00287
FSRTL_COMPARISON_RESULT
00288
NtOfsCollateSid (
00289 IN PINDEX_KEY Key1,
00290 IN PINDEX_KEY Key2,
00291 IN PVOID CollationData
00292 );
00293
00294
FSRTL_COMPARISON_RESULT
00295
NtOfsCollateUnicode (
00296 IN PINDEX_KEY Key1,
00297 IN PINDEX_KEY Key2,
00298 IN PVOID CollationData
00299 );
00300
00301
00302
00303
00304
00305
NTSTATUS
00306
NtOfsMatchAll (
00307 IN PINDEX_ROW IndexRow,
00308 IN OUT PVOID MatchData
00309 );
00310
00311
NTSTATUS
00312
NtOfsMatchUlongExact (
00313 IN PINDEX_ROW IndexRow,
00314 IN OUT PVOID MatchData
00315 );
00316
00317
NTSTATUS
00318
NtOfsMatchUlongsExact (
00319 IN PINDEX_ROW IndexRow,
00320 IN OUT PVOID MatchData
00321 );
00322
00323
NTSTATUS
00324
NtOfsMatchUnicodeExpression (
00325 IN PINDEX_ROW IndexRow,
00326 IN OUT PVOID MatchData
00327 );
00328
00329
NTSTATUS
00330
NtOfsMatchUnicodeString (
00331 IN PINDEX_ROW IndexRow,
00332 IN OUT PVOID MatchData
00333 );
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344 typedef NTSTATUS (*
PMATCH_FUNCTION) (IN
PINDEX_ROW IndexRow, IN OUT PVOID MatchData);
00345
00346
00347
00348
00349
00350 typedef enum _CREATE_OPTIONS
00351 {
00352
CREATE_NEW = 0,
00353
CREATE_OR_OPEN = 1,
00354
OPEN_EXISTING = 2
00355 }
CREATE_OPTIONS;
00356
00357
00358
00359
00360
00361
00362 typedef enum _EXCLUSION
00363 {
00364
SHARED = 0,
00365
EXCLUSIVE
00366 }
EXCLUSION;
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377 #define SUPPRESS_CONTENT_INDEX (0x20000000)
00378
00379
00380
00381
00382
00383 #define NTOFS_VIEW_INDEX_BUFFER_SIZE (0x1000)
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393 extern FILE_REFERENCE NtOfsContentIndexSystemFile;
00394
00395
#if defined(_NTFSPROC_)
00396
00397
#define NTFSAPI
00398
00399
#else
00400
00401 #define NTFSAPI DECLSPEC_IMPORT
00402
00403
#endif
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
NTFSAPI
00428
NTSTATUS
00429
NtOfsCreateIndex (
00430 IN
PIRP_CONTEXT IrpContext,
00431 IN
OBJECT_HANDLE ObjectHandle,
00432 IN UNICODE_STRING Name,
00433 IN CREATE_OPTIONS CreateOptions,
00434 IN ULONG DeleteCollationData,
00435 IN ULONG CollationRule,
00436 IN PCOLLATION_FUNCTION CollationFunction,
00437 IN PVOID CollationData OPTIONAL,
00438 OUT INDEX_HANDLE *IndexHandle
00439 );
00440
00441
00442
00443
00444
00445
00446
00447
NTFSAPI
00448
NTSTATUS
00449
NtOfsFindRecord (
00450 IN
PIRP_CONTEXT IrpContext,
00451 IN INDEX_HANDLE IndexHandle,
00452 IN PINDEX_KEY IndexKey,
00453 OUT PINDEX_ROW IndexRow,
00454 OUT PMAP_HANDLE MapHandle,
00455 IN OUT PQUICK_INDEX_HINT QuickIndexHint OPTIONAL
00456 );
00457
00458
00459
00460
00461
00462
00463
NTFSAPI
00464
NTSTATUS
00465
NtOfsFindLastRecord (
00466 IN
PIRP_CONTEXT IrpContext,
00467 IN INDEX_HANDLE IndexHandle,
00468 IN PINDEX_KEY MaxIndexKey,
00469 OUT PINDEX_ROW IndexRow,
00470 OUT PMAP_HANDLE MapHandle
00471 );
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
NTFSAPI
00486
VOID
00487
NtOfsAddRecords (
00488 IN
PIRP_CONTEXT IrpContext,
00489 IN INDEX_HANDLE IndexHandle,
00490 IN ULONG Count,
00491 IN PINDEX_ROW IndexRow,
00492 IN ULONG SequentialInsertMode
00493 );
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503
NTFSAPI
00504
VOID
00505
NtOfsDeleteRecords (
00506 IN
PIRP_CONTEXT IrpContext,
00507 IN INDEX_HANDLE IndexHandle,
00508 IN ULONG Count,
00509 IN PINDEX_KEY IndexKey
00510 );
00511
00512
00513
00514
00515
00516
00517
00518
00519
00520
00521
00522
00523
00524
00525
00526
00527
00528
00529
00530
00531
00532
00533
00534
00535
00536
00537
00538
00539
00540
00541
00542
00543
00544
NTFSAPI
00545
NTSTATUS
00546
NtOfsReadRecords (
00547 IN
PIRP_CONTEXT IrpContext,
00548 IN INDEX_HANDLE IndexHandle,
00549 IN OUT PREAD_CONTEXT *ReadContext,
00550 IN OPTIONAL PINDEX_KEY IndexKey,
00551 IN PMATCH_FUNCTION MatchFunction,
00552 IN PVOID MatchData,
00553 IN OUT ULONG *Count,
00554 OUT PINDEX_ROW Rows,
00555 IN ULONG BufferLength,
00556 OUT PVOID Buffer
00557 );
00558
00559
NTFSAPI
00560
VOID
00561
NtOfsFreeReadContext (
00562 IN PREAD_CONTEXT ReadContext
00563 );
00564
00565
00566
00567
00568
00569
00570
00571
00572
00573
NTFSAPI
00574
VOID
00575
NtOfsUpdateRecord (
00576 IN
PIRP_CONTEXT IrpContext,
00577 IN INDEX_HANDLE IndexHandle,
00578 IN ULONG Count,
00579 IN PINDEX_ROW IndexRow,
00580 IN OUT PQUICK_INDEX_HINT QuickIndexHint OPTIONAL,
00581 IN OUT PMAP_HANDLE MapHandle OPTIONAL
00582 );
00583
00584
00585
00586
00587
00588
00589
NTFSAPI
00590
VOID
00591
NtOfsCloseIndex (
00592 IN
PIRP_CONTEXT IrpContext,
00593 IN INDEX_HANDLE IndexHandle
00594 );
00595
00596
00597
00598
00599
00600
00601
NTFSAPI
00602
VOID
00603
NtOfsDeleteIndex (
00604 IN
PIRP_CONTEXT IrpContext,
00605 IN
OBJECT_HANDLE ObjectHandle,
00606 IN INDEX_HANDLE IndexHandle
00607 );
00608
00609
00610
00611
00612
00613
00614
00615
00616
00617
00618
00619
00620
00621
00622
00623
00624
00625
00626 #define NtOfsInitializeMapHandle( M ) { (M)->Bcb = NULL; }
00627
00628
00629
00630
00631
00632
00633
00634
00635
00636
#ifndef _NTFSPROC_
00637
NTFSAPI
00638
VOID
00639
NtOfsMapAttribute (
00640 IN
PIRP_CONTEXT IrpContext,
00641 IN ATTRIBUTE_HANDLE Attribute,
00642 IN LONGLONG Offset,
00643 IN ULONG Length,
00644 OUT PVOID *Buffer,
00645 OUT PMAP_HANDLE MapHandle
00646 );
00647
00648
#else
00649
#ifdef MAPCOUNT_DBG
00650
#define NtOfsMapAttribute(I,S,O,L,B,M) ( \
00651
CcMapData((S)->FileObject, (PLARGE_INTEGER)&(O), (L), TRUE, &(M)->Bcb, (B)), \
00652
(I)->MapCount++, \
00653
(M)->FileOffset = (O), \
00654
(M)->Length = (L), \
00655
(M)->Buffer = *(PVOID *)(B) \
00656
)
00657
#else
00658
#define NtOfsMapAttribute(I,S,O,L,B,M) ( \
00659
CcMapData((S)->FileObject, (PLARGE_INTEGER)&(O), (L), TRUE, &(M)->Bcb, (B)), \
00660
(M)->FileOffset = (O), \
00661
(M)->Length = (L), \
00662
(M)->Buffer = *(PVOID *)(B) \
00663
)
00664
#endif
00665
#endif
00666
00667
00668
00669
00670
00671
00672
00673
#ifndef _NTFSPROC_
00674
NTFSAPI
00675
VOID
00676
NtOfsPreparePinWrite (
00677 IN
PIRP_CONTEXT IrpContext,
00678 IN ATTRIBUTE_HANDLE Attribute,
00679 IN LONGLONG Offset,
00680 IN ULONG Length,
00681 OUT PVOID *Buffer,
00682 OUT PMAP_HANDLE MapHandle
00683 );
00684
00685
#else
00686
#ifdef MAPCOUNT_DBG
00687
#define NtOfsPreparePinWrite(I,S,O,L,B,M) { \
00688
if (((O) + (L)) > (S)->Header.AllocationSize.QuadPart) { \
00689
ExRaiseStatus(STATUS_END_OF_FILE); \
00690
} \
00691
CcPreparePinWrite((S)->FileObject, (PLARGE_INTEGER)&(O), (L), FALSE, TRUE, &(M)->Bcb, (B)); \
00692
(I)->MapCount++; \
00693
(M)->FileOffset = (O); \
00694
(M)->Length = (L); \
00695
(M)->Buffer = (B); \
00696
}
00697
#else
00698
#define NtOfsPreparePinWrite(I,S,O,L,B,M) { \
00699
if (((O) + (L)) > (S)->Header.AllocationSize.QuadPart) { \
00700
ExRaiseStatus(STATUS_END_OF_FILE); \
00701
} \
00702
CcPreparePinWrite((S)->FileObject, (PLARGE_INTEGER)&(O), (L), FALSE, TRUE, &(M)->Bcb, (B)); \
00703
(M)->FileOffset = (O); \
00704
(M)->Length = (L); \
00705
(M)->Buffer = (B); \
00706
}
00707
#endif
00708
#endif
00709
00710
00711
00712
00713
00714
00715
00716
#ifndef _NTFSPROC_
00717
NTFSAPI
00718
VOID
00719
NtOfsPinRead(
00720 IN
PIRP_CONTEXT IrpContext,
00721 IN ATTRIBUTE_HANDLE Attribute,
00722 IN LONGLONG Offset,
00723 IN ULONG Length,
00724 OUT PMAP_HANDLE MapHandle
00725 );
00726
00727
#else
00728
#ifdef MAPCOUNT_DBG
00729
#define NtOfsPinRead(I,S,O,L,M) { \
00730
ASSERT((M)->Bcb != NULL); \
00731
ASSERT(((O) >= (M)->FileOffset) && (((O) + (L)) <= ((M)->FileOffset + (M)->Length))); \
00732
CcPinMappedData((S)->FileObject, (PLARGE_INTEGER)&(O), (L), TRUE, &(M)->Bcb); \
00733
(I)->MapCount++; \
00734
(M)->FileOffset = (O); \
00735
(M)->Length = (L); \
00736
}
00737
#else
00738
#define NtOfsPinRead(I,S,O,L,M) { \
00739
ASSERT((M)->Bcb != NULL); \
00740
ASSERT(((O) >= (M)->FileOffset) && (((O) + (L)) <= ((M)->FileOffset + (M)->Length))); \
00741
CcPinMappedData((S)->FileObject, (PLARGE_INTEGER)&(O), (L), TRUE, &(M)->Bcb); \
00742
(M)->FileOffset = (O); \
00743
(M)->Length = (L); \
00744
}
00745
#endif
00746
#endif
00747
00748
00749
00750
00751
00752
00753
00754
00755
00756
00757
00758
00759
00760
00761 #define NtOfsDirty(I,M,L) {CcSetDirtyPinnedData((M)->Bcb,(L));}
00762
00763
00764
00765
00766
00767
00768
#ifndef _NTFSPROC_
00769
NTFSAPI
00770
VOID
00771
NtOfsReleaseMap (
00772 IN
PIRP_CONTEXT IrpContext,
00773 IN PMAP_HANDLE MapHandle
00774 );
00775
00776
#else
00777
00778
#ifdef MAPCOUNT_DBG
00779
#define NtOfsReleaseMap(IC,M) { \
00780
if ((M)->Bcb != NULL) { \
00781
CcUnpinData((M)->Bcb); \
00782
(IC)->MapCount--; \
00783
(M)->Bcb = NULL; \
00784
} \
00785
}
00786
#else
00787
#define NtOfsReleaseMap(IC,M) { \
00788
if ((M)->Bcb != NULL) { \
00789
CcUnpinData((M)->Bcb); \
00790
(M)->Bcb = NULL; \
00791
} \
00792
}
00793
#endif
00794
#endif
00795
00796
00797
00798
00799
00800
00801
00802
00803
00804
NTFSAPI
00805
VOID
00806
NtOfsPutData (
00807 IN
PIRP_CONTEXT IrpContext,
00808 IN ATTRIBUTE_HANDLE Attribute,
00809 IN LONGLONG Offset,
00810 IN ULONG Length,
00811 IN PVOID Data OPTIONAL
00812 );
00813
00814
00815
00816
00817
00818
00819
00820
00821
00822
00823
00824
00825
00826
00827
00828
00829
00830
00831
NTFSAPI
00832
NTSTATUS
00833
NtOfsCreateAttribute (
00834 IN
PIRP_CONTEXT IrpContext,
00835 IN
OBJECT_HANDLE ObjectHandle,
00836 IN UNICODE_STRING Name,
00837 IN CREATE_OPTIONS CreateOptions,
00838 IN ULONG LogNonresidentToo,
00839 OUT ATTRIBUTE_HANDLE *AttributeHandle
00840 );
00841
00842
00843
00844
00845
00846
00847
00848
00849
00850
00851
00852
00853
NTFSAPI
00854
NTSTATUS
00855
NtOfsCreateAttributeEx (
00856 IN
PIRP_CONTEXT IrpContext,
00857 IN
OBJECT_HANDLE ObjectHandle,
00858 IN UNICODE_STRING Name,
00859 IN ULONG AttributeTypeCode,
00860 IN CREATE_OPTIONS CreateOptions,
00861 IN ULONG LogNonresidentToo,
00862 OUT ATTRIBUTE_HANDLE *AttributeHandle
00863 );
00864
00865
00866
00867
00868
00869 #define $LOGGED_UTILITY_STREAM (0x100)
00870
00871
00872
00873
00874
00875
00876
00877
NTFSAPI
00878
VOID
00879
NtOfsCloseAttribute (
00880 IN
PIRP_CONTEXT IrpContext,
00881 IN ATTRIBUTE_HANDLE AttributeHandle
00882 );
00883
00884
00885
00886
00887
00888
00889
00890
NTFSAPI
00891
VOID
00892
NtOfsDeleteAttribute (
00893 IN
PIRP_CONTEXT IrpContext,
00894 IN
OBJECT_HANDLE ObjectHandle,
00895 IN ATTRIBUTE_HANDLE AttributeHandle
00896 );
00897
00898
00899
00900
00901
00902
00903
NTFSAPI
00904 LONGLONG
00905
NtOfsQueryLength (
00906 IN ATTRIBUTE_HANDLE AttributeHandle
00907 );
00908
00909
00910
00911
00912
00913
00914
00915
NTFSAPI
00916
VOID
00917
NtOfsSetLength (
00918 IN
PIRP_CONTEXT IrpContext,
00919 IN ATTRIBUTE_HANDLE Attribute,
00920 IN LONGLONG Length
00921 );
00922
00923
00924
00925
00926
00927
NTFSAPI
00928
NTSTATUS
00929
NtOfsWaitForNewLength (
00930 IN ATTRIBUTE_HANDLE Attribute,
00931 IN LONGLONG Length,
00932 IN ULONG Async,
00933 IN
PIRP Irp,
00934 IN PDRIVER_CANCEL CancelRoutine,
00935 IN PLARGE_INTEGER Timeout OPTIONAL
00936 );
00937
00938
00939
00940
00941
00942
00943
00944
VOID
00945
NtOfsPostNewLength (
00946 IN
PIRP_CONTEXT IrpContext OPTIONAL,
00947 IN ATTRIBUTE_HANDLE Attribute,
00948 IN BOOLEAN WakeAll
00949 );
00950
00951
00952
00953
00954
00955
00956
00957
00958
00959
00960
00961
00962
00963
00964
00965
00966
00967
NTFSAPI
00968
VOID
00969
NtOfsDecommit (
00970 IN
PIRP_CONTEXT IrpContext,
00971 IN ATTRIBUTE_HANDLE Attribute,
00972 IN LONGLONG Offset,
00973 IN LONGLONG Length
00974 );
00975
00976
00977
00978
00979
00980
00981
00982
00983
NTFSAPI
00984
VOID
00985
NtOfsFlushAttribute (
00986 IN
PIRP_CONTEXT IrpContext,
00987 IN ATTRIBUTE_HANDLE Attribute,
00988 IN ULONG Purge
00989 );
00990
00991
00992
00993
00994
00995
00996
NTFSAPI
00997
VOID
00998
NtOfsQueryAttributeSecurityId (
00999 IN
PIRP_CONTEXT IrpContext,
01000 IN ATTRIBUTE_HANDLE Attribute,
01001 OUT SECURITY_ID *SecurityId
01002 );
01003
01004
01005
01006
01007
01008
01009
01010
01011
01012
01013
01014
01015
01016
01017
01018
VOID
01019
NtOfsAcquireObjectShared (
01020 HANDLE ObjectHandle
01021 );
01022
01023
01024
01025
01026
01027
01028
VOID
01029
NtOfsReleaseObject (
01030 HANDLE ObjectHandle
01031 );
01032
01033
01034 BOOLEAN
01035
NtOfsIsObjectAcquiredExclusive (
01036 HANDLE ObjectHandle
01037 );
01038
01039 BOOLEAN
01040
NtOfsIsObjectAcquiredShared (
01041 HANDLE ObjectHandle
01042 );
01043
01044
01045
01046
01047
01048
01049
01050
01051
01052
01053
01054
01055
01056
01057
NTFSAPI
01058
NTSTATUS
01059
NtOfsOpenByFileReference (
01060 IN
PIRP_CONTEXT IrpContext,
01061 IN
FILE_REFERENCE FileReference,
01062 IN EXCLUSION Exclusion,
01063 OUT
OBJECT_HANDLE *ObjectHandle
01064 );
01065
01066
01067
01068
01069
01070
01071
01072
01073
01074
01075
NTFSAPI
01076
NTSTATUS
01077
NtOfsCreateRelativeObject (
01078 IN
PIRP_CONTEXT IrpContext,
01079 IN
OBJECT_HANDLE ParentObjectHandle,
01080 IN UNICODE_STRING Name,
01081 IN CREATE_OPTIONS CreateOptions,
01082 IN EXCLUSION Exclusion,
01083 OUT
OBJECT_HANDLE *ObjectHandle
01084 );
01085
01086
01087
01088
01089
01090
NTFSAPI
01091
NTSTATUS
01092
NtOfsCloseObject (
01093 IN
PIRP_CONTEXT IrpContext,
01094 IN
OBJECT_HANDLE ObjectHandle
01095 );
01096
01097
01098
01099
01100
01101
01102
01103
NTFSAPI
01104
NTSTATUS
01105
NtOfsDeleteObject (
01106 IN
PIRP_CONTEXT IrpContext,
01107 IN
OBJECT_HANDLE ObjectHandle
01108 );
01109
01110
01111
01112
01113
01114
01115
NTFSAPI
01116
NTSTATUS
01117
NtOfsDeleteAllAttributes (
01118 IN
PIRP_CONTEXT IrpContext,
01119 IN
OBJECT_HANDLE ObjectHandle
01120 );
01121
01122
01123
01124
01125
01126
01127
01128
NTFSAPI
01129
NTSTATUS
01130
NtOfsQueryPathFromRoot (
01131 IN
PIRP_CONTEXT IrpContext,
01132 IN
FILE_REFERENCE FileReference,
01133 OUT UNICODE_STRING *PathName
01134 );
01135
01136
01137
01138
01139
01140
01141
01142
NTFSAPI
01143
NTSTATUS
01144
NtOfsQueryFileName (
01145 IN
PIRP_CONTEXT IrpContext,
01146 IN
FILE_REFERENCE FileReference,
01147 OUT UNICODE_STRING *FileName
01148 );
01149
01150
01151
01152
01153
01154
NTFSAPI
01155
NTSTATUS
01156
NtOfsQueryFileReferenceFromName (
01157 IN
PIRP_CONTEXT IrpContext,
01158 IN UNICODE_STRING Name,
01159 OUT
FILE_REFERENCE *FileReference
01160 );
01161
01162
01163
01164
01165
01166
NTFSAPI
01167
NTSTATUS
01168
NtOfsQueryFileReferenceFromHandle (
01169 IN
OBJECT_HANDLE Object,
01170 OUT
FILE_REFERENCE *FileReference
01171 );
01172
01173
01174
01175
01176
01177
01178
NTFSAPI
01179
NTSTATUS
01180
NtOfsQueryObjectSecurityId (
01181 IN
PIRP_CONTEXT IrpContext,
01182 IN
OBJECT_HANDLE ObjectHandle,
01183 OUT SECURITY_ID *SecurityId
01184 );
01185
01186
01187
01188
01189
01190
01191
01192
01193
01194
01195
01196
01197
01198
01199
01200
NTFSAPI
01201
NTSTATUS
01202
NtOfsIsAncestorOf (
01203 IN
PIRP_CONTEXT IrpContext,
01204 IN
FILE_REFERENCE Ancestor,
01205 IN
FILE_REFERENCE Child
01206 );
01207
01208
01209
01210
01211
01212
01213
01214
NTFSAPI
01215
NTSTATUS
01216
NtOfsGetParentFileReferenceFromHandle (
01217 IN
PIRP_CONTEXT IrpContext,
01218 IN
OBJECT_HANDLE ChildObject,
01219 OUT
FILE_REFERENCE *ParentFileReference
01220 );
01221
01222
01223
01224
01225
01226
01227
01228
01229
01230
01231
01232
01233
01234
01235
01236
01237
NTFSAPI
01238
NTSTATUS
01239
NtOfsClearSecurityCache (
01240 IN
PIRP_CONTEXT IrpContext
01241 );
01242
01243
01244
01245
01246
01247
01248
01249
01250
01251
01252
NTFSAPI
01253
NTSTATUS
01254
NtOfsIsAccessGranted (
01255 IN
PIRP_CONTEXT IrpContext,
01256 IN SECURITY_ID SecurityId,
01257 IN ACCESS_MASK DesiredAccess,
01258 IN
ACCESS_STATE *SecurityAccessState
01259 );
01260
01261
01262
01263
01264
01265
01266
01267
01268
01269
01270
01271
01272
01273
01274
01275
01276
01277
01278
01279
01280
NTFSAPI
01281
NTSTATUS
01282
NtOfsMarkVolumeCorrupt (
01283 IN
PIRP_CONTEXT IrpContext,
01284 IN ULONG NewState,
01285 IN ULONG StateMask,
01286 OUT ULONG *OldState
01287 );
01288
01289
01290
01291
01292
01293
01294
01295
NTFSAPI
01296
NTSTATUS
01297
NtOfsQueryVolumeStatistics (
01298 IN
PIRP_CONTEXT IrpContext,
01299 OUT LONGLONG *TotalClusters,
01300 OUT LONGLONG *FreeClusters
01301 );
01302
01303
01304
01305
01306
01307
NTFSAPI
01308
NTSTATUS
01309
NtOfsQueryHandleState (
01310 IN
PIRP_CONTEXT IrpContext,
01311 OUT VOID *OldData
01312 );
01313
01314
NTFSAPI
01315
NTSTATUS
01316
NtOfsSetHandleState (
01317 IN
PIRP_CONTEXT IrpContext,
01318 IN VOID *Data
01319 );
01320
01321
01322
01323
01324
01325
01326
NTFSAPI
01327
NTSTATUS
01328
NtOfsQueryAttributeHandle (
01329 IN
PIRP_CONTEXT IrpContext,
01330 OUT ATTRIBUTE_HANDLE *AttributeHandle
01331 );
01332
01333
NTFSAPI
01334
NTSTATUS
01335
NtOfsQueryObjectHandle (
01336 IN
PIRP_CONTEXT IrpContext,
01337 OUT
OBJECT_HANDLE *ObjectHandle
01338 );
01339
01340
01341
01342
01343
01344
01345
01346
01347
NTFSAPI
01348
NTSTATUS
01349
NtOfsCloneIrpContext (
01350 IN
PIRP_CONTEXT IrpContext,
01351 OUT
PIRP_CONTEXT *NewIrpContext
01352 );
01353
01354
01355
01356
01357
01358
01359
NTFSAPI
01360
NTSTATUS
01361
NtOfsCompleteRequest (
01362 IN
PIRP_CONTEXT IrpContext,
01363 NTSTATUS Status
01364 );
01365
01366
01367
01368
01369
01370
01371
01372
01373
01374
01375
01376 typedef struct _BASE_FILE_SEGMENT_ITERATOR
BASE_FILE_SEGMENT_ITERATOR;
01377
01378 typedef struct _USN_ITERATOR
USN_ITERATOR;
01379
01380
01381
01382
01383
01384
01385
01386
01387
01388
01389
01390
01391
01392
01393
01394
01395
01396
01397
01398
01399
01400
01401
NTFSAPI
01402
NTSTATUS
01403
NtOfsCreateBaseFileSegmentIterator (
01404 IN
PIRP_CONTEXT IrpContext,
01405 OUT BASE_FILE_SEGMENT_ITERATOR *Iterator
01406 );
01407
01408
NTFSAPI
01409
NTSTATUS
01410
NtOfsNextBaseFileSegmentIteration (
01411 IN
PIRP_CONTEXT IrpContext,
01412 IN BASE_FILE_SEGMENT_ITERATOR *Iterator,
01413 IN OUT ULONG *BufferLength,
01414 IN OUT PVOID Buffer
01415 );
01416
01417
NTFSAPI
01418
NTSTATUS
01419
NtOfsCloseBaseFileSegmentIterator (
01420 IN
PIRP_CONTEXT IrpContext,
01421 IN BASE_FILE_SEGMENT_ITERATOR *Iterator
01422 );
01423
01424
NTFSAPI
01425
NTSTATUS
01426
NtOfsCreateUsnIterator (
01427 IN
PIRP_CONTEXT IrpContext,
01428 IN USN BeginningUsn,
01429 IN USN EndingUsn,
01430 OUT USN_ITERATOR *Iterator
01431 );
01432
01433
NTFSAPI
01434
NTSTATUS
01435
NtOfsNextUsnIteration (
01436 IN
PIRP_CONTEXT IrpContext,
01437 IN USN_ITERATOR *Iterator,
01438 IN OUT ULONG *BufferLength,
01439 IN OUT PVOID Buffer
01440 );
01441
01442
NTFSAPI
01443
NTSTATUS
01444
NtOfsCloseUsnIterator (
01445 IN
PIRP_CONTEXT IrpContext,
01446 IN USN_ITERATOR *Iterator
01447 );
01448
01449
01450
01451
01452
01453
01454
01455
01456
01457
01458
01459 typedef enum _NTFS_ADDON_TYPES {
01460
Encryption = 3
01461 }
NTFS_ADDON_TYPES;
01462
01463
01464
01465
01466
01467
01468
01469
01470
01471
01472
01473
01474 #define STREAM_NEW_OR_EXIST_MASK 0x000f0000
01475 #define FILE_DIR_TYPE_MASK 0x000000ff
01476
01477 #define FILE_NEW 0x00000001
01478 #define FILE_EXISTING 0x00000002
01479 #define DIRECTORY_NEW 0x00000004
01480 #define DIRECTORY_EXISTING 0x00000008
01481 #define EXISTING_FILE_ENCRYPTED 0x00000010
01482 #define STREAM_NEW 0x00010000
01483 #define STREAM_EXISTING 0x00020000
01484
01485
01486
01487
01488
01489 #define STREAM_ENCRYPTED 0x00000001
01490 #define FILE_ENCRYPTED 0x00000002
01491
01492
01493
01494
01495
01496
01497
01498
01499
01500
01501 #define READ_DATA_ACCESS 0x01
01502 #define WRITE_DATA_ACCESS 0x02
01503 #define APPEND_DATA_ACCESS 0x04
01504 #define EXECUTE_ACCESS 0x20
01505
01506 #define BACKUP_ACCESS 0x08
01507 #define RESTORE_ACCESS 0x10
01508 #define TRAVERSE_ACCESS 0x40
01509
01510
typedef NTSTATUS
01511 (*ENCRYPTED_FILE_CREATE) (
01512 IN
OBJECT_HANDLE FileHdl,
01513 IN
OBJECT_HANDLE ParentDir OPTIONAL,
01514 IN
PIO_STACK_LOCATION IrpSp,
01515 IN ULONG FileDirFlag,
01516 IN
PIRP_CONTEXT IrpContext,
01517 IN
PDEVICE_OBJECT VolDo,
01518 IN PVOID FileKeyContext,
01519 IN OUT PVOID *PKeyContext,
01520 IN OUT ULONG *ContextLength,
01521 IN OUT PVOID *PCreateContext,
01522 IN OUT PBOOLEAN Reserved
01523 );
01524
01525
typedef NTSTATUS
01526 (*ENCRYPTED_FILE_PRE_CREATE) (
01527 IN
PDEVICE_OBJECT VolDo,
01528 IN
PIRP Irp,
01529 IN
PFILE_OBJECT FileObject
01530 );
01531
01532
typedef NTSTATUS
01533 (*ENCRYPTED_FILE_POST_CREATE) (
01534 IN
PDEVICE_OBJECT VolDo,
01535 IN
PIRP Irp,
01536 IN
PFILE_OBJECT FileObject,
01537 IN
NTSTATUS Status,
01538 IN OUT PVOID *PCreateContext
01539 );
01540
01541
typedef NTSTATUS
01542 (*ENCRYPTED_FILE_SYSTEM_CONTROL) (
01543 IN PVOID PInputBuffer OPTIONAL,
01544 IN ULONG InputDataLength,
01545 OUT PVOID OutputBuffer OPTIONAL,
01546 IN OUT ULONG *OutputBufferLength OPTIONAL,
01547 IN ULONG EncryptionFlag,
01548 IN ULONG AccessFlag,
01549 IN ULONG FsControlCode,
01550 IN
OBJECT_HANDLE FileHdl,
01551 IN
PIRP_CONTEXT IrpContext,
01552 IN
PDEVICE_OBJECT VolDo,
01553 IN
ATTRIBUTE_HANDLE Attribute,
01554 IN OUT PVOID *PContext OPTIONAL,
01555 IN OUT ULONG *ContextLength OPTIONAL
01556 );
01557
01558
typedef NTSTATUS
01559 (*ENCRYPTED_FILE_PRE_FILE_SYSTEM_CONTROL) (
01560 IN
PDEVICE_OBJECT VolDo,
01561 IN
PIRP Irp,
01562 IN
PFILE_OBJECT FileObject
01563 );
01564
01565
typedef NTSTATUS
01566 (*ENCRYPTED_FILE_READ)(
01567 IN OUT PUCHAR InOutBuffer,
01568 IN PLARGE_INTEGER
Offset,
01569 IN ULONG
BufferSize,
01570 IN PVOID Context
01571 );
01572
01573
typedef NTSTATUS
01574 (*ENCRYPTED_FILE_WRITE)(
01575 IN PUCHAR InBuffer,
01576 OUT PUCHAR OutBuffer,
01577 IN PLARGE_INTEGER
Offset,
01578 IN ULONG
BufferSize,
01579 IN PUCHAR Context
01580 );
01581
01582
typedef VOID
01583 (*ENCRYPTED_FILE_CLEANUP)(
01584 IN OUT PVOID *Context
01585 );
01586
01587 #define ENCRYPTION_CURRENT_INTERFACE_VERSION 3
01588
01589 #define ENCRYPTION_ALL_STREAMS 0x00000001
01590 #define ENCRYPTION_ALLOW_COMPRESSION 0x00000002
01591
01592 typedef struct _ENCRYPTION_CALL_BACK {
01593 ULONG
InterfaceVersion;
01594 ULONG
ImplementationFlags;
01595 ENCRYPTED_FILE_CREATE FileCreate;
01596 ENCRYPTED_FILE_PRE_CREATE PreCreate;
01597 ENCRYPTED_FILE_POST_CREATE PostCreate;
01598 ENCRYPTED_FILE_SYSTEM_CONTROL FileSystemControl_1;
01599 ENCRYPTED_FILE_SYSTEM_CONTROL FileSystemControl_2;
01600 ENCRYPTED_FILE_PRE_FILE_SYSTEM_CONTROL PreFileSystemControl;
01601 ENCRYPTED_FILE_READ AfterReadProcess;
01602 ENCRYPTED_FILE_WRITE BeforeWriteProcess;
01603 ENCRYPTED_FILE_CLEANUP CleanUp;
01604 }
ENCRYPTION_CALL_BACK, *
PENCRYPTION_CALL_BACK;
01605
01606
01607
01608
01609
01610
01611
01612
NTFSAPI
01613
NTSTATUS
01614
NtOfsRegisterCallBacks (
01615 NTFS_ADDON_TYPES NtfsAddonType,
01616 PVOID CallBackTable
01617 );
01618