如何判断驱动器是否为网络映射或SUBST的驱动器
编号:QA001175
建立日期: 1999年6月14日 最后修改日期:1999年6月14日
所属类别:
李奔:
Visual C++ 6.0
windows 98和windows 95 osr2
如何取得系统现有的逻辑驱动器,然而却不能包括网络映射驱动器和SUBST的驱动器,也就是说,象scandisk那样!我用了很多函数都不能做到,例如:GetLogicalDrive和GetLogicalDriveStrings,他们都不能区分出网络驱动器和subst驱动器,其实,最困难的并不是网络驱动器(我调用int 21h已经可以解决),而是subst驱动器!难道非要读分区表吗?
回答:
既然已经用了INT21,那么都用它好了,查询一个驱动器是否是一个SUBST路径所成的,用它也可以。附上一段VC6的帮助。
不过要查询是否是网络驱动器,用GetDriveType()也一样。
----------------------
Interrupt 21h Function 71AAh Minor Code 2h
Determines if the specified drive is associated with a path and, if it is, retrieves
the associated path.
mov ax, 71aah ; SUBST
mov bh, 2 ; Query SUBST
mov bl, DriveNum ; see below
mov dx, seg PathName ; see below
mov ds, dx
mov dx, offset PathName
int 21h
jc error
Parameters
DriveNum
Drive to SUBST. This parameter can 1 for A, 2 for B, and so on. Note that DriveNum cannot be 0 to indicate the default drive.
PathName
Address of buffer that receives the null-terminated string of the path associated with the specified drive. The buffer must be of MAXPATHLEN size.
Return Value
Clears the carry flag and retrieves the associated path in the specified buffer if successful. Otherwise, the function sets the carry flag and returns an error value in the AX register.
此问题由cs回答。
| |
|
|
| |
|
|