Emanuele Aliberti <ea@reactos.com>

- Some stubs for ts moved in process/session.c.
- Implemented ProcessIdToSessionId.

svn path=/trunk/; revision=11017
This commit is contained in:
Emanuele Aliberti 2004-09-23 21:01:23 +00:00
parent b0f758cf33
commit bf3b5cc677
4 changed files with 82 additions and 23 deletions

View file

@ -168,8 +168,8 @@ DisconnectNamedPipe@4
DnsHostnameToComputerNameA@12
DnsHostnameToComputerNameW@12
DosDateTimeToFileTime@12
;DosPathToSessionPathA
;DosPathToSessionPathW
DosPathToSessionPathA@12
DosPathToSessionPathW@12
DuplicateConsoleHandle@16
DuplicateHandle@28
EndUpdateResourceA@8

View file

@ -29,6 +29,7 @@ BEGIN
VALUE "OriginalFilename", "kernel32.dll\0"
VALUE "ProductName", RES_STR_PRODUCT_NAME
VALUE "ProductVersion", RES_STR_PRODUCT_VERSION
VALUE "Build Date", RES_STR_BUILD_DATE
END
END
BLOCK "VarFileInfo"

View file

@ -1,4 +1,4 @@
/* $Id: stubs.c,v 1.91 2004/09/23 19:03:26 weiden Exp $
/* $Id: stubs.c,v 1.92 2004/09/23 21:01:23 ea Exp $
*
* KERNEL32.DLL stubs (STUB functions)
* Remove from this file, if you implement them.
@ -1197,17 +1197,6 @@ WriteFileGather(
return 0;
}
/*
* @unimplemented
*/
DWORD
STDCALL
WTSGetActiveConsoleSessionId(VOID)
{
STUB;
return 0;
}
/*
* @unimplemented
*/

View file

@ -1,4 +1,4 @@
/* $Id: session.c,v 1.5 2003/07/10 18:50:51 chorns Exp $
/* $Id: session.c,v 1.6 2004/09/23 21:01:23 ea Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
@ -10,22 +10,91 @@
*/
#include <k32.h>
DWORD ActiveConsoleSessionId = 0;
/*
* @unimplemented
*/
BOOL STDCALL ProcessIdToSessionId (
DWORD dwProcessId,
DWORD* pSessionId
)
DWORD STDCALL
DosPathToSessionPathW (DWORD SessionID, LPWSTR InPath, LPWSTR * OutPath)
{
if (NULL != pSessionId)
return 0;
}
/*
* From: ActiveVB.DE
*
* Declare Function DosPathToSessionPath _
* Lib "kernel32.dll" _
* Alias "DosPathToSessionPathA" ( _
* ByVal SessionId As Long, _
* ByVal pInPath As String, _
* ByVal ppOutPath As String ) _
* As Long
*
* @unimplemented
*/
DWORD STDCALL
DosPathToSessionPathA (DWORD SessionId, LPSTR InPath, LPSTR * OutPath)
{
//DosPathToSessionPathW (SessionId,InPathW,OutPathW);
return 0;
}
/*
* @implemented
*/
BOOL STDCALL ProcessIdToSessionId (IN DWORD dwProcessId,
OUT DWORD* pSessionId)
{
NTSTATUS Status = STATUS_SUCCESS;
HANDLE ProcessHandle = INVALID_HANDLE_VALUE;
OBJECT_ATTRIBUTES Oa = { sizeof (OBJECT_ATTRIBUTES), 0, };
DWORD SessionId = 0;
if (IsBadWritePtr(pSessionId, sizeof (DWORD)))
{
/* TODO: implement TS */
*pSessionId = 0; /* no TS */
return TRUE;
SetLastError (ERROR_INVALID_DATA); //FIXME
goto ProcessIdToSessionId_FAIL_EXIT;
}
Status = NtOpenProcess (
& ProcessHandle,
PROCESS_QUERY_INFORMATION,
& Oa,
NULL);
if (!NT_SUCCESS(Status))
{
goto ProcessIdToSessionId_FAIL;
}
Status = NtQueryInformationProcess (
ProcessHandle,
ProcessSessionInformation,
& SessionId,
sizeof SessionId,
NULL);
if (!NT_SUCCESS(Status))
{
NtClose (ProcessHandle);
goto ProcessIdToSessionId_FAIL;
}
NtClose (ProcessHandle);
*pSessionId = SessionId;
return TRUE;
ProcessIdToSessionId_FAIL:
SetLastErrorByStatus(Status);
ProcessIdToSessionId_FAIL_EXIT:
return FALSE;
}
/*
* @implemented
*/
DWORD STDCALL
WTSGetActiveConsoleSessionId (VOID)
{
return ActiveConsoleSessionId;
}
/* EOF */