Ant,
> Yep. I stepped through EnumProcessModules on a new suspended
> process and indeed the PEB_LDR_DATA structure is null. In my
> version of psapi.dll it actually tries to use that null pointer + the
> small
> offset to InMemoryOrderModuleList so fails anyway!
Wowsers. I guess that means we should consider ourselves lucky that trying
to use EnumProcessModules on a suspended-created process does not simply
crash ...
> Doing certain things seem to force further initialisation.
Yep, seems it to be doing that. I experimented a bit, and calling a Sleep
for a single tick caused the same effect. Now if I want to do some IAT
patching (for which I was actually doing all the testing-and-trying to be
honest) I do not need to write my own IAT resolver/DLL loader (with all the
dependencies ofcourse) (something I was already considering :-) )
But I wonder if MS tried to do some kind of injection themselves long ago,
and went for a hack instead of actually trying to solving the problem --
maybe having added a flag to CreateProcess which would indicate a request
for IAT resolving, and thus DLL loading.
>> Yep, MS on its best I guess. :-)
>
> Not very good, is it?!
Well, Windows is a *big* program, and several version are encumbered with
lots of backward compatibility, possibly making it impossible to apply the
*best* solution, or see lots of older programs crash-and-burn.
But yes, I sometimes get the feeling they aren't all that good ... :-( :-)
Shortly ago I asked a question about how I could check if a filepath was
actually pointing to a file (and not to a device, pipe, and all sorts of
other stuff). When doing testing I fould that calling GetFileAttributes
on a named pipe caused the server-sides ConnectedNamedPipe to actually
respond as if a connection was requested. Not quite expected.
A question though: which program do you use to track-and-trace/single-step
Windows programs ? I never had much use for them, but in cases like these
(working with a static program/setup I mean) such a tool does seems to be
handy to have.
Regards,
Rudy Wieser
-- Origional message:
"Ant" <n...@home.today> wrote in message news:oq8gd0$184e$1...@gioia.aioe.org...