Browse Source

Made API Keys editable during Runtime

master
Tillman Staffen 1 month ago
parent
commit
b23a14fa16
  1. BIN
      Unreal/Content/SPIE/Widgets/Debug/W_DebugSPIEPage.uasset
  2. BIN
      Unreal/Plugins/BTools/Content/ConfigPawn/ConfigPawn.uasset
  3. BIN
      Unreal/Plugins/BTools/Content/DebugWidget/ChildWidgets/W_DebugWidget_EditableField.uasset
  4. 97
      Unreal/Plugins/BTools/Source/BTools/Private/BToolsBPLibrary.cpp

BIN
Unreal/Content/SPIE/Widgets/Debug/W_DebugSPIEPage.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Unreal/Plugins/BTools/Content/ConfigPawn/ConfigPawn.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Unreal/Plugins/BTools/Content/DebugWidget/ChildWidgets/W_DebugWidget_EditableField.uasset (Stored with Git LFS)

Binary file not shown.

97
Unreal/Plugins/BTools/Source/BTools/Private/BToolsBPLibrary.cpp

@ -26,7 +26,7 @@
#include <TlHelp32.h>
//Create Shortscuts on Runtime
#include "Windows/AllowWindowsPlatformTypes.h"
#include <Windows.h>
#include "Windows/WindowsHWrapper.h"
#include <shobjidl.h>
#include <shlguid.h>
#include "Windows/HideWindowsPlatformTypes.h"
@ -69,42 +69,54 @@ void UBToolsBPLibrary::TerminateProc(FTheProcHandle procHandle)
bool UBToolsBPLibrary::KillProcessByName(FString Name)
{
bool killedProg = false;
#if PLATFORM_WINDOWS
bool bKilledProcess = false;
if (Name.IsEmpty())
{
return false;
}
FString ProcNameWithExtension = Name;
if (ProcNameWithExtension.Find(TEXT(".exe"), ESearchCase::IgnoreCase, ESearchDir::FromEnd) == INDEX_NONE)
if (!ProcNameWithExtension.EndsWith(TEXT(".exe"), ESearchCase::IgnoreCase))
{
ProcNameWithExtension += TEXT(".exe");
}
HANDLE SnapShot = ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (SnapShot != INVALID_HANDLE_VALUE)
const HANDLE Snapshot = ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (Snapshot == INVALID_HANDLE_VALUE)
{
PROCESSENTRY32 Entry;
Entry.dwSize = sizeof(PROCESSENTRY32);
return false;
}
if (::Process32First(SnapShot, &Entry)) //Kill all progamms with there is more than one
PROCESSENTRY32 Entry = {};
Entry.dwSize = sizeof(PROCESSENTRY32);
if (::Process32First(Snapshot, &Entry))
{
do
{
do
if (FCString::Stricmp(*ProcNameWithExtension, Entry.szExeFile) == 0)
{
if (FCString::Stricmp(*ProcNameWithExtension, Entry.szExeFile) == 0)
const HANDLE ProcessHandle = ::OpenProcess(PROCESS_TERMINATE, false, Entry.th32ProcessID);
if (ProcessHandle)
{
HANDLE processHandle = OpenProcess(PROCESS_ALL_ACCESS, false, Entry.th32ProcessID);
TerminateProcess(processHandle, 0);
//FPlatformProcess::TerminateProc(SnapShot, true);
killedProg = true;
if (::TerminateProcess(ProcessHandle, 0))
{
bKilledProcess = true;
}
::CloseHandle(ProcessHandle);
}
} while (::Process32Next(SnapShot, &Entry));
}
}
} while (::Process32Next(Snapshot, &Entry));
}
::CloseHandle(SnapShot);
::CloseHandle(Snapshot);
return bKilledProcess;
#else
return false;
#endif
return killedProg;
}
int UBToolsBPLibrary::KillProcessesByPath(FString Dir)
@ -169,36 +181,45 @@ bool UBToolsBPLibrary::IsProgramRunningByName(FString ProcName)
{
#if PLATFORM_WINDOWS
if (ProcName.IsEmpty())
{
return false;
}
FString ProcNameWithExtension = ProcName;
if (ProcNameWithExtension.Find(TEXT(".exe"), ESearchCase::IgnoreCase, ESearchDir::FromEnd) == INDEX_NONE)
if (!ProcNameWithExtension.EndsWith(TEXT(".exe"), ESearchCase::IgnoreCase))
{
ProcNameWithExtension += TEXT(".exe");
}
HANDLE SnapShot = ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (SnapShot != INVALID_HANDLE_VALUE)
const HANDLE Snapshot = ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (Snapshot == INVALID_HANDLE_VALUE)
{
PROCESSENTRY32 Entry;
Entry.dwSize = sizeof(PROCESSENTRY32);
return false;
}
if (::Process32First(SnapShot, &Entry))
bool bIsRunning = false;
PROCESSENTRY32 Entry = {};
Entry.dwSize = sizeof(PROCESSENTRY32);
if (::Process32First(Snapshot, &Entry))
{
do
{
do
if (FCString::Stricmp(*ProcNameWithExtension, Entry.szExeFile) == 0)
{
if (FCString::Stricmp(*ProcNameWithExtension, Entry.szExeFile) == 0)
{
return true;
}
} while (::Process32Next(SnapShot, &Entry));
}
bIsRunning = true;
break;
}
} while (::Process32Next(Snapshot, &Entry));
}
::CloseHandle(SnapShot);
#endif
::CloseHandle(Snapshot);
return bIsRunning;
#else
return false;
#endif
}
FString UBToolsBPLibrary::GetLocalAppDataPath()

Loading…
Cancel
Save