Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than netapi32, prefix the name with the module name and a period.
<DllImport("NetApi32.dll", CharSet:=CharSet.Auto, SetLastError:=True)> _
Private Shared Function DsGetSiteName( _
<MarshalAs(UnmanagedType.LPTStr)> ByVal ComputerName As String, _
<Out()> ByRef SiteNameBuffer As IntPtr) As UInt32
End Function
User-Defined Types:
None.
Alternative Managed API:
None
Notes:
The DsGetSiteName function does not require any particular access to the specified domain. The function is sent to the Netlogon service on the computer specified by ComputerName.
Return codes:
ERROR_NO_SITENAME The computer is not in a site.
ERROR_NOT_ENOUGH_MEMORY Insufficient memory is available.
Dim pBuffer As IntPtr = IntPtr.Zero
Dim result As UInt32 = DsGetSiteName("MEASUS", pBuffer)
If result.ToString = "0" Then
Dim SiteName As String = Marshal.PtrToStringAuto(pBuffer)
NetApiBufferFree(pBuffer)
Console.WriteLine(SiteName)
End If
Returns the name of the site where a computer resides. For a domain controller (DC), the name of the site is the location of the configured DC. For a member workstation or member server, the name specifies the workstation site as configured in the domain of the computer.
5/1/2014 1:46:21 AM - zippy1981@gmail.com-72.231.2.126
An IntPtr is a pointer to a memory location (unmanaged) that adapts to the platform it is running on (64-bit, etc.) UNLIKE a standard int/Integer. You should always use this type for unmanaged calls that require it, even though an int will appear to work on your development machine.
1/13/2008 4:00:13 AM - Damon Carr-72.43.165.29
An IntPtr is a pointer to a memory location (unmanaged) that adapts to the platform it is running on (64-bit, etc.) UNLIKE a standard int/Integer. You should always use this type for unmanaged calls that require it, even though an int will appear to work on your development machine.
1/13/2008 4:00:13 AM - Damon Carr-72.43.165.29
TODO - a short description of this collection of constants
4/6/2012 12:59:20 AM - anonymous
Please edit this page!
Do you have...
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).