Author: tfaber
Date: Mon Jun 23 20:39:49 2014
New Revision: 63636
URL:
http://svn.reactos.org/svn/reactos?rev=63636&view=rev
Log:
[RPCRT4][CRT]
- Do not omit the last argument to VirtualProtect, it will cause the function to fail
Modified:
trunk/reactos/dll/win32/rpcrt4/cproxy.c
trunk/reactos/dll/win32/rpcrt4/cstub.c
trunk/reactos/lib/sdk/crt/except/stack.c
Modified: trunk/reactos/dll/win32/rpcrt4/cproxy.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/cproxy.c?…
==============================================================================
--- trunk/reactos/dll/win32/rpcrt4/cproxy.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/rpcrt4/cproxy.c [iso-8859-1] Mon Jun 23 20:39:49 2014
@@ -175,13 +175,14 @@
{
unsigned int i;
struct thunk *prev, *block;
+ DWORD oldprot;
block = VirtualAlloc( NULL, BLOCK_SIZE * sizeof(*block),
MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE );
if (!block) return NULL;
for (i = 0; i < BLOCK_SIZE; i++) init_thunk( &block[i], BLOCK_SIZE * num + i +
3 );
- VirtualProtect( block, BLOCK_SIZE * sizeof(*block), PAGE_EXECUTE_READ, NULL );
+ VirtualProtect( block, BLOCK_SIZE * sizeof(*block), PAGE_EXECUTE_READ, &oldprot
);
prev = InterlockedCompareExchangePointer( (void **)&method_blocks[num], block,
NULL );
if (prev) /* someone beat us to it */
{
Modified: trunk/reactos/dll/win32/rpcrt4/cstub.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/cstub.c?r…
==============================================================================
--- trunk/reactos/dll/win32/rpcrt4/cstub.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/rpcrt4/cstub.c [iso-8859-1] Mon Jun 23 20:39:49 2014
@@ -176,6 +176,7 @@
{
unsigned int i;
vtbl_method_t *prev, *block;
+ DWORD oldprot;
block = VirtualAlloc( NULL, BLOCK_SIZE * sizeof(*block),
MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE );
@@ -186,7 +187,7 @@
memcpy( &block[i], opcodes, sizeof(opcodes) );
block[i].offset = (BLOCK_SIZE * num + i + 3) * sizeof(void *);
}
- VirtualProtect( block, BLOCK_SIZE * sizeof(*block), PAGE_EXECUTE_READ, NULL );
+ VirtualProtect( block, BLOCK_SIZE * sizeof(*block), PAGE_EXECUTE_READ, &oldprot
);
prev = InterlockedCompareExchangePointer( (void **)&method_blocks[num], block,
NULL );
if (prev) /* someone beat us to it */
{
Modified: trunk/reactos/lib/sdk/crt/except/stack.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/except/stack.c…
==============================================================================
--- trunk/reactos/lib/sdk/crt/except/stack.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/except/stack.c [iso-8859-1] Mon Jun 23 20:39:49 2014
@@ -38,7 +38,8 @@
int CDECL _resetstkoflw(void)
{
int stack_addr;
+ DWORD oldprot;
/* causes stack fault that updates NtCurrentTeb()->Tib.StackLimit */
- return VirtualProtect( &stack_addr, 1, PAGE_GUARD|PAGE_READWRITE, NULL );
+ return VirtualProtect(&stack_addr, 1, PAGE_GUARD|PAGE_READWRITE, &oldprot);
}