File:  [OS/2 SDKs] / os2sdk / demos / examples / infoseg / infoseg.c
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs
Thu Aug 9 12:26:12 2018 UTC (7 years, 9 months ago) by root
Branches: msft, MAIN
CVS tags: os2sdk-1988, HEAD
Microsoft OS/2 SDK 03-01-1988

/*
 * Example of DosGetInfoSeg usage
 *
 * Gets the local and global data segments and displays some of their contents
 *
 * Created by Microsoft Corp. 1986
 */

#define  INCL_DOSINFOSEG

#include <os2def.h>
#include <bsedos.h>    /* contains MAKEPG and MAKEPLINFOSEG definitions */

main()
{
	PGINFOSEG gdt;
	PLINFOSEG ldt;
	SEL gdt_handle, ldt_handle;
	
	/* get the infoseg handles */
	DosGetInfoSeg(&gdt_handle, &ldt_handle);
	
	/* convert the handles into far pointers */
	gdt = MAKEPGINFOSEG(gdt_handle);
	ldt = MAKEPLINFOSEG(ldt_handle);
	
	/* display the contents of the segments */
	printf("This is thread %u of process %u\n",
		ldt->tidCurrent,
		ldt->pidCurrent);
	printf("The current time is %u:%2u:%2u.%2u\n",
		gdt->hour, gdt->minutes, gdt->seconds, gdt->hundredths);
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.