为什么我的调用会出错
- typedef BYTE * (* FSREAD)(LARGE_INTEGER base,DWORD size) ;
- typedef bool (* FSWRITE)(LARGE_INTEGER base,DWORD size,BYTE * mem) ;
- typedef bool ( * FS_PRE_READ)(FSREAD FSIO_READ);
- typedef bool ( * FS_PRE_WRITE)(FSWRITE FSIO_WRITE);
- typedef FS_FAT * (* FS_ENUMFILE)(wchar_t * path,void * node);
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////
- hDev = ::CreateFile(this->m_patch.Left(6),
- GENERIC_READ | GENERIC_WRITE,FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0);
- if (hDev == INVALID_HANDLE_VALUE)
- MessageBox(this->m_patch.Left(6));
- HINSTANCE DLLInst = NULL;
- FS_ENUMFILE FileEnum;
- FS_PRE_READ FileRreRead;
- if(NULL == DLLInst) DLLInst = LoadLibrary(_T("FS.dll"));
- if (DLLInst) {
- FileEnum = (FS_ENUMFILE) ::GetProcAddress(DLLInst, "FS_ENUMFILE");
- FileRreRead = (FS_PRE_READ) ::GetProcAddress(DLLInst, "FS_PRE_READ");
- }
- FileRreRead(FileEnumPre);//初始化
- CString a,b,all;
- void * node = NULL;
- //MessageBox((this->m_patch.Mid(4, this->m_patch.GetLength() - 5)).AllocSysString());
- FileEnum((this->m_patch.Mid(4, this->m_patch.GetLength() - 5)).AllocSysString(), node);
- FS_FAT * fp=(FS_FAT *)node;
- while(fp!=NULL)
- {
- InsertItem(fp->longname, hSel, TVI_LAST);
- fp=fp->next;
- }
-
- 其中
- / 由FS_PRE_READ调用来获取信息
- BYTE * FileEnumPre(LARGE_INTEGER a, DWORD b)
- {
- BYTE * buffer=new BYTE[b];
- if (hDev!=INVALID_HANDLE_VALUE)
- {
- DWORD dwRet;
- ::SetFilePointer(hDev,a.LowPart,&a.HighPart,FILE_BEGIN);
- ::ReadFile(hDev,buffer,b,&dwRet,0);
- }
- else
- {
- }
- return buffer;
- }
复制代码
FileEnum((this->m_patch.Mid(4, this->m_patch.GetLength() - 5)).AllocSysString(), node);这一行提示堆破坏~~ |