Menu

#9 Terminal / RDP compliance

open
nobody
None
5
2013-01-28
2011-07-22
Ran Sasson
No

Hello Lorenzo ,
I'd like to ask you please , if you could manage to make the popup window come up in the right session (not only the console) ?
In http://sourceforge.net/projects/wphfforwin7/ they managed to do it , but that software is not suited for user level config or distribution.
Thank you for this good piece of software,
Ran

Discussion

  • Ran Sasson

    Ran Sasson - 2011-07-22

    Actually, after rechecking, I'm not so sure it's done right on http://sourceforge.net/projects/wphfforwin7/

     
  • CBWhiz

    CBWhiz - 2011-11-21

    It is not done right on that project.
    http://wphfforwin7.hg.sourceforge.net/hgweb/wphfforwin7/wphfforwin7/file/220d9d4bb42f/HylaPrint/ipc.cpp

    That project uses the first active TS session.

    The correct thing to do is to capture the username in StartDocPort and then enumerate active sessions with that username.

    This will still fail in the case of multiple active sessions with the same username, but at least it would be a working solution.

     
  • Lorenzo Monti

    Lorenzo Monti - 2011-11-23

    0.3.5 is RDP compliant.
    following cbwhiz's suggestion.
    please give it a try and report any issues --

     
  • CBWhiz

    CBWhiz - 2011-11-23

    Nice work, I see you fixed a bunch of the TODO comments like the unique pipe name.

    I haven't tested it out yet, but the source looks good.

    Why aren't you using sourceforge's SVN for releases?

     
  • Ran Sasson

    Ran Sasson - 2011-11-23

    Thank You !
    I've tested it with TS 2008 and it works fine.

    Still haven't tested it with multiple concurrent sessions of the same user.
    I'll update about that.

    I'll also add my method of domain distribution using GPO (at the Help Forum tab)

    Thanks again & best regards,
    Ran

     
  • CBWhiz

    CBWhiz - 2011-11-23

    Ah, I've hit a snag.
    I'm using a TS server joined to an AD domain, lets call them TS and AD.
    I log in as the user 'AD\CBWhiz' and try to print.

    The code tries to FindSessionId, but the machineName of the print job is 'TS', and the domainName of the user is 'AD', this no sid is found.

    Specifically, I need to remove this line:
    _wcsicmp(lpSessDomain, szDomain) == 0

    I don't see any way of getting the domain name of the user from the print job unfortunately.

    Any ideas?

     
  • Lorenzo Monti

    Lorenzo Monti - 2011-11-24

    hi folks --
    cbwhiz you are absolutely correct LoL I was comparing domain and machine names. I removed the test.
    as per the "multiple user sessions" issue: one possible (dirty) solution is to instrument the StartDocPrinter function with a system-wide hook. every process that wants to start a print job has to call this function. so: we hook the real function, collect its return value (the job id) along with the session ID (we can do this because we're still at the user's level) and store this information somewhere.
    once we're in the spooler, we lookup the job ID, and get back the session ID that we collected previously.
    unfortunately there are two major drawbacks: (1) using MS detours or something similar to instrument a system API looks more of a hack (2) MS detours is 32 bit only, unless one has $10K. I don't know of another library that does the same and has 64 bit support --
    anyway I DON'T like this approach -- any other idea?
    BTW - I uploaded the whole source tree to SVN. I'll be glad to join developers to this project.
    thank you all guys!
    - L -

     
  • Ran Sasson

    Ran Sasson - 2011-11-24

    any compiled version ready for testing the TS version ?

     
  • Lorenzo Monti

    Lorenzo Monti - 2011-11-24

    install version 0.3.5 --
    then go to SVN http://wphf-reloaded.svn.sourceforge.net/viewvc/wphf-reloaded/
    get wphfmon.dll and wphfmonUI.dll from win32 or x64 subfolder (whichever applies to you)
    get the release version
    stop the spooler
    put the dlls you got in %SYSTEMROOT%\System32
    start the spooler

    I was thinking about releasing 0.3.6 immediately because of the bug reported by cbwhiz -
    but maybe we can carry out some more tests before -

     
  • Ran Sasson

    Ran Sasson - 2011-11-24

    OK . Testing on 3 machines of TS 2008 (not R2).
    installed using the TS installer .
    configuration done using the GPO (see help forum)
    multiple users is working fine.

    multiple ACTIVE sessions of the same users - the print window pops up on the first ACTIVE user session.

    Good work !

     
  • CBWhiz

    CBWhiz - 2011-11-28

    Alright, this pretty much works the best that we can do using documented APIs I think.

    As you said, we could use a global hook on StartDocPrinter, but that is nasty indeed :).

    If we choose to go that route, we should make it a configuration option. Are you sure we're in the user's session when that call is made? I don't know about that.

    Anyway, i've written an (unreleased) detour API for 32 bit only. It's a bit rough around the edges, but all i'd need to do to get it working for x64 is a bit of assembler work.

    You can add me to the project if you want, though from what i've seen your coding style is a bit 'stricter' than mine :). Not sure if you want me to have direct commit access.

    I'll probably be lazily maintaining my patched version at github unless I can get all my changes merged back in here (see other tickets).

     

Log in to post a comment.

Auth0 Logo