Windows NT 4.0 source code leak
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

99 lines
2.3 KiB

4 years ago
  1. ;****************************************************************************
  2. ;* *
  3. ;* WFFSC.ASM - *
  4. ;* *
  5. ;* WINFILE's File System Change Notification Handler *
  6. ;* *
  7. ;****************************************************************************
  8. include winfile.inc
  9. ;=============================================================================
  10. externFP lstrlen
  11. externFP lstrcpy
  12. externFP LocalAlloc
  13. externFP PostMessage
  14. createSeg _%SEGNAME, %SEGNAME, WORD, PUBLIC, CODE
  15. sBegin %SEGNAME
  16. assumes CS,%SEGNAME
  17. assumes DS,DATA
  18. ;*--------------------------------------------------------------------------*
  19. ;* *
  20. ;* KernelChangeFileSystem() - *
  21. ;* *
  22. ;*--------------------------------------------------------------------------*
  23. cProc KernelChangeFileSystem, <FAR, PUBLIC>, <SI, DI>
  24. parmW wDosFunc
  25. parmD lpFile
  26. localW handle
  27. cBegin
  28. cmp wDosFunc,4300h ; Is it get attributes?
  29. je KCFSExit ; Yup, skip
  30. ; Alloc a local buffer for the file's name.
  31. les si,lpFile
  32. push es
  33. push si
  34. call lstrlen
  35. inc ax ; Skip the NULL
  36. ; Is this a RENAME command?
  37. cmp wDosFunc,5600h
  38. jne KCFSAllocIt ; Nope, Skip
  39. ; Yup, add the length of the second string.
  40. mov di,ax ; DI = Length of first string
  41. add si,di ; SI points to second string
  42. push es
  43. push si
  44. call lstrlen
  45. add ax,di ; Add length of first string
  46. inc ax ; Include the NULL
  47. KCFSAllocIt:
  48. mov di,ax ; DI = Number of chars to copy
  49. mov dx,LMEM_NODISCARD or LMEM_NOCOMPACT or LMEM_FIXED
  50. cCall LocalAlloc,<dx,di>
  51. or ax,ax
  52. jz KCFSExit
  53. mov handle,ax ; Save the handle
  54. ; Copy the file's name into local storage.
  55. push ds ; Save DS
  56. mov cx,di ; CX = Length
  57. push ds
  58. pop es
  59. mov di,ax ; ES:DI = Destination
  60. lds si,lpFile ; DS:SI = Source
  61. cld
  62. rep movsb ; Copy
  63. pop ds ; Restore DS
  64. ; Compute the proper FSC_ value for wParam.
  65. mov ax,wDosFunc
  66. xchg ah,al
  67. mov ah,80h ; high bit -> dos function, not FSC
  68. sub dx,dx
  69. mov cx,WM_FILESYSCHANGE
  70. ; Post the message.
  71. cCall PostMessage,<_hwndFrame,cx,ax,dx,handle>
  72. KCFSExit:
  73. cEnd
  74. sEnd
  75. end