NetRemoteTOD sample in VB.NET

  • Thread starter Thread starter adiel
  • Start date Start date
A

adiel

Hello I found the following example on another newsgroup:
is there any sample for NetRemoteTOD API function in C#?

[DllImport("netapi32.dll", CharSet=CharSet.Unicode)]
static extern uint NetRemoteTOD(string UncServerName, out IntPtr
BufferPtr);

[DllImport("netapi32.dll")]
static extern uint NetApiBufferFree(IntPtr Buffer);

struct TIME_OF_DAY_INFO
{
public uint tod_elapsedt, tod_msecs, tod_hours,
tod_mins, tod_secs, tod_hunds;
public int tod_timezone;
public uint tod_tinterval, tod_day, tod_month,
tod_year, tod_weekday;
}

--

IntPtr ptodi;
NetRemoteTOD( @"\\server", out ptodi );
TIME_OF_DAY_INFO todi = (TIME_OF_DAY_INFO)Marshal.PtrToStructure(
ptodi, typeof(TIME_OF_DAY_INFO) );
NetApiBufferFree( ptodi );

I was wondering if anyone had a sample on how to use NetRemoteTOD in VB.Net.

Thanks,
Adiel
 
Back
Top