Open keldnorman opened 4 years ago
I made these changes & added username detection in my fork. Waiting for it to get merged. *I used a different account picture detection, yours doesn't account for the default picture.
hey just wondering where you would put this code? ^^^
Would also be really cool if there were sign in options and support for multiple accounts to make it seem more believable, in the mean time I might try looking into ways to make this work.
Would also be really cool if there were sign in options and support for multiple accounts to make it seem more believable, in the mean time I might try looking into ways to make this work.
@jy1263 I agree, I'm looking to do just that in a WPF fork (to give more control over the styling). https://github.com/cftad/SharpLocker
There is one problem. the background image is not always the lockscreen image. I'm gonna try to replace the background image with the lockscreen image.
@CL0Pinette been tryna figure that out but idk if thats possible without administrator privileges, because u can't access C:\ProgramData\Microsoft\Windows\SystemData\
@CL0Pinette There is another idea.
A fairly large number of users have the Windows Spotlight feature turned on, which displays Bing-provided images on the lock screen. You can randomly grab one from %LOCALAPPDATA%\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets
as it doesn't require admin rights. Try to pick one with size > 250 or 300KB (or better, check its resolution or aspect ratio) so as to avoid picking a Start Menu tile image.
Also, I've noticed that Windows uses %WINDIR%\Web\Screen\img103.png
as a fallback lock screen image when Spotlight is enabled but no Spotlight images have been downloaded yet, or if Spotlight is unavailable due to some reason.
I've also read that the registry keys OriginalFile_A
or Creative\LandscapeAssetPath
present in the location HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lock Screen\
contain the filesystem path to the current lock screen image in use, when Windows Spotlight is enabled. I've just enabled Spotlight on my PC and am yet to find out if it's true.
Hello, keldnorman, where can i write that code for profile pin?
@msvamp I think the originalfile_A
that you mentioned is not related to the Windows spotlight.
I believe it corresponds to the lock screen with Picture
.
I changed it a few times and the binary data does contain some of the parts of the files I've selected.
Also HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\SystemProtectedUserData\<Your SID>\AnyoneRead\LockScreen
has (Default)
as ZACEDB
or some permutation which changes when you select a different picture where each letter represents an image and the permutation represents the order in which stuff is shown in the settings page. Also, it's read-only.
I'd like to know where you read about Originalfile_A
and how I can decode the binary data to the original file path tho...
@phanirithvij I frankly don't remember where I found it. I did look through my history and only found some help articles and support pages that mention clearing certain entries in HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lock Screen
can help reset lock screen settings (and the wallpaper) to default to help people resolve issues with their lockscreen. (Maybe I didn't look deep enough in the history)
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\SystemProtectedUserData\<Your SID>\AnyoneRead\LockScreen
has(Default)
This looks something interesting, though I have hardly found the (Default)
value containing any important data.
where you read about
Originalfile_A
and how I can decode the binary data to the original file path tho...
I don't think Microsoft has disclosed anywhere about how the value is stored in the registry key, but I found a useful LockScreen class in the Windows Runtime API after I read this answer on SuperUser. This could be of some use to you -
[Windows.System.UserProfile.LockScreen,Windows.System.UserProfile,ContentType=WindowsRuntime]::OriginalImageFile.AbsolutePath
The problem with this path is: it is the path of the original file while applying a lockscreen image. So this value remains unchanged although the original image is deleted in the future.
@msvamp Thanks for your quick reply.
I did put together some go
code which can get the spotlight lock screen wallpaper path exactly following this blog from winhelponline.
Not a C# dev (not a go dev either :) )
Look at getLockScreenRegKeySpotLight
and getLockScreenPath
functions and ignore other stuff.
Also @jy1263 I was able to access C:\ProgramData\Microsoft\Windows\SystemData\<SID>\ReadOnly
without admin privileges.
@jy1263 a python snippet to list contents of the C:\ProgramData\Microsoft\Windows\SystemData\<SID>\ReadOnly
dir, which runs for on my machine without needing of admin rights
from pathlib import Path
# pip install pywin32
import win32security
import os
def get_user_sid():
desc = win32security.GetFileSecurity(
".", win32security.OWNER_SECURITY_INFORMATION
)
sid = desc.GetSecurityDescriptorOwner()
# https://www.programcreek.com/python/example/71691/win32security.ConvertSidToStringSid
sid = win32security.ConvertSidToStringSid(sid)
return sid
sid = get_user_sid()
dirname = Path(
f'C:\ProgramData\Microsoft\Windows\SystemData\{sid}\ReadOnly')
for root, dirs, files in os.walk(dirname, topdown=False):
for name in files:
print(os.path.join(root, name))
for name in dirs:
print(os.path.join(root, name))
For anyone interested
go get -u -v github.com/spf13/afero golang.org/x/sys/windows/registry
Then go run file.go
or go build file.go && ./file
To get the current background image:
and to get the account picture: