1998-10-11 19:04:17 +02:00
|
|
|
/*
|
|
|
|
* IMAGEHLP library
|
|
|
|
*
|
|
|
|
* Copyright 1998 Patrik Stridvall
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
1998-10-11 19:04:17 +02:00
|
|
|
*/
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#include "windef.h"
|
1999-02-17 14:51:06 +01:00
|
|
|
#include "winbase.h"
|
1998-10-11 19:04:17 +02:00
|
|
|
#include "winerror.h"
|
2002-03-10 00:29:33 +01:00
|
|
|
#include "wine/debug.h"
|
1998-10-11 19:04:17 +02:00
|
|
|
#include "imagehlp.h"
|
|
|
|
|
|
|
|
/***********************************************************************
|
2000-03-28 22:22:59 +02:00
|
|
|
* InitializeListHead
|
1998-10-11 19:04:17 +02:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
VOID InitializeListHead(PLIST_ENTRY pListHead)
|
1998-10-11 19:04:17 +02:00
|
|
|
{
|
|
|
|
pListHead->Flink = pListHead;
|
|
|
|
pListHead->Blink = pListHead;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2000-03-28 22:22:59 +02:00
|
|
|
* InsertHeadList
|
1998-10-11 19:04:17 +02:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
VOID InsertHeadList(PLIST_ENTRY pListHead, PLIST_ENTRY pEntry)
|
1998-10-11 19:04:17 +02:00
|
|
|
{
|
|
|
|
pEntry->Blink = pListHead;
|
|
|
|
pEntry->Flink = pListHead->Flink;
|
|
|
|
pListHead->Flink = pEntry;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2000-03-28 22:22:59 +02:00
|
|
|
* InsertTailList
|
1998-10-11 19:04:17 +02:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
VOID InsertTailList(PLIST_ENTRY pListHead, PLIST_ENTRY pEntry)
|
1998-10-11 19:04:17 +02:00
|
|
|
{
|
|
|
|
pEntry->Flink = pListHead;
|
|
|
|
pEntry->Blink = pListHead->Blink;
|
|
|
|
pListHead->Blink = pEntry;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2000-03-28 22:22:59 +02:00
|
|
|
* IsListEmpty
|
1998-10-11 19:04:17 +02:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOLEAN IsListEmpty(PLIST_ENTRY pListHead)
|
1998-10-11 19:04:17 +02:00
|
|
|
{
|
|
|
|
return !pListHead;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2000-03-28 22:22:59 +02:00
|
|
|
* PopEntryList
|
1998-10-11 19:04:17 +02:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
PSINGLE_LIST_ENTRY PopEntryList(PSINGLE_LIST_ENTRY pListHead)
|
1998-10-11 19:04:17 +02:00
|
|
|
{
|
|
|
|
pListHead->Next = NULL;
|
|
|
|
return pListHead;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2000-03-28 22:22:59 +02:00
|
|
|
* PushEntryList
|
1998-10-11 19:04:17 +02:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
VOID PushEntryList(
|
|
|
|
PSINGLE_LIST_ENTRY pListHead, PSINGLE_LIST_ENTRY pEntry)
|
1998-10-11 19:04:17 +02:00
|
|
|
{
|
|
|
|
pEntry->Next=pListHead;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2000-03-28 22:22:59 +02:00
|
|
|
* RemoveEntryList
|
1998-10-11 19:04:17 +02:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
VOID RemoveEntryList(PLIST_ENTRY pEntry)
|
1998-10-11 19:04:17 +02:00
|
|
|
{
|
|
|
|
pEntry->Flink->Blink = pEntry->Blink;
|
|
|
|
pEntry->Blink->Flink = pEntry->Flink;
|
|
|
|
pEntry->Flink = NULL;
|
|
|
|
pEntry->Blink = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2000-03-28 22:22:59 +02:00
|
|
|
* RemoveHeadList
|
1998-10-11 19:04:17 +02:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
PLIST_ENTRY RemoveHeadList(PLIST_ENTRY pListHead)
|
1998-10-11 19:04:17 +02:00
|
|
|
{
|
1999-02-26 12:11:13 +01:00
|
|
|
PLIST_ENTRY p = pListHead->Flink;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1998-10-11 19:04:17 +02:00
|
|
|
if(p != pListHead)
|
|
|
|
{
|
2002-06-01 01:06:46 +02:00
|
|
|
RemoveEntryList(pListHead);
|
1998-10-11 19:04:17 +02:00
|
|
|
return p;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pListHead->Flink = NULL;
|
|
|
|
pListHead->Blink = NULL;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2000-03-28 22:22:59 +02:00
|
|
|
* RemoveTailList
|
1998-10-11 19:04:17 +02:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
PLIST_ENTRY RemoveTailList(PLIST_ENTRY pListHead)
|
1998-10-11 19:04:17 +02:00
|
|
|
{
|
1999-02-26 12:11:13 +01:00
|
|
|
RemoveHeadList(pListHead->Blink);
|
1998-10-11 19:04:17 +02:00
|
|
|
if(pListHead != pListHead->Blink)
|
|
|
|
return pListHead;
|
|
|
|
else
|
|
|
|
return NULL;
|
|
|
|
}
|