hongsing
驱动小牛
驱动小牛
  • 注册日期2004-05-22
  • 最后登录2012-04-29
  • 粉丝0
  • 关注0
  • 积分4分
  • 威望8点
  • 贡献值0点
  • 好评度6点
  • 原创分0分
  • 专家分0分
阅读:1237回复:3

改 REGFSD 问题请教。

楼主#
更多 发布于:2005-04-07 19:36
我是用REGFSD改过来的驱动,重定向到另外一个盘,比如 REGFSD 生成的盘是 D 盘,所有读写 D 盘的操作,我都转向到 E 盘,文件显示(FIND 和 FINDNEXT)没问题,当读区大于 512 字节的文件时,就蓝平了,小于512字节的没问题。请教各位朋友,这是个什么问题?
hongsing
驱动小牛
驱动小牛
  • 注册日期2004-05-22
  • 最后登录2012-04-29
  • 粉丝0
  • 关注0
  • 积分4分
  • 威望8点
  • 贡献值0点
  • 好评度6点
  • 原创分0分
  • 专家分0分
沙发#
发布于:2005-04-07 19:39
相关代码如下:
VOID __cdecl RequestHandler(IOP * pIop)
{
PDEVICEPARAMS pDP;
IOR* pIor = &pIop->IOP_ior;
HKEY h;
PCHAR pValue, p;
DWORD pos;
DWORD ValueSize = READBUFSIZE;
CHAR readbuf[READBUFSIZE];
PDEVICEPARAMS pDp;

HANDLE filehwnd;
WORD pError;
CHAR LogBuf[300];
DWORD GetC=0;

// dprintf(\"REGFSD: %s initiated\\tIOP=%x\\n\",
// GetIOFunctionName(pIor->IOR_func), pIop);

pIor->IOR_status = IORS_INVALID_COMMAND; // assume error

switch (pIop->IOP_ior.IOR_func)
{
case IOR_READ:

// The IOP was sent by our HandleRead function. The private convention
// is:
// IOR_start_addr[0] = the Registry key to whose value is to be read
// IOR_start_addr[1] = name of value to read
// IOR_private_port = file position (byte offset from start of value)

dw2(\"========RequestHandler=======<IOR_READ><1>--\",\"Start\");
//h = (HKEY)pIor->IOR_start_addr[0];
filehwnd = (HANDLE)pIor->IOR_start_addr[0];
pValue = (PCHAR)pIor->IOR_start_addr[1];
pos = pIor->IOR_private_port;
p = readbuf;

// Read the value
sprintf(LogBuf,\"%s: <pos=%d><count=%d>\",pValue,pos,pIor->IOR_xfer_count);
dw2(\"========RequestHandler=======<IOR_READ><2>--\",LogBuf);
//DWORD __cdecl R0_ReadFile(BOOL bInContext, HANDLE h, PVOID buffer,
// DWORD Count, DWORD FileOffset, PWORD pError);

GetC = R0_ReadFile(FALSE,filehwnd,p,pIor->IOR_xfer_count,pos,&pError);
if (pError==0)
{
sprintf(LogBuf,\"Count:<%d>,RDBSIZE:<%d>,pos<%d>,Getc<%d>\",pIor->IOR_xfer_count,READBUFSIZE,pos,GetC);
dw2(\"========RequestHandler=======<READ_ST> <3>--\",LogBuf);

pIor->IOR_status = IORS_SUCCESS;
//pIor->IOR_xfer_count = min(pIor->IOR_xfer_count, READBUFSIZE-pos);
pIor->IOR_xfer_count = min(pIor->IOR_xfer_count, GetC);
memcpy((PVOID)pIor->IOR_buffer_ptr, p+pos, GetC);

sprintf(LogBuf,\"Count:<%d>,RDBSIZE:<%d>,pos<%d>,Getc<%d>\",pIor->IOR_xfer_count,READBUFSIZE,pos,GetC);
dw2(\"========RequestHandler=======<READ_OK> <3>--\",LogBuf);
}
/*if (RegQueryValueEx(h, pValue, NULL,NULL, p, &ValueSize) ==
ERROR_SUCCESS)
{

// If the value is read, then transfer the data to the client buffer

if (pos < READBUFSIZE)
{
pIor->IOR_status = IORS_SUCCESS;
pIor->IOR_xfer_count =
min(pIor->IOR_xfer_count,
READBUFSIZE-pos);
memcpy((PVOID)pIor->IOR_buffer_ptr, p+pos,
pIor->IOR_xfer_count);
}
}*/

break;

case IOR_GEN_IOCTL:
// dprintf(\"\\tdrive=%c function=%x\\n\", pIor->IOR_ioctl_drive+\'A\',
// pIor->IOR_ioctl_function);

switch (pIor->IOR_ioctl_function)
{
case 0x440D:
// Get Device Parameters

pDp = (PDEVICEPARAMS)pIor->IOR_ioctl_buffer_ptr;

if ( (pIor->IOR_ioctl_control_param & 0xff) == 0x60)
{
IoctlGetDeviceParams(pDp);
pIor->IOR_status = IORS_SUCCESS;
}

break;

}

break;

default:
pIor->IOR_status = IORS_INVALID_COMMAND;
break;
}

// Invoke the completion handler. First pop off the empty entry at the
// top of the stack. Note: IOP_callback_ptr is type as IOP_callback_entry*,
// not ULONG when using VtoolsD.

--pIop->IOP_callback_ptr;
pIop->IOP_callback_ptr->IOP_CB_address(pIop);
}
hongsing
驱动小牛
驱动小牛
  • 注册日期2004-05-22
  • 最后登录2012-04-29
  • 粉丝0
  • 关注0
  • 积分4分
  • 威望8点
  • 贡献值0点
  • 好评度6点
  • 原创分0分
  • 专家分0分
板凳#
发布于:2005-04-07 23:11
调试信息是这样的:
23:46:26 Admin: ========VolOpen=======<True>-- E:\\XPICON.DLL
23:46:26 Admin: ========VolOpen======= XPICON.DLL 0
23:46:26 Admin: ========VolOpen=======<True>-- Open Success
23:46:26 Admin: ========HandleSeek=======<3>-- FILE_BEGIN,<ir_pos=0>
23:46:26 Admin: ========HandleSeek=======<5>-- End,<ir_pos=0>
23:46:26 Admin: ========RequestHandler=======<IOR_READ><1>-- Start
23:46:26 Admin: ========RequestHandler=======<IOR_READ><2>-- E:\\XPICON.DLL: <pos=0><count=30720>
hongsing
驱动小牛
驱动小牛
  • 注册日期2004-05-22
  • 最后登录2012-04-29
  • 粉丝0
  • 关注0
  • 积分4分
  • 威望8点
  • 贡献值0点
  • 好评度6点
  • 原创分0分
  • 专家分0分
地板#
发布于:2005-04-08 21:50
How To?
who can help me?
游客

返回顶部