fix for new ntdll.lib usage

This commit is contained in:
DavidXanatos 2020-12-01 21:29:26 +01:00
parent 8b2b2742a7
commit 1f3f9704a7
7 changed files with 594 additions and 39 deletions

View File

@ -3,7 +3,7 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
## [0.5.0 / 5.45.0] - 2020-11-28
## [0.5.0 / 5.45.0] - 2020-12-01
### Added
- added new notification window
@ -25,6 +25,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- added more windows 10 specific template presets
- added ability to create desktop shortcuts to sandboxed items
- added icons to box option tabs
- added box grouping
- added new debug option "DebugTrace=y" to log debug output to the trace log
### Changed
- File migration limit can now be disabled by specifying "CopyLimitKb=-1"
@ -32,6 +34,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- terminated boxed processes are now kept listed for a coupel of seconds
- reworked sandbox dletion mechaism ofthe new UI
- restructured sandbox options window
- SbieDLL.dll can now be compiled with an up to date nitll.lib
### Fixed
- fixed issues migrating files > 4GB
@ -43,6 +46,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- fixed UI not properly displaying async errors
- fixed issues when a snapshot operation failed
- fixed some special cases of IpcPath and WinClass in the new UI
- fixed driver issues with WHQL passing compatybility testing
## [0.4.5 / 5.44.1] - 2020-11-16

View File

@ -0,0 +1,539 @@
;----------------------------------------------------------------------------
; __except_handler3 support routine is not longer available on ntdll.lib
;
; this is a copy of __except_handler3 procedure and required procedures from
; the c:\WinDDK\7600.16385.1\lib\wnet\i386\ntdll.lib
;
;----------------------------------------------------------------------------
.386
_TEXT segment use32 para public 'CODE'
public __except_handler3
;EXTERN __ValidateEH3RN : PROC
;__except_handler3 proc near
push esi
inc ebx
xor dh,byte ptr [eax]
pop eax
inc ebx
xor byte ptr [eax],dh
__except_handler3:
push ebp
mov ebp,esp
sub esp,8
push ebx
push esi
push edi
push ebp
cld
mov ebx,dword ptr [ebp+0Ch]
mov eax,dword ptr [ebp+8]
test dword ptr [eax+4],6
nop ; 00
jne _lh_unwinding
mov dword ptr [ebp-8],eax
mov eax,dword ptr [ebp+10h]
mov dword ptr [ebp-4],eax
lea eax,[ebp-8]
mov dword ptr [ebx-4],eax
mov esi,dword ptr [ebx+0Ch]
mov edi,dword ptr [ebx+8]
push ebx
call __ValidateEH3RN
add esp,4
or eax,eax
je _lh_abort
_lh_top:
cmp esi,0FFFFFFFFh
je _lh_bagit
lea ecx,[esi+esi*2]
mov eax,dword ptr [edi+ecx*4+4]
or eax,eax
je _lh_continue
push esi
push ebp
lea ebp,[ebx+10h]
xor ebx,ebx
xor ecx,ecx
xor edx,edx
xor esi,esi
xor edi,edi
call eax
pop ebp
pop esi
mov ebx,dword ptr [ebp+0Ch]
or eax,eax
je _lh_continue
js _lh_dismiss
mov edi,dword ptr [ebx+8]
push ebx
call __global_unwind2
add esp,4
lea ebp,[ebx+10h]
push esi
push ebx
call __local_unwind2
add esp,8
lea ecx,[esi+esi*2]
push 1
mov eax,dword ptr [edi+ecx*4+8]
call __NLG_Notify
mov eax,dword ptr [edi+ecx*4]
mov dword ptr [ebx+0Ch],eax
mov eax,dword ptr [edi+ecx*4+8]
xor ebx,ebx
xor ecx,ecx
xor edx,edx
xor esi,esi
xor edi,edi
call eax
_lh_continue:
mov edi,dword ptr [ebx+8]
lea ecx,[esi+esi*2]
mov esi,dword ptr [edi+ecx*4]
jmp _lh_top
_lh_dismiss:
mov eax,0
jmp _lh_return
_lh_abort:
mov eax,dword ptr [ebp+8]
or dword ptr [eax+4],8
_lh_bagit:
mov eax,1
jmp _lh_return
_lh_unwinding:
push ebp
lea ebp,[ebx+10h]
push 0FFFFFFFFh
push ebx
call __local_unwind2
add esp,8
pop ebp
mov eax,1
_lh_return:
pop ebp
pop edi
pop esi
pop ebx
mov esp,ebp
pop ebp
ret
__seh_longjmp_unwind@4:
push ebp
mov ecx,dword ptr [esp+8]
mov ebp,dword ptr [ecx]
mov eax,dword ptr [ecx+1Ch]
push eax
mov eax,dword ptr [ecx+18h]
push eax
call __local_unwind2
add esp,8
pop ebp
ret 4
;__except_handler3 endp
;EXTERN C P_RtlUnwind : DWORD
EXTERN _RtlUnwind@16 : PROC
;MAGIC_NUMBER1 equ 019930520h
;
;_NLG_INFO struc
; dwSig dd MAGIC_NUMBER1
; uoffDestination dd 0
; dwCode dd 0
; uoffFramePointer dd 0
;_NLG_INFO ends
;extern __NLG_Destination:_NLG_INFO
extern __NLG_Destination: FAR
;__global_unwind2 proc near
__global_unwind2:
push ebp
mov ebp,esp
push ebx
push esi
push edi
push ebp
push 0
push 0
push offset _gu_return
push dword ptr [ebp+8]
;call P_RtlUnwind
call _RtlUnwind@16 ; call it from ntdll.lib
_gu_return:
pop ebp
pop edi
pop esi
pop ebx
mov esp,ebp
pop ebp
ret
__unwind_handler:
mov ecx,dword ptr [esp+4]
test dword ptr [ecx+4],6
nop ; 00
mov eax,1
je _uh_return
mov eax,dword ptr [esp+14h]
push ebp
mov ebp,dword ptr [eax+10h]
mov edx,dword ptr [eax+28h]
push edx
mov edx,dword ptr [eax+24h]
push edx
call __local_unwind2
add esp,8
pop ebp
mov eax,dword ptr [esp+8]
mov edx,dword ptr [esp+10h]
mov dword ptr [edx],eax
mov eax,3
_uh_return:
ret
__local_unwind2:
push ebx
push esi
push edi
mov eax,dword ptr [esp+10h]
push ebp
push eax
push 0FFFFFFFEh
push offset __unwind_handler
push dword ptr fs:[0]
nop ; 00
mov dword ptr fs:[0],esp
nop ; 00
_lu_top:
mov eax,dword ptr [esp+24h]
mov ebx,dword ptr [eax+8]
mov esi,dword ptr [eax+0Ch]
cmp esi,0FFFFFFFFh
je _lu_done
cmp dword ptr [esp+28h],0FFFFFFFFh
je _continue_
cmp esi,dword ptr [esp+28h]
jbe _lu_done
_continue_:
lea esi,[esi+esi*2]
mov ecx,dword ptr [ebx+esi*4]
mov dword ptr [esp+8],ecx
mov dword ptr [eax+0Ch],ecx
cmp dword ptr [ebx+esi*4+4],0
jne __NLG_Return2
push 101h
mov eax,dword ptr [ebx+esi*4+8]
call __NLG_Notify
call dword ptr [ebx+esi*4+8]
__NLG_Return2:
jmp _lu_top
_lu_done:
pop dword ptr fs:[0]
nop ; 00
add esp,10h
pop edi
pop esi
pop ebx
ret
__abnormal_termination:
xor eax,eax
mov ecx,dword ptr fs:[0]
nop ; 00
cmp dword ptr [ecx+4],offset __unwind_handler
nop ; 00
jne _at_done
mov edx,dword ptr [ecx+0Ch]
mov edx,dword ptr [edx+0Ch]
cmp dword ptr [ecx+8],edx
jne _at_done
mov eax,1
_at_done:
ret
__NLG_Notify1:
push ebx
push ecx
mov ebx,offset __NLG_Destination
jmp __NLG_Go
__NLG_Notify:
push ebx
push ecx
mov ebx,offset __NLG_Destination
mov ecx,dword ptr [ebp+8]
__NLG_Go:
mov dword ptr [ebx+8],ecx
mov dword ptr [ebx+4],eax
mov dword ptr [ebx+0Ch],ebp
push ebp
push ecx
push eax
__NLG_Dispatch:
pop eax
pop ecx
pop ebp
pop ecx
pop ebx
ret 4
;__global_unwind2 endp
;EXTERN C _NtQueryVirtualMemory : DWORD
EXTERN _NtQueryVirtualMemory@24: PROC
EXTERN C _nValidPages : DWORD
EXTERN C _rgValidPages : DWORD
EXTERN C _lModifying : DWORD
;__ValidateEH3RN proc near
__ValidateEH3RN:
mov edi,edi
push ebp
mov ebp,esp
sub esp,20h
push ebx
push esi
mov esi,dword ptr [ebp+8]
mov ebx,dword ptr [esi+8]
test bl,3
jne label01
mov eax,dword ptr fs:[00000004h]
mov dword ptr [ebp+8],eax
mov eax,dword ptr fs:[00000008h]
mov dword ptr [ebp-4],eax
cmp ebx,dword ptr [ebp-4]
jb label02
cmp ebx,dword ptr [ebp+8]
jae label02
label01:
xor eax,eax
jmp label03
label02:
push edi
mov edi,dword ptr [esi+0Ch]
cmp edi,0FFFFFFFFh
jne label04
xor eax,eax
inc eax
jmp label05
label04:
xor edx,edx
mov dword ptr [ebp+8],edx
mov eax,ebx
label30:
mov ecx,dword ptr [eax]
cmp ecx,0FFFFFFFFh
je label06
cmp ecx,edx
jae label07
label06:
cmp dword ptr [eax+4],0
je label10
inc dword ptr [ebp+8]
label10:
inc edx
add eax,0Ch
cmp edx,edi
jbe label30
cmp dword ptr [ebp+8],0
je label11
mov eax,dword ptr [esi-8]
cmp eax,dword ptr [ebp-4]
jb label07
cmp eax,esi
jae label07
label11:
mov ecx,dword ptr [_nValidPages]
mov esi,ebx
and esi,0FFFFF000h
xor eax,eax
test ecx,ecx
jle label08
label12:
cmp dword ptr _rgValidPages[eax*4],esi
nop ; 00
je label09
inc eax
cmp eax,ecx
jl label12
label08:
lea eax,[ebp+8]
push eax
push 1Ch
lea eax,[ebp-20h]
push eax
push 0
push ebx
or edi,0FFFFFFFFh
push edi
;call _NtQueryVirtualMemory
call _NtQueryVirtualMemory@24 ; call it from ntdll.lib
test eax,eax
jl label13
mov eax,dword ptr [ebp+8]
jmp label14
xor eax,eax
label07:
jmp label05
test eax,eax
label09:
jle label15
xor edx,edx
mov ebx,offset _lModifying
inc edx
mov edi,ebx
xchg edx,dword ptr [edi]
test edx,edx
jne label15
cmp dword ptr _rgValidPages[eax*4],esi
nop ; 00
je label15
lea eax,[ecx-1]
test eax,eax
jl label16
label18:
cmp dword ptr _rgValidPages[eax*4],esi
nop ; 00
je label17
dec eax
jns label18
label17:
test eax,eax
jge label19
cmp ecx,10h
label16:
jge label20
inc ecx
mov dword ptr [_nValidPages],ecx
label20:
lea eax,[ecx-1]
jmp label15
label19:
je label21
label15:
xor edx,edx
test eax,eax
jl label21
label22:
lea ecx,_rgValidPages[edx*4]
nop ; 00
mov edi,dword ptr [ecx]
inc edx
cmp edx,eax
mov dword ptr [ecx],esi
mov esi,edi
jle label22
label21:
xor eax,eax
xchg eax,dword ptr [ebx]
jmp label15
label13:
xor eax,eax
label14:
test eax,eax
je label23
cmp dword ptr [ebp-8],1000000h
nop ; 01
jne label23
test byte ptr [ebp-0Ch],0CCh
je label0
mov ecx,dword ptr [ebp-1Ch]
cmp word ptr [ecx],5A4Dh
jne label23
mov eax,dword ptr [ecx+3Ch]
add eax,ecx
cmp dword ptr [eax],4550h
jne label23
cmp word ptr [eax+18h],10Bh
jne label23
sub ebx,ecx
cmp word ptr [eax+6],0
movzx ecx,word ptr [eax+14h]
lea ecx,[ecx+eax+18h]
jbe label23
mov eax,dword ptr [ecx+0Ch]
cmp ebx,eax
jb label0
mov edx,dword ptr [ecx+8]
add edx,eax
cmp ebx,edx
jae label0
test byte ptr [ecx+27h],80h
jne label07
label0:
xor eax,eax
inc eax
mov ecx,eax
mov edx,offset _lModifying
xchg ecx,dword ptr [edx]
test ecx,ecx
jne label05
mov ecx,dword ptr [_nValidPages]
test ecx,ecx
mov edx,ecx
jle label24
lea eax,_rgValidPages[ecx*4+0FFFFFFFCh]
nop ; FF
label25:
cmp dword ptr [eax],esi
je label24
dec edx
sub eax,4
test edx,edx
jg label25
label24:
test edx,edx
jne label26
push 0Fh
pop ebx
cmp ecx,ebx
jg label27
mov ebx,ecx
label27:
xor edx,edx
test ebx,ebx
jl label28
label29:
lea eax,_rgValidPages[edx*4]
nop ; 00
mov edi,dword ptr [eax]
inc edx
cmp edx,ebx
mov dword ptr [eax],esi
mov esi,edi
jle label29
label28:
cmp ecx,10h
jge label26
inc ecx
mov dword ptr [_nValidPages],ecx
label26:
xor eax,eax
mov ecx,offset _lModifying
xchg eax,dword ptr [ecx]
jmp label15
label23:
mov eax,edi
label05:
pop edi
label03:
pop esi
pop ebx
leave
ret
;__ValidateEH3RN endp
_TEXT ends
end

View File

@ -15,8 +15,6 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <ntstatus.h>
#define WIN32_NO_STATUS
typedef long NTSTATUS;
@ -32,11 +30,6 @@ typedef long NTSTATUS;
// If you are missing some expected functions we probably just not added them here yet, so just add what you need.
//
//int __cdecl __stdio_common_vswprintf(unsigned __int64 options, wchar_t *str, size_t len, const wchar_t *format, _locale_t locale, va_list valist);
//int __cdecl __stdio_common_vfwprintf(unsigned __int64 options, FILE *file, const wchar_t *format, _locale_t locale, va_list valist);
//int __cdecl __stdio_common_vswscanf(unsigned __int64 options, const wchar_t *input, size_t length, const wchar_t *format, _locale_t locale, va_list valist);
//int __cdecl __stdio_common_vfwscanf(unsigned __int64 options, FILE *file, const wchar_t *format, _locale_t locale, va_list valist);
int(*P_vsnwprintf)(wchar_t *_Buffer, size_t Count, const wchar_t * const, va_list Args) = NULL;
int(*P_vsnprintf)(char *_Buffer, size_t Count, const char * const, va_list Args) = NULL;
@ -142,12 +135,7 @@ char * __cdecl strstr(char const* _Str, char const* _SubStr) { return Pstrstr(_S
char*(__cdecl *P_strlwr)(const* str) = NULL;
char* __cdecl _strlwr(char* str) { return P_strlwr(str); }
#ifndef _WIN64
int(__cdecl *P_except_handler3)(void* exception_record, void* registration, void* context, void* dispatcher);
int __cdecl _except_handler3(void* exception_record, void* registration, void* context, void* dispatcher) {
return P_except_handler3(exception_record, registration, context, dispatcher);
}
#else
#ifdef _WIN64
EXCEPTION_DISPOSITION(__cdecl *P__C_specific_handler)(struct _EXCEPTION_RECORD *ExceptionRecord, void* EstablisherFrame, struct _CONTEXT* ContextRecord, struct _DISPATCHER_CONTEXT *DispatcherContext) = NULL;
EXCEPTION_DISPOSITION __cdecl __C_specific_handler(struct _EXCEPTION_RECORD *ExceptionRecord, void* EstablisherFrame, struct _CONTEXT* ContextRecord, struct _DISPATCHER_CONTEXT *DispatcherContext) {
return P__C_specific_handler(ExceptionRecord, EstablisherFrame, ContextRecord, DispatcherContext);
@ -155,6 +143,22 @@ EXCEPTION_DISPOSITION __cdecl __C_specific_handler(struct _EXCEPTION_RECORD *Exc
ULONG(__cdecl *P__chkstk)() = NULL;
ULONG __cdecl __chkstk() { return P__chkstk(); }
#else
// Global variables for __NLG_Destination
typedef struct {
unsigned long dwSig;
unsigned long uoffDestination;
unsigned long dwCode;
unsigned long uoffFramePointer;
} _NLG_INFO;
_NLG_INFO _NLG_Destination = { 0x019930520, 0, 0, 0 };
// Global variables for __ValidateEH3RN
INT _nValidPages = 0;
PVOID _rgValidPages[0x10] = { NULL };
BOOL _lModifying = FALSE;
#endif
#endif
@ -199,17 +203,10 @@ void InitMyNtDll(HMODULE Ntdll)
*(FARPROC*)&Pstrstr = GetProcAddress(Ntdll, "strstr");
*(FARPROC*)&P_strlwr = GetProcAddress(Ntdll, "_strlwr");
#ifndef _WIN64
*(FARPROC*)&P_except_handler3 = GetProcAddress(Ntdll, "_except_handler3");
#else
#ifdef _WIN64
*(FARPROC*)&P__C_specific_handler = GetProcAddress(Ntdll, "__C_specific_handler");
*(FARPROC*)&P__chkstk = GetProcAddress(Ntdll, "__chkstk");
#endif
#endif
}

View File

@ -22,7 +22,7 @@
<Keyword>Win32Proj</Keyword>
<ProjectName>SboxDll</ProjectName>
<ProjectGuid>{8E0EAA5B-6F5B-E0E2-338A-453EF2B548E4}</ProjectGuid>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='SbieDebug|Win32'" Label="Configuration">
@ -30,28 +30,28 @@
<UseDebugLibraries>true</UseDebugLibraries>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='SbieDebug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='SbieRelease|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='SbieRelease|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
@ -71,22 +71,18 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='SbieDebug|Win32'">
<TargetExt>.dll</TargetExt>
<TargetName>SbieDll</TargetName>
<LibraryPath>$(WindowsSDK_LibraryPath_x86)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='SbieDebug|x64'">
<TargetExt>.dll</TargetExt>
<TargetName>SbieDll</TargetName>
<LibraryPath>$(WindowsSDK_LibraryPath_x64)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='SbieRelease|Win32'">
<TargetExt>.dll</TargetExt>
<TargetName>SbieDll</TargetName>
<LibraryPath>$(WindowsSDK_LibraryPath_x86)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='SbieRelease|x64'">
<TargetExt>.dll</TargetExt>
<TargetName>SbieDll</TargetName>
<LibraryPath>$(WindowsSDK_LibraryPath_x64)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='SbieDebug|Win32'">
<ClCompile>
@ -96,7 +92,7 @@
<OmitFramePointers />
</ClCompile>
<Link>
<AdditionalDependencies>ntdll.lib;uuid.lib;kernel32.lib;psapi.lib</AdditionalDependencies>
<AdditionalDependencies>ntdll.lib;uuid.lib;kernel32.lib</AdditionalDependencies>
<ModuleDefinitionFile>SboxDll32.def</ModuleDefinitionFile>
<BaseAddress>0x7D220000</BaseAddress>
<EntryPointSymbol>DllMain</EntryPointSymbol>
@ -115,7 +111,7 @@
<CompileAs>Default</CompileAs>
</ClCompile>
<Link>
<AdditionalDependencies>ntdll.lib;uuid.lib;kernel32.lib;psapi.lib</AdditionalDependencies>
<AdditionalDependencies>ntdll.lib;uuid.lib;kernel32.lib</AdditionalDependencies>
<BaseAddress>0x7D220000</BaseAddress>
<EntryPointSymbol>DllMain</EntryPointSymbol>
<ModuleDefinitionFile>SboxDll64.def</ModuleDefinitionFile>
@ -135,7 +131,7 @@
<Optimization>MaxSpeed</Optimization>
</ClCompile>
<Link>
<AdditionalDependencies>ntdll.lib;uuid.lib;kernel32.lib;psapi.lib</AdditionalDependencies>
<AdditionalDependencies>ntdll.lib;uuid.lib;kernel32.lib</AdditionalDependencies>
<ModuleDefinitionFile>SboxDll32.def</ModuleDefinitionFile>
<BaseAddress>0x7D220000</BaseAddress>
<EntryPointSymbol>DllMain</EntryPointSymbol>
@ -153,7 +149,7 @@
<CompileAs>Default</CompileAs>
</ClCompile>
<Link>
<AdditionalDependencies>ntdll.lib;uuid.lib;kernel32.lib;psapi.lib</AdditionalDependencies>
<AdditionalDependencies>ntdll.lib;uuid.lib;kernel32.lib</AdditionalDependencies>
<BaseAddress>0x7D220000</BaseAddress>
<EntryPointSymbol>DllMain</EntryPointSymbol>
<ModuleDefinitionFile>SboxDll64.def</ModuleDefinitionFile>
@ -375,6 +371,15 @@
<Midl Include="pstore.idl" />
</ItemGroup>
<ItemGroup>
<CustomBuild Include="..\..\common\except_handler3.asm">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieRelease|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieDebug|x64'">true</ExcludedFromBuild>
<FileType>Document</FileType>
<Command Condition="'$(Configuration)|$(Platform)'=='SbieRelease|Win32'">ml -c -Cx -nologo -Zi -Zm -Fo$(Configuration)\%(Filename).obj %(FullPath)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='SbieRelease|Win32'">%(ProjectDir)$(Configuration)\%(Filename).obj</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='SbieDebug|Win32'">ml -c -Cx -nologo -Zi -Zm -Fo$(Configuration)\%(Filename).obj %(FullPath)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='SbieDebug|Win32'">%(ProjectDir)$(Configuration)\%(Filename).obj</Outputs>
</CustomBuild>
<None Include="SboxDll32.def" />
<None Include="SboxDll64.def" />
<None Include="util_32.asm">

View File

@ -233,6 +233,9 @@
<None Include="util_32.asm">
<Filter>hook</Filter>
</None>
<None Include="..\..\common\except_handler3.asm">
<Filter>common</Filter>
</None>
</ItemGroup>
<ItemGroup>
<Filter Include="scm">

View File

@ -190,6 +190,9 @@ _FX void Dll_InitGeneric(HINSTANCE hInstance)
extern void InitMyNtDll(HMODULE Ntdll);
InitMyNtDll(Dll_Ntdll);
extern FARPROC __sys_GetModuleInformation;
__sys_GetModuleInformation = GetProcAddress(LoadLibraryW(L"psapi.dll"), "GetModuleInformation");
if (! Dll_InitMem()) {
SbieApi_Log(2305, NULL);
ExitProcess(-1);

View File

@ -111,6 +111,9 @@ P_RpcStringFreeW __sys_RpcStringFreeW = NULL;
extern WCHAR *g_Ipc_DynamicPortNames[NUM_DYNAMIC_PORTS];
typedef BOOL (WINAPI *P_GetModuleInformation)(_In_ HANDLE hProcess, _In_ HMODULE hModule, _Out_ LPMODULEINFO lpmodinfo, _In_ DWORD cb);
P_GetModuleInformation __sys_GetModuleInformation = NULL;
//---------------------------------------------------------------------------
// RpcRt_Init
//---------------------------------------------------------------------------
@ -328,7 +331,7 @@ _FX ULONG RpcRt_RpcBindingFromStringBindingW(
{
MODULEINFO modinfo;
if (GetModuleInformation(GetCurrentProcess(), (HANDLE)hWinHttp, &modinfo, sizeof(MODULEINFO)))
if (__sys_GetModuleInformation(GetCurrentProcess(), (HANDLE)hWinHttp, &modinfo, sizeof(MODULEINFO)))
{
// return address within WinHttp?
if (pRetAddr < hWinHttp + modinfo.SizeOfImage)
@ -445,7 +448,7 @@ _FX RPC_STATUS RpcRt_RpcBindingCreateW(
{
MODULEINFO modinfo;
if (GetModuleInformation(GetCurrentProcess(), (HANDLE)hWinSCard, &modinfo, sizeof(MODULEINFO)))
if (__sys_GetModuleInformation(GetCurrentProcess(), (HANDLE)hWinSCard, &modinfo, sizeof(MODULEINFO)))
{
// return address within WinSCard?
if (pRetAddr < hWinSCard + modinfo.SizeOfImage)
@ -458,7 +461,7 @@ _FX RPC_STATUS RpcRt_RpcBindingCreateW(
{
MODULEINFO modinfo;
if (GetModuleInformation(GetCurrentProcess(), (HANDLE)hResourcePolicyClient, &modinfo, sizeof(MODULEINFO)))
if (__sys_GetModuleInformation(GetCurrentProcess(), (HANDLE)hResourcePolicyClient, &modinfo, sizeof(MODULEINFO)))
{
// return address within ResourcePolicyClient?
if (pRetAddr < hResourcePolicyClient + modinfo.SizeOfImage)
@ -531,7 +534,7 @@ RPC_STATUS RPC_ENTRY RpcRt_RpcStringBindingComposeW(TCHAR *ObjUuid,TCHAR *ProtSe
if (hSppc && (pRetAddr > hSppc) && EndPoint == NULL && ObjUuid == NULL) {
MODULEINFO modinfo;
if (GetModuleInformation(GetCurrentProcess(), (HANDLE)hSppc, &modinfo, sizeof(MODULEINFO))) {
if (__sys_GetModuleInformation(GetCurrentProcess(), (HANDLE)hSppc, &modinfo, sizeof(MODULEINFO))) {
if (pRetAddr < hSppc + modinfo.SizeOfImage) {
EndPoint = L"SPPCTransportEndpoint-00001";
Scm_Start_Sppsvc();