extern static bool _GetLogFileInformation(
     SafeFileHandle hLog,
     ref CLFS_INFORMATION pinfoBuffer,
     ref int cbBuffer);
        public static void GetLogFileInformation(
            SafeFileHandle hLog,
            ref CLFS_INFORMATION pinfoBuffer,
            ref int cbBuffer)
        {
            if (!_GetLogFileInformation(hLog, ref pinfoBuffer, ref cbBuffer))
            {
                uint errorCode = (uint)Marshal.GetLastWin32Error();
                switch (errorCode)
                {
                    case Error.ERROR_INVALID_HANDLE:
                    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));
                }
            }
        }
Esempio n. 3
0
        internal void GetLogFileInformation(out CLFS_INFORMATION pinfoBuffer)
        {
            pinfoBuffer = new CLFS_INFORMATION();

            int size = Marshal.SizeOf(typeof(CLFS_INFORMATION));
            UnsafeNativeMethods.GetLogFileInformation(
                this.logFile,
                ref pinfoBuffer,
                ref size);
        }