Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert an Integer to LARGE_INTEGER

How do i convert an integer to LARGE_INTEGER?

For example, when I want to trigger a timer immediately:

LARGE_INTEGER zero;  
zero.QuadPart = 0;  
KeSetTimer(pTimer, zero, pDpc);

Is there any way to convert 0 to LARGE_INTEGER? So I could do this instead:

KeSetTimer(pTimer, (SomeType)0, pDpc);

I have tried:

KeSetTimer(pTimer, (LARGE_INTEGER )0, pDpc);

But it doesn't work. I have Googled, but couldn't find any help.

like image 928
Just a little noob Avatar asked Nov 16 '25 23:11

Just a little noob


1 Answers

LARGE_INTEGER is a struct. It is not possible to cast a value to a struct type.

You need to create an instance of the struct and set its fields as needed.

For example:

LARGE_INTEGER intToLargeInt(int i) {
    LARGE_INTEGER li;
    li.QuadPart = i;
    return li;
}

You can then use it like this:

KeSetTimer(pTimer, intToLargeInt(0), pDpc);
like image 85
Klas Lindbäck Avatar answered Nov 18 '25 12:11

Klas Lindbäck



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!