Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

Discovered a NEW BUG in DPMILD32 (DOSX)

posted by DOS386(R), 18.12.2009, 03:21


  if ?DPMI10
                test    cs:bEnvFlgs,ENVFL_DONTUSEDPMI1
                jnz     UseStdAlloc
;---------------------- some apps have to be loaded at their ImageBase
;---------------------- although relocs are NOT stripped!


Excellent "design" :-(


                test    [edx.IMAGE_NT_HEADERS.FileHeader.Characteristics],IMAGE_FILE_DLL
                jz              @F
;---------------------- for dlls dont use the prefered load address unless
;---------------------- relocs are stripped or DPMILDR=1024 is set
                test    cs:bEnvFlgs2, ENVFL2_USEPREFADDR
                jnz     @F
                test    [edx.IMAGE_NT_HEADERS.FileHeader.Characteristics],IMAGE_FILE_RELOCS_STRIPPED
                jz              UseStdAlloc
@@:
                mov     ebx, [edx.IMAGE_NT_HEADERS.OptionalHeader.ImageBase]
                mov     ecx, eax
                mov     edx, 1
                push    eax
                mov     ax, 0504h
                int     31h
                pop     eax
                jc              UseStdAlloc
                mov     xmemhdl, esi
                mov     edi, ebx
                jmp     allocok
UseStdAlloc:
  endif


test edx.IMAGE_NT_HEADERS.FileHeader.Characteristics],IMAGE_FILE_RELOCS_STRIPPED

is faulty, this bit is "not used" in PE. PE loaders in both ME and XP don't look at this bit, they check the directory instead.

So the correct way would be:

1. Peek both directory entries
2. If both are ZERO, assume "IMAGE_FILE_RELOCS_STRIPPED"
3. If RVA is valid and (size is >=8 and divisible by 4), assume "relox are avaiable"
4. Otherwise give up "broken relox, can't load"

---
This is a LOGITECH mouse driver, but some software expect here
the following string:*** This is Copyright 1983 Microsoft ***

 

Complete thread:

Back to the forum
Board view  Mix view
15187 Postings in 1365 Threads, 250 registered users, 15 users online (1 registered, 14 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum