--- os2sdk/demos/examples/infoseg/infoseg.c 2018/08/09 12:25:13 1.1 +++ os2sdk/demos/examples/infoseg/infoseg.c 2018/08/09 12:26:12 1.1.1.2 @@ -1,70 +1,33 @@ /* - * Example of DOSGETINFOSEG usage + * Example of DosGetInfoSeg usage * * Gets the local and global data segments and displays some of their contents * - * Copyright (C) Microsoft Corp. 1986 + * Created by Microsoft Corp. 1986 */ -#include "doscalls.h" +#define INCL_DOSINFOSEG -struct gdtinfoarea{ - unsigned long time; - unsigned long milliseconds; - unsigned char hours; - unsigned char minutes; - unsigned char seconds; - unsigned char hundreths; - unsigned timezone; - unsigned timer_interval; - unsigned char day; - unsigned char month; - unsigned year; - unsigned char day_of_week; - unsigned char major_version; - unsigned char minor_version; - unsigned char revision_number; - unsigned char current_screen_group; - unsigned char max_num_of_screengrps; - unsigned char huge_selector_shift_count; - unsigned char protect_mode_indicator; - unsigned foreground_process_id; - unsigned char dynamic_variation_flag; - unsigned char maxwait; - unsigned minimum_timeslice; - unsigned maximum_timeslice; - unsigned boot_drive; - unsigned char reserved[32]; - }; - - - struct ldtinfoarea{ - unsigned current_process_pid; - unsigned parent_pid; - unsigned priority_of_current_thread; - unsigned thread_id_of_current_thread; - unsigned screen_group; - unsigned subscreen_group; - unsigned current_process_is_in_fg; - }; +#include +#include /* contains MAKEPG and MAKEPLINFOSEG definitions */ main() { - struct gdtinfoarea *gdt; - struct ldtinfoarea *ldt; - unsigned gdt_handle, ldt_handle; + PGINFOSEG gdt; + PLINFOSEG ldt; + SEL gdt_handle, ldt_handle; /* get the infoseg handles */ - DOSGETINFOSEG(&gdt_handle, &ldt_handle); + DosGetInfoSeg(&gdt_handle, &ldt_handle); /* convert the handles into far pointers */ - gdt = (struct gdtinfoarea *)((long)gdt_handle << 16); - ldt = (struct ldtinfoarea *)((long)ldt_handle << 16); + gdt = MAKEPGINFOSEG(gdt_handle); + ldt = MAKEPLINFOSEG(ldt_handle); /* display the contents of the segments */ printf("This is thread %u of process %u\n", - ldt->thread_id_of_current_thread, - ldt->current_process_pid); + ldt->tidCurrent, + ldt->pidCurrent); printf("The current time is %u:%2u:%2u.%2u\n", - gdt->hours, gdt->minutes, gdt->seconds, gdt->hundreths); + gdt->hour, gdt->minutes, gdt->seconds, gdt->hundredths); }