⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stack.cpp

📁 十分经典的开源反编译工具
💻 CPP
字号:
/************************************************************************
*                  stack.cpp                                            *
* This is a simple stack class for a stack of lptr's. It is used in     *
* keeping track of jump locations, so that when a jump is followed it   *
* can be reversed. The stack is of a set size, and when it becomes too  *
* large the bottom of the stack is lost. I did have some plans on using *
* this class in a front end unpacker-emulator but my plans have changed *
* and any unpacker-emulator will use a different method more akin to    *
* single step tracing.                                                  *
* The stack was added in Version 2.11                                   *
************************************************************************/

#include <windows.h>
#include "stacks.h"
#include "debug.h"

/************************************************************************
* constructor function                                                  *
* - simply reset the top of the stack                                   *
************************************************************************/
stack::stack()
{	stacktop=0;
}

/************************************************************************
* destructor function                                                   *
* - nothing to do since the stack is a fixed array                      *
************************************************************************/
stack::~stack()
{
}

/************************************************************************
* push                                                                  *
* - places an item on top of the stack. If there is no room then we     *
*   lose an item from the bottom and move the others down               *
************************************************************************/
void stack::push(lptr loc)
{ int i;
  if(stacktop==CALLSTACKSIZE)  // need to remove bottom item from stack
  { for(i=0;i<CALLSTACKSIZE-1;i++)
	 { callstack[i]=callstack[i+1];
		stacktop--;
	 }
  }
  callstack[stacktop]=loc;
  stacktop++;
}

/************************************************************************
* pop                                                                   *
* - gets an item from the top of the stack, or returns nlptr if the     *
*   stack is empty                                                      *
************************************************************************/
lptr stack::pop(void)
{ if(!stacktop)
    return nlptr;
  stacktop--;
  return callstack[stacktop];
}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -