-4

I have a 32 bit application. How correctly (officially) to find out which folder to install the application, depending on the bit depth of the OS? Are there any winapi commands that would give out the correct path, if i indicating that the application is 32 bit.

windows/System32 or windows/SysWOW64?

In general, how correctly to do, if i'm not want to check if one of this folder exist?

Minimum supported client needed - Windows XP.

ilw
  • 2,499
  • 5
  • 30
  • 54

1 Answers1

2

You should call SHGetKnownFolderPath supplying FOLDERID_ProgramFiles folder id. It will retrieve correct directory for applications. If you still want to install into system32 (though typical applications should not do it), then you can call it with FOLDERID_SystemX86.

user7860670
  • 35,849
  • 4
  • 58
  • 84
  • `Minimum supported client Windows Vista [desktop apps only]` What about xp? – ilw Dec 15 '17 at 08:29
  • You can try checking `%ProgramFiles(x86)%` environment variable as described [here](https://stackoverflow.com/questions/9594066/how-to-get-program-files-x86-env-variable). – user7860670 Dec 15 '17 at 08:36
  • 3
    There is the old function [SHGetFolderPath](https://msdn.microsoft.com/de-de/library/windows/desktop/bb762181(v=vs.85).aspx) for XP. – xMRi Dec 15 '17 at 08:39
  • Thank yo guys. In fact, I want to know it through RPC. I know, this is the topic of another question, but nevertheless ... For example: https://web.archive.org/web/20160403140939/http://www.hsc.fr/ressources/articles/win_net_srv/msrpc_winreg.html – ilw Dec 15 '17 at 08:47
  • 1
    @Andreyua What matters is less what you actually want, but what you ask. This question doesn't specify RPC and so this question is not about RPC. If you asked the wrong question, tough. You should know well enough by now how to ask. – David Heffernan Dec 15 '17 at 09:01