DataSection access rights - Questions and one issue
Posted: Mon Nov 17, 2025 11:37 pm
Is there any option for the datasections. How are they managed when mixed with regular code. Are they merged (to save data) and what access rights are there?
(Currently with 6.12 LTS Version, X64, Threadsafe):
I have a shared module using a DataSection, that I use for multiple projects with different info. Today on an older project, i get an error when error trying to write to the data. I tried other projects using the same code, no issues. I manually added code to change access mode to read+write, and it works now:
(Currently with 6.12 LTS Version, X64, Threadsafe):
I have a shared module using a DataSection, that I use for multiple projects with different info. Today on an older project, i get an error when error trying to write to the data. I tried other projects using the same code, no issues. I manually added code to change access mode to read+write, and it works now:
Code: Select all
Procedure DALAPI_LoadAll(*ptrData)
Define.MEMORY_BASIC_INFORMATION MBI
If VirtualQuery_(*ptrData, @MBI, SizeOf(MEMORY_BASIC_INFORMATION))
Define.i xLong1
If MBI\Protect = #PAGE_READONLY ; Or MBI\Protect = PAGE_WRITECOPY
; Debug "Setting Memory Protection to read-write"
VirtualProtect_(MBI\BaseAddress, MBI\RegionSize, #PAGE_READWRITE, @xLong1)
ElseIf MBI\Protect = #PAGE_EXECUTE_READ ; Or MBI\Protect = PAGE_EXECUTE_WRITECOPY
; Debug "Setting Memory Protection to read-write"
VirtualProtect_(MBI\BaseAddress, MBI\RegionSize, #PAGE_EXECUTE_READWRITE, @xLong1)
EndIf
EndIf
(previous unmodified code)