X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: "Rod Pemberton" Newsgroups: comp.os.msdos.djgpp Subject: Re: csdpmi7 not working on virtualbox, how use dosmemget with seg ofs from int21h? Date: Wed, 16 Mar 2011 14:09:05 -0400 Organization: Aioe.org NNTP Server Lines: 151 Message-ID: References: <39cdc18e-eccb-4213-b896-db3be020702e AT w9g2000prg DOT googlegroups DOT com> <3e035797-6b8e-4106-bd29-98e87a9cc121 AT a21g2000prj DOT googlegroups DOT com> NNTP-Posting-Host: sg0uvLzlDfZOqmCSVnJXCA.user.speranza.aioe.org X-Complaints-To: abuse AT aioe DOT org X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.2001 X-Notice: Filtered by postfilter v. 0.8.2 X-Newsreader: Microsoft Outlook Express 6.00.2800.2001 X-Priority: 3 X-MSMail-Priority: Normal Bytes: 6468 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com "Jim Michaels" wrote in message news:f1bda3ea-6f2b-4e52-9378-85dd56198198 AT i39g2000prd DOT googlegroups DOT com... > On Mar 14, 4:19 am, Eli Zaretskii wrote: > > > From: Jim Michaels > > > On Mar 3, 2:31 am, "Rod Pemberton" > > > > "Jim Michaels" wrote in message > > > > > > the addresses of the structures in real mode memory in question > > > > > are in segment offset format coming from and going into int21h > > > > > function 7303h (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. the code is not working. I get garbage. > > > > the code you showed me simply passes ES:DI to the function and the > > > same ES:DI buffer is passed back. nothing useful there. in 7303h, > > > the function returns new information. big problem. no code examples > > > from djgpp! > > > [please follow] > > > That's it! > > I don't take to hand-waving. I need concrete examples. code it. > Eli told you. I told you. Jason told you. I've posted code below. Typically, people do not like requests of them to code stuff for you. However, it sounds like maybe you're dealing with an DOS that's not 100% compatible, and so cannot determine if the code you're coding is correct. Either that, or you're not understanding something we've said. So, I'll do what I told you to do for converting my lfn_71A0() routine to 7303h. Here's my code, after my .sig, which is *tested* and *working*. FYI, dosmemput() copies more characters than passed. You can fix it. That could be considered an error or poor programming, for a few reasons: fixed size, too much, or not enough depending on the length of the path string. I pasted in the non-typedef version of your struct, with a correction for my mistake on the reserved array element. I then changed the other stuff I said to change. Very simple. Some lines have wrapped. You'll have to fix them. This is due to the long names you used in the struct. Each printf() should be a complete line and each uint type in the struct should be a complete line. A space is "cut" due to the wrapping in the printf() strings prior to the size specification. The code is DJGPP only. HTH, Rod Pemberton /* gcc -Wall -pedantic -O2 -o jm.exe jm.c */ /* DO NOT use -ansi flag. DJGPP and DOS specific code. */ #include #include #include #include #include #include __dpmi_regs r; #define HANDLE_PRAGMA_PACK_PUSH_POP 1 #pragma pack(push,1) struct { uint16_t ret_size_of_returned_structure; uint16_t call_structure_version_ret_actual_structure_version; uint32_t number_of_sectors_per_cluster_with_adjustment_for_compression; uint32_t number_of_bytes_per_sector; uint32_t number_of_available_clusters; uint32_t total_number_of_clusters_on_the_drive; uint32_t number_of_physical_sectors_available_on_the_drive_without_adjustment_for_com pression; uint32_t total_number_of_physical_sectors_on_the_drive_without_adjustment_for_compres sion; uint32_t number_of_available_allocation_units_without_adjustment_for_compression; uint32_t total_allocation_units_without_adjustment_for_compression; uint8_t reserved[8]; } extFAT32FreeSpaceStructure; #pragma pack(pop) #define OFFS 261 #define BUFL 44 int lfn_7303(char *mpath) { dosmemput(mpath, 32, __tb); r.x.ax = 0x7303; r.x.ds = __tb_segment; r.x.dx = __tb_offset; r.x.es = r.x.ds; r.x.di = r.x.dx+OFFS; r.x.cx = BUFL; r.x.flags |= 1; __dpmi_int(0x21, &r); dosmemget(__tb+OFFS, BUFL, &extFAT32FreeSpaceStructure); if (r.x.flags & 1) return(1); return(0); } int main(void) { if(!lfn_7303("C:\\")) { printf("struct size %04hx\n",extFAT32FreeSpaceStructure.ret_size_of_returned_structure); printf("struct ver %04hx\n",extFAT32FreeSpaceStructure.call_structure_version_ret_actual_struct ure_version); printf("sec/clus %08lx\n",extFAT32FreeSpaceStructure.number_of_sectors_per_cluster_with_adjus tment_for_compression); printf("bytes/sec %08lx\n",extFAT32FreeSpaceStructure.number_of_bytes_per_sector); printf("avail clus %08lx\n",extFAT32FreeSpaceStructure.number_of_available_clusters); printf("total clus %08lx\n",extFAT32FreeSpaceStructure.total_number_of_clusters_on_the_drive); printf("avail sec %08lx\n",extFAT32FreeSpaceStructure.number_of_physical_sectors_available_on_ the_drive_without_adjustment_for_compression); printf("total sec %08lx\n",extFAT32FreeSpaceStructure.total_number_of_physical_sectors_on_the_ drive_without_adjustment_for_compression); printf("avail alloc %08lx\n",extFAT32FreeSpaceStructure.number_of_available_allocation_units_wit hout_adjustment_for_compression); printf("total alloc %08lx\n",extFAT32FreeSpaceStructure.total_allocation_units_without_adjustmen t_for_compression); } else printf("error\n"); return(0);