Displaying 7 results from an estimated 7 matches for "memory_basic_information".
2012 Jan 07
3
[LLVMdev] [PATCH][Compiler-rt] Windows implementation of mmap functionality in clear_cache_test and enable_execute_stack_test
...char execution_buffer[128];
// make executable the page containing execution_buffer
char* start = (char*)((uintptr_t)execution_buffer & (-4095));
char* end = (char*)((uintptr_t)(&execution_buffer[128+4096]) & (-4095));
+#if defined(_WIN32)
+ DWORD dummy_oldProt;
+ MEMORY_BASIC_INFORMATION b;
+ if ( !VirtualQuery(start, &b, sizeof(b)) )
+ return 1;
+ if ( !VirtualProtect(b.BaseAddress, b.RegionSize, PAGE_EXECUTE_READWRITE, &b.Protect) )
+#else
if ( mprotect(start, end-start, PROT_READ|PROT_WRITE|PROT_EXEC) != 0 )
+#endif
return 1;
// verify y...
2010 Sep 20
1
Dynamic forking in Win32
...oFork(
EXE_FILE *exe,
LPVOID ptrLoc,
DWORD imageSize,
char *target)
{
PROCESS_INFORMATION pi;
CONTEXT ctx;
PROCINFO childInfo;
if (createChild(&pi, &ctx, &childInfo, target)) {
LPVOID v = (LPVOID)NULL;
DWORD r, old_protection = 0;
MEMORY_BASIC_INFORMATION basic_info;
printf("Original EXE loaded (PID = %d).\n", (int)pi.dwProcessId);
printf("Original Base Addr = %X, Size = %X\n",
(int)childInfo.baseAddr, (int)childInfo.imageSize);
if (VirtualQueryEx(
pi.hProcess,
(LPC...
2012 Jan 07
1
[LLVMdev] [llvm-commits] [PATCH][Compiler-rt] Windows implementation of mmap functionality in clear_cache_test and enable_execute_stack_test
...(void);
@@ -38,7 +47,15 @@
// make executable the page containing execution_buffer
char* start = (char*)((uintptr_t)execution_buffer & (-4095));
char* end = (char*)((uintptr_t)(&execution_buffer[128+4096]) & (-4095));
+#if defined(_WIN32)
+ DWORD dummy_oldProt;
+ MEMORY_BASIC_INFORMATION b;
+ if ( !VirtualQuery(start, &b, sizeof(b)) )
+ return 1;
+ if ( !VirtualProtect(b.BaseAddress, b.RegionSize, PAGE_EXECUTE_READWRITE, &b.Protect) )
+#else
if ( mprotect(start, end-start, PROT_READ|PROT_WRITE|PROT_EXEC) != 0 )
+#endif
return 1;
// verify y...
2012 Jan 07
0
[LLVMdev] [llvm-commits] [PATCH][Compiler-rt] Windows implementation of mmap functionality in clear_cache_test and enable_execute_stack_test
Hi Ruben,
> I see I missed some curly braces. I also modified spacing a tiny bit.
Doesn't seem so. E.g. you have:
+ if ( !VirtualQuery(addr, &b, sizeof(b)) )
+ exit(1);
+ if( !VirtualProtect(b.BaseAddress, b.RegionSize,
PAGE_EXECUTE_READWRITE, &b.Protect) )
Add space after "if". Do not put spaces after "(" and before ")". Same
for other
2012 Jan 07
2
[LLVMdev] [llvm-commits] [PATCH][Compiler-rt] Windows implementation of mmap functionality in clear_cache_test and enable_execute_stack_test
...cution_buffer
char* start = (char*)((uintptr_t)execution_buffer & (-4095));
char* end = (char*)((uintptr_t)(&execution_buffer[128+4096]) & (-4095));
- if ( mprotect(start, end-start, PROT_READ|PROT_WRITE|PROT_EXEC) != 0 )
+#if defined(_WIN32)
+ DWORD dummy_oldProt;
+ MEMORY_BASIC_INFORMATION b;
+ if (!VirtualQuery(start, &b, sizeof(b)))
return 1;
+ if (!VirtualProtect(b.BaseAddress, b.RegionSize, PAGE_EXECUTE_READWRITE, &b.Protect))
+#else
+ if (mprotect(start, end-start, PROT_READ|PROT_WRITE|PROT_EXEC) != 0)
+#endif
+ return 1;
// verify you can...
2006 Oct 06
13
Need some help with latest win32-mmap
Hi all,
I''ve got the latest win32-mmap code checked into CVS. Unfortunately, it
seems that I''m not able to open an existing mapping and retrieve set
data. Below is a simple example that seems like it ought to work but
doesn''t. Any ideas?
# map1.rb
require ''win32/mmap''
include Win32
mmap = MMap.new(:name => ''alpha'', :size
2013 Jun 25
0
[LLVMdev] [PATCH] Windows implementation of enable_execute_stack
...F not defined! See enable_execute_stack.c"
> #else
> const uintptr_t pageSize = sysconf(_SC_PAGESIZE);
> #endif /* __APPLE__ */
>
> followed by the generic Unix implementation. Neither applies to Win32, so
> I ifdef'ed the whole thing.
>
>
>> > + MEMORY_BASIC_INFORMATION b;
>> > +
>> > + if (!VirtualQuery(addr, &b, sizeof(b)))
>> > + exit(1);
>> > + if (!VirtualProtect(b.BaseAddress, b.RegionSize,
>> PAGE_EXECUTE_READWRITE, &b.Protect))
>> > + exit(1);
>> > +#endif /* _WIN32 */
>>...