1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
/*****************************************************************************/
/* RootHandler.cpp Copyright (c) Ladislav Zezula 2015 */
/*---------------------------------------------------------------------------*/
/* Implementation of root handler */
/*---------------------------------------------------------------------------*/
/* Date Ver Who Comment */
/* -------- ---- --- ------- */
/* 09.03.15 1.00 Lad Created */
/*****************************************************************************/
#define __CASCLIB_SELF__
#include "../CascLib.h"
#include "../CascCommon.h"
//-----------------------------------------------------------------------------
// Common support
int RootHandler_Insert(TRootHandler * pRootHandler, const char * szFileName, LPBYTE pbEncodingKey)
{
if(pRootHandler == NULL || pRootHandler->Insert == NULL)
return ERROR_NOT_SUPPORTED;
return pRootHandler->Insert(pRootHandler, szFileName, pbEncodingKey);
}
LPBYTE RootHandler_Search(TRootHandler * pRootHandler, struct _TCascSearch * pSearch, PDWORD PtrFileSize, PDWORD PtrLocaleFlags)
{
// Check if the root structure is valid at all
if(pRootHandler == NULL)
return NULL;
return pRootHandler->Search(pRootHandler, pSearch, PtrFileSize, PtrLocaleFlags);
}
void RootHandler_EndSearch(TRootHandler * pRootHandler, struct _TCascSearch * pSearch)
{
// Check if the root structure is valid at all
if(pRootHandler != NULL)
{
pRootHandler->EndSearch(pRootHandler, pSearch);
}
}
LPBYTE RootHandler_GetKey(TRootHandler * pRootHandler, const char * szFileName)
{
// Check if the root structure is valid at all
if(pRootHandler == NULL)
return NULL;
return pRootHandler->GetKey(pRootHandler, szFileName);
}
void RootHandler_Dump(TCascStorage * hs, LPBYTE pbRootHandler, DWORD cbRootHandler, const TCHAR * szNameFormat, const TCHAR * szListFile, int nDumpLevel)
{
TDumpContext * dc;
// Only if the ROOT provider suports the dump option
if(hs->pRootHandler != NULL && hs->pRootHandler->Dump != NULL)
{
// Create the dump file
dc = CreateDumpContext(hs, szNameFormat);
if(dc != NULL)
{
// Dump the content and close the file
hs->pRootHandler->Dump(hs, dc, pbRootHandler, cbRootHandler, szListFile, nDumpLevel);
dump_close(dc);
}
}
}
void RootHandler_Close(TRootHandler * pRootHandler)
{
// Check if the root structure is allocated at all
if(pRootHandler != NULL)
{
pRootHandler->Close(pRootHandler);
}
}
|