Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

159 lines
3.4 KiB

#include "termsrvpch.h"
#pragma hdrstop
#include <wtsapi32.h>
//
// Caution! Many of these functions must perform a SetLastError() because
// the callers will call GetLastError() and try to recover based on the
// error code. Even more interesting, Taskmgr will sometimes pass the
// error code to FormatMessage and display it to the end user. So
// we can't use ERROR_PROC_NOT_FOUND = "The specified procedure could not be
// found", because it is meaningless to the end user.
//
// I have chosen to use ERROR_FUNCTION_NOT_CALLED = "Function could not be
// executed".
//
static
VOID
WINAPI
WTSCloseServer(
IN HANDLE hServer
)
{
// Not much can be done here.
// We will probably never hit this code anyway,
// since you'd need to obtain a handle first
}
static
BOOL
WINAPI
WTSDisconnectSession(
IN HANDLE hServer,
IN DWORD SessionId,
IN BOOL bWait
)
{
// Taskmgr needs an error code here
SetLastError(ERROR_FUNCTION_NOT_CALLED);
return FALSE;
}
BOOL
WINAPI
WTSEnumerateSessionsW(
IN HANDLE hServer,
IN DWORD Reserved,
IN DWORD Version,
OUT PWTS_SESSION_INFOW * ppSessionInfo,
OUT DWORD * pCount
)
{
// Windows Update needs an error code here
SetLastError(ERROR_FUNCTION_NOT_CALLED);
return FALSE;
}
VOID
WINAPI
WTSFreeMemory(
IN PVOID pMemory
)
{
// May as well just implement it directly since we're in kernel32 already.
// Though theoretically nobody should call us since the only time you
// WTSFreeMemory is after a successful WTSQuerySessionInformation.
LocalFree( pMemory );
}
BOOL
WINAPI
WTSLogoffSession(
IN HANDLE hServer,
IN DWORD SessionId,
IN BOOL bWait
)
{
// Taskmgr needs an error code here
SetLastError(ERROR_FUNCTION_NOT_CALLED);
return FALSE;
}
HANDLE
WINAPI
WTSOpenServerW(
IN LPWSTR pServerName
)
{
// This function is doc'd to set the LE
SetLastError(ERROR_FUNCTION_NOT_CALLED);
return NULL;
}
BOOL
WINAPI
WTSQuerySessionInformationW(
IN HANDLE hServer,
IN DWORD SessionId,
IN WTS_INFO_CLASS WTSInfoClass,
OUT LPWSTR * ppBuffer,
OUT DWORD * pBytesReturned
)
{
// SessMgr.exe needs an error code here
SetLastError(ERROR_FUNCTION_NOT_CALLED);
return FALSE;
}
BOOL
WINAPI
WTSQueryUserToken(
IN ULONG SessionId,
IN PHANDLE phToken
)
{
// Somebody might need an error code here
SetLastError(ERROR_FUNCTION_NOT_CALLED);
return FALSE;
}
BOOL
WINAPI
WTSSendMessageW(
IN HANDLE hServer,
IN DWORD SessionId,
IN LPWSTR pTitle,
IN DWORD TitleLength,
IN LPWSTR pMessage,
IN DWORD MessageLength,
IN DWORD Style,
IN DWORD Timeout,
OUT DWORD * pResponse,
IN BOOL bWait
)
{
// Taskmgr needs an error code here
SetLastError(ERROR_FUNCTION_NOT_CALLED);
return FALSE;
}
//
// !! WARNING !! The entries below must be in alphabetical order, and are CASE SENSITIVE (eg lower case comes last!)
//
DEFINE_PROCNAME_ENTRIES(wtsapi32)
{
DLPENTRY(WTSCloseServer)
DLPENTRY(WTSDisconnectSession)
DLPENTRY(WTSEnumerateSessionsW)
DLPENTRY(WTSFreeMemory)
DLPENTRY(WTSLogoffSession)
DLPENTRY(WTSOpenServerW)
DLPENTRY(WTSQuerySessionInformationW)
DLPENTRY(WTSQueryUserToken)
DLPENTRY(WTSSendMessageW)
};
DEFINE_PROCNAME_MAP(wtsapi32)