Changeset 73140 in webkit


Ignore:
Timestamp:
Dec 2, 2010 9:24:52 AM (13 years ago)
Author:
sfalken@apple.com
Message:

2010-12-02 Steve Falkenburg <sfalken@apple.com>

Reviewed by Adam Roben.

Move enableExecutionPrevention to WebKitMain
https://bugs.webkit.org/show_bug.cgi?id=50392

  • WebProcess/WebKitMain.cpp: (enableDataExecutionPrevention): (WebKitMain):
  • WebProcess/win/WebProcessMainWin.cpp: (WebKit::WebProcessMain):
Location:
trunk/WebKit2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit2/ChangeLog

    r73138 r73140  
     12010-12-02  Steve Falkenburg  <sfalken@apple.com>
     2
     3        Reviewed by Adam Roben.
     4
     5        Move enableExecutionPrevention to WebKitMain
     6        https://bugs.webkit.org/show_bug.cgi?id=50392
     7
     8        * WebProcess/WebKitMain.cpp:
     9        (enableDataExecutionPrevention):
     10        (WebKitMain):
     11        * WebProcess/win/WebProcessMainWin.cpp:
     12        (WebKit::WebProcessMain):
     13
    1142010-12-02  Steve Falkenburg  <sfalken@apple.com>
    215
  • trunk/WebKit2/WebProcess/WebKitMain.cpp

    r68173 r73140  
    3636
    3737using namespace WebKit;
     38
     39static void enableDataExecutionPrevention()
     40{
     41    // Enable Data Execution prevention at runtime rather than via /NXCOMPAT
     42    // http://blogs.msdn.com/michael_howard/archive/2008/01/29/new-nx-apis-added-to-windows-vista-sp1-windows-xp-sp3-and-windows-server-2008.aspx
     43
     44    const DWORD enableDEP = 0x00000001;
     45
     46    HMODULE hMod = ::GetModuleHandleW(L"Kernel32.dll");
     47    if (!hMod)
     48        return;
     49
     50    typedef BOOL (WINAPI *PSETDEP)(DWORD);
     51
     52    PSETDEP procSet = reinterpret_cast<PSETDEP>(::GetProcAddress(hMod, "SetProcessDEPPolicy"));
     53    if (!procSet)
     54        return;
     55
     56    // Enable Data Execution Prevention, but allow ATL thunks (for compatibility with the version of ATL that ships with the Platform SDK).
     57    procSet(enableDEP);
     58}
    3859
    3960static int WebKitMain(const CommandLine& commandLine)
     
    138159#endif
    139160
     161    enableDataExecutionPrevention();
     162
    140163    enableTerminationOnHeapCorruption();
    141164
  • trunk/WebKit2/WebProcess/win/WebProcessMainWin.cpp

    r73138 r73140  
    3737namespace WebKit {
    3838
    39 static void enableDataExecutionPrevention()
    40 {
    41     // Enable Data Execution prevention at runtime rather than via /NXCOMPAT
    42     // http://blogs.msdn.com/michael_howard/archive/2008/01/29/new-nx-apis-added-to-windows-vista-sp1-windows-xp-sp3-and-windows-server-2008.aspx
    43 
    44     const DWORD enableDEP = 0x00000001;
    45 
    46     HMODULE hMod = ::GetModuleHandleW(L"Kernel32.dll");
    47     if (!hMod)
    48         return;
    49 
    50     typedef BOOL (WINAPI *PSETDEP)(DWORD);
    51 
    52     PSETDEP procSet = reinterpret_cast<PSETDEP>(::GetProcAddress(hMod, "SetProcessDEPPolicy"));
    53     if (!procSet)
    54         return;
    55 
    56     // Enable Data Execution Prevention, but allow ATL thunks (for compatibility with the version of ATL that ships with the Platform SDK).
    57     procSet(enableDEP);
    58 }
    59 
    6039#if USE(SAFARI_THEME)
    6140#ifdef DEBUG_ALL
     
    8059int WebProcessMain(const CommandLine& commandLine)
    8160{
    82     enableDataExecutionPrevention();
    83 
    8461    ::OleInitialize(0);
    8562
Note: See TracChangeset for help on using the changeset viewer.