windows 如何提取当前用户的帐户图片?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2677719/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I extract the current user's account picture?
提问by Jon Tackabury
I am trying to extract the current user's account picture in Windows 7, but I can't seem to figure out where it is located. I have found that the picture is sometimes written to the User's temp folder, but only after performing certain actions. It isn't always guaranteed to be there. Has anyone had any luck extracting this image? Thanks!
我试图在 Windows 7 中提取当前用户的帐户图片,但我似乎无法弄清楚它所在的位置。我发现图片有时会写入用户的临时文件夹,但仅在执行某些操作之后。它并不总是保证在那里。有没有人有幸提取过这张图片?谢谢!
Update:I am trying to extract the image using C++, but help in any language would be a big step. :)
更新:我正在尝试使用 C++ 提取图像,但任何语言的帮助都将是一大步。:)
采纳答案by Alex K.
回答by frozen
Whenever an API call needs the UserTile, it is copied to %TEMP%\%USERNAME%.bmp, which is usually C:\Users\username\AppData\Local\Temp\username.bmp.
每当 API 调用需要 UserTile 时,它就会被复制到%TEMP%\%USERNAME%.bmp,通常是C:\Users\username\AppData\Local\Temp\username.bmp。
But if you need to extract it directly from SAM, you can adapt the details from http://deployment.xtremeconsulting.com/2010/06/23/usertile-automation-part-1/, to make a program to read HKLM\SAM\SAM\Domains\Account\Users\????????\UserTile(in system context!), skip 12 bytes, read 4 bytes to uint, and read that uint number of bytes into a file.
但是如果你需要直接从SAM中提取出来,你可以修改http://deployment.xtremeconsulting.com/2010/06/23/usertile-automation-part-1/中的细节,制作一个读取HKLM的程序SAM\SAM\Domains\Account\Users\????????\UserTile(在系统上下文中!),跳过 12 个字节,读取 4 个字节到 uint,然后将该 uint 字节数读入文件。
Edit: I feel I should add that the API call that Explorer in Windows XP uses to get the icon, is an unnamed address in one of the logon DLL's (hence you can not call it yourself, since that address should change between versions), I can not remember which exact DLL at the moment.
编辑:我觉得我应该补充一点,Windows XP 中的资源管理器用于获取图标的 API 调用是登录 DLL 之一中的未命名地址(因此您不能自己调用它,因为该地址应在版本之间更改),我现在不记得是哪个确切的 DLL。
回答by user2542295
I'm not sure about how you want to extract the picture. But if you just could use windows explorer, go to C:\Users\(your-username)\AppData\Local\Temp. The image file is named as (your-username).bmp
我不确定你想如何提取图片。但是,如果您只能使用 Windows 资源管理器,请转到C:\Users\(your-username)\AppData\Local\Temp。图像文件命名为(your-username).bmp
I got this from http://www.sevenforums.com/tutorials/5187-user-account-picture-change.html. I have checked it and it worked.
我从http://www.sevenforums.com/tutorials/5187-user-account-picture-change.html得到这个。我已经检查过它并且有效。