2 * PROJECT: ReactOS kernel-mode tests
3 * LICENSE: LGPLv2+ - See COPYING.LIB in the top level directory
4 * PURPOSE: Kernel-Mode Test Suite FsRtl Test
5 * PROGRAMMER: Pierre Schweitzer <pierre.schweitzer@reactos.org>
13 static VOID
FsRtlMcbTest()
17 static VOID
DumpAllRuns(PLARGE_MCB Mcb
)
20 LONGLONG Vbn
, Lbn
, Count
;
22 trace("MCB %p:\n", Mcb
);
24 for (i
= 0; FsRtlGetNextLargeMcbEntry(Mcb
, i
, &Vbn
, &Lbn
, &Count
); i
++)
26 // print out vbn, lbn, and count
27 trace("\t[%I64d,%I64d,%I64d]\n", Vbn
, Lbn
, Count
);
32 static VOID
FsRtlLargeMcbTest()
36 LONGLONG Vbn
, Lbn
, SectorCount
, StartingLbn
, CountFromStartingLbn
;
38 FsRtlInitializeLargeMcb(&LargeMcb
, PagedPool
);
40 ok(FsRtlLookupLastLargeMcbEntry(&LargeMcb
, &Vbn
, &Lbn
) == FALSE
, "expected FALSE, got TRUE\n");
41 ok(FsRtlLookupLastLargeMcbEntryAndIndex(&LargeMcb
, &Vbn
, &Lbn
, &Index
) == FALSE
, "expected FALSE, got TRUE\n");
43 ok(FsRtlAddLargeMcbEntry(&LargeMcb
, 1, 1, 1024) == TRUE
, "expected TRUE, got FALSE\n");
44 NbRuns
= FsRtlNumberOfRunsInLargeMcb(&LargeMcb
);
45 ok(NbRuns
== 2, "Expected 2 runs, got: %lu\n", NbRuns
);
46 DumpAllRuns(&LargeMcb
); // [0,-1,1][1,1,1024] [vbn,lbn,sc]
47 ok(FsRtlLookupLastLargeMcbEntry(&LargeMcb
, &Vbn
, &Lbn
) == TRUE
, "expected TRUE, got FALSE\n");
48 ok(Vbn
== 1024, "Expected Vbn 1024, got: %I64d\n", Vbn
);
49 ok(Lbn
== 1024, "Expected Lbn 1024, got: %I64d\n", Lbn
);
50 ok(FsRtlLookupLastLargeMcbEntryAndIndex(&LargeMcb
, &Vbn
, &Lbn
, &Index
) == TRUE
, "expected TRUE, got FALSE\n");
51 ok(Vbn
== 1024, "Expected Vbn 1024, got: %I64d\n", Vbn
);
52 ok(Lbn
== 1024, "Expected Lbn 1024, got: %I64d\n", Lbn
);
53 ok(Index
== 1, "Expected Index 1, got: %lu\n", Index
);
55 ok(FsRtlAddLargeMcbEntry(&LargeMcb
, 2048, 2, 1024) == TRUE
, "expected TRUE, got FALSE\n");
56 NbRuns
= FsRtlNumberOfRunsInLargeMcb(&LargeMcb
);
57 ok(NbRuns
== 4, "Expected 4 runs, got: %lu\n", NbRuns
);
58 DumpAllRuns(&LargeMcb
); // [0,-1,1][1,1,1024][1025,-1,1023][2048,2,1024] ======= [(0,1) hole] [(1,1025)=>(1,1025)] [(1025, 2048) hole] [(2048,3072)=>(2,1026)]
59 ok(FsRtlLookupLastLargeMcbEntry(&LargeMcb
, &Vbn
, &Lbn
) == TRUE
, "expected TRUE, got FALSE\n");
60 ok(Vbn
== 3071, "Expected Vbn 3071, got: %I64d\n", Vbn
);
61 ok(Lbn
== 1025, "Expected Lbn 1025, got: %I64d\n", Lbn
);
62 ok(FsRtlLookupLastLargeMcbEntryAndIndex(&LargeMcb
, &Vbn
, &Lbn
, &Index
) == TRUE
, "expected TRUE, got FALSE\n");
63 ok(Vbn
== 3071, "Expected Vbn 3071, got: %I64d\n", Vbn
);
64 ok(Lbn
== 1025, "Expected Lbn 1025, got: %I64d\n", Lbn
);
65 ok(Index
== 3, "Expected Index 3, got: %lu\n", Index
);
67 ok(FsRtlGetNextLargeMcbEntry(&LargeMcb
, 0, &Vbn
, &Lbn
, &SectorCount
) == TRUE
, "expected TRUE, got FALSE\n");
68 ok(Vbn
== 0, "Expected Vbn 0, got: %I64d\n", Vbn
);
69 ok(Lbn
== -1, "Expected Lbn -1, got: %I64d\n", Lbn
);
70 ok(SectorCount
== 1, "Expected SectorCount 1, got: %I64d\n", SectorCount
);
72 ok(FsRtlGetNextLargeMcbEntry(&LargeMcb
, 1, &Vbn
, &Lbn
, &SectorCount
) == TRUE
, "expected TRUE, got FALSE\n");
73 ok(Vbn
== 1, "Expected Vbn 1, got: %I64d\n", Vbn
);
74 ok(Lbn
== 1, "Expected Lbn 1, got: %I64d\n", Lbn
);
75 ok(SectorCount
== 1024, "Expected SectorCount 1024, got: %I64d\n", SectorCount
);
77 ok(FsRtlGetNextLargeMcbEntry(&LargeMcb
, 2, &Vbn
, &Lbn
, &SectorCount
) == TRUE
, "expected TRUE, got FALSE\n");
78 ok(Vbn
== 1025, "Expected Vbn 1025, got: %I64d\n", Vbn
);
79 ok(Lbn
== -1, "Expected Lbn -1, got: %I64d\n", Lbn
);
80 ok(SectorCount
== 1023, "Expected SectorCount 1023, got: %I64d\n", SectorCount
);
82 ok(FsRtlGetNextLargeMcbEntry(&LargeMcb
, 3, &Vbn
, &Lbn
, &SectorCount
) == TRUE
, "expected TRUE, got FALSE\n");
83 ok(Vbn
== 2048, "Expected Vbn 2048, got: %I64d\n", Vbn
);
84 ok(Lbn
== 2, "Expected Lbn 2, got: %I64d\n", Lbn
);
85 ok(SectorCount
== 1024, "Expected SectorCount 1024, got: %I64d\n", SectorCount
);
87 ok(FsRtlGetNextLargeMcbEntry(&LargeMcb
, 4, &Vbn
, &Lbn
, &SectorCount
) == FALSE
, "expected FALSE, got TRUE\n");
89 ok(FsRtlLookupLargeMcbEntry(&LargeMcb
, 1, &Lbn
, &SectorCount
, &StartingLbn
, &CountFromStartingLbn
, &Index
) == TRUE
, "expected TRUE, got FALSE\n");
90 ok(Lbn
== 1, "Expected Lbn 1, got: %I64d\n", Lbn
);
91 ok(SectorCount
== 1024, "Expected SectorCount 1024, got: %I64d\n", SectorCount
);
92 ok(StartingLbn
== 1, "Expected StartingLbn 1, got: %I64d\n", StartingLbn
);
93 ok(CountFromStartingLbn
== 1024, "Expected CountFromStartingLbn 1024, got: %I64d\n", CountFromStartingLbn
);
94 ok(Index
== 1, "Expected Index 1, got: %lu\n", Index
);
96 ok(FsRtlLookupLargeMcbEntry(&LargeMcb
, 2048, &Lbn
, &SectorCount
, &StartingLbn
, &CountFromStartingLbn
, &Index
) == TRUE
, "expected TRUE, got FALSE\n");
97 ok(Lbn
== 2, "Expected Lbn 2, got: %I64d\n", Lbn
);
98 ok(SectorCount
== 1024, "Expected SectorCount 1024, got: %I64d\n", SectorCount
);
99 ok(StartingLbn
== 2, "Expected StartingLbn 2, got: %I64d\n", StartingLbn
);
100 ok(CountFromStartingLbn
== 1024, "Expected CountFromStartingLbn 1024, got: %I64d\n", CountFromStartingLbn
);
101 ok(Index
== 3, "Expected Index 3, got: %lu\n", Index
);
103 ok(FsRtlLookupLargeMcbEntry(&LargeMcb
, 3073, &Lbn
, &SectorCount
, &StartingLbn
, &CountFromStartingLbn
, &Index
) == FALSE
, "expected FALSE, got TRUE\n");
105 FsRtlRemoveLargeMcbEntry(&LargeMcb
, 1, 1024);
106 NbRuns
= FsRtlNumberOfRunsInLargeMcb(&LargeMcb
);
107 ok(NbRuns
== 2, "Expected 2 runs, got: %lu\n", NbRuns
);
108 DumpAllRuns(&LargeMcb
); // [0,-1,2048][2048,2,1024]
109 ok(FsRtlLookupLargeMcbEntry(&LargeMcb
, 512, &Lbn
, &SectorCount
, &StartingLbn
, &CountFromStartingLbn
, &Index
) == TRUE
, "expected TRUE, got FALSE\n");
110 ok(Lbn
== -1, "Expected Lbn -1, got: %I64d\n", Lbn
);
111 ok(SectorCount
== 1536, "Expected SectorCount 1536, got: %I64d\n", SectorCount
);
112 ok(StartingLbn
== -1, "Expected StartingLbn -1, got: %I64d\n", StartingLbn
);
113 ok(CountFromStartingLbn
== 2048, "Expected CountFromStartingLbn 2048, got: %I64d\n", CountFromStartingLbn
);
114 ok(Index
== 0, "Expected Index 0, got: %lu\n", Index
);
115 ok(FsRtlLookupLastLargeMcbEntryAndIndex(&LargeMcb
, &Vbn
, &Lbn
, &Index
) == TRUE
, "expected TRUE, got FALSE\n");
116 ok(Vbn
== 3071, "Expected Vbn 3071, got: %I64d\n", Vbn
);
117 ok(Lbn
== 1025, "Expected Lbn 1025, got: %I64d\n", Lbn
);
118 ok(Index
== 1, "Expected Index 1, got: %lu\n", Index
);
120 ok(FsRtlSplitLargeMcb(&LargeMcb
, 2048, 1024) == TRUE
, "expected TRUE, got FALSE\n");
121 NbRuns
= FsRtlNumberOfRunsInLargeMcb(&LargeMcb
);
122 ok(NbRuns
== 2, "Expected 2 runs, got: %lu\n", NbRuns
);
123 DumpAllRuns(&LargeMcb
); // [0,-1,3072][3072,2,1024]
124 ok(FsRtlLookupLastLargeMcbEntryAndIndex(&LargeMcb
, &Vbn
, &Lbn
, &Index
) == TRUE
, "expected TRUE, got FALSE\n");
125 ok(Vbn
== 4095, "Expected Vbn 4095, got: %I64d\n", Vbn
);
126 ok(Lbn
== 1025, "Expected Lbn 1025, got: %I64d\n", Lbn
);
127 ok(Index
== 1, "Expected Index 1, got: %lu\n", Index
);
128 ok(FsRtlLookupLargeMcbEntry(&LargeMcb
, 2048, &Lbn
, &SectorCount
, &StartingLbn
, &CountFromStartingLbn
, &Index
) == TRUE
, "expected TRUE, got FALSE\n");
129 ok(Lbn
== -1, "Expected Lbn -1, got: %I64d\n", Lbn
);
130 ok(SectorCount
== 1024, "Expected SectorCount 1024, got: %I64d\n", SectorCount
);
131 ok(StartingLbn
== -1, "Expected StartingLbn -1, got: %I64d\n", StartingLbn
);
132 ok(CountFromStartingLbn
== 3072, "Expected CountFromStartingLbn 3072, got: %I64d\n", CountFromStartingLbn
);
133 ok(Index
== 0, "Expected Index 0, got: %lu\n", Index
);
134 ok(FsRtlLookupLargeMcbEntry(&LargeMcb
, 3072, &Lbn
, &SectorCount
, &StartingLbn
, &CountFromStartingLbn
, &Index
) == TRUE
, "expected TRUE, got FALSE\n");
135 ok(Lbn
== 2, "Expected Lbn 2, got: %I64d\n", Lbn
);
136 ok(SectorCount
== 1024, "Expected SectorCount 1024, got: %I64d\n", SectorCount
);
137 ok(StartingLbn
== 2, "Expected StartingLbn 2, got: %I64d\n", StartingLbn
);
138 ok(CountFromStartingLbn
== 1024, "Expected CountFromStartingLbn 1024, got: %I64d\n", CountFromStartingLbn
);
139 ok(Index
== 1, "Expected Index 1, got: %lu\n", Index
);
141 ok(FsRtlAddLargeMcbEntry(&LargeMcb
, 3584, 3, 1024) == FALSE
, "expected FALSE, got TRUE\n");
143 ok(FsRtlAddLargeMcbEntry(&LargeMcb
, 4095, 1025, 1024) == TRUE
, "expected TRUE, got FALSE\n");
144 NbRuns
= FsRtlNumberOfRunsInLargeMcb(&LargeMcb
);
145 ok(NbRuns
== 2, "Expected 2 runs, got: %lu\n", NbRuns
);
146 DumpAllRuns(&LargeMcb
); // [0,-1,3072][3072,2,2047]
147 ok(FsRtlLookupLastLargeMcbEntry(&LargeMcb
, &Vbn
, &Lbn
) == TRUE
, "expected TRUE, got FALSE\n");
148 ok(Vbn
== 5118, "Expected Vbn 5118, got: %I64d\n", Vbn
);
149 ok(Lbn
== 2048, "Expected Lbn 2048, got: %I64d\n", Lbn
);
150 ok(FsRtlLookupLastLargeMcbEntryAndIndex(&LargeMcb
, &Vbn
, &Lbn
, &Index
) == TRUE
, "expected TRUE, got FALSE\n");
151 ok(Vbn
== 5118, "Expected Vbn 5118, got: %I64d\n", Vbn
);
152 ok(Lbn
== 2048, "Expected Lbn 2048, got: %I64d\n", Lbn
);
153 ok(Index
== 1, "Expected Index 1, got: %lu\n", Index
);
155 FsRtlTruncateLargeMcb(&LargeMcb
, 4607);
156 DumpAllRuns(&LargeMcb
); // [0,-1,3072][3072,2,1535]
157 ok(FsRtlLookupLargeMcbEntry(&LargeMcb
, 4095, &Lbn
, &SectorCount
, &StartingLbn
, &CountFromStartingLbn
, &Index
) == TRUE
, "expected TRUE, got FALSE\n");
158 ok(Lbn
== 1025, "Expected Lbn 1025, got: %I64d\n", Lbn
);
159 ok(SectorCount
== 512, "Expected SectorCount 512, got: %I64d\n", SectorCount
);
160 ok(StartingLbn
== 2, "Expected StartingLbn 2, got: %I64d\n", StartingLbn
);
161 ok(CountFromStartingLbn
== 1535, "Expected CountFromStartingLbn 1535, got: %I64d\n", CountFromStartingLbn
);
162 ok(Index
== 1, "Expected Index 1, got: %lu\n", Index
);
164 FsRtlUninitializeLargeMcb(&LargeMcb
);
166 FsRtlInitializeLargeMcb(&LargeMcb
, PagedPool
);
167 NbRuns
= FsRtlNumberOfRunsInLargeMcb(&LargeMcb
);
168 ok(NbRuns
== 0, "Expected 0 runs, got: %lu\n", NbRuns
);
170 /* Create a mapping with three holes between each mapping
171 * It looks like that:
172 * ----//////-----/////-----///////
174 ok(FsRtlAddLargeMcbEntry(&LargeMcb
, 1024, 1025, 1024) == TRUE
, "expected TRUE, got FALSE\n");
175 DumpAllRuns(&LargeMcb
); // [0,-1,1024][1024,1024,1024]
176 ok(FsRtlAddLargeMcbEntry(&LargeMcb
, 3072, 3072, 1024) == TRUE
, "expected TRUE, got FALSE\n");
177 DumpAllRuns(&LargeMcb
); // [0,-1,1024][1024,1024,1024][2048,-1,1024][3072,3072,1024]
178 ok(FsRtlAddLargeMcbEntry(&LargeMcb
, 5120, 5120, 1024) == TRUE
, "expected TRUE, got FALSE\n");
179 DumpAllRuns(&LargeMcb
); // [0,-1,1024][1024,1024,1024][2048,-1,1024][3072,3072,1024][4096,-1,1024][5120,5120,1024]
181 NbRuns
= FsRtlNumberOfRunsInLargeMcb(&LargeMcb
);
182 ok(NbRuns
== 6, "Expected 6 runs, got: %lu\n", NbRuns
);
184 ok(FsRtlGetNextLargeMcbEntry(&LargeMcb
, 0, &Vbn
, &Lbn
, &SectorCount
) == TRUE
, "expected TRUE, got FALSE\n");
185 ok(Vbn
== 0, "Expected Vbn 0, got: %I64d\n", Vbn
);
186 ok(Lbn
== -1, "Expected Lbn -1, got: %I64d\n", Lbn
);
187 ok(SectorCount
== 1024, "Expected SectorCount 1024, got: %I64d\n", SectorCount
);
189 ok(FsRtlGetNextLargeMcbEntry(&LargeMcb
, 1, &Vbn
, &Lbn
, &SectorCount
) == TRUE
, "expected TRUE, got FALSE\n");
190 ok(Vbn
== 1024, "Expected Vbn 1024, got: %I64d\n", Vbn
);
191 ok(Lbn
== 1025, "Expected Lbn 1024, got: %I64d\n", Lbn
);
192 ok(SectorCount
== 1024, "Expected SectorCount 1024, got: %I64d\n", SectorCount
);
194 ok(FsRtlGetNextLargeMcbEntry(&LargeMcb
, 2, &Vbn
, &Lbn
, &SectorCount
) == TRUE
, "expected TRUE, got FALSE\n");
195 ok(Vbn
== 2048, "Expected Vbn 2048, got: %I64d\n", Vbn
);
196 ok(Lbn
== -1, "Expected Lbn -1, got: %I64d\n", Lbn
);
197 ok(SectorCount
== 1024, "Expected SectorCount 1024, got: %I64d\n", SectorCount
);
199 ok(FsRtlGetNextLargeMcbEntry(&LargeMcb
, 3, &Vbn
, &Lbn
, &SectorCount
) == TRUE
, "expected TRUE, got FALSE\n");
200 ok(Vbn
== 3072, "Expected Vbn 3072, got: %I64d\n", Vbn
);
201 ok(Lbn
== 3072, "Expected Lbn 3072, got: %I64d\n", Lbn
);
202 ok(SectorCount
== 1024, "Expected SectorCount 1024, got: %I64d\n", SectorCount
);
204 ok(FsRtlGetNextLargeMcbEntry(&LargeMcb
, 4, &Vbn
, &Lbn
, &SectorCount
) == TRUE
, "expected TRUE, got FALSE\n");
205 ok(Vbn
== 4096, "Expected Vbn 4096, got: %I64d\n", Vbn
);
206 ok(Lbn
== -1, "Expected Lbn -1, got: %I64d\n", Lbn
);
207 ok(SectorCount
== 1024, "Expected SectorCount 1024, got: %I64d\n", SectorCount
);
209 ok(FsRtlGetNextLargeMcbEntry(&LargeMcb
, 5, &Vbn
, &Lbn
, &SectorCount
) == TRUE
, "expected TRUE, got FALSE\n");
210 ok(Vbn
== 5120, "Expected Vbn 5120, got: %I64d\n", Vbn
);
211 ok(Lbn
== 5120, "Expected Lbn 5120, got: %I64d\n", Lbn
);
212 ok(SectorCount
== 1024, "Expected SectorCount 1024, got: %I64d\n", SectorCount
);
214 /* Fill first hole */
215 ok(FsRtlAddLargeMcbEntry(&LargeMcb
, 0, 1, 1024) == TRUE
, "expected TRUE, got FALSE\n");
216 DumpAllRuns(&LargeMcb
); // [0,1,2048][2048,-1,1024][3072,3072,1024][4096,-1,1024][5120,5120,1024]
218 NbRuns
= FsRtlNumberOfRunsInLargeMcb(&LargeMcb
);
219 ok(NbRuns
== 5, "Expected 5 runs, got: %lu\n", NbRuns
);
221 ok(FsRtlGetNextLargeMcbEntry(&LargeMcb
, 0, &Vbn
, &Lbn
, &SectorCount
) == TRUE
, "expected TRUE, got FALSE\n");
222 ok(Vbn
== 0, "Expected Vbn 0, got: %I64d\n", Vbn
);
223 ok(Lbn
== 1, "Expected Lbn 1, got: %I64d\n", Lbn
);
224 ok(SectorCount
== 2048, "Expected SectorCount 2048, got: %I64d\n", SectorCount
);
226 ok(FsRtlGetNextLargeMcbEntry(&LargeMcb
, 1, &Vbn
, &Lbn
, &SectorCount
) == TRUE
, "expected TRUE, got FALSE\n");
227 ok(Vbn
== 2048, "Expected Vbn 2048, got: %I64d\n", Vbn
);
228 ok(Lbn
== -1, "Expected Lbn -1, got: %I64d\n", Lbn
);
229 ok(SectorCount
== 1024, "Expected SectorCount 1024, got: %I64d\n", SectorCount
);
231 ok(FsRtlGetNextLargeMcbEntry(&LargeMcb
, 2, &Vbn
, &Lbn
, &SectorCount
) == TRUE
, "expected TRUE, got FALSE\n");
232 ok(Vbn
== 3072, "Expected Vbn 3072, got: %I64d\n", Vbn
);
233 ok(Lbn
== 3072, "Expected Lbn 3072, got: %I64d\n", Lbn
);
234 ok(SectorCount
== 1024, "Expected SectorCount 1024, got: %I64d\n", SectorCount
);
236 ok(FsRtlGetNextLargeMcbEntry(&LargeMcb
, 3, &Vbn
, &Lbn
, &SectorCount
) == TRUE
, "expected TRUE, got FALSE\n");
237 ok(Vbn
== 4096, "Expected Vbn 4096, got: %I64d\n", Vbn
);
238 ok(Lbn
== -1, "Expected Lbn -1, got: %I64d\n", Lbn
);
239 ok(SectorCount
== 1024, "Expected SectorCount 1024, got: %I64d\n", SectorCount
);
241 ok(FsRtlGetNextLargeMcbEntry(&LargeMcb
, 4, &Vbn
, &Lbn
, &SectorCount
) == TRUE
, "expected TRUE, got FALSE\n");
242 ok(Vbn
== 5120, "Expected Vbn 5120, got: %I64d\n", Vbn
);
243 ok(Lbn
== 5120, "Expected Lbn 5120, got: %I64d\n", Lbn
);
244 ok(SectorCount
== 1024, "Expected SectorCount 1024, got: %I64d\n", SectorCount
);
246 /* Fill half of the last hole and overlap */
247 ok(FsRtlAddLargeMcbEntry(&LargeMcb
, 4608, 4608, 1024) == TRUE
, "expected TRUE, got FALSE\n");
248 DumpAllRuns(&LargeMcb
); // [0,1,2048][2048,-1,1024][3072,3072,1024][4096,-1,512][4608,4608,1536]
250 NbRuns
= FsRtlNumberOfRunsInLargeMcb(&LargeMcb
);
251 ok(NbRuns
== 5, "Expected 5 runs, got: %lu\n", NbRuns
);
253 ok(FsRtlGetNextLargeMcbEntry(&LargeMcb
, 0, &Vbn
, &Lbn
, &SectorCount
) == TRUE
, "expected TRUE, got FALSE\n");
254 ok(Vbn
== 0, "Expected Vbn 0, got: %I64d\n", Vbn
);
255 ok(Lbn
== 1, "Expected Lbn 1, got: %I64d\n", Lbn
);
256 ok(SectorCount
== 2048, "Expected SectorCount 2048, got: %I64d\n", SectorCount
);
258 ok(FsRtlGetNextLargeMcbEntry(&LargeMcb
, 1, &Vbn
, &Lbn
, &SectorCount
) == TRUE
, "expected TRUE, got FALSE\n");
259 ok(Vbn
== 2048, "Expected Vbn 2048, got: %I64d\n", Vbn
);
260 ok(Lbn
== -1, "Expected Lbn -1, got: %I64d\n", Lbn
);
261 ok(SectorCount
== 1024, "Expected SectorCount 1024, got: %I64d\n", SectorCount
);
263 ok(FsRtlGetNextLargeMcbEntry(&LargeMcb
, 2, &Vbn
, &Lbn
, &SectorCount
) == TRUE
, "expected TRUE, got FALSE\n");
264 ok(Vbn
== 3072, "Expected Vbn 3072, got: %I64d\n", Vbn
);
265 ok(Lbn
== 3072, "Expected Lbn 3072, got: %I64d\n", Lbn
);
266 ok(SectorCount
== 1024, "Expected SectorCount 1024, got: %I64d\n", SectorCount
);
268 ok(FsRtlGetNextLargeMcbEntry(&LargeMcb
, 3, &Vbn
, &Lbn
, &SectorCount
) == TRUE
, "expected TRUE, got FALSE\n");
269 ok(Vbn
== 4096, "Expected Vbn 4096, got: %I64d\n", Vbn
);
270 ok(Lbn
== -1, "Expected Lbn -1, got: %I64d\n", Lbn
);
271 ok(SectorCount
== 512, "Expected SectorCount 512, got: %I64d\n", SectorCount
);
273 ok(FsRtlGetNextLargeMcbEntry(&LargeMcb
, 4, &Vbn
, &Lbn
, &SectorCount
) == TRUE
, "expected TRUE, got FALSE\n");
274 ok(Vbn
== 4608, "Expected Vbn 4608, got: %I64d\n", Vbn
);
275 ok(Lbn
== 4608, "Expected Lbn 4608, got: %I64d\n", Lbn
);
276 ok(SectorCount
== 1536, "Expected SectorCount 1536, got: %I64d\n", SectorCount
);
278 FsRtlUninitializeLargeMcb(&LargeMcb
);
280 FsRtlInitializeLargeMcb(&LargeMcb
, PagedPool
);
281 NbRuns
= FsRtlNumberOfRunsInLargeMcb(&LargeMcb
);
282 ok(NbRuns
== 0, "Expected 0 runs, got: %lu\n", NbRuns
);
284 ok(FsRtlAddLargeMcbEntry(&LargeMcb
, 0, 1, 1024) == TRUE
, "expected TRUE, got FALSE\n");
285 NbRuns
= FsRtlNumberOfRunsInLargeMcb(&LargeMcb
);
286 ok(NbRuns
== 1, "Expected 1 runs, got: %lu\n", NbRuns
);
287 ok(FsRtlGetNextLargeMcbEntry(&LargeMcb
, 0, &Vbn
, &Lbn
, &SectorCount
) == TRUE
, "expected TRUE, got FALSE\n");
288 ok(Vbn
== 0, "Expected Vbn 0, got: %I64d\n", Vbn
);
289 ok(Lbn
== 1, "Expected Lbn 1, got: %I64d\n", Lbn
);
290 ok(SectorCount
== 1024, "Expected SectorCount 1024, got: %I64d\n", SectorCount
);
291 DumpAllRuns(&LargeMcb
);
293 ok(FsRtlAddLargeMcbEntry(&LargeMcb
, 0, 2, 1024) == FALSE
, "expected FALSE, got TRUE\n");
294 NbRuns
= FsRtlNumberOfRunsInLargeMcb(&LargeMcb
);
295 ok(NbRuns
== 1, "Expected 1 runs, got: %lu\n", NbRuns
);
296 ok(FsRtlGetNextLargeMcbEntry(&LargeMcb
, 0, &Vbn
, &Lbn
, &SectorCount
) == TRUE
, "expected TRUE, got FALSE\n");
297 ok(Vbn
== 0, "Expected Vbn 0, got: %I64d\n", Vbn
);
298 ok(Lbn
== 1, "Expected Lbn 1, got: %I64d\n", Lbn
);
299 ok(SectorCount
== 1024, "Expected SectorCount 1024, got: %I64d\n", SectorCount
);
300 DumpAllRuns(&LargeMcb
);
302 ok(FsRtlAddLargeMcbEntry(&LargeMcb
, 0, 0, 1024) == FALSE
, "expected FALSE, got TRUE\n");
303 NbRuns
= FsRtlNumberOfRunsInLargeMcb(&LargeMcb
);
304 ok(NbRuns
== 1, "Expected 1 runs, got: %lu\n", NbRuns
);
305 ok(FsRtlGetNextLargeMcbEntry(&LargeMcb
, 0, &Vbn
, &Lbn
, &SectorCount
) == TRUE
, "expected TRUE, got FALSE\n");
306 ok(Vbn
== 0, "Expected Vbn 0, got: %I64d\n", Vbn
);
307 ok(Lbn
== 1, "Expected Lbn 1, got: %I64d\n", Lbn
);
308 ok(SectorCount
== 1024, "Expected SectorCount 1024, got: %I64d\n", SectorCount
);
309 DumpAllRuns(&LargeMcb
);
311 ok(FsRtlAddLargeMcbEntry(&LargeMcb
, 1, 2, 1023) == TRUE
, "expected TRUE, got FALSE\n");
312 NbRuns
= FsRtlNumberOfRunsInLargeMcb(&LargeMcb
);
313 ok(NbRuns
== 1, "Expected 1 runs, got: %lu\n", NbRuns
);
314 ok(FsRtlGetNextLargeMcbEntry(&LargeMcb
, 0, &Vbn
, &Lbn
, &SectorCount
) == TRUE
, "expected TRUE, got FALSE\n");
315 ok(Vbn
== 0, "Expected Vbn 0, got: %I64d\n", Vbn
);
316 ok(Lbn
== 1, "Expected Lbn 1, got: %I64d\n", Lbn
);
317 ok(SectorCount
== 1024, "Expected SectorCount 1024, got: %I64d\n", SectorCount
);
318 DumpAllRuns(&LargeMcb
);
320 FsRtlUninitializeLargeMcb(&LargeMcb
);
322 FsRtlInitializeLargeMcb(&LargeMcb
, PagedPool
);
323 NbRuns
= FsRtlNumberOfRunsInLargeMcb(&LargeMcb
);
324 ok(NbRuns
== 0, "Expected 0 runs, got: %lu\n", NbRuns
);
326 ok(FsRtlAddLargeMcbEntry(&LargeMcb
, 0, 1, 1) == TRUE
, "expected TRUE, got FALSE\n");
327 NbRuns
= FsRtlNumberOfRunsInLargeMcb(&LargeMcb
);
328 ok(NbRuns
== 1, "Expected 1 runs, got: %lu\n", NbRuns
);
329 ok(FsRtlGetNextLargeMcbEntry(&LargeMcb
, 0, &Vbn
, &Lbn
, &SectorCount
) == TRUE
, "expected TRUE, got FALSE\n");
330 ok(Vbn
== 0, "Expected Vbn 0, got: %I64d\n", Vbn
);
331 ok(Lbn
== 1, "Expected Lbn 1, got: %I64d\n", Lbn
);
332 ok(SectorCount
== 1, "Expected SectorCount 1, got: %I64d\n", SectorCount
);
333 DumpAllRuns(&LargeMcb
);
336 ok(FsRtlAddLargeMcbEntry(&LargeMcb
, 1, 10, 1) == TRUE
, "expected TRUE, got FALSE\n");
337 NbRuns
= FsRtlNumberOfRunsInLargeMcb(&LargeMcb
);
338 ok(NbRuns
== 2, "Expected 2 runs, got: %lu\n", NbRuns
);
339 ok(FsRtlGetNextLargeMcbEntry(&LargeMcb
, 0, &Vbn
, &Lbn
, &SectorCount
) == TRUE
, "expected TRUE, got FALSE\n");
340 ok(Vbn
== 0, "Expected Vbn 0, got: %I64d\n", Vbn
);
341 ok(Lbn
== 1, "Expected Lbn 1, got: %I64d\n", Lbn
);
342 ok(SectorCount
== 1, "Expected SectorCount 1, got: %I64d\n", SectorCount
);
343 ok(FsRtlGetNextLargeMcbEntry(&LargeMcb
, 1, &Vbn
, &Lbn
, &SectorCount
) == TRUE
, "expected TRUE, got FALSE\n");
344 ok(Vbn
== 1, "Expected Vbn 1, got: %I64d\n", Vbn
);
345 ok(Lbn
== 10, "Expected Lbn 10, got: %I64d\n", Lbn
);
346 ok(SectorCount
== 1, "Expected SectorCount 1, got: %I64d\n", SectorCount
);
347 DumpAllRuns(&LargeMcb
);
349 ok(FsRtlAddLargeMcbEntry(&LargeMcb
, 2, 20, 1) == TRUE
, "expected TRUE, got FALSE\n");
350 NbRuns
= FsRtlNumberOfRunsInLargeMcb(&LargeMcb
);
351 ok(NbRuns
== 3, "Expected 3 runs, got: %lu\n", NbRuns
);
352 ok(FsRtlGetNextLargeMcbEntry(&LargeMcb
, 0, &Vbn
, &Lbn
, &SectorCount
) == TRUE
, "expected TRUE, got FALSE\n");
353 ok(Vbn
== 0, "Expected Vbn 0, got: %I64d\n", Vbn
);
354 ok(Lbn
== 1, "Expected Lbn 1, got: %I64d\n", Lbn
);
355 ok(SectorCount
== 1, "Expected SectorCount 1, got: %I64d\n", SectorCount
);
356 ok(FsRtlGetNextLargeMcbEntry(&LargeMcb
, 1, &Vbn
, &Lbn
, &SectorCount
) == TRUE
, "expected TRUE, got FALSE\n");
357 ok(Vbn
== 1, "Expected Vbn 1, got: %I64d\n", Vbn
);
358 ok(Lbn
== 10, "Expected Lbn 10, got: %I64d\n", Lbn
);
359 ok(SectorCount
== 1, "Expected SectorCount 1, got: %I64d\n", SectorCount
);
360 ok(FsRtlGetNextLargeMcbEntry(&LargeMcb
, 2, &Vbn
, &Lbn
, &SectorCount
) == TRUE
, "expected TRUE, got FALSE\n");
361 ok(Vbn
== 2, "Expected Vbn 2, got: %I64d\n", Vbn
);
362 ok(Lbn
== 20, "Expected Lbn 20, got: %I64d\n", Lbn
);
363 ok(SectorCount
== 1, "Expected SectorCount 1, got: %I64d\n", SectorCount
);
364 DumpAllRuns(&LargeMcb
);
366 FsRtlUninitializeLargeMcb(&LargeMcb
);
369 static VOID
FsRtlLargeMcbTestsExt2()
371 LARGE_MCB FirstMcb
, SecondMcb
;
372 LONGLONG Lbn
, SectorCountFromLbn
, StartingLbn
, SectorCountFromStartingLbn
, Vbn
, SectorCount
;
376 FsRtlInitializeLargeMcb(&FirstMcb
, PagedPool
);
377 FsRtlInitializeLargeMcb(&SecondMcb
, PagedPool
);
379 FsRtlTruncateLargeMcb(&FirstMcb
, 0);
380 FsRtlTruncateLargeMcb(&SecondMcb
, 0);
382 Result
= FsRtlLookupLargeMcbEntry(&FirstMcb
, 1, &Lbn
, &SectorCountFromLbn
, NULL
, NULL
, NULL
);
383 ok(Result
== FALSE
, "Expected FALSE, got TRUE\n");
385 Result
= FsRtlAddLargeMcbEntry(&FirstMcb
, 1, 198657, 1);
386 ok(Result
== TRUE
, "Expected TRUE, got FALSE\n");
388 DumpAllRuns(&FirstMcb
);
390 NbRuns
= FsRtlNumberOfRunsInLargeMcb(&FirstMcb
);
391 ok(NbRuns
== 2, "Expected 2 runs, got: %lu\n", NbRuns
);
393 Result
= FsRtlLookupLargeMcbEntry(&FirstMcb
, 1, &Lbn
, &SectorCountFromLbn
, &StartingLbn
, &SectorCountFromStartingLbn
, &Index
);
394 ok(Result
== TRUE
, "Expected TRUE, got FALSE\n");
395 ok(Lbn
== 198657LL, "Expected Lbn 198657, got: %I64d\n", Lbn
);
396 ok(SectorCountFromLbn
== 1LL, "Expected SectorCountFromLbn 1, got: %I64d\n", SectorCountFromLbn
);
397 ok(StartingLbn
== 198657LL, "Expected StartingLbn 198657, got: %I64d\n", StartingLbn
);
398 ok(SectorCountFromStartingLbn
== 1LL, "Expected SectorCountFromStartingLbn 1, got: %I64d\n", SectorCountFromStartingLbn
);
399 ok(Index
== 1, "Expected Index 1, got: %d\n", Index
);
401 Result
= FsRtlLookupLargeMcbEntry(&FirstMcb
, 2, &Lbn
, &SectorCountFromLbn
, NULL
, NULL
, NULL
);
402 ok(Result
== FALSE
, "Expected FALSE, got TRUE\n");
404 Result
= FsRtlAddLargeMcbEntry(&FirstMcb
, 2, 199169, 11);
405 ok(Result
== TRUE
, "Expected TRUE, got FALSE\n");
407 DumpAllRuns(&FirstMcb
);
409 NbRuns
= FsRtlNumberOfRunsInLargeMcb(&FirstMcb
);
410 ok(NbRuns
== 3, "Expected 3 runs, got: %lu\n", NbRuns
);
412 Result
= FsRtlLookupLargeMcbEntry(&FirstMcb
, 2, &Lbn
, &SectorCountFromLbn
, &StartingLbn
, &SectorCountFromStartingLbn
, &Index
);
413 ok(Result
== TRUE
, "Expected TRUE, got FALSE\n");
414 ok(Lbn
== 199169LL, "Expected Lbn 199169, got: %I64d\n", Lbn
);
415 ok(SectorCountFromLbn
== 11LL, "Expected SectorCountFromLbn 11, got: %I64d\n", SectorCountFromLbn
);
416 ok(StartingLbn
== 199169LL, "Expected StartingLbn 199169, got: %I64d\n", StartingLbn
);
417 ok(SectorCountFromStartingLbn
== 11LL, "Expected SectorCountFromStartingLbn 11, got: %I64d\n", SectorCountFromStartingLbn
);
418 ok(Index
== 2, "Expected Index 2, got: %d\n", Index
);
420 Result
= FsRtlGetNextLargeMcbEntry(&FirstMcb
, 0, &Vbn
, &Lbn
, &SectorCount
);
421 ok(Result
== TRUE
, "Expected TRUE, got FALSE\n");
422 ok(Vbn
== 0LL, "Expected Vbn 0, got: %I64d\n", Vbn
);
423 ok(Lbn
== -1LL, "Expected Lbn -1, got: %I64d\n", Lbn
);
424 ok(SectorCount
== 1LL, "Expected SectorCount 1, got: %I64d\n", SectorCount
);
426 Result
= FsRtlGetNextLargeMcbEntry(&FirstMcb
, 1, &Vbn
, &Lbn
, &SectorCount
);
427 ok(Result
== TRUE
, "Expected TRUE, got FALSE\n");
428 ok(Vbn
== 1LL, "Expected Vbn 1, got: %I64d\n", Vbn
);
429 ok(Lbn
== 198657LL, "Expected Lbn 198657, got: %I64d\n", Lbn
);
430 ok(SectorCount
== 1LL, "Expected SectorCount 1, got: %I64d\n", SectorCount
);
432 Result
= FsRtlGetNextLargeMcbEntry(&FirstMcb
, 2, &Vbn
, &Lbn
, &SectorCount
);
433 ok(Result
== TRUE
, "Expected TRUE, got FALSE\n");
434 ok(Vbn
== 2LL, "Expected Vbn 2, got: %I64d\n", Vbn
);
435 ok(Lbn
== 199169LL, "Expected Lbn 199169, got: %I64d\n", Lbn
);
436 ok(SectorCount
== 11LL, "Expected SectorCount 11, got: %I64d\n", SectorCount
);
438 Result
= FsRtlGetNextLargeMcbEntry(&FirstMcb
, 3, &Vbn
, &Lbn
, &SectorCount
);
439 ok(Result
== FALSE
, "Expected FALSE, got TRUE\n");
441 Result
= FsRtlAddLargeMcbEntry(&SecondMcb
, 197128, 197128, 1);
442 ok(Result
== TRUE
, "Expected TRUE, got FALSE\n");
444 Result
= FsRtlLookupLargeMcbEntry(&SecondMcb
, 197128, &Lbn
, &SectorCountFromLbn
, &StartingLbn
, &SectorCountFromStartingLbn
, &Index
);
445 ok(Result
== TRUE
, "Expected TRUE, got FALSE\n");
446 ok(Lbn
== 197128LL, "Expected Lbn 197128, got: %I64d\n", Lbn
);
447 ok(SectorCountFromLbn
== 1LL, "Expected SectorCountFromLbn 1, got: %I64d\n", SectorCountFromLbn
);
448 ok(StartingLbn
== 197128LL, "Expected StartingLbn 197128, got: %I64d\n", StartingLbn
);
449 ok(SectorCountFromStartingLbn
== 1LL, "Expected SectorCountFromStartingLbn 1, got: %I64d\n", SectorCountFromStartingLbn
);
450 ok(Index
== 1, "Expected Index 1, got: %d\n", Index
);
452 Result
= FsRtlLookupLargeMcbEntry(&FirstMcb
, 13, &Lbn
, &SectorCountFromLbn
, NULL
, NULL
, NULL
);
453 ok(Result
== FALSE
, "Expected FALSE, got TRUE\n");
455 Result
= FsRtlAddLargeMcbEntry(&FirstMcb
, 13, 199180, 4);
456 ok(Result
== TRUE
, "Expected TRUE, got FALSE\n");
458 DumpAllRuns(&FirstMcb
);
460 NbRuns
= FsRtlNumberOfRunsInLargeMcb(&FirstMcb
);
461 ok(NbRuns
== 3, "Expected 3 runs, got: %lu\n", NbRuns
);
463 Result
= FsRtlLookupLargeMcbEntry(&FirstMcb
, 13, &Lbn
, &SectorCountFromLbn
, &StartingLbn
, &SectorCountFromStartingLbn
, &Index
);
464 ok(Result
== TRUE
, "Expected TRUE, got FALSE\n");
465 ok(Lbn
== 199180LL, "Expected Lbn 199180, got: %I64d\n", Lbn
);
466 ok(SectorCountFromLbn
== 4LL, "Expected SectorCountFromLbn 4, got: %I64d\n", SectorCountFromLbn
);
467 ok(StartingLbn
== 199169LL, "Expected StartingLbn 199169, got: %I64d\n", StartingLbn
);
468 ok(SectorCountFromStartingLbn
== 15LL, "Expected SectorCountFromStartingLbn 15, got: %I64d\n", SectorCountFromStartingLbn
);
469 ok(Index
== 2, "Expected Index 2, got: %d\n", Index
);
471 Result
= FsRtlGetNextLargeMcbEntry(&FirstMcb
, 0, &Vbn
, &Lbn
, &SectorCount
);
472 ok(Result
== TRUE
, "Expected TRUE, got FALSE\n");
473 ok(Vbn
== 0LL, "Expected Vbn 0, got: %I64d\n", Vbn
);
474 ok(Lbn
== -1LL, "Expected Lbn -1, got: %I64d\n", Lbn
);
475 ok(SectorCount
== 1LL, "Expected SectorCount 1, got: %I64d\n", SectorCount
);
477 Result
= FsRtlGetNextLargeMcbEntry(&FirstMcb
, 1, &Vbn
, &Lbn
, &SectorCount
);
478 ok(Result
== TRUE
, "Expected TRUE, got FALSE\n");
479 ok(Vbn
== 1LL, "Expected Vbn 1, got: %I64d\n", Vbn
);
480 ok(Lbn
== 198657LL, "Expected Lbn 198657, got: %I64d\n", Lbn
);
481 ok(SectorCount
== 1LL, "Expected SectorCount 1, got: %I64d\n", SectorCount
);
483 Result
= FsRtlGetNextLargeMcbEntry(&FirstMcb
, 2, &Vbn
, &Lbn
, &SectorCount
);
484 ok(Result
== TRUE
, "Expected TRUE, got FALSE\n");
485 ok(Vbn
== 2LL, "Expected Vbn 2, got: %I64d\n", Vbn
);
486 ok(Lbn
== 199169LL, "Expected Lbn 199169, got: %I64d\n", Lbn
);
487 ok(SectorCount
== 15LL, "Expected SectorCount 15, got: %I64d\n", SectorCount
);
489 Result
= FsRtlGetNextLargeMcbEntry(&FirstMcb
, 3, &Vbn
, &Lbn
, &SectorCount
);
490 ok(Result
== FALSE
, "Expected FALSE, got TRUE\n");
492 Result
= FsRtlAddLargeMcbEntry(&SecondMcb
, 197128, 197128, 1);
493 ok(Result
== TRUE
, "Expected TRUE, got FALSE\n");
495 Result
= FsRtlLookupLargeMcbEntry(&SecondMcb
, 197128, &Lbn
, &SectorCountFromLbn
, &StartingLbn
, &SectorCountFromStartingLbn
, &Index
);
496 ok(Result
== TRUE
, "Expected TRUE, got FALSE\n");
497 ok(Lbn
== 197128LL, "Expected Lbn 197128, got: %I64d\n", Lbn
);
498 ok(SectorCountFromLbn
== 1LL, "Expected SectorCountFromLbn 1, got: %I64d\n", SectorCountFromLbn
);
499 ok(StartingLbn
== 197128LL, "Expected StartingLbn 197128, got: %I64d\n", StartingLbn
);
500 ok(SectorCountFromStartingLbn
== 1LL, "Expected SectorCountFromStartingLbn 1, got: %I64d\n", SectorCountFromStartingLbn
);
501 ok(Index
== 1, "Expected Index 1, got: %d\n", Index
);
503 Result
= FsRtlLookupLargeMcbEntry(&FirstMcb
, 17, &Lbn
, &SectorCountFromLbn
, NULL
, NULL
, NULL
);
504 ok(Result
== FALSE
, "Expected FALSE, got TRUE\n");
506 Result
= FsRtlAddLargeMcbEntry(&FirstMcb
, 17, 1105, 16);
507 ok(Result
== TRUE
, "Expected TRUE, got FALSE\n");
509 DumpAllRuns(&FirstMcb
);
511 NbRuns
= FsRtlNumberOfRunsInLargeMcb(&FirstMcb
);
512 ok(NbRuns
== 4, "Expected 4 runs, got: %lu\n", NbRuns
);
514 Result
= FsRtlLookupLargeMcbEntry(&FirstMcb
, 17, &Lbn
, &SectorCountFromLbn
, &StartingLbn
, &SectorCountFromStartingLbn
, &Index
);
515 ok(Result
== TRUE
, "Expected TRUE, got FALSE\n");
516 ok(Lbn
== 1105LL, "Expected Lbn 1105, got: %I64d\n", Lbn
);
517 ok(SectorCountFromLbn
== 16LL, "Expected SectorCountFromLbn 16, got: %I64d\n", SectorCountFromLbn
);
518 ok(StartingLbn
== 1105LL, "Expected StartingLbn 1105, got: %I64d\n", StartingLbn
);
519 ok(SectorCountFromStartingLbn
== 16LL, "Expected SectorCountFromStartingLbn 16, got: %I64d\n", SectorCountFromStartingLbn
);
520 ok(Index
== 3, "Expected Index 3, got: %d\n", Index
);
522 Result
= FsRtlGetNextLargeMcbEntry(&FirstMcb
, 0, &Vbn
, &Lbn
, &SectorCount
);
523 ok(Result
== TRUE
, "Expected TRUE, got FALSE\n");
524 ok(Vbn
== 0LL, "Expected Vbn 0, got: %I64d\n", Vbn
);
525 ok(Lbn
== -1LL, "Expected Lbn -1, got: %I64d\n", Lbn
);
526 ok(SectorCount
== 1LL, "Expected SectorCount 1, got: %I64d\n", SectorCount
);
528 Result
= FsRtlGetNextLargeMcbEntry(&FirstMcb
, 1, &Vbn
, &Lbn
, &SectorCount
);
529 ok(Result
== TRUE
, "Expected TRUE, got FALSE\n");
530 ok(Vbn
== 1LL, "Expected Vbn 1, got: %I64d\n", Vbn
);
531 ok(Lbn
== 198657LL, "Expected Lbn 198657, got: %I64d\n", Lbn
);
532 ok(SectorCount
== 1LL, "Expected SectorCount 1, got: %I64d\n", SectorCount
);
534 Result
= FsRtlGetNextLargeMcbEntry(&FirstMcb
, 2, &Vbn
, &Lbn
, &SectorCount
);
535 ok(Result
== TRUE
, "Expected TRUE, got FALSE\n");
536 ok(Vbn
== 2LL, "Expected Vbn 2, got: %I64d\n", Vbn
);
537 ok(Lbn
== 199169LL, "Expected Lbn 199169, got: %I64d\n", Lbn
);
538 ok(SectorCount
== 15LL, "Expected SectorCount 15, got: %I64d\n", SectorCount
);
540 Result
= FsRtlGetNextLargeMcbEntry(&FirstMcb
, 3, &Vbn
, &Lbn
, &SectorCount
);
541 ok(Result
== TRUE
, "Expected TRUE, got FALSE\n");
542 ok(Vbn
== 17LL, "Expected Vbn 17, got: %I64d\n", Vbn
);
543 ok(Lbn
== 1105LL, "Expected Lbn 1105, got: %I64d\n", Lbn
);
544 ok(SectorCount
== 16LL, "Expected SectorCount 16, got: %I64d\n", SectorCount
);
546 Result
= FsRtlGetNextLargeMcbEntry(&FirstMcb
, 4, &Vbn
, &Lbn
, &SectorCount
);
547 ok(Result
== FALSE
, "Expected FALSE, got TRUE\n");
549 Result
= FsRtlAddLargeMcbEntry(&SecondMcb
, 197128, 197128, 1);
550 ok(Result
== TRUE
, "Expected TRUE, got FALSE\n");
552 Result
= FsRtlLookupLargeMcbEntry(&SecondMcb
, 197128, &Lbn
, &SectorCountFromLbn
, &StartingLbn
, &SectorCountFromStartingLbn
, &Index
);
553 ok(Result
== TRUE
, "Expected TRUE, got FALSE\n");
554 ok(Lbn
== 197128LL, "Expected Lbn 197128, got: %I64d\n", Lbn
);
555 ok(SectorCountFromLbn
== 1LL, "Expected SectorCountFromLbn 1, got: %I64d\n", SectorCountFromLbn
);
556 ok(StartingLbn
== 197128LL, "Expected StartingLbn 197128, got: %I64d\n", StartingLbn
);
557 ok(SectorCountFromStartingLbn
== 1LL, "Expected SectorCountFromStartingLbn 1, got: %I64d\n", SectorCountFromStartingLbn
);
558 ok(Index
== 1, "Expected Index 1, got: %d\n", Index
);
560 Result
= FsRtlLookupLargeMcbEntry(&FirstMcb
, 33, &Lbn
, &SectorCountFromLbn
, NULL
, NULL
, NULL
);
561 ok(Result
== FALSE
, "Expected FALSE, got TRUE\n");
563 Result
= FsRtlAddLargeMcbEntry(&FirstMcb
, 33, 1185, 32);
564 ok(Result
== TRUE
, "Expected TRUE, got FALSE\n");
566 DumpAllRuns(&FirstMcb
);
568 NbRuns
= FsRtlNumberOfRunsInLargeMcb(&FirstMcb
);
569 ok(NbRuns
== 5, "Expected 5 runs, got: %lu\n", NbRuns
);
571 Result
= FsRtlLookupLargeMcbEntry(&FirstMcb
, 33, &Lbn
, &SectorCountFromLbn
, &StartingLbn
, &SectorCountFromStartingLbn
, &Index
);
572 ok(Result
== TRUE
, "Expected TRUE, got FALSE\n");
573 ok(Lbn
== 1185LL, "Expected Lbn 1185, got: %I64d\n", Lbn
);
574 ok(SectorCountFromLbn
== 32LL, "Expected SectorCountFromLbn 32, got: %I64d\n", SectorCountFromLbn
);
575 ok(StartingLbn
== 1185LL, "Expected StartingLbn 1185, got: %I64d\n", StartingLbn
);
576 ok(SectorCountFromStartingLbn
== 32LL, "Expected SectorCountFromStartingLbn 32, got: %I64d\n", SectorCountFromStartingLbn
);
577 ok(Index
== 4, "Expected Index 4, got: %d\n", Index
);
579 Result
= FsRtlGetNextLargeMcbEntry(&FirstMcb
, 0, &Vbn
, &Lbn
, &SectorCount
);
580 ok(Result
== TRUE
, "Expected TRUE, got FALSE\n");
581 ok(Vbn
== 0LL, "Expected Vbn 0, got: %I64d\n", Vbn
);
582 ok(Lbn
== -1LL, "Expected Lbn -1, got: %I64d\n", Lbn
);
583 ok(SectorCount
== 1LL, "Expected SectorCount 1, got: %I64d\n", SectorCount
);
585 Result
= FsRtlGetNextLargeMcbEntry(&FirstMcb
, 1, &Vbn
, &Lbn
, &SectorCount
);
586 ok(Result
== TRUE
, "Expected TRUE, got FALSE\n");
587 ok(Vbn
== 1LL, "Expected Vbn 1, got: %I64d\n", Vbn
);
588 ok(Lbn
== 198657LL, "Expected Lbn 198657, got: %I64d\n", Lbn
);
589 ok(SectorCount
== 1LL, "Expected SectorCount 1, got: %I64d\n", SectorCount
);
591 Result
= FsRtlGetNextLargeMcbEntry(&FirstMcb
, 2, &Vbn
, &Lbn
, &SectorCount
);
592 ok(Result
== TRUE
, "Expected TRUE, got FALSE\n");
593 ok(Vbn
== 2LL, "Expected Vbn 2, got: %I64d\n", Vbn
);
594 ok(Lbn
== 199169LL, "Expected Lbn 199169, got: %I64d\n", Lbn
);
595 ok(SectorCount
== 15LL, "Expected SectorCount 15, got: %I64d\n", SectorCount
);
597 Result
= FsRtlGetNextLargeMcbEntry(&FirstMcb
, 3, &Vbn
, &Lbn
, &SectorCount
);
598 ok(Result
== TRUE
, "Expected TRUE, got FALSE\n");
599 ok(Vbn
== 17LL, "Expected Vbn 17, got: %I64d\n", Vbn
);
600 ok(Lbn
== 1105LL, "Expected Lbn 1105, got: %I64d\n", Lbn
);
601 ok(SectorCount
== 16LL, "Expected SectorCount 16, got: %I64d\n", SectorCount
);
603 Result
= FsRtlGetNextLargeMcbEntry(&FirstMcb
, 4, &Vbn
, &Lbn
, &SectorCount
);
604 ok(Result
== TRUE
, "Expected TRUE, got FALSE\n");
605 ok(Vbn
== 33LL, "Expected Vbn 33, got: %I64d\n", Vbn
);
606 ok(Lbn
== 1185LL, "Expected Lbn 1185, got: %I64d\n", Lbn
);
607 ok(SectorCount
== 32LL, "Expected SectorCount 32, got: %I64d\n", SectorCount
);
609 Result
= FsRtlGetNextLargeMcbEntry(&FirstMcb
, 5, &Vbn
, &Lbn
, &SectorCount
);
610 ok(Result
== FALSE
, "Expected FALSE, got TRUE\n");
612 Result
= FsRtlAddLargeMcbEntry(&SecondMcb
, 197128, 197128, 1);
613 ok(Result
== TRUE
, "Expected TRUE, got FALSE\n");
615 Result
= FsRtlLookupLargeMcbEntry(&SecondMcb
, 197128, &Lbn
, &SectorCountFromLbn
, &StartingLbn
, &SectorCountFromStartingLbn
, &Index
);
616 ok(Result
== TRUE
, "Expected TRUE, got FALSE\n");
617 ok(Lbn
== 197128LL, "Expected Lbn 197128, got: %I64d\n", Lbn
);
618 ok(SectorCountFromLbn
== 1LL, "Expected SectorCountFromLbn 1, got: %I64d\n", SectorCountFromLbn
);
619 ok(StartingLbn
== 197128LL, "Expected StartingLbn 197128, got: %I64d\n", StartingLbn
);
620 ok(SectorCountFromStartingLbn
== 1LL, "Expected SectorCountFromStartingLbn 1, got: %I64d\n", SectorCountFromStartingLbn
);
621 ok(Index
== 1, "Expected Index 1, got: %d\n", Index
);
623 Result
= FsRtlLookupLargeMcbEntry(&FirstMcb
, 65, &Lbn
, &SectorCountFromLbn
, NULL
, NULL
, NULL
);
624 ok(Result
== FALSE
, "Expected FALSE, got TRUE\n");
626 Result
= FsRtlAddLargeMcbEntry(&FirstMcb
, 65, 1249, 44);
627 ok(Result
== TRUE
, "Expected TRUE, got FALSE\n");
629 DumpAllRuns(&FirstMcb
);
631 NbRuns
= FsRtlNumberOfRunsInLargeMcb(&FirstMcb
);
632 ok(NbRuns
== 6, "Expected 6 runs, got: %lu\n", NbRuns
);
634 Result
= FsRtlLookupLargeMcbEntry(&FirstMcb
, 65, &Lbn
, &SectorCountFromLbn
, &StartingLbn
, &SectorCountFromStartingLbn
, &Index
);
635 ok(Result
== TRUE
, "Expected TRUE, got FALSE\n");
636 ok(Lbn
== 1249LL, "Expected Lbn 1249, got: %I64d\n", Lbn
);
637 ok(SectorCountFromLbn
== 44LL, "Expected SectorCountFromLbn 44, got: %I64d\n", SectorCountFromLbn
);
638 ok(StartingLbn
== 1249LL, "Expected StartingLbn 1249, got: %I64d\n", StartingLbn
);
639 ok(SectorCountFromStartingLbn
== 44LL, "Expected SectorCountFromStartingLbn 44, got: %I64d\n", SectorCountFromStartingLbn
);
640 ok(Index
== 5, "Expected Index 1, got: %d\n", Index
);
642 Result
= FsRtlGetNextLargeMcbEntry(&FirstMcb
, 0, &Vbn
, &Lbn
, &SectorCount
);
643 ok(Result
== TRUE
, "Expected TRUE, got FALSE\n");
644 ok(Vbn
== 0LL, "Expected Vbn 0, got: %I64d\n", Vbn
);
645 ok(Lbn
== -1LL, "Expected Lbn -1, got: %I64d\n", Lbn
);
646 ok(SectorCount
== 1LL, "Expected SectorCount 1, got: %I64d\n", SectorCount
);
648 Result
= FsRtlGetNextLargeMcbEntry(&FirstMcb
, 1, &Vbn
, &Lbn
, &SectorCount
);
649 ok(Result
== TRUE
, "Expected TRUE, got FALSE\n");
650 ok(Vbn
== 1LL, "Expected Vbn 1, got: %I64d\n", Vbn
);
651 ok(Lbn
== 198657LL, "Expected Lbn 198657, got: %I64d\n", Lbn
);
652 ok(SectorCount
== 1LL, "Expected SectorCount 1, got: %I64d\n", SectorCount
);
654 Result
= FsRtlGetNextLargeMcbEntry(&FirstMcb
, 2, &Vbn
, &Lbn
, &SectorCount
);
655 ok(Result
== TRUE
, "Expected TRUE, got FALSE\n");
656 ok(Vbn
== 2LL, "Expected Vbn 2, got: %I64d\n", Vbn
);
657 ok(Lbn
== 199169LL, "Expected Lbn 199169, got: %I64d\n", Lbn
);
658 ok(SectorCount
== 15LL, "Expected SectorCount 15, got: %I64d\n", SectorCount
);
660 Result
= FsRtlGetNextLargeMcbEntry(&FirstMcb
, 3, &Vbn
, &Lbn
, &SectorCount
);
661 ok(Result
== TRUE
, "Expected TRUE, got FALSE\n");
662 ok(Vbn
== 17LL, "Expected Vbn 17, got: %I64d\n", Vbn
);
663 ok(Lbn
== 1105LL, "Expected Lbn 1105, got: %I64d\n", Lbn
);
664 ok(SectorCount
== 16LL, "Expected SectorCount 16, got: %I64d\n", SectorCount
);
666 Result
= FsRtlGetNextLargeMcbEntry(&FirstMcb
, 4, &Vbn
, &Lbn
, &SectorCount
);
667 ok(Result
== TRUE
, "Expected TRUE, got FALSE\n");
668 ok(Vbn
== 33LL, "Expected Vbn 33, got: %I64d\n", Vbn
);
669 ok(Lbn
== 1185LL, "Expected Lbn 1185, got: %I64d\n", Lbn
);
670 ok(SectorCount
== 32LL, "Expected SectorCount 32, got: %I64d\n", SectorCount
);
672 Result
= FsRtlGetNextLargeMcbEntry(&FirstMcb
, 5, &Vbn
, &Lbn
, &SectorCount
);
673 ok(Result
== TRUE
, "Expected TRUE, got FALSE\n");
674 ok(Vbn
== 65LL, "Expected Vbn 65, got: %I64d\n", Vbn
);
675 ok(Lbn
== 1249LL, "Expected Lbn 1249, got: %I64d\n", Lbn
);
676 ok(SectorCount
== 44LL, "Expected SectorCount 44, got: %I64d\n", SectorCount
);
678 Result
= FsRtlGetNextLargeMcbEntry(&FirstMcb
, 6, &Vbn
, &Lbn
, &SectorCount
);
679 ok(Result
== FALSE
, "Expected FALSE, got TRUE\n");
681 Result
= FsRtlLookupLargeMcbEntry(&FirstMcb
, 1, &Lbn
, &SectorCountFromLbn
, NULL
, NULL
, NULL
);
682 ok(Result
== TRUE
, "Expected TRUE, got FALSE\n");
683 ok(Lbn
== 198657LL, "Expected Lbn 198657, got: %I64d\n", Lbn
);
684 ok(SectorCountFromLbn
== 1LL, "Expected SectorCountFromLbn 108, got: %I64d\n", SectorCountFromLbn
);
686 FsRtlUninitializeLargeMcb(&SecondMcb
);
687 FsRtlUninitializeLargeMcb(&FirstMcb
);
694 FsRtlLargeMcbTestsExt2();