Jump to content

DLL Structure with bite-based elements instead of bytes


Iczer
 Share

Recommended Posts

To get info from :

wDate struct {
                unsigned ft_day   : 5;
                unsigned ft_month : 4;
                unsigned ft_year  : 7;
            } _DosDate;

 15 14 13 12 11 10  9  8  7  6  5  4  3  2  1  0
|<--(year - 1980)--->|<---month->|<-----day---->|


;----------------------------------------------------------------
wTime struct {
                unsigned ft_tsec : 5;
                unsigned ft_min  : 6;
                unsigned ft_hour : 5;
            } _DosTime;

 15 14 13 12 11 10  9  8  7  6  5  4  3  2  1  0
|<------hours---->|<----minutes-->|<--sec/ 2)-->|

Edited by Iczer
Link to comment
Share on other sites

I know :

$year = BitShift(BitAND($aRet[0],65024),9)+1980
$month = BitShift(BitAND($aRet[0],480),5)
$day = BitAND($aRet[0],31)

$Hours = BitShift(BitAND($aRet[0],63488),11)
$Minutes = BitShift(BitAND($aRet[0],2016),5)
$Seconds = BitAND($aRet[0],31)*2

it seem there are no bit-based structures... but would't  it be more clean way to have them? Since they are exist  :sweating:  :sorcerer:

Link to comment
Share on other sites

Hi, I think could do something like this: Edit: I did not look you want bit.  use bitwise instead.

Local $tword=DllStructCreate("word")

DllStructSetData($tword,1,258)

Local $tbytes=DllStructCreate("byte[" & DllStructGetSize($tword) & "]",DllStructGetPtr($tword))

msgbox(0,"the low byte",DllStructGetData($tbytes,1,1))

msgbox(0,"the high byte",DllStructGetData($tbytes,1,2))

But I sure trancexx way is the best.

saludos

Edited by Danyfirex
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...