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
887aa70e
Commit
887aa70e
authored
Mar 29, 2023
by
Hugh McMaster
Committed by
Alexandre Julliard
Apr 03, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernelbase: Implement GetConsoleOriginalTitleW().
parent
6891faf4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
37 deletions
+45
-37
console.c
dlls/kernel32/tests/console.c
+9
-9
console.c
dlls/kernelbase/console.c
+28
-24
conhost.c
programs/conhost/conhost.c
+8
-4
No files found.
dlls/kernel32/tests/console.c
View file @
887aa70e
...
...
@@ -4264,23 +4264,23 @@ static void test_GetConsoleOriginalTitleW(void)
ok
(
!
ret
,
"Unexpected string length; error %lu
\n
"
,
GetLastError
());
ret
=
GetConsoleOriginalTitleW
(
buf
,
ARRAY_SIZE
(
buf
));
todo_wine
ok
(
ret
,
"GetConsoleOriginalTitleW failed: %lu
\n
"
,
GetLastError
());
ok
(
ret
,
"GetConsoleOriginalTitleW failed: %lu
\n
"
,
GetLastError
());
buf
[
ret
]
=
0
;
todo_wine
ok
(
!
wcscmp
(
buf
,
title
),
"got %s, expected %s
\n
"
,
wine_dbgstr_w
(
buf
),
wine_dbgstr_w
(
title
));
todo_wine
ok
(
ret
==
title_len
,
"got %lu, expected %lu
\n
"
,
ret
,
title_len
);
ok
(
!
wcscmp
(
buf
,
title
),
"got %s, expected %s
\n
"
,
wine_dbgstr_w
(
buf
),
wine_dbgstr_w
(
title
));
ok
(
ret
==
title_len
,
"got %lu, expected %lu
\n
"
,
ret
,
title_len
);
ret
=
SetConsoleTitleW
(
L"test"
);
ok
(
ret
,
"SetConsoleTitleW failed: %lu
\n
"
,
GetLastError
());
ret
=
GetConsoleOriginalTitleW
(
buf
,
ARRAY_SIZE
(
buf
));
todo_wine
ok
(
ret
,
"GetConsoleOriginalTitleW failed: %lu
\n
"
,
GetLastError
());
todo_wine
ok
(
!
wcscmp
(
buf
,
title
),
"got %s, expected %s
\n
"
,
wine_dbgstr_w
(
buf
),
wine_dbgstr_w
(
title
));
todo_wine
ok
(
ret
==
title_len
,
"got %lu, expected %lu
\n
"
,
ret
,
title_len
);
ok
(
ret
,
"GetConsoleOriginalTitleW failed: %lu
\n
"
,
GetLastError
());
ok
(
!
wcscmp
(
buf
,
title
),
"got %s, expected %s
\n
"
,
wine_dbgstr_w
(
buf
),
wine_dbgstr_w
(
title
));
ok
(
ret
==
title_len
,
"got %lu, expected %lu
\n
"
,
ret
,
title_len
);
ret
=
GetConsoleOriginalTitleW
(
buf
,
5
);
todo_wine
ok
(
ret
,
"GetConsoleOriginalTitleW failed: %lu
\n
"
,
GetLastError
());
todo_wine
ok
(
!
wcscmp
(
buf
,
L"Orig"
),
"got %s, expected 'Orig'
\n
"
,
wine_dbgstr_w
(
buf
));
todo_wine
ok
(
ret
==
title_len
,
"got %lu, expected %lu
\n
"
,
ret
,
title_len
);
ok
(
ret
,
"GetConsoleOriginalTitleW failed: %lu
\n
"
,
GetLastError
());
ok
(
!
wcscmp
(
buf
,
L"Orig"
),
"got %s, expected 'Orig'
\n
"
,
wine_dbgstr_w
(
buf
));
ok
(
ret
==
title_len
,
"got %lu, expected %lu
\n
"
,
ret
,
title_len
);
}
static
void
test_GetConsoleOriginalTitle
(
void
)
...
...
dlls/kernelbase/console.c
View file @
887aa70e
...
...
@@ -202,6 +202,32 @@ static COORD get_console_font_size( HANDLE handle, DWORD index )
return
c
;
}
/* helper function for GetConsoleTitle and GetConsoleOriginalTitle */
static
DWORD
get_console_title
(
WCHAR
*
title
,
DWORD
size
,
BOOL
current_title
)
{
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
,
&
current_title
,
sizeof
(
current_title
),
params
,
max_size
,
&
size
)
&&
size
>=
sizeof
(
*
params
))
{
size
-=
sizeof
(
*
params
);
memcpy
(
title
,
params
->
buffer
,
size
);
title
[
size
/
sizeof
(
WCHAR
)
]
=
0
;
size
=
params
->
title_len
;
}
else
size
=
0
;
HeapFree
(
GetProcessHeap
(),
0
,
params
);
return
size
;
}
static
HANDLE
create_console_server
(
void
)
{
OBJECT_ATTRIBUTES
attr
=
{
sizeof
(
attr
)};
...
...
@@ -899,9 +925,7 @@ DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleOriginalTitleA( LPSTR title, DWORD size
*/
DWORD
WINAPI
DECLSPEC_HOTPATCH
GetConsoleOriginalTitleW
(
LPWSTR
title
,
DWORD
size
)
{
FIXME
(
": (%p, %lu) stub!
\n
"
,
title
,
size
);
SetLastError
(
ERROR_CALL_NOT_IMPLEMENTED
);
return
0
;
return
get_console_title
(
title
,
size
,
FALSE
);
}
...
...
@@ -1046,27 +1070,7 @@ DWORD WINAPI DECLSPEC_HOTPATCH GetConsoleTitleA( LPSTR title, DWORD size )
*/
DWORD
WINAPI
DECLSPEC_HOTPATCH
GetConsoleTitleW
(
LPWSTR
title
,
DWORD
size
)
{
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
,
params
,
max_size
,
&
size
)
&&
size
>=
sizeof
(
*
params
))
{
size
-=
sizeof
(
*
params
);
memcpy
(
title
,
params
->
buffer
,
size
);
title
[
size
/
sizeof
(
WCHAR
)
]
=
0
;
size
=
params
->
title_len
;
}
else
size
=
0
;
HeapFree
(
GetProcessHeap
(),
0
,
params
);
return
size
;
return
get_console_title
(
title
,
size
,
TRUE
);
}
...
...
programs/conhost/conhost.c
View file @
887aa70e
...
...
@@ -2726,15 +2726,19 @@ static NTSTATUS console_input_ioctl( struct console *console, unsigned int code,
case
IOCTL_CONDRV_GET_TITLE
:
{
BOOL
current_title
;
WCHAR
*
title
;
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
;
if
(
in_size
!=
sizeof
(
BOOL
))
return
STATUS_INVALID_PARAMETER
;
current_title
=
*
(
BOOL
*
)
in_data
;
title
=
current_title
?
console
->
title
:
console
->
title_orig
;
title_len
=
title
?
wcslen
(
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
)
);
if
(
str_size
)
memcpy
(
params
->
buffer
,
console
->
title
,
str_size
);
TRACE
(
"returning
%s %s
\n
"
,
current_title
?
"title"
:
"original title"
,
debugstr_w
(
title
)
);
if
(
str_size
)
memcpy
(
params
->
buffer
,
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