summaryrefslogtreecommitdiffhomepage
path: root/src/ldso
diff options
context:
space:
mode:
Diffstat (limited to 'src/ldso')
-rw-r--r--src/ldso/pe_load_framework_loader_ex.c74
1 files changed, 74 insertions, 0 deletions
diff --git a/src/ldso/pe_load_framework_loader_ex.c b/src/ldso/pe_load_framework_loader_ex.c
new file mode 100644
index 0000000..80aa8b1
--- /dev/null
+++ b/src/ldso/pe_load_framework_loader_ex.c
@@ -0,0 +1,74 @@
+/*****************************************************************************/
+/* pemagination: a (virtual) tour into portable bits and executable bytes */
+/* Copyright (C) 2013--2017 Z. Gilboa */
+/* Released under GPLv2 and GPLv3; see COPYING.PEMAGINE. */
+/*****************************************************************************/
+
+#include <psxtypes/psxtypes.h>
+#include <pemagine/pemagine.h>
+#include "pe_os.h"
+
+int32_t pe_load_framework_loader_ex(
+ void ** baseaddr,
+ void ** hroot,
+ void ** hdsodir,
+ const struct pe_guid * abi,
+ const wchar16_t * basename,
+ const wchar16_t * rrelname,
+ void * refaddr,
+ uintptr_t * buffer,
+ uint32_t bufsize,
+ uint32_t flags,
+ uint32_t * sysflags)
+{
+ int32_t status;
+ struct pe_framework_runtime_data * rtdata;
+ struct pe_framework_runtime_data context;
+
+ status = pe_get_framework_runtime_data(
+ &rtdata,
+ pe_get_peb_command_line(),
+ abi);
+
+ if (status) {
+ context.hself = 0;
+ context.hparent = 0;
+ context.himage = 0;
+ context.hroot = 0;
+ context.hdsodir = 0;
+ context.hloader = 0;
+ context.hcwd = 0;
+ context.hdrive = 0;
+
+ context.abi.data1 = abi->data1;
+ context.abi.data1 = abi->data2;
+ context.abi.data1 = abi->data3;
+
+ context.abi.data4[0] = abi->data4[0];
+ context.abi.data4[1] = abi->data4[1];
+ context.abi.data4[2] = abi->data4[2];
+ context.abi.data4[3] = abi->data4[3];
+ context.abi.data4[4] = abi->data4[4];
+ context.abi.data4[5] = abi->data4[5];
+ context.abi.data4[6] = abi->data4[6];
+ context.abi.data4[7] = abi->data4[7];
+
+ rtdata = &context;
+ }
+
+ if ((status = pe_find_framework_loader(
+ rtdata,basename,rrelname,refaddr,
+ buffer,bufsize,flags)))
+ return status;
+
+ if ((status = pe_load_framework_loader(
+ baseaddr,rtdata,
+ buffer,bufsize,
+ sysflags)))
+ return status;
+
+ *hroot = rtdata->hroot;
+ *hdsodir = rtdata->hdsodir;
+
+ return OS_STATUS_SUCCESS;
+}