📄 file.html
字号:
e -- Existing file only (fail if doesn't exist)
'' is the same as 'q k e'
'r' is the same as 'r k e'
'w' is the same as 'w t c'
'rw' is the same as 'rw k c'
'rt' or 'rn' implies 'c'.
Or $access can be numeric.</pre>
</dd>
<dd>
<p><code>$svAccess</code> is designed to be "do what I mean", so you can skip
the rest of its explanation unless you are interested in the complex
details. Note that, if you want write access to a device, you need
to specify <a href="#item__22k_22"><code>"k"</code></a> [and perhaps <a href="#item__22e_22"><code>"e"</code></a>, as in <code>"w ke"</code> or <code>"rw ke"</code>]
since Win32 suggests <code>OPEN_EXISTING</code> be used when opening a device.</p>
</dd>
<dl>
<dt><strong><a name="item__22q_22"><code>"q"</code></a></strong>
<dd>
<p>Stands for "Query access". This is really a no-op since you always have
query access when you open a file. You can specify <a href="#item__22q_22"><code>"q"</code></a> to document
that you plan to query the file [or device, etc.]. This is especially
helpful when you don't want read nor write access since something like
<a href="#item__22q_22"><code>"q"</code></a> or <code>"q ke"</code> may be easier to understand than just <code>""</code> or <a href="#item__22ke_22"><code>"ke"</code></a>.</p>
</dd>
</li>
<dt><strong><code>"r"</code></strong>
<dd>
<p>Stands for "Read access". Sets the <code>GENERIC_READ</code> <code>bit(s)</code> in the
<code>$uAccess</code> that is passed to <a href="#item_createfile"><code>CreateFile</code></a>. This is the default
access if the <code>$svAccess</code> parameter is missing [or if it is <a href="../../lib/Pod/perlfunc.html#item_undef"><code>undef</code></a>
and <code>$rvhvOptions</code> doesn't specify an <code>"Access"</code> option].</p>
</dd>
</li>
<dt><strong><a name="item__22w_22"><code>"w"</code></a></strong>
<dd>
<p>Stands for "Write access". Sets the <code>GENERIC_WRITE</code> <code>bit(s)</code> in the
<code>$uAccess</code> that is passed to <a href="#item_createfile"><code>CreateFile</code></a>.</p>
</dd>
</li>
<dt><strong><a name="item__22k_22"><code>"k"</code></a></strong>
<dd>
<p>Stands for "Keep if exists". If the requested file exists, then it is
opened. This is the default unless <code>GENERIC_WRITE</code> access has been
requested but <code>GENERIC_READ</code> access has not been requested. Contrast
with <a href="#item__22t_22"><code>"t"</code></a> and <a href="#item__22n_22"><code>"n"</code></a>.</p>
</dd>
</li>
<dt><strong><code>"t"</code></strong>
<dd>
<p>Stands for "Truncate if exists". If the requested file exists, then
it is truncated to zero length and then opened. This is the default if
<code>GENERIC_WRITE</code> access has been requested and <code>GENERIC_READ</code> access
has not been requested. Contrast with <a href="#item__22k_22"><code>"k"</code></a> and <a href="#item__22n_22"><code>"n"</code></a>.</p>
</dd>
</li>
<dt><strong><a name="item__22n_22"><code>"n"</code></a></strong>
<dd>
<p>Stands for "New file only". If the requested file exists, then it is
not opened and the <a href="#item_createfile"><code>createFile</code></a> call fails. Contrast with <a href="#item__22k_22"><code>"k"</code></a> and
<a href="#item__22t_22"><code>"t"</code></a>. Can't be used with <a href="#item__22e_22"><code>"e"</code></a>.</p>
</dd>
</li>
<dt><strong><code>"c"</code></strong>
<dd>
<p>Stands for "Create if none". If the requested file does not
exist, then it is created and then opened. This is the default
if <code>GENERIC_WRITE</code> access has been requested or if <a href="#item__22t_22"><code>"t"</code></a> or
<a href="#item__22n_22"><code>"n"</code></a> was specified. Contrast with <a href="#item__22e_22"><code>"e"</code></a>.</p>
</dd>
</li>
<dt><strong><a name="item__22e_22"><code>"e"</code></a></strong>
<dd>
<p>Stands for "Existing file only". If the requested file does not
exist, then nothing is opened and the <a href="#item_createfile"><code>createFile</code></a> call fails. This
is the default unless <code>GENERIC_WRITE</code> access has been requested or
<a href="#item__22t_22"><code>"t"</code></a> or <a href="#item__22n_22"><code>"n"</code></a> was specified. Contrast with <a href="#item__22c_22"><code>"c"</code></a>. Can't be
used with <a href="#item__22n_22"><code>"n"</code></a>.</p>
</dd>
</li>
</dl>
<p>The characters from <code>"ktn"</code> and <code>"ce"</code> are combined to determine the
what value for <code>$uCreate</code> to pass to <a href="#item_createfile"><code>CreateFile</code></a> [unless overridden
by <code>$rvhvOptions</code>]:</p>
<dl>
<dt><strong><a name="item__22kc_22"><code>"kc"</code></a></strong>
<dd>
<p><code>OPEN_ALWAYS</code></p>
</dd>
</li>
<dt><strong><a name="item__22ke_22"><code>"ke"</code></a></strong>
<dd>
<p><code>OPEN_EXISTING</code></p>
</dd>
</li>
<dt><strong><a name="item__22tc_22"><code>"tc"</code></a></strong>
<dd>
<p><code>TRUNCATE_EXISTING</code></p>
</dd>
</li>
<dt><strong><a name="item__22te_22"><code>"te"</code></a></strong>
<dd>
<p><code>CREATE_ALWAYS</code></p>
</dd>
</li>
<dt><strong><a name="item__22nc_22"><code>"nc"</code></a></strong>
<dd>
<p><code>CREATE_NEW</code></p>
</dd>
</li>
<dt><strong><a name="item__22ne_22"><code>"ne"</code></a></strong>
<dd>
<p>Illegal.</p>
</dd>
</li>
</dl>
<p><code>$svShare</code> controls how the file is shared, that is, whether other
processes can have read, write, and/or delete access to the file while
we have it opened. <code>$svShare</code> will usually be a string containing zero
or more characters from <code>"rwd"</code> but can also be a numeric bit mask.</p>
<p><a href="#item__22r_22"><code>"r"</code></a> sets the <code>FILE_SHARE_READ</code> bit which allows other processes to have
read access to the file. <a href="#item__22w_22"><code>"w"</code></a> sets the <code>FILE_SHARE_WRITE</code> bit which
allows other processes to have write access to the file. <code>"d"</code> sets the
<code>FILE_SHARE_DELETE</code> bit which allows other processes to have delete access
to the file [ignored under Windows 95].</p>
<p>The default for <code>$svShare</code> is <code>"rw"</code> which provides the same sharing as
using regular perl <a href="../../lib/Pod/perlfunc.html#item_open"><code>open()</code></a>.</p>
<p>If another process currently has read, write, and/or delete access to
the file and you don't allow that level of sharing, then your call to
<a href="#item_createfile"><code>createFile</code></a> will fail. If you requested read, write, and/or delete
access and another process already has the file open but doesn't allow
that level of sharing, then your call to <a href="#item_createfile"><code>createFile</code></a> will fail. Once
you have the file open, if another process tries to open it with read,
write, and/or delete access and you don't allow that level of sharing,
then that process won't be allowed to open the file.</p>
<p><code>$rvhvOptions</code> is a reference to a hash where any keys must be from
the list <code>qw( Access Create Share Attributes Flags Security Model )</code>.
The meaning of the value depends on the key name, as described below.
Any option values in <code>$rvhvOptions</code> override the settings from
<code>$svAccess</code> and <code>$svShare</code> if they conflict.</p>
<dl>
<dt><strong><a name="item_flags__3d_3e__24uflags">Flags => $uFlags</a></strong>
<dd>
<p><code>$uFlags</code> is an unsigned value having any of the <code>FILE_FLAG_*</code> or
<code>FILE_ATTRIBUTE_*</code> bits set. Any <code>FILE_ATTRIBUTE_*</code> bits set via the
<code>Attributes</code> option are logically <code>or</code>ed with these bits. Defaults
to <code>0</code>.</p>
</dd>
<dd>
<p>If opening the client side of a named pipe, then you can also specify
<code>SECURITY_SQOS_PRESENT</code> along with one of the other <code>SECURITY_*</code>
constants to specify the security quality of service to be used.</p>
</dd>
</li>
<dt><strong><a name="item_attributes__3d_3e__24sattributes">Attributes => $sAttributes</a></strong>
<dd>
<p>A string of zero or more characters from <code>"achorst"</code> [see <a href="#item_attrletstobits"><code>attrLetsToBits</code></a>
for more information] which are converted to <code>FILE_ATTRIBUTE_*</code> bits to
be set in the <code>$uFlags</code> argument passed to <a href="#item_createfile"><code>CreateFile</code></a>.</p>
</dd>
</li>
<dt><strong><a name="item_security__3d_3e__24psecurityattributes">Security => $pSecurityAttributes</a></strong>
<dd>
<p><code>$pSecurityAttributes</code> should contain a <code>SECURITY_ATTRIBUTES</code> structure
packed into a string or <code>[]</code> [the default].</p>
</dd>
</li>
<dt><strong><a name="item_model__3d_3e__24hmodelfile">Model => $hModelFile</a></strong>
<dd>
<p><code>$hModelFile</code> should contain a handle opened with <code>GENERIC_READ</code>
access to a model file from which file attributes and extended attributes
are to be copied. Or <code>$hModelFile</code> can be <code>0</code> [the default].</p>
</dd>
</li>
<dt><strong><a name="item_access__3d_3e__24saccess">Access => $sAccess</a></strong>
<dt><strong><a name="item_access__3d_3e__24uaccess">Access => $uAccess</a></strong>
<dd>
<p><code>$sAccess</code> should be a string of zero or more characters from
<code>"qrw"</code> specifying the type of access desired: "query" or <code>0</code>,
"read" or <code>GENERIC_READ</code> [the default], or "write" or
<code>GENERIC_WRITE</code>.</p>
</dd>
<dd>
<p><code>$uAccess</code> should be an unsigned value containing bits set to
indicate the type of access desired. <code>GENERIC_READ</code> is the default.</p>
</dd>
</li>
<dt><strong><a name="item_create__3d_3e__24screate">Create => $sCreate</a></strong>
<dt><strong><a name="item_create__3d_3e__24ucreate">Create => $uCreate</a></strong>
<dd>
<p><code>$sCreate</code> should be a string constaing zero or one character from
<code>"ktn"</code> and zero or one character from <code>"ce"</code>. These stand for
"Keep if exists", "Truncate if exists", "New file only", "Create if
none", and "Existing file only". These are translated into a
<code>$uCreate</code> value.</p>
</dd>
<dd>
<p><code>$uCreate</code> should be one of <code>OPEN_ALWAYS</code>, <code>OPEN_EXISTING</code>,
<code>TRUNCATE_EXISTING</code>, <code>CREATE_ALWAYS</code>, or <code>CREATE_NEW</code>.</p>
</dd>
</li>
<dt><strong><a name="item_share__3d_3e__24sshare">Share => $sShare</a></strong>
<dt><strong><a name="item_share__3d_3e__24ushare">Share => $uShare</a></strong>
<dd>
<p><code>$sShare</code> should be a string with zero or more characters from
<code>"rwd"</code> that is translated into a <code>$uShare</code> value. <code>"rw"</code> is
the default.</p>
</dd>
<dd>
<p><code>$uShare</code> should be an unsigned value having zero or more of the
following bits set: <code>FILE_SHARE_READ</code>, <code>FILE_SHARE_WRITE</code>, and
<code>FILE_SHARE_DELETE</code>. <code>FILE_SHARE_READ|FILE_SHARE_WRITE</code> is the
default.</p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -