MCPcopy Create free account
hub / github.com/HoShiMin/Kernel-Bridge / CreateDir

Method CreateDir

Kernel-Bridge/API/FilesAPI.cpp:71–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69
70
71NTSTATUS FilesAPI::CreateDir(LPCWSTR DirPath) {
72 UNICODE_STRING Path;
73 RtlInitUnicodeString(&Path, DirPath);
74
75 OBJECT_ATTRIBUTES ObjectAttributes;
76 InitializeObjectAttributes(
77 &ObjectAttributes,
78 &Path,
79 OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE,
80 NULL,
81 NULL
82 );
83
84 IO_STATUS_BLOCK IoStatusBlock = {};
85 LARGE_INTEGER AllocationSize = {};
86
87 HANDLE hDir = NULL;
88 NTSTATUS Status = ZwCreateFile(
89 &hDir,
90 SYNCHRONIZE,
91 &ObjectAttributes,
92 &IoStatusBlock,
93 &AllocationSize,
94 FILE_ATTRIBUTE_NORMAL,
95 0, // Non-shared access
96 FILE_CREATE,
97 FILE_DIRECTORY_FILE,
98 NULL,
99 0
100 );
101 if (NT_SUCCESS(Status) && hDir) ZwClose(hDir);
102 return Status;
103}
104
105NTSTATUS FilesAPI::DeleteFile(LPCWSTR FilePath) {
106 UNICODE_STRING Path;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected