X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: Jim Michaels Newsgroups: comp.os.msdos.djgpp Subject: Re: csdpmi7 not working on virtualbox, how use dosmemget with seg ofs from int21h? Date: Tue, 15 Mar 2011 00:37:06 -0700 (PDT) Organization: http://groups.google.com Lines: 100 Message-ID: <42d13cb8-adf4-4a86-9cf2-012d0929fb4c@q40g2000prh.googlegroups.com> References: <39cdc18e-eccb-4213-b896-db3be020702e AT w9g2000prg DOT googlegroups DOT com> <3e035797-6b8e-4106-bd29-98e87a9cc121 AT a21g2000prj DOT googlegroups DOT com> <428d9bd6-efc5-4f66-bab3-961a0c4598f9 AT f31g2000pri DOT googlegroups DOT com> NNTP-Posting-Host: 24.21.90.47 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1300174626 25609 127.0.0.1 (15 Mar 2011 07:37:06 GMT) X-Complaints-To: groups-abuse AT google DOT com NNTP-Posting-Date: Tue, 15 Mar 2011 07:37:06 +0000 (UTC) Complaints-To: groups-abuse AT google DOT com Injection-Info: q40g2000prh.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: 5740 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com On Mar 14, 11:48=A0pm, Eli Zaretskii wrote: > > From: Jim Michaels > > Newsgroups: comp.os.msdos.djgpp > > Date: Mon, 14 Mar 2011 16:38:41 -0700 (PDT) > > > I tried this, and I got 0 for a structure size back. > > You mean in your ret_size_of_returned_structure member? =A0Or somewhere > else? > > Did you check the Carry flag after __dpmi_int returns? =A0If the CF is > set, it means the interrupt failed, and the AX register will contain > the error code. =A0Did you check that? > > > > > #if defined(__DJGPP__) > > #define HANDLE_PRAGMA_PACK_PUSH_POP 1 > > #pragma pack(push,1) > > > typedef struct extFAT32FreeSpaceStructure { > > /* 00h =A0 =A0 WORD*/uint16_t =A0ret_size_of_returned_structure; > > /* 02h =A0 =A0 WORD*/uint16_t =A0call_structure_version_ret_actual_stru= cture_version;// (0000h) > > /* 04h =A0 =A0 DWORD*/uint32_t number_of_sectors_per_cluster_with_adjus= tment_for_compression; > > /* 08h =A0 =A0 DWORD*/uint32_t number_of_bytes_per_sector; > > /* 0Ch =A0 =A0 DWORD*/uint32_t number_of_available_clusters; > > /* 10h =A0 =A0 DWORD*/uint32_t total_number_of_clusters_on_the_drive; > > /* 14h =A0 =A0 DWORD*/uint32_t number_of_physical_sectors_available_on_= the_drive_without_adjustment_for_compression; > > /* 18h =A0 =A0 DWORD*/uint32_t total_number_of_physical_sectors_on_the_= drive_without_adjustment_for_compression; > > /* 1Ch =A0 =A0 DWORD*/uint32_t number_of_available_allocation_units_wit= hout_adjustment_for_compression; > > /* 20h =A0 =A0 DWORD*/uint32_t total_allocation_units_without_adjustmen= t_for_compression; > > /* 24h =A08 BYTEs*/uint64_t =A0reserved; > > uint32_t wastedspace; > > } extFAT32FreeSpaceStructure; > > > #pragma pack(pop) > > > #endif > > > #define STR_OFS 0x30 > > #define STRUCT_OFS 0x0 > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 unsigned long adr=3Dr.x.es; > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 adr<<=3D4; > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 adr +=3D r.x.di; > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 dosmemget(__tb+STRUCT_OFS+adr, = sizeof(extFAT32FreeSpaceStructure), pds); > > What is `pds' here? =A0Please show complete code, not fragments that > omit crucial details. > > And why do you include the `wastedspace' member in the struct? =A0It is > not part of the structure, according to RBIL. > > Also, what does `sizeof(extFAT32FreeSpaceStructure)' return? =A0It > should be 32; if not, you should look for a bug. > > Anyway, your use of dosmemget is incorrect. =A0According to the > dosmemget documentation, ES:DI is not an offset into the transfer > buffer, it's the real-time SEG:OFF address itself. =A0So you should do > this: > > =A0 dosmemget(adr, sizeof(extFAT32FreeSpaceStructure), pds); > > (assuming `pds' is correct, and you remove `wastedspace' from the > structure, because it makes you fetch data beyond what DOS fills in). > > Or you could use __tb+STRUCT_OFS instead of `adr', because my reading > of RBIL is that DOS fills the buffer whose address you passed to it in > ES:DI when you called __dpmi_int. =A0Per the FAQ, you should have put > the segment and offset of __tb in ES:DI before invoking __dpmi_int, so > the buffer filled by DOS is in the transfer buffer, and __tb is its > address. doesn't work. I already check the carry flag, which If I am not mistaken is r.x.flags & 1. I am not a total idiot. every compiler wants things its own way (openwatcom is different). the reason why I padded the struct to size 0x30 was because some of the djgpp dos memory access functions require accessing memory in 16- byte chunks (0x10), or segment size chunks. I still get garbage whatever I try. I think I may have to take this problem to the freedos folks and see why 7303h doesn't seem to work on their OS when they are supposed to support it. I am still learning. but I need to get solid code so I can say to the freedos folk, "your OS is broken, here's how", or, I can have a working program that works on freedos which uses FAT32 and maybe windows 98. I am going to see what they say about this in the freedos forum. they got some kind of pc world code to work in freedos and give FAT32 results.