.CAL Calendar File Format This topic describes the binary file format used by Microsoft Windows Calendar (CALENDAR.EXE). A Calendar binary file contains information about file content, dates, days, and appointments. Calendar-File Header The first 8 bytes of a Calendar file are a character array identifying the file as a Calendar file. Following are the contents of the array: 'C' + 'r' = b5 'A' + 'a' = a2 'L' + 'd' = b0 'E' + 'n' = b3 'N' + 'e' = b3 'D' + 'l' = b0 'A' + 'a' = a2 'R' + 'c' = b5 The next 2 bytes (cDateDescriptors) contain the integer count of dates described in the file. The next 12 bytes contain six 2-byte fields of information that is global to the entire file. These variables are normally set by the user through the Alarm Controls and Options Day dialog boxes. The header information has the following form: WORD MinEarlyRing BOOL fSound int interval int mininterval BOOL f24HourFormat int StartTime Following are the members in the header structure: MinEarlyRing Specifies an early ring, in minutes. fSound Specifies whether alarms should be audible. interval Specifies the interval between appointments: 0 = 15 minutes, 1 = 30 minutes, 2 = 60 minutes. mininterval Specifies the interval, in minutes. f24HourFormat Specifies the time format: nonzero=24-hour format. StartTime Specifies the starting time in day mode--that is, the time that normally appears first in the display, in minutes past midnight. The rest of the first 64 bytes are reserved. Date Descriptors A date-descriptor array appears next. Each entry in the array describes one day. The number of entries in the array is cDateDescriptors (described in the preceding section). Each element in the array consists of 12 bytes, in six 2-byte fields. The date-descriptor array has the following form: unsigned Date int fMarked int cAlarms unsigned FileBlockOffset int reserved unsigned reserved Following are the members in the date-descriptor array: Date Specifies the date, in days past 1/1/1980. fMarked Specifies which mark(s) are set for the date: box = 128, parentheses = 256, circle = 512, cross = 1024, underscore = 2048. cAlarms Specifies the number of alarms set for the day. FileBlockOffset Specifies the file offset, in 64-byte blocks, to the day's information. Only the low 15 bits are used (the high bit will be zero). Thus, if this offset is 6, the day's information is stored at byte 6*64 in the file. reserved Reserved; must be 0xFFF. reserved Reserved; must be 0xFFF. Day-Specific Information All day information is stored after the date-descriptor array, on even 64-byte boundaries. The day-information structure has the following form: unsigned reserved unsigned Date unsigned reserved unsigned cbNotes unsigned cbAppointment char Notes[cbNotes] BYTE ApptInfo[] Following are the members in the day-information structure: reserved Reserved; must be zero. Date Specifies the date, in days past 1/1/1980. reserved Reserved; must be 1. cbNotes Specifies the number of bytes of note information, including null bytes. This information appears in the note array below the appointment list. cbAppointment Specifies the count of bytes of appointment information. Notes Contains the text of the note. ApptInfo Contains the block of appointments. Appointment-Specific Information The information in the appointment block is stored as a list of single appointments. Each appointment consists of a structure similar to the following: struct { char cb; char flags; int time; char szApptDesc[]; }; Following are the members in each appointment structure: cb Specifies the size, in bytes, of the structure containing the appointment. The structure address of the next appointment is the current appointment plus the value of the cb member. flags Contains various flags. This member can have one or more of the following values: Value Meaning 1 Alarm will go off at the specified time of the appointment. 2 Appointment is a special time. time Specifies the number of minutes past midnight. szApptDesc Contains a null-terminated string consisting of text associated with an appointment.