Permalink
Browse files

Don't try to load non .dll/.so files as plugins

since desktop.ini and/or thumb.db files tend to get created
  • Loading branch information...
UnknownShadow200 committed Feb 9, 2019
1 parent 2ae8fd9 commit bea0405984498446b0d175d824ddb6b1b20d36c4
Showing with 10 additions and 4 deletions.
  1. +10 −3 src/Game.c
  2. +0 −1 src/Platform.c
@@ -377,15 +377,22 @@ static void Game_LoadOptions(void) {
}

static void Game_LoadPlugin(const String* filename, void* obj) {
const static String txt = String_FromConst(".txt");
#if defined CC_BUILD_WIN
const static String ext = String_FromConst(".dll");
#elif defined CC_BUILD_OSX
const static String ext = String_FromConst(".dylib");
#else
const static String ext = String_FromConst(".so");
#endif

void* lib;
void* verSymbol; /* EXPORT int Plugin_ApiVersion = GAME_API_VER; */
void* compSymbol; /* EXPORT struct IGameComponent Plugin_Component = { (whatever) } */
int ver;
ReturnCode res;

/* ignore classicalsharp's accepted.txt */
if (String_CaselessEnds(filename, &txt)) return;
/* ignore accepted.txt, deskop.ini, .pdb files, etc */
if (!String_CaselessEnds(filename, &ext)) return;
res = Platform_LoadLibrary(filename, &lib);
if (res) { Logger_Warn2(res, "loading plugin", filename); return; }

@@ -33,7 +33,6 @@ void* DisplayDevice_Meta;
#include <windows.h>
#include <winsock2.h>
#include <ws2tcpip.h>
#include <wininet.h>
#include <mmsystem.h>
#include <shellapi.h>
#include <wincrypt.h>

0 comments on commit bea0405

Please sign in to comment.