Do not allow creation of not aligned EMF records by GDI code.
[wine.git] / dlls / imagehlp / internal.c
blob2da3cd221c33df2436c57b42ebefcdfb09b01d65
1 /*
2 * IMAGEHLP library
4 * Copyright 1998 Patrik Stridvall
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.
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.
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
21 #include <stdarg.h>
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winerror.h"
26 #include "wine/debug.h"
27 #include "imagehlp.h"
29 /***********************************************************************
30 * InitializeListHead
32 VOID InitializeListHead(PLIST_ENTRY pListHead)
34 pListHead->Flink = pListHead;
35 pListHead->Blink = pListHead;
38 /***********************************************************************
39 * InsertHeadList
41 VOID InsertHeadList(PLIST_ENTRY pListHead, PLIST_ENTRY pEntry)
43 pEntry->Blink = pListHead;
44 pEntry->Flink = pListHead->Flink;
45 pListHead->Flink = pEntry;
48 /***********************************************************************
49 * InsertTailList
51 VOID InsertTailList(PLIST_ENTRY pListHead, PLIST_ENTRY pEntry)
53 pEntry->Flink = pListHead;
54 pEntry->Blink = pListHead->Blink;
55 pListHead->Blink = pEntry;
58 /***********************************************************************
59 * IsListEmpty
61 BOOLEAN IsListEmpty(PLIST_ENTRY pListHead)
63 return !pListHead;
66 /***********************************************************************
67 * PopEntryList
69 PSINGLE_LIST_ENTRY PopEntryList(PSINGLE_LIST_ENTRY pListHead)
71 pListHead->Next = NULL;
72 return pListHead;
75 /***********************************************************************
76 * PushEntryList
78 VOID PushEntryList(
79 PSINGLE_LIST_ENTRY pListHead, PSINGLE_LIST_ENTRY pEntry)
81 pEntry->Next=pListHead;
84 /***********************************************************************
85 * RemoveEntryList
87 VOID RemoveEntryList(PLIST_ENTRY pEntry)
89 pEntry->Flink->Blink = pEntry->Blink;
90 pEntry->Blink->Flink = pEntry->Flink;
91 pEntry->Flink = NULL;
92 pEntry->Blink = NULL;
95 /***********************************************************************
96 * RemoveHeadList
98 PLIST_ENTRY RemoveHeadList(PLIST_ENTRY pListHead)
100 PLIST_ENTRY p = pListHead->Flink;
102 if(p != pListHead)
104 RemoveEntryList(pListHead);
105 return p;
107 else
109 pListHead->Flink = NULL;
110 pListHead->Blink = NULL;
111 return NULL;
115 /***********************************************************************
116 * RemoveTailList
118 PLIST_ENTRY RemoveTailList(PLIST_ENTRY pListHead)
120 RemoveHeadList(pListHead->Blink);
121 if(pListHead != pListHead->Blink)
122 return pListHead;
123 else
124 return NULL;