Leaked source code of windows server 2003
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.

2462 lines
67 KiB

  1. PAGE 58,132
  2. ;******************************************************************************
  3. TITLE SHADOW.ASM - Windows/386 NETBIOS SHADOW FOR REMOTE NETWORK ACCESS
  4. ;******************************************************************************
  5. ;
  6. ; (C) Copyright MICROSOFT Corp., 1987-1993
  7. ;
  8. ; Title: SHADOW.ASM -
  9. ;
  10. ;
  11. ;
  12. ; Version:
  13. ;
  14. ; Date:
  15. ;
  16. ; Author:
  17. ;
  18. ;------------------------------------------------------------------------------
  19. .386p
  20. .XLIST
  21. WIN40COMPAT equ 1
  22. include vmm.inc
  23. include shell.inc
  24. include debug.inc
  25. include ifsmgr.inc
  26. include dosmgr.inc
  27. include vxdldr.inc
  28. include vwin32.inc
  29. include winnetwk.inc
  30. include netvxd.inc
  31. include vrdsvc.inc
  32. .LIST
  33. extern _ProcessRegisterNet:near
  34. extern _ProcessNetFunction:near
  35. IFDEF HOOKMOUNT
  36. extern _ProcessRegisterMount:near
  37. ENDIF
  38. extern _FS_ConnectResourceShadow:near
  39. extern _IoctlRegisterAgent:near
  40. extern _IoctlUnRegisterAgent:near
  41. extern _IoctlGetUNCPath:near
  42. extern _IoctlBeginPQEnum:near
  43. extern _IoctlEndPQEnum:near
  44. extern _IoctlNextPriShadow:near
  45. extern _IoctlPrevPriShadow:near
  46. extern _IoctlGetShadowInfo:near
  47. extern _IoctlSetShadowInfo:near
  48. extern _IoctlCopyChunk:near
  49. extern _IoctlChkUpdtStatus:near
  50. extern _IoctlDoShadowMaintenance:near
  51. extern _IoctlBeginReint:near
  52. extern _IoctlEndReint:near
  53. extern _IoctlCreateShadow:near
  54. extern _IoctlDeleteShadow:near
  55. extern _IoctlSetServerStatus:near
  56. extern _IoctlGetServerStatus:near
  57. extern _IoctlAddUse:near
  58. extern _IoctlDelUse:near
  59. extern _IoctlGetUse:near
  60. extern _ActOnCreateVM:near
  61. extern _ActOnResumeVM:near
  62. extern _ActOnSetDeviceFocus:near
  63. extern _TerminateHook:near
  64. extern _IoctlSwitches:near
  65. extern _IoctlGetShadow:near
  66. extern _IoctlGetGlobalStatus:near
  67. extern _IoctlFindOpenHSHADOW:near
  68. extern _IoctlFindNextHSHADOW:near
  69. extern _IoctlFindCloseHSHADOW:near
  70. extern _IoctlGetPriorityHSHADOW:near
  71. extern _IoctlSetPriorityHSHADOW:near
  72. extern _IoctlAddHint:near
  73. extern _IoctlDeleteHint:near
  74. extern _IoctlFindOpenHint:near
  75. extern _IoctlFindNextHint:near
  76. extern _IoctlFindCloseHint:near
  77. extern _IoctlGetAliasHSHADOW:near
  78. extern _FS_FakeNetConnect:near
  79. extern _ActOnTerminateThread:near
  80. IFDEF DEBUG
  81. extern _ShadowRestrictedEventCallback:near
  82. extern _DebugQueryCmdStr:byte
  83. extern _DebugQueryCmdStrLen:dword
  84. extern _SHDDebug:near
  85. ENDIF
  86. Declare_Virtual_Device SHADOW, 3, 0Ah, Shadow_Control, CSC_Device_ID, IFSMgr_Init_Order+1,,Shadow_PM_Api_Handler
  87. SHADOW_VERSION EQU 8287h
  88. API_SUCCESS EQU 1
  89. API_FAILURE EQU 0
  90. Time_Out_Period EQU 1100
  91. MAX_LANS EQU 16
  92. Shadow_IOCTL_BASE EQU 1001
  93. Shadow_IOCTL_GENERROR EQU 1
  94. TRUE EQU 1
  95. FALSE EQU 0
  96. ;SHADOW_OEM_ID EQU 00220000h
  97. IFDEF DEBUG
  98. SHADOW_LOG_TIME_INTERVAL EQU 60000
  99. SHADOW_STATS_FLUSH_COUNT EQU 10
  100. ENDIF
  101. VxD_DATA_SEG
  102. IFDEF DEBUG
  103. _NbDebug dd 0
  104. ENDIF
  105. public OrigRegisterNetFunc
  106. public _OrigNetFunction
  107. public _fLog
  108. public _fShadow
  109. public _fShadowFind
  110. public _fDiscon
  111. public _fNoShadow
  112. public _OrigSetupFailedConnection
  113. public _proidShadow
  114. public _FCBToShort
  115. public _ShortToFCB
  116. public _DebugMenu
  117. public _GetConfigDir
  118. public _Get_Sys_VM_Handle
  119. public _Get_Cur_VM_Handle
  120. public _Call_VM_Event
  121. public _SetWin32Event
  122. public _CloseVxDHandle
  123. public _VRedirCSCInfoFunction
  124. public _MyCheckAccessConflict
  125. OrigRegisterNetFunc dd -1
  126. _OrigNetFunction dd 0
  127. OrigHookDeviceService dd 0
  128. NextNetFunction dd 0
  129. _OrigSetupFailedConnection dd 0
  130. _proidShadow dd 0
  131. _VRedirCSCInfoFunction dd 0
  132. IFDEF HOOKMOUNT
  133. public OrigRegisterMountFunc
  134. OrigRegisterMountFunc dd -1
  135. ENDIF
  136. ALIGN 4
  137. indos_ptr dd 0
  138. IFDEF DEBUG
  139. Alloc_watch dd 0
  140. Alloc_table dd 512 DUP (0)
  141. Alloc_sizes dd 512 DUP (0)
  142. Alloc_cnt dd 0
  143. ENDIF
  144. ALIGN 4
  145. Shadow_PM_API_Table LABEL DWORD
  146. dd offset32 Shadow_PM_API_Get_Version
  147. Shadow_PM_API_Max EQU ($-Shadow_PM_API_Table)/4
  148. Shadow_IOCTL_Table LABEL DWORD
  149. dd offset32 Shadow_PM_API_Register_Agent
  150. dd offset32 Shadow_PM_API_UnRegister_Agent
  151. dd offset32 Shadow_PM_API_GetUNCPath
  152. dd offset32 Shadow_PM_API_BeginPQEnum
  153. dd offset32 Shadow_PM_API_EndPQEnum
  154. dd offset32 Shadow_PM_API_NextPriShadow
  155. dd offset32 Shadow_PM_API_PrevPriShadow
  156. dd offset32 Shadow_PM_API_GetShadowInfo
  157. dd offset32 Shadow_PM_API_SetShadowInfo
  158. dd offset32 Shadow_PM_API_ChkUpdtStatus
  159. dd offset32 Shadow_PM_API_DoShadowMaintenance
  160. dd offset32 Shadow_PM_API_CopyChunk
  161. dd offset32 Shadow_PM_API_BeginReint
  162. dd offset32 Shadow_PM_API_EndReint
  163. dd offset32 Shadow_PM_API_CreateShadow
  164. dd offset32 Shadow_PM_API_DeleteShadow
  165. dd offset32 Shadow_PM_API_GetServerStatus
  166. dd offset32 Shadow_PM_API_SetServerStatus
  167. dd offset32 Shadow_PM_API_AddUse
  168. dd offset32 Shadow_PM_API_DelUse
  169. dd offset32 Shadow_PM_API_GetUse
  170. dd offset32 Shadow_PM_API_Switches
  171. dd offset32 Shadow_PM_API_GetShadow
  172. dd offset32 Shadow_PM_API_GetGlobalStatus
  173. dd offset32 Shadow_PM_API_FindOpenHSHADOW
  174. dd offset32 Shadow_PM_API_FindNextHSHADOW
  175. dd offset32 Shadow_PM_API_FindCloseHSHADOW
  176. dd offset32 Shadow_PM_API_GetPriorityHSHADOW
  177. dd offset32 Shadow_PM_API_SetPriorityHSHADOW
  178. dd offset32 Shadow_PM_API_AddHint
  179. dd offset32 Shadow_PM_API_DeleteHint
  180. dd offset32 Shadow_PM_API_FindOpenHint
  181. dd offset32 Shadow_PM_API_FindNextHint
  182. dd offset32 Shadow_PM_API_FindCloseHint
  183. dd offset32 Shadow_PM_API_GetAliasHSHADOW
  184. Shadow_IOCTL_MAX EQU ($-Shadow_IOCTL_Table)/4
  185. IFDEF DEBUG
  186. Debug_Menu LABEL DWORD
  187. dd OFFSET32 MinDbg_Str, OFFSET32 MinDbg_Debug
  188. dd OFFSET32 DefaultDbg_Str, OFFSET32 DefaultDbg_Debug
  189. dd OFFSET32 MaxDbg_Str, OFFSET32 MaxDbg_Debug
  190. dd OFFSET32 Alloc_Str, OFFSET32 Alloc_Debug
  191. dd OFFSET32 Heap_Str, OFFSET32 AllocDisplay_Debug
  192. Debug_Menu_Len equ ($ - Debug_Menu)/8
  193. dd 0
  194. MinDbg_Str db "Minimal debug output", 0
  195. DefaultDbg_Str db "Default debug output", 0
  196. MaxDbg_Str db "Maximum debug output", 0
  197. Alloc_Str db "Monitor memory allocations", 0
  198. Heap_Str db "Display current memory allocations", 0
  199. Shadow_Str db "Shadow",0
  200. ENDIF ; DEBUG
  201. _fLog dd 0
  202. _fShadow dd 0
  203. _fDiscon dd 0
  204. _fNoShadow dd 0
  205. _cntTicks dd 0
  206. _fShadowFind dd 0
  207. sz386Enh db "386enh",0
  208. _vszShadowOverride db "NoShadow",0
  209. extern _ulMaxStoreSize:DWORD
  210. VxD_DATA_ENDS
  211. VxD_LOCKED_DATA_SEG
  212. VxD_LOCKED_DATA_ENDS
  213. VxD_CODE_SEG
  214. ;******************************************************************************
  215. ;
  216. ; @doc INTERNAL SHADOW
  217. ;
  218. ; @api LocalAlloc | Allocates page-locked memory.
  219. ;
  220. ; @parm flags | ignored
  221. ;
  222. ; @parm bytesneeded | number of bytes of memory required
  223. ;
  224. ; @rdesc Returns address of memory if allocation succeeds
  225. ; or zero if allocation failed.
  226. ;
  227. ;******************************************************************************
  228. LocalAlloc proc near c public, flags:dword, bytesneeded:dword
  229. mov eax, bytesneeded
  230. push eax
  231. VxDcall IFSMgr_GetHeap
  232. pop ecx ; Clear stack
  233. test eax, eax
  234. jz short AH50
  235. AH20:
  236. IFDEF DEBUG
  237. jmp AH_Debug
  238. ENDIF
  239. cld
  240. ret
  241. ; Heap allocation failed. Try to fill the spare if inDos not set.
  242. AH50:
  243. mov ecx, indos_ptr
  244. cmp word ptr [ecx], 0
  245. jne short AH20
  246. VxDcall IFSMgr_FillHeapSpare
  247. push bytesneeded
  248. VxDcall IFSMgr_GetHeap
  249. pop ecx ; Clear stack
  250. IFDEF DEBUG
  251. jmp AH_Debug
  252. ENDIF
  253. cld
  254. ret
  255. IFDEF DEBUG
  256. AH_Debug:
  257. cld
  258. pushad
  259. test eax, eax
  260. jnz AH_GotMem
  261. Debug_Out "Shadow: LocalAlloc Failed"
  262. jmp AH_Done
  263. AH_GotMem:
  264. mov edx, Alloc_watch
  265. or edx, edx
  266. jz AH_NoTrace
  267. mov edx, bytesneeded
  268. ; Trace_Out "Shadow: LocalAlloc #EDX bytes at #EAX"
  269. AH_NoTrace:
  270. mov edi, OFFSET32 Alloc_table
  271. mov ecx, Alloc_cnt
  272. mov [edi + ecx *4], eax
  273. mov edi, OFFSET32 Alloc_sizes
  274. mov edx, bytesneeded
  275. mov [edi + ecx *4], edx
  276. inc Alloc_cnt
  277. AH_Done:
  278. popad
  279. ret
  280. ENDIF
  281. LocalAlloc endp
  282. ;******************************************************************************
  283. ;
  284. ; @doc INTERNAL SHADOW
  285. ;
  286. ; @api LocalFree | Frees a previously allocated block of page-locked memory.
  287. ;
  288. ; @parm memhandle | address of the block to be freed
  289. ;
  290. ; @rdesc Returns zero.
  291. ;
  292. ;******************************************************************************
  293. LocalFree proc near c public, memhandle:dword
  294. mov eax, memhandle
  295. IFDEF DEBUG
  296. pushad
  297. IFDEF DEBUG
  298. mov ecx, eax
  299. call _ShadowCheckHeap
  300. ENDIF
  301. mov edi, OFFSET32 Alloc_table
  302. mov ecx, Alloc_cnt
  303. cld
  304. repne scasd
  305. jz FH_Found
  306. Debug_Out "Shadow: LocalFree invalid handle"
  307. jmp FH_Done
  308. FH_Found:
  309. sub edi, 4
  310. xor ecx, ecx
  311. mov [edi], ecx
  312. mov esi, OFFSET32 Alloc_table
  313. mov edx, Alloc_cnt
  314. dec edx
  315. mov ebx, [esi + edx * 4]
  316. mov [edi], ebx
  317. mov esi, OFFSET32 Alloc_sizes
  318. mov ebx, [esi + edx * 4]
  319. sub edi, OFFSET32 Alloc_table
  320. add edi, OFFSET32 Alloc_sizes
  321. mov [edi], ebx
  322. mov Alloc_cnt, edx
  323. mov edx, Alloc_watch
  324. or edx, edx
  325. jz FH_Done
  326. ; Trace_Out "Shadow: LocalFree #EAX"
  327. FH_Done:
  328. popad
  329. ENDIF
  330. push eax
  331. VxDcall IFSMgr_RetHeap
  332. pop eax ; Clear stack, smallest way
  333. cld
  334. xor eax, eax
  335. ret
  336. LocalFree endp
  337. ;******************************************************************************
  338. ;
  339. ; @doc INTERNAL SHADOW
  340. ;
  341. ; @asm Shadow_Device_Init | This function is called when the
  342. ; shadow is dynamically loaded.
  343. ;
  344. ; @reg EBX | System VM Handle
  345. ;
  346. ; @reg EBP | pointer to client regs structure
  347. ;
  348. ; @rdesc Register values at return:
  349. ;
  350. ; @reg FLAGS | Flags defined at return:
  351. ;
  352. ; @flag NC | Succeeded in initializing VxD
  353. ;
  354. ; @flag CY | Failed to initializing VxD
  355. ;
  356. ; @uses FLAGS
  357. ;
  358. ; @xref Shadow_Control
  359. ;
  360. ;******************************************************************************
  361. BeginProc Shadow_Device_Init, PUBLIC
  362. ; int 1
  363. xor eax,eax
  364. mov esi, OFFSET32 sz386Enh
  365. mov edi, OFFSET32 _vszShadowOverride
  366. VMMCall Get_Profile_Decimal_Int
  367. jc yes_shadow_enable
  368. jz yes_shadow_enable
  369. Trace_Out "Shadow: Override set"
  370. mov _fNoShadow, 1
  371. stc
  372. ret
  373. yes_shadow_enable:
  374. mov esi, OFFSET32 ShadowNetFunction
  375. mov eax, @@IFSMgr_NetFunction
  376. VMMcall Hook_Device_Service
  377. jc DevInitError
  378. Trace_Out "Shadow: Hooked IFSMgr_NetFunction"
  379. mov _OrigNetFunction, esi
  380. clc
  381. mov esi, OFFSET32 ShadowHookDeviceService
  382. mov eax, @@Hook_Device_Service
  383. VMMcall Hook_Device_Service
  384. jc DevInitError
  385. Trace_Out "Shadow: Hooked Hook_Device_Service"
  386. mov OrigHookDeviceService, esi
  387. clc
  388. Register_Net_Func:
  389. mov esi, OFFSET32 ShadowRegisterNetFunc
  390. mov eax, @@IFSMgr_RegisterNet
  391. VMMcall Hook_Device_Service
  392. jc DevInitError
  393. Trace_Out "Shadow: Hooked RegisterNet service"
  394. mov OrigRegisterNetFunc, esi
  395. clc
  396. VxDCall IFSMgr_RegisterNet, <_FS_FakeNetConnect, IFSMGRVERSION, WNNC_NET_COGENT>
  397. cmp eax, -1
  398. jz DevInitError
  399. mov _proidShadow, eax
  400. IFDEF HOOKMOUNT
  401. mov esi, OFFSET32 ShadowMountFunction
  402. mov eax, @@IFSMgr_RegisterMount
  403. VMMcall Hook_Device_Service
  404. jc DevInitError
  405. Trace_Out "Shadow: Hooked RegisterMount service"
  406. mov OrigRegisterMountFunc, esi
  407. clc
  408. ENDIF
  409. IFDEF DEBUG
  410. mov eax, SHADOW_LOG_TIME_INTERVAL
  411. mov edx, 0
  412. mov esi, OFFSET32 Shadow_Timer_Callback
  413. VMMCall Set_Global_Time_Out
  414. mov eax,esi
  415. cmp eax,0
  416. jne TimerSet
  417. Trace_Out "Shadow: Couldn't set the logging timer"
  418. TimerSet:
  419. ENDIF
  420. mov esi, OFFSET32 _FS_ConnectResourceShadow
  421. mov eax, @@IFSMgr_SetupFailedConnection
  422. VMMcall Hook_Device_Service
  423. jc SFC_Error
  424. Trace_Out "Shadow: Hooked SetupFailedConnection"
  425. mov _OrigSetupFailedConnection, esi
  426. SFC_Error:
  427. clc
  428. ret
  429. DevInitError:
  430. Trace_Out "Shadow: Error Hooking services"
  431. mov _fshadow, 0
  432. ret
  433. EndProc Shadow_Device_Init
  434. ;******************************************************************************
  435. ;
  436. ; @doc INTERNAL SHADOW
  437. ;
  438. ; @asm Shadow_Device_Exit | This function is called when the
  439. ; VxD is dynamically unloaded.
  440. ;
  441. ; @reg EBX | System VM Handle
  442. ;
  443. ; @reg EBP | pointer to client regs structure
  444. ;
  445. ; @rdesc Register values at return:
  446. ;
  447. ; @reg FLAGS | Flags defined at return:
  448. ;
  449. ; @flag NC | Success
  450. ;
  451. ; @flag CY | Failure
  452. ;
  453. ; @uses FLAGS
  454. ;
  455. ; @xref Shadow_Control
  456. ;
  457. ;
  458. ;******************************************************************************
  459. BeginProc Shadow_Device_Exit
  460. clc
  461. ret
  462. EndProc Shadow_Device_Exit
  463. ;******************************************************************************
  464. ;
  465. ; @doc INTERNAL SHADOW
  466. ;
  467. ; @asm Shadow_Sys_VM_Terminate | This function is called when the
  468. ; VxD is dynamically unloaded.
  469. ;
  470. ; @reg EBX | System VM Handle
  471. ;
  472. ; @reg EBP | pointer to client regs structure
  473. ;
  474. ; @rdesc Register values at return:
  475. ;
  476. ; @reg FLAGS | Flags defined at return:
  477. ;
  478. ; @flag NC | Success
  479. ;
  480. ; @flag CY | Failure
  481. ;
  482. ; @uses FLAGS
  483. ;
  484. ; @xref Shadow_Control
  485. ;
  486. ;
  487. ;******************************************************************************
  488. BeginProc Shadow_Sys_VM_Terminate
  489. call _TerminateHook
  490. clc
  491. ret
  492. EndProc Shadow_Sys_VM_Terminate
  493. ;******************************************************************************
  494. ;
  495. ; @doc INTERNAL SHADOW
  496. ;
  497. ; @asm Shadow_Control | This function dispatches VxD control messages
  498. ;
  499. ; @reg EBX | System VM Handle
  500. ;
  501. ; @reg EBP | pointer to client regs structure
  502. ;
  503. ; @rdesc Register values at return:
  504. ;
  505. ; @reg FLAGS | Flags defined at return:
  506. ;
  507. ; @flag NC | Success
  508. ;
  509. ; @flag CY | Failure
  510. ;
  511. ; @uses FLAGS
  512. ;
  513. ;******************************************************************************
  514. BeginProc Shadow_Control
  515. Control_Dispatch Device_Init, Shadow_Device_Init
  516. Control_Dispatch System_Exit, Shadow_Device_Exit
  517. Control_Dispatch Sys_VM_Terminate, Shadow_Sys_VM_Terminate
  518. Control_Dispatch W32_DEVICEIOCONTROL, Shadow_DeviceIOControl
  519. Control_Dispatch Create_VM, Shadow_Create_VM
  520. Control_Dispatch VM_Resume, Shadow_Resume_VM
  521. Control_Dispatch Set_Device_Focus, Shadow_Set_Device_Focus
  522. Control_Dispatch terminate_thread, Shadow_Terminate_Thread
  523. IFDEF DEBUG
  524. Control_Dispatch Debug_Query, SHDDumpDebug
  525. ENDIF
  526. clc
  527. ret
  528. EndProc Shadow_Control
  529. ;******************************************************************************
  530. ;
  531. ; @doc INTERNAL SHADOW
  532. ;
  533. ; @asm Shadow_DeviceIOControl | This is the single entry point for WIN32
  534. ; Device IOCTL calls.
  535. ;
  536. ; @reg EAX | W32_DEVICEIOCONTROL
  537. ;
  538. ; @reg EBX | DDB
  539. ;
  540. ; @reg ECX | dwIoControlCode
  541. ;
  542. ; @reg ESI | Pointer to DIOCParams structure.
  543. ;
  544. ; @rdesc Return code in EAX as follows
  545. ;
  546. ; @flag 0 | Success
  547. ;
  548. ; @flag -1 | Asynchronous I/O in progress
  549. ;
  550. ; @falg Other | Error code.
  551. ;
  552. ; @uses ALL
  553. ;
  554. ;******************************************************************************
  555. BeginProc Shadow_DeviceIOControl
  556. push ebx
  557. push esi
  558. push edi
  559. cmp ecx, DIOC_GETVERSION ; Q: Version IOCTL? (must be supported)
  560. jne DIOC_10 ; N: Continue
  561. ; Y: Information returned from GetVersion TBD
  562. xor eax, eax ; Return w/ EAX = 0 (success)
  563. jmp DIOC_Done
  564. DIOC_10:
  565. ; cmp ecx, DIOC_CLOSEHANDLE ; Q: Close IOCTL? (must be supported)
  566. ; jne DIOC_20 ; N: Continue
  567. ; xor eax, eax ; Y: Return w/ EAX = 0 (success)
  568. ; jmp DIOC_Done
  569. DIOC_20:
  570. shr ecx, 2 ; as per winioctl.h
  571. and ecx, 7ffh ; as per winioctl.h
  572. sub ecx, Shadow_IOCTL_BASE
  573. cmp ecx, Shadow_IOCTL_MAX ; Q: index in range?
  574. jae SHORT DIOC_Error ; N: Return error
  575. mov edi, [esi.lpvInBuffer] ; Y: Call appropriate API
  576. call Shadow_IOCTL_Table[ecx*4]
  577. cmp eax, 0
  578. jl DIOC_Error
  579. xor eax, eax ; Return w/ EAX = 0 (success)
  580. ; fall-through
  581. DIOC_Done:
  582. clc
  583. pop edi
  584. pop esi
  585. pop ebx
  586. ret
  587. DIOC_Error:
  588. mov eax, Shadow_IOCTL_GENERROR
  589. jmp DIOC_Done
  590. EndProc Shadow_DeviceIOControl
  591. ;******************************************************************************
  592. ;
  593. ; @doc INTERNAL SHADOW
  594. ;
  595. ; @asm Shadow_Create_VM | This function is called when a virtual
  596. ; machine is created
  597. ;
  598. ; @reg EBX | System VM Handle
  599. ;
  600. ; @reg EBP | pointer to client regs structure
  601. ;
  602. ; @rdesc Register values at return:
  603. ;
  604. ; @reg FLAGS | Flags defined at return:
  605. ;
  606. ; @flag NC | Succeeded in initializing VxD
  607. ;
  608. ; @flag CY | Failed to initializing VxD
  609. ;
  610. ; @uses FLAGS
  611. ;
  612. ; @xref Shadow_Control
  613. ;
  614. ;******************************************************************************
  615. BeginProc Shadow_Create_VM, PUBLIC
  616. call _ActOnCreateVM
  617. clc
  618. ret
  619. EndProc Shadow_Create_VM
  620. ;******************************************************************************
  621. ;
  622. ; @doc INTERNAL SHADOW
  623. ;
  624. ; @asm Shadow_Resume_VM | This function is called when a virtual
  625. ; machine is created
  626. ;
  627. ; @reg EBX | System VM Handle
  628. ;
  629. ; @reg EBP | pointer to client regs structure
  630. ;
  631. ; @rdesc Register values at return:
  632. ;
  633. ; @reg FLAGS | Flags defined at return:
  634. ;
  635. ; @flag NC | Succeeded in initializing VxD
  636. ;
  637. ; @flag CY | Failed to initializing VxD
  638. ;
  639. ; @uses FLAGS
  640. ;
  641. ; @xref Shadow_Control
  642. ;
  643. ;******************************************************************************
  644. BeginProc Shadow_Resume_VM, PUBLIC
  645. call _ActOnResumeVM
  646. clc
  647. ret
  648. EndProc Shadow_Resume_VM
  649. ;******************************************************************************
  650. ;
  651. ; @doc INTERNAL SHADOW
  652. ;
  653. ; @asm Shadow_Set_Device_Focus | This function is called when our VXD
  654. ; gets Set_Device_Focus message
  655. ;
  656. ; @reg EBX | System VM Handle
  657. ;
  658. ; @reg EBP | pointer to client regs structure
  659. ;
  660. ; @rdesc Register values at return:
  661. ;
  662. ; @reg FLAGS | Flags defined at return:
  663. ;
  664. ; @flag NC | Succeeded in initializing VxD
  665. ;
  666. ; @flag CY | Failed to initializing VxD
  667. ;
  668. ; @uses FLAGS
  669. ;
  670. ; @xref Shadow_Control
  671. ;
  672. ;******************************************************************************
  673. BeginProc Shadow_Set_Device_Focus, PUBLIC
  674. call _ActOnSetDeviceFocus
  675. clc
  676. ret
  677. EndProc Shadow_Set_Device_Focus
  678. ;******************************************************************************
  679. ;
  680. ; @doc INTERNAL SHADOW
  681. ;
  682. ; @asm Shadow_Terminate_Thread | This function is called when our VXD
  683. ; gets Terminate_Thread message
  684. ;
  685. ; @reg EBX | System VM Handle
  686. ;
  687. ; @reg EBP | pointer to client regs structure
  688. ;
  689. ; @rdesc Register values at return:
  690. ;
  691. ; @reg FLAGS | Flags defined at return:
  692. ;
  693. ; @flag NC | Succeeded in initializing VxD
  694. ;
  695. ; @flag CY | Failed to initializing VxD
  696. ;
  697. ; @uses FLAGS
  698. ;
  699. ; @xref Shadow_Control
  700. ;
  701. ;******************************************************************************
  702. BeginProc Shadow_Terminate_Thread, PUBLIC
  703. push edi
  704. call _ActOnTerminateThread
  705. pop edi
  706. clc
  707. ret
  708. EndProc Shadow_Terminate_Thread
  709. ;******************************************************************************
  710. ;
  711. ; @doc INTERNAL SHADOW
  712. ;
  713. ; @asm Shadow_PM_API_Handler | This is the single entry point for VMs
  714. ; executing in protect-mode.
  715. ;
  716. ; @reg EBX | Current VM Handle
  717. ;
  718. ; @reg EBP | Pointer to Client Register Structure.
  719. ;
  720. ; @reg CLIENT_AX | Shadow PM API Index.
  721. ;
  722. ; @reg CLIENT_ES:CLIENT_(E)BX | API specific parameters or NULL
  723. ;
  724. ; @rdesc Refer to specific APIs for client register values at return.
  725. ; A return value of 0 indicates that the API succeeded, otherwise
  726. ; an error value is returned. The version call is an exception
  727. ;
  728. ; @uses FLAGS
  729. ;
  730. ;******************************************************************************
  731. BeginProc Shadow_PM_API_Handler
  732. movzx eax, [ebp.Client_AX] ; Get API index
  733. cmp eax, Shadow_PM_API_MAX ; Q: index in range?
  734. jae SHORT Shadow_Handler_Error ; N: Fail call.
  735. mov [ebp.Client_AX], 1
  736. mov cx,[ebp.Client_ES] ; Q: Null Parameters?
  737. or cx,[ebp.Client_ES] ; Y: Don't call map_flat
  738. jz SHORT Shadow_Handler_Null_Parms
  739. Client_Ptr_Flat edi, es, bx ; N: EDI -> parameter struc.
  740. Shadow_Handler_Null_Parms:
  741. call Shadow_PM_API_Table[eax*4] ; Call appropriate API
  742. mov [ebp.Client_AX], ax
  743. ret
  744. Shadow_Handler_Error:
  745. mov [ebp.Client_AX], API_FAILURE
  746. ret
  747. EndProc Shadow_PM_API_Handler
  748. ;******************************************************************************
  749. ;
  750. ; @doc INTERNAL SHADOW API
  751. ;
  752. ; @asm Shadow_PM_API_Get_Version | This function returns the version
  753. ; number of the device,
  754. ;
  755. ; @reg EBX | Current VM Handle
  756. ;
  757. ; @reg EBP | Pointer to Client Register Structure.
  758. ;
  759. ; @reg CLIENT_AX | VTD API Index.
  760. ;
  761. ; @rdesc AX contains version number
  762. ;
  763. ; @uses FLAGS
  764. ;
  765. ; @xref Shadow_PM_API_Handler
  766. ;
  767. ;******************************************************************************
  768. BeginProc Shadow_PM_API_Get_Version
  769. mov eax, SHADOW_VERSION
  770. ret
  771. EndProc Shadow_PM_API_Get_Version
  772. ;******************************************************************************
  773. ;
  774. ; @doc INTERNAL SHADOW API
  775. ;
  776. ; @asm SHADOW_PM_API_Register_Agent | This function allows the
  777. ; reintegartion agent to register itself
  778. ;
  779. ; @reg EBX | Current VM Handle
  780. ;
  781. ; @reg EBP | Pointer to Client Register Structure.
  782. ;
  783. ; @reg EDI | Contains the window handle
  784. ;
  785. ; @rdesc eax contains zero if API failed, else non-zero.
  786. ;
  787. ; @uses FLAGS
  788. ;
  789. ; @xref SHADOW_PM_API_Handler
  790. ;
  791. ;******************************************************************************
  792. BeginProc Shadow_PM_API_Register_Agent
  793. push edi
  794. call _IoctlRegisterAgent
  795. pop edi
  796. ret
  797. EndProc Shadow_PM_API_Register_Agent
  798. ;******************************************************************************
  799. ;
  800. ; @doc INTERNAL SHADOW API
  801. ;
  802. ; @asm SHADOW_PM_API_UnRegister_Agent | This function allows the
  803. ; reintegartion agent to unregister itself
  804. ;
  805. ; @reg EBX | Current VM Handle
  806. ;
  807. ; @reg EBP | Dont' Care
  808. ;
  809. ; @reg EDI | Contains the window handle
  810. ;
  811. ; @rdesc eax contains zero if API failed, else non-zero.
  812. ;
  813. ; @uses FLAGS
  814. ;
  815. ; @xref SHADOW_PM_API_Handler
  816. ;
  817. ;******************************************************************************
  818. BeginProc Shadow_PM_API_UnRegister_Agent
  819. push edi
  820. call _IoctlUnRegisterAgent
  821. pop edi
  822. ret
  823. EndProc Shadow_PM_API_UnRegister_Agent
  824. ;******************************************************************************
  825. ;
  826. ; @doc INTERNAL SHADOW API
  827. ;
  828. ; @asm SHADOW_PM_API_Get_Copyback_Params | This function is called
  829. ; by the Reintegration Agent. It returns the
  830. ; name of the shadow file that has been modified and
  831. ; the remote file that needs to be updated
  832. ;
  833. ; @reg EBX | Current VM Handle
  834. ;
  835. ; @reg EBP | Pointer to Client Register Structure.
  836. ;
  837. ; @reg EDI | A pointer to a PATHS structure :
  838. ; typedef struct tagPATHS
  839. ; {
  840. ; unsigned uCookie; // Indicates the reintegartion ID
  841. ; LPVOID lpSrc; // Name of local file
  842. ; int cbSrc; // Buffer size
  843. ; LPVOD lpDst; // Name of remote file
  844. ; int cbDst; // Buffer size
  845. ; }
  846. ; PATHS;
  847. ;
  848. ; @rdesc eax contains zero if API failed, else non-zero.
  849. ;
  850. ; @uses FLAGS
  851. ;
  852. ; @xref SHADOW_PM_API_Handler
  853. ;
  854. ;******************************************************************************
  855. BeginProc Shadow_PM_API_GetUNCPath
  856. push edi
  857. call _IoctlGetUNCPath
  858. pop edi
  859. ret
  860. EndProc Shadow_PM_API_GetUNCPath
  861. ;******************************************************************************
  862. ;
  863. ; @doc INTERNAL SHADOW API
  864. ;
  865. ; @asm SHADOW_PM_API_Begin_PQ_Enum | This function is called
  866. ; by the Reintegration Agent. It returns the
  867. ; name of the shadow file that has been modified and
  868. ; the remote file that needs to be updated
  869. ;
  870. ; @reg EBX | Current VM Handle
  871. ;
  872. ; @reg EBP | Pointer to Client Register Structure.
  873. ;
  874. ; @reg EDI | A pointer to a unsigned long
  875. ;
  876. ; @rdesc eax contains zero if API failed, else non-zero.
  877. ;
  878. ; @uses FLAGS
  879. ;
  880. ; @xref SHADOW_PM_API_Handler
  881. ;
  882. ;******************************************************************************
  883. BeginProc Shadow_PM_API_BeginPQEnum
  884. push edi
  885. call _IoctlBeginPQEnum
  886. pop edi
  887. ret
  888. EndProc Shadow_PM_API_BeginPQEnum
  889. ;******************************************************************************
  890. ;
  891. ; @doc INTERNAL SHADOW API
  892. ;
  893. ; @asm SHADOW_PM_API_End_PQ_Enum | This function is called
  894. ; by the Reintegration Agent. It returns the
  895. ; name of the shadow file that has been modified and
  896. ; the remote file that needs to be updated
  897. ;
  898. ; @reg EBX | Current VM Handle
  899. ;
  900. ; @reg EBP | Pointer to Client Register Structure.
  901. ;
  902. ; @reg EDI | A pointer to a unsigned long
  903. ;
  904. ; @rdesc eax contains zero if API failed, else non-zero.
  905. ;
  906. ; @uses FLAGS
  907. ;
  908. ; @xref SHADOW_PM_API_Handler
  909. ;
  910. ;******************************************************************************
  911. BeginProc Shadow_PM_API_EndPQEnum
  912. push edi
  913. call _IoctlEndPQEnum
  914. pop edi
  915. ret
  916. EndProc Shadow_PM_API_EndPQEnum
  917. ;******************************************************************************
  918. ;
  919. ; @doc INTERNAL SHADOW API
  920. ;
  921. ; @asm SHADOW_PM_API_Next_Pri_Shadow | This function is called
  922. ; by the Reintegration Agent. It returns the
  923. ; name of the shadow file that has been modified and
  924. ; the remote file that needs to be updated
  925. ;
  926. ; @reg EBX | Current VM Handle
  927. ;
  928. ; @reg EBP | Pointer to Client Register Structure.
  929. ;
  930. ; @reg EDI | A pointer to a unsigned long
  931. ;
  932. ; @rdesc eax contains zero if API failed, else non-zero.
  933. ;
  934. ; @uses FLAGS
  935. ;
  936. ; @xref SHADOW_PM_API_Handler
  937. ;
  938. ;******************************************************************************
  939. BeginProc Shadow_PM_API_NextPriShadow
  940. push edi
  941. call _IoctlNextPriShadow
  942. pop edi
  943. ret
  944. EndProc Shadow_PM_API_NextPriShadow
  945. ;******************************************************************************
  946. ;
  947. ; @doc INTERNAL SHADOW API
  948. ;
  949. ; @asm SHADOW_PM_API_Prev_Pri_Shadow | This function is called
  950. ; by the Reintegration Agent. It returns the
  951. ; name of the shadow file that has been modified and
  952. ; the remote file that needs to be updated
  953. ;
  954. ; @reg EBX | Current VM Handle
  955. ;
  956. ; @reg EBP | Pointer to Client Register Structure.
  957. ;
  958. ; @reg EDI | A pointer to a unsigned long
  959. ;
  960. ; @rdesc eax contains zero if API failed, else non-zero.
  961. ;
  962. ; @uses FLAGS
  963. ;
  964. ; @xref SHADOW_PM_API_Handler
  965. ;
  966. ;******************************************************************************
  967. BeginProc Shadow_PM_API_PrevPriShadow
  968. push edi
  969. call _IoctlPrevPriShadow
  970. pop edi
  971. ret
  972. EndProc Shadow_PM_API_PrevPriShadow
  973. ;******************************************************************************
  974. ;
  975. ; @doc INTERNAL SHADOW API
  976. ;
  977. ; @asm SHADOW_PM_API_Get_Shadow_Info | This function is called
  978. ; by the Reintegration Agent. It returns the
  979. ; name of the shadow file that has been modified and
  980. ; the remote file that needs to be updated
  981. ;
  982. ; @reg EBX | Current VM Handle
  983. ;
  984. ; @reg EBP | Pointer to Client Register Structure.
  985. ;
  986. ; @reg EDI | A pointer to SHADOWINFO structure
  987. ; {
  988. ; HSHADOW hShadow;
  989. ; HSHADOW hDir;
  990. ; HSERVER hServer;
  991. ; LPFIND32 lpFind32;
  992. ; unsigned short usStatus;
  993. ; }
  994. ;
  995. ; @rdesc eax contains zero if API failed, else non-zero.
  996. ;
  997. ; @uses FLAGS
  998. ;
  999. ; @xref SHADOW_PM_API_Handler
  1000. ;
  1001. ;******************************************************************************
  1002. BeginProc Shadow_PM_API_GetShadowInfo
  1003. push edi
  1004. call _IoctlGetShadowInfo
  1005. pop edi
  1006. ret
  1007. EndProc Shadow_PM_API_GetShadowInfo
  1008. ;******************************************************************************
  1009. ;
  1010. ; @doc INTERNAL SHADOW API
  1011. ;
  1012. ; @asm SHADOW_PM_API_Set_Shadow_Info | This function is called
  1013. ; by the Reintegration Agent. It returns the
  1014. ; name of the shadow file that has been modified and
  1015. ; the remote file that needs to be updated
  1016. ;
  1017. ; @reg EBX | Current VM Handle
  1018. ;
  1019. ; @reg EBP | Pointer to Client Register Structure.
  1020. ;
  1021. ; @reg EDI | A pointer to SHADOWINFO structure
  1022. ; {
  1023. ; HSHADOW hShadow;
  1024. ; HSHADOW hDir;
  1025. ; HSERVER hServer;
  1026. ; LPFIND32 lpFind32;
  1027. ; unsigned short usStatus;
  1028. ; }
  1029. ;
  1030. ; @rdesc eax contains zero if API failed, else non-zero.
  1031. ;
  1032. ; @uses FLAGS
  1033. ;
  1034. ; @xref SHADOW_PM_API_Handler
  1035. ;
  1036. ;******************************************************************************
  1037. BeginProc Shadow_PM_API_SetShadowInfo
  1038. push edi
  1039. call _IoctlSetShadowInfo
  1040. pop edi
  1041. ret
  1042. EndProc Shadow_PM_API_SetShadowInfo
  1043. ;******************************************************************************
  1044. ;
  1045. ; @doc INTERNAL SHADOW API
  1046. ;
  1047. ; @asm SHADOW_PM_API_ChkUpdtStatus | This function is called
  1048. ; by the Reintegration Agent.
  1049. ;
  1050. ; @reg EBX | Current VM Handle
  1051. ;
  1052. ; @reg EBP | Pointer to Client Register Structure.
  1053. ;
  1054. ; @rdesc eax contains zero if API failed, else non-zero.
  1055. ;
  1056. ; @uses FLAGS
  1057. ;
  1058. ; @xref SHADOW_PM_API_Handler
  1059. ;
  1060. ;******************************************************************************
  1061. BeginProc Shadow_PM_API_ChkUpdtStatus
  1062. push edi
  1063. call _IoctlChkUpdtStatus
  1064. pop edi
  1065. ret
  1066. EndProc Shadow_PM_API_ChkUpdtStatus
  1067. ;******************************************************************************
  1068. ;
  1069. ; @doc INTERNAL SHADOW API
  1070. ;
  1071. ; @asm SHADOW_PM_API_DoShadowMaintenance | This function is called
  1072. ; by the Reintegration Agent.
  1073. ;
  1074. ; @reg EBX | Current VM Handle
  1075. ;
  1076. ; @reg EBP | Pointer to Client Register Structure.
  1077. ;
  1078. ; @rdesc eax contains zero if API failed, else non-zero.
  1079. ;
  1080. ; @uses FLAGS
  1081. ;
  1082. ; @xref SHADOW_PM_API_Handler
  1083. ;
  1084. ;******************************************************************************
  1085. BeginProc Shadow_PM_API_DoShadowMaintenance
  1086. push edi
  1087. call _IoctlDoShadowMaintenance
  1088. pop edi
  1089. ret
  1090. EndProc Shadow_PM_API_DoShadowMaintenance
  1091. ;******************************************************************************
  1092. ;
  1093. ; @doc INTERNAL SHADOW API
  1094. ;
  1095. ; @asm SHADOW_PM_API_CopyChunk | This function is called
  1096. ; by the Reintegration Agent.
  1097. ;
  1098. ; @reg EBX | Current VM Handle
  1099. ;
  1100. ; @reg EBP | Pointer to Client Register Structure.
  1101. ;
  1102. ; @rdesc eax contains zero if API failed, else non-zero.
  1103. ;
  1104. ; @uses FLAGS
  1105. ;
  1106. ; @xref SHADOW_PM_API_Handler
  1107. ;
  1108. ;******************************************************************************
  1109. BeginProc Shadow_PM_API_CopyChunk
  1110. push ebx
  1111. mov ebx,[esi.lpvOutBuffer]
  1112. push ebx
  1113. push edi
  1114. call _IoctlCopyChunk
  1115. pop edi
  1116. pop ebx
  1117. pop ebx
  1118. ret
  1119. EndProc Shadow_PM_API_CopyChunk
  1120. ;******************************************************************************
  1121. ;
  1122. ; @doc INTERNAL SHADOW API
  1123. ;
  1124. ; @asm SHADOW_PM_API_BeginReint | This function is called
  1125. ; by the Reintegration Agent to start reintegration on a
  1126. ; server whose handle is in the SHADOWINFO structure
  1127. ;
  1128. ; @reg EBX | Current VM Handle
  1129. ;
  1130. ; @reg EBP | Pointer to Client Register Structure.
  1131. ;
  1132. ; @reg EDI | A pointer to SHADOWINFO structure
  1133. ; {
  1134. ; HSHADOW hShadow;
  1135. ; HSHADOW hDir;
  1136. ; HSERVER hServer;
  1137. ; LPFIND32 lpFind32;
  1138. ; unsigned short usStatus;
  1139. ; }
  1140. ;
  1141. ; @rdesc eax contains zero if API failed, else non-zero.
  1142. ;
  1143. ; @uses FLAGS
  1144. ;
  1145. ; @xref SHADOW_PM_API_Handler
  1146. ;
  1147. ;******************************************************************************
  1148. BeginProc Shadow_PM_API_BeginReint
  1149. push edi
  1150. call _IoctlBeginReint
  1151. pop edi
  1152. ret
  1153. EndProc Shadow_PM_API_BeginReint
  1154. ;******************************************************************************
  1155. ;
  1156. ; @doc INTERNAL SHADOW API
  1157. ;
  1158. ; @asm SHADOW_PM_API_EndReint | This function is called
  1159. ; by the Reintegration Agent to end reintegration on a
  1160. ; server whose handle is in the SHADOWINFO structure.
  1161. ; uStatus contains the server status to be set.
  1162. ; uOp contains the operation to be applied on the status(AND,OR etc.)
  1163. ;
  1164. ; @reg EBX | Current VM Handle
  1165. ;
  1166. ; @reg EBP | Pointer to Client Register Structure.
  1167. ;
  1168. ; @reg EDI | A pointer to SHADOWINFO structure
  1169. ; {
  1170. ; HSHADOW hShadow;
  1171. ; HSHADOW hDir;
  1172. ; HSERVER hServer;
  1173. ; LPFIND32 lpFind32;
  1174. ; unsigned uStatus;
  1175. ; unsigned uOp;
  1176. ; }
  1177. ;
  1178. ; @rdesc eax contains zero if API failed, else non-zero.
  1179. ;
  1180. ; @uses FLAGS
  1181. ;
  1182. ; @xref SHADOW_PM_API_Handler
  1183. ;
  1184. ;******************************************************************************
  1185. BeginProc Shadow_PM_API_EndReint
  1186. push edi
  1187. call _IoctlEndReint
  1188. pop edi
  1189. ret
  1190. EndProc Shadow_PM_API_EndReint
  1191. ;******************************************************************************
  1192. ;
  1193. ; @doc INTERNAL SHADOW API
  1194. ;
  1195. ; @asm SHADOW_PM_API_CreateShadow | This function is called
  1196. ; by the Reintegration Agent to create a shadow
  1197. ;
  1198. ; @reg EBX | Current VM Handle
  1199. ;
  1200. ; @reg EBP | Pointer to Client Register Structure.
  1201. ;
  1202. ; @reg EDI | A pointer to SHADOWINFO structure
  1203. ; {
  1204. ; HSHADOW hShadow;
  1205. ; HSHADOW hDir;
  1206. ; HSERVER hServer;
  1207. ; LPFIND32 lpFind32;
  1208. ; unsigned uStatus;
  1209. ; unsigned uOp;
  1210. ; }
  1211. ;
  1212. ; @rdesc eax contains zero if API failed, else non-zero.
  1213. ;
  1214. ; @uses FLAGS
  1215. ;
  1216. ; @xref SHADOW_PM_API_Handler
  1217. ;
  1218. ;******************************************************************************
  1219. BeginProc Shadow_PM_API_CreateShadow
  1220. push edi
  1221. call _IoctlCreateShadow
  1222. pop edi
  1223. ret
  1224. EndProc Shadow_PM_API_CreateShadow
  1225. ;******************************************************************************
  1226. ;
  1227. ; @doc INTERNAL SHADOW API
  1228. ;
  1229. ; @asm SHADOW_PM_API_DeleteShadow | This function is called
  1230. ; by the Reintegration Agent to delete a shadow
  1231. ;
  1232. ; @reg EBX | Current VM Handle
  1233. ;
  1234. ; @reg EBP | Pointer to Client Register Structure.
  1235. ;
  1236. ; @reg EDI | A pointer to SHADOWINFO structure
  1237. ; {
  1238. ; HSHADOW hShadow;
  1239. ; HSHADOW hDir;
  1240. ; HSERVER hServer;
  1241. ; LPFIND32 lpFind32;
  1242. ; unsigned uStatus;
  1243. ; unsigned uOp;
  1244. ; }
  1245. ;
  1246. ; @rdesc eax contains zero if API failed, else non-zero.
  1247. ;
  1248. ; @uses FLAGS
  1249. ;
  1250. ; @xref SHADOW_PM_API_Handler
  1251. ;
  1252. ;******************************************************************************
  1253. BeginProc Shadow_PM_API_DeleteShadow
  1254. push edi
  1255. call _IoctlDeleteShadow
  1256. pop edi
  1257. ret
  1258. EndProc Shadow_PM_API_DeleteShadow
  1259. ;******************************************************************************
  1260. ;
  1261. ; @doc INTERNAL SHADOW API
  1262. ;
  1263. ; @asm SHADOW_PM_API_GetServerStatus | This function is called
  1264. ; by the Reintegration Agent to create a shadow
  1265. ;
  1266. ; @reg EBX | Current VM Handle
  1267. ;
  1268. ; @reg EBP | Pointer to Client Register Structure.
  1269. ;
  1270. ; @reg EDI | A pointer to SHADOWINFO structure
  1271. ; {
  1272. ; HSHADOW hShadow;
  1273. ; HSHADOW hDir;
  1274. ; HSERVER hServer;
  1275. ; LPFIND32 lpFind32;
  1276. ; unsigned uStatus;
  1277. ; unsigned uOp;
  1278. ; }
  1279. ;
  1280. ; @rdesc eax contains zero if API failed, else non-zero.
  1281. ;
  1282. ; @uses FLAGS
  1283. ;
  1284. ; @xref SHADOW_PM_API_Handler
  1285. ;
  1286. ;******************************************************************************
  1287. BeginProc Shadow_PM_API_GetServerStatus
  1288. push edi
  1289. call _IoctlGetServerStatus
  1290. pop edi
  1291. ret
  1292. EndProc Shadow_PM_API_GetServerStatus
  1293. ;******************************************************************************
  1294. ;
  1295. ; @doc INTERNAL SHADOW API
  1296. ;
  1297. ; @asm SHADOW_PM_API_SetServerStatus | This function is called
  1298. ; by the Reintegration Agent to create a shadow
  1299. ;
  1300. ; @reg EBX | Current VM Handle
  1301. ;
  1302. ; @reg EBP | Pointer to Client Register Structure.
  1303. ;
  1304. ; @reg EDI | A pointer to SHADOWINFO structure
  1305. ; {
  1306. ; HSHADOW hShadow;
  1307. ; HSHADOW hDir;
  1308. ; HSERVER hServer;
  1309. ; LPFIND32 lpFind32;
  1310. ; unsigned uStatus;
  1311. ; unsigned uOp;
  1312. ; }
  1313. ;
  1314. ; @rdesc eax contains zero if API failed, else non-zero.
  1315. ;
  1316. ; @uses FLAGS
  1317. ;
  1318. ; @xref SHADOW_PM_API_Handler
  1319. ;
  1320. ;******************************************************************************
  1321. BeginProc Shadow_PM_API_SetServerStatus
  1322. push edi
  1323. call _IoctlSetServerStatus
  1324. pop edi
  1325. ret
  1326. EndProc Shadow_PM_API_SetServerStatus
  1327. ;******************************************************************************
  1328. ;
  1329. ; @doc INTERNAL SHADOW API
  1330. ;
  1331. ; @asm SHADOW_PM_API_AddUse | This function is by Shadow NP
  1332. ; on detecting disconnection
  1333. ;
  1334. ; @reg EBX | Current VM Handle
  1335. ;
  1336. ; @reg EBP | Pointer to Client Register Structure.
  1337. ;
  1338. ; @reg EDI | A pointer to COPYPARAMS structure
  1339. ; typedef struct tagCOPYPARAMS
  1340. ; {
  1341. ; HSERVER hServer;
  1342. ; HSHADOW hDir;
  1343. ; HSHADOW hShadow;
  1344. ; LPSTR lpLocalPath;
  1345. ; LPSTR lpRemotePath;
  1346. ; LPSTR lpServerPath;
  1347. ; }
  1348. ; COPYPARAMS;
  1349. ;
  1350. ; @rdesc eax contains zero if API failed, else non-zero.
  1351. ;
  1352. ; @uses FLAGS
  1353. ;
  1354. ; @xref SHADOW_PM_API_Handler
  1355. ;
  1356. ;******************************************************************************
  1357. BeginProc Shadow_PM_API_AddUse
  1358. push edi
  1359. call _IoctlAddUse
  1360. pop edi
  1361. ret
  1362. EndProc Shadow_PM_API_AddUse
  1363. ;******************************************************************************
  1364. ;
  1365. ; @doc INTERNAL SHADOW API
  1366. ;
  1367. ; @asm SHADOW_PM_API_DelUse | This function is by Shadow NP
  1368. ; on detecting disconnection
  1369. ;
  1370. ; @reg EBX | Current VM Handle
  1371. ;
  1372. ; @reg EBP | Pointer to Client Register Structure.
  1373. ;
  1374. ; @reg EDI | A pointer to COPYPARAMS structure
  1375. ; typedef struct tagCOPYPARAMS
  1376. ; {
  1377. ; HSERVER hServer;
  1378. ; HSHADOW hDir;
  1379. ; HSHADOW hShadow;
  1380. ; LPSTR lpLocalPath;
  1381. ; LPSTR lpRemotePath;
  1382. ; LPSTR lpServerPath;
  1383. ; }
  1384. ; COPYPARAMS;
  1385. ;
  1386. ; @rdesc eax contains zero if API failed, else non-zero.
  1387. ;
  1388. ; @uses FLAGS
  1389. ;
  1390. ; @xref SHADOW_PM_API_Handler
  1391. ;
  1392. ;******************************************************************************
  1393. BeginProc Shadow_PM_API_DelUse
  1394. push edi
  1395. call _IoctlDelUse
  1396. pop edi
  1397. ret
  1398. EndProc Shadow_PM_API_DelUse
  1399. ;******************************************************************************
  1400. ;
  1401. ; @doc INTERNAL SHADOW API
  1402. ;
  1403. ; @asm SHADOW_PM_API_GetUse | This function is by Shadow NP
  1404. ; on detecting disconnection
  1405. ;
  1406. ; @reg EBX | Current VM Handle
  1407. ;
  1408. ; @reg EBP | Pointer to Client Register Structure.
  1409. ;
  1410. ; @reg EDI | A pointer to COPYPARAMS structure
  1411. ; typedef struct tagCOPYPARAMS
  1412. ; {
  1413. ; HSERVER hServer;
  1414. ; HSHADOW hDir;
  1415. ; HSHADOW hShadow;
  1416. ; LPSTR lpLocalPath;
  1417. ; LPSTR lpRemotePath;
  1418. ; LPSTR lpServerPath;
  1419. ; }
  1420. ; COPYPARAMS;
  1421. ;
  1422. ; @rdesc eax contains zero if API failed, else non-zero.
  1423. ;
  1424. ; @uses FLAGS
  1425. ;
  1426. ; @xref SHADOW_PM_API_Handler
  1427. ;
  1428. ;******************************************************************************
  1429. BeginProc Shadow_PM_API_GetUse
  1430. push edi
  1431. call _IoctlGetUse
  1432. pop edi
  1433. ret
  1434. EndProc Shadow_PM_API_GetUse
  1435. ;******************************************************************************
  1436. ;
  1437. ; @doc INTERNAL SHADOW API
  1438. ;
  1439. ; @asm SHADOW_PM_API_Switches | This function is called
  1440. ; by the Reintegration Agent to switch on/off shadowing, loggin etc.
  1441. ;
  1442. ; @reg EBX | Current VM Handle
  1443. ;
  1444. ; @reg EBP | Pointer to Client Register Structure.
  1445. ;
  1446. ; @reg EDI | A pointer to SHADOWINFO structure
  1447. ; {
  1448. ; HSHADOW hShadow;
  1449. ; HSHADOW hDir;
  1450. ; HSERVER hServer;
  1451. ; LPFIND32 lpFind32;
  1452. ; unsigned uStatus;
  1453. ; unsigned uOp;
  1454. ; }
  1455. ;
  1456. ; @rdesc eax contains zero if API failed, else non-zero.
  1457. ;
  1458. ; @uses FLAGS
  1459. ;
  1460. ; @xref SHADOW_PM_API_Handler
  1461. ;
  1462. ;******************************************************************************
  1463. BeginProc Shadow_PM_API_Switches
  1464. push edi
  1465. call _IoctlSwitches
  1466. pop edi
  1467. ret
  1468. EndProc Shadow_PM_API_Switches
  1469. ;******************************************************************************
  1470. ;
  1471. ; @doc INTERNAL SHADOW API
  1472. ;
  1473. ; @asm SHADOW_PM_API_Get_Shadow_Info |
  1474. ; IN: hDir, name of the shadow (OEM string) in lpFind2->cFileName
  1475. ; OUT: hShadow, uStatus, lpFind32 contains the find info
  1476. ;
  1477. ; @reg EBX | Current VM Handle
  1478. ;
  1479. ; @reg EBP | Pointer to Client Register Structure.
  1480. ;
  1481. ; @reg EDI | A pointer to SHADOWINFO structure
  1482. ; {
  1483. ; HSERVER hServer;
  1484. ; HSHADOW hDir;
  1485. ; HSHADOW hShadow;
  1486. ; LPFIND32 lpFind32;
  1487. ; unsigned uStatus;
  1488. ; unsigned uOp;
  1489. ; }
  1490. ;
  1491. ; @rdesc eax contains zero if API failed, else non-zero.
  1492. ;
  1493. ; @uses FLAGS
  1494. ;
  1495. ; @xref SHADOW_PM_API_Handler
  1496. ;
  1497. ;******************************************************************************
  1498. BeginProc Shadow_PM_API_GetShadow
  1499. push edi
  1500. call _IoctlGetShadow
  1501. pop edi
  1502. ret
  1503. EndProc Shadow_PM_API_GetShadow
  1504. ;******************************************************************************
  1505. ;
  1506. ; @doc INTERNAL SHADOW API
  1507. ;
  1508. ; @asm SHADOW_PM_API_Get_Space_Info |
  1509. ;
  1510. ; @reg EBX | Current VM Handle
  1511. ;
  1512. ; @reg EBP | Pointer to Client Register Structure.
  1513. ;
  1514. ; @reg EDI | A pointer to GLOABLSTATUS structure
  1515. ;
  1516. ; @rdesc eax contains zero if API failed, else non-zero.
  1517. ;
  1518. ; @uses FLAGS
  1519. ;
  1520. ; @xref SHADOW_PM_API_Handler
  1521. ;
  1522. ;******************************************************************************
  1523. BeginProc Shadow_PM_API_GetGlobalStatus
  1524. push edi
  1525. call _IoctlGetGlobalStatus
  1526. pop edi
  1527. ret
  1528. EndProc Shadow_PM_API_GetGlobalStatus
  1529. BeginProc Shadow_PM_API_FindOpenHSHADOW
  1530. push edi
  1531. call _IoctlFindOpenHSHADOW
  1532. pop edi
  1533. ret
  1534. EndProc Shadow_PM_API_FindOpenHSHADOW
  1535. BeginProc Shadow_PM_API_FindNextHSHADOW
  1536. push edi
  1537. call _IoctlFindNextHSHADOW
  1538. pop edi
  1539. ret
  1540. EndProc Shadow_PM_API_FindNextHSHADOW
  1541. BeginProc Shadow_PM_API_FindCloseHSHADOW
  1542. push edi
  1543. call _IoctlFindCloseHSHADOW
  1544. pop edi
  1545. ret
  1546. EndProc Shadow_PM_API_FindCloseHSHADOW
  1547. BeginProc Shadow_PM_API_GetPriorityHSHADOW
  1548. push edi
  1549. call _IoctlGetPriorityHSHADOW
  1550. pop edi
  1551. ret
  1552. EndProc Shadow_PM_API_GetPriorityHSHADOW
  1553. BeginProc Shadow_PM_API_SetPriorityHSHADOW
  1554. push edi
  1555. call _IoctlSetPriorityHSHADOW
  1556. pop edi
  1557. ret
  1558. EndProc Shadow_PM_API_SetPriorityHSHADOW
  1559. BeginProc Shadow_PM_API_AddHint
  1560. push edi
  1561. call _IoctlAddHint
  1562. pop edi
  1563. ret
  1564. EndProc Shadow_PM_API_AddHint
  1565. BeginProc Shadow_PM_API_DeleteHint
  1566. push edi
  1567. call _IoctlDeleteHint
  1568. pop edi
  1569. ret
  1570. EndProc Shadow_PM_API_DeleteHint
  1571. BeginProc Shadow_PM_API_FindOpenHint
  1572. push edi
  1573. call _IoctlFindOpenHint
  1574. pop edi
  1575. ret
  1576. EndProc Shadow_PM_API_FindOpenHint
  1577. BeginProc Shadow_PM_API_FindNextHint
  1578. push edi
  1579. call _IoctlFindNextHint
  1580. pop edi
  1581. ret
  1582. EndProc Shadow_PM_API_FindNextHint
  1583. BeginProc Shadow_PM_API_FindCloseHint
  1584. push edi
  1585. call _IoctlFindCloseHint
  1586. pop edi
  1587. ret
  1588. EndProc Shadow_PM_API_FindCloseHint
  1589. BeginProc Shadow_PM_API_GetAliasHSHADOW
  1590. push edi
  1591. call _IoctlGetAliasHSHADOW
  1592. pop edi
  1593. ret
  1594. EndProc Shadow_PM_API_GetAliasHSHADOW
  1595. IFDEF DEBUG
  1596. ;******************************************************************************
  1597. ; D E B U G G I N G C O D E
  1598. ;******************************************************************************
  1599. BeginProc Shadow_Timer_Callback, PUBLIC
  1600. inc _cntTicks
  1601. mov eax, _cntTicks
  1602. cmp eax, SHADOW_STATS_FLUSH_COUNT
  1603. jl STC_Done
  1604. mov eax, 0
  1605. mov ebx, 0
  1606. mov ecx, PEF_WAIT_NOT_NESTED_EXEC
  1607. mov edx, 0
  1608. lea esi, Shadow_Restricted_Event_Callback
  1609. VMMCall Call_Restricted_Event
  1610. mov _cntTicks,0
  1611. STC_Done:
  1612. ret
  1613. EndProc Shadow_Timer_Callback
  1614. BeginProc Shadow_Restricted_Event_Callback, PUBLIC
  1615. call _ShadowRestrictedEventCallback
  1616. mov eax, SHADOW_LOG_TIME_INTERVAL
  1617. mov edx, 0
  1618. mov esi, OFFSET32 Shadow_Timer_Callback
  1619. VMMCall Set_Global_Time_Out
  1620. mov eax,esi
  1621. cmp eax,0
  1622. jne TimerSet1
  1623. Trace_Out "Shadow: Couldn't set the logging timer again"
  1624. TimerSet1:
  1625. ret
  1626. EndProc Shadow_Restricted_Event_Callback
  1627. BeginProc _DebugBreak, PUBLIC
  1628. push [esp+4]
  1629. VMMCall _Debug_Out_Service
  1630. pop eax
  1631. ret
  1632. EndProc _DebugBreak
  1633. BeginProc MinDbg_Debug
  1634. mov _NbDebug, 0
  1635. ret
  1636. EndProc MinDbg_Debug
  1637. BeginProc DefaultDbg_Debug
  1638. ; mov _NbDebug, DEFAULT_DEBUG
  1639. ret
  1640. EndProc DefaultDbg_Debug
  1641. BeginProc MaxDbg_Debug
  1642. mov _NbDebug, 0FFFFFFFFh
  1643. ret
  1644. EndProc MaxDbg_Debug
  1645. BeginProc Alloc_Debug
  1646. mov eax, Alloc_watch
  1647. not eax
  1648. mov Alloc_watch, eax
  1649. ret
  1650. EndProc Alloc_Debug
  1651. BeginProc _ShadowCheckHeap
  1652. pushad
  1653. push @Line
  1654. push OFFSET32 Shadow_str
  1655. push ecx
  1656. VxDCall IFSMgr_CheckHeap
  1657. add esp, 12
  1658. or eax, eax
  1659. jz GCH_10
  1660. trace_out "Heap is fried"
  1661. GCH_10:
  1662. popad
  1663. ret
  1664. EndProc _ShadowCheckHeap
  1665. BeginProc _CheckHeap
  1666. mov ecx, [esp+4]
  1667. call _shadowCheckHeap
  1668. ret
  1669. EndProc _Checkheap
  1670. BeginProc AllocDisplay_Debug
  1671. mov ecx, Alloc_cnt
  1672. or ecx, ecx
  1673. jz AD_Exit
  1674. mov edi, OFFSET32 Alloc_table
  1675. mov esi, OFFSET32 Alloc_sizes
  1676. AD_Loop:
  1677. mov edx, [edi]
  1678. mov ebx, [esi]
  1679. Trace_Out "Memory block: #edx Size: #ebx"
  1680. add esi, 4
  1681. add edi, 4
  1682. loop AD_Loop
  1683. AD_Exit:
  1684. Trace_Out " "
  1685. call _ShadowCheckHeap
  1686. ret
  1687. EndProc AllocDisplay_Debug
  1688. ;** SHDDumpDebug - Dump debug information to the debugger
  1689. ;
  1690. public SHDDumpDebug
  1691. SHDDumpDebug proc near
  1692. xor ebx, ebx
  1693. mov ax, fs
  1694. test ax, ax
  1695. jz dq1
  1696. push esi
  1697. push ds
  1698. lea edi, _DebugQueryCmdStr
  1699. mov ecx, _DebugQueryCmdStrLen
  1700. mov ds, ax
  1701. cld
  1702. rep movsb
  1703. xor eax, eax
  1704. stosb
  1705. pop ds
  1706. pop esi
  1707. lea ebx, _DebugQueryCmdStr
  1708. dq1:
  1709. push ebx
  1710. call _SHDDebug
  1711. add esp, 4
  1712. ret
  1713. SHDDumpDebug endp
  1714. ENDIF
  1715. ;** ShadowHookDeviceService - external API handler
  1716. ;
  1717. ; This routine receives HookDeviceService from the IFSMgr
  1718. ;
  1719. ; Entry (TOS+4) = ioreq & user register ptr
  1720. ; Exit none
  1721. ; Uses C registers
  1722. BeginProc ShadowHookDeviceService, PUBLIC
  1723. ; Trace_Out "HookDeviceService Hook Called"
  1724. pushf
  1725. cmp eax, @@IFSMgr_NetFunction
  1726. jz SHDS_Unhook
  1727. popf
  1728. jmp OrigHookDeviceService
  1729. SHDS_Unhook:
  1730. ; Someone is indeed trying to hook IFSMgr_NetFunction
  1731. ; Let us first unhook ourselves
  1732. popf
  1733. ; Trace_Out "Someone hooking IFSMgr_NetFunction"
  1734. push eax
  1735. push esi
  1736. mov esi, OFFSET32 ShadowNetFunction
  1737. VMMCall Unhook_Device_Service
  1738. pop esi
  1739. pop eax
  1740. jc SHDS_error
  1741. ; We unhooked ourselves
  1742. ; let the caller do it
  1743. call OrigHookDeviceService
  1744. ; Save his result on the stack
  1745. pushf
  1746. ; Let us hook ourselves back in
  1747. push esi
  1748. push eax
  1749. mov esi, OFFSET32 ShadowNetFunction
  1750. mov eax, @@IFSMgr_NetFunction
  1751. call OrigHookDeviceService
  1752. mov _OrigNetFunction, esi
  1753. pop eax
  1754. pop esi
  1755. jc SHDS_unhook_error
  1756. popf
  1757. jmp SHDS_done
  1758. SHDS_unhook_error:
  1759. popf
  1760. jmp SHDS_error
  1761. SHDS_error:
  1762. Trace_Out "HookDeviceService Hook Error, disabling shadowing"
  1763. mov _fShadow, 0
  1764. SHDS_done:
  1765. ret
  1766. EndProc ShadowHookDeviceService
  1767. ;** ShadowRegisterNetFunction - external API handler
  1768. ;
  1769. ; This routine receives RegisterNet from the IFSMgr
  1770. ;
  1771. ; Entry (TOS+4) = ioreq & user register ptr
  1772. ; Exit none
  1773. ; Uses C registers
  1774. BeginProc ShadowRegisterNetFunc, PUBLIC
  1775. ; int 1
  1776. Trace_Out "Hook Called"
  1777. mov eax, [esp+8]
  1778. cmp eax, IFSMGRVERSION
  1779. jne connect_passthrough ; if wrong ifs version, don't hook
  1780. mov eax, [esp+0ch]
  1781. cmp eax, WNNC_NET_LANMAN
  1782. je hooklanman ; hookit if lanman or ourselves
  1783. mov eax, [esp+0ch]
  1784. cmp eax, WNNC_NET_COGENT ; BUGBUG get us a net ID
  1785. je hookus
  1786. Trace_Out "Hook Called by some other FSD"
  1787. jmp connect_passthrough
  1788. hooklanman:
  1789. Trace_Out "Hook Called by LANMAN"
  1790. xor ecx, ecx ;; important step!!!
  1791. VxDCall VRedir_Get_Version
  1792. mov _VRedirCSCInfoFunction, ecx ;; if this is a new vredir, it will give us the function
  1793. jmp hookit
  1794. hookus:
  1795. Trace_Out "Hook Called by us"
  1796. hookit:
  1797. mov eax, [esp+4] ; take the pFunc from FSD
  1798. ; Put it in our table
  1799. push eax
  1800. call _ProcessRegisterNet
  1801. add esp,4
  1802. or eax,eax
  1803. jz connect_passthrough
  1804. mov [esp+4],eax ; replace his function with ours
  1805. connect_passthrough:
  1806. jmp OrigRegisterNetFunc ; pass on to IFSMgr
  1807. EndProc ShadowRegisterNetFunc
  1808. ;** ShadowNetFunction - external API handler
  1809. ;
  1810. ; This routine receives NetFunction from the IFSMgr
  1811. ;
  1812. ; Entry (TOS+4) = ioreq & user register ptr
  1813. ; Exit none
  1814. ; Uses C registers
  1815. BeginProc ShadowNetFunction, PUBLIC, HOOK_PROC, NextNetFunction
  1816. ; Trace_Out "NetFunction Hook Called"
  1817. call _ProcessNetFunction
  1818. ret
  1819. EndProc ShadowNetFunction
  1820. IFDEF HOOKMOUNT
  1821. ;** ShadowMountFunction - external API handler
  1822. ;
  1823. ; This routine receives RegisterMount from the IFSMgr
  1824. ;
  1825. ; Entry (TOS+4) = ioreq & user register ptr
  1826. ; Exit none
  1827. ; Uses C registers
  1828. BeginProc ShadowMountFunction, PUBLIC
  1829. ; int 1
  1830. Trace_Out "Hook Called"
  1831. mov eax, [esp+4] ; take the pFunc from FSD
  1832. ; Put it in our table
  1833. push eax
  1834. call _ProcessRegisterMount
  1835. add esp,4
  1836. or eax,eax
  1837. jz mount_passthrough
  1838. mov [esp+4],eax ; replace his function with ours
  1839. mount_passthrough:
  1840. jmp OrigRegisterMountFunc ; pass on to IFSMgr
  1841. EndProc ShadowMountFunction
  1842. ENDIF
  1843. BeginProc _UniToBCSPath , PUBLIC
  1844. int Dyna_Link_Int
  1845. dd @@UniToBCSPath OR DL_Jmp_Mask
  1846. EndProc _UniToBCSPath
  1847. BeginProc _UniToBCS , PUBLIC
  1848. int Dyna_Link_Int
  1849. dd @@UniToBCS OR DL_Jmp_Mask
  1850. EndProc _UniToBCS
  1851. BeginProc _BCSToUni , PUBLIC
  1852. int Dyna_Link_Int
  1853. dd @@BCSToUni OR DL_Jmp_Mask
  1854. EndProc _BCSToUni
  1855. BeginProc _IFSMgr_MetaMatch, PUBLIC
  1856. int Dyna_Link_Int
  1857. dd @@IFSMgr_MetaMatch OR DL_Jmp_Mask
  1858. EndProc _IFSMgr_MetaMatch
  1859. BeginProc _UniToUpper, PUBLIC
  1860. int Dyna_Link_Int
  1861. dd @@UniToUpper OR DL_Jmp_Mask
  1862. EndProc _UniToUpper
  1863. BeginProc _FGHS, PUBLIC
  1864. int Dyna_Link_Int
  1865. dd @@IFSMgr_GetHeap OR DL_Jmp_Mask
  1866. EndProc _FGHS
  1867. BeginProc _RetHeap, PUBLIC
  1868. int Dyna_Link_Int
  1869. dd @@IFSMgr_RetHeap OR DL_Jmp_Mask
  1870. EndProc _RetHeap
  1871. BeginProc _IFSMgr_Printf, PUBLIC
  1872. int Dyna_Link_Int
  1873. dd @@IFSMgr_printf OR DL_Jmp_Mask
  1874. EndProc _IFSMgr_Printf
  1875. BeginProc _IFSMgr_AssertFailed, PUBLIC
  1876. int Dyna_Link_Int
  1877. dd @@IFSMgr_AssertFailed OR DL_Jmp_Mask
  1878. EndProc _IFSMgr_AssertFailed
  1879. BeginProc _Ring0Api, PUBLIC
  1880. int Dyna_Link_Int
  1881. dd @@IFSMgr_Ring0_FileIO OR DL_Jmp_Mask
  1882. EndProc _Ring0Api
  1883. BeginProc _ParsePath, PUBLIC
  1884. int Dyna_Link_Int
  1885. dd @@IFSMgr_ParsePath OR DL_Jmp_Mask
  1886. EndProc _ParsePath
  1887. BeginProc _IFSMgr_Win32ToDosTime, PUBLIC
  1888. int Dyna_Link_Int
  1889. dd @@IFSMgr_Win32ToDosTime OR DL_Jmp_Mask
  1890. EndProc _IFSMgr_Win32ToDosTime
  1891. BeginProc _IFSMgr_DosToWin32Time, PUBLIC
  1892. int Dyna_Link_Int
  1893. dd @@IFSMgr_DosToWin32Time OR DL_Jmp_Mask
  1894. EndProc _IFSMgr_DosToWin32Time
  1895. BeginProc _IFSMgr_DosToNetTime, PUBLIC
  1896. int Dyna_Link_Int
  1897. dd @@IFSMgr_DosToNetTime OR DL_Jmp_Mask
  1898. EndProc _IFSMgr_DosToNetTime
  1899. BeginProc _IFSMgr_Get_NetTime, PUBLIC
  1900. int Dyna_Link_Int
  1901. dd @@IFSMgr_Get_NetTime OR DL_Jmp_Mask
  1902. EndProc _IFSMgr_Get_NetTime
  1903. BeginProc _IFSMgr_NetToWin32Time, PUBLIC
  1904. int Dyna_Link_Int
  1905. dd @@IFSMgr_NetToWin32Time OR DL_Jmp_Mask
  1906. EndProc _IFSMgr_NetToWin32Time
  1907. BeginProc _GetCurThreadHandle
  1908. VMMCall Get_Cur_Thread_Handle
  1909. mov eax,edi
  1910. ret
  1911. EndProc _GetCurThreadHandle
  1912. BeginProc _Shell_PostMessage
  1913. int Dyna_Link_Int
  1914. dd @@_Shell_PostMessage OR DL_Jmp_Mask
  1915. EndProc _Shell_PostMessage
  1916. BeginProc __BlockOnID
  1917. int Dyna_Link_Int
  1918. dd @@_BlockOnID OR DL_Jmp_Mask
  1919. EndProc __BlockOnID
  1920. BeginProc __SignalID
  1921. int Dyna_Link_Int
  1922. dd @@_SignalID OR DL_Jmp_Mask
  1923. EndProc __SignalID
  1924. BeginProc _IFSMgr_UseAdd
  1925. int Dyna_Link_Int
  1926. dd @@IFSMgr_UseAdd OR DL_Jmp_Mask
  1927. EndProc _IFSMgr_UseAdd
  1928. BeginProc _IFSMgr_UseDel
  1929. int Dyna_Link_Int
  1930. dd @@IFSMgr_UseDel OR DL_Jmp_Mask
  1931. EndProc _IFSMgr_UseDel
  1932. BeginProc _CreateBasis
  1933. int Dyna_Link_Int
  1934. dd @@CreateBasis OR DL_Jmp_Mask
  1935. EndProc _CreateBasis
  1936. BeginProc _MatchBasisName
  1937. int Dyna_Link_Int
  1938. dd @@MatchBasisName OR DL_Jmp_Mask
  1939. EndProc _MatchBasisName
  1940. BeginProc _AppendBasisTail
  1941. int Dyna_Link_Int
  1942. dd @@AppendBasisTail OR DL_Jmp_Mask
  1943. EndProc _AppendBasisTail
  1944. BeginProc _FCBToShort
  1945. int Dyna_Link_Int
  1946. dd @@FcbToShort OR DL_Jmp_Mask
  1947. EndProc _FCBToShort
  1948. BeginProc _ShortToFCB
  1949. int Dyna_Link_Int
  1950. dd @@ShortToFcb OR DL_Jmp_Mask
  1951. EndProc _ShortToFCB
  1952. BeginProc _DebugMenu
  1953. int Dyna_Link_Int
  1954. dd @@IFSMgr_DebugMenu OR DL_Jmp_Mask
  1955. EndProc _DebugMenu
  1956. _GetConfigDir:
  1957. push edx
  1958. VMMCall Get_Config_Directory
  1959. mov eax, edx
  1960. pop edx
  1961. ret
  1962. _Get_Sys_VM_Handle:
  1963. push ebx
  1964. VMMcall Get_Sys_VM_Handle
  1965. mov eax, ebx
  1966. pop ebx
  1967. ret
  1968. _Get_Cur_VM_Handle:
  1969. push ebx
  1970. VMMcall Get_Cur_VM_Handle
  1971. mov eax, ebx
  1972. pop ebx
  1973. ret
  1974. _Call_VM_Event:
  1975. push ebx
  1976. push esi
  1977. push edx
  1978. mov ebx, [esp+16] ;VM handle
  1979. mov esi, [esp+20] ;callback function
  1980. mov edx, [esp+24] ; refdata
  1981. VMMCall Call_VM_Event
  1982. pop edx
  1983. pop esi
  1984. pop ebx
  1985. ret
  1986. ;*** _SetWin32Event - This function sets an event to the signaled state.
  1987. ;
  1988. ; _SetWin32Event is a thunk to VWIN32_SetWin32Event. (We make
  1989. ; sure that Win32 is loaded prior to making the call.)
  1990. ;
  1991. ; BOOL = SetWin32Event( pevt );
  1992. ;
  1993. ; ENTRY [esp+4] - pointer to an event object
  1994. ;
  1995. ; EXIT eax = 0 if event was invalid, <> 0 if OK
  1996. ; The event object is set to a signaled state. If it is a
  1997. ; manual reset event, it remains in the signaled state until it
  1998. ; is explicitly reset and all threads currently blocked on this
  1999. ; event are unblocked. If it is an auto reset event, one waiting
  2000. ; thread is unblocked.
  2001. ;
  2002. ; USES EAX, ECX, EDX
  2003. ;
  2004. BeginProc _SetWin32Event
  2005. VxDCall VWIN32_Get_Version ; Verify Win32 installation
  2006. jc short swe90 ; Win32 not installed! (EAX)=0
  2007. ; BUGBUG - the input parameter to _VWIN32_SetWin32Event is
  2008. ; documented as being in EAX right now, but if someone comes to
  2009. ; their senses and makes this C callable, this code will still work!
  2010. mov eax,DWORD PTR [esp+4] ; (EAX) = event object address
  2011. push eax
  2012. VxDCall _VWIN32_SetWin32Event ; Call _VWIN32_SetWin32Event
  2013. lea esp,[esp+4]
  2014. swe90: ret
  2015. EndProc _SetWin32Event
  2016. ;*** _ResetWin32Event - This function sets an event to not signaled state.
  2017. ;
  2018. ; _ResetWin32Event is a thunk to VWIN32_ResetWin32Event.
  2019. ; (We make sure that Win32 is loaded prior to making the call.)
  2020. ;
  2021. ; BOOL = ResetWin32Event( pevt );
  2022. ;
  2023. ; ENTRY [esp+4] - pointer to an event object
  2024. ;
  2025. ; EXIT eax = 0 if event was invalid, <> 0 if OK
  2026. ; The event object is set to a not signaled state.
  2027. ;
  2028. ; USES EAX, ECX, EDX
  2029. ;
  2030. BeginProc _ResetWin32Event
  2031. VxDCall VWIN32_Get_Version ; Verify Win32 installation
  2032. jc short swe91 ; Win32 not installed! (EAX)=0
  2033. ; BUGBUG - the input parameter to _VWIN32_ResetWin32Event is
  2034. ; documented as being in EAX right now, but if someone comes to
  2035. ; their senses and makes this C callable, this code will still work!
  2036. mov eax,DWORD PTR [esp+4] ; (EAX) = event object address
  2037. push eax
  2038. VxDCall _VWIN32_ResetWin32Event ; Call _VWIN32_ResetWin32Event
  2039. lea esp,[esp+4]
  2040. swe91: ret
  2041. EndProc _ResetWin32Event
  2042. ;*** _InSysVM - Returns boolean (Current VM == System VM) in EAX
  2043. ;
  2044. BeginProc _InSysVM
  2045. push ebx
  2046. VMMCall Get_Cur_VM_Handle ; (EBX) = Current VM
  2047. VMMCall Test_Sys_VM_Handle ; (Zero) = (Current VM == System VM)
  2048. pop ebx
  2049. sete al ; (AL)= (Current VM == System VM)
  2050. movzx eax,al ; EAX = (Current VM == System VM)
  2051. ret
  2052. EndProc _InSysVM
  2053. _CloseVxDHandle:
  2054. mov eax, [esp+4]
  2055. VxDcall _VWIN32_CloseVxDHandle
  2056. ret
  2057. BeginProc _MyCheckAccessConflict
  2058. int Dyna_Link_Int
  2059. dd @@IFSMgr_CheckAccessConflict OR DL_Jmp_Mask
  2060. EndProc _MyCheckAccessConflict
  2061. ;
  2062. ; SP_PutNumber
  2063. ;
  2064. ; Takes an unsigned long integer and places it into a buffer, respecting
  2065. ; a buffer limit, a radix, and a case select (upper or lower, for hex).
  2066. ;
  2067. SP_PutNumber proc near c public, lpb:DWORD, n:DWORD, limit:DWORD, radix:DWORD, case:DWORD
  2068. push esi
  2069. push edi
  2070. mov al,'a'-'0'-10 ; figure out conversion offset
  2071. cmp case,0
  2072. jz pn_lower
  2073. mov al,'A'-'0'-10
  2074. pn_lower:
  2075. mov byte ptr case,al
  2076. mov eax,n ; ebx=number
  2077. mov ecx,radix ; cx=radix
  2078. mov edi,lpb ; edi->string
  2079. mov esi,limit ; cchLimit
  2080. divdown:
  2081. xor edx,edx
  2082. div ecx ; edx = rem, eax = div
  2083. xchg eax,edx ; eax = rem, edx = div
  2084. add al,'0'
  2085. cmp al,'9'
  2086. jbe isadig ; is a digit already
  2087. add al,byte ptr case ; convert to letter
  2088. isadig:
  2089. dec esi ; decrement cchLimit
  2090. jz pn_exit ; go away if end of string
  2091. stosb ; stick it in
  2092. mov eax,edx
  2093. or eax,eax
  2094. jnz divdown ; crack out next digit
  2095. pn_exit:
  2096. mov eax,edi
  2097. sub eax,dword ptr lpb[0] ; find number of chars output
  2098. pop edi
  2099. pop esi
  2100. ret
  2101. SP_PutNumber EndP
  2102. ;
  2103. ; SP_Reverse
  2104. ;
  2105. ; Reverses a string in place
  2106. ;
  2107. SP_Reverse proc near c public, lpFirst:DWORD, lpLast:DWORD
  2108. push esi
  2109. push edi
  2110. mov esi,lpFirst
  2111. mov edi,lpLast
  2112. mov ecx,edi ; number of character difference
  2113. sub ecx,esi
  2114. inc ecx
  2115. shr ecx,1 ; number of swaps required
  2116. jcxz spr_boring ; nuthin' to do
  2117. spr100:
  2118. mov ah,[edi]
  2119. mov al,[esi] ; load the two characters
  2120. mov [esi],ah
  2121. mov [edi],al ; swap them
  2122. inc esi
  2123. dec edi ; adjust the pointers
  2124. loop spr100 ; ...until we've done 'em all
  2125. spr_boring:
  2126. pop edi
  2127. pop esi
  2128. ret
  2129. SP_Reverse EndP
  2130. VxD_CODE_ENDS
  2131. END
  2132.