id
int64
0
755k
file_name
stringlengths
3
109
file_path
stringlengths
13
185
content
stringlengths
31
9.38M
size
int64
31
9.38M
language
stringclasses
1 value
extension
stringclasses
11 values
total_lines
int64
1
340k
avg_line_length
float64
2.18
149k
max_line_length
int64
7
2.22M
alphanum_fraction
float64
0
1
repo_name
stringlengths
6
65
repo_stars
int64
100
47.3k
repo_forks
int64
0
12k
repo_open_issues
int64
0
3.4k
repo_license
stringclasses
9 values
repo_extraction_date
stringclasses
92 values
exact_duplicates_redpajama
bool
2 classes
near_duplicates_redpajama
bool
2 classes
exact_duplicates_githubcode
bool
2 classes
exact_duplicates_stackv2
bool
1 class
exact_duplicates_stackv1
bool
2 classes
near_duplicates_githubcode
bool
2 classes
near_duplicates_stackv1
bool
2 classes
near_duplicates_stackv2
bool
1 class
16,210
api-memory.cpp
BlackINT3_OpenArk/src/OpenArkDrv/arkdrv-api/api-memory/api-memory.cpp
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #include "api-memory.h" #ifdef _ARKDRV_ #else namespace ArkDrvApi { namespace Memory { static ARK_MEMORY_RANGE sys_range = { 0 }; ARK_MEMORY_RANGE MemoryRange() { if (!sys_range.r0start) { SYSTEM_INFO sys; GetSystemInfo(&sys); sys_range.r3start = (ULONG64)sys.lpMinimumApplicationAddress; sys_range.r3end = (ULONG64)sys.lpMaximumApplicationAddress; sys_range.r0start = 0xFFFF080000000000; sys_range.r0end = 0xFFFFFFFFFFFFFFFF; if (!UNONE::OsIs64()) { sys_range.r0start = 0x80000000; sys_range.r0end = 0xFFFFFFFF; } } return sys_range; } bool IsKernelAddress(ULONG64 addr) { auto range = MemoryRange(); return addr >= sys_range.r0start; } bool MemoryReadR0(ULONG pid, ULONG64 addr, ULONG size, std::string &readbuf) { if (!size) return false; ARK_MEMORY_IN memin; memin.pid = pid; memin.addr = addr; memin.size = size; DWORD outlen; PARK_MEMORY_OUT memout; bool ret = IoControlDriver(IOCTL_ARK_MEMORY, ARK_MEMORY_READ, &memin, sizeof(memin), (PVOID*)&memout, &outlen); if (!ret) return false; if (memout) { readbuf.resize(memout->size); memcpy(&readbuf[0], memout->readbuf, memout->size); free(memout); } return true; } bool MemoryRead(ULONG pid, ULONG64 addr, ULONG size, std::string &readbuf) { if (IsKernelAddress(addr)) return MemoryReadR0(pid, addr, size, readbuf); HANDLE phd = ArkDrvApi::Process::OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pid); if (!phd) return FALSE; DWORD readlen; std::string data; data.resize(size); BOOL ret = ReadProcessMemory(phd, (PVOID)addr, (PVOID)data.data(), (SIZE_T)size, (SIZE_T*)&readlen); if (!ret) { auto err = GetLastError(); if (err != ERROR_PARTIAL_COPY) goto err; MEMORY_BASIC_INFORMATION mbi; if (!VirtualQueryEx(phd, (PVOID)addr, &mbi, sizeof(mbi))) goto err; auto exact = (ULONG)mbi.RegionSize - (ULONG)(addr - (ULONG64)mbi.BaseAddress); ret = ReadProcessMemory(phd, (PVOID)addr, (PVOID)data.data(), (SIZE_T)exact, (SIZE_T*)&readlen); if (!ret) goto err; } CloseHandle(phd); data.resize(readlen); readbuf = std::move(data); return true; err: ERR(L"ReadProcessMemory pid:%d, err:%d", pid, GetLastError()); CloseHandle(phd); return false; } bool MemoryWriteR0(ULONG pid, ULONG64 addr, std::string &writebuf) { DWORD written = writebuf.size(); DWORD total = ARK_HEADER_SIZE(ARK_MEMORY_IN) + written; PARK_MEMORY_IN memin = (PARK_MEMORY_IN)malloc(total); if (!memin) return false; memin->addr = addr; memin->pid = pid; memin->size = writebuf.size(); memcpy(memin->u.writebuf, writebuf.data(), written); DWORD outlen; PARK_MEMORY_OUT memout; bool ret = IoControlDriver(IOCTL_ARK_MEMORY, ARK_MEMORY_WRITE, memin, total, (PVOID*)&memout, &outlen); free(memin); if (!ret) return false; if (memout) free(memout); return true; } bool MemoryWrite(ULONG pid, ULONG64 addr, std::string &writebuf) { if (IsKernelAddress(addr)) return MemoryWriteR0(pid, addr, writebuf); HANDLE phd = ArkDrvApi::Process::OpenProcess(PROCESS_VM_OPERATION | PROCESS_VM_WRITE, FALSE, pid); if (!phd) return FALSE; PVOID buf = (PVOID)writebuf.data(); SIZE_T bufsize = (SIZE_T)writebuf.size(); DWORD written, oldprotect; BOOL ret = FALSE; ret = VirtualProtectEx(phd, (PVOID)addr, bufsize, PAGE_READWRITE, &oldprotect); if (!ret) { ERR(L"VirtualProtectEx pid:%d, err:%d", pid, GetLastError()); CloseHandle(phd); return FALSE; } ret = WriteProcessMemory(phd, (PVOID)addr, buf, bufsize, (SIZE_T*)&written); if (!ret) { ERR(L"WriteProcessMemory pid:%d, err:%d", pid, GetLastError()); VirtualProtectEx(phd, (PVOID)addr, bufsize, oldprotect, &oldprotect); CloseHandle(phd); return FALSE; } VirtualProtectEx(phd, (PVOID)addr, bufsize, oldprotect, &oldprotect); CloseHandle(phd); return true; } } // namespace Memory } // namespace ArkDrvApi #endif
4,594
C++
.cpp
134
32.343284
112
0.710822
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,211
api-process.cpp
BlackINT3_OpenArk/src/OpenArkDrv/arkdrv-api/api-process/api-process.cpp
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #include "api-process.h" #ifdef _ARKDRV_ #else namespace ArkDrvApi { namespace Process { HANDLE WINAPI OpenProcessR0(DWORD access, BOOL inherit, DWORD pid) { std::string outdata; PROCESS_OPEN_INFO info; info.access = access; info.inherit = inherit; info.pid = pid; bool ret = IoControlDriver(IOCTL_ARK_PROCESS, PROCESS_OPEN, TO_STREAM(info), outdata); if (!ret) return NULL; HANDLE phd = (HANDLE)*(DWORD*)outdata.c_str(); return phd; } HANDLE WINAPI OpenProcess(DWORD access, BOOL inherit, DWORD pid) { if (pid == -1) return NULL; HANDLE phd = ::OpenProcess(access, inherit, pid); if (phd) return phd; if (GetLastError() != ERROR_ACCESS_DENIED) { ERR(L"OpenProcess pid:%d err:%d", pid, GetLastError()); return NULL; } phd = OpenProcessR0(access, inherit, pid); if (!phd) { ERR(L"OpenProcess by Kernel pid:%d err:%d", pid, GetLastError()); return NULL; } return phd; } HANDLE WINAPI OpenThreadR0(DWORD access, BOOL inherit, DWORD tid) { std::string outdata; THREAD_OPEN_INFO info; info.access = access; info.inherit = inherit; info.tid = tid; bool ret = IoControlDriver(IOCTL_ARK_PROCESS, THREAD_OPEN, TO_STREAM(info), outdata); if (!ret) return NULL; HANDLE thd = (HANDLE)*(DWORD*)outdata.c_str(); return thd; } HANDLE WINAPI OpenThread(DWORD access, BOOL inherit, DWORD tid) { HANDLE thd = ::OpenThread(access, inherit, tid); if (!thd && GetLastError() == ERROR_ACCESS_DENIED) { thd = OpenThreadR0(access, inherit, tid); if (!thd) return 0; } return thd; } } // namespace Process } // namespace ArkDrvApi #endif
2,358
C++
.cpp
72
31.055556
87
0.690351
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,212
api-driver.cpp
BlackINT3_OpenArk/src/OpenArkDrv/arkdrv-api/api-driver/api-driver.cpp
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #include "api-driver.h" #ifdef _ARKDRV_ #else namespace ArkDrvApi { namespace Driver { bool DriverEnumInfo(std::vector<DRIVER_ITEM> &infos) { infos.clear(); DWORD op = DRIVER_ENUM_INFO; PDRIVER_INFO drivers; DWORD outlen; bool ret = IoControlDriver(IOCTL_ARK_DRIVER, op, NULL, 0, (PVOID*)&drivers, &outlen); if (!ret) return false; for (int i = 0; i < drivers->count; i++) { infos.push_back(drivers->items[i]); } free(drivers); return true; } } // namespace Memory } // namespace ArkDrvApi #endif
1,304
C++
.cpp
37
33.918919
86
0.660616
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,213
api-network.cpp
BlackINT3_OpenArk/src/OpenArkDrv/arkdrv-api/api-network/api-network.cpp
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #include <Winsock2.h> #include <ws2ipdef.h> #include <IPHlpApi.h> #include <vector> #include <mstcpip.h> #include <ws2tcpip.h> #include "api-network.h" #pragma comment(lib, "IPHlpApi.lib") #ifdef _ARKDRV_ #else namespace ArkDrvApi { namespace Network { char* GetReadableState(int state) { switch (state) { case MIB_TCP_STATE_CLOSED: return "CLOSED"; case MIB_TCP_STATE_LISTEN: return "LISTENING"; case MIB_TCP_STATE_ESTAB: return "ESTABLISHED"; case MIB_TCP_STATE_SYN_SENT: return "SYN_SENT"; case MIB_TCP_STATE_SYN_RCVD: return "SYN_RECV"; case MIB_TCP_STATE_FIN_WAIT1: return "FIN_WAIT1"; case MIB_TCP_STATE_FIN_WAIT2: return "FIN_WAIT2"; case MIB_TCP_STATE_CLOSE_WAIT: return "CLOSE_WAIT"; case MIB_TCP_STATE_CLOSING: return "CLOSING"; case MIB_TCP_STATE_LAST_ACK: return "LAST_ACK"; case MIB_TCP_STATE_TIME_WAIT: return "TIME_WAIT"; case MIB_TCP_STATE_DELETE_TCB: return "DELETE_TCB"; default: return "UNKNOWN"; } } bool EnumTcp4Endpoints(std::vector<ARK_NETWORK_ENDPOINT_ITEM> &items) { DWORD size = 0; PMIB_TCPTABLE_OWNER_PID tcp = NULL; if (GetExtendedTcpTable(tcp, &size, TRUE, AF_INET, TCP_TABLE_OWNER_PID_ALL, 0) != ERROR_INSUFFICIENT_BUFFER) return false; tcp = (MIB_TCPTABLE_OWNER_PID *)new char[size]; if (GetExtendedTcpTable(tcp, &size, TRUE, AF_INET, TCP_TABLE_OWNER_PID_ALL, 0) != NO_ERROR) { delete tcp; return false; } int nums = (int)tcp->dwNumEntries; for (int i = 0; i < nums; i++) { ARK_NETWORK_ENDPOINT_ITEM endpoint; endpoint.ip_ver = ARK_NETWORK_IPV4; endpoint.tran_ver = ARK_NETWORK_TCP; strcpy_s(endpoint.protocol, "TCP"); endpoint.u0.local_addr = tcp->table[i].dwLocalAddr; endpoint.u1.remote_addr = tcp->table[i].dwRemoteAddr; endpoint.local_port = tcp->table[i].dwLocalPort; endpoint.remote_port = tcp->table[i].dwRemotePort; endpoint.state = tcp->table[i].dwState; endpoint.pid = tcp->table[i].dwOwningPid; strcpy_s(endpoint.readable_state, GetReadableState(endpoint.state)); sprintf_s(endpoint.local, "%s:%d", inet_ntoa(*(in_addr*)& tcp->table[i].dwLocalAddr), htons(tcp->table[i].dwLocalPort)); if (endpoint.state == MIB_TCP_STATE_LISTEN) { strcpy_s(endpoint.remote, "0.0.0.0:0"); } else { sprintf_s(endpoint.remote, "%s:%d", inet_ntoa(*(in_addr*)& tcp->table[i].dwRemoteAddr), htons(tcp->table[i].dwRemotePort)); } items.push_back(endpoint); } delete tcp; //for (auto i : items) printf("%s %s %s %s %d\n", i.protocol, i.local, i.remote, i.readable_state, i.pid); return 0; } bool EnumTcp6Endpoints(std::vector<ARK_NETWORK_ENDPOINT_ITEM> &items) { typedef PSTR(NTAPI *__RtlIpv6AddressToStringA)( _In_ const struct in6_addr *Addr, _Out_writes_(46) PSTR S ); auto pRtlIpv6AddressToStringA = (__RtlIpv6AddressToStringA) GetProcAddress(GetModuleHandleA("ntdll.dll"), "RtlIpv6AddressToStringA"); if (!pRtlIpv6AddressToStringA) return false; DWORD size = 0; PMIB_TCP6TABLE_OWNER_PID tcp = NULL; if (GetExtendedTcpTable(tcp, &size, TRUE, AF_INET6, TCP_TABLE_OWNER_PID_ALL, 0) != ERROR_INSUFFICIENT_BUFFER) return false; tcp = (MIB_TCP6TABLE_OWNER_PID *)new char[size]; if (GetExtendedTcpTable(tcp, &size, TRUE, AF_INET6, TCP_TABLE_OWNER_PID_ALL, 0) != NO_ERROR) { delete[] tcp; return false; } int nums = (int)tcp->dwNumEntries; for (int i = 0; i < nums; i++) { ARK_NETWORK_ENDPOINT_ITEM endpoint; endpoint.ip_ver = ARK_NETWORK_IPV6; endpoint.tran_ver = ARK_NETWORK_TCP; strcpy_s(endpoint.protocol, "TCP6"); RtlCopyMemory(&endpoint.u0.local_addr6, &tcp->table[i].ucLocalAddr, 16); RtlCopyMemory(&endpoint.u1.remote_addr6, &tcp->table[i].ucRemoteAddr, 16); endpoint.local_port = tcp->table[i].dwLocalPort; endpoint.remote_port = tcp->table[i].dwRemotePort; endpoint.state = tcp->table[i].dwState; endpoint.pid = tcp->table[i].dwOwningPid; strcpy_s(endpoint.readable_state, GetReadableState(endpoint.state)); CHAR str[64] = { 0 }; pRtlIpv6AddressToStringA((in6_addr*)&endpoint.u0.local_addr6, (char*)&str); sprintf_s(endpoint.local, "[%s]:%d", &str, htons(endpoint.local_port)); if (endpoint.state == MIB_TCP_STATE_LISTEN) { strcpy_s(endpoint.remote, "[::]:0"); } else { RtlZeroMemory(&str, sizeof(str)); pRtlIpv6AddressToStringA((in6_addr*)&endpoint.u1.remote_addr6, (char*)&str); sprintf_s(endpoint.remote, "[%s]:%d", &str, htons(endpoint.remote_port)); } items.push_back(endpoint); } delete[] tcp; //for (auto i : items) printf("%s %s %s %s %d\n", i.protocol, i.local, i.remote, i.readable_state, i.pid); return 0; } bool EnumUdp4Endpoints(std::vector<ARK_NETWORK_ENDPOINT_ITEM> &items) { DWORD size = 0; PMIB_UDPTABLE_OWNER_PID udp = NULL; if (GetExtendedUdpTable(udp, &size, TRUE, AF_INET, UDP_TABLE_OWNER_PID, 0) != ERROR_INSUFFICIENT_BUFFER) return false; udp = (MIB_UDPTABLE_OWNER_PID *)new char[size]; if (GetExtendedUdpTable(udp, &size, TRUE, AF_INET, UDP_TABLE_OWNER_PID, 0) != NO_ERROR) { delete udp; return false; } int nums = (int)udp->dwNumEntries; for (int i = 0; i < nums; i++) { ARK_NETWORK_ENDPOINT_ITEM endpoint; endpoint.ip_ver = ARK_NETWORK_IPV4; endpoint.tran_ver = ARK_NETWORK_UDP; strcpy_s(endpoint.protocol, "UDP"); endpoint.u0.local_addr = udp->table[i].dwLocalAddr; endpoint.local_port = udp->table[i].dwLocalPort; endpoint.pid = udp->table[i].dwOwningPid; sprintf_s(endpoint.local, "%s:%d", inet_ntoa(*(in_addr*)&udp->table[i].dwLocalAddr), htons(udp->table[i].dwLocalPort)); strcpy_s(endpoint.remote, "*:*"); items.push_back(endpoint); } delete udp; //for (auto i : items) printf("%s %s %s %s %d\n", i.protocol, i.local, i.remote, i.readable_state, i.pid); return 0; } bool EnumUdp6Endpoints(std::vector<ARK_NETWORK_ENDPOINT_ITEM> &items) { typedef PSTR(NTAPI *__RtlIpv6AddressToStringA)( _In_ const struct in6_addr *Addr, _Out_writes_(46) PSTR S ); auto pRtlIpv6AddressToStringA = (__RtlIpv6AddressToStringA) GetProcAddress(GetModuleHandleA("ntdll.dll"), "RtlIpv6AddressToStringA"); if (!pRtlIpv6AddressToStringA) return false; DWORD size = 0; PMIB_UDP6TABLE_OWNER_PID udp = NULL; if (GetExtendedUdpTable(udp, &size, TRUE, AF_INET6, UDP_TABLE_OWNER_PID, 0) != ERROR_INSUFFICIENT_BUFFER) return false; udp = (MIB_UDP6TABLE_OWNER_PID *)new char[size]; if (GetExtendedUdpTable(udp, &size, TRUE, AF_INET6, UDP_TABLE_OWNER_PID, 0) != NO_ERROR) { delete udp; return false; } int nums = (int)udp->dwNumEntries; for (int i = 0; i < nums; i++) { ARK_NETWORK_ENDPOINT_ITEM endpoint; endpoint.ip_ver = ARK_NETWORK_IPV6; endpoint.tran_ver = ARK_NETWORK_UDP; strcpy_s(endpoint.protocol, "UDP6"); RtlCopyMemory(&endpoint.u0.local_addr6, &udp->table[i].ucLocalAddr, 16); endpoint.local_port = udp->table[i].dwLocalPort; endpoint.pid = udp->table[i].dwOwningPid; CHAR str[64] = { 0 }; pRtlIpv6AddressToStringA((in6_addr*)&endpoint.u0.local_addr6, (char*)&str); sprintf_s(endpoint.local, "[%s]:%d", &str, htons(endpoint.local_port)); strcpy_s(endpoint.remote, "*:*"); items.push_back(endpoint); } delete udp; //for (auto i : items) printf("%s %s %s %s %d\n", i.protocol, i.local, i.remote, i.readable_state, i.pid); return 0; } } // namespace Network } // namespace ArkDrvApi #endif
7,996
C++
.cpp
211
35.56872
126
0.70337
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,214
api-object.cpp
BlackINT3_OpenArk/src/OpenArkDrv/arkdrv-api/api-object/api-object.cpp
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #include "api-object.h" #ifdef _ARKDRV_ ULONG ObjectTypeIndexByName(WCHAR *object_type_name) { ULONG index = -1; NTSTATUS status; ULONG bufsize = PAGE_SIZE; PVOID buf = ExAllocatePoolWithTag(NonPagedPool, bufsize, 'obte'); while ((status = ZwQueryObject( NULL, (OBJECT_INFORMATION_CLASS)3, //ObjectTypesInformation, buf, bufsize, NULL )) == STATUS_INFO_LENGTH_MISMATCH) { ExFreePoolWithTag(buf, 'obte'); bufsize *= 2; buf = ExAllocatePoolWithTag(NonPagedPool, bufsize, 'obte'); } if (!NT_SUCCESS(status)) { ExFreePoolWithTag(buf, 'obte'); return index; } ULONG number_types = *(ULONG *)buf; POBJECT_TYPE_INFORMATION obj_info = (POBJECT_TYPE_INFORMATION)(((PUCHAR)buf) + ALIGN_UP(sizeof(number_types), ULONG_PTR)); for (ULONG i = 0; i < number_types; i++) { UNICODE_STRING t_type_name; RtlInitUnicodeString(&t_type_name, object_type_name); if (0 == RtlCompareUnicodeString(&t_type_name, &(obj_info->TypeName), TRUE)) { index = i + 2; break; } obj_info = (POBJECT_TYPE_INFORMATION) ((PCHAR)(obj_info + 1) + ALIGN_UP(obj_info->TypeName.MaximumLength, ULONG_PTR)); } if (buf) { ExFreePoolWithTag(buf, 'obte'); } return index; } #else #undef ALIGN_DOWN_BY #undef ALIGN_UP_BY #undef ALIGN_DOWN_POINTER_BY #undef ALIGN_UP_POINTER_BY #undef ALIGN_DOWN #undef ALIGN_UP #undef ALIGN_DOWN_POINTER #undef ALIGN_UP_POINTER #define ALIGN_DOWN_BY(length, alignment) \ ((ULONG_PTR)(length) & ~(alignment - 1)) #define ALIGN_UP_BY(length, alignment) \ (ALIGN_DOWN_BY(((ULONG_PTR)(length) + alignment - 1), alignment)) #define ALIGN_DOWN_POINTER_BY(address, alignment) \ ((PVOID)((ULONG_PTR)(address) & ~((ULONG_PTR)alignment - 1))) #define ALIGN_UP_POINTER_BY(address, alignment) \ (ALIGN_DOWN_POINTER_BY(((ULONG_PTR)(address) + alignment - 1), alignment)) #define ALIGN_DOWN(length, type) \ ALIGN_DOWN_BY(length, sizeof(type)) #define ALIGN_UP(length, type) \ ALIGN_UP_BY(length, sizeof(type)) #define ALIGN_DOWN_POINTER(address, type) \ ALIGN_DOWN_POINTER_BY(address, sizeof(type)) #define ALIGN_UP_POINTER(address, type) \ ALIGN_UP_POINTER_BY(address, sizeof(type)) typedef struct _OBJECT_TYPE_INFORMATION2 { UNICODE_STRING TypeName; ULONG TotalNumberOfObjects; ULONG TotalNumberOfHandles; ULONG TotalPagedPoolUsage; ULONG TotalNonPagedPoolUsage; ULONG TotalNamePoolUsage; ULONG TotalHandleTableUsage; ULONG HighWaterNumberOfObjects; ULONG HighWaterNumberOfHandles; ULONG HighWaterPagedPoolUsage; ULONG HighWaterNonPagedPoolUsage; ULONG HighWaterNamePoolUsage; ULONG HighWaterHandleTableUsage; ULONG InvalidAttributes; GENERIC_MAPPING GenericMapping; ULONG ValidAccessMask; BOOLEAN SecurityRequired; BOOLEAN MaintainHandleCount; UCHAR TypeIndex; // since WINBLUE CHAR ReservedByte; ULONG PoolType; ULONG DefaultPagedPoolCharge; ULONG DefaultNonPagedPoolCharge; } OBJECT_TYPE_INFORMATION2, *POBJECT_TYPE_INFORMATION2; //#include <WtsApi32.h> //#pragma comment(lib, "WtsApi32.lib") namespace ArkDrvApi { namespace Object { bool ObjectTypeEnumR3(std::vector<ARK_OBJECT_TYPE_ITEM> &items) { NTSTATUS status; __NtQueryObject pNtQueryObject = (__NtQueryObject)GetProcAddress(GetModuleHandleA("ntdll.dll"), "NtQueryObject"); if (!pNtQueryObject) return false; ULONG bufsize = PAGE_SIZE; PVOID buf = VirtualAlloc(NULL, bufsize, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); while ((status = pNtQueryObject( INVALID_HANDLE_VALUE, ObjectTypesInformation, buf, bufsize, NULL )) == STATUS_INFO_LENGTH_MISMATCH) { VirtualFree(buf, bufsize, MEM_RELEASE); bufsize *= 2; buf = VirtualAlloc(NULL, bufsize, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); } if (!NT_SUCCESS(status)) { VirtualFree(buf, bufsize, MEM_RELEASE); return status; } POBJECT_TYPES_INFORMATION obj_types = (POBJECT_TYPES_INFORMATION)buf; POBJECT_TYPE_INFORMATION obj_info = (POBJECT_TYPE_INFORMATION)(((PUCHAR)obj_types) + ALIGN_UP(sizeof(*obj_types), ULONG_PTR)); for (ULONG i = 0; i < obj_types->NumberOfTypes; i++) { ARK_OBJECT_TYPE_ITEM item; item.type_index = i + 2; RtlZeroMemory(item.type_name, sizeof(item.type_name)); RtlCopyMemory(item.type_name, obj_info->TypeName.Buffer, obj_info->TypeName.Length*2); std::wstring &&type_name = UNONE::StrTrimRightW(item.type_name); RtlCopyMemory(item.type_name, type_name.c_str(), (type_name.size()+1) * 2); item.type_object = NULL; item.total_objects = obj_info->TotalNumberOfObjects; item.total_handles = obj_info->TotalNumberOfHandles; items.push_back(item); obj_info = (POBJECT_TYPE_INFORMATION) ((PCHAR)(obj_info + 1) + ALIGN_UP(obj_info->TypeName.MaximumLength, ULONG_PTR)); } VirtualFree(buf, bufsize, MEM_RELEASE); return true; } bool ObjectTypeEnum(std::vector<ARK_OBJECT_TYPE_ITEM> &items) { return ObjectTypeEnumR3(items); } typedef NTSTATUS(NTAPI *__NtOpenDirectoryObject)( __out PHANDLE DirectoryHandle, __in ACCESS_MASK DesiredAccess, __in POBJECT_ATTRIBUTES ObjectAttributes ); typedef NTSTATUS(NTAPI *__NtQueryDirectoryObject)( __in HANDLE DirectoryHandle, __out_bcount_opt(Length) PVOID Buffer, __in ULONG Length, __in BOOLEAN ReturnSingleEntry, __in BOOLEAN RestartScan, __inout PULONG Context, __out_opt PULONG ReturnLength ); typedef struct _OBJECT_DIRECTORY_INFORMATION { UNICODE_STRING Name; UNICODE_STRING TypeName; } OBJECT_DIRECTORY_INFORMATION, *POBJECT_DIRECTORY_INFORMATION; typedef enum _WTS_CONNECTSTATE_CLASS { WTSActive, // User logged on to WinStation WTSConnected, // WinStation connected to client WTSConnectQuery, // In the process of connecting to client WTSShadow, // Shadowing another WinStation WTSDisconnected, // WinStation logged on without client WTSIdle, // Waiting for client to connect WTSListen, // WinStation is listening for connection WTSReset, // WinStation is being reset WTSDown, // WinStation is down due to error WTSInit, // WinStation in initialization } WTS_CONNECTSTATE_CLASS; #define WTS_CURRENT_SERVER_HANDLE ((HANDLE)NULL) typedef struct _WTS_SESSION_INFOW { DWORD SessionId; // session id LPWSTR pWinStationName; // name of WinStation this session is // connected to WTS_CONNECTSTATE_CLASS State; // connection state (see enum) } WTS_SESSION_INFOW, *PWTS_SESSION_INFOW; typedef struct _SESSION_INFOW { DWORD SessionId; // session id std::wstring pWinStationName; // name of WinStation this session is // connected to WTS_CONNECTSTATE_CLASS State; // connection state (see enum) } SESSION_INFOW, *PSESSION_INFOW; bool GetSessions(std::vector<SESSION_INFOW> &sinfos) { typedef BOOL (WINAPI *__WTSEnumerateSessionsW)( IN HANDLE hServer, IN DWORD Reserved, IN DWORD Version, PWTS_SESSION_INFOW *ppSessionInfo, DWORD *pCount ); typedef void (WINAPI *__WTSFreeMemory)( IN PVOID pMemory ); HMODULE wts = GetModuleHandleA("Wtsapi32.dll"); if (!wts) wts = LoadLibraryA("Wtsapi32.dll"); __WTSEnumerateSessionsW pWTSEnumerateSessionsW = (__WTSEnumerateSessionsW)GetProcAddress(wts, "WTSEnumerateSessionsW"); __WTSFreeMemory pWTSFreeMemory = (__WTSFreeMemory)GetProcAddress(wts, "WTSFreeMemory"); if (!pWTSEnumerateSessionsW || !pWTSFreeMemory) return false; DWORD scount = 0; PWTS_SESSION_INFOW sessions = NULL; BOOL ret = pWTSEnumerateSessionsW(WTS_CURRENT_SERVER_HANDLE, 0, 1, &sessions, &scount); if (!ret) { ERR(L"WTSEnumerateSessionsW err:%d", GetLastError()); return false; } for (int i = 0; i < scount; i++) { SESSION_INFOW info; info.SessionId = sessions[i].SessionId; info.pWinStationName = sessions[i].pWinStationName; info.State = sessions[i].State; sinfos.push_back(info); } pWTSFreeMemory(sessions); return true; } bool ObjectSectionEnumR3(std::vector<ARK_OBJECT_SECTION_ITEM> &items, ULONG session) { std::wstring dirname, prefix; if (session == ARK_SESSION_GLOBAL) { dirname = L"\\BaseNamedObjects"; prefix = L"Global"; } else { dirname = UNONE::StrFormatW(L"\\Sessions\\%u\\BaseNamedObjects", session); prefix = L""; } #define DIRECTORY_QUERY (0x0001) NTSTATUS status; __NtOpenDirectoryObject pNtOpenDirectoryObject = (__NtOpenDirectoryObject)GetProcAddress(GetModuleHandleA("ntdll.dll"), "NtOpenDirectoryObject"); __NtQueryDirectoryObject pNtQueryDirectoryObject = (__NtQueryDirectoryObject)GetProcAddress(GetModuleHandleA("ntdll.dll"), "NtQueryDirectoryObject"); if (!pNtOpenDirectoryObject || !pNtQueryDirectoryObject) return false; HANDLE dirobj; OBJECT_ATTRIBUTES oa; UNICODE_STRING udirname; udirname.Buffer = (WCHAR*)dirname.c_str(); udirname.Length = dirname.size() * 2; udirname.MaximumLength = udirname.Length; InitializeObjectAttributes(&oa, &udirname, 0, NULL, NULL); status = pNtOpenDirectoryObject(&dirobj, DIRECTORY_QUERY, &oa); if (!NT_SUCCESS(status)) { ERR(L"NtOpenDirectoryObject status:%d", status); return false; } ULONG context, written; ULONG bufsize = 512; POBJECT_DIRECTORY_INFORMATION info = (POBJECT_DIRECTORY_INFORMATION)malloc(bufsize); if (!info) return false; status = pNtQueryDirectoryObject(dirobj, info, bufsize, TRUE, TRUE, &context, &written); if (!NT_SUCCESS(status)) { CloseHandle(dirobj); free(info); ERR(L"NtQueryDirectoryObject status:%d", status); return false; } while (NT_SUCCESS(pNtQueryDirectoryObject(dirobj, info, bufsize, TRUE, FALSE, &context, &written))) { if (!wcsncmp(L"Section", info->TypeName.Buffer, 7)) { ARK_OBJECT_SECTION_ITEM item; RtlZeroMemory(item.section_name, sizeof(item.section_name)); RtlZeroMemory(item.section_dir, sizeof(item.section_dir)); wcsncpy(item.section_name, info->Name.Buffer, MIN(info->Name.Length / 2, 127)); wcsncpy(item.section_dir, dirname.c_str(), MIN(dirname.size(), 127)); std::wstring map_name; if (!prefix.empty()) { map_name = UNONE::StrFormatW(L"%s\\%s", prefix.c_str(), item.section_name); } else { map_name = item.section_name; } HANDLE maphd = OpenFileMappingW(FILE_MAP_READ, FALSE, map_name.c_str()); if (maphd) { PVOID mapaddr = MapViewOfFileEx(maphd, FILE_MAP_READ, 0, 0, 0, NULL); MEMORY_BASIC_INFORMATION mbi; VirtualQuery(mapaddr, &mbi, sizeof(mbi)); item.section_size = (ULONG)mbi.RegionSize; UnmapViewOfFile(mapaddr); CloseHandle(maphd); } item.session_id = session; items.push_back(item); } } CloseHandle(dirobj); free(info); return true; } bool ObjectSectionEnum(std::vector<ARK_OBJECT_SECTION_ITEM> &items, ULONG session) { return ObjectSectionEnumR3(items, session); } bool ObjectSectionEnum(std::vector<ARK_OBJECT_SECTION_ITEM> &items) { std::vector<ARK_OBJECT_SECTION_ITEM> temps; ObjectSectionEnumR3(temps, ARK_SESSION_GLOBAL); items.insert(items.end(), temps.begin(), temps.end()); for (auto &item : items) { wcscpy(item.session_name, L"Global"); } std::vector<SESSION_INFOW> sinfos; GetSessions(sinfos); for (int i = 0; i < sinfos.size(); i++) { temps.clear(); ObjectSectionEnumR3(temps, sinfos[i].SessionId); for (auto &item : temps) { wcscpy(item.session_name, sinfos[i].pWinStationName.c_str()); } items.insert(items.end(), temps.begin(), temps.end()); } return true; } } // namespace Object } // namespace ArkDrvApi #endif
12,164
C++
.cpp
326
34.892638
150
0.727982
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,215
api-wingui.cpp
BlackINT3_OpenArk/src/OpenArkDrv/arkdrv-api/api-wingui/api-wingui.cpp
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #include "api-wingui.h" #ifdef _ARKDRV_ #else namespace ArkDrvApi { namespace WinGUI { bool HotkeyEnumInfo(std::vector<HOTKEY_ITEM> &hotkeys) { if (!ConnectDriver()) return false; DWORD op = HOTKEY_ENUM; PHOTKEY_INFO info; DWORD outlen; int hkmarks[HOTKEY_MAX_VK+1] = { 0 }; for (int i = 1; i <= HOTKEY_MAX_VK; i++) { if (RegisterHotKey(NULL, HOTKEY_PLACEHOLDER_ID + i, MOD_ALT | MOD_NOREPEAT, i)) { hkmarks[i] = ~i; } else { OutputDebugStringA(UNONE::StrFormatA("Register err:%s\n", UNONE::OsDosErrorMsgA(GetLastError()).c_str()).c_str()); } } bool ret = IoControlDriver(IOCTL_ARK_HOTKEY, op, NULL, 0, (PVOID*)&info, &outlen); for (int i = 1; i <= HOTKEY_MAX_VK; i++) { if (hkmarks[i]) { UnregisterHotKey(NULL, HOTKEY_PLACEHOLDER_ID + i); } } if (!ret) return false; for (int i = 0; i < info->count; i++) { hotkeys.push_back(info->items[i]); } free(info); return true; } bool HotkeyRemoveInfo(HOTKEY_ITEM &item) { DWORD op = HOTKEY_REMOVE; DWORD out; DWORD outlen; bool ret = IoControlDriver(IOCTL_ARK_HOTKEY, op, &item, sizeof(item), (PVOID*)&out, &outlen); if (!ret) return false; return true; } } // namespace WinGUI } // namespace ArkDrvApi #endif
1,990
C++
.cpp
59
32.016949
117
0.659244
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,216
api-storage.cpp
BlackINT3_OpenArk/src/OpenArkDrv/arkdrv-api/api-storage/api-storage.cpp
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #include "api-storage.h" #ifdef _ARKDRV_ #else namespace ArkDrvApi { namespace Storage { bool UnlockEnum(const std::wstring &path, std::vector<HANDLE_ITEM> &items) { std::string outdata; bool ret = IoControlDriver(IOCTL_ARK_STORAGE, STORAGE_UNLOCK_ENUM, path, outdata); if (!ret) return false; PHANDLE_INFO info = (PHANDLE_INFO)outdata.c_str(); for (int i = 0; i < info->count; i++) { items.push_back(info->items[i]); } return true; } bool UnlockClose(HANDLE_ITEM &item) { std::string indata; std::string outdata; indata.assign((char *)&item, sizeof(HANDLE_ITEM)); bool ret = IoControlDriver(IOCTL_ARK_STORAGE, STORAGE_UNLOCK_CLOSE, indata, outdata); if (!ret) return false; return true; } bool HotkeyRemoveInfo(HOTKEY_ITEM &item) { return false; } } // namespace Storage } // namespace ArkDrvApi #endif
1,617
C++
.cpp
47
33.021277
86
0.682398
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,217
coderkit.h
BlackINT3_OpenArk/src/OpenArk/coderkit/coderkit.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include <QtGui> #include <QtCore> #include <QtWidgets> #include <QMutex> #include <qbuttongroup.h> #include <Windows.h> #include <mutex> #include "ui_coderkit.h" #include "../common/ui-wrapper/ui-wrapper.h" namespace Ui { class CoderKit; class OpenArkWindow; } class OpenArk; class CoderKit : public CommonMainTabObject { Q_OBJECT public: CoderKit(QWidget* parent, int tabid); ~CoderKit(); private slots: void onTabChanged(int index); void onCodeTextChanged(); void onCodeTextChanged(const QString &text); void onWindowsErrorTextChanged(const QString &text); void onMessageId(); void onAlgIndexChanged(int index); void onAlgPlainChanged(); void onFormatChanged(); private: void InitAsmToolsView(); void UpdateAlgorithmText(bool crypt); void UpdateEditCodeText(const std::wstring& data, QObject* ignored_obj); QString Rasm2Asm(std::string data, int cpu, int byteorder, const std::string &format); QString Rasm2Disasm(std::string data, int cpu, int byteorder); QString NasmAsm(std::string data, int bits, const std::string &format); QString NasmDisasm(const std::string &data, int bits); void SolveCodeTextFormat(std::string &text, std::string &format, int interval, int id); std::string UrlEncode(const std::string &buf, std::vector<char> pass); std::string UrlDecode(const std::string &buf); std::string UrlEncodeURL(const std::string &buf); private: Ui::CoderKit ui; std::mutex upt_mutex_; int alg_idx_; bool is_user_; bool is_format_changed_; QButtonGroup radio_group_type_; QButtonGroup radio_group_interval_; };
2,362
C++
.h
65
34.769231
88
0.725011
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,218
scanner.h
BlackINT3_OpenArk/src/OpenArk/scanner/scanner.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include <QtGui> #include <QtCore> #include <QtWidgets> #include <QMutex> #include <Windows.h> #include <mutex> #include "ui_scanner.h" #include "../common/ui-wrapper/ui-wrapper.h" namespace Ui { class Scanner; class OpenArkWindow; } class OpenArk; class Scanner : public CommonMainTabObject { Q_OBJECT public: Scanner(QWidget *parent, int tabid); ~Scanner(); protected: bool eventFilter(QObject *obj, QEvent *e); public slots: void onTabChanged(int index); void onOpenFile(const QString& file); void onRefresh(); private slots: void dragEnterEvent(QDragEnterEvent *event); void dragMoveEvent(QDragMoveEvent *event); void dropEvent(QDropEvent *event); void onImportChanged(const QModelIndex &current, const QModelIndex &previous); void onRelocChanged(const QModelIndex &current, const QModelIndex &previous); void onExpandAll(); void onTextChanged(const QString& text); private: std::wstring GuessFileType(); bool CheckIsPe(); void RefreshSummary(const std::wstring& path); void RefreshHeaders(); void RefreshSections(); void RefreshImport(); void RefreshExport(); void RefreshResource(); void RefreshRelocation(); void RefreshDebug(); void RefreshRva(); bool MapPe(const std::wstring& path); bool UnmapPe(); private: Ui::Scanner ui; QString pe_file_; CHAR* pe_image_; bool pe_x64_; bool pe_valid_; QStandardItemModel* sumup_model_; QStandardItemModel* sumdown_model_; QStandardItemModel* headers_model_; QStandardItemModel* sections_model_; QStandardItemModel* imp_model_; QStandardItemModel* imp_func_model_; QStandardItemModel* exp_model_; QStandardItemModel* exp_func_model_; QStandardItemModel* reloc_model_; QStandardItemModel* reloc_item_model_; QStandardItemModel* dbg_model_; QMenu* headers_menu_; int64_t base_prev_; std::mutex upt_mutex_; };
2,617
C++
.h
83
29.855422
79
0.736738
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,219
process-properties.h
BlackINT3_OpenArk/src/OpenArk/process-mgr/process-properties.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include <QtCore> #include <QtWidgets> #include <Windows.h> #include "ui_process-properties.h" #include "../common/cache/cache.h" namespace Ui { class ProcessProperties; } class ProcessProperties : public QWidget { Q_OBJECT public: ProcessProperties(QWidget* parent, DWORD pid, int tab); ~ProcessProperties(); protected: bool eventFilter(QObject *obj, QEvent *e); public slots: void onRefresh(); private slots: void onTimer(); void onTabChanged(); void onExploreFile(); private: void ShowImageDetail(); void ShowThreads(); void ShowWindowList(); private: Ui::ProcessProperties ui; QStandardItemModel *threads_model_; QStandardItemModel *wnds_model_; DWORD pid_; ProcInfo pinfo_; QMenu *menu_; QTimer timer_; };
1,544
C++
.h
50
29.38
77
0.698253
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,220
process-mgr.h
BlackINT3_OpenArk/src/OpenArk/process-mgr/process-mgr.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include <QtGui> #include <QtCore> #include <QtWidgets> #include <QMutex> #include <Windows.h> #include "ui_process-mgr.h" #include "../common/common.h" namespace Ui { class ProcessMgr; class OpenArkWindow; } class OpenArk; PROXY_FILTER(ProcSortFilterProxyModel); class ModSortFilterProxyModel : public QSortFilterProxyModel { Q_OBJECT public: ModSortFilterProxyModel(QWidget *parent) {}; ~ModSortFilterProxyModel() {}; int bottom_idx_; protected: bool lessThan(const QModelIndex &left, const QModelIndex &right) const; }; class ProcessMgr : public QWidget { Q_OBJECT public: ProcessMgr(QWidget* parent); ~ProcessMgr(); signals: void signalOpen(QString); protected: bool eventFilter(QObject *obj, QEvent *e); public slots : void onOpenFile(const QString& file); void onRefresh(); void onReset(); void onProcSelection(QString pid); private slots: void onTimer(); void onCopyActionTriggerd(QAction* action); void onKillProcess(); void onKillProcessTree(); void onRestartProcess(); void onSuspendProcess(); void onInjectDll(); void onSelectPid(); void onExploreFile(); void onCreateMiniDump(); void onCreateFullDump(); void onEnumThread(); void onEnumWindow(); void onSendtoScanner(); void onVerifySignature(); void onVerifyAllSignature(); void onShowProperties(); void onCloseHandle(); void onHideUnnamedHandles(bool checked); void onHideMemoryItem(bool checked); void onDumpMemory(); void onShowBottom(int idx); void onShowProcess(); void onShowModule(); void onShowHandle(); void onShowMemory(); void onSectionClicked(int idx); void onProcDoubleClicked(const QModelIndex &idx); void onProcChanged(const QModelIndex &current, const QModelIndex &previous); private: void InitProcessView(); void InitBottomCommon(); void InitModuleView(); void InitHandleView(); void InitMemoryView(); void ShowProperties(DWORD pid, int tab); void ShowProcessList(); void ShowProcessTree(); void AppendProcessItem(QStandardItem *parent, QStandardItem *name_item, ProcInfo info, int seq); void AjustProcessStyle(); int ProcCurRow(); int ProcCurCol(); DWORD ProcCurPid(); QString ProcCurViewItemData(int column); QString ProcViewItemData(int row, int column); QString BottomCurViewItemData(int column); QString ModViewItemData(int row, int column); private: int proc_header_idx_; int bottom_header_idx_; int bottom_header_last_; int bottom_idx_; bool unnamed_checked_; bool uncommed_checked_; bool nonexec_checked_; bool imaged_checked_; DWORD cur_pid_; private: Ui::ProcessMgr ui; OpenArk *parent_; QLabel *cpu_percent_label_; QLabel *mm_percent_label_; QLabel *cntproc_label_; QLabel *cntthread_label_; QLabel *cnthandle_label_; QMenu *proc_menu_; QMenu *mod_menu_; QMenu *hd_menu_; QMenu *mem_menu_; QTimer timer_; QPoint proc_sel_; QStandardItemModel *proc_model_; QStandardItemModel *bottom_model_; QStandardItemModel *hd_model_; QStandardItemModel *mem_model_; ProcSortFilterProxyModel *proxy_proc_; ModSortFilterProxyModel *proxy_bottom_; };
3,838
C++
.h
131
27.51145
97
0.755279
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,221
process-selection.h
BlackINT3_OpenArk/src/OpenArk/process-mgr/process-selection.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include <QtCore> #include <QtWidgets> #include <Windows.h> #include "process-mgr.h" #include "ui_process-selection.h" namespace Ui { class ProcessSelection; } class ProcessSelection : public QDialog { Q_OBJECT public: ProcessSelection(QWidget* parent); ~ProcessSelection(); signals: void procSelection(QString); private slots: void onLocateProcess(); void onPidChanged(const QString &text); void onToggled(bool checked); private: DWORD GetInputPid(); Ui::ProcessSelection ui; ProcessMgr *parent_; };
1,323
C++
.h
40
31.725
77
0.691406
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,222
reverse.h
BlackINT3_OpenArk/src/OpenArk/reverse/reverse.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include <QtCore> #include <QtWidgets> #include <Windows.h> #include "ui_reverse.h" #include <QString> #include <QNetworkAccessManager> #include <QNetworkRequest> #include <QNetworkReply> #include <QUrl> #include <QFile> #include <QDebug> #include <QProgressBar> #include "../common/ui-wrapper/ui-wrapper.h" class OpenArk; class Ui::Reverse; typedef struct _WINTOOL_ITEM { int type; QString name; QString exec; QString uri; } WINTOOL_ITEM; class Reverse : public CommonMainTabObject { Q_OBJECT public: Reverse(QWidget *parent, int tabid); ~Reverse(); private slots: void onTabChanged(int index); void onExecute(); void readContent(); void onProgress(qint64 bytesSent, qint64 bytesTotal); private: void DownloadAndExecuteFile(WINTOOL_ITEM wintool); void InitWindowsView(); void InitLinuxView(); void InitAndroidView(); void InitDevKitsView(); private: Ui::Reverse ui; QNetworkReply *reply; QFile *file; };
1,738
C++
.h
58
28.534483
77
0.712067
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,223
about.h
BlackINT3_OpenArk/src/OpenArk/about/about.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include <QtCore> #include <QtWidgets> #include <Windows.h> #include "ui_about.h" namespace Ui { class About; } class About : public QWidget { Q_OBJECT public: About(QWidget* parent); ~About(); private slots: private: Ui::About ui; };
1,054
C++
.h
32
31.59375
77
0.652559
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,224
utilities.h
BlackINT3_OpenArk/src/OpenArk/utilities/utilities.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include <QtCore> #include <QtWidgets> #include <Windows.h> #include "ui_utilities.h" #include "../common/ui-wrapper/ui-wrapper.h" class OpenArk; class Ui::Utilities; class JunksSortFilterProxyModel : public QSortFilterProxyModel { Q_OBJECT public: JunksSortFilterProxyModel(QWidget *parent) {}; ~JunksSortFilterProxyModel() {}; protected: bool lessThan(const QModelIndex &left, const QModelIndex &right) const; }; struct JunkItem { QString name; QString path; DWORD64 size; }; struct JunkCluster { QString dir; DWORD64 sumsize; QList<JunkItem> items; }; class ScanJunksThread : public QThread { Q_OBJECT signals: void appendJunks(JunkCluster); protected: void run(); public: QList<JunkCluster> junks_cluster_; bool is_custom_scan_ = false; bool is_builtin_scan_ = false; QStringList custom_path_; QString custom_suffex_; }; class CleanJunksThread : public QThread { Q_OBJECT signals: void cleanJunks(JunkCluster); public: void setJunkCluster(QList<JunkCluster> clusters) { junks_cluster_ = clusters; }; protected: void run(); private: QList<JunkCluster> junks_cluster_; }; class Utilities : public CommonMainTabObject { Q_OBJECT public: Utilities(QWidget *parent, int tabid); ~Utilities(); public: void RecordAppServer(const QString &svr); private slots: void onTabChanged(int index); void onOpJunkfiles(int, JunkCluster); void onAppendJunkfiles(JunkCluster); void onCleanJunkfiles(JunkCluster); private: void InitCleanerView(); void InitSystemToolsView(); void RemoveCleanerItems(); QVector<int> removed_rows_; private: QString app_server_; QStandardItemModel *junks_model_; JunksSortFilterProxyModel *proxy_junks_; ScanJunksThread *scanjunks_thread_; CleanJunksThread *cleanjunks_thread_; Ui::Utilities ui; };
2,572
C++
.h
90
27.011111
81
0.743123
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,225
common.h
BlackINT3_OpenArk/src/OpenArk/common/common.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include <unone.h> using namespace UNONE::Plugins; #include "win-wrapper/win-wrapper.h" #include "qt-wrapper/qt-wrapper.h" #include "cpp-wrapper/cpp-wrapper.h" #include "app/app.h" #include "cache/cache.h" #include "config/config.h"
1,041
C++
.h
24
42.375
77
0.657817
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,226
qt-wrapper.h
BlackINT3_OpenArk/src/OpenArk/common/qt-wrapper/qt-wrapper.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include <unone.h> #include <Windows.h> #include <QtGui> #include <QtCore> #include <QtWidgets> #include <QIcon> #include <QPainter> #include <QProxyStyle> #include <QSize> #include <QTreeView> #include <QModelIndex> #include <QStandardItem> #include <QAbstractItemView> #include <QMessageBox> #include <QPoint> #include <QJsonObject> #include <QJsonDocument> #include <QJsonArray> #include <openark/openark.h> extern QTranslator *app_tr; extern OpenArk *openark; extern QApplication *app; class OpenArkTabStyle : public QProxyStyle { public: QSize sizeFromContents(ContentsType type, const QStyleOption *option, const QSize &size, const QWidget *widget) const; void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = 0) const; }; // Language #include <qtranslator.h> class OpenArkLanguage : public QObject { Q_OBJECT public: OpenArkLanguage() { curlang_ = -1; }; ~OpenArkLanguage() {}; public: static OpenArkLanguage* Instance(); void ChangeLanguage(int lang); int GetLanguage() { return curlang_; }; signals: void languageChaned(); private: static OpenArkLanguage *langobj_; int curlang_; }; #define PROXY_FILTER(classname) \ class classname : public QSortFilterProxyModel {\ Q_OBJECT \ public: \ classname(QWidget *parent) {};\ ~classname() {}; \ protected: \ bool lessThan(const QModelIndex &left, const QModelIndex &right) const; \ }; #define TR(str) QObject::tr(str) #define TRA(str) QObject::tr(str).toStdString().c_str() #define TRW(str) QObject::tr(str).toStdWString().c_str() #define QToChars(qstr) qstr.toStdString().c_str() #define QToWChars(qstr) qstr.toStdWString().c_str() #define QToStr(qstr) qstr.toStdString() #define QToWStr(qstr) qstr.toStdWString() #define QDecToDWord(qstr) UNONE::StrToDecimalW(qstr.toStdWString()) #define QHexToDWord(qstr) UNONE::StrToHexW(qstr.toStdWString()) #define QDecToQWord(qstr) UNONE::StrToDecimal64W(qstr.toStdWString()) #define QHexToQWord(qstr) UNONE::StrToHex64W(qstr.toStdWString()) #define CharsToQ(chars) QString::fromLocal8Bit(chars) #define WCharsToQ(wchars) QString::fromWCharArray(wchars) #define StrToQ(str) QString::fromStdString(str) #define WStrToQ(wstr) QString::fromStdWString(wstr) #define ByteToHexQ(w) StrToQ(UNONE::StrFormatA("%02X", w)) #define WordToHexQ(w) StrToQ(UNONE::StrFormatA("%04X", w)) #define DWordToDecQ(w) StrToQ(UNONE::StrFormatA("%d", w)) #define DWordToHexQ(w) StrToQ(UNONE::StrFormatA("%08X", w)) #define QWordToDecQ(w) StrToQ(UNONE::StrFormatA("%lld", w)) #define QWordToHexQ(w) StrToQ(UNONE::StrFormatA("%016llX", w)) inline void MsgBoxInfo(QString msg) { QMessageBox::information(nullptr, QObject::tr("OpenArk Information"), msg); } inline void MsgBoxWarn(QString msg) { QMessageBox::warning(nullptr, QObject::tr("OpenArk Warning"), msg); } inline void MsgBoxError(QString msg) { QMessageBox::critical(nullptr, QObject::tr("OpenArk Error"), msg); } inline void LabelSuccess(QLabel* label, QString msg) { label->setText(msg); label->setStyleSheet("color:green"); } inline void LabelError(QLabel* label, QString msg) { label->setText(msg); label->setStyleSheet("color:red"); } inline QStringList VectorToQList(const std::vector<std::string>& vec) { QStringList result; for (auto& s : vec) { result.append(StrToQ(s)); } return result; }; inline QStringList WVectorToQList(const std::vector<std::wstring>& vec) { QStringList result; for (auto& s : vec) { result.append(WStrToQ(s)); } return result; }; inline std::vector<std::string> QListToVector(const QStringList& lst) { std::vector<std::string> result; for (auto& s : lst) { result.push_back(s.toStdString()); } return result; }; inline std::vector<std::wstring> QListToWVector(const QStringList& lst) { std::vector<std::wstring> result; for (auto& s : lst) { result.push_back(s.toStdWString()); } return result; }; __inline QString ByteArrayToHexQ(BYTE* arr, int len) { std::string str = UNONE::StrStreamToHexStrA(std::string((char*)arr, len)); str = UNONE::StrInsertA(str, 2, " "); return StrToQ(str); }; __inline QString WordArrayToHexQ(WORD* arr, int len) { std::string str = UNONE::StrStreamToHexStrA(std::string((char*)arr, len * 2)); str = UNONE::StrInsertA(str, 4, " "); return StrToQ(str); }; #define AppendTreeItem(root, name, value) \ item = new QStandardItem(name); \ root->appendRow(item); \ root->setChild(row++, 1, new QStandardItem(value)); #define InitTableItem(root) \ int column = 0;\ int count = root->rowCount();\ QStandardItem *item;\ #define InitTableItem2(root, cnt) \ int column = 0;\ count = cnt;\ QStandardItem *item;\ #define AppendTableItem(root, value) \ item = new QStandardItem(value);\ root->setItem(count, column++, item); #define AppendTableIconItem(root, ico, value) \ item = new QStandardItem(ico, value);\ root->setItem(count, column++, item); #define AppendNameValue(root, name, value) \ root->setItem(count, 0, new QStandardItem(name)); \ root->setItem(count, 1, new QStandardItem(value)); \ count++ #define AppendTableRowNameVaule(root, name, value) \ count = root->rowCount();\ root->setItem(count, 0, new QStandardItem(name)); \ root->setItem(count, 1, new QStandardItem(value)); \ // MVC wrapper QModelIndex GetCurItemView(QAbstractItemView *view, int column); QString GetItemModelData(QAbstractItemModel *model, int row, int column); QString GetItemViewData(QAbstractItemView *view, int row, int column); QString GetCurItemViewData(QAbstractItemView *view, int column); void SetCurItemViewData(QAbstractItemView *view, int column, QString val); int GetCurViewRow(QAbstractItemView *view); int GetCurViewColumn(QAbstractItemView *view); void ClearItemModelData(QStandardItemModel* model, int pos = 0); void ExpandTreeView(const QModelIndex& index, QTreeView* view); void SetDefaultTableViewStyle(QTableView* view, QStandardItemModel* model); void SetDefaultTreeViewStyle(QTreeView* view, QStandardItemModel* model); void SetDefaultTreeViewStyle(QTreeView* view, QStandardItemModel* model, QSortFilterProxyModel *proxy, std::vector<std::pair<int, QString>>& layout); int GetLayoutIndex(std::vector<std::pair<int, QString>> &layout, QString name); #define LAYOUT_INDEX(str) GetLayoutIndex(layout, tr(str)) void SetLineBgColor(QStandardItemModel *model, int row, const QBrush &abrush); void SetLineHidden(QTreeView *view, int row, bool hide); // Others QIcon LoadIcon(QString file_path); bool IsContainAction(QMenu *menu, QObject *obj); bool ExploreFile(QString file_path); QString MsToTime(LONGLONG ms); // Json bool JsonParse(const QByteArray &data, QJsonObject &obj); bool JsonGetValue(const QJsonObject &obj, const QString &key, QJsonValue &val); bool JsonGetValue(const QByteArray &data, const QString &key, QJsonValue &val); // void ShellOpenUrl(QString url); void ShellRun(QString cmdline, QString param); void ShellRunHide(QString cmdline, QString param); void ShellRunCmdExe(QString exe, int show = SW_SHOW); void ShellRunCmdDir(QString dir); QString PidFormat(DWORD pid); QString NameFormat(QString name);
7,857
C++
.h
215
35.106977
122
0.755544
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,227
reg-wrapper.h
BlackINT3_OpenArk/src/OpenArk/common/win-wrapper/reg-wrapper.h
#ifndef _UNONE_REGISTRY_H_ #define _UNONE_REGISTRY_H_ #pragma once #include <windows.h> #include <string> #include <vector> namespace UNONE { // Utility class to read, write and manipulate the Windows Registry. // Registry vocabulary primer: a "key" is like a folder, in which there // are "values", which are <name, data> pairs, with an associated data type. // // Note: // ReadValue family of functions guarantee that the return arguments // are not touched in case of failure. class RegistryKey { public: RegistryKey(); RegistryKey(HKEY rootkey, const char* subkey, REGSAM access); ~RegistryKey(); LONG Create(HKEY rootkey, const char* subkey, REGSAM access); LONG CreateWithDisposition(HKEY rootkey, const char* subkey, DWORD* disposition, REGSAM access); // Creates a subkey or open it if it already exists. LONG CreateKey(const char* name, REGSAM access); // Opens an existing reg key. LONG Open(HKEY rootkey, const char* subkey, REGSAM access); // Opens an existing reg key, given the relative key name. LONG OpenKey(const char* relative_key_name, REGSAM access); // Closes this reg key. void Close(); // Returns false if this key does not have the specified value, of if an error // occurrs while attempting to access it. bool HasValue(const char* value_name) const; // Returns the number of values for this key, of 0 if the number cannot be // determined. DWORD GetValueCount() const; // Determine the nth value's name. LONG GetValueNameAt(int index, std::string& name) const; // True while the key is valid. bool Valid() const { return key_ != NULL; } // Kill a key and everything that live below it; please be careful when using // it. // delete subkeys only LONG DeleteKey(const char* name); // Kill a key and everything that live below it and itself // access is KEY_WOW64_32KEY or KEY_WOW64_64KEY // delete subkeys and self static LONG DeleteKey(HKEY rootkey, const char* subkey, REGSAM access = 0); // Deletes a single value within the key. LONG DeleteValue(const char* name); // Getters: // Returns an int32 value. If |name| is NULL or empty, returns the default // value, if any. LONG ReadValueDW(const char* name, DWORD* out_value) const; // Returns an int64 value. If |name| is NULL or empty, returns the default // value, if any. LONG ReadInt64(const char* name, __int64* out_value) const; // Returns a string value. If |name| is NULL or empty, returns the default // value, if any. LONG ReadValue(const char* name, std::string& out_value) const; // Reads a REG_MULTI_SZ registry field into a vector of strings. Clears // |values| initially and adds further strings to the list. Returns // ERROR_CANTREAD if type is not REG_MULTI_SZ. LONG ReadValues(const char* name, std::vector<std::string>& values); // Returns raw data. If |name| is NULL or empty, returns the default // value, if any. LONG ReadValue(const char* name, void* data, DWORD* dsize, DWORD* dtype) const; // Setters: // Sets an int32 value. LONG WriteValue(const char* name, DWORD in_value); // Sets a string value. LONG WriteValue(const char* name, const std::string& in_value) ; // Sets raw data, including type. LONG WriteValue(const char* name, const void* data, DWORD dsize, DWORD dtype); // Starts watching the key to see if any of its values have changed. // The key must have been opened with the KEY_NOTIFY access privilege. LONG StartWatching(); // If StartWatching hasn't been called, always returns false. // Otherwise, returns true if anything under the key has changed. // This can't be const because the |watch_event_| may be refreshed. bool HasChanged(); // Will automatically be called by destructor if not manually called // beforehand. Returns true if it was watching, false otherwise. LONG StopWatching(); inline bool IsWatching() const { return watch_event_ != 0; } HANDLE watch_event() const { return watch_event_; } HKEY Handle() const { return key_; } private: HKEY key_; // The registry key being iterated. HANDLE watch_event_; }; // Iterates the entries found in a particular folder on the registry. class RegistryValueIterator { public: RegistryValueIterator(HKEY root_key, const char* folder_key); ~RegistryValueIterator(); DWORD ValueCount() const; // True while the iterator is valid. bool Valid() const; // Advances to the next registry entry. void operator++(); const char* Name() const { return name_; } std::string Value() const { return value_; } DWORD ValueSize() const { return value_size_; } DWORD Type() const { return type_; } int Index() const { return index_; } private: // Read in the current values. bool Read(); // The registry key being iterated. HKEY key_; // Current index of the iteration. int index_; // Current values. char name_[MAX_PATH]; std::string value_; DWORD value_size_; DWORD type_; }; class RegistryKeyIterator { public: RegistryKeyIterator(HKEY root_key, const char* folder_key); ~RegistryKeyIterator(); DWORD SubkeyCount() const; // True while the iterator is valid. bool Valid() const; // Advances to the next entry in the folder. void operator++(); const char* Name() const { return name_; } int Index() const { return index_; } private: // Read in the current values. bool Read(); // The registry key being iterated. HKEY key_; // Current index of the iteration. int index_; char name_[MAX_PATH]; }; } // namespace UNONE #endif // BASE_WIN_REGISTRY_H_
5,470
C++
.h
142
36.373239
97
0.739625
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,228
win-wrapper.h
BlackINT3_OpenArk/src/OpenArk/common/win-wrapper/win-wrapper.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include <vector> #include <map> #include <string> #include <array> #include <QString> #include "../common.h" #include "reg-wrapper.h" #define KB (1024) #define MB (1024*KB) #define GB (1024*MB) #define TB (1024*GB) bool RetrieveThreadTimes(DWORD tid, std::wstring& ct, std::wstring& kt, std::wstring& ut); std::wstring FormatFileTime(FILETIME *file_tm); std::wstring ProcessCreateTime(__in DWORD pid); LONGLONG ProcessCreateTimeValue(__in DWORD pid); bool CreateDump(DWORD pid, const std::wstring& path, bool mini); void ClipboardCopyData(const std::string &data); std::vector<HWND> GetSystemWnds(); int64_t FileTimeToInt64(FILETIME tm); double GetSystemUsageOfCPU(); double GetSystemUsageOfMemory(); SIZE_T GetProcessPrivateWorkingSet(DWORD pid); void SetWindowOnTop(HWND wnd, bool ontop); void WinShowProperties(const std::wstring &path); bool GetCertOwner(const QString &path, QString &owner); bool ObGetObjectName(HANDLE hd, std::string& obj_name); bool ExtractResource(const QString &res, const QString &path); bool WriteFileDataW(__in const std::wstring& fpath, __in int64_t offset, __in const std::string& fdata); bool ReadFileDataW(__in const std::wstring &fpath, __in int64_t offset, __in int64_t readsize, __out std::string &fdata); bool ReadStdout(const std::wstring& cmdline, std::wstring& output, DWORD& exitcode, DWORD timeout = INFINITE); DWORD PsGetPidByWindowW(wchar_t *cls, wchar_t *title); DWORD OsGetExplorerPid(); bool ObLoadDriverRegistryW(__in const std::wstring &file_path, __in std::wstring srv_name); bool ObUnloadDriverRegistryW(__in const std::wstring &srv_name); bool PsKillProcess(__in DWORD pid); ULONG64 GetFreeLibraryAddress(DWORD pid); std::string OsWinVersionInfo(); std::string OsReleaseNumber();
2,547
C++
.h
54
46.148148
121
0.728732
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,229
ui-wrapper.h
BlackINT3_OpenArk/src/OpenArk/common/ui-wrapper/ui-wrapper.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include <windows.h> #include <vector> #include <common/common.h> #include <openark/openark.h> class CommonMainTabObject : public QTabWidget { Q_OBJECT public: CommonMainTabObject(OpenArk *parent) { parent_ = parent; }; ~CommonMainTabObject() {}; public: OpenArk *GetParent() const { return parent_; }; Q_INVOKABLE void SetActiveTab(QVector<int> idx) { tabwidget_->setCurrentIndex(idx[0]); auto tabwidgets = tabwidget_->currentWidget()->findChildren<QTabWidget*>(); if (idx.size() >= 2 && tabwidgets.size() > 0) { auto obj = qobject_cast<QTabWidget*>(tabwidgets.at(0)); obj->setCurrentIndex(idx[1]); } }; Q_INVOKABLE int GetActiveTab() { return tabwidget_->currentIndex(); }; Q_INVOKABLE void SetActiveTab(int idx) { tabwidget_->setCurrentIndex(idx); }; Q_INVOKABLE void RefreshTab() { onTabChanged(GetActiveTab()); }; public slots: virtual void onTabChanged(int index) { auto tabwidgets = tabwidget_->currentWidget()->findChildren<QTabWidget*>(); if (tabwidgets.size() > 0) { auto obj = qobject_cast<QTabWidget*>(tabwidgets.at(0)); emit obj->currentChanged(obj->currentIndex()); } else { QVector<int> tabs; tabs.push_back(index); tabs.push_back(0); OpenArkConfig::Instance()->SetMainTabMap(maintab_id_, tabs); } }; protected: void Init(QTabWidget *tabwidget, int maintab_id) { tabwidget_ = tabwidget; maintab_id_ = maintab_id; tabwidget_->setTabPosition(QTabWidget::West); tabwidget_->tabBar()->setStyle(new OpenArkTabStyle); connect(tabwidget_, SIGNAL(currentChanged(int)), this, SLOT(onTabChanged(int))); }; int maintab_id_; QTabWidget *tabwidget_; OpenArk *parent_; }; class CommonTabObject : public QWidget { Q_OBJECT public: CommonTabObject() {}; ~CommonTabObject() {}; public: Q_INVOKABLE int GetActiveTab() { return tabwidget_->currentIndex(); }; Q_INVOKABLE void SetActiveTab(QVector<int> idx) { tabwidget_->setCurrentIndex(idx[0]); qobject_cast<QTabWidget *>(tabwidget_->currentWidget())->setCurrentIndex(idx[1]); }; public slots: virtual void onTabChanged(int index) { QVector<int> tabs; tabs.push_back(l2tab_id_); tabs.push_back(index); OpenArkConfig::Instance()->SetMainTabMap(maintab_id_, tabs); }; protected: void Init(QTabWidget *tabwidget, int maintab_id, int l2tab_id) { tabwidget_ = tabwidget; maintab_id_ = maintab_id; l2tab_id_ = l2tab_id; connect(tabwidget_, SIGNAL(currentChanged(int)), this, SLOT(onTabChanged(int))); }; int maintab_id_; int l2tab_id_; QTabWidget *tabwidget_; };
3,322
C++
.h
92
33.913043
83
0.702795
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,230
disassembly.h
BlackINT3_OpenArk/src/OpenArk/common/utils/disassembly/disassembly.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include <string> #include <Windows.h> std::string DisasmMemory(ULONG64 pc, char *mem, ULONG memsize, int bits = 64); std::string HexDumpMemory(ULONG64 pc, char *mem, ULONG memsize);
992
C++
.h
20
48.55
78
0.650875
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,231
udis86.h
BlackINT3_OpenArk/src/OpenArk/common/utils/disassembly/udis86/udis86.h
/* udis86 - udis86.h * * Copyright (c) 2002-2009 Vivek Thampi * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef UDIS86_H #define UDIS86_H #include "libudis86/types.h" #include "libudis86/extern.h" #include "libudis86/itab.h" #endif
1,554
C++
.h
31
47.774194
84
0.765943
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,232
extern.h
BlackINT3_OpenArk/src/OpenArk/common/utils/disassembly/udis86/libudis86/extern.h
/* udis86 - libudis86/extern.h * * Copyright (c) 2002-2009, 2013 Vivek Thampi * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef UD_EXTERN_H #define UD_EXTERN_H #ifdef __cplusplus extern "C" { #endif #include "types.h" #if defined(_MSC_VER) && defined(_USRDLL) # ifdef LIBUDIS86_EXPORTS # define LIBUDIS86_DLLEXTERN __declspec(dllexport) # else # define LIBUDIS86_DLLEXTERN __declspec(dllimport) # endif #else # define LIBUDIS86_DLLEXTERN #endif /* ============================= PUBLIC API ================================= */ extern LIBUDIS86_DLLEXTERN void ud_init(struct ud*); extern LIBUDIS86_DLLEXTERN void ud_set_mode(struct ud*, uint8_t); extern LIBUDIS86_DLLEXTERN void ud_set_pc(struct ud*, uint64_t); extern LIBUDIS86_DLLEXTERN void ud_set_input_hook(struct ud*, int (*)(struct ud*)); extern LIBUDIS86_DLLEXTERN void ud_set_input_buffer(struct ud*, const uint8_t*, size_t); #ifndef __UD_STANDALONE__ extern LIBUDIS86_DLLEXTERN void ud_set_input_file(struct ud*, FILE*); #endif /* __UD_STANDALONE__ */ extern LIBUDIS86_DLLEXTERN void ud_set_vendor(struct ud*, unsigned); extern LIBUDIS86_DLLEXTERN void ud_set_syntax(struct ud*, void (*)(struct ud*)); extern LIBUDIS86_DLLEXTERN void ud_input_skip(struct ud*, size_t); extern LIBUDIS86_DLLEXTERN int ud_input_end(const struct ud*); extern LIBUDIS86_DLLEXTERN unsigned int ud_decode(struct ud*); extern LIBUDIS86_DLLEXTERN unsigned int ud_disassemble(struct ud*); extern LIBUDIS86_DLLEXTERN void ud_translate_intel(struct ud*); extern LIBUDIS86_DLLEXTERN void ud_translate_att(struct ud*); extern LIBUDIS86_DLLEXTERN const char* ud_insn_asm(const struct ud* u); extern LIBUDIS86_DLLEXTERN const uint8_t* ud_insn_ptr(const struct ud* u); extern LIBUDIS86_DLLEXTERN uint64_t ud_insn_off(const struct ud*); extern LIBUDIS86_DLLEXTERN const char* ud_insn_hex(struct ud*); extern LIBUDIS86_DLLEXTERN unsigned int ud_insn_len(const struct ud* u); extern LIBUDIS86_DLLEXTERN const struct ud_operand* ud_insn_opr(const struct ud *u, unsigned int n); extern LIBUDIS86_DLLEXTERN int ud_opr_is_sreg(const struct ud_operand *opr); extern LIBUDIS86_DLLEXTERN int ud_opr_is_gpr(const struct ud_operand *opr); extern LIBUDIS86_DLLEXTERN enum ud_mnemonic_code ud_insn_mnemonic(const struct ud *u); extern LIBUDIS86_DLLEXTERN const char* ud_lookup_mnemonic(enum ud_mnemonic_code c); extern LIBUDIS86_DLLEXTERN void ud_set_user_opaque_data(struct ud*, void*); extern LIBUDIS86_DLLEXTERN void* ud_get_user_opaque_data(const struct ud*); extern LIBUDIS86_DLLEXTERN void ud_set_asm_buffer(struct ud *u, char *buf, size_t size); extern LIBUDIS86_DLLEXTERN void ud_set_sym_resolver(struct ud *u, const char* (*resolver)(struct ud*, uint64_t addr, int64_t *offset)); /* ========================================================================== */ #ifdef __cplusplus } #endif #endif /* UD_EXTERN_H */
4,338
C++
.h
79
51.101266
100
0.72213
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
16,233
syn.h
BlackINT3_OpenArk/src/OpenArk/common/utils/disassembly/udis86/libudis86/syn.h
/* udis86 - libudis86/syn.h * * Copyright (c) 2002-2009 * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef UD_SYN_H #define UD_SYN_H #include "types.h" #ifndef __UD_STANDALONE__ # include <stdarg.h> #endif /* __UD_STANDALONE__ */ extern const char* ud_reg_tab[]; uint64_t ud_syn_rel_target(struct ud*, struct ud_operand*); #ifdef __GNUC__ int ud_asmprintf(struct ud *u, const char *fmt, ...) __attribute__ ((format (printf, 2, 3))); #else int ud_asmprintf(struct ud *u, const char *fmt, ...); #endif void ud_syn_print_addr(struct ud *u, uint64_t addr); void ud_syn_print_imm(struct ud* u, const struct ud_operand *op); void ud_syn_print_mem_disp(struct ud* u, const struct ud_operand *, int sign); #endif /* UD_SYN_H */ /* vim: set ts=2 sw=2 expandtab */
2,085
C++
.h
46
43.217391
84
0.739173
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
16,234
udint.h
BlackINT3_OpenArk/src/OpenArk/common/utils/disassembly/udis86/libudis86/udint.h
/* udis86 - libudis86/udint.h -- definitions for internal use only * * Copyright (c) 2002-2009 Vivek Thampi * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _UDINT_H_ #define _UDINT_H_ #include "types.h" #ifdef HAVE_CONFIG_H # include <config.h> #endif /* HAVE_CONFIG_H */ #if defined(UD_DEBUG) && HAVE_ASSERT_H # include <assert.h> # define UD_ASSERT(_x) assert(_x) #else # define UD_ASSERT(_x) #endif /* !HAVE_ASSERT_H */ #if defined(UD_DEBUG) #define UDERR(u, msg) \ do { \ (u)->error = 1; \ fprintf(stderr, "decode-error: %s:%d: %s", \ __FILE__, __LINE__, (msg)); \ } while (0) #else #define UDERR(u, m) \ do { \ (u)->error = 1; \ } while (0) #endif /* !LOGERR */ #define UD_RETURN_ON_ERROR(u) \ do { \ if ((u)->error != 0) { \ return (u)->error; \ } \ } while (0) #define UD_RETURN_WITH_ERROR(u, m) \ do { \ UDERR(u, m); \ return (u)->error; \ } while (0) #ifndef __UD_STANDALONE__ # define UD_NON_STANDALONE(x) x #else # define UD_NON_STANDALONE(x) #endif /* printf formatting int64 specifier */ #ifdef FMT64 # undef FMT64 #endif #if defined(_MSC_VER) || defined(__BORLANDC__) # define FMT64 "I64" #else # if defined(__APPLE__) # define FMT64 "ll" # elif defined(__amd64__) || defined(__x86_64__) # define FMT64 "l" # else # define FMT64 "ll" # endif /* !x64 */ #endif /* define an inline macro */ #if defined(_MSC_VER) || defined(__BORLANDC__) # define UD_INLINE __inline /* MS Visual Studio requires __inline instead of inline for C code */ #else # define UD_INLINE inline #endif #endif /* _UDINT_H_ */
2,960
C++
.h
89
30.404494
84
0.680881
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,235
decode.h
BlackINT3_OpenArk/src/OpenArk/common/utils/disassembly/udis86/libudis86/decode.h
/* udis86 - libudis86/decode.h * * Copyright (c) 2002-2009 Vivek Thampi * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef UD_DECODE_H #define UD_DECODE_H #include "types.h" #include "udint.h" #include "itab.h" #define MAX_INSN_LENGTH 15 /* itab prefix bits */ #define P_none ( 0 ) #define P_inv64 ( 1 << 0 ) #define P_INV64(n) ( ( n >> 0 ) & 1 ) #define P_def64 ( 1 << 1 ) #define P_DEF64(n) ( ( n >> 1 ) & 1 ) #define P_oso ( 1 << 2 ) #define P_OSO(n) ( ( n >> 2 ) & 1 ) #define P_aso ( 1 << 3 ) #define P_ASO(n) ( ( n >> 3 ) & 1 ) #define P_rexb ( 1 << 4 ) #define P_REXB(n) ( ( n >> 4 ) & 1 ) #define P_rexw ( 1 << 5 ) #define P_REXW(n) ( ( n >> 5 ) & 1 ) #define P_rexr ( 1 << 6 ) #define P_REXR(n) ( ( n >> 6 ) & 1 ) #define P_rexx ( 1 << 7 ) #define P_REXX(n) ( ( n >> 7 ) & 1 ) #define P_seg ( 1 << 8 ) #define P_SEG(n) ( ( n >> 8 ) & 1 ) #define P_vexl ( 1 << 9 ) #define P_VEXL(n) ( ( n >> 9 ) & 1 ) #define P_vexw ( 1 << 10 ) #define P_VEXW(n) ( ( n >> 10 ) & 1 ) #define P_str ( 1 << 11 ) #define P_STR(n) ( ( n >> 11 ) & 1 ) #define P_strz ( 1 << 12 ) #define P_STR_ZF(n) ( ( n >> 12 ) & 1 ) /* operand type constants -- order is important! */ enum ud_operand_code { OP_NONE, OP_A, OP_E, OP_M, OP_G, OP_I, OP_F, OP_R0, OP_R1, OP_R2, OP_R3, OP_R4, OP_R5, OP_R6, OP_R7, OP_AL, OP_CL, OP_DL, OP_AX, OP_CX, OP_DX, OP_eAX, OP_eCX, OP_eDX, OP_rAX, OP_rCX, OP_rDX, OP_ES, OP_CS, OP_SS, OP_DS, OP_FS, OP_GS, OP_ST0, OP_ST1, OP_ST2, OP_ST3, OP_ST4, OP_ST5, OP_ST6, OP_ST7, OP_J, OP_S, OP_O, OP_I1, OP_I3, OP_sI, OP_V, OP_W, OP_Q, OP_P, OP_U, OP_N, OP_MU, OP_H, OP_L, OP_R, OP_C, OP_D, OP_MR } UD_ATTR_PACKED; /* * Operand size constants * * Symbolic constants for various operand sizes. Some of these constants * are given a value equal to the width of the data (SZ_B == 8), such * that they maybe used interchangeably in the internals. Modifying them * will most certainly break things! */ typedef uint16_t ud_operand_size_t; #define SZ_NA 0 #define SZ_Z 1 #define SZ_V 2 #define SZ_Y 3 #define SZ_X 4 #define SZ_RDQ 7 #define SZ_B 8 #define SZ_W 16 #define SZ_D 32 #define SZ_Q 64 #define SZ_T 80 #define SZ_O 12 #define SZ_DQ 128 /* double quad */ #define SZ_QQ 256 /* quad quad */ /* * Complex size types; that encode sizes for operands of type MR (memory or * register); for internal use only. Id space above 256. */ #define SZ_BD ((SZ_B << 8) | SZ_D) #define SZ_BV ((SZ_B << 8) | SZ_V) #define SZ_WD ((SZ_W << 8) | SZ_D) #define SZ_WV ((SZ_W << 8) | SZ_V) #define SZ_WY ((SZ_W << 8) | SZ_Y) #define SZ_DY ((SZ_D << 8) | SZ_Y) #define SZ_WO ((SZ_W << 8) | SZ_O) #define SZ_DO ((SZ_D << 8) | SZ_O) #define SZ_QO ((SZ_Q << 8) | SZ_O) /* resolve complex size type. */ static UD_INLINE ud_operand_size_t Mx_mem_size(ud_operand_size_t size) { return (size >> 8) & 0xff; } static UD_INLINE ud_operand_size_t Mx_reg_size(ud_operand_size_t size) { return size & 0xff; } /* A single operand of an entry in the instruction table. * (internal use only) */ struct ud_itab_entry_operand { enum ud_operand_code type; ud_operand_size_t size; }; /* A single entry in an instruction table. *(internal use only) */ struct ud_itab_entry { enum ud_mnemonic_code mnemonic; struct ud_itab_entry_operand operand1; struct ud_itab_entry_operand operand2; struct ud_itab_entry_operand operand3; struct ud_itab_entry_operand operand4; uint32_t prefix; }; struct ud_lookup_table_list_entry { const uint16_t *table; enum ud_table_type type; const char *meta; }; extern struct ud_itab_entry ud_itab[]; extern struct ud_lookup_table_list_entry ud_lookup_table_list[]; #endif /* UD_DECODE_H */ /* vim:cindent * vim:expandtab * vim:ts=4 * vim:sw=4 */
5,593
C++
.h
163
31.834356
84
0.601558
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,236
types.h
BlackINT3_OpenArk/src/OpenArk/common/utils/disassembly/udis86/libudis86/types.h
/* udis86 - libudis86/types.h * * Copyright (c) 2002-2013 Vivek Thampi * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef UD_TYPES_H #define UD_TYPES_H #ifdef __KERNEL__ /* * -D__KERNEL__ is automatically passed on the command line when * building something as part of the Linux kernel. Assume standalone * mode. */ # include <linux/kernel.h> # include <linux/string.h> # ifndef __UD_STANDALONE__ # define __UD_STANDALONE__ 1 # endif #endif /* __KERNEL__ */ #if !defined(__UD_STANDALONE__) # include <stdint.h> # include <stdio.h> #endif /* gcc specific extensions */ #ifdef __GNUC__ # define UD_ATTR_PACKED __attribute__((packed)) #else # define UD_ATTR_PACKED #endif /* UD_ATTR_PACKED */ /* ----------------------------------------------------------------------------- * All possible "types" of objects in udis86. Order is Important! * ----------------------------------------------------------------------------- */ enum ud_type { UD_NONE, /* 8 bit GPRs */ UD_R_AL, UD_R_CL, UD_R_DL, UD_R_BL, UD_R_AH, UD_R_CH, UD_R_DH, UD_R_BH, UD_R_SPL, UD_R_BPL, UD_R_SIL, UD_R_DIL, UD_R_R8B, UD_R_R9B, UD_R_R10B, UD_R_R11B, UD_R_R12B, UD_R_R13B, UD_R_R14B, UD_R_R15B, /* 16 bit GPRs */ UD_R_AX, UD_R_CX, UD_R_DX, UD_R_BX, UD_R_SP, UD_R_BP, UD_R_SI, UD_R_DI, UD_R_R8W, UD_R_R9W, UD_R_R10W, UD_R_R11W, UD_R_R12W, UD_R_R13W, UD_R_R14W, UD_R_R15W, /* 32 bit GPRs */ UD_R_EAX, UD_R_ECX, UD_R_EDX, UD_R_EBX, UD_R_ESP, UD_R_EBP, UD_R_ESI, UD_R_EDI, UD_R_R8D, UD_R_R9D, UD_R_R10D, UD_R_R11D, UD_R_R12D, UD_R_R13D, UD_R_R14D, UD_R_R15D, /* 64 bit GPRs */ UD_R_RAX, UD_R_RCX, UD_R_RDX, UD_R_RBX, UD_R_RSP, UD_R_RBP, UD_R_RSI, UD_R_RDI, UD_R_R8, UD_R_R9, UD_R_R10, UD_R_R11, UD_R_R12, UD_R_R13, UD_R_R14, UD_R_R15, /* segment registers */ UD_R_ES, UD_R_CS, UD_R_SS, UD_R_DS, UD_R_FS, UD_R_GS, /* control registers*/ UD_R_CR0, UD_R_CR1, UD_R_CR2, UD_R_CR3, UD_R_CR4, UD_R_CR5, UD_R_CR6, UD_R_CR7, UD_R_CR8, UD_R_CR9, UD_R_CR10, UD_R_CR11, UD_R_CR12, UD_R_CR13, UD_R_CR14, UD_R_CR15, /* debug registers */ UD_R_DR0, UD_R_DR1, UD_R_DR2, UD_R_DR3, UD_R_DR4, UD_R_DR5, UD_R_DR6, UD_R_DR7, UD_R_DR8, UD_R_DR9, UD_R_DR10, UD_R_DR11, UD_R_DR12, UD_R_DR13, UD_R_DR14, UD_R_DR15, /* mmx registers */ UD_R_MM0, UD_R_MM1, UD_R_MM2, UD_R_MM3, UD_R_MM4, UD_R_MM5, UD_R_MM6, UD_R_MM7, /* x87 registers */ UD_R_ST0, UD_R_ST1, UD_R_ST2, UD_R_ST3, UD_R_ST4, UD_R_ST5, UD_R_ST6, UD_R_ST7, /* extended multimedia registers */ UD_R_XMM0, UD_R_XMM1, UD_R_XMM2, UD_R_XMM3, UD_R_XMM4, UD_R_XMM5, UD_R_XMM6, UD_R_XMM7, UD_R_XMM8, UD_R_XMM9, UD_R_XMM10, UD_R_XMM11, UD_R_XMM12, UD_R_XMM13, UD_R_XMM14, UD_R_XMM15, /* 256B multimedia registers */ UD_R_YMM0, UD_R_YMM1, UD_R_YMM2, UD_R_YMM3, UD_R_YMM4, UD_R_YMM5, UD_R_YMM6, UD_R_YMM7, UD_R_YMM8, UD_R_YMM9, UD_R_YMM10, UD_R_YMM11, UD_R_YMM12, UD_R_YMM13, UD_R_YMM14, UD_R_YMM15, UD_R_RIP, /* Operand Types */ UD_OP_REG, UD_OP_MEM, UD_OP_PTR, UD_OP_IMM, UD_OP_JIMM, UD_OP_CONST }; #include "itab.h" union ud_lval { int8_t sbyte; uint8_t ubyte; int16_t sword; uint16_t uword; int32_t sdword; uint32_t udword; int64_t sqword; uint64_t uqword; struct { uint16_t seg; uint32_t off; } ptr; }; /* ----------------------------------------------------------------------------- * struct ud_operand - Disassembled instruction Operand. * ----------------------------------------------------------------------------- */ struct ud_operand { enum ud_type type; uint16_t size; enum ud_type base; enum ud_type index; uint8_t scale; uint8_t offset; union ud_lval lval; /* * internal use only */ uint64_t _legacy; /* this will be removed in 1.8 */ uint8_t _oprcode; }; /* ----------------------------------------------------------------------------- * struct ud - The udis86 object. * ----------------------------------------------------------------------------- */ struct ud { /* * input buffering */ int (*inp_hook) (struct ud*); #ifndef __UD_STANDALONE__ FILE* inp_file; #endif const uint8_t* inp_buf; size_t inp_buf_size; size_t inp_buf_index; uint8_t inp_curr; size_t inp_ctr; uint8_t inp_sess[64]; int inp_end; int inp_peek; void (*translator)(struct ud*); uint64_t insn_offset; char insn_hexcode[64]; /* * Assembly output buffer */ char *asm_buf; size_t asm_buf_size; size_t asm_buf_fill; char asm_buf_int[128]; /* * Symbol resolver for use in the translation phase. */ const char* (*sym_resolver)(struct ud*, uint64_t addr, int64_t *offset); uint8_t dis_mode; uint64_t pc; uint8_t vendor; enum ud_mnemonic_code mnemonic; struct ud_operand operand[4]; uint8_t error; uint8_t _rex; uint8_t pfx_rex; uint8_t pfx_seg; uint8_t pfx_opr; uint8_t pfx_adr; uint8_t pfx_lock; uint8_t pfx_str; uint8_t pfx_rep; uint8_t pfx_repe; uint8_t pfx_repne; uint8_t opr_mode; uint8_t adr_mode; uint8_t br_far; uint8_t br_near; uint8_t have_modrm; uint8_t modrm; uint8_t modrm_offset; uint8_t vex_op; uint8_t vex_b1; uint8_t vex_b2; uint8_t primary_opcode; void * user_opaque_data; struct ud_itab_entry * itab_entry; struct ud_lookup_table_list_entry *le; }; /* ----------------------------------------------------------------------------- * Type-definitions * ----------------------------------------------------------------------------- */ typedef enum ud_type ud_type_t; typedef enum ud_mnemonic_code ud_mnemonic_code_t; typedef struct ud ud_t; typedef struct ud_operand ud_operand_t; #define UD_SYN_INTEL ud_translate_intel #define UD_SYN_ATT ud_translate_att #define UD_EOI (-1) #define UD_INP_CACHE_SZ 32 #define UD_VENDOR_AMD 0 #define UD_VENDOR_INTEL 1 #define UD_VENDOR_ANY 2 #endif /* vim: set ts=2 sw=2 expandtab */
7,500
C++
.h
229
30.026201
84
0.587227
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,237
itab.h
BlackINT3_OpenArk/src/OpenArk/common/utils/disassembly/udis86/libudis86/itab.h
#ifndef UD_ITAB_H #define UD_ITAB_H /* itab.h -- generated by udis86:scripts/ud_itab.py, do no edit */ /* ud_table_type -- lookup table types (see decode.c) */ enum ud_table_type { UD_TAB__OPC_VEX, UD_TAB__OPC_TABLE, UD_TAB__OPC_X87, UD_TAB__OPC_MOD, UD_TAB__OPC_RM, UD_TAB__OPC_OSIZE, UD_TAB__OPC_MODE, UD_TAB__OPC_VEX_L, UD_TAB__OPC_3DNOW, UD_TAB__OPC_REG, UD_TAB__OPC_ASIZE, UD_TAB__OPC_VEX_W, UD_TAB__OPC_SSE, UD_TAB__OPC_VENDOR }; /* ud_mnemonic -- mnemonic constants */ enum ud_mnemonic_code { UD_Iaaa, UD_Iaad, UD_Iaam, UD_Iaas, UD_Iadc, UD_Iadd, UD_Iaddpd, UD_Iaddps, UD_Iaddsd, UD_Iaddss, UD_Iaddsubpd, UD_Iaddsubps, UD_Iaesdec, UD_Iaesdeclast, UD_Iaesenc, UD_Iaesenclast, UD_Iaesimc, UD_Iaeskeygenassist, UD_Iand, UD_Iandnpd, UD_Iandnps, UD_Iandpd, UD_Iandps, UD_Iarpl, UD_Iblendpd, UD_Iblendps, UD_Iblendvpd, UD_Iblendvps, UD_Ibound, UD_Ibsf, UD_Ibsr, UD_Ibswap, UD_Ibt, UD_Ibtc, UD_Ibtr, UD_Ibts, UD_Icall, UD_Icbw, UD_Icdq, UD_Icdqe, UD_Iclc, UD_Icld, UD_Iclflush, UD_Iclgi, UD_Icli, UD_Iclts, UD_Icmc, UD_Icmova, UD_Icmovae, UD_Icmovb, UD_Icmovbe, UD_Icmovg, UD_Icmovge, UD_Icmovl, UD_Icmovle, UD_Icmovno, UD_Icmovnp, UD_Icmovns, UD_Icmovnz, UD_Icmovo, UD_Icmovp, UD_Icmovs, UD_Icmovz, UD_Icmp, UD_Icmppd, UD_Icmpps, UD_Icmpsb, UD_Icmpsd, UD_Icmpsq, UD_Icmpss, UD_Icmpsw, UD_Icmpxchg, UD_Icmpxchg16b, UD_Icmpxchg8b, UD_Icomisd, UD_Icomiss, UD_Icpuid, UD_Icqo, UD_Icrc32, UD_Icvtdq2pd, UD_Icvtdq2ps, UD_Icvtpd2dq, UD_Icvtpd2pi, UD_Icvtpd2ps, UD_Icvtpi2pd, UD_Icvtpi2ps, UD_Icvtps2dq, UD_Icvtps2pd, UD_Icvtps2pi, UD_Icvtsd2si, UD_Icvtsd2ss, UD_Icvtsi2sd, UD_Icvtsi2ss, UD_Icvtss2sd, UD_Icvtss2si, UD_Icvttpd2dq, UD_Icvttpd2pi, UD_Icvttps2dq, UD_Icvttps2pi, UD_Icvttsd2si, UD_Icvttss2si, UD_Icwd, UD_Icwde, UD_Idaa, UD_Idas, UD_Idec, UD_Idiv, UD_Idivpd, UD_Idivps, UD_Idivsd, UD_Idivss, UD_Idppd, UD_Idpps, UD_Iemms, UD_Ienter, UD_Iextractps, UD_If2xm1, UD_Ifabs, UD_Ifadd, UD_Ifaddp, UD_Ifbld, UD_Ifbstp, UD_Ifchs, UD_Ifclex, UD_Ifcmovb, UD_Ifcmovbe, UD_Ifcmove, UD_Ifcmovnb, UD_Ifcmovnbe, UD_Ifcmovne, UD_Ifcmovnu, UD_Ifcmovu, UD_Ifcom, UD_Ifcom2, UD_Ifcomi, UD_Ifcomip, UD_Ifcomp, UD_Ifcomp3, UD_Ifcomp5, UD_Ifcompp, UD_Ifcos, UD_Ifdecstp, UD_Ifdiv, UD_Ifdivp, UD_Ifdivr, UD_Ifdivrp, UD_Ifemms, UD_Iffree, UD_Iffreep, UD_Ifiadd, UD_Ificom, UD_Ificomp, UD_Ifidiv, UD_Ifidivr, UD_Ifild, UD_Ifimul, UD_Ifincstp, UD_Ifist, UD_Ifistp, UD_Ifisttp, UD_Ifisub, UD_Ifisubr, UD_Ifld, UD_Ifld1, UD_Ifldcw, UD_Ifldenv, UD_Ifldl2e, UD_Ifldl2t, UD_Ifldlg2, UD_Ifldln2, UD_Ifldpi, UD_Ifldz, UD_Ifmul, UD_Ifmulp, UD_Ifndisi, UD_Ifneni, UD_Ifninit, UD_Ifnop, UD_Ifnsave, UD_Ifnsetpm, UD_Ifnstcw, UD_Ifnstenv, UD_Ifnstsw, UD_Ifpatan, UD_Ifprem, UD_Ifprem1, UD_Ifptan, UD_Ifrndint, UD_Ifrstor, UD_Ifrstpm, UD_Ifscale, UD_Ifsin, UD_Ifsincos, UD_Ifsqrt, UD_Ifst, UD_Ifstp, UD_Ifstp1, UD_Ifstp8, UD_Ifstp9, UD_Ifsub, UD_Ifsubp, UD_Ifsubr, UD_Ifsubrp, UD_Iftst, UD_Ifucom, UD_Ifucomi, UD_Ifucomip, UD_Ifucomp, UD_Ifucompp, UD_Ifxam, UD_Ifxch, UD_Ifxch4, UD_Ifxch7, UD_Ifxrstor, UD_Ifxsave, UD_Ifxtract, UD_Ifyl2x, UD_Ifyl2xp1, UD_Igetsec, UD_Ihaddpd, UD_Ihaddps, UD_Ihlt, UD_Ihsubpd, UD_Ihsubps, UD_Iidiv, UD_Iimul, UD_Iin, UD_Iinc, UD_Iinsb, UD_Iinsd, UD_Iinsertps, UD_Iinsw, UD_Iint, UD_Iint1, UD_Iint3, UD_Iinto, UD_Iinvd, UD_Iinvept, UD_Iinvlpg, UD_Iinvlpga, UD_Iinvvpid, UD_Iiretd, UD_Iiretq, UD_Iiretw, UD_Ija, UD_Ijae, UD_Ijb, UD_Ijbe, UD_Ijcxz, UD_Ijecxz, UD_Ijg, UD_Ijge, UD_Ijl, UD_Ijle, UD_Ijmp, UD_Ijno, UD_Ijnp, UD_Ijns, UD_Ijnz, UD_Ijo, UD_Ijp, UD_Ijrcxz, UD_Ijs, UD_Ijz, UD_Ilahf, UD_Ilar, UD_Ilddqu, UD_Ildmxcsr, UD_Ilds, UD_Ilea, UD_Ileave, UD_Iles, UD_Ilfence, UD_Ilfs, UD_Ilgdt, UD_Ilgs, UD_Ilidt, UD_Illdt, UD_Ilmsw, UD_Ilock, UD_Ilodsb, UD_Ilodsd, UD_Ilodsq, UD_Ilodsw, UD_Iloop, UD_Iloope, UD_Iloopne, UD_Ilsl, UD_Ilss, UD_Iltr, UD_Imaskmovdqu, UD_Imaskmovq, UD_Imaxpd, UD_Imaxps, UD_Imaxsd, UD_Imaxss, UD_Imfence, UD_Iminpd, UD_Iminps, UD_Iminsd, UD_Iminss, UD_Imonitor, UD_Imontmul, UD_Imov, UD_Imovapd, UD_Imovaps, UD_Imovbe, UD_Imovd, UD_Imovddup, UD_Imovdq2q, UD_Imovdqa, UD_Imovdqu, UD_Imovhlps, UD_Imovhpd, UD_Imovhps, UD_Imovlhps, UD_Imovlpd, UD_Imovlps, UD_Imovmskpd, UD_Imovmskps, UD_Imovntdq, UD_Imovntdqa, UD_Imovnti, UD_Imovntpd, UD_Imovntps, UD_Imovntq, UD_Imovq, UD_Imovq2dq, UD_Imovsb, UD_Imovsd, UD_Imovshdup, UD_Imovsldup, UD_Imovsq, UD_Imovss, UD_Imovsw, UD_Imovsx, UD_Imovsxd, UD_Imovupd, UD_Imovups, UD_Imovzx, UD_Impsadbw, UD_Imul, UD_Imulpd, UD_Imulps, UD_Imulsd, UD_Imulss, UD_Imwait, UD_Ineg, UD_Inop, UD_Inot, UD_Ior, UD_Iorpd, UD_Iorps, UD_Iout, UD_Ioutsb, UD_Ioutsd, UD_Ioutsw, UD_Ipabsb, UD_Ipabsd, UD_Ipabsw, UD_Ipackssdw, UD_Ipacksswb, UD_Ipackusdw, UD_Ipackuswb, UD_Ipaddb, UD_Ipaddd, UD_Ipaddq, UD_Ipaddsb, UD_Ipaddsw, UD_Ipaddusb, UD_Ipaddusw, UD_Ipaddw, UD_Ipalignr, UD_Ipand, UD_Ipandn, UD_Ipavgb, UD_Ipavgusb, UD_Ipavgw, UD_Ipblendvb, UD_Ipblendw, UD_Ipclmulqdq, UD_Ipcmpeqb, UD_Ipcmpeqd, UD_Ipcmpeqq, UD_Ipcmpeqw, UD_Ipcmpestri, UD_Ipcmpestrm, UD_Ipcmpgtb, UD_Ipcmpgtd, UD_Ipcmpgtq, UD_Ipcmpgtw, UD_Ipcmpistri, UD_Ipcmpistrm, UD_Ipextrb, UD_Ipextrd, UD_Ipextrq, UD_Ipextrw, UD_Ipf2id, UD_Ipf2iw, UD_Ipfacc, UD_Ipfadd, UD_Ipfcmpeq, UD_Ipfcmpge, UD_Ipfcmpgt, UD_Ipfmax, UD_Ipfmin, UD_Ipfmul, UD_Ipfnacc, UD_Ipfpnacc, UD_Ipfrcp, UD_Ipfrcpit1, UD_Ipfrcpit2, UD_Ipfrsqit1, UD_Ipfrsqrt, UD_Ipfsub, UD_Ipfsubr, UD_Iphaddd, UD_Iphaddsw, UD_Iphaddw, UD_Iphminposuw, UD_Iphsubd, UD_Iphsubsw, UD_Iphsubw, UD_Ipi2fd, UD_Ipi2fw, UD_Ipinsrb, UD_Ipinsrd, UD_Ipinsrq, UD_Ipinsrw, UD_Ipmaddubsw, UD_Ipmaddwd, UD_Ipmaxsb, UD_Ipmaxsd, UD_Ipmaxsw, UD_Ipmaxub, UD_Ipmaxud, UD_Ipmaxuw, UD_Ipminsb, UD_Ipminsd, UD_Ipminsw, UD_Ipminub, UD_Ipminud, UD_Ipminuw, UD_Ipmovmskb, UD_Ipmovsxbd, UD_Ipmovsxbq, UD_Ipmovsxbw, UD_Ipmovsxdq, UD_Ipmovsxwd, UD_Ipmovsxwq, UD_Ipmovzxbd, UD_Ipmovzxbq, UD_Ipmovzxbw, UD_Ipmovzxdq, UD_Ipmovzxwd, UD_Ipmovzxwq, UD_Ipmuldq, UD_Ipmulhrsw, UD_Ipmulhrw, UD_Ipmulhuw, UD_Ipmulhw, UD_Ipmulld, UD_Ipmullw, UD_Ipmuludq, UD_Ipop, UD_Ipopa, UD_Ipopad, UD_Ipopcnt, UD_Ipopfd, UD_Ipopfq, UD_Ipopfw, UD_Ipor, UD_Iprefetch, UD_Iprefetchnta, UD_Iprefetcht0, UD_Iprefetcht1, UD_Iprefetcht2, UD_Ipsadbw, UD_Ipshufb, UD_Ipshufd, UD_Ipshufhw, UD_Ipshuflw, UD_Ipshufw, UD_Ipsignb, UD_Ipsignd, UD_Ipsignw, UD_Ipslld, UD_Ipslldq, UD_Ipsllq, UD_Ipsllw, UD_Ipsrad, UD_Ipsraw, UD_Ipsrld, UD_Ipsrldq, UD_Ipsrlq, UD_Ipsrlw, UD_Ipsubb, UD_Ipsubd, UD_Ipsubq, UD_Ipsubsb, UD_Ipsubsw, UD_Ipsubusb, UD_Ipsubusw, UD_Ipsubw, UD_Ipswapd, UD_Iptest, UD_Ipunpckhbw, UD_Ipunpckhdq, UD_Ipunpckhqdq, UD_Ipunpckhwd, UD_Ipunpcklbw, UD_Ipunpckldq, UD_Ipunpcklqdq, UD_Ipunpcklwd, UD_Ipush, UD_Ipusha, UD_Ipushad, UD_Ipushfd, UD_Ipushfq, UD_Ipushfw, UD_Ipxor, UD_Ircl, UD_Ircpps, UD_Ircpss, UD_Ircr, UD_Irdmsr, UD_Irdpmc, UD_Irdrand, UD_Irdtsc, UD_Irdtscp, UD_Irep, UD_Irepne, UD_Iret, UD_Iretf, UD_Irol, UD_Iror, UD_Iroundpd, UD_Iroundps, UD_Iroundsd, UD_Iroundss, UD_Irsm, UD_Irsqrtps, UD_Irsqrtss, UD_Isahf, UD_Isalc, UD_Isar, UD_Isbb, UD_Iscasb, UD_Iscasd, UD_Iscasq, UD_Iscasw, UD_Iseta, UD_Isetae, UD_Isetb, UD_Isetbe, UD_Isetg, UD_Isetge, UD_Isetl, UD_Isetle, UD_Isetno, UD_Isetnp, UD_Isetns, UD_Isetnz, UD_Iseto, UD_Isetp, UD_Isets, UD_Isetz, UD_Isfence, UD_Isgdt, UD_Ishl, UD_Ishld, UD_Ishr, UD_Ishrd, UD_Ishufpd, UD_Ishufps, UD_Isidt, UD_Iskinit, UD_Isldt, UD_Ismsw, UD_Isqrtpd, UD_Isqrtps, UD_Isqrtsd, UD_Isqrtss, UD_Istc, UD_Istd, UD_Istgi, UD_Isti, UD_Istmxcsr, UD_Istosb, UD_Istosd, UD_Istosq, UD_Istosw, UD_Istr, UD_Isub, UD_Isubpd, UD_Isubps, UD_Isubsd, UD_Isubss, UD_Iswapgs, UD_Isyscall, UD_Isysenter, UD_Isysexit, UD_Isysret, UD_Itest, UD_Iucomisd, UD_Iucomiss, UD_Iud2, UD_Iunpckhpd, UD_Iunpckhps, UD_Iunpcklpd, UD_Iunpcklps, UD_Ivaddpd, UD_Ivaddps, UD_Ivaddsd, UD_Ivaddss, UD_Ivaddsubpd, UD_Ivaddsubps, UD_Ivaesdec, UD_Ivaesdeclast, UD_Ivaesenc, UD_Ivaesenclast, UD_Ivaesimc, UD_Ivaeskeygenassist, UD_Ivandnpd, UD_Ivandnps, UD_Ivandpd, UD_Ivandps, UD_Ivblendpd, UD_Ivblendps, UD_Ivblendvpd, UD_Ivblendvps, UD_Ivbroadcastsd, UD_Ivbroadcastss, UD_Ivcmppd, UD_Ivcmpps, UD_Ivcmpsd, UD_Ivcmpss, UD_Ivcomisd, UD_Ivcomiss, UD_Ivcvtdq2pd, UD_Ivcvtdq2ps, UD_Ivcvtpd2dq, UD_Ivcvtpd2ps, UD_Ivcvtps2dq, UD_Ivcvtps2pd, UD_Ivcvtsd2si, UD_Ivcvtsd2ss, UD_Ivcvtsi2sd, UD_Ivcvtsi2ss, UD_Ivcvtss2sd, UD_Ivcvtss2si, UD_Ivcvttpd2dq, UD_Ivcvttps2dq, UD_Ivcvttsd2si, UD_Ivcvttss2si, UD_Ivdivpd, UD_Ivdivps, UD_Ivdivsd, UD_Ivdivss, UD_Ivdppd, UD_Ivdpps, UD_Iverr, UD_Iverw, UD_Ivextractf128, UD_Ivextractps, UD_Ivhaddpd, UD_Ivhaddps, UD_Ivhsubpd, UD_Ivhsubps, UD_Ivinsertf128, UD_Ivinsertps, UD_Ivlddqu, UD_Ivmaskmovdqu, UD_Ivmaskmovpd, UD_Ivmaskmovps, UD_Ivmaxpd, UD_Ivmaxps, UD_Ivmaxsd, UD_Ivmaxss, UD_Ivmcall, UD_Ivmclear, UD_Ivminpd, UD_Ivminps, UD_Ivminsd, UD_Ivminss, UD_Ivmlaunch, UD_Ivmload, UD_Ivmmcall, UD_Ivmovapd, UD_Ivmovaps, UD_Ivmovd, UD_Ivmovddup, UD_Ivmovdqa, UD_Ivmovdqu, UD_Ivmovhlps, UD_Ivmovhpd, UD_Ivmovhps, UD_Ivmovlhps, UD_Ivmovlpd, UD_Ivmovlps, UD_Ivmovmskpd, UD_Ivmovmskps, UD_Ivmovntdq, UD_Ivmovntdqa, UD_Ivmovntpd, UD_Ivmovntps, UD_Ivmovq, UD_Ivmovsd, UD_Ivmovshdup, UD_Ivmovsldup, UD_Ivmovss, UD_Ivmovupd, UD_Ivmovups, UD_Ivmpsadbw, UD_Ivmptrld, UD_Ivmptrst, UD_Ivmread, UD_Ivmresume, UD_Ivmrun, UD_Ivmsave, UD_Ivmulpd, UD_Ivmulps, UD_Ivmulsd, UD_Ivmulss, UD_Ivmwrite, UD_Ivmxoff, UD_Ivmxon, UD_Ivorpd, UD_Ivorps, UD_Ivpabsb, UD_Ivpabsd, UD_Ivpabsw, UD_Ivpackssdw, UD_Ivpacksswb, UD_Ivpackusdw, UD_Ivpackuswb, UD_Ivpaddb, UD_Ivpaddd, UD_Ivpaddq, UD_Ivpaddsb, UD_Ivpaddsw, UD_Ivpaddusb, UD_Ivpaddusw, UD_Ivpaddw, UD_Ivpalignr, UD_Ivpand, UD_Ivpandn, UD_Ivpavgb, UD_Ivpavgw, UD_Ivpblendvb, UD_Ivpblendw, UD_Ivpclmulqdq, UD_Ivpcmpeqb, UD_Ivpcmpeqd, UD_Ivpcmpeqq, UD_Ivpcmpeqw, UD_Ivpcmpestri, UD_Ivpcmpestrm, UD_Ivpcmpgtb, UD_Ivpcmpgtd, UD_Ivpcmpgtq, UD_Ivpcmpgtw, UD_Ivpcmpistri, UD_Ivpcmpistrm, UD_Ivperm2f128, UD_Ivpermilpd, UD_Ivpermilps, UD_Ivpextrb, UD_Ivpextrd, UD_Ivpextrq, UD_Ivpextrw, UD_Ivphaddd, UD_Ivphaddsw, UD_Ivphaddw, UD_Ivphminposuw, UD_Ivphsubd, UD_Ivphsubsw, UD_Ivphsubw, UD_Ivpinsrb, UD_Ivpinsrd, UD_Ivpinsrq, UD_Ivpinsrw, UD_Ivpmaddubsw, UD_Ivpmaddwd, UD_Ivpmaxsb, UD_Ivpmaxsd, UD_Ivpmaxsw, UD_Ivpmaxub, UD_Ivpmaxud, UD_Ivpmaxuw, UD_Ivpminsb, UD_Ivpminsd, UD_Ivpminsw, UD_Ivpminub, UD_Ivpminud, UD_Ivpminuw, UD_Ivpmovmskb, UD_Ivpmovsxbd, UD_Ivpmovsxbq, UD_Ivpmovsxbw, UD_Ivpmovsxwd, UD_Ivpmovsxwq, UD_Ivpmovzxbd, UD_Ivpmovzxbq, UD_Ivpmovzxbw, UD_Ivpmovzxdq, UD_Ivpmovzxwd, UD_Ivpmovzxwq, UD_Ivpmuldq, UD_Ivpmulhrsw, UD_Ivpmulhuw, UD_Ivpmulhw, UD_Ivpmulld, UD_Ivpmullw, UD_Ivpor, UD_Ivpsadbw, UD_Ivpshufb, UD_Ivpshufd, UD_Ivpshufhw, UD_Ivpshuflw, UD_Ivpsignb, UD_Ivpsignd, UD_Ivpsignw, UD_Ivpslld, UD_Ivpslldq, UD_Ivpsllq, UD_Ivpsllw, UD_Ivpsrad, UD_Ivpsraw, UD_Ivpsrld, UD_Ivpsrldq, UD_Ivpsrlq, UD_Ivpsrlw, UD_Ivpsubb, UD_Ivpsubd, UD_Ivpsubq, UD_Ivpsubsb, UD_Ivpsubsw, UD_Ivpsubusb, UD_Ivpsubusw, UD_Ivpsubw, UD_Ivptest, UD_Ivpunpckhbw, UD_Ivpunpckhdq, UD_Ivpunpckhqdq, UD_Ivpunpckhwd, UD_Ivpunpcklbw, UD_Ivpunpckldq, UD_Ivpunpcklqdq, UD_Ivpunpcklwd, UD_Ivpxor, UD_Ivrcpps, UD_Ivrcpss, UD_Ivroundpd, UD_Ivroundps, UD_Ivroundsd, UD_Ivroundss, UD_Ivrsqrtps, UD_Ivrsqrtss, UD_Ivshufpd, UD_Ivshufps, UD_Ivsqrtpd, UD_Ivsqrtps, UD_Ivsqrtsd, UD_Ivsqrtss, UD_Ivstmxcsr, UD_Ivsubpd, UD_Ivsubps, UD_Ivsubsd, UD_Ivsubss, UD_Ivtestpd, UD_Ivtestps, UD_Ivucomisd, UD_Ivucomiss, UD_Ivunpckhpd, UD_Ivunpckhps, UD_Ivunpcklpd, UD_Ivunpcklps, UD_Ivxorpd, UD_Ivxorps, UD_Ivzeroall, UD_Ivzeroupper, UD_Iwait, UD_Iwbinvd, UD_Iwrmsr, UD_Ixadd, UD_Ixchg, UD_Ixcryptcbc, UD_Ixcryptcfb, UD_Ixcryptctr, UD_Ixcryptecb, UD_Ixcryptofb, UD_Ixgetbv, UD_Ixlatb, UD_Ixor, UD_Ixorpd, UD_Ixorps, UD_Ixrstor, UD_Ixsave, UD_Ixsetbv, UD_Ixsha1, UD_Ixsha256, UD_Ixstore, UD_Iinvalid, UD_I3dnow, UD_Inone, UD_Idb, UD_Ipause, UD_MAX_MNEMONIC_CODE }; extern const char * ud_mnemonics_str[]; #endif /* UD_ITAB_H */
15,326
C++
.h
934
11.450749
66
0.605477
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,238
zip_utils.h
BlackINT3_OpenArk/src/OpenArk/common/utils/compress/zip_utils.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include <string> #include <unone.h> namespace Plugin { namespace Compressor { class ZipUtils { public: enum WRAPPER_TYPE { UNPACK_CURRENT, //uncompress to / UNPACK_SUBDIR, //uncompress to /sub-dir PACK_CURRENT, //compress / PACK_SUBDIR, //compress /sub-dir }; static bool UnpackToDir(const std::string& zip_path, WRAPPER_TYPE wrapper_type, const std::string& out_dir); static bool PackDir(const std::string& dir, WRAPPER_TYPE wrapper_type, const std::string& zip_path); static bool PackFile(const std::string& file, const std::string& zip_path); public: ZipUtils(){}; ~ZipUtils(){}; }; } //namespace Compressor } //namespace Plugin
1,469
C++
.h
40
35.05
77
0.675088
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,241
cache.h
BlackINT3_OpenArk/src/OpenArk/common/cache/cache.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include <unone.h> #include <QString> #include <QVector> #include <QMap> #include <QMutex> struct ProcInfo { DWORD pid; DWORD ppid = -1; DWORD parent_existed = -1; QString name; QString desc; QString corp; QString ctime; QString path; }; ProcInfo CacheGetProcInfo(unsigned int pid); ProcInfo CacheGetProcInfo(unsigned int pid, ProcInfo& info); void CacheGetProcChilds(unsigned int pid, QVector<ProcInfo>& infos); void CacheRefreshProcInfo(); UNONE::PROCESS_BASE_INFOW CacheGetProcessBaseInfo(DWORD pid); struct FileBaseInfo { QString path; QString desc; QString ver; QString corp; }; FileBaseInfo CacheGetFileBaseInfo(QString path);
1,456
C++
.h
43
32.511628
77
0.703546
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,242
config.h
BlackINT3_OpenArk/src/OpenArk/common/config/config.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include <QString> #include <QSettings> #include <QVector> enum ConfOp { CONF_GET, CONF_SET, }; enum MainTabNumber { TAB_PROCESS, TAB_KERNEL, TAB_CODERKIT, TAB_SCANNER, TAB_BUNDLER, TAB_UTILITIES, TAB_REVERSE, TAB_MAX }; static int def_lang_ = -1; class OpenArkConfig { public: void Init(); static OpenArkConfig* Instance(); int GetLang(ConfOp op, int &lang = def_lang_); QStringList GetJunkDirs(); QString GetConsole(const QString &name); void GetMainGeometry(int &x, int &y, int &w, int &h); void GetMainDefaultGeometry(int &x, int &y, int &w, int &h); void SetMainGeometry(int x, int y, int w, int h); void GetMainMaxed(bool &maxed); void SetMainMaxed(bool maxed); void GetPrefMainTab(int &idx); void SetPrefMainTab(int idx); void GetPrefLevel2Tab(int &idx); void SetPrefLevel2Tab(int idx); void SetMainTabMap(int seq, QVector<int> idx); void GetMainTabMap(int seq, QVector<int> &idx); void GetMainTabAllMap(QVector<QVector<int>> &idxs); QVariant GetValue(const QString &key, const QVariant &defaultValue = QVariant()) const { return appconf_->value(key, defaultValue); }; void SetValue(const QString &key, const QVariant &value) { return appconf_->setValue(key, value); }; bool Contains(const QString &key) const { return appconf_->contains(key); } void Sync() { return appconf_->sync(); }; private: QSettings *appconf_; QVector<QString> maintab_map_; public: static OpenArkConfig *confobj_; OpenArkConfig(); ~OpenArkConfig(); };
2,286
C++
.h
65
33.492308
135
0.704474
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,243
app.h
BlackINT3_OpenArk/src/OpenArk/common/app/app.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include <unone.h> #include <QString> enum LogOuputLevel { LevelInfo, LevelWarn, LevelErr, LevelDbg }; void LogOutput(LogOuputLevel lev, const char* func, const char* format, ...); void LogOutput(LogOuputLevel lev, const char* func, const wchar_t* format, ...); #define INFO(format, ...) \ LogOutput(LevelInfo, __FUNCTION__, (format), __VA_ARGS__) #define WARN(format, ...) \ LogOutput(LevelWarn, __FUNCTION__, (format), __VA_ARGS__) #define ERR(format, ...) \ LogOutput(LevelErr, __FUNCTION__, (format), __VA_ARGS__) #define DBG(format, ...) \ LogOutput(LevelDbg, __FUNCTION__, (format), __VA_ARGS__) #define QERR_A(format, ...) \ LogOutput(LevelErr, __FUNCTION__, (TRA(format)), __VA_ARGS__) #define QERR_W(format, ...) \ LogOutput(LevelErr, __FUNCTION__, (TRW(format)), __VA_ARGS__) inline QString AppFilePath() { return QString::fromStdWString(UNONE::PsGetProcessPathW()); } inline QString AppVersion() { std::wstring ver; UNONE::FsGetFileInfoW(UNONE::PsGetProcessPathW(), L"ProductVersion", ver); if (!ver.empty()) { ver = ver.substr(0, ver.find_last_of(L".")); } return QString::fromStdWString(ver); } inline QString AppBuildTime() { QString &&stamp = QString::fromStdString(UNONE::TmFormatUnixTimeA(UNONE::PeGetTimeStamp((CHAR*)GetModuleHandleW(NULL)), "YMDHW")); return stamp; } inline std::wstring AppConfigDir() { static std::wstring dir; if (!dir.empty()) return dir; auto &&curdir = UNONE::PsGetProcessDirW(); auto &&cfg = curdir + L"\\openark.ini"; if (UNONE::FsIsExistedW(cfg)) { dir = std::move(curdir); return dir; } dir = UNONE::OsEnvironmentW(L"%AppData%") + L"\\OpenArk"; return dir; } inline QString AppFsUrl(QString url = "") { static QString fsurl; if (url.isEmpty()) { return fsurl; } fsurl = url; return fsurl; }
2,592
C++
.h
73
33.945205
131
0.674493
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,244
cpp-wrapper.h
BlackINT3_OpenArk/src/OpenArk/common/cpp-wrapper/cpp-wrapper.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include <functional> // form: http://mindhacks.cn/2012/08/27/modern-cpp-practices/ class ScopeGuard { public: explicit ScopeGuard(std::function<void()> onExitScope) : onExitScope_(onExitScope), dismissed_(false) { } ~ScopeGuard() { if (!dismissed_) { onExitScope_(); } } void Dismiss() { dismissed_ = true; } private: std::function<void()> onExitScope_; bool dismissed_; private: // noncopyable ScopeGuard(ScopeGuard const&); ScopeGuard& operator=(ScopeGuard const&); }; #define SCOPEGUARD_LINENAME_CAT(name, line) name##line #define SCOPEGUARD_LINENAME(name, line) SCOPEGUARD_LINENAME_CAT(name, line) #define ON_SCOPE_EXIT(callback) ScopeGuard SCOPEGUARD_LINENAME(EXIT, __LINE__)(callback) int VariantInt(std::string val, int radix = 16); int64_t VariantInt64(std::string val, int radix = 16); std::wstring VariantFilePath(std::wstring path); // disable logger, exit recover #define DISABLE_RECOVER() \ UNONE::LogCallback routine;\ bool regok = UNONE::InterCurrentLogger(routine);\ if (regok) UNONE::InterRegisterLogger([&](const std::wstring &) {});\ ON_SCOPE_EXIT([&] {if (regok) UNONE::InterUnregisterLogger(); });
1,965
C++
.h
53
35.377358
88
0.693642
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,245
cmds.h
BlackINT3_OpenArk/src/OpenArk/cmds/cmds.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include "../common/common.h" enum { ECMD_PARAM_INVALID, ECMD_NOSUCH_CMD, }; class Cmds : public QTextBrowser { Q_OBJECT public: Cmds (QTextBrowser *parent); ~Cmds (); public: Q_INVOKABLE void CmdHelp(QString cmd, QStringList argv); Q_INVOKABLE void CmdCls(QString cmd, QStringList argv); Q_INVOKABLE void CmdHistory(QString cmd, QStringList argv); Q_INVOKABLE void CmdTimeStamp(QString cmd, QStringList argv); Q_INVOKABLE void CmdErrorShow(QString cmd, QStringList argv); Q_INVOKABLE void CmdFormats(QString cmd, QStringList argv); Q_INVOKABLE void CmdExit(QString cmd, QStringList argv); Q_INVOKABLE void CmdRestart(QString cmd, QStringList argv); Q_INVOKABLE void CmdCmd(QString cmd, QStringList argv); Q_INVOKABLE void CmdStart(QString cmd, QStringList argv); Q_INVOKABLE void CmdMsg(QString cmd, QStringList argv); Q_INVOKABLE void CmdWndInfo(QString cmd, QStringList argv); Q_INVOKABLE void CmdProcessInfo(QString cmd, QStringList argv); Q_INVOKABLE void CmdProcessTree(QString cmd, QStringList argv); Q_INVOKABLE void CmdMemoryEditor(QString cmd, QStringList argv); Q_INVOKABLE void CmdFileEditor(QString cmd, QStringList argv); QString CmdGetLast(); QString CmdGetNext(); void CmdException(QString cmd, int type); void CmdErrorOutput(const std::wstring &err); void CmdOutput(const char* format, ...); void CmdOutput(const wchar_t* format, ...); void CmdDispatcher(const std::wstring &cmdline); size_t cmd_cursor_; QStringList cmd_history_; QTextBrowser *cmd_window_; };
2,323
C++
.h
54
41.333333
77
0.733981
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,246
constants.h
BlackINT3_OpenArk/src/OpenArk/cmds/constants/constants.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include <Windows.h> #include <string> #include <map> extern char *MessageRawString; extern std::map<int, std::wstring> ObjectTypeTable; extern std::map<int, std::string> MessageMapTable; void InitObjectTypeTable(); int GetObjectTypeIndex(wchar_t* name); std::string MbiTypeToString(int type); std::string MbiStateToString(int type); std::string MbiPageProtectToString(int type);
1,190
C++
.h
27
43
77
0.683893
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,248
settings.h
BlackINT3_OpenArk/src/OpenArk/settings/settings.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include <QtCore> #include <QtWidgets> #include <Windows.h> #include "ui_settings.h" enum SettingsTabNumber { TAB_SETTINGS_GENERAL, TAB_SETTINGS_CONSOLE, TAB_SETTINGS_CLEAN, }; class Settings : public QWidget { Q_OBJECT public: Settings(QWidget *parent); ~Settings(); void SetActiveTab(int idx) const { ui.tabWidget->setCurrentIndex(idx); }; bool eventFilter(QObject *obj, QEvent *e); protected: void closeEvent(QCloseEvent *e); void InitConsoleView(); void InitCleanView(); void InitGeneralView(); private: Ui::Settings ui; QStandardItemModel *console_model_; };
1,389
C++
.h
41
32.463415
77
0.688476
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,249
kernel.h
BlackINT3_OpenArk/src/OpenArk/kernel/kernel.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include <QtCore> #include <QtWidgets> #include <Windows.h> #include "ui_kernel.h" #include "../common/qt-wrapper/qt-wrapper.h" #include "../common/ui-wrapper/ui-wrapper.h" #include "network/network.h" #include "storage/storage.h" #include "object/object.h" #include "memory/memory.h" #include "driver/driver.h" enum { TAB_KERNEL_ENTRY, TAB_KERNEL_DRIVER, TAB_KERNEL_NOTIFY, TAB_KERNEL_HOTKEY, TAB_KERNEL_OBJECT, TAB_KERNEL_MEMORY, TAB_KERNEL_STORAGE, TAB_KERNEL_NETWORK, TAB_KERNEL_MAX, }; class KernelNetwork; class KernelStorage; class KernelObject; class KernelMemory; class KernelDriver; class OpenArk; class Ui::Kernel; PROXY_FILTER(NotifySortFilterProxyModel); PROXY_FILTER(HotkeySortFilterProxyModel); class Kernel : public CommonMainTabObject { Q_OBJECT public: Kernel(QWidget *parent, int tabid); ~Kernel(); protected: bool eventFilter(QObject *obj, QEvent *e); void dragEnterEvent(QDragEnterEvent *event); void dropEvent(QDropEvent *event); private slots: void onTabChanged(int index); void onClickKernelMode(); void onRefreshKernelMode(); public slots: void onOpenFile(QString path); signals: void signalOpen(QString); private: void InitKernelEntryView(); void InitNotifyView(); void InitHotkeyView(); void ShowSystemNotify(); void ShowSystemHotkey(); QString NotifyItemData(int column); QString HotkeyItemData(int column); private: bool arkdrv_conn_; KernelNetwork *network_; KernelStorage *storage_; KernelObject *object_; KernelMemory *memory_; KernelDriver *driver_; Ui::Kernel ui; QMenu *notify_menu_; QMenu *hotkey_menu_; QStandardItemModel *kerninfo_model_; QStandardItemModel *notify_model_; QStandardItemModel *hotkey_model_; NotifySortFilterProxyModel *proxy_notify_; HotkeySortFilterProxyModel *proxy_hotkey_; };
2,595
C++
.h
88
27.909091
77
0.746496
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,250
storage.h
BlackINT3_OpenArk/src/OpenArk/kernel/storage/storage.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include <windows.h> #include <vector> #include "ui_kernel.h" #include "../kernel.h" #include "../common/common.h" class Ui::Kernel; class Kernel; PROXY_FILTER(UnlockFileSortFilterProxyModel); class KernelStorage : public CommonTabObject { Q_OBJECT public: KernelStorage(); ~KernelStorage(); public: bool eventFilter(QObject *obj, QEvent *e); void ModuleInit(Ui::Kernel *ui, Kernel *kernel); private slots: void onTabChanged(int index); private: void ShowUnlockFiles(); void InitFileUnlockView(); void InitFileFilterView(); private: Ui::Kernel *ui_; Kernel *kernel_; QMenu *unlock_menu_; QMenu *fsflt_menu_; QStandardItemModel *fsflt_model_; QStandardItemModel *unlock_model_; UnlockFileSortFilterProxyModel *proxy_unlock_; UnlockFileSortFilterProxyModel *proxy_fsflt_; };
1,604
C++
.h
48
31.9375
77
0.704707
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,252
driver.h
BlackINT3_OpenArk/src/OpenArk/kernel/driver/driver.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include "../../common/cpp-wrapper/cpp-wrapper.h" #include <QString> #pragma once #include <windows.h> #include <vector> #include "ui_kernel.h" #include "../kernel.h" #include "../common/common.h" class Ui::Kernel; class Kernel; enum { TAB_KERNEL_DRIVER_LIST, TAB_KERNEL_DRIVER_KIT, }; PROXY_FILTER(DriversSortFilterProxyModel); class KernelDriver : public CommonTabObject { Q_OBJECT public: enum { Region, View, }; KernelDriver(); ~KernelDriver(); public: bool eventFilter(QObject *obj, QEvent *e); void ModuleInit(Ui::Kernel *mainui, Kernel *kernel); bool InstallDriver(QString driver, QString name); bool UninstallDriver(QString service); void ShowDrivers(); private slots: void onTabChanged(int index); void onSignDriver(); void onInstallNormallyDriver(); void onInstallUnsignedDriver(); void onInstallExpiredDriver(); void onUninstallDriver(); private: void InitDriversView(); void InitDriverKitView(); QString DriversItemData(int column); private: Ui::Kernel *ui_; Kernel *kernel_; QMenu *drivers_menu_; QStandardItemModel *drivers_model_; DriversSortFilterProxyModel *proxy_drivers_; }; bool SignExpiredDriver(QString driver); std::wstring ParseDriverPath(UCHAR *symlnk); #define RECOVER_SIGN_TIME() \ SYSTEMTIME saved = { 0 };\ GetLocalTime(&saved);\ FILETIME ft;\ SystemTimeToFileTime(&saved, &ft);\ auto ticks = GetTickCount();\ SYSTEMTIME cur = { 0 };\ cur.wYear = 2012;\ cur.wMonth = 1;\ cur.wDay = 1;\ SetLocalTime(&cur);\ ON_SCOPE_EXIT([&] { \ LARGE_INTEGER li;\ li.LowPart = ft.dwLowDateTime;\ li.HighPart = ft.dwHighDateTime;\ li.QuadPart += (GetTickCount() - ticks) * 10000; \ ft.dwHighDateTime = li.HighPart; \ ft.dwLowDateTime = li.LowPart; \ FileTimeToSystemTime(&ft, &saved); \ SetLocalTime(&saved); \ });
2,623
C++
.h
87
28.137931
77
0.70388
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,253
memory.h
BlackINT3_OpenArk/src/OpenArk/kernel/memory/memory.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include <windows.h> #include <vector> #include "ui_kernel.h" #include "../kernel.h" #include "../common/common.h" class Ui::Kernel; class Kernel; class KernelMemoryRW; class KernelMemory : public CommonTabObject { Q_OBJECT public: enum { Region, View, }; KernelMemory(); ~KernelMemory(); public: bool eventFilter(QObject *obj, QEvent *e); void ModuleInit(Ui::Kernel *mainui, Kernel *kernel); private slots: void onTabChanged(int index); private: Ui::Kernel *ui; KernelMemoryRW *memrw_; }; class KernelMemoryRW : public QWidget { Q_OBJECT public: KernelMemoryRW(); ~KernelMemoryRW(); private: QWidget *memui_; bool free_init_; std::function<void(QList<QVariant>)> free_callback_; QList<QVariant> free_vars_; ULONG maxsize_; public: bool eventFilter(QObject *obj, QEvent *e); void RegFreeCallback(std::function<void(QList<QVariant>)> callback, QList<QVariant> vars) { free_callback_ = callback; free_vars_ = vars; free_init_ = true; }; void SetMaxSize(ULONG maxsize) { maxsize_ = maxsize; }; void ViewMemory(ULONG pid, ULONG64 addr, ULONG size); void ViewMemory(ULONG pid, std::string data); void WriteMemory(std::string data); void OpenNewWindow(QWidget *parent, ULONG64 addr, ULONG size) { auto memwidget = this->GetWidget(); memwidget->findChild<QLineEdit*>("readAddrEdit")->setText(QString("0x%1").arg(QString::number(addr,16).toUpper())); memwidget->findChild<QLineEdit*>("writeAddrEdit")->setText(QString("0x%1").arg(QString::number(addr, 16).toUpper())); memwidget->findChild<QLineEdit*>("readSizeEdit")->setText(QString("0x%1").arg(QString::number(size, 16).toUpper())); memwidget->setParent(parent); memwidget->setWindowTitle(tr("Memory Read-Write")); memwidget->setWindowFlags(Qt::Window); memwidget->resize(1000, 530); memwidget->show(); } QWidget *GetWidget() const { return memui_; }; };
2,674
C++
.h
78
32.435897
119
0.705837
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,254
network.h
BlackINT3_OpenArk/src/OpenArk/kernel/network/network.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include <windows.h> #include <vector> #include "ui_kernel.h" #include "../kernel.h" #include "../common/common.h" #include "../common/ui-wrapper/ui-wrapper.h" class Ui::Kernel; class Kernel; enum { //TAB_KERNEL_NETWORK_WFP, //TAB_KERNEL_NETWORK_TDI, TAB_KERNEL_NETWORK_PORT, TAB_KERNEL_NETWORK_HOSTS, }; typedef struct _CALLOUT_INFO { ULONG CalloutId; GUID CalloutKey; CHAR ModuleName[MAX_PATH]; }CALLOUT_INFO; bool EnumWfpCallouts(std::vector<CALLOUT_INFO>& CalloutIDs); PROXY_FILTER(WfpSortFilterProxyModel); PROXY_FILTER(PortSortFilterProxyModel); class KernelNetwork : public CommonTabObject { Q_OBJECT public: KernelNetwork(); ~KernelNetwork(); public: bool eventFilter(QObject *obj, QEvent *e); void ModuleInit(Ui::Kernel *ui, Kernel *kernel); private slots: void onTabChanged(int index); void onShowPortInfo(); private: void InitWfpView(); void InitHostsView(); void InitPortView(); void ShowWfpInfo(); private: Ui::Kernel *ui_; Kernel *kernel_; std::wstring hosts_dir_; std::wstring hosts_file_; QMenu *hosts_menu_; QMenu *port_menu_; QStandardItemModel *wfp_model_; QStandardItemModel *port_model_; WfpSortFilterProxyModel *proxy_wfp_; PortSortFilterProxyModel *proxy_port_; };
2,032
C++
.h
66
29.242424
77
0.715526
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,255
fwpvi.h
BlackINT3_OpenArk/src/OpenArk/kernel/network/include/fwpvi.h
/* Copyright (c) Microsoft Corporation SYNOPSIS Declares version independent definitions for the FWP API. */ #include "sdkddkver.h" #if (NTDDI_VERSION >= NTDDI_WIN6) #ifndef FWPVI_H #define FWPVI_H /////////////////////////////////////////////////////////////////////////////// // // Version independent definitions for Fwpmtypes. // /////////////////////////////////////////////////////////////////////////////// #define FWPM_DISPLAY_DATA FWPM_DISPLAY_DATA0 #define FWPM_SESSION FWPM_SESSION0 #define FWPM_SESSION_ENUM_TEMPLATE FWPM_SESSION_ENUM_TEMPLATE0 #define FWPM_PROVIDER FWPM_PROVIDER0 #define FWPM_PROVIDER_ENUM_TEMPLATE FWPM_PROVIDER_ENUM_TEMPLATE0 #define FWPM_PROVIDER_CHANGE FWPM_PROVIDER_CHANGE0 #define FWPM_PROVIDER_SUBSCRIPTION FWPM_PROVIDER_SUBSCRIPTION0 #define FWPM_CLASSIFY_OPTION FWPM_CLASSIFY_OPTION0 #define FWPM_CLASSIFY_OPTIONS FWPM_CLASSIFY_OPTIONS0 #if (NTDDI_VERSION >= NTDDI_WIN7) #define FWPM_PROVIDER_CONTEXT FWPM_PROVIDER_CONTEXT1 #else #define FWPM_PROVIDER_CONTEXT FWPM_PROVIDER_CONTEXT0 #endif #define FWPM_PROVIDER_CONTEXT_ENUM_TEMPLATE FWPM_PROVIDER_CONTEXT_ENUM_TEMPLATE0 #define FWPM_PROVIDER_CONTEXT_CHANGE FWPM_PROVIDER_CONTEXT_CHANGE0 #define FWPM_PROVIDER_CONTEXT_SUBSCRIPTION FWPM_PROVIDER_CONTEXT_SUBSCRIPTION0 #define FWPM_SUBLAYER FWPM_SUBLAYER0 #define FWPM_SUBLAYER_ENUM_TEMPLATE FWPM_SUBLAYER_ENUM_TEMPLATE0 #define FWPM_SUBLAYER_CHANGE FWPM_SUBLAYER_CHANGE0 #define FWPM_SUBLAYER_SUBSCRIPTION FWPM_SUBLAYER_SUBSCRIPTION0 #define FWPM_FIELD FWPM_FIELD0 #define FWPM_LAYER FWPM_LAYER0 #define FWPM_LAYER_ENUM_TEMPLATE FWPM_LAYER_ENUM_TEMPLATE0 #define FWPM_CALLOUT FWPM_CALLOUT0 #define FWPM_CALLOUT_ENUM_TEMPLATE FWPM_CALLOUT_ENUM_TEMPLATE0 #define FWPM_CALLOUT_CHANGE FWPM_CALLOUT_CHANGE0 #define FWPM_CALLOUT_SUBSCRIPTION FWPM_CALLOUT_SUBSCRIPTION0 #define FWPM_ACTION FWPM_ACTION0 #define FWPM_FILTER_CONDITION FWPM_FILTER_CONDITION0 #define FWPM_FILTER FWPM_FILTER0 #define FWPM_FILTER_ENUM_TEMPLATE FWPM_FILTER_ENUM_TEMPLATE0 #define FWPM_FILTER_CHANGE FWPM_FILTER_CHANGE0 #define FWPM_FILTER_SUBSCRIPTION FWPM_FILTER_SUBSCRIPTION0 #define FWPM_LAYER_STATISTICS FWPM_LAYER_STATISTICS0 #define FWPM_STATISTICS FWPM_STATISTICS0 #if (NTDDI_VERSION >= NTDDI_WIN7) #define FWPM_NET_EVENT_HEADER FWPM_NET_EVENT_HEADER1 #define FWPM_NET_EVENT_IKEEXT_MM_FAILURE FWPM_NET_EVENT_IKEEXT_MM_FAILURE1 #define FWPM_NET_EVENT_IKEEXT_EM_FAILURE FWPM_NET_EVENT_IKEEXT_EM_FAILURE1 #else #define FWPM_NET_EVENT_HEADER FWPM_NET_EVENT_HEADER0 #define FWPM_NET_EVENT_IKEEXT_MM_FAILURE FWPM_NET_EVENT_IKEEXT_MM_FAILURE0 #define FWPM_NET_EVENT_IKEEXT_EM_FAILURE FWPM_NET_EVENT_IKEEXT_EM_FAILURE0 #endif #define FWPM_NET_EVENT_IKEEXT_QM_FAILURE FWPM_NET_EVENT_IKEEXT_QM_FAILURE0 #define FWPM_NET_EVENT_IPSEC_KERNEL_DROP FWPM_NET_EVENT_IPSEC_KERNEL_DROP0 #if (NTDDI_VERSION >= NTDDI_WIN7) #define FWPM_NET_EVENT_CLASSIFY_DROP FWPM_NET_EVENT_CLASSIFY_DROP1 #define FWPM_NET_EVENT_IPSEC_DOSP_DROP FWPM_NET_EVENT_IPSEC_DOSP_DROP0 #define FWPM_NET_EVENT FWPM_NET_EVENT1 #else #define FWPM_NET_EVENT_CLASSIFY_DROP FWPM_NET_EVENT_CLASSIFY_DROP0 #define FWPM_NET_EVENT FWPM_NET_EVENT0 #endif #define FWPM_NET_EVENT_ENUM_TEMPLATE FWPM_NET_EVENT_ENUM_TEMPLATE0 #define FWPM_NET_EVENT_SUBSCRIPTION FWPM_NET_EVENT_SUBSCRIPTION0 #if (NTDDI_VERSION >= NTDDI_WIN7) #define FWPM_SYSTEM_PORTS_BY_TYPE FWPM_SYSTEM_PORTS_BY_TYPE0 #define FWPM_SYSTEM_PORTS FWPM_SYSTEM_PORTS0 #endif /////////////////////////////////////////////////////////////////////////////// // // Version independent definitions for Fwpstypes. // /////////////////////////////////////////////////////////////////////////////// #define FWPS_FILTER_CONDITION FWPS_FILTER_CONDITION0 #define FWPS_ACTION FWPS_ACTION0 #if (NTDDI_VERSION >= NTDDI_WIN7) #define FWPS_FILTER FWPS_FILTER1 #else #define FWPS_FILTER FWPS_FILTER0 #endif #define FWPS_INCOMING_VALUE FWPS_INCOMING_VALUE0 #define FWPS_INCOMING_VALUES FWPS_INCOMING_VALUES0 #define FWPS_DISCARD_METADATA FWPS_DISCARD_METADATA0 #define FWPS_INBOUND_FRAGMENT_METADATA FWPS_INBOUND_FRAGMENT_METADATA0 #define FWPS_CLASSIFY_OUT FWPS_CLASSIFY_OUT0 #if (NTDDI_VERSION >= NTDDI_WIN7) #define FWPS_ALE_ENDPOINT_PROPERTIES FWPS_ALE_ENDPOINT_PROPERTIES0 #define FWPS_ALE_ENDPOINT_ENUM_TEMPLATE FWPS_ALE_ENDPOINT_ENUM_TEMPLATE0 #endif /////////////////////////////////////////////////////////////////////////////// // // Version independent definitions for Fwptypes. // /////////////////////////////////////////////////////////////////////////////// #define FWP_VALUE FWP_VALUE0 #define FWP_RANGE FWP_RANGE0 #define FWP_CONDITION_VALUE FWP_CONDITION_VALUE0 /////////////////////////////////////////////////////////////////////////////// // // Version independent definitions for Iketypes. // /////////////////////////////////////////////////////////////////////////////// #if (NTDDI_VERSION >= NTDDI_WIN7) #define IKEEXT_PRESHARED_KEY_AUTHENTICATION IKEEXT_PRESHARED_KEY_AUTHENTICATION1 #else #define IKEEXT_PRESHARED_KEY_AUTHENTICATION IKEEXT_PRESHARED_KEY_AUTHENTICATION0 #endif #define IKEEXT_CERT_ROOT_CONFIG IKEEXT_CERT_ROOT_CONFIG0 #if (NTDDI_VERSION >= NTDDI_WIN7) #define IKEEXT_CERTIFICATE_AUTHENTICATION IKEEXT_CERTIFICATE_AUTHENTICATION1 #else #define IKEEXT_CERTIFICATE_AUTHENTICATION IKEEXT_CERTIFICATE_AUTHENTICATION0 #endif #define IKEEXT_IPV6_CGA_AUTHENTICATION IKEEXT_IPV6_CGA_AUTHENTICATION0 #define IKEEXT_KERBEROS_AUTHENTICATION IKEEXT_KERBEROS_AUTHENTICATION0 #define IKEEXT_NTLM_V2_AUTHENTICATION IKEEXT_NTLM_V2_AUTHENTICATION0 #if (NTDDI_VERSION >= NTDDI_WIN7) #define IKEEXT_EAP_AUTHENTICATION IKEEXT_EAP_AUTHENTICATION0 #endif #if (NTDDI_VERSION >= NTDDI_WIN7) #define IKEEXT_AUTHENTICATION_METHOD IKEEXT_AUTHENTICATION_METHOD1 #else #define IKEEXT_AUTHENTICATION_METHOD IKEEXT_AUTHENTICATION_METHOD0 #endif #define IKEEXT_CIPHER_ALGORITHM IKEEXT_CIPHER_ALGORITHM0 #define IKEEXT_INTEGRITY_ALGORITHM IKEEXT_INTEGRITY_ALGORITHM0 #define IKEEXT_PROPOSAL IKEEXT_PROPOSAL0 #if (NTDDI_VERSION >= NTDDI_WIN7) #define IKEEXT_POLICY IKEEXT_POLICY1 #else #define IKEEXT_POLICY IKEEXT_POLICY0 #endif #if (NTDDI_VERSION >= NTDDI_WIN7) #define IKEEXT_EM_POLICY IKEEXT_EM_POLICY1 #else #define IKEEXT_EM_POLICY IKEEXT_EM_POLICY0 #endif #if (NTDDI_VERSION >= NTDDI_WIN7) #define IKEEXT_IP_VERSION_SPECIFIC_KEYMODULE_STATISTICS IKEEXT_IP_VERSION_SPECIFIC_KEYMODULE_STATISTICS1 #else #define IKEEXT_IP_VERSION_SPECIFIC_KEYMODULE_STATISTICS IKEEXT_IP_VERSION_SPECIFIC_KEYMODULE_STATISTICS0 #endif #if (NTDDI_VERSION >= NTDDI_WIN7) #define IKEEXT_KEYMODULE_STATISTICS IKEEXT_KEYMODULE_STATISTICS1 #else #define IKEEXT_KEYMODULE_STATISTICS IKEEXT_KEYMODULE_STATISTICS0 #endif #if (NTDDI_VERSION >= NTDDI_WIN7) #define IKEEXT_IP_VERSION_SPECIFIC_COMMON_STATISTICS IKEEXT_IP_VERSION_SPECIFIC_COMMON_STATISTICS1 #else #define IKEEXT_IP_VERSION_SPECIFIC_COMMON_STATISTICS IKEEXT_IP_VERSION_SPECIFIC_COMMON_STATISTICS0 #endif #if (NTDDI_VERSION >= NTDDI_WIN7) #define IKEEXT_COMMON_STATISTICS IKEEXT_COMMON_STATISTICS1 #else #define IKEEXT_COMMON_STATISTICS IKEEXT_COMMON_STATISTICS0 #endif #if (NTDDI_VERSION >= NTDDI_WIN7) #define IKEEXT_STATISTICS IKEEXT_STATISTICS1 #else #define IKEEXT_STATISTICS IKEEXT_STATISTICS0 #endif #define IKEEXT_TRAFFIC IKEEXT_TRAFFIC0 #define IKEEXT_COOKIE_PAIR IKEEXT_COOKIE_PAIR0 #define IKEEXT_NAME_CREDENTIAL IKEEXT_NAME_CREDENTIAL0 #if (NTDDI_VERSION >= NTDDI_WIN7) #define IKEEXT_CERTIFICATE_CREDENTIAL IKEEXT_CERTIFICATE_CREDENTIAL1 #define IKEEXT_CREDENTIAL IKEEXT_CREDENTIAL1 #define IKEEXT_CREDENTIAL_PAIR IKEEXT_CREDENTIAL_PAIR1 #define IKEEXT_CREDENTIALS IKEEXT_CREDENTIALS1 #else #define IKEEXT_CERTIFICATE_CREDENTIAL IKEEXT_CERTIFICATE_CREDENTIAL0 #define IKEEXT_CREDENTIAL IKEEXT_CREDENTIAL0 #define IKEEXT_CREDENTIAL_PAIR IKEEXT_CREDENTIAL_PAIR0 #define IKEEXT_CREDENTIALS IKEEXT_CREDENTIALS0 #endif #if (NTDDI_VERSION >= NTDDI_WIN7) #define IKEEXT_SA_DETAILS IKEEXT_SA_DETAILS1 #else #define IKEEXT_SA_DETAILS IKEEXT_SA_DETAILS0 #endif #define IKEEXT_SA_ENUM_TEMPLATE IKEEXT_SA_ENUM_TEMPLATE0 /////////////////////////////////////////////////////////////////////////////// // // Version independent definitions for Ipsectypes. // /////////////////////////////////////////////////////////////////////////////// #define IPSEC_SA_LIFETIME IPSEC_SA_LIFETIME0 #define IPSEC_AUTH_TRANSFORM_ID IPSEC_AUTH_TRANSFORM_ID0 #define IPSEC_AUTH_TRANSFORM IPSEC_AUTH_TRANSFORM0 #define IPSEC_CIPHER_TRANSFORM_ID IPSEC_CIPHER_TRANSFORM_ID0 #define IPSEC_CIPHER_TRANSFORM IPSEC_CIPHER_TRANSFORM0 #define IPSEC_AUTH_AND_CIPHER_TRANSFORM IPSEC_AUTH_AND_CIPHER_TRANSFORM0 #define IPSEC_SA_TRANSFORM IPSEC_SA_TRANSFORM0 #define IPSEC_PROPOSAL IPSEC_PROPOSAL0 #define IPSEC_SA_IDLE_TIMEOUT IPSEC_SA_IDLE_TIMEOUT0 #if (NTDDI_VERSION >= NTDDI_WIN7) #define IPSEC_TRANSPORT_POLICY IPSEC_TRANSPORT_POLICY1 #define IPSEC_TUNNEL_ENDPOINTS IPSEC_TUNNEL_ENDPOINTS1 #define IPSEC_TUNNEL_POLICY IPSEC_TUNNEL_POLICY1 #else #define IPSEC_TRANSPORT_POLICY IPSEC_TRANSPORT_POLICY0 #define IPSEC_TUNNEL_ENDPOINTS IPSEC_TUNNEL_ENDPOINTS0 #define IPSEC_TUNNEL_POLICY IPSEC_TUNNEL_POLICY0 #endif #define IPSEC_KEYING_POLICY IPSEC_KEYING_POLICY0 #define IPSEC_AGGREGATE_SA_STATISTICS IPSEC_AGGREGATE_SA_STATISTICS0 #define IPSEC_ESP_DROP_PACKET_STATISTICS IPSEC_ESP_DROP_PACKET_STATISTICS0 #define IPSEC_AH_DROP_PACKET_STATISTICS IPSEC_AH_DROP_PACKET_STATISTICS0 #if (NTDDI_VERSION >= NTDDI_WIN7) #define IPSEC_AGGREGATE_DROP_PACKET_STATISTICS IPSEC_AGGREGATE_DROP_PACKET_STATISTICS1 #define IPSEC_TRAFFIC_STATISTICS IPSEC_TRAFFIC_STATISTICS1 #define IPSEC_STATISTICS IPSEC_STATISTICS1 #else #define IPSEC_AGGREGATE_DROP_PACKET_STATISTICS IPSEC_AGGREGATE_DROP_PACKET_STATISTICS0 #define IPSEC_TRAFFIC_STATISTICS IPSEC_TRAFFIC_STATISTICS0 #define IPSEC_STATISTICS IPSEC_STATISTICS0 #endif #define IPSEC_SA_AUTH_INFORMATION IPSEC_SA_AUTH_INFORMATION0 #define IPSEC_SA_CIPHER_INFORMATION IPSEC_SA_CIPHER_INFORMATION0 #define IPSEC_SA_AUTH_AND_CIPHER_INFORMATION IPSEC_SA_AUTH_AND_CIPHER_INFORMATION0 #define IPSEC_SA IPSEC_SA0 #define IPSEC_KEYMODULE_STATE IPSEC_KEYMODULE_STATE0 #define IPSEC_TOKEN IPSEC_TOKEN0 #define IPSEC_ID IPSEC_ID0 #if (NTDDI_VERSION >= NTDDI_WIN7) #define IPSEC_TRAFFIC IPSEC_TRAFFIC1 #define IPSEC_SA_BUNDLE IPSEC_SA_BUNDLE1 #else #define IPSEC_TRAFFIC IPSEC_TRAFFIC0 #define IPSEC_SA_BUNDLE IPSEC_SA_BUNDLE0 #endif #define IPSEC_V4_UDP_ENCAPSULATION IPSEC_V4_UDP_ENCAPSULATION0 #if (NTDDI_VERSION >= NTDDI_WIN7) #define IPSEC_GETSPI IPSEC_GETSPI1 #define IPSEC_SA_DETAILS IPSEC_SA_DETAILS1 #define IPSEC_SA_CONTEXT IPSEC_SA_CONTEXT1 #else #define IPSEC_GETSPI IPSEC_GETSPI0 #define IPSEC_SA_DETAILS IPSEC_SA_DETAILS0 #define IPSEC_SA_CONTEXT IPSEC_SA_CONTEXT0 #endif #define IPSEC_SA_CONTEXT_ENUM_TEMPLATE IPSEC_SA_CONTEXT_ENUM_TEMPLATE0 #define IPSEC_SA_ENUM_TEMPLATE IPSEC_SA_ENUM_TEMPLATE0 #define IPSEC_ADDRESS_INFO IPSEC_ADDRESS_INFO0 #if (NTDDI_VERSION >= NTDDI_WIN7) #define IPSEC_VIRTUAL_IF_TUNNEL_INFO IPSEC_VIRTUAL_IF_TUNNEL_INFO0 #define IPSEC_DOSP_OPTIONS IPSEC_DOSP_OPTIONS0 #define IPSEC_DOSP_STATISTICS IPSEC_DOSP_STATISTICS0 #define IPSEC_DOSP_STATE IPSEC_DOSP_STATE0 #define IPSEC_DOSP_STATE_ENUM_TEMPLATE IPSEC_DOSP_STATE_ENUM_TEMPLATE0 #endif // (NTDDI_VERSION >= NTDDI_WIN7) /////////////////////////////////////////////////////////////////////////////// // // Version independent definitions for Fwpmu / Fwpmk // /////////////////////////////////////////////////////////////////////////////// #define FWPM_SERVICE_STATE_CHANGE_CALLBACK FWPM_SERVICE_STATE_CHANGE_CALLBACK0 #define FwpmFreeMemory FwpmFreeMemory0 #define FwpmBfeStateGet FwpmBfeStateGet0 #define FwpmBfeStateSubscribeChanges FwpmBfeStateSubscribeChanges0 #define FwpmBfeStateUnsubscribeChanges FwpmBfeStateUnsubscribeChanges0 #define FwpmEngineOpen FwpmEngineOpen0 #define FwpmEngineClose FwpmEngineClose0 #define FwpmEngineGetOption FwpmEngineGetOption0 #define FwpmEngineSetOption FwpmEngineSetOption0 #define FwpmEngineGetSecurityInfo FwpmEngineGetSecurityInfo0 #define FwpmEngineSetSecurityInfo FwpmEngineSetSecurityInfo0 #define FwpmSessionCreateEnumHandle FwpmSessionCreateEnumHandle0 #define FwpmSessionEnum FwpmSessionEnum0 #define FwpmSessionDestroyEnumHandle FwpmSessionDestroyEnumHandle0 #define FwpmTransactionBegin FwpmTransactionBegin0 #define FwpmTransactionCommit FwpmTransactionCommit0 #define FwpmTransactionAbort FwpmTransactionAbort0 #define FwpmProviderAdd FwpmProviderAdd0 #define FwpmProviderDeleteByKey FwpmProviderDeleteByKey0 #define FwpmProviderGetByKey FwpmProviderGetByKey0 #define FwpmProviderCreateEnumHandle FwpmProviderCreateEnumHandle0 #define FwpmProviderEnum FwpmProviderEnum0 #define FwpmProviderDestroyEnumHandle FwpmProviderDestroyEnumHandle0 #define FwpmProviderGetSecurityInfoByKey FwpmProviderGetSecurityInfoByKey0 #define FwpmProviderSetSecurityInfoByKey FwpmProviderSetSecurityInfoByKey0 #define FWPM_PROVIDER_CHANGE_CALLBACK FWPM_PROVIDER_CHANGE_CALLBACK0 #define FwpmProviderSubscribeChanges FwpmProviderSubscribeChanges0 #define FwpmProviderUnsubscribeChanges FwpmProviderUnsubscribeChanges0 #define FwpmProviderSubscriptionsGet FwpmProviderSubscriptionsGet0 #if (NTDDI_VERSION >= NTDDI_WIN7) #define FwpmProviderContextAdd FwpmProviderContextAdd1 #define FwpmProviderContextGetById FwpmProviderContextGetById1 #define FwpmProviderContextGetByKey FwpmProviderContextGetByKey1 #define FwpmProviderContextEnum FwpmProviderContextEnum1 #else #define FwpmProviderContextAdd FwpmProviderContextAdd0 #define FwpmProviderContextGetById FwpmProviderContextGetById0 #define FwpmProviderContextGetByKey FwpmProviderContextGetByKey0 #define FwpmProviderContextEnum FwpmProviderContextEnum0 #endif #define FwpmProviderContextDeleteById FwpmProviderContextDeleteById0 #define FwpmProviderContextDeleteByKey FwpmProviderContextDeleteByKey0 #define FwpmProviderContextCreateEnumHandle FwpmProviderContextCreateEnumHandle0 #define FwpmProviderContextDestroyEnumHandle FwpmProviderContextDestroyEnumHandle0 #define FwpmProviderContextGetSecurityInfoByKey FwpmProviderContextGetSecurityInfoByKey0 #define FwpmProviderContextSetSecurityInfoByKey FwpmProviderContextSetSecurityInfoByKey0 #define FWPM_PROVIDER_CONTEXT_CHANGE_CALLBACK FWPM_PROVIDER_CONTEXT_CHANGE_CALLBACK0 #define FwpmProviderContextSubscribeChanges FwpmProviderContextSubscribeChanges0 #define FwpmProviderContextUnsubscribeChanges FwpmProviderContextUnsubscribeChanges0 #define FwpmProviderContextSubscriptionsGet FwpmProviderContextSubscriptionsGet0 #define FwpmSubLayerAdd FwpmSubLayerAdd0 #define FwpmSubLayerDeleteByKey FwpmSubLayerDeleteByKey0 #define FwpmSubLayerGetByKey FwpmSubLayerGetByKey0 #define FwpmSubLayerCreateEnumHandle FwpmSubLayerCreateEnumHandle0 #define FwpmSubLayerEnum FwpmSubLayerEnum0 #define FwpmSubLayerDestroyEnumHandle FwpmSubLayerDestroyEnumHandle0 #define FwpmSubLayerGetSecurityInfoByKey FwpmSubLayerGetSecurityInfoByKey0 #define FwpmSubLayerSetSecurityInfoByKey FwpmSubLayerSetSecurityInfoByKey0 #define FWPM_SUBLAYER_CHANGE_CALLBACK FWPM_SUBLAYER_CHANGE_CALLBACK0 #define FwpmSubLayerSubscribeChanges FwpmSubLayerSubscribeChanges0 #define FwpmSubLayerUnsubscribeChanges FwpmSubLayerUnsubscribeChanges0 #define FwpmSubLayerSubscriptionsGet FwpmSubLayerSubscriptionsGet0 #define FwpmLayerGetById FwpmLayerGetById0 #define FwpmLayerGetByKey FwpmLayerGetByKey0 #define FwpmLayerCreateEnumHandle FwpmLayerCreateEnumHandle0 #define FwpmLayerEnum FwpmLayerEnum0 #define FwpmLayerDestroyEnumHandle FwpmLayerDestroyEnumHandle0 #define FwpmLayerGetSecurityInfoByKey FwpmLayerGetSecurityInfoByKey0 #define FwpmLayerSetSecurityInfoByKey FwpmLayerSetSecurityInfoByKey0 #define FwpmCalloutAdd FwpmCalloutAdd0 #define FwpmCalloutDeleteById FwpmCalloutDeleteById0 #define FwpmCalloutDeleteByKey FwpmCalloutDeleteByKey0 #define FwpmCalloutGetById FwpmCalloutGetById0 #define FwpmCalloutGetByKey FwpmCalloutGetByKey0 #define FwpmCalloutCreateEnumHandle FwpmCalloutCreateEnumHandle0 #define FwpmCalloutEnum FwpmCalloutEnum0 #define FwpmCalloutDestroyEnumHandle FwpmCalloutDestroyEnumHandle0 #define FwpmCalloutGetSecurityInfoByKey FwpmCalloutGetSecurityInfoByKey0 #define FwpmCalloutSetSecurityInfoByKey FwpmCalloutSetSecurityInfoByKey0 #define FWPM_CALLOUT_CHANGE_CALLBACK FWPM_CALLOUT_CHANGE_CALLBACK0 #define FwpmCalloutSubscribeChanges FwpmCalloutSubscribeChanges0 #define FwpmCalloutUnsubscribeChanges FwpmCalloutUnsubscribeChanges0 #define FwpmCalloutSubscriptionsGet FwpmCalloutSubscriptionsGet0 #define FwpmFilterAdd FwpmFilterAdd0 #define FwpmFilterDeleteById FwpmFilterDeleteById0 #define FwpmFilterDeleteByKey FwpmFilterDeleteByKey0 #define FwpmFilterGetById FwpmFilterGetById0 #define FwpmFilterGetByKey FwpmFilterGetByKey0 #define FwpmFilterCreateEnumHandle FwpmFilterCreateEnumHandle0 #define FwpmFilterEnum FwpmFilterEnum0 #define FwpmFilterDestroyEnumHandle FwpmFilterDestroyEnumHandle0 #define FwpmFilterGetSecurityInfoByKey FwpmFilterGetSecurityInfoByKey0 #define FwpmFilterSetSecurityInfoByKey FwpmFilterSetSecurityInfoByKey0 #define FWPM_FILTER_CHANGE_CALLBACK FWPM_FILTER_CHANGE_CALLBACK0 #define FwpmFilterSubscribeChanges FwpmFilterSubscribeChanges0 #define FwpmFilterUnsubscribeChanges FwpmFilterUnsubscribeChanges0 #define FwpmFilterSubscriptionsGet FwpmFilterSubscriptionsGet0 #define FwpmGetAppIdFromFileName FwpmGetAppIdFromFileName0 #if (NTDDI_VERSION >= NTDDI_WIN7) #define FwpmIPsecTunnelAdd FwpmIPsecTunnelAdd1 #else #define FwpmIPsecTunnelAdd FwpmIPsecTunnelAdd0 #endif #define FwpmIPsecTunnelDeleteByKey FwpmIPsecTunnelDeleteByKey0 #if (NTDDI_VERSION >= NTDDI_WIN7) #define IPsecGetStatistics IPsecGetStatistics1 #define IPsecSaContextCreate IPsecSaContextCreate1 #else #define IPsecGetStatistics IPsecGetStatistics0 #define IPsecSaContextCreate IPsecSaContextCreate0 #endif #define IPsecSaContextDeleteById IPsecSaContextDeleteById0 #if (NTDDI_VERSION >= NTDDI_WIN7) #define IPsecSaContextGetById IPsecSaContextGetById1 #define IPsecSaContextGetSpi IPsecSaContextGetSpi1 #define IPsecSaContextSetSpi IPsecSaContextSetSpi0 #define IPsecSaContextAddInbound IPsecSaContextAddInbound1 #define IPsecSaContextAddOutbound IPsecSaContextAddOutbound1 #else #define IPsecSaContextGetById IPsecSaContextGetById0 #define IPsecSaContextGetSpi IPsecSaContextGetSpi0 #define IPsecSaContextAddInbound IPsecSaContextAddInbound0 #define IPsecSaContextAddOutbound IPsecSaContextAddOutbound0 #endif #define IPsecSaContextExpire IPsecSaContextExpire0 #if (NTDDI_VERSION >= NTDDI_WIN7) #define IPsecSaContextUpdate IPsecSaContextUpdate0 #endif #define IPsecSaContextCreateEnumHandle IPsecSaContextCreateEnumHandle0 #if (NTDDI_VERSION >= NTDDI_WIN7) #define IPsecSaContextEnum IPsecSaContextEnum1 #else #define IPsecSaContextEnum IPsecSaContextEnum0 #endif #define IPsecSaContextDestroyEnumHandle IPsecSaContextDestroyEnumHandle0 #define IPsecSaCreateEnumHandle IPsecSaCreateEnumHandle0 #if (NTDDI_VERSION >= NTDDI_WIN7) #define IPsecSaEnum IPsecSaEnum1 #else #define IPsecSaEnum IPsecSaEnum0 #endif #define IPsecSaDestroyEnumHandle IPsecSaDestroyEnumHandle0 #define IPsecSaDbGetSecurityInfo IPsecSaDbGetSecurityInfo0 #define IPsecSaDbSetSecurityInfo IPsecSaDbSetSecurityInfo0 #if (NTDDI_VERSION >= NTDDI_WIN7) #define IPsecDospGetStatistics IPsecDospGetStatistics0 #define IPsecDospStateCreateEnumHandle IPsecDospStateCreateEnumHandle0 #define IPsecDospStateEnum IPsecDospStateEnum0 #define IPsecDospStateDestroyEnumHandle IPsecDospStateDestroyEnumHandle0 #define IPsecDospGetSecurityInfo IPsecDospGetSecurityInfo0 #define IPsecDospSetSecurityInfo IPsecDospSetSecurityInfo0 #endif #if (NTDDI_VERSION >= NTDDI_WIN7) #define IkeextGetStatistics IkeextGetStatistics1 #else #define IkeextGetStatistics IkeextGetStatistics0 #endif #define IkeextSaDeleteById IkeextSaDeleteById0 #if (NTDDI_VERSION >= NTDDI_WIN7) #define IkeextSaGetById IkeextSaGetById1 #else #define IkeextSaGetById IkeextSaGetById0 #endif #define IkeextSaCreateEnumHandle IkeextSaCreateEnumHandle0 #if (NTDDI_VERSION >= NTDDI_WIN7) #define IkeextSaEnum IkeextSaEnum1 #else #define IkeextSaEnum IkeextSaEnum0 #endif #define IkeextSaDestroyEnumHandle IkeextSaDestroyEnumHandle0 #define IkeextSaDbGetSecurityInfo IkeextSaDbGetSecurityInfo0 #define IkeextSaDbSetSecurityInfo IkeextSaDbSetSecurityInfo0 #define FwpmNetEventCreateEnumHandle FwpmNetEventCreateEnumHandle0 #if (NTDDI_VERSION >= NTDDI_WIN7) #define FwpmNetEventEnum FwpmNetEventEnum1 #else #define FwpmNetEventEnum FwpmNetEventEnum0 #endif #define FwpmNetEventDestroyEnumHandle FwpmNetEventDestroyEnumHandle0 #define FwpmNetEventsGetSecurityInfo FwpmNetEventsGetSecurityInfo0 #define FwpmNetEventsSetSecurityInfo FwpmNetEventsSetSecurityInfo0 #if (NTDDI_VERSION >= NTDDI_WIN7) #define FWPM_NET_EVENT_CALLBACK FWPM_NET_EVENT_CALLBACK0 #define FwpmNetEventSubscribe FwpmNetEventSubscribe0 #define FwpmNetEventUnsubscribe FwpmNetEventUnsubscribe0 #define FwpmNetEventSubscriptionsGet FwpmNetEventSubscriptionsGet0 #define FwpmSystemPortsGet FwpmSystemPortsGet0 #define FWPM_SYSTEM_PORTS_CALLBACK FWPM_SYSTEM_PORTS_CALLBACK0 #define FwpmSystemPortsSubscribe FwpmSystemPortsSubscribe0 #define FwpmSystemPortsUnsubscribe FwpmSystemPortsUnsubscribe0 #endif /////////////////////////////////////////////////////////////////////////////// // // Version independent definitions for Fwpsu / Fwpsk // /////////////////////////////////////////////////////////////////////////////// #define FWPS_INCOMING_METADATA_VALUES FWPS_INCOMING_METADATA_VALUES0 #if (NTDDI_VERSION >= NTDDI_WIN7) #define FWPS_CALLOUT_CLASSIFY_FN FWPS_CALLOUT_CLASSIFY_FN1 #else #define FWPS_CALLOUT_CLASSIFY_FN FWPS_CALLOUT_CLASSIFY_FN0 #endif // (NTDDI_VERSION >= NTDDI_WIN7) #if (NTDDI_VERSION >= NTDDI_WIN7) #define FWPS_CALLOUT_NOTIFY_FN FWPS_CALLOUT_NOTIFY_FN1 #else #define FWPS_CALLOUT_NOTIFY_FN FWPS_CALLOUT_NOTIFY_FN0 #endif // (NTDDI_VERSION >= NTDDI_WIN7) #define FWPS_CALLOUT_FLOW_DELETE_NOTIFY_FN FWPS_CALLOUT_FLOW_DELETE_NOTIFY_FN0 #define FWPS_CALLOUT_BOOTTIME_CALLOUT_DELETE_NOTIFY_FN FWPS_CALLOUT_BOOTTIME_CALLOUT_DELETE_NOTIFY_FN0 #if (NTDDI_VERSION >= NTDDI_WIN7) #define FWPS_CALLOUT FWPS_CALLOUT1 #else #define FWPS_CALLOUT FWPS_CALLOUT0 #endif // (NTDDI_VERSION >= NTDDI_WIN7) #if (NTDDI_VERSION >= NTDDI_WIN7) #define FwpsCalloutRegister FwpsCalloutRegister1 #else #define FwpsCalloutRegister FwpsCalloutRegister0 #endif // (NTDDI_VERSION >= NTDDI_WIN7) #define FwpsCalloutUnregisterById FwpsCalloutUnregisterById0 #define FwpsCalloutUnregisterByKey FwpsCalloutUnregisterByKey0 #define FwpsFlowAssociateContext FwpsFlowAssociateContext0 #define FwpsFlowRemoveContext FwpsFlowRemoveContext0 #define FWPS_PACKET_LIST_INBOUND_IPSEC_INFORMATION FWPS_PACKET_LIST_INBOUND_IPSEC_INFORMATION0 #define FWPS_PACKET_LIST_OUTBOUND_IPSEC_INFORMATION FWPS_PACKET_LIST_OUTBOUND_IPSEC_INFORMATION0 #define FWPS_PACKET_LIST_IPSEC_INFORMATION FWPS_PACKET_LIST_IPSEC_INFORMATION0 #define FWPS_PACKET_LIST_FWP_INFORMATION FWPS_PACKET_LIST_FWP_INFORMATION0 #define FWPS_PACKET_LIST_INFORMATION FWPS_PACKET_LIST_INFORMATION0 #define FwpsGetPacketListSecurityInformation FwpsGetPacketListSecurityInformation0 #define FwpsPendOperation FwpsPendOperation0 #define FwpsCompleteOperation FwpsCompleteOperation0 #if (NTDDI_VERSION >= NTDDI_WIN7) #define FwpsAcquireClassifyHandle FwpsAcquireClassifyHandle0 #define FwpsReleaseClassifyHandle FwpsReleaseClassifyHandle0 #define FwpsPendClassify FwpsPendClassify0 #define FwpsCompleteClassify FwpsCompleteClassify0 #define FwpsAcquireWritableLayerDataPointer FwpsAcquireWritableLayerDataPointer0 #define FwpsApplyModifiedLayerData FwpsApplyModifiedLayerData0 #define FWPS_CONNECT_REQUEST FWPS_CONNECT_REQUEST0 #define FWPS_BIND_REQUEST FWPS_BIND_REQUEST0 #define FWPS_NET_BUFFER_LIST_EVENT_TYPE FWPS_NET_BUFFER_LIST_EVENT_TYPE0 #define FWPS_NET_BUFFER_LIST_NOTIFY_FN FWPS_NET_BUFFER_LIST_NOTIFY_FN0 #define FwpsNetBufferListGetTagForContext FwpsNetBufferListGetTagForContext0 #define FwpsNetBufferListAssociateContext FwpsNetBufferListAssociateContext0 #define FwpsNetBufferListRetrieveContext FwpsNetBufferListRetrieveContext0 #define FwpsNetBufferListRemoveContext FwpsNetBufferListRemoveContext0 #define FwpsOpenToken FwpsOpenToken0 #define FwpsAleEndpointGetById FwpsAleEndpointGetById0 #define FwpsAleEndpointCreateEnumHandle FwpsAleEndpointCreateEnumHandle0 #define FwpsAleEndpointEnum FwpsAleEndpointEnum0 #define FwpsAleEndpointDestroyEnumHandle FwpsAleEndpointDestroyEnumHandle0 #define FwpsAleEndpointGetSecurityInfo FwpsAleEndpointGetSecurityInfo0 #define FwpsAleEndpointSetSecurityInfo FwpsAleEndpointSetSecurityInfo0 #endif // (NTDDI_VERSION >= NTDDI_WIN7) #define FwpsClassifyOptionSet FwpsClassifyOptionSet0 #define FwpsInjectionHandleCreate FwpsInjectionHandleCreate0 #define FwpsInjectionHandleDestroy FwpsInjectionHandleDestroy0 #define FWPS_INJECT_COMPLETE FWPS_INJECT_COMPLETE0 #define FwpsAllocateNetBufferAndNetBufferList FwpsAllocateNetBufferAndNetBufferList0 #define FwpsFreeNetBufferList FwpsFreeNetBufferList0 #define FwpsAllocateCloneNetBufferList FwpsAllocateCloneNetBufferList0 #define FwpsFreeCloneNetBufferList FwpsFreeCloneNetBufferList0 #define FwpsReassembleForwardFragmentGroup FwpsReassembleForwardFragmentGroup0 #define FwpsInjectNetworkSendAsync FwpsInjectNetworkSendAsync0 #define FwpsInjectForwardAsync FwpsInjectForwardAsync0 #define FwpsConstructIpHeaderForTransportPacket FwpsConstructIpHeaderForTransportPacket0 #if (NTDDI_VERSION >= NTDDI_WIN7) #define FWPS_TRANSPORT_SEND_PARAMS FWPS_TRANSPORT_SEND_PARAMS1 #define FwpsInjectTransportSendAsync FwpsInjectTransportSendAsync1 #else #define FWPS_TRANSPORT_SEND_PARAMS FWPS_TRANSPORT_SEND_PARAMS0 #define FwpsInjectTransportSendAsync FwpsInjectTransportSendAsync0 #endif // (NTDDI_VERSION >= NTDDI_WIN7) #define FwpsInjectTransportReceiveAsync FwpsInjectTransportReceiveAsync0 #define FwpsInjectNetworkReceiveAsync FwpsInjectNetworkReceiveAsync0 #define FwpsReferenceNetBufferList FwpsReferenceNetBufferList0 #define FwpsDereferenceNetBufferList FwpsDereferenceNetBufferList0 #define FwpsQueryPacketInjectionState FwpsQueryPacketInjectionState0 #define FWPS_STREAM_DATA_OFFSET FWPS_STREAM_DATA_OFFSET0 #define FWPS_STREAM_DATA FWPS_STREAM_DATA0 #define FWPS_STREAM_CALLOUT_IO_PACKET FWPS_STREAM_CALLOUT_IO_PACKET0 #define FwpsStreamInjectAsync FwpsStreamInjectAsync0 #define FwpsStreamContinue FwpsStreamContinue0 #define FwpsCopyStreamDataToBuffer FwpsCopyStreamDataToBuffer0 #define FwpsCloneStreamData FwpsCloneStreamData0 #define FwpsDiscardClonedStreamData FwpsDiscardClonedStreamData0 #endif // FWPVI_H #endif // (NTDDI_VERSION >= NTDDI_WIN6)
26,457
C++
.h
552
46.88587
104
0.846825
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,256
fwpmu.h
BlackINT3_OpenArk/src/OpenArk/kernel/network/include/fwpmu.h
/* Copyright (c) Microsoft Corporation SYNOPSIS Declares the management portion of the FWP API. */ #if (NTDDI_VERSION >= NTDDI_WIN6) /////////////////////////////////////////////////////////////////////////////// // // GUIDs for built-in layers. // /////////////////////////////////////////////////////////////////////////////// // c86fd1bf-21cd-497e-a0bb-17425c885c58 DEFINE_GUID( FWPM_LAYER_INBOUND_IPPACKET_V4, 0xc86fd1bf, 0x21cd, 0x497e, 0xa0, 0xbb, 0x17, 0x42, 0x5c, 0x88, 0x5c, 0x58 ); // b5a230d0-a8c0-44f2-916e-991b53ded1f7 DEFINE_GUID( FWPM_LAYER_INBOUND_IPPACKET_V4_DISCARD, 0xb5a230d0, 0xa8c0, 0x44f2, 0x91, 0x6e, 0x99, 0x1b, 0x53, 0xde, 0xd1, 0xf7 ); // f52032cb-991c-46e7-971d-2601459a91ca DEFINE_GUID( FWPM_LAYER_INBOUND_IPPACKET_V6, 0xf52032cb, 0x991c, 0x46e7, 0x97, 0x1d, 0x26, 0x01, 0x45, 0x9a, 0x91, 0xca ); // bb24c279-93b4-47a2-83ad-ae1698b50885 DEFINE_GUID( FWPM_LAYER_INBOUND_IPPACKET_V6_DISCARD, 0xbb24c279, 0x93b4, 0x47a2, 0x83, 0xad, 0xae, 0x16, 0x98, 0xb5, 0x08, 0x85 ); // 1e5c9fae-8a84-4135-a331-950b54229ecd DEFINE_GUID( FWPM_LAYER_OUTBOUND_IPPACKET_V4, 0x1e5c9fae, 0x8a84, 0x4135, 0xa3, 0x31, 0x95, 0x0b, 0x54, 0x22, 0x9e, 0xcd ); // 08e4bcb5-b647-48f3-953c-e5ddbd03937e DEFINE_GUID( FWPM_LAYER_OUTBOUND_IPPACKET_V4_DISCARD, 0x08e4bcb5, 0xb647, 0x48f3, 0x95, 0x3c, 0xe5, 0xdd, 0xbd, 0x03, 0x93, 0x7e ); // a3b3ab6b-3564-488c-9117-f34e82142763 DEFINE_GUID( FWPM_LAYER_OUTBOUND_IPPACKET_V6, 0xa3b3ab6b, 0x3564, 0x488c, 0x91, 0x17, 0xf3, 0x4e, 0x82, 0x14, 0x27, 0x63 ); // 9513d7c4-a934-49dc-91a7-6ccb80cc02e3 DEFINE_GUID( FWPM_LAYER_OUTBOUND_IPPACKET_V6_DISCARD, 0x9513d7c4, 0xa934, 0x49dc, 0x91, 0xa7, 0x6c, 0xcb, 0x80, 0xcc, 0x02, 0xe3 ); // a82acc24-4ee1-4ee1-b465-fd1d25cb10a4 DEFINE_GUID( FWPM_LAYER_IPFORWARD_V4, 0xa82acc24, 0x4ee1, 0x4ee1, 0xb4, 0x65, 0xfd, 0x1d, 0x25, 0xcb, 0x10, 0xa4 ); // 9e9ea773-2fae-4210-8f17-34129ef369eb DEFINE_GUID( FWPM_LAYER_IPFORWARD_V4_DISCARD, 0x9e9ea773, 0x2fae, 0x4210, 0x8f, 0x17, 0x34, 0x12, 0x9e, 0xf3, 0x69, 0xeb ); // 7b964818-19c7-493a-b71f-832c3684d28c DEFINE_GUID( FWPM_LAYER_IPFORWARD_V6, 0x7b964818, 0x19c7, 0x493a, 0xb7, 0x1f, 0x83, 0x2c, 0x36, 0x84, 0xd2, 0x8c ); // 31524a5d-1dfe-472f-bb93-518ee945d8a2 DEFINE_GUID( FWPM_LAYER_IPFORWARD_V6_DISCARD, 0x31524a5d, 0x1dfe, 0x472f, 0xbb, 0x93, 0x51, 0x8e, 0xe9, 0x45, 0xd8, 0xa2 ); // 5926dfc8-e3cf-4426-a283-dc393f5d0f9d DEFINE_GUID( FWPM_LAYER_INBOUND_TRANSPORT_V4, 0x5926dfc8, 0xe3cf, 0x4426, 0xa2, 0x83, 0xdc, 0x39, 0x3f, 0x5d, 0x0f, 0x9d ); // ac4a9833-f69d-4648-b261-6dc84835ef39 DEFINE_GUID( FWPM_LAYER_INBOUND_TRANSPORT_V4_DISCARD, 0xac4a9833, 0xf69d, 0x4648, 0xb2, 0x61, 0x6d, 0xc8, 0x48, 0x35, 0xef, 0x39 ); // 634a869f-fc23-4b90-b0c1-bf620a36ae6f DEFINE_GUID( FWPM_LAYER_INBOUND_TRANSPORT_V6, 0x634a869f, 0xfc23, 0x4b90, 0xb0, 0xc1, 0xbf, 0x62, 0x0a, 0x36, 0xae, 0x6f ); // 2a6ff955-3b2b-49d2-9848-ad9d72dcaab7 DEFINE_GUID( FWPM_LAYER_INBOUND_TRANSPORT_V6_DISCARD, 0x2a6ff955, 0x3b2b, 0x49d2, 0x98, 0x48, 0xad, 0x9d, 0x72, 0xdc, 0xaa, 0xb7 ); // 09e61aea-d214-46e2-9b21-b26b0b2f28c8 DEFINE_GUID( FWPM_LAYER_OUTBOUND_TRANSPORT_V4, 0x09e61aea, 0xd214, 0x46e2, 0x9b, 0x21, 0xb2, 0x6b, 0x0b, 0x2f, 0x28, 0xc8 ); // c5f10551-bdb0-43d7-a313-50e211f4d68a DEFINE_GUID( FWPM_LAYER_OUTBOUND_TRANSPORT_V4_DISCARD, 0xc5f10551, 0xbdb0, 0x43d7, 0xa3, 0x13, 0x50, 0xe2, 0x11, 0xf4, 0xd6, 0x8a ); // e1735bde-013f-4655-b351-a49e15762df0 DEFINE_GUID( FWPM_LAYER_OUTBOUND_TRANSPORT_V6, 0xe1735bde, 0x013f, 0x4655, 0xb3, 0x51, 0xa4, 0x9e, 0x15, 0x76, 0x2d, 0xf0 ); // f433df69-ccbd-482e-b9b2-57165658c3b3 DEFINE_GUID( FWPM_LAYER_OUTBOUND_TRANSPORT_V6_DISCARD, 0xf433df69, 0xccbd, 0x482e, 0xb9, 0xb2, 0x57, 0x16, 0x56, 0x58, 0xc3, 0xb3 ); // 3b89653c-c170-49e4-b1cd-e0eeeee19a3e DEFINE_GUID( FWPM_LAYER_STREAM_V4, 0x3b89653c, 0xc170, 0x49e4, 0xb1, 0xcd, 0xe0, 0xee, 0xee, 0xe1, 0x9a, 0x3e ); // 25c4c2c2-25ff-4352-82f9-c54a4a4726dc DEFINE_GUID( FWPM_LAYER_STREAM_V4_DISCARD, 0x25c4c2c2, 0x25ff, 0x4352, 0x82, 0xf9, 0xc5, 0x4a, 0x4a, 0x47, 0x26, 0xdc ); // 47c9137a-7ec4-46b3-b6e4-48e926b1eda4 DEFINE_GUID( FWPM_LAYER_STREAM_V6, 0x47c9137a, 0x7ec4, 0x46b3, 0xb6, 0xe4, 0x48, 0xe9, 0x26, 0xb1, 0xed, 0xa4 ); // 10a59fc7-b628-4c41-9eb8-cf37d55103cf DEFINE_GUID( FWPM_LAYER_STREAM_V6_DISCARD, 0x10a59fc7, 0xb628, 0x4c41, 0x9e, 0xb8, 0xcf, 0x37, 0xd5, 0x51, 0x03, 0xcf ); // 3d08bf4e-45f6-4930-a922-417098e20027 DEFINE_GUID( FWPM_LAYER_DATAGRAM_DATA_V4, 0x3d08bf4e, 0x45f6, 0x4930, 0xa9, 0x22, 0x41, 0x70, 0x98, 0xe2, 0x00, 0x27 ); // 18e330c6-7248-4e52-aaab-472ed67704fd DEFINE_GUID( FWPM_LAYER_DATAGRAM_DATA_V4_DISCARD, 0x18e330c6, 0x7248, 0x4e52, 0xaa, 0xab, 0x47, 0x2e, 0xd6, 0x77, 0x04, 0xfd ); // fa45fe2f-3cba-4427-87fc-57b9a4b10d00 DEFINE_GUID( FWPM_LAYER_DATAGRAM_DATA_V6, 0xfa45fe2f, 0x3cba, 0x4427, 0x87, 0xfc, 0x57, 0xb9, 0xa4, 0xb1, 0x0d, 0x00 ); // 09d1dfe1-9b86-4a42-be9d-8c315b92a5d0 DEFINE_GUID( FWPM_LAYER_DATAGRAM_DATA_V6_DISCARD, 0x09d1dfe1, 0x9b86, 0x4a42, 0xbe, 0x9d, 0x8c, 0x31, 0x5b, 0x92, 0xa5, 0xd0 ); // 61499990-3cb6-4e84-b950-53b94b6964f3 DEFINE_GUID( FWPM_LAYER_INBOUND_ICMP_ERROR_V4, 0x61499990, 0x3cb6, 0x4e84, 0xb9, 0x50, 0x53, 0xb9, 0x4b, 0x69, 0x64, 0xf3 ); // a6b17075-ebaf-4053-a4e7-213c8121ede5 DEFINE_GUID( FWPM_LAYER_INBOUND_ICMP_ERROR_V4_DISCARD, 0xa6b17075, 0xebaf, 0x4053, 0xa4, 0xe7, 0x21, 0x3c, 0x81, 0x21, 0xed, 0xe5 ); // 65f9bdff-3b2d-4e5d-b8c6-c720651fe898 DEFINE_GUID( FWPM_LAYER_INBOUND_ICMP_ERROR_V6, 0x65f9bdff, 0x3b2d, 0x4e5d, 0xb8, 0xc6, 0xc7, 0x20, 0x65, 0x1f, 0xe8, 0x98 ); // a6e7ccc0-08fb-468d-a472-9771d5595e09 DEFINE_GUID( FWPM_LAYER_INBOUND_ICMP_ERROR_V6_DISCARD, 0xa6e7ccc0, 0x08fb, 0x468d, 0xa4, 0x72, 0x97, 0x71, 0xd5, 0x59, 0x5e, 0x09 ); // 41390100-564c-4b32-bc1d-718048354d7c DEFINE_GUID( FWPM_LAYER_OUTBOUND_ICMP_ERROR_V4, 0x41390100, 0x564c, 0x4b32, 0xbc, 0x1d, 0x71, 0x80, 0x48, 0x35, 0x4d, 0x7c ); // b3598d36-0561-4588-a6bf-e955e3f6264b DEFINE_GUID( FWPM_LAYER_OUTBOUND_ICMP_ERROR_V4_DISCARD, 0xb3598d36, 0x0561, 0x4588, 0xa6, 0xbf, 0xe9, 0x55, 0xe3, 0xf6, 0x26, 0x4b ); // 7fb03b60-7b8d-4dfa-badd-980176fc4e12 DEFINE_GUID( FWPM_LAYER_OUTBOUND_ICMP_ERROR_V6, 0x7fb03b60, 0x7b8d, 0x4dfa, 0xba, 0xdd, 0x98, 0x01, 0x76, 0xfc, 0x4e, 0x12 ); // 65f2e647-8d0c-4f47-b19b-33a4d3f1357c DEFINE_GUID( FWPM_LAYER_OUTBOUND_ICMP_ERROR_V6_DISCARD, 0x65f2e647, 0x8d0c, 0x4f47, 0xb1, 0x9b, 0x33, 0xa4, 0xd3, 0xf1, 0x35, 0x7c ); // 1247d66d-0b60-4a15-8d44-7155d0f53a0c DEFINE_GUID( FWPM_LAYER_ALE_RESOURCE_ASSIGNMENT_V4, 0x1247d66d, 0x0b60, 0x4a15, 0x8d, 0x44, 0x71, 0x55, 0xd0, 0xf5, 0x3a, 0x0c ); // 0b5812a2-c3ff-4eca-b88d-c79e20ac6322 DEFINE_GUID( FWPM_LAYER_ALE_RESOURCE_ASSIGNMENT_V4_DISCARD, 0x0b5812a2, 0xc3ff, 0x4eca, 0xb8, 0x8d, 0xc7, 0x9e, 0x20, 0xac, 0x63, 0x22 ); // 55a650e1-5f0a-4eca-a653-88f53b26aa8c DEFINE_GUID( FWPM_LAYER_ALE_RESOURCE_ASSIGNMENT_V6, 0x55a650e1, 0x5f0a, 0x4eca, 0xa6, 0x53, 0x88, 0xf5, 0x3b, 0x26, 0xaa, 0x8c ); // cbc998bb-c51f-4c1a-bb4f-9775fcacab2f DEFINE_GUID( FWPM_LAYER_ALE_RESOURCE_ASSIGNMENT_V6_DISCARD, 0xcbc998bb, 0xc51f, 0x4c1a, 0xbb, 0x4f, 0x97, 0x75, 0xfc, 0xac, 0xab, 0x2f ); // 88bb5dad-76d7-4227-9c71-df0a3ed7be7e DEFINE_GUID( FWPM_LAYER_ALE_AUTH_LISTEN_V4, 0x88bb5dad, 0x76d7, 0x4227, 0x9c, 0x71, 0xdf, 0x0a, 0x3e, 0xd7, 0xbe, 0x7e ); // 371dfada-9f26-45fd-b4eb-c29eb212893f DEFINE_GUID( FWPM_LAYER_ALE_AUTH_LISTEN_V4_DISCARD, 0x371dfada, 0x9f26, 0x45fd, 0xb4, 0xeb, 0xc2, 0x9e, 0xb2, 0x12, 0x89, 0x3f ); // 7ac9de24-17dd-4814-b4bd-a9fbc95a321b DEFINE_GUID( FWPM_LAYER_ALE_AUTH_LISTEN_V6, 0x7ac9de24, 0x17dd, 0x4814, 0xb4, 0xbd, 0xa9, 0xfb, 0xc9, 0x5a, 0x32, 0x1b ); // 60703b07-63c8-48e9-ada3-12b1af40a617 DEFINE_GUID( FWPM_LAYER_ALE_AUTH_LISTEN_V6_DISCARD, 0x60703b07, 0x63c8, 0x48e9, 0xad, 0xa3, 0x12, 0xb1, 0xaf, 0x40, 0xa6, 0x17 ); // e1cd9fe7-f4b5-4273-96c0-592e487b8650 DEFINE_GUID( FWPM_LAYER_ALE_AUTH_RECV_ACCEPT_V4, 0xe1cd9fe7, 0xf4b5, 0x4273, 0x96, 0xc0, 0x59, 0x2e, 0x48, 0x7b, 0x86, 0x50 ); // 9eeaa99b-bd22-4227-919f-0073c63357b1 DEFINE_GUID( FWPM_LAYER_ALE_AUTH_RECV_ACCEPT_V4_DISCARD, 0x9eeaa99b, 0xbd22, 0x4227, 0x91, 0x9f, 0x00, 0x73, 0xc6, 0x33, 0x57, 0xb1 ); // a3b42c97-9f04-4672-b87e-cee9c483257f DEFINE_GUID( FWPM_LAYER_ALE_AUTH_RECV_ACCEPT_V6, 0xa3b42c97, 0x9f04, 0x4672, 0xb8, 0x7e, 0xce, 0xe9, 0xc4, 0x83, 0x25, 0x7f ); // 89455b97-dbe1-453f-a224-13da895af396 DEFINE_GUID( FWPM_LAYER_ALE_AUTH_RECV_ACCEPT_V6_DISCARD, 0x89455b97, 0xdbe1, 0x453f, 0xa2, 0x24, 0x13, 0xda, 0x89, 0x5a, 0xf3, 0x96 ); // c38d57d1-05a7-4c33-904f-7fbceee60e82 DEFINE_GUID( FWPM_LAYER_ALE_AUTH_CONNECT_V4, 0xc38d57d1, 0x05a7, 0x4c33, 0x90, 0x4f, 0x7f, 0xbc, 0xee, 0xe6, 0x0e, 0x82 ); // d632a801-f5ba-4ad6-96e3-607017d9836a DEFINE_GUID( FWPM_LAYER_ALE_AUTH_CONNECT_V4_DISCARD, 0xd632a801, 0xf5ba, 0x4ad6, 0x96, 0xe3, 0x60, 0x70, 0x17, 0xd9, 0x83, 0x6a ); // 4a72393b-319f-44bc-84c3-ba54dcb3b6b4 DEFINE_GUID( FWPM_LAYER_ALE_AUTH_CONNECT_V6, 0x4a72393b, 0x319f, 0x44bc, 0x84, 0xc3, 0xba, 0x54, 0xdc, 0xb3, 0xb6, 0xb4 ); // c97bc3b8-c9a3-4e33-8695-8e17aad4de09 DEFINE_GUID( FWPM_LAYER_ALE_AUTH_CONNECT_V6_DISCARD, 0xc97bc3b8, 0xc9a3, 0x4e33, 0x86, 0x95, 0x8e, 0x17, 0xaa, 0xd4, 0xde, 0x09 ); // af80470a-5596-4c13-9992-539e6fe57967 DEFINE_GUID( FWPM_LAYER_ALE_FLOW_ESTABLISHED_V4, 0xaf80470a, 0x5596, 0x4c13, 0x99, 0x92, 0x53, 0x9e, 0x6f, 0xe5, 0x79, 0x67 ); // 146ae4a9-a1d2-4d43-a31a-4c42682b8e4f DEFINE_GUID( FWPM_LAYER_ALE_FLOW_ESTABLISHED_V4_DISCARD, 0x146ae4a9, 0xa1d2, 0x4d43, 0xa3, 0x1a, 0x4c, 0x42, 0x68, 0x2b, 0x8e, 0x4f ); // 7021d2b3-dfa4-406e-afeb-6afaf7e70efd DEFINE_GUID( FWPM_LAYER_ALE_FLOW_ESTABLISHED_V6, 0x7021d2b3, 0xdfa4, 0x406e, 0xaf, 0xeb, 0x6a, 0xfa, 0xf7, 0xe7, 0x0e, 0xfd ); // 46928636-bbca-4b76-941d-0fa7f5d7d372 DEFINE_GUID( FWPM_LAYER_ALE_FLOW_ESTABLISHED_V6_DISCARD, 0x46928636, 0xbbca, 0x4b76, 0x94, 0x1d, 0x0f, 0xa7, 0xf5, 0xd7, 0xd3, 0x72 ); #if (NTDDI_VERSION >= NTDDI_WIN7) // effb7edb-0055-4f9a-a23a-4ff8131ad191 DEFINE_GUID( FWPM_LAYER_INBOUND_MAC_FRAME_802_3, 0xeffb7edb, 0x0055, 0x4f9a, 0xa2, 0x31, 0x4f, 0xf8, 0x13, 0x1a, 0xd1, 0x91 ); // 694673bc-d6db-4870-adee-0acdbdb7f4b2 DEFINE_GUID( FWPM_LAYER_OUTBOUND_MAC_FRAME_802_3, 0x694673bc, 0xd6db, 0x4870, 0xad, 0xee, 0x0a, 0xcd, 0xbd, 0xb7, 0xf4, 0xb2 ); #endif // f02b1526-a459-4a51-b9e3-759de52b9d2c DEFINE_GUID( FWPM_LAYER_IPSEC_KM_DEMUX_V4, 0xf02b1526, 0xa459, 0x4a51, 0xb9, 0xe3, 0x75, 0x9d, 0xe5, 0x2b, 0x9d, 0x2c ); // 2f755cf6-2fd4-4e88-b3e4-a91bca495235 DEFINE_GUID( FWPM_LAYER_IPSEC_KM_DEMUX_V6, 0x2f755cf6, 0x2fd4, 0x4e88, 0xb3, 0xe4, 0xa9, 0x1b, 0xca, 0x49, 0x52, 0x35 ); // eda65c74-610d-4bc5-948f-3c4f89556867 DEFINE_GUID( FWPM_LAYER_IPSEC_V4, 0xeda65c74, 0x610d, 0x4bc5, 0x94, 0x8f, 0x3c, 0x4f, 0x89, 0x55, 0x68, 0x67 ); // 13c48442-8d87-4261-9a29-59d2abc348b4 DEFINE_GUID( FWPM_LAYER_IPSEC_V6, 0x13c48442, 0x8d87, 0x4261, 0x9a, 0x29, 0x59, 0xd2, 0xab, 0xc3, 0x48, 0xb4 ); // b14b7bdb-dbbd-473e-bed4-8b4708d4f270 DEFINE_GUID( FWPM_LAYER_IKEEXT_V4, 0xb14b7bdb, 0xdbbd, 0x473e, 0xbe, 0xd4, 0x8b, 0x47, 0x08, 0xd4, 0xf2, 0x70 ); // b64786b3-f687-4eb9-89d2-8ef32acdabe2 DEFINE_GUID( FWPM_LAYER_IKEEXT_V6, 0xb64786b3, 0xf687, 0x4eb9, 0x89, 0xd2, 0x8e, 0xf3, 0x2a, 0xcd, 0xab, 0xe2 ); // 75a89dda-95e4-40f3-adc7-7688a9c847e1 DEFINE_GUID( FWPM_LAYER_RPC_UM, 0x75a89dda, 0x95e4, 0x40f3, 0xad, 0xc7, 0x76, 0x88, 0xa9, 0xc8, 0x47, 0xe1 ); // 9247bc61-eb07-47ee-872c-bfd78bfd1616 DEFINE_GUID( FWPM_LAYER_RPC_EPMAP, 0x9247bc61, 0xeb07, 0x47ee, 0x87, 0x2c, 0xbf, 0xd7, 0x8b, 0xfd, 0x16, 0x16 ); // 618dffc7-c450-4943-95db-99b4c16a55d4 DEFINE_GUID( FWPM_LAYER_RPC_EP_ADD, 0x618dffc7, 0xc450, 0x4943, 0x95, 0xdb, 0x99, 0xb4, 0xc1, 0x6a, 0x55, 0xd4 ); // 94a4b50b-ba5c-4f27-907a-229fac0c2a7a DEFINE_GUID( FWPM_LAYER_RPC_PROXY_CONN, 0x94a4b50b, 0xba5c, 0x4f27, 0x90, 0x7a, 0x22, 0x9f, 0xac, 0x0c, 0x2a, 0x7a ); // f8a38615-e12c-41ac-98df-121ad981aade DEFINE_GUID( FWPM_LAYER_RPC_PROXY_IF, 0xf8a38615, 0xe12c, 0x41ac, 0x98, 0xdf, 0x12, 0x1a, 0xd9, 0x81, 0xaa, 0xde ); #if (NTDDI_VERSION >= NTDDI_WIN7) // 4aa226e9-9020-45fb-956a-c0249d841195 DEFINE_GUID( FWPM_LAYER_KM_AUTHORIZATION, 0x4aa226e9, 0x9020, 0x45fb, 0x95,0x6a, 0xc0, 0x24, 0x9d, 0x84, 0x11, 0x95 ); // 0c2aa681-905b-4ccd-a467-4dd811d07b7b DEFINE_GUID( FWPM_LAYER_NAME_RESOLUTION_CACHE_V4, 0x0c2aa681, 0x905b, 0x4ccd, 0xa4, 0x67, 0x4d, 0xd8, 0x11, 0xd0, 0x7b, 0x7b ); // 92d592fa-6b01-434a-9dea-d1e96ea97da9 DEFINE_GUID( FWPM_LAYER_NAME_RESOLUTION_CACHE_V6, 0x92d592fa, 0x6b01, 0x434a, 0x9d, 0xea, 0xd1, 0xe9, 0x6e, 0xa9, 0x7d, 0xa9 ); // 74365cce-ccb0-401a-bfc1-b89934ad7e15 DEFINE_GUID( FWPM_LAYER_ALE_RESOURCE_RELEASE_V4, 0x74365cce, 0xccb0, 0x401a, 0xbf, 0xc1, 0xb8, 0x99, 0x34, 0xad, 0x7e, 0x15 ); // f4e5ce80-edcc-4e13-8a2f-b91454bb057b DEFINE_GUID( FWPM_LAYER_ALE_RESOURCE_RELEASE_V6, 0xf4e5ce80, 0xedcc, 0x4e13, 0x8a, 0x2f, 0xb9, 0x14, 0x54, 0xbb, 0x05, 0x7b ); // b4766427-e2a2-467a-bd7e-dbcd1bd85a09 DEFINE_GUID( FWPM_LAYER_ALE_ENDPOINT_CLOSURE_V4, 0xb4766427, 0xe2a2, 0x467a, 0xbd, 0x7e, 0xdb, 0xcd, 0x1b, 0xd8, 0x5a, 0x09 ); // bb536ccd-4755-4ba9-9ff7-f9edf8699c7b DEFINE_GUID( FWPM_LAYER_ALE_ENDPOINT_CLOSURE_V6, 0xbb536ccd, 0x4755, 0x4ba9, 0x9f, 0xf7, 0xf9, 0xed, 0xf8, 0x69, 0x9c, 0x7b ); // c6e63c8c-b784-4562-aa7d-0a67cfcaf9a3 DEFINE_GUID( FWPM_LAYER_ALE_CONNECT_REDIRECT_V4, 0xc6e63c8c, 0xb784, 0x4562, 0xaa, 0x7d, 0x0a, 0x67, 0xcf, 0xca, 0xf9, 0xa3 ); // 587e54a7-8046-42ba-a0aa-b716250fc7fd DEFINE_GUID( FWPM_LAYER_ALE_CONNECT_REDIRECT_V6, 0x587e54a7, 0x8046, 0x42ba, 0xa0, 0xaa, 0xb7, 0x16, 0x25, 0x0f, 0xc7, 0xfd ); // 66978cad-c704-42ac-86ac-7c1a231bd253 DEFINE_GUID( FWPM_LAYER_ALE_BIND_REDIRECT_V4, 0x66978cad, 0xc704, 0x42ac, 0x86, 0xac, 0x7c, 0x1a, 0x23, 0x1b, 0xd2, 0x53 ); // bef02c9c-606b-4536-8c26-1c2fc7b631d4 DEFINE_GUID( FWPM_LAYER_ALE_BIND_REDIRECT_V6, 0xbef02c9c, 0x606b, 0x4536, 0x8c, 0x26, 0x1c, 0x2f, 0xc7, 0xb6, 0x31, 0xd4 ); // af52d8ec-cb2d-44e5-ad92-f8dc38d2eb29 DEFINE_GUID( FWPM_LAYER_STREAM_PACKET_V4, 0xaf52d8ec, 0xcb2d, 0x44e5, 0xad, 0x92, 0xf8, 0xdc, 0x38, 0xd2, 0xeb, 0x29 ); // 779a8ca3-f099-468f-b5d4-83535c461c02 DEFINE_GUID( FWPM_LAYER_STREAM_PACKET_V6, 0x779a8ca3, 0xf099, 0x468f, 0xb5, 0xd4, 0x83, 0x53, 0x5c, 0x46, 0x1c, 0x02 ); #endif // (NTDDI_VERSION >= NTDDI_WIN7) /////////////////////////////////////////////////////////////////////////////// // // GUIDs for built-in sublayers. // /////////////////////////////////////////////////////////////////////////////// // 758c84f4-fb48-4de9-9aeb-3ed9551ab1fd DEFINE_GUID( FWPM_SUBLAYER_RPC_AUDIT, 0x758c84f4, 0xfb48, 0x4de9, 0x9a, 0xeb, 0x3e, 0xd9, 0x55, 0x1a, 0xb1, 0xfd ); // 83f299ed-9ff4-4967-aff4-c309f4dab827 DEFINE_GUID( FWPM_SUBLAYER_IPSEC_TUNNEL, 0x83f299ed, 0x9ff4, 0x4967, 0xaf, 0xf4, 0xc3, 0x09, 0xf4, 0xda, 0xb8, 0x27 ); // eebecc03-ced4-4380-819a-2734397b2b74 DEFINE_GUID( FWPM_SUBLAYER_UNIVERSAL, 0xeebecc03, 0xced4, 0x4380, 0x81, 0x9a, 0x27, 0x34, 0x39, 0x7b, 0x2b, 0x74 ); // 1b75c0ce-ff60-4711-a70f-b4958cc3b2d0 DEFINE_GUID( FWPM_SUBLAYER_LIPS, 0x1b75c0ce, 0xff60, 0x4711, 0xa7, 0x0f, 0xb4, 0x95, 0x8c, 0xc3, 0xb2, 0xd0 ); // 15a66e17-3f3c-4f7b-aa6c-812aa613dd82 DEFINE_GUID( FWPM_SUBLAYER_SECURE_SOCKET, 0x15a66e17, 0x3f3c, 0x4f7b, 0xaa, 0x6c, 0x81, 0x2a, 0xa6, 0x13, 0xdd, 0x82 ); // 337608b9-b7d5-4d5f-82f9-3618618bc058 DEFINE_GUID( FWPM_SUBLAYER_TCP_CHIMNEY_OFFLOAD, 0x337608b9, 0xb7d5, 0x4d5f, 0x82, 0xf9, 0x36, 0x18, 0x61, 0x8b, 0xc0, 0x58 ); // 877519e1-e6a9-41a5-81b4-8c4f118e4a60 DEFINE_GUID( FWPM_SUBLAYER_INSPECTION, 0x877519e1, 0xe6a9, 0x41a5, 0x81, 0xb4, 0x8c, 0x4f, 0x11, 0x8e, 0x4a, 0x60 ); // ba69dc66-5176-4979-9c89-26a7b46a8327 DEFINE_GUID( FWPM_SUBLAYER_TEREDO, 0xba69dc66, 0x5176, 0x4979, 0x9c, 0x89, 0x26, 0xa7, 0xb4, 0x6a, 0x83, 0x27 ); #define FWPM_SUBLAYER_EDGE_TRAVERSAL FWPM_SUBLAYER_TEREDO #if (NTDDI_VERSION >= NTDDI_WIN6SP1) // a5082e73-8f71-4559-8a9a-101cea04ef87 DEFINE_GUID( FWPM_SUBLAYER_IPSEC_FORWARD_OUTBOUND_TUNNEL, 0xa5082e73, 0x8f71, 0x4559, 0x8a, 0x9a, 0x10, 0x1c, 0xea, 0x04, 0xef, 0x87 ); #endif // (NTDDI_VERSION >= NTDDI_WIN6SP1) #if (NTDDI_VERSION >= NTDDI_WIN7) // e076d572-5d3d-48ef-802b-909eddb098bd DEFINE_GUID( FWPM_SUBLAYER_IPSEC_DOSP, 0xe076d572, 0x5d3d, 0x48ef, 0x80, 0x2b, 0x90, 0x9e, 0xdd, 0xb0, 0x98, 0xbd ); #endif // (NTDDI_VERSION >= NTDDI_WIN7) /////////////////////////////////////////////////////////////////////////////// // // GUIDs for built-in conditions. // /////////////////////////////////////////////////////////////////////////////// #if (NTDDI_VERSION >= NTDDI_WIN7) // d999e981-7948-4c8e-b742-c84e3b678f8f DEFINE_GUID( FWPM_CONDITION_ETHER_DESTINATION_ADDRESS, 0xd999e981, 0x7948, 0x4c83, 0xb7, 0x42, 0xc8, 0x4e, 0x3b, 0x67, 0x8f, 0x8f ); // 408f2ed4-3a70-4b4d-92a6-415ac20e2f12 DEFINE_GUID( FWPM_CONDITION_ETHER_SOURCE_ADDRESS, 0x408f2ed4, 0x3a70, 0x4b4d, 0x92, 0xa6, 0x41, 0x5a, 0xc2, 0x0e, 0x2f, 0x12 ); // ad2a4e10-e9e9-4e27-9cfa-fd3e5d184c11 DEFINE_GUID( FWPM_CONDITION_ETHER_ADDRESS_TYPE, 0xad2a4e10, 0xe9e9, 0x4e27, 0x9c, 0xfa, 0xfd, 0x3e, 0x5d, 0x18, 0x4c, 0x11 ); // a38e51e9-0ac5-44eb-9387-a1c75b576e82 DEFINE_GUID( FWPM_CONDITION_ETHER_ENCAP_METHOD, 0xa38e51e9, 0x0ac5, 0x44eb, 0x93, 0x87, 0xa1, 0xc7, 0x5b, 0x57, 0x6e, 0x82 ); // fd08948d-a219-4d52-bb98-1a5540ee7b4e DEFINE_GUID( FWPM_CONDITION_ETHER_TYPE, 0xfd08948d, 0xa219, 0x4d52, 0xbb, 0x98, 0x1a, 0x55, 0x40, 0xee, 0x7b, 0x4e ); // c45f5381-0caf-47d0-b96c-238acb17806b DEFINE_GUID( FWPM_CONDITION_ETHER_SNAP_CONTROL, 0xc45f5381, 0x0caf, 0x47d0, 0xb9, 0x6c, 0x23, 0x8a, 0xcb, 0x17, 0x80, 0x6b ); // af37332e-d7dc-4a69-9f4e-3d683ab7365b DEFINE_GUID( FWPM_CONDITION_ETHER_SNAP_OUI, 0xaf37332e, 0xd7dc, 0x4a69, 0x9f, 0x4e, 0x3d, 0x68, 0x3a, 0xb7, 0x36, 0x5b ); // 938eab21-3618-4e64-9ca5-2141ebda1ca2 DEFINE_GUID( FWPM_CONDITION_ETHER_VLAN_TAG, 0x938eab21, 0x3618, 0x4e64, 0x9c, 0xa5, 0x21, 0x41, 0xeb, 0xda, 0x1c, 0xa2 ); #endif #define FWPM_CONDITION_INTERFACE_LUID FWPM_CONDITION_IP_LOCAL_INTERFACE // d9ee00de-c1ef-4617-bfe3-ffd8f5a08957 DEFINE_GUID( FWPM_CONDITION_IP_LOCAL_ADDRESS, 0xd9ee00de, 0xc1ef, 0x4617, 0xbf, 0xe3, 0xff, 0xd8, 0xf5, 0xa0, 0x89, 0x57 ); // b235ae9a-1d64-49b8-a44c-5ff3d9095045 DEFINE_GUID( FWPM_CONDITION_IP_REMOTE_ADDRESS, 0xb235ae9a, 0x1d64, 0x49b8, 0xa4, 0x4c, 0x5f, 0xf3, 0xd9, 0x09, 0x50, 0x45 ); // ae96897e-2e94-4bc9-b313-b27ee80e574d DEFINE_GUID( FWPM_CONDITION_IP_SOURCE_ADDRESS, 0xae96897e, 0x2e94, 0x4bc9, 0xb3, 0x13, 0xb2, 0x7e, 0xe8, 0x0e, 0x57, 0x4d ); // 2d79133b-b390-45c6-8699-acaceaafed33 DEFINE_GUID( FWPM_CONDITION_IP_DESTINATION_ADDRESS, 0x2d79133b, 0xb390, 0x45c6, 0x86, 0x99, 0xac, 0xac, 0xea, 0xaf, 0xed, 0x33 ); // 6ec7f6c4-376b-45d7-9e9c-d337cedcd237 DEFINE_GUID( FWPM_CONDITION_IP_LOCAL_ADDRESS_TYPE, 0x6ec7f6c4, 0x376b, 0x45d7, 0x9e, 0x9c, 0xd3, 0x37, 0xce, 0xdc, 0xd2, 0x37 ); // 1ec1b7c9-4eea-4f5e-b9ef-76beaaaf17ee DEFINE_GUID( FWPM_CONDITION_IP_DESTINATION_ADDRESS_TYPE, 0x1ec1b7c9, 0x4eea, 0x4f5e, 0xb9, 0xef, 0x76, 0xbe, 0xaa, 0xaf, 0x17, 0xee ); #if (NTDDI_VERSION >= NTDDI_WIN7) // eabe448a-a711-4d64-85b7-3f76b65299c7 DEFINE_GUID( FWPM_CONDITION_IP_NEXTHOP_ADDRESS, 0xeabe448a, 0xa711, 0x4d64, 0x85, 0xb7, 0x3f, 0x76, 0xb6, 0x52, 0x99, 0xc7 ); #endif // (NTDDI_VERSION >= NTDDI_WIN7) // 4cd62a49-59c3-4969-b7f3-bda5d32890a4 DEFINE_GUID( FWPM_CONDITION_IP_LOCAL_INTERFACE, 0x4cd62a49, 0x59c3, 0x4969, 0xb7, 0xf3, 0xbd, 0xa5, 0xd3, 0x28, 0x90, 0xa4 ); #if (NTDDI_VERSION >= NTDDI_WIN6SP1) // 618a9b6d-386b-4136-ad6e-b51587cfb1cd DEFINE_GUID( FWPM_CONDITION_IP_ARRIVAL_INTERFACE, 0x618a9b6d, 0x386b, 0x4136, 0xad, 0x6e, 0xb5, 0x15, 0x87, 0xcf, 0xb1, 0xcd ); // 89f990de-e798-4e6d-ab76-7c9558292e6f DEFINE_GUID( FWPM_CONDITION_ARRIVAL_INTERFACE_TYPE, 0x89f990de, 0xe798, 0x4e6d, 0xab, 0x76, 0x7c, 0x95, 0x58, 0x29, 0x2e, 0x6f ); // 511166dc-7a8c-4aa7-b533-95ab59fb0340 DEFINE_GUID( FWPM_CONDITION_ARRIVAL_TUNNEL_TYPE, 0x511166dc, 0x7a8c, 0x4aa7, 0xb5, 0x33, 0x95, 0xab, 0x59, 0xfb, 0x03, 0x40 ); // cc088db3-1792-4a71-b0f9-037d21cd828b DEFINE_GUID( FWPM_CONDITION_ARRIVAL_INTERFACE_INDEX, 0xcc088db3, 0x1792, 0x4a71, 0xb0, 0xf9, 0x03, 0x7d, 0x21, 0xcd, 0x82, 0x8b ); #if (NTDDI_VERSION >= NTDDI_WIN7) // ef8a6122-0577-45a7-9aaf-825fbeb4fb95 DEFINE_GUID( FWPM_CONDITION_NEXTHOP_SUB_INTERFACE_INDEX, 0xef8a6122, 0x0577, 0x45a7, 0x9a, 0xaf, 0x82, 0x5f, 0xbe, 0xb4, 0xfb, 0x95 ); // 93ae8f5b-7f6f-4719-98c8-14e97429ef04 DEFINE_GUID( FWPM_CONDITION_IP_NEXTHOP_INTERFACE, 0x93ae8f5b, 0x7f6f, 0x4719, 0x98, 0xc8, 0x14, 0xe9, 0x74, 0x29, 0xef, 0x04 ); // 97537c6c-d9a3-4767-a381-e942675cd920 DEFINE_GUID( FWPM_CONDITION_NEXTHOP_INTERFACE_TYPE, 0x97537c6c, 0xd9a3, 0x4767, 0xa3, 0x81, 0xe9, 0x42, 0x67, 0x5c, 0xd9, 0x20 ); // 72b1a111-987b-4720-99dd-c7c576fa2d4c DEFINE_GUID( FWPM_CONDITION_NEXTHOP_TUNNEL_TYPE, 0x72b1a111, 0x987b, 0x4720, 0x99, 0xdd, 0xc7, 0xc5, 0x76, 0xfa, 0x2d, 0x4c ); // 138e6888-7ab8-4d65-9ee8-0591bcf6a494 DEFINE_GUID( FWPM_CONDITION_NEXTHOP_INTERFACE_INDEX, 0x138e6888, 0x7ab8, 0x4d65, 0x9e, 0xe8, 0x05, 0x91, 0xbc, 0xf6, 0xa4, 0x94 ); // 46ea1551-2255-492b-8019-aabeee349f40 DEFINE_GUID( FWPM_CONDITION_ORIGINAL_PROFILE_ID, 0x46ea1551, 0x2255, 0x492b, 0x80, 0x19, 0xaa, 0xbe, 0xee, 0x34, 0x9f, 0x40 ); // ab3033c9-c0e3-4759-937d-5758c65d4ae3 DEFINE_GUID( FWPM_CONDITION_CURRENT_PROFILE_ID, 0xab3033c9, 0xc0e3, 0x4759, 0x93, 0x7d, 0x57, 0x58, 0xc6, 0x5d, 0x4a, 0xe3 ); // 4ebf7562-9f18-4d06-9941-a7a625744d71 DEFINE_GUID( FWPM_CONDITION_LOCAL_INTERFACE_PROFILE_ID, 0x4ebf7562, 0x9f18, 0x4d06, 0x99, 0x41, 0xa7, 0xa6, 0x25, 0x74, 0x4d, 0x71 ); // cdfe6aab-c083-4142-8679-c08f95329c61 DEFINE_GUID( FWPM_CONDITION_ARRIVAL_INTERFACE_PROFILE_ID, 0xcdfe6aab, 0xc083, 0x4142, 0x86, 0x79, 0xc0, 0x8f, 0x95, 0x32, 0x9c, 0x61 ); // d7ff9a56-cdaa-472b-84db-d23963c1d1bf DEFINE_GUID( FWPM_CONDITION_NEXTHOP_INTERFACE_PROFILE_ID, 0xd7ff9a56, 0xcdaa, 0x472b, 0x84, 0xdb, 0xd2, 0x39, 0x63, 0xc1, 0xd1, 0xbf ); // 11205e8c-11ae-457a-8a44-477026dd764a DEFINE_GUID( FWPM_CONDITION_REAUTHORIZE_REASON, 0x11205e8c, 0x11ae, 0x457a, 0x8a, 0x44, 0x47, 0x70, 0x26, 0xdd, 0x76, 0x4a ); // 076dfdbe-c56c-4f72-ae8a-2cfe7e5c8286 DEFINE_GUID( FWPM_CONDITION_ORIGINAL_ICMP_TYPE, 0x076dfdbe, 0xc56c, 0x4f72, 0xae, 0x8a, 0x2c, 0xfe, 0x7e, 0x5c, 0x82, 0x86 ); // da50d5c8-fa0d-4c89-b032-6e62136d1e96 DEFINE_GUID( FWPM_CONDITION_IP_PHYSICAL_ARRIVAL_INTERFACE, 0xda50d5c8, 0xfa0d, 0x4c89, 0xb0, 0x32, 0x6e, 0x62, 0x13, 0x6d, 0x1e, 0x96 ); // f09bd5ce-5150-48be-b098-c25152fb1f92 DEFINE_GUID( FWPM_CONDITION_IP_PHYSICAL_NEXTHOP_INTERFACE, 0xf09bd5ce, 0x5150, 0x48be, 0xb0, 0x98, 0xc2, 0x51, 0x52, 0xfb, 0x1f, 0x92 ); // cce68d5e-053b-43a8-9a6f-33384c28e4f6 DEFINE_GUID( FWPM_CONDITION_INTERFACE_QUARANTINE_EPOCH, 0xcce68d5e, 0x053b, 0x43a8, 0x9a, 0x6f, 0x33, 0x38, 0x4c, 0x28, 0xe4, 0xf6 ); #endif // (NTDDI_VERSION >= NTDDI_WIN7) #endif // (NTDDI_VERSION >= NTDDI_WIN6SP1) // daf8cd14-e09e-4c93-a5ae-c5c13b73ffca DEFINE_GUID( FWPM_CONDITION_INTERFACE_TYPE, 0xdaf8cd14, 0xe09e, 0x4c93, 0xa5, 0xae, 0xc5, 0xc1, 0x3b, 0x73, 0xff, 0xca ); #if (NTDDI_VERSION >= NTDDI_WIN6SP1) #define FWPM_CONDITION_LOCAL_INTERFACE_TYPE FWPM_CONDITION_INTERFACE_TYPE #endif // (NTDDI_VERSION >= NTDDI_WIN6SP1) // 77a40437-8779-4868-a261-f5a902f1c0cd DEFINE_GUID( FWPM_CONDITION_TUNNEL_TYPE, 0x77a40437, 0x8779, 0x4868, 0xa2, 0x61, 0xf5, 0xa9, 0x02, 0xf1, 0xc0, 0xcd ); #if (NTDDI_VERSION >= NTDDI_WIN6SP1) #define FWPM_CONDITION_LOCAL_TUNNEL_TYPE FWPM_CONDITION_TUNNEL_TYPE #endif // (NTDDI_VERSION >= NTDDI_WIN6SP1) // 1076b8a5-6323-4c5e-9810-e8d3fc9e6136 DEFINE_GUID( FWPM_CONDITION_IP_FORWARD_INTERFACE, 0x1076b8a5, 0x6323, 0x4c5e, 0x98, 0x10, 0xe8, 0xd3, 0xfc, 0x9e, 0x61, 0x36 ); // 3971ef2b-623e-4f9a-8cb1-6e79b806b9a7 DEFINE_GUID( FWPM_CONDITION_IP_PROTOCOL, 0x3971ef2b, 0x623e, 0x4f9a, 0x8c, 0xb1, 0x6e, 0x79, 0xb8, 0x06, 0xb9, 0xa7 ); // 0c1ba1af-5765-453f-af22-a8f791ac775b DEFINE_GUID( FWPM_CONDITION_IP_LOCAL_PORT, 0x0c1ba1af, 0x5765, 0x453f, 0xaf, 0x22, 0xa8, 0xf7, 0x91, 0xac, 0x77, 0x5b ); #define FWPM_CONDITION_ICMP_TYPE FWPM_CONDITION_IP_LOCAL_PORT // c35a604d-d22b-4e1a-91b4-68f674ee674b DEFINE_GUID( FWPM_CONDITION_IP_REMOTE_PORT, 0xc35a604d, 0xd22b, 0x4e1a, 0x91, 0xb4, 0x68, 0xf6, 0x74, 0xee, 0x67, 0x4b ); #define FWPM_CONDITION_ICMP_CODE FWPM_CONDITION_IP_REMOTE_PORT // 4672a468-8a0a-4202-abb4-849e92e66809 DEFINE_GUID( FWPM_CONDITION_EMBEDDED_LOCAL_ADDRESS_TYPE, 0x4672a468, 0x8a0a, 0x4202, 0xab, 0xb4, 0x84, 0x9e, 0x92, 0xe6, 0x68, 0x09 ); // 77ee4b39-3273-4671-b63b-ab6feb66eeb6 DEFINE_GUID( FWPM_CONDITION_EMBEDDED_REMOTE_ADDRESS, 0x77ee4b39, 0x3273, 0x4671, 0xb6, 0x3b, 0xab, 0x6f, 0xeb, 0x66, 0xee, 0xb6 ); // 07784107-a29e-4c7b-9ec7-29c44afafdbc DEFINE_GUID( FWPM_CONDITION_EMBEDDED_PROTOCOL, 0x07784107, 0xa29e, 0x4c7b, 0x9e, 0xc7, 0x29, 0xc4, 0x4a, 0xfa, 0xfd, 0xbc ); // bfca394d-acdb-484e-b8e6-2aff79757345 DEFINE_GUID( FWPM_CONDITION_EMBEDDED_LOCAL_PORT, 0xbfca394d, 0xacdb, 0x484e, 0xb8, 0xe6, 0x2a, 0xff, 0x79, 0x75, 0x73, 0x45 ); // cae4d6a1-2968-40ed-a4ce-547160dda88d DEFINE_GUID( FWPM_CONDITION_EMBEDDED_REMOTE_PORT, 0xcae4d6a1, 0x2968, 0x40ed, 0xa4, 0xce, 0x54, 0x71, 0x60, 0xdd, 0xa8, 0x8d ); // 632ce23b-5167-435c-86d7-e903684aa80c DEFINE_GUID( FWPM_CONDITION_FLAGS, 0x632ce23b, 0x5167, 0x435c, 0x86, 0xd7, 0xe9, 0x03, 0x68, 0x4a, 0xa8, 0x0c ); // 8784c146-ca97-44d6-9fd1-19fb1840cbf7 DEFINE_GUID( FWPM_CONDITION_DIRECTION, 0x8784c146, 0xca97, 0x44d6, 0x9f, 0xd1, 0x19, 0xfb, 0x18, 0x40, 0xcb, 0xf7 ); // 667fd755-d695-434a-8af5-d3835a1259bc DEFINE_GUID( FWPM_CONDITION_INTERFACE_INDEX, 0x667fd755, 0xd695, 0x434a, 0x8a, 0xf5, 0xd3, 0x83, 0x5a, 0x12, 0x59, 0xbc ); #if (NTDDI_VERSION >= NTDDI_WIN6SP1) #define FWPM_CONDITION_LOCAL_INTERFACE_INDEX FWPM_CONDITION_INTERFACE_INDEX #endif // (NTDDI_VERSION >= NTDDI_WIN6SP1) // 0cd42473-d621-4be3-ae8c-72a348d283e1 DEFINE_GUID( FWPM_CONDITION_SUB_INTERFACE_INDEX, 0x0cd42473, 0xd621, 0x4be3, 0xae, 0x8c, 0x72, 0xa3, 0x48, 0xd2, 0x83, 0xe1 ); #if (NTDDI_VERSION >= NTDDI_WIN6SP1) #define FWPM_CONDITION_ARRIVAL_SUB_INTERFACE_INDEX \ FWPM_CONDITION_SUB_INTERFACE_INDEX #endif // (NTDDI_VERSION >= NTDDI_WIN6SP1) // 2311334d-c92d-45bf-9496-edf447820e2d DEFINE_GUID( FWPM_CONDITION_SOURCE_INTERFACE_INDEX, 0x2311334d, 0xc92d, 0x45bf, 0x94, 0x96, 0xed, 0xf4, 0x47, 0x82, 0x0e, 0x2d ); // 055edd9d-acd2-4361-8dab-f9525d97662f DEFINE_GUID( FWPM_CONDITION_SOURCE_SUB_INTERFACE_INDEX, 0x055edd9d, 0xacd2, 0x4361, 0x8d, 0xab, 0xf9, 0x52, 0x5d, 0x97, 0x66, 0x2f ); // 35cf6522-4139-45ee-a0d5-67b80949d879 DEFINE_GUID( FWPM_CONDITION_DESTINATION_INTERFACE_INDEX, 0x35cf6522, 0x4139, 0x45ee, 0xa0, 0xd5, 0x67, 0xb8, 0x09, 0x49, 0xd8, 0x79 ); // 2b7d4399-d4c7-4738-a2f5-e994b43da388 DEFINE_GUID( FWPM_CONDITION_DESTINATION_SUB_INTERFACE_INDEX, 0x2b7d4399, 0xd4c7, 0x4738, 0xa2, 0xf5, 0xe9, 0x94, 0xb4, 0x3d, 0xa3, 0x88 ); // d78e1e87-8644-4ea5-9437-d809ecefc971 DEFINE_GUID( FWPM_CONDITION_ALE_APP_ID, 0xd78e1e87, 0x8644, 0x4ea5, 0x94, 0x37, 0xd8, 0x09, 0xec, 0xef, 0xc9, 0x71 ); // af043a0a-b34d-4f86-979c-c90371af6e66 DEFINE_GUID( FWPM_CONDITION_ALE_USER_ID, 0xaf043a0a, 0xb34d, 0x4f86, 0x97, 0x9c, 0xc9, 0x03, 0x71, 0xaf, 0x6e, 0x66 ); // f63073b7-0189-4ab0-95a4-6123cbfab862 DEFINE_GUID( FWPM_CONDITION_ALE_REMOTE_USER_ID, 0xf63073b7, 0x0189, 0x4ab0, 0x95, 0xa4, 0x61, 0x23, 0xcb, 0xfa, 0xb8, 0x62 ); // 1aa47f51-7f93-4508-a271-81abb00c9cab DEFINE_GUID( FWPM_CONDITION_ALE_REMOTE_MACHINE_ID, 0x1aa47f51, 0x7f93, 0x4508, 0xa2, 0x71, 0x81, 0xab, 0xb0, 0x0c, 0x9c, 0xab ); // 1c974776-7182-46e9-afd3-b02910e30334 DEFINE_GUID( FWPM_CONDITION_ALE_PROMISCUOUS_MODE, 0x1c974776, 0x7182, 0x46e9, 0xaf, 0xd3, 0xb0, 0x29, 0x10, 0xe3, 0x03, 0x34 ); // b9f4e088-cb98-4efb-a2c7-ad07332643db DEFINE_GUID( FWPM_CONDITION_ALE_SIO_FIREWALL_SYSTEM_PORT, 0xb9f4e088, 0xcb98, 0x4efb, 0xa2, 0xc7, 0xad, 0x07, 0x33, 0x26, 0x43, 0xdb ); #if (NTDDI_VERSION >= NTDDI_WIN7) #define FWPM_CONDITION_ALE_SIO_FIREWALL_SOCKET_PROPERTY \ FWPM_CONDITION_ALE_SIO_FIREWALL_SYSTEM_PORT // b482d227-1979-4a98-8044-18bbe6237542 DEFINE_GUID( FWPM_CONDITION_ALE_REAUTH_REASON, 0xb482d227, 0x1979, 0x4a98, 0x80, 0x44, 0x18, 0xbb, 0xe6, 0x23, 0x75, 0x42 ); #endif // (NTDDI_VERSION >= NTDDI_WIN7) // 46275a9d-c03f-4d77-b784-1c57f4d02753 DEFINE_GUID( FWPM_CONDITION_ALE_NAP_CONTEXT, 0x46275a9d, 0xc03f, 0x4d77, 0xb7, 0x84, 0x1c, 0x57, 0xf4, 0xd0, 0x27, 0x53 ); #if (NTDDI_VERSION >= NTDDI_WIN7) // 35d0ea0e-15ca-492b-900e-97fd46352cce DEFINE_GUID( FWPM_CONDITION_KM_AUTH_NAP_CONTEXT, 0x35d0ea0e, 0x15ca, 0x492b, 0x90, 0x0e, 0x97, 0xfd, 0x46, 0x35, 0x2c, 0xce ); #endif // (NTDDI_VERSION >= NTDDI_WIN7) // 9bf0ee66-06c9-41b9-84da-288cb43af51f DEFINE_GUID( FWPM_CONDITION_REMOTE_USER_TOKEN, 0x9bf0ee66, 0x06c9, 0x41b9, 0x84, 0xda, 0x28, 0x8c, 0xb4, 0x3a, 0xf5, 0x1f ); // 7c9c7d9f-0075-4d35-a0d1-8311c4cf6af1 DEFINE_GUID( FWPM_CONDITION_RPC_IF_UUID, 0x7c9c7d9f, 0x0075, 0x4d35, 0xa0, 0xd1, 0x83, 0x11, 0xc4, 0xcf, 0x6a, 0xf1 ); // eabfd9b7-1262-4a2e-adaa-5f96f6fe326d DEFINE_GUID( FWPM_CONDITION_RPC_IF_VERSION, 0xeabfd9b7, 0x1262, 0x4a2e, 0xad, 0xaa, 0x5f, 0x96, 0xf6, 0xfe, 0x32, 0x6d ); // 238a8a32-3199-467d-871c-272621ab3896 DEFINE_GUID( FWPM_CONDITION_RPC_IF_FLAG, 0x238a8a32, 0x3199, 0x467d, 0x87, 0x1c, 0x27, 0x26, 0x21, 0xab, 0x38, 0x96 ); // ff2e7b4d-3112-4770-b636-4d24ae3a6af2 DEFINE_GUID( FWPM_CONDITION_DCOM_APP_ID, 0xff2e7b4d, 0x3112, 0x4770, 0xb6, 0x36, 0x4d, 0x24, 0xae, 0x3a, 0x6a, 0xf2 ); // d024de4d-deaa-4317-9c85-e40ef6e140c3 DEFINE_GUID( FWPM_CONDITION_IMAGE_NAME, 0xd024de4d, 0xdeaa, 0x4317, 0x9c, 0x85, 0xe4, 0x0e, 0xf6, 0xe1, 0x40, 0xc3 ); // 2717bc74-3a35-4ce7-b7ef-c838fabdec45 DEFINE_GUID( FWPM_CONDITION_RPC_PROTOCOL, 0x2717bc74, 0x3a35, 0x4ce7, 0xb7, 0xef, 0xc8, 0x38, 0xfa, 0xbd, 0xec, 0x45 ); // daba74ab-0d67-43e7-986e-75b84f82f594 DEFINE_GUID( FWPM_CONDITION_RPC_AUTH_TYPE, 0xdaba74ab, 0x0d67, 0x43e7, 0x98, 0x6e, 0x75, 0xb8, 0x4f, 0x82, 0xf5, 0x94 ); // e5a0aed5-59ac-46ea-be05-a5f05ecf446e DEFINE_GUID( FWPM_CONDITION_RPC_AUTH_LEVEL, 0xe5a0aed5, 0x59ac, 0x46ea, 0xbe, 0x05, 0xa5, 0xf0, 0x5e, 0xcf, 0x44, 0x6e ); // 0d306ef0-e974-4f74-b5c7-591b0da7d562 DEFINE_GUID( FWPM_CONDITION_SEC_ENCRYPT_ALGORITHM, 0x0d306ef0, 0xe974, 0x4f74, 0xb5, 0xc7, 0x59, 0x1b, 0x0d, 0xa7, 0xd5, 0x62 ); // 4772183b-ccf8-4aeb-bce1-c6c6161c8fe4 DEFINE_GUID( FWPM_CONDITION_SEC_KEY_SIZE, 0x4772183b, 0xccf8, 0x4aeb, 0xbc, 0xe1, 0xc6, 0xc6, 0x16, 0x1c, 0x8f, 0xe4 ); // 03a629cb-6e52-49f8-9c41-5709633c09cf DEFINE_GUID( FWPM_CONDITION_IP_LOCAL_ADDRESS_V4, 0x03a629cb, 0x6e52, 0x49f8, 0x9c, 0x41, 0x57, 0x09, 0x63, 0x3c, 0x09, 0xcf ); // 2381be84-7524-45b3-a05b-1e637d9c7a6a DEFINE_GUID( FWPM_CONDITION_IP_LOCAL_ADDRESS_V6, 0x2381be84, 0x7524, 0x45b3, 0xa0, 0x5b, 0x1e, 0x63, 0x7d, 0x9c, 0x7a, 0x6a ); // 1bd0741d-e3df-4e24-8634-762046eef6eb DEFINE_GUID( FWPM_CONDITION_PIPE, 0x1bd0741d, 0xe3df, 0x4e24, 0x86, 0x34, 0x76, 0x20, 0x46, 0xee, 0xf6, 0xeb ); // 1febb610-3bcc-45e1-bc36-2e067e2cb186 DEFINE_GUID( FWPM_CONDITION_IP_REMOTE_ADDRESS_V4, 0x1febb610, 0x3bcc, 0x45e1, 0xbc, 0x36, 0x2e, 0x06, 0x7e, 0x2c, 0xb1, 0x86 ); // 246e1d8c-8bee-4018-9b98-31d4582f3361 DEFINE_GUID( FWPM_CONDITION_IP_REMOTE_ADDRESS_V6, 0x246e1d8c, 0x8bee, 0x4018, 0x9b, 0x98, 0x31, 0xd4, 0x58, 0x2f, 0x33, 0x61 ); // e31180a8-bbbd-4d14-a65e-7157b06233bb DEFINE_GUID( FWPM_CONDITION_PROCESS_WITH_RPC_IF_UUID, 0xe31180a8, 0xbbbd, 0x4d14, 0xa6, 0x5e, 0x71, 0x57, 0xb0, 0x62, 0x33, 0xbb ); // dccea0b9-0886-4360-9c6a-ab043a24fba9 DEFINE_GUID( FWPM_CONDITION_RPC_EP_VALUE, 0xdccea0b9, 0x0886, 0x4360, 0x9c, 0x6a, 0xab, 0x04, 0x3a, 0x24, 0xfb, 0xa9 ); // 218b814a-0a39-49b8-8e71-c20c39c7dd2e DEFINE_GUID( FWPM_CONDITION_RPC_EP_FLAGS, 0x218b814a, 0x0a39, 0x49b8, 0x8e, 0x71, 0xc2, 0x0c, 0x39, 0xc7, 0xdd, 0x2e ); // c228fc1e-403a-4478-be05-c9baa4c05ace DEFINE_GUID( FWPM_CONDITION_CLIENT_TOKEN, 0xc228fc1e, 0x403a, 0x4478, 0xbe, 0x05, 0xc9, 0xba, 0xa4, 0xc0, 0x5a, 0xce ); // b605a225-c3b3-48c7-9833-7aefa9527546 DEFINE_GUID( FWPM_CONDITION_RPC_SERVER_NAME, 0xb605a225, 0xc3b3, 0x48c7, 0x98, 0x33, 0x7a, 0xef, 0xa9, 0x52, 0x75, 0x46 ); // 8090f645-9ad5-4e3b-9f9f-8023ca097909 DEFINE_GUID( FWPM_CONDITION_RPC_SERVER_PORT, 0x8090f645, 0x9ad5, 0x4e3b, 0x9f, 0x9f, 0x80, 0x23, 0xca, 0x09, 0x79, 0x09 ); // 40953fe2-8565-4759-8488-1771b4b4b5db DEFINE_GUID( FWPM_CONDITION_RPC_PROXY_AUTH_TYPE, 0x40953fe2, 0x8565, 0x4759, 0x84, 0x88, 0x17, 0x71, 0xb4, 0xb4, 0xb5, 0xdb ); // a3ec00c7-05f4-4df7-91f2-5f60d91ff443 DEFINE_GUID( FWPM_CONDITION_CLIENT_CERT_KEY_LENGTH, 0xa3ec00c7, 0x05f4, 0x4df7, 0x91, 0xf2, 0x5f, 0x60, 0xd9, 0x1f, 0xf4, 0x43 ); // c491ad5e-f882-4283-b916-436b103ff4ad DEFINE_GUID( FWPM_CONDITION_CLIENT_CERT_OID, 0xc491ad5e, 0xf882, 0x4283, 0xb9, 0x16, 0x43, 0x6b, 0x10, 0x3f, 0xf4, 0xad ); // 206e9996-490e-40cf-b831-b38641eb6fcb DEFINE_GUID( FWPM_CONDITION_NET_EVENT_TYPE, 0x206e9996, 0x490e, 0x40cf, 0xb8, 0x31, 0xb3, 0x86, 0x41, 0xeb, 0x6f, 0xcb ); #if (NTDDI_VERSION >= NTDDI_WIN7) // 9b539082-eb90-4186-a6cc-de5b63235016 DEFINE_GUID( FWPM_CONDITION_PEER_NAME, 0x9b539082, 0xeb90, 0x4186, 0xa6, 0xcc, 0xde, 0x5b, 0x63, 0x23, 0x50, 0x16 ); //f68166fd-0682-4c89-b8f5-86436c7ef9b7 DEFINE_GUID( FWPM_CONDITION_REMOTE_ID, 0xf68166fd, 0x0682, 0x4c89, 0xb8, 0xf5, 0x86, 0x43, 0x6c, 0x7e, 0xf9, 0xb7 ); //eb458cd5-da7b-4ef9-8d43-7b0a840332f2 DEFINE_GUID( FWPM_CONDITION_AUTHENTICATION_TYPE, 0xeb458cd5, 0xda7b, 0x4ef9, 0x8d, 0x43, 0x7b, 0x0a, 0x84, 0x03, 0x32, 0xf2 ); //ff0f5f49-0ceb-481b-8638-1479791f3f2c DEFINE_GUID( FWPM_CONDITION_KM_TYPE, 0xff0f5f49, 0x0ceb, 0x481b, 0x86, 0x38, 0x14, 0x79, 0x79, 0x1f, 0x3f, 0x2c ); //feef4582-ef8f-4f7b-858b-9077d122de47 DEFINE_GUID( FWPM_CONDITION_KM_MODE, 0xfeef4582, 0xef8f, 0x4f7b, 0x85, 0x8b, 0x90, 0x77, 0xd1, 0x22, 0xde, 0x47 ); //ad37dee3-722f-45cc-a4e3-068048124452 DEFINE_GUID( FWPM_CONDITION_IPSEC_POLICY_KEY, 0xad37dee3, 0x722f, 0x45cc, 0xa4, 0xe3, 0x06, 0x80, 0x48, 0x12, 0x44, 0x52 ); #endif /////////////////////////////////////////////////////////////////////////////// // // GUIDs for built-in providers. // /////////////////////////////////////////////////////////////////////////////// // 10ad9216-ccde-456c-8b16-e9f04e60a90b DEFINE_GUID( FWPM_PROVIDER_IKEEXT, 0x10ad9216, 0xccde, 0x456c, 0x8b, 0x16, 0xe9, 0xf0, 0x4e, 0x60, 0xa9, 0x0b ); #if (NTDDI_VERSION >= NTDDI_WIN7) // 3c6c05a9-c05c-4bb9-8338-2327814ce8bf DEFINE_GUID( FWPM_PROVIDER_IPSEC_DOSP_CONFIG, 0x3c6c05a9, 0xc05c, 0x4bb9, 0x83, 0x38, 0x23, 0x27, 0x81, 0x4c, 0xe8, 0xbf ); #endif // 896aa19e-9a34-4bcb-ae79-beb9127c84b9 DEFINE_GUID( FWPM_PROVIDER_TCP_CHIMNEY_OFFLOAD, 0x896aa19e, 0x9a34, 0x4bcb, 0xae, 0x79, 0xbe, 0xb9, 0x12, 0x7c, 0x84, 0xb9 ); /////////////////////////////////////////////////////////////////////////////// // // GUIDs for built-in callouts. // /////////////////////////////////////////////////////////////////////////////// // 5132900d-5e84-4b5f-80e4-01741e81ff10 DEFINE_GUID( FWPM_CALLOUT_IPSEC_INBOUND_TRANSPORT_V4, 0x5132900d, 0x5e84, 0x4b5f, 0x80, 0xe4, 0x01, 0x74, 0x1e, 0x81, 0xff, 0x10 ); // 49d3ac92-2a6c-4dcf-955f-1c3be009dd99 DEFINE_GUID( FWPM_CALLOUT_IPSEC_INBOUND_TRANSPORT_V6, 0x49d3ac92, 0x2a6c, 0x4dcf, 0x95, 0x5f, 0x1c, 0x3b, 0xe0, 0x09, 0xdd, 0x99 ); // 4b46bf0a-4523-4e57-aa38-a87987c910d9 DEFINE_GUID( FWPM_CALLOUT_IPSEC_OUTBOUND_TRANSPORT_V4, 0x4b46bf0a, 0x4523, 0x4e57, 0xaa, 0x38, 0xa8, 0x79, 0x87, 0xc9, 0x10, 0xd9 ); // 38d87722-ad83-4f11-a91f-df0fb077225b DEFINE_GUID( FWPM_CALLOUT_IPSEC_OUTBOUND_TRANSPORT_V6, 0x38d87722, 0xad83, 0x4f11, 0xa9, 0x1f, 0xdf, 0x0f, 0xb0, 0x77, 0x22, 0x5b ); // 191a8a46-0bf8-46cf-b045-4b45dfa6a324 DEFINE_GUID( FWPM_CALLOUT_IPSEC_INBOUND_TUNNEL_V4, 0x191a8a46, 0x0bf8, 0x46cf, 0xb0, 0x45, 0x4b, 0x45, 0xdf, 0xa6, 0xa3, 0x24 ); // 80c342e3-1e53-4d6f-9b44-03df5aeee154 DEFINE_GUID( FWPM_CALLOUT_IPSEC_INBOUND_TUNNEL_V6, 0x80c342e3, 0x1e53, 0x4d6f, 0x9b, 0x44, 0x03, 0xdf, 0x5a, 0xee, 0xe1, 0x54 ); // 70a4196c-835b-4fb0-98e8-075f4d977d46 DEFINE_GUID( FWPM_CALLOUT_IPSEC_OUTBOUND_TUNNEL_V4, 0x70a4196c, 0x835b, 0x4fb0, 0x98, 0xe8, 0x07, 0x5f, 0x4d, 0x97, 0x7d, 0x46 ); // f1835363-a6a5-4e62-b180-23db789d8da6 DEFINE_GUID( FWPM_CALLOUT_IPSEC_OUTBOUND_TUNNEL_V6, 0xf1835363, 0xa6a5, 0x4e62, 0xb1, 0x80, 0x23, 0xdb, 0x78, 0x9d, 0x8d, 0xa6 ); // 28829633-c4f0-4e66-873f-844db2a899c7 DEFINE_GUID( FWPM_CALLOUT_IPSEC_FORWARD_INBOUND_TUNNEL_V4, 0x28829633, 0xc4f0, 0x4e66, 0x87, 0x3f, 0x84, 0x4d, 0xb2, 0xa8, 0x99, 0xc7 ); // af50bec2-c686-429a-884d-b74443e7b0b4 DEFINE_GUID( FWPM_CALLOUT_IPSEC_FORWARD_INBOUND_TUNNEL_V6, 0xaf50bec2, 0xc686, 0x429a, 0x88, 0x4d, 0xb7, 0x44, 0x43, 0xe7, 0xb0, 0xb4 ); // fb532136-15cb-440b-937c-1717ca320c40 DEFINE_GUID( FWPM_CALLOUT_IPSEC_FORWARD_OUTBOUND_TUNNEL_V4, 0xfb532136, 0x15cb, 0x440b, 0x93, 0x7c, 0x17, 0x17, 0xca, 0x32, 0x0c, 0x40 ); // dae640cc-e021-4bee-9eb6-a48b275c8c1d DEFINE_GUID( FWPM_CALLOUT_IPSEC_FORWARD_OUTBOUND_TUNNEL_V6, 0xdae640cc, 0xe021, 0x4bee, 0x9e, 0xb6, 0xa4, 0x8b, 0x27, 0x5c, 0x8c, 0x1d ); // 7dff309b-ba7d-4aba-91aa-ae5c6640c944 DEFINE_GUID( FWPM_CALLOUT_IPSEC_INBOUND_INITIATE_SECURE_V4, 0x7dff309b, 0xba7d, 0x4aba, 0x91, 0xaa, 0xae, 0x5c, 0x66, 0x40, 0xc9, 0x44 ); // a9a0d6d9-c58c-474e-8aeb-3cfe99d6d53d DEFINE_GUID( FWPM_CALLOUT_IPSEC_INBOUND_INITIATE_SECURE_V6, 0xa9a0d6d9, 0xc58c, 0x474e, 0x8a, 0xeb, 0x3c, 0xfe, 0x99, 0xd6, 0xd5, 0x3d ); // 3df6e7de-fd20-48f2-9f26-f854444cba79 DEFINE_GUID( FWPM_CALLOUT_IPSEC_INBOUND_TUNNEL_ALE_ACCEPT_V4, 0x3df6e7de, 0xfd20, 0x48f2, 0x9f, 0x26, 0xf8, 0x54, 0x44, 0x4c, 0xba, 0x79 ); // a1e392d3-72ac-47bb-87a7-0122c69434ab DEFINE_GUID( FWPM_CALLOUT_IPSEC_INBOUND_TUNNEL_ALE_ACCEPT_V6, 0xa1e392d3, 0x72ac, 0x47bb, 0x87, 0xa7, 0x01, 0x22, 0xc6, 0x94, 0x34, 0xab ); // 6ac141fc-f75d-4203-b9c8-48e6149c2712 DEFINE_GUID( FWPM_CALLOUT_IPSEC_ALE_CONNECT_V4, 0x6ac141fc, 0xf75d, 0x4203, 0xb9,0xc8,0x48, 0xe6, 0x14, 0x9c, 0x27, 0x12 ); // 4c0dda05-e31f-4666-90b0-b3dfad34129a DEFINE_GUID( FWPM_CALLOUT_IPSEC_ALE_CONNECT_V6, 0x4c0dda05, 0xe31f, 0x4666, 0x90, 0xb0, 0xb3, 0xdf, 0xad, 0x34, 0x12, 0x9a ); #if (NTDDI_VERSION >= NTDDI_WIN7) // 6d08a342-db9e-4fbe-9ed2-57374ce89f79 DEFINE_GUID( FWPM_CALLOUT_IPSEC_DOSP_FORWARD_V6, 0x6d08a342, 0xdb9e, 0x4fbe, 0x9e, 0xd2, 0x57, 0x37, 0x4c, 0xe8, 0x9f, 0x79 ); // 2fcb56ec-cd37-4b4f-b108-62c2b1850a0c DEFINE_GUID( FWPM_CALLOUT_IPSEC_DOSP_FORWARD_V4, 0x2fcb56ec, 0xcd37, 0x4b4f, 0xb1, 0x08, 0x62, 0xc2, 0xb1, 0x85, 0x0a, 0x0c ); #endif // (NTDDI_VERSION >= NTDDI_WIN7) // eda08606-2494-4d78-89bc-67837c03b969 DEFINE_GUID( FWPM_CALLOUT_WFP_TRANSPORT_LAYER_V4_SILENT_DROP, 0xeda08606, 0x2494, 0x4d78, 0x89, 0xbc, 0x67, 0x83, 0x7c, 0x03, 0xb9, 0x69 ); // 8693cc74-a075-4156-b476-9286eece814e DEFINE_GUID( FWPM_CALLOUT_WFP_TRANSPORT_LAYER_V6_SILENT_DROP, 0x8693cc74, 0xa075, 0x4156, 0xb4, 0x76, 0x92, 0x86, 0xee, 0xce, 0x81, 0x4e ); // f3e10ab3-2c25-4279-ac36-c30fc181bec4 DEFINE_GUID( FWPM_CALLOUT_TCP_CHIMNEY_CONNECT_LAYER_V4, 0xf3e10ab3, 0x2c25, 0x4279, 0xac, 0x36, 0xc3, 0x0f, 0xc1, 0x81, 0xbe, 0xc4 ); // 39e22085-a341-42fc-a279-aec94e689c56 DEFINE_GUID( FWPM_CALLOUT_TCP_CHIMNEY_CONNECT_LAYER_V6, 0x39e22085, 0xa341, 0x42fc, 0xa2, 0x79, 0xae, 0xc9, 0x4e, 0x68, 0x9c, 0x56 ); // e183ecb2-3a7f-4b54-8ad9-76050ed880ca DEFINE_GUID( FWPM_CALLOUT_TCP_CHIMNEY_ACCEPT_LAYER_V4, 0xe183ecb2, 0x3a7f, 0x4b54, 0x8a, 0xd9, 0x76, 0x05, 0x0e, 0xd8, 0x80, 0xca ); // 0378cf41-bf98-4603-81f2-7f12586079f6 DEFINE_GUID( FWPM_CALLOUT_TCP_CHIMNEY_ACCEPT_LAYER_V6, 0x0378cf41, 0xbf98, 0x4603, 0x81, 0xf2, 0x7f, 0x12, 0x58, 0x60, 0x79, 0xf6 ); // bc582280-1677-41e9-94ab-c2fcb15c2eeb DEFINE_GUID( FWPM_CALLOUT_SET_OPTIONS_AUTH_CONNECT_LAYER_V4, 0xbc582280, 0x1677, 0x41e9, 0x94, 0xab, 0xc2, 0xfc, 0xb1, 0x5c, 0x2e, 0xeb ); // 98e5373c-b884-490f-b65f-2f6a4a575195 DEFINE_GUID( FWPM_CALLOUT_SET_OPTIONS_AUTH_CONNECT_LAYER_V6, 0x98e5373c, 0xb884, 0x490f, 0xb6, 0x5f, 0x2f, 0x6a, 0x4a, 0x57, 0x51, 0x95 ); // 31b95392-066e-42a2-b7db-92f8acdd56f9 DEFINE_GUID( FWPM_CALLOUT_TEREDO_ALE_RESOURCE_ASSIGNMENT_V6, 0x31b95392, 0x066e, 0x42a2, 0xb7, 0xdb, 0x92, 0xf8, 0xac, 0xdd, 0x56, 0xf9 ); #define FWPM_CALLOUT_EDGE_TRAVERSAL_ALE_RESOURCE_ASSIGNMENT_V6 \ FWPM_CALLOUT_TEREDO_ALE_RESOURCE_ASSIGNMENT_V6 // 079b1010-f1c5-4fcd-ae05-da41107abd0b DEFINE_GUID( FWPM_CALLOUT_EDGE_TRAVERSAL_ALE_RESOURCE_ASSIGNMENT_V4, 0x079b1010, 0xf1c5, 0x4fcd, 0xae, 0x05, 0xda, 0x41, 0x10, 0x7a, 0xbd, 0x0b ); // 81a434e7-f60c-4378-bab8-c625a30f0197 DEFINE_GUID( FWPM_CALLOUT_TEREDO_ALE_LISTEN_V6, 0x81a434e7, 0xf60c, 0x4378, 0xba, 0xb8, 0xc6, 0x25, 0xa3, 0x0f, 0x01, 0x97 ); #define FWPM_CALLOUT_EDGE_TRAVERSAL_ALE_LISTEN_V6 \ FWPM_CALLOUT_TEREDO_ALE_LISTEN_V6 // 33486ab5-6d5e-4e65-a00b-a7afed0ba9a1 DEFINE_GUID( FWPM_CALLOUT_EDGE_TRAVERSAL_ALE_LISTEN_V4, 0x33486ab5, 0x6d5e, 0x4e65, 0xa0, 0x0b, 0xa7, 0xaf, 0xed, 0x0b, 0xa9, 0xa1 ); /////////////////////////////////////////////////////////////////////////////// // // GUIDs for built-in provider contexts. // /////////////////////////////////////////////////////////////////////////////// // b25ea800-0d02-46ed-92bd-7fa84bb73e9d DEFINE_GUID( FWPM_PROVIDER_CONTEXT_SECURE_SOCKET_AUTHIP, 0xb25ea800, 0x0d02, 0x46ed, 0x92, 0xbd, 0x7f, 0xa8, 0x4b, 0xb7, 0x3e, 0x9d ); // 8c2d4144-f8e0-42c0-94ce-7ccfc63b2f9b DEFINE_GUID( FWPM_PROVIDER_CONTEXT_SECURE_SOCKET_IPSEC, 0x8c2d4144, 0xf8e0, 0x42c0, 0x94, 0xce, 0x7c, 0xcf, 0xc6, 0x3b, 0x2f, 0x9b ); /////////////////////////////////////////////////////////////////////////////// // // GUIDs for built-in keying modules. // /////////////////////////////////////////////////////////////////////////////// // a9bbf787-82a8-45bb-a400-5d7e5952c7a9 DEFINE_GUID( FWPM_KEYING_MODULE_IKE, 0xa9bbf787, 0x82a8, 0x45bb, 0xa4, 0x00, 0x5d, 0x7e, 0x59, 0x52, 0xc7, 0xa9 ); // 11e3dae0-dd26-4590-857d-ab4b28d1a095 DEFINE_GUID( FWPM_KEYING_MODULE_AUTHIP, 0x11e3dae0, 0xdd26, 0x4590, 0x85, 0x7d, 0xab, 0x4b, 0x28, 0xd1, 0xa0, 0x95 ); // 041792cc-8f07-419d-a394-716968cb1647 DEFINE_GUID( FWPM_KEYING_MODULE_IKEV2, 0x041792cc, 0x8f07, 0x419d, 0xa3, 0x94, 0x71, 0x69, 0x68, 0xcb, 0x16, 0x47 ); #ifndef GUID_DEFS_ONLY #ifndef FWPMX_H #define FWPMX_H #include "fwpmtypes.h" #include "fwpvi.h" #ifdef __cplusplus extern "C" { #endif /////////////////////////////////////////////////////////////////////////////// // // Well-known filter weight ranges. // /////////////////////////////////////////////////////////////////////////////// // Number of bits used for auto-generated weights. #define FWPM_AUTO_WEIGHT_BITS (60) // Maximum auto-generated weight. #define FWPM_AUTO_WEIGHT_MAX (MAXUINT64 >> (64 - FWPM_AUTO_WEIGHT_BITS)) // Maximum allowed weight range. #define FWPM_WEIGHT_RANGE_MAX (MAXUINT64 >> FWPM_AUTO_WEIGHT_BITS) // IPsec policy #define FWPM_WEIGHT_RANGE_IPSEC (0x0) // Filters to exempt IKE traffic from IPsec. #define FWPM_WEIGHT_RANGE_IKE_EXEMPTIONS (0xc) /////////////////////////////////////////////////////////////////////////////// // // IPsec transform constants. // /////////////////////////////////////////////////////////////////////////////// ////////// // Authentication transform constants ////////// static const IPSEC_AUTH_TRANSFORM_ID0 IPSEC_AUTH_TRANSFORM_ID_HMAC_MD5_96 = { IPSEC_AUTH_MD5, IPSEC_AUTH_CONFIG_HMAC_MD5_96 }; static const IPSEC_AUTH_TRANSFORM_ID0 IPSEC_AUTH_TRANSFORM_ID_HMAC_SHA_1_96 = { IPSEC_AUTH_SHA_1, IPSEC_AUTH_CONFIG_HMAC_SHA_1_96 }; #if (NTDDI_VERSION >= NTDDI_WIN6SP1) static const IPSEC_AUTH_TRANSFORM_ID0 IPSEC_AUTH_TRANSFORM_ID_HMAC_SHA_256_128 = { IPSEC_AUTH_SHA_256, IPSEC_AUTH_CONFIG_HMAC_SHA_256_128 }; static const IPSEC_AUTH_TRANSFORM_ID0 IPSEC_AUTH_TRANSFORM_ID_GCM_AES_128 = { IPSEC_AUTH_AES_128, IPSEC_AUTH_CONFIG_GCM_AES_128 }; static const IPSEC_AUTH_TRANSFORM_ID0 IPSEC_AUTH_TRANSFORM_ID_GCM_AES_192 = { IPSEC_AUTH_AES_192, IPSEC_AUTH_CONFIG_GCM_AES_192 }; static const IPSEC_AUTH_TRANSFORM_ID0 IPSEC_AUTH_TRANSFORM_ID_GCM_AES_256 = { IPSEC_AUTH_AES_256, IPSEC_AUTH_CONFIG_GCM_AES_256 }; #endif // (NTDDI_VERSION >= NTDDI_WIN6SP1) ////////// // Cipher transform constants ////////// static const IPSEC_CIPHER_TRANSFORM_ID0 IPSEC_CIPHER_TRANSFORM_ID_CBC_DES = { IPSEC_CIPHER_TYPE_DES, IPSEC_CIPHER_CONFIG_CBC_DES }; static const IPSEC_CIPHER_TRANSFORM_ID0 IPSEC_CIPHER_TRANSFORM_ID_CBC_3DES = { IPSEC_CIPHER_TYPE_3DES, IPSEC_CIPHER_CONFIG_CBC_3DES }; static const IPSEC_CIPHER_TRANSFORM_ID0 IPSEC_CIPHER_TRANSFORM_ID_AES_128 = { IPSEC_CIPHER_TYPE_AES_128, IPSEC_CIPHER_CONFIG_CBC_AES_128 }; static const IPSEC_CIPHER_TRANSFORM_ID0 IPSEC_CIPHER_TRANSFORM_ID_AES_192 = { IPSEC_CIPHER_TYPE_AES_192, IPSEC_CIPHER_CONFIG_CBC_AES_192 }; static const IPSEC_CIPHER_TRANSFORM_ID0 IPSEC_CIPHER_TRANSFORM_ID_AES_256 = { IPSEC_CIPHER_TYPE_AES_256, IPSEC_CIPHER_CONFIG_CBC_AES_256 }; #if (NTDDI_VERSION >= NTDDI_WIN6SP1) static const IPSEC_CIPHER_TRANSFORM_ID0 IPSEC_CIPHER_TRANSFORM_ID_GCM_AES_128 = { IPSEC_CIPHER_TYPE_AES_128, IPSEC_CIPHER_CONFIG_GCM_AES_128 }; static const IPSEC_CIPHER_TRANSFORM_ID0 IPSEC_CIPHER_TRANSFORM_ID_GCM_AES_192 = { IPSEC_CIPHER_TYPE_AES_192, IPSEC_CIPHER_CONFIG_GCM_AES_192 }; static const IPSEC_CIPHER_TRANSFORM_ID0 IPSEC_CIPHER_TRANSFORM_ID_GCM_AES_256 = { IPSEC_CIPHER_TYPE_AES_256, IPSEC_CIPHER_CONFIG_GCM_AES_256 }; #endif // (NTDDI_VERSION >= NTDDI_WIN6SP1) /////////////////////////////////////////////////////////////////////////////// // // Well-known filter contexts. // /////////////////////////////////////////////////////////////////////////////// // IPSec transport filter contexts in inbound layer #define FWPM_CONTEXT_IPSEC_INBOUND_PASSTHRU (0x1ui64) #define FWPM_CONTEXT_IPSEC_INBOUND_PERSIST_CONNECTION_SECURITY (0x2ui64) #define FWPM_CONTEXT_IPSEC_INBOUND_RESERVED (0xff00000000000000ui64) // IPSec transport filter contexts in outbound layer #define FWPM_CONTEXT_IPSEC_OUTBOUND_NEGOTIATE_DISCOVER (0x1ui64) #if (NTDDI_VERSION >= NTDDI_WIN7) #define FWPM_CONTEXT_IPSEC_OUTBOUND_SUPPRESS_NEGOTIATION (0x2ui64) #endif // Filter contexts used in the ALE connect layer #define FWPM_CONTEXT_ALE_SET_CONNECTION_REQUIRE_IPSEC_SECURITY (0x2ui64) #define FWPM_CONTEXT_ALE_SET_CONNECTION_LAZY_SD_EVALUATION (0x4ui64) // Filter contexts used in the ALE connect or accept layer #define FWPM_CONTEXT_ALE_SET_CONNECTION_REQUIRE_IPSEC_ENCRYPTION (0x8ui64) #if (NTDDI_VERSION >= NTDDI_WIN7) #define FWPM_CONTEXT_ALE_SET_CONNECTION_ALLOW_FIRST_INBOUND_PKT_UNENCRYPTED (0x10ui64) // FWPM_CONTEXT_ALE_ALLOW_AUTH_FW modifies configurations that require ipsec security // Hence, at connect, this is only valid in combination with FWPM_CONTEXT_ALE_SET_CONNECTION_REQUIRE_IPSEC_SECURITY. #define FWPM_CONTEXT_ALE_ALLOW_AUTH_FW (0x20ui64) #endif // (NTDDI_VERSION >= NTDDI_WIN7) // Contexts used by the TCP Chimney Offload callouts. #define FWPM_CONTEXT_TCP_CHIMNEY_OFFLOAD_ENABLE (0x1ui64) #define FWPM_CONTEXT_TCP_CHIMNEY_OFFLOAD_DISABLE (0x2ui64) // Contexts used in the RPC audit sublayer #define FWPM_CONTEXT_RPC_AUDIT_ENABLED (0x1ui64) /////////////////////////////////////////////////////////////////////////////// // // Access rights // /////////////////////////////////////////////////////////////////////////////// // Specific access rights. #define FWPM_ACTRL_ADD (0x00000001) #define FWPM_ACTRL_ADD_LINK (0x00000002) #define FWPM_ACTRL_BEGIN_READ_TXN (0x00000004) #define FWPM_ACTRL_BEGIN_WRITE_TXN (0x00000008) #define FWPM_ACTRL_CLASSIFY (0x00000010) #define FWPM_ACTRL_ENUM (0x00000020) #define FWPM_ACTRL_OPEN (0x00000040) #define FWPM_ACTRL_READ (0x00000080) #define FWPM_ACTRL_READ_STATS (0x00000100) #define FWPM_ACTRL_SUBSCRIBE (0x00000200) #define FWPM_ACTRL_WRITE (0x00000400) // Generic access rights. #define FWPM_GENERIC_READ \ ( STANDARD_RIGHTS_READ | \ FWPM_ACTRL_BEGIN_READ_TXN | \ FWPM_ACTRL_CLASSIFY | \ FWPM_ACTRL_OPEN | \ FWPM_ACTRL_READ | \ FWPM_ACTRL_READ_STATS ) #define FWPM_GENERIC_EXECUTE \ ( STANDARD_RIGHTS_EXECUTE | \ FWPM_ACTRL_ENUM | \ FWPM_ACTRL_SUBSCRIBE ) #define FWPM_GENERIC_WRITE \ ( STANDARD_RIGHTS_WRITE | \ DELETE | \ FWPM_ACTRL_ADD | \ FWPM_ACTRL_ADD_LINK | \ FWPM_ACTRL_BEGIN_WRITE_TXN | \ FWPM_ACTRL_WRITE ) #define FWPM_GENERIC_ALL \ ( STANDARD_RIGHTS_REQUIRED | \ FWPM_ACTRL_ADD | \ FWPM_ACTRL_ADD_LINK | \ FWPM_ACTRL_BEGIN_READ_TXN | \ FWPM_ACTRL_BEGIN_WRITE_TXN | \ FWPM_ACTRL_CLASSIFY | \ FWPM_ACTRL_ENUM | \ FWPM_ACTRL_OPEN | \ FWPM_ACTRL_READ | \ FWPM_ACTRL_READ_STATS | \ FWPM_ACTRL_SUBSCRIBE | \ FWPM_ACTRL_WRITE ) /////////////////////////////////////////////////////////////////////////////// // // Common utility functions. // /////////////////////////////////////////////////////////////////////////////// void WINAPI FwpmFreeMemory0(__inout void** p); /////////////////////////////////////////////////////////////////////////////// // // Functions for managing the engine. // /////////////////////////////////////////////////////////////////////////////// DWORD WINAPI FwpmEngineOpen0( __in_opt const wchar_t* serverName, __in UINT32 authnService, __in_opt SEC_WINNT_AUTH_IDENTITY_W* authIdentity, __in_opt const FWPM_SESSION0* session, __out HANDLE* engineHandle ); DWORD WINAPI FwpmEngineClose0(__inout HANDLE engineHandle); DWORD WINAPI FwpmEngineGetOption0( __in HANDLE engineHandle, __in FWPM_ENGINE_OPTION option, __deref_out FWP_VALUE0** value ); DWORD WINAPI FwpmEngineSetOption0( __in HANDLE engineHandle, __in FWPM_ENGINE_OPTION option, __in const FWP_VALUE0* newValue ); DWORD WINAPI FwpmEngineGetSecurityInfo0( __in HANDLE engineHandle, __in SECURITY_INFORMATION securityInfo, __deref_out_opt PSID* sidOwner, __deref_out_opt PSID* sidGroup, __deref_out_opt PACL* dacl, __deref_out_opt PACL* sacl, __deref_out PSECURITY_DESCRIPTOR* securityDescriptor ); DWORD WINAPI FwpmEngineSetSecurityInfo0( __in HANDLE engineHandle, __in SECURITY_INFORMATION securityInfo, __in_opt const SID* sidOwner, __in_opt const SID* sidGroup, __in_opt const ACL* dacl, __in_opt const ACL* sacl ); DWORD WINAPI FwpmSessionCreateEnumHandle0( __in HANDLE engineHandle, __in_opt const FWPM_SESSION_ENUM_TEMPLATE0* enumTemplate, __out HANDLE* enumHandle ); DWORD WINAPI FwpmSessionEnum0( __in HANDLE engineHandle, __in HANDLE enumHandle, __in UINT32 numEntriesRequested, __deref_out_ecount(*numEntriesReturned) FWPM_SESSION0*** entries, __out UINT32* numEntriesReturned ); DWORD WINAPI FwpmSessionDestroyEnumHandle0( __in HANDLE engineHandle, __inout HANDLE enumHandle ); /////////////////////////////////////////////////////////////////////////////// // // Functions for explicit transactions. // /////////////////////////////////////////////////////////////////////////////// #define FWPM_TXN_READ_ONLY (0x00000001) DWORD WINAPI FwpmTransactionBegin0( __in HANDLE engineHandle, __in UINT32 flags ); DWORD WINAPI FwpmTransactionCommit0(__in HANDLE engineHandle); DWORD WINAPI FwpmTransactionAbort0(__in HANDLE engineHandle); /////////////////////////////////////////////////////////////////////////////// // // Functions for managing providers. // /////////////////////////////////////////////////////////////////////////////// DWORD WINAPI FwpmProviderAdd0( __in HANDLE engineHandle, __in const FWPM_PROVIDER0* provider, __in_opt PSECURITY_DESCRIPTOR sd ); DWORD WINAPI FwpmProviderDeleteByKey0( __in HANDLE engineHandle, __in const GUID* key ); DWORD WINAPI FwpmProviderGetByKey0( __in HANDLE engineHandle, __in const GUID* key, __deref_out FWPM_PROVIDER0** provider ); DWORD WINAPI FwpmProviderCreateEnumHandle0( __in HANDLE engineHandle, __in_opt const FWPM_PROVIDER_ENUM_TEMPLATE0* enumTemplate, __out HANDLE* enumHandle ); DWORD WINAPI FwpmProviderEnum0( __in HANDLE engineHandle, __in HANDLE enumHandle, __in UINT32 numEntriesRequested, __deref_out_ecount(*numEntriesReturned) FWPM_PROVIDER0*** entries, __out UINT32* numEntriesReturned ); DWORD WINAPI FwpmProviderDestroyEnumHandle0( __in HANDLE engineHandle, __inout HANDLE enumHandle ); DWORD WINAPI FwpmProviderGetSecurityInfoByKey0( __in HANDLE engineHandle, __in_opt const GUID* key, __in SECURITY_INFORMATION securityInfo, __deref_out_opt PSID* sidOwner, __deref_out_opt PSID* sidGroup, __deref_out_opt PACL* dacl, __deref_out_opt PACL* sacl, __deref_out PSECURITY_DESCRIPTOR* securityDescriptor ); DWORD WINAPI FwpmProviderSetSecurityInfoByKey0( __in HANDLE engineHandle, __in_opt const GUID* key, __in SECURITY_INFORMATION securityInfo, __in_opt const SID* sidOwner, __in_opt const SID* sidGroup, __in_opt const ACL* dacl, __in_opt const ACL* sacl ); typedef void (CALLBACK *FWPM_PROVIDER_CHANGE_CALLBACK0)( __inout void* context, __in const FWPM_PROVIDER_CHANGE0* change ); DWORD WINAPI FwpmProviderSubscribeChanges0( __in HANDLE engineHandle, __in const FWPM_PROVIDER_SUBSCRIPTION0* subscription, __in FWPM_PROVIDER_CHANGE_CALLBACK0 callback, __in_opt void* context, __out HANDLE* changeHandle ); DWORD WINAPI FwpmProviderUnsubscribeChanges0( __in HANDLE engineHandle, __inout HANDLE changeHandle ); DWORD WINAPI FwpmProviderSubscriptionsGet0( __in HANDLE engineHandle, __deref_out_ecount(*numEntries) FWPM_PROVIDER_SUBSCRIPTION0*** entries, __out UINT32* numEntries ); /////////////////////////////////////////////////////////////////////////////// // // Functions for managing provider contexts. // /////////////////////////////////////////////////////////////////////////////// DWORD WINAPI FwpmProviderContextAdd0( __in HANDLE engineHandle, __in const FWPM_PROVIDER_CONTEXT0* providerContext, __in_opt PSECURITY_DESCRIPTOR sd, __out_opt UINT64* id ); #if (NTDDI_VERSION >= NTDDI_WIN7) DWORD WINAPI FwpmProviderContextAdd1( __in HANDLE engineHandle, __in const FWPM_PROVIDER_CONTEXT1* providerContext, __in_opt PSECURITY_DESCRIPTOR sd, __out_opt UINT64* id ); #endif // (NTDDI_VERSION >= NTDDI_WIN7) DWORD WINAPI FwpmProviderContextDeleteById0( __in HANDLE engineHandle, __in UINT64 id ); DWORD WINAPI FwpmProviderContextDeleteByKey0( __in HANDLE engineHandle, __in const GUID* key ); DWORD WINAPI FwpmProviderContextGetById0( __in HANDLE engineHandle, __in UINT64 id, __deref_out FWPM_PROVIDER_CONTEXT0** providerContext ); #if (NTDDI_VERSION >= NTDDI_WIN7) DWORD WINAPI FwpmProviderContextGetById1( __in HANDLE engineHandle, __in UINT64 id, __deref_out FWPM_PROVIDER_CONTEXT1** providerContext ); #endif // (NTDDI_VERSION >= NTDDI_WIN7) DWORD WINAPI FwpmProviderContextGetByKey0( __in HANDLE engineHandle, __in const GUID* key, __deref_out FWPM_PROVIDER_CONTEXT0** providerContext ); #if (NTDDI_VERSION >= NTDDI_WIN7) DWORD WINAPI FwpmProviderContextGetByKey1( __in HANDLE engineHandle, __in const GUID* key, __deref_out FWPM_PROVIDER_CONTEXT1** providerContext ); #endif // (NTDDI_VERSION >= NTDDI_WIN7) DWORD WINAPI FwpmProviderContextCreateEnumHandle0( __in HANDLE engineHandle, __in_opt const FWPM_PROVIDER_CONTEXT_ENUM_TEMPLATE0* enumTemplate, __out HANDLE* enumHandle ); DWORD WINAPI FwpmProviderContextEnum0( __in HANDLE engineHandle, __in HANDLE enumHandle, __in UINT32 numEntriesRequested, __deref_out_ecount(*numEntriesReturned) FWPM_PROVIDER_CONTEXT0*** entries, __out UINT32* numEntriesReturned ); #if (NTDDI_VERSION >= NTDDI_WIN7) DWORD WINAPI FwpmProviderContextEnum1( __in HANDLE engineHandle, __in HANDLE enumHandle, __in UINT32 numEntriesRequested, __deref_out_ecount(*numEntriesReturned) FWPM_PROVIDER_CONTEXT1*** entries, __out UINT32* numEntriesReturned ); #endif // (NTDDI_VERSION >= NTDDI_WIN7) DWORD WINAPI FwpmProviderContextDestroyEnumHandle0( __in HANDLE engineHandle, __inout HANDLE enumHandle ); DWORD WINAPI FwpmProviderContextGetSecurityInfoByKey0( __in HANDLE engineHandle, __in_opt const GUID* key, __in SECURITY_INFORMATION securityInfo, __deref_out_opt PSID* sidOwner, __deref_out_opt PSID* sidGroup, __deref_out_opt PACL* dacl, __deref_out_opt PACL* sacl, __deref_out PSECURITY_DESCRIPTOR* securityDescriptor ); DWORD WINAPI FwpmProviderContextSetSecurityInfoByKey0( __in HANDLE engineHandle, __in_opt const GUID* key, __in SECURITY_INFORMATION securityInfo, __in_opt const SID* sidOwner, __in_opt const SID* sidGroup, __in_opt const ACL* dacl, __in_opt const ACL* sacl ); typedef void (CALLBACK *FWPM_PROVIDER_CONTEXT_CHANGE_CALLBACK0)( __inout void* context, __in const FWPM_PROVIDER_CONTEXT_CHANGE0* change ); DWORD WINAPI FwpmProviderContextSubscribeChanges0( __in HANDLE engineHandle, __in const FWPM_PROVIDER_CONTEXT_SUBSCRIPTION0* subscription, __in FWPM_PROVIDER_CONTEXT_CHANGE_CALLBACK0 callback, __in_opt void* context, __out HANDLE* changeHandle ); DWORD WINAPI FwpmProviderContextUnsubscribeChanges0( __in HANDLE engineHandle, __inout HANDLE changeHandle ); DWORD WINAPI FwpmProviderContextSubscriptionsGet0( __in HANDLE engineHandle, __deref_out_ecount(*numEntries) FWPM_PROVIDER_CONTEXT_SUBSCRIPTION0*** entries, __out UINT32* numEntries ); /////////////////////////////////////////////////////////////////////////////// // // Functions for managing sub-layers. // /////////////////////////////////////////////////////////////////////////////// DWORD WINAPI FwpmSubLayerAdd0( __in HANDLE engineHandle, __in const FWPM_SUBLAYER0* subLayer, __in_opt PSECURITY_DESCRIPTOR sd ); DWORD WINAPI FwpmSubLayerDeleteByKey0( __in HANDLE engineHandle, __in const GUID* key ); DWORD WINAPI FwpmSubLayerGetByKey0( __in HANDLE engineHandle, __in const GUID* key, __deref_out FWPM_SUBLAYER0** subLayer ); DWORD WINAPI FwpmSubLayerCreateEnumHandle0( __in HANDLE engineHandle, __in_opt const FWPM_SUBLAYER_ENUM_TEMPLATE0* enumTemplate, __out HANDLE* enumHandle ); DWORD WINAPI FwpmSubLayerEnum0( __in HANDLE engineHandle, __in HANDLE enumHandle, __in UINT32 numEntriesRequested, __deref_out_ecount(*numEntriesReturned) FWPM_SUBLAYER0*** entries, __out UINT32* numEntriesReturned ); DWORD WINAPI FwpmSubLayerDestroyEnumHandle0( __in HANDLE engineHandle, __inout HANDLE enumHandle ); DWORD WINAPI FwpmSubLayerGetSecurityInfoByKey0( __in HANDLE engineHandle, __in_opt const GUID* key, __in SECURITY_INFORMATION securityInfo, __deref_out_opt PSID* sidOwner, __deref_out_opt PSID* sidGroup, __deref_out_opt PACL* dacl, __deref_out_opt PACL* sacl, __deref_out PSECURITY_DESCRIPTOR* securityDescriptor ); DWORD WINAPI FwpmSubLayerSetSecurityInfoByKey0( __in HANDLE engineHandle, __in_opt const GUID* key, __in SECURITY_INFORMATION securityInfo, __in_opt const SID* sidOwner, __in_opt const SID* sidGroup, __in_opt const ACL* dacl, __in_opt const ACL* sacl ); typedef void (CALLBACK *FWPM_SUBLAYER_CHANGE_CALLBACK0)( __inout void* context, __in const FWPM_SUBLAYER_CHANGE0* change ); DWORD WINAPI FwpmSubLayerSubscribeChanges0( __in HANDLE engineHandle, __in const FWPM_SUBLAYER_SUBSCRIPTION0* subscription, __in FWPM_SUBLAYER_CHANGE_CALLBACK0 callback, __in_opt void* context, __out HANDLE* changeHandle ); DWORD WINAPI FwpmSubLayerUnsubscribeChanges0( __in HANDLE engineHandle, __inout HANDLE changeHandle ); DWORD WINAPI FwpmSubLayerSubscriptionsGet0( __in HANDLE engineHandle, __deref_out_ecount(*numEntries) FWPM_SUBLAYER_SUBSCRIPTION0*** entries, __out UINT32* numEntries ); /////////////////////////////////////////////////////////////////////////////// // // Functions for managing layers. // /////////////////////////////////////////////////////////////////////////////// DWORD WINAPI FwpmLayerGetById0( __in HANDLE engineHandle, __in UINT16 id, __deref_out FWPM_LAYER0** layer ); DWORD WINAPI FwpmLayerGetByKey0( __in HANDLE engineHandle, __in const GUID* key, __deref_out FWPM_LAYER0** layer ); DWORD WINAPI FwpmLayerCreateEnumHandle0( __in HANDLE engineHandle, __in_opt const FWPM_LAYER_ENUM_TEMPLATE0* enumTemplate, __out HANDLE* enumHandle ); DWORD WINAPI FwpmLayerEnum0( __in HANDLE engineHandle, __in HANDLE enumHandle, __in UINT32 numEntriesRequested, __deref_out_ecount(*numEntriesReturned) FWPM_LAYER0*** entries, __out UINT32* numEntriesReturned ); DWORD WINAPI FwpmLayerDestroyEnumHandle0( __in HANDLE engineHandle, __inout HANDLE enumHandle ); DWORD WINAPI FwpmLayerGetSecurityInfoByKey0( __in HANDLE engineHandle, __in_opt const GUID* key, __in SECURITY_INFORMATION securityInfo, __deref_out_opt PSID* sidOwner, __deref_out_opt PSID* sidGroup, __deref_out_opt PACL* dacl, __deref_out_opt PACL* sacl, __deref_out PSECURITY_DESCRIPTOR* securityDescriptor ); DWORD WINAPI FwpmLayerSetSecurityInfoByKey0( __in HANDLE engineHandle, __in_opt const GUID* key, __in SECURITY_INFORMATION securityInfo, __in_opt const SID* sidOwner, __in_opt const SID* sidGroup, __in_opt const ACL* dacl, __in_opt const ACL* sacl ); /////////////////////////////////////////////////////////////////////////////// // // Functions for managing callouts. // /////////////////////////////////////////////////////////////////////////////// DWORD WINAPI FwpmCalloutAdd0( __in HANDLE engineHandle, __in const FWPM_CALLOUT0* callout, __in_opt PSECURITY_DESCRIPTOR sd, __out_opt UINT32* id ); DWORD WINAPI FwpmCalloutDeleteById0( __in HANDLE engineHandle, __in UINT32 id ); DWORD WINAPI FwpmCalloutDeleteByKey0( __in HANDLE engineHandle, __in const GUID* key ); DWORD WINAPI FwpmCalloutGetById0( __in HANDLE engineHandle, __in UINT32 id, __deref_out FWPM_CALLOUT0** callout ); DWORD WINAPI FwpmCalloutGetByKey0( __in HANDLE engineHandle, __in const GUID* key, __deref_out FWPM_CALLOUT0** callout ); DWORD WINAPI FwpmCalloutCreateEnumHandle0( __in HANDLE engineHandle, __in_opt const FWPM_CALLOUT_ENUM_TEMPLATE0* enumTemplate, __out HANDLE* enumHandle ); DWORD WINAPI FwpmCalloutEnum0( __in HANDLE engineHandle, __in HANDLE enumHandle, __in UINT32 numEntriesRequested, __deref_out_ecount(*numEntriesReturned) FWPM_CALLOUT0*** entries, __out UINT32* numEntriesReturned ); DWORD WINAPI FwpmCalloutDestroyEnumHandle0( __in HANDLE engineHandle, __inout HANDLE enumHandle ); DWORD WINAPI FwpmCalloutGetSecurityInfoByKey0( __in HANDLE engineHandle, __in_opt const GUID* key, __in SECURITY_INFORMATION securityInfo, __deref_out_opt PSID* sidOwner, __deref_out_opt PSID* sidGroup, __deref_out_opt PACL* dacl, __deref_out_opt PACL* sacl, __deref_out PSECURITY_DESCRIPTOR* securityDescriptor ); DWORD WINAPI FwpmCalloutSetSecurityInfoByKey0( __in HANDLE engineHandle, __in_opt const GUID* key, __in SECURITY_INFORMATION securityInfo, __in_opt const SID* sidOwner, __in_opt const SID* sidGroup, __in_opt const ACL* dacl, __in_opt const ACL* sacl ); typedef void (CALLBACK *FWPM_CALLOUT_CHANGE_CALLBACK0)( __inout void* context, __in const FWPM_CALLOUT_CHANGE0* change ); DWORD WINAPI FwpmCalloutSubscribeChanges0( __in HANDLE engineHandle, __in const FWPM_CALLOUT_SUBSCRIPTION0* subscription, __in FWPM_CALLOUT_CHANGE_CALLBACK0 callback, __in_opt void* context, __out HANDLE* changeHandle ); DWORD WINAPI FwpmCalloutUnsubscribeChanges0( __in HANDLE engineHandle, __inout HANDLE changeHandle ); DWORD WINAPI FwpmCalloutSubscriptionsGet0( __in HANDLE engineHandle, __deref_out_ecount(*numEntries) FWPM_CALLOUT_SUBSCRIPTION0*** entries, __out UINT32* numEntries ); /////////////////////////////////////////////////////////////////////////////// // // Functions for managing filters. // /////////////////////////////////////////////////////////////////////////////// DWORD WINAPI FwpmFilterAdd0( __in HANDLE engineHandle, __in const FWPM_FILTER0* filter, __in_opt PSECURITY_DESCRIPTOR sd, __out_opt UINT64* id ); DWORD WINAPI FwpmFilterDeleteById0( __in HANDLE engineHandle, __in UINT64 id ); DWORD WINAPI FwpmFilterDeleteByKey0( __in HANDLE engineHandle, __in const GUID* key ); DWORD WINAPI FwpmFilterGetById0( __in HANDLE engineHandle, __in UINT64 id, __deref_out FWPM_FILTER0** filter ); DWORD WINAPI FwpmFilterGetByKey0( __in HANDLE engineHandle, __in const GUID* key, __deref_out FWPM_FILTER0** filter ); DWORD WINAPI FwpmFilterCreateEnumHandle0( __in HANDLE engineHandle, __in_opt const FWPM_FILTER_ENUM_TEMPLATE0* enumTemplate, __out HANDLE* enumHandle ); DWORD WINAPI FwpmFilterEnum0( __in HANDLE engineHandle, __in HANDLE enumHandle, __in UINT32 numEntriesRequested, __deref_out_ecount(*numEntriesReturned) FWPM_FILTER0*** entries, __out UINT32* numEntriesReturned ); DWORD WINAPI FwpmFilterDestroyEnumHandle0( __in HANDLE engineHandle, __inout HANDLE enumHandle ); DWORD WINAPI FwpmFilterGetSecurityInfoByKey0( __in HANDLE engineHandle, __in_opt const GUID* key, __in SECURITY_INFORMATION securityInfo, __deref_out_opt PSID* sidOwner, __deref_out_opt PSID* sidGroup, __deref_out_opt PACL* dacl, __deref_out_opt PACL* sacl, __deref_out PSECURITY_DESCRIPTOR* securityDescriptor ); DWORD WINAPI FwpmFilterSetSecurityInfoByKey0( __in HANDLE engineHandle, __in_opt const GUID* key, __in SECURITY_INFORMATION securityInfo, __in_opt const SID* sidOwner, __in_opt const SID* sidGroup, __in_opt const ACL* dacl, __in_opt const ACL* sacl ); typedef void (CALLBACK *FWPM_FILTER_CHANGE_CALLBACK0)( __inout void* context, __in const FWPM_FILTER_CHANGE0* change ); DWORD WINAPI FwpmFilterSubscribeChanges0( __in HANDLE engineHandle, __in const FWPM_FILTER_SUBSCRIPTION0* subscription, __in FWPM_FILTER_CHANGE_CALLBACK0 callback, __in_opt void* context, __out HANDLE* changeHandle ); DWORD WINAPI FwpmFilterUnsubscribeChanges0( __in HANDLE engineHandle, __inout HANDLE changeHandle ); DWORD WINAPI FwpmFilterSubscriptionsGet0( __in HANDLE engineHandle, __deref_out_ecount(*numEntries) FWPM_FILTER_SUBSCRIPTION0*** entries, __out UINT32* numEntries ); DWORD WINAPI FwpmGetAppIdFromFileName0( __in PCWSTR fileName, __deref_out FWP_BYTE_BLOB** appId ); /////////////////////////////////////////////////////////////////////////////// // // Helper functions for configuring an IPsec tunnel. // /////////////////////////////////////////////////////////////////////////////// // Create a point-to-point tunnel. #define FWPM_TUNNEL_FLAG_POINT_TO_POINT (0x00000001) #if (NTDDI_VERSION >= NTDDI_WIN7) // Enable Virtual interface based IPsec tunnel mode. #define FWPM_TUNNEL_FLAG_ENABLE_VIRTUAL_IF_TUNNELING (0x00000002) #endif // (NTDDI_VERSION >= NTDDI_WIN7) DWORD WINAPI FwpmIPsecTunnelAdd0( __in HANDLE engineHandle, __in UINT32 flags, __in_opt const FWPM_PROVIDER_CONTEXT0* mainModePolicy, __in const FWPM_PROVIDER_CONTEXT0* tunnelPolicy, __in UINT32 numFilterConditions, __in const FWPM_FILTER_CONDITION0* filterConditions, __in_opt PSECURITY_DESCRIPTOR sd ); #if (NTDDI_VERSION >= NTDDI_WIN7) DWORD WINAPI FwpmIPsecTunnelAdd1( __in HANDLE engineHandle, __in UINT32 flags, __in_opt const FWPM_PROVIDER_CONTEXT1* mainModePolicy, __in const FWPM_PROVIDER_CONTEXT1* tunnelPolicy, __in UINT32 numFilterConditions, __in const FWPM_FILTER_CONDITION0* filterConditions, __in_opt const GUID* keyModKey, __in_opt PSECURITY_DESCRIPTOR sd ); #endif // (NTDDI_VERSION >= NTDDI_WIN7) DWORD WINAPI FwpmIPsecTunnelDeleteByKey0( __in HANDLE engineHandle, __in const GUID* key ); /////////////////////////////////////////////////////////////////////////////// // // Functions for managing IPsec. // /////////////////////////////////////////////////////////////////////////////// DWORD WINAPI IPsecGetStatistics0( __in HANDLE engineHandle, __out IPSEC_STATISTICS0* ipsecStatistics ); #if (NTDDI_VERSION >= NTDDI_WIN7) DWORD WINAPI IPsecGetStatistics1( __in HANDLE engineHandle, __out IPSEC_STATISTICS1* ipsecStatistics ); #endif // (NTDDI_VERSION >= NTDDI_WIN7) DWORD WINAPI IPsecSaContextCreate0( __in HANDLE engineHandle, __in const IPSEC_TRAFFIC0* outboundTraffic, __out_opt UINT64* inboundFilterId, __out UINT64* id ); #if (NTDDI_VERSION >= NTDDI_WIN7) DWORD WINAPI IPsecSaContextCreate1( __in HANDLE engineHandle, __in const IPSEC_TRAFFIC1* outboundTraffic, __in_opt const IPSEC_VIRTUAL_IF_TUNNEL_INFO0* virtualIfTunnelInfo, __out_opt UINT64* inboundFilterId, __out UINT64* id ); #endif // (NTDDI_VERSION >= NTDDI_WIN7) DWORD WINAPI IPsecSaContextDeleteById0( __in HANDLE engineHandle, __in UINT64 id ); DWORD WINAPI IPsecSaContextGetById0( __in HANDLE engineHandle, __in UINT64 id, __deref_out IPSEC_SA_CONTEXT0** saContext ); #if (NTDDI_VERSION >= NTDDI_WIN7) DWORD WINAPI IPsecSaContextGetById1( __in HANDLE engineHandle, __in UINT64 id, __deref_out IPSEC_SA_CONTEXT1** saContext ); #endif // (NTDDI_VERSION >= NTDDI_WIN7) DWORD WINAPI IPsecSaContextGetSpi0( __in HANDLE engineHandle, __in UINT64 id, __in const IPSEC_GETSPI0* getSpi, __out IPSEC_SA_SPI* inboundSpi ); #if (NTDDI_VERSION >= NTDDI_WIN7) DWORD WINAPI IPsecSaContextGetSpi1( __in HANDLE engineHandle, __in UINT64 id, __in const IPSEC_GETSPI1* getSpi, __out IPSEC_SA_SPI* inboundSpi ); DWORD WINAPI IPsecSaContextSetSpi0( __in HANDLE engineHandle, __in UINT64 id, __in const IPSEC_GETSPI1* getSpi, __in IPSEC_SA_SPI inboundSpi ); #endif // (NTDDI_VERSION >= NTDDI_WIN7) DWORD WINAPI IPsecSaContextAddInbound0( __in HANDLE engineHandle, __in UINT64 id, __in const IPSEC_SA_BUNDLE0* inboundBundle ); DWORD WINAPI IPsecSaContextAddOutbound0( __in HANDLE engineHandle, __in UINT64 id, __in const IPSEC_SA_BUNDLE0* outboundBundle ); #if (NTDDI_VERSION >= NTDDI_WIN7) DWORD WINAPI IPsecSaContextAddInbound1( __in HANDLE engineHandle, __in UINT64 id, __in const IPSEC_SA_BUNDLE1* inboundBundle ); DWORD WINAPI IPsecSaContextAddOutbound1( __in HANDLE engineHandle, __in UINT64 id, __in const IPSEC_SA_BUNDLE1* outboundBundle ); #endif // (NTDDI_VERSION >= NTDDI_WIN7) DWORD WINAPI IPsecSaContextExpire0( __in HANDLE engineHandle, __in UINT64 id ); #if (NTDDI_VERSION >= NTDDI_WIN7) // Flags indicating the specific field in the IPSEC_SA_CONTEXT data type that is // being updated. // #define IPSEC_SA_DETAILS_UPDATE_TRAFFIC (0x01ui64) #define IPSEC_SA_DETAILS_UPDATE_UDP_ENCAPSULATION (0x02ui64) #define IPSEC_SA_BUNDLE_UPDATE_FLAGS (0x04ui64) #define IPSEC_SA_BUNDLE_UPDATE_NAP_CONTEXT (0x08ui64) #define IPSEC_SA_BUNDLE_UPDATE_KEY_MODULE_STATE (0x10ui64) #define IPSEC_SA_BUNDLE_UPDATE_PEER_V4_PRIVATE_ADDRESS (0x20ui64) #define IPSEC_SA_BUNDLE_UPDATE_MM_SA_ID (0x40ui64) DWORD WINAPI IPsecSaContextUpdate0( __in HANDLE engineHandle, __in UINT64 flags, __in const IPSEC_SA_CONTEXT1* newValues ); #endif // (NTDDI_VERSION >= NTDDI_WIN7) DWORD WINAPI IPsecSaContextCreateEnumHandle0( __in HANDLE engineHandle, __in_opt const IPSEC_SA_CONTEXT_ENUM_TEMPLATE0* enumTemplate, __out HANDLE* enumHandle ); DWORD WINAPI IPsecSaContextEnum0( __in HANDLE engineHandle, __in HANDLE enumHandle, __in UINT32 numEntriesRequested, __deref_out_ecount(*numEntriesReturned) IPSEC_SA_CONTEXT0*** entries, __out UINT32* numEntriesReturned ); #if (NTDDI_VERSION >= NTDDI_WIN7) DWORD WINAPI IPsecSaContextEnum1( __in HANDLE engineHandle, __in HANDLE enumHandle, __in UINT32 numEntriesRequested, __deref_out_ecount(*numEntriesReturned) IPSEC_SA_CONTEXT1*** entries, __out UINT32* numEntriesReturned ); #endif // (NTDDI_VERSION >= NTDDI_WIN7) DWORD WINAPI IPsecSaContextDestroyEnumHandle0( __in HANDLE engineHandle, __inout HANDLE enumHandle ); DWORD WINAPI IPsecSaCreateEnumHandle0( __in HANDLE engineHandle, __in_opt const IPSEC_SA_ENUM_TEMPLATE0* enumTemplate, __out HANDLE* enumHandle ); DWORD WINAPI IPsecSaEnum0( __in HANDLE engineHandle, __in HANDLE enumHandle, __in UINT32 numEntriesRequested, __deref_out_ecount(*numEntriesReturned) IPSEC_SA_DETAILS0*** entries, __out UINT32* numEntriesReturned ); #if (NTDDI_VERSION >= NTDDI_WIN7) DWORD WINAPI IPsecSaEnum1( __in HANDLE engineHandle, __in HANDLE enumHandle, __in UINT32 numEntriesRequested, __deref_out_ecount(*numEntriesReturned) IPSEC_SA_DETAILS1*** entries, __out UINT32* numEntriesReturned ); #endif // (NTDDI_VERSION >= NTDDI_WIN7) DWORD WINAPI IPsecSaDestroyEnumHandle0( __in HANDLE engineHandle, __inout HANDLE enumHandle ); DWORD WINAPI IPsecSaDbGetSecurityInfo0( __in HANDLE engineHandle, __in SECURITY_INFORMATION securityInfo, __deref_out_opt PSID* sidOwner, __deref_out_opt PSID* sidGroup, __deref_out_opt PACL* dacl, __deref_out_opt PACL* sacl, __deref_out PSECURITY_DESCRIPTOR* securityDescriptor ); DWORD WINAPI IPsecSaDbSetSecurityInfo0( __in HANDLE engineHandle, __in SECURITY_INFORMATION securityInfo, __in_opt const SID* sidOwner, __in_opt const SID* sidGroup, __in_opt const ACL* dacl, __in_opt const ACL* sacl ); #if (NTDDI_VERSION >= NTDDI_WIN7) /////////////////////////////////////////////////////////////////////////////// // // Functions for managing IPsec DoS Protection. // /////////////////////////////////////////////////////////////////////////////// DWORD WINAPI IPsecDospGetStatistics0( __in HANDLE engineHandle, __out IPSEC_DOSP_STATISTICS0* idpStatistics ); DWORD WINAPI IPsecDospStateCreateEnumHandle0( __in HANDLE engineHandle, __in_opt const IPSEC_DOSP_STATE_ENUM_TEMPLATE0* enumTemplate, __out HANDLE* enumHandle ); DWORD WINAPI IPsecDospStateEnum0( __in HANDLE engineHandle, __in HANDLE enumHandle, __in UINT32 numEntriesRequested, __deref_out_ecount(*numEntries) IPSEC_DOSP_STATE0*** entries, __out UINT32* numEntries ); DWORD WINAPI IPsecDospStateDestroyEnumHandle0( __in HANDLE engineHandle, __inout HANDLE enumHandle ); DWORD WINAPI IPsecDospGetSecurityInfo0( __in HANDLE engineHandle, __in SECURITY_INFORMATION securityInfo, __deref_out_opt PSID* sidOwner, __deref_out_opt PSID* sidGroup, __deref_out_opt PACL* dacl, __deref_out_opt PACL* sacl, __deref_out PSECURITY_DESCRIPTOR* securityDescriptor ); DWORD WINAPI IPsecDospSetSecurityInfo0( __in HANDLE engineHandle, __in SECURITY_INFORMATION securityInfo, __in_opt const SID* sidOwner, __in_opt const SID* sidGroup, __in_opt const ACL* dacl, __in_opt const ACL* sacl ); #endif // (NTDDI_VERSION >= NTDDI_WIN7) /////////////////////////////////////////////////////////////////////////////// // // Functions for managing IKE, Authip. // /////////////////////////////////////////////////////////////////////////////// DWORD WINAPI IkeextGetStatistics0( __in HANDLE engineHandle, __out IKEEXT_STATISTICS0* ikeextStatistics ); #if (NTDDI_VERSION >= NTDDI_WIN7) DWORD WINAPI IkeextGetStatistics1( __in HANDLE engineHandle, __out IKEEXT_STATISTICS1* ikeextStatistics ); #endif // (NTDDI_VERSION >= NTDDI_WIN7) DWORD WINAPI IkeextSaDeleteById0( __in HANDLE engineHandle, __in UINT64 id ); DWORD WINAPI IkeextSaGetById0( __in HANDLE engineHandle, __in UINT64 id, __deref_out IKEEXT_SA_DETAILS0** sa ); #if (NTDDI_VERSION >= NTDDI_WIN7) DWORD WINAPI IkeextSaGetById1( __in HANDLE engineHandle, __in UINT64 id, __in_opt GUID* saLookupContext, __deref_out IKEEXT_SA_DETAILS1** sa ); #endif // (NTDDI_VERSION >= NTDDI_WIN7) DWORD WINAPI IkeextSaCreateEnumHandle0( __in HANDLE engineHandle, __in_opt const IKEEXT_SA_ENUM_TEMPLATE0* enumTemplate, __out HANDLE* enumHandle ); DWORD WINAPI IkeextSaEnum0( __in HANDLE engineHandle, __in HANDLE enumHandle, __in UINT32 numEntriesRequested, __deref_out_ecount(*numEntriesReturned) IKEEXT_SA_DETAILS0*** entries, __out UINT32* numEntriesReturned ); #if (NTDDI_VERSION >= NTDDI_WIN7) DWORD WINAPI IkeextSaEnum1( __in HANDLE engineHandle, __in HANDLE enumHandle, __in UINT32 numEntriesRequested, __deref_out_ecount(*numEntriesReturned) IKEEXT_SA_DETAILS1*** entries, __out UINT32* numEntriesReturned ); #endif // (NTDDI_VERSION >= NTDDI_WIN7) DWORD WINAPI IkeextSaDestroyEnumHandle0( __in HANDLE engineHandle, __inout HANDLE enumHandle ); DWORD WINAPI IkeextSaDbGetSecurityInfo0( __in HANDLE engineHandle, __in SECURITY_INFORMATION securityInfo, __deref_out_opt PSID* sidOwner, __deref_out_opt PSID* sidGroup, __deref_out_opt PACL* dacl, __deref_out_opt PACL* sacl, __deref_out PSECURITY_DESCRIPTOR* securityDescriptor ); DWORD WINAPI IkeextSaDbSetSecurityInfo0( __in HANDLE engineHandle, __in SECURITY_INFORMATION securityInfo, __in_opt const SID* sidOwner, __in_opt const SID* sidGroup, __in_opt const ACL* dacl, __in_opt const ACL* sacl ); /////////////////////////////////////////////////////////////////////////////// // // Functions for diagnostics. // /////////////////////////////////////////////////////////////////////////////// DWORD WINAPI FwpmNetEventCreateEnumHandle0( __in HANDLE engineHandle, __in_opt const FWPM_NET_EVENT_ENUM_TEMPLATE0* enumTemplate, __out HANDLE* enumHandle ); DWORD WINAPI FwpmNetEventEnum0( __in HANDLE engineHandle, __in HANDLE enumHandle, __in UINT32 numEntriesRequested, __deref_out_ecount(*numEntriesReturned) FWPM_NET_EVENT0*** entries, __out UINT32* numEntriesReturned ); #if (NTDDI_VERSION >= NTDDI_WIN7) DWORD WINAPI FwpmNetEventEnum1( __in HANDLE engineHandle, __in HANDLE enumHandle, __in UINT32 numEntriesRequested, __deref_out_ecount(*numEntriesReturned) FWPM_NET_EVENT1*** entries, __out UINT32* numEntriesReturned ); #endif // (NTDDI_VERSION >= NTDDI_WIN7) DWORD WINAPI FwpmNetEventDestroyEnumHandle0( __in HANDLE engineHandle, __inout HANDLE enumHandle ); DWORD WINAPI FwpmNetEventsGetSecurityInfo0( __in HANDLE engineHandle, __in SECURITY_INFORMATION securityInfo, __deref_out_opt PSID* sidOwner, __deref_out_opt PSID* sidGroup, __deref_out_opt PACL* dacl, __deref_out_opt PACL* sacl, __deref_out PSECURITY_DESCRIPTOR* securityDescriptor ); DWORD WINAPI FwpmNetEventsSetSecurityInfo0( __in HANDLE engineHandle, __in SECURITY_INFORMATION securityInfo, __in_opt const SID* sidOwner, __in_opt const SID* sidGroup, __in_opt const ACL* dacl, __in_opt const ACL* sacl ); #if (NTDDI_VERSION >= NTDDI_WIN7) typedef void (CALLBACK *FWPM_NET_EVENT_CALLBACK0)( __inout void* context, __in const FWPM_NET_EVENT1* event ); DWORD WINAPI FwpmNetEventSubscribe0( __in HANDLE engineHandle, __in const FWPM_NET_EVENT_SUBSCRIPTION0* subscription, __in FWPM_NET_EVENT_CALLBACK0 callback, __in_opt void* context, __out HANDLE* eventsHandle ); DWORD WINAPI FwpmNetEventUnsubscribe0( __in HANDLE engineHandle, __inout HANDLE eventsHandle ); DWORD WINAPI FwpmNetEventSubscriptionsGet0( __in HANDLE engineHandle, __deref_out_ecount(*numEntries) FWPM_NET_EVENT_SUBSCRIPTION0*** entries, __out UINT32* numEntries ); #endif // (NTDDI_VERSION >= NTDDI_WIN7) #if (NTDDI_VERSION >= NTDDI_WIN7) /////////////////////////////////////////////////////////////////////////////// // // Functions for tracking system ports. // /////////////////////////////////////////////////////////////////////////////// DWORD WINAPI FwpmSystemPortsGet0( __in_opt HANDLE engineHandle, __deref_out FWPM_SYSTEM_PORTS0** sysPorts ); typedef void (CALLBACK *FWPM_SYSTEM_PORTS_CALLBACK0)( __inout void* context, __in const FWPM_SYSTEM_PORTS0* sysPorts ); DWORD WINAPI FwpmSystemPortsSubscribe0( __in_opt HANDLE engineHandle, __reserved void* reserved, __in FWPM_SYSTEM_PORTS_CALLBACK0 callback, __in_opt void* context, __out HANDLE* sysPortsHandle ); DWORD WINAPI FwpmSystemPortsUnsubscribe0( __in_opt HANDLE engineHandle, __inout HANDLE sysPortsHandle ); #endif // (NTDDI_VERSION >= NTDDI_WIN7) #ifdef __cplusplus } #endif #endif // FWPMX_H #endif // GUID_DEFS_ONLY #endif // (NTDDI_VERSION >= NTDDI_WIN6)
84,945
C++
.h
3,375
22.085333
116
0.686204
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,257
fwptypes.h
BlackINT3_OpenArk/src/OpenArk/kernel/network/include/fwptypes.h
/* this ALWAYS GENERATED file contains the definitions for the interfaces */ /* File created by MIDL compiler version 7.00.0555 */ /* Compiler settings for fwptypes.idl: Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 7.00.0555 protocol : dce , ms_ext, c_ext, robust error checks: allocation ref bounds_check enum stub_data VC __declspec() decoration level: __declspec(uuid()), __declspec(selectany), __declspec(novtable) DECLSPEC_UUID(), MIDL_INTERFACE() */ /* @@MIDL_FILE_HEADING( ) */ #pragma warning( disable: 4049 ) /* more than 64k source lines */ /* verify that the <rpcndr.h> version is high enough to compile this file*/ #ifndef __REQUIRED_RPCNDR_H_VERSION__ #define __REQUIRED_RPCNDR_H_VERSION__ 500 #endif /* verify that the <rpcsal.h> version is high enough to compile this file*/ #ifndef __REQUIRED_RPCSAL_H_VERSION__ #define __REQUIRED_RPCSAL_H_VERSION__ 100 #endif #include "rpc.h" #include "rpcndr.h" #ifndef __RPCNDR_H_VERSION__ #error this stub requires an updated version of <rpcndr.h> #endif // __RPCNDR_H_VERSION__ #ifndef __fwptypes_h__ #define __fwptypes_h__ #if defined(_MSC_VER) && (_MSC_VER >= 1020) #pragma once #endif /* Forward Declarations */ /* header files for imported files */ #include "wtypes.h" #ifdef __cplusplus extern "C"{ #endif /* interface __MIDL_itf_fwptypes_0000_0000 */ /* [local] */ #if _MSC_VER >= 800 #if _MSC_VER >= 1200 #pragma warning(push) #endif #pragma warning(disable:4201) #endif #ifdef __midl typedef struct _LUID { DWORD LowPart; LONG HighPart; } LUID; typedef struct _LUID *PLUID; #endif typedef /* [v1_enum] */ enum FWP_DIRECTION_ { FWP_DIRECTION_OUTBOUND = 0, FWP_DIRECTION_INBOUND = ( FWP_DIRECTION_OUTBOUND + 1 ) , FWP_DIRECTION_MAX = ( FWP_DIRECTION_INBOUND + 1 ) } FWP_DIRECTION; typedef /* [v1_enum] */ enum FWP_IP_VERSION_ { FWP_IP_VERSION_V4 = 0, FWP_IP_VERSION_V6 = ( FWP_IP_VERSION_V4 + 1 ) , FWP_IP_VERSION_NONE = ( FWP_IP_VERSION_V6 + 1 ) , FWP_IP_VERSION_MAX = ( FWP_IP_VERSION_NONE + 1 ) } FWP_IP_VERSION; typedef /* [v1_enum] */ enum FWP_NE_FAMILY_ { FWP_AF_INET = FWP_IP_VERSION_V4, FWP_AF_INET6 = FWP_IP_VERSION_V6, FWP_AF_ETHER = FWP_IP_VERSION_NONE, FWP_AF_NONE = ( FWP_AF_ETHER + 1 ) } FWP_AF; typedef /* [v1_enum] */ enum FWP_ETHER_ENCAP_METHOD_ { FWP_ETHER_ENCAP_METHOD_ETHER_V2 = 0, FWP_ETHER_ENCAP_METHOD_SNAP = 1, FWP_ETHER_ENCAP_METHOD_SNAP_W_OUI_ZERO = 3 } FWP_ETHER_ENCAP_METHOD; typedef /* [v1_enum] */ enum FWP_DATA_TYPE_ { FWP_EMPTY = 0, FWP_UINT8 = ( FWP_EMPTY + 1 ) , FWP_UINT16 = ( FWP_UINT8 + 1 ) , FWP_UINT32 = ( FWP_UINT16 + 1 ) , FWP_UINT64 = ( FWP_UINT32 + 1 ) , FWP_INT8 = ( FWP_UINT64 + 1 ) , FWP_INT16 = ( FWP_INT8 + 1 ) , FWP_INT32 = ( FWP_INT16 + 1 ) , FWP_INT64 = ( FWP_INT32 + 1 ) , FWP_FLOAT = ( FWP_INT64 + 1 ) , FWP_DOUBLE = ( FWP_FLOAT + 1 ) , FWP_BYTE_ARRAY16_TYPE = ( FWP_DOUBLE + 1 ) , FWP_BYTE_BLOB_TYPE = ( FWP_BYTE_ARRAY16_TYPE + 1 ) , FWP_SID = ( FWP_BYTE_BLOB_TYPE + 1 ) , FWP_SECURITY_DESCRIPTOR_TYPE = ( FWP_SID + 1 ) , FWP_TOKEN_INFORMATION_TYPE = ( FWP_SECURITY_DESCRIPTOR_TYPE + 1 ) , FWP_TOKEN_ACCESS_INFORMATION_TYPE = ( FWP_TOKEN_INFORMATION_TYPE + 1 ) , FWP_UNICODE_STRING_TYPE = ( FWP_TOKEN_ACCESS_INFORMATION_TYPE + 1 ) , FWP_BYTE_ARRAY6_TYPE = ( FWP_UNICODE_STRING_TYPE + 1 ) , FWP_SINGLE_DATA_TYPE_MAX = 0xff, FWP_V4_ADDR_MASK = ( FWP_SINGLE_DATA_TYPE_MAX + 1 ) , FWP_V6_ADDR_MASK = ( FWP_V4_ADDR_MASK + 1 ) , FWP_RANGE_TYPE = ( FWP_V6_ADDR_MASK + 1 ) , FWP_DATA_TYPE_MAX = ( FWP_RANGE_TYPE + 1 ) } FWP_DATA_TYPE; typedef struct FWP_BYTE_ARRAY6_ { UINT8 byteArray6[ 6 ]; } FWP_BYTE_ARRAY6; #define FWP_BYTE_ARRAY6_SIZE 6 typedef struct FWP_BYTE_ARRAY16_ { UINT8 byteArray16[ 16 ]; } FWP_BYTE_ARRAY16; typedef struct FWP_BYTE_BLOB_ { UINT32 size; UINT8 *data; } FWP_BYTE_BLOB; typedef struct FWP_TOKEN_INFORMATION_ { ULONG sidCount; PSID_AND_ATTRIBUTES sids; ULONG restrictedSidCount; PSID_AND_ATTRIBUTES restrictedSids; } FWP_TOKEN_INFORMATION; typedef struct FWP_VALUE0_ { FWP_DATA_TYPE type; union { /* Empty union arm */ UINT8 uint8; UINT16 uint16; UINT32 uint32; UINT64 *uint64; INT8 int8; INT16 int16; INT32 int32; INT64 *int64; float float32; double *double64; FWP_BYTE_ARRAY16 *byteArray16; FWP_BYTE_BLOB *byteBlob; SID *sid; FWP_BYTE_BLOB *sd; FWP_TOKEN_INFORMATION *tokenInformation; FWP_BYTE_BLOB *tokenAccessInformation; LPWSTR unicodeString; FWP_BYTE_ARRAY6 *byteArray6; } ; } FWP_VALUE0; typedef /* [v1_enum] */ enum FWP_MATCH_TYPE_ { FWP_MATCH_EQUAL = 0, FWP_MATCH_GREATER = ( FWP_MATCH_EQUAL + 1 ) , FWP_MATCH_LESS = ( FWP_MATCH_GREATER + 1 ) , FWP_MATCH_GREATER_OR_EQUAL = ( FWP_MATCH_LESS + 1 ) , FWP_MATCH_LESS_OR_EQUAL = ( FWP_MATCH_GREATER_OR_EQUAL + 1 ) , FWP_MATCH_RANGE = ( FWP_MATCH_LESS_OR_EQUAL + 1 ) , FWP_MATCH_FLAGS_ALL_SET = ( FWP_MATCH_RANGE + 1 ) , FWP_MATCH_FLAGS_ANY_SET = ( FWP_MATCH_FLAGS_ALL_SET + 1 ) , FWP_MATCH_FLAGS_NONE_SET = ( FWP_MATCH_FLAGS_ANY_SET + 1 ) , FWP_MATCH_EQUAL_CASE_INSENSITIVE = ( FWP_MATCH_FLAGS_NONE_SET + 1 ) , FWP_MATCH_NOT_EQUAL = ( FWP_MATCH_EQUAL_CASE_INSENSITIVE + 1 ) , FWP_MATCH_TYPE_MAX = ( FWP_MATCH_NOT_EQUAL + 1 ) } FWP_MATCH_TYPE; typedef struct FWP_V4_ADDR_AND_MASK_ { UINT32 addr; UINT32 mask; } FWP_V4_ADDR_AND_MASK; #define FWP_V6_ADDR_SIZE (16) typedef struct FWP_V6_ADDR_AND_MASK_ { UINT8 addr[ 16 ]; UINT8 prefixLength; } FWP_V6_ADDR_AND_MASK; typedef struct FWP_RANGE0_ { FWP_VALUE0 valueLow; FWP_VALUE0 valueHigh; } FWP_RANGE0; #define FWP_ACTRL_MATCH_FILTER (0x00000001) typedef struct FWP_CONDITION_VALUE0_ { FWP_DATA_TYPE type; union { /* Empty union arm */ UINT8 uint8; UINT16 uint16; UINT32 uint32; UINT64 *uint64; INT8 int8; INT16 int16; INT32 int32; INT64 *int64; float float32; double *double64; FWP_BYTE_ARRAY16 *byteArray16; FWP_BYTE_BLOB *byteBlob; SID *sid; FWP_BYTE_BLOB *sd; FWP_TOKEN_INFORMATION *tokenInformation; FWP_BYTE_BLOB *tokenAccessInformation; LPWSTR unicodeString; FWP_BYTE_ARRAY6 *byteArray6; FWP_V4_ADDR_AND_MASK *v4AddrMask; FWP_V6_ADDR_AND_MASK *v6AddrMask; FWP_RANGE0 *rangeValue; } ; } FWP_CONDITION_VALUE0; typedef /* [v1_enum] */ enum FWP_CLASSIFY_OPTION_TYPE_ { FWP_CLASSIFY_OPTION_MULTICAST_STATE = 0, FWP_CLASSIFY_OPTION_LOOSE_SOURCE_MAPPING = ( FWP_CLASSIFY_OPTION_MULTICAST_STATE + 1 ) , FWP_CLASSIFY_OPTION_UNICAST_LIFETIME = ( FWP_CLASSIFY_OPTION_LOOSE_SOURCE_MAPPING + 1 ) , FWP_CLASSIFY_OPTION_MCAST_BCAST_LIFETIME = ( FWP_CLASSIFY_OPTION_UNICAST_LIFETIME + 1 ) , FWP_CLASSIFY_OPTION_SECURE_SOCKET_SECURITY_FLAGS = ( FWP_CLASSIFY_OPTION_MCAST_BCAST_LIFETIME + 1 ) , FWP_CLASSIFY_OPTION_SECURE_SOCKET_AUTHIP_MM_POLICY_KEY = ( FWP_CLASSIFY_OPTION_SECURE_SOCKET_SECURITY_FLAGS + 1 ) , FWP_CLASSIFY_OPTION_SECURE_SOCKET_AUTHIP_QM_POLICY_KEY = ( FWP_CLASSIFY_OPTION_SECURE_SOCKET_AUTHIP_MM_POLICY_KEY + 1 ) , FWP_CLASSIFY_OPTION_MAX = ( FWP_CLASSIFY_OPTION_SECURE_SOCKET_AUTHIP_QM_POLICY_KEY + 1 ) } FWP_CLASSIFY_OPTION_TYPE; #define FWP_OPTION_VALUE_ALLOW_MULTICAST_STATE (0x00000000) #define FWP_OPTION_VALUE_DENY_MULTICAST_STATE (0x00000001) #define FWP_OPTION_VALUE_ALLOW_GLOBAL_MULTICAST_STATE (0x00000002) #define FWP_OPTION_VALUE_DISABLE_LOOSE_SOURCE (0x00000000) #define FWP_OPTION_VALUE_ENABLE_LOOSE_SOURCE (0x00000001) #define FWP_ACTION_FLAG_TERMINATING (0x00001000) #define FWP_ACTION_FLAG_NON_TERMINATING (0x00002000) #define FWP_ACTION_FLAG_CALLOUT (0x00004000) typedef UINT32 FWP_ACTION_TYPE; #define FWP_ACTION_BLOCK (0x00000001 | FWP_ACTION_FLAG_TERMINATING) #define FWP_ACTION_PERMIT (0x00000002 | FWP_ACTION_FLAG_TERMINATING) #define FWP_ACTION_CALLOUT_TERMINATING (0x00000003 | FWP_ACTION_FLAG_CALLOUT | FWP_ACTION_FLAG_TERMINATING) #define FWP_ACTION_CALLOUT_INSPECTION (0x00000004 | FWP_ACTION_FLAG_CALLOUT | FWP_ACTION_FLAG_NON_TERMINATING) #define FWP_ACTION_CALLOUT_UNKNOWN (0x00000005 | FWP_ACTION_FLAG_CALLOUT) #define FWP_ACTION_CONTINUE (0x00000006 | FWP_ACTION_FLAG_NON_TERMINATING) #define FWP_ACTION_NONE (0x00000007) #define FWP_ACTION_NONE_NO_MATCH (0x00000008) #define FWP_CONDITION_FLAG_IS_LOOPBACK (0x00000001) #define FWP_CONDITION_FLAG_IS_IPSEC_SECURED (0x00000002) #define FWP_CONDITION_FLAG_IS_REAUTHORIZE (0x00000004) #define FWP_CONDITION_FLAG_IS_WILDCARD_BIND (0x00000008) #define FWP_CONDITION_FLAG_IS_RAW_ENDPOINT (0x00000010) #define FWP_CONDITION_FLAG_IS_FRAGMENT (0x00000020) #define FWP_CONDITION_FLAG_IS_FRAGMENT_GROUP (0x00000040) #define FWP_CONDITION_FLAG_IS_IPSEC_NATT_RECLASSIFY (0x00000080) #define FWP_CONDITION_FLAG_REQUIRES_ALE_CLASSIFY (0x00000100) #define FWP_CONDITION_FLAG_IS_IMPLICIT_BIND (0x00000200) #if (NTDDI_VERSION >= NTDDI_WIN6SP1) #define FWP_CONDITION_FLAG_IS_REASSEMBLED (0x00000400) #if (NTDDI_VERSION >= NTDDI_WIN7) #define FWP_CONDITION_FLAG_IS_NAME_APP_SPECIFIED (0x00004000) #define FWP_CONDITION_FLAG_IS_PROMISCUOUS (0x00008000) #define FWP_CONDITION_FLAG_IS_AUTH_FW (0x00010000) #define FWP_CONDITION_FLAG_IS_RECLASSIFY (0x00020000) #define FWP_CONDITION_FLAG_IS_OUTBOUND_PASS_THRU (0x00040000) #define FWP_CONDITION_FLAG_IS_INBOUND_PASS_THRU (0x00080000) #define FWP_CONDITION_FLAG_IS_CONNECTION_REDIRECTED (0x00100000) #define FWP_CONDITION_REAUTHORIZE_REASON_POLICY_CHANGE (0x00000001) #define FWP_CONDITION_REAUTHORIZE_REASON_NEW_ARRIVAL_INTERFACE (0x00000002) #define FWP_CONDITION_REAUTHORIZE_REASON_NEW_NEXTHOP_INTERFACE (0x00000004) #define FWP_CONDITION_REAUTHORIZE_REASON_PROFILE_CROSSING (0x00000008) #define FWP_CONDITION_REAUTHORIZE_REASON_CLASSIFY_COMPLETION (0x00000010) #define FWP_CONDITION_REAUTHORIZE_REASON_IPSEC_PROPERTIES_CHANGED (0x00000020) #define FWP_CONDITION_REAUTHORIZE_REASON_MID_STREAM_INSPECTION (0x00000040) #define FWP_CONDITION_REAUTHORIZE_REASON_SOCKET_PROPERTY_CHANGED (0x00000080) #define FWP_CONDITION_REAUTHORIZE_REASON_NEW_INBOUND_MCAST_BCAST_PACKET (0x00000100) #define FWP_CONDITION_SOCKET_PROPERTY_FLAG_IS_SYSTEM_PORT_RPC (0x00000001) #define FWP_CONDITION_SOCKET_PROPERTY_FLAG_ALLOW_EDGE_TRAFFIC (0x00000002) #define FWP_CONDITION_SOCKET_PROPERTY_FLAG_DENY_EDGE_TRAFFIC (0x00000004) #endif #endif typedef /* [v1_enum] */ enum FWP_FILTER_ENUM_TYPE_ { FWP_FILTER_ENUM_FULLY_CONTAINED = 0, FWP_FILTER_ENUM_OVERLAPPING = ( FWP_FILTER_ENUM_FULLY_CONTAINED + 1 ) , FWP_FILTER_ENUM_TYPE_MAX = ( FWP_FILTER_ENUM_OVERLAPPING + 1 ) } FWP_FILTER_ENUM_TYPE; #define FWP_FILTER_ENUM_FLAG_BEST_TERMINATING_MATCH (0x00000001) #define FWP_FILTER_ENUM_FLAG_SORTED (0x00000002) #define FWP_FILTER_ENUM_FLAG_BOOTTIME_ONLY (0x00000004) #define FWP_FILTER_ENUM_FLAG_INCLUDE_BOOTTIME (0x00000008) #define FWP_FILTER_ENUM_FLAG_INCLUDE_DISABLED (0x00000010) #define FWP_FILTER_ENUM_VALID_FLAGS (FWP_FILTER_ENUM_FLAG_BEST_TERMINATING_MATCH | FWP_FILTER_ENUM_FLAG_SORTED) #define FWP_CALLOUT_FLAG_CONDITIONAL_ON_FLOW (0x00000001) #define FWP_CALLOUT_FLAG_ALLOW_OFFLOAD (0x00000002) #if (NTDDI_VERSION >= NTDDI_WIN7) #define FWP_CALLOUT_FLAG_ENABLE_COMMIT_ADD_NOTIFY (0x00000004) #define FWP_CALLOUT_FLAG_ALLOW_MID_STREAM_INSPECTION (0x00000008) #define FWP_CALLOUT_FLAG_ALLOW_RECLASSIFY (0x00000010) #endif #if _MSC_VER >= 800 #if _MSC_VER >= 1200 #pragma warning(pop) #else #pragma warning(default:4201) #endif #endif extern RPC_IF_HANDLE __MIDL_itf_fwptypes_0000_0000_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_fwptypes_0000_0000_v0_0_s_ifspec; /* Additional Prototypes for ALL interfaces */ /* end of Additional Prototypes */ #ifdef __cplusplus } #endif #endif
12,275
C++
.h
309
36.304207
122
0.697994
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,258
fwpmtypes.h
BlackINT3_OpenArk/src/OpenArk/kernel/network/include/fwpmtypes.h
/* this ALWAYS GENERATED file contains the definitions for the interfaces */ /* File created by MIDL compiler version 7.00.0555 */ /* Compiler settings for fwpmtypes.idl: Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 7.00.0555 protocol : dce , ms_ext, c_ext, robust error checks: allocation ref bounds_check enum stub_data VC __declspec() decoration level: __declspec(uuid()), __declspec(selectany), __declspec(novtable) DECLSPEC_UUID(), MIDL_INTERFACE() */ /* @@MIDL_FILE_HEADING( ) */ #pragma warning( disable: 4049 ) /* more than 64k source lines */ /* verify that the <rpcndr.h> version is high enough to compile this file*/ #ifndef __REQUIRED_RPCNDR_H_VERSION__ #define __REQUIRED_RPCNDR_H_VERSION__ 500 #endif /* verify that the <rpcsal.h> version is high enough to compile this file*/ #ifndef __REQUIRED_RPCSAL_H_VERSION__ #define __REQUIRED_RPCSAL_H_VERSION__ 100 #endif #include "rpc.h" #include "rpcndr.h" #ifndef __RPCNDR_H_VERSION__ #error this stub requires an updated version of <rpcndr.h> #endif // __RPCNDR_H_VERSION__ #ifndef __fwpmtypes_h__ #define __fwpmtypes_h__ #if defined(_MSC_VER) && (_MSC_VER >= 1020) #pragma once #endif /* Forward Declarations */ /* header files for imported files */ #include "fwptypes.h" #include "iketypes.h" #include "ipsectypes.h" #ifdef __cplusplus extern "C"{ #endif /* interface __MIDL_itf_fwpmtypes_0000_0000 */ /* [local] */ #if _MSC_VER >= 800 #if _MSC_VER >= 1200 #pragma warning(push) #endif #pragma warning(disable:4201) #endif #ifndef _DEFINE_DL_ADDRESS_TYPE_ #define _DEFINE_DL_ADDRESS_TYPE_ typedef /* [public][public][v1_enum] */ enum __MIDL___MIDL_itf_fwpmtypes_0000_0000_0001 { DlUnicast = 0, DlMulticast = ( DlUnicast + 1 ) , DlBroadcast = ( DlMulticast + 1 ) } DL_ADDRESS_TYPE; typedef /* [v1_enum] */ enum __MIDL___MIDL_itf_fwpmtypes_0000_0000_0001 *PDL_ADDRESS_TYPE; #endif typedef struct FWPM_DISPLAY_DATA0_ { wchar_t *name; wchar_t *description; } FWPM_DISPLAY_DATA0; typedef /* [v1_enum] */ enum FWPM_CHANGE_TYPE_ { FWPM_CHANGE_ADD = 1, FWPM_CHANGE_DELETE = ( FWPM_CHANGE_ADD + 1 ) , FWPM_CHANGE_TYPE_MAX = ( FWPM_CHANGE_DELETE + 1 ) } FWPM_CHANGE_TYPE; #define FWPM_SUBSCRIPTION_FLAG_NOTIFY_ON_ADD (0x00000001) #define FWPM_SUBSCRIPTION_FLAG_NOTIFY_ON_DELETE (0x00000002) typedef enum FWPM_SERVICE_STATE_ { FWPM_SERVICE_STOPPED = 0, FWPM_SERVICE_START_PENDING = ( FWPM_SERVICE_STOPPED + 1 ) , FWPM_SERVICE_STOP_PENDING = ( FWPM_SERVICE_START_PENDING + 1 ) , FWPM_SERVICE_RUNNING = ( FWPM_SERVICE_STOP_PENDING + 1 ) , FWPM_SERVICE_STATE_MAX = ( FWPM_SERVICE_RUNNING + 1 ) } FWPM_SERVICE_STATE; #define FWPM_NET_EVENT_KEYWORD_INBOUND_MCAST (0x00000001) #define FWPM_NET_EVENT_KEYWORD_INBOUND_BCAST (0x00000002) typedef enum FWPM_ENGINE_OPTION_ { FWPM_ENGINE_COLLECT_NET_EVENTS = 0, FWPM_ENGINE_NET_EVENT_MATCH_ANY_KEYWORDS = ( FWPM_ENGINE_COLLECT_NET_EVENTS + 1 ) , FWPM_ENGINE_NAME_CACHE = ( FWPM_ENGINE_NET_EVENT_MATCH_ANY_KEYWORDS + 1 ) , FWPM_ENGINE_OPTION_MAX = ( FWPM_ENGINE_NAME_CACHE + 1 ) } FWPM_ENGINE_OPTION; #define FWPM_SESSION_FLAG_DYNAMIC (0x00000001) #if (NTDDI_VERSION >= NTDDI_WIN7) #define FWPM_SESSION_FLAG_RESERVED (0x10000000) #endif // (NTDDI_VERSION >= NTDDI_WIN7) typedef struct FWPM_SESSION0_ { GUID sessionKey; FWPM_DISPLAY_DATA0 displayData; UINT32 flags; UINT32 txnWaitTimeoutInMSec; DWORD processId; SID *sid; wchar_t *username; BOOL kernelMode; } FWPM_SESSION0; typedef struct FWPM_SESSION_ENUM_TEMPLATE0_ { UINT64 reserved; } FWPM_SESSION_ENUM_TEMPLATE0; #define FWPM_PROVIDER_FLAG_PERSISTENT (0x00000001) #define FWPM_PROVIDER_FLAG_DISABLED (0x00000010) typedef struct FWPM_PROVIDER0_ { GUID providerKey; FWPM_DISPLAY_DATA0 displayData; UINT32 flags; FWP_BYTE_BLOB providerData; wchar_t *serviceName; } FWPM_PROVIDER0; typedef struct FWPM_PROVIDER_ENUM_TEMPLATE0_ { UINT64 reserved; } FWPM_PROVIDER_ENUM_TEMPLATE0; typedef struct FWPM_PROVIDER_CHANGE0_ { FWPM_CHANGE_TYPE changeType; GUID providerKey; } FWPM_PROVIDER_CHANGE0; typedef struct FWPM_PROVIDER_SUBSCRIPTION0_ { FWPM_PROVIDER_ENUM_TEMPLATE0 *enumTemplate; UINT32 flags; GUID sessionKey; } FWPM_PROVIDER_SUBSCRIPTION0; #define FWPM_PROVIDER_CONTEXT_FLAG_PERSISTENT (0x00000001) typedef struct FWPM_CLASSIFY_OPTION0_ { FWP_CLASSIFY_OPTION_TYPE type; FWP_VALUE0 value; } FWPM_CLASSIFY_OPTION0; typedef struct FWPM_CLASSIFY_OPTIONS0_ { UINT32 numOptions; FWPM_CLASSIFY_OPTION0 *options; } FWPM_CLASSIFY_OPTIONS0; typedef /* [v1_enum] */ enum FWPM_PROVIDER_CONTEXT_TYPE_ { FWPM_IPSEC_KEYING_CONTEXT = 0, FWPM_IPSEC_IKE_QM_TRANSPORT_CONTEXT = ( FWPM_IPSEC_KEYING_CONTEXT + 1 ) , FWPM_IPSEC_IKE_QM_TUNNEL_CONTEXT = ( FWPM_IPSEC_IKE_QM_TRANSPORT_CONTEXT + 1 ) , FWPM_IPSEC_AUTHIP_QM_TRANSPORT_CONTEXT = ( FWPM_IPSEC_IKE_QM_TUNNEL_CONTEXT + 1 ) , FWPM_IPSEC_AUTHIP_QM_TUNNEL_CONTEXT = ( FWPM_IPSEC_AUTHIP_QM_TRANSPORT_CONTEXT + 1 ) , FWPM_IPSEC_IKE_MM_CONTEXT = ( FWPM_IPSEC_AUTHIP_QM_TUNNEL_CONTEXT + 1 ) , FWPM_IPSEC_AUTHIP_MM_CONTEXT = ( FWPM_IPSEC_IKE_MM_CONTEXT + 1 ) , FWPM_CLASSIFY_OPTIONS_CONTEXT = ( FWPM_IPSEC_AUTHIP_MM_CONTEXT + 1 ) , FWPM_GENERAL_CONTEXT = ( FWPM_CLASSIFY_OPTIONS_CONTEXT + 1 ) , FWPM_IPSEC_IKEV2_QM_TUNNEL_CONTEXT = ( FWPM_GENERAL_CONTEXT + 1 ) , FWPM_IPSEC_IKEV2_MM_CONTEXT = ( FWPM_IPSEC_IKEV2_QM_TUNNEL_CONTEXT + 1 ) , FWPM_IPSEC_DOSP_CONTEXT = ( FWPM_IPSEC_IKEV2_MM_CONTEXT + 1 ) , FWPM_PROVIDER_CONTEXT_TYPE_MAX = ( FWPM_IPSEC_DOSP_CONTEXT + 1 ) } FWPM_PROVIDER_CONTEXT_TYPE; typedef struct FWPM_PROVIDER_CONTEXT0_ { GUID providerContextKey; FWPM_DISPLAY_DATA0 displayData; UINT32 flags; GUID *providerKey; FWP_BYTE_BLOB providerData; FWPM_PROVIDER_CONTEXT_TYPE type; union { IPSEC_KEYING_POLICY0 *keyingPolicy; IPSEC_TRANSPORT_POLICY0 *ikeQmTransportPolicy; IPSEC_TUNNEL_POLICY0 *ikeQmTunnelPolicy; IPSEC_TRANSPORT_POLICY0 *authipQmTransportPolicy; IPSEC_TUNNEL_POLICY0 *authipQmTunnelPolicy; IKEEXT_POLICY0 *ikeMmPolicy; IKEEXT_POLICY0 *authIpMmPolicy; FWP_BYTE_BLOB *dataBuffer; FWPM_CLASSIFY_OPTIONS0 *classifyOptions; /* Empty union arm */ } ; UINT64 providerContextId; } FWPM_PROVIDER_CONTEXT0; #if (NTDDI_VERSION >= NTDDI_WIN7) typedef struct FWPM_PROVIDER_CONTEXT1_ { GUID providerContextKey; FWPM_DISPLAY_DATA0 displayData; UINT32 flags; GUID *providerKey; FWP_BYTE_BLOB providerData; FWPM_PROVIDER_CONTEXT_TYPE type; union { IPSEC_KEYING_POLICY0 *keyingPolicy; IPSEC_TRANSPORT_POLICY1 *ikeQmTransportPolicy; IPSEC_TUNNEL_POLICY1 *ikeQmTunnelPolicy; IPSEC_TRANSPORT_POLICY1 *authipQmTransportPolicy; IPSEC_TUNNEL_POLICY1 *authipQmTunnelPolicy; IKEEXT_POLICY1 *ikeMmPolicy; IKEEXT_POLICY1 *authIpMmPolicy; FWP_BYTE_BLOB *dataBuffer; FWPM_CLASSIFY_OPTIONS0 *classifyOptions; IPSEC_TUNNEL_POLICY1 *ikeV2QmTunnelPolicy; IKEEXT_POLICY1 *ikeV2MmPolicy; IPSEC_DOSP_OPTIONS0 *idpOptions; } ; UINT64 providerContextId; } FWPM_PROVIDER_CONTEXT1; #endif // (NTDDI_VERSION >= NTDDI_WIN7) typedef struct FWPM_PROVIDER_CONTEXT_ENUM_TEMPLATE0_ { GUID *providerKey; FWPM_PROVIDER_CONTEXT_TYPE providerContextType; } FWPM_PROVIDER_CONTEXT_ENUM_TEMPLATE0; typedef struct FWPM_PROVIDER_CONTEXT_CHANGE0_ { FWPM_CHANGE_TYPE changeType; GUID providerContextKey; UINT64 providerContextId; } FWPM_PROVIDER_CONTEXT_CHANGE0; typedef struct FWPM_PROVIDER_CONTEXT_SUBSCRIPTION0_ { FWPM_PROVIDER_CONTEXT_ENUM_TEMPLATE0 *enumTemplate; UINT32 flags; GUID sessionKey; } FWPM_PROVIDER_CONTEXT_SUBSCRIPTION0; #define FWPM_SUBLAYER_FLAG_PERSISTENT (0x00000001) typedef struct FWPM_SUBLAYER0_ { GUID subLayerKey; FWPM_DISPLAY_DATA0 displayData; UINT32 flags; GUID *providerKey; FWP_BYTE_BLOB providerData; UINT16 weight; } FWPM_SUBLAYER0; typedef struct FWPM_SUBLAYER_ENUM_TEMPLATE0_ { GUID *providerKey; } FWPM_SUBLAYER_ENUM_TEMPLATE0; typedef struct FWPM_SUBLAYER_CHANGE0_ { FWPM_CHANGE_TYPE changeType; GUID subLayerKey; } FWPM_SUBLAYER_CHANGE0; typedef struct FWPM_SUBLAYER_SUBSCRIPTION0_ { FWPM_SUBLAYER_ENUM_TEMPLATE0 *enumTemplate; UINT32 flags; GUID sessionKey; } FWPM_SUBLAYER_SUBSCRIPTION0; #define FWPM_LAYER_FLAG_KERNEL (0x00000001) #define FWPM_LAYER_FLAG_BUILTIN (0x00000002) #define FWPM_LAYER_FLAG_CLASSIFY_MOSTLY (0x00000004) #define FWPM_LAYER_FLAG_BUFFERED (0x00000008) typedef /* [v1_enum] */ enum FWPM_FIELD_TYPE_ { FWPM_FIELD_RAW_DATA = 0, FWPM_FIELD_IP_ADDRESS = ( FWPM_FIELD_RAW_DATA + 1 ) , FWPM_FIELD_FLAGS = ( FWPM_FIELD_IP_ADDRESS + 1 ) , FWPM_FIELD_TYPE_MAX = ( FWPM_FIELD_FLAGS + 1 ) } FWPM_FIELD_TYPE; typedef struct FWPM_FIELD0_ { GUID *fieldKey; FWPM_FIELD_TYPE type; FWP_DATA_TYPE dataType; } FWPM_FIELD0; typedef struct FWPM_LAYER0_ { GUID layerKey; FWPM_DISPLAY_DATA0 displayData; UINT32 flags; UINT32 numFields; FWPM_FIELD0 *field; GUID defaultSubLayerKey; UINT16 layerId; } FWPM_LAYER0; typedef struct FWPM_LAYER_ENUM_TEMPLATE0_ { UINT64 reserved; } FWPM_LAYER_ENUM_TEMPLATE0; #define FWPM_CALLOUT_FLAG_PERSISTENT (0x00010000) #define FWPM_CALLOUT_FLAG_USES_PROVIDER_CONTEXT (0x00020000) #define FWPM_CALLOUT_FLAG_REGISTERED (0x00040000) typedef struct FWPM_CALLOUT0_ { GUID calloutKey; FWPM_DISPLAY_DATA0 displayData; UINT32 flags; GUID *providerKey; FWP_BYTE_BLOB providerData; GUID applicableLayer; UINT32 calloutId; } FWPM_CALLOUT0; typedef struct FWPM_CALLOUT_ENUM_TEMPLATE0_ { GUID *providerKey; GUID layerKey; } FWPM_CALLOUT_ENUM_TEMPLATE0; typedef struct FWPM_CALLOUT_CHANGE0_ { FWPM_CHANGE_TYPE changeType; GUID calloutKey; UINT32 calloutId; } FWPM_CALLOUT_CHANGE0; typedef struct FWPM_CALLOUT_SUBSCRIPTION0_ { FWPM_CALLOUT_ENUM_TEMPLATE0 *enumTemplate; UINT32 flags; GUID sessionKey; } FWPM_CALLOUT_SUBSCRIPTION0; typedef struct FWPM_ACTION0_ { FWP_ACTION_TYPE type; /* [switch_type] */ union { GUID filterType; GUID calloutKey; } ; } FWPM_ACTION0; typedef struct FWPM_FILTER_CONDITION0_ { GUID fieldKey; FWP_MATCH_TYPE matchType; FWP_CONDITION_VALUE0 conditionValue; } FWPM_FILTER_CONDITION0; #define FWPM_FILTER_FLAG_NONE (0x00000000) #define FWPM_FILTER_FLAG_PERSISTENT (0x00000001) #define FWPM_FILTER_FLAG_BOOTTIME (0x00000002) #define FWPM_FILTER_FLAG_HAS_PROVIDER_CONTEXT (0x00000004) #define FWPM_FILTER_FLAG_CLEAR_ACTION_RIGHT (0x00000008) #define FWPM_FILTER_FLAG_PERMIT_IF_CALLOUT_UNREGISTERED (0x00000010) #define FWPM_FILTER_FLAG_DISABLED (0x00000020) typedef struct FWPM_FILTER0_ { GUID filterKey; FWPM_DISPLAY_DATA0 displayData; UINT32 flags; GUID *providerKey; FWP_BYTE_BLOB providerData; GUID layerKey; GUID subLayerKey; FWP_VALUE0 weight; UINT32 numFilterConditions; FWPM_FILTER_CONDITION0 *filterCondition; FWPM_ACTION0 action; /* [switch_type] */ union { UINT64 rawContext; GUID providerContextKey; } ; GUID *reserved; UINT64 filterId; FWP_VALUE0 effectiveWeight; } FWPM_FILTER0; typedef struct FWPM_FILTER_ENUM_TEMPLATE0_ { GUID *providerKey; GUID layerKey; FWP_FILTER_ENUM_TYPE enumType; UINT32 flags; FWPM_PROVIDER_CONTEXT_ENUM_TEMPLATE0 *providerContextTemplate; UINT32 numFilterConditions; FWPM_FILTER_CONDITION0 *filterCondition; UINT32 actionMask; GUID *calloutKey; } FWPM_FILTER_ENUM_TEMPLATE0; typedef struct FWPM_FILTER_CHANGE0_ { FWPM_CHANGE_TYPE changeType; GUID filterKey; UINT64 filterId; } FWPM_FILTER_CHANGE0; typedef struct FWPM_FILTER_SUBSCRIPTION0_ { FWPM_FILTER_ENUM_TEMPLATE0 *enumTemplate; UINT32 flags; GUID sessionKey; } FWPM_FILTER_SUBSCRIPTION0; typedef struct FWPM_LAYER_STATISTICS0_ { GUID layerId; UINT32 classifyPermitCount; UINT32 classifyBlockCount; UINT32 classifyVetoCount; UINT32 numCacheEntries; } FWPM_LAYER_STATISTICS0; typedef struct FWPM_STATISTICS0_ { UINT32 numLayerStatistics; FWPM_LAYER_STATISTICS0 *layerStatistics; UINT32 inboundAllowedConnectionsV4; UINT32 inboundBlockedConnectionsV4; UINT32 outboundAllowedConnectionsV4; UINT32 outboundBlockedConnectionsV4; UINT32 inboundAllowedConnectionsV6; UINT32 inboundBlockedConnectionsV6; UINT32 outboundAllowedConnectionsV6; UINT32 outboundBlockedConnectionsV6; UINT32 inboundActiveConnectionsV4; UINT32 outboundActiveConnectionsV4; UINT32 inboundActiveConnectionsV6; UINT32 outboundActiveConnectionsV6; } FWPM_STATISTICS0; #define FWPM_NET_EVENT_FLAG_IP_PROTOCOL_SET (0x00000001) #define FWPM_NET_EVENT_FLAG_LOCAL_ADDR_SET (0x00000002) #define FWPM_NET_EVENT_FLAG_REMOTE_ADDR_SET (0x00000004) #define FWPM_NET_EVENT_FLAG_LOCAL_PORT_SET (0x00000008) #define FWPM_NET_EVENT_FLAG_REMOTE_PORT_SET (0x00000010) #define FWPM_NET_EVENT_FLAG_APP_ID_SET (0x00000020) #define FWPM_NET_EVENT_FLAG_USER_ID_SET (0x00000040) #define FWPM_NET_EVENT_FLAG_SCOPE_ID_SET (0x00000080) #define FWPM_NET_EVENT_FLAG_IP_VERSION_SET (0x00000100) #define FWPM_NET_EVENT_FLAG_REAUTH_REASON_SET (0x00000200) typedef struct FWPM_NET_EVENT_HEADER0_ { FILETIME timeStamp; UINT32 flags; FWP_IP_VERSION ipVersion; UINT8 ipProtocol; union { UINT32 localAddrV4; FWP_BYTE_ARRAY16 localAddrV6; } ; union { UINT32 remoteAddrV4; FWP_BYTE_ARRAY16 remoteAddrV6; } ; UINT16 localPort; UINT16 remotePort; UINT32 scopeId; FWP_BYTE_BLOB appId; SID *userId; } FWPM_NET_EVENT_HEADER0; typedef struct FWPM_NET_EVENT_HEADER1_ { FILETIME timeStamp; UINT32 flags; FWP_IP_VERSION ipVersion; UINT8 ipProtocol; union { UINT32 localAddrV4; FWP_BYTE_ARRAY16 localAddrV6; /* Empty union arm */ } ; union { UINT32 remoteAddrV4; FWP_BYTE_ARRAY16 remoteAddrV6; /* Empty union arm */ } ; UINT16 localPort; UINT16 remotePort; UINT32 scopeId; FWP_BYTE_BLOB appId; SID *userId; union { struct { FWP_AF addressFamily; union { struct { FWP_BYTE_ARRAY6 dstAddrEth; FWP_BYTE_ARRAY6 srcAddrEth; DL_ADDRESS_TYPE addrType; FWP_ETHER_ENCAP_METHOD encapMethod; UINT16 etherType; UINT32 snapControl; UINT32 snapOui; UINT16 vlanTag; UINT64 ifLuid; } ; } ; } ; /* Empty union arm */ } ; } FWPM_NET_EVENT_HEADER1; typedef /* [v1_enum] */ enum FWPM_NET_EVENT_TYPE_ { FWPM_NET_EVENT_TYPE_IKEEXT_MM_FAILURE = 0, FWPM_NET_EVENT_TYPE_IKEEXT_QM_FAILURE = ( FWPM_NET_EVENT_TYPE_IKEEXT_MM_FAILURE + 1 ) , FWPM_NET_EVENT_TYPE_IKEEXT_EM_FAILURE = ( FWPM_NET_EVENT_TYPE_IKEEXT_QM_FAILURE + 1 ) , FWPM_NET_EVENT_TYPE_CLASSIFY_DROP = ( FWPM_NET_EVENT_TYPE_IKEEXT_EM_FAILURE + 1 ) , FWPM_NET_EVENT_TYPE_IPSEC_KERNEL_DROP = ( FWPM_NET_EVENT_TYPE_CLASSIFY_DROP + 1 ) , FWPM_NET_EVENT_TYPE_IPSEC_DOSP_DROP = ( FWPM_NET_EVENT_TYPE_IPSEC_KERNEL_DROP + 1 ) , FWPM_NET_EVENT_TYPE_MAX = ( FWPM_NET_EVENT_TYPE_IPSEC_DOSP_DROP + 1 ) } FWPM_NET_EVENT_TYPE; #define IKEEXT_CERT_HASH_LEN 20 #define FWPM_NET_EVENT_IKEEXT_MM_FAILURE_FLAG_BENIGN (0x00000001) #define FWPM_NET_EVENT_IKEEXT_MM_FAILURE_FLAG_MULTIPLE (0x00000002) typedef struct FWPM_NET_EVENT_IKEEXT_MM_FAILURE0_ { UINT32 failureErrorCode; IPSEC_FAILURE_POINT failurePoint; UINT32 flags; IKEEXT_KEY_MODULE_TYPE keyingModuleType; IKEEXT_MM_SA_STATE mmState; IKEEXT_SA_ROLE saRole; IKEEXT_AUTHENTICATION_METHOD_TYPE mmAuthMethod; UINT8 endCertHash[ 20 ]; UINT64 mmId; UINT64 mmFilterId; } FWPM_NET_EVENT_IKEEXT_MM_FAILURE0; #if (NTDDI_VERSION >= NTDDI_WIN7) typedef struct FWPM_NET_EVENT_IKEEXT_MM_FAILURE1_ { UINT32 failureErrorCode; IPSEC_FAILURE_POINT failurePoint; UINT32 flags; IKEEXT_KEY_MODULE_TYPE keyingModuleType; IKEEXT_MM_SA_STATE mmState; IKEEXT_SA_ROLE saRole; IKEEXT_AUTHENTICATION_METHOD_TYPE mmAuthMethod; UINT8 endCertHash[ 20 ]; UINT64 mmId; UINT64 mmFilterId; wchar_t *localPrincipalNameForAuth; wchar_t *remotePrincipalNameForAuth; UINT32 numLocalPrincipalGroupSids; LPWSTR *localPrincipalGroupSids; UINT32 numRemotePrincipalGroupSids; LPWSTR *remotePrincipalGroupSids; } FWPM_NET_EVENT_IKEEXT_MM_FAILURE1; #endif // (NTDDI_VERSION >= NTDDI_WIN7) typedef struct FWPM_NET_EVENT_IKEEXT_QM_FAILURE0_ { UINT32 failureErrorCode; IPSEC_FAILURE_POINT failurePoint; IKEEXT_KEY_MODULE_TYPE keyingModuleType; IKEEXT_QM_SA_STATE qmState; IKEEXT_SA_ROLE saRole; IPSEC_TRAFFIC_TYPE saTrafficType; union { /* Empty union arm */ FWP_CONDITION_VALUE0 localSubNet; } ; union { /* Empty union arm */ FWP_CONDITION_VALUE0 remoteSubNet; } ; UINT64 qmFilterId; } FWPM_NET_EVENT_IKEEXT_QM_FAILURE0; #define FWPM_NET_EVENT_IKEEXT_EM_FAILURE_FLAG_MULTIPLE (0x00000001) #define FWPM_NET_EVENT_IKEEXT_EM_FAILURE_FLAG_BENIGN (0x00000002) typedef struct FWPM_NET_EVENT_IKEEXT_EM_FAILURE0_ { UINT32 failureErrorCode; IPSEC_FAILURE_POINT failurePoint; UINT32 flags; IKEEXT_EM_SA_STATE emState; IKEEXT_SA_ROLE saRole; IKEEXT_AUTHENTICATION_METHOD_TYPE emAuthMethod; UINT8 endCertHash[ 20 ]; UINT64 mmId; UINT64 qmFilterId; } FWPM_NET_EVENT_IKEEXT_EM_FAILURE0; #if (NTDDI_VERSION >= NTDDI_WIN7) typedef struct FWPM_NET_EVENT_IKEEXT_EM_FAILURE1_ { UINT32 failureErrorCode; IPSEC_FAILURE_POINT failurePoint; UINT32 flags; IKEEXT_EM_SA_STATE emState; IKEEXT_SA_ROLE saRole; IKEEXT_AUTHENTICATION_METHOD_TYPE emAuthMethod; UINT8 endCertHash[ 20 ]; UINT64 mmId; UINT64 qmFilterId; wchar_t *localPrincipalNameForAuth; wchar_t *remotePrincipalNameForAuth; UINT32 numLocalPrincipalGroupSids; LPWSTR *localPrincipalGroupSids; UINT32 numRemotePrincipalGroupSids; LPWSTR *remotePrincipalGroupSids; IPSEC_TRAFFIC_TYPE saTrafficType; } FWPM_NET_EVENT_IKEEXT_EM_FAILURE1; #endif // (NTDDI_VERSION >= NTDDI_WIN7) typedef struct FWPM_NET_EVENT_CLASSIFY_DROP0_ { UINT64 filterId; UINT16 layerId; } FWPM_NET_EVENT_CLASSIFY_DROP0; typedef struct FWPM_NET_EVENT_CLASSIFY_DROP1_ { UINT64 filterId; UINT16 layerId; UINT32 reauthReason; UINT32 originalProfile; UINT32 currentProfile; UINT32 msFwpDirection; BOOL isLoopback; } FWPM_NET_EVENT_CLASSIFY_DROP1; typedef struct FWPM_NET_EVENT_IPSEC_KERNEL_DROP0_ { INT32 failureStatus; FWP_DIRECTION direction; IPSEC_SA_SPI spi; UINT64 filterId; UINT16 layerId; } FWPM_NET_EVENT_IPSEC_KERNEL_DROP0; typedef struct FWPM_NET_EVENT_IPSEC_DOSP_DROP0_ { FWP_IP_VERSION ipVersion; union { UINT32 publicHostV4Addr; UINT8 publicHostV6Addr[ 16 ]; } ; union { UINT32 internalHostV4Addr; UINT8 internalHostV6Addr[ 16 ]; } ; INT32 failureStatus; FWP_DIRECTION direction; } FWPM_NET_EVENT_IPSEC_DOSP_DROP0; typedef struct FWPM_NET_EVENT0_ { FWPM_NET_EVENT_HEADER0 header; FWPM_NET_EVENT_TYPE type; union { FWPM_NET_EVENT_IKEEXT_MM_FAILURE0 *ikeMmFailure; FWPM_NET_EVENT_IKEEXT_QM_FAILURE0 *ikeQmFailure; FWPM_NET_EVENT_IKEEXT_EM_FAILURE0 *ikeEmFailure; FWPM_NET_EVENT_CLASSIFY_DROP0 *classifyDrop; FWPM_NET_EVENT_IPSEC_KERNEL_DROP0 *ipsecDrop; FWPM_NET_EVENT_IPSEC_DOSP_DROP0 *idpDrop; } ; } FWPM_NET_EVENT0; #if (NTDDI_VERSION >= NTDDI_WIN7) typedef struct FWPM_NET_EVENT1_ { FWPM_NET_EVENT_HEADER1 header; FWPM_NET_EVENT_TYPE type; union { FWPM_NET_EVENT_IKEEXT_MM_FAILURE1 *ikeMmFailure; FWPM_NET_EVENT_IKEEXT_QM_FAILURE0 *ikeQmFailure; FWPM_NET_EVENT_IKEEXT_EM_FAILURE1 *ikeEmFailure; FWPM_NET_EVENT_CLASSIFY_DROP1 *classifyDrop; FWPM_NET_EVENT_IPSEC_KERNEL_DROP0 *ipsecDrop; FWPM_NET_EVENT_IPSEC_DOSP_DROP0 *idpDrop; } ; } FWPM_NET_EVENT1; #endif // (NTDDI_VERSION >= NTDDI_WIN7) typedef struct FWPM_NET_EVENT_ENUM_TEMPLATE0_ { FILETIME startTime; FILETIME endTime; UINT32 numFilterConditions; FWPM_FILTER_CONDITION0 *filterCondition; } FWPM_NET_EVENT_ENUM_TEMPLATE0; typedef struct FWPM_NET_EVENT_SUBSCRIPTION0_ { FWPM_NET_EVENT_ENUM_TEMPLATE0 *enumTemplate; UINT32 flags; GUID sessionKey; } FWPM_NET_EVENT_SUBSCRIPTION0; #if (NTDDI_VERSION >= NTDDI_WIN7) typedef /* [v1_enum] */ enum FWPM_SYSTEM_PORT_TYPE_ { FWPM_SYSTEM_PORT_RPC_EPMAP = 0, FWPM_SYSTEM_PORT_TEREDO = ( FWPM_SYSTEM_PORT_RPC_EPMAP + 1 ) , FWPM_SYSTEM_PORT_IPHTTPS_IN = ( FWPM_SYSTEM_PORT_TEREDO + 1 ) , FWPM_SYSTEM_PORT_IPHTTPS_OUT = ( FWPM_SYSTEM_PORT_IPHTTPS_IN + 1 ) , FWPM_SYSTEM_PORT_TYPE_MAX = ( FWPM_SYSTEM_PORT_IPHTTPS_OUT + 1 ) } FWPM_SYSTEM_PORT_TYPE; typedef struct FWPM_SYSTEM_PORTS_BY_TYPE0_ { FWPM_SYSTEM_PORT_TYPE type; UINT32 numPorts; UINT16 *ports; } FWPM_SYSTEM_PORTS_BY_TYPE0; typedef struct FWPM_SYSTEM_PORTS0_ { UINT32 numTypes; FWPM_SYSTEM_PORTS_BY_TYPE0 *types; } FWPM_SYSTEM_PORTS0; #endif // (NTDDI_VERSION >= NTDDI_WIN7) #if _MSC_VER >= 800 #if _MSC_VER >= 1200 #pragma warning(pop) #else #pragma warning(default:4201) #endif #endif extern RPC_IF_HANDLE __MIDL_itf_fwpmtypes_0000_0000_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_fwpmtypes_0000_0000_v0_0_s_ifspec; /* Additional Prototypes for ALL interfaces */ /* end of Additional Prototypes */ #ifdef __cplusplus } #endif #endif
22,770
C++
.h
702
27.529915
90
0.702561
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,259
iketypes.h
BlackINT3_OpenArk/src/OpenArk/kernel/network/include/iketypes.h
/* this ALWAYS GENERATED file contains the definitions for the interfaces */ /* File created by MIDL compiler version 7.00.0555 */ /* Compiler settings for iketypes.idl: Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 7.00.0555 protocol : dce , ms_ext, c_ext, robust error checks: allocation ref bounds_check enum stub_data VC __declspec() decoration level: __declspec(uuid()), __declspec(selectany), __declspec(novtable) DECLSPEC_UUID(), MIDL_INTERFACE() */ /* @@MIDL_FILE_HEADING( ) */ #pragma warning( disable: 4049 ) /* more than 64k source lines */ /* verify that the <rpcndr.h> version is high enough to compile this file*/ #ifndef __REQUIRED_RPCNDR_H_VERSION__ #define __REQUIRED_RPCNDR_H_VERSION__ 500 #endif /* verify that the <rpcsal.h> version is high enough to compile this file*/ #ifndef __REQUIRED_RPCSAL_H_VERSION__ #define __REQUIRED_RPCSAL_H_VERSION__ 100 #endif #include "rpc.h" #include "rpcndr.h" #ifndef __RPCNDR_H_VERSION__ #error this stub requires an updated version of <rpcndr.h> #endif // __RPCNDR_H_VERSION__ #ifndef __iketypes_h__ #define __iketypes_h__ #if defined(_MSC_VER) && (_MSC_VER >= 1020) #pragma once #endif /* Forward Declarations */ /* header files for imported files */ #include "fwptypes.h" #ifdef __cplusplus extern "C"{ #endif /* interface __MIDL_itf_iketypes_0000_0000 */ /* [local] */ #pragma once #pragma once #pragma once #pragma once #if _MSC_VER >= 800 #if _MSC_VER >= 1200 #pragma warning(push) #endif #pragma warning(disable:4201) #endif typedef struct IPSEC_V4_UDP_ENCAPSULATION0_ IPSEC_V4_UDP_ENCAPSULATION0; typedef /* [v1_enum] */ enum IKEEXT_KEY_MODULE_TYPE_ { IKEEXT_KEY_MODULE_IKE = 0, IKEEXT_KEY_MODULE_AUTHIP = ( IKEEXT_KEY_MODULE_IKE + 1 ) , IKEEXT_KEY_MODULE_IKEV2 = ( IKEEXT_KEY_MODULE_AUTHIP + 1 ) , IKEEXT_KEY_MODULE_MAX = ( IKEEXT_KEY_MODULE_IKEV2 + 1 ) } IKEEXT_KEY_MODULE_TYPE; typedef /* [v1_enum] */ enum IKEEXT_AUTHENTICATION_METHOD_TYPE_ { IKEEXT_PRESHARED_KEY = 0, IKEEXT_CERTIFICATE = ( IKEEXT_PRESHARED_KEY + 1 ) , IKEEXT_KERBEROS = ( IKEEXT_CERTIFICATE + 1 ) , IKEEXT_ANONYMOUS = ( IKEEXT_KERBEROS + 1 ) , IKEEXT_SSL = ( IKEEXT_ANONYMOUS + 1 ) , IKEEXT_NTLM_V2 = ( IKEEXT_SSL + 1 ) , IKEEXT_IPV6_CGA = ( IKEEXT_NTLM_V2 + 1 ) , IKEEXT_CERTIFICATE_ECDSA_P256 = ( IKEEXT_IPV6_CGA + 1 ) , IKEEXT_CERTIFICATE_ECDSA_P384 = ( IKEEXT_CERTIFICATE_ECDSA_P256 + 1 ) , IKEEXT_SSL_ECDSA_P256 = ( IKEEXT_CERTIFICATE_ECDSA_P384 + 1 ) , IKEEXT_SSL_ECDSA_P384 = ( IKEEXT_SSL_ECDSA_P256 + 1 ) , IKEEXT_EAP = ( IKEEXT_SSL_ECDSA_P384 + 1 ) , IKEEXT_AUTHENTICATION_METHOD_TYPE_MAX = ( IKEEXT_EAP + 1 ) } IKEEXT_AUTHENTICATION_METHOD_TYPE; typedef /* [v1_enum] */ enum IKEEXT_AUTHENTICATION_IMPERSONATION_TYPE_ { IKEEXT_IMPERSONATION_NONE = 0, IKEEXT_IMPERSONATION_SOCKET_PRINCIPAL = ( IKEEXT_IMPERSONATION_NONE + 1 ) , IKEEXT_IMPERSONATION_MAX = ( IKEEXT_IMPERSONATION_SOCKET_PRINCIPAL + 1 ) } IKEEXT_AUTHENTICATION_IMPERSONATION_TYPE; typedef struct IKEEXT_PRESHARED_KEY_AUTHENTICATION0__ { FWP_BYTE_BLOB presharedKey; } IKEEXT_PRESHARED_KEY_AUTHENTICATION0; #if (NTDDI_VERSION >= NTDDI_WIN7) #define IKEEXT_PSK_FLAG_LOCAL_AUTH_ONLY (0x00000001) #define IKEEXT_PSK_FLAG_REMOTE_AUTH_ONLY (0x00000002) typedef struct IKEEXT_PRESHARED_KEY_AUTHENTICATION1__ { FWP_BYTE_BLOB presharedKey; UINT32 flags; } IKEEXT_PRESHARED_KEY_AUTHENTICATION1; #endif // (NTDDI_VERSION >= NTDDI_WIN7) #define IKEEXT_CERT_FLAG_ENABLE_ACCOUNT_MAPPING (0x00000001) #define IKEEXT_CERT_FLAG_DISABLE_REQUEST_PAYLOAD (0x00000002) #define IKEEXT_CERT_FLAG_USE_NAP_CERTIFICATE (0x00000004) #define IKEEXT_CERT_FLAG_INTERMEDIATE_CA (0x00000008) #define IKEEXT_CERT_FLAG_IGNORE_INIT_CERT_MAP_FAILURE (0x00000010) #define IKEEXT_CERT_FLAG_PREFER_NAP_CERTIFICATE_OUTBOUND (0x00000020) typedef struct IKEEXT_CERT_ROOT_CONFIG0_ { FWP_BYTE_BLOB certData; UINT32 flags; } IKEEXT_CERT_ROOT_CONFIG0; #define IKEEXT_CERT_AUTH_FLAG_SSL_ONE_WAY (0x00000001) #define IKEEXT_CERT_AUTH_FLAG_DISABLE_CRL_CHECK (0x00000002) #define IKEEXT_CERT_AUTH_ENABLE_CRL_CHECK_STRONG (0x00000004) #define IKEEXT_CERT_AUTH_DISABLE_SSL_CERT_VALIDATION (0x00000008) #if (NTDDI_VERSION >= NTDDI_WIN7) #define IKEEXT_CERT_AUTH_ALLOW_HTTP_CERT_LOOKUP (0x00000010) #define IKEEXT_CERT_AUTH_URL_CONTAINS_BUNDLE (0x00000020) #endif // (NTDDI_VERSION >= NTDDI_WIN7) typedef /* [v1_enum] */ enum IKEEXT_CERT_CONFIG_TYPE_ { IKEEXT_CERT_CONFIG_EXPLICIT_TRUST_LIST = 0, IKEEXT_CERT_CONFIG_ENTERPRISE_STORE = ( IKEEXT_CERT_CONFIG_EXPLICIT_TRUST_LIST + 1 ) , IKEEXT_CERT_CONFIG_TRUSTED_ROOT_STORE = ( IKEEXT_CERT_CONFIG_ENTERPRISE_STORE + 1 ) , IKEEXT_CERT_CONFIG_UNSPECIFIED = ( IKEEXT_CERT_CONFIG_TRUSTED_ROOT_STORE + 1 ) , IKEEXT_CERT_CONFIG_TYPE_MAX = ( IKEEXT_CERT_CONFIG_UNSPECIFIED + 1 ) } IKEEXT_CERT_CONFIG_TYPE; typedef struct IKEEXT_CERTIFICATE_AUTHENTICATION0_ { IKEEXT_CERT_CONFIG_TYPE inboundConfigType; union { struct { UINT32 inboundRootArraySize; IKEEXT_CERT_ROOT_CONFIG0 *inboundRootArray; } ; IKEEXT_CERT_ROOT_CONFIG0 *inboundEnterpriseStoreConfig; IKEEXT_CERT_ROOT_CONFIG0 *inboundTrustedRootStoreConfig; } ; IKEEXT_CERT_CONFIG_TYPE outboundConfigType; union { struct { UINT32 outboundRootArraySize; IKEEXT_CERT_ROOT_CONFIG0 *outboundRootArray; } ; IKEEXT_CERT_ROOT_CONFIG0 *outboundEnterpriseStoreConfig; IKEEXT_CERT_ROOT_CONFIG0 *outboundTrustedRootStoreConfig; } ; UINT32 flags; } IKEEXT_CERTIFICATE_AUTHENTICATION0; #if (NTDDI_VERSION >= NTDDI_WIN7) typedef struct IKEEXT_CERTIFICATE_AUTHENTICATION1_ { IKEEXT_CERT_CONFIG_TYPE inboundConfigType; union { struct { UINT32 inboundRootArraySize; IKEEXT_CERT_ROOT_CONFIG0 *inboundRootArray; } ; IKEEXT_CERT_ROOT_CONFIG0 *inboundEnterpriseStoreConfig; IKEEXT_CERT_ROOT_CONFIG0 *inboundTrustedRootStoreConfig; /* Empty union arm */ } ; IKEEXT_CERT_CONFIG_TYPE outboundConfigType; union { struct { UINT32 outboundRootArraySize; IKEEXT_CERT_ROOT_CONFIG0 *outboundRootArray; } ; IKEEXT_CERT_ROOT_CONFIG0 *outboundEnterpriseStoreConfig; IKEEXT_CERT_ROOT_CONFIG0 *outboundTrustedRootStoreConfig; /* Empty union arm */ } ; UINT32 flags; FWP_BYTE_BLOB localCertLocationUrl; } IKEEXT_CERTIFICATE_AUTHENTICATION1; #endif // (NTDDI_VERSION >= NTDDI_WIN7) typedef struct IKEEXT_IPV6_CGA_AUTHENTICATION0_ { wchar_t *keyContainerName; wchar_t *cspName; UINT32 cspType; FWP_BYTE_ARRAY16 cgaModifier; BYTE cgaCollisionCount; } IKEEXT_IPV6_CGA_AUTHENTICATION0; #define IKEEXT_KERB_AUTH_DISABLE_INITIATOR_TOKEN_GENERATION (0x00000001) #define IKEEXT_KERB_AUTH_DONT_ACCEPT_EXPLICIT_CREDENTIALS (0x00000002) typedef struct IKEEXT_KERBEROS_AUTHENTICATION0__ { UINT32 flags; } IKEEXT_KERBEROS_AUTHENTICATION0; #define IKEEXT_NTLM_V2_AUTH_DONT_ACCEPT_EXPLICIT_CREDENTIALS (0x00000001) typedef struct IKEEXT_NTLM_V2_AUTHENTICATION0__ { UINT32 flags; } IKEEXT_NTLM_V2_AUTHENTICATION0; #if (NTDDI_VERSION >= NTDDI_WIN7) #define IKEEXT_EAP_FLAG_LOCAL_AUTH_ONLY (0x00000001) #define IKEEXT_EAP_FLAG_REMOTE_AUTH_ONLY (0x00000002) typedef struct IKEEXT_EAP_AUTHENTICATION0__ { UINT32 flags; } IKEEXT_EAP_AUTHENTICATION0; #endif // (NTDDI_VERSION >= NTDDI_WIN7) typedef struct IKEEXT_AUTHENTICATION_METHOD0_ { IKEEXT_AUTHENTICATION_METHOD_TYPE authenticationMethodType; union { IKEEXT_PRESHARED_KEY_AUTHENTICATION0 presharedKeyAuthentication; IKEEXT_CERTIFICATE_AUTHENTICATION0 certificateAuthentication; IKEEXT_KERBEROS_AUTHENTICATION0 kerberosAuthentication; IKEEXT_NTLM_V2_AUTHENTICATION0 ntlmV2Authentication; /* Empty union arm */ IKEEXT_CERTIFICATE_AUTHENTICATION0 sslAuthentication; IKEEXT_IPV6_CGA_AUTHENTICATION0 cgaAuthentication; } ; } IKEEXT_AUTHENTICATION_METHOD0; #if (NTDDI_VERSION >= NTDDI_WIN7) typedef struct IKEEXT_AUTHENTICATION_METHOD1_ { IKEEXT_AUTHENTICATION_METHOD_TYPE authenticationMethodType; union { IKEEXT_PRESHARED_KEY_AUTHENTICATION1 presharedKeyAuthentication; IKEEXT_CERTIFICATE_AUTHENTICATION1 certificateAuthentication; IKEEXT_KERBEROS_AUTHENTICATION0 kerberosAuthentication; IKEEXT_NTLM_V2_AUTHENTICATION0 ntlmV2Authentication; /* Empty union arm */ IKEEXT_CERTIFICATE_AUTHENTICATION1 sslAuthentication; IKEEXT_IPV6_CGA_AUTHENTICATION0 cgaAuthentication; IKEEXT_EAP_AUTHENTICATION0 eapAuthentication; } ; } IKEEXT_AUTHENTICATION_METHOD1; #endif // (NTDDI_VERSION >= NTDDI_WIN7) typedef /* [v1_enum] */ enum IKEEXT_CIPHER_TYPE_ { IKEEXT_CIPHER_DES = 0, IKEEXT_CIPHER_3DES = ( IKEEXT_CIPHER_DES + 1 ) , IKEEXT_CIPHER_AES_128 = ( IKEEXT_CIPHER_3DES + 1 ) , IKEEXT_CIPHER_AES_192 = ( IKEEXT_CIPHER_AES_128 + 1 ) , IKEEXT_CIPHER_AES_256 = ( IKEEXT_CIPHER_AES_192 + 1 ) , IKEEXT_CIPHER_TYPE_MAX = ( IKEEXT_CIPHER_AES_256 + 1 ) } IKEEXT_CIPHER_TYPE; typedef struct IKEEXT_CIPHER_ALGORITHM0_ { IKEEXT_CIPHER_TYPE algoIdentifier; UINT32 keyLen; UINT32 rounds; } IKEEXT_CIPHER_ALGORITHM0; typedef /* [v1_enum] */ enum IKEEXT_INTEGRITY_TYPE_ { IKEEXT_INTEGRITY_MD5 = 0, IKEEXT_INTEGRITY_SHA1 = ( IKEEXT_INTEGRITY_MD5 + 1 ) , IKEEXT_INTEGRITY_SHA_256 = ( IKEEXT_INTEGRITY_SHA1 + 1 ) , IKEEXT_INTEGRITY_SHA_384 = ( IKEEXT_INTEGRITY_SHA_256 + 1 ) , IKEEXT_INTEGRITY_TYPE_MAX = ( IKEEXT_INTEGRITY_SHA_384 + 1 ) } IKEEXT_INTEGRITY_TYPE; typedef struct IKEEXT_INTEGRITY_ALGORITHM0_ { IKEEXT_INTEGRITY_TYPE algoIdentifier; } IKEEXT_INTEGRITY_ALGORITHM0; typedef /* [v1_enum] */ enum IKEEXT_DH_GROUP_ { IKEEXT_DH_GROUP_NONE = 0, IKEEXT_DH_GROUP_1 = ( IKEEXT_DH_GROUP_NONE + 1 ) , IKEEXT_DH_GROUP_2 = ( IKEEXT_DH_GROUP_1 + 1 ) , IKEEXT_DH_GROUP_2048 = ( IKEEXT_DH_GROUP_2 + 1 ) , IKEEXT_DH_ECP_256 = ( IKEEXT_DH_GROUP_2048 + 1 ) , IKEEXT_DH_ECP_384 = ( IKEEXT_DH_ECP_256 + 1 ) , IKEEXT_DH_GROUP_MAX = ( IKEEXT_DH_ECP_384 + 1 ) } IKEEXT_DH_GROUP; typedef struct IKEEXT_PROPOSAL0_ { IKEEXT_CIPHER_ALGORITHM0 cipherAlgorithm; IKEEXT_INTEGRITY_ALGORITHM0 integrityAlgorithm; UINT32 maxLifetimeSeconds; IKEEXT_DH_GROUP dhGroup; UINT32 quickModeLimit; } IKEEXT_PROPOSAL0; #define IKEEXT_POLICY_FLAG_DISABLE_DIAGNOSTICS (0x00000001) #define IKEEXT_POLICY_FLAG_NO_MACHINE_LUID_VERIFY (0x00000002) #define IKEEXT_POLICY_FLAG_NO_IMPERSONATION_LUID_VERIFY (0x00000004) #define IKEEXT_POLICY_FLAG_ENABLE_OPTIONAL_DH (0x00000008) typedef struct IKEEXT_POLICY0_ { UINT32 softExpirationTime; UINT32 numAuthenticationMethods; IKEEXT_AUTHENTICATION_METHOD0 *authenticationMethods; IKEEXT_AUTHENTICATION_IMPERSONATION_TYPE initiatorImpersonationType; UINT32 numIkeProposals; IKEEXT_PROPOSAL0 *ikeProposals; UINT32 flags; UINT32 maxDynamicFilters; } IKEEXT_POLICY0; #if (NTDDI_VERSION >= NTDDI_WIN7) typedef struct IKEEXT_POLICY1_ { UINT32 softExpirationTime; UINT32 numAuthenticationMethods; IKEEXT_AUTHENTICATION_METHOD1 *authenticationMethods; IKEEXT_AUTHENTICATION_IMPERSONATION_TYPE initiatorImpersonationType; UINT32 numIkeProposals; IKEEXT_PROPOSAL0 *ikeProposals; UINT32 flags; UINT32 maxDynamicFilters; UINT32 retransmitDurationSecs; } IKEEXT_POLICY1; #endif // (NTDDI_VERSION >= NTDDI_WIN7) typedef struct IKEEXT_EM_POLICY0_ { UINT32 numAuthenticationMethods; IKEEXT_AUTHENTICATION_METHOD0 *authenticationMethods; IKEEXT_AUTHENTICATION_IMPERSONATION_TYPE initiatorImpersonationType; } IKEEXT_EM_POLICY0; #if (NTDDI_VERSION >= NTDDI_WIN7) typedef struct IKEEXT_EM_POLICY1_ { UINT32 numAuthenticationMethods; IKEEXT_AUTHENTICATION_METHOD1 *authenticationMethods; IKEEXT_AUTHENTICATION_IMPERSONATION_TYPE initiatorImpersonationType; } IKEEXT_EM_POLICY1; #endif // (NTDDI_VERSION >= NTDDI_WIN7) #define IKEEXT_ERROR_CODE_COUNT (ERROR_IPSEC_IKE_NEG_STATUS_END - ERROR_IPSEC_IKE_NEG_STATUS_BEGIN) typedef struct IKEEXT_IP_VERSION_SPECIFIC_KEYMODULE_STATISTICS0_ { UINT32 currentActiveMainModes; UINT32 totalMainModesStarted; UINT32 totalSuccessfulMainModes; UINT32 totalFailedMainModes; UINT32 totalResponderMainModes; UINT32 currentNewResponderMainModes; UINT32 currentActiveQuickModes; UINT32 totalQuickModesStarted; UINT32 totalSuccessfulQuickModes; UINT32 totalFailedQuickModes; UINT32 totalAcquires; UINT32 totalReinitAcquires; UINT32 currentActiveExtendedModes; UINT32 totalExtendedModesStarted; UINT32 totalSuccessfulExtendedModes; UINT32 totalFailedExtendedModes; UINT32 totalImpersonationExtendedModes; UINT32 totalImpersonationMainModes; } IKEEXT_IP_VERSION_SPECIFIC_KEYMODULE_STATISTICS0; #if (NTDDI_VERSION >= NTDDI_WIN7) typedef struct IKEEXT_IP_VERSION_SPECIFIC_KEYMODULE_STATISTICS1_ { UINT32 currentActiveMainModes; UINT32 totalMainModesStarted; UINT32 totalSuccessfulMainModes; UINT32 totalFailedMainModes; UINT32 totalResponderMainModes; UINT32 currentNewResponderMainModes; UINT32 currentActiveQuickModes; UINT32 totalQuickModesStarted; UINT32 totalSuccessfulQuickModes; UINT32 totalFailedQuickModes; UINT32 totalAcquires; UINT32 totalReinitAcquires; UINT32 currentActiveExtendedModes; UINT32 totalExtendedModesStarted; UINT32 totalSuccessfulExtendedModes; UINT32 totalFailedExtendedModes; UINT32 totalImpersonationExtendedModes; UINT32 totalImpersonationMainModes; } IKEEXT_IP_VERSION_SPECIFIC_KEYMODULE_STATISTICS1; #endif // (NTDDI_VERSION >= NTDDI_WIN7) typedef struct IKEEXT_KEYMODULE_STATISTICS0_ { IKEEXT_IP_VERSION_SPECIFIC_KEYMODULE_STATISTICS0 v4Statistics; IKEEXT_IP_VERSION_SPECIFIC_KEYMODULE_STATISTICS0 v6Statistics; UINT32 errorFrequencyTable[ 97 ]; UINT32 mainModeNegotiationTime; UINT32 quickModeNegotiationTime; UINT32 extendedModeNegotiationTime; } IKEEXT_KEYMODULE_STATISTICS0; #if (NTDDI_VERSION >= NTDDI_WIN7) typedef struct IKEEXT_KEYMODULE_STATISTICS1_ { IKEEXT_IP_VERSION_SPECIFIC_KEYMODULE_STATISTICS1 v4Statistics; IKEEXT_IP_VERSION_SPECIFIC_KEYMODULE_STATISTICS1 v6Statistics; UINT32 errorFrequencyTable[ 97 ]; UINT32 mainModeNegotiationTime; UINT32 quickModeNegotiationTime; UINT32 extendedModeNegotiationTime; } IKEEXT_KEYMODULE_STATISTICS1; #endif // (NTDDI_VERSION >= NTDDI_WIN7) typedef struct IKEEXT_IP_VERSION_SPECIFIC_COMMON_STATISTICS0_ { UINT32 totalSocketReceiveFailures; UINT32 totalSocketSendFailures; } IKEEXT_IP_VERSION_SPECIFIC_COMMON_STATISTICS0; #if (NTDDI_VERSION >= NTDDI_WIN7) typedef struct IKEEXT_IP_VERSION_SPECIFIC_COMMON_STATISTICS1_ { UINT32 totalSocketReceiveFailures; UINT32 totalSocketSendFailures; } IKEEXT_IP_VERSION_SPECIFIC_COMMON_STATISTICS1; #endif // (NTDDI_VERSION >= NTDDI_WIN7) typedef struct IKEEXT_COMMON_STATISTICS0_ { IKEEXT_IP_VERSION_SPECIFIC_COMMON_STATISTICS0 v4Statistics; IKEEXT_IP_VERSION_SPECIFIC_COMMON_STATISTICS0 v6Statistics; UINT32 totalPacketsReceived; UINT32 totalInvalidPacketsReceived; UINT32 currentQueuedWorkitems; } IKEEXT_COMMON_STATISTICS0; #if (NTDDI_VERSION >= NTDDI_WIN7) typedef struct IKEEXT_COMMON_STATISTICS1_ { IKEEXT_IP_VERSION_SPECIFIC_COMMON_STATISTICS1 v4Statistics; IKEEXT_IP_VERSION_SPECIFIC_COMMON_STATISTICS1 v6Statistics; UINT32 totalPacketsReceived; UINT32 totalInvalidPacketsReceived; UINT32 currentQueuedWorkitems; } IKEEXT_COMMON_STATISTICS1; #endif // (NTDDI_VERSION >= NTDDI_WIN7) typedef struct IKEEXT_STATISTICS0_ { IKEEXT_KEYMODULE_STATISTICS0 ikeStatistics; IKEEXT_KEYMODULE_STATISTICS0 authipStatistics; IKEEXT_COMMON_STATISTICS0 commonStatistics; } IKEEXT_STATISTICS0; #if (NTDDI_VERSION >= NTDDI_WIN7) typedef struct IKEEXT_STATISTICS1_ { IKEEXT_KEYMODULE_STATISTICS1 ikeStatistics; IKEEXT_KEYMODULE_STATISTICS1 authipStatistics; IKEEXT_KEYMODULE_STATISTICS1 ikeV2Statistics; IKEEXT_COMMON_STATISTICS1 commonStatistics; } IKEEXT_STATISTICS1; #endif // (NTDDI_VERSION >= NTDDI_WIN7) typedef struct IKEEXT_TRAFFIC0_ { FWP_IP_VERSION ipVersion; union { UINT32 localV4Address; UINT8 localV6Address[ 16 ]; } ; union { UINT32 remoteV4Address; UINT8 remoteV6Address[ 16 ]; } ; UINT64 authIpFilterId; } IKEEXT_TRAFFIC0; typedef UINT64 IKEEXT_COOKIE; typedef struct IKEEXT_COOKIE_PAIR0_ { IKEEXT_COOKIE initiator; IKEEXT_COOKIE responder; } IKEEXT_COOKIE_PAIR0; #define IKEEXT_CERT_CREDENTIAL_FLAG_NAP_CERT (0x00000001) typedef struct IKEEXT_CERTIFICATE_CREDENTIAL0_ { FWP_BYTE_BLOB subjectName; FWP_BYTE_BLOB certHash; UINT32 flags; } IKEEXT_CERTIFICATE_CREDENTIAL0; typedef struct IKEEXT_NAME_CREDENTIAL0_ { wchar_t *principalName; } IKEEXT_NAME_CREDENTIAL0; typedef struct IKEEXT_CREDENTIAL0_ { IKEEXT_AUTHENTICATION_METHOD_TYPE authenticationMethodType; IKEEXT_AUTHENTICATION_IMPERSONATION_TYPE impersonationType; union { IKEEXT_PRESHARED_KEY_AUTHENTICATION0 *presharedKey; IKEEXT_CERTIFICATE_CREDENTIAL0 *certificate; IKEEXT_NAME_CREDENTIAL0 *name; /* Empty union arm */ } ; } IKEEXT_CREDENTIAL0; typedef struct IKEEXT_CREDENTIAL_PAIR0_ { IKEEXT_CREDENTIAL0 localCredentials; IKEEXT_CREDENTIAL0 peerCredentials; } IKEEXT_CREDENTIAL_PAIR0; typedef struct IKEEXT_CREDENTIALS0_ { UINT32 numCredentials; IKEEXT_CREDENTIAL_PAIR0 *credentials; } IKEEXT_CREDENTIALS0; typedef struct IKEEXT_SA_DETAILS0_ { UINT64 saId; IKEEXT_KEY_MODULE_TYPE keyModuleType; FWP_IP_VERSION ipVersion; union { IPSEC_V4_UDP_ENCAPSULATION0 *v4UdpEncapsulation; /* Empty union arm */ } ; IKEEXT_TRAFFIC0 ikeTraffic; IKEEXT_PROPOSAL0 ikeProposal; IKEEXT_COOKIE_PAIR0 cookiePair; IKEEXT_CREDENTIALS0 ikeCredentials; GUID ikePolicyKey; UINT64 virtualIfTunnelId; } IKEEXT_SA_DETAILS0; #if (NTDDI_VERSION >= NTDDI_WIN7) typedef struct IKEEXT_CERTIFICATE_CREDENTIAL1_ { FWP_BYTE_BLOB subjectName; FWP_BYTE_BLOB certHash; UINT32 flags; FWP_BYTE_BLOB certificate; } IKEEXT_CERTIFICATE_CREDENTIAL1; typedef struct IKEEXT_CREDENTIAL1_ { IKEEXT_AUTHENTICATION_METHOD_TYPE authenticationMethodType; IKEEXT_AUTHENTICATION_IMPERSONATION_TYPE impersonationType; union { IKEEXT_PRESHARED_KEY_AUTHENTICATION1 *presharedKey; IKEEXT_CERTIFICATE_CREDENTIAL1 *certificate; IKEEXT_NAME_CREDENTIAL0 *name; /* Empty union arm */ } ; } IKEEXT_CREDENTIAL1; typedef struct IKEEXT_CREDENTIAL_PAIR1_ { IKEEXT_CREDENTIAL1 localCredentials; IKEEXT_CREDENTIAL1 peerCredentials; } IKEEXT_CREDENTIAL_PAIR1; typedef struct IKEEXT_CREDENTIALS1_ { UINT32 numCredentials; IKEEXT_CREDENTIAL_PAIR1 *credentials; } IKEEXT_CREDENTIALS1; typedef struct IKEEXT_SA_DETAILS1_ { UINT64 saId; IKEEXT_KEY_MODULE_TYPE keyModuleType; FWP_IP_VERSION ipVersion; union { IPSEC_V4_UDP_ENCAPSULATION0 *v4UdpEncapsulation; /* Empty union arm */ } ; IKEEXT_TRAFFIC0 ikeTraffic; IKEEXT_PROPOSAL0 ikeProposal; IKEEXT_COOKIE_PAIR0 cookiePair; IKEEXT_CREDENTIALS1 ikeCredentials; GUID ikePolicyKey; UINT64 virtualIfTunnelId; FWP_BYTE_BLOB correlationKey; } IKEEXT_SA_DETAILS1; #endif // (NTDDI_VERSION >= NTDDI_WIN7) typedef struct IKEEXT_SA_ENUM_TEMPLATE0_ { FWP_CONDITION_VALUE0 localSubNet; FWP_CONDITION_VALUE0 remoteSubNet; FWP_BYTE_BLOB localMainModeCertHash; } IKEEXT_SA_ENUM_TEMPLATE0; typedef /* [v1_enum] */ enum IKEEXT_MM_SA_STATE_ { IKEEXT_MM_SA_STATE_NONE = 0, IKEEXT_MM_SA_STATE_SA_SENT = ( IKEEXT_MM_SA_STATE_NONE + 1 ) , IKEEXT_MM_SA_STATE_SSPI_SENT = ( IKEEXT_MM_SA_STATE_SA_SENT + 1 ) , IKEEXT_MM_SA_STATE_FINAL = ( IKEEXT_MM_SA_STATE_SSPI_SENT + 1 ) , IKEEXT_MM_SA_STATE_FINAL_SENT = ( IKEEXT_MM_SA_STATE_FINAL + 1 ) , IKEEXT_MM_SA_STATE_COMPLETE = ( IKEEXT_MM_SA_STATE_FINAL_SENT + 1 ) , IKEEXT_MM_SA_STATE_MAX = ( IKEEXT_MM_SA_STATE_COMPLETE + 1 ) } IKEEXT_MM_SA_STATE; typedef /* [v1_enum] */ enum IKEEXT_QM_SA_STATE_ { IKEEXT_QM_SA_STATE_NONE = 0, IKEEXT_QM_SA_STATE_INITIAL = ( IKEEXT_QM_SA_STATE_NONE + 1 ) , IKEEXT_QM_SA_STATE_FINAL = ( IKEEXT_QM_SA_STATE_INITIAL + 1 ) , IKEEXT_QM_SA_STATE_COMPLETE = ( IKEEXT_QM_SA_STATE_FINAL + 1 ) , IKEEXT_QM_SA_STATE_MAX = ( IKEEXT_QM_SA_STATE_COMPLETE + 1 ) } IKEEXT_QM_SA_STATE; typedef /* [v1_enum] */ enum IKEEXT_EM_SA_STATE_ { IKEEXT_EM_SA_STATE_NONE = 0, IKEEXT_EM_SA_STATE_SENT_ATTS = ( IKEEXT_EM_SA_STATE_NONE + 1 ) , IKEEXT_EM_SA_STATE_SSPI_SENT = ( IKEEXT_EM_SA_STATE_SENT_ATTS + 1 ) , IKEEXT_EM_SA_STATE_AUTH_COMPLETE = ( IKEEXT_EM_SA_STATE_SSPI_SENT + 1 ) , IKEEXT_EM_SA_STATE_FINAL = ( IKEEXT_EM_SA_STATE_AUTH_COMPLETE + 1 ) , IKEEXT_EM_SA_STATE_COMPLETE = ( IKEEXT_EM_SA_STATE_FINAL + 1 ) , IKEEXT_EM_SA_STATE_MAX = ( IKEEXT_EM_SA_STATE_COMPLETE + 1 ) } IKEEXT_EM_SA_STATE; typedef /* [v1_enum] */ enum IKEEXT_SA_ROLE_ { IKEEXT_SA_ROLE_INITIATOR = 0, IKEEXT_SA_ROLE_RESPONDER = ( IKEEXT_SA_ROLE_INITIATOR + 1 ) , IKEEXT_SA_ROLE_MAX = ( IKEEXT_SA_ROLE_RESPONDER + 1 ) } IKEEXT_SA_ROLE; #if _MSC_VER >= 800 #if _MSC_VER >= 1200 #pragma warning(pop) #else #pragma warning(default:4201) #endif #endif extern RPC_IF_HANDLE __MIDL_itf_iketypes_0000_0000_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_iketypes_0000_0000_v0_0_s_ifspec; /* Additional Prototypes for ALL interfaces */ /* end of Additional Prototypes */ #ifdef __cplusplus } #endif #endif
22,442
C++
.h
606
32.528053
100
0.730658
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,260
object.h
BlackINT3_OpenArk/src/OpenArk/kernel/object/object.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include <windows.h> #include <vector> #include "ui_kernel.h" #include "../kernel.h" #include "../common/common.h" class Ui::Kernel; class Kernel; enum { TAB_KERNEL_OBJECT_TYPES, TAB_KERNEL_OBJECT_SECTIONS, }; PROXY_FILTER(ObjectTypesSortFilterProxyModel); PROXY_FILTER(ObjectSectionsSortFilterProxyModel); class KernelObject : public CommonTabObject { Q_OBJECT public: KernelObject(); ~KernelObject(); public: bool eventFilter(QObject *obj, QEvent *e); void ModuleInit(Ui::Kernel *ui, Kernel *kernel); private slots: void onTabChanged(int index); private: void ShowObjectTypes(); void ShowObjectSections(); void InitObjectTypesView(); void InitObjectSectionsView(); private: Ui::Kernel *ui_; QMenu *objtypes_menu_; QMenu *objsections_menu_; QStandardItemModel *objtypes_model_; QStandardItemModel *objsections_model_; ObjectTypesSortFilterProxyModel *proxy_objtypes_; ObjectSectionsSortFilterProxyModel *proxy_objsections_; };
1,763
C++
.h
53
31.754717
77
0.720493
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,261
wingui.h
BlackINT3_OpenArk/src/OpenArk/kernel/wingui/wingui.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include <windows.h> #include <string> std::string HotkeyVkToString(UINT32 vk, UINT16 mod1, UINT16 mod2);
914
C++
.h
19
47.105263
77
0.644693
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,262
openark.h
BlackINT3_OpenArk/src/OpenArk/openark/openark.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include <QtWidgets/QMainWindow> #include "ui_openark.h" #include "common/config/config.h" class Cmds; class OpenArk : public QMainWindow { Q_OBJECT public: OpenArk(QWidget *parent = Q_NULLPTR); protected: bool eventFilter(QObject *obj, QEvent *e); void changeEvent(QEvent *e); signals: void signalRefresh(); void signalShowPtool(int); public slots: void onLogOutput(QString log); void onExecCmd(const std::wstring &cmdline); void onOpen(QString path); private slots: void onActionOpen(bool checked); void onActionRefresh(bool checked); void onActionReset(bool checked); void onActionOnTop(bool checked); void onActionAbout(bool checked); void onActionSettings(bool checked); void onActionConsole(bool checked); void onActionPtool(bool checked); void onActionManuals(bool checked); void onActionGithub(bool checked); void onActionCoderKit(bool checked); void onActionScanner(bool checked); void onActionBundler(bool checked); void onActionCheckUpdate(bool checked); void onActionLanguage(QAction *act); void onCmdHelp(); void onShowConsoleMenu(const QPoint &pt); void onConsoleClear(); void onConsoleHelps(); void onConsoleHistory(); void onCmdInput(); void onTabChanged(int); public: void StatusBarClear(); void StatusBarAdd(QWidget *label); void SetActiveTab(int idx) const { ui.tabWidget->setCurrentIndex(idx); }; int GetActiveTab() const { return ui.tabWidget->currentIndex(); }; private: Cmds *cmds_; QSize old_window_size_; QPoint old_window_pos_; QTimer *chkupt_timer_; QToolBar *stool_; Ui::OpenArkWindow ui; };
2,377
C++
.h
70
32.257143
77
0.736407
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,263
bundler.h
BlackINT3_OpenArk/src/OpenArk/bundler/bundler.h
#pragma once #include <QtGui> #include <QtCore> #include <QtWidgets> #include <QMutex> #include <Windows.h> #include <mutex> #include "ui_bundler.h" namespace Ui { class Bundler; class OpenArkWindow; } class OpenArk; class Bundler : public QWidget { Q_OBJECT public: Bundler(QWidget *parent); ~Bundler(); protected: bool eventFilter(QObject *obj, QEvent *e); private slots: void dragEnterEvent(QDragEnterEvent *event); void dropEvent(QDropEvent *event); void onRefresh(); void onOpenFolder(); void onSelectIcon(); void onUseIcon(); void onSaveTo(); private: void OpenFolderImpl(QString folder); void SelectIconImpl(QString icon); private: Ui::Bundler ui; OpenArk *parent_; QString files_folder_; QString icon_file_; QMenu *files_menu_; QStandardItemModel *files_model_; };
803
C++
.h
39
18.820513
45
0.778808
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,264
icons.h
BlackINT3_OpenArk/src/OpenArk/bundler/icons/icons.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include <Windows.h> #include <string> #include <vector> #include <algorithm> bool GetIconData(const std::wstring& ExePath, std::string& IconData); bool SetIconData(const std::wstring& ExePath, std::string& IconData);
1,027
C++
.h
22
45.636364
77
0.658367
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,265
crc32.h
BlackINT3_OpenArk/src/OpenArk/bundler/crc32/crc32.h
#pragma once #include <stdint.h> uint32_t crc32(const void *buf, size_t size, uint32_t init_crc = 0);
102
C++
.h
3
33
68
0.727273
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,267
lz4.h
BlackINT3_OpenArk/src/OpenArk/bundler/lz4/lz4.h
/* LZ4 - Fast LZ compression algorithm Header File Copyright (C) 2011-2014, Yann Collet. BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. You can contact the author at : - LZ4 source repository : http://code.google.com/p/lz4/ - LZ4 public forum : https://groups.google.com/forum/#!forum/lz4c */ #pragma once #if defined (__cplusplus) extern "C" { #endif /* * lz4.h provides raw compression format functions, for optimal performance and integration into programs. * If you need to generate data using an inter-operable format (respecting the framing specification), * please use lz4frame.h instead. */ /************************************** Version **************************************/ #define LZ4_VERSION_MAJOR 1 /* for breaking interface changes */ #define LZ4_VERSION_MINOR 5 /* for new (non-breaking) interface capabilities */ #define LZ4_VERSION_RELEASE 0 /* for tweaks, bug-fixes, or development */ #define LZ4_VERSION_NUMBER (LZ4_VERSION_MAJOR *100*100 + LZ4_VERSION_MINOR *100 + LZ4_VERSION_RELEASE) int LZ4_versionNumber (void); /************************************** Tuning parameter **************************************/ /* * LZ4_MEMORY_USAGE : * Memory usage formula : N->2^N Bytes (examples : 10 -> 1KB; 12 -> 4KB ; 16 -> 64KB; 20 -> 1MB; etc.) * Increasing memory usage improves compression ratio * Reduced memory usage can improve speed, due to cache effect * Default value is 14, for 16KB, which nicely fits into Intel x86 L1 cache */ #define LZ4_MEMORY_USAGE 14 /************************************** Simple Functions **************************************/ int LZ4_compress (const char* source, char* dest, int sourceSize); int LZ4_decompress_safe (const char* source, char* dest, int compressedSize, int maxDecompressedSize); /* LZ4_compress() : Compresses 'sourceSize' bytes from 'source' into 'dest'. Destination buffer must be already allocated, and must be sized to handle worst cases situations (input data not compressible) Worst case size evaluation is provided by function LZ4_compressBound() inputSize : Max supported value is LZ4_MAX_INPUT_SIZE return : the number of bytes written in buffer dest or 0 if the compression fails LZ4_decompress_safe() : compressedSize : is obviously the source size maxDecompressedSize : is the size of the destination buffer, which must be already allocated. return : the number of bytes decompressed into the destination buffer (necessarily <= maxDecompressedSize) If the destination buffer is not large enough, decoding will stop and output an error code (<0). If the source stream is detected malformed, the function will stop decoding and return a negative result. This function is protected against buffer overflow exploits, and never writes outside of output buffer, nor reads outside of input buffer. It is also protected against malicious data packets. */ /************************************** Advanced Functions **************************************/ #define LZ4_MAX_INPUT_SIZE 0x7E000000 /* 2 113 929 216 bytes */ #define LZ4_COMPRESSBOUND(isize) ((unsigned int)(isize) > (unsigned int)LZ4_MAX_INPUT_SIZE ? 0 : (isize) + ((isize)/255) + 16) /* LZ4_compressBound() : Provides the maximum size that LZ4 compression may output in a "worst case" scenario (input data not compressible) This function is primarily useful for memory allocation purposes (output buffer size). Macro LZ4_COMPRESSBOUND() is also provided for compilation-time evaluation (stack memory allocation for example). isize : is the input size. Max supported value is LZ4_MAX_INPUT_SIZE return : maximum output size in a "worst case" scenario or 0, if input size is too large ( > LZ4_MAX_INPUT_SIZE) */ int LZ4_compressBound(int isize); /* LZ4_compress_limitedOutput() : Compress 'sourceSize' bytes from 'source' into an output buffer 'dest' of maximum size 'maxOutputSize'. If it cannot achieve it, compression will stop, and result of the function will be zero. This saves time and memory on detecting non-compressible (or barely compressible) data. This function never writes outside of provided output buffer. sourceSize : Max supported value is LZ4_MAX_INPUT_VALUE maxOutputSize : is the size of the destination buffer (which must be already allocated) return : the number of bytes written in buffer 'dest' or 0 if compression fails */ int LZ4_compress_limitedOutput (const char* source, char* dest, int sourceSize, int maxOutputSize); /* LZ4_compress_withState() : Same compression functions, but using an externally allocated memory space to store compression state. Use LZ4_sizeofState() to know how much memory must be allocated, and then, provide it as 'void* state' to compression functions. */ int LZ4_sizeofState(void); int LZ4_compress_withState (void* state, const char* source, char* dest, int inputSize); int LZ4_compress_limitedOutput_withState (void* state, const char* source, char* dest, int inputSize, int maxOutputSize); /* LZ4_decompress_fast() : originalSize : is the original and therefore uncompressed size return : the number of bytes read from the source buffer (in other words, the compressed size) If the source stream is detected malformed, the function will stop decoding and return a negative result. Destination buffer must be already allocated. Its size must be a minimum of 'originalSize' bytes. note : This function fully respect memory boundaries for properly formed compressed data. It is a bit faster than LZ4_decompress_safe(). However, it does not provide any protection against intentionally modified data stream (malicious input). Use this function in trusted environment only (data to decode comes from a trusted source). */ int LZ4_decompress_fast (const char* source, char* dest, int originalSize); /* LZ4_decompress_safe_partial() : This function decompress a compressed block of size 'compressedSize' at position 'source' into destination buffer 'dest' of size 'maxDecompressedSize'. The function tries to stop decompressing operation as soon as 'targetOutputSize' has been reached, reducing decompression time. return : the number of bytes decoded in the destination buffer (necessarily <= maxDecompressedSize) Note : this number can be < 'targetOutputSize' should the compressed block to decode be smaller. Always control how many bytes were decoded. If the source stream is detected malformed, the function will stop decoding and return a negative result. This function never writes outside of output buffer, and never reads outside of input buffer. It is therefore protected against malicious data packets */ int LZ4_decompress_safe_partial (const char* source, char* dest, int compressedSize, int targetOutputSize, int maxDecompressedSize); /*********************************************** Streaming Compression Functions ***********************************************/ #define LZ4_STREAMSIZE_U64 ((1 << (LZ4_MEMORY_USAGE-3)) + 4) #define LZ4_STREAMSIZE (LZ4_STREAMSIZE_U64 * sizeof(long long)) /* * LZ4_stream_t * information structure to track an LZ4 stream. * important : init this structure content before first use ! * note : only allocated directly the structure if you are statically linking LZ4 * If you are using liblz4 as a DLL, please use below construction methods instead. */ typedef struct { long long table[LZ4_STREAMSIZE_U64]; } LZ4_stream_t; /* * LZ4_resetStream * Use this function to init an allocated LZ4_stream_t structure */ void LZ4_resetStream (LZ4_stream_t* LZ4_streamPtr); /* * LZ4_createStream will allocate and initialize an LZ4_stream_t structure * LZ4_freeStream releases its memory. * In the context of a DLL (liblz4), please use these methods rather than the static struct. * They are more future proof, in case of a change of LZ4_stream_t size. */ LZ4_stream_t* LZ4_createStream(void); int LZ4_freeStream (LZ4_stream_t* LZ4_streamPtr); /* * LZ4_loadDict * Use this function to load a static dictionary into LZ4_stream. * Any previous data will be forgotten, only 'dictionary' will remain in memory. * Loading a size of 0 is allowed. * Return : dictionary size, in bytes (necessarily <= 64 KB) */ int LZ4_loadDict (LZ4_stream_t* LZ4_streamPtr, const char* dictionary, int dictSize); /* * LZ4_compress_continue * Compress data block 'source', using blocks compressed before as dictionary to improve compression ratio * Previous data blocks are assumed to still be present at their previous location. */ int LZ4_compress_continue (LZ4_stream_t* LZ4_streamPtr, const char* source, char* dest, int inputSize); /* * LZ4_compress_limitedOutput_continue * Same as before, but also specify a maximum target compressed size (maxOutputSize) * If objective cannot be met, compression exits, and returns a zero. */ int LZ4_compress_limitedOutput_continue (LZ4_stream_t* LZ4_streamPtr, const char* source, char* dest, int inputSize, int maxOutputSize); /* * LZ4_saveDict * If previously compressed data block is not guaranteed to remain available at its memory location * save it into a safer place (char* safeBuffer) * Note : you don't need to call LZ4_loadDict() afterwards, * dictionary is immediately usable, you can therefore call again LZ4_compress_continue() * Return : dictionary size in bytes, or 0 if error * Note : any dictSize > 64 KB will be interpreted as 64KB. */ int LZ4_saveDict (LZ4_stream_t* LZ4_streamPtr, char* safeBuffer, int dictSize); /************************************************ Streaming Decompression Functions ************************************************/ #define LZ4_STREAMDECODESIZE_U64 4 #define LZ4_STREAMDECODESIZE (LZ4_STREAMDECODESIZE_U64 * sizeof(unsigned long long)) typedef struct { unsigned long long table[LZ4_STREAMDECODESIZE_U64]; } LZ4_streamDecode_t; /* * LZ4_streamDecode_t * information structure to track an LZ4 stream. * init this structure content using LZ4_setStreamDecode or memset() before first use ! * * In the context of a DLL (liblz4) please prefer usage of construction methods below. * They are more future proof, in case of a change of LZ4_streamDecode_t size in the future. * LZ4_createStreamDecode will allocate and initialize an LZ4_streamDecode_t structure * LZ4_freeStreamDecode releases its memory. */ LZ4_streamDecode_t* LZ4_createStreamDecode(void); int LZ4_freeStreamDecode (LZ4_streamDecode_t* LZ4_stream); /* * LZ4_setStreamDecode * Use this function to instruct where to find the dictionary. * Setting a size of 0 is allowed (same effect as reset). * Return : 1 if OK, 0 if error */ int LZ4_setStreamDecode (LZ4_streamDecode_t* LZ4_streamDecode, const char* dictionary, int dictSize); /* *_continue() : These decoding functions allow decompression of multiple blocks in "streaming" mode. Previously decoded blocks *must* remain available at the memory position where they were decoded (up to 64 KB) If this condition is not possible, save the relevant part of decoded data into a safe buffer, and indicate where is its new address using LZ4_setStreamDecode() */ int LZ4_decompress_safe_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* source, char* dest, int compressedSize, int maxDecompressedSize); int LZ4_decompress_fast_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* source, char* dest, int originalSize); /* Advanced decoding functions : *_usingDict() : These decoding functions work the same as a combination of LZ4_setDictDecode() followed by LZ4_decompress_x_continue() They are stand-alone and don't use nor update an LZ4_streamDecode_t structure. */ int LZ4_decompress_safe_usingDict (const char* source, char* dest, int compressedSize, int maxDecompressedSize, const char* dictStart, int dictSize); int LZ4_decompress_fast_usingDict (const char* source, char* dest, int originalSize, const char* dictStart, int dictSize); /************************************** Obsolete Functions **************************************/ /* Obsolete decompression functions These function names are deprecated and should no longer be used. They are only provided here for compatibility with older user programs. - LZ4_uncompress is the same as LZ4_decompress_fast - LZ4_uncompress_unknownOutputSize is the same as LZ4_decompress_safe These function prototypes are now disabled; uncomment them if you really need them. It is highly recommended to stop using these functions and migrate to newer ones */ /* int LZ4_uncompress (const char* source, char* dest, int outputSize); */ /* int LZ4_uncompress_unknownOutputSize (const char* source, char* dest, int isize, int maxOutputSize); */ /* Obsolete streaming functions; use new streaming interface whenever possible */ void* LZ4_create (const char* inputBuffer); int LZ4_sizeofStreamState(void); int LZ4_resetStreamState(void* state, const char* inputBuffer); char* LZ4_slideInputBuffer (void* state); /* Obsolete streaming decoding functions */ int LZ4_decompress_safe_withPrefix64k (const char* source, char* dest, int compressedSize, int maxOutputSize); int LZ4_decompress_fast_withPrefix64k (const char* source, char* dest, int originalSize); #if defined (__cplusplus) } #endif
14,890
C++
.h
265
52.984906
163
0.730223
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
16,269
lz4frame_static.h
BlackINT3_OpenArk/src/OpenArk/bundler/lz4/lz4frame_static.h
/* LZ4 auto-framing library Header File for static linking only Copyright (C) 2011-2015, Yann Collet. BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. You can contact the author at : - LZ4 source repository : http://code.google.com/p/lz4/ - LZ4 source mirror : https://github.com/Cyan4973/lz4 - LZ4 public forum : https://groups.google.com/forum/#!forum/lz4c */ #pragma once #if defined (__cplusplus) extern "C" { #endif /* lz4frame_static.h should be used solely in the context of static linking. * */ /************************************** * Error management * ************************************/ #define LZ4F_LIST_ERRORS(ITEM) \ ITEM(OK_NoError) ITEM(ERROR_GENERIC) \ ITEM(ERROR_maxBlockSize_invalid) ITEM(ERROR_blockMode_invalid) ITEM(ERROR_contentChecksumFlag_invalid) \ ITEM(ERROR_compressionLevel_invalid) \ ITEM(ERROR_allocation_failed) \ ITEM(ERROR_srcSize_tooLarge) ITEM(ERROR_dstMaxSize_tooSmall) \ ITEM(ERROR_decompressionFailed) \ ITEM(ERROR_checksum_invalid) \ ITEM(ERROR_maxCode) #define LZ4F_GENERATE_ENUM(ENUM) ENUM, typedef enum { LZ4F_LIST_ERRORS(LZ4F_GENERATE_ENUM) } LZ4F_errorCodes; /* enum is exposed, to handle specific errors; compare function result to -enum value */ /************************************** Includes **************************************/ #include "lz4frame.h" #if defined (__cplusplus) } #endif
2,776
C++
.h
57
44.596491
160
0.713388
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
16,270
lz4frame.h
BlackINT3_OpenArk/src/OpenArk/bundler/lz4/lz4frame.h
/* LZ4 auto-framing library Header File Copyright (C) 2011-2015, Yann Collet. BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. You can contact the author at : - LZ4 source repository : http://code.google.com/p/lz4/ - LZ4 source mirror : https://github.com/Cyan4973/lz4 - LZ4 public forum : https://groups.google.com/forum/#!forum/lz4c */ /* LZ4F is a stand-alone API to create LZ4-compressed frames * fully conformant to specification v1.4.1. * All related operations, including memory management, are handled by the library. * You don't need lz4.h when using lz4frame.h. * */ #pragma once #if defined (__cplusplus) extern "C" { #endif /************************************** Includes **************************************/ #include <stddef.h> /* size_t */ /************************************** * Error management * ************************************/ typedef size_t LZ4F_errorCode_t; unsigned LZ4F_isError(LZ4F_errorCode_t code); const char* LZ4F_getErrorName(LZ4F_errorCode_t code); /* return error code string; useful for debugging */ /************************************** * Frame compression types * ************************************/ typedef enum { LZ4F_default=0, max64KB=4, max256KB=5, max1MB=6, max4MB=7 } blockSizeID_t; typedef enum { blockLinked=0, blockIndependent} blockMode_t; typedef enum { noContentChecksum=0, contentChecksumEnabled } contentChecksum_t; typedef struct { blockSizeID_t blockSizeID; /* max64KB, max256KB, max1MB, max4MB ; 0 == default */ blockMode_t blockMode; /* blockLinked, blockIndependent ; 0 == default */ contentChecksum_t contentChecksumFlag; /* noContentChecksum, contentChecksumEnabled ; 0 == default */ unsigned reserved[5]; } LZ4F_frameInfo_t; typedef struct { LZ4F_frameInfo_t frameInfo; unsigned compressionLevel; /* 0 == default (fast mode); values above 16 count as 16 */ unsigned autoFlush; /* 1 == always flush : reduce need for tmp buffer */ unsigned reserved[4]; } LZ4F_preferences_t; /*********************************** * Simple compression function * *********************************/ size_t LZ4F_compressFrameBound(size_t srcSize, const LZ4F_preferences_t* preferencesPtr); size_t LZ4F_compressFrame(void* dstBuffer, size_t dstMaxSize, const void* srcBuffer, size_t srcSize, const LZ4F_preferences_t* preferencesPtr); /* LZ4F_compressFrame() * Compress an entire srcBuffer into a valid LZ4 frame, as defined by specification v1.4.1. * The most important rule is that dstBuffer MUST be large enough (dstMaxSize) to ensure compression completion even in worst case. * You can get the minimum value of dstMaxSize by using LZ4F_compressFrameBound() * If this condition is not respected, LZ4F_compressFrame() will fail (result is an errorCode) * The LZ4F_preferences_t structure is optional : you can provide NULL as argument. All preferences will be set to default. * The result of the function is the number of bytes written into dstBuffer. * The function outputs an error code if it fails (can be tested using LZ4F_isError()) */ /********************************** * Advanced compression functions * ********************************/ typedef void* LZ4F_compressionContext_t; typedef struct { unsigned stableSrc; /* 1 == src content will remain available on future calls to LZ4F_compress(); avoid saving src content within tmp buffer as future dictionary */ unsigned reserved[3]; } LZ4F_compressOptions_t; /* Resource Management */ #define LZ4F_VERSION 100 LZ4F_errorCode_t LZ4F_createCompressionContext(LZ4F_compressionContext_t* LZ4F_compressionContextPtr, unsigned version); LZ4F_errorCode_t LZ4F_freeCompressionContext(LZ4F_compressionContext_t LZ4F_compressionContext); /* LZ4F_createCompressionContext() : * The first thing to do is to create a compressionContext object, which will be used in all compression operations. * This is achieved using LZ4F_createCompressionContext(), which takes as argument a version and an LZ4F_preferences_t structure. * The version provided MUST be LZ4F_VERSION. It is intended to track potential version differences between different binaries. * The function will provide a pointer to a fully allocated LZ4F_compressionContext_t object. * If the result LZ4F_errorCode_t is not zero, there was an error during context creation. * Object can release its memory using LZ4F_freeCompressionContext(); */ /* Compression */ size_t LZ4F_compressBegin(LZ4F_compressionContext_t compressionContext, void* dstBuffer, size_t dstMaxSize, const LZ4F_preferences_t* preferencesPtr); /* LZ4F_compressBegin() : * will write the frame header into dstBuffer. * dstBuffer must be large enough to accommodate a header (dstMaxSize). Maximum header size is 19 bytes. * The LZ4F_preferences_t structure is optional : you can provide NULL as argument, all preferences will then be set to default. * The result of the function is the number of bytes written into dstBuffer for the header * or an error code (can be tested using LZ4F_isError()) */ size_t LZ4F_compressBound(size_t srcSize, const LZ4F_preferences_t* preferencesPtr); /* LZ4F_compressBound() : * Provides the minimum size of Dst buffer given srcSize to handle worst case situations. * preferencesPtr is optional : you can provide NULL as argument, all preferences will then be set to default. * Note that different preferences will produce in different results. */ size_t LZ4F_compressUpdate(LZ4F_compressionContext_t compressionContext, void* dstBuffer, size_t dstMaxSize, const void* srcBuffer, size_t srcSize, const LZ4F_compressOptions_t* compressOptionsPtr); /* LZ4F_compressUpdate() * LZ4F_compressUpdate() can be called repetitively to compress as much data as necessary. * The most important rule is that dstBuffer MUST be large enough (dstMaxSize) to ensure compression completion even in worst case. * If this condition is not respected, LZ4F_compress() will fail (result is an errorCode) * You can get the minimum value of dstMaxSize by using LZ4F_compressBound() * The LZ4F_compressOptions_t structure is optional : you can provide NULL as argument. * The result of the function is the number of bytes written into dstBuffer : it can be zero, meaning input data was just buffered. * The function outputs an error code if it fails (can be tested using LZ4F_isError()) */ size_t LZ4F_flush(LZ4F_compressionContext_t compressionContext, void* dstBuffer, size_t dstMaxSize, const LZ4F_compressOptions_t* compressOptionsPtr); /* LZ4F_flush() * Should you need to create compressed data immediately, without waiting for a block to be filled, * you can call LZ4_flush(), which will immediately compress any remaining data buffered within compressionContext. * The LZ4F_compressOptions_t structure is optional : you can provide NULL as argument. * The result of the function is the number of bytes written into dstBuffer * (it can be zero, this means there was no data left within compressionContext) * The function outputs an error code if it fails (can be tested using LZ4F_isError()) */ size_t LZ4F_compressEnd(LZ4F_compressionContext_t compressionContext, void* dstBuffer, size_t dstMaxSize, const LZ4F_compressOptions_t* compressOptionsPtr); /* LZ4F_compressEnd() * When you want to properly finish the compressed frame, just call LZ4F_compressEnd(). * It will flush whatever data remained within compressionContext (like LZ4_flush()) * but also properly finalize the frame, with an endMark and a checksum. * The result of the function is the number of bytes written into dstBuffer (necessarily >= 4 (endMark size)) * The function outputs an error code if it fails (can be tested using LZ4F_isError()) * The LZ4F_compressOptions_t structure is optional : you can provide NULL as argument. * compressionContext can then be used again, starting with LZ4F_compressBegin(). */ /*********************************** * Decompression functions * *********************************/ typedef void* LZ4F_decompressionContext_t; typedef struct { unsigned stableDst; /* guarantee that decompressed data will still be there on next function calls (avoid storage into tmp buffers) */ unsigned reserved[3]; } LZ4F_decompressOptions_t; /* Resource management */ LZ4F_errorCode_t LZ4F_createDecompressionContext(LZ4F_decompressionContext_t* ctxPtr, unsigned version); LZ4F_errorCode_t LZ4F_freeDecompressionContext(LZ4F_decompressionContext_t ctx); /* LZ4F_createDecompressionContext() : * The first thing to do is to create a decompressionContext object, which will be used in all decompression operations. * This is achieved using LZ4F_createDecompressionContext(). * The version provided MUST be LZ4F_VERSION. It is intended to track potential version differences between different binaries. * The function will provide a pointer to a fully allocated and initialized LZ4F_decompressionContext_t object. * If the result LZ4F_errorCode_t is not OK_NoError, there was an error during context creation. * Object can release its memory using LZ4F_freeDecompressionContext(); */ /* Decompression */ size_t LZ4F_getFrameInfo(LZ4F_decompressionContext_t ctx, LZ4F_frameInfo_t* frameInfoPtr, const void* srcBuffer, size_t* srcSizePtr); /* LZ4F_getFrameInfo() * This function decodes frame header information, such as blockSize. * It is optional : you could start by calling directly LZ4F_decompress() instead. * The objective is to extract header information without starting decompression, typically for allocation purposes. * LZ4F_getFrameInfo() can also be used *after* starting decompression, on a valid LZ4F_decompressionContext_t. * The number of bytes read from srcBuffer will be provided within *srcSizePtr (necessarily <= original value). * You are expected to resume decompression from where it stopped (srcBuffer + *srcSizePtr) * The function result is an hint of how many srcSize bytes LZ4F_decompress() expects for next call, * or an error code which can be tested using LZ4F_isError(). */ size_t LZ4F_decompress(LZ4F_decompressionContext_t ctx, void* dstBuffer, size_t* dstSizePtr, const void* srcBuffer, size_t* srcSizePtr, const LZ4F_decompressOptions_t* optionsPtr); /* LZ4F_decompress() * Call this function repetitively to regenerate data compressed within srcBuffer. * The function will attempt to decode *srcSizePtr bytes from srcBuffer, into dstBuffer of maximum size *dstSizePtr. * * The number of bytes regenerated into dstBuffer will be provided within *dstSizePtr (necessarily <= original value). * * The number of bytes read from srcBuffer will be provided within *srcSizePtr (necessarily <= original value). * If number of bytes read is < number of bytes provided, then decompression operation is not completed. * It typically happens when dstBuffer is not large enough to contain all decoded data. * LZ4F_decompress() must be called again, starting from where it stopped (srcBuffer + *srcSizePtr) * The function will check this condition, and refuse to continue if it is not respected. * * dstBuffer is supposed to be flushed between each call to the function, since its content will be overwritten. * dst arguments can be changed at will with each consecutive call to the function. * * The function result is an hint of how many srcSize bytes LZ4F_decompress() expects for next call. * Schematically, it's the size of the current (or remaining) compressed block + header of next block. * Respecting the hint provides some boost to performance, since it does skip intermediate buffers. * This is just a hint, you can always provide any srcSize you want. * When a frame is fully decoded, the function result will be 0. (no more data expected) * If decompression failed, function result is an error code, which can be tested using LZ4F_isError(). */ #if defined (__cplusplus) } #endif
13,377
C++
.h
207
61.777778
198
0.747657
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,271
lz4hc.h
BlackINT3_OpenArk/src/OpenArk/bundler/lz4/lz4hc.h
/* LZ4 HC - High Compression Mode of LZ4 Header File Copyright (C) 2011-2014, Yann Collet. BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. You can contact the author at : - LZ4 homepage : http://fastcompression.blogspot.com/p/lz4.html - LZ4 source repository : http://code.google.com/p/lz4/ */ #pragma once #if defined (__cplusplus) extern "C" { #endif int LZ4_compressHC (const char* source, char* dest, int inputSize); /* LZ4_compressHC : return : the number of bytes in compressed buffer dest or 0 if compression fails. note : destination buffer must be already allocated. To avoid any problem, size it to handle worst cases situations (input data not compressible) Worst case size evaluation is provided by function LZ4_compressBound() (see "lz4.h") */ int LZ4_compressHC_limitedOutput (const char* source, char* dest, int inputSize, int maxOutputSize); /* LZ4_compress_limitedOutput() : Compress 'inputSize' bytes from 'source' into an output buffer 'dest' of maximum size 'maxOutputSize'. If it cannot achieve it, compression will stop, and result of the function will be zero. This function never writes outside of provided output buffer. inputSize : Max supported value is 1 GB maxOutputSize : is maximum allowed size into the destination buffer (which must be already allocated) return : the number of output bytes written in buffer 'dest' or 0 if compression fails. */ int LZ4_compressHC2 (const char* source, char* dest, int inputSize, int compressionLevel); int LZ4_compressHC2_limitedOutput (const char* source, char* dest, int inputSize, int maxOutputSize, int compressionLevel); /* Same functions as above, but with programmable 'compressionLevel'. Recommended values are between 4 and 9, although any value between 0 and 16 will work. 'compressionLevel'==0 means use default 'compressionLevel' value. Values above 16 behave the same as 16. Equivalent variants exist for all other compression functions below. */ /* Note : Decompression functions are provided within LZ4 source code (see "lz4.h") (BSD license) */ /************************************** Using an external allocation **************************************/ int LZ4_sizeofStateHC(void); int LZ4_compressHC_withStateHC (void* state, const char* source, char* dest, int inputSize); int LZ4_compressHC_limitedOutput_withStateHC (void* state, const char* source, char* dest, int inputSize, int maxOutputSize); int LZ4_compressHC2_withStateHC (void* state, const char* source, char* dest, int inputSize, int compressionLevel); int LZ4_compressHC2_limitedOutput_withStateHC(void* state, const char* source, char* dest, int inputSize, int maxOutputSize, int compressionLevel); /* These functions are provided should you prefer to allocate memory for compression tables with your own allocation methods. To know how much memory must be allocated for the compression tables, use : int LZ4_sizeofStateHC(); Note that tables must be aligned for pointer (32 or 64 bits), otherwise compression will fail (return code 0). The allocated memory can be provided to the compression functions using 'void* state' parameter. LZ4_compress_withStateHC() and LZ4_compress_limitedOutput_withStateHC() are equivalent to previously described functions. They just use the externally allocated memory for state instead of allocating their own (on stack, or on heap). */ /************************************** Experimental Streaming Functions **************************************/ #define LZ4_STREAMHCSIZE_U64 32774 #define LZ4_STREAMHCSIZE (LZ4_STREAMHCSIZE_U64 * sizeof(unsigned long long)) typedef struct { unsigned long long table[LZ4_STREAMHCSIZE_U64]; } LZ4_streamHC_t; /* LZ4_streamHC_t This structure allows static allocation of LZ4 HC streaming state. State must then be initialized using LZ4_resetStreamHC() before first use. Static allocation should only be used with statically linked library. If you want to use LZ4 as a DLL, please use construction functions below, which are more future-proof. */ LZ4_streamHC_t* LZ4_createStreamHC(void); int LZ4_freeStreamHC (LZ4_streamHC_t* LZ4_streamHCPtr); /* These functions create and release memory for LZ4 HC streaming state. Newly created states are already initialized. Existing state space can be re-used anytime using LZ4_resetStreamHC(). If you use LZ4 as a DLL, please use these functions instead of direct struct allocation, to avoid size mismatch between different versions. */ void LZ4_resetStreamHC (LZ4_streamHC_t* LZ4_streamHCPtr, int compressionLevel); int LZ4_loadDictHC (LZ4_streamHC_t* LZ4_streamHCPtr, const char* dictionary, int dictSize); int LZ4_compressHC_continue (LZ4_streamHC_t* LZ4_streamHCPtr, const char* source, char* dest, int inputSize); int LZ4_compressHC_limitedOutput_continue (LZ4_streamHC_t* LZ4_streamHCPtr, const char* source, char* dest, int inputSize, int maxOutputSize); int LZ4_saveDictHC (LZ4_streamHC_t* LZ4_streamHCPtr, char* safeBuffer, int maxDictSize); /* These functions compress data in successive blocks of any size, using previous blocks as dictionary. One key assumption is that each previous block will remain read-accessible while compressing next block. Before starting compression, state must be properly initialized, using LZ4_resetStreamHC(). A first "fictional block" can then be designated as initial dictionary, using LZ4_loadDictHC() (Optional). Then, use LZ4_compressHC_continue() or LZ4_compressHC_limitedOutput_continue() to compress each successive block. They work like usual LZ4_compressHC() or LZ4_compressHC_limitedOutput(), but use previous memory blocks to improve compression. Previous memory blocks (including initial dictionary when present) must remain accessible and unmodified during compression. If, for any reason, previous data block can't be preserved in memory during next compression block, you must save it to a safer memory space, using LZ4_saveDictHC(). */ /************************************** * Deprecated Streaming Functions * ************************************/ /* Note : these streaming functions follows the older model, and should no longer be used */ void* LZ4_createHC (const char* inputBuffer); char* LZ4_slideInputBufferHC (void* LZ4HC_Data); int LZ4_freeHC (void* LZ4HC_Data); int LZ4_compressHC2_continue (void* LZ4HC_Data, const char* source, char* dest, int inputSize, int compressionLevel); int LZ4_compressHC2_limitedOutput_continue (void* LZ4HC_Data, const char* source, char* dest, int inputSize, int maxOutputSize, int compressionLevel); int LZ4_sizeofStreamStateHC(void); int LZ4_resetStreamStateHC(void* state, const char* inputBuffer); #if defined (__cplusplus) } #endif
8,140
C++
.h
135
57.57037
152
0.759854
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
16,272
pack.h
BlackINT3_OpenArk/src/OpenArk/bundler/pack/pack.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include <Windows.h> #include <stdint.h> #include <string> #include <vector> #define IDX_BUDE 108 #define IDS_BUDE L"IDR_BUDE" enum BundleError { BERR_OK = 0, BERR_INVALID_FILEMAGIC, BERR_INVALID_HEADER, BERR_INVALID_COMPRESS, BERR_INVALID_SCRIPTCOUNT, BERR_INVALID_RECORDCOUNT, BERR_INVALID_RECORDSIZE, BERR_INVALID_RECORDCRC32, BERR_FAIL_COMPRESSED, BERR_FAIL_DECOMPRESSED, BERR_FAIL_OPEN, BERR_FAIL_READ, BERR_FAIL_WRITE, BERR_FAIL_CREATEDIR, BERR_FAIL_CREATEFILE, }; BundleError BundlePack(const std::wstring &dirname, std::vector<std::wstring> &files, std::vector<std::wstring> &names, std::wstring script, std::string &bdata); BundleError BundleUnpack(const std::wstring &outdir, const char *bdata, std::wstring &script, std::wstring &dirname); BundleError BundleGetDirName(const char *bdata, std::wstring &dirname);
1,651
C++
.h
43
36.930233
117
0.706359
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,274
kobject.h
BlackINT3_OpenArk/src/OpenArkDrv/kobject/kobject.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include <ntifs.h> #include <arkdrv-api/arkdrv-api.h> NTSTATUS ObjectDispatcher(IN ULONG op, IN PDEVICE_OBJECT devobj, PVOID inbuf, ULONG inlen, PVOID outbuf, ULONG outlen, IN PIRP irp);
996
C++
.h
19
51.368421
132
0.655738
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,275
kstorage.h
BlackINT3_OpenArk/src/OpenArkDrv/kstorage/kstorage.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include <ntifs.h> #include <arkdrv-api/arkdrv-api.h> NTSTATUS StorageDispatcher(IN ULONG op, IN PDEVICE_OBJECT devobj, IN PIRP irp);
943
C++
.h
19
48.578947
79
0.648971
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,276
handle.h
BlackINT3_OpenArk/src/OpenArkDrv/kstorage/unlock/handle.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include <ntifs.h> typedef struct _SYSTEM_HANDLE_TABLE_ENTRY_INFO { USHORT UniqueProcessId; USHORT CreatorBackTraceIndex; UCHAR ObjectTypeIndex; UCHAR HandleAttributes; USHORT HandleValue; PVOID Object; ULONG GrantedAccess; } SYSTEM_HANDLE_TABLE_ENTRY_INFO, *PSYSTEM_HANDLE_TABLE_ENTRY_INFO; typedef struct _SYSTEM_HANDLE_INFORMATION { HANDLE NumberOfHandles;//32ÊÇulong 64ÊÇLONGLONG SYSTEM_HANDLE_TABLE_ENTRY_INFO Handles[1]; } SYSTEM_HANDLE_INFORMATION, *PSYSTEM_HANDLE_INFORMATION; /* typedef enum _OBJECT_INFORMATION_CLASS { ObjectBasicInformation, ObjectNameInformation, ObjectTypeInformation, ObjectAllInformation, ObjectDataInformation }OBJECT_INFORMATION_CLASS, *POBJECT_INFORMATION_CLASS; */ typedef struct _OBJECT_BASIC_INFORMATION { ULONG Attributes; ACCESS_MASK DesiredAccess; ULONG HandleCount; ULONG ReferenceCount; ULONG PagedPoolUsage; ULONG NonPagedPoolUsage; ULONG Reserved[3]; ULONG NameInformationLength; ULONG TypeInformationLength; ULONG SecurityDescriptorLength; LARGE_INTEGER CreationTime; } OBJECT_BASIC_INFORMATION, *POBJECT_BASIC_INFORMATION; /* typedef struct _OBJECT_NAME_INFORMATION { UNICODE_STRING Name; WCHAR NameBuffer[0]; } OBJECT_NAME_INFORMATION, *POBJECT_NAME_INFORMATION; */ /* typedef struct _OBJECT_TYPE_INFORMATION { UNICODE_STRING TypeName; ULONG TotalNumberOfHandles; ULONG TotalNumberOfObjects; WCHAR Unused1[8]; ULONG HighWaterNumberOfHandles; ULONG HighWaterNumberOfObjects; WCHAR Unused2[8]; ACCESS_MASK InvalidAttributes; GENERIC_MAPPING GenericMapping; ACCESS_MASK ValidAttributes; BOOLEAN SecurityRequired; BOOLEAN MaintainHandleCount; USHORT MaintainTypeList; POOL_TYPE PoolType; ULONG DefaultPagedPoolCharge; ULONG DefaultNonPagedPoolCharge; } OBJECT_TYPE_INFORMATION, *POBJECT_TYPE_INFORMATION; */ typedef struct _OBJECT_HANDLE_FLAG_INFORMATION { BOOLEAN Inherit; BOOLEAN ProtectFromClose; }OBJECT_HANDLE_FLAG_INFORMATION, *POBJECT_HANDLE_FLAG_INFORMATION; EXTERN_C NTSTATUS NTAPI ObSetHandleAttributes(HANDLE Handle, POBJECT_HANDLE_FLAG_INFORMATION HandleFlags, KPROCESSOR_MODE PreviousMode); BOOLEAN ForceCloseHandle(HANDLE pid, HANDLE handle); NTSTATUS EnumHandleInfoByPid(LPVOID buf, ULONG len, HANDLE pid); NTSTATUS StorageUnlockEnum(PVOID inbuf, ULONG inlen, PVOID outbuf, ULONG outlen, PIRP irp); NTSTATUS StorageUnlockClose(PVOID inbuf, ULONG inlen, PVOID outbuf, ULONG outlen, PIRP irp);
3,673
C++
.h
87
40.597701
137
0.68577
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,277
kdriver.h
BlackINT3_OpenArk/src/OpenArkDrv/kdriver/kdriver.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include <ntifs.h> typedef enum _SYSTEM_INFORMATION_CLASS { SystemBasicInformation, SystemProcessorInformation, SystemPerformanceInformation, SystemTimeOfDayInformation, SystemNotImplemented1, SystemProcessesAndThreadsInformation, SystemCallCounts, SystemConfigurationInformation, SystemProcessorTimes, SystemGlobalFlag, SystemNotImplemented2, SystemModuleInformation, SystemLockInformation, SystemNotImplemented3, SystemNotImplemented4, SystemNotImplemented5, SystemHandleInformation, SystemObjectInformation, SystemPagefileInformation, SystemInstructionEmulationCounts, SystemInvalidInfoClass1, SystemCacheInformation, SystemPoolTagInformation, SystemProcessorStatistics, SystemDpcInformation, SystemNotImplemented6, SystemLoadImage, SystemUnloadImage, SystemTimeAdjustment, SystemNotImplemented7, SystemNotImplemented8, SystemNotImplemented9, SystemCrashDumpInformation, SystemExceptionInformation, SystemCrashDumpStateInformation, SystemKernelDebuggerInformation, SystemContextSwitchInformation, SystemRegistryQuotaInformation, SystemLoadAndCallImage, SystemPrioritySeparation, SystemNotImplemented10, SystemNotImplemented11, SystemInvalidInfoClass2, SystemInvalidInfoClass3, SystemTimeZoneInformation, SystemLookasideInformation, SystemSetTimeSlipEvent, SystemCreateSession, SystemDeleteSession, SystemInvalidInfoClass4, SystemRangeStartInformation, SystemVerifierInformation, SystemAddVerifier, SystemSessionProcessesInformation } SYSTEM_INFORMATION_CLASS; typedef struct _RTL_PROCESS_MODULE_INFORMATION { HANDLE Section; // Not filled in PVOID MappedBase; PVOID ImageBase; ULONG ImageSize; ULONG Flags; USHORT LoadOrderIndex; USHORT InitOrderIndex; USHORT LoadCount; USHORT OffsetToFileName; UCHAR FullPathName[256]; } RTL_PROCESS_MODULE_INFORMATION, *PRTL_PROCESS_MODULE_INFORMATION; typedef struct _RTL_PROCESS_MODULES { ULONG NumberOfModules; RTL_PROCESS_MODULE_INFORMATION Modules[1]; } RTL_PROCESS_MODULES, *PRTL_PROCESS_MODULES; EXTERN_C NTSTATUS NTAPI ZwQuerySystemInformation( __in SYSTEM_INFORMATION_CLASS SystemInformationClass, __out_bcount_opt(SystemInformationLength) PVOID SystemInformation, __in ULONG SystemInformationLength, __out_opt PULONG ReturnLength ); BOOLEAN InitDriverDispatcher(); NTSTATUS DriverDispatcher(IN ULONG op, IN PDEVICE_OBJECT devobj, IN PIRP irp);
3,192
C++
.h
98
30.816327
78
0.812682
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,278
c-assist.h
BlackINT3_OpenArk/src/OpenArkDrv/common/c-assist.h
#pragma once #include <ntifs.h> EXTERN_C VOID MmEnableWP(); EXTERN_C VOID MmDisableWP(); EXTERN_C VOID MmWriteProtectOn(IN KIRQL Irql); EXTERN_C KIRQL MmWriteProtectOff();
172
C++
.h
6
27.666667
46
0.801205
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,279
common.h
BlackINT3_OpenArk/src/OpenArkDrv/common/common.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include <knone.h> #include <ntifs.h> #define ARK_POOLTAG 'OARK' typedef struct _ARK_DRIVER { PDRIVER_OBJECT drvobj; PDEVICE_OBJECT devobj; ULONG ver; ULONG major; ULONG minor; ULONG build; PVOID process_notify; PVOID thread_notify; PVOID image_notify; PVOID registry_notify; } ARK_DRIVER, *PARK_DRIVER; extern ARK_DRIVER ArkDrv; typedef enum { _NTOS_UNKNOWN, _NTOS_WINXP, _NTOS_WINXPSP1, _NTOS_WINXPSP2, _NTOS_WINXPSP3, _NTOS_WIN2003, _NTOS_WIN2003SP1, _NTOS_WIN2003SP2, _NTOS_WINVISTA, _NTOS_WINVISTASP1, _NTOS_WINVISTASP2, _NTOS_WIN7, _NTOS_WIN7SP1, _NTOS_WIN8, _NTOS_WIN81, _NTOS_WIN10_1507, //10240 _NTOS_WIN10_1511, //10586 _NTOS_WIN10_1607, //14393 _NTOS_WIN10_1703, //15063 _NTOS_WIN10_1709, //16299 _NTOS_WIN10_1803, //17134 _NTOS_WIN10_1809, //17763 _NTOS_WIN10_1903, //18362 _NTOS_WIN10_1909, //18363 _NTOS_WIN10_2004, //19041 _NTOS_WIN10_20H2, //19042 _NTOS_WIN10_21H1, //19043 _NTOS_WIN10_21H2, //19044 _NTOS_WIN11_21H2, //22000 } NTOS_VERSION_X, *PNTOS_VERSION_X; BOOLEAN InitArkDriver(PDRIVER_OBJECT drvobj, PDEVICE_OBJECT devobj); PVOID GetNtRoutineAddress(IN PCWSTR name); NTSTATUS DuplicateInputBuffer(IN PIRP irp, PVOID &inbuf); NTSTATUS ReleaseInputBuffer(IN PIRP irp, PVOID &inbuf);
2,058
C++
.h
67
29.029851
77
0.704133
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,280
ops-hotkey.h
BlackINT3_OpenArk/src/OpenArkDrv/kwingui/ops-hotkey/ops-hotkey.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include <ntifs.h> #include "../../arkdrv-api/arkdrv-api.h" NTSTATUS HotkeyDispatcher(IN ULONG op, IN PDEVICE_OBJECT devobj, IN PIRP irp);
948
C++
.h
19
48.842105
78
0.644397
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,281
utils.h
BlackINT3_OpenArk/src/OpenArkDrv/kwingui/ops-hotkey/utils/utils.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include <ntifs.h> #include <windef.h> extern "C" { typedef BOOLEAN(NTAPI* __NtUserRegisterHotKey)(HWND hWnd, int id, UINT fsModifiers, UINT vk); typedef BOOLEAN(NTAPI* __NtUserUnregisterHotKey)(HWND hWnd, int id); } NTSTATUS GetSectionRegion(PUCHAR base, CHAR* name, PUCHAR& start, ULONG& size); PVOID GetSystemModuleBase(IN char* modname, OUT PULONG imagesize); BOOLEAN OsGetVersionInfo(IN OUT RTL_OSVERSIONINFOEXW& info);
1,238
C++
.h
25
48.32
94
0.681818
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,282
notify-lib.h
BlackINT3_OpenArk/src/OpenArkDrv/knotify/notify-lib.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include <ntifs.h> BOOLEAN GetProcessNotifyInfo(ULONG &count, PULONG64 &items); BOOLEAN RemoveProcessNotify(ULONG64 routine); BOOLEAN GetThreadNotifyInfo(ULONG &count, PULONG64 &items); BOOLEAN RemoveThreadNotify(ULONG64 routine); BOOLEAN GetImageNotifyInfo(ULONG &count, PULONG64 &items); BOOLEAN RemoveImageNotify(ULONG64 routine); BOOLEAN GetRegistryNotifyInfo(ULONG &count, PULONG64 &items); BOOLEAN RemoveRegistryNotify(ULONG64 routine);
1,254
C++
.h
25
49.04
77
0.705546
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,283
knotify.h
BlackINT3_OpenArk/src/OpenArkDrv/knotify/knotify.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include <ntifs.h> #include "../arkdrv-api/arkdrv-api.h" BOOLEAN InitNotifyDispatcher(); NTSTATUS NotifyDispatcher(IN ULONG op, IN PDEVICE_OBJECT devobj, IN PIRP irp);
976
C++
.h
20
47.8
78
0.653766
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,284
kmemory.h
BlackINT3_OpenArk/src/OpenArkDrv/kmemory/kmemory.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include <ntifs.h> NTSTATUS MemoryDispatcher(IN ULONG op, IN PDEVICE_OBJECT devobj, PVOID inbuf, ULONG inlen, PVOID outbuf, ULONG outlen, IN PIRP irp);
959
C++
.h
18
52.333333
132
0.651805
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,285
kprocess.h
BlackINT3_OpenArk/src/OpenArkDrv/kprocess/kprocess.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include <ntifs.h> #include <arkdrv-api/arkdrv-api.h> NTSTATUS ProcessDispatcher(IN ULONG op, IN PDEVICE_OBJECT devobj, PVOID inbuf, ULONG inlen, PVOID outbuf, ULONG outlen, IN PIRP irp);
997
C++
.h
19
51.421053
133
0.65609
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,286
arkdrv-api.h
BlackINT3_OpenArk/src/OpenArkDrv/arkdrv-api/arkdrv-api.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #ifdef _ARKDRV_ #include <ntifs.h> #include <windef.h> #else #include <Windows.h> #include <common/app/app.h> #endif //_NTDDK_ #include "api-storage/api-storage.h" #include "api-memory/api-memory.h" #include "api-wingui/api-wingui.h" #include "api-driver/api-driver.h" #include "api-notify/api-notify.h" #include "api-object/api-object.h" #include "api-process/api-process.h" #include "api-network/api-network.h" #define ARK_NTDEVICE_NAME L"\\Device\\OpenArkDrv" #define ARK_DOSDEVICE_NAME L"\\DosDevices\\OpenArkDrv" #define ARK_USER_SYMBOLINK L"\\\\.\\OpenArkDrv" #define ARK_DRV_TYPE 41827 #define IOCTL_ARK_HEARTBEAT CTL_CODE(ARK_DRV_TYPE, 0x800, METHOD_BUFFERED, FILE_ANY_ACCESS) #define IOCTL_ARK_DRIVER CTL_CODE(ARK_DRV_TYPE, 0x801, METHOD_BUFFERED, FILE_ANY_ACCESS) #define IOCTL_ARK_NOTIFY CTL_CODE(ARK_DRV_TYPE, 0x802, METHOD_BUFFERED, FILE_ANY_ACCESS) #define IOCTL_ARK_MEMORY CTL_CODE(ARK_DRV_TYPE, 0x803, METHOD_BUFFERED, FILE_ANY_ACCESS) #define IOCTL_ARK_HOTKEY CTL_CODE(ARK_DRV_TYPE, 0x900, METHOD_BUFFERED, FILE_ANY_ACCESS) #define IOCTL_ARK_STORAGE CTL_CODE(ARK_DRV_TYPE, 0x920, METHOD_BUFFERED, FILE_ANY_ACCESS) #define IOCTL_ARK_OBJECT CTL_CODE(ARK_DRV_TYPE, 0x940, METHOD_BUFFERED, FILE_ANY_ACCESS) #define IOCTL_ARK_PROCESS CTL_CODE(ARK_DRV_TYPE, 0x960, METHOD_BUFFERED, FILE_ANY_ACCESS) //#undef _ARKDRV_ #ifdef _ARKDRV_ #include <ntifs.h> #else #include <unone.h> #include <string> #include <vector> namespace ArkDrvApi { extern HANDLE arkdrv; bool ConnectDriver(); bool DisconnectDriver(); bool HeartBeatPulse(); bool IoControlDriver(DWORD ctlcode, DWORD op, PVOID inbuf, DWORD inlen, PVOID *outbuf, DWORD *outlen); bool IoControlDriver(DWORD ctlcode, DWORD op, const std::wstring &indata, std::string &outdata); bool IoControlDriver(DWORD ctlcode, DWORD op, const std::string &indata, std::string &outdata); #define TO_STREAM(st) std::string((char*)&st, sizeof(st)) #define TO_STREAM_P(pst, size) std::string((char*)pst, size) #define TO_STRUCT(str, type) ((type)str.c_str()) } // namespace ArkDrvApi #endif //_NTDDK_
2,858
C++
.h
63
44.269841
102
0.727142
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,287
api-notify.h
BlackINT3_OpenArk/src/OpenArkDrv/arkdrv-api/api-notify/api-notify.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include "../arkdrv-api.h" #ifdef _ARKDRV_ #include <ntifs.h> #include <windef.h> #else #include <Windows.h> #endif //_NTDDK_ // Notify enum NOTIFY_OPS { NOTIFY_PATCH, NOTIFY_PATCH_REGULARLY, NOTIFY_REMOVE, NOTIFY_REMOVE_REGULARLY, NOTIFY_ENUM_PROCESS, NOTIFY_ENUM_THREAD, NOTIFY_ENUM_IMAGE, NOTIFY_ENUM_REGISTRY, }; enum NOTIFY_TYPE { CREATE_PROCESS, CREATE_THREAD, LOAD_IMAGE, CM_REGISTRY, }; #pragma pack(push, 1) typedef struct _NOTIFY_INFO { ULONG count; NOTIFY_TYPE type; ULONG64 items[1]; } NOTIFY_INFO, *PNOTIFY_INFO; typedef struct _NOTIFY_REMOVE_INFO { NOTIFY_TYPE type; ULONG64 item; } NOTIFY_REMOVE_INFO, *PNOTIFY_REMOVE_INFO; #pragma pack(pop) //#undef _ARKDRV_ #ifdef _ARKDRV_ #include <ntifs.h> #else #include <unone.h> #include <string> #include <vector> namespace ArkDrvApi { namespace Notify { bool NotifyPatch(NOTIFY_TYPE type, ULONG64 routine); bool NotifyPatchRegularly(NOTIFY_TYPE type, ULONG64 routine, int interval); bool NotifyRemove(NOTIFY_TYPE type, ULONG64 routine); bool NotifyRemoveRegularly(NOTIFY_TYPE type, ULONG64 routine, int interval); bool NotifyEnumProcess(std::vector<ULONG64> &routines); bool NotifyEnumThread(std::vector<ULONG64> &routines); bool NotifyEnumImage(std::vector<ULONG64> &routines); bool NotifyEnumRegistry(std::vector<ULONG64> &routines); } // namespace Notify } // namespace ArkDrvApi #endif //_NTDDK_
2,192
C++
.h
71
29.507042
77
0.721226
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,288
api-memory.h
BlackINT3_OpenArk/src/OpenArkDrv/arkdrv-api/api-memory/api-memory.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #define ARK_HEADER_SIZE(st) (sizeof(st) - sizeof(UCHAR)) #include "../arkdrv-api.h" #ifdef _ARKDRV_ #include <ntifs.h> #include <windef.h> #else #include <Windows.h> #endif //_NTDDK_ // Memory enum ARK_MEMORY_OPS { ARK_MEMORY_READ, ARK_MEMORY_WRITE, }; #pragma pack(push, 1) typedef struct _ARK_MEMORY_IN { ULONG pid; ULONG64 addr; ULONG size; union { UCHAR dummy[1]; UCHAR writebuf[1]; } u; } ARK_MEMORY_IN, *PARK_MEMORY_IN; typedef struct _ARK_MEMORY_OUT { ULONG pid; ULONG size; UCHAR readbuf[1]; } ARK_MEMORY_OUT, *PARK_MEMORY_OUT; typedef struct _ARK_MEMORY_RANGE { ULONG64 r3start; ULONG64 r3end; ULONG64 r0start; ULONG64 r0end; } ARK_MEMORY_RANGE, *PARK_MEMORY_RANGE; #pragma pack(pop) //#undef _ARKDRV_ #ifdef _ARKDRV_ #include <ntifs.h> #else #include <unone.h> #include <string> #include <vector> namespace ArkDrvApi { namespace Memory { ARK_MEMORY_RANGE MemoryRange(); bool IsKernelAddress(ULONG64 addr); bool MemoryRead(ULONG pid, ULONG64 addr, ULONG size, std::string &readbuf); bool MemoryWrite(ULONG pid, ULONG64 addr, std::string &writebuf); } // namespace Memory } // namespace ArkDrvApi #endif //_NTDDK_
1,955
C++
.h
67
27.80597
77
0.69443
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,289
api-process.h
BlackINT3_OpenArk/src/OpenArkDrv/arkdrv-api/api-process/api-process.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include "../arkdrv-api.h" #ifdef _ARKDRV_ #include <ntifs.h> #include <windef.h> #else #include <Windows.h> #endif //_NTDDK_ enum PROCESS_OPS { PROCESS_OPEN, THREAD_OPEN, }; #pragma pack(push, 1) typedef struct _PROCESS_OPEN_INFO { DWORD access; BOOL inherit; DWORD pid; } PROCESS_OPEN_INFO, *PPROCESS_OPEN_INFO; typedef struct _THREAD_OPEN_INFO { DWORD access; BOOL inherit; DWORD tid; } THREAD_OPEN_INFO, *PTHREAD_OPEN_INFO; #pragma pack(pop) //#undef _ARKDRV_ #ifdef _ARKDRV_ #include <ntifs.h> #else #include <unone.h> #include <string> #include <vector> namespace ArkDrvApi { namespace Process { HANDLE WINAPI OpenProcessR0(DWORD access, BOOL inherit, DWORD pid); HANDLE WINAPI OpenProcess(DWORD access, BOOL inherit, DWORD pid); HANDLE WINAPI OpenThreadR0(DWORD access, BOOL inherit, DWORD tid); HANDLE WINAPI OpenThread(DWORD access, BOOL inherit, DWORD tid); } // namespace Process } // namespace ArkDrvApi #include <common/cpp-wrapper/cpp-wrapper.h> #define EN_VID_PROCESS() \ bool regok = UNONE::InterCreateTlsValue(ArkDrvApi::Process::OpenProcess, UNONE::PROCESS_VID);\ ON_SCOPE_EXIT([&] {if (regok) UNONE::InterDeleteTlsValue(UNONE::PROCESS_VID); }); #endif //_NTDDK_
2,008
C++
.h
59
32.711864
95
0.705761
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,290
api-driver.h
BlackINT3_OpenArk/src/OpenArkDrv/arkdrv-api/api-driver/api-driver.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include "../arkdrv-api.h" #ifdef _ARKDRV_ #include <ntifs.h> #include <windef.h> #else #include <Windows.h> #endif //_NTDDK_ // Driver enum DRIVER_OPS { DRIVER_ENUM_INFO, }; #pragma pack(push, 1) typedef struct _DRIVER_ITEM { ULONG64 base; ULONG size; ULONG flags; USHORT load_seq; USHORT init_seq; UCHAR path[256]; } DRIVER_ITEM, *PDRIVER_ITEM; typedef struct _DRIVER_INFO { ULONG count; DRIVER_ITEM items[1]; } DRIVER_INFO, *PDRIVER_INFO; #pragma pack(pop) //#undef _ARKDRV_ #ifdef _ARKDRV_ #include <ntifs.h> #else #include <unone.h> #include <string> #include <vector> namespace ArkDrvApi { namespace Driver { bool DriverEnumInfo(std::vector<DRIVER_ITEM> &infos); } // namespace Memory } // namespace ArkDrvApi #endif //_NTDDK_
1,553
C++
.h
54
27.555556
77
0.68024
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,291
api-network.h
BlackINT3_OpenArk/src/OpenArkDrv/arkdrv-api/api-network/api-network.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include "../arkdrv-api.h" #ifdef _ARKDRV_ #include <ntifs.h> #include <windef.h> #else #include <Windows.h> #endif //_NTDDK_ enum ARK_NETWORK_OPS { }; #define ARK_NETWORK_IPV4 4 #define ARK_NETWORK_IPV6 6 #define ARK_NETWORK_TCP 0 #define ARK_NETWORK_UDP 1 #pragma pack(push, 1) typedef struct _ARK_NETWORK_ENDPOINT_ITEM { ULONG ip_ver; ULONG tran_ver; CHAR protocol[8]; union { ULONG local_addr; UCHAR local_addr6[16]; } u0; union { ULONG remote_addr; UCHAR remote_addr6[16]; } u1; ULONG local_port; ULONG remote_port; CHAR local[64]; CHAR remote[64]; ULONG state; CHAR readable_state[32]; ULONG pid; } ARK_NETWORK_ENDPOINT_ITEM, *PARK_NETWORK_ENDPOINT_ITEM; #pragma pack(pop) //#undef _ARKDRV_ #ifdef _ARKDRV_ #include <ntifs.h> #else #include <unone.h> #include <string> #include <vector> namespace ArkDrvApi { namespace Network { bool EnumTcp4Endpoints(std::vector<ARK_NETWORK_ENDPOINT_ITEM> &items); bool EnumTcp6Endpoints(std::vector<ARK_NETWORK_ENDPOINT_ITEM> &items); bool EnumUdp4Endpoints(std::vector<ARK_NETWORK_ENDPOINT_ITEM> &items); bool EnumUdp6Endpoints(std::vector<ARK_NETWORK_ENDPOINT_ITEM> &items); } // namespace Network } // namespace ArkDrvApi #endif //_NTDDK_
2,023
C++
.h
67
28.731343
77
0.703742
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,292
api-object.h
BlackINT3_OpenArk/src/OpenArkDrv/arkdrv-api/api-object/api-object.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include "../arkdrv-api.h" #ifdef _ARKDRV_ #include <ntifs.h> #include <windef.h> #else #include <Windows.h> #endif //_NTDDK_ enum ARK_OBJECT_OPS { ARK_OBJECT_TYPE_ENUM, }; #define ARK_SESSION_GLOBAL -1 #pragma pack(push, 1) typedef struct _ARK_OBJECT_TYPE_ITEM { ULONG type_index; WCHAR type_name[128]; PVOID type_object; ULONG total_objects; ULONG total_handles; } ARK_OBJECT_TYPE_ITEM, *PARK_OBJECT_TYPE_ITEM; typedef struct _OBJECT_TYPE_INFO { ULONG count; ARK_OBJECT_TYPE_ITEM items[1]; } ARK_OBJECT_TYPE_INFO, *PARK_OBJECT_TYPE_INFO; typedef struct _ARK_OBJECT_SECTION_ITEM { ULONG session_id; WCHAR session_name[128]; ULONG section_size; WCHAR section_name[128]; WCHAR section_dir[128]; } ARK_OBJECT_SECTION_ITEM, *PARK_OBJECT_SECTION_ITEM; typedef struct _ARK_OBJECT_SECTION_INFO { ULONG count; ARK_OBJECT_SECTION_ITEM items[1]; } ARK_OBJECT_SECTION_INFO, *PARK_OBJECT_SECTION_INFO; #pragma pack(pop) //#undef _ARKDRV_ #ifdef _ARKDRV_ #include <ntifs.h> typedef struct _OBJECT_TYPE_INFORMATION { UNICODE_STRING TypeName; ULONG TotalNumberOfHandles; ULONG TotalNumberOfObjects; WCHAR Unused1[8]; ULONG HighWaterNumberOfHandles; ULONG HighWaterNumberOfObjects; WCHAR Unused2[8]; ACCESS_MASK InvalidAttributes; GENERIC_MAPPING GenericMapping; ACCESS_MASK ValidAttributes; BOOLEAN SecurityRequired; BOOLEAN MaintainHandleCount; USHORT MaintainTypeList; POOL_TYPE PoolType; ULONG DefaultPagedPoolCharge; ULONG DefaultNonPagedPoolCharge; } OBJECT_TYPE_INFORMATION, *POBJECT_TYPE_INFORMATION; ULONG ObjectTypeIndexByName(WCHAR *object_type_name); #else #include <unone.h> #include <string> #include <vector> namespace ArkDrvApi { namespace Object { bool ObjectTypeEnum(std::vector<ARK_OBJECT_TYPE_ITEM> &items); bool ObjectSectionEnum(std::vector<ARK_OBJECT_SECTION_ITEM> &items); bool ObjectSectionEnum(std::vector<ARK_OBJECT_SECTION_ITEM> &items, ULONG session); } // namespace Object } // namespace ArkDrvApi #endif //_NTDDK_
3,027
C++
.h
85
34.129412
84
0.68109
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,293
api-wingui.h
BlackINT3_OpenArk/src/OpenArkDrv/arkdrv-api/api-wingui/api-wingui.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include "../arkdrv-api.h" #ifdef _ARKDRV_ #include <ntifs.h> #include <windef.h> #else #include <Windows.h> #endif //_NTDDK_ // WinGUI #define HOTKEY_MAX_VK 0x80 #define HOTKEY_PLACEHOLDER_ID 0x99887766 enum HOTKEY_OPS { HOTKEY_ENUM, HOTKEY_REMOVE, }; #pragma pack(push, 1) typedef struct _HOTKEY_ITEM { UCHAR name[64]; UINT32 wnd; UINT16 mod1; UINT16 mod2; UINT32 vk; UINT32 id; UINT32 pid; UINT32 tid; ULONG64 hkobj; } HOTKEY_ITEM, *PHOTKEY_ITEM; typedef struct _HOTKEY_INFO { ULONG count; HOTKEY_ITEM items[1]; } HOTKEY_INFO, *PHOTKEY_INFO; #pragma pack(pop) //#undef _ARKDRV_ #ifdef _ARKDRV_ #include <ntifs.h> #else #include <unone.h> #include <string> #include <vector> namespace ArkDrvApi { namespace WinGUI { bool HotkeyEnumInfo(std::vector<HOTKEY_ITEM> &hotkeys); bool HotkeyRemoveInfo(HOTKEY_ITEM &item); } // namespace Memory } // namespace ArkDrvApi #endif //_NTDDK_
1,704
C++
.h
61
26.672131
77
0.692448
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,294
api-storage.h
BlackINT3_OpenArk/src/OpenArkDrv/arkdrv-api/api-storage/api-storage.h
/**************************************************************************** ** ** Copyright (C) 2019 BlackINT3 ** Contact: https://github.com/BlackINT3/OpenArk ** ** GNU Lesser General Public License Usage (LGPL) ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ****************************************************************************/ #pragma once #include "../arkdrv-api.h" #ifdef _ARKDRV_ #include <ntifs.h> #include <windef.h> #else #include <Windows.h> #endif //_NTDDK_ enum STORAGE_OPS { STORAGE_UNLOCK_ENUM, STORAGE_UNLOCK_CLOSE, }; #pragma pack(push, 1) typedef struct _HANDLE_ITEM { ULONG type_index; // object type index ULONG ref_count; // ref count HANDLE pid; // process id LPVOID object; // HANDLE handle; // WCHAR type_name[64]; // the object type name WCHAR name[260]; // object name } HANDLE_ITEM, *PHANDLE_ITEM; typedef struct _HANDLE_INFO { ULONG count; HANDLE_ITEM items[1]; } HANDLE_INFO, *PHANDLE_INFO; #pragma pack(pop) //#undef _ARKDRV_ #ifdef _ARKDRV_ #include <ntifs.h> #else #include <unone.h> #include <string> #include <vector> namespace ArkDrvApi { namespace Storage { bool UnlockEnum(const std::wstring &path, std::vector<HANDLE_ITEM> &items); bool UnlockClose(HANDLE_ITEM &item); } // namespace Storage } // namespace ArkDrvApi #endif //_NTDDK_
1,759
C++
.h
56
30.107143
77
0.681765
BlackINT3/OpenArk
9,035
883
52
LGPL-2.1
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,295
QuickFindWidget.cpp
dail8859_NotepadNext/src/NotepadNext/QuickFindWidget.cpp
/* * This file is part of Notepad Next. * Copyright 2020 Justin Dailey * * Notepad Next is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Notepad Next is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Notepad Next. If not, see <https://www.gnu.org/licenses/>. */ #include "FocusWatcher.h" #include "QuickFindWidget.h" #include "ScintillaNext.h" #include "FadingIndicator.h" #include "ui_QuickFindWidget.h" #include <QKeyEvent> #include <QLineEdit> #include <QShortcut> #include <QScrollBar> QuickFindWidget::QuickFindWidget(QWidget *parent) : QFrame(parent), ui(new Ui::QuickFindWidget) { ui->setupUi(this); // Move the focus to the line edit widget setFocusProxy(ui->lineEdit); ui->lineEdit->installEventFilter(this); FocusWatcher *fw = new FocusWatcher(ui->lineEdit); connect(fw, &FocusWatcher::focusOut, this, &QuickFindWidget::focusOut); connect(fw, &FocusWatcher::focusIn, this, &QuickFindWidget::focusIn); connect(ui->lineEdit, &QLineEdit::returnPressed, this, &QuickFindWidget::returnPressed); // Any changes need to trigger a new search connect(ui->lineEdit, &QLineEdit::textChanged, this, &QuickFindWidget::performNewSearch); connect(ui->buttonMatchCase, &QToolButton::toggled, this, &QuickFindWidget::performNewSearch); connect(ui->buttonWholeWord, &QToolButton::toggled, this, &QuickFindWidget::performNewSearch); connect(ui->buttonRegexp, &QToolButton::toggled, this, &QuickFindWidget::performNewSearch); } QuickFindWidget::~QuickFindWidget() { if (finder) { delete finder; } delete ui; } void QuickFindWidget::setEditor(ScintillaNext *editor) { if (this->editor != Q_NULLPTR) { disconnect(editor, &ScintillaNext::resized, this, &QuickFindWidget::positionWidget); } connect(editor, &ScintillaNext::resized, this, &QuickFindWidget::positionWidget); this->editor = editor; if (finder == Q_NULLPTR) { finder = new Finder(editor); finder->setWrap(true); // Always wrap the search } else { finder->setEditor(editor); } initializeEditorIndicator(); positionWidget(); } bool QuickFindWidget::eventFilter(QObject *obj, QEvent *event) { if (event->type() == QEvent::KeyPress) { QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event); // Use escape key to close the quick find widget if (keyEvent->key() == Qt::Key_Escape) { clearHighlights(); clearCachedMatches(); hide(); editor->grabFocus(); } } return QObject::eventFilter(obj, event); } void QuickFindWidget::setSearchContextColorBad() { setSearchContextColor(QStringLiteral("red")); } void QuickFindWidget::setSearchContextColorGood() { setSearchContextColor(QStringLiteral("blue")); } void QuickFindWidget::performNewSearch() { clearHighlights(); clearCachedMatches(); ui->lblInfo->hide(); // Early out if (searchText().isEmpty()) { setSearchContextColorGood(); return; } prepareSearch(); finder->forEachMatch([&](int start, int end) { matches.append(qMakePair(start, end)); return qMax(start + 1, end); }); if (matches.empty()) { setSearchContextColorBad(); } else { setSearchContextColorGood(); } highlightMatches(); navigateToNextMatch(false); } void QuickFindWidget::highlightMatches() { qInfo(Q_FUNC_INFO); editor->setIndicatorCurrent(indicator); for (const auto &range : matches) { editor->indicatorFillRange(range.first, range.second - range.first); } } void QuickFindWidget::showWrapIndicator() { FadingIndicator::showPixmap(editor, QStringLiteral(":/icons/wrapindicator.png")); } void QuickFindWidget::navigateToNextMatch(bool skipCurrent) { qInfo(Q_FUNC_INFO); // Early out if there are no matches if (matches.length() == 0) { ui->lblInfo->hide(); return; } if (currentMatchIndex != -1) { currentMatchIndex++; if (currentMatchIndex >= matches.length()) { currentMatchIndex = 0; } } else { int startPos = INVALID_POSITION; if (skipCurrent) { startPos = editor->selectionEnd(); } else { startPos = editor->selectionStart(); } auto it = std::lower_bound(matches.begin(), matches.end(), startPos, [](const QPair<int, int>& pair, int value) { return pair.first < value; }); if (it != matches.end()) { currentMatchIndex = std::distance(matches.begin(), it); } else { // Wrap back around currentMatchIndex = 0; } } // Search wrapped around if (currentMatchIndex == 0) { showWrapIndicator(); } goToCurrentMatch(); } void QuickFindWidget::navigateToPrevMatch() { qInfo(Q_FUNC_INFO); // Early out if there are no matches if (matches.length() == 0) { ui->lblInfo->hide(); return; } if (currentMatchIndex != -1) { currentMatchIndex--; if (currentMatchIndex < 0) { currentMatchIndex = matches.length() - 1; } } else { qWarning("navigateToPrevMatch() with no valid index yet"); return; } // Search wrapped around if (currentMatchIndex == matches.length() - 1) { showWrapIndicator(); } goToCurrentMatch(); } void QuickFindWidget::goToCurrentMatch() { editor->setSel(matches[currentMatchIndex].first, matches[currentMatchIndex].second); editor->verticalCentreCaret(); ui->lblInfo->show(); ui->lblInfo->setText(tr("%L1/%L2").arg(currentMatchIndex + 1).arg(matches.length())); } int QuickFindWidget::computeSearchFlags() const { int searchFlags = 0; if (ui->buttonMatchCase->isChecked()) { searchFlags |= SCFIND_MATCHCASE; } if (ui->buttonWholeWord->isChecked()) { searchFlags |= SCFIND_WHOLEWORD; } if (ui->buttonRegexp->isChecked()) { searchFlags |= SCFIND_REGEXP; } return searchFlags; } void QuickFindWidget::setSearchContextColor(const QString &color) { ui->lineEdit->setStyleSheet(QStringLiteral("border: 1px solid %1; padding: 2px;").arg(color)); } void QuickFindWidget::initializeEditorIndicator() { indicator = editor->allocateIndicator(QStringLiteral("quick_find")); editor->indicSetFore(indicator, 0xFF8000); editor->indicSetStyle(indicator, INDIC_FULLBOX); editor->indicSetOutlineAlpha(indicator, 150); editor->indicSetAlpha(indicator, 50); editor->indicSetUnder(indicator, true); } QString QuickFindWidget::searchText() const { return ui->lineEdit->text(); } void QuickFindWidget::positionWidget() { int usableWidth = editor->width(); // Account for the scrollbar as the quick find will be underneath if the scrollbar is visible if (editor->verticalScrollBar() && editor->verticalScrollBar()->isVisible()) { usableWidth -= editor->verticalScrollBar()->width(); } QPoint position = QPoint(usableWidth - width(), 0); move(editor->mapTo(parentWidget(), position)); } void QuickFindWidget::prepareSearch() { finder->setSearchText(searchText()); finder->setSearchFlags(computeSearchFlags()); } void QuickFindWidget::focusIn() { ui->lineEdit->selectAll(); ui->lblInfo->hide(); performNewSearch(); } void QuickFindWidget::focusOut() { clearHighlights(); clearCachedMatches(); hide(); } void QuickFindWidget::returnPressed() { if (QGuiApplication::keyboardModifiers() & Qt::ShiftModifier) { navigateToPrevMatch(); } else { navigateToNextMatch(true); } } void QuickFindWidget::clearHighlights() { editor->setIndicatorCurrent(indicator); editor->indicatorClearRange(0, editor->length()); } void QuickFindWidget::clearCachedMatches() { matches.clear(); currentMatchIndex = -1; }
8,446
C++
.cpp
272
26.128676
121
0.682653
dail8859/NotepadNext
9,006
547
57
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,296
NppImporter.cpp
dail8859_NotepadNext/src/NotepadNext/NppImporter.cpp
/* * This file is part of Notepad Next. * Copyright 2019 Justin Dailey * * Notepad Next is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Notepad Next is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Notepad Next. If not, see <https://www.gnu.org/licenses/>. */ #include <QFile> #include <QDir> #include "NppImporter.h" #include "SciLexer.h" #define FONTSTYLE_BOLD 1 #define FONTSTYLE_ITALIC 2 #define FONTSTYLE_UNDERLINE 4 static inline int color(int c) { return (c & 0xFF0000) >> 16 | (c & 0x00FF00) | (c & 0x0000FF) << 16; } const int LANG_INDEX_INSTR = 0; const int LANG_INDEX_INSTR2 = 1; const int LANG_INDEX_TYPE = 2; const int LANG_INDEX_TYPE2 = 3; const int LANG_INDEX_TYPE3 = 4; const int LANG_INDEX_TYPE4 = 5; const int LANG_INDEX_TYPE5 = 6; static int keywordClassToIndex(const QStringView keywordClass) { if (keywordClass == QStringLiteral("instre1")) return LANG_INDEX_INSTR; if (keywordClass == QStringLiteral("instre2")) return LANG_INDEX_INSTR2; if (keywordClass == QStringLiteral("type1")) return LANG_INDEX_TYPE; if (keywordClass == QStringLiteral("type2")) return LANG_INDEX_TYPE2; if (keywordClass == QStringLiteral("type3")) return LANG_INDEX_TYPE3; if (keywordClass == QStringLiteral("type4")) return LANG_INDEX_TYPE4; if (keywordClass == QStringLiteral("type5")) return LANG_INDEX_TYPE5; return -1; // TODO: not sure what is best } struct LanguageName { QString shortName; QString longName; int lexer_id; }; #define TEXT(x) x static const QMap<QString, LanguageName> langNamesToLexer = { {TEXT("normal"), {TEXT("Normal text"), TEXT("Normal text file"), SCLEX_NULL}}, {TEXT("php"), {TEXT("PHP"), TEXT("PHP Hypertext Preprocessor file"), SCLEX_HTML}}, {TEXT("c"), {TEXT("C"), TEXT("C source file"), SCLEX_CPP}}, {TEXT("cpp"), {TEXT("C++"), TEXT("C++ source file"), SCLEX_CPP}}, {TEXT("cs"), {TEXT("C#"), TEXT("C# source file"), SCLEX_CPP}}, {TEXT("objc"), {TEXT("Objective-C"), TEXT("Objective-C source file"), SCLEX_CPP}}, {TEXT("java"), {TEXT("Java"), TEXT("Java source file"), SCLEX_CPP}}, {TEXT("rc"), {TEXT("RC"), TEXT("Windows Resource file"), SCLEX_CPP}}, {TEXT("html"), {TEXT("HTML"), TEXT("Hyper Text Markup Language file"), SCLEX_HTML}}, {TEXT("xml"), {TEXT("XML"), TEXT("eXtensible Markup Language file"), SCLEX_XML}}, {TEXT("makefile"), {TEXT("Makefile"), TEXT("Makefile"), SCLEX_MAKEFILE}}, {TEXT("pascal"), {TEXT("Pascal"), TEXT("Pascal source file"), SCLEX_PASCAL}}, {TEXT("batch"), {TEXT("Batch"), TEXT("Batch file"), SCLEX_BATCH}}, {TEXT("ini"), {TEXT("ini"), TEXT("MS ini file"), SCLEX_PROPERTIES}}, {TEXT("nfo"), {TEXT("NFO"), TEXT("MSDOS Style/ASCII Art"), SCLEX_NULL}}, //{TEXT("udf"), {TEXT("udf"), TEXT("User Define File"), SCLEX_USER}}, {TEXT("asp"), {TEXT("ASP"), TEXT("Active Server Pages script file"), SCLEX_HTML}}, {TEXT("sql"), {TEXT("SQL"), TEXT("Structured Query Language file"), SCLEX_SQL}}, {TEXT("vb"), {TEXT("Visual Basic"), TEXT("Visual Basic file"), SCLEX_VB}}, {TEXT("javascript"), {TEXT("JavaScript"), TEXT("JavaScript file"), SCLEX_CPP}}, {TEXT("css"), {TEXT("CSS"), TEXT("Cascade Style Sheets File"), SCLEX_CSS}}, {TEXT("perl"), {TEXT("Perl"), TEXT("Perl source file"), SCLEX_PERL}}, {TEXT("python"), {TEXT("Python"), TEXT("Python file"), SCLEX_PYTHON}}, {TEXT("lua"), {TEXT("Lua"), TEXT("Lua source File"), SCLEX_LUA}}, {TEXT("tex"), {TEXT("TeX"), TEXT("TeX file"), SCLEX_TEX}}, {TEXT("fortran"), {TEXT("Fortran free form"), TEXT("Fortran free form source file"), SCLEX_FORTRAN}}, {TEXT("bash"), {TEXT("Shell"), TEXT("Unix script file"), SCLEX_BASH}}, {TEXT("actionscript"), {TEXT("ActionScript"), TEXT("Flash ActionScript file"), SCLEX_CPP}}, {TEXT("nsis"), {TEXT("NSIS"), TEXT("Nullsoft Scriptable Install System script file"), SCLEX_NSIS}}, {TEXT("tcl"), {TEXT("TCL"), TEXT("Tool Command Language file"), SCLEX_TCL}}, {TEXT("lisp"), {TEXT("Lisp"), TEXT("List Processing language file"), SCLEX_LISP}}, {TEXT("scheme"), {TEXT("Scheme"), TEXT("Scheme file"), SCLEX_LISP}}, {TEXT("asm"), {TEXT("Assembly"), TEXT("Assembly language source file"), SCLEX_ASM}}, {TEXT("diff"), {TEXT("Diff"), TEXT("Diff file"), SCLEX_DIFF}}, {TEXT("props"), {TEXT("Properties file"), TEXT("Properties file"), SCLEX_PROPERTIES}}, {TEXT("postscript"), {TEXT("PostScript"), TEXT("PostScript file"), SCLEX_PS}}, {TEXT("ruby"), {TEXT("Ruby"), TEXT("Ruby file"), SCLEX_RUBY}}, {TEXT("smalltalk"), {TEXT("Smalltalk"), TEXT("Smalltalk file"), SCLEX_SMALLTALK}}, {TEXT("vhdl"), {TEXT("VHDL"), TEXT("VHSIC Hardware Description Language file"), SCLEX_VHDL}}, {TEXT("kix"), {TEXT("KiXtart"), TEXT("KiXtart file"), SCLEX_KIX}}, {TEXT("autoit"), {TEXT("AutoIt"), TEXT("AutoIt"), SCLEX_AU3}}, {TEXT("caml"), {TEXT("CAML"), TEXT("Categorical Abstract Machine Language"), SCLEX_CAML}}, {TEXT("ada"), {TEXT("Ada"), TEXT("Ada file"), SCLEX_ADA}}, {TEXT("verilog"), {TEXT("Verilog"), TEXT("Verilog file"), SCLEX_VERILOG}}, {TEXT("matlab"), {TEXT("MATLAB"), TEXT("MATrix LABoratory"), SCLEX_MATLAB}}, {TEXT("haskell"), {TEXT("Haskell"), TEXT("Haskell"), SCLEX_HASKELL}}, {TEXT("inno"), {TEXT("Inno Setup"), TEXT("Inno Setup script"), SCLEX_INNOSETUP}}, //{TEXT("searchResult"), {TEXT("Internal Search"), TEXT("Internal Search"), SCLEX_SEARCHRESULT}}, {TEXT("cmake"), {TEXT("CMake"), TEXT("CMake file"), SCLEX_CMAKE}}, {TEXT("yaml"), {TEXT("YAML"), TEXT("YAML Ain't Markup Language"), SCLEX_YAML}}, {TEXT("cobol"), {TEXT("COBOL"), TEXT("COmmon Business Oriented Language"), SCLEX_COBOL}}, {TEXT("gui4cli"), {TEXT("Gui4Cli"), TEXT("Gui4Cli file"), SCLEX_GUI4CLI}}, {TEXT("d"), {TEXT("D"), TEXT("D programming language"), SCLEX_D}}, {TEXT("powershell"), {TEXT("PowerShell"), TEXT("Windows PowerShell"), SCLEX_POWERSHELL}}, {TEXT("r"), {TEXT("R"), TEXT("R programming language"), SCLEX_R}}, {TEXT("jsp"), {TEXT("JSP"), TEXT("JavaServer Pages script file"), SCLEX_HTML}}, {TEXT("coffeescript"), {TEXT("CoffeeScript"), TEXT("CoffeeScript file"), SCLEX_COFFEESCRIPT}}, {TEXT("json"), {TEXT("json"), TEXT("JSON file"), SCLEX_CPP }}, {TEXT("javascript.js"), {TEXT("JavaScript"), TEXT("JavaScript file"), SCLEX_CPP }}, {TEXT("fortran77"), {TEXT("Fortran fixed form"), TEXT("Fortran fixed form source file"), SCLEX_F77}}, {TEXT("baanc"), {TEXT("BaanC"), TEXT("BaanC File"), SCLEX_BAAN }}, {TEXT("srec"), {TEXT("S-Record"), TEXT("Motorola S-Record binary data"), SCLEX_SREC}}, {TEXT("ihex"), {TEXT("Intel HEX"), TEXT("Intel HEX binary data"), SCLEX_IHEX}}, {TEXT("tehex"), {TEXT("Tektronix extended HEX"), TEXT("Tektronix extended HEX binary data"), SCLEX_TEHEX}}, {TEXT("swift"), {TEXT("Swift"), TEXT("Swift file"), SCLEX_CPP}}, {TEXT("asn1"), {TEXT("ASN.1"), TEXT("Abstract Syntax Notation One file"), SCLEX_ASN1}}, {TEXT("avs"), {TEXT("AviSynth"), TEXT("AviSynth scripts files"), SCLEX_AVS}}, {TEXT("blitzbasic"), {TEXT("BlitzBasic"), TEXT("BlitzBasic file"), SCLEX_BLITZBASIC}}, {TEXT("purebasic"), {TEXT("PureBasic"), TEXT("PureBasic file"), SCLEX_PUREBASIC}}, {TEXT("freebasic"), {TEXT("FreeBasic"), TEXT("FreeBasic file"), SCLEX_FREEBASIC}}, {TEXT("csound"), {TEXT("Csound"), TEXT("Csound file"), SCLEX_CSOUND}}, {TEXT("erlang"), {TEXT("Erlang"), TEXT("Erlang file"), SCLEX_ERLANG}}, {TEXT("escript"), {TEXT("ESCRIPT"), TEXT("ESCRIPT file"), SCLEX_ESCRIPT}}, {TEXT("forth"), {TEXT("Forth"), TEXT("Forth file"), SCLEX_FORTH}}, {TEXT("latex"), {TEXT("LaTeX"), TEXT("LaTeX file"), SCLEX_LATEX}}, {TEXT("mmixal"), {TEXT("MMIXAL"), TEXT("MMIXAL file"), SCLEX_MMIXAL}}, {TEXT("nimrod"), {TEXT("Nimrod"), TEXT("Nimrod file"), SCLEX_NIMROD}}, {TEXT("nncrontab"), {TEXT("Nncrontab"), TEXT("extended crontab file"), SCLEX_NNCRONTAB}}, {TEXT("oscript"), {TEXT("OScript"), TEXT("OScript source file"), SCLEX_OSCRIPT}}, {TEXT("rebol"), {TEXT("REBOL"), TEXT("REBOL file"), SCLEX_REBOL}}, {TEXT("registry"), {TEXT("registry"), TEXT("registry file"), SCLEX_REGISTRY}}, {TEXT("rust"), {TEXT("Rust"), TEXT("Rust file"), SCLEX_RUST}}, {TEXT("spice"), {TEXT("Spice"), TEXT("spice file"), SCLEX_SPICE}}, {TEXT("txt2tags"), {TEXT("txt2tags"), TEXT("txt2tags file"), SCLEX_TXT2TAGS}}, {TEXT("ext"), {TEXT("External"), TEXT("External"), SCLEX_NULL}} }; static const QMap<QString, QVector<int>> folderMarkers = { {"type", {SC_MARKNUM_FOLDEROPEN, SC_MARKNUM_FOLDER, SC_MARKNUM_FOLDERSUB, SC_MARKNUM_FOLDERTAIL, SC_MARKNUM_FOLDEREND, SC_MARKNUM_FOLDEROPENMID, SC_MARKNUM_FOLDERMIDTAIL}}, {"simple", {SC_MARK_MINUS, SC_MARK_PLUS, SC_MARK_EMPTY, SC_MARK_EMPTY, SC_MARK_EMPTY, SC_MARK_EMPTY, SC_MARK_EMPTY}}, {"arrow", {SC_MARK_ARROWDOWN, SC_MARK_ARROW, SC_MARK_EMPTY, SC_MARK_EMPTY, SC_MARK_EMPTY, SC_MARK_EMPTY, SC_MARK_EMPTY}}, {"circle", {SC_MARK_CIRCLEMINUS, SC_MARK_CIRCLEPLUS,SC_MARK_VLINE, SC_MARK_LCORNERCURVE, SC_MARK_CIRCLEPLUSCONNECTED, SC_MARK_CIRCLEMINUSCONNECTED, SC_MARK_TCORNERCURVE}}, {"box", {SC_MARK_BOXMINUS, SC_MARK_BOXPLUS, SC_MARK_VLINE, SC_MARK_LCORNER, SC_MARK_BOXPLUSCONNECTED, SC_MARK_BOXMINUSCONNECTED, SC_MARK_TCORNER}} }; NppImporter::NppImporter(const QString &configPath, ScintillaEdit *_editor) : editor(_editor) { qInfo("Import Notepad++ settings from: \"%s\"", qUtf8Printable(configPath)); if (!QFile::exists(configPath)) { qInfo("import location not found"); return; } QDir dir(configPath); readLangsModel(dir.filePath("langs.xml")); readStylersModel(dir.filePath("stylers.xml")); readConfigModel(dir.filePath("config.xml")); // Do some cleanup because I have no idea what Notepad++ is doing in some cases languages["cpp"].keywords[LANG_INDEX_INSTR2] = languages["cpp"].keywords.take(LANG_INDEX_TYPE); languages["cpp"].lexer.styles[16].keywordClass = LANG_INDEX_INSTR2; // Build a temporary list of the key/value pairs QList<QPair<QString, const Language *>> sortedLanguages; for (const QString &key : languages.keys()) { sortedLanguages.append(qMakePair(key, &languages[key])); } // And sort it based on the values std::sort(sortedLanguages.begin(), sortedLanguages.end(), [](const QPair<QString, const Language *> &a, const QPair<QString, const Language *> &b) { return QString::compare(a.second->shortName, b.second->shortName, Qt::CaseInsensitive) < 0; }); // Store the sorted keys for (const QPair<QString, const Language *> &pair : sortedLanguages) { sortedLanguageKeys.append(pair.first); } } void NppImporter::readLangsModel(const QString &filePath) { QFile file(filePath); if (file.open(QIODevice::ReadOnly)) { QXmlStreamReader xml(&file); xml.readNextStartElement(); while (xml.readNextStartElement()) { if (xml.name() == QStringLiteral("Languages")) { //qInfo(qUtf8Printable(xml.name().toString())); while (xml.readNextStartElement()) { auto attrs = xml.attributes(); if (!langNamesToLexer.contains(attrs.value("name").toString())) { xml.skipCurrentElement(); continue; } Language language; language.name = attrs.value("name").toString(); language.extensions = attrs.value("ext").toString().split(" ", Qt::SkipEmptyParts); language.shortName = langNamesToLexer[language.name].shortName; language.longDescription = langNamesToLexer[language.name].longName; language.lexer_id = langNamesToLexer[language.name].lexer_id; // TODO: read more while (xml.readNextStartElement()) { //qInfo(qUtf8Printable(language.name)); auto attrs = xml.attributes(); auto t = xml.readElementText(); //qInfo(qUtf8Printable(t)); language.keywords[keywordClassToIndex(attrs.value("name"))] = t; //xml.skipCurrentElement(); } languages.insert(language.name, language); } } else { xml.skipCurrentElement(); } } if (xml.hasError()) { qWarning("%s", qUtf8Printable(xml.errorString())); } } } void NppImporter::readStylersModel(const QString &filePath) { QFile file(filePath); if (file.open(QIODevice::ReadOnly)) { QXmlStreamReader xml(&file); xml.readNextStartElement(); while (xml.readNextStartElement()) { if (xml.name() == QStringLiteral("LexerStyles")) { readLexerStyles(xml); } else if (xml.name() == QStringLiteral("GlobalStyles")) { readGlobalStyles(xml); } else { xml.skipCurrentElement(); } } if (xml.hasError()) { qWarning("%s", qUtf8Printable(xml.errorString())); } } } void NppImporter::readConfigModel(const QString &filePath) { QFile file(filePath); if (file.open(QIODevice::ReadOnly)) { QXmlStreamReader xml(&file); xml.readNextStartElement(); while (xml.readNextStartElement()) { if (xml.name() == QStringLiteral("GUIConfigs")) { readGUIConfigs(xml); } else { xml.skipCurrentElement(); } } if (xml.hasError()) { qWarning("%s", qUtf8Printable(xml.errorString())); } } } void NppImporter::readLexerStyles(QXmlStreamReader &xml) { qInfo("%s", qUtf8Printable(xml.name().toString())); while (xml.readNextStartElement()) { auto attrs = xml.attributes(); if (!langNamesToLexer.contains(attrs.value("name").toString())) { xml.skipCurrentElement(); continue; } LexerType *lexer = &languages[attrs.value("name").toString()].lexer; lexer->description = attrs.value("desc").toString(); while (xml.readNextStartElement()) { //qInfo(qUtf8Printable(xml.name().toString())); auto attrs = xml.attributes(); LexerStyle style; style.id = attrs.value("styleID").toInt(); style.fgColor = color(attrs.value("fgColor").toInt(nullptr, 16)); style.bgColor = color(attrs.value("bgColor").toInt(nullptr, 16)); if (attrs.hasAttribute("keywordClass")) { style.keywordClass = keywordClassToIndex(attrs.value("keywordClass")); } else { style.keywordClass = -1; } lexer->styles.append(style); xml.skipCurrentElement(); } } } void NppImporter::readGlobalStyles(QXmlStreamReader &xml) { editor->setMarginWidthN(0, 30); editor->styleResetDefault(); editor->styleClearAll(); while (xml.readNextStartElement()) { //qInfo(qUtf8Printable(xml.tokenString())); //qInfo(qUtf8Printable(xml.attributes().value("name").toString())); auto attrs = xml.attributes(); int styleID = attrs.value("styleID").toInt(); if (styleID >= 32 && styleID <= 39) { int fgColor = attrs.value("fgColor").toInt(nullptr, 16); int bgColor = attrs.value("bgColor").toInt(nullptr, 16); editor->styleSetFore(styleID, color(fgColor)); editor->styleSetBack(styleID, color(bgColor)); if (attrs.hasAttribute("fontName") && attrs.value("fontName").length() > 0) { editor->styleSetFont(styleID, attrs.value("fontName").toLocal8Bit().constData()); } if (attrs.hasAttribute("fontSize") && attrs.value("fontSize").length() > 0) { int fontSize = attrs.value("fontSize").toInt(); editor->styleSetSize(styleID, fontSize); } if (attrs.hasAttribute("fontStyle") && attrs.value("fontStyle").length() > 0) { int fontStyle = attrs.value("fontStyle").toInt(); editor->styleSetBold(styleID, fontStyle & FONTSTYLE_BOLD); editor->styleSetItalic(styleID, fontStyle & FONTSTYLE_ITALIC); editor->styleSetUnderline(styleID, fontStyle & FONTSTYLE_UNDERLINE); } if (styleID == STYLE_DEFAULT) { editor->styleClearAll(); } } else if (styleID > 0) { editor->indicSetFore(styleID, color(attrs.value("bgColor").toInt(nullptr, 16))); } else if (attrs.value("name") == QStringLiteral("Current line background colour")) { editor->setCaretLineBack(color(attrs.value("bgColor").toInt(nullptr, 16))); } else if (attrs.value("name") == QStringLiteral("Selected text colour")) { editor->setSelBack(true, color(attrs.value("bgColor").toInt(nullptr, 16))); } else if (attrs.value("name") == QStringLiteral("Caret colour")) { editor->setCaretFore(color(attrs.value("fgColor").toInt(nullptr, 16))); } else if (attrs.value("name") == QStringLiteral("Edge colour")) { editor->setEdgeColour(color(attrs.value("fgColor").toInt(nullptr, 16))); } else if (attrs.value("name") == QStringLiteral("White space symbol")) { editor->setWhitespaceFore(true, color(attrs.value("fgColor").toInt(nullptr, 16))); } else if (attrs.value("name") == QStringLiteral("Fold")) { // NOTE: Yes this is a bug in Notepad++ swapping the fg and bg colors foldFgColor = color(attrs.value("bgColor").toInt(nullptr, 16)); foldBgColor = color(attrs.value("fgColor").toInt(nullptr, 16)); } else if (attrs.value("name") == QStringLiteral("Fold active")) { activeFgColor = color(attrs.value("fgColor").toInt(nullptr, 16)); } else if (attrs.value("name") == QStringLiteral("Fold margin")) { editor->setFoldMarginColour(true, color(attrs.value("fgColor").toInt(nullptr, 16))); editor->setFoldMarginHiColour(true, color(attrs.value("bgColor").toInt(nullptr, 16))); } else { //qWarning("Unhandled WidgetStyle \"%s\"", qUtf8Printable(xml.attributes().value("name").toString())); } xml.skipCurrentElement(); } } void NppImporter::readGUIConfigs(QXmlStreamReader &xml) { while (xml.readNextStartElement()) { auto attrs = xml.attributes(); if (attrs.value("name") == QStringLiteral("ScintillaPrimaryView")) { if (attrs.value("indentGuideLine") == QStringLiteral("show")) { editor->setIndentationGuides(SC_IV_LOOKBOTH); } if (attrs.value("currentLineHilitingShow") == QStringLiteral("show")) { editor->setCaretLineVisible(true); editor->setCaretLineVisibleAlways(true); } if (attrs.value("Wrap") == QStringLiteral("yes")) { editor->setWrapMode(SC_WRAP_WHITESPACE); } if (attrs.value("edge") == QStringLiteral("line")) { editor->setEdgeMode(EDGE_LINE); editor->setEdgeColumn(attrs.value("edgeNbColumn").toInt()); } if (attrs.value("whiteSpaceShow") == QStringLiteral("show")) { editor->setViewWS(SCWS_VISIBLEALWAYS); } if (attrs.value("eolShow") == QStringLiteral("show")) { editor->setViewEOL(true); } if (attrs.hasAttribute("folderMarkStyle")) { editor->setAutomaticFold(SC_AUTOMATICFOLD_SHOW | SC_AUTOMATICFOLD_CLICK | SC_AUTOMATICFOLD_CHANGE); editor->markerEnableHighlight(true); const auto markers = folderMarkers[attrs.value("folderMarkStyle").toString()]; const auto types = folderMarkers["type"]; for (int i = 0; i < types.size(); ++i) { editor->markerDefine(types[i], markers[i]); editor->markerSetFore(types[i], foldFgColor); editor->markerSetBack(types[i], foldBgColor); editor->markerSetBackSelected(types[i], activeFgColor); } } } xml.skipCurrentElement(); } }
22,150
C++
.cpp
395
47.455696
187
0.586361
dail8859/NotepadNext
9,006
547
57
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,297
IFaceTableMixer.cpp
dail8859_NotepadNext/src/NotepadNext/IFaceTableMixer.cpp
/* * This file is part of Notepad Next. * Copyright 2019 Justin Dailey * * Notepad Next is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Notepad Next is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Notepad Next. If not, see <https://www.gnu.org/licenses/>. */ #include "IFaceTableMixer.h" const IFaceConstant *IFaceTableMixer::FindConstant(const char *name) const { for (auto const &iface : ifaces) { const IFaceConstant *ret = iface->FindConstant(name); if (ret != nullptr) return ret; } return nullptr; } const IFaceFunction *IFaceTableMixer::FindFunction(const char *name) const { for (auto const &iface : ifaces) { const IFaceFunction *ret = iface->FindFunction(name); if (ret != nullptr) return ret; } return nullptr; } const IFaceFunction *IFaceTableMixer::FindFunctionByConstantName(const char *name) const { for (auto const &iface : ifaces) { const IFaceFunction *ret = iface->FindFunctionByConstantName(name); if (ret != nullptr) return ret; } return nullptr; } const IFaceFunction *IFaceTableMixer::FindFunctionByValue(int value) const { for (auto const &iface : ifaces) { const IFaceFunction *ret = iface->FindFunctionByValue(value); if (ret != nullptr) return ret; } return nullptr; } const IFaceProperty *IFaceTableMixer::FindProperty(const char *name) const { for (auto const &iface : ifaces) { const IFaceProperty *ret = iface->FindProperty(name); if (ret != nullptr) return ret; } return nullptr; } int IFaceTableMixer::GetConstantName(int value, char *nameOut, unsigned nameBufferLen, const char *hint) const { for (auto const &iface : ifaces) { int ret = iface->GetConstantName(value, nameOut, nameBufferLen, hint); if (ret != 0) return ret; } return 0; } const IFaceFunction *IFaceTableMixer::GetFunctionByMessage(int message) const { for (auto const &iface : ifaces) { const IFaceFunction *ret = iface->GetFunctionByMessage(message); if (ret != nullptr) return ret; } return nullptr; } IFaceFunction IFaceTableMixer::GetPropertyFuncByMessage(int message) const { for (auto const &iface : ifaces) { IFaceFunction ret = iface->GetPropertyFuncByMessage(message); if (ret.value != -1) return ret; } return{ "invalid", -1, iface_void, { iface_void, iface_void } }; }
2,715
C++
.cpp
74
34.581081
112
0.753326
dail8859/NotepadNext
9,006
547
57
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
true
false
false
true
false
false
16,298
SearchResultsCollector.cpp
dail8859_NotepadNext/src/NotepadNext/SearchResultsCollector.cpp
/* * This file is part of Notepad Next. * Copyright 2023 Justin Dailey * * Notepad Next is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Notepad Next is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Notepad Next. If not, see <https://www.gnu.org/licenses/>. */ #include "SearchResultsCollector.h" SearchResultsCollector::SearchResultsCollector(ISearchResultsHandler *child) : child(child) { } void SearchResultsCollector::newSearch(const QString searchTerm) { child->newSearch(searchTerm); } void SearchResultsCollector::newFileEntry(ScintillaNext *editor) { // There may be a result that was not passed along yet if (runningHitCount > 0) { child->newResultsEntry(prevLine, prevLineNumber, prevStartPositionFromBeginning, prevEndPositionFromBeginning, runningHitCount); } runningHitCount = 0; child->newFileEntry(editor); } void SearchResultsCollector::newResultsEntry(const QString line, int lineNumber, int startPositionFromBeginning, int endPositionFromBeginning, int hitCount) { if (runningHitCount == 0) { // Save the previous results since there have not been any yet prevLine = line; prevLineNumber = lineNumber; prevStartPositionFromBeginning = startPositionFromBeginning; prevEndPositionFromBeginning = endPositionFromBeginning; runningHitCount = 1; } else if (lineNumber != prevLineNumber) { // Report the previous data child->newResultsEntry(prevLine, prevLineNumber, prevStartPositionFromBeginning, prevEndPositionFromBeginning, runningHitCount); // Save the new results prevLine = line; prevLineNumber = lineNumber; prevStartPositionFromBeginning = startPositionFromBeginning; prevEndPositionFromBeginning = endPositionFromBeginning; // Just one result now runningHitCount = 1; } else { runningHitCount += hitCount; } } void SearchResultsCollector::completeSearch() { // There may be a result that was not passed along yet if (runningHitCount > 0) { child->newResultsEntry(prevLine, prevLineNumber, prevStartPositionFromBeginning, prevEndPositionFromBeginning, runningHitCount); } runningHitCount = 0; child->completeSearch(); }
2,736
C++
.cpp
69
35.115942
156
0.752919
dail8859/NotepadNext
9,006
547
57
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,301
LuaState.cpp
dail8859_NotepadNext/src/NotepadNext/LuaState.cpp
/* * This file is part of Notepad Next. * Copyright 2019 Justin Dailey * * Notepad Next is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Notepad Next is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Notepad Next. If not, see <https://www.gnu.org/licenses/>. */ #include "LuaState.h" #include "lua.hpp" #include <QFile> #include <sstream> #include <string> std::string dumpLuaState(lua_State *L) { std::stringstream ostr; int i; int top = lua_gettop(L); ostr << "top=" << top << ":\n"; for (i = 1; i <= top; ++i) { int t = lua_type(L, i); switch(t) { case LUA_TSTRING: ostr << " " << i << ": '" << lua_tostring(L, i) << "'\n"; break; case LUA_TBOOLEAN: ostr << " " << i << ": " << (lua_toboolean(L, i) ? "true" : "false") << "\n"; break; case LUA_TNUMBER: ostr << " " << i << ": " << lua_tonumber(L, i) << "\n"; break; default: ostr << " " << i << ": TYPE=" << lua_typename(L, t) << "\n"; break; } } return ostr.str(); } static int require_resource(lua_State *L) { const char *module = luaL_checkstring(L, 1); QString module_file = QString(":/languages/%1.lua").arg(module); QFile f(module_file); lua_pop(L, 1); if (f.exists()) { f.open(QFile::ReadOnly); luaL_loadstring(L, f.readAll().constData()); f.close(); // At this point either the function or an error string is on the stack } else { lua_pushfstring(L, "\n\tno file '%s'", module_file.toLatin1().constData()); } return 1; } LuaState::LuaState() { qInfo(Q_FUNC_INFO); L = luaL_newstate(); luaL_openlibs(L); // Remove the searchers used for finding files on the file system execute("table.remove(package.searchers, 4); table.remove(package.searchers, 3); table.remove(package.searchers, 2)"); for(int i = 0; i < 3; ++i) { lua_getglobal(L, "table"); lua_getfield(L, -1, "remove"); lua_remove(L, -2); lua_getglobal(L, "package"); lua_getfield(L, -1, "searchers"); lua_remove(L, -2); lua_call(L, 1, 0); } lua_getglobal(L, "table"); lua_getfield(L, -1, "insert"); lua_remove(L, -2); lua_getglobal(L, "package"); lua_getfield(L, -1, "searchers"); lua_remove(L, -2); lua_pushcfunction(L, require_resource); lua_call(L, 2, 0); } LuaState::~LuaState() { if (L) { lua_close(L); L = Q_NULLPTR; } } void LuaState::execute(const char *statement, bool clear) { // There may be other things on the stack so save the top of it const int stacktop = lua_gettop(L); int status = luaL_loadstring(L, statement); if (status == LUA_OK) { status = lua_pcall(L, 0, LUA_MULTRET, 0); } else if (status == LUA_ERRSYNTAX) { qWarning("LUA_ERRSYNTAX: %s", statement); } else if (status == LUA_ERRMEM) { qFatal("Lua memory allocation error"); } if (status != LUA_OK) { // Print an error message //writeErrorToOutput(lua_tostring(L, -1)); //writeErrorToOutput("\r\n"); qWarning("%s", lua_tostring(L, -1)); } if (clear) lua_settop(L, stacktop); } void LuaState::executeFile(const QString &fileName) { QFile ff(fileName); if (!ff.open(QFile::ReadOnly)) { qFatal("Cannot execute file: %s", fileName.toLatin1().constData()); } execute(ff.readAll().constData()); ff.close(); } void LuaState::clearStack() { lua_settop(L, 0); } void LuaState::raiseError(const char *errorMessage) { luaL_where(L, 1); if (errorMessage) { lua_pushstring(L, errorMessage); } else { lua_insert(L, -2); } lua_concat(L, 2); lua_error(L); }
4,337
C++
.cpp
143
24.79021
122
0.590483
dail8859/NotepadNext
9,006
547
57
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,302
TranslationManager.cpp
dail8859_NotepadNext/src/NotepadNext/TranslationManager.cpp
/* * This file is part of Notepad Next. * Copyright 2024 Justin Dailey * * Notepad Next is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Notepad Next is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Notepad Next. If not, see <https://www.gnu.org/licenses/>. */ #include "TranslationManager.h" #include <QApplication> #include <QDirIterator> #include <QDebug> #include <memory> QString TranslationFileNameToLocaleName(const QString &baseName) { // return "zh_CN" from "NotepadNext_zh_CN" return baseName.mid(QApplication::applicationName().length() + 1); // +1 for the underscore } TranslationManager::TranslationManager(QObject *parent, const QString &path) : QObject(parent), path(path) { } QStringList TranslationManager::availableTranslations() const { QStringList translations; QDirIterator it(path); while (it.hasNext()) { it.next(); if (it.fileName().startsWith(QApplication::applicationName())) { // Some are Qt translation files, not for the application QString localeName = TranslationFileNameToLocaleName(it.fileInfo().baseName()); translations.append(localeName); } } return translations; } QString TranslationManager::FormatLocaleTerritoryAndLanguage(QLocale &locale) { #if QT_VERSION < QT_VERSION_CHECK(6, 2, 0) const QString territory = QLocale::countryToString(locale.country()); #else const QString territory = QLocale::territoryToString(locale.territory()); #endif const QString language = QLocale::languageToString(locale.language()); return QStringLiteral("%1 / %2").arg(language, territory); } void TranslationManager::loadSystemDefaultTranslation() { // The wrong translation file may be loaded when passing Locale::system() to loadTranslation function, e.g. "zh_CN" translation file will be loaded when the locale is "en_US". It's probably a Qt bug. loadTranslation(QLocale(QLocale::system().name())); } void TranslationManager::loadTranslation(QLocale locale) { qInfo(Q_FUNC_INFO); const QStringList filenames{QStringList{QApplication::applicationName(), "qt", "qtbase"}}; for (const auto& filename : filenames) { std::unique_ptr<QTranslator> translator = std::make_unique<QTranslator>(); if (translator->load(locale, filename, QStringLiteral("_"), path)) { if (QCoreApplication::installTranslator(translator.get())) { qInfo() << "Loaded translation" << translator.get()->filePath(); translators.append(translator.release()); } } } } void TranslationManager::loadTranslationByName(QString localeName) { if (localeName.isEmpty()) { loadSystemDefaultTranslation(); } else { loadTranslation(QLocale(localeName)); } }
3,253
C++
.cpp
82
35.426829
203
0.72661
dail8859/NotepadNext
9,006
547
57
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,303
ApplicationSettings.cpp
dail8859_NotepadNext/src/NotepadNext/ApplicationSettings.cpp
/* * This file is part of Notepad Next. * Copyright 2024 Justin Dailey * * Notepad Next is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Notepad Next is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Notepad Next. If not, see <https://www.gnu.org/licenses/>. */ #include "ApplicationSettings.h" #include <QApplication> #include <QFont> #define CREATE_SETTING(group, name, lname, type, default) \ ApplicationSetting<type> name{#group "/" #name, default};\ type ApplicationSettings::lname() const\ {\ return get(name);\ }\ void ApplicationSettings::set##name(type lname)\ {\ set(name, lname);\ emit lname##Changed(lname);\ } ApplicationSettings::ApplicationSettings(QObject *parent) : QSettings{parent} { } CREATE_SETTING(Gui, ShowMenuBar, showMenuBar, bool, true) CREATE_SETTING(Gui, ShowToolBar, showToolBar, bool, true) CREATE_SETTING(Gui, ShowTabBar, showTabBar, bool, true) CREATE_SETTING(Gui, ShowStatusBar, showStatusBar, bool, true) CREATE_SETTING(Gui, CenterSearchDialog, centerSearchDialog, bool, true) CREATE_SETTING(Gui, TabsClosable, tabsClosable, bool, true) CREATE_SETTING(Gui, ExitOnLastTabClosed, exitOnLastTabClosed, bool, false) CREATE_SETTING(Gui, CombineSearchResults, combineSearchResults, bool, false) CREATE_SETTING(App, RestorePreviousSession, restorePreviousSession, bool, false) CREATE_SETTING(App, RestoreUnsavedFiles, restoreUnsavedFiles, bool, false) CREATE_SETTING(App, RestoreTempFiles, restoreTempFiles, bool, false) CREATE_SETTING(App, Translation, translation, QString, QStringLiteral("")) CREATE_SETTING(Editor, ShowWhitespace, showWhitespace, bool, false); CREATE_SETTING(Editor, ShowEndOfLine, showEndOfLine, bool, false); CREATE_SETTING(Editor, ShowWrapSymbol, showWrapSymbol, bool, false); CREATE_SETTING(Editor, ShowIndentGuide, showIndentGuide, bool, true); CREATE_SETTING(Editor, WordWrap, wordWrap, bool, false) CREATE_SETTING(Editor, FontName, fontName, QString, QStringLiteral("Courier New")) CREATE_SETTING(Editor, FontSize, fontSize, int, []() { return qApp->font().pointSize() + 2; }) CREATE_SETTING(Editor, AdditionalWordChars, additionalWordChars, QString, QStringLiteral(""));
2,640
C++
.cpp
55
45.836364
94
0.781189
dail8859/NotepadNext
9,006
547
57
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,305
ZoomEventWatcher.cpp
dail8859_NotepadNext/src/NotepadNext/ZoomEventWatcher.cpp
/* * This file is part of Notepad Next. * Copyright 2022 Justin Dailey * * Notepad Next is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Notepad Next is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Notepad Next. If not, see <https://www.gnu.org/licenses/>. */ #include "ZoomEventWatcher.h" #include <QEvent> #include <QWheelEvent> #include <QApplication> static bool isWheelEventHorizontal(QWheelEvent *event) { #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) return event->angleDelta().y() == 0; #else return event->orientation() == Qt::Horizontal; #endif } static int wheelEventYDelta(QWheelEvent *event) { #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) return event->angleDelta().y(); #else return event->delta(); #endif } ZoomEventWatcher::ZoomEventWatcher(QObject *parent) : QObject{parent} { } bool ZoomEventWatcher::eventFilter(QObject *obj, QEvent *event) { if (event->type() == QEvent::Wheel) { QWheelEvent *wheelEvent = static_cast<QWheelEvent *>(event); if (!isWheelEventHorizontal(wheelEvent)) { if (QApplication::keyboardModifiers() & Qt::ControlModifier) { if (wheelEventYDelta(wheelEvent) > 0) { emit zoomIn(); } else { emit zoomOut(); } return true; } } } return QObject::eventFilter(obj, event); }
1,872
C++
.cpp
56
28.660714
74
0.68144
dail8859/NotepadNext
9,006
547
57
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,306
MacroManager.cpp
dail8859_NotepadNext/src/NotepadNext/MacroManager.cpp
/* * This file is part of Notepad Next. * Copyright 2024 Justin Dailey * * Notepad Next is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Notepad Next is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Notepad Next. If not, see <https://www.gnu.org/licenses/>. */ #include "MacroManager.h" #include "ApplicationSettings.h" MacroManager::MacroManager(QObject *parent) : QObject{parent} { qInfo(Q_FUNC_INFO); #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) qRegisterMetaTypeStreamOperators<Macro>("Macro"); #else // HACK: For some reason this is required to make QVariant recognize it as a valid type // see https://stackoverflow.com/q/70974383 QMetaType::fromType<Macro>().hasRegisteredDataStreamOperators(); #endif loadSettings(); } MacroManager::~MacroManager() { saveSettings(); } void MacroManager::startRecording(ScintillaNext *editor) { qInfo(Q_FUNC_INFO); Q_ASSERT(_isRecording == false); _isRecording = true; recorder.startRecording(editor); emit recordingStarted(); } void MacroManager::stopRecording() { qInfo(Q_FUNC_INFO); Q_ASSERT(_isRecording == true); _isRecording = false; Macro *m = recorder.stopRecording(); if (m->size() == 0) { // If there were no actions recorded, delete it delete m; } else { if (isCurrentMacroSaved == false) { // The previous current macro wasn't saved and we are getting ready to point to something else, delete it delete currentMacro; } isCurrentMacroSaved = false; currentMacro = m; } emit recordingStopped(); } void MacroManager::loadSettings() { qInfo(Q_FUNC_INFO); ApplicationSettings settings; int size = settings.beginReadArray("Macros"); for (int i = 0; i < size; ++i) { settings.setArrayIndex(i); if (settings.value("Macro").canConvert<Macro>()) { Macro *m = new Macro(settings.value("Macro").value<Macro>()); macros.append(m); } else { qWarning("MacroManager: Skipping invalid Macro"); } } settings.endArray(); } void MacroManager::saveSettings() const { qInfo(Q_FUNC_INFO); ApplicationSettings settings; settings.remove("Macros"); if (macros.size() > 0) { settings.beginWriteArray("Macros"); for (int i = 0; i < macros.size(); ++i) { settings.setArrayIndex(i); settings.setValue("Macro", QVariant::fromValue(*macros.at(i))); } settings.endArray(); } } void MacroManager::replayCurrentMacro(ScintillaNext *editor) { qInfo(Q_FUNC_INFO); currentMacro->replay(editor); } void MacroManager::saveCurrentMacro(const QString &macroName) { qInfo(Q_FUNC_INFO); isCurrentMacroSaved = true; currentMacro->setName(macroName); macros.append(currentMacro); } bool MacroManager::hasCurrentUnsavedMacro() const { return currentMacro != Q_NULLPTR && isCurrentMacroSaved == false; }
3,466
C++
.cpp
111
26.540541
117
0.687011
dail8859/NotepadNext
9,006
547
57
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,307
EditorHexViewerTableModel.cpp
dail8859_NotepadNext/src/NotepadNext/EditorHexViewerTableModel.cpp
/* * This file is part of Notepad Next. * Copyright 2022 Justin Dailey * * Notepad Next is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Notepad Next is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Notepad Next. If not, see <https://www.gnu.org/licenses/>. */ #include "EditorHexViewerTableModel.h" #include "ScintillaNext.h" static int IndexToPos(const QModelIndex &index) { return index.row() * 16 + index.column(); } EditorHexViewerTableModel::EditorHexViewerTableModel(QObject *parent) : QAbstractTableModel(parent) { } void EditorHexViewerTableModel::setEditor(ScintillaNext *e) { editor = e; } QVariant EditorHexViewerTableModel::headerData(int section, Qt::Orientation orientation, int role) const { if (role == Qt::DisplayRole) { if (orientation == Qt::Horizontal) { if (section == 16) return QVariant(); return QString("%1").arg(section, 2, 16, QChar('0')).toUpper(); } else if (orientation == Qt::Vertical) { return QString("%1").arg(section * 16, 8, 16, QChar('0')).toUpper(); } } else if (role == Qt::TextAlignmentRole) { return Qt::AlignCenter; } return QVariant(); } int EditorHexViewerTableModel::rowCount(const QModelIndex &parent) const { if (parent.isValid()) return 0; return (editor->length() / 16) + 1; } int EditorHexViewerTableModel::columnCount(const QModelIndex &parent) const { if (parent.isValid()) return 0; return 16 + 1; } QVariant EditorHexViewerTableModel::data(const QModelIndex &index, int role) const { if (!index.isValid()) return QVariant(); if (role == Qt::DisplayRole || role == Qt::EditRole || role == Qt::ToolTipRole) { if (index.column() == 16) { QString str; for (int i = 0; i < 16 ; ++i) { int docPos = index.row() * 16 + i; if (docPos >= editor->length()) break; QChar c = QChar(static_cast<uchar>(editor->charAt(docPos))); str += c.isPrint() ? c : '.'; } return str; } int docPos = IndexToPos(index); if (docPos >= editor->length()) return QVariant(); unsigned char ch = static_cast<unsigned char>(editor->charAt(docPos)); return QString("%1").arg(ch, 2, 16, QChar('0')).toUpper(); } else if (role == Qt::TextAlignmentRole) { if (index.column() == 16) return Qt::AlignVCenter; else return Qt::AlignCenter; } return QVariant(); } bool EditorHexViewerTableModel::setData(const QModelIndex &index, const QVariant &value, int role) { if (index.isValid() && role == Qt::EditRole) { bool ok; unsigned int charValue = value.toString().toInt(&ok, 16); if (ok && charValue <= 255) { QByteArray byte(1, static_cast<char>(charValue)); int pos = IndexToPos(index); editor->setTargetRange(pos, pos + 1); editor->replaceTarget(1, byte.constData()); emit dataChanged(index, index, QVector<int>() << role); return true; } } return false; } Qt::ItemFlags EditorHexViewerTableModel::flags(const QModelIndex &index) const { if (!index.isValid()) return Qt::NoItemFlags; if (index.column() == 16) { // The string displayed at the end return Qt::ItemIsEnabled; } else if (IndexToPos(index) >= editor->length()) { // The potentially empty cells past the end of the document return Qt::NoItemFlags; } else { return Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable; } }
4,141
C++
.cpp
117
29.393162
104
0.639549
dail8859/NotepadNext
9,006
547
57
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,308
LuaExtension.cpp
dail8859_NotepadNext/src/NotepadNext/LuaExtension.cpp
/* * This file is part of Notepad Next. * Copyright 2019 Justin Dailey * * Notepad Next is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Notepad Next is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Notepad Next. If not, see <https://www.gnu.org/licenses/>. */ #include <stdlib.h> #include <string.h> #include <ctype.h> #include <stdio.h> #include <time.h> #include <string> #include <vector> #include <fstream> #include "Scintilla.h" #include "LuaExtension.h" #include "IFaceTableMixer.h" #include "SciIFaceTable.h" #include "lua.hpp" IFaceTableMixer ifacemixer; // From lua.c #define EOFMARK "<eof>" #define marklen (sizeof(EOFMARK)/sizeof(char) - 1) static bool call_function(lua_State *L, int nargs, bool ignoreFunctionReturnValue); // Helper function from SciTE [[maybe_unused]] static int Substitute(std::string &s, const std::string &sFind, const std::string &sReplace) { int c = 0; size_t lenFind = sFind.size(); size_t lenReplace = sReplace.size(); size_t posFound = s.find(sFind); while (posFound != std::string::npos) { s.replace(posFound, lenFind, sReplace); posFound = s.find(sFind, posFound + lenReplace); c++; } return c; } // Helper function from SciTE [[maybe_unused]] static bool Exists(const char *fileName) { bool ret = false; if (fileName && fileName[0]) { FILE *fp = fopen(fileName, "rb"); if (fp) { ret = true; fclose(fp); } } return ret; } // A note on naming conventions: // I've gone back and forth on this a bit, trying different styles. // It isn't easy to get something that feels consistent, considering // that the Lua API uses lower case, underscore-separated words and // Scintilla of course uses mixed case with no underscores. // What I've settled on is that functions that require you to think // about the Lua stack are likely to be mixed with Lua API functions, // so these should using a naming convention similar to Lua itself. // Functions that don't manipulate Lua at a low level should follow // the normal SciTE convention. There is some grey area of course, // and for these I just make a judgement call static ScintillaEdit *editor; static lua_State *luaState = 0; static bool luaDisabled = false; static bool tracebackEnabled = true; typedef int NppExtensionAPIPane; void hostTrace(const char *s) { qInfo("%s", s); } void hostTraceError(const char *s) { qWarning("%s", s); } // Forward declarations static NppExtensionAPIPane check_pane_object(lua_State *L, int index); static void push_pane_object(lua_State *L, NppExtensionAPIPane p); static int iface_function_helper(lua_State *L, const IFaceFunction &func); inline void raise_error(lua_State *L, const char *errMsg=NULL) { luaL_where(L, 1); if (errMsg) { lua_pushstring(L, errMsg); } else { lua_insert(L, -2); } lua_concat(L, 2); lua_error(L); } inline void raise_ferror(lua_State *L, const char *fmt, ...) { va_list args; va_start(args, fmt); lua_pushvfstring(L, fmt, args); va_end(args); raise_error(L); } inline int absolute_index(lua_State *L, int index) { return ((index < 0) && (index != LUA_REGISTRYINDEX)) ? (lua_gettop(L) + index + 1) : index; } [[maybe_unused]] static int cf_npp_send(lua_State *L) { // This is reinstated as a replacement for the old <pane>:send, which was removed // due to safety concerns. Is now exposed as npp.SendEditor / npp.SendOutput. // It is rewritten to be typesafe, checking the arguments against the metadata in // IFaceTable in the same way that the object interface does. IFaceFunction propfunc; int paneIndex = lua_upvalueindex(1); check_pane_object(L, paneIndex); int message = (int)luaL_checkinteger(L, 1); lua_pushvalue(L, paneIndex); lua_replace(L, 1); const IFaceFunction *func; func = SciIFaceTable.GetFunctionByMessage(message); if (func == nullptr) { propfunc = SciIFaceTable.GetPropertyFuncByMessage(message); if (propfunc.value != -1) func = &propfunc; } if (func != nullptr) { if (IFaceFunctionIsScriptable(*func)) { return iface_function_helper(L, *func); } else { raise_error(L, "Cannot call send for this function: not scriptable."); return 0; } } else { raise_error(L, "Message number does not match any published Scintilla / Notepad++ function or property"); return 0; } } [[maybe_unused]] static int cf_npp_constname(lua_State *L) { char constName[100] = ""; const char *hint = nullptr; int message = (int)luaL_checkinteger(L, 1); hint = luaL_optstring(L, 2, nullptr); if (ifacemixer.GetConstantName(message, constName, 100, hint) > 0) { lua_pushstring(L, constName); return 1; } else { raise_error(L, "Argument does not match any Scintilla / Notepad++ constant"); return 0; } } void stackdump(lua_State* l) { int i; int top = lua_gettop(l); for (i = 1; i <= top; i++) { /* repeat for each level */ int t = lua_type(l, i); hostTrace(lua_typename(l, t)); hostTrace(" "); /* put a separator */ } hostTrace("\n"); /* end the listing */ } static NppExtensionAPIPane check_pane_object(lua_State *L, int index) { NppExtensionAPIPane *pPane = static_cast<NppExtensionAPIPane *>(luaL_testudata(L, index, "Nn_MT_Pane")); if ((!pPane) && lua_istable(L, index)) { // so that nested objects have a convenient way to do a back reference int absIndex = absolute_index(L, index); lua_pushliteral(L, "pane"); lua_gettable(L, absIndex); pPane = static_cast<NppExtensionAPIPane *>(luaL_testudata(L, -1, "Nn_MT_Pane")); } if (pPane) { return *pPane; } pPane = static_cast<NppExtensionAPIPane *>(luaL_testudata(L, index, "Nn_MT_Application")); // NOTE: I'm not sure what the above comment about the "back reference" means. This may or // may not apply in this case. So that if statement may need pasted/modified in this case if (pPane) { return *pPane; } if (index == 1) lua_pushliteral(L, "Self object is missing in pane method or property access."); else if (index == lua_upvalueindex(1)) lua_pushliteral(L, "Internal error: pane object expected in closure."); else lua_pushliteral(L, "Pane object expected."); raise_error(L); return 0; // this line never reached } static int cf_global_print(lua_State *L) { int nargs = lua_gettop(L); lua_getglobal(L, "tostring"); for (int i = 1; i <= nargs; ++i) { if (i > 1) hostTrace("\t"); const char *argStr = lua_tostring(L, i); if (argStr) { hostTrace(argStr); } else { lua_pushvalue(L, -1); // tostring lua_pushvalue(L, i); lua_call(L, 1, 1); argStr = lua_tostring(L, -1); if (argStr) { hostTrace(argStr); } else { raise_error(L, "tostring (called from print) returned a non-string"); } lua_settop(L, nargs + 1); } } hostTrace("\n"); return 0; } [[maybe_unused]] static bool call_function(lua_State *L, int nargs, bool ignoreFunctionReturnValue=false) { bool handled = false; if (L) { int traceback = 0; if (tracebackEnabled) { lua_getglobal(L, "debug"); lua_getfield(L, -1, "traceback"); lua_remove(L, -2); if (lua_isfunction(L, -1)) { traceback = lua_gettop(L) - nargs - 1; lua_insert(L, traceback); } else { lua_pop(L, 1); } } int result = lua_pcall(L, nargs, ignoreFunctionReturnValue ? 0 : 1, traceback); if (traceback) { lua_remove(L, traceback); } if (result == LUA_OK) { if (ignoreFunctionReturnValue) { handled = true; } else { handled = (0 != lua_toboolean(L, -1)); lua_pop(L, 1); } } else if (result == LUA_ERRRUN) { lua_getglobal(L, "print"); lua_insert(L, -2); // use pushed error message lua_pcall(L, 1, 0, 0); } else { lua_pop(L, 1); if (result == LUA_ERRMEM) { hostTraceError("Memory allocation error\n"); } else if (result == LUA_ERRERR) { hostTraceError("An error occurred, but cannot be reported due to failure in _TRACEBACK\n"); } else { hostTraceError("Unexpected error\n"); } } } return handled; } struct ScintillaFailure { sptr_t status; explicit ScintillaFailure(sptr_t status_) : status(status_) { } }; static int iface_function_helper(lua_State *L, const IFaceFunction &func) { NppExtensionAPIPane p = check_pane_object(L, 1); int arg = 2; sptr_t params[2] = {0,0}; char *stringResult = 0; enum stringResultType { none, string, tstring } needStringResult = none; int loopParamCount = 2; if (func.paramType[0] == iface_length && func.paramType[1] == iface_string) { params[0] = static_cast<sptr_t>(lua_rawlen(L, arg)); params[1] = reinterpret_cast<sptr_t>(params[0] ? lua_tostring(L, arg) : ""); loopParamCount = 0; } else if ((func.paramType[1] == iface_stringresult) || (func.returnType == iface_stringresult)) { needStringResult = (func.paramType[1] == iface_stringresult) || (func.returnType == iface_stringresult) ? string : tstring; // The buffer will be allocated later, so it won't leak if Lua does // a longjmp in response to a bad arg. if (func.paramType[0] == iface_length) { loopParamCount = 0; } else { loopParamCount = 1; } } // Specifically handle these 2 messages because they carry the setter in the 2nd param if (func.value == SCI_SETMARGINLEFT || func.value == SCI_SETMARGINRIGHT) { params[1] = static_cast<sptr_t>(luaL_checkinteger(L, arg++)); } else { for (int i = 0; i < loopParamCount; ++i) { if (func.paramType[i] == iface_string) { const char *s = lua_tostring(L, arg++); params[i] = reinterpret_cast<sptr_t>(s ? s : ""); } else if (func.paramType[i] == iface_keymod) { int keycode = static_cast<int>(luaL_checkinteger(L, arg++)) & 0xFFFF; int modifiers = static_cast<int>(luaL_checkinteger(L, arg++)) & (SCMOD_SHIFT|SCMOD_CTRL|SCMOD_ALT); params[i] = keycode | (modifiers<<16); } else if (func.paramType[i] == iface_bool) { params[i] = lua_toboolean(L, arg++); } else if (IFaceTypeIsNumeric(func.paramType[i])) { params[i] = static_cast<sptr_t>(luaL_checkinteger(L, arg++)); } } } if (needStringResult != none) { sptr_t stringResultLen; if (needStringResult == string) { stringResultLen = editor->send(func.value, params[0], 0); if (stringResultLen > 0) { // not all string result methods are guaranteed to add a null terminator stringResult = new char[stringResultLen+1]; stringResult[stringResultLen]='\0'; params[1] = reinterpret_cast<sptr_t>(stringResult); } else { // Is this an error? Are there any cases where it's not an error, // and where the right thing to do is just return a blank string? return 0; } } if (func.paramType[0] == iface_length) { params[0] = stringResultLen; } } // Now figure out what to do with the param types and return type. // - stringresult gets inserted at the start of return tuple. // - numeric return type gets returned to lua as a number (following the stringresult) // - other return types e.g. void get dropped. sptr_t result = 0; try { result = editor->send(func.value, params[0], params[1]); } catch (ScintillaFailure &sf) { std::string failureExplanation; failureExplanation += "Lua: Scintilla failure "; failureExplanation += std::to_string(sf.status); failureExplanation += " for message "; failureExplanation += std::to_string(func.value); failureExplanation += ".\n"; // Reset status before continuing editor->send(SCI_SETSTATUS, SC_STATUS_OK, 0); hostTraceError(failureExplanation.c_str()); } int resultCount = 0; if (stringResult) { lua_pushstring(L, stringResult); delete[] stringResult; resultCount++; } if (func.returnType == iface_bool) { lua_pushboolean(L, static_cast<int>(result)); resultCount++; } else if (IFaceTypeIsNumeric(func.returnType)) { lua_pushinteger(L, static_cast<lua_Integer>(result)); resultCount++; } return resultCount; } struct IFacePropertyBinding { NppExtensionAPIPane pane; const IFaceProperty *prop; }; static int cf_ifaceprop_metatable_index(lua_State *L) { // if there is a getter, __index calls it // otherwise, __index raises "property 'name' is write-only". IFacePropertyBinding *ipb = static_cast<IFacePropertyBinding *>(luaL_testudata(L, 1, "Nn_MT_IFacePropertyBinding")); if (!(ipb && IFacePropertyIsScriptable(*(ipb->prop)))) { raise_error(L, "Internal error: property binding is improperly set up"); return 0; } if (ipb->prop->getter == 0) { raise_error(L, "Attempt to read a write-only indexed property"); return 0; } IFaceFunction func = ipb->prop->GetterFunction(); // rewrite the stack to match what the function expects. put pane at index 1; param is already at index 2. push_pane_object(L, ipb->pane); lua_replace(L, 1); lua_settop(L, 2); return iface_function_helper(L, func); } static int cf_ifaceprop_metatable_newindex(lua_State *L) { IFacePropertyBinding *ipb = static_cast<IFacePropertyBinding *>(luaL_testudata(L, 1, "Nn_MT_IFacePropertyBinding")); if (!(ipb && IFacePropertyIsScriptable(*(ipb->prop)))) { raise_error(L, "Internal error: property binding is improperly set up"); return 0; } if (ipb->prop->setter == 0) { raise_error(L, "Attempt to write a read-only indexed property"); return 0; } IFaceFunction func = ipb->prop->SetterFunction(); // rewrite the stack to match what the function expects. // pane at index 1; param at index 2, value at index 3 push_pane_object(L, ipb->pane); lua_replace(L, 1); lua_settop(L, 3); return iface_function_helper(L, func); } static int cf_pane_iface_function(lua_State *L) { int funcidx = lua_upvalueindex(1); const IFaceFunction *func = static_cast<IFaceFunction *>(lua_touserdata(L, funcidx)); if (func) { return iface_function_helper(L, *func); } else { raise_error(L, "Internal error - bad upvalue in iface function closure"); return 0; } } static int push_iface_function(lua_State *L, const char *name, IFaceTableInterface *iface) { auto func = iface->FindFunction(name); if (func != nullptr) { if (IFaceFunctionIsScriptable(*func)) { lua_pushlightuserdata(L, (void*)func); lua_pushcclosure(L, cf_pane_iface_function, 1); // Since Lua experts say it is inefficient to create closures / cfunctions // in an inner loop, I tried caching the closures in the metatable, and looking // for them there first. However, it made very little difference and did not // seem worth the added complexity. - WBD return 1; } } return -1; // signal to try next pane index handler } static int push_iface_propval(lua_State *L, const char *name, IFaceTableInterface *iface) { // this function doesn't raise errors, but returns 0 if the function is not handled. auto prop = iface->FindProperty(name); if (prop != nullptr) { if (!IFacePropertyIsScriptable(*prop)) { raise_error(L, "Error: iface property is not scriptable."); return -1; } if (prop->paramType == iface_void) { if (prop->getter) { lua_settop(L, 1); return iface_function_helper(L, prop->GetterFunction()); } } else if (prop->paramType == iface_bool) { // The bool getter is untested since there are none in the iface. // However, the following is suggested as a reference protocol. NppExtensionAPIPane p = check_pane_object(L, 1); if (prop->getter) { if (editor->send(prop->getter, 1, 0)) { lua_pushnil(L); return 1; } else { lua_settop(L, 1); lua_pushboolean(L, 0); return iface_function_helper(L, prop->GetterFunction()); } } } else { // Indexed property. These return an object with the following behavior: // if there is a getter, __index calls it // otherwise, __index raises "property 'name' is write-only". // if there is a setter, __newindex calls it // otherwise, __newindex raises "property 'name' is read-only" IFacePropertyBinding *ipb = static_cast<IFacePropertyBinding *>(lua_newuserdata(L, sizeof(IFacePropertyBinding))); if (ipb) { ipb->pane = check_pane_object(L, 1); ipb->prop = prop; if (luaL_newmetatable(L, "Nn_MT_IFacePropertyBinding")) { lua_pushliteral(L, "__index"); lua_pushcfunction(L, cf_ifaceprop_metatable_index); lua_settable(L, -3); lua_pushliteral(L, "__newindex"); lua_pushcfunction(L, cf_ifaceprop_metatable_newindex); lua_settable(L, -3); } lua_setmetatable(L, -2); return 1; } else { raise_error(L, "Internal error: failed to allocate userdata for indexed property"); return -1; } } } return -1; // signal to try next pane index handler } static int cf_pane_metatable_index(lua_State *L) { IFaceTableInterface *iface = static_cast<IFaceTableInterface *>(lua_touserdata(L, lua_upvalueindex(1))); if (lua_isstring(L, 2)) { const char *name = lua_tostring(L, 2); // these return the number of values pushed (possibly 0), or -1 if no match int results = push_iface_function(L, name, iface); if (results < 0) results = push_iface_propval(L, name, iface); if (results >= 0) { return results; } else if (name[0] != '_') { lua_getmetatable(L, 1); if (lua_istable(L, -1)) { lua_pushvalue(L, 2); lua_gettable(L, -2); if (!lua_isnil(L, -1)) return 1; } } } raise_error(L, "Pane function / readable property / indexed writable property name expected"); return 0; } static int cf_pane_metatable_newindex(lua_State *L) { IFaceTableInterface *iface = static_cast<IFaceTableInterface *>(lua_touserdata(L, lua_upvalueindex(1))); if (lua_isstring(L, 2)) { auto prop = iface->FindProperty(lua_tostring(L, 2)); if (prop != nullptr) { if (IFacePropertyIsScriptable(*prop)) { if (prop->setter) { // stack needs to be rearranged to look like an iface function call lua_remove(L, 2); if (prop->paramType == iface_void) { return iface_function_helper(L, prop->SetterFunction()); } else if ((prop->paramType == iface_bool)) { if (!lua_isnil(L, 3)) { lua_pushboolean(L, 1); lua_insert(L, 2); } else { // the nil will do as a false value. // just push an arbitrary numeric value that Scintilla will ignore lua_pushinteger(L, 0); } return iface_function_helper(L, prop->SetterFunction()); } else { raise_error(L, "Error - (pane object) cannot assign directly to indexed property"); } } else { raise_error(L, "Error - (pane object) cannot assign to a read-only property"); } } } } raise_error(L, "Error - (pane object) expected the name of a writable property"); return 0; } void push_pane_object(lua_State *L, NppExtensionAPIPane p) { *static_cast<NppExtensionAPIPane *>(lua_newuserdata(L, sizeof(p))) = p; if (luaL_newmetatable(L, "Nn_MT_Pane")) { lua_pushlightuserdata(L, &SciIFaceTable); lua_pushcclosure(L, cf_pane_metatable_index, 1); lua_setfield(L, -2, "__index"); lua_pushlightuserdata(L, &SciIFaceTable); lua_pushcclosure(L, cf_pane_metatable_newindex, 1); lua_setfield(L, -2, "__newindex"); // Push built-in functions into the metatable, where the custom // __index metamethod will find them. } lua_setmetatable(L, -2); } static int cf_global_metatable_index(lua_State *L) { if (lua_isstring(L, 2)) { const char *name = lua_tostring(L, 2); if ((name[0] < 'A') || (name[0] > 'Z') || ((name[1] >= 'a') && (name[1] <= 'z'))) { // short circuit; iface constants are always upper-case and start with a letter return 0; } auto con = ifacemixer.FindConstant(name); if (con != nullptr) { lua_pushinteger(L, con->value); return 1; } else { auto func = ifacemixer.FindFunctionByConstantName(name); if (func != nullptr) { lua_pushinteger(L, func->value); // FindFunctionByConstantName is slow, so cache the result into the // global table. My tests show this gives an order of magnitude // improvement. lua_pushvalue(L, 2); lua_pushvalue(L, -2); lua_rawset(L, 1); return 1; } } } return 0; // global namespace access should not raise errors } static int LuaPanicFunction(lua_State *L) { if (L == luaState) { lua_close(luaState); luaState = NULL; luaDisabled = true; } hostTraceError("\nError occurred in unprotected call. This is very bad.\n"); return 1; } static bool InitGlobalScope() { tracebackEnabled = true; if (!luaDisabled) { if (!luaState) { luaDisabled = true; hostTraceError("Scripting engine failed to initialise\n"); return false; } lua_atpanic(luaState, LuaPanicFunction); } else { return false; } ifacemixer.AddIFaceTable(&SciIFaceTable); // ...register standard libraries luaL_openlibs(luaState); // override a library function whose default impl uses stdout lua_register(luaState, "print", cf_global_print); // pane objects push_pane_object(luaState, 0); lua_setglobal(luaState, "editor"); // get global environment table from registry lua_pushglobaltable(luaState); // Metatable for global namespace, to publish iface constants if (luaL_newmetatable(luaState, "Nn_MT_GlobalScope")) { lua_pushcfunction(luaState, cf_global_metatable_index); lua_setfield(luaState, -2, "__index"); } // set global index callback hook lua_setmetatable(luaState, -2); // remove the global environment table from the stack lua_pop(luaState, 1); return true; } LuaExtension::LuaExtension() {} LuaExtension::~LuaExtension() {} LuaExtension &LuaExtension::Instance() { static LuaExtension singleton; return singleton; } bool LuaExtension::Initialise(lua_State *L, ScintillaNext *editor_) { luaState = L; editor = editor_; InitGlobalScope(); return false; } void LuaExtension::setEditor(ScintillaEdit *editor_) { editor = editor_; } bool LuaExtension::Finalise() { if (luaState) { lua_close(luaState); } luaState = NULL; editor = NULL; return false; } bool LuaExtension::RunString(const char *s) { if (luaState || InitGlobalScope()) { int status = luaL_loadbuffer(luaState, s, strlen(s), "=File"); if (status == LUA_OK) { status = lua_pcall(luaState, 0, LUA_MULTRET, 0); } if (status != LUA_OK) { // Print an error message hostTraceError(lua_tostring(luaState, -1)); hostTraceError("\n"); lua_settop(luaState, 0); /* clear stack */ return false; } lua_settop(luaState, 0); /* clear stack */ } return true; } bool LuaExtension::OnExecute(const char *s) { static bool isFirstLine = true; static std::string chunk; int status = 0; if (luaState || InitGlobalScope()) { if (isFirstLine) { // First try to compile the chunk as a return statement const char *retline = lua_pushfstring(luaState, "return %s;", s); status = luaL_loadbuffer(luaState, retline, strlen(retline), "=Console"); if (status == 0) lua_remove(luaState, -2); else lua_pop(luaState, 2); if (status == LUA_OK) { // It worked, let's call it status = lua_pcall(luaState, 0, LUA_MULTRET, 0); } else { // Else let's just try it as is status = luaL_loadbuffer(luaState, s, strlen(s), "=Console"); if (status == LUA_OK) { status = lua_pcall(luaState, 0, LUA_MULTRET, 0); } else if (status == LUA_ERRSYNTAX) { size_t lmsg; const char *msg = lua_tolstring(luaState, -1, &lmsg); if (lmsg >= marklen && strcmp(msg + lmsg - marklen, EOFMARK) == 0) { lua_pop(luaState, 1); isFirstLine = false; chunk = s; return false; } } } } else { // Append the new line to what we've gotten so far chunk.append("\n"); chunk.append(s); status = luaL_loadbuffer(luaState, chunk.c_str(), chunk.length(), "=Console"); if (status == LUA_OK) { status = lua_pcall(luaState, 0, LUA_MULTRET, 0); } else if (status == LUA_ERRSYNTAX) { size_t lmsg; const char *msg = lua_tolstring(luaState, -1, &lmsg); if (lmsg >= marklen && strcmp(msg + lmsg - marklen, EOFMARK) == 0) { lua_pop(luaState, 1); return false; } } } // At this point *something* ran so clear out some data chunk.clear(); isFirstLine = true; if (status == LUA_OK) { if (lua_gettop(luaState) > 0) { /* any result to print? */ lua_getglobal(luaState, "print"); lua_insert(luaState, 1); if (lua_pcall(luaState, lua_gettop(luaState) - 1, 0, 0) != 0) hostTraceError("error calling " LUA_QL("print")); } // else everything finished fine but had no return value } else { // Print an error message if possible const char *errmsg = lua_tostring(luaState, -1); if (errmsg) { hostTraceError(errmsg); hostTraceError("\n"); } else { hostTraceError("error\n"); } } lua_settop(luaState, 0); /* clear stack */ } return true; }
29,141
C++
.cpp
734
30.896458
131
0.587322
dail8859/NotepadNext
9,006
547
57
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,309
Converter.cpp
dail8859_NotepadNext/src/NotepadNext/Converter.cpp
/* * This file is part of Notepad Next. * Copyright 2022 Justin Dailey * * Notepad Next is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Notepad Next is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Notepad Next. If not, see <https://www.gnu.org/licenses/>. */ #include "Converter.h" Converter::Converter(ScintillaNext *editor) : editor(editor) { } void Converter::convert(QTextStream &stream) { convertRange(stream, 0, editor->length()); } void Converter::ensureDocumentStyled(int start, int end) { // If idle styling is used, then the document may not have styling information yet editor->colourise(start, end); }
1,103
C++
.cpp
31
33.387097
86
0.757263
dail8859/NotepadNext
9,006
547
57
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,310
SessionManager.cpp
dail8859_NotepadNext/src/NotepadNext/SessionManager.cpp
/* * This file is part of Notepad Next. * Copyright 2022 Justin Dailey * * Notepad Next is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Notepad Next is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Notepad Next. If not, see <https://www.gnu.org/licenses/>. */ #include "BookMarkDecorator.h" #include "ScintillaNext.h" #include "MainWindow.h" #include "SessionManager.h" #include "EditorManager.h" #include "NotepadNextApplication.h" #include <QDir> #include <QStandardPaths> #include <QUuid> static QString RandomSessionFileName() { return QUuid::createUuid().toString(QUuid::WithoutBraces); } // QList<int> cannot be automatically serialized to/from QSettings (i.e. QVariant) so turn it to a QVariantList static QVariantList QListToQVariantList(const QList<int> intList) { QVariantList vl; for (const int i : intList){ vl.append(i); } return vl; } // Do the opposite of the function above static QList<int> QVariantListToQList(const QVariantList &variantList) { QList<int> intList; for (const QVariant &variant : variantList) { intList.append(variant.toInt()); } return intList; } SessionManager::SessionManager(NotepadNextApplication *app, SessionFileTypes types) : app(app) { setSessionFileTypes(types); } void SessionManager::setSessionFileTypes(SessionFileTypes types) { fileTypes = types; } QDir SessionManager::sessionDirectory() const { QDir d(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)); d.mkpath("session"); d.cd("session"); return d; } void SessionManager::saveIntoSessionDirectory(ScintillaNext *editor, const QString &sessionFileName) const { editor->saveCopyAs(sessionDirectory().filePath(sessionFileName)); } SessionManager::SessionFileType SessionManager::determineType(ScintillaNext *editor) const { if (editor->isFile()) { if (editor->isSavedToDisk()) { return SessionManager::SavedFile; } else { return SessionManager::UnsavedFile; } } else { if (!editor->isSavedToDisk()) { return SessionManager::TempFile; } else { return SessionManager::None; } } } void SessionManager::clear() const { clearSettings(); clearDirectory(); } void SessionManager::clearSettings() const { ApplicationSettings settings;; // Clear everything out. There can be left over entries that are no longer needed settings.beginGroup("CurrentSession"); settings.remove(""); } void SessionManager::clearDirectory() const { QDir d = sessionDirectory(); for (const QString &f : d.entryList()) { d.remove(f); } } void SessionManager::saveSession(MainWindow *window) { qInfo(Q_FUNC_INFO); clear(); // Early out if no flags are set if (fileTypes == SessionManager::None) { return; } const ScintillaNext *currentEditor = window->currentEditor(); int currentEditorIndex = 0; ApplicationSettings settings;; settings.beginGroup("CurrentSession"); settings.beginWriteArray("OpenedFiles"); int index = 0; for (const auto &editor : window->editors()) { SessionFileType editorType = determineType(editor); if (fileTypes.testFlag(editorType)) { settings.setArrayIndex(index); if (editorType == SessionManager::SavedFile) { storeFileDetails(editor, settings); } else if (editorType == SessionManager::UnsavedFile) { storeUnsavedFileDetails(editor, settings); } else if (editorType == SessionManager::TempFile) { storeTempFile(editor, settings); } else { qWarning("Unknown SessionFileType %d", editorType); } if (currentEditor == editor) { currentEditorIndex = index; } ++index; } } settings.endArray(); settings.setValue("CurrentEditorIndex", currentEditorIndex); settings.endGroup(); } void SessionManager::loadSession(MainWindow *window) { qInfo(Q_FUNC_INFO); ApplicationSettings settings;; settings.beginGroup("CurrentSession"); ScintillaNext *currentEditor = Q_NULLPTR; const int currentEditorIndex = settings.value("CurrentEditorIndex").toInt(); const int size = settings.beginReadArray("OpenedFiles"); // NOTE: In theory the fileTypes should determine what is loaded, however if the session fileTypes // change from the last time it was saved then it means the settings were manually altered outside of the app, // which is non-standard behavior, so just load anything in the file for (int index = 0; index < size; ++index) { settings.setArrayIndex(index); ScintillaNext *editor = Q_NULLPTR; if (settings.contains("Type")) { const QString type = settings.value("Type").toString(); if (type == QStringLiteral("File")) { editor = loadFileDetails(settings); } else if (type == QStringLiteral("UnsavedFile")) { editor = loadUnsavedFileDetails(settings); } else if (type == QStringLiteral("Temp")) { editor = loadTempFile(settings); } else { qDebug("Unknown session entry type: %s", qUtf8Printable(type)); } if (editor) { if (currentEditorIndex == index) { currentEditor = editor; } } } else { qDebug("Unknown session entry type for index %d", index); } } settings.endArray(); settings.endGroup(); if (currentEditor) { window->switchToEditor(currentEditor); } } bool SessionManager::willFileGetStoredInSession(ScintillaNext *editor) const { SessionFileType editorType = determineType(editor); // See if the editor type is in the currently supported file types return fileTypes.testFlag(editorType); } void SessionManager::storeFileDetails(ScintillaNext *editor, QSettings &settings) { settings.setValue("Type", "File"); settings.setValue("FilePath", editor->getFilePath()); storeEditorViewDetails(editor, settings); } ScintillaNext* SessionManager::loadFileDetails(QSettings &settings) { qInfo(Q_FUNC_INFO); const QString filePath = settings.value("FilePath").toString(); qDebug("Session file: \"%s\"", qUtf8Printable(filePath)); ScintillaNext *editor = app->getEditorManager()->getEditorByFilePath(filePath); if (editor != Q_NULLPTR) { qDebug(" file is already open, ignoring"); return Q_NULLPTR; } if (QFileInfo::exists(filePath)) { editor = ScintillaNext::fromFile(filePath); app->getEditorManager()->manageEditor(editor); loadEditorViewDetails(editor, settings); return editor; } else { qDebug(" no longer exists on disk, ignoring"); return Q_NULLPTR; } } void SessionManager::storeUnsavedFileDetails(ScintillaNext *editor, QSettings &settings) { const QString sessionFileName = RandomSessionFileName(); settings.setValue("Type", "UnsavedFile"); settings.setValue("FilePath", editor->getFilePath()); settings.setValue("SessionFileName", sessionFileName); storeEditorViewDetails(editor, settings); saveIntoSessionDirectory(editor, sessionFileName); } ScintillaNext *SessionManager::loadUnsavedFileDetails(QSettings &settings) { qInfo(Q_FUNC_INFO); const QString filePath = settings.value("FilePath").toString(); const QString sessionFileName = settings.value("SessionFileName").toString(); const QString sessionFilePath = sessionDirectory().filePath(sessionFileName); qDebug("Session file: \"%s\"", qUtf8Printable(filePath)); qDebug(" temp loc: \"%s\"", qUtf8Printable(sessionFilePath)); ScintillaNext *editor = app->getEditorManager()->getEditorByFilePath(filePath); if (editor != Q_NULLPTR) { qDebug(" file is already open, ignoring"); return Q_NULLPTR; } if (QFileInfo::exists(filePath) && QFileInfo::exists(sessionFilePath)) { ScintillaNext *editor = ScintillaNext::fromFile(sessionFilePath); // Since this editor has different file path info, treat this as a temporary buffer editor->setFileInfo(filePath); editor->setTemporary(true); loadEditorViewDetails(editor, settings); app->getEditorManager()->manageEditor(editor); return editor; } else { // What if just filePath exists? qDebug(" no longer exists on disk, ignoring this file for session loading"); return Q_NULLPTR; } } void SessionManager::storeTempFile(ScintillaNext *editor, QSettings &settings) { const QString sessionFileName = RandomSessionFileName(); settings.setValue("Type", "Temp"); settings.setValue("FileName", editor->getName()); settings.setValue("SessionFileName", sessionFileName); settings.setValue("Language", editor->languageName); storeEditorViewDetails(editor, settings); saveIntoSessionDirectory(editor, sessionFileName); } ScintillaNext *SessionManager::loadTempFile(QSettings &settings) { qInfo(Q_FUNC_INFO); const QString fileName = settings.value("FileName").toString(); const QString sessionFileName = settings.value("SessionFileName").toString(); const QString languageName = settings.value("Language", QString()).toString(); const QString fullFilePath = sessionDirectory().filePath(sessionFileName); qDebug("Session temp file: \"%s\"", qUtf8Printable(fullFilePath)); if (QFileInfo::exists(fullFilePath)) { ScintillaNext *editor = ScintillaNext::fromFile(fullFilePath, false); editor->detachFileInfo(fileName); editor->setTemporary(true); app->getEditorManager()->manageEditor(editor); loadEditorViewDetails(editor, settings); if (!languageName.isEmpty()) { qDebug("Setting session file language to \"%s\"", qUtf8Printable(languageName)); app->setEditorLanguage(editor, languageName); } return editor; } else { qDebug(" no longer exists on disk, ignoring"); return Q_NULLPTR; } } void SessionManager::storeEditorViewDetails(ScintillaNext *editor, QSettings &settings) { settings.setValue("FirstVisibleLine", static_cast<int>(editor->firstVisibleLine() + 1)); // Keep it 1-based in the settings just for human-readability settings.setValue("CurrentPosition", static_cast<int>(editor->currentPos())); BookMarkDecorator *decorator = editor->findChild<BookMarkDecorator*>(QString(), Qt::FindDirectChildrenOnly); QList<int> bookMarkedLines = decorator->bookMarkedLines(); if (bookMarkedLines.length() > 0) settings.setValue("BookMarks", QListToQVariantList(bookMarkedLines)); } void SessionManager::loadEditorViewDetails(ScintillaNext *editor, QSettings &settings) { const int firstVisibleLine = settings.value("FirstVisibleLine").toInt() - 1; const int currentPosition = settings.value("CurrentPosition").toInt(); editor->setFirstVisibleLine(firstVisibleLine); editor->setEmptySelection(currentPosition); if (settings.contains("BookMarks")) { QList<int> bookMarkedLines = QVariantListToQList(settings.value("BookMarks").toList()); // just using .value<QList<int>>() does not work...possibly a Qt bug? BookMarkDecorator *decorator = editor->findChild<BookMarkDecorator*>(QString(), Qt::FindDirectChildrenOnly); decorator->setBookMarkedLines(bookMarkedLines); } }
12,218
C++
.cpp
316
32.566456
165
0.694971
dail8859/NotepadNext
9,006
547
57
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,311
DebugManager.cpp
dail8859_NotepadNext/src/NotepadNext/DebugManager.cpp
/* * This file is part of Notepad Next. * Copyright 2022 Justin Dailey * * Notepad Next is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Notepad Next is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Notepad Next. If not, see <https://www.gnu.org/licenses/>. */ #include "DebugManager.h" #include <QList> Q_GLOBAL_STATIC(QList<DebugOutputHandler>, handlers); Q_GLOBAL_STATIC(QStringList, buffered_debug_output); QtMessageHandler original = Q_NULLPTR; static void buffer_debug_output(QtMsgType type, const QMessageLogContext &context, const QString &msg) { buffered_debug_output->append(qFormatLogMessage(type, context, msg)); original(type, context, msg); } static void debug_manager_handler(QtMsgType type, const QMessageLogContext &context, const QString &msg) { const QString log_message = qFormatLogMessage(type, context, msg); for (DebugOutputHandler handler : *handlers) { handler(log_message); } original(type, context, msg); } void DebugManager::manageDebugOutput() { // Just to be safe, restore the original message handler qInstallMessageHandler(0); // Clear the list if it was ever used previously handlers->clear(); // Install our own custom handler original = qInstallMessageHandler(debug_manager_handler); } void DebugManager::pauseDebugOutput() { // Just to be safe, restore the original message handler qInstallMessageHandler(0); buffered_debug_output->clear(); original = qInstallMessageHandler(buffer_debug_output); } void DebugManager::resumeDebugOutput() { for (DebugOutputHandler handler : *handlers) { for (const QString &msg : *buffered_debug_output) { handler(msg); } } buffered_debug_output->clear(); qInstallMessageHandler(debug_manager_handler); } void DebugManager::addMessageHandler(DebugOutputHandler handler) { handlers->append(handler); }
2,376
C++
.cpp
65
33.153846
104
0.752073
dail8859/NotepadNext
9,006
547
57
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,312
NotepadNextApplication.cpp
dail8859_NotepadNext/src/NotepadNext/NotepadNextApplication.cpp
/* * This file is part of Notepad Next. * Copyright 2019 Justin Dailey * * Notepad Next is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Notepad Next is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Notepad Next. If not, see <https://www.gnu.org/licenses/>. */ #include "MainWindow.h" #include "NotepadNextApplication.h" #include "RecentFilesListManager.h" #include "EditorManager.h" #include "LuaExtension.h" #include "DebugManager.h" #include "SessionManager.h" #include "TranslationManager.h" #include "ApplicationSettings.h" #include "LuaState.h" #include "lua.hpp" #include "LuaBridge.h" #include "EditorConfigAppDecorator.h" #include "ILexer.h" #include "Lexilla.h" #include <QCommandLineParser> #include <QDirIterator> #ifdef Q_OS_WIN #include <Windows.h> #endif const SingleApplication::Options opts = SingleApplication::ExcludeAppPath | SingleApplication::ExcludeAppVersion | SingleApplication::SecondaryNotification; template <> struct luabridge::Stack <QString const&> { static void push (lua_State* L, QString const &s) { lua_pushlstring(L, s.toLatin1().constData(), s.toLatin1().size()); } static QString get (lua_State* L, int index) { return QString(luaL_checkstring (L, index)); } }; void parseCommandLine(QCommandLineParser &parser, const QStringList &args) { parser.setApplicationDescription("Notepad Next"); parser.addHelpOption(); parser.addVersionOption(); parser.addPositionalArgument("files", "Files to open."); parser.addOptions({ {"translation", "Overrides the system default translation.", "translation"}, {"reset-settings", "Resets all application settings."}, {"n", "Places the cursor on the line number for the first file specified", "line number"} }); parser.process(args); } static QString toLocalFileName(const QString file) { QUrl fileUrl(file); return fileUrl.isValid() && fileUrl.isLocalFile() ? fileUrl.toLocalFile() : file; } NotepadNextApplication::NotepadNextApplication(int &argc, char **argv) : SingleApplication(argc, argv, true, opts) { #ifdef Q_OS_WIN // Create a system-wide mutex so the installer can detect if it is running CreateMutex(NULL, false, L"NotepadNextMutex"); #endif parseCommandLine(parser, arguments()); DebugManager::manageDebugOutput(); DebugManager::pauseDebugOutput(); } bool NotepadNextApplication::init() { qInfo(Q_FUNC_INFO); setWindowIcon(QIcon(QStringLiteral(":/icons/NotepadNext.png"))); settings = new ApplicationSettings(this); if (parser.isSet("reset-settings")) { settings->clear(); } // Translation files are stored as a qresource translationManager = new TranslationManager(this, QStringLiteral(":/i18n/")); // The command line overrides the settings if (!parser.value("translation").isEmpty()) { translationManager->loadTranslationByName(parser.value("translation")); } else { // Normally the setting is "" which will load the default system translation translationManager->loadTranslationByName(settings->translation()); } // This connection isn't needed since the application can not appropriately retranslate the UI at runtime //connect(settings, &ApplicationSettings::translationChanged, translationManager, &TranslationManager::loadTranslationByName); luaState = new LuaState(); recentFilesListManager = new RecentFilesListManager(this); editorManager = new EditorManager(settings, this); sessionManager = new SessionManager(this); connect(editorManager, &EditorManager::editorCreated, recentFilesListManager, [=](ScintillaNext *editor) { if (editor->isFile()) { recentFilesListManager->removeFile(editor->getFilePath()); } }); connect(editorManager, &EditorManager::editorClosed, recentFilesListManager, [=](ScintillaNext *editor) { if (editor->isFile()) { recentFilesListManager->addFile(editor->getFilePath()); } }); loadSettings(); connect(this, &NotepadNextApplication::aboutToQuit, this, &NotepadNextApplication::saveSettings); EditorConfigAppDecorator *ecad = new EditorConfigAppDecorator(this); ecad->setEnabled(true); luaState->executeFile(":/scripts/init.lua"); LuaExtension::Instance().Initialise(luaState->L, Q_NULLPTR); // LuaBridge is not a long term solution // This is probably temporary, but it is quick and works luabridge::setHideMetatables(false); luabridge::getGlobalNamespace(luaState->L) .beginNamespace("nn") .beginClass<ApplicationSettings>("Settings") .addFunction("showMenuBar", &ApplicationSettings::setShowMenuBar) .addFunction("showToolBar", &ApplicationSettings::setShowToolBar) .addFunction("showTabBar", &ApplicationSettings::setShowTabBar) .addFunction("showStatusBar", &ApplicationSettings::setShowStatusBar) .endClass() .endNamespace(); luabridge::setGlobal(luaState->L, settings, "settings"); createNewWindow(); connect(editorManager, &EditorManager::editorCreated, window, &MainWindow::addEditor); luabridge::getGlobalNamespace(luaState->L) .beginNamespace("nn") .beginClass<QWidget>("QWidget") .addFunction("exit", &QWidget::close) .endClass() .deriveClass<MainWindow, QWidget>("MainWindow") .addFunction("newFile", &MainWindow::newFile) .addFunction("openFile", &MainWindow::openFile) .addFunction("openFileDialog", &MainWindow::openFileDialog) .addFunction("reloadFile", &MainWindow::reloadFile) .addFunction("saveFile", &MainWindow::saveCurrentFile) .addFunction("saveFileAs", &MainWindow::saveCurrentFileAs) .addFunction("closeFile", &MainWindow::closeCurrentFile) .endClass() .endNamespace(); luabridge::setGlobal(luaState->L, window, "window"); // If the application is activated (e.g. user switching to another program and them back) the focus // needs to be reset on whatever object previously had focus (e.g. the find dialog) connect(this, &NotepadNextApplication::focusChanged, this, [&](QWidget *old, QWidget *now) { Q_UNUSED(old); if (now) { currentlyFocusedWidget = now; } }); connect(this, &SingleApplication::instanceStarted, window, &MainWindow::bringWindowToForeground); connect(this, &SingleApplication::receivedMessage, this, &NotepadNextApplication::receiveInfoFromSecondaryInstance, Qt::QueuedConnection); connect(this, &NotepadNextApplication::applicationStateChanged, this, [&](Qt::ApplicationState state) { if (state == Qt::ApplicationActive) { // Make sure it is active... // The application can be active without the main window being show e.g. if there is a // message box that pops up before the main window if (window->isActiveWindow()) { window->focusIn(); } if (!currentlyFocusedWidget.isNull()) { currentlyFocusedWidget->activateWindow(); } } }); if (settings->restorePreviousSession()) { qInfo("Restoring previous session"); sessionManager->loadSession(window); } openFiles(parser.positionalArguments()); if (parser.isSet("n") && parser.positionalArguments().length() > 0) { QString firstFile = parser.positionalArguments()[0]; ScintillaNext *editor = editorManager->getEditorByFilePath(toLocalFileName(firstFile)); if (editor) { int n = parser.value("n").toInt(); editor->gotoLine(n - 1); } } // If the window does not have any editors (meaning the no files were // specified on the command line) then create a new empty file if (window->editorCount() == 0) { window->newFile(); } // Everything should be ready at this point window->restoreWindowState(); window->show(); DebugManager::resumeDebugOutput(); return true; } SessionManager *NotepadNextApplication::getSessionManager() const { SessionManager::SessionFileTypes fileTypes; if (settings->restorePreviousSession()) { fileTypes |= SessionManager::SavedFile; } if (settings->restoreUnsavedFiles()) { fileTypes |= SessionManager::UnsavedFile; } if (settings->restoreTempFiles()) { fileTypes |= SessionManager::TempFile; } // Update the file types supported in case something has changed in the settings sessionManager->setSessionFileTypes(fileTypes); return sessionManager; } QString NotepadNextApplication::getFileDialogFilter() const { return getLuaState()->executeAndReturn<QString>("return DialogFilters()"); } QString NotepadNextApplication::getFileDialogFilterForLanguage(const QString &language) const { return getLuaState()->executeAndReturn<QString>(QString("return FilterForLanguage(\"%1\")").arg(language).toLatin1().constData()); } QStringList NotepadNextApplication::getLanguages() const { return getLuaState()->executeAndReturn<QStringList>( R"( local names = {} for k in pairs(languages) do table.insert(names, k) end table.sort(names, function (a, b) return string.lower(a) < string.lower(b) end) return names )"); } void NotepadNextApplication::setEditorLanguage(ScintillaNext *editor, const QString &languageName) const { LuaExtension::Instance().setEditor(editor); getLuaState()->execute(QString("languageName = \"%1\"").arg(languageName).toLatin1().constData()); const QString lexer = getLuaState()->executeAndReturn<QString>("return languages[languageName].lexer"); editor->languageName = languageName; editor->languageSingleLineComment = getLuaState()->executeAndReturn<QString>("return languages[languageName].singleLineComment or \"\"").toUtf8(); auto lexerInstance = CreateLexer(lexer.toLatin1().constData()); editor->setILexer((sptr_t) lexerInstance); editor->clearDocumentStyle(); // Remove all previous style information, setting the lexer does not guarantee styling information is cleared // Not ideal this has to be manually emitted but it works since setILexer() is not widely used emit editor->lexerChanged(); // Dynamic properties can be used to skip part of the default initialization. The value in the // property doesn't currently matter, but may be used at a later point. getLuaState()->execute(QString("skip_tabs = %1").arg(editor->QObject::property("nn_skip_usetabs").isValid() ? "true" : "false").toLatin1().constData()); getLuaState()->execute(QString("skip_tabwidth = %1").arg(editor->QObject::property("nn_skip_tabwidth").isValid() ? "true" : "false").toLatin1().constData()); getLuaState()->execute(R"( local L = languages[languageName] if not skip_tabs then editor.UseTabs = (L.tabSettings or "tabs") == "tabs" end if not skip_tabwidth then editor.TabWidth = L.tabSize or 4 end editor.MarginWidthN[2] = L.disableFoldMargin and 0 or 16 if L.styles then for name, style in pairs(L.styles) do editor.StyleFore[style.id] = style.fgColor editor.StyleBack[style.id] = style.bgColor if style.fontStyle then editor.StyleBold[style.id] = (style.fontStyle & 1 == 1) editor.StyleItalic[style.id] = (style.fontStyle & 2 == 2) editor.StyleUnderline[style.id] = (style.fontStyle & 4 == 4) editor.StyleEOLFilled[style.id] = (style.fontStyle & 8 == 8) end end end if L.keywords then for id, kw in pairs(L.keywords) do editor.KeyWords[id] = kw end end if L.properties then for p,v in pairs(L.properties) do editor.Property[p] = v end end editor.Property["fold"] = "1" editor.Property["fold.compact"] = "0" )"); } QString NotepadNextApplication::detectLanguage(ScintillaNext *editor) const { qInfo(Q_FUNC_INFO); QString language_name = QStringLiteral("Text"); if (editor->isFile()) { language_name = detectLanguageFromExtension(editor->getFileInfo().suffix()); } if (language_name == QStringLiteral("Text")) { language_name = detectLanguageFromContents(editor); } return language_name; } QString NotepadNextApplication::detectLanguageFromExtension(const QString &extension) const { qInfo(Q_FUNC_INFO); return getLuaState()->executeAndReturn<QString>(QString(R"( local ext = "%1" for name, L in pairs(languages) do if L.extensions then for _, v in ipairs(L.extensions) do if v == ext then return name end end end end return "Text" )").arg(extension).toLatin1().constData()); } QString NotepadNextApplication::detectLanguageFromContents(ScintillaNext *editor) const { qInfo(Q_FUNC_INFO); LuaExtension::Instance().setEditor(editor); return getLuaState()->executeAndReturn<QString>(QString(R"( -- Grab a small chunk if editor.Length > 0 then editor:SetTargetRange(0, math.min(64, editor.Length)) return detectLanguageFromContents(editor.TargetText) end return "Text" )").toLatin1().constData()); } void NotepadNextApplication::sendInfoToPrimaryInstance() { qInfo(Q_FUNC_INFO); QByteArray buffer; QDataStream stream(&buffer, QIODevice::WriteOnly); stream << arguments(); const bool success = sendMessage(buffer); if (!success) { qWarning("sendMessage() unsuccessful"); } } void NotepadNextApplication::receiveInfoFromSecondaryInstance(quint32 instanceId, QByteArray message) { qInfo(Q_FUNC_INFO); Q_UNUSED(instanceId) QDataStream stream(&message, QIODevice::ReadOnly); QStringList args; stream >> args; QCommandLineParser parser; parseCommandLine(parser, args); openFiles(parser.positionalArguments()); } bool NotepadNextApplication::isRunningAsAdmin() const { static bool initialized = false; static bool isAdmin = false; if (!initialized) { initialized = true; #ifdef Q_OS_WIN BOOL isMember; SID_IDENTIFIER_AUTHORITY ntAuthority = SECURITY_NT_AUTHORITY; PSID administratorsGroupSid = NULL; // Create a SID for the Administrators group if (AllocateAndInitializeSid(&ntAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &administratorsGroupSid)) { if (CheckTokenMembership(NULL, administratorsGroupSid, &isMember)) { isAdmin = isMember; } FreeSid(administratorsGroupSid); } #endif } return isAdmin; } bool NotepadNextApplication::event(QEvent *event) { // Handle the QFileOpenEvent to open files on MacOS X. if (event->type() == QEvent::FileOpen) { QFileOpenEvent *fileOpenEvent = static_cast<QFileOpenEvent*>(event); qInfo("QFileOpenEvent %s", qUtf8Printable(fileOpenEvent->file())); openFiles(QStringList() << fileOpenEvent->file()); return true; } return SingleApplication::event(event); } void NotepadNextApplication::openFiles(const QStringList &files) { qInfo(Q_FUNC_INFO); for (const QString &file : files) { window->openFile(toLocalFileName(file)); } } void NotepadNextApplication::loadSettings() { recentFilesListManager->setFileList(getSettings()->value("App/RecentFilesList").toStringList()); } void NotepadNextApplication::saveSettings() { getSettings()->setValue("App/RecentFilesList", recentFilesListManager->fileList()); } MainWindow *NotepadNextApplication::createNewWindow() { Q_ASSERT(window == Q_NULLPTR); window = new MainWindow(this); // Keep Lua's editor reference up to date connect(window, &MainWindow::editorActivated, this, [](ScintillaNext *editor) { LuaExtension::Instance().setEditor(editor); }); // Since these editors don't actually get "closed" go ahead and add them to the recent file list connect(window, &MainWindow::aboutToClose, this, [=]() { for (const auto &editor : window->editors()) { if (editor->isFile()) { recentFilesListManager->addFile(editor->getFilePath()); } } getSessionManager()->saveSession(window); }); return window; }
17,323
C++
.cpp
412
35.385922
161
0.686767
dail8859/NotepadNext
9,006
547
57
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,313
main.cpp
dail8859_NotepadNext/src/NotepadNext/main.cpp
/* * This file is part of Notepad Next. * Copyright 2019 Justin Dailey * * Notepad Next is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Notepad Next is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Notepad Next. If not, see <https://www.gnu.org/licenses/>. */ #include <QDebug> #include <QSettings> #include <QSysInfo> #include <QApplication> #include <QDataStream> #include "NotepadNextApplication.h" int main(int argc, char *argv[]) { qSetMessagePattern("[%{time process}] %{if-debug}D%{endif}%{if-info}I%{endif}%{if-warning}W%{endif}%{if-critical}C%{endif}%{if-fatal}F%{endif}: %{message}"); // Set these since other parts of the app references these QApplication::setOrganizationName("NotepadNext"); QApplication::setApplicationName("NotepadNext"); QGuiApplication::setApplicationDisplayName("Notepad Next"); #ifdef Q_OS_UNIX // Unix doesn't provide an application version by default QGuiApplication::setApplicationVersion(APP_VERSION); #endif #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); #endif // Default settings format QSettings::setDefaultFormat(QSettings::IniFormat); NotepadNextApplication app(argc, argv); // Log some debug info qInfo("============================="); qInfo("%s v%s%s", qUtf8Printable(QApplication::applicationDisplayName()), qUtf8Printable(QApplication::applicationVersion()), APP_DISTRIBUTION); qInfo("Build Date/Time: %s %s", __DATE__, __TIME__); qInfo("Qt: %s", qVersion()); qInfo("OS: %s", qUtf8Printable(QSysInfo::prettyProductName())); qInfo("Locale: %s", qUtf8Printable(QLocale::system().name())); qInfo("CPU: %s", qUtf8Printable(QSysInfo::currentCpuArchitecture())); qInfo("File Path: %s", qUtf8Printable(QApplication::applicationFilePath())); qInfo("Arguments: %s", qUtf8Printable(app.arguments().join(' '))); qInfo("============================="); if(app.isPrimary()) { app.init(); return app.exec(); } else { qInfo() << "Primary instance already running. PID:" << app.primaryPid(); app.sendInfoToPrimaryInstance(); qInfo() << "Secondary instance closing..."; app.exit(0); return 0; } }
2,783
C++
.cpp
64
39.4375
161
0.696006
dail8859/NotepadNext
9,006
547
57
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,314
Finder.cpp
dail8859_NotepadNext/src/NotepadNext/Finder.cpp
/* * This file is part of Notepad Next. * Copyright 2019 Justin Dailey * * Notepad Next is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Notepad Next is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Notepad Next. If not, see <https://www.gnu.org/licenses/>. */ #include "Finder.h" #include "UndoAction.h" Finder::Finder(ScintillaNext *edit) : editor(edit) { search_flags = editor->searchFlags(); } void Finder::setEditor(ScintillaNext *editor) { this->editor = editor; } void Finder::setSearchFlags(int flags) { this->search_flags = flags; } void Finder::setWrap(bool wrap) { this->wrap = wrap; } void Finder::setSearchText(const QString &text) { this->text = text; } Sci_CharacterRange Finder::findNext(int startPos) { did_latest_search_wrap = false; if (text.isEmpty()) return {INVALID_POSITION, INVALID_POSITION}; const int pos = startPos == INVALID_POSITION ? editor->selectionEnd() : startPos; const QByteArray textData = text.toUtf8(); editor->setTargetRange(pos, editor->length()); editor->setSearchFlags(search_flags); if (editor->searchInTarget(textData.length(), textData.constData()) != INVALID_POSITION) { return {static_cast<Sci_PositionCR>(editor->targetStart()), static_cast<Sci_PositionCR>(editor->targetEnd())}; } else if (wrap) { editor->setTargetRange(0, pos); if (editor->searchInTarget(textData.length(), textData.constData()) != INVALID_POSITION) { did_latest_search_wrap = true; return {static_cast<Sci_PositionCR>(editor->targetStart()), static_cast<Sci_PositionCR>(editor->targetEnd())}; } } return {INVALID_POSITION, INVALID_POSITION}; } Sci_CharacterRange Finder::findPrev() { did_latest_search_wrap = false; if (text.isEmpty()) return {INVALID_POSITION, INVALID_POSITION}; const int pos = editor->selectionStart(); const QByteArray textData = text.toUtf8(); editor->setTargetRange(pos, editor->length()); editor->setSearchFlags(search_flags); auto range = editor->findText(editor->searchFlags(), textData.constData(), pos, 0); if (range.first != INVALID_POSITION) { return {static_cast<Sci_PositionCR>(range.first), static_cast<Sci_PositionCR>(range.second)}; } else if (wrap) { range = editor->findText(editor->searchFlags(), textData.constData(), editor->length(), pos); if (range.first != INVALID_POSITION) { did_latest_search_wrap = true; return {static_cast<Sci_PositionCR>(range.first), static_cast<Sci_PositionCR>(range.second)}; } } return {INVALID_POSITION, INVALID_POSITION}; } // Count all occurrences in the document int Finder::count() { int total = 0; if (text.length() > 0) { forEachMatch([&](int start, int end) { Q_UNUSED(start); total++; return end; }); } return total; } Sci_CharacterRange Finder::replaceSelectionIfMatch(const QString &replaceText) { const QByteArray textData = text.toUtf8(); bool isRegex = editor->searchFlags() & SCFIND_REGEXP; // Search just in the selection to see if the current selection is a match editor->setTargetStart(editor->selectionStart()); editor->setTargetEnd(editor->selectionEnd()); editor->setSearchFlags(search_flags); if (editor->searchInTarget(textData.length(), textData.constData()) != INVALID_POSITION) { const QByteArray replaceData = replaceText.toUtf8(); if (isRegex) editor->replaceTargetRE(replaceData.length(), replaceData.constData()); else editor->replaceTarget(replaceData.length(), replaceData.constData()); return {static_cast<Sci_PositionCR>(editor->targetStart()), static_cast<Sci_PositionCR>(editor->targetEnd())}; } return {INVALID_POSITION, INVALID_POSITION}; } int Finder::replaceAll(const QString &replaceText) { if (text.isEmpty()) return 0; const QByteArray &replaceData = replaceText.toUtf8(); const QByteArray &b = text.toUtf8(); const char *c = b.constData(); Sci_TextToFind ttf {{0, (Sci_PositionCR)editor->length()}, c, {-1, -1}}; const bool isRegex = search_flags & SCFIND_REGEXP; int total = 0; // Don't technically need to set the search flags here but do it just in case something looks at the search flags later editor->setSearchFlags(search_flags); // NOTE: can't use editor->forEachMatch() here since the search range can grow since the document is changing const UndoAction ua(editor); while (editor->send(SCI_FINDTEXT, search_flags, reinterpret_cast<sptr_t>(&ttf)) != -1) { const int start = ttf.chrgText.cpMin; const int end = ttf.chrgText.cpMax; editor->setTargetRange(start, end); if (isRegex) ttf.chrg.cpMin = start + editor->replaceTargetRE(replaceData.length(), replaceData.constData()); else ttf.chrg.cpMin = start + editor->replaceTarget(replaceData.length(), replaceData.constData()); // The replace could have changed the document size, so update the end of the search range ttf.chrg.cpMax = editor->length(); total++; } return total; }
5,735
C++
.cpp
142
35.070423
123
0.688941
dail8859/NotepadNext
9,006
547
57
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,315
FileDialogHelpers.cpp
dail8859_NotepadNext/src/NotepadNext/FileDialogHelpers.cpp
/* * This file is part of Notepad Next. * Copyright 2022 Justin Dailey * * Notepad Next is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Notepad Next is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Notepad Next. If not, see <https://www.gnu.org/licenses/>. */ #include "FileDialogHelpers.h" /* * NOTE: This code is nearly identical to the QFileDialog implementation of several static methods. * Since the QDir filter options were not exposed, there was no way to specify QDir::Hidden. */ constexpr QDir::Filters default_filters = QDir::AllEntries | QDir::NoDotAndDotDot | QDir::AllDirs | QDir::Files | QDir::Hidden; QList<QUrl> FileDialogHelpers::getOpenFileUrls(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options options, const QStringList &supportedSchemes) { QFileDialog dialog(parent, caption, dir, filter); dialog.setSupportedSchemes(supportedSchemes); dialog.setFilter(default_filters); dialog.setOptions(options); dialog.setFileMode(QFileDialog::ExistingFiles); if (selectedFilter && !selectedFilter->isEmpty()) dialog.selectNameFilter(*selectedFilter); if (dialog.exec() == QDialog::Accepted) { if (selectedFilter) *selectedFilter = dialog.selectedNameFilter(); return dialog.selectedUrls(); } return QList<QUrl>(); } QStringList FileDialogHelpers::getOpenFileNames(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options options) { const QStringList schemes = QStringList(QStringLiteral("file")); const QList<QUrl> selectedUrls = getOpenFileUrls(parent, caption, dir, filter, selectedFilter, options, schemes); QStringList fileNames; fileNames.reserve(selectedUrls.size()); for (const QUrl &url : selectedUrls) { if (url.isLocalFile() || url.isEmpty()) fileNames << url.toLocalFile(); else fileNames << url.toString(); } return fileNames; } QUrl FileDialogHelpers::getSaveFileUrl(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options options, const QStringList &supportedSchemes) { QFileDialog dialog(parent, caption, dir, filter); dialog.setSupportedSchemes(supportedSchemes); dialog.setAcceptMode(QFileDialog::AcceptSave); dialog.setFilter(default_filters); dialog.setOptions(options); if (selectedFilter && !selectedFilter->isEmpty()) dialog.selectNameFilter(*selectedFilter); if (dialog.exec() == QDialog::Accepted) { if (selectedFilter) *selectedFilter = dialog.selectedNameFilter(); return dialog.selectedUrls().value(0); } return QUrl(); } QString FileDialogHelpers::getSaveFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options options) { const QStringList schemes = QStringList(QStringLiteral("file")); const QUrl selectedUrl = getSaveFileUrl(parent, caption, dir, filter, selectedFilter, options, schemes); if (selectedUrl.isLocalFile() || selectedUrl.isEmpty()) return selectedUrl.toLocalFile(); else return selectedUrl.toString(); }
3,797
C++
.cpp
78
44.102564
222
0.744261
dail8859/NotepadNext
9,006
547
57
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,316
RtfConverter.cpp
dail8859_NotepadNext/src/NotepadNext/RtfConverter.cpp
/* * This file is part of Notepad Next. * Copyright 2022 Justin Dailey * * Notepad Next is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Notepad Next is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Notepad Next. If not, see <https://www.gnu.org/licenses/>. */ #include "RtfConverter.h" #include <QTextStream> #include <QMap> static void AddCharEscaped(QTextStream &stream, int ch) { switch (ch) { case '\n': stream << QByteArrayLiteral("\\par") << Qt::endl; break; case '{': stream << QByteArrayLiteral("\\{"); break; case '}': stream << QByteArrayLiteral("\\}"); break; case '\t': stream << QByteArrayLiteral("\\tab "); break; default: stream << static_cast<char>(ch); } } static QColor ScintillaColorToQColor(int color) { int r = color & 0xFF; int g = (color >> 8) & 0xFF; int b = (color >> 16) & 0xFF; return QColor::fromRgb(r, g, b); } void RtfConverter::convertRange(QTextStream &stream, int start, int end) { ensureDocumentStyled(start, end); QByteArray rtf_body; QTextStream rtf_stream(&rtf_body); QVector<QColor> styleColors; int prevStyle = -1; for (int i = start; i < end; ++i) { const int newStyle = editor->styleAt(i); if (newStyle != prevStyle) { const QColor c = ScintillaColorToQColor(editor->styleFore(newStyle)); if (!styleColors.contains(c)) { styleColors.append(c); } // Turn bold off or non if (prevStyle != -1 && editor->styleBold(prevStyle) && !editor->styleBold(newStyle)) { rtf_stream << "\\b0"; } else if (editor->styleBold(newStyle)) { rtf_stream << "\\b"; } // Set the foreground color rtf_stream << "\\cf" << styleColors.indexOf(c) << ' '; prevStyle = newStyle; } // Output the character const int ch = editor->charAt(i); if (ch == '\r'){ if (editor->charAt(i + 1) != '\n') { AddCharEscaped(rtf_stream, ch); } } else { AddCharEscaped(rtf_stream, ch); } } rtf_stream.flush(); stream << R"({\rtf1\ansi\deff0\deftab480)" << Qt::endl; stream << R"({\fonttbl)" << Qt::endl; stream << R"({\f0 )" << editor->styleFont(STYLE_DEFAULT) << ";}" << Qt::endl; stream << R"(})" << Qt::endl; stream << Qt::endl; stream << R"({\colortbl)" << Qt::endl; for (const auto &c : styleColors) { stream << "\\red" << c.red() <<"\\green" << c.green() << "\\blue" << c.blue() << ";" << Qt::endl; } stream << R"(})" << Qt::endl; stream << Qt::endl; stream << "{" << Qt::endl; stream << rtf_body << Qt::endl; stream << "}" << Qt::endl; stream.flush(); }
3,353
C++
.cpp
99
27.333333
105
0.57412
dail8859/NotepadNext
9,006
547
57
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,317
IFaceTable.cpp
dail8859_NotepadNext/src/NotepadNext/IFaceTable.cpp
/* * This file is part of Notepad Next. * Copyright 2019 Justin Dailey * * Notepad Next is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Notepad Next is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Notepad Next. If not, see <https://www.gnu.org/licenses/>. */ #include "IFaceTable.h" #include <string.h> #include <ctype.h> #include <algorithm> #include <iterator> template<typename Iter> typename std::iterator_traits<Iter>::value_type const *binary_find(Iter begin, Iter end, const char *name) { auto it = std::lower_bound(begin, end, name, [](const auto &lhs, const char *rhs) { return strcmp(lhs.name, rhs) < 0; }); if (it == end || strcmp(name, it->name) != 0) { return nullptr; } else { return &(*it); } } const IFaceConstant *IFaceTable::FindConstant(const char *name) const { return binary_find(constants.cbegin(), constants.cend(), name); } const IFaceFunction *IFaceTable::FindFunction(const char *name) const { return binary_find(functions.cbegin(), functions.cend(), name); } const IFaceFunction *IFaceTable::FindFunctionByConstantName(const char *name) const { if (strncmp(name, prefix, strlen(prefix)) == 0) { // This looks like a constant for an iface function. This requires // a sequential search. Take special care since the function names // are mixed case, whereas the constants are all-caps. for (const auto &func : functions) { const char *nm = name + strlen(prefix); const char *fn = func.name; while (*nm && *fn && (*nm == toupper(*fn))) { ++nm; ++fn; } if (!*nm && !*fn) { return &func; } } } return nullptr; } const IFaceFunction *IFaceTable::FindFunctionByValue(int value) const { for (const auto &func : functions) { if (func.value == value) return &func; } return nullptr; } const IFaceProperty *IFaceTable::FindProperty(const char *name) const { return binary_find(properties.cbegin(), properties.cend(), name); } int IFaceTable::GetConstantName(int value, char *nameOut, unsigned nameBufferLen, const char *hint) const { if (nameOut && nameBufferLen > 0) { *nameOut = '\0'; } // Look in both the constants table and the functions table. Start with functions. for (const auto &func : functions) { if (func.value == value) { int len = static_cast<int>(strlen(func.name) + strlen(prefix)); if (nameOut && (static_cast<int>(nameBufferLen) > len)) { strcpy(nameOut, prefix); strcat(nameOut, func.name); // fix case for (char *nm = nameOut + strlen(prefix); *nm; ++nm) { if (*nm >= 'a' && *nm <= 'z') { *nm = static_cast<char>(*nm - 'a' + 'A'); } } return len; } else { return -1 - len; } } } for (const auto &con : constants) { if (con.value == value && (hint == NULL || strncmp(hint, con.name, strlen(hint)) == 0)) { int len = static_cast<int>(strlen(con.name)); if (nameOut && (static_cast<int>(nameBufferLen) > len)) { strcpy(nameOut, con.name); return len; } else { return -1 - len; } } } return 0; } const IFaceFunction *IFaceTable::GetFunctionByMessage(int message) const { for (const auto &func : functions) { if (func.value == message) { return &func; } } return nullptr; } IFaceFunction IFaceTable::GetPropertyFuncByMessage(int message) const { for (const auto &prop : properties) { if (prop.getter == message) { return prop.GetterFunction(); } else if (prop.setter == message) { return prop.SetterFunction(); } } return { "invalid", -1, iface_void, {iface_void, iface_void} }; } std::vector<std::string> IFaceTable::GetAllConstantNames() const { std::vector<std::string> kws; std::string prefix_str(prefix); kws.reserve(constants.size() + functions.size()); std::transform(constants.begin(), constants.end(), std::back_inserter(kws), [](const IFaceConstant &ifc) { return ifc.name; }); std::transform(functions.begin(), functions.end(), std::back_inserter(kws), [&](const IFaceFunction &iff) { std::string s = prefix_str + std::string(iff.name); std::transform(s.begin(), s.end(), s.begin(), ::toupper); return s; }); std::sort(kws.begin(), kws.end()); return kws; } std::vector<std::string> IFaceTable::GetAllFunctionNames() const { std::vector<std::string> kws; kws.reserve(functions.size()); std::transform(functions.begin(), functions.end(), std::back_inserter(kws), [](const IFaceFunction &iff) { return iff.name; }); return kws; } std::vector<std::string> IFaceTable::GetAllPropertyNames() const { std::vector<std::string> kws; kws.reserve(properties.size()); std::transform(properties.begin(), properties.end(), std::back_inserter(kws), [](const IFaceProperty &ifp) { return ifp.name; }); return kws; }
5,793
C++
.cpp
149
31.879195
133
0.612674
dail8859/NotepadNext
9,006
547
57
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
16,318
UndoAction.cpp
dail8859_NotepadNext/src/NotepadNext/UndoAction.cpp
/* * This file is part of Notepad Next. * Copyright 2022 Justin Dailey * * Notepad Next is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Notepad Next is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Notepad Next. If not, see <https://www.gnu.org/licenses/>. */ #include "UndoAction.h" #include "ScintillaNext.h" UndoAction::UndoAction(ScintillaNext *editor) : editor(editor) { editor->beginUndoAction(); } UndoAction::~UndoAction() { editor->endUndoAction(); }
944
C++
.cpp
28
31.535714
73
0.756312
dail8859/NotepadNext
9,006
547
57
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
16,319
EditorPrintPreviewRenderer.cpp
dail8859_NotepadNext/src/NotepadNext/EditorPrintPreviewRenderer.cpp
/* * This file is part of Notepad Next. * Copyright 2022 Justin Dailey * * Notepad Next is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Notepad Next is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Notepad Next. If not, see <https://www.gnu.org/licenses/>. */ #include "EditorPrintPreviewRenderer.h" #include "ScintillaNext.h" #include <QPrinter> #include <QDebug> #include <QPainter> EditorPrintPreviewRenderer::EditorPrintPreviewRenderer(ScintillaNext *editor) : QObject(), editor(editor) { } void EditorPrintPreviewRenderer::render(QPrinter *printer) { QRectF printableArea(QPointF(0, 0), printer->pageRect(QPrinter::DevicePixel).size()); qInfo() << "Print from page" << printer->fromPage() << "to" << printer->toPage(); qInfo() << "Paper:" << printer->paperRect(QPrinter::DevicePixel); qInfo() << "Page:" << printer->pageRect(QPrinter::DevicePixel); qInfo() << "Printable Area:" << printableArea; const int fromPage = printer->fromPage(); const int toPage = printer->toPage(); // The printer starts with a valid page initially bool needsNewPage = false; int startPos = 0; int pageNum = 1; QPainter painter(printer); do { bool needsToDraw = (fromPage == 0 && toPage == 0) || (fromPage <= pageNum && pageNum <= toPage); if (needsToDraw) { if (needsNewPage) { printer->newPage(); } else { needsNewPage = true; } } startPos = editor->formatRange(needsToDraw, printer, printer, printableArea.toRect(), printer->paperRect(QPrinter::DevicePixel).toRect(), startPos, editor->length()); pageNum++; } while (startPos < editor->length()); }
2,267
C++
.cpp
56
34.446429
111
0.663632
dail8859/NotepadNext
9,006
547
57
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false