title: GnuPG and CreateProcess in Delphi Service
body: <p>Trying to use <a href="http://gnupg.org/" rel="nofollow noreferrer">GnuPG</a> with Delphi (Win32). I need to sign some file with such console command:</p>
  
  <blockquote>
    <p><code>"C:\Program Files\GNU\GnuPG\gpg.exe" -a -u Alex --passphrase secretpassword --yes --clearsign -o C:\Result.asc C:\InputFile.txt</code></p>
  </blockquote>
  
  <p>First I created normal VCL Forms App and used <code>CreateProcess</code> function, everything was OK, but when I transfered that code to my service app, gpg.exe exits with code 2. Maybe I missed something? Any ideas?</p>
  
  <p><strong>Update</strong></p>
  
  <p>Just in case someone has such a problem. GnuPG stores keys in <code>C:\Documents And Settings\&lt;username&gt;\Application Data\gnupg\</code> but when service runs from another user account (SYSTEM) - it can't find your key. GL &amp; HF</p>