Sha256: 8d7381b25b98af2a35627994442d515cdcc53f7b0f193ad56a7ce352fba08745

Contents?: true

Size: 749 Bytes

Versions: 22

Compression:

Stored size: 749 Bytes

Contents

#include <windows.h>
#include <string>
using namespace std;

BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
	// Append .so parent folder to PATH to make extensions (e.g. FMOD.dll) loadable.
	
	if (fdwReason == DLL_PROCESS_ATTACH)
	{
		TCHAR buffer[MAX_PATH+1];
		if (GetModuleFileName(hinstDLL, buffer, MAX_PATH+1))
		{
			// Make last backslash a \0 (get parent directory)
			TCHAR* ptr = buffer;
			while (*ptr) ++ptr;
			while (*ptr != '\\' && *ptr != '/')
				if (ptr < buffer)
					return TRUE;
				else
					--ptr;
			*ptr = 0;

			wstring oldPath = _wgetenv(L"PATH");
			wstring envString = L"PATH=" + oldPath + L';' + buffer;
			_wputenv(envString.c_str());
		}
	}
	return TRUE;
}

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
gosu-0.7.26.1 GosuImpl/RubyGosu_DllMain.cxx
gosu-0.7.26 GosuImpl/RubyGosu_DllMain.cxx
gosu-0.7.25 GosuImpl/RubyGosu_DllMain.cxx
gosu-0.7.24 GosuImpl/RubyGosu_DllMain.cxx
gosu-0.7.23 GosuImpl/RubyGosu_DllMain.cxx
gosu-0.7.22 GosuImpl/RubyGosu_DllMain.cxx
gosu-0.7.21 GosuImpl/RubyGosu_DllMain.cxx
gosu-0.7.20 GosuImpl/RubyGosu_DllMain.cxx
gosu-0.7.19 GosuImpl/RubyGosu_DllMain.cxx
gosu-0.7.18 GosuImpl/RubyGosu_DllMain.cxx
gosu-0.7.17 GosuImpl/RubyGosu_DllMain.cxx
gosu-0.7.16 GosuImpl/RubyGosu_DllMain.cxx
gosu-0.7.15 GosuImpl/RubyGosu_DllMain.cxx
gosu-0.7.14 GosuImpl/RubyGosu_DllMain.cxx
gosu-0.7.10.1 GosuImpl/RubyGosu_DllMain.cxx
gosu-0.7.10.2 GosuImpl/RubyGosu_DllMain.cxx
gosu-0.7.10.3 GosuImpl/RubyGosu_DllMain.cxx
gosu-0.7.11 GosuImpl/RubyGosu_DllMain.cxx
gosu-0.7.12 GosuImpl/RubyGosu_DllMain.cxx
gosu-0.7.13.2 GosuImpl/RubyGosu_DllMain.cxx