C2039 C3861 C2664 C2440 C3536 C2789 C3083 C2665 errors appear in a project with a sln file created by me since it did not originally exist

I found a project on github in which the developer did not create a sln file on purpose I created it via file->add->existing project the project was created in visual studio 2017.
and I get errors

There is also a chance that the errors in the code were left on purpose.
(yes i know it’s a very old case) this project is connected with windows kernel.

ERROR CODE:
Severity Code Description Project File Line Suppression State
Error C3861 ‘absolute’: identifier not found ConsoleApplication1 c:usersaaaasourcereposconsoleapplication1consoleapplication1loaduploadup.h 168
Error C2039 ‘temp_directory_path’: is not a member of ‘std’ ConsoleApplication1 c:usersaaaasourcereposconsoleapplication1consoleapplication1loaduploadup.h 212
Error C2039 ‘temp_directory_path’: is not a member of ‘std’ ConsoleApplication1 c:usersaaaasourcereposconsoleapplication1consoleapplication1loaduploadup.h 247
Error C2039 ‘path’: is not a member of ‘std’ ConsoleApplication1 c:usersaaaasourcereposconsoleapplication1consoleapplication1loaduploadup.h 168
Error C2039 ‘absolute’: is not a member of ‘std’ ConsoleApplication1 c:usersaaaasourcereposconsoleapplication1consoleapplication1loaduploadup.h 168
Error C2440 ‘return’: cannot convert from ‘initializer list’ to ‘std::tuple<NTSTATUS,std::string>’ ConsoleApplication1 c:usersaaaasourcereposconsoleapplication1consoleapplication1loaduploadup.h 218
Error C2664 ‘std::basic_ofstream<char,std::char_traits>::basic_ofstream(const std::basic_ofstream<char,std::char_traits> &)’: cannot convert argument 1 from ‘const std::_Iosb::_Openmode’ to ‘const std::experimental::filesystem::v1::path &’ ConsoleApplication1 c:usersaaaasourcereposconsoleapplication1consoleapplication1loaduploadup.h 213
Error C2664 ‘int remove(const char *)’: cannot convert argument 1 from ‘int’ to ‘const char *’ ConsoleApplication1 c:usersaaaasourcereposconsoleapplication1consoleapplication1loaduploadup.h 251
Error C2665 ‘driver::load’: none of the 2 overloads could convert all the argument types ConsoleApplication1 c:usersaaaasourcereposconsoleapplication1consoleapplication1loaduploadup.h 218
Error C2789 ‘image_path’: an object of const-qualified type must be initialized ConsoleApplication1 c:usersaaaasourcereposconsoleapplication1consoleapplication1loaduploadup.h 247
Error C2789 ‘file_path’: an object of const-qualified type must be initialized ConsoleApplication1 c:usersaaaasourcereposconsoleapplication1consoleapplication1loaduploadup.h 212
Error C2789 ‘delete_drv’: an object of const-qualified type must be initialized ConsoleApplication1 c:usersaaaasourcereposconsoleapplication1consoleapplication1loaduploadup.h 251
Error C3083 ‘filesystem’: the symbol to the left of a ‘::’ must be a type ConsoleApplication1 c:usersaaaasourcereposconsoleapplication1consoleapplication1loaduploadup.h 168
Error C3083 ‘filesystem’: the symbol to the left of a ‘::’ must be a type ConsoleApplication1 c:usersaaaasourcereposconsoleapplication1consoleapplication1loaduploadup.h 212
Error C3083 ‘filesystem’: the symbol to the left of a ‘::’ must be a type ConsoleApplication1 c:usersaaaasourcereposconsoleapplication1consoleapplication1loaduploadup.h 247
Error C3083 ‘filesystem’: the symbol to the left of a ‘::’ must be a type ConsoleApplication1 c:usersaaaasourcereposconsoleapplication1consoleapplication1loaduploadup.h 251
Error C3536 ‘image_path’: cannot be used before it is initialized ConsoleApplication1 c:usersaaaasourcereposconsoleapplication1consoleapplication1loaduploadup.h 251
Error C3536 ‘file_path’: cannot be used before it is initialized ConsoleApplication1 c:usersaaaasourcereposconsoleapplication1consoleapplication1loaduploadup.h 213
Error C3861 ‘temp_directory_path’: identifier not found ConsoleApplication1 c:usersaaaasourcereposconsoleapplication1consoleapplication1loaduploadup.h 212
Error C3861 ‘temp_directory_path’: identifier not found ConsoleApplication1 c:usersaaaasourcereposconsoleapplication1consoleapplication1loaduploadup.h 247
Error C3861 ‘path’: identifier not found ConsoleApplication1 c:usersaaaasourcereposconsoleapplication1consoleapplication1loaduploadup.h 168

Loudup.h code

#pragma once
#include <Windows.h>
#include <Winternl.h>
#include <string>
#include <fstream>
#include <filesystem>
#include "SkCrypt.h"

#pragma comment(lib, "ntdll.lib")
using nt_load_driver_t = NTSTATUS(__fastcall*)(PUNICODE_STRING);
using nt_unload_driver_t = NTSTATUS(__fastcall*)(PUNICODE_STRING);

namespace driver
{
    namespace util
    {
        inline bool delete_service_entry(const std::string& service_name)
        {
            HKEY reg_handle;
            static const std::string reg_key(E("System\CurrentControlSet\Services\"));

            auto result = RegOpenKeyA(
                HKEY_LOCAL_MACHINE,
                reg_key.c_str(),
                &reg_handle
            );

            return ERROR_SUCCESS == RegDeleteKeyA(reg_handle, service_name.data()) && ERROR_SUCCESS == RegCloseKey(reg_handle);;
        }

        inline bool create_service_entry(const std::string& drv_path, const std::string& service_name)
        {
            HKEY reg_handle;
            std::string reg_key(E("System\CurrentControlSet\Services\"));
            reg_key += service_name;

            auto result = RegCreateKeyA(
                HKEY_LOCAL_MACHINE,
                reg_key.c_str(),
                &reg_handle
            );

            if (result != ERROR_SUCCESS)
                return false;

            //
            // set type to 1 (kernel)
            //
            constexpr std::uint8_t type_value = 1;
            result = RegSetValueExA(
                reg_handle,
                E("Type"),
                NULL,
                REG_DWORD,
                &type_value,
                4u
            );

            if (result != ERROR_SUCCESS)
                return false;

            //
            // set error control to 3
            //
            constexpr std::uint8_t error_control_value = 3;
            result = RegSetValueExA(
                reg_handle,
                E("ErrorControl"),
                NULL,
                REG_DWORD,
                &error_control_value,
                4u
            );

            if (result != ERROR_SUCCESS)
                return false;

            //
            // set start to 3
            //
            constexpr std::uint8_t start_value = 3;
            result = RegSetValueExA(
                reg_handle,
                E("Start"),
                NULL,
                REG_DWORD,
                &start_value,
                4u
            );

            if (result != ERROR_SUCCESS)
                return false;

            //
            // set image path to the driver on disk
            //
            result = RegSetValueExA(
                reg_handle,
                E("ImagePath"),
                NULL,
                REG_SZ,
                (std::uint8_t*)drv_path.c_str(),
                drv_path.size()
            );

            if (result != ERROR_SUCCESS)
                return false;

            return ERROR_SUCCESS == RegCloseKey(reg_handle);
        }

        // this function was coded by paracord: https://githacks.org/snippets/4#L94 
        inline bool enable_privilege(const std::string& privilege_name)
        {
            HANDLE token_handle = nullptr;
            if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &token_handle))
                return false;

            LUID luid{};
            if (!LookupPrivilegeValueA(nullptr, privilege_name.data(), &luid))
                return false;

            TOKEN_PRIVILEGES token_state{};
            token_state.PrivilegeCount = 1;
            token_state.Privileges[0].Luid = luid;
            token_state.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;

            if (!AdjustTokenPrivileges(token_handle, FALSE, &token_state, sizeof(TOKEN_PRIVILEGES), nullptr, nullptr))
                return false;

            CloseHandle(token_handle);
            return true;
        }

        inline std::string get_service_image_path(const std::string& service_name)
        {
            HKEY reg_handle;
            DWORD bytes_read;
            char image_path[0xFF];
            static const std::string reg_key(E("System\CurrentControlSet\Services\"));

            auto result = RegOpenKeyA(
                HKEY_LOCAL_MACHINE,
                reg_key.c_str(),
                &reg_handle
            );

            result = RegGetValueA(
                reg_handle,
                service_name.c_str(),
                "ImagePath",
                REG_SZ,
                NULL,
                image_path,
                &bytes_read
            );

            RegCloseKey(reg_handle);
            return std::string(image_path);
        }
    }

    inline NTSTATUS load(const std::string& drv_path, const std::string& service_name)
    {
        if (!util::enable_privilege(std::string(E("SeLoadDriverPrivilege"))))
            return STATUS_ABANDONED_WAIT_0;

        if (!util::create_service_entry("\??\" + std::filesystem::absolute(std::filesystem::path(drv_path)).string(), service_name))
            return STATUS_ABANDONED_WAIT_0;

        std::string reg_path(E("\Registry\Machine\System\CurrentControlSet\Services\"));
        reg_path += service_name;

        static const auto lp_nt_load_drv =
            ::GetProcAddress(
                GetModuleHandleA(E("ntdll.dll")),
                E("NtLoadDriver")
            );

        if (lp_nt_load_drv)
        {
            ANSI_STRING driver_rep_path_cstr;
            UNICODE_STRING driver_reg_path_unicode;

            RtlInitAnsiString(&driver_rep_path_cstr, reg_path.c_str());
            RtlAnsiStringToUnicodeString(&driver_reg_path_unicode, &driver_rep_path_cstr, true);
            reinterpret_cast<nt_load_driver_t>(lp_nt_load_drv)(&driver_reg_path_unicode);
        }

        return STATUS_ABANDONED_WAIT_0;
    }

    inline std::tuple<NTSTATUS, std::string> load(const std::vector<std::uint8_t>& drv_buffer)
    {
        static const auto random_file_name = [](std::size_t length) -> std::string
            {
                static const auto randchar = []() -> char
                    {
                        const char charset[] =
                            "0123456789"
                            "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
                            "abcdefghijklmnopqrstuvwxyz";
                        const std::size_t max_index = (sizeof(charset) - 1);
                        return charset[rand() % max_index];
                    };
                std::string str(length, 0);
                std::generate_n(str.begin(), length, randchar);
                return str;
            };

        const auto service_name = random_file_name(16);
        const auto file_path = std::filesystem::temp_directory_path().string() + random_file_name(16);
        std::ofstream output_file(file_path.c_str(), std::ios::binary);

        output_file.write((char*)drv_buffer.data(), drv_buffer.size());
        output_file.close();

        return { load(file_path, service_name), service_name };
    }

    inline std::tuple<NTSTATUS, std::string> load(const std::uint8_t* buffer, const std::size_t size)
    {
        std::vector<std::uint8_t> image(buffer, buffer + size);
        return load(image);
    }

    inline bool unload(const std::string& service_name)
    {
        std::string reg_path(E("\Registry\Machine\System\CurrentControlSet\Services\"));
        reg_path += service_name;

        static const auto lp_nt_unload_drv =
            ::GetProcAddress(
                GetModuleHandleA(E("ntdll.dll")),
                E("NtUnloadDriver")
            );

        if (lp_nt_unload_drv)
        {
            ANSI_STRING driver_rep_path_cstr;
            UNICODE_STRING driver_reg_path_unicode;

            RtlInitAnsiString(&driver_rep_path_cstr, reg_path.c_str());
            RtlAnsiStringToUnicodeString(&driver_reg_path_unicode, &driver_rep_path_cstr, true);

            const bool unload_drv = !reinterpret_cast<nt_unload_driver_t>(lp_nt_unload_drv)(&driver_reg_path_unicode);
            const auto image_path = std::filesystem::temp_directory_path().string() + service_name;
            const bool delete_reg = util::delete_service_entry(service_name);
            try
            {
                const bool delete_drv = std::filesystem::remove(image_path);
            }
            catch (std::exception& e) {}
            return unload_drv && delete_reg;
        }
        return false;
    }
}

I tried writing to the creator and searching for a solution on the internet
In 1 case the creator wouldn’t answer me
In the second case I lacked neither skills nor Iq.

New contributor

Sofiya Marina is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật