Commits

Ivo Hinkelmann  committed ad6f3f8 Merge

CWS-TOOLING: integrate CWS mhu23

  • Participants
  • Parent commits da1920c, 7c858a6

Comments (0)

Files changed (4)

File sal/osl/w32/salinit.cxx

 
 void SAL_CALL sal_detail_initialize(int argc, char ** argv)
 {
+    // SetProcessDEPPolicy(PROCESS_DEP_ENABLE);
+    // SetDllDirectoryW(L"");
+    // SetSearchPathMode(
+    //   BASE_SEARCH_PATH_ENABLE_SAFE_SEARCHMODE | BASE_SEARCH_PATH_PERMANENT);
+    HMODULE h = GetModuleHandleW(L"kernel32.dll");
+    if (h != 0) {
+        FARPROC p = GetProcAddress(h, "SetProcessDEPPolicy");
+        if (p != 0) {
+            reinterpret_cast< BOOL (WINAPI *)(DWORD) >(p)(0x00000001);
+	}
+	p = GetProcAddress(h, "SetDllDirectoryW");
+        if (p != 0) {
+            reinterpret_cast< BOOL (WINAPI *)(LPCWSTR) >(p)(L"");
+        }
+        p = GetProcAddress(h, "SetSearchPathMode");
+        if (p != 0) {
+            reinterpret_cast< BOOL (WINAPI *)(DWORD) >(p)(0x8001);
+        }
+    }
+
     WSADATA wsaData;
     int     error;
     WORD    wVersionRequested;

File solenv/inc/set_wntx64.mk

 IMPLIB_X64=$(WRAPCMD) $(LIBMGR_X64_BINARY)
 
 USE_CFLAGS_X64=-c -nologo -Gs $(NOLOGO) -Zm500 -Zc:forScope,wchar_t- -GR
+
+# Stack buffer overrun detection.
+CFLAGS+=-GS
+
 USE_CDEFS_X64+= -DWIN32 -D_AMD64_=1 -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NON_CONFORMING_SWPRINTFS
 .IF "$(debug)"!=""
 USE_CFLAGS_X64+=-Zi -Fd$(MISC_X64)/$(@:b).pdb
 LINKFLAGS_X64=/MAP /OPT:NOREF
 .ENDIF
 
+# excetion handling protection
+LINKFLAGS+=-safeseh
+
+# enable DEP
+LINKFLAGS+=-nxcompat
+
+# enable ASLR
+LINKFLAGS+=-dynamicbase
+
 .IF "$(PRODUCT)"!="full"
 LINKFLAGS_X64+= -NODEFAULTLIB -DEBUG
 .ELSE # "$(PRODUCT)"!="full"

File solenv/inc/wntmsci10.mk

 # SOLAR JAva Unterstuetzung nur fuer wntmsci
 
 ASM=ml
-AFLAGS=/c /Cp /coff
+AFLAGS=/c /Cp /coff /safeseh
 
 # architecture dependent flags for the C and C++ compiler that can be changed by
 # exporting the variable ARCH_FLAGS="..." in the shell, which is used to start build

File solenv/inc/wntmsci11.mk

 # SOLAR JAva Unterstuetzung nur fuer wntmsci
 
 ASM=ml
-AFLAGS=/c /Cp /coff
+AFLAGS=/c /Cp /coff /safeseh
 
 # architecture dependent flags for the C and C++ compiler that can be changed by
 # exporting the variable ARCH_FLAGS="..." in the shell, which is used to start build
 # lookup":
 # -wd4251 -wd4275 -wd4290 -wd4675 -wd4786 -wd4800
 CFLAGS+=-Zm500 -Zc:forScope,wchar_t- -GR
+
+# Stack buffer overrun detection.
+CFLAGS+=-GS
+
 CFLAGS+=-c -nologo -Gs $(NOLOGO)
 
 CDEFS+= -D_X86_=1 -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NON_CONFORMING_SWPRINTFS
 LINKFLAGS=/MAP /OPT:NOREF
 .ENDIF
 
+# excetion handling protection
+LINKFLAGS+=-safeseh
+
+# enable DEP
+LINKFLAGS+=-nxcompat
+
+# enable ASLR
+LINKFLAGS+=-dynamicbase
+
 .IF "$(linkinc)" != ""
-LINKFLAGS=-NODEFAULTLIB -INCREMENTAL:YES -DEBUG
+LINKFLAGS+=-NODEFAULTLIB -INCREMENTAL:YES -DEBUG
 MAPFILE=
 _VC_MANIFEST_INC=1
 .ELSE # "$(linkinc)" != ""