diff --git a/win32ss/user/winsrv/consrv.cmake b/win32ss/user/winsrv/consrv.cmake index ea30acf25a..1307a0fb91 100644 --- a/win32ss/user/winsrv/consrv.cmake +++ b/win32ss/user/winsrv/consrv.cmake @@ -56,6 +56,6 @@ add_dependencies(consrv psdk) add_pch(consrv consrv/consrv.h CONSRV_SOURCE) #add_object_library(consrv ${CONSRV_SOURCE}) list(APPEND CONSRV_IMPORT_LIBS psapi) -list(APPEND CONSRV_DELAY_IMPORT_LIBS ole32) +list(APPEND CONSRV_DELAY_IMPORT_LIBS shell32 ole32) list(APPEND CONSRV_TARGET_LINK_LIBS concfg uuid) set_module_type(consrv module UNICODE) diff --git a/win32ss/user/winsrv/consrv/frontends/gui/conwnd.c b/win32ss/user/winsrv/consrv/frontends/gui/conwnd.c index 860244f6c5..f4dc67fbaf 100644 --- a/win32ss/user/winsrv/consrv/frontends/gui/conwnd.c +++ b/win32ss/user/winsrv/consrv/frontends/gui/conwnd.c @@ -7,6 +7,7 @@ * Johannes Anderwald * Jeffrey Morlan * Hermes Belusca-Maito (hermes.belusca@sfr.fr) + * Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com) */ /* INCLUDES *******************************************************************/ @@ -14,6 +15,7 @@ #include #include #include +#include #define NDEBUG #include @@ -586,6 +588,8 @@ OnNcCreate(HWND hWnd, LPCREATESTRUCTW Create) PGUI_CONSOLE_DATA GuiData = (PGUI_CONSOLE_DATA)Create->lpCreateParams; PCONSRV_CONSOLE Console; + DragAcceptFiles(hWnd, TRUE); + if (NULL == GuiData) { DPRINT1("GuiConsoleNcCreate: No GUI data\n"); @@ -2135,6 +2139,51 @@ OnMove(PGUI_CONSOLE_DATA GuiData) GuiData->GuiInfo.WindowOrigin.y = rcWnd.top; } +static VOID +OnDropFiles(HWND hWnd, PCONSRV_CONSOLE Console, HDROP hDrop) +{ + WCHAR *pch, szPath[MAX_PATH + 2]; + INPUT_RECORD ir; + USHORT vk; + + szPath[0] = L'"'; + DragQueryFileW(hDrop, 0, &szPath[1], ARRAYSIZE(szPath) - 1); + if (wcschr(&szPath[1], L' ') != NULL) + { + StringCchCatW(szPath, ARRAYSIZE(szPath), L"\""); + pch = szPath; + } + else + { + pch = &szPath[1]; + } + + ir.EventType = KEY_EVENT; + ir.Event.KeyEvent.wRepeatCount = 1; + + for (; *pch; ++pch) + { + vk = VkKeyScanW(*pch); + + ir.Event.KeyEvent.bKeyDown = TRUE; + ir.Event.KeyEvent.wVirtualKeyCode = LOBYTE(vk); + ir.Event.KeyEvent.wVirtualScanCode = MapVirtualKeyW(LOBYTE(vk), MAPVK_VK_TO_VSC); + ir.Event.KeyEvent.uChar.UnicodeChar = *pch; + ir.Event.KeyEvent.dwControlKeyState = 0; + + if (HIBYTE(vk) & 1) + ir.Event.KeyEvent.dwControlKeyState |= SHIFT_PRESSED; + if (HIBYTE(vk) & 2) + ir.Event.KeyEvent.dwControlKeyState |= LEFT_CTRL_PRESSED; + if (HIBYTE(vk) & 4) + ir.Event.KeyEvent.dwControlKeyState |= LEFT_ALT_PRESSED; + ConioProcessInputEvent(Console, &ir); + + ir.Event.KeyEvent.bKeyDown = FALSE; + ConioProcessInputEvent(Console, &ir); + } +} + /* // HACK: This functionality is standard for general scrollbars. Don't add it by hand. @@ -2526,6 +2575,12 @@ ConWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) break; } + case WM_DROPFILES: + { + OnDropFiles(hWnd, Console, (HDROP)(wParam)); + break; + } + case PM_CONSOLE_BEEP: DPRINT1("Beep\n"); Beep(800, 200);