Sign in to follow this  
Followers 0
PaulIA

64 bit math question

3 posts in this topic

I have been trying to figure out a way to convert the following code snippet:

FILETIME FileTime;

__int64 lgTemp;

__int64 SecsTo1970 = 116444736000000000;

lgTemp = Int32x32To64(Time, 10000000) + SecsTo1970;

FileTime.dwLowDateTime = (DWORD) lgTemp;

FileTime.dwHighDateTime = (DWORD)(lgTemp >> 32);

This first problem I have is getting around the Int32x32To64 API call due to the fact that DllCall doesn't return an Int64 type. I found a post by Valik that describes using DllStructCreate to force a variable to an Int64 type, like this:

$rTemp = DllStructCreate("int64")
DllStructSetData($rTemp, 1, 36028797018963967)
$iTemp = DllStructGetData($rTemp, 1)
ConsoleWrite($iTemp & @CR)

This seems to work, so I'm guessing that I can do the same to the two constants and then do the math. I then need to split $iTemp into two DWORD variables and this is where I've come up short. If anybody could give me a shove in the right direction, I'd appeciate it.


Auto3Lib: A library of over 1200 functions for AutoIt

Share this post


Link to post
Share on other sites



Don't you hate it when you figure out the answer 30 minutes after you post. :whistle:

$rTemp   = _DllStructCreate("int64")
$pTemp   = _DllStructGetPtr($rTemp )
$rBuffer = _DllStructCreate("int;uint", $pTemp)
_DllStructSetData($rTemp, 1, 2305843009213693951); $1FFFFFFF FFFFFFFF
$iTemp   = DllStructGetData($rTemp, 1)
ConsoleWrite($iTemp & @CR)
ConsoleWrite(Hex(_DllStructGetData($rBuffer, 1)) & @CR)
ConsoleWrite(Hex(_DllStructGetData($rBuffer, 2)) & @CR)

Auto3Lib: A library of over 1200 functions for AutoIt

Share this post


Link to post
Share on other sites

Don't you hate it when you figure out the answer 30 minutes after you post. :whistle:

$rTemp   = _DllStructCreate("int64")
$pTemp   = _DllStructGetPtr($rTemp )
$rBuffer = _DllStructCreate("int;uint", $pTemp)
_DllStructSetData($rTemp, 1, 2305843009213693951); $1FFFFFFF FFFFFFFF
$iTemp   = DllStructGetData($rTemp, 1)
ConsoleWrite($iTemp & @CR)
ConsoleWrite(Hex(_DllStructGetData($rBuffer, 1)) & @CR)
ConsoleWrite(Hex(_DllStructGetData($rBuffer, 2)) & @CR)
I generally find out not 30 mins after, but about 5 haha.

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0