的SHGetFolderPath()32位和64位SHGetFolderPath

2023-09-08 10:37:03 作者:航母会飞

如果我使用的的SHGetFolderPath API调用在32位系统中CSIDL_PROGRAM_FILESx86文件夹ID,而不是CSIDL_PROGRAM_FILES ID?

从理论上讲CSIDL_PROGRAM_FILESx86应该映射到 C:\ Program Files文件(x86)的在64位系统,但又有什么映射到一个32位系统,这条路没有按'牛逼存在吗?

解决方案

在不同的场景中的这篇文章在MSDN 。

向下滚动的言论,FOLDERID_ProgramFiles

  OS应用程序KNOWNFOLDERID默认路径CSIDL等效
32位32位FOLDERID_ProgramFiles的%SystemDrive%\ Program Files文件CSIDL_PROGRAM_FILES
32位32位FOLDERID_ProgramFilesX86的%SystemDrive%\ Program Files文件CSIDL_PROGRAM_FILESX86
32位32位FOLDERID_ProgramFilesX64(不确定)不适用不适用
 

摘要:它将指向的%SystemDrive%\ Program Files文件

Windows系统32位和64位的区别

What happens if I use SHGetFolderPath api call in a 32 bit system with CSIDL_PROGRAM_FILESx86 folder id instead of the CSIDL_PROGRAM_FILES id?

Theoretically CSIDL_PROGRAM_FILESx86 should map to C:\program files (x86) in a 64 bit system but what does it map to in a 32 bit system where this path doesn't exist?

解决方案

The different scenarios are described in this article on MSDN.

Scroll down to remarks, "FOLDERID_ProgramFiles"

OS    Application KNOWNFOLDERID            Default Path                   CSIDL Equivalent  
32 bit    32 bit  FOLDERID_ProgramFiles    %SystemDrive%\Program Files    CSIDL_PROGRAM_FILES  
32 bit    32 bit  FOLDERID_ProgramFilesX86 %SystemDrive%\Program Files    CSIDL_PROGRAM_FILESX86  
32 bit    32 bit  FOLDERID_ProgramFilesX64 (undefined)    Not applicable  Not applicable

Summary: It will point to %SystemDrive%\Program Files

相关推荐