如果不写wdm,如何在windows2000中进入系统零层?

解决方案 »

  1.   

    http://person.okey.net/~webcrazy/ntring0.htm这是用到的类型://要安装ntddk
    //typedef unsigned long ULONG_PTR, *PULONG_PTR;
    #define _X86_ #include <windows.h>
    /*
    //#include <winbase.h>
    extern "C" {
    #include "ntddk.h"
    }
    */
    #include <windef.h>
    typedef long NTSTATUS; 
    typedef unsigned short USHORT;
    #define NT_SUCCESS(Status) ((NTSTATUS)(Status) >= 0) 
    #define OBJ_INHERIT 0x00000002L 
    #define OBJ_PERMANENT 0x00000010L 
    #define OBJ_EXCLUSIVE 0x00000020L 
    #define OBJ_CASE_INSENSITIVE 0x00000040L 
    #define OBJ_OPENIF 0x00000080L 
    #define OBJ_OPENLINK 0x00000100L 
    #define OBJ_KERNEL_HANDLE 0x00000200L 
    #define OBJ_VALID_ATTRIBUTES 0x000003F2Ltypedef struct _UNICODE_STRING { 
    USHORT Length; 
    USHORT MaximumLength; 
    #ifdef MIDL_PASS 
    [size_is(MaximumLength / 2), length_is((Length) / 2) ] USHORT * Buffer; 
    #else // MIDL_PASS 
    PWSTR Buffer; 
    #endif // MIDL_PASS 
    } UNICODE_STRING;
    typedef UNICODE_STRING *PUNICODE_STRING; 
    typedef const UNICODE_STRING *PCUNICODE_STRING; 
    #define UNICODE_NULL ((WCHAR)0) // winnt typedef struct _OBJECT_ATTRIBUTES { 
    ULONG Length; 
    HANDLE RootDirectory; 
    PUNICODE_STRING ObjectName; 
    ULONG Attributes; 
    PVOID SecurityDescriptor; // Points to type SECURITY_DESCRIPTOR 
    PVOID SecurityQualityOfService; // Points to type SECURITY_QUALITY_OF_SERVICE 
    } OBJECT_ATTRIBUTES; 
    typedef OBJECT_ATTRIBUTES *POBJECT_ATTRIBUTES; 
    #define InitializeObjectAttributes( p, n, a, r, s ) { \
    (p)->Length = sizeof( OBJECT_ATTRIBUTES ); \
    (p)->RootDirectory = r; \
    (p)->Attributes = a; \
    (p)->ObjectName = n; \
    (p)->SecurityDescriptor = s; \
    (p)->SecurityQualityOfService = NULL; \
    } extern "C"
    NTSYSAPI 
    VOID 
    NTAPI 
    RtlInitUnicodeString( 
     PUNICODE_STRING DestinationString, 
     PCWSTR SourceString 
     ); 
    extern "C"
    NTSYSAPI 
    NTSTATUS 
    NTAPI 
    ZwOpenSection( 
      OUT PHANDLE SectionHandle, 
      IN ACCESS_MASK DesiredAccess, 
      IN POBJECT_ATTRIBUTES ObjectAttributes 
      ); 
    extern "C"
    NTSYSAPI 
    NTSTATUS 
    NTAPI 
    ZwClose( 
    IN HANDLE Handle 
    ); 
    #define STATUS_SUCCESS ((NTSTATUS)0x00000000L) // ntsubauth
    #define STATUS_ACCESS_DENIED ((NTSTATUS)0xC0000022L)
    #pragma comment(lib,"ntdll.lib")
    //#include "ntring0.h"
    //#include <windows.h>
    /*
    namespace NT 

    extern "C" 

    #pragma warning (disable:4005) //macro redfination 
    #include "ntddk.h" 
    #pragma warning (default:4005) 


    */#include <stdio.h>#include <aclapi.h>
    #include <conio.h>#define ENTERRING0 _asm pushad \
    _asm pushf \
    _asm cli#define LEAVERING0 _asm popf \
    _asm popad \
    _asm retftypedef struct gdtr {
    unsigned short Limit;
    unsigned short BaseLow;
    unsigned short BaseHigh;
    } Gdtr_t, *PGdtr_t;typedef struct idtr {
    short Limit;
    short BaseLow;
    short BaseHigh;
    }IdtR;
    typedef struct
    {
    unsigned short offset_0_15;
    unsigned short selector;

    unsigned char param_count : 4;
    unsigned char some_bits : 4;

    unsigned char type : 4;
    unsigned char app_system : 1;
    unsigned char dpl : 2;
    unsigned char present : 1;

    unsigned short offset_16_31;
    } CALLGATE_DESCRIPTOR;void PrintWin32Error( DWORD ErrorCode )
    {
    LPVOID lpMsgBuf;

    FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
    NULL, ErrorCode, 
    MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
    (LPTSTR) &lpMsgBuf, 0, NULL );
    printf("%s\n", lpMsgBuf );
    LocalFree( lpMsgBuf );
    }
      

  2.   

    不清楚啊,我没有装XP,哪个地方出了问题啊?是GDT那儿吗?