E_STRING strBuff = { 0 };
std::wstring dosPath = L"C:\\WINDOWS\\system32\\drivers";
std::wstring devicePath = L"\\Device\\HarddiskVolume4\\123.txt";
PUNICODE_STRING pNtPath = new UNICODE_STRING;
GetWindowsDirectory(szWindowsDirectory, ARRAYSIZE(szWindowsDirectory));
status = DosPathToNtPath((wchar_t*)dosPath.c_str(), pNtPath);
if (NT_SUCCESS(status))
{
status = NtPathToDosPath(pNtPath, DosPathBuffer);
SafeDeletePoint(pNtPath);
}
DeviceDosPathToNtPath((wchar_t*)devicePath.c_str(), szNtPath);
RtlInitUnicodeString(&strBuff, szNtPath);
getchar();
return 0;
system("pause");
return 0;
}
|