diff --git a/winpr/include/winpr/user.h b/winpr/include/winpr/user.h index e05b02122..0499c7d6a 100644 --- a/winpr/include/winpr/user.h +++ b/winpr/include/winpr/user.h @@ -3,6 +3,7 @@ * User Environment * * Copyright 2014 Marc-Andre Moreau + * Copyright 2015 DI (FH) Martin Haimberger * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,6 +30,26 @@ #ifndef _WIN32 +#define MB_OK 0x00000000L +#define MB_OKCANCEL 0x00000001L +#define MB_ABORTRETRYIGNORE 0x00000002L +#define MB_YESNOCANCEL 0x00000003L +#define MB_YESNO 0x00000004L +#define MB_RETRYCANCEL 0x00000005L +#define MB_CANCELTRYCONTINUE 0x00000006L + +#define IDOK 1 +#define IDCANCEL 2 +#define IDABORT 3 +#define IDRETRY 4 +#define IDIGNORE 5 +#define IDYES 6 +#define IDNO 7 +#define IDTRYAGAIN 10 +#define IDCONTINUE 11 +#define IDTIMEOUT 32000 +#define IDASYNC 32001 + #define CF_TEXT 1 #define CF_BITMAP 2 #define CF_METAFILEPICT 3 diff --git a/winpr/include/winpr/wnd.h b/winpr/include/winpr/wnd.h index f09995913..6fc89942a 100644 --- a/winpr/include/winpr/wnd.h +++ b/winpr/include/winpr/wnd.h @@ -3,6 +3,7 @@ * Window Notification System * * Copyright 2014 Marc-Andre Moreau + * Copyright 2015 DI (FH) Martin Haimberger * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -410,6 +411,8 @@ typedef struct tagWTSSESSION_NOTIFICATION #define WTS_SESSION_LOCK 0x7 #define WTS_SESSION_UNLOCK 0x8 #define WTS_SESSION_REMOTE_CONTROL 0x9 +#define WTS_SESSION_CREATE 0xA +#define WTS_SESSION_TERMINATE 0xB #ifdef __cplusplus extern "C" { diff --git a/winpr/include/winpr/wtsapi.h b/winpr/include/winpr/wtsapi.h index d367b42dc..376a8518c 100644 --- a/winpr/include/winpr/wtsapi.h +++ b/winpr/include/winpr/wtsapi.h @@ -3,6 +3,7 @@ * Windows Terminal Services API * * Copyright 2013 Marc-Andre Moreau + * Copyright 2015 DI (FH) Martin Haimberger * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -1078,6 +1079,12 @@ WINPR_API BOOL CDECL WTSIsChildSessionsEnabled(PBOOL pbEnabled); WINPR_API BOOL CDECL WTSGetChildSessionId(PULONG pSessionId); +WINPR_API BOOL CDECL WTSLogonUser(HANDLE hServer, LPCSTR username, + LPCSTR password, LPCSTR domain); + +WINPR_API BOOL CDECL WTSLogoffUser(HANDLE hServer); + + #ifdef __cplusplus } #endif @@ -1278,6 +1285,11 @@ typedef BOOL (CDECL * WTS_GET_CHILD_SESSION_ID_FN)(PULONG pSessionId); typedef DWORD (WINAPI * WTS_GET_ACTIVE_CONSOLE_SESSION_ID_FN)(void); +typedef BOOL (WINAPI * WTS_LOGON_USER_FN)(HANDLE hServer, LPCSTR username, + LPCSTR password, LPCSTR domain); + +typedef BOOL (WINAPI * WTS_LOGOFF_USER_FN)(HANDLE hServer); + struct _WtsApiFunctionTable { DWORD dwVersion; @@ -1346,6 +1358,8 @@ struct _WtsApiFunctionTable WTS_IS_CHILD_SESSIONS_ENABLED_FN pIsChildSessionsEnabled; WTS_GET_CHILD_SESSION_ID_FN pGetChildSessionId; WTS_GET_ACTIVE_CONSOLE_SESSION_ID_FN pGetActiveConsoleSessionId; + WTS_LOGON_USER_FN pLogonUser; + WTS_LOGOFF_USER_FN pLogoffUser; }; typedef struct _WtsApiFunctionTable WtsApiFunctionTable; typedef WtsApiFunctionTable* PWtsApiFunctionTable; diff --git a/winpr/libwinpr/wtsapi/wtsapi.c b/winpr/libwinpr/wtsapi/wtsapi.c index b0f92f000..8001fffcc 100644 --- a/winpr/libwinpr/wtsapi/wtsapi.c +++ b/winpr/libwinpr/wtsapi/wtsapi.c @@ -3,6 +3,7 @@ * Windows Terminal Services API * * Copyright 2013 Marc-Andre Moreau + * Copyright 2015 DI (FH) Martin Haimberger * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -536,6 +537,16 @@ BOOL CDECL WTSGetChildSessionId(PULONG pSessionId) WTSAPI_STUB_CALL_BOOL(GetChildSessionId, pSessionId); } +BOOL CDECL WTSLogonUser(HANDLE hServer, LPCSTR username, LPCSTR password, LPCSTR domain) +{ + WTSAPI_STUB_CALL_BOOL(LogonUser, hServer, username, password, domain); +} + +BOOL CDECL WTSLogoffUser(HANDLE hServer) +{ + WTSAPI_STUB_CALL_BOOL(LogoffUser, hServer); +} + #ifndef _WIN32 /**