Monday, June 17, 2019

How to change Windows 10 login screen inactivity timeout?


We are developing some MFA (multi-factor authentication) support on Windows. After entering the user password it will have other challenge like email/phone calls.
But on Windows 10 we found that the login screen (not remote) will close after 30s of inactivity. In some cases the email/phone challenge may take more than 30s, and logon screen being closed will stop the email/phone wait.
Is there any way, like registry, to change the Windows 10 logon timeout value?

The registry controlling the login screen timeout is
Key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI
DWORD Value: IdleTimeOut
Unit: msec

Because the registry key wasn't here and adding it didn't work.

My windows versions (for info):

(Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\WindowsNT\CurrentVersion").ReleaseId
#1803
Get-WmiObject win32_operatingsystem | Select-Object caption, version
#caption                  version
#-------                  -------
#Microsoft Windows 10 Pro 10.0.17134
1. Get Your Scheme or use 'SCHEME_CURRENT' alias
Check your current power scheme:

powercfg.exe /LIST
#Existing Power Schemes (* Active)
#-----------------------------------
#Power Scheme GUID: 381b4222-f694-41f0-9685-ff5bb260df2e  (Balanced) *
#Power Scheme GUID: 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c  (High performance)
#Power Scheme GUID: a1841308-3541-4fab-bc81-f71556f20b4a  (Power saver)
Get your current scheme alias:

(powercfg.exe /QUERY ((powercfg.exe /GETACTIVESCHEME) -replace '.* ([0-9a-f-]{36}) .*', '$1'))|Select-String -Pattern "^  GUID Alias"
#GUID Alias: SCHEME_BALANCED
2. Set lock timeout AC or DC
Use /SETACVALUEINDEX when you are not on battery

Use /SETDCVALUEINDEX when on battery

The value is in seconds, so here 1200s = 60s * 20 i.e. 20minutes

powercfg.exe /SETACVALUEINDEX SCHEME_CURRENT SUB_VIDEO VIDEOCONLOCK 1200






Wednesday, June 12, 2019

Build google protocol-buffer with NDK r19c

I was build google protocol buffer 3.30 with NDK r16 

It call the ./configure  pass in standalone toolchain as parameter, it works.

2 years later, the NDK upgrade to r19c
google protocol buffer upgrade to 3.8.0

When call ./configure same as previous version, report an error :

checking whether #ndk/toolchains/android/arm-linux-androideabi/bin/arm-linux-androideabi-clang++ supports C++11 features by default... no
checking whether #ndk/toolchains/android/arm-linux-androideabi/bin/arm-linux-androideabi-clang++ supports C++11 features with -std=c++11... no
checking whether #ndk/toolchains/android/arm-linux-androideabi/bin/arm-linux-androideabi-clang++ supports C++11 features with +std=c++11... no
checking whether #ndk/toolchains/android/arm-linux-androideabi/bin/arm-linux-androideabi-clang++ supports C++11 features with -h std=c++11... no
checking whether #ndk/toolchains/android/arm-linux-androideabi/bin/arm-linux-androideabi-clang++ supports C++11 features with -std=c++0x... no
checking whether #ndk/toolchains/android/arm-linux-androideabi/bin/arm-linux-androideabi-clang++ supports C++11 features with +std=c++0x... no
checking whether #ndk/toolchains/android/arm-linux-androideabi/bin/arm-linux-androideabi-clang++ supports C++11 features with -h std=c++0x... no
configure: error: *** A compiler with support for C++11 language features is required.  

Finally, found solution: call cmake instead of ./autogen , ./configure

cd cmake
cmake \
-Dprotobuf_BUILD_SHARED_LIBS=OFF \
-Dprotobuf_BUILD_STATIC_LIBS=ON \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-Dprotobuf_BUILD_TESTS=OFF \
-Dprotobuf_BUILD_EXAMPLES=OFF \
-Dprotobuf_BUILD_PROTOC_BINARIES=OFF \
-DCMAKE_TOOLCHAIN_FILE=$CMAKE_TOOLCHAIN \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$INSTALL_PATH \
-DANDROID_NDK=$ANDROID_NDK_ROOT \
-DANDROID_TOOLCHAIN=clang \
-DANDROID_ABI=$androidabi \
-DANDROID_NATIVE_API_LEVEL=26 \
-DANDROID_STL=c++_shared \
-DANDROID_LINKER_FLAGS="-landroid -llog" \
-DANDROID_CPP_FEATURES="rtti exceptions" \
.
cmake --build .
make install