• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            S.l.e!ep.¢%

            像打了激速一樣,以四倍的速度運(yùn)轉(zhuǎn),開心的工作
            簡單、開放、平等的公司文化;尊重個(gè)性、自由與個(gè)人價(jià)值;
            posts - 1098, comments - 335, trackbacks - 0, articles - 1
              C++博客 :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理

            HOOK SSDT Hide Process (四)

            Posted on 2009-10-25 20:55 S.l.e!ep.¢% 閱讀(366) 評(píng)論(0)  編輯 收藏 引用 所屬分類: RootKit
            Enum Process Under Ring3

            taskmgr.exe 就是通過以下方式 Enum Process 的

            #include?<stdlib.h>
            #include?
            <stdio.h>
            #include?
            <windows.h>

            typedef?
            long?NTSTATUS;

            //
            //?Unicode?strings?are?counted?16-bit?character?strings.?If?they?are
            //?NULL?terminated,?Length?does?not?include?trailing?NULL.
            //

            typedef?
            struct?_UNICODE_STRING
            {
            ????USHORT?Length;
            ????USHORT?MaximumLength;
            ????PWSTR??Buffer;

            }?UNICODE_STRING,?
            *PUNICODE_STRING;

            //
            //?Thread?priority
            //

            typedef?LONG?KPRIORITY;

            //-----------------------------------------------------------------------------
            //?Query?system?information

            typedef?
            enum?_SYSTEM_INFORMATION_CLASS
            {
            ????SystemBasicInformation,?????????????????
            //?0x00?SYSTEM_BASIC_INFORMATION
            ????SystemProcessorInformation,?????????????//?0x01?SYSTEM_PROCESSOR_INFORMATION
            ????SystemPerformanceInformation,???????????//?0x02
            ????SystemTimeOfDayInformation,?????????????//?0x03
            ????SystemPathInformation,??????????????????//?0x04
            ????SystemProcessInformation,???????????????//?0x05
            ????SystemCallCountInformation,?????????????//?0x06
            ????SystemDeviceInformation,????????????????//?0x07
            ????SystemProcessorPerformanceInformation,??//?0x08
            ????SystemFlagsInformation,?????????????????//?0x09
            ????SystemCallTimeInformation,??????????????//?0x0A
            ????SystemModuleInformation,????????????????//?0x0B?SYSTEM_MODULE_INFORMATION
            ????SystemLocksInformation,?????????????????//?0x0C
            ????SystemStackTraceInformation,????????????//?0x0D
            ????SystemPagedPoolInformation,?????????????//?0x0E
            ????SystemNonPagedPoolInformation,??????????//?0x0F
            ????SystemHandleInformation,????????????????//?0x10
            ????SystemObjectInformation,????????????????//?0x11
            ????SystemPageFileInformation,??????????????//?0x12
            ????SystemVdmInstemulInformation,???????????//?0x13
            ????SystemVdmBopInformation,????????????????//?0x14
            ????SystemFileCacheInformation,?????????????//?0x15
            ????SystemPoolTagInformation,???????????????//?0x16
            ????SystemInterruptInformation,?????????????//?0x17
            ????SystemDpcBehaviorInformation,???????????//?0x18
            ????SystemFullMemoryInformation,????????????//?0x19
            ????SystemLoadGdiDriverInformation,?????????//?0x1A
            ????SystemUnloadGdiDriverInformation,???????//?0x1B
            ????SystemTimeAdjustmentInformation,????????//?0x1C
            ????SystemSummaryMemoryInformation,?????????//?0x1D
            ????SystemNextEventIdInformation,???????????//?0x1E
            ????SystemEventIdsInformation,??????????????//?0x1F
            ????SystemCrashDumpInformation,?????????????//?0x20
            ????SystemExceptionInformation,?????????????//?0x21
            ????SystemCrashDumpStateInformation,????????//?0x22
            ????SystemKernelDebuggerInformation,????????//?0x23
            ????SystemContextSwitchInformation,?????????//?0x24
            ????SystemRegistryQuotaInformation,?????????//?0x25
            ????SystemExtendServiceTableInformation,????//?0x26
            ????SystemPrioritySeperation,???????????????//?0x27
            ????SystemPlugPlayBusInformation,???????????//?0x28
            ????SystemDockInformation,??????????????????//?0x29
            ????
            //SystemPowerInformation,???????????????//?0x2A
            ????
            //SystemProcessorSpeedInformation,??????//?0x2B
            ????
            //SystemCurrentTimeZoneInformation,?????//?0x2C
            ????
            //SystemLookasideInformation????????????//?0x2D

            }?SYSTEM_INFORMATION_CLASS,?
            *PSYSTEM_INFORMATION_CLASS;

            //
            //?Process?information
            //?NtQuerySystemInformation?with?SystemProcessInformation
            //

            typedef?
            struct?_SYSTEM_PROCESS_INFORMATION?{
            ????ULONG?NextEntryOffset;
            ????ULONG?NumberOfThreads;
            ????LARGE_INTEGER?SpareLi1;
            ????LARGE_INTEGER?SpareLi2;
            ????LARGE_INTEGER?SpareLi3;
            ????LARGE_INTEGER?CreateTime;
            ????LARGE_INTEGER?UserTime;
            ????LARGE_INTEGER?KernelTime;
            ????UNICODE_STRING?ImageName;
            ????KPRIORITY?BasePriority;
            ????ULONG_PTR?UniqueProcessId;
            ????ULONG_PTR?InheritedFromUniqueProcessId;
            ????ULONG?HandleCount;
            ????
            //?Next?part?is?platform?dependent

            }?SYSTEM_PROCESS_INFORMATION,?
            *PSYSTEM_PROCESS_INFORMATION;

            typedef?NTSTATUS?(
            *PNFNtQuerySystemInformation)(
            ????IN?SYSTEM_INFORMATION_CLASS?SystemInformationClass,
            ????OUT?PVOID?SystemInformation,
            ????IN?ULONG?SystemInformationLength,
            ????OUT?PULONG?ReturnLength
            ????);

            PNFNtQuerySystemInformation?pNtQuerySystemInformation;

            BOOL?LoadNTDLL()
            {
            ????HMODULE?hMod?
            =?GetModuleHandle("ntdll.dll");

            ????
            if?(hMod?==?NULL)
            ????{
            ????????hMod?
            =?LoadLibrary("ntdll.dll");
            ????????
            if?(hMod?==?NULL)
            ????????{
            ????????????printf(
            "LoadLibrary?Error:?%d\n",?GetLastError());
            ????????????
            return?FALSE;
            ????????}
            ????}

            ????pNtQuerySystemInformation?
            =?(PNFNtQuerySystemInformation)GetProcAddress(hMod,?"NtQuerySystemInformation");

            ????
            if(?pNtQuerySystemInformation?==?NULL?)
            ????{
            ????????printf(
            "GetProcAddress?for?NtQuerySystemInformation?Error:?%d\n",?GetLastError());
            ????????
            return?FALSE;
            ????}

            ????ULONG?dwNumberBytes?
            =?0x8000;
            ????
            char*?pBuf?=?(char*)malloc(dwNumberBytes);
            ????PSYSTEM_PROCESS_INFORMATION?pProcessInfo?
            =?(PSYSTEM_PROCESS_INFORMATION)pBuf;
            ????ULONG?dwReturn?
            =?0;

            ????pNtQuerySystemInformation(SystemProcessInformation,?pProcessInfo,?dwNumberBytes,?
            &dwReturn);

            ????
            return?TRUE;
            }

            int?main()
            {
            ????
            if(?!LoadNTDLL()?)
            ????{
            ????????printf(
            "LoadNTDLL?Error!\n");
            ????????
            return?0;
            ????}

            ????printf(
            "test\n");
            ????
            return?0;
            }


            運(yùn)行后,出現(xiàn)
            Debug Error
            File: chkesp.c
            line: 42

            出現(xiàn)這個(gè)錯(cuò)誤通常有兩種情況
            1. 參數(shù)個(gè)數(shù)錯(cuò)
            2. 函數(shù)的調(diào)用方式錯(cuò)

            詳細(xì)檢查之下
            typedef NTSTATUS
            ?(*PNFNtQuerySystemInformation)(
            ??? IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
            ??? OUT PVOID SystemInformation,
            ??? IN ULONG SystemInformationLength,
            ??? OUT PULONG ReturnLength
            ??? );

            這里的寫法有問題,少寫了 __stdcall 的調(diào)用方式

            typedef NTSTATUS
            ?(NTAPI *PNFNtQuerySystemInformation)(
            ??? IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
            ??? OUT PVOID SystemInformation,
            ??? IN ULONG SystemInformationLength,
            ??? OUT PULONG ReturnLength
            ??? );

            這樣的寫法就OK了

            26uuu久久五月天| 久久精品国产亚洲Aⅴ香蕉 | 91精品无码久久久久久五月天| 久久精品国产亚洲av瑜伽| 亚洲国产精品久久久天堂| 国产午夜电影久久| 久久精品欧美日韩精品| 久久精品国产72国产精福利| 久久婷婷五月综合色高清| 久久亚洲国产精品五月天婷| 精品久久无码中文字幕| 色综合合久久天天给综看| 久久久91精品国产一区二区三区| 色青青草原桃花久久综合| 中文字幕一区二区三区久久网站| 亚洲国产精品无码久久一线| 三级片免费观看久久| 97超级碰碰碰碰久久久久| 无码AV中文字幕久久专区| 久久综合给合综合久久| 国产福利电影一区二区三区久久老子无码午夜伦不 | 国产精品久久久久久福利69堂| 伊人 久久 精品| 久久综合伊人77777麻豆| 亚洲午夜久久影院| 久久精品成人免费看| 久久精品人人做人人爽97| 久久久久久精品成人免费图片| 久久综合九色综合欧美就去吻| 91精品国产高清久久久久久91| 国产精品视频久久久| 99久久国语露脸精品国产| 久久久久久亚洲Av无码精品专口 | 久久综合综合久久狠狠狠97色88 | 国产精品美女久久久| 国产午夜精品久久久久免费视| 国产aⅴ激情无码久久| 久久久久亚洲av综合波多野结衣| 欧美日韩中文字幕久久久不卡| 久久久精品国产亚洲成人满18免费网站 | 国产精品无码久久综合|