Home MagiCMagiC MagiCMagiC MAGX_COOKIE, status_bitsMAGX_COOKIE, status_bits

11.1 AESVARS, Pointer to AESVARS

/* The following code obtains the pointer to the AESVARS structure of
   MagiC in a reliable manner.

   The routine is particularly important as the relevant components
   in the MagX cookie do not yet have a valid value at boot-up. */


AESVARS* DOMagixAESVars (VOID)
{
    LOCAL WORD have_it = 0;
    LOCAL AESVARS *ap = 0;

    if (!have_it)
    {
        OSHEADER *O;

        have_it = 1;

        O = (OSHEADER *) Supexec (get_osheader);
        ap = (AESVARS *) O->os_magic;

        if (!get_cookie ('MagX', NULL) ||
            ap->magic != 0x87654321L || ap->magic2 != 'MAGX')
              ap = 0;
    }

    return (ap);

} /* DOMagixAESVars */

See also: Test for MagiC   get_cookie


Home MagiCMagiC MagiCMagiC MAGX_COOKIE, status_bitsMAGX_COOKIE, status_bits