title: Trouble calling SystemParametersInfo
body: <p>Recently I've been trying to call the <code>SystemParametersInfo</code> method from managed code, without any success.</p>
  
  <p>The problem is that, after calling the method, the method returns <code>false</code> (indicating failure), however <code>GetLastError</code> (retrieved by  <code>Marshal.GetLastWin32Error()</code>) is <code>0</code>.</p>
  
  <p>I tried to invoke the method from C++ as a test (with the exact same parameters), and it works completely fine from there.</p>
  
  <p>The P/Invoke declaration of the method is this:</p>
  
  <pre><code>[DllImport("user32.dll", SetLastError = true)]
  [return: MarshalAs(UnmanagedType.Bool)]
  internal static extern bool SystemParametersInfo(SPI uiAction, int uiParam, ref STICKYKEYS pvParam, SPIF fWinIni);
  
  internal struct STICKYKEYS 
  {
    public int cbSize;
    public int dwFlags;
  }
  </code></pre>
  
  <p>And the invocation is as follows:</p>
  
  <pre><code>NativeMethods.STICKYKEYS stickyKeys = default(NativeMethods.STICKYKEYS);
  bool result = NativeMethods.SystemParametersInfo(NativeMethods.SPI.SPI_GETSTICKYKEYS, StickyKeysSize, ref stickyKeys, 0);
  int error = Marshal.GetLastWin32Error();
  </code></pre>
  
  <p>The <code>SPI.SPI_GETSTICKYKEYS</code> is<code>0x003A</code> (as seen on MSDN).</p>
  
  <p>Here the result is <code>false</code>, and the error returned is <code>0</code>.<br>
  Also this is complied as a 64-bit executable if that matters.</p>
  
  <p>I'm completely at my wit's end, do you have any idea what I might be doing wrong?</p>