Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
627f2b35
Commit
627f2b35
authored
Sep 30, 2022
by
Hugh McMaster
Committed by
Alexandre Julliard
Oct 10, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernelbase: Return full title length from GetConsoleTitle().
parent
e6bea032
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
16 deletions
+37
-16
console.c
dlls/kernel32/tests/console.c
+3
-3
console.c
dlls/kernelbase/console.c
+19
-9
condrv.h
include/wine/condrv.h
+7
-0
conhost.c
programs/conhost/conhost.c
+8
-4
No files found.
dlls/kernel32/tests/console.c
View file @
627f2b35
...
...
@@ -4272,12 +4272,12 @@ static void test_GetConsoleTitleW(void)
ret
=
GetConsoleTitleW
(
buf
,
ARRAY_SIZE
(
buf
));
ok
(
ret
,
"GetConsoleTitleW failed: %lu
\n
"
,
GetLastError
());
todo_wine
ok
(
ret
==
wcslen
(
str
),
"Got string length %lu, expected %Iu
\n
"
,
ret
,
wcslen
(
str
));
ok
(
ret
==
wcslen
(
str
),
"Got string length %lu, expected %Iu
\n
"
,
ret
,
wcslen
(
str
));
ok
(
!
wcscmp
(
buf
,
str
),
"Title = %s
\n
"
,
wine_dbgstr_w
(
buf
));
ret
=
GetConsoleTitleW
(
buf
,
2
);
ok
(
ret
,
"GetConsoleTitleW failed: %lu
\n
"
,
GetLastError
());
todo_wine
ok
(
ret
==
wcslen
(
str
),
"Got string length %lu, expected %Iu
\n
"
,
ret
,
wcslen
(
str
));
ok
(
ret
==
wcslen
(
str
),
"Got string length %lu, expected %Iu
\n
"
,
ret
,
wcslen
(
str
));
if
(
!
skip_nt
)
ok
(
!
wcscmp
(
buf
,
L"t"
),
"Title = %s
\n
"
,
wine_dbgstr_w
(
buf
));
ret
=
GetConsoleTitleW
(
buf
,
4
);
...
...
@@ -4289,7 +4289,7 @@ static void test_GetConsoleTitleW(void)
ok
(
ret
,
"SetConsoleTitleW failed: %lu
\n
"
,
GetLastError
());
ret
=
GetConsoleTitleW
(
buf
,
ARRAY_SIZE
(
buf
));
todo_wine
ok
(
!
ret
,
"Unexpected string length; error %lu
\n
"
,
GetLastError
());
ok
(
!
ret
,
"Unexpected string length; error %lu
\n
"
,
GetLastError
());
}
static
void
test_file_info
(
HANDLE
input
,
HANDLE
output
)
...
...
dlls/kernelbase/console.c
View file @
627f2b35
...
...
@@ -1012,12 +1012,11 @@ DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleTitleA( LPSTR title, DWORD size )
DWORD
ret
;
if
(
!
ptr
)
return
0
;
ret
=
GetConsoleTitleW
(
ptr
,
size
);
if
(
ret
)
{
WideCharToMultiByte
(
GetConsoleOutputCP
(),
0
,
ptr
,
ret
+
1
,
title
,
size
,
NULL
,
NULL
);
ret
=
strlen
(
title
);
}
WideCharToMultiByte
(
GetConsoleOutputCP
(),
0
,
ptr
,
-
1
,
title
,
size
,
NULL
,
NULL
);
HeapFree
(
GetProcessHeap
(),
0
,
ptr
);
return
ret
;
}
...
...
@@ -1028,15 +1027,26 @@ DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleTitleA( LPSTR title, DWORD size )
*/
DWORD
WINAPI
DECLSPEC_HOTPATCH
GetConsoleTitleW
(
LPWSTR
title
,
DWORD
size
)
{
if
(
!
size
)
return
0
;
struct
condrv_title_params
*
params
;
size_t
max_size
=
sizeof
(
*
params
)
+
(
size
-
1
)
*
sizeof
(
WCHAR
);
if
(
!
title
||
!
size
)
return
0
;
if
(
!
(
params
=
HeapAlloc
(
GetProcessHeap
(),
0
,
max_size
)))
return
0
;
if
(
!
console_ioctl
(
RtlGetCurrentPeb
()
->
ProcessParameters
->
ConsoleHandle
,
IOCTL_CONDRV_GET_TITLE
,
NULL
,
0
,
title
,
(
size
-
1
)
*
sizeof
(
WCHAR
)
,
&
size
))
NULL
,
0
,
params
,
max_size
,
&
size
))
return
0
;
size
/=
sizeof
(
WCHAR
);
title
[
size
]
=
0
;
return
size
+
1
;
if
(
size
<
sizeof
(
*
params
))
return
0
;
size
-=
sizeof
(
*
params
);
memcpy
(
title
,
params
->
buffer
,
size
);
title
[
size
/
sizeof
(
WCHAR
)
]
=
0
;
size
=
params
->
title_len
;
HeapFree
(
GetProcessHeap
(),
0
,
params
);
return
size
;
}
...
...
include/wine/condrv.h
View file @
627f2b35
...
...
@@ -159,6 +159,13 @@ struct condrv_output_info_params
#define SET_CONSOLE_OUTPUT_INFO_POPUP_ATTR 0x0040
#define SET_CONSOLE_OUTPUT_INFO_FONT 0x0080
/* IOCTL_CONDRV_GET_TITLE params */
struct
condrv_title_params
{
unsigned
int
title_len
;
WCHAR
buffer
[
1
];
};
/* IOCTL_CONDRV_FILL_OUTPUT params */
struct
condrv_fill_output_params
{
...
...
programs/conhost/conhost.c
View file @
627f2b35
...
...
@@ -2675,12 +2675,16 @@ static NTSTATUS console_input_ioctl( struct console *console, unsigned int code,
case
IOCTL_CONDRV_GET_TITLE
:
{
WCHAR
*
result
;
size_t
title_len
,
str_size
;
struct
condrv_title_params
*
params
;
if
(
in_size
)
return
STATUS_INVALID_PARAMETER
;
title_len
=
console
->
title
?
wcslen
(
console
->
title
)
:
0
;
str_size
=
min
(
*
out_size
-
sizeof
(
*
params
),
title_len
*
sizeof
(
WCHAR
)
);
*
out_size
=
sizeof
(
*
params
)
+
str_size
;
if
(
!
(
params
=
alloc_ioctl_buffer
(
*
out_size
)))
return
STATUS_NO_MEMORY
;
TRACE
(
"returning title %s
\n
"
,
debugstr_w
(
console
->
title
)
);
*
out_size
=
min
(
*
out_size
,
console
->
title
?
wcslen
(
console
->
title
)
*
sizeof
(
WCHAR
)
:
0
);
if
(
!
(
result
=
alloc_ioctl_buffer
(
*
out_size
)))
return
STATUS_NO_MEMORY
;
if
(
*
out_size
)
memcpy
(
result
,
console
->
title
,
*
out_size
);
if
(
str_size
)
memcpy
(
params
->
buffer
,
console
->
title
,
str_size
);
params
->
title_len
=
title_len
;
return
STATUS_SUCCESS
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment