1998-10-11 19:04:17 +02:00
|
|
|
/*
|
|
|
|
* IMAGEHLP library
|
|
|
|
*
|
|
|
|
* Copyright 1998 Patrik Stridvall
|
|
|
|
*/
|
|
|
|
|
1999-02-17 14:51:06 +01:00
|
|
|
#include "winbase.h"
|
1998-10-11 19:04:17 +02:00
|
|
|
#include "winerror.h"
|
1999-03-14 17:35:05 +01:00
|
|
|
#include "windef.h"
|
1999-05-14 10:17:14 +02:00
|
|
|
#include "debugtools.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;
|
1998-10-11 19:04:17 +02:00
|
|
|
|
|
|
|
if(p != pListHead)
|
|
|
|
{
|
1999-02-26 12:11:13 +01: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;
|
|
|
|
}
|