Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

1. Closed: NOT a BUG | 2. Closed: NOT a BUG | 3. Closed: NB (DOSX)

posted by Japheth Homepage, Germany (South), 19.06.2008, 10:29

> > dpmild32 doesn't care about the PE "readable" bit (IMAGE_SCN_MEM_READ)
> at all
>
> COOL ... but what does this code do ?
>
> ; PELOAD.ASM
>
> ;*** support for PE-files ***
> ;*** 32-Bit DPMI clients only ***
>
> ?SKIPCOMMENTS   equ 1   ;std=1, 1=skip sections not marked as r/w/e
>
> if ?SKIPCOMMENTS
> test byte ptr [edi].IMAGE_SECTION_HEADER.Characteristics+3, 0E0h ;is is
> read/write/exec?
> jz   @F  ; FAR FAR FAR below
> endif       
> ;-------------------------------------------- section size into ecx
> call    getsectionsize       
>
> shr     ecx, 2
> push    edi
> mov     edi,[edi].IMAGE_SECTION_HEADER.VirtualAddress
> lea     edi,[edi + esi - sizeof MZHDR]
> mov     edx,edi
> xor     eax, eax
> rep     stos dword ptr [edi]
> pop     edi

>
> Maybe it skips my evil non-readable section ? :clap:

Yes.

> IMHO the "?SKIPCOMMENTS" "feature" should get deleted, or moved after the
> clearing at least.

Or just set this boring "readable" bit in your app ...

> One more good idea would be in DPMILD32 to check the page block fixup
> sizes for:
> - >=8
> and
> - divisibility by 4
> Because a value <8 or not divisible by 4 is obviously evil :surprised: ->
> whine ("Can't load, fixups broken" or so) -> file is missbrewed,
> misslinked, corrupted, crosslinked, etc. BTW, the "PE" thingie has the
> very same bug: it crashes if the size is ZERO :-|

Ok, might be considered...

> This actually brings us to the next severe bug: memory clearing.
> DKRNL seems to correctly clear all allocated memory, also DPMILD32 clears
> __some__ sections (see above), however, besides sections affected by the
> "?SKIPCOMMENTS" "feature", it doesn't clear the stack, while Windaube
> seems to do this job - "almost" :-|

> - Always clear the stack after allocating it or before starting the
> application

I'm not sure if this is a good idea. If helps with buggy applications only, which fully deserve to crash and die.

---
MS-DOS forever!

 

Complete thread:

Back to the forum
Board view  Mix view
22049 Postings in 2034 Threads, 396 registered users, 275 users online (0 registered, 275 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum