[*] Minor UWP progress

This commit is contained in:
Reece Wilson 2024-04-21 11:37:00 +01:00
parent 76b5466e87
commit c26eaf86a7
6 changed files with 91 additions and 25 deletions

View File

@ -270,6 +270,7 @@ namespace Aurora
ADD_GET_PROC(Nt, NtQuerySymbolicLinkObject)
ADD_GET_PROC(Nt, NtOpenSymbolicLinkObject)
ADD_GET_PROC(Nt, NtWaitForMultipleObjects)
ADD_GET_PROC(Nt, NtQuerySystemInformation)
ADD_GET_PROC_BI(Kernel32, KernelBase, VirtualAlloc2)
ADD_GET_PROC_BI(Kernel32, KernelBase, MapViewOfFile)
@ -305,6 +306,10 @@ namespace Aurora
ADD_GET_PROC(Kernel32, RemoveDllDirectory)
ADD_GET_PROC(Kernel32, AddDllDirectory)
ADD_GET_PROC(Kernel32, SetProcessInformation)
ADD_GET_PROC(Kernel32, GetNamedPipeClientProcessId)
ADD_GET_PROC(Kernel32, Module32FirstW)
ADD_GET_PROC(Kernel32, Module32NextW)
ADD_GET_PROC(Kernel32, CreateJobObjectW)
ADD_GET_PROC(Kernel32, GetConsoleScreenBufferInfo)
ADD_GET_PROC(Kernel32, SetConsoleScreenBufferSize)
@ -912,6 +917,11 @@ namespace Aurora
HMODULE UWPLibraryW(LPCWSTR lpLibFileName)
{
auto pos = std::basic_string_view<wchar_t>(lpLibFileName).find_last_of('/');
if (pos == std::basic_string_view<wchar_t>::npos)
{
pos = std::basic_string_view<wchar_t>(lpLibFileName).find_last_of('\\');
}
if (pos == std::basic_string_view<wchar_t>::npos)
{
#if defined(AURORA_HAS_LOAD_PGKD)

View File

@ -26,12 +26,14 @@ struct _NETRESOURCEW;
struct _CONSOLE_SCREEN_BUFFER_INFO;
struct _SMALL_RECT;
struct _CHAR_INFO;
struct tagMODULEENTRY32W;
enum _TOKEN_INFORMATION_CLASS;
enum _SE_OBJECT_TYPE;
enum _MINIDUMP_TYPE;
enum _OBJECT_WAIT_TYPE;
enum _SE_OBJECT_TYPE;
enum _PROCESS_INFORMATION_CLASS;
enum _SYSTEM_INFORMATION_CLASS;
//#if defined(AURORA_COMPILER_MSVC)
struct _IP_ADAPTER_ADDRESSES_LH;
@ -377,8 +379,8 @@ namespace Aurora
DWORD dwDesiredAccess,
DWORD dwShareMode,
CONST _SECURITY_ATTRIBUTES *lpSecurityAttributes,
DWORD dwFlags,
LPVOID lpScreenBufferData
DWORD dwFlags,
LPVOID lpScreenBufferData
);
inline BOOL(__stdcall *pSetConsoleCursorPosition)(
@ -425,25 +427,45 @@ namespace Aurora
);
inline BOOL(__stdcall *pReadConsoleInputW)(
HANDLE hConsoleInput,
_INPUT_RECORD * lpBuffer,
DWORD nLength,
LPDWORD lpNumberOfEventsRead
HANDLE hConsoleInput,
_INPUT_RECORD * lpBuffer,
DWORD nLength,
LPDWORD lpNumberOfEventsRead
);
inline BOOL(__stdcall *pWriteConsoleInputW)(
HANDLE hConsoleInput,
CONST _INPUT_RECORD * lpBuffer,
DWORD nLength,
LPDWORD lpNumberOfEventsWritten
HANDLE hConsoleInput,
CONST _INPUT_RECORD * lpBuffer,
DWORD nLength,
LPDWORD lpNumberOfEventsWritten
);
inline BOOL(__stdcall *pWriteConsoleW)(
HANDLE hConsoleInput,
CONST wchar_t * lpBuffer,
DWORD nLength,
LPDWORD lpNumberOfEventsWritten,
void * pReserved
HANDLE hConsoleInput,
CONST wchar_t * lpBuffer,
DWORD nLength,
LPDWORD lpNumberOfEventsWritten,
void * pReserved
);
inline BOOL(__stdcall *pGetNamedPipeClientProcessId)(
HANDLE Pipe,
PULONG ClientProcessId
);
inline BOOL(__stdcall *pModule32FirstW)(
HANDLE Pipe,
tagMODULEENTRY32W * lpme
);
inline BOOL(__stdcall *pModule32NextW)(
HANDLE Pipe,
tagMODULEENTRY32W * lpme
);
inline HANDLE(__stdcall *pCreateJobObjectW)(
LPSECURITY_ATTRIBUTES lpJobAttributes,
LPCWSTR lpName
);
inline BOOL(__stdcall *pPrefetchVirtualMemory)(
@ -480,6 +502,13 @@ namespace Aurora
);
#endif
inline NTSTATUS(__stdcall *pNtQuerySystemInformation)(
_SYSTEM_INFORMATION_CLASS SystemInformationClass,
PVOID SystemInformation,
ULONG SystemInformationLength,
PULONG ReturnLength
);
inline ULONGLONG(__stdcall *pVerSetConditionMask)(
ULONGLONG ConditionMask,
DWORD TypeMask,

View File

@ -252,12 +252,18 @@ namespace Aurora::HWInfo
#else
SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION processorInfo[128];
#endif
if (!pNtQuerySystemInformation)
{
SysPushErrorFeatureMissing();
return false;
}
ULONG uOutLen {};
if (FAILED(NtQuerySystemInformation(SystemProcessorPerformanceInformation,
&processorInfo,
sizeof(processorInfo),
&uOutLen)))
if (FAILED(pNtQuerySystemInformation(SystemProcessorPerformanceInformation,
&processorInfo,
sizeof(processorInfo),
&uOutLen)))
{
return false;
}

View File

@ -78,8 +78,14 @@ namespace Aurora::IO::NT
}
{
if (!pGetNamedPipeClientProcessId)
{
SysPushErrorIO("UWP Platform Error");
break;
}
ULONG pid {};
if (!GetNamedPipeClientProcessId(hPipe, &pid))
if (!pGetNamedPipeClientProcessId(hPipe, &pid))
{
SysPushErrorIO("IO HANDLE Server Error");
break;

View File

@ -14,7 +14,7 @@ namespace Aurora::Process
{
void MakeToolHelp32Snapshot()
{
MODULEENTRY32 me32;
MODULEENTRY32W me32;
HANDLE hModuleSnap = INVALID_HANDLE_VALUE;
hModuleSnap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, GetCurrentProcessId());
@ -23,9 +23,15 @@ namespace Aurora::Process
SysPushErrorGen("CreateToolhelp32Snapshot");
return;
}
me32.dwSize = sizeof(MODULEENTRY32);
me32.dwSize = sizeof(MODULEENTRY32W);
if (!Module32First(hModuleSnap, &me32))
if (!pModule32FirstW)
{
SysPushErrorFeatureMissing();
return;
}
if (!pModule32FirstW(hModuleSnap, &me32))
{
SysPushErrorGen("Module32First failed");
CloseHandle(hModuleSnap);
@ -38,7 +44,8 @@ namespace Aurora::Process
InvaildateModule(h);
MakeAware(h);
}
while (Module32Next(hModuleSnap, &me32));
while (pModule32NextW &&
pModule32NextW(hModuleSnap, &me32));
CloseHandle(hModuleSnap);
}

View File

@ -19,7 +19,15 @@ namespace Aurora::Processes
{
JOBOBJECT_EXTENDED_LIMIT_INFORMATION jeli {};
gLeaderJob = CreateJobObject(NULL, NULL);
if (!pCreateJobObjectW)
{
SysPushErrorFeatureMissing("Win32-like platform missing job objects!");
return;
}
// problematic symbol: (others seem to be more ok???)
// this file shouldn't be linked against most UWP apps anyway
gLeaderJob = pCreateJobObjectW(NULL, NULL);
if (!gLeaderJob)
{
SysPushErrorArg("CreateJobObject error");