00001
#include "ntos.h"
00002
#include <stdio.h>
00003
#include <stdlib.h>
00004
#include <string.h>
00005
00006
void
00007 main(
00008 )
00009 {
00010
NTSTATUS Status;
00011 OBJECT_ATTRIBUTES Attr1;
00012 OBJECT_ATTRIBUTES Attr2;
00013 UNICODE_STRING Name1;
00014 UNICODE_STRING Name2;
00015 HANDLE Handle1;
00016 HANDLE Handle2;
00017 IO_STATUS_BLOCK IoStatusBlock;
00018
00019
00020
RtlInitUnicodeString(&Name1,
L"\\DosDevices");
00021
RtlInitUnicodeString(&Name2,
L"C:\\Nt");
00022 InitializeObjectAttributes(&Attr1,
00023 &Name1,
00024 OBJ_CASE_INSENSITIVE,
00025
NULL,
00026
NULL);
00027
Status =
NtOpenDirectoryObject(&Handle1,
00028 DIRECTORY_QUERY,
00029 &Attr1);
00030
if (!
NT_SUCCESS(
Status)) {
00031 printf(
"NtOpenDirectoryObject failed %08lx\n",
Status);
00032
exit(1);
00033 }
00034
00035 InitializeObjectAttributes(&Attr2,
00036 &Name2,
00037 OBJ_CASE_INSENSITIVE,
00038 Handle1,
00039
NULL);
00040
Status =
NtOpenFile(&Handle2,
00041 FILE_LIST_DIRECTORY,
00042 &Attr2,
00043 &IoStatusBlock,
00044 FILE_SHARE_READ | FILE_SHARE_WRITE,
00045 0);
00046
if (!
NT_SUCCESS(
Status)) {
00047 printf(
"NtOpenFile failed %08lx\n",
Status);
00048
exit(1);
00049 }
00050
00051 printf(
"success\n");
00052
00053
00054 }
00055