rendered paste body CStack<HANDLE> *__stdcall LoadMpqsFromPrivateProfileConfig(char *IniFile, char *BaseDirectory, HANDLE hParentMpq) { SFileEnableDirectAccess(SFILE_SCOPE_APPEND_TO_CUR_DIR | SFILE_SCOPE_CUR_DIR); CStack<HANDLE> *Mpqs = new CStack<HANDLE>(); char SectionBuffer[1024 * 5 + 1]; GetPrivateProfileSection("MPQS", SectionBuffer, 1024 * 5, IniFile); char *Line = SectionBuffer; while (*Line != 0) { size_t Len = strlen(Line); char *Value = strchr(Line, '='); if (Value == 0) Value = Line; else Value++; char *Priority = strchr(Value, ';'); if (Priority == 0) goto cycle; *Priority++ = 0; HANDLE hMpq = INVALID_HANDLE_VALUE; char MPQ[MAX_PATH]; if((_memicmp(Value, "file:", 5) == 0 && PathCombine(MPQ, BaseDirectory, Value + 5) != 0 && SFileOpenArchive(MPQ, atoi(Priority), 0, &hMpq)) ||(_memicmp(Value, "dir:", 4) == 0 && PathCombine(MPQ, BaseDirectory, Value + 4) != 0 && SFileOpenPathAsArchive(hParentMpq, MPQ, atoi(Priority), 0, &hMpq))) { Mpqs->push(hMpq); } cycle: Line += strlen(Line) + 1; } return Mpqs; }}