Add some ctrl breaker checks into copy, del, and dir.
[reactos.git] / reactos / lib / imagehlp / internal.c
1 /*
2 * IMAGEHLP library
3 *
4 * Copyright 1998 Patrik Stridvall
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21 #include <stdarg.h>
22
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winerror.h"
26 #include "wine/debug.h"
27 #include "imagehlp.h"
28
29 /***********************************************************************
30 * InitializeListHead
31 */
32 VOID InitializeListHead(PLIST_ENTRY pListHead)
33 {
34 pListHead->Flink = pListHead;
35 pListHead->Blink = pListHead;
36 }
37
38 /***********************************************************************
39 * InsertHeadList
40 */
41 VOID InsertHeadList(PLIST_ENTRY pListHead, PLIST_ENTRY pEntry)
42 {
43 pEntry->Blink = pListHead;
44 pEntry->Flink = pListHead->Flink;
45 pListHead->Flink = pEntry;
46 }
47
48 /***********************************************************************
49 * InsertTailList
50 */
51 VOID InsertTailList(PLIST_ENTRY pListHead, PLIST_ENTRY pEntry)
52 {
53 pEntry->Flink = pListHead;
54 pEntry->Blink = pListHead->Blink;
55 pListHead->Blink = pEntry;
56 }
57
58 /***********************************************************************
59 * IsListEmpty
60 */
61 BOOLEAN IsListEmpty(PLIST_ENTRY pListHead)
62 {
63 return !pListHead;
64 }
65
66 /***********************************************************************
67 * PopEntryList
68 */
69 PSINGLE_LIST_ENTRY PopEntryList(PSINGLE_LIST_ENTRY pListHead)
70 {
71 pListHead->Next = NULL;
72 return pListHead;
73 }
74
75 /***********************************************************************
76 * PushEntryList
77 */
78 VOID PushEntryList(
79 PSINGLE_LIST_ENTRY pListHead, PSINGLE_LIST_ENTRY pEntry)
80 {
81 pEntry->Next=pListHead;
82 }
83
84 /***********************************************************************
85 * RemoveEntryList
86 */
87 VOID RemoveEntryList(PLIST_ENTRY pEntry)
88 {
89 pEntry->Flink->Blink = pEntry->Blink;
90 pEntry->Blink->Flink = pEntry->Flink;
91 pEntry->Flink = NULL;
92 pEntry->Blink = NULL;
93 }
94
95 /***********************************************************************
96 * RemoveHeadList
97 */
98 PLIST_ENTRY RemoveHeadList(PLIST_ENTRY pListHead)
99 {
100 PLIST_ENTRY p = pListHead->Flink;
101
102 if(p != pListHead)
103 {
104 RemoveEntryList(pListHead);
105 return p;
106 }
107 else
108 {
109 pListHead->Flink = NULL;
110 pListHead->Blink = NULL;
111 return NULL;
112 }
113 }
114
115 /***********************************************************************
116 * RemoveTailList
117 */
118 PLIST_ENTRY RemoveTailList(PLIST_ENTRY pListHead)
119 {
120 RemoveHeadList(pListHead->Blink);
121 if(pListHead != pListHead->Blink)
122 return pListHead;
123 else
124 return NULL;
125 }