test: client/private.c File Reference

Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

# private.c File Reference

`#include "precomp.h"`

Go to the source code of this file.

## Typedefs

typedef HANDLE(* | PCONVPALFUNC )(HANDLE)

## Functions

BOOL WINAPI | SetConsoleCursor (IN HANDLE hConsoleOutput, IN HCURSOR hCursor)
| defined(BUILD_WOW64)
int WINAPI | ShowConsoleCursor (IN HANDLE hConsoleOutput, IN BOOL bShow)
HMENU APIENTRY | ConsoleMenuControl (IN HANDLE hConsoleOutput, IN UINT dwCommandIdLow, IN UINT dwCommandIdHigh)
BOOL APIENTRY | SetConsolePaletteInternal (IN HANDLE hConsoleOutput, IN HPALETTE hPalette, IN UINT dwUsage)
BOOL APIENTRY | SetConsoleDisplayMode (IN HANDLE hConsoleOutput, IN DWORD dwFlags, OUT PCOORD lpNewScreenBufferDimensions)
BOOL APIENTRY | RegisterConsoleVDM (IN DWORD dwRegisterFlags, IN HANDLE hStartHardwareEvent, IN HANDLE hEndHardwareEvent, IN LPWSTR lpStateSectionName, IN DWORD dwStateSectionNameLength, OUT LPDWORD lpStateLength, OUT PVOID *lpState, IN LPWSTR lpVDMBufferSectionName, IN DWORD dwVDMBufferSectionNameLength, IN COORD VDMBufferSize OPTIONAL, OUT PVOID *lpVDMBuffer)
BOOL APIENTRY | GetConsoleHardwareState (IN HANDLE hConsoleOutput, OUT PCOORD lpResolution, OUT PCOORD lpFontSize)
BOOL APIENTRY | SetConsoleHardwareState (IN HANDLE hConsoleOutput, IN COORD dwResolution, IN COORD dwFontSize)
BOOL APIENTRY | GetConsoleDisplayMode (OUT LPDWORD lpModeFlags)
BOOL APIENTRY | SetConsoleKeyShortcuts (IN BOOL bSet, IN BYTE bReserveKeys, IN LPAPPKEY lpAppKeys, IN DWORD dwNumAppKeys)
BOOL APIENTRY | SetConsoleMenuClose (IN BOOL bEnable)
BOOL | SetConsolePalette (IN HANDLE hConsoleOutput, IN HPALETTE hPalette, IN UINT dwUsage)
| defined(BUILD_WOW6432)
BOOL APIENTRY | WriteConsoleInputVDMA (HANDLE hConsoleInput, PINPUT_RECORD lpBuffer, DWORD nLength, LPDWORD lpNumberOfEventsWritten)
BOOL APIENTRY | WriteConsoleInputVDMW (HANDLE hConsoleInput, PINPUT_RECORD lpBuffer, DWORD nLength, LPDWORD lpNumberOfEventsWritten)

## Variables

PCONVPALFUNC | pfnGdiConvertPalette

## Typedef Documentation

typedef HANDLE(* PCONVPALFUNC)(HANDLE)

| Definition at line 29 of file client/private.c. Referenced by SetConsolePalette().

## Function Documentation

HMENU APIENTRY ConsoleMenuControl | ( | IN HANDLE | hConsoleOutput,
|  | IN UINT | dwCommandIdLow,
|  | IN UINT | dwCommandIdHigh
| ) |

Definition at line 138 of file client/private.c.

References _CONSOLE_MENUCONTROL_MSG::CommandIdHigh, _CONSOLE_MENUCONTROL_MSG::CommandIdLow, _CONSOLE_MENUCONTROL_MSG::ConsoleHandle, ConsolepMenuControl, CsrClientCallServer(), GET_CONSOLE_HANDLE, NULL, _CONSOLE_MENUCONTROL_MSG::OutputHandle, PCONSOLE_MENUCONTROL_MSG, and _CONSOLE_API_MSG::u.

    00146            :
    00147
    00148     Sets the command id range for the current screen buffer and returns the
    00149     menu handle.
    00150
    00151 Parameters:
    00152
    00153     hConsoleOutput - Supplies a console output handle.
    00154
    00155     dwCommandIdLow - Specifies the lowest command id to store in the input buffer.
    00156
    00157     dwCommandIdHigh - Specifies the highest command id to store in the input
    00158         buffer.
    00159
    00160 Return value:
    00161
    00162     TRUE - The operation was successful.
    00163
    00164     FALSE/NULL - The operation failed. Extended error status is available
    00165         using GetLastError.
    00166
    00167 --*/
    00168
    00169 {
    00170
    00171     CONSOLE_API_MSG m;
    00172     PCONSOLE_MENUCONTROL_MSG a = &m.u.ConsoleMenuControl;
    00173
    00174     a->ConsoleHandle = GET_CONSOLE_HANDLE;
    00175     a->OutputHandle = hConsoleOutput;
    00176     a->CommandIdLow =dwCommandIdLow;
    00177     a->CommandIdHigh = dwCommandIdHigh;
    00178     CsrClientCallServer( (PCSR_API_MSG)&m,
    00179                          NULL,
    00180                          CSR_MAKE_API_NUMBER( CONSRV_SERVERDLL_INDEX,
    00181                                               ConsolepMenuControl
    00182                                             ),
    00183                          sizeof( *a )
    00184                        );
    00185     return a->hMenu;
    00186
    00187 }

BOOL APIENTRY GetConsoleDisplayMode | ( | OUT LPDWORD | lpModeFlags | ) |

Definition at line 548 of file client/private.c.

References _CONSOLE_GETDISPLAYMODE_MSG::ConsoleHandle, ConsolepGetDisplayMode, CsrClientCallServer(), EXCEPTION_EXECUTE_HANDLER, FALSE, GET_CONSOLE_HANDLE, NT_SUCCESS, NULL, PCONSOLE_GETDISPLAYMODE_MSG, SET_LAST_ERROR, SET_LAST_NT_ERROR, TRUE, and _CONSOLE_API_MSG::u.

    00554            :
    00555
    00556     This routine returns the display mode of the console.
    00557
    00558 Parameters:
    00559
    00560     lpModeFlags - pointer to store display mode in.
    00561
    00562 Return value:
    00563
    00564     TRUE - The operation was successful.
    00565
    00566     FALSE/NULL - The operation failed. Extended error status is available
    00567         using GetLastError.
    00568
    00569 --*/
    00570
    00571 {
    00572
    00573     CONSOLE_API_MSG m;
    00574     PCONSOLE_GETDISPLAYMODE_MSG a = &m.u.GetConsoleDisplayMode;
    00575
    00576     a->ConsoleHandle = GET_CONSOLE_HANDLE;
    00577     CsrClientCallServer( (PCSR_API_MSG)&m,
    00578                          NULL,
    00579                          CSR_MAKE_API_NUMBER( CONSRV_SERVERDLL_INDEX,
    00580                                               ConsolepGetDisplayMode
    00581                                             ),
    00582                          sizeof( *a )
    00583                        );
    00584     if (!NT_SUCCESS( m.ReturnValue)) {
    00585         SET_LAST_NT_ERROR(m.ReturnValue);
    00586         return FALSE;
    00587     }
    00588     else {
    00589         try {
    00590             *lpModeFlags = a->ModeFlags;
    00591         } except( EXCEPTION_EXECUTE_HANDLER ) {
    00592             SET_LAST_ERROR(ERROR_INVALID_ACCESS);
    00593             return FALSE;
    00594         }
    00595         return TRUE;
    00596     }
    00597
    00598 }

BOOL APIENTRY GetConsoleHardwareState | ( | IN HANDLE | hConsoleOutput,
|  | OUT PCOORD | lpResolution,
|  | OUT PCOORD | lpFontSize
| ) |

Definition at line 425 of file client/private.c.

References _CONSOLE_GETHARDWARESTATE_MSG::ConsoleHandle, ConsolepGetHardwareState, CsrClientCallServer(), EXCEPTION_EXECUTE_HANDLER, FALSE, GET_CONSOLE_HANDLE, NT_SUCCESS, NULL, _CONSOLE_GETHARDWARESTATE_MSG::OutputHandle, PCONSOLE_GETHARDWARESTATE_MSG, SET_LAST_ERROR, SET_LAST_NT_ERROR, TRUE, and _CONSOLE_API_MSG::u.

    00433            :
    00434
    00435     This routine returns the video resolution and font.
    00436
    00437 Parameters:
    00438
    00439     hConsoleOutput - Supplies a console output handle.
    00440
    00441     lpResolution - Pointer to structure to store screen
    00442         resolution in.  Resolution is returned in pixels.
    00443
    00444     lpFontSize - Pointer to structure to store font size in.
    00445         Font size is returned in pixels.
    00446
    00447 Return value:
    00448
    00449     TRUE - The operation was successful.
    00450
    00451     FALSE/NULL - The operation failed. Extended error status is available
    00452         using GetLastError.
    00453
    00454 --*/
    00455
    00456 {
    00457
    00458     CONSOLE_API_MSG m;
    00459     PCONSOLE_GETHARDWARESTATE_MSG a = &m.u.GetConsoleHardwareState;
    00460
    00461     a->ConsoleHandle = GET_CONSOLE_HANDLE;
    00462     a->OutputHandle = hConsoleOutput;
    00463     CsrClientCallServer( (PCSR_API_MSG)&m,
    00464                          NULL,
    00465                          CSR_MAKE_API_NUMBER( CONSRV_SERVERDLL_INDEX,
    00466                                               ConsolepGetHardwareState
    00467                                             ),
    00468                          sizeof( *a )
    00469                        );
    00470     if (!NT_SUCCESS( m.ReturnValue)) {
    00471         SET_LAST_NT_ERROR(m.ReturnValue);
    00472         return FALSE;
    00473     }
    00474     else {
    00475         try {
    00476             *lpResolution = a->Resolution;
    00477             *lpFontSize = a->FontSize;
    00478         } except( EXCEPTION_EXECUTE_HANDLER ) {
    00479             SET_LAST_ERROR(ERROR_INVALID_ACCESS);
    00480             return FALSE;
    00481         }
    00482         return TRUE;
    00483     }
    00484
    00485 }

BOOL APIENTRY RegisterConsoleVDM | ( | IN DWORD | dwRegisterFlags,
|  | IN HANDLE | hStartHardwareEvent,
|  | IN HANDLE | hEndHardwareEvent,
|  | IN LPWSTR | lpStateSectionName,
|  | IN DWORD | dwStateSectionNameLength,
|  | OUT LPDWORD | lpStateLength,
|  | OUT PVOID * | lpState,
|  | IN LPWSTR | lpVDMBufferSectionName,
|  | IN DWORD | dwVDMBufferSectionNameLength,
|  | IN COORD VDMBufferSize | OPTIONAL,
|  | OUT PVOID * | lpVDMBuffer
| ) |

Definition at line 322 of file client/private.c.

References _CONSOLE_REGISTERVDM_MSG::ConsoleHandle, ConsolepRegisterVDM, CsrAllocateCaptureBuffer(), CsrCaptureMessageBuffer(), CsrClientCallServer(), CsrFreeCaptureBuffer(), _CONSOLE_REGISTERVDM_MSG::EndEvent, EXCEPTION_EXECUTE_HANDLER, FALSE, GET_CONSOLE_HANDLE, NT_SUCCESS, NULL, PCONSOLE_REGISTERVDM_MSG, _CONSOLE_REGISTERVDM_MSG::RegisterFlags, SET_LAST_ERROR, SET_LAST_NT_ERROR, _CONSOLE_REGISTERVDM_MSG::StartEvent, _CONSOLE_REGISTERVDM_MSG::StateSectionName, _CONSOLE_REGISTERVDM_MSG::StateSectionNameLength, TRUE, _CONSOLE_API_MSG::u, _CONSOLE_REGISTERVDM_MSG::VDMBufferSectionName, _CONSOLE_REGISTERVDM_MSG::VDMBufferSectionNameLength, and _CONSOLE_REGISTERVDM_MSG::VDMBufferSize.

    00338            :
    00339
    00340     This routine registers the VDM with the console.
    00341
    00342 Parameters:
    00343
    00344     hStartHardwareEvent - the event the VDM waits on to be
    00345         notified of gaining/losing control of the hardware.
    00346
    00347     hEndHardwareEvent - the event the VDM sets when it is done
    00348         saving/restoring the hardware.
    00349
    00350 Return value:
    00351
    00352     TRUE - The operation was successful.
    00353
    00354     FALSE/NULL - The operation failed. Extended error status is available
    00355         using GetLastError.
    00356
    00357 --*/
    00358
    00359 {
    00360     CONSOLE_API_MSG m;
    00361     PCONSOLE_REGISTERVDM_MSG a = &m.u.RegisterConsoleVDM;
    00362     PCSR_CAPTURE_HEADER CaptureBuffer;
    00363
    00364     a->ConsoleHandle = GET_CONSOLE_HANDLE;
    00365     a->RegisterFlags = dwRegisterFlags;
    00366     if (dwRegisterFlags) {
    00367         a->StartEvent = hStartHardwareEvent;
    00368         a->EndEvent = hEndHardwareEvent;
    00369         a->VDMBufferSectionNameLength = dwVDMBufferSectionNameLength;
    00370         a->VDMBufferSize = VDMBufferSize;
    00371         a->StateSectionNameLength = dwStateSectionNameLength;
    00372         CaptureBuffer = CsrAllocateCaptureBuffer( 2,
    00373                                                   dwStateSectionNameLength+dwVDMBufferSectionNameLength
    00374                                                 );
    00375         if (CaptureBuffer == NULL) {
    00376             SET_LAST_ERROR(ERROR_NOT_ENOUGH_MEMORY);
    00377             return FALSE;
    00378         }
    00379
    00380         CsrCaptureMessageBuffer( CaptureBuffer,
    00381                                  lpStateSectionName,
    00382                                  dwStateSectionNameLength,
    00383                                  (PVOID *) &a->StateSectionName
    00384                                    );
    00385
    00386         CsrCaptureMessageBuffer( CaptureBuffer,
    00387                                  lpVDMBufferSectionName,
    00388                                  dwVDMBufferSectionNameLength,
    00389                                  (PVOID *) &a->VDMBufferSectionName
    00390                                    );
    00391     } else {
    00392         CaptureBuffer = NULL;
    00393     }
    00394     CsrClientCallServer( (PCSR_API_MSG)&m,
    00395                          CaptureBuffer,
    00396                          CSR_MAKE_API_NUMBER( CONSRV_SERVERDLL_INDEX,
    00397                                               ConsolepRegisterVDM
    00398                                             ),
    00399                          sizeof( *a )
    00400                        );
    00401     if (CaptureBuffer != NULL) {
    00402         CsrFreeCaptureBuffer( CaptureBuffer );
    00403     }
    00404     if (!NT_SUCCESS( m.ReturnValue)) {
    00405         SET_LAST_NT_ERROR(m.ReturnValue);
    00406         return FALSE;
    00407     }
    00408     else {
    00409         if (dwRegisterFlags) {
    00410             try {
    00411                 *lpStateLength = a->StateLength;
    00412                 *lpState = a->StateBuffer;
    00413                 *lpVDMBuffer = a->VDMBuffer;
    00414             } except (EXCEPTION_EXECUTE_HANDLER) {
    00415                 SET_LAST_ERROR(ERROR_INVALID_ACCESS);
    00416                 return FALSE;
    00417             }
    00418         }
    00419         return TRUE;
    00420     }
    00421 }

BOOL WINAPI SetConsoleCursor | ( | IN HANDLE | hConsoleOutput,
|  | IN HCURSOR | hCursor
| ) |

defined(BUILD_WOW64)

Definition at line 38 of file client/private.c.

References _CONSOLE_SETCURSOR_MSG::ConsoleHandle, ConsolepSetCursor, CsrClientCallServer(), _CONSOLE_SETCURSOR_MSG::CursorHandle, FALSE, GET_CONSOLE_HANDLE, NT_SUCCESS, NULL, _CONSOLE_SETCURSOR_MSG::OutputHandle, PCONSOLE_SETCURSOR_MSG, SET_LAST_NT_ERROR, TRUE, and _CONSOLE_API_MSG::u.

    00045            :
    00046
    00047     Sets the mouse pointer for the specified screen buffer.
    00048
    00049 Parameters:
    00050
    00051     hConsoleOutput - Supplies a console output handle.
    00052
    00053     hCursor - win32 cursor handle, should be NULL to set the default
    00054         cursor.
    00055
    00056 Return value:
    00057
    00058     TRUE - The operation was successful.
    00059
    00060     FALSE/NULL - The operation failed. Extended error status is available
    00061         using GetLastError.
    00062
    00063 --*/
    00064
    00065 {
    00066
    00067     CONSOLE_API_MSG m;
    00068     PCONSOLE_SETCURSOR_MSG a = &m.u.SetConsoleCursor;
    00069
    00070     a->ConsoleHandle = GET_CONSOLE_HANDLE;
    00071     a->OutputHandle = hConsoleOutput;
    00072     a->CursorHandle = hCursor;
    00073     CsrClientCallServer( (PCSR_API_MSG)&m,
    00074                          NULL,
    00075                          CSR_MAKE_API_NUMBER( CONSRV_SERVERDLL_INDEX,
    00076                                               ConsolepSetCursor
    00077                                             ),
    00078                          sizeof( *a )
    00079                        );
    00080     if (!NT_SUCCESS( m.ReturnValue)) {
    00081         SET_LAST_NT_ERROR(m.ReturnValue);
    00082         return FALSE;
    00083     }
    00084     else {
    00085         return TRUE;
    00086     }
    00087
    00088 }

BOOL APIENTRY SetConsoleDisplayMode | ( | IN HANDLE | hConsoleOutput,
|  | IN DWORD | dwFlags,
|  | OUT PCOORD | lpNewScreenBufferDimensions
| ) |

Definition at line 225 of file client/private.c.

References _CONSOLE_SETDISPLAYMODE_MSG::ConsoleHandle, ConsolepSetDisplayMode, CsrClientCallServer(), dwFlags, _CONSOLE_SETDISPLAYMODE_MSG::dwFlags, EXCEPTION_EXECUTE_HANDLER, FALSE, GET_CONSOLE_HANDLE, _CONSOLE_SETDISPLAYMODE_MSG::hEvent, NT_SUCCESS, NtClose(), NtCreateEvent(), NTSTATUS(), NtWaitForSingleObject(), NULL, _CONSOLE_SETDISPLAYMODE_MSG::OutputHandle, PCONSOLE_SETDISPLAYMODE_MSG, SET_LAST_ERROR, SET_LAST_NT_ERROR, Status, TRUE, and _CONSOLE_API_MSG::u.

    00233            :
    00234
    00235     This routine sets the console display mode for an output buffer.
    00236     This API is only supported on x86 machines.  Frame buffer consoles
    00237     are always windowed.
    00238
    00239 Parameters:
    00240
    00241     hConsoleOutput - Supplies a console output handle.
    00242
    00243     dwFlags - Specifies the display mode. Options are:
    00244
    00245         CONSOLE_FULLSCREEN_MODE - data is displayed fullscreen
    00246
    00247         CONSOLE_WINDOWED_MODE - data is displayed in a window
    00248
    00249     lpNewScreenBufferDimensions - On output, contains the new dimensions of
    00250         the screen buffer.  The dimensions are in rows and columns for
    00251         textmode screen buffers.
    00252 Return value:
    00253
    00254     TRUE - The operation was successful.
    00255
    00256     FALSE/NULL - The operation failed. Extended error status is available
    00257         using GetLastError.
    00258
    00259 --*/
    00260
    00261 {
    00262
    00263     CONSOLE_API_MSG m;
    00264     PCONSOLE_SETDISPLAYMODE_MSG a = &m.u.SetConsoleDisplayMode;
    00265     NTSTATUS Status;
    00266
    00267 #if !defined(_X86_)
    00268     return FALSE;
    00269 #else
    00270
    00271     Status = NtCreateEvent(&(a->hEvent),
    00272                            EVENT_ALL_ACCESS,
    00273                            NULL,
    00274                            SynchronizationEvent,
    00275                            (BOOLEAN)FALSE
    00276                            );
    00277     if (!NT_SUCCESS(Status)) {
    00278        SET_LAST_NT_ERROR(Status);
    00279        return FALSE;
    00280     }
    00281
    00282     a->ConsoleHandle = GET_CONSOLE_HANDLE;
    00283     a->OutputHandle = hConsoleOutput;
    00284     a->dwFlags = dwFlags;
    00285
    00286     CsrClientCallServer( (PCSR_API_MSG)&m,
    00287                          NULL,
    00288                          CSR_MAKE_API_NUMBER( CONSRV_SERVERDLL_INDEX,
    00289                                               ConsolepSetDisplayMode
    00290                                             ),
    00291                          sizeof( *a )
    00292                        );
    00293     if (!NT_SUCCESS( m.ReturnValue)) {
    00294         SET_LAST_NT_ERROR(m.ReturnValue);
    00295         NtClose(a->hEvent);
    00296         return FALSE;
    00297
    00298     }
    00299     else {
    00300              Status = NtWaitForSingleObject(a->hEvent, FALSE, NULL);
    00301         NtClose(a->hEvent);
    00302
    00303          if (Status != 0) {
    00304             SET_LAST_NT_ERROR(Status);
    00305             return FALSE;
    00306          }
    00307         try {
    00308             *lpNewScreenBufferDimensions = a->ScreenBufferDimensions;
    00309         } except( EXCEPTION_EXECUTE_HANDLER ) {
    00310             SET_LAST_ERROR(ERROR_INVALID_ACCESS);
    00311             return FALSE;
    00312         }
    00313         return TRUE;
    00314     }
    00315
    00316 #endif
    00317
    00318 }

BOOL APIENTRY SetConsoleHardwareState | ( | IN HANDLE | hConsoleOutput,
|  | IN COORD | dwResolution,
|  | IN COORD | dwFontSize
| ) |

Definition at line 489 of file client/private.c.

References _CONSOLE_SETHARDWARESTATE_MSG::ConsoleHandle, ConsolepSetHardwareState, CsrClientCallServer(), FALSE, _CONSOLE_SETHARDWARESTATE_MSG::FontSize, GET_CONSOLE_HANDLE, NT_SUCCESS, NULL, _CONSOLE_SETHARDWARESTATE_MSG::OutputHandle, PCONSOLE_SETHARDWARESTATE_MSG, _CONSOLE_SETHARDWARESTATE_MSG::Resolution, SET_LAST_NT_ERROR, TRUE, and _CONSOLE_API_MSG::u.

    00497            :
    00498
    00499     This routine set the video resolution and font.
    00500
    00501 Parameters:
    00502
    00503     hConsoleOutput - Supplies a console output handle.
    00504
    00505     dwResolution - Contains screen resolution to set.
    00506         Resolution is returned in pixels.
    00507
    00508     dwFontSize - Contains font size to set.
    00509         Font size is returned in pixels.
    00510
    00511 Return value:
    00512
    00513     TRUE - The operation was successful.
    00514
    00515     FALSE/NULL - The operation failed. Extended error status is available
    00516         using GetLastError.
    00517
    00518 --*/
    00519
    00520 {
    00521
    00522     CONSOLE_API_MSG m;
    00523     PCONSOLE_SETHARDWARESTATE_MSG a = &m.u.SetConsoleHardwareState;
    00524
    00525     a->ConsoleHandle = GET_CONSOLE_HANDLE;
    00526     a->OutputHandle = hConsoleOutput;
    00527     a->Resolution = dwResolution;
    00528     a->FontSize = dwFontSize;
    00529     CsrClientCallServer( (PCSR_API_MSG)&m,
    00530                          NULL,
    00531                          CSR_MAKE_API_NUMBER( CONSRV_SERVERDLL_INDEX,
    00532                                               ConsolepSetHardwareState
    00533                                             ),
    00534                          sizeof( *a )
    00535                        );
    00536     if (!NT_SUCCESS( m.ReturnValue)) {
    00537         SET_LAST_NT_ERROR(m.ReturnValue);
    00538         return FALSE;
    00539     }
    00540     else {
    00541         return TRUE;
    00542     }
    00543
    00544 }

BOOL APIENTRY SetConsoleKeyShortcuts | ( | IN BOOL | bSet,
|  | IN BYTE | bReserveKeys,
|  | IN LPAPPKEY | lpAppKeys,
|  | IN DWORD | dwNumAppKeys
| ) |

Definition at line 602 of file client/private.c.

References _CONSOLE_SETKEYSHORTCUTS_MSG::AppKeys, _CONSOLE_SETKEYSHORTCUTS_MSG::ConsoleHandle, ConsolepSetKeyShortcuts, CsrAllocateCaptureBuffer(), CsrCaptureMessageBuffer(), CsrClientCallServer(), CsrFreeCaptureBuffer(), FALSE, GET_CONSOLE_HANDLE, NT_SUCCESS, NULL, _CONSOLE_SETKEYSHORTCUTS_MSG::NumAppKeys, PCONSOLE_SETKEYSHORTCUTS_MSG, _CONSOLE_SETKEYSHORTCUTS_MSG::ReserveKeys, _CONSOLE_SETKEYSHORTCUTS_MSG::Set, SET_LAST_ERROR, SET_LAST_NT_ERROR, TRUE, and _CONSOLE_API_MSG::u.

    00611            :
    00612
    00613     Only one set of key shortcuts is valid per console.  Calling
    00614     SetConsoleKeyShortcuts(set) overwrites any previous settings.
    00615     SetConsoleKeyShortcuts(!set) removes any shortcuts.
    00616
    00617 Parameters:
    00618
    00619     bSet - if TRUE, set shortcuts.  else remove shortcuts.
    00620
    00621     bReserveKeys - byte containing reserve key info.
    00622
    00623     lpAppKeys - pointer to application-defined shortcut keys.  can be null.
    00624
    00625     dwNumAppKeys - number of app keys contained in lpAppKeys.
    00626
    00627 Return value:
    00628
    00629     TRUE - The operation was successful.
    00630
    00631     FALSE/NULL - The operation failed. Extended error status is available
    00632         using GetLastError.
    00633
    00634 --*/
    00635
    00636 {
    00637
    00638     CONSOLE_API_MSG m;
    00639     PCONSOLE_SETKEYSHORTCUTS_MSG a = &m.u.SetConsoleKeyShortcuts;
    00640     PCSR_CAPTURE_HEADER CaptureBuffer;
    00641
    00642     a->ConsoleHandle = GET_CONSOLE_HANDLE;
    00643     a->Set = bSet;
    00644     a->ReserveKeys = bReserveKeys;
    00645     if (lpAppKeys == NULL) {
    00646         a->NumAppKeys = 0;
    00647         CaptureBuffer = NULL;
    00648     } else {
    00649         a->NumAppKeys = dwNumAppKeys;
    00650         CaptureBuffer = CsrAllocateCaptureBuffer( 1,
    00651                                                   dwNumAppKeys * sizeof(APPKEY)
    00652                                                 );
    00653         if (CaptureBuffer == NULL) {
    00654             SET_LAST_ERROR(ERROR_NOT_ENOUGH_MEMORY);
    00655             return FALSE;
    00656         }
    00657         CsrCaptureMessageBuffer( CaptureBuffer,
    00658                                  lpAppKeys,
    00659                                  dwNumAppKeys * sizeof(APPKEY),
    00660                                  (PVOID *) &a->AppKeys
    00661                                );
    00662     }
    00663
    00664     CsrClientCallServer( (PCSR_API_MSG)&m,
    00665                          CaptureBuffer,
    00666                          CSR_MAKE_API_NUMBER( CONSRV_SERVERDLL_INDEX,
    00667                                               ConsolepSetKeyShortcuts
    00668                                             ),
    00669                          sizeof( *a )
    00670                        );
    00671     if (CaptureBuffer)
    00672         CsrFreeCaptureBuffer( CaptureBuffer );
    00673     if (!NT_SUCCESS( m.ReturnValue)) {
    00674         SET_LAST_NT_ERROR(m.ReturnValue);
    00675         return FALSE;
    00676     }
    00677     else {
    00678         return TRUE;
    00679     }
    00680
    00681 }

BOOL APIENTRY SetConsoleMenuClose | ( | IN BOOL | bEnable | ) |

Definition at line 685 of file client/private.c.

References _CONSOLE_SETMENUCLOSE_MSG::ConsoleHandle, ConsolepSetMenuClose, CsrClientCallServer(), _CONSOLE_SETMENUCLOSE_MSG::Enable, FALSE, GET_CONSOLE_HANDLE, NT_SUCCESS, NULL, PCONSOLE_SETMENUCLOSE_MSG, SET_LAST_NT_ERROR, TRUE, and _CONSOLE_API_MSG::u.

    00691            :
    00692
    00693     This routine returns the display mode of the console.
    00694
    00695 Parameters:
    00696
    00697     bEnable - if TRUE, close is enabled in the system menu.
    00698
    00699 Return value:
    00700
    00701     TRUE - The operation was successful.
    00702
    00703     FALSE/NULL - The operation failed. Extended error status is available
    00704         using GetLastError.
    00705
    00706 --*/
    00707
    00708 {
    00709
    00710     CONSOLE_API_MSG m;
    00711     PCONSOLE_SETMENUCLOSE_MSG a = &m.u.SetConsoleMenuClose;
    00712
    00713     a->ConsoleHandle = GET_CONSOLE_HANDLE;
    00714     a->Enable = bEnable;
    00715     CsrClientCallServer( (PCSR_API_MSG)&m,
    00716                          NULL,
    00717                          CSR_MAKE_API_NUMBER( CONSRV_SERVERDLL_INDEX,
    00718                                               ConsolepSetMenuClose
    00719                                             ),
    00720                          sizeof( *a )
    00721                        );
    00722     if (!NT_SUCCESS( m.ReturnValue)) {
    00723         SET_LAST_NT_ERROR(m.ReturnValue);
    00724         return FALSE;
    00725     }
    00726     else {
    00727         return TRUE;
    00728     }
    00729
    00730 }

BOOL SetConsolePalette | ( | IN HANDLE | hConsoleOutput,
|  | IN HPALETTE | hPalette,
|  | IN UINT | dwUsage
| ) |

defined(BUILD_WOW6432)

Definition at line 737 of file client/private.c.

References FALSE, L, LdrLoadDll(), NT_SUCCESS, NTSTATUS(), NULL, PCONVPALFUNC, pfnGdiConvertPalette, RtlInitUnicodeString(), SET_LAST_NT_ERROR, SetConsolePaletteInternal(), and Status.

Referenced by main().

    00745            :
    00746
    00747     Sets the palette for the console screen buffer.
    00748
    00749 Parameters:
    00750
    00751     hOutput - Supplies a console output handle.
    00752
    00753     hPalette - Supplies a handle to the palette to set.
    00754
    00755     dwUsage - Specifies use of the system palette.
    00756
    00757         SYSPAL_NOSTATIC - System palette contains no static colors
    00758                           except black and white.
    00759
    00760         SYSPAL_STATIC -   System palette contains static colors
    00761                           which will not change when an application
    00762                           realizes its logical palette.
    00763
    00764 Return value:
    00765
    00766     TRUE - The operation was successful.
    00767
    00768     FALSE/NULL - The operation failed. Extended error status is available
    00769         using GetLastError.
    00770
    00771 --*/
    00772
    00773 {
    00774
    00775     HANDLE hmodGdi;
    00776     UNICODE_STRING ModuleNameString;
    00777     NTSTATUS Status;
    00778
    00779     if ( !pfnGdiConvertPalette ) {
    00780         RtlInitUnicodeString( &ModuleNameString, L"gdi32" );
    00781         Status = LdrLoadDll( UNICODE_NULL, NULL, &ModuleNameString, &hmodGdi );
    00782         if ( !NT_SUCCESS(Status) ) {
    00783             SET_LAST_NT_ERROR(Status);
    00784             return FALSE;
    00785             }
    00786         pfnGdiConvertPalette = (PCONVPALFUNC)GetProcAddress(hmodGdi, "GdiConvertPalette");
    00787         if (pfnGdiConvertPalette == NULL) {
    00788             SET_LAST_NT_ERROR(STATUS_PROCEDURE_NOT_FOUND);
    00789             return FALSE;
    00790             }
    00791
    00792         }
    00793
    00794     hPalette = (*pfnGdiConvertPalette)(hPalette);
    00795
    00796     return SetConsolePaletteInternal(hConsoleOutput,
    00797                                      hPalette,
    00798                                      dwUsage);
    00799 }

BOOL APIENTRY SetConsolePaletteInternal | ( | IN HANDLE | hConsoleOutput,
|  | IN HPALETTE | hPalette,
|  | IN UINT | dwUsage
| ) |

Definition at line 191 of file client/private.c.

References _CONSOLE_SETPALETTE_MSG::ConsoleHandle, ConsolepSetPalette, CsrClientCallServer(), _CONSOLE_SETPALETTE_MSG::dwUsage, FALSE, GET_CONSOLE_HANDLE, _CONSOLE_SETPALETTE_MSG::hPalette, NT_SUCCESS, NTSTATUS(), NULL, _CONSOLE_SETPALETTE_MSG::OutputHandle, PCONSOLE_SETPALETTE_MSG, SET_LAST_NT_ERROR, Status, TRUE, and _CONSOLE_API_MSG::u.

Referenced by SetConsolePalette().

    00196 {
    00197
    00198     CONSOLE_API_MSG m;
    00199     PCONSOLE_SETPALETTE_MSG a = &m.u.SetConsolePalette;
    00200     NTSTATUS Status;
    00201
    00202     a->ConsoleHandle = GET_CONSOLE_HANDLE;
    00203     a->OutputHandle = hConsoleOutput;
    00204     a->hPalette = hPalette;
    00205     a->dwUsage = dwUsage;
    00206     CsrClientCallServer( (PCSR_API_MSG)&m,
    00207                          NULL,
    00208                          CSR_MAKE_API_NUMBER( CONSRV_SERVERDLL_INDEX,
    00209                                               ConsolepSetPalette
    00210                                             ),
    00211                          sizeof( *a )
    00212                        );
    00213     if (!NT_SUCCESS( m.ReturnValue)) {
    00214         SET_LAST_NT_ERROR(m.ReturnValue);
    00215         return FALSE;
    00216     }
    00217     else {
    00218         return TRUE;
    00219     }
    00220
    00221 }

int WINAPI ShowConsoleCursor | ( | IN HANDLE | hConsoleOutput,
|  | IN BOOL | bShow
| ) |

Definition at line 92 of file client/private.c.

References _CONSOLE_SHOWCURSOR_MSG::bShow, _CONSOLE_SHOWCURSOR_MSG::ConsoleHandle, ConsolepShowCursor, CsrClientCallServer(), GET_CONSOLE_HANDLE, NULL, _CONSOLE_SHOWCURSOR_MSG::OutputHandle, PCONSOLE_SHOWCURSOR_MSG, and _CONSOLE_API_MSG::u.

    00099            :
    00100
    00101     Sets the mouse pointer visibility counter.  If the counter is less than
    00102     zero, the mouse pointer is not shown.
    00103
    00104 Parameters:
    00105
    00106     hOutput - Supplies a console output handle.
    00107
    00108     bShow - if TRUE, the display count is to be increased. if FALSE,
    00109         decreased.
    00110
    00111 Return value:
    00112
    00113     The return value specifies the new display count.
    00114
    00115 --*/
    00116
    00117 {
    00118
    00119     CONSOLE_API_MSG m;
    00120     PCONSOLE_SHOWCURSOR_MSG a = &m.u.ShowConsoleCursor;
    00121
    00122     a->ConsoleHandle = GET_CONSOLE_HANDLE;
    00123     a->OutputHandle = hConsoleOutput;
    00124     a->bShow = bShow;
    00125     CsrClientCallServer( (PCSR_API_MSG)&m,
    00126                          NULL,
    00127                          CSR_MAKE_API_NUMBER( CONSRV_SERVERDLL_INDEX,
    00128                                               ConsolepShowCursor
    00129                                             ),
    00130                          sizeof( *a )
    00131                        );
    00132     return a->DisplayCount;
    00133
    00134 }

BOOL APIENTRY WriteConsoleInputVDMA | ( | HANDLE | hConsoleInput,
|  | PINPUT_RECORD | lpBuffer,
|  | DWORD | nLength,
|  | LPDWORD | lpNumberOfEventsWritten
| ) |

Definition at line 803 of file client/private.c.

References FALSE, and WriteConsoleInputInternal().

    00809 {
    00810     return WriteConsoleInputInternal(hConsoleInput,lpBuffer,nLength,lpNumberOfEventsWritten,FALSE,FALSE);
    00811 }

BOOL APIENTRY WriteConsoleInputVDMW | ( | HANDLE | hConsoleInput,
|  | PINPUT_RECORD | lpBuffer,
|  | DWORD | nLength,
|  | LPDWORD | lpNumberOfEventsWritten
| ) |

Definition at line 815 of file client/private.c.

References FALSE, TRUE, and WriteConsoleInputInternal().

    00821 {
    00822     return WriteConsoleInputInternal(hConsoleInput,lpBuffer,nLength,lpNumberOfEventsWritten,TRUE,FALSE);
    00823 }

## Variable Documentation

PCONVPALFUNC pfnGdiConvertPalette

| Definition at line 30 of file client/private.c. Referenced by SetConsolePalette().