Netguy
驱动牛犊
驱动牛犊
  • 注册日期2001-04-02
  • 最后登录2012-05-25
  • 粉丝0
  • 关注0
  • 积分2分
  • 威望17点
  • 贡献值0点
  • 好评度6点
  • 原创分0分
  • 专家分0分
阅读:1727回复:6

driver中如何将短文件名转换为长文件名?

楼主#
更多 发布于:2002-04-09 18:29
就是把8+3的DOS文件名转换为长文件名。比如将c:\\progra~1\\readme.txt转换为c:\\program files\\readme.txt
Thx!

[编辑 -  4/9/02 作者: Netguy]
fracker
驱动太牛
驱动太牛
  • 注册日期2001-06-28
  • 最后登录2021-03-30
  • 粉丝0
  • 关注0
  • 积分219分
  • 威望81点
  • 贡献值0点
  • 好评度23点
  • 原创分0分
  • 专家分1分
  • 社区居民
沙发#
发布于:2002-04-10 10:23
在VxD里面有一个函数可以直接转换,NT下可以用ZwQueryDirectoryFile来找出她的短文件名。
wlrwx
驱动小牛
驱动小牛
  • 注册日期2002-04-05
  • 最后登录2016-01-09
  • 粉丝0
  • 关注0
  • 积分11分
  • 威望11点
  • 贡献值0点
  • 好评度1点
  • 原创分0分
  • 专家分0分
板凳#
发布于:2002-04-10 20:31
That\'s an operation that is quite common in a File System filter driver.
You should be able to use it also in a device diver.

Assuming that you already have a FULL path name (starting from the root)
and not a relative name, you can do the following:
   - Parse each component of the name.
     Get the name of the file/directory you want the long file name for and
the name of the directory in which this file/directory resides.
     Example:
         1st pass:
               directory name: \\
               file/directory name: PROGRA~1
         2nd pass:
               directory name: \\PROGRA~1\\
               file/directory name: readme.txt
         ...

     - For each component, open the directory using ZwCreateFile or
IoCreateFileSpecifyDeviceObjectHint if you are in a FS Filter.
       If you are a FS filter, you can specify the VDO you are attached to
with IoCreateFileSpecifyDeviceObjectHint.
       This will avoid reentrency in your filter. If you are not in the FS
stack, then ZwCreateFile will be fine.

     - Then, send a ZwQueryDirectoryFile (...,
FileBothDirectoryInformation, ...) and precise your file/directory name for
the FileName parameter.
        Note that you can also use the FileNamesInformation class.

     - You will then get a FILE_BOTH_DIR_INFORMATION structure with the
long file name inside for the file you have specified (FileName field).

     - Then, rebuild the full long file name with the long file names you
have obtained.

这个是我在news.microsoft.com上看到的这个问题的回答,希望对你有些帮助吧
 :P :P :P
真正的浪子―――― 是掠过城市的微风,每个人都能感到他的清新,可没有人能留住...... 亦是划过天际的流星,所有人都能仰望他夺目的光芒,没有人能触及...... 风止于森林,流星损于黄土......非凡浪子归于他的最爱......
Netguy
驱动牛犊
驱动牛犊
  • 注册日期2001-04-02
  • 最后登录2012-05-25
  • 粉丝0
  • 关注0
  • 积分2分
  • 威望17点
  • 贡献值0点
  • 好评度6点
  • 原创分0分
  • 专家分0分
地板#
发布于:2002-07-09 17:21
呵呵,微软新闻组上的那个也是我问的呀

我的这个driver是从FileMon改过来的,应该算个FS Filter。我查了一下,IoCreateFileSpecifyDeviceObjectHint这个好象是WinXP的IFS Kit中新增的(参看http://www.microsoft.com/DDK/IFSkit/XPPortingGuide.asp),在Win2K的ntoskrnl.exe中没有导出这个函数。

怎么办?只好用ZwCreateFile试试看是否不蓝屏?

[编辑 -  7/9/02 by  Netguy]

[编辑 -  7/9/02 by  Netguy]
VanCheer
驱动老牛
驱动老牛
  • 注册日期2002-02-21
  • 最后登录2003-08-28
  • 粉丝0
  • 关注0
  • 积分-20分
  • 威望-10点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
地下室#
发布于:2002-07-09 17:22
呵呵,微软新闻组上的那个也是我问的呀

我的这个driver是从FileMon改过来的,应该算个FS Filter。我查了一下,IoCreateFileSpecifyDeviceObjectHint这个好象是WinXP的IFS Kit中新增的,在Win2K的ntoskrnl.exe中没有导出这个函数。

怎么办?只好用ZwCreateFile试试看是否不蓝屏?

好老的帖子,呵呵 :( :( :(
[img]http://www.driverdevelop.com/forum/upload/VanCheer/2003-03-21_mon.gif[/img][img]http://www.driverdevelop.com/forum/upload/VanCheer/2002-12-07_smallbaby.jpg[/img]
Netguy
驱动牛犊
驱动牛犊
  • 注册日期2001-04-02
  • 最后登录2012-05-25
  • 粉丝0
  • 关注0
  • 积分2分
  • 威望17点
  • 贡献值0点
  • 好评度6点
  • 原创分0分
  • 专家分0分
5楼#
发布于:2002-07-10 15:54
老没关系,我的问题还没有解决呀

[quote]呵呵,微软新闻组上的那个也是我问的呀
好老的帖子,呵呵 :( :( :(
Netguy
驱动牛犊
驱动牛犊
  • 注册日期2001-04-02
  • 最后登录2012-05-25
  • 粉丝0
  • 关注0
  • 积分2分
  • 威望17点
  • 贡献值0点
  • 好评度6点
  • 原创分0分
  • 专家分0分
6楼#
发布于:2002-07-10 15:54
老没关系,我的问题还没有解决呀

好老的帖子,呵呵 :( :( :(
游客

返回顶部