DELPHI盒子
!实时搜索: 盒子论坛 | 注册用户 | 修改信息 | 退出
检举帖 | 全文检索 | 关闭广告 | 捐赠
技术论坛
 用户名
 密  码
自动登陆(30天有效)
忘了密码
≡技术区≡
DELPHI技术
lazarus/fpc/Free Pascal
移动应用开发
Web应用开发
数据库专区
报表专区
网络通讯
开源项目
论坛精华贴
≡发布区≡
发布代码
发布控件
文档资料
经典工具
≡事务区≡
网站意见
盒子之家
招聘应聘
信息交换
论坛信息
最新加入: tino0914
今日帖子: 27
在线用户: 17
导航: 论坛 -> 论坛精华贴 斑竹:liumazi,iamdream  
作者:
男 lisam (星空寂寞) ★☆☆☆☆ -
普通会员
2003/4/14 17:50:01
标题:
我想做一个类似于虚拟光驱的那种程序应该从那个地方入手啊? 浏览:4028
加入我的收藏
楼主: 初步是想把 某个文件夹虚拟成一个硬盘来用,Delphi上实现的思路是怎样的,需要用到那些组件呢?
----------------------------------------------
作者:
男 beginer (初学者) ★☆☆☆☆ -
盒子活跃会员
2003/4/15 8:50:12
1楼: 太难了,我不懂。
----------------------------------------------
新手,想得到您的帮助!
作者:
男 liumazi (刘麻子) ★☆☆☆☆ -
大善人会员
2004/9/19 10:13:57
2楼: [转载]模拟DOS命令 - subst 来源:未知 
unit Subst; 

API for work with substitution device (see dos command "subst"). 
Win 9x/NT/2000/XP compatible
ver. 1.2 Last rev. 25 Feb 2002

Freware with source.

Copyright (c) 2000-2002, SoftLab MIL-TEC Ltd
Web: http://www.softcomplete.com
Email: support@softcomplete.com

THIS SOFTWARE AND THE ACCOMPANYING FILES ARE DISTRIBUTED
"AS IS" AND WITHOUT WARRANTIES AS TO PERFORMANCE OF MERCHANTABILITY OR
ANY OTHER WARRANTIES WHETHER EXPRESSED OR IMPLIED.
NO WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE IS OFFERED.
THE USER MUST ASSUME THE ENTIRE RISK OF USING THE ACCOMPANYING CODE. // 请注意此段文本

Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented, you must
not claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation
would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. Original copyright may not be removed or altered from any source
distribution.
}

interface

uses Windows, SysUtils;

function SubstCreate(DriveLetter: Char; const Path: string): Boolean;
// create subst device. Path must be a real folder.

function SubstRemove(DriveLetter: Char): Boolean;
// destroy subst device.

function SubstQuery(DriveLetter: Char): string;
// get Path for subst device.
// return empty string if DriveLetter is not subst-device

implementation

procedure VxDCall; external kernel32 index 1;

function SubstCreate(DriveLetter: Char; const Path: string): Boolean;
var drvno: byte;
buff: array[0..256] of char;
FPath: string;

function AddSlash(const Path: string): string; {??áàa???ì \ ???è íà??}
begin
if (Path = '') or (Path[Length(Path)] <> '\') then Result:=Path+'\'
else Result:=Path;
end;

begin
if Path[Length(Path)] = '\' then
FPath:=Copy(Path,1,Length(Path)-1)
else
FPath:=Path;
if Win32Platform = VER_PLATFORM_WIN32_NT then begin
buff[0]:=DriveLetter;
buff[1]:=':';
buff[2]:=#0;
Result:=DefineDosDevice(0,buff,PChar(Path));
end else begin
FPath:=ExtractShortPathName(FPath);
if FPath <> '' then begin
drvno:=Ord(UpperCase(DriveLetter)[1])-64;
StrPCopy(buff,FPath);
asm
pushad
push es
xor ebx, ebx
mov bh,0
mov bl,drvno
lea edx,buff
push 0 //ECX (unused)
push 71AAh
push 2A0010h
call VxDCall
pop es
popad
end;
end;
Result:=ANSIUpperCase(AddSlash(SubstQuery(DriveLetter))) = ANSIUpperCase(AddSlash(Path));
end;
end;

function SubstRemove(DriveLetter: Char): Boolean;
var drvno: byte;
Drive,Path: string;
begin
if Win32Platform = VER_PLATFORM_WIN32_NT then begin
SetLength(Drive,3);
Drive[1]:=DriveLetter;
Drive[2]:=':';
Drive[3]:=#0;
Path:=SubstQuery(DriveLetter);
Result:=DefineDosDevice(DDD_REMOVE_DEFINITION,PChar(Drive),PChar(Path));
end else begin
drvno:=Ord(UpperCase(DriveLetter)[1])-64;
asm
pushad
push es
xor ebx, ebx
mov bh,1
mov bl,drvno
push 0 //ECX (unused)
push 71AAh
push 2A0010h
call VxDCall
pop es
popad
end;
Result:=SubstQuery(DriveLetter) = '';
end;
end;

function SubstQuery(DriveLetter: Char): string;
var drvno: byte;
buff: array[0..256] of char;
lbuff: array[0..256] of char;
begin
if Win32Platform = VER_PLATFORM_WIN32_NT then begin
lbuff[0]:=DriveLetter;
lbuff[1]:=':';
lbuff[2]:=#0;
buff[0]:=#0;
QueryDosDevice(lbuff,buff,256);
Result:=StrPas(buff);
if Copy(Result,1,4) = '\??\' then
Result:=Copy(Result,5,Length(Result))
else
Result:='';
end else begin
drvno:=Ord(UpperCase(DriveLetter)[1])-64;
buff[0]:=#0;
asm
pushad
push es
xor ebx, ebx
mov bh,2
mov bl,drvno
lea edx,buff
push 0 //ECX (unused)
push 71AAh
push 2A0010h
call VxDCall
pop es
popad
end;
Result:=StrPas(buff);
if Result = '' then Exit;
// convert to longfilename
asm
// expand long path
pushad
push ds
push es
xor ebx, ebx
lea esi, buff
lea edi, lbuff
mov ecx,0
mov cl, 2
mov ch, 0
push ECX
push 7160h
push 2A0010h
call VxDCall
pop es
pop ds
popad
end;
Result:=StrPas(lbuff);
end;
end;

end.
 

----------------------------------------------
好好学习,天天上网。
作者:
女 seowhy123456 (seowhy123456) ▲▲▲▲▲ -
禁用账号
2011/5/2 20:27:57
4楼: ……
被禁用帐号,帖子内容自动屏蔽!
……

----------------------------------------------
发布广告,禁用帐号!
作者:
女 seowhy123456 (seowhy123456) ▲▲▲▲▲ -
禁用账号
2011/5/2 20:32:53
5楼: ……
被禁用帐号,帖子内容自动屏蔽!
……

----------------------------------------------
发布广告,禁用帐号!
作者:
女 seowhy123456 (seowhy123456) ▲▲▲▲▲ -
禁用账号
2011/5/12 23:42:20
6楼: ……
被禁用帐号,帖子内容自动屏蔽!
……

----------------------------------------------
发布广告,禁用帐号!
作者:
女 seowhy123456 (seowhy123456) ▲▲▲▲▲ -
禁用账号
2011/6/13 22:58:20
7楼: ……
被禁用帐号,帖子内容自动屏蔽!
……

----------------------------------------------
发布广告,禁用帐号!
作者:
女 seowhy123456 (seowhy123456) ▲▲▲▲▲ -
禁用账号
2011/7/1 23:21:40
8楼: ……
被禁用帐号,帖子内容自动屏蔽!
……

----------------------------------------------
发布广告,禁用帐号!
作者:
女 seowhy123456 (seowhy123456) ▲▲▲▲▲ -
禁用账号
2011/7/1 23:28:03
9楼: ……
被禁用帐号,帖子内容自动屏蔽!
……

----------------------------------------------
发布广告,禁用帐号!
作者:
女 seowhy123456 (seowhy123456) ▲▲▲▲▲ -
禁用账号
2011/7/3 21:56:34
10楼: ……
被禁用帐号,帖子内容自动屏蔽!
……

----------------------------------------------
发布广告,禁用帐号!
信息
登陆以后才能回复
Copyright © 2CCC.Com 盒子论坛 v3.0.1 版权所有 页面执行82.03125毫秒 RSS