Mail Archives: djgpp/2011/03/15/02:48:27
> From: Jim Michaels <jmichae3 AT yahoo DOT com>
> 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? Or somewhere
else?
Did you check the Carry flag after __dpmi_int returns? If the CF is
set, it means the interrupt failed, and the AX register will contain
the error code. Did you check that?
> #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_compression;
> /* 18h DWORD*/uint32_t total_number_of_physical_sectors_on_the_drive_without_adjustment_for_compression;
> /* 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=r.x.es;
> adr<<=4;
> adr += r.x.di;
> dosmemget(__tb+STRUCT_OFS+adr, sizeof(extFAT32FreeSpaceStructure), pds);
What is `pds' here? Please show complete code, not fragments that
omit crucial details.
And why do you include the `wastedspace' member in the struct? It is
not part of the structure, according to RBIL.
Also, what does `sizeof(extFAT32FreeSpaceStructure)' return? It
should be 32; if not, you should look for a bug.
Anyway, your use of dosmemget is incorrect. According to the
dosmemget documentation, ES:DI is not an offset into the transfer
buffer, it's the real-time SEG:OFF address itself. So you should do
this:
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. Per 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.
- Raw text -