Yes... That's why I wrote that you should search for the WRS header...

Here is a quick and untested implementation:
Code:
char *_acknex_dll  = NULL;
char *_default_wrs = NULL;

void reload_defaultWRS()
{
	if(!_acknex_dll)
	{
		// Read the acknex.dll in
		FILE *file = fopen(_chr(str_printf(NULL, "%s\\%s", _chr(exe_dir), "acknex.dll")), "rb");
		fseek(file, 0, SEEK_END);
		long length = ftell(file);
		fseek(file, 0, SEEK_SET);

		_acknex_dll = malloc(length);
		fread(_acknex_dll, length, 1 file);
		fclose(file);

		// Look for the WRS resource
		char *temp = _acknex_dll;
		while(1)
		{
			temp = strstr(temp, "WRS3");
			if(!temp)
				break;

			if(temp[4] == '\0') // strings in the string section are terminated with a 0 byte, so if there is one, this isn't the WRS we are looking for
			{
				temp += 4;
				continue;
			}

			_default_wrs = temp;
			break;
		}
	}

	if(!_default_wrs)
	{
		error("Couldn't find default WRS!");
		return;
	}

	add_resource(_default_wrs);
}



Edit: Dunno if Lite-C has strstr() or not... If it doesn't, here is an implementation:
Code:
char *strstr(char *str1, const char *str2)
{
	size_t index = 0;
	size_t length = strlen(str2);
	char *start = NULL;
	
	for(; *str1 != '\0'; str1++)
	{
		if(*str1 == str2[index])
		{
			if(index == 0)
				start = str1;
			
			index ++;
			if(index == length)
				return start;
		}
		else
		{
			index = 0;
		}
	}
	
	return NULL;
}


Last edited by JustSid; 01/16/14 17:54.

Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com