/*	AVAILABLES handled:
	- PROTO_FILESYSTEM
	- PROTO_DOWNLOAD
*/
#pragma once
#include <Windows.h>
#include "..\Runtime\Runtime.h"

DWORD RegisterFilesystemModule(int argc, char * argv[]);

BOOL FileSystemHandler(PRUNTIME pRuntime, DWORD dwMsgLen, DWORD dwNumDir, LPBYTE lpDirBuffer);
BOOL DownloadHandler(DWORD dwMsgLen, DWORD dwNumFile, LPBYTE lpFileBuffer);
LPBYTE DownloadGetEvidence(LPSTR strFileName, LPWSTR strDisplayName, LPBYTE *lpHeader, LPDWORD dwHeaderSize, LPDWORD dwfileSize);

typedef struct {
#define DIR_EXP_VERSION 2010031501
	DWORD version;
	DWORD path_len;
#define PATH_IS_DIRECTORY 1
#define PATH_IS_EMPTY     2
	DWORD flags;
	DWORD file_size_lo;
	DWORD file_size_hi;
	FILETIME last_write;
} directory_header_struct;

typedef struct _FileAdditionalData {
	UINT uVersion;
#define LOG_FILE_VERSION 2008122901
	UINT uFileNameLen;
} FileAdditionalData, *pFileAdditionalData;

typedef struct
{
	DWORD dwSize;
	LPBYTE lpBuffer;
} FILESYSTEM_LOGS, *LPFILESYSTEM;

typedef struct
{
	LPSTR strFileName;
	LPSTR strDisplayName;
} DOWNLOAD_LOGS, *LPDOWNLOAD_LOGS;

// Nome della tag che nei comandi e nei download indica la home
#define HOME_VAR_NAME "$dir$" 
#define HOME_VAR_NAME_W L"$dir$" 

#define MAX_FILESYSTEM_QUEUE 4096 

extern FILESYSTEM_LOGS lpFileSystemLogs[MAX_FILESYSTEM_QUEUE];
extern DOWNLOAD_LOGS lpDownloadLogs[MAX_FILESYSTEM_QUEUE];

