|
|
@ -4,6 +4,7 @@
|
|
|
|
#include "vdm.hpp"
|
|
|
|
#include "vdm.hpp"
|
|
|
|
#include "msrexec.hpp"
|
|
|
|
#include "msrexec.hpp"
|
|
|
|
#include "hmdm_ctx.h"
|
|
|
|
#include "hmdm_ctx.h"
|
|
|
|
|
|
|
|
#include "linker/linker.hpp"
|
|
|
|
|
|
|
|
|
|
|
|
namespace fs = std::filesystem;
|
|
|
|
namespace fs = std::filesystem;
|
|
|
|
int main(int argc, char** argv)
|
|
|
|
int main(int argc, char** argv)
|
|
|
@ -16,18 +17,14 @@ int main(int argc, char** argv)
|
|
|
|
|
|
|
|
|
|
|
|
// read each .obj file from directory into std::vector...
|
|
|
|
// read each .obj file from directory into std::vector...
|
|
|
|
std::vector<lnk::obj_buffer_t> image_objs;
|
|
|
|
std::vector<lnk::obj_buffer_t> image_objs;
|
|
|
|
for (auto& file : fs::recursive_directory_iterator(argv[1]))
|
|
|
|
if (!lnk::get_objs(argv[1], image_objs))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!strcmp(file.path().extension().string().c_str(), ".obj"))
|
|
|
|
std::printf("> failed to parse lib...\n");
|
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
lnk::obj_buffer_t obj_buffer;
|
|
|
|
|
|
|
|
utils::open_binary_file(file.path().string(), obj_buffer);
|
|
|
|
|
|
|
|
image_objs.push_back(obj_buffer);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
std::printf("> number of objs = %d\n", image_objs.size());
|
|
|
|
std::printf("> number of objs = %d\n", image_objs.size());
|
|
|
|
const auto [drv_handle, drv_key, drv_status] = vdm::load_drv();
|
|
|
|
/*const auto [drv_handle, drv_key, drv_status] = vdm::load_drv();
|
|
|
|
|
|
|
|
|
|
|
|
if (drv_status != STATUS_SUCCESS || drv_handle == INVALID_HANDLE_VALUE)
|
|
|
|
if (drv_status != STATUS_SUCCESS || drv_handle == INVALID_HANDLE_VALUE)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -78,6 +75,17 @@ int main(int argc, char** argv)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
);
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
|
|
|
|
|
};*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
drv::kalloc_t _kalloc = [&](std::size_t size) -> void*
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return malloc(size);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
drv::kmemcpy_t _kmemcpy =
|
|
|
|
|
|
|
|
[&](void* dest, const void* src, std::size_t size) -> void*
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return memcpy(dest, src, size);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
drv::hmdm_ctx drv_mapper({ _kalloc, _kmemcpy });
|
|
|
|
drv::hmdm_ctx drv_mapper({ _kalloc, _kmemcpy });
|
|
|
@ -86,7 +94,7 @@ int main(int argc, char** argv)
|
|
|
|
std::printf("\n\n> driver entry -> 0x%p\n", drv_entry);
|
|
|
|
std::printf("\n\n> driver entry -> 0x%p\n", drv_entry);
|
|
|
|
std::getchar();
|
|
|
|
std::getchar();
|
|
|
|
|
|
|
|
|
|
|
|
int result;
|
|
|
|
/*int result;
|
|
|
|
msrexec.exec([&result, drv_entry = drv_entry]
|
|
|
|
msrexec.exec([&result, drv_entry = drv_entry]
|
|
|
|
(void* krnl_base, get_system_routine_t get_kroutine) -> void
|
|
|
|
(void* krnl_base, get_system_routine_t get_kroutine) -> void
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -99,7 +107,7 @@ int main(int argc, char** argv)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::printf("> failed to unload driver... reason -> 0x%x\n", unload_status);
|
|
|
|
std::printf("> failed to unload driver... reason -> 0x%x\n", unload_status);
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
|
|
std::printf("> press enter to close...\n");
|
|
|
|
std::printf("> press enter to close...\n");
|
|
|
|
std::getchar();
|
|
|
|
std::getchar();
|
|
|
|