Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- *
- Purpose: Xenus NTOS emulator entrypoint.
- Author: Reece W.
- License: All Rights Reserved J. Reece Wilson
- */
- #include <xenus_lazy.h>
- #include <liblinux.hpp>
- #include <ITypes\ITaskStruct.hpp>
- // C++ test
- class TestClass
- {
- size_t _seconds;
- public:
- TestClass(size_t seconds)
- {
- _seconds = seconds;
- }
- void test()
- {
- printf("This is C++, and I'm fucking off for %i seconds\n", _seconds);
- ssleep(_seconds);
- printf("Genetic failure error code: %i %i \n", XENUS_ERROR_GENERIC_FAILURE, kErrorGenericFailure);
- printf("Nested call, no error, status code: %i %i \n", XENUS_STATUS_NESTED_CALL, kStatusNestedCall);
- };
- };
- // current/task_struct test
- void test_current()
- {
- ITaskStruct test(current);
- print("Current (struct task_struct): \n");
- printf("State: %p \n", test.get_var_state().GetInt()); //state hasn't been implemented, but we can still read/write to it via a slightly more resource intensive variable int datatype
- printf("On CPU: %i \n", test.get_on_cpu()); //on_cpu has been implemented; we can access it with get_on_cpu & set_on_cpu
- }
- static mod_global_data_t ntos_module = { 0 };
- bool subsystem_ntos_init(mod_dependency_list_p deps)
- {
- return true;
- }
- int subsystem_ntos_start()
- {
- test_current();
- (new TestClass(3))->test();
- return 1;
- }
- void subsystem_ntos_shutdown()
- {
- }
- void entrypoint(xenus_entrypoint_ctx_p context)
- {
- /* Do note, the IAT is still NULL'd at this moment in time! */
- context->size = sizeof(xenus_entrypoint_ctx_t);
- context->description = "An emulation attempt of the Microsoft Windows� Kernel (ntos.exe).";
- context->copyright = "All rights reserved, Reece Wilson (2018)";
- context->init = subsystem_ntos_init;
- context->start = subsystem_ntos_start;
- context->shutdown = subsystem_ntos_shutdown;
- context->dependencies.count = 0;
- context->static_data = &ntos_module;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement