How to reliably obtain "On resume, display logon screen" for a Windows screensaver?

476 views Asked by At

Am I missing something? I run the following code on my Vista laptop from a user-mode process:

BOOL bSecure = -100;
if(::SystemParametersInfo(SPI_GETSCREENSAVESECURE, NULL, &bSecure, 0))
{
    int success = 1;
}

The purpose is to obtain the "On resume, display logon screen" screensaver setting (circled in red below):

enter image description here

SystemParametersInfo succeeds but bSecure is not changed.

For those who may not believe me, here's the screenshot from the VS debugger:

enter image description here

Upon further debugging it turns out that SystemParametersInfo actually returns 0xC0000002 when on my other computer it returns 1 when it succeeds. I thought it is not supposed to return HRESULT, or is it?

Anyway, the question -- how to reliably obtain this setting?

0

There are 0 answers