首页
社区
课程
招聘
[旧帖] [求助]memcpy在驱动程序中使用之后,加载驱动时产生error(127),这个函数怎么用啊 0.00雪花
发表于: 2009-4-7 20:56 4672

[旧帖] [求助]memcpy在驱动程序中使用之后,加载驱动时产生error(127),这个函数怎么用啊 0.00雪花

2009-4-7 20:56
4672
看了HOOK 大法中,那个SSDT的代码中有一句

NTSTATUS NewZwQuerySystemInformation(
                                                                         IN ULONG SystemInformationClass,
                                                                         IN PVOID SystemInformation,
                                                                         IN ULONG SystemInformationLength,
                                                                         OUT PULONG ReturnLength)
{

        NTSTATUS ntStatus;

        ntStatus = ((ZWQUERYSYSTEMINFORMATION)(OldZwQuerySystemInformation)) (
                SystemInformationClass,
                SystemInformation,
                SystemInformationLength,
                ReturnLength );

        if( NT_SUCCESS(ntStatus))
        {
                // Asking for a file and directory listing
                if(SystemInformationClass == 5)
                {
                        // 列举系统进程链表
                        // 寻找以"_root_"开头的进程

                        struct _SYSTEM_PROCESSES *curr = (struct _SYSTEM_PROCESSES *)SystemInformation;
                        struct _SYSTEM_PROCESSES *prev = NULL;

                        while(curr)
                        {
                                //DbgPrint("Current item is %x\n", curr);
                                if (curr->ProcessName.Buffer != NULL)
                                {
                                        if(0 == memcmp(curr->ProcessName.Buffer, L"_root_", 12))                                        {
                                                m_UserTime.QuadPart += curr->UserTime.QuadPart;
                                                m_KernelTime.QuadPart += curr->KernelTime.QuadPart;

                                                if(prev) // Middle or Last entry
                                                {
                                                        if(curr->NextEntryDelta)
                                                                prev->NextEntryDelta += curr->NextEntryDelta;
                                                        else  // we are last, so make prev the end
                                                                prev->NextEntryDelta = 0;
                                                }
                                                else
                                                {
                                                        if(curr->NextEntryDelta)
                                                        {
                                                                // we are first in the list, so move it forward
                                                                (char *)SystemInformation += curr->NextEntryDelta;
                                                        }
                                                        else // we are the only process!
                                                                SystemInformation = NULL;
                                                }
                                        }
                                }
                                else // Idle process入口
                                {
                                        //  把_root_进程的时间加给Idle进程,Idle称空闲时间

                                        curr->UserTime.QuadPart += m_UserTime.QuadPart;
                                        curr->KernelTime.QuadPart += m_KernelTime.QuadPart;

                                        // 重设时间,为下一次过滤
                                        m_UserTime.QuadPart = m_KernelTime.QuadPart = 0;
                                }
                                prev = curr;
                                if(curr->NextEntryDelta) ((char *)curr += curr->NextEntryDelta);
                                else curr = NULL;
                        }
                }
                else if (SystemInformationClass == 8) // 列举系统进程时间
                {
                        struct _SYSTEM_PROCESSOR_TIMES * times = (struct _SYSTEM_PROCESSOR_TIMES *)SystemInformation;
                        times->IdleTime.QuadPart += m_UserTime.QuadPart + m_KernelTime.QuadPart;
                }

        }
        return ntStatus;
}

加红的一句话出的错,MEMCMP在驱动中可以使用吗,我是在XP SP3下调的,驱动编译通过,加载驱动时bRet= StartService( hServiceDDK, NULL, NULL );  
        if( !bRet )  
        {  
                DWORD dwRtn = GetLastError();  
                if( dwRtn ==127L)
                                printf("找不到指定程序");
                 }

为什么啊?

[课程]Android-CTF解题方法汇总!

收藏
免费 0
支持
分享
最新回复 (3)
雪    币: 201
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
还有,我用过ntSuspenthread这个函数,也出现了同样的错误,怎么回事呢>?
2009-4-8 08:03
0
雪    币: 133
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
3
找不到_root_的程序啊
2009-4-8 11:12
0
雪    币: 201
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
4
解决了,搞定!!
2009-4-8 17:04
0
游客
登录 | 注册 方可回帖
返回
//