Skip to content

Commit

Permalink
Update for new USVFS function scheme.
Browse files Browse the repository at this point in the history
  • Loading branch information
Holt59 committed Jun 8, 2024
1 parent 3d18f0c commit 9ca181c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
3 changes: 2 additions & 1 deletion src/spawn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,8 @@ DWORD spawn(const SpawnParameters& sp, HANDLE& processHandle)
const DWORD flags = CREATE_BREAKAWAY_FROM_JOB;

if (sp.hooked) {
success = ::CreateProcessHooked(nullptr, const_cast<wchar_t*>(wcommandLine.c_str()),
success = ::usvfsCreateProcessHooked(
nullptr, const_cast<wchar_t*>(wcommandLine.c_str()),
nullptr, nullptr, inheritHandles, flags, nullptr,
wcwd.c_str(), &si, &pi);
} else {
Expand Down
30 changes: 15 additions & 15 deletions src/usvfsconnector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ void LogWorker::process()

int noLogCycles = 0;
while (!m_QuitRequested) {
if (GetLogMessages(&m_Buffer[0], m_Buffer.size(), false)) {
if (usvfsGetLogMessages(&m_Buffer[0], m_Buffer.size(), false)) {
m_LogFile.write(m_Buffer.c_str());
m_LogFile.write("\n");
m_LogFile.flush();
Expand Down Expand Up @@ -142,7 +142,7 @@ UsvfsConnector::UsvfsConnector()
usvfsSetCrashDumpPath(params, dumpPath.c_str());
usvfsSetProcessDelay(params, delay.count());

InitLogging(false);
usvfsInitLogging(false);

log::debug("initializing usvfs:\n"
" . instance: {}\n"
Expand All @@ -154,13 +154,13 @@ UsvfsConnector::UsvfsConnector()
usvfsCreateVFS(params);
usvfsFreeParameters(params);

ClearExecutableBlacklist();
usvfsClearExecutableBlacklist();
for (auto exec : s.executablesBlacklist().split(";")) {
std::wstring buf = exec.toStdWString();
BlacklistExecutable(buf.data());
usvfsBlacklistExecutable(buf.data());
}

ClearLibraryForceLoads();
usvfsClearLibraryForceLoads();

m_LogWorker.moveToThread(&m_WorkerThread);

Expand All @@ -172,7 +172,7 @@ UsvfsConnector::UsvfsConnector()

UsvfsConnector::~UsvfsConnector()
{
DisconnectVFS();
usvfsDisconnectVFS();
m_LogWorker.exit();
m_WorkerThread.quit();
m_WorkerThread.wait();
Expand All @@ -193,11 +193,11 @@ void UsvfsConnector::updateMapping(const MappingType& mapping)

log::debug("Updating VFS mappings...");

ClearVirtualMappings();
usvfsClearVirtualMappings();

for (auto map : mapping) {
if (progress.wasCanceled()) {
ClearVirtualMappings();
usvfsClearVirtualMappings();
throw UsvfsConnectorException("VFS mapping canceled by user");
}
progress.setValue(value++);
Expand All @@ -206,12 +206,12 @@ void UsvfsConnector::updateMapping(const MappingType& mapping)
}

if (map.isDirectory) {
VirtualLinkDirectoryStatic(
usvfsVirtualLinkDirectoryStatic(
map.source.toStdWString().c_str(), map.destination.toStdWString().c_str(),
(map.createTarget ? LINKFLAG_CREATETARGET : 0) | LINKFLAG_RECURSIVE);
++dirs;
} else {
VirtualLinkFile(map.source.toStdWString().c_str(),
usvfsVirtualLinkFile(map.source.toStdWString().c_str(),
map.destination.toStdWString().c_str(), 0);
++files;
}
Expand Down Expand Up @@ -243,20 +243,20 @@ void UsvfsConnector::updateParams(MOBase::log::Levels logLevel,
usvfsUpdateParameters(p);
usvfsFreeParameters(p);

ClearExecutableBlacklist();
usvfsClearExecutableBlacklist();
for (auto exec : executableBlacklist.split(";")) {
std::wstring buf = exec.toStdWString();
BlacklistExecutable(buf.data());
usvfsBlacklistExecutable(buf.data());
}
}

void UsvfsConnector::updateForcedLibraries(
const QList<MOBase::ExecutableForcedLoadSetting>& forcedLibraries)
{
ClearLibraryForceLoads();
usvfsClearLibraryForceLoads();
for (auto setting : forcedLibraries) {
if (setting.enabled()) {
ForceLoadLibrary(setting.process().toStdWString().data(),
usvfsForceLoadLibrary(setting.process().toStdWString().data(),
setting.library().toStdWString().data());
}
}
Expand All @@ -269,7 +269,7 @@ std::vector<HANDLE> getRunningUSVFSProcesses()
{
size_t count = 0;
DWORD* buffer = nullptr;
if (!::GetVFSProcessList2(&count, &buffer)) {
if (!::usvfsGetVFSProcessList2(&count, &buffer)) {
log::error("failed to get usvfs process list");
return {};
}
Expand Down

0 comments on commit 9ca181c

Please sign in to comment.