找回密码
 加入
搜索
查看: 4320|回复: 8

[GUI管理] 有没有办法给指定的窗口(非GUI)用皮肤?

  [复制链接]
发表于 2010-9-23 16:13:25 | 显示全部楼层 |阅读模式
有没有办法给指定的窗口(非GUI)用皮肤?(我说的是非Autoit的窗口即其它软件的窗口),是哪种的皮肤插件可以啊?

评分

参与人数 1金钱 -10 收起 理由
afan -10

查看全部评分

发表于 2010-9-23 16:38:31 | 显示全部楼层
呵呵,我也想知道啊。
发表于 2010-9-23 17:35:20 | 显示全部楼层
可以,这要用到线程渗透技术,具体请看Thread.au3中的_RTInfiltrateThread或_RTRemoteProcedure函数。

1、用GetWindowThreadProcessId获取目标窗口所属的进程和线程ID。
2、OpenProcess、OpenThread分别取得目标进程和线程的句柄。
3、为目标进程分配内存空间,存放代码(设置皮肤的代码)和数据(皮肤文件的路径等信息)。
4、暂停目标线程的执行。
5、调用NtSetContextThread修改目标线程的代码指针(EIP),使其指向第3步获取到的内存指针。
6、恢复线程,执行自定义代码。
7、释放内存,并关闭进程和线程的句柄。
8、OK。

Thread.au3 - http://www.autoitx.com/forum.php ... mp;highlight=thread
 楼主| 发表于 2010-9-23 19:08:28 | 显示全部楼层
本帖最后由 lsf1012 于 2010-9-23 19:09 编辑

楼上的说的太深奥了,不懂,不过我发现SkinCrafterDll可以用,但是老出问题,用窗口的名柄回皮肤后,只有个框框是皮肤的,而且不能动了
发表于 2010-9-23 19:14:43 | 显示全部楼层
本帖最后由 pusofalse 于 2010-9-23 19:23 编辑

回复 4# lsf1012


    SkinCrafterDll只能为当前线程中的窗口设置皮肤,为其他线程的窗口设置皮肤时,那个窗口就死掉了,所以只能用线程渗透(不是创建远程线程),渗透到目标窗口所属的线程中,更改其执行流程,使其运行自己定义的设置皮肤的代码。

#include <Thread.au3>

Const $tagSET_SKIN = "hWnd hWnd;wchar LicenKey[8];wchar SkinPath[520]"

$sImagePath = @ScriptDir & "\SkinCrafterDll.dll"
$sFilePath = @ScriptDir & "\LEDWidget.skf"

$pLibrary = _RTLoadLibrary($sImagePath)

Const $pApplySkin = _RTGetProcAddress($pLibrary, "ApplySkin")
Const $pDecorateAs = _RTGetProcAddress($pLibrary, "DecorateAs")
Const $pLoadSkinFromFile = _RTGetProcAddress($pLibrary, "LoadSkinFromFile")
Const $pInitDecoration = _RTGetProcAddress($pLibrary, "InitDecoration")
Const $pInitLicenKeys = _RTGetProcAddress($pLibrary, "InitLicenKeys")

_RTFreeLibrary($pLibrary)

Run(@SystemDir & "\notepad.exe")
ProcessWait("Notepad.exe")
Sleep(700)

$hWnd = WinGetHandle("[class:Notepad]")

$iProcessId = _RTGetWindowThreadProcessId($hWnd)
$iThreadId = @Extended

$hProcess = _RTOpenProcess($iProcessId)
$hThread = _RTOpenThread($iThreadId)

$pStartAddr = _RTVirtualAllocEx($hProcess, 2048)
$pParam = $pStartAddr + 512

_RTWriteProcessMemory($hProcess, $pParam, $hWnd, 4, "hWnd*")
_RTWriteProcessMemory($hProcess, $pParam + 4, 1, 6, "wstr")
_RTWriteProcessMemory($hProcess, $pParam + 20, $sFilePath, 518, "wstr")

$bEspData = _RTInfiltrateThread($hProcess, $hThread, $pStartAddr, 0, $pParam)
$pEsp = Ptr(@Extended)

$bCode = "0x" & _
        "55" & _                                                ; push ebp
        "8BEC" & _                                                ; mov ebp, esp
        "60" & _                                                ; pushad
        "8B5D08" & _                                                ; mov ebx, dword ptr [ebp+8]
        "8D7B04" & _                                                ; lea edi, dword ptr [ebx+4]
        "57" & _                                                ; push edi
        "57" & _                                                ; push edi
        "6A00" & _                                                ; push 0
        "57" & _                                                ; push edi
        "B8" & _RTLongPtrToBytes($pInitLicenKeys) & _                ; mov eax, InitLicenKeys
        "FFD0" & _                                                ; call eax
        "6A01" & _                                                ; push 1
        "B8" & _RTLongPtrToBytes($pInitDecoration) & _                ; mov eax, InitDecoration
        "FFD0" & _                                                ; call eax
        "8D7B14" & _                                                ; lea edi, dword ptr [ebx+14]
        "57" & _                                                ; push edi
        "B8" & _RTLongPtrToBytes($pLoadSkinFromFile) & _        ; mov eax, LoadSkinFromFile
        "FFD0" & _                                                ; call eax
        "6A19" & _                                                ; push 19
        "FF33" & _                                                ; push dword ptr [ebx]
        "B8" & _RTLongPtrToBytes($pDecorateAs) & _                ; mov eax, DecorateAs
        "FFD0" & _                                                ; call eax
        "B8" & _RTLongPtrToBytes($pApplySkin) & _                ; mov eax, ApplySkin
        "FFD0" & _                                                ; call eax
        "83C420" & _                                                ; add esp, 20
        "61" & _                                                ; popad
        "5D" & _                                                ; pop ebp
        "C705" & _RTLongPtrToBytes($pEsp) & _RTUlongToBytes($bEspData) & _
        "C3"                                                        ; ret

_RTLoadDllEx($sImagePath, $hProcess)
_RTInjectEx($hProcess, $pStartAddr, $bCode)
_RTResumeThread($hThread)

_RTCloseHandle($hThread)
_RTCloseHandle($hProcess)


$sImagePath和$sFilePath分别是SkinCrafterDll.dll和皮肤文件的全路径。

评分

参与人数 1金钱 +50 收起 理由
afan + 50 强人

查看全部评分

 楼主| 发表于 2010-9-23 20:12:22 | 显示全部楼层
我试了下,说“0x01c21be0”指令引用的“0x01c21be0”内存不能为“read”,然后就中止了
发表于 2010-9-24 08:58:11 | 显示全部楼层
回复  lsf1012


    SkinCrafterDll只能为当前线程中的窗口设置皮肤,为其他线程的窗口设置皮肤时,那 ...
pusofalse 发表于 2010-9-23 19:14


太牛啦,认真学习。。。
发表于 2010-9-24 17:12:28 | 显示全部楼层
又学到了一招,原来是这样子的.
发表于 2011-12-14 13:09:58 | 显示全部楼层
本帖最后由 lling 于 2011-12-14 13:20 编辑

可否更改XP系统桌面任务栏皮肤,请给段示例应用代码,要在PE中使用。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-6-1 10:07 , Processed in 0.083478 second(s), 28 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表