mirror of
https://github.com/reactos/reactos.git
synced 2025-04-05 21:21:33 +00:00
implemented SetConsoleIcon()
svn path=/trunk/; revision=8721
This commit is contained in:
parent
b6a8d006e3
commit
e040902fff
6 changed files with 85 additions and 16 deletions
|
@ -497,6 +497,12 @@ typedef struct
|
|||
HWND WindowHandle;
|
||||
} CSRSS_CONSOLE_WINDOW, *PCSRSS_CONSOLE_WINDOW;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
HANDLE ConsoleHandle;
|
||||
HICON WindowIcon;
|
||||
} CSRSS_CONSOLE_SET_WINDOW_ICON, *PCSRSS_CONSOLE_SET_WINDOW_ICON;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
WCHAR DesktopName[1];
|
||||
|
@ -590,6 +596,7 @@ typedef struct
|
|||
#define CSRSS_CREATE_DESKTOP (0x2B)
|
||||
#define CSRSS_SHOW_DESKTOP (0x2C)
|
||||
#define CSRSS_HIDE_DESKTOP (0x2D)
|
||||
#define CSRSS_SET_CONSOLE_ICON (0x2E)
|
||||
|
||||
/* Keep in sync with definition below. */
|
||||
#define CSRSS_REQUEST_HEADER_SIZE (sizeof(LPC_MESSAGE) + sizeof(ULONG))
|
||||
|
@ -643,6 +650,7 @@ typedef struct
|
|||
CSRSS_CREATE_DESKTOP_REQUEST CreateDesktopRequest;
|
||||
CSRSS_SHOW_DESKTOP_REQUEST ShowDesktopRequest;
|
||||
CSRSS_HIDE_DESKTOP_REQUEST HideDesktopRequest;
|
||||
CSRSS_CONSOLE_SET_WINDOW_ICON ConsoleSetWindowIconRequest;
|
||||
} Data;
|
||||
} CSRSS_API_REQUEST, *PCSRSS_API_REQUEST;
|
||||
|
||||
|
@ -682,6 +690,7 @@ typedef struct
|
|||
CSRSS_CREATE_DESKTOP_REPLY CreateDesktopReply;
|
||||
CSRSS_SHOW_DESKTOP_REPLY ShowDesktopReply;
|
||||
CSRSS_HIDE_DESKTOP_REPLY HideDesktopReply;
|
||||
CSRSS_CONSOLE_SET_WINDOW_ICON ConsoleSetWindowIconReply;
|
||||
} Data;
|
||||
} CSRSS_API_REPLY, *PCSRSS_API_REPLY;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: console.c,v 1.73 2004/01/23 21:16:03 ekohl Exp $
|
||||
/* $Id: console.c,v 1.74 2004/03/14 17:53:26 weiden Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
|
@ -3169,7 +3169,7 @@ AttachConsole(DWORD dwProcessId)
|
|||
}
|
||||
|
||||
/*--------------------------------------------------------------
|
||||
* GetConsoleWindow/0
|
||||
* GetConsoleWindow
|
||||
*
|
||||
* @implemented
|
||||
*/
|
||||
|
@ -3196,4 +3196,32 @@ GetConsoleWindow (VOID)
|
|||
return Reply.Data.ConsoleWindowReply.WindowHandle;
|
||||
}
|
||||
|
||||
|
||||
/*--------------------------------------------------------------
|
||||
* GetConsoleWindow
|
||||
* @implemented
|
||||
*/
|
||||
BOOL STDCALL SetConsoleIcon(HICON hicon)
|
||||
{
|
||||
CSRSS_API_REQUEST Request;
|
||||
CSRSS_API_REPLY Reply;
|
||||
NTSTATUS Status;
|
||||
|
||||
Request.Data.ConsoleSetWindowIconRequest.ConsoleHandle =
|
||||
OpenConsoleW (L"CONOUT$", (GENERIC_READ|GENERIC_WRITE), FALSE, OPEN_EXISTING);
|
||||
if (INVALID_HANDLE_VALUE == Request.Data.ConsoleSetWindowIconRequest.ConsoleHandle)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
Request.Type = CSRSS_SET_CONSOLE_ICON;
|
||||
Request.Data.ConsoleSetWindowIconRequest.WindowIcon = hicon;
|
||||
Status = CsrClientCallServer( &Request, &Reply, sizeof( CSRSS_API_REQUEST ), sizeof( CSRSS_API_REPLY ) );
|
||||
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Reply.Status))
|
||||
{
|
||||
SetLastErrorByStatus (Status);
|
||||
return FALSE;
|
||||
}
|
||||
return NT_SUCCESS(Status);
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: stubs.c,v 1.66 2004/03/14 13:20:10 weiden Exp $
|
||||
/* $Id: stubs.c,v 1.67 2004/03/14 17:53:26 weiden Exp $
|
||||
*
|
||||
* KERNEL32.DLL stubs (unimplemented functions)
|
||||
* Remove from this file, if you implement them.
|
||||
|
@ -2388,15 +2388,6 @@ BOOL STDCALL GetConsoleKeyboardLayoutNameW(LPWSTR name)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
BOOL STDCALL SetConsoleIcon(HICON hicon)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: conio.h,v 1.2 2004/01/11 17:31:15 gvg Exp $
|
||||
/* $Id: conio.h,v 1.3 2004/03/14 17:53:27 weiden Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
|
@ -58,6 +58,7 @@ typedef struct tagCSRSS_CONSOLE_VTBL
|
|||
UINT OldCursorX, UINT OldCursorY);
|
||||
BOOL (STDCALL *ChangeTitle)(PCSRSS_CONSOLE Console);
|
||||
VOID (STDCALL *CleanupConsole)(PCSRSS_CONSOLE Console);
|
||||
BOOL (STDCALL *ChangeIcon)(PCSRSS_CONSOLE Console);
|
||||
} CSRSS_CONSOLE_VTBL, *PCSRSS_CONSOLE_VTBL;
|
||||
|
||||
typedef struct tagCSRSS_CONSOLE
|
||||
|
@ -80,6 +81,7 @@ typedef struct tagCSRSS_CONSOLE
|
|||
BOOL EarlyReturn; /* wake client and return data, even if we are in line buffered mode, and we don't have a complete line */
|
||||
DWORD HardwareState; /* _GDI_MANAGED, _DIRECT */
|
||||
HWND hWindow;
|
||||
HICON hWindowIcon;
|
||||
COORD Size;
|
||||
PVOID PrivateData;
|
||||
PCSRSS_CONSOLE_VTBL Vtbl;
|
||||
|
@ -129,6 +131,7 @@ CSR_API(CsrReadConsoleOutput);
|
|||
CSR_API(CsrWriteConsoleInput);
|
||||
CSR_API(CsrHardwareStateProperty);
|
||||
CSR_API(CsrGetConsoleWindow);
|
||||
CSR_API(CsrSetConsoleIcon);
|
||||
|
||||
#define ConioInitScreenBuffer(Console, Buff) (Console)->Vtbl->InitScreenBuffer((Console), (Buff))
|
||||
#define ConioDrawRegion(Console, Region) (Console)->Vtbl->DrawRegion((Console), (Region))
|
||||
|
@ -154,6 +157,7 @@ CSR_API(CsrGetConsoleWindow);
|
|||
Win32CsrLockObject((ProcessData), (Handle), (Object_t **)(Ptr), CONIO_SCREEN_BUFFER_MAGIC)
|
||||
#define ConioUnlockScreenBuffer(Buff) \
|
||||
Win32CsrUnlockObject((Object_t *) Buff)
|
||||
#define ConioChangeIcon(Console) (Console)->Vtbl->ChangeIcon(Console)
|
||||
|
||||
#endif /* CONIO_H_INCLUDED */
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: conio.c,v 1.8 2004/03/07 20:03:43 hbirr Exp $
|
||||
/* $Id: conio.c,v 1.9 2004/03/14 17:53:27 weiden Exp $
|
||||
*
|
||||
* reactos/subsys/csrss/win32csr/conio.c
|
||||
*
|
||||
|
@ -2873,4 +2873,31 @@ CSR_API(CsrGetConsoleWindow)
|
|||
return Reply->Status = STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
CSR_API(CsrSetConsoleIcon)
|
||||
{
|
||||
PCSRSS_CONSOLE Console;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("CsrSetConsoleIcon\n");
|
||||
|
||||
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
|
||||
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - sizeof(LPC_MESSAGE);
|
||||
|
||||
Status = ConioLockConsole(ProcessData,
|
||||
Request->Data.ConsoleSetWindowIconRequest.ConsoleHandle,
|
||||
&Console);
|
||||
if (! NT_SUCCESS(Status))
|
||||
{
|
||||
return Reply->Status = Status;
|
||||
}
|
||||
|
||||
Console->hWindowIcon = Request->Data.ConsoleSetWindowIconRequest.WindowIcon;
|
||||
Reply->Status = (ConioChangeIcon(Console) ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL);
|
||||
Reply->Data.ConsoleSetWindowIconReply.WindowIcon = Console->hWindow;
|
||||
|
||||
ConioUnlockConsole(Console);
|
||||
|
||||
return Reply->Status;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: guiconsole.c,v 1.11 2004/03/07 21:00:11 hbirr Exp $
|
||||
/* $Id: guiconsole.c,v 1.12 2004/03/14 17:53:27 weiden Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
|
@ -717,6 +717,15 @@ GuiChangeTitle(PCSRSS_CONSOLE Console)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
STATIC BOOL STDCALL
|
||||
GuiChangeIcon(PCSRSS_CONSOLE Console)
|
||||
{
|
||||
SendMessageW(Console->hWindow, WM_SETICON, ICON_BIG, (LPARAM)Console->hWindowIcon);
|
||||
SendMessageW(Console->hWindow, WM_SETICON, ICON_SMALL, (LPARAM)Console->hWindowIcon);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static VOID STDCALL
|
||||
GuiCleanupConsole(PCSRSS_CONSOLE Console)
|
||||
{
|
||||
|
@ -731,7 +740,8 @@ static CSRSS_CONSOLE_VTBL GuiVtbl =
|
|||
GuiSetCursorInfo,
|
||||
GuiSetScreenInfo,
|
||||
GuiChangeTitle,
|
||||
GuiCleanupConsole
|
||||
GuiCleanupConsole,
|
||||
GuiChangeIcon
|
||||
};
|
||||
|
||||
NTSTATUS FASTCALL
|
||||
|
|
Loading…
Reference in a new issue