Dalamud/docs/api/Dalamud.Memory.MemoryProtection.html
2022-04-03 04:09:45 +02:00

246 lines
12 KiB
HTML

<!DOCTYPE html>
<!--[if IE]><![endif]-->
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Enum MemoryProtection
</title>
<meta name="viewport" content="width=device-width">
<meta name="title" content="Enum MemoryProtection
">
<meta name="generator" content="docfx 2.59.1.0">
<link rel="shortcut icon" href="../favicon.ico">
<link rel="stylesheet" href="../styles/docfx.vendor.css">
<link rel="stylesheet" href="../styles/docfx.css">
<link rel="stylesheet" href="../styles/main.css">
<meta property="docfx:navrel" content="">
<meta property="docfx:tocrel" content="toc.html">
</head>
<body data-spy="scroll" data-target="#affix" data-offset="120">
<div id="wrapper">
<header>
<nav id="autocollapse" class="navbar navbar-inverse ng-scope" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../index.html">
<img id="logo" class="svg" src="../logo.svg" alt="">
</a>
</div>
<div class="collapse navbar-collapse" id="navbar">
<form class="navbar-form navbar-right" role="search" id="search">
<div class="form-group">
<input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">
</div>
</form>
</div>
</div>
</nav>
<div class="subnav navbar navbar-default">
<div class="container hide-when-search" id="breadcrumb">
<ul class="breadcrumb">
<li></li>
</ul>
</div>
</div>
</header>
<div role="main" class="container body-content hide-when-search">
<div class="sidenav hide-when-search">
<a class="btn toc-toggle collapse" data-toggle="collapse" href="#sidetoggle" aria-expanded="false" aria-controls="sidetoggle">Show / Hide Table of Contents</a>
<div class="sidetoggle collapse" id="sidetoggle">
<div id="sidetoc"></div>
</div>
</div>
<div class="article row grid-right">
<div class="col-md-10">
<article class="content wrap" id="_content" data-uid="Dalamud.Memory.MemoryProtection">
<h1 id="Dalamud_Memory_MemoryProtection" data-uid="Dalamud.Memory.MemoryProtection" class="text-break">Enum MemoryProtection
</h1>
<div class="markdown level0 summary"><p>PAGE_* from memoryapi.</p>
</div>
<div class="markdown level0 conceptual"></div>
<h6><strong>Namespace</strong>: <a class="xref" href="Dalamud.Memory.html">Dalamud.Memory</a></h6>
<h6><strong>Assembly</strong>: Dalamud.dll</h6>
<h5 id="Dalamud_Memory_MemoryProtection_syntax">Syntax</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">[Flags]
public enum MemoryProtection</code></pre>
</div>
<h3 id="fields">Fields
</h3>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Name</th>
<th>Description</th>
</tr>
<thead>
<tbody>
<tr>
<td id="Dalamud_Memory_MemoryProtection_Execute">Execute</td>
<td><p>Enables execute access to the committed region of pages. An attempt to write to the committed region results
in an access violation. This flag is not supported by the CreateFileMapping function.</p>
</td>
</tr>
<tr>
<td id="Dalamud_Memory_MemoryProtection_ExecuteRead">ExecuteRead</td>
<td><p>Enables execute or read-only access to the committed region of pages. An attempt to write to the committed region
results in an access violation.</p>
</td>
</tr>
<tr>
<td id="Dalamud_Memory_MemoryProtection_ExecuteReadWrite">ExecuteReadWrite</td>
<td><p>Enables execute, read-only, or read/write access to the committed region of pages.</p>
</td>
</tr>
<tr>
<td id="Dalamud_Memory_MemoryProtection_ExecuteWriteCopy">ExecuteWriteCopy</td>
<td><p>Enables execute, read-only, or copy-on-write access to a mapped view of a file mapping object. An attempt to
write to a committed copy-on-write page results in a private copy of the page being made for the process. The
private page is marked as PAGE_EXECUTE_READWRITE, and the change is written to the new page. This flag is not
supported by the VirtualAlloc or VirtualAllocEx functions.</p>
</td>
</tr>
<tr>
<td id="Dalamud_Memory_MemoryProtection_Guard">Guard</td>
<td><p>Pages in the region become guard pages. Any attempt to access a guard page causes the system to raise a
STATUS_GUARD_PAGE_VIOLATION exception and turn off the guard page status. Guard pages thus act as a one-time
access alarm. For more information, see Creating Guard Pages. When an access attempt leads the system to turn
off guard page status, the underlying page protection takes over. If a guard page exception occurs during a
system service, the service typically returns a failure status indicator. This value cannot be used with
PAGE_NOACCESS. This flag is not supported by the CreateFileMapping function.</p>
</td>
</tr>
<tr>
<td id="Dalamud_Memory_MemoryProtection_NoAccess">NoAccess</td>
<td><p>Disables all access to the committed region of pages. An attempt to read from, write to, or execute the committed
region results in an access violation. This flag is not supported by the CreateFileMapping function.</p>
</td>
</tr>
<tr>
<td id="Dalamud_Memory_MemoryProtection_NoCache">NoCache</td>
<td><p>Sets all pages to be non-cachable. Applications should not use this attribute except when explicitly required
for a device. Using the interlocked functions with memory that is mapped with SEC_NOCACHE can result in an
EXCEPTION_ILLEGAL_INSTRUCTION exception. The PAGE_NOCACHE flag cannot be used with the PAGE_GUARD, PAGE_NOACCESS,
or PAGE_WRITECOMBINE flags. The PAGE_NOCACHE flag can be used only when allocating private memory with the
VirtualAlloc, VirtualAllocEx, or VirtualAllocExNuma functions. To enable non-cached memory access for shared
memory, specify the SEC_NOCACHE flag when calling the CreateFileMapping function.</p>
</td>
</tr>
<tr>
<td id="Dalamud_Memory_MemoryProtection_ReadOnly">ReadOnly</td>
<td><p>Enables read-only access to the committed region of pages. An attempt to write to the committed region results
in an access violation. If Data Execution Prevention is enabled, an attempt to execute code in the committed
region results in an access violation.</p>
</td>
</tr>
<tr>
<td id="Dalamud_Memory_MemoryProtection_ReadWrite">ReadWrite</td>
<td><p>Enables read-only or read/write access to the committed region of pages. If Data Execution Prevention is enabled,
attempting to execute code in the committed region results in an access violation.</p>
</td>
</tr>
<tr>
<td id="Dalamud_Memory_MemoryProtection_TargetsInvalid">TargetsInvalid</td>
<td><p>Sets all locations in the pages as invalid targets for CFG. Used along with any execute page protection like
PAGE_EXECUTE, PAGE_EXECUTE_READ, PAGE_EXECUTE_READWRITE and PAGE_EXECUTE_WRITECOPY. Any indirect call to locations
in those pages will fail CFG checks and the process will be terminated. The default behavior for executable
pages allocated is to be marked valid call targets for CFG. This flag is not supported by the VirtualProtect
or CreateFileMapping functions.</p>
</td>
</tr>
<tr>
<td id="Dalamud_Memory_MemoryProtection_TargetsNoUpdate">TargetsNoUpdate</td>
<td><p>Pages in the region will not have their CFG information updated while the protection changes for VirtualProtect.
For example, if the pages in the region was allocated using PAGE_TARGETS_INVALID, then the invalid information
will be maintained while the page protection changes. This flag is only valid when the protection changes to
an executable type like PAGE_EXECUTE, PAGE_EXECUTE_READ, PAGE_EXECUTE_READWRITE and PAGE_EXECUTE_WRITECOPY.
The default behavior for VirtualProtect protection change to executable is to mark all locations as valid call
targets for CFG.</p>
</td>
</tr>
<tr>
<td id="Dalamud_Memory_MemoryProtection_WriteCombine">WriteCombine</td>
<td><p>Sets all pages to be write-combined. Applications should not use this attribute except when explicitly required
for a device. Using the interlocked functions with memory that is mapped as write-combined can result in an
EXCEPTION_ILLEGAL_INSTRUCTION exception. The PAGE_WRITECOMBINE flag cannot be specified with the PAGE_NOACCESS,
PAGE_GUARD, and PAGE_NOCACHE flags. The PAGE_WRITECOMBINE flag can be used only when allocating private memory
with the VirtualAlloc, VirtualAllocEx, or VirtualAllocExNuma functions. To enable write-combined memory access
for shared memory, specify the SEC_WRITECOMBINE flag when calling the CreateFileMapping function.</p>
</td>
</tr>
<tr>
<td id="Dalamud_Memory_MemoryProtection_WriteCopy">WriteCopy</td>
<td><p>Enables read-only or copy-on-write access to a mapped view of a file mapping object. An attempt to write to
a committed copy-on-write page results in a private copy of the page being made for the process. The private
page is marked as PAGE_READWRITE, and the change is written to the new page. If Data Execution Prevention is
enabled, attempting to execute code in the committed region results in an access violation. This flag is not
supported by the VirtualAlloc or VirtualAllocEx functions.</p>
</td>
</tr>
</tbody>
</thead></thead></table>
<h3 id="extensionmethods">Extension Methods</h3>
<div>
<a class="xref" href="Dalamud.Utility.EnumExtensions.html#Dalamud_Utility_EnumExtensions_GetAttribute__1_System_Enum_">EnumExtensions.GetAttribute&lt;TAttribute&gt;()</a>
</div>
</article>
</div>
<div class="hidden-sm col-md-2" role="complementary">
<div class="sideaffix">
<div class="contribution">
<ul class="nav">
<li>
<a href="https://github.com/goatcorp/Dalamud/new/master/apiSpec/new?filename=Dalamud_Memory_MemoryProtection.md&amp;value=---%0Auid%3A%20Dalamud.Memory.MemoryProtection%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A" class="contribution-link">Improve this Doc</a>
</li>
<li>
<a href="https://github.com/goatcorp/Dalamud/blob/master/Dalamud/Memory/MemoryProtection.cs/#L10" class="contribution-link">View Source</a>
</li>
</ul>
</div>
<nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
<h5>In This Article</h5>
<div></div>
</nav>
</div>
</div>
</div>
</div>
<footer>
<div class="grad-bottom"></div>
<div class="footer">
<div class="container">
<span class="pull-right">
<a href="#top">Back to top</a>
</span>
<span>Generated by <strong>DocFX</strong></span>
</div>
</div>
</footer>
</div>
<script type="text/javascript" src="../styles/docfx.vendor.js"></script>
<script type="text/javascript" src="../styles/docfx.js"></script>
<script type="text/javascript" src="../styles/main.js"></script>
</body>
</html>