mirror of
https://github.com/reactos/reactos.git
synced 2024-07-11 23:25:09 +00:00
fix kernel32 console winetest crash
svn path=/trunk/; revision=38879
This commit is contained in:
parent
0195906a3c
commit
d068ad2d69
|
@ -3763,6 +3763,7 @@ BOOL WINAPI SetConsoleIcon(HICON hicon)
|
|||
BOOL WINAPI
|
||||
SetConsoleInputExeNameW(LPCWSTR lpInputExeName)
|
||||
{
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
int lenName = lstrlenW(lpInputExeName);
|
||||
|
||||
if(lenName < 1 ||
|
||||
|
@ -3776,8 +3777,16 @@ SetConsoleInputExeNameW(LPCWSTR lpInputExeName)
|
|||
RtlEnterCriticalSection(&ConsoleLock);
|
||||
_SEH2_TRY
|
||||
{
|
||||
RtlCopyMemory(InputExeName, lpInputExeName, lenName * sizeof(WCHAR));
|
||||
InputExeName[lenName] = L'\0';
|
||||
_SEH2_TRY
|
||||
{
|
||||
RtlCopyMemory(InputExeName, lpInputExeName, lenName * sizeof(WCHAR));
|
||||
InputExeName[lenName] = L'\0';
|
||||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
Status = _SEH2_GetExceptionCode();
|
||||
}
|
||||
_SEH2_END;
|
||||
}
|
||||
_SEH2_FINALLY
|
||||
{
|
||||
|
@ -3785,6 +3794,12 @@ SetConsoleInputExeNameW(LPCWSTR lpInputExeName)
|
|||
}
|
||||
_SEH2_END;
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastErrorByStatus(Status);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -3836,20 +3851,28 @@ SetConsoleInputExeNameA(LPCSTR lpInputExeName)
|
|||
DWORD WINAPI
|
||||
GetConsoleInputExeNameW(DWORD nBufferLength, LPWSTR lpBuffer)
|
||||
{
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
int lenName = 0;
|
||||
|
||||
RtlEnterCriticalSection(&ConsoleLock);
|
||||
|
||||
_SEH2_TRY
|
||||
{
|
||||
lenName = lstrlenW(InputExeName);
|
||||
if(lenName >= (int)nBufferLength)
|
||||
_SEH2_TRY
|
||||
{
|
||||
/* buffer is not large enough, return the required size */
|
||||
SetLastError(ERROR_BUFFER_OVERFLOW);
|
||||
lenName += 1;
|
||||
lenName = lstrlenW(InputExeName);
|
||||
if(lenName >= (int)nBufferLength)
|
||||
{
|
||||
/* buffer is not large enough, return the required size */
|
||||
SetLastError(ERROR_BUFFER_OVERFLOW);
|
||||
lenName += 1;
|
||||
}
|
||||
RtlCopyMemory(lpBuffer, InputExeName, (lenName + 1) * sizeof(WCHAR));
|
||||
}
|
||||
RtlCopyMemory(lpBuffer, InputExeName, (lenName + 1) * sizeof(WCHAR));
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
Status = _SEH2_GetExceptionCode();
|
||||
}
|
||||
_SEH2_END;
|
||||
}
|
||||
_SEH2_FINALLY
|
||||
{
|
||||
|
@ -3857,6 +3880,12 @@ GetConsoleInputExeNameW(DWORD nBufferLength, LPWSTR lpBuffer)
|
|||
}
|
||||
_SEH2_END;
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastError(ERROR_BUFFER_OVERFLOW);
|
||||
return lenName + 1;
|
||||
}
|
||||
|
||||
return lenName;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue