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 wtsapi32, prefix the name with the module name and a period.
WTSEnumerateListeners (wtsapi32)
.
C# Signature:
/// <summary>
/// This function is to be called twice.
/// First time is to get pCount (function returns false with WinErr 122).
/// Second Time is to get pointer of array (function returns true if successful)
/// Unfortunately this function cannot be used on another machine, unlike [winsta.dll] -> WinStationQueryInformationW ... see Cassia source code for details
/// </summary>
/// <param name="hServer"> Remote Server Handle not supported. Value must be IntPtr.Zero ( WTS_CURRENT_SERVER_HANDLE ) </param>
/// <param name="pReserved">Value must be IntPtr.Zero</param>
/// <param name="Reserved">Always set to 0</param>
/// <param name="pListeners">A pointer to an array, filled when pCount is greater than 0</param>
/// <param name="pCount">If pListeners is IntPtr.Zero and pCount is 0, calling function will populate pCount</param>
/// <returns></returns>
[DllImport("wtsapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
static extern bool WTSEnumerateListeners([In] IntPtr hServer,
[In] IntPtr pReserved,
[In] uint Reserved,
[Optional] ref IntPtr pListeners,
[In,Out] ref uint pCount);
Alternative Managed API:
//GitHub > Cassia > Impl > NativeMethods.cs
[DllImport("winsta.dll", CharSet = CharSet.Unicode, EntryPoint = "WinStationQueryInformationW", SetLastError = true)]
public static extern int WinStationQueryInformationRemoteAddress(IntPtr hServer, int sessionId,
WINSTATIONINFOCLASS information,
ref WINSTATIONREMOTEADDRESS buffer,
int bufferLength, out int returnedLength);
Notes:
None.
Tips & Tricks:
Please add some!
Sample Code:
Please add some!
This function is meant to query the listeners on the workstation it is invoked from.
3/15/2018 12:30:25 PM - -207.195.114.48
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).