Tools/Extractors: Support specifying which wow version to open when installed to the same directory (retail/ptr/other)

This commit is contained in:
Shauren
2019-06-19 20:00:14 +02:00
parent 658a79d94a
commit 9bb85965e1
4 changed files with 34 additions and 10 deletions

View File

@@ -55,10 +55,16 @@ void CASC::FileDeleter::operator()(HANDLE handle)
::CascCloseFile(handle);
}
CASC::StorageHandle CASC::OpenStorage(boost::filesystem::path const& path, DWORD localeMask)
CASC::StorageHandle CASC::OpenStorage(boost::filesystem::path const& path, DWORD localeMask, char const* product)
{
std::string strPath = path.string();
CASC_OPEN_STORAGE_ARGS args = {};
args.Size = sizeof(CASC_OPEN_STORAGE_ARGS);
args.szLocalPath = strPath.c_str();
args.szCodeName = product;
args.dwLocaleMask = localeMask;
HANDLE handle = nullptr;
if (!::CascOpenStorage(path.string().c_str(), localeMask, &handle))
if (!::CascOpenStorageEx(nullptr, &args, false, &handle))
{
DWORD lastError = GetLastError(); // support checking error set by *Open* call, not the next *Close*
printf("Error opening casc storage '%s': %s\n", path.string().c_str(), HumanReadableCASCError(lastError));

View File

@@ -48,7 +48,7 @@ namespace CASC
char const* HumanReadableCASCError(DWORD error);
StorageHandle OpenStorage(boost::filesystem::path const& path, DWORD localeMask);
StorageHandle OpenStorage(boost::filesystem::path const& path, DWORD localeMask, char const* product);
DWORD GetBuildNumber(StorageHandle const& storage);
DWORD GetInstalledLocalesMask(StorageHandle const& storage);
bool HasTactKey(StorageHandle const& storage, ULONGLONG keyLookup);