|
|
@ -17,6 +17,8 @@
|
|
|
|
#include "stdmisc.h"
|
|
|
|
#include "stdmisc.h"
|
|
|
|
#include "nel/misc/system_utils.h"
|
|
|
|
#include "nel/misc/system_utils.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <SDL_video.h>
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef NL_OS_WINDOWS
|
|
|
|
#ifdef NL_OS_WINDOWS
|
|
|
|
#ifndef NL_COMP_MINGW
|
|
|
|
#ifndef NL_COMP_MINGW
|
|
|
|
#define NOMINMAX
|
|
|
|
#define NOMINMAX
|
|
|
@ -234,37 +236,14 @@ bool CSystemUtils::isAzertyKeyboard()
|
|
|
|
|
|
|
|
|
|
|
|
bool CSystemUtils::isScreensaverEnabled()
|
|
|
|
bool CSystemUtils::isScreensaverEnabled()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
bool res = false;
|
|
|
|
return SDL_IsScreenSaverEnabled();
|
|
|
|
#ifdef NL_OS_WINDOWS
|
|
|
|
|
|
|
|
// old code, is not working anymore
|
|
|
|
|
|
|
|
// BOOL bRetValue;
|
|
|
|
|
|
|
|
// SystemParametersInfoA(SPI_GETSCREENSAVEACTIVE, 0, &bRetValue, 0);
|
|
|
|
|
|
|
|
// res = (bRetValue == TRUE);
|
|
|
|
|
|
|
|
HKEY hKeyScreenSaver = NULL;
|
|
|
|
|
|
|
|
LSTATUS lReturn = RegOpenKeyExA(HKEY_CURRENT_USER, TEXT("Control Panel\\Desktop"), 0, KEY_QUERY_VALUE, &hKeyScreenSaver);
|
|
|
|
|
|
|
|
if (lReturn == ERROR_SUCCESS)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
DWORD dwType = 0L;
|
|
|
|
|
|
|
|
DWORD dwSize = KeyMaxLength;
|
|
|
|
|
|
|
|
unsigned char Buffer[KeyMaxLength] = {0};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lReturn = RegQueryValueExA(hKeyScreenSaver, TEXT("SCRNSAVE.EXE"), NULL, &dwType, NULL, &dwSize);
|
|
|
|
|
|
|
|
// if SCRNSAVE.EXE is present, check also if it's empty
|
|
|
|
|
|
|
|
if (lReturn == ERROR_SUCCESS)
|
|
|
|
|
|
|
|
res = (Buffer[0] != '\0');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
RegCloseKey(hKeyScreenSaver);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return res;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool CSystemUtils::enableScreensaver(bool screensaver)
|
|
|
|
bool CSystemUtils::enableScreensaver(bool screensaver)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
bool res = false;
|
|
|
|
if (screensaver) SDL_EnableScreenSaver();
|
|
|
|
#ifdef NL_OS_WINDOWS
|
|
|
|
else SDL_DisableScreenSaver();
|
|
|
|
res = (SystemParametersInfoA(SPI_SETSCREENSAVEACTIVE, screensaver ? TRUE:FALSE, NULL, 0) == TRUE);
|
|
|
|
return true;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return res;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
std::string CSystemUtils::getRootKey()
|
|
|
|
std::string CSystemUtils::getRootKey()
|
|
|
|