[Bug 24125] APB Reloaded 1.x (MMORPG) needs better GetSystemDEPPolicy() and GetProcessDEPPolicy() implementation

wine-bugs at winehq.org wine-bugs at winehq.org
Sat Nov 9 11:22:31 CST 2013


http://bugs.winehq.org/show_bug.cgi?id=24125

Anastasius Focht <focht at gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|CLOSED                      |REOPENED
            Version|unspecified                 |1.7.6
           Keywords|                            |download
                URL|                            |www.gamersfirst.com/
                 CC|                            |focht at gmx.net
          Component|-unknown                    |kernel32
           Platform|Other                       |x86-64
         Resolution|INVALID                     |
     Ever Confirmed|0                           |1
            Summary|Data Execution Prevention   |APB Reloaded 1.x (MMORPG)
                   |additions missing           |needs better
                   |                            |GetSystemDEPPolicy() and
                   |                            |GetProcessDEPPolicy()
                   |                            |implementation
           Severity|minor                       |normal
         OS/Version|other                       |Linux

--- Comment #7 from Anastasius Focht <focht at gmx.net> 2013-11-09 11:22:31 CST ---
Hello folks,

reopening and changing summary for comment #5 (game depends on this).

GetProcessDEPPolicy() can be implemented using
ntdll.NtQueryInformationProcess() with 'ProcessExecuteFlags' class which
currently returns hard-coded MEM_EXECUTE_OPTION_DISABLE flags.

Here is some code from chromium how the API is used:
https://src.chromium.org/svn/trunk/src/sandbox/win/src/process_mitigations_test.cc

--- snip ---
SBOX_TESTS_COMMAND int CheckDep(int argc, wchar_t **argv) {
  GetProcessDEPPolicyFunction get_process_dep_policy =
      reinterpret_cast<GetProcessDEPPolicyFunction>(
          ::GetProcAddress(::GetModuleHandleW(L"kernel32.dll"),
                           "GetProcessDEPPolicy"));
  if (get_process_dep_policy) {
    BOOL is_permanent = FALSE;
    DWORD dep_flags = 0;

    if (!get_process_dep_policy(::GetCurrentProcess(), &dep_flags,
        &is_permanent)) {
      return SBOX_TEST_FIRST_ERROR;
    }

    if (!(dep_flags & PROCESS_DEP_ENABLE) || !is_permanent)
      return SBOX_TEST_SECOND_ERROR;

  } else {
    NtQueryInformationProcessFunction query_information_process = NULL;
    ResolveNTFunctionPtr("NtQueryInformationProcess",
                          &query_information_process);
    if (!query_information_process)
      return SBOX_TEST_NOT_FOUND;

    ULONG size = 0;
    ULONG dep_flags = 0;
    if (!SUCCEEDED(query_information_process(::GetCurrentProcess(),
                                             ProcessExecuteFlags, &dep_flags,
                                             sizeof(dep_flags), &size))) {
      return SBOX_TEST_THIRD_ERROR;
    }

    const int MEM_EXECUTE_OPTION_ENABLE = 1;
    const int MEM_EXECUTE_OPTION_DISABLE = 2;
    const int MEM_EXECUTE_OPTION_ATL7_THUNK_EMULATION = 4;
    const int MEM_EXECUTE_OPTION_PERMANENT = 8;
    dep_flags &= 0xff;

    if (dep_flags != (MEM_EXECUTE_OPTION_DISABLE |
                      MEM_EXECUTE_OPTION_PERMANENT)) {
      return SBOX_TEST_FOURTH_ERROR;
    }
  }

  return SBOX_TEST_SUCCEEDED;
}
--- snip ---

SetProcessDEPPolicy() should be implemented using same mechanism (those API are
only for 32-bit).

MSDN:
http://msdn.microsoft.com/en-us/library/windows/desktop/bb736299%28v=vs.85%29.aspx

SystemDEPPolicy() is just a read-only field, maybe it could be made a registry
setting to allow it to be tweaked per WINEPREFIX?

Regards

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the wine-bugs mailing list