X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=windows%2Fwindow.c;h=290e6a31cf513da6803b294c61b8e58f09e69d89;hb=1de7240eb88fa24a8532ded116b4ec72dd213008;hp=6b5a5c564bfc193e1e8b65f5df83fddb5d9c63dd;hpb=67e5ceb9a8e6bc20fa0e0cf82ee9f89582e94112;p=PuTTY.git diff --git a/windows/window.c b/windows/window.c index 6b5a5c56..290e6a31 100644 --- a/windows/window.c +++ b/windows/window.c @@ -19,6 +19,7 @@ #include "terminal.h" #include "storage.h" #include "win_res.h" +#include "winsecur.h" #ifndef NO_MULTIMON #include @@ -76,6 +77,11 @@ #define WHEEL_DELTA 120 #endif +/* VK_PACKET, used to send Unicode characters in WM_KEYDOWNs */ +#ifndef VK_PACKET +#define VK_PACKET 0xE7 +#endif + static Mouse_Button translate_button(Mouse_Button button); static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam, @@ -223,6 +229,11 @@ void frontend_echoedit_update(void *frontend, int echo, int edit) { } +int frontend_is_utf8(void *frontend) +{ + return ucsdata.line_codepage == CP_UTF8; +} + char *get_ttymode(void *frontend, const char *mode) { return term_get_ttymode(term, mode); @@ -385,6 +396,21 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) return 1; } + /* + * Protect our process + */ + { +#if !defined UNPROTECT && !defined NO_SECURITY + char *error = NULL; + if (! setprocessacl(error)) { + char *message = dupprintf("Could not restrict process ACL: %s", + error); + logevent(NULL, message); + sfree(message); + sfree(error); + } +#endif + } /* * Process the command line. */ @@ -806,7 +832,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) AppendMenu(m, MF_SEPARATOR, 0, 0); AppendMenu(m, MF_ENABLED, IDM_NEWSESS, "Ne&w Session..."); AppendMenu(m, MF_ENABLED, IDM_DUPSESS, "&Duplicate Session"); - AppendMenu(m, MF_POPUP | MF_ENABLED, (UINT) savedsess_menu, + AppendMenu(m, MF_POPUP | MF_ENABLED, (UINT_PTR) savedsess_menu, "Sa&ved Sessions"); AppendMenu(m, MF_ENABLED, IDM_RECONF, "Chan&ge Settings..."); AppendMenu(m, MF_SEPARATOR, 0, 0); @@ -1033,7 +1059,7 @@ void update_specials_menu(void *frontend) saved_menu = new_menu; /* XXX lame stacking */ new_menu = CreatePopupMenu(); AppendMenu(saved_menu, MF_POPUP | MF_ENABLED, - (UINT) new_menu, specials[i].name); + (UINT_PTR) new_menu, specials[i].name); break; case TS_EXITMENU: nesting--; @@ -1058,13 +1084,14 @@ void update_specials_menu(void *frontend) for (j = 0; j < lenof(popup_menus); j++) { if (specials_menu) { /* XXX does this free up all submenus? */ - DeleteMenu(popup_menus[j].menu, (UINT)specials_menu, MF_BYCOMMAND); + DeleteMenu(popup_menus[j].menu, (UINT_PTR)specials_menu, + MF_BYCOMMAND); DeleteMenu(popup_menus[j].menu, IDM_SPECIALSEP, MF_BYCOMMAND); } if (new_menu) { InsertMenu(popup_menus[j].menu, IDM_SHOWLOG, MF_BYCOMMAND | MF_POPUP | MF_ENABLED, - (UINT) new_menu, "S&pecial Command"); + (UINT_PTR) new_menu, "S&pecial Command"); InsertMenu(popup_menus[j].menu, IDM_SHOWLOG, MF_BYCOMMAND | MF_SEPARATOR, IDM_SPECIALSEP, 0); } @@ -3086,7 +3113,8 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, unsigned char buf[20]; int len; - if (wParam == VK_PROCESSKEY) { /* IME PROCESS key */ + if (wParam == VK_PROCESSKEY || /* IME PROCESS key */ + wParam == VK_PACKET) { /* 'this key is a Unicode char' */ if (message == WM_KEYDOWN) { MSG m; m.hwnd = hwnd;