How to retrieve correct path of either system32 or SysWOW64?

前端 未结 3 1423
执笔经年
执笔经年 2020-12-21 02:52

I have a 32-bit process that can run either in 32-bit or 64-bit Windows. So, naturally, if the process tried to access the file c:\\windows\\system32\\file.ext,

3条回答
  •  -上瘾入骨i
    2020-12-21 03:24

    if I understood it correctly, you can use SHGetSpecialFolderPath passing CSIDL_SYSTEMX86 to the csidl parameter. The documentation for the valid csidl's states that a 32 bit process will get:

    • %windir%\system32 on a 32 bits OS
    • %windir%\syswow64 on a 64 bits OS

    Best regards

提交回复
热议问题