[KERNEL32]: Fix bugs #4, #5, #6. CreateJobObjectA was building a dynamic string isntead of using the TEB. It was also not returning the right error code in case of error. It was also allowing jobs to have names past 260 characters. Fixed by using the ConvertWin32AnsiObjectApiToUnicodeApi macro from 5-6 revisions ago.

svn path=/trunk/; revision=52787
This commit is contained in:
Alex Ionescu 2011-07-23 00:30:56 +00:00
parent 59a6314a13
commit 19366d1781

View file

@ -27,32 +27,8 @@ WINAPI
CreateJobObjectA(LPSECURITY_ATTRIBUTES lpJobAttributes,
LPCSTR lpName)
{
HANDLE hJob;
ANSI_STRING AnsiName;
UNICODE_STRING UnicodeName;
if (lpName != NULL)
{
NTSTATUS Status;
RtlInitAnsiString(&AnsiName, lpName);
Status = RtlAnsiStringToUnicodeString(&UnicodeName, &AnsiName, TRUE);
if (!NT_SUCCESS(Status))
{
SetLastErrorByStatus(Status);
return FALSE;
}
}
hJob = CreateJobObjectW(lpJobAttributes,
((lpName != NULL) ? UnicodeName.Buffer : NULL));
if (lpName != NULL)
{
RtlFreeUnicodeString(&UnicodeName);
}
return hJob;
/* Call the W(ide) function */
ConvertWin32AnsiObjectApiToUnicodeApi(JobObject, lpName, lpJobAttributes);
}