• WTSSendMessageA "access is denied"

    From T@21:1/5 to All on Fri Nov 18 22:56:15 2022
    Hi All,

    Windows Chromebook Edition (W11-Pro 22H2)

    https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtssendmessagea

    Rudy probably knows this one off the top of his head.

    I have a weird one trying to use WTSSendMessageA. It
    works perfectly from the command line as both
    user and Administrator.

    WTSSendMessageA(
    $Handle,
    $SessionId,
    $pTitle,
    $TitleLength,
    $pMessage,
    $MessageLength,
    $Style,
    $Timeout,
    $pResponse,
    $bWait );

    But when I try to run it from the Task Scheduler
    as Administrator, I get back: error 5 (GetLastError),
    "Access is Denied" (nf-winbase-formatmessagew)

    https://ibb.co/9nR9pcc

    And to add insult to injury, The pop up you see
    from ibb comes from a DLL a guy at M$ wrote me.
    And that one works in Task Scheduler. AAAAHHHHHH!!!!

    $Handle = WTS_CURRENT_SERVER_HANDLE;
    $bWait = 1;

    Yours in frustration,
    -T

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From R.Wieser@21:1/5 to All on Sat Nov 19 09:34:52 2022
    T,

    https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtssendmessagea

    Rudy probably knows this one off the top of his head.

    :-) Thanks for the confidence in me, but I'm afraid I know very little
    about RDP in general.

    But when I try to run it from the Task Scheduler
    as Administrator, I get back: error 5 (GetLastError),
    "Access is Denied" (nf-winbase-formatmessagew)
    ...
    And to add insult to injury, The pop up you see
    from ibb comes from a DLL a guy at M$ wrote me.
    And that one works in Task Scheduler. AAAAHHHHHH!!!!

    I read that as : I've got a program thats started by a remote task scheduler which tries to open a message box at my end and fails, but I do get a messagebox (showing the results of my failed attempt) when I use the M$ guys DLL for it."

    In that case my assumption is that that DLL does some more work than just calling WTSSendMessage. Perhaps wrapping the call in a creation and
    teardown of an actual RDP session (WTSVirtualChannelOpen and -close) ?

    That the program works when you start it directly could be because the environment for a program started thru the task scheduler is a bit different from when its started by you in person. It by default not being
    interactive is one of them.

    Hope that helps.

    Regards,
    Rudy Wieser

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From T@21:1/5 to R.Wieser on Sat Nov 19 00:56:23 2022
    On 11/19/22 00:34, R.Wieser wrote:
    T,

    https://learn.microsoft.com/en-us/windows/win32/api/wtsapi32/nf-wtsapi32-wtssendmessagea

    Rudy probably knows this one off the top of his head.

    :-) Thanks for the confidence in me, but I'm afraid I know very little
    about RDP in general.

    But, But, But, You know all and see all!!!!


    But when I try to run it from the Task Scheduler
    as Administrator, I get back: error 5 (GetLastError),
    "Access is Denied" (nf-winbase-formatmessagew)
    ...
    And to add insult to injury, The pop up you see
    from ibb comes from a DLL a guy at M$ wrote me.
    And that one works in Task Scheduler. AAAAHHHHHH!!!!

    I read that as : I've got a program thats started by a remote task scheduler which tries to open a message box at my end and fails, but I do get a messagebox (showing the results of my failed attempt) when I use the M$ guys DLL for it."

    In that case my assumption is that that DLL does some more work than just calling WTSSendMessage. Perhaps wrapping the call in a creation and teardown of an actual RDP session (WTSVirtualChannelOpen and -close) ?

    That the program works when you start it directly could be because the environment for a program started thru the task scheduler is a bit different from when its started by you in person. It by default not being
    interactive is one of them.

    Hope that helps.

    Regards,
    Rudy Wieser



    That is what I believe is happening.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)