// Get total number of functions in the program

idaman size_t ida_export get_func_qty(void);

// Get pointer to the next function
//      ea - any address in the program
// Returns ptr to function or NULL if next function doesn't exist

idaman func_t *ida_export get_next_func(ea_t ea);

// Get function limits
// The function limits is the minimal area containing all addresses
// belonging to the function
// returns: true-ok, false-wrong arguments

idaman bool ida_export get_func_limits(func_t *pfn, area_t *limits);


// Get function name
//      ea     - any address in the function
//      buf    - buffer for the answer
//      bufsize- size of the output buffer
// returns: function name or NULL

idaman char *ida_export get_func_name(ea_t ea, char *buf, size_t bufsize);

struct area_t
{
  ea_t startEA;
  ea_t endEA;


class func_t : public area_t
{
public:
  ushort flags;
  ..bunch of flags defined...
  union
  {
    struct              // attributes of a function entry chunk
    {
      asize_t argsize;     // number of bytes purged from the stack
                           // upon returning
      ..other stuff ...
    };
    struct                 // attributes of a function tail chunk
    {
      ea_t owner;          // the address of the main function possessing this tail
      int refqty;          // number of referers
      ..other stuff ..
    };
  };
};

 // windows.h conflicts with IDA's header files, so copy it from MSDN
extern "C" int VirtualProtect(
  void* lpAddress,      // region of committed pages
  DWORD dwSize,          // size of the region
  DWORD flNewProtect,    // desired access protection
  DWORD* lpflOldProtect  // old protection
); 
