From 19366d17810ede6d938dcac65812836241a01ab0 Mon Sep 17 00:00:00 2001 From: Alex Ionescu Date: Sat, 23 Jul 2011 00:30:56 +0000 Subject: [PATCH] [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 --- reactos/dll/win32/kernel32/client/job.c | 28 ++----------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/reactos/dll/win32/kernel32/client/job.c b/reactos/dll/win32/kernel32/client/job.c index bc7dcb5ee9e..275790b9d21 100644 --- a/reactos/dll/win32/kernel32/client/job.c +++ b/reactos/dll/win32/kernel32/client/job.c @@ -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); }