FreeBASIC  0.91.0
drv_intl.c
Go to the documentation of this file.
1 /* helper functions for internationalization support */
2 
3 #include "../fb.h"
4 #include "fb_private_intl.h"
5 #include <dpmi.h>
6 #include <go32.h>
7 
9 {
10  int result = FALSE;
11  int arg_seg, arg_sel;
12  __dpmi_regs r;
13 
14  DBG_ASSERT( pInfo!=NULL );
15  memset( pInfo, 0, sizeof(DOS_COUNTRY_INFO_GENERAL) );
16 
17  pInfo->info_id = 0x01;
18  pInfo->size_data = sizeof(DOS_COUNTRY_INFO_GENERAL) - 3;
19 
20  arg_seg = __dpmi_allocate_dos_memory( (sizeof(DOS_COUNTRY_INFO_GENERAL) + 15) >> 4,
21  &arg_sel );
22  if( arg_seg==0 )
23  return FALSE;
24 
25  memset( &r, 0, sizeof(r) );
26 
27  r.x.ax = 0x6501;
28  r.x.bx = 0xFFFF;
29  r.x.dx = 0xFFFF;
30  r.x.es = arg_seg;
31  r.x.di = 0x0000;
32  r.x.cx = sizeof(DOS_COUNTRY_INFO_GENERAL);
33 
34  if( __dpmi_int( 0x21, &r )==0 ) {
35  if( (r.x.flags & 0x01)==0 ) {
36  movedata( arg_sel, 0,
37  _my_ds(), (unsigned) pInfo,
38  sizeof(DOS_COUNTRY_INFO_GENERAL) );
39  result = TRUE;
40  }
41  }
42 
43  __dpmi_free_dos_memory( arg_sel );
44 
45  return result;
46 }