64,685
社区成员
发帖
与我相关
我的任务
分享
1570: VOID
1571: Sleep(
1572: DWORD dwMilliseconds
1573: )
1574:
1575: /*++
1576:
1577: Routine Description:
1578:
1579: The execution of the current thread can be delayed for a specified
1580: interval of time with the Sleep function.
1581:
1582: The Sleep function causes the current thread to enter a
1583: waiting state until the specified interval of time has passed.
1584:
1585: Arguments:
1586:
1587: dwMilliseconds - A time-out value that specifies the relative time,
1588: in milliseconds, over which the wait is to be completed. A
1589: timeout value of 0 specified that the wait is to timeout
1590: immediately. This allows an application to test an object to
1591: determine if it is in the signaled state. A timeout value of -1
1592: specifies an infinite timeout period.
1593:
1594: Return Value:
1595:
1596: None.
1597:
1598: --*/
1599:
1600: {
1601: SleepEx(dwMilliseconds,FALSE);
1602: }
1603:
1604: DWORD
1605: APIENTRY
1606: SleepEx(
1607: DWORD dwMilliseconds,
1608: BOOL bAlertable
1609: )
1610:
1611: /*++
1612:
1613: Routine Description:
1614:
1615: The execution of the current thread can be delayed for a specified
1616: interval of time with the SleepEx function.
1617:
1618: The SleepEx function causes the current thread to enter a waiting
1619: state until the specified interval of time has passed.
1620:
1621: If the bAlertable parameter is FALSE, the only way the SleepEx
1622: returns is when the specified time interval has passed. If the
1623: bAlertable parameter is TRUE, then the SleepEx can return due to the
1624: expiration of the time interval (return value of 0), or because an
1625: I/O completion callback terminated the SleepEx early (return value
1626: of WAIT_IO_COMPLETION).
1627:
1628: Arguments:
1629:
1630: dwMilliseconds - A time-out value that specifies the relative time,
1631: in milliseconds, over which the wait is to be completed. A
1632: timeout value of 0 specified that the wait is to timeout
1633: immediately. A timeout value of -1 specifies an infinite
1634: timeout period.
1635:
1636: bAlertable - Supplies a flag that controls whether or not the
1637: SleepEx may terminate early due to an I/O completion callback.
1638: A value of TRUE allows this API to complete early due to an I/O
1639: completion callback. A value of FALSE will not allow I/O
1640: completion callbacks to terminate this call early.
1641:
1642: Return Value:
1643:
1644: 0 - The SleepEx terminated due to expiration of the time interval.
1645:
1646: WAIT_IO_COMPLETION - The SleepEx terminated due to one or more I/O
1647: completion callbacks.
1648:
1649: --*/
1650: {
1651: LARGE_INTEGER TimeOut;
1652: PLARGE_INTEGER pTimeOut;
1653: NTSTATUS Status;
1654:
1655: pTimeOut = BaseFormatTimeOut(&TimeOut,dwMilliseconds);
1656: if (pTimeOut == NULL) {
1657: //
1658: // If Sleep( -1 ) then delay for the longest possible integer
1659: // relative to now.
1660: //
1661:
1662: TimeOut.LowPart = 0x0;
1663: TimeOut.HighPart = 0x80000000;
1664: pTimeOut = &TimeOut;
1665: }
1666:
1667: rewait:
1668: Status = NtDelayExecution(
1669: (BOOLEAN)bAlertable,
1670: pTimeOut
1671: );
1672: if ( bAlertable && Status == STATUS_ALERTED ) {
1673: goto rewait;
1674: }
1675: return Status == STATUS_USER_APC ? WAIT_IO_COMPLETION : 0;
1676: }
; *** Sleep (857) ***
; SYM:Sleep#24EE
0x7c8024ee 8bff mov edi,edi
0x7c8024f0 55 push ebp
0x7c8024f1 8bec mov ebp,esp
0x7c8024f3 6a00 push 0x0
0x7c8024f5 ff7508 push dword ptr [ebp+0x8]
0x7c8024f8 e88bf9ffff call 0x7c801e88 ; SYM:SleepEx#1E88
0x7c8024fd 5d pop ebp
0x7c8024fe c20400 ret 0x4
; *** SleepEx (858) ***
; SYM:SleepEx#1E88
0x7c801e88 6a3c push 0x3c
0x7c801e8a 684816827c push 0x7c821648 ; CODE(?):FF FF FF FF
0x7c801e8f e85dfb0100 call 0x7c8219f1
0x7c801e94 c745b424000000 mov dword ptr [ebp-0x4c],0x24
0x7c801e9b c745b801000000 mov dword ptr [ebp-0x48],0x1
0x7c801ea2 6a07 push 0x7
0x7c801ea4 59 pop ecx
0x7c801ea5 33c0 xor eax,eax
0x7c801ea7 8d7dbc lea edi,[ebp-0x44]
0x7c801eaa f3ab rep stosd
0x7c801eac 33f6 xor esi,esi
0x7c801eae 39750c cmp [ebp+0xc],esi
0x7c801eb1 7547 jnz 0x7c801efa ; (*+0x49)
0x7c801eb3 8975fc mov [ebp-0x4],esi ; <==0x7C801F05(*+0x52)
0x7c801eb6 ff7508 push dword ptr [ebp+0x8]
0x7c801eb9 8d45d8 lea eax,[ebp-0x28]
0x7c801ebc 50 push eax
0x7c801ebd e89cfa0100 call 0x7c82195e
0x7c801ec2 8945e4 mov [ebp-0x1c],eax
0x7c801ec5 3bc6 cmp eax,esi
0x7c801ec7 743e jz 0x7c801f07 ; (*+0x40)
0x7c801ec9 ff75e4 push dword ptr [ebp-0x1c] ; <==0x7C801F17(*+0x4E), 0x7C801F20(*+0x57)
0x7c801ecc ff750c push dword ptr [ebp+0xc]
0x7c801ecf ff151815807c call dword ptr [0x7c801518] ; EXT:NTDLL.DLL!NtDelayExecution
0x7c801ed5 8945e0 mov [ebp-0x20],eax
0x7c801ed8 39750c cmp [ebp+0xc],esi
0x7c801edb 753c jnz 0x7c801f19 ; (*+0x3E)
0x7c801edd 834dfcff or dword ptr [ebp-0x4],0xff ; <==0x7C801F1E(*+0x41)
0x7c801ee1 e848000000 call 0x7c801f2e
0x7c801ee6 b8c0000000 mov eax,0xc0
0x7c801eeb 3945e0 cmp [ebp-0x20],eax
0x7c801eee 7402 jz 0x7c801ef2 ; (*+0x4)
0x7c801ef0 33c0 xor eax,eax
0x7c801ef2 e835fb0100 call 0x7c821a2c ; <==0x7C801EEE(*-0x4)
0x7c801ef7 c20800 ret 0x8
;********************************************************************************
0x7c801efa 33d2 xor edx,edx ; <==0x7C801EB1(*-0x49)
0x7c801efc 8d4db4 lea ecx,[ebp-0x4c]
0x7c801eff ff155812807c call dword ptr [0x7c801258] ; EXT:NTDLL.DLL!RtlActivateActivationContextUnsafeFast
0x7c801f05 ebac jmp 0x7c801eb3 ; (*-0x52)
0x7c801f07 8975d8 mov [ebp-0x28],esi ; <==0x7C801EC7(*-0x40)
0x7c801f0a c745dc00000080 mov dword ptr [ebp-0x24],0x80000000
0x7c801f11 8d45d8 lea eax,[ebp-0x28]
0x7c801f14 8945e4 mov [ebp-0x1c],eax
0x7c801f17 ebb0 jmp 0x7c801ec9 ; (*-0x4E)
0x7c801f19 3d01010000 cmp eax,0x101 ; <==0x7C801EDB(*-0x3E)
0x7c801f1e 75bd jnz 0x7c801edd ; (*-0x41)
0x7c801f20 eba7 jmp 0x7c801ec9 ; (*-0x57)
0x7c801f22 90 nop
0x7c801f23 90 nop
0x7c801f24 90 nop
0x7c801f25 90 nop
0x7c801f26 90 nop
0x7c801f27 33f6 xor esi,esi
0x7c801f29 90 nop
0x7c801f2a 90 nop
0x7c801f2b 90 nop
0x7c801f2c 90 nop
0x7c801f2d 90 nop
0x7c801f2e 39750c cmp [ebp+0xc],esi ; <==0x7C801EE1(*-0x4D)
0x7c801f31 7501 jnz 0x7c801f34 ; (*+0x3)
0x7c801f33 c3 ret ; <==0x7C801F3D(*+0xA)
;********************************************************************************
0x7c801f34 8d4db4 lea ecx,[ebp-0x4c] ; <==0x7C801F31(*-0x3)
0x7c801f37 ff155412807c call dword ptr [0x7c801254] ; EXT:NTDLL.DLL!RtlDeactivateActivationContextUnsafeFast
0x7c801f3d ebf4 jmp 0x7c801f33 ; (*-0xA)