如何以编程方式检查系统上是否启用了8.3短路径名? [英] How to check programatically that 8.3 short path name is enabled on system?

查看:261
本文介绍了如何以编程方式检查系统上是否启用了8.3短路径名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我手动知道我们可以通过设置NtfsDisable8dot3NameCreation来启用或禁用8.3短路径名称支持.

I know manually we can enable or disable 8.3 short path name support by setting NtfsDisable8dot3NameCreation.

但是如何通过代码读取此系统信息?实际上,我必须根据系统是否启用8.3来禁用某些功能.

But how to read this system information through code? Actually I have to disable some functionality based on whether the system have 8.3 enabled or not.

请帮助

谢谢

推荐答案

提供此功能:

PS C:\Windows\system32> FSUTIL.EXE 8dot3name query D: 
The volume state is: 0 (8dot3 name creation is enabled). 
The registry state is: 2 (Per volume setting - the default).

Based on the above two settings, 8dot3 name creation is enabled on D:

如果需要API,请使用

If you want an API, use GetVolumeInformation, which provides this:

lpMaximumComponentLength [输出,可选]

lpMaximumComponentLength [out, optional]

指向变量的指针,该变量以TCHARs为单位接收最大长度, 指定文件系统支持的文件名组件的名称.

A pointer to a variable that receives the maximum length, in TCHARs, of a file name component that a specified file system supports.

文件名部分是文件名之间的一部分 反斜杠.存储在以下变量中的值 * lpMaximumComponentLength指向,用于指示指定的文件系统支持长名称.例如,对于FAT文件 支持长名称的系统,该函数存储值255, 而不是之前的8.3指标.长名也可以是 在使用NTFS文件系统的系统上受支持.

A file name component is the portion of a file name between backslashes. The value that is stored in the variable that *lpMaximumComponentLength points to is used to indicate that a specified file system supports long names. For example, for a FAT file system that supports long names, the function stores the value 255, rather than the previous 8.3 indicator. Long names can also be supported on systems that use the NTFS file system.

这篇关于如何以编程方式检查系统上是否启用了8.3短路径名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆