Bullock, Howard A. wrote:

>1. The API wants the server name in UNICODE. I have looked at the
>Unicode module docs but do not understand how they relate to this task.
>How do I change my standard text name to UNICODE for use with this
>function?
>  
>
use Encode qw(encode);
printf("%s", encode("UCS-2LE", 'asdadasdads'));


>2. Is the unpacking of the buffer correct for DWORDs?
>
>3. When unpacking the returned data, what is the difference between the
>LONG and DWORD? Aren't they both 4 bytes?
>  
>
yes.  DWORD is an unsigned 32 bit integer, LONG a signed 32 bit integer.


>$tod_month = unpack ("L", substr($lpBuffer, 37, 4));
>$tod_day = unpack ("L", substr($lpBuffer, 33, 4));
>$tod_year = unpack ("L", substr($lpBuffer, 41, 4));
>$tod_hours = unpack ("L", substr($lpBuffer, 9, 4));
>$tod_mins = unpack ("L", substr($lpBuffer, 13, 4));
>$tod_secs = unpack ("L", substr($lpBuffer, 17, 4));
>$tod_timezone = unpack ("L", substr($lpBuffer, 25, 4)) * 60
>  
>

why do you use the odd offsets?  from the struct in the comments in your
code everything seems perfecty aligned to dwords.

you should write this with one unpack call, like this:

(
  undef, undef, $tod_hours, $tod_mins, $tod_secs, undef, $tod_timezone,
undef, $tod_day, $tod_month, $tod_year, undef
)= unpack("L6lL5", $lpBuffer);

willem
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to