Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define fbc -dll -x "LoadExe.dll"
- #include "crt.bi"
- #include "windows.bi"
- Dim Shared exeEntryPoint as Sub(hInstance as HINSTANCE, hPrevInstance as HINSTANCE, szCmdLine as PSTR, iCmdShow as Integer)
- extern "windows-ms"
- sub LauncherMain(hwnd as HWND, hinst as HINSTANCE, szCmdLine as zstring, nCmdShow as integer) export
- AllocConsole()
- print szCmdLine
- if open(szCmdLine for binary access read as #1) then
- MessageBox(NULL, "Could not open file """+szCmdLine+"""", "ERROR", MB_ICONERROR)
- system
- end if
- dim as ubyte ptr exeBuff
- exeBuff = malloc(lof(1)) ' Allocate buffer for exe
- get #1,, *exeBuff, lof(1)
- Dim as IMAGE_OPTIONAL_HEADER PEHeader
- memcpy(exeBuff, @PEHeader, sizeof(IMAGE_OPTIONAL_HEADER))
- exeEntryPoint = cast(any ptr, PEHeader.AddressOfEntryPoint)
- sleep
- exeEntryPoint(hinst, NULL, szCmdLine, nCmdShow)
- sleep
- end sub
- end extern
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement