ead9e049f006c19f13c96803f96c009af872abd3
1 /* $Id: safeobj.h,v 1.2 2002/02/20 09:17:55 hyperion Exp $
6 * types and definitions for safe checking of user-provided objects
8 * This file is part of the ReactOS Operating System.
11 * Created by KJK::Hyperion <noog@libero.it>
13 * THIS SOFTWARE IS NOT COPYRIGHTED
15 * This source code is offered for use in the public domain. You may
16 * use, modify or distribute it freely.
18 * This code is distributed in the hope that it will be useful but
19 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
20 * DISCLAMED. This includes but is not limited to warranties of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
24 #ifndef __PSX_SAFEOBJ_H_INCLUDED__
25 #define __PSX_SAFEOBJ_H_INCLUDED__
33 typedef uint32_t __magic_t
;
38 int __safeobj_validate(void *, __magic_t
);
41 /* builds a magic number from 4 characters */
42 #define MAGIC(a,b,c,d) ( \
43 (((uint32_t)(uint8_t)(a)) << 24) | \
44 (((uint32_t)(uint8_t)(b)) << 16) | \
45 (((uint32_t)(uint8_t)(c)) << 8) | \
46 (((uint32_t)(uint8_t)(d)) << 0) \
49 /* retrieves a comma-separated list of the 4 characters in a magic number */
50 #define MAGIC_DECOMPOSE(m) \
51 ((uint8_t)(m >> 24)), \
52 ((uint8_t)(m >> 16)), \
53 ((uint8_t)(m >> 8)), \
56 #endif /* __PSX_SAFEOBJ_H_INCLUDED__ */