223{
232
233 if (!
Context->Record.IsNonResident)
234 {
236 return 0;
241 }
242
243
244
245
246
247
248
249
250
251 AlreadyRead = 0;
252
253
254
255 if (0)
256 {
258 LastLCN =
Context->CacheRunLastLCN;
259 DataRunStartLCN =
Context->CacheRunStartLCN;
260 DataRunLength =
Context->CacheRunLength;
261 CurrentOffset =
Context->CacheRunCurrentOffset;
262 }
263 else
264 {
265 LastLCN = 0;
267 CurrentOffset = 0;
268
270 {
271 DataRun =
NtfsDecodeRun(DataRun, &DataRunOffset, &DataRunLength);
272 if (DataRunOffset != -1)
273 {
274
275 DataRunStartLCN = LastLCN + DataRunOffset;
276 LastLCN = DataRunStartLCN;
277 }
278 else
279 {
280
281 DataRunStartLCN = -1;
282 }
283
284 if (
Offset >= CurrentOffset &&
285 Offset < CurrentOffset + (DataRunLength *
Volume->ClusterSize))
286 {
287 break;
288 }
289
290 if (*DataRun == 0)
291 {
292 return AlreadyRead;
293 }
294
295 CurrentOffset += DataRunLength *
Volume->ClusterSize;
296 }
297 }
298
299
300
301
302
304 if (DataRunStartLCN == -1)
307 {
311
313 {
314 CurrentOffset += DataRunLength *
Volume->ClusterSize;
315 DataRun =
NtfsDecodeRun(DataRun, &DataRunOffset, &DataRunLength);
317 {
318 DataRunStartLCN = LastLCN + DataRunOffset;
319 LastLCN = DataRunStartLCN;
320 }
321 else
322 DataRunStartLCN = -1;
323 }
324
326 {
328 if (DataRunStartLCN == -1)
331 break;
332
336
337
339 break;
340
341
342
343
344
345 if (*DataRun == 0)
346 break;
347 CurrentOffset += DataRunLength *
Volume->ClusterSize;
348 DataRun =
NtfsDecodeRun(DataRun, &DataRunOffset, &DataRunLength);
349 if (DataRunOffset != -1)
350 {
351
352 DataRunStartLCN = LastLCN + DataRunOffset;
353 LastLCN = DataRunStartLCN;
354 }
355 else
356 {
357
358 DataRunStartLCN = -1;
359 }
360 }
361
362 }
363
366 Context->CacheRunStartLCN = DataRunStartLCN;
367 Context->CacheRunLength = DataRunLength;
368 Context->CacheRunLastLCN = LastLCN;
369 Context->CacheRunCurrentOffset = CurrentOffset;
370
371 return AlreadyRead;
372}
static BOOLEAN NtfsDiskRead(PNTFS_VOLUME_INFO Volume, ULONGLONG Offset, ULONGLONG Length, PCHAR Buffer)
while(CdLookupNextInitialFileDirent(IrpContext, Fcb, FileContext))