Skip to content

Commit

Permalink
1_1_1_1375
Browse files Browse the repository at this point in the history
upd latest
  • Loading branch information
Blaukovitch committed Aug 19, 2024
1 parent 9ee2bd0 commit 3df6c32
Show file tree
Hide file tree
Showing 149 changed files with 5,190 additions and 3,130 deletions.
9 changes: 9 additions & 0 deletions 00-Common Headers/KexDll.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
#define KEXDATA_FLAG_ENABLED_FOR_MSI 8 // Indicates that this MSI has VxKex enabled.
#define KEXDATA_FLAG_DISABLE_LOGGING 16 // Log files are not to be created.
#define KEXDATA_FLAG_CHROMIUM 32 // This is a Chromium-based application (Chrome, Edge, Electron, QtWebEngine, etc.)
#define KEXDATA_FLAG_KB2533623_PRESENT 64 // Indicates the DllDirectory APIs are available

#define KEX_STRONGSPOOF_SHAREDUSERDATA 1
#define KEX_STRONGSPOOF_REGISTRY 2
Expand Down Expand Up @@ -742,6 +743,10 @@ NTSTATUS NTAPI Ext_NtQueryInformationProcess(
IN ULONG ProcessInformationLength,
OUT PULONG ReturnLength OPTIONAL);

KEXAPI NTSTATUS NTAPI Ext_NtAssignProcessToJobObject(
IN HANDLE JobHandle,
IN HANDLE ProcessHandle);

#pragma endregion

#pragma region KexNt* functions
Expand Down Expand Up @@ -886,4 +891,8 @@ KEXAPI NTSTATUS NTAPI KexNtQueryInformationProcess(
IN ULONG ProcessInformationLength,
OUT PULONG ReturnLength OPTIONAL);

KEXAPI NTSTATUS NTAPI KexNtAssignProcessToJobObject(
IN HANDLE JobHandle,
IN HANDLE ProcessHandle);

#pragma endregion
3 changes: 3 additions & 0 deletions 00-Common Headers/KexGui.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@
// undocumented window message
#define WM_COPYGLOBALDATA 0x0049

// special taskdialog flag not defined in sdk headers
#define TDIF_SIZE_TO_CONTENT 0x1000000

//
// ctlsx.c
//
Expand Down
12 changes: 3 additions & 9 deletions 00-Common Headers/KexLnk.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,6 @@
# pragma comment(lib, "ole32.lib")
# endif
# endif

# ifdef KEX_ARCH_X86
// seh32.lib contains SEH functions from WinXP CRTs.
# pragma comment(lib, "seh32.lib")
# endif
#elif defined(KEX_TARGET_TYPE_SYS)
# ifdef _M_X64
# pragma comment(lib, "ntoskrnl_x64.lib")
Expand All @@ -76,10 +71,9 @@
# pragma comment(lib, "ntoskrnl_x86.lib")
# pragma comment(lib, "ntstrsafe_x86.lib")
# endif
#endif

# ifdef KEX_ARCH_X86
// original name: exsup.lib from DDK
# pragma comment(lib, "seh32km.lib")
# endif
#ifdef KEX_ARCH_X86
# pragma comment(lib, "seh32.lib")
#endif
#pragma endregion
107 changes: 46 additions & 61 deletions 00-Common Headers/KxBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@

#include <KexComm.h>
#include <KexDll.h>
#include <powrprof.h>
#include <cfgmgr32.h>
#include <bcrypt.h>

#pragma region Macro Definitions

Expand All @@ -38,20 +36,25 @@
PROCESS_CREATION_MITIGATION_POLICY_DEP_ATL_THUNK_ENABLE | \
PROCESS_CREATION_MITIGATION_POLICY_SEHOP_ENABLE)

// undocumented STARTUPINFO flag
#define STARTF_HASSHELLDATA 0x400

#define LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR 0x00000100
#define LOAD_LIBRARY_SEARCH_APPLICATION_DIR 0x00000200
#define LOAD_LIBRARY_SEARCH_USER_DIRS 0x00000400
#define LOAD_LIBRARY_SEARCH_SYSTEM32 0x00000800
#define LOAD_LIBRARY_SEARCH_DEFAULT_DIRS 0x00001000
#define LOAD_LIBRARY_SAFE_CURRENT_DIRS 0x00002000

#define IOCTL_KSEC_RANDOM_FILL_BUFFER CTL_CODE(FILE_DEVICE_KSEC, 0x02, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define LOAD_LIBRARY_ALL_DLLDIR_FLAGS (LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR | \
LOAD_LIBRARY_SEARCH_APPLICATION_DIR | \
LOAD_LIBRARY_SEARCH_USER_DIRS | \
LOAD_LIBRARY_SEARCH_SYSTEM32 | \
LOAD_LIBRARY_SEARCH_DEFAULT_DIRS)

#define APPMODEL_ERROR_NO_PACKAGE 15700L
#define APPMODEL_ERROR_NO_APPLICATION 15703L

#define DEVICE_NOTIFY_CALLBACK 2

#pragma endregion

#pragma region Structures and Typedefs
Expand Down Expand Up @@ -362,16 +365,6 @@ typedef struct _THREAD_POWER_THROTTLING_STATE {
ULONG StateMask;
} TYPEDEF_TYPE_NAME(THREAD_POWER_THROTTLING_STATE);

typedef ULONG (CALLBACK *PDEVICE_NOTIFY_CALLBACK_ROUTINE) (
IN PVOID Context OPTIONAL,
IN ULONG Type,
IN PVOID Setting);

typedef struct _DEVICE_NOTIFY_SUBSCRIBE_PARAMETERS {
PDEVICE_NOTIFY_CALLBACK_ROUTINE Callback;
PVOID Context;
} TYPEDEF_TYPE_NAME(DEVICE_NOTIFY_SUBSCRIBE_PARAMETERS);

typedef enum _PROCESS_MITIGATION_POLICY {
ProcessDEPPolicy,
ProcessASLRPolicy,
Expand Down Expand Up @@ -449,6 +442,20 @@ typedef enum _PSS_QUERY_INFORMATION_CLASS {
PSS_QUERY_PERFORMANCE_COUNTERS = 7
} TYPEDEF_TYPE_NAME(PSS_QUERY_INFORMATION_CLASS);

typedef PVOID (WINAPI *PPSS_ALLOCATOR_ALLOC_ROUTINE) (
IN PVOID Context,
IN ULONG Size);

typedef VOID (WINAPI *PPSS_ALLOCATOR_FREE_ROUTINE) (
IN PVOID Context,
IN PVOID Address);

typedef struct _PSS_ALLOCATOR {
PVOID Context;
PPSS_ALLOCATOR_ALLOC_ROUTINE AllocRoutine;
PPSS_ALLOCATOR_FREE_ROUTINE FreeRoutine;
} TYPEDEF_TYPE_NAME(PSS_ALLOCATOR);

typedef enum _CM_NOTIFY_FILTER_TYPE {
CM_NOTIFY_FILTER_TYPE_DEVICEINTERFACE,
CM_NOTIFY_FILTER_TYPE_DEVICEHANDLE,
Expand Down Expand Up @@ -529,27 +536,24 @@ typedef struct _CM_NOTIFY_FILTER {
};
} TYPEDEF_TYPE_NAME(CM_NOTIFY_FILTER);

typedef enum _WLDP_WINDOWS_LOCKDOWN_MODE {
WLDP_WINDOWS_LOCKDOWN_MODE_UNLOCKED,
WLDP_WINDOWS_LOCKDOWN_MODE_TRIAL,
WLDP_WINDOWS_LOCKDOWN_MODE_LOCKED,
WLDP_WINDOWS_LOCKDOWN_MODE_MAX
} TYPEDEF_TYPE_NAME(WLDP_WINDOWS_LOCKDOWN_MODE);

typedef enum _FIRMWARE_TYPE {
FirmwareTypeUnknown,
FirmwareTypeBios,
FirmwareTypeUefi,
FirmwareTypeMax
} TYPEDEF_TYPE_NAME(FIRMWARE_TYPE);

typedef struct _VERHEAD {
WORD wTotLen;
WORD wValLen;
WORD wType;
WCHAR szKey[(sizeof("VS_VERSION_INFO") + 3) & ~3];
VS_FIXEDFILEINFO vsf;
} TYPEDEF_TYPE_NAME(VERHEAD);
typedef enum _APP_POLICY_WINDOWING_MODEL {
AppPolicyWindowingModel_None,
AppPolicyWindowingModel_Universal,
AppPolicyWindowingModel_ClassicDesktop,
AppPolicyWindowingModel_ClassicPhone
} TYPEDEF_TYPE_NAME(APP_POLICY_WINDOWING_MODEL);

typedef enum _APP_POLICY_THREAD_INITIALIZATION_TYPE {
AppPolicyThreadInitializationType_None,
AppPolicyThreadInitializationType_InitializeWinRT
} TYPEDEF_TYPE_NAME(APP_POLICY_THREAD_INITIALIZATION_TYPE);

#pragma endregion

Expand Down Expand Up @@ -751,23 +755,6 @@ KXBASEAPI HRESULT WINAPI GetAppContainerRegistryLocation(
IN REGSAM DesiredAccess,
OUT PHKEY AppContainerKey);

//
// crypto.c
//

KXBASEAPI BOOL WINAPI ProcessPrng(
OUT PBYTE Buffer,
IN SIZE_T BufferCb);

KXBASEAPI NTSTATUS WINAPI BCryptHash(
IN BCRYPT_ALG_HANDLE Algorithm,
IN PBYTE Secret OPTIONAL,
IN ULONG SecretCb,
IN PBYTE Input,
IN ULONG InputCb,
OUT PBYTE Output,
IN ULONG OutputCb);

//
// vmem.c
//
Expand All @@ -791,21 +778,6 @@ KXBASEAPI BOOL WINAPI PrefetchVirtualMemory(
IN PWIN32_MEMORY_RANGE_ENTRY VirtualAddresses,
IN ULONG Flags);

//
// power.c
//

KXBASEAPI POWER_PLATFORM_ROLE WINAPI PowerDeterminePlatformRoleEx(
IN ULONG Version);

KXBASEAPI ULONG WINAPI PowerRegisterSuspendResumeNotification(
IN ULONG Flags,
IN HANDLE Recipient,
OUT PHPOWERNOTIFY RegistrationHandle);

KXBASEAPI ULONG WINAPI PowerUnregisterSuspendResumeNotification(
IN OUT HPOWERNOTIFY RegistrationHandle);

//
// misc.c
//
Expand All @@ -816,4 +788,17 @@ KXBASEAPI BOOL WINAPI GetOsSafeBootMode(
KXBASEAPI BOOL WINAPI GetFirmwareType(
OUT PFIRMWARE_TYPE FirmwareType);

//
// module.c
//

KXBASEAPI DLL_DIRECTORY_COOKIE WINAPI Ext_AddDllDirectory(
IN PCWSTR NewDirectory);

KXBASEAPI BOOL WINAPI Ext_RemoveDllDirectory(
IN DLL_DIRECTORY_COOKIE Cookie);

KXBASEAPI BOOL WINAPI Ext_SetDefaultDllDirectories(
IN ULONG DirectoryFlags);

#endif // if defined(KEX_ENV_WIN32)
34 changes: 34 additions & 0 deletions 00-Common Headers/KxMi.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#pragma once

#include <KexComm.h>
#include <powrprof.h>

#if !defined(KXMIAPI) && defined(KEX_ENV_WIN32)
# define KXMIAPI
# pragma comment(lib, "KxMi.lib")
#endif

typedef ULONG (CALLBACK *PDEVICE_NOTIFY_CALLBACK_ROUTINE) (
IN PVOID Context OPTIONAL,
IN ULONG Type,
IN PVOID Setting);

typedef struct _DEVICE_NOTIFY_SUBSCRIBE_PARAMETERS {
PDEVICE_NOTIFY_CALLBACK_ROUTINE Callback;
PVOID Context;
} TYPEDEF_TYPE_NAME(DEVICE_NOTIFY_SUBSCRIBE_PARAMETERS);

//
// powrprof.c
//

KXMIAPI POWER_PLATFORM_ROLE WINAPI PowerDeterminePlatformRoleEx(
IN ULONG Version);

KXMIAPI ULONG WINAPI PowerRegisterSuspendResumeNotification(
IN ULONG Flags,
IN HANDLE Recipient,
OUT PHPOWERNOTIFY RegistrationHandle);

KXMIAPI ULONG WINAPI PowerUnregisterSuspendResumeNotification(
IN OUT HPOWERNOTIFY RegistrationHandle);
8 changes: 6 additions & 2 deletions 00-Common Headers/NtDll.h
Original file line number Diff line number Diff line change
Expand Up @@ -1508,7 +1508,7 @@ typedef struct _TEB {
ULONG_PTR KexPerThreadData;
PVOID EnvironmentPointer; // unused
};

CLIENT_ID ClientId; // GetCurrentProcessId & GetCurrentThreadId
PVOID ActiveRpcHandle; // unused
PVOID ThreadLocalStoragePointer;
Expand Down Expand Up @@ -1922,7 +1922,7 @@ typedef enum _PS_ATTRIBUTE_NUM {
PsAttributeGroupAffinity, // in PGROUP_AFFINITY
PsAttributePreferredNode, // in PUSHORT
PsAttributeIdealProcessor, // in PPROCESSOR_NUMBER
PsAttributeUmsThread, // see UpdateProceThreadAttributeList in msdn (CreateProcessA/W...) in PUMS_CREATE_THREAD_ATTRIBUTES
PsAttributeUmsThread, // see UpdateProcThreadAttributeList in msdn (CreateProcessA/W...) in PUMS_CREATE_THREAD_ATTRIBUTES
PsAttributeMitigationOptions, // in UCHAR
PsAttributeProtectionLevel,
PsAttributeSecureProcess, // since THRESHOLD (Virtual Secure Mode, Device Guard)
Expand Down Expand Up @@ -3639,6 +3639,10 @@ NTSYSCALLAPI NTSTATUS NTAPI NtQueryFullAttributesFile(
IN POBJECT_ATTRIBUTES ObjectAttributes,
OUT PFILE_NETWORK_OPEN_INFORMATION FileInformation);

NTSYSCALLAPI NTSTATUS NTAPI NtAssignProcessToJobObject(
IN HANDLE JobHandle,
IN HANDLE ProcessHandle);

#pragma endregion

#pragma region Nt* function declarations (not in Windows 7)
Expand Down
Binary file modified 00-Common Headers/vautogen.h
Binary file not shown.
Binary file modified 00-Documentation/Application Compatibility List.docx
Binary file not shown.
Binary file modified 00-Documentation/Changelog.txt
Binary file not shown.
31 changes: 0 additions & 31 deletions 00-Documentation/Extended DLL API List.txt

This file was deleted.

Binary file removed 00-Documentation/~$plication Compatibility List.docx
Binary file not shown.
Binary file removed 00-Import Libraries/seh32km.lib
Binary file not shown.
Binary file modified 01-Development Utilities/7zSfx/7zS2.sfx
Binary file not shown.
Binary file added 01-Development Utilities/7zSfx/7zS2_original.sfx
Binary file not shown.
Loading

0 comments on commit 3df6c32

Please sign in to comment.