title: How do I solve this "P/Invoke declarations should be portable"?
body: <p>This code:</p>
  
  <pre><code>[DllImport("shell32", CharSet=CharSet.Unicode)]
  private static extern int SHGetFileInfo(string pszPath, uint dwFileAttributes, out SHFILEINFO psfi, uint cbFileInfo, uint flags);
  </code></pre>
  
  <p>Causes the following Code Analysis problem:</p>
  
  <blockquote>
    <p><strong>CA1901  P/Invoke declarations should be portable</strong></p>
    
    <p>As it is declared in your code, the return type of P/Invoke
    'IconUtil.SHGetFileInfo(string, uint, out IconUtil.SHFILEINFO, uint,
    uint)' will be 4 bytes wide on 64-bit platforms. This is not correct,
    as the actual native declaration of this API indicates it should be 8
    bytes wide on 64-bit platforms. Consult the MSDN Platform SDK
    documentation for help determining what data type should be used
    instead of 'int'.</p>
  </blockquote>
  
  <p>What am I supposed to do? I tried "consulting MSDN", but I'm not really sure what the problem even means.</p>
  
  <hr>
  
  <p>I also get this for the same line:</p>
  
  <blockquote>
    <p><strong>CA1060  Move P/Invokes to NativeMethods class</strong></p>
    
    <p>Because it is a P/Invoke method, 'IconUtil.SHGetFileInfo(string, uint,
    out IconUtil.SHFILEINFO, uint, uint)' should be defined in a class
    named NativeMethods, SafeNativeMethods, or UnsafeNativeMethods.</p>
  </blockquote>