Commit 8fe759df authored by Thomas Faber's avatar Thomas Faber Committed by Alexandre Julliard

rpcrt4: Do not omit mandatory argument to VirtualProtect.

parent b2d22ecb
...@@ -192,13 +192,14 @@ static const struct thunk *allocate_block( unsigned int num ) ...@@ -192,13 +192,14 @@ static const struct thunk *allocate_block( unsigned int num )
{ {
unsigned int i; unsigned int i;
struct thunk *prev, *block; struct thunk *prev, *block;
DWORD oldprot;
block = VirtualAlloc( NULL, BLOCK_SIZE * sizeof(*block), block = VirtualAlloc( NULL, BLOCK_SIZE * sizeof(*block),
MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE ); MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE );
if (!block) return NULL; if (!block) return NULL;
for (i = 0; i < BLOCK_SIZE; i++) init_thunk( &block[i], BLOCK_SIZE * num + i + 3 ); 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 ); prev = InterlockedCompareExchangePointer( (void **)&method_blocks[num], block, NULL );
if (prev) /* someone beat us to it */ if (prev) /* someone beat us to it */
{ {
......
...@@ -194,6 +194,7 @@ static const vtbl_method_t *allocate_block( unsigned int num ) ...@@ -194,6 +194,7 @@ static const vtbl_method_t *allocate_block( unsigned int num )
{ {
unsigned int i; unsigned int i;
vtbl_method_t *prev, *block; vtbl_method_t *prev, *block;
DWORD oldprot;
block = VirtualAlloc( NULL, BLOCK_SIZE * sizeof(*block), block = VirtualAlloc( NULL, BLOCK_SIZE * sizeof(*block),
MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE ); MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE );
...@@ -204,7 +205,7 @@ static const vtbl_method_t *allocate_block( unsigned int num ) ...@@ -204,7 +205,7 @@ static const vtbl_method_t *allocate_block( unsigned int num )
memcpy( &block[i], opcodes, sizeof(opcodes) ); memcpy( &block[i], opcodes, sizeof(opcodes) );
block[i].offset = (BLOCK_SIZE * num + i + 3) * sizeof(void *); 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 ); prev = InterlockedCompareExchangePointer( (void **)&method_blocks[num], block, NULL );
if (prev) /* someone beat us to it */ if (prev) /* someone beat us to it */
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment