From e2ad5d74adbf3edc8a7026cad8283c0077377e81 Mon Sep 17 00:00:00 2001 From: Kevin Wasserman Date: Thu, 21 Jun 2012 15:30:24 -0400 Subject: Use file mapping to marshall message data GlobalAlloc() is no longer supported for this purpose. Also split out leash message marshalling code into a separate function acquire_tkt_send_message_leash and improve string copy safety. Signed-off-by: Kevin Wasserman ticket: 7276 (new) queue: kfw target_version: 1.10.4 tags: pullup --- src/windows/leash/LeashView.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/windows/leash/LeashView.cpp') diff --git a/src/windows/leash/LeashView.cpp b/src/windows/leash/LeashView.cpp index 96c5127eb..0460f2c8a 100644 --- a/src/windows/leash/LeashView.cpp +++ b/src/windows/leash/LeashView.cpp @@ -2729,7 +2729,7 @@ LRESULT CLeashView::OnObtainTGTWithParam(WPARAM wParam, LPARAM lParam) { LRESULT res = 0; - char * param = (char *) GlobalLock((HGLOBAL) lParam); + char *param = 0; LSH_DLGINFO_EX ldi; ldi.size = sizeof(ldi); ldi.dlgtype = DLGTYPE_PASSWD; @@ -2737,6 +2737,14 @@ CLeashView::OnObtainTGTWithParam(WPARAM wParam, LPARAM lParam) ldi.title = ldi.in.title; ldi.username = ldi.in.username; ldi.realm = ldi.in.realm; + + if (lParam) + param = (char *) MapViewOfFile((HANDLE)lParam, + FILE_MAP_ALL_ACCESS, + 0, + 0, + 4096); + if ( param ) { if ( *param ) strcpy(ldi.in.title,param); @@ -2757,7 +2765,10 @@ CLeashView::OnObtainTGTWithParam(WPARAM wParam, LPARAM lParam) ldi.dlgtype |= DLGFLAG_READONLYPRINC; res = pLeash_kinit_dlg_ex(m_hWnd, &ldi); - GlobalUnlock((HGLOBAL) lParam); + if (param) + UnmapViewOfFile(param); + if (lParam) + CloseHandle((HANDLE )lParam); ::SendMessage(m_hWnd, WM_COMMAND, ID_UPDATE_DISPLAY, 0); return res; } -- cgit