Windows C / NtDelayExecution
Author | Kyle Cucci (d4rksystem) |
Platform | Windows |
Language | C |
Technique | NtDelayExecution |
Description:
The following code snippet demonstrates two methods for introducing delays in a Windows environment. The first method uses NtDelayExecution
, while the second employs the Beep
function.
Code
int main() {
bool alertable = 0; // Thread alertable state. 0 = thread cannot cannot break on call to NtAlertThread.
int duration = 60000; // Duration of the delay in milliseconds
NtDelayExecution(alertable, duration)
return 0;
}
// ---
int main() {
int frequency = 0; // Frequency of the beep in hertz (this will likely be "0" if the malware doesn't actually want to invoke the beep sound!)
int duration = 60000; // Duration of the beep in milliseconds
Beep(frequency, duration)
return 0;
}
Created
August 17, 2024
Last Revised
August 17, 2024