From 0d581eb12dc3a1fc0a0413214a7afdfb9bf2abc1 Mon Sep 17 00:00:00 2001 From: love-code-yeyixiao <188240888@qq.com> Date: Tue, 17 Sep 2024 11:21:50 +0800 Subject: [PATCH 1/3] 1.14.9 --- CHANGELOG.md | 1 + Sandboxie/core/dll/custom.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c970afeab4..2d3cd15927 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - \\??\\%SystemDrive%\\Sandbox\\%SANDBOX% - \\??\\%SystemDrive%\\Users\\%USER%\Sandbox\\%SANDBOX% - added Sandbox Import dialog +- added "MacAddressValue1"(Number) and "MacAddressValue2"(Number) to set MAC address for each box(You must set both two options at the same time). ### Changed - sandbox root selection in global settings is now a combo box diff --git a/Sandboxie/core/dll/custom.c b/Sandboxie/core/dll/custom.c index 38d4ce4170..b7d00e7af5 100644 --- a/Sandboxie/core/dll/custom.c +++ b/Sandboxie/core/dll/custom.c @@ -1630,8 +1630,16 @@ ULONG Nsi_NsiAllocateAndGetTable(int a1, struct NPI_MODULEID* NPI_MS_ID, unsigne memcpy(pEntry->Address, lpMac, 8); else { - *(DWORD*)&pEntry->Address[0] = Dll_rand(); - *(DWORD*)&pEntry->Address[4] = Dll_rand(); + DWORD mac = SbieApi_QueryConfNumber(NULL, L"MacAddressValue1", 0); + DWORD mac2 = SbieApi_QueryConfNumber(NULL,L"MacAddressValue2",0); + if (mac != 0 && mac2 != 0) { + *(DWORD*)&pEntry->Address[0] = mac; + *(DWORD*)&pEntry->Address[4] = mac2; + } + else { + *(DWORD*)&pEntry->Address[0] = Dll_rand(); + *(DWORD*)&pEntry->Address[4] = Dll_rand(); + } map_insert(&Custom_NicMac, (void*)key, pEntry->Address, 8); } From 7ebe83d477ff3fd2873bc30bae7b2158fc7ed531 Mon Sep 17 00:00:00 2001 From: love-code-yeyixiao <188240888@qq.com> Date: Fri, 4 Oct 2024 22:23:30 +0800 Subject: [PATCH 2/3] 1.14.11 --- Sandboxie/core/dll/custom.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/Sandboxie/core/dll/custom.c b/Sandboxie/core/dll/custom.c index b7d00e7af5..5a8ccf3502 100644 --- a/Sandboxie/core/dll/custom.c +++ b/Sandboxie/core/dll/custom.c @@ -1588,11 +1588,24 @@ __int64 __fastcall AllocateAndGetAdaptersInfo(PIP_ADAPTER_INFO a1) return result; } */ - +wchar_t itoa1(int num) { + switch (num) { + case 0:return L'0'; + case 1:return L'1'; + case 2:return L'2'; + case 3:return L'4'; + case 5:return L'5'; + case 6:return L'6'; + case 7:return L'7'; + case 8:return L'8'; + case 9:return L'9'; + default:return L'0'; + } +} ULONG Nsi_NsiAllocateAndGetTable(int a1, struct NPI_MODULEID* NPI_MS_ID, unsigned int TcpInformationId, void **pAddrEntry, int SizeOfAddrEntry, void **a6, int a7, void **pStateEntry, int SizeOfStateEntry, void **pOwnerEntry, int SizeOfOwnerEntry, DWORD *Count, int a13) { ULONG ret = __sys_NsiAllocateAndGetTable(a1, NPI_MS_ID, TcpInformationId, pAddrEntry, SizeOfAddrEntry, a6, a7, pStateEntry, SizeOfStateEntry, pOwnerEntry, SizeOfOwnerEntry, Count, a13); - + static long num = 0; if (memcmp(NPI_MS_ID, NPI_MS_NDIS_MODULEID, 24) == 0 && pStateEntry) { typedef struct _STATE_ENTRY { @@ -1630,8 +1643,11 @@ ULONG Nsi_NsiAllocateAndGetTable(int a1, struct NPI_MODULEID* NPI_MS_ID, unsigne memcpy(pEntry->Address, lpMac, 8); else { - DWORD mac = SbieApi_QueryConfNumber(NULL, L"MacAddressValue1", 0); - DWORD mac2 = SbieApi_QueryConfNumber(NULL,L"MacAddressValue2",0); + wchar_t KeyName1[30] = {0}, KeyName2[30] = {0}; + Sbie_snwprintf(KeyName1, 30, L"%s%s", L"MacAddressValueMajor", itoa1(num)); + Sbie_snwprintf(KeyName2, 30, L"%s%s", L"MacAddressValueMinor", itoa1(num)); + DWORD mac = SbieApi_QueryConfNumber(NULL, KeyName2, 0); + DWORD mac2 = SbieApi_QueryConfNumber(NULL,KeyName2,0); if (mac != 0 && mac2 != 0) { *(DWORD*)&pEntry->Address[0] = mac; *(DWORD*)&pEntry->Address[4] = mac2; @@ -1640,6 +1656,7 @@ ULONG Nsi_NsiAllocateAndGetTable(int a1, struct NPI_MODULEID* NPI_MS_ID, unsigne *(DWORD*)&pEntry->Address[0] = Dll_rand(); *(DWORD*)&pEntry->Address[4] = Dll_rand(); } + num++; map_insert(&Custom_NicMac, (void*)key, pEntry->Address, 8); } From 40098c4a3712bbc49832e5ac26d4e39e51503d10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=88=B1=E7=BC=96=E7=A8=8B=E7=9A=84=E5=8F=B6=E4=B8=80?= =?UTF-8?q?=E7=AC=91?= <92030377+love-code-yeyixiao@users.noreply.github.com> Date: Fri, 4 Oct 2024 22:39:54 +0800 Subject: [PATCH 3/3] Update CHANGELOG.md --- CHANGELOG.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd8a51ebae..ca20c6279b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,16 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## [1.1x.xx / 5.xx.xx] - 2024-xx-xx + +### Added +- added "MacAddressValueMajorX"(fill 'X' with number 0-9) and "MacAddressValueMinorX"(fill 'X' with number 0-9) to set MAC address for each box(You must set both two options at the same time). + - For example: + - MacAddressValueMajor0=Number + - MacAddressValueMinor0=Number + - MacAddressValueMajor1=Number + - MacAddressValueMinor1=Number + ## [1.14.10 / 5.69.10] - 2024-10-03 ### Added @@ -26,7 +36,6 @@ This project adheres to [Semantic Versioning](http://semver.org/). - \\??\\%SystemDrive%\\Sandbox\\%SANDBOX% - \\??\\%SystemDrive%\\Users\\%USER%\Sandbox\\%SANDBOX% - added Sandbox Import dialog -- added "MacAddressValue1"(Number) and "MacAddressValue2"(Number) to set MAC address for each box(You must set both two options at the same time). ### Changed - sandbox root selection in global settings is now a combo box