MCPcopy Create free account
hub / github.com/WinDurango/WinDurango / EraCreateFileW

Function EraCreateFileW

projects/WinDurango.KernelX/src/kernelx.cpp:760–809  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

758 std::replace(convert.begin(), convert.end(), L'//', L'/');
759
760 lpFileName = convert.data();
761 }
762
763 if ((fileName[0] == 'G' || fileName[0] == 'g') && fileName[1] == ':')
764 {
765 static std::wstring trimPath{};
766 trimPath = fileName.substr(2);
767 fileName = trimPath.data();
768 convert = std::filesystem::current_path().c_str();
769 convert.append(fileName);
770 std::replace(convert.begin(), convert.end(), L'\\', L'/');
771 std::replace(convert.begin(), convert.end(), L'//', L'/');
772
773 lpFileName = convert.data();
774 }
775 else if ((fileName[0] == 'T' || fileName[0] == 't') && fileName[1] == ':')
776 {
777
778 static std::wstring trimPath{};
779 trimPath = fileName.substr(2);
780 fileName = trimPath.data();
781 convert = winrt::Windows::Storage::ApplicationData::Current().TemporaryFolder().Path();
782 convert.append(fileName);
783 std::replace(convert.begin(), convert.end(), L'\\', L'/');
784 std::replace(convert.begin(), convert.end(), L'//', L'/');
785
786 lpFileName = convert.data();
787 }
788}
789
790EXTERN_C HANDLE __stdcall EraCreateFileW(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
791 LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition,
792 DWORD dwFlagsAndAttributes, HANDLE hTemplateFile)
793{
794 // We do this so we have a Logan event copy, so we know when AcpHal tries to communicate via DeviceIoControl.
795 if (wcscmp(lpFileName, L"\\\\?\\acpi_hal#logan#0#{f764922a-de30-40a5-a66e-c46cb191a1cd}") == 0)
796 {
797 HANDLE Event = CreateEventW(NULL, FALSE, FALSE, NULL);
798 LoganHandle = Event;
799
800 LoganInit();
801 SetLastError(ERROR_SUCCESS);
802
803 return LoganHandle;
804 }
805
806 static std::wstring convert{};
807 std::wstring_view fileName(lpFileName);
808
809 int length = fileName.length();
810 if (fileName[0] == '/')
811 {
812 static std::wstring trimPath{};

Callers

nothing calls this directly

Calls 7

LoganInitFunction · 0.85
SetLastErrorFunction · 0.85
FixRelativePathFunction · 0.85
dataMethod · 0.80
c_strMethod · 0.80
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected