NetRemoteTOD USage

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I am tring to use the NetRemoteTOD Windows API from CSharp, I am looking for some help on the C# Signature for this API. An example of the Signature or USage in C# would be of great help.

The NetRemoteTOD function returns the time of day information from a specified server.

Here is the WIN32API

NET_API_STATUS NetRemoteTOD(
LPCWSTR UncServerName,
LPBYTE *BufferPtr
);


Regards,
PRM
 
PRM,

I've set up the definitions you need on the PInvoke.NET website
(http://www.pinvoke.net). You will need the following definitions:

NetRemoteTOD
NetApiBufferFree
TIME_OF_DAY_INFO

Once you have that, here is a sample bit of code to get the information:

// The pointer.
IntPtr pintBuffer = IntPtr.Zero;

// Get the time of day.
int pintError = NetRemoteTOD(@"\\sony_laptop", ref pintBuffer);

// Get the structure.
TIME_OF_DAY_INFO pobjInfo = (TIME_OF_DAY_INFO)
Marshal.PtrToStructure(pintBuffer, typeof(TIME_OF_DAY_INFO));

// Free the buffer.
NetApiBufferFree(pintBuffer);

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

PRM said:
Hi,
I am tring to use the NetRemoteTOD Windows API from CSharp, I am
looking for some help on the C# Signature for this API. An example of the
Signature or USage in C# would be of great help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top