title: Delphi define types of external WinAPI function
body: <p>I was trying to call <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/ms682431(v=vs.85).aspx" rel="nofollow">CreateProcessWithLogonW</a> function in delphi</p>
  
  <p>My first attempt was as follow</p>
  
  <pre><code>function CreateProcessWithLogonW(
    lpUsername,
    lpDomain,
    lpPassword: LPCWSTR;
    dwLogonFlags: DWORD;
    lpApplicationName: LPCWSTR;
    lpCommandLine: LPWSTR;
    dwCreationFlags: DWORD;
    lpEnvironment: Pointer;
    lpCurrentDirectory: LPCWSTR;
    lpStartupInfo: TStartupInfo;
    lpProcessInfo: TProcessInformation
    ): BOOL;
      stdcall; external 'Advapi32.dll';
  </code></pre>
  
  <p>I got AV once i call it in my program, I <a href="http://borland.newsgroups.archived.at/public.delphi.nativeapi.win32/200709/0709089600.html" rel="nofollow">googled</a> how to call this function in Delphi and i found that <code>lpStartupInfo</code> and <code>lpProcessInfo</code> must be define as follow  </p>
  
  <pre><code> var lpStartupInfo: TStartupInfo;
   var lpProcessInfo: TProcessInformation
  </code></pre>
  
  <p>The functions works as expected.</p>
  
  <p>My question: How i can now if the function parameter must be variable when calling external WinAPI functions such the above. Because I didn't find in the docs about this information.  </p>