I am still trying to learn to use the Win32::API module. This attempt is listed below. I have the following questions:
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? 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? http://msdn.microsoft.com/library/default.asp?url=/library/en-us/netmgmt /netmgmt/netremotetod.asp http://support.microsoft.com/kb/249716/EN-US/ Any help in assisting me to better understand these issues and the use of Win32::API in general would be greatly appreciated. #-------------- use Win32::API; $GetTOD = new Win32::API('Netapi32','NetRemoteTOD','PP','N'); if(not defined $GetTOD) { die "Can't import API NetRemoteTOD: $!\n"; } $lpBuffer = " " x 48; $rc = $GetTOD->Call('berd4px01.tycoelectronics.net', $lpBuffer); print $rc . "\n"; #typedef struct _TIME_OF_DAY_INFO { # DWORD tod_elapsedt; # DWORD tod_msecs; # DWORD tod_hours; # DWORD tod_mins; # DWORD tod_secs; # DWORD tod_hunds; # LONG tod_timezone; # DWORD tod_tinterval; # DWORD tod_day; # DWORD tod_month; # DWORD tod_year; # DWORD tod_weekday; #} TIME_OF_DAY_INFO, *PTIME_OF_DAY_INFO, *LPTIME_OF_DAY_INFO; $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 print $tod_month ."\n"; _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs