run windows service(srvany.exe) error,but run with psexec is ok

0

I'm use dxgi to capture login screen,and set the process auto startup(use instsrv+srvany). but when I call the code

    if (FAILED(hr = pAdapter->EnumOutputs(0, &pOutput)))
{
    printf("error:%x\n", hr);
    CLEAN_RETURN(hr);
}

the error code is DXGI_ERROR_NOT_CURRENTLY_AVAILABLE(0x887A0022). and OpenInputDesktop return error(1)

if I use PsExec64.exe to run the process(PsExec64.exe -s -d -i dxgiSample.exe),it's ok. so what's problem?

windows
winapi
service
asked on Stack Overflow Nov 9, 2020 by hello • edited Nov 9, 2020 by vonPryz

1 Answer

0

instsrv+srvany

Run your application as a service.

Services run in session 0.

If you call IDXGIAdapter::EnumOutputs() in a Session 0 process, it returns DXGI_ERROR_NOT_CURRENTLY_AVAILABLE.

answered on Stack Overflow Nov 10, 2020 by Rita Han

User contributions licensed under CC BY-SA 3.0