1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Not exactly a plugin

Discussion in 'Plugins' started by vefatica, Aug 6, 2009.

  1. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,952
    Likes Received:
    30
    For a long time I have used a SHRALIAS.DLL which is loaded by PowerPro (via my logon script).

    Recently I wrote an INJECTDLL.EXE which will cause any process (except the kernel) to load a specified DLL. In the process of doing that, I discovered (or at least was told) that it's safe to CreateThread() in DllMain (since the thread's entry point won't be called until DLL initialization is finished).

    So, in principle, I could re-write SHRALIAS.DLL to work when loaded by any process. The ideal process would be Explorer since it's running at logon and stays running for the entire session. So a logon script could load all the shralias-protected lists and then inject SHRALIAS.DLL into Explorer.

    Would anyone be interested in this?

    At the moment there's no facility for unloading the DLL (and there might not be for a while.

    Also, my SHRALIAS.DLL contains a (global) hotkey server and I have an external SHRHOTKEY.EXE to interface with it (some details below). Is anyone interested in that?

    Code:
    v:\> shrhotkey /?
    Usage:  SHRHOTKEY [[Alt-][Ctrl-][Shift-][Win-]]<key> [<command> <directory>]
    
            Omit <command> and <directory> to remove a hotkey.
    
            <command> may be "**sendkeys**" with <directory> an arbitrary string
    
            SHRHOTKEY list (show hot keys)
    
        Unnamed keys: A-Z, a-z, 0-9, <space>, non-alphanumeric characters
    
        Named keys (case-insensitive):
    
            F1      F8      Left    Prior   BS      Enter   KP4     KP+
            F2      F9      Right   Next    Back    Return  KP5     KP-
            F3      F10     Home    Insert  Scroll  KP0     KP6     KP*
            F4      F11     End     Delete  Pause   KP1     KP7     KP/
            F5      F12     PgUp    Ins     Esc     KP2     KP8     KP.
            F6      Up      PgDn    Del     Screen  KP3     KP9     NumLock
            F7      Down    Tab     Space
    
    v:\> shrhotkey list
    
    Key: CTRL-ALT-F4
    Command: d:\uty\monitor0.exe
    Directory: d:\uty
    
    Key: F9
    Command: d:\uty\toggletcc.exe d:\tcmd10\tcc.exe
    Directory: v:\
    </space></directory></command></directory></command></directory></command></key>
     
  2. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    vefatica wrote:
    | For a long time I have used a SHRALIAS.DLL which is loaded by
    | PowerPro (via my logon script).
    |
    | Recently I wrote an INJECTDLL.EXE which will cause any process
    | (except the kernel) to load a specified DLL. In the process of
    | doing that, I discovered (or at least was told) that it's safe to
    | CreateThread() in DllMain (since the thread's entry point won't be
    | called until DLL initialization is finished).
    |
    | So, in principle, I could re-write SHRALIAS.DLL to work when loaded
    | by any process. The ideal process would be Explorer since it's
    | running at logon and stays running for the entire session. So a
    | logon script could load all the shralias-protected lists and then
    | inject SHRALIAS.DLL into Explorer.

    I presume the SHRALIAS.DLL is equivalent to SHRALIAS.EXE (or may even
    be part of it). I use your SHRALIAS.EXE version which on unloading
    automatically saves the global tables in ASCII files. I load it
    during login by a transient TCC session. Being able to load it
    without the transient session, esp. if it could create global tables
    shared by all users (because it is loaded before login?), would be of
    interest.

    |
    | Would anyone be interested in this?
    |
    | At the moment there's no facility for unloading the DLL (and there
    | might not be for a while.

    Major issue!

    | Also, my SHRALIAS.DLL contains a (global) hotkey server and I have
    | an external SHRHOTKEY.EXE to interface with it (some details below).
    | Is anyone interested in that?

    How does this method of hotkey definition differ from hotkeys on
    desktop icons? By not needing a desktop icon?
    --
    Steve
     
  3. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,952
    Likes Received:
    30
    Without the hotkey business SHRALIAS.DLL is equivalent to SHRALIAS.EXE. The EXE is Rex's; it doesn't use my DLL.

    I suppose I'd have to make a special, ASCII, one for you. :-)

    The global lists which SHRALIAS protects are user-particular; they can't be shared by different users. And only a Windows service could provide that functionality anyway. Writing a SHRALIAS service would be a tad difficult. I'm not going to do it. I suspect most **wouldn't** want those lists shared among users.

    SHRALIAS has always been 24/7 for me. While I have a PowerPro script to unload it, I have never done so in the 5-6 years PPro has been loading SHRALIAS.DLL. So the lack of that functionality means nothing to me.

    If you've injected a DLL into another process, there's no easy way to get the process to unload it. But I could write a little external (none too soon) to communicate with SHRALIAS.DLL and tell it to stop(/start) acting like SHRALIAS.

    As for hotkeys, I imagine not needing a shortcut is the fundamental difference. I suppose Explorer, like my SHRALIAS, ultimately uses RegisterHotKey(). Explorer probably scans the desktop shortcuts initially and then makes changes as the user changes desktop shortcuts. My SHRALIAS loads initial ones from a file and makes changes according to user input from SHRHOTKEY.EXE.

    FWIW, the whole thing works. I modified the DLL just a little, stopped telling PowerPro to load it, and put a single line in my logon script:

    Code:
    d:\uty\injectdll.exe %@pid[explorer.exe] d:\tcmd10\shralias.dll
    It worked the first time (I like it when that happens).
     
  4. samintz

    samintz Scott Mintz

    Joined:
    May 20, 2008
    Messages:
    1,190
    Likes Received:
    11
    What's the advantage of this vs. a dedicated SHRALIAS.EXE process that
    does the same thing? Personally, I would prefer the dedicated process so
    that I can see it when I run ProcessExplorer. An injected DLL is
    essentially hidden (and virus like).

    -Scott

    vefatica <> wrote on 08/06/2009 08:21:12 PM:


    <directory>]

    string

    </space></directory></command></directory></command></directory></command></key>
     
  5. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,952
    Likes Received:
    30
    On Fri, 07 Aug 2009 14:48:22 -0500, samintz <> wrote:

    |What's the advantage of this vs. a dedicated SHRALIAS.EXE process that
    |does the same thing? Personally, I would prefer the dedicated process so
    |that I can see it when I run ProcessExplorer. An injected DLL is
    |essentially hidden (and virus like).

    I'm exactly the opposite. I don't like lots of processes running. Besides that
    personal preference there's little practical difference.

    With ProcessExplorer I can see that Explorer has handles to the likes of
    "\BaseNamedObjects\SharememUAliasvefatica". With Depends.exe (or ListDlls.exe)
    I can see that Explorer has loaded my DLL. It's only hidden in that it doesn't
    appear as a process.
    --
    - Vince
     

Share This Page