Topic
  • 3 replies
  • Latest Post - ‏2011-09-20T18:46:19Z by SystemAdmin
JerryCallen
JerryCallen
9 Posts

Pinned topic Is "/replace=yes" supposed to work with DLLs?

‏2011-09-20T17:01:16Z |
I have an application that does all of its important work by loading and running one of a number of DLLs. The application actually creates a new process, and that new process then loads and runs the DLL, so I'm pre-instrumenting just the DLLs so that the program that starts the DLL loader can be unmodified.

My command line for doing the instrumentation looks like this:

quantify
/RunTimeDataBase=0x20510000 /RunTimeDataSize=0xfc50000
/SelectiveInstrumentation /run=no /replace=yes
C:\svn\trunk\install\lib\transform.dll

After I run this, the target directory (C:\svn\trunk\install\lib) contains:

EngineCmdLine.log
transform.dll
transform.dll.Original
transform.dll.QSel
transform_pure.tmp

However, transform.dll is still the original DLL; it hasn't been replaced. If I manually delete transform.dll and rename transform.dll.QSel to transform.dll, Quantify runs fine and does what I want it to do, but I'd like to avoid this manual step.

Am I using /replace wrong? Is /replace supposed to work on DLLs as well as executables?
Updated on 2011-09-20T18:46:19Z at 2011-09-20T18:46:19Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    2948 Posts

    Re: Is "/replace=yes" supposed to work with DLLs?

    ‏2011-09-20T17:12:26Z  
    Hi Jerry,

    >
    > If I manually delete transform.dll and rename transform.dll.QSel to transform.dll,
    > Quantify runs fine and does what I want it to do, but I'd like to avoid this manual
    > step. Am I using /replace wrong? Is /replace supposed to work on DLLs as well as
    > executables?
    >

    You're doing everything correctly, but you're also using "Selective Instrumentation"
    which makes it a little bit trickier. In the "Module Instrumentation" window, you
    have listed a number of modules which need to be instrumented, but you probably used
    the TRANSIENT option instead of the PERMANENT option because that was the default.
    The TRANSIENT option attempts to do some renaming and swapping of modules before and
    after every run. (That's why the original DLL is never actually replaced.) If you
    use the PERMANENT option instead, I believe the original modules will get replaced as
    you want.

    Please give that a try.
    Don
  • JerryCallen
    JerryCallen
    9 Posts

    Re: Is "/replace=yes" supposed to work with DLLs?

    ‏2011-09-20T18:15:03Z  
    Hi Jerry,

    >
    > If I manually delete transform.dll and rename transform.dll.QSel to transform.dll,
    > Quantify runs fine and does what I want it to do, but I'd like to avoid this manual
    > step. Am I using /replace wrong? Is /replace supposed to work on DLLs as well as
    > executables?
    >

    You're doing everything correctly, but you're also using "Selective Instrumentation"
    which makes it a little bit trickier. In the "Module Instrumentation" window, you
    have listed a number of modules which need to be instrumented, but you probably used
    the TRANSIENT option instead of the PERMANENT option because that was the default.
    The TRANSIENT option attempts to do some renaming and swapping of modules before and
    after every run. (That's why the original DLL is never actually replaced.) If you
    use the PERMANENT option instead, I believe the original modules will get replaced as
    you want.

    Please give that a try.
    Don
    I'm actually doing all this from the command line; I'm not using the GUI (I need to eventually have all this stuff scriptable, so it can be integrated into the build process).

    I tried doing this:

    quantify
    /RunTimeDataBase=0x20510000 /RunTimeDataSize=0xfc50000
    /SelectiveInstrumentation
    /SelectedModuleList=transform.dll,P,L;
    /run=no /replace=yes
    C:\svn\trunk\install\lib\transform.dll

    It still didn't do the rename. I tried putting the full path in the command line:

    quantify
    /RunTimeDataBase=0x20510000 /RunTimeDataSize=0xfc50000
    /SelectiveInstrumentation
    /SelectedModuleList=C:\svn\trunk\install\lib\transform.dll,P,L;
    /run=no /replace=yes
    C:\svn\trunk\install\lib\transform.dll

    and that didn't work, either.

    It's not the end of the world if I can't get this working; I can make the renaming part of the script.
  • SystemAdmin
    SystemAdmin
    2948 Posts

    Re: Is "/replace=yes" supposed to work with DLLs?

    ‏2011-09-20T18:46:19Z  
    I'm actually doing all this from the command line; I'm not using the GUI (I need to eventually have all this stuff scriptable, so it can be integrated into the build process).

    I tried doing this:

    quantify
    /RunTimeDataBase=0x20510000 /RunTimeDataSize=0xfc50000
    /SelectiveInstrumentation
    /SelectedModuleList=transform.dll,P,L;
    /run=no /replace=yes
    C:\svn\trunk\install\lib\transform.dll

    It still didn't do the rename. I tried putting the full path in the command line:

    quantify
    /RunTimeDataBase=0x20510000 /RunTimeDataSize=0xfc50000
    /SelectiveInstrumentation
    /SelectedModuleList=C:\svn\trunk\install\lib\transform.dll,P,L;
    /run=no /replace=yes
    C:\svn\trunk\install\lib\transform.dll

    and that didn't work, either.

    It's not the end of the world if I can't get this working; I can make the renaming part of the script.
    Hi Jerry,

    I think this might be a case where your command line just contains too much info.
    To replace transform.dll with a Quantify'd version of the DLL, just do:

    DOS> quantify /run=no /replace=yes C:\svn\trunk\install\lib\transform.dll

    Now, when you actually RUN the executable, you can do:

    DOS> quantify
    /RunTimeDataBase=0x20510000 /RunTimeDataSize=0xfc50000
    /SelectiveInstrumentation
    /SelectedModuleList=transform.dll,P,L;
    <executable name>

    Please give that a try and let me know how it goes.
    Don