Satisfy hardened runtime dyld path reqs in Win32API

This commit is contained in:
Struma 2021-04-15 23:59:27 -04:00 committed by Roza
parent 7f35003e3f
commit f583683609
2 changed files with 239 additions and 232 deletions

View file

@ -5,20 +5,21 @@
#include <SDL.h>
#include <cstdint>
#include "filesystem/filesystem.h"
#include "miniffi.h"
#include "binding-util.h"
#if defined(__linux__) || defined(__APPLE__)
#define MVAL2RB(v) ULONG2NUM(v)
#define RB2MVAL(v) (mffi_value)NUM2ULONG(v)
#define MVAL2RB(v) ULONG2NUM(v)
#define RB2MVAL(v) (mffi_value)NUM2ULONG(v)
#else
#ifdef __MINGW64__
#define MVAL2RB(v) ULL2NUM(v)
#define RB2MVAL(v) (mffi_value)NUM2ULL(v)
#else
#define MVAL2RB(v) UINT2NUM(v)
#define RB2MVAL(v) (mffi_value)NUM2UINT(v)
#endif
#ifdef __MINGW64__
#define MVAL2RB(v) ULL2NUM(v)
#define RB2MVAL(v) (mffi_value)NUM2ULL(v)
#else
#define MVAL2RB(v) UINT2NUM(v)
#define RB2MVAL(v) (mffi_value)NUM2UINT(v)
#endif
#endif
#define _T_VOID 0
@ -81,7 +82,11 @@ RB_METHOD(MiniFFI_initialize) {
rb_scan_args(argc, argv, "22", &libname, &func, &imports, &exports);
SafeStringValue(libname);
SafeStringValue(func);
#ifdef __MACOSX__
void *hlib = SDL_LoadObject(mkxp_fs::normalizePath(RSTRING_PTR(libname), 1, 1).c_str());
#else
void *hlib = SDL_LoadObject(RSTRING_PTR(libname));
#endif
setPrivateData(self, hlib);
void *hfunc = MiniFFI_GetFunctionHandle(hlib, RSTRING_PTR(func));
#ifdef __WIN32__

View file

@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
<true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.cs.disable-library-validation</key>