HANDLE hFile;
OBJECT_ATTRIBUTES oa;
IO_STATUS_BLOCK iosb;
LARGE_INTEGER li;
UNICODE_STRING strPath = RTL_CONSTANT_STRING(L"\\??\\E:\\123.txt");
UNICODE_STRING str = RTL_CONSTANT_STRING(L"我爱你");
char strWriteInfo[ArrayLength] = {0};
ANSI_STRING sWrite;
InitializeObjectAttributes(&oa, &strPath, OBJ_KERNEL_HANDLE, NULL, NULL);
ZwCreateFile(&hFile,
GENERIC_READ | GENERIC_WRITE,
&oa,
&iosb,
NULL,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ,
FILE_OPEN,
FILE_SYNCHRONOUS_IO_NONALERT,
NULL,
0);
li.HighPart = -1;
li.LowPart = FILE_WRITE_TO_END_OF_FILE;
RtlInitEmptyAnsiString(&sWrite, strWriteInfo, ArrayLength);
RtlUnicodeStringToAnsiString(&sWrite, &str, TRUE);
ZwWriteFile(hFile, NULL, NULL, NULL, &iosb, sWrite.Buffer, sWrite.Length, &li, NULL);
ZwClose(hFile);
windows driver 写数据到txt
最新推荐文章于 2024-12-09 08:05:19 发布
