mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
implemented OpenJobObjectA/W() - untested though
svn path=/trunk/; revision=11008
This commit is contained in:
parent
c39da650dd
commit
808e28016e
1 changed files with 82 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $Id: job.c,v 1.2 2004/09/23 18:31:51 weiden Exp $
|
||||
/* $Id: job.c,v 1.3 2004/09/23 18:46:10 weiden Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
|
@ -106,6 +106,87 @@ CreateJobObjectW(LPSECURITY_ATTRIBUTES lpJobAttributes,
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
HANDLE
|
||||
STDCALL
|
||||
OpenJobObjectW(DWORD dwDesiredAccess,
|
||||
BOOL bInheritHandle,
|
||||
LPCWSTR lpName)
|
||||
{
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
UNICODE_STRING JobName;
|
||||
HANDLE hJob;
|
||||
NTSTATUS Status;
|
||||
|
||||
if(lpName == NULL)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
RtlInitUnicodeString(&JobName, lpName);
|
||||
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&JobName,
|
||||
(bInheritHandle ? OBJ_INHERIT : 0),
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
Status = NtOpenJobObject(&hJob,
|
||||
dwDesiredAccess,
|
||||
&ObjectAttributes);
|
||||
|
||||
RtlFreeUnicodeString(&JobName);
|
||||
|
||||
if(!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastErrorByStatus(Status);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return hJob;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
HANDLE
|
||||
STDCALL
|
||||
OpenJobObjectA(DWORD dwDesiredAccess,
|
||||
BOOL bInheritHandle,
|
||||
LPCSTR lpName)
|
||||
{
|
||||
ANSI_STRING AnsiName;
|
||||
UNICODE_STRING UnicodeName;
|
||||
HANDLE hJob;
|
||||
NTSTATUS Status;
|
||||
|
||||
if(lpName == NULL)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
RtlInitAnsiString(&AnsiName, lpName);
|
||||
Status = RtlAnsiStringToUnicodeString(&UnicodeName, &AnsiName, TRUE);
|
||||
if(!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastErrorByStatus(Status);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
hJob = OpenJobObjectW(dwDesiredAccess,
|
||||
bInheritHandle,
|
||||
UnicodeName.Buffer);
|
||||
|
||||
RtlFreeUnicodeString(&UnicodeName);
|
||||
return hJob;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue