能力值:
( LV7,RANK:140 )
|
-
-
2 楼
pvStart需要你自己先分配空间,长度也不是sizeof(pvStart)
最后于 2023-5-29 14:20
被yeyeshun编辑
,原因:
|
能力值:
( LV2,RANK:10 )
|
-
-
3 楼
yeyeshun
pvStart需要你自己先分配空间,长度也不是sizeof(pvStart)
传入了分配的内存和长度,返回错误长度不匹配,但是最后个参数ReturnLength值一直不变,初始值是多少还是多少
|
能力值:
( LV13,RANK:385 )
|
-
-
4 楼
原型:
NTSTATUS ZwQueryInformationThread (
_In_ HANDLE ThreadHandle,
_In_ THREADINFOCLASS ThreadInformationClass,
_In_ PVOID ThreadInformation,
_In_ ULONG ThreadInformationLength,
_Out_opt_ PULONG ReturnLength
); 微软Api都有套路. 可以第一次调用函数. 调用后获取一下需要申请的空间大小.
如: PVOID buffer = nullptr;
ULONG need_size = 0;
ZwQueryInformationThread(threadHandle, ThreadQuerySetWin32StartAddress, NULL,0,&need_size);
//check....
//申请空间,申请need_size大小.然后重新调用
ZwQueryInformationThread(threadHandle, ThreadQuerySetWin32StartAddress, buffer,need_size,&need_size);
//check...
//your code .... 尝试下看看.
|
能力值:
( LV2,RANK:10 )
|
-
-
5 楼
TkBinary
原型:NTSTATUS ZwQueryInformationThread (
_In_ &nbs ...
第一次返回的need_size 还是0,错误还是STATUS_INFO_LENGTH_MISMATCH ((NTSTATUS)0xC0000004L)
|
能力值:
( LV4,RANK:50 )
|
-
-
6 楼
case ThreadQuerySetWin32StartAddress: if (ThreadInformationLength != sizeof (ULONG_PTR)) { return STATUS_INFO_LENGTH_MISMATCH; }
st = ObReferenceObjectByHandle (ThreadHandle, THREAD_QUERY_INFORMATION, PsThreadType, PreviousMode, &Thread, NULL);
if (!NT_SUCCESS (st)) { return st; }
Win32StartAddressValue = Thread->Win32StartAddress; ObDereferenceObject (Thread);
try { *(PVOID *) ThreadInformation = Win32StartAddressValue;
if (ARGUMENT_PRESENT (ReturnLength) ) { *ReturnLength = sizeof (ULONG_PTR); } } except (EXCEPTION_EXECUTE_HANDLER) { return GetExceptionCode (); }
return st;
|
能力值:
( LV3,RANK:20 )
|
-
-
7 楼
解决没有
|
能力值:
( LV2,RANK:10 )
|
-
-
8 楼
PVOID pvStart = ExAllocatePool(NonPagedPool, sizeof(PULONG_PTR)); ULONG nLength = 0; state = ZwQueryInformationThread(threadHandle, ThreadQuerySetWin32StartAddress, pvStart, sizeof(PULONG_PTR), &nLength); 这样写成功了 不过修改回调地址拦截没生效
KIRQL irql = CloseWriteProf(); *(UCHAR*)pvStart = 0xC3; OpenWriteProf(irql);
KIRQL CloseWriteProf() { KIRQL irql = KeRaiseIrqlToDpcLevel(); ULONG_PTR cr0 = __readcr0();
cr0 &= 0xfffffffffffeffff; _disable(); __writecr0(cr0);
return irql; } VOID OpenWriteProf(KIRQL irql) { ULONG_PTR cr0 = __readcr0(); cr0 |= 0x10000; __writecr0(cr0); _enable(); KeLowerIrql(irql); }
最后于 2023-5-31 10:36
被Hbruce编辑
,原因:
|
能力值:
( LV2,RANK:10 )
|
-
-
9 楼
问题已经解决,感谢各位大神答疑
|
能力值:
( LV13,RANK:385 )
|
-
-
10 楼
Hbruce
问题已经解决,感谢各位大神答疑 上面方法解决的?
还有修改回调地址 可以使用 Attach MDL .....等方式.
最后于 2023-5-31 11:33
被TkBinary编辑
,原因:
|
能力值:
( LV2,RANK:10 )
|
-
-
11 楼
TkBinary
Hbruce
问题已经解决,感谢各位大神答疑 上面方法解决的?还有修改回调地址 可以使用 Attach MDL .....等方式.&nb ...
是的,上面写的获取成功了,修改回调地址上面加入attach后也成功了
|
|
|