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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
#include "main.h"
#include "MoreItems.h"
static const wchar_t g_noentry[] = L"No Entry";
wchar_t *strFile;
size_t cbFile;
wchar_t *strTitle;
size_t cbTitle;
char *strCurtain;
size_t cbCurtain;
int length;
int index;
unsigned long starttime; // Start time in MS (0, begin of file)
unsigned long endtime; // End time in MS (0, end of file)
moreitems *Next; // Next Item in linked list
moreitems::moreitems()
: strFile(0), cbFile(0), strTitle(0), cbTitle(0),
strCurtain(0), cbCurtain(0), length(0), index(0),
starttime(0), endtime(0), Next(0)
{
}
moreitems::~moreitems()
{
// recursive, find the _tail and remove it, work back to _head
delete Next; Next = NULL;
delete[] strFile; strFile=NULL;
delete[] strTitle;
delete[] strCurtain;
}
const wchar_t *moreitems::GetHiddenFilename(int index)
{
if (this->index == index)
return strFile;
if (Next == NULL)
return g_noentry;
return Next->GetHiddenFilename(index);
}
int moreitems::SetRange(int index, unsigned long start, unsigned long end)
{
if (this->index == index)
{
this->starttime = start;
this->endtime = end;
return 1;
}
if (Next == NULL)
return 0;
return Next->SetRange(index,start,end);
}
unsigned long moreitems::GetStart(int index)
{
if (this->index == index)
{
return this->starttime;
}
if (Next == NULL)
return 0;
return Next->GetStart(index);
}
unsigned long moreitems::GetEnd(int index)
{
if (this->index == index)
{
return this->endtime;
}
if (Next == NULL)
return 0;
return Next->GetEnd(index);
}
int moreitems::AddHiddenItem(const wchar_t *filename, const wchar_t *title, int length, int index, char *curtain)
{
// Linked list _head
moreitems *additem = this;
if (additem && index == 1)
{
// List empty
// Use placeholder
}
else
{
// Found items, walk to the end
while (additem && additem->Next) additem = additem->Next;
if (additem)
{
additem->Next = new moreitems;
additem = additem->Next;
}
}
if (additem)
{
additem->cbFile = lstrlenW(filename) + 1;
additem->strFile = new wchar_t[additem->cbFile];
StringCchCopyW(additem->strFile , additem->cbFile, filename);
additem->cbTitle = (int)lstrlenW(title) + 1;
additem->strTitle = new wchar_t[additem->cbFile];
StringCchCopyW(additem->strTitle, additem->cbTitle, title);
if (curtain && *curtain)
{
additem->cbCurtain = (int)strlen(curtain) + 1;
additem->strCurtain = new char[additem->cbCurtain];
StringCchCopyA(additem->strCurtain, additem->cbCurtain, curtain);
}
else
{
additem->cbCurtain = 0;
additem->strCurtain = NULL;
}
additem->length = length;
additem->index = index;
return 1;
}
return 0;
}
const char *moreitems::GetHiddenCurtain(int index)
{
moreitems *where = this;
while ( where )
{
if ( where->index == index && where->cbCurtain ) return where->strCurtain;
where = where->Next;
}
return NULL;
}
|