确定用于USB访问的CreateFile第一个参数lpFileName [英] Determining CreateFile 1st parameter lpFileName for USB access

查看:309
本文介绍了确定用于USB访问的CreateFile第一个参数lpFileName的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在开发用于划分笔式驱动器的应用程序.为此,我使用CreateFile函数打开设备句柄.该函数是:

Hi,
I''m developing the application for partitioning the pen drive. For that i''m using CreateFile function for opening the device handle. The function is:

CreateFile(
LPCTSTR lpFileName, // file name
DWORD dwDesiredAccess, // access mode
DWORD dwShareMode, // share mode
LPSECURITY_ATTRIBUTES lpSecurityAttributes, // SD
DWORD dwCreationDisposition, // how to create
DWORD dwFlagsAndAttributes, // file attributes
HANDLE hTemplateFile // handle to template
file
);


如何确定第一个参数应该是什么?我猜应该跟
类似


How do I determine what the first parameter should be? I guess it should be something similar to

"\\\\.\\xxxUSBxxx;



我在哪里可以找到有关该字符串应该是什么的线索?

在此先感谢
问候
Mohanraj



Where can I look for clues on what this string should be?

Thanks in Advance
Regards
Mohanraj

推荐答案

您可以从WMI和Win32_DiskDrive类获取deviceId.

不要在多个地方重新发布相同的问题.这样就无法在答案上进行协作.

它不是\\.\ xxxUSBxxx.格式为\\.\ PHYSICALDRIVE0 \\.\ PHYSICALDRIVE1 \\.\ PHYSICALDRIVE2 \\ PHYSICALDRIVE3 ...
You can get the deviceId from WMI and the Win32_DiskDrive class.

Don''t repost the same question in multiple places. It makes collaborting on an answer impossible.

And it''s not \\.\xxxUSBxxx. It''ll be in the format \\.\PHYSICALDRIVE0 \\.\PHYSICALDRIVE1 \\.\PHYSICALDRIVE2 \\PHYSICALDRIVE3 ...


这篇关于确定用于USB访问的CreateFile第一个参数lpFileName的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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