extern static bool _ScanLogContainers(ref CLFS_SCAN_CONTEXT pcxScan, CLFS_SCAN_MODE eScanMode, IntPtr pReserved);
void SilenceCompiler() { this.cidNode.cbNode = 0; this.cidNode.cType = 0; this.hLog = IntPtr.Zero; this.cIndex = 0; this.cContainers = 0; this.cContainersReturned = 0; this.eScanMode = CLFS_SCAN_MODE.CLFS_SCAN_BACKWARD; this.pinfoContainer = IntPtr.Zero; }
extern static bool _CreateLogContainerScanContext( SafeFileHandle hLog, uint cFromContainer, uint cContainers, CLFS_SCAN_MODE eScanMode, ref CLFS_SCAN_CONTEXT pcxScan, NativeOverlapped* pOverlapped);
public static void CreateLogContainerScanContextSync( SafeFileHandle hLog, uint cFromContainer, uint cContainers, CLFS_SCAN_MODE eScanMode, ref CLFS_SCAN_CONTEXT pcxScan) { if (!_CreateLogContainerScanContext(hLog, cFromContainer, cContainers, eScanMode, ref pcxScan, null)) { uint errorCode = (uint)Marshal.GetLastWin32Error(); if (errorCode == Error.ERROR_IO_PENDING) { // The CLFS API was called with a NULL overlapped, so the operation should not be asynchronous. // This means that CLFS has a bug, so it is not safe to continue processing. DiagnosticUtility.FailFast("No async in CreateLCScanSync"); } switch (errorCode) { case Error.ERROR_INVALID_HANDLE: case Error.ERROR_OUTOFMEMORY: case Error.ERROR_ACCESS_DENIED: case Error.ERROR_INVALID_PARAMETER: throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(Error.ExceptionForKnownCode(errorCode)); default: throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(Error.ExceptionForUnknownCode(errorCode)); } } }