Blame src/internal/perk_errinfo_impl.c

db655e
/***************************************************************/
db655e
/*  perk: PE Resource Kit                                      */
425fb8
/*  Copyright (C) 2015--2021  SysDeer Technologies, LLC        */
db655e
/*  Released under GPLv2 and GPLv3; see COPYING.PERK.          */
db655e
/***************************************************************/
db655e
db655e
#include <perk/perk.h>
db655e
#include "perk_driver_impl.h"
db655e
#include "perk_errinfo_impl.h"
db655e
db655e
int pe_record_error(
db655e
	const struct pe_driver_ctx *	dctx,
f006c4
	int				esyscode,
f006c4
	int				elibcode,
f006c4
	const char *			efunction,
f006c4
	int				eline,
f006c4
	unsigned			eflags,
f006c4
	void *				eany)
db655e
{
db655e
	struct pe_driver_ctx_impl *	ictx;
db655e
	struct pe_error_info *		erri;
db655e
db655e
	ictx = pe_get_driver_ictx(dctx);
db655e
db655e
	if (ictx->errinfp == ictx->erricap)
db655e
		return -1;
db655e
db655e
	*ictx->errinfp = &ictx->erribuf[ictx->errinfp - ictx->erriptr];
db655e
	erri = *ictx->errinfp;
db655e
09d2c0
	erri->euctx     = ictx->euctx;
09d2c0
	erri->eunit     = ictx->eunit;
09d2c0
f006c4
	erri->edctx     = dctx;
f006c4
	erri->esyscode  = esyscode;
f006c4
	erri->elibcode  = elibcode;
f006c4
	erri->efunction = efunction;
f006c4
	erri->eline     = eline;
f006c4
	erri->eflags    = eflags;
f006c4
	erri->eany      = eany;
db655e
db655e
	ictx->errinfp++;
db655e
db655e
	return -1;
db655e
}