Windows: Enable ASLR (had to fix a few pointer truncations)

This commit is contained in:
Henrik Rydgard 2015-07-15 20:02:42 +02:00
parent 73e9c3b3a2
commit d3018c1787
4 changed files with 8 additions and 19 deletions

View file

@ -149,13 +149,10 @@ CtrlDisAsmView *CtrlDisAsmView::getFrom(HWND hwnd)
return (CtrlDisAsmView *)GetWindowLongPtr(hwnd, GWLP_USERDATA); return (CtrlDisAsmView *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
} }
CtrlDisAsmView::CtrlDisAsmView(HWND _wnd) CtrlDisAsmView::CtrlDisAsmView(HWND _wnd)
{ {
wnd=_wnd; wnd=_wnd;
SetWindowLongPtr(wnd, GWLP_USERDATA, (LONG)this); SetWindowLongPtr(wnd, GWLP_USERDATA, (LONG_PTR)this);
SetWindowLong(wnd, GWL_STYLE, GetWindowLong(wnd,GWL_STYLE) | WS_VSCROLL); SetWindowLong(wnd, GWL_STYLE, GetWindowLong(wnd,GWL_STYLE) | WS_VSCROLL);
SetScrollRange(wnd, SB_VERT, -1,1,TRUE); SetScrollRange(wnd, SB_VERT, -1,1,TRUE);

View file

@ -24,7 +24,7 @@ extern HMENU g_hPopupMenus;
CtrlMemView::CtrlMemView(HWND _wnd) CtrlMemView::CtrlMemView(HWND _wnd)
{ {
wnd=_wnd; wnd=_wnd;
SetWindowLongPtr(wnd, GWLP_USERDATA, (LONG)this); SetWindowLongPtr(wnd, GWLP_USERDATA, (LONG_PTR)this);
SetWindowLong(wnd, GWL_STYLE, GetWindowLong(wnd,GWL_STYLE) | WS_VSCROLL); SetWindowLong(wnd, GWL_STYLE, GetWindowLong(wnd,GWL_STYLE) | WS_VSCROLL);
SetScrollRange(wnd, SB_VERT, -1,1,TRUE); SetScrollRange(wnd, SB_VERT, -1,1,TRUE);

View file

@ -36,7 +36,7 @@ void CtrlDisplayListView::registerClass()
CtrlDisplayListView::CtrlDisplayListView(HWND _wnd) CtrlDisplayListView::CtrlDisplayListView(HWND _wnd)
: wnd(_wnd) : wnd(_wnd)
{ {
SetWindowLongPtr(wnd, GWLP_USERDATA, (LONG) this); SetWindowLongPtr(wnd, GWLP_USERDATA, (LONG_PTR) this);
SetWindowLong(wnd, GWL_STYLE, GetWindowLong(wnd,GWL_STYLE) | WS_VSCROLL); SetWindowLong(wnd, GWL_STYLE, GetWindowLong(wnd,GWL_STYLE) | WS_VSCROLL);
SetScrollRange(wnd, SB_VERT, -1,1,TRUE); SetScrollRange(wnd, SB_VERT, -1,1,TRUE);

View file

@ -140,10 +140,9 @@
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine> <TargetMachine>MachineX86</TargetMachine>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<LargeAddressAware>true</LargeAddressAware> <LargeAddressAware>true</LargeAddressAware>
<BaseAddress>0x00400000</BaseAddress> <BaseAddress>
<FixedBaseAddress>true</FixedBaseAddress> </BaseAddress>
<AdditionalOptions>/ignore:4049 /ignore:4217 %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/ignore:4049 /ignore:4217 %(AdditionalOptions)</AdditionalOptions>
<ForceFileOutput>MultiplyDefinedSymbolOnly</ForceFileOutput> <ForceFileOutput>MultiplyDefinedSymbolOnly</ForceFileOutput>
</Link> </Link>
@ -179,10 +178,7 @@
<ProgramDatabaseFile>$(OutDir)$(ProjectName).pdb</ProgramDatabaseFile> <ProgramDatabaseFile>$(OutDir)$(ProjectName).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<TargetMachine>MachineX64</TargetMachine> <TargetMachine>MachineX64</TargetMachine>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<LargeAddressAware>true</LargeAddressAware> <LargeAddressAware>true</LargeAddressAware>
<BaseAddress>0x00400000</BaseAddress>
<FixedBaseAddress>true</FixedBaseAddress>
<ShowProgress>NotSet</ShowProgress> <ShowProgress>NotSet</ShowProgress>
<AdditionalOptions>/ignore:4049 /ignore:4217 %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/ignore:4049 /ignore:4217 %(AdditionalOptions)</AdditionalOptions>
<ForceFileOutput>MultiplyDefinedSymbolOnly</ForceFileOutput> <ForceFileOutput>MultiplyDefinedSymbolOnly</ForceFileOutput>
@ -223,9 +219,8 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX86</TargetMachine> <TargetMachine>MachineX86</TargetMachine>
<AdditionalOptions>/ignore:4049 /ignore:4217 %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/ignore:4049 /ignore:4217 %(AdditionalOptions)</AdditionalOptions>
<BaseAddress>0x00400000</BaseAddress> <BaseAddress>
<RandomizedBaseAddress>false</RandomizedBaseAddress> </BaseAddress>
<FixedBaseAddress>true</FixedBaseAddress>
<LargeAddressAware>true</LargeAddressAware> <LargeAddressAware>true</LargeAddressAware>
<GenerateMapFile>true</GenerateMapFile> <GenerateMapFile>true</GenerateMapFile>
</Link> </Link>
@ -266,9 +261,6 @@
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX64</TargetMachine> <TargetMachine>MachineX64</TargetMachine>
<BaseAddress>0x00400000</BaseAddress>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<FixedBaseAddress>true</FixedBaseAddress>
<AdditionalOptions>/ignore:4049 /ignore:4217 %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/ignore:4049 /ignore:4217 %(AdditionalOptions)</AdditionalOptions>
</Link> </Link>
<PreBuildEvent> <PreBuildEvent>