Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><code>HANDLE</code> is a Windows-API-specific data type defined in <code>winnt.h</code>. According to the <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa383751.aspx#HANDLE" rel="nofollow">MSDN</a>,</p> <blockquote> <p>A handle to an object. This type is declared in <code>WinNT.h</code> as follows:</p> <pre><code>typedef PVOID HANDLE; </code></pre> </blockquote> <p>So, now we see that <code>HANDLE</code> is really just <code>void *</code> -- representing a handle to an object. Think about what it is that you're trying to do; does it make sense to serialize a <em>pointer</em> to some object in the Windows API?</p> <p>Instead, try to serialize what it takes to retrieve an equivalent <code>HANDLE</code>; judging by the name of the member, I'm going to guess you used <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa363858.aspx" rel="nofollow"><code>CreateFile</code></a> -- so, you'll need to know...</p> <ul> <li>The file name</li> <li>The desired access (e.g. <code>GENERIC_READ | GENERIC_WRITE</code>)</li> <li>The share mode (e.g. <code>FILE_SHARE_DELETE</code>)</li> <li>Optionally, the security attributes</li> <li>The creation disposition (i.e. <code>CREATE_NEW</code>, <code>TRUNCATE_EXISTING</code>, etc.)</li> <li>The file or device flags and attributes </li> <li>Optionally, a template file -- for copying its attributes when creating a file</li> </ul> <hr> <p>Now, if you <em>really</em> don't want to be doing that -- you're <strong>positive</strong> you want the pointer value -- maybe try serializing it after casting via <a href="http://en.cppreference.com/w/cpp/language/reinterpret_cast" rel="nofollow"><code>reinterpret_cast</code></a> to <code>std::intptr_t</code> or <code>std::uintptr_t</code> (as <em>might</em> be defined in <code>cstdint</code> as of C++11).</p> <pre><code>ar &amp; reinterpret_cast&lt;std::intptr_t&gt;(file); </code></pre> <p>... then you should couple this with something as follows (when deserializing):</p> <pre><code>std::intptr_t _file; ar &amp; _file; HANDLE file = std::reinterpret_cast&lt;HANDLE&gt;(_file); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload