Just trying to make a new section and setting up his attributes with #pragma return this warning:
warning C4330: attribute 'write' for section '.mysec' ignored
Simple code:
#include <windows.h>
#include <stdio.h>
#pragma section(".mysec",execute,read,write)
__declspec(allocate(".mysec")) UCHAR var[] = {0xDE, 0xAD, 0xBE, 0xEF};
void main() { return; }
linker options: /DYNAMICBASE:NO, /FIXED, /NXCOMPAT:NO, /OPT:NOREF
OS/tools: Win x64 / msvc++ 110
I read some articles on MSDN and in particulary this http://msdn.microsoft.com/en-us/library/50bewfwa(v=vs.110).aspx but didn't found answer.
Thanks.
I think that this due to the execute
flag. I don't think you can have a section that contains writeable code in Windows.
I might be remembering this wrong but it would a security issue and thus not supported.