home *** CD-ROM | disk | FTP | other *** search
/ Cracking 2 / Cracking II..iso / Tools / icedump 6.018 and nticedump 1.9 / iceload.txt < prev    next >
Encoding:
Text File  |  2000-05-03  |  3.2 KB  |  74 lines

  1.  
  2.  
  3.    intro.
  4.  
  5.    while i was looking into the 'non executable first section' problem i came
  6.    to realize that it would take relatively little code to write a loader32
  7.    replacement, what's more, i could add DLL support as well (the lack of
  8.    which is so much annoying for us ;-). so iceload was born and with a little
  9.    tweaking over a few days me, G-RoM and muffin are happy to present you the
  10.    result.
  11.    
  12.  
  13.    usage.
  14.  
  15.       iceload [[-r]|[-n] file.dll]
  16.       iceload [file.exe]
  17.  
  18.    file.*: may specify path BUT should use SHORT names, or at least not contain
  19.            spaces (our command line parser is less than decent ;-)
  20.  
  21.    -r:     forces the DLL to relocate (or not load if it cannot due to missing
  22.            relocations)
  23.  
  24.    -n:     notifies SoftICE about the DLL but will not load it, instead you
  25.            should start up the target application which uses the DLL. this
  26.            switch obviously cannot be used with -r.
  27.  
  28.    executing iceload without any parameters will start up its GUI which should
  29.    be intuitive enough (watch the tooltips, courtesy of muffin ;-). SoftICE is
  30.    automatically notified about the selected file, but it is not loaded (.dll)
  31.    (as if the -n switch had been specified) or executed (.exe) immediately,
  32.    use the 'Load/Run' icon for that. the GUI also lets you load exports from
  33.    a DLL and save the SoftICE history buffer.
  34.  
  35.    keyboard accelerators (thanks to the rain for the idea):
  36.  
  37.       CTRL+O = Open PE
  38.       CTRL+X = Exit
  39.       CTRL+R = Run
  40.       CTRL+L = Load exports
  41.       CTRL+S = Save SI history
  42.       CTRL+A = About
  43.  
  44.  
  45.    technotes.
  46.  
  47.    this section explains how the whole thing works, might be of some interest
  48.    to some people after all.
  49.  
  50.    nmtrans.NmSymLoadExecutableEx is the main function responsible for telling
  51.    SoftICE where to put a breakpoint in a given module. it further calls down
  52.    to nmtrans.NmSymGetModuleLoadRecord which among other things will decide
  53.    what sort of module the user managed to select (can be various executable
  54.    formats, symbol files, etc). as you can guess, a PE exe has a different ID
  55.    than a DLL.
  56.  
  57.    next it calls nmtrans.NmSymIsModuleLoadable to figure out if SoftICE should
  58.    be told about this module or not. guess what, a DLL is explicitly declared
  59.    as non-loadable (although technically it is) and thus loader32/nmtrans will
  60.    not even try to notify SoftICE.
  61.  
  62.    what's more, when nmtrans.NmSymLoadExecutableEx notifies SoftICE via
  63.    nmtrans.DevIO_SetWLDRBreak (which in turn uses DeviceIoControl) and submits
  64.    information about the module, it sends a flag which tells SoftICE whether
  65.    the module is a PE exe or not (based on the type ID and not on what
  66.    nmtrans.NmSymIsModuleLoadable said). as you might guess it, SoftICE sets
  67.    a breakpoint on the entry point only if that flag is set...
  68.  
  69.    so to solve the problem we simply call nmtrans.NmSymGetModuleLoadRecord
  70.    and then nmtrans.DevIO_SetWLDRBreak ourselves with that flag set. these
  71.    two APIs are the sole reason for requiring nmtrans.dll and could have
  72.    been replaced with handcoded versions, but development time over file
  73.    size takes priority for such little gizmos ;-)
  74.