📄 ifsmgr.inc
字号:
{
VxDJmp(IFSMgr_CountLocks)
}
VOID VXDINLINE NAKED IFSMgr_UnassignLockList(PVOID pFSDLockListHead)
{
VxDJmp(IFSMgr_UnassignLockList)
}
VOID VXDINLINE NAKED IFSMgr_ReassignLockFileInst(PVOID pFSDLockListhead, PVOID pOldOpenFileInstance, PVOID pNewOpenFileInstance)
{
VxDJmp(IFSMgr_ReassignLockFileInst)
}
VOID VXDINLINE NAKED NotifyVolumeArrival(UINT drive)
{
VxDJmp(NotifyVolumeArrival)
}
int VXDINLINE NAKED QueryVolumeRemoval(UINT drive, int fDialog)
{
VxDJmp(QueryVolumeRemoval)
}
VOID VXDINLINE NAKED NotifyVolumeRemoval(UINT drive)
{
VxDJmp(NotifyVolumeRemoval)
}
int VXDINLINE NAKED IFSMgr_PNPEvent(UINT Message, UINT Resource, UINT Flags)
{
VxDJmp(IFSMgr_PNPEvent)
}
int VXDINLINE NAKED _VolFlush(UINT Volume, int Flags)
{
VxDJmp(_VolFlush)
}
VOID VXDINLINE NAKED IFSMgr_CompleteAsync(pioreq pir)
{
VxDJmp(IFSMgr_CompleteAsync)
}
int VXDINLINE R0_OpenCreateFile(BOOL incontext, WORD modeflags, WORD attrib, BYTE action, BYTE flags, char* pathname, PDWORD phandle, PDWORD paction)
{
DWORD opcode = incontext ? R0_OPENCREAT_IN_CONTEXT : R0_OPENCREATFILE;
DWORD result=0;
_asm
{
pushad
mov eax, R0_OPENCREATFILE ;/* opcode */
xor ebx,ebx
xor ecx,ecx
xor edx,edx
mov bx, [modeflags]
mov cx, [attrib]
mov dl, [action]
mov dh, [flags]
mov esi, [pathname]
}
VxDCall(IFSMgr_Ring0_FileIO)
_asm
{
jc error
mov ebx, [phandle]
mov [ebx], eax
mov ebx, [paction]
mov [ebx], ecx
xor eax, eax
error:
mov [WORD PTR result], ax
popad
}
return result;
}
int VXDINLINE R0_ReadFile(BOOL incontext, DWORD handle, DWORD count, DWORD pos, PBYTE buffer, PDWORD nread)
{
DWORD opcode = incontext ? R0_READFILE_IN_CONTEXT : R0_READFILE;
DWORD result=0;
_asm
{
pushad
mov eax, R0_READFILE ; /* opcode */
mov ebx, [handle]
mov ecx, [count]
mov edx, [pos]
mov esi, [buffer]
}
VxDCall(IFSMgr_Ring0_FileIO)
_asm
{
jc error
mov ebx, [nread]
mov [ebx], ecx
xor eax, eax
error:
mov [WORD PTR result], ax
popad
}
return result;
}
int VXDINLINE R0_WriteFile(BOOL incontext, DWORD handle, DWORD count, DWORD pos, const BYTE* buffer, PDWORD nwritten)
{
DWORD opcode = incontext ? R0_WRITEFILE_IN_CONTEXT : R0_WRITEFILE;
DWORD result=0;
_asm
{
pushad
mov eax, R0_WRITEFILE ; /* opcode */
mov ebx, [handle]
mov ecx, [count]
mov edx, [pos]
mov esi, [buffer]
}
VxDCall(IFSMgr_Ring0_FileIO)
_asm
{
jc error
mov ebx, nwritten
mov [ebx], ecx
xor eax, eax
error:
mov [WORD PTR result], ax
popad
}
return result;
}
int VXDINLINE R0_CloseFile(DWORD handle)
{
_asm
{
mov eax, R0_CLOSEFILE
mov ebx, [handle]
}
VxDCall(IFSMgr_Ring0_FileIO)
_asm jc error
_asm xor eax, eax
_asm error:
_asm movzx eax, ax
}
int VXDINLINE R0_GetFileSize(DWORD handle, PDWORD psize)
{
_asm
{
mov eax, R0_GETFILESIZE
mov ebx, handle
}
VxDCall(IFSMgr_Ring0_FileIO)
_asm
{
jc error
mov ebx, psize
mov [ebx], eax
xor eax, eax
error:
movzx eax, ax
}
}
int VXDINLINE R0_FindFirstFile(WORD attrib, const char* pathname, _WIN32_FIND_DATA* fd, PDWORD phandle)
{
_asm
{
mov eax, R0_FINDFIRSTFILE
mov esi, pathname
mov edx, fd
}
VxDCall(IFSMgr_Ring0_FileIO)
_asm
{
jc error
mov ebx, phandle
mov [ebx], eax
xor eax, eax
error:
movzx eax, ax
}
}
int VXDINLINE R0_FindNextFile(DWORD handle, _WIN32_FIND_DATA* fd)
{
_asm
{
mov eax, R0_FINDNEXTFILE
mov ebx, handle
mov edx, fd
}
VxDCall(IFSMgr_Ring0_FileIO)
_asm jc error
_asm xor eax, eax
_asm error:
_asm movzx eax, ax
}
int VXDINLINE R0_FindClose(DWORD handle)
{
_asm
{
mov eax, R0_FINDCLOSEFILE
mov ebx, handle
}
VxDCall(IFSMgr_Ring0_FileIO)
_asm jc error
_asm xor eax, eax
_asm error:
_asm movzx eax, ax
}
int VXDINLINE R0_GetFileAttributes(const char* pathname, PWORD pattrib)
{
_asm
{
mov eax, R0_FILEATTRIBUTES or GET_ATTRIBUTES
mov esi, pathname
}
VxDCall(IFSMgr_Ring0_FileIO)
_asm
{
jc error
mov ebx, pattrib
mov word ptr [ebx], cx
xor eax, eax
error:
movzx eax, ax
}
}
int VXDINLINE R0_SetFileAttributes(const char* pathname, WORD attrib)
{
_asm
{
mov eax, R0_FILEATTRIBUTES or SET_ATTRIBUTES
mov cx, attrib
mov esi, pathname
}
VxDCall(IFSMgr_Ring0_FileIO)
_asm jc error
_asm xor eax, eax
_asm error:
_asm movzx eax, ax
}
int VXDINLINE R0_RenameFile(const char* oldname, const char* newname)
{
_asm
{
mov eax, R0_RENAMEFILE
mov esi, oldname
mov edx, newname
}
VxDCall(IFSMgr_Ring0_FileIO)
_asm jc error
_asm xor eax, eax
_asm error:
_asm movzx eax, ax
}
int VXDINLINE R0_DeleteFile(const char* pathname, WORD attrib)
{
_asm
{
mov eax, R0_DELETEFILE
mov cx, attrib
mov esi, pathname
}
VxDCall(IFSMgr_Ring0_FileIO)
_asm jc error
_asm xor eax, eax
_asm error:
_asm movzx eax, ax
}
int VXDINLINE R0_LockFile(DWORD handle, DWORD pid, DWORD dwOffset, DWORD dwLength)
{
_asm
{
mov eax, R0_LOCKFILE or LOCK_REGION
mov ebx, handle
mov ecx, pid
mov edx, dwOffset
mov esi, dwLength
}
VxDCall(IFSMgr_Ring0_FileIO)
_asm jc error
_asm xor eax, eax
_asm error:
_asm movzx eax, ax
}
int VXDINLINE R0_UnlockFile(DWORD handle, DWORD pid, DWORD dwOffset, DWORD dwLength)
{
_asm
{
mov eax, R0_LOCKFILE or UNLOCK_REGION
mov ebx, handle
mov ecx, pid
mov edx, dwOffset
mov esi, dwLength
}
VxDCall(IFSMgr_Ring0_FileIO)
_asm jc error
_asm xor eax, eax
_asm error:
_asm movzx eax, ax
}
int VXDINLINE R0_GetDiskFreeSpace(BYTE drive, PWORD pspc, PWORD pavl, PWORD psecsize, PWORD ptot)
{
_asm
{
mov eax, R0_GETDISKFREESPACE
mov dl, drive
}
VxDCall(IFSMgr_Ring0_FileIO)
_asm
{
jc error
mov esi, pspc
mov word ptr [esi], ax ; sectors per cluster
mov esi, pavl
mov word ptr [esi], bx ; available clusters
mov esi, psecsize
mov word ptr [esi], cx ; bytes per sector
mov esi, ptot
mov word ptr [esi], dx ; total clusters on disk
xor eax, eax
error:
movzx eax, ax
}
}
int VXDINLINE R0_ReadAbsoluteDisk(BYTE drive, UINT nsectors, DWORD sector, PBYTE buffer)
{
_asm
{
mov al, drive
mov ah, R0_READABSOLUTEDISK shr 8
mov ecx, nsectors
mov edx, sector
mov esi, buffer
}
VxDCall(IFSMgr_Ring0_FileIO)
_asm jc error
_asm xor eax, eax
_asm error:
_asm movzx eax, ax
}
int VXDINLINE R0_WriteAbsoluteDisk(BYTE drive, UINT nsectors, DWORD sector, const BYTE* buffer)
{
_asm
{
mov al, drive
mov ah, R0_WRITEABSOLUTEDISK shr 8
mov ecx, nsectors
mov edx, sector
mov esi, buffer
}
VxDCall(IFSMgr_Ring0_FileIO)
_asm jc error
_asm xor eax, eax
_asm error:
_asm movzx eax, ax
}
int VXDINLINE IFSMgr_Ring0GetDriveInfo(UINT drive)
{
_asm mov edx, drive
VxDCall(IFSMgr_Ring0_FileIO)
_asm
{
jnc noerror
mov eax, -1
noerror:
}
}
int VXDINLINE TimeSliceSleep(UINT time)
{
_asm mov eax, time
VxDCall(Time_Slice_Sleep)
}
int VXDINLINE GetVMMReenterCount()
{
int v;
_asm pushad
_asm xor ecx,ecx
VxDCall(Get_VMM_Reenter_Count)
_asm mov [v],ecx
_asm popad
return v;
}
int VXDINLINE ReleaseTimeSlice()
{
VxDCall(Release_Time_Slice)
}
//%%%
//int RestrictedEvent(unsigned int Proc,unsigned int refdata)
// {
// _asm
// {
//
// mov eax, 0;
// mov ebx, 0 ;Handle
// ;;mov ecx, PEF_ALWAYS_SCHED|PEF_RING0_EVENT;
// mov ecx, PEF_ALWAYS_SCHED|PEF_WAIT_CRIT;
// mov edx, [refdata]
// mov esi, [Proc]
// mov edi, 0
// VxDCall (Call_Restricted_Event)
// }
// return 0;
// }
ShellMessageNCB(int flags,char * message,char *caption)
{
int handle;
handle=Get_Sys_VM_Handle();
_asm
{
pushad
mov ebx, [handle] ; virtual machine handle
mov eax, [flags] ; message box flags
mov ecx, [message] ; address of message text
mov edi, [caption] ; address of caption text
mov esi, 0 ; address of callback
mov edx, 0 ; reference data for callback
}
VxDCall (SHELL_SYSMODAL_Message);
_asm cli
_asm popad
}
ShellWinMessage(int flags,char * message,char *caption)
{
int handle;
handle=Get_Sys_VM_Handle();
_asm
{
pushad
mov ebx, [handle] ; virtual machine handle
mov eax, [flags] ; message box flags
mov ecx, [message] ; address of message text
mov edi, [caption] ; address of caption text
mov esi, 0 ; address of callback
mov edx, 0 ; reference data for callback
}
VxDCall (SHELL_Message);
_asm jnc noerror
ShellMessageNCB(flags,message,caption);
_asm noerror:
_asm cli
_asm popad
}
APPY_HANDLE VXDINLINE
SHELL_CallAtAppyTime(APPY_CALLBACK pfnAppyCallBack, DWORD dwRefData, DWORD flAppy, ...)
{
_asm push flAppy[4]
_asm push flAppy
_asm push dwRefData
_asm push pfnAppyCallBack
Touch_Register(eax)
Touch_Register(ecx)
Touch_Register(edx)
VxDCall(_SHELL_CallAtAppyTime);
_asm add esp, 4*4
}
int VXDINLINE
SHELLexec(int exec)
{
_asm push exec
Touch_Register(eax)
Touch_Register(ecx)
Touch_Register(edx)
VxDCall(_SHELL_ShellExecute);
_asm add esp, 4
}
int SHELLHookBroadcast(void* haddress,int ref)
{
_asm push ref
_asm push haddress
VxDCall (_SHELL_HookSystemBroadcast)
_asm add esp,8
}
int VXDINLINE WaitShTime(unsigned int time)
{
unsigned int timelow;
unsigned int time2=0;
_asm pushad
Touch_Register(eax)
Touch_Register(edx)
VxDCall(VTD_Get_Real_Time)
_asm mov [timelow],eax
while (time2<time)
{
Touch_Register(eax)
Touch_Register(edx)
VxDCall(VTD_Get_Real_Time)
_asm sub eax,[timelow]
_asm mov [time2],eax
}
_asm popad
}
int VXDINLINE AdjustThreadPriority(UINT pb,UINT th)
{
_asm mov eax, pb
_asm mov edi,th
VxDCall(Adjust_Thread_Exec_Priority)
}
ppIFSFileHookFunc IFSMgr_InstallFileSystemApiHook(pIFSFileHookFunc fcn)
{
ppIFSFileHookFunc p;
_asm push fcn
_asm mov eax,fcn /* not sure which! */
VxDCall(IFSMgr_InstallFileSystemApiHook)
_asm add esp,4
_asm mov [p],eax
return p;
}
int VXDINLINE NAKED IFSMgr_RemoveFileSystemApiHook(pIFSFileHookFunc fcn)
{
VxDJmp(IFSMgr_RemoveFileSystemApiHook)
}
int VXDINLINE NAKED IFSMgr_CDROM_Attach(DWORD drive, struct _VRP** pvrp, int fDoMount)
{
VxDJmp(IFSMgr_CDROM_Attach)
}
int VXDINLINE NAKED IFSMgr_CDROM_Detach(DWORD Drive, struct _VRP* vrp)
{
VxDJmp(IFSMgr_CDROM_Detach)
}
int VXDINLINE NAKED IFSMgr_FSDUnmountCFSD(DWORD rh)
{
VxDJmp(IFSMgr_FSDUnmountCFSD)
}
int VXDINLINE NAKED IFSMgr_MountChildVolume(struct _VRP* vrp, DWORD drive)
{
VxDJmp(IFSMgr_MountChildVolume)
}
int VXDINLINE NAKED IFSMgr_UnmountChildVolume(struct _VRP* vrp, DWORD drive)
{
VxDJmp(IFSMgr_UnmountChildVolume)
}
int VXDINLINE NAKED IFSMgr_SwapDrives(struct _VRP* vrp, DWORD drive1, DWORD drive2)
{
VxDJmp(IFSMgr_SwapDrives)
}
int VXDINLINE NAKED IFSMgr_FSDGetCurrentDrive(pioreq pir)
{
VxDJmp(IFSMgr_FSDGetCurrentDrive)
}
int VXDINLINE NAKED _GetMappedErr(UINT Function, UINT ExtErr)
{
VxDJmp(_GetMappedErr)
}
int VXDINLINE NAKED IFSMgr_GetLockState(DWORD drive, PDWORD pLockType, PDWORD pLockFlags, PDWORD pLockOwner)
{
VxDJmp(IFSMgr_GetLockState)
}
BOOL VXDINLINE Query_PhysLock(DWORD unit)
{
_asm mov eax, unit
VxDCall(Query_PhysLock)
_asm sbb eax, eax ; CF set if process doesn't own volume lock, so return is -1 if unowned, 0 if owned
}
VOID VXDINLINE NAKED IFSMgr_printf(const char* pfstr, ...)
{
VxDJmp(IFSMgr_printf)
}
#ifdef DEBUG
#define IFSASSERT(x) if (!(x)) IFSMgr_AssertFailed(#x, __FILE__, __LINE__)
VOID VXDINLINE NAKED IFSMgr_AssertFailed(const char* msg, const char* pfname, DWORD line)
{
VxDJmp(IFSMgr_AssertFailed)
}
VOID VXDINLINE NAKED IFSMgr_LogEntry(const char* name, DWORD info1, DWORD info2, int sdepth, DWORD mask)
{
VxDJmp(IFSMgr_LogEntry)
}
DWORD VXDINLINE NAKED IFSMgr_DebugMenu(PVOID pm)
{
VxDJmp(IFSMgr_DebugMenu)
}
DWORD VXDINLINE NAKED IFSMgr_DebugVars()
{
VxDJmp(IFSMgr_DebugVars)
}
int VXDINLINE NAKED IFSMgr_GetDebugString(const char* prompt, char* buffer, UINT length)
{
VxDJmp(IFSMgr_GetDebugString)
}
int VXDINLINE NAKED IFSMgr_GetDebugHexNum(const char* prompt, PDWORD phexval)
{
VxDJmp(IFSMgr_GetDebugHexNum)
}
DWORD VXDINLINE NAKED IFSMgr_DbgSetFileHandleLimit(DWORD MaxHandles)
{
VxDJmp(IFSMgr_DbgSetFileHandleLimit)
}
#else
#define IFSASSERT(x)
#define IFSMgr_Assert_Failed(a1, a2, a3)
#define IFSMgr_LogEntry(a1, a2, a3, a4, a5)
#define IFSMgr_DebugMenu(a1) NULL
#define IFSMgr_DebugVars() NULL
#define IFSMgr_GetDebugString(a1, a2, a3) 0
#define IFSMgr_GetDebugHexNum(a1, a2) 0
#define IFSMgr_DbgSetFileHandleLimit(a1) a1
#endif
#endif /* Not_VxD */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -