https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a9064d328396837a09d93…
commit a9064d328396837a09d939372884b16fa88106f8
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Wed Aug 8 20:38:41 2018 +0200
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Wed Aug 8 20:46:34 2018 +0200
[CONSRV] Add a PasteText() helper function and use it.
---
win32ss/user/winsrv/consrv/frontends/gui/text.c | 124 +++++++++++++-----------
1 file changed, 68 insertions(+), 56 deletions(-)
diff --git a/win32ss/user/winsrv/consrv/frontends/gui/text.c b/win32ss/user/winsrv/consrv/frontends/gui/text.c
index 8e6e870399..57009fd128 100644
--- a/win32ss/user/winsrv/consrv/frontends/gui/text.c
+++ b/win32ss/user/winsrv/consrv/frontends/gui/text.c
@@ -225,6 +225,69 @@ CopyLines(PTEXTMODE_SCREEN_BUFFER Buffer,
}
+VOID
+PasteText(
+ IN PCONSRV_CONSOLE Console,
+ IN PWCHAR Buffer,
+ IN SIZE_T cchSize)
+{
+ USHORT VkKey; // MAKEWORD(low = vkey_code, high = shift_state);
+ INPUT_RECORD er;
+ WCHAR CurChar = 0;
+
+ /* Do nothing if we have nothing to paste */
+ if (!Buffer || (cchSize <= 0))
+ return;
+
+ er.EventType = KEY_EVENT;
+ er.Event.KeyEvent.wRepeatCount = 1;
+ while (cchSize--)
+ {
+ /* \r or \n characters. Go to the line only if we get "\r\n" sequence. */
+ if (CurChar == L'\r' && *Buffer == L'\n')
+ {
+ ++Buffer;
+ continue;
+ }
+ CurChar = *Buffer++;
+
+ /* Get the key code (+ shift state) corresponding to the character */
+ VkKey = VkKeyScanW(CurChar);
+ if (VkKey == 0xFFFF)
+ {
+ DPRINT1("FIXME: TODO: VkKeyScanW failed - Should simulate the key!\n");
+ /*
+ * We don't really need the scan/key code because we actually only
+ * use the UnicodeChar for output purposes. It may pose few problems
+ * later on but it's not of big importance. One trick would be to
+ * convert the character to OEM / multibyte and use MapVirtualKey()
+ * on each byte (simulating an Alt-0xxx OEM keyboard press).
+ */
+ }
+
+ /* Pressing some control keys */
+
+ /* Pressing the character key, with the control keys maintained pressed */
+ er.Event.KeyEvent.bKeyDown = TRUE;
+ er.Event.KeyEvent.wVirtualKeyCode = LOBYTE(VkKey);
+ er.Event.KeyEvent.wVirtualScanCode = MapVirtualKeyW(LOBYTE(VkKey), MAPVK_VK_TO_VSC);
+ er.Event.KeyEvent.uChar.UnicodeChar = CurChar;
+ er.Event.KeyEvent.dwControlKeyState = 0;
+ if (HIBYTE(VkKey) & 1)
+ er.Event.KeyEvent.dwControlKeyState |= SHIFT_PRESSED;
+ if (HIBYTE(VkKey) & 2)
+ er.Event.KeyEvent.dwControlKeyState |= LEFT_CTRL_PRESSED; // RIGHT_CTRL_PRESSED;
+ if (HIBYTE(VkKey) & 4)
+ er.Event.KeyEvent.dwControlKeyState |= LEFT_ALT_PRESSED; // RIGHT_ALT_PRESSED;
+
+ ConioProcessInputEvent(Console, &er);
+
+ /* Up all the character and control keys */
+ er.Event.KeyEvent.bKeyDown = FALSE;
+ ConioProcessInputEvent(Console, &er);
+ }
+}
+
VOID
GetSelectionBeginEnd(PCOORD Begin, PCOORD End,
PCOORD SelectionAnchor,
@@ -274,67 +337,16 @@ GuiPasteToTextModeBuffer(PTEXTMODE_SCREEN_BUFFER Buffer,
PCONSRV_CONSOLE Console = Buffer->Header.Console;
HANDLE hData;
- LPWSTR str;
- WCHAR CurChar = 0;
-
- USHORT VkKey; // MAKEWORD(low = vkey_code, high = shift_state);
- INPUT_RECORD er;
+ LPWSTR pszText;
hData = GetClipboardData(CF_UNICODETEXT);
if (hData == NULL) return;
- str = GlobalLock(hData);
- if (str == NULL) return;
-
- DPRINT("Got data <%S> from clipboard\n", str);
+ pszText = GlobalLock(hData);
+ if (pszText == NULL) return;
- er.EventType = KEY_EVENT;
- er.Event.KeyEvent.wRepeatCount = 1;
- while (*str)
- {
- /* \r or \n characters. Go to the line only if we get "\r\n" sequence. */
- if (CurChar == L'\r' && *str == L'\n')
- {
- str++;
- continue;
- }
- CurChar = *str++;
-
- /* Get the key code (+ shift state) corresponding to the character */
- VkKey = VkKeyScanW(CurChar);
- if (VkKey == 0xFFFF)
- {
- DPRINT1("FIXME: TODO: VkKeyScanW failed - Should simulate the key!\n");
- /*
- * We don't really need the scan/key code because we actually only
- * use the UnicodeChar for output purposes. It may pose few problems
- * later on but it's not of big importance. One trick would be to
- * convert the character to OEM / multibyte and use MapVirtualKey
- * on each byte (simulating an Alt-0xxx OEM keyboard press).
- */
- }
-
- /* Pressing some control keys */
-
- /* Pressing the character key, with the control keys maintained pressed */
- er.Event.KeyEvent.bKeyDown = TRUE;
- er.Event.KeyEvent.wVirtualKeyCode = LOBYTE(VkKey);
- er.Event.KeyEvent.wVirtualScanCode = MapVirtualKeyW(LOBYTE(VkKey), MAPVK_VK_TO_VSC);
- er.Event.KeyEvent.uChar.UnicodeChar = CurChar;
- er.Event.KeyEvent.dwControlKeyState = 0;
- if (HIBYTE(VkKey) & 1)
- er.Event.KeyEvent.dwControlKeyState |= SHIFT_PRESSED;
- if (HIBYTE(VkKey) & 2)
- er.Event.KeyEvent.dwControlKeyState |= LEFT_CTRL_PRESSED; // RIGHT_CTRL_PRESSED;
- if (HIBYTE(VkKey) & 4)
- er.Event.KeyEvent.dwControlKeyState |= LEFT_ALT_PRESSED; // RIGHT_ALT_PRESSED;
-
- ConioProcessInputEvent(Console, &er);
-
- /* Up all the character and control keys */
- er.Event.KeyEvent.bKeyDown = FALSE;
- ConioProcessInputEvent(Console, &er);
- }
+ DPRINT("Got data <%S> from clipboard\n", pszText);
+ PasteText(Console, pszText, wcslen(pszText));
GlobalUnlock(hData);
}
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1ed0f9ab576f094b27e11…
commit 1ed0f9ab576f094b27e11ba374738ecabc00e2e6
Author: Thomas Faber <thomas.faber(a)reactos.org>
AuthorDate: Wed Aug 8 19:58:56 2018 +0200
Commit: Thomas Faber <thomas.faber(a)reactos.org>
CommitDate: Wed Aug 8 20:08:38 2018 +0200
[HAL] Remove misleading debug prints about USB controllers.
---
hal/halx86/legacy/bussupp.c | 26 --------------------------
1 file changed, 26 deletions(-)
diff --git a/hal/halx86/legacy/bussupp.c b/hal/halx86/legacy/bussupp.c
index a37d875ede..4d20396560 100644
--- a/hal/halx86/legacy/bussupp.c
+++ b/hal/halx86/legacy/bussupp.c
@@ -1128,32 +1128,6 @@ HalpInitializePciBus(VOID)
}
}
- /* Check if this is a USB controller */
- if ((PciData->BaseClass == PCI_CLASS_SERIAL_BUS_CTLR) &&
- (PciData->SubClass == PCI_SUBCLASS_SB_USB))
- {
- /* Check if this is an OHCI controller */
- if (PciData->ProgIf == 0x10)
- {
- DbgPrint("\tDevice is an OHCI (USB) PCI Expansion Card. Turn off Legacy USB in your BIOS!\n\n");
- continue;
- }
-
- /* Check for Intel UHCI controller */
- if (PciData->VendorID == 0x8086)
- {
- DbgPrint("\tDevice is an Intel UHCI (USB) Controller. Turn off Legacy USB in your BIOS!\n\n");
- continue;
- }
-
- /* Check for VIA UHCI controller */
- if (PciData->VendorID == 0x1106)
- {
- DbgPrint("\tDevice is a VIA UHCI (USB) Controller. Turn off Legacy USB in your BIOS!\n\n");
- continue;
- }
- }
-
/* Now check the registry for chipset hacks */
Status = HalpGetChipHacks(PciData->VendorID,
PciData->DeviceID,