Sha256: d760e0aa867d419999dad6135e369102f2fe95ff7c9412d0124405103e06a8a6

Contents?: true

Size: 829 Bytes

Versions: 8

Compression:

Stored size: 829 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. audiere.dll) loadable.
	// TODO: This sounds like a risky thing wrt security, but does this matter?

	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

8 entries across 8 versions & 1 rubygems

Version Path
gosu-0.7.33 GosuImpl/RubyGosu_DllMain.cxx
gosu-0.7.32 GosuImpl/RubyGosu_DllMain.cxx
gosu-0.7.31 GosuImpl/RubyGosu_DllMain.cxx
gosu-0.7.30 GosuImpl/RubyGosu_DllMain.cxx
gosu-0.7.29 GosuImpl/RubyGosu_DllMain.cxx
gosu-0.7.28 GosuImpl/RubyGosu_DllMain.cxx
gosu-0.7.27.1 GosuImpl/RubyGosu_DllMain.cxx
gosu-0.7.27 GosuImpl/RubyGosu_DllMain.cxx