Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. format PE DLL native
  2. entry START
  3.  
  4. __DEBUG__               = 1
  5. __DEBUG_LEVEL__         = 2
  6.  
  7. section '.flat' readable writable executable
  8.  
  9. include '../../proc32.inc'
  10. include '../../struct.inc'
  11. include '../../macros.inc'
  12. include '../../fdo.inc'
  13.  
  14. proc START c, reason:dword
  15.  
  16.         DEBUGF  2,"Loading 'asm_drv' driver\n"
  17.         cmp     [reason], DRV_ENTRY
  18.         jne     .fail
  19.        
  20.         invoke  RegService, my_service, service_proc        
  21.         ret
  22.  
  23.   .fail:
  24.         xor     eax, eax
  25.         ret
  26.  
  27. endp
  28.  
  29. proc service_proc stdcall, ioctl:dword
  30.  
  31.         mov     ebx, [ioctl]
  32.         mov     eax, [ebx + IOCTL.io_code]
  33.         cmp     eax, 0 ; FUNCTION ADD(a+b);
  34.         jne     .fail
  35.        
  36.         mov     eax, [ebx + IOCTL.input]
  37.         mov     ecx, eax
  38.         add     ecx, 4
  39.        
  40.         mov     eax, [eax]
  41.         add     eax, [ecx]
  42.        
  43.         mov     ecx, [ebx + IOCTL.output]
  44.         mov     [ecx], eax
  45.        
  46.         xor     eax, eax
  47.         ret
  48.  
  49.   .fail:
  50.         or      eax, -1
  51.         ret
  52. endp
  53.  
  54. data fixups
  55. end data
  56.  
  57. include '../../peimport.inc'
  58.  
  59. my_service   db 'asm_drv',0    ; max 16 chars include zero
  60.  
  61. include_debug_strings
  62.