Skip to content

Instantly share code, notes, and snippets.

@hasherezade
Created Oct 23, 2021
Embed
What would you like to do?
FlareOn 8 - Task 7 (loader)
cmake_minimum_required ( VERSION 2.8...3.21 )
project (spell_loader)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
set (srcs
main.cpp
)
set (hdrs
resource.h
)
set (rsrc
resource.rc
)
add_executable( ${PROJECT_NAME} ${rsrc} ${hdrs} ${srcs} )
INSTALL( TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX} COMPONENT ${PROJECT_NAME} )
#include <windows.h>
#include <iostream>
int main()
{
HMODULE lib = LoadLibraryA("ldr.dll");
if (!lib) {
return -1;
}
FARPROC func = GetProcAddress(lib, "Start");
if (!func) {
return -2;
}
std::cout << "Calling the start function..." << std::endl;
int(*exp_func)() = (int(*)())func;
func();
system("pause");
return 0;
}
// resource.h
#define MY_RESOURCE 128
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "windows.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""windows.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
MY_RESOURCE PNG "_1_429cc0.png"
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment