#ifndef _CLFSW32_H
#define _CLFSW32_H

#if __POCC__ >= 500
#pragma once
#endif

/* Common log file API definitions */

#undef CLFS_KERNEL_MODE
#include <clfs.h>

#ifdef __cplusplus
extern "C"
{
#endif

#if (_WIN32_WINNT >= _WIN32_WINNT_WS03)
typedef void (__stdcall * PCLFS_COMPLETION_ROUTINE) (PVOID, ULONG);
typedef ULONG(__stdcall * CLFS_PRINT_RECORD_ROUTINE) (PFILE, CLFS_RECORD_TYPE, PVOID, ULONG);
typedef PVOID CLFS_LOG_ARCHIVE_CONTEXT, *PCLFS_LOG_ARCHIVE_CONTEXT;

CLFSUSER_API CLFS_LSN WINAPI LsnCreate(CLFS_CONTAINER_ID, ULONG, ULONG);
CLFSUSER_API CLFS_CONTAINER_ID WINAPI LsnContainer(const CLFS_LSN *);
CLFSUSER_API ULONG WINAPI LsnBlockOffset(const CLFS_LSN *);
CLFSUSER_API ULONG WINAPI LsnRecordSequence(const CLFS_LSN *);
CLFSUSER_API HANDLE WINAPI CreateLogFile(LPCWSTR, ACCESS_MASK, DWORD, LPSECURITY_ATTRIBUTES, ULONG, ULONG);
CLFSUSER_API BOOL WINAPI DeleteLogByHandle(HANDLE);
CLFSUSER_API BOOL WINAPI DeleteLogFile(LPCWSTR, PVOID);
CLFSUSER_API BOOL WINAPI AddLogContainer(HANDLE, PULONGLONG, LPWSTR, LPVOID);
CLFSUSER_API BOOL WINAPI AddLogContainerSet(HANDLE, USHORT, PULONGLONG, LPWSTR *, LPVOID);
CLFSUSER_API BOOL WINAPI RemoveLogContainer(HANDLE, LPWSTR, BOOL, LPVOID);
CLFSUSER_API BOOL WINAPI RemoveLogContainerSet(HANDLE, USHORT, LPWSTR *, BOOL, LPVOID);
CLFSUSER_API BOOL WINAPI SetLogArchiveTail(HANDLE, PCLFS_LSN, LPVOID);
CLFSUSER_API BOOL WINAPI SetEndOfLog(HANDLE, PCLFS_LSN, LPOVERLAPPED);
CLFSUSER_API BOOL WINAPI CreateLogContainerScanContext(HANDLE, ULONG, ULONG, CLFS_SCAN_MODE, PCLFS_SCAN_CONTEXT, LPOVERLAPPED);
CLFSUSER_API BOOL WINAPI ScanLogContainers(PCLFS_SCAN_CONTEXT, CLFS_SCAN_MODE, LPVOID);
CLFSUSER_API BOOL WINAPI AlignReservedLog(PVOID, ULONG, LONGLONG[], PLONGLONG);
CLFSUSER_API BOOL WINAPI AllocReservedLog(PVOID, ULONG, PLONGLONG);
CLFSUSER_API BOOL WINAPI FreeReservedLog(PVOID, ULONG, PLONGLONG);
CLFSUSER_API BOOL WINAPI GetLogFileInformation(HANDLE, PCLFS_INFORMATION, PULONG);
CLFSUSER_API BOOL WINAPI SetLogArchiveMode(HANDLE, CLFS_LOG_ARCHIVE_MODE);
CLFSUSER_API BOOL WINAPI ReadLogRestartArea(PVOID, PVOID *, PULONG, PCLFS_LSN, PVOID *, LPOVERLAPPED);
CLFSUSER_API BOOL WINAPI ReadPreviousLogRestartArea(PVOID, PVOID *, PULONG, PCLFS_LSN, LPOVERLAPPED);
CLFSUSER_API BOOL WINAPI WriteLogRestartArea(PVOID, PVOID, ULONG, PCLFS_LSN, ULONG, PULONG, PCLFS_LSN, LPOVERLAPPED);
CLFSUSER_API BOOL WINAPI AdvanceLogBase(PVOID, PCLFS_LSN, ULONG, LPOVERLAPPED);
CLFSUSER_API BOOL WINAPI CloseAndResetLogFile(HANDLE);
CLFSUSER_API BOOL WINAPI CreateLogMarshallingArea(HANDLE, CLFS_BLOCK_ALLOCATION, CLFS_BLOCK_DEALLOCATION, PVOID, ULONG, ULONG, ULONG, PVOID *);
CLFSUSER_API BOOL WINAPI DeleteLogMarshallingArea(PVOID);
CLFSUSER_API BOOL WINAPI ReserveAndAppendLog(PVOID, PCLFS_WRITE_ENTRY, ULONG, PCLFS_LSN, PCLFS_LSN, ULONG, LONGLONG[], ULONG, PCLFS_LSN, LPOVERLAPPED);
CLFSUSER_API BOOL WINAPI ReserveAndAppendLogAligned(PVOID, PCLFS_WRITE_ENTRY, ULONG, ULONG, PCLFS_LSN, PCLFS_LSN, ULONG, LONGLONG[], ULONG, PCLFS_LSN, LPOVERLAPPED);
CLFSUSER_API BOOL WINAPI FlushLogBuffers(PVOID, LPOVERLAPPED);
CLFSUSER_API BOOL WINAPI FlushLogToLsn(PVOID, PCLFS_LSN, PCLFS_LSN, LPOVERLAPPED);
CLFSUSER_API BOOL WINAPI ReadLogRecord(PVOID, PCLFS_LSN, CLFS_CONTEXT_MODE, PVOID *, PULONG, PCLFS_RECORD_TYPE, PCLFS_LSN, PCLFS_LSN, PVOID *, LPOVERLAPPED);
CLFSUSER_API BOOL WINAPI ReadNextLogRecord(PVOID, PVOID *, PULONG, PCLFS_RECORD_TYPE, PCLFS_LSN, PCLFS_LSN, PCLFS_LSN, PCLFS_LSN, LPOVERLAPPED);
CLFSUSER_API BOOL WINAPI TerminateReadLog(PVOID);
CLFSUSER_API BOOL WINAPI DumpLogRecords(PWSTR, CLFS_RECORD_TYPE, PCLFS_LSN, PCLFS_LSN, PFILE, CLFS_PRINT_RECORD_ROUTINE, CLFS_BLOCK_ALLOCATION, CLFS_BLOCK_DEALLOCATION, PVOID, ULONG, ULONG);
CLFSUSER_API BOOL WINAPI PrepareLogArchive(HANDLE, PWSTR, ULONG, const PCLFS_LSN, const PCLFS_LSN, PULONG, PULONGLONG, PULONGLONG, PCLFS_LSN, PCLFS_LSN, PCLFS_LSN, PCLFS_LOG_ARCHIVE_CONTEXT);
CLFSUSER_API BOOL WINAPI ReadLogArchiveMetadata(CLFS_LOG_ARCHIVE_CONTEXT, ULONG, ULONG, PBYTE, PULONG);
CLFSUSER_API BOOL WINAPI GetNextLogArchiveExtent(CLFS_LOG_ARCHIVE_CONTEXT, CLFS_ARCHIVE_DESCRIPTOR[], ULONG, PULONG);
CLFSUSER_API BOOL WINAPI TerminateLogArchive(CLFS_LOG_ARCHIVE_CONTEXT);
CLFSUSER_API BOOL WINAPI ValidateLog(LPCWSTR, LPSECURITY_ATTRIBUTES, PCLFS_INFORMATION, PULONG);
CLFSUSER_API BOOL WINAPI GetLogContainerName(HANDLE, CLFS_CONTAINER_ID, LPCWSTR, ULONG, PULONG);
CLFSUSER_API BOOL WINAPI GetLogIoStatistics(HANDLE, PVOID, ULONG, CLFS_IOSTATS_CLASS, PULONG);
#endif /* _WIN32_WINNT >= _WIN32_WINNT_WS03 */

#if (_WIN32_WINNT >= _WIN32_WINNT_LONGHORN)
CLFSUSER_API BOOL WINAPI TruncateLog(PVOID, PCLFS_LSN, LPOVERLAPPED);
#endif /* _WIN32_WINNT >= _WIN32_WINNT_LONGHORN */

#ifdef __cplusplus
}
#endif

#endif /* _CLFSW32_H */
