www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2011/03/14/19:45:08

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: Jim Michaels <jmichae3 AT yahoo DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: csdpmi7 not working on virtualbox, how use dosmemget with seg ofs
from int21h?
Date: Mon, 14 Mar 2011 16:38:41 -0700 (PDT)
Organization: http://groups.google.com
Lines: 121
Message-ID: <428d9bd6-efc5-4f66-bab3-961a0c4598f9@f31g2000pri.googlegroups.com>
References: <39cdc18e-eccb-4213-b896-db3be020702e AT w9g2000prg DOT googlegroups DOT com>
<iknmth$1lb$1 AT speranza DOT aioe DOT org> <3e035797-6b8e-4106-bd29-98e87a9cc121 AT a21g2000prj DOT googlegroups DOT com>
<E1Pz5o6-0001qv-4s AT fencepost DOT gnu DOT org>
NNTP-Posting-Host: 24.21.90.47
Mime-Version: 1.0
X-Trace: posting.google.com 1300145922 25283 127.0.0.1 (14 Mar 2011 23:38:42 GMT)
X-Complaints-To: groups-abuse AT google DOT com
NNTP-Posting-Date: Mon, 14 Mar 2011 23:38:42 +0000 (UTC)
Complaints-To: groups-abuse AT google DOT com
Injection-Info: f31g2000pri.googlegroups.com; posting-host=24.21.90.47; posting-account=05hOMwoAAAB6R8xtiQKzEljSMzgOhVF1
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.15)
Gecko/20110303 Firefox/3.6.15 ( .NET CLR 3.5.30729),gzip(gfe)
Bytes: 5742
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

On Mar 14, 4:19=A0am, Eli Zaretskii <e DOT  DOT  DOT  AT gnu DOT org> wrote:
> > From: Jim Michaels <jmich DOT  DOT  DOT  AT yahoo DOT com>
> > Newsgroups: comp.os.msdos.djgpp
> > Date: Mon, 14 Mar 2011 02:06:34 -0700 (PDT)
>
> > On Mar 3, 2:31 am, "Rod Pemberton" <do_not_h DOT  DOT  DOT  AT notreplytome DOT cmm>
> > wrote:
> > > "Jim Michaels" <jmich DOT  DOT  DOT  AT yahoo DOT com> wrote in message
>
> > >news:39cdc18e-eccb-4213-b896-db3be020702e AT w9g2000prg DOT googlegroups DOT com.=
..
>
> > > >.
> > > > I am doing an int 21h function 7303h disk free space call, and I ne=
ed
> > > > to pass a structure to this function and when the function finishes=
,
> > > > it returns a similar structure back, but with different data filled
> > > > in.
> > > > [...]
>
> > > > the addresses of the structures in real mode memory in question are=
 in
> > > > segment offset format coming from and going into int21h function 73=
03h
> > > > (a DOS FAT32 function) at es:di and I need a C string at ds:dx, and=
 I
> > > > need to get at whatever is coming back from es:di.
>
> > > > any detailed clues/code as to how I should deal with that?
>
> > that doesn't actually tell me how to to get a random memory location
> > value back from int21h in ES:DI and the structure is passed back in
> > that. =A0the code is not working. =A0I get garbage.
>
> > the code you showed me simply passes ES:DI to the function and the
> > same ES:DI buffer is passed back. =A0nothing useful there. =A0in 7303h,
> > the function returns new information. =A0big problem. =A0no code exampl=
es
> > from djgpp!
>
> I think you will find what you need in the venerable DJGPP FAQ list.
>
> http://www.delorie.com/djgpp/v2faq/faq18_4.htmltells you how to copy
> data from your program to conventional memory, where Int 21h can get
> at it.
>
> http://www.delorie.com/djgpp/v2faq/faq18_5.htmltells you how to move
> data from a structure filled by Int 21h, and shows an example.
>
> In a nutshell, you will need:
>
> =A0. Define a struct according to the expectations of 217303, and use
> =A0 =A0__attribute__((packed)) on its members, see faq18_5.html.
>
> =A0. Copy the drive string ("C:\\" etc.) into the transfer buffer using
> =A0 =A0dosmemput and __tb, see faq18_4.html.
>
> =A0 . Put the segment and offset of the transfer buffer into DS:DX using
> =A0 =A0 __dpmi_regs and __tb. =A0See also faq18_3.html.
>
> =A0 . Put into ES:DI the segment and offset of the address in the
> =A0 =A0 transfer buffer that is after the end of the drive string. =A0Aga=
in,
> =A0 =A0 use __dpmi_regs.
>
> =A0 . Call __dpmi_int.
>
> =A0 . Copy the information from the transfer buffer to the struct you
> =A0 =A0 defined above, starting at the address you put into ES:DI, using
> =A0 =A0 dosmemget. =A0See faq18_5.html.
>
> That's it!

I tried this, and I got 0 for a structure size back.

#if defined(__DJGPP__)
#define HANDLE_PRAGMA_PACK_PUSH_POP 1
#pragma pack(push,1)

typedef struct extFAT32FreeSpaceStructure {
/* 00h	WORD*/uint16_t	ret_size_of_returned_structure;
/* 02h	WORD*/uint16_t
call_structure_version_ret_actual_structure_version;// (0000h)
/* 04h	DWORD*/uint32_t
number_of_sectors_per_cluster_with_adjustment_for_compression;
/* 08h	DWORD*/uint32_t	number_of_bytes_per_sector;
/* 0Ch	DWORD*/uint32_t	number_of_available_clusters;
/* 10h	DWORD*/uint32_t	total_number_of_clusters_on_the_drive;
/* 14h	DWORD*/uint32_t
number_of_physical_sectors_available_on_the_drive_without_adjustment_for_co=
mpression;
/* 18h	DWORD*/uint32_t
total_number_of_physical_sectors_on_the_drive_without_adjustment_for_compre=
ssion;
/* 1Ch	DWORD*/uint32_t
number_of_available_allocation_units_without_adjustment_for_compression;
/* 20h	DWORD*/uint32_t
total_allocation_units_without_adjustment_for_compression;
/* 24h  8 BYTEs*/uint64_t	reserved;
uint32_t wastedspace;
} extFAT32FreeSpaceStructure;

#pragma pack(pop)

#endif




#define STR_OFS 0x30
#define STRUCT_OFS 0x0
                  unsigned long adr=3Dr.x.es;
                    adr<<=3D4;
                    adr +=3D r.x.di;
                    dosmemget(__tb+STRUCT_OFS+adr,
sizeof(extFAT32FreeSpaceStructure), pds);

I also tried dosmemget without adr and I got 29997 or something like
that, some huge number for the structure size, totally inappropriate.
so I know I am getting incorrect results.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019