diff options
| author | Jeffrey Altman <jaltman@secure-endpoints.com> | 2006-06-25 19:21:41 +0000 |
|---|---|---|
| committer | Jeffrey Altman <jaltman@secure-endpoints.com> | 2006-06-25 19:21:41 +0000 |
| commit | bd7edfe0a67af34296baa530d2a2218ec4ddcb2d (patch) | |
| tree | 209f2041cde5e42570d4e36eed0a12a43a4833aa /src/windows/identity/ui | |
| parent | 05352b990d5caeed4c6afe3140ab946842bd743d (diff) | |
| download | krb5-bd7edfe0a67af34296baa530d2a2218ec4ddcb2d.tar.gz krb5-bd7edfe0a67af34296baa530d2a2218ec4ddcb2d.tar.xz krb5-bd7edfe0a67af34296baa530d2a2218ec4ddcb2d.zip | |
NetIDMgr updates
* add scrollbars to option tree pane in configuration dialog
* convert to using Microsoft's safe string library both to ensure
safe string manipulation and to avoid deprecation warnings
* disable deprecation warnings for Platform SDK header shlwapi.h
which cannot otherwise be compiled
* add kerberos 5 kvno property to tickets. display in properties
dialog and main window if column selected by user
* improve manifest handling in order to support both manifests
generated by the compiler and those hand crafted in order to
specify the correct versions of the custom control libraries.
* update khimaira message types and credential acquisition
documentation
ticket: new
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@18212 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/windows/identity/ui')
| -rw-r--r-- | src/windows/identity/ui/Makefile | 7 | ||||
| -rw-r--r-- | src/windows/identity/ui/credwnd.c | 2 | ||||
| -rw-r--r-- | src/windows/identity/ui/debugfuncs.c | 6 | ||||
| -rw-r--r-- | src/windows/identity/ui/htwnd.c | 505 | ||||
| -rw-r--r-- | src/windows/identity/ui/htwnd.h | 2 | ||||
| -rw-r--r-- | src/windows/identity/ui/newcredwnd.c | 9 |
6 files changed, 357 insertions, 174 deletions
diff --git a/src/windows/identity/ui/Makefile b/src/windows/identity/ui/Makefile index e09d9f8c7..35c19bdba 100644 --- a/src/windows/identity/ui/Makefile +++ b/src/windows/identity/ui/Makefile @@ -27,7 +27,7 @@ MODULE=ui EXEFILE=$(BINDIR)\netidmgr.exe -MANIFESTFILE=$(BINDIR)\netidmgr.exe.manifest +MANIFESTFILE=$(BINDIR)\netidmgr.exe.static.manifest OBJFILES= \ $(OBJ)\main.obj \ @@ -88,7 +88,6 @@ $(MANIFESTFILE): netidmgr.manifest.$(CPU).$(KH_CLVER).debug !endif $(CP) $** $@ - !if ("$(CPU)" == "IA64" ) || ("$(CPU)" == "AMD64" ) || ("$(CPU)" == "ALPHA64" ) SCLIB=bufferoverflowu.lib !else @@ -97,6 +96,6 @@ SCLIB= $(EXEFILE): $(OBJFILES) $(RESFILES) $(LIBFILES) $(EXEGUILINK) $(SDKLIBFILES) $(SCLIB) + $(_VC_MANIFEST_EMBED_EXE) $(MANIFESTFILE) -all: mkdirs $(EXEFILE) $(MANIFESTFILE) - +all: mkdirs $(MANIFESTFILE) $(EXEFILE) diff --git a/src/windows/identity/ui/credwnd.c b/src/windows/identity/ui/credwnd.c index b68a3f953..31df6bdf7 100644 --- a/src/windows/identity/ui/credwnd.c +++ b/src/windows/identity/ui/credwnd.c @@ -4113,7 +4113,7 @@ cw_wm_command(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) /* a hyperlink was activated */
khui_htwnd_link * l;
l = (khui_htwnd_link *) lParam;
- wcsncpy(wid, l->id, l->id_len);
+ StringCchCopyN(wid, ARRAYLENGTH(wid), l->id, l->id_len);
wid[l->id_len] = 0;
if(!wcscmp(wid, L"NewCreds")) {
diff --git a/src/windows/identity/ui/debugfuncs.c b/src/windows/identity/ui/debugfuncs.c index b18ef42bb..7df6e9d65 100644 --- a/src/windows/identity/ui/debugfuncs.c +++ b/src/windows/identity/ui/debugfuncs.c @@ -202,8 +202,12 @@ void khm_start_file_log(void) { khm_get_file_log_path(sizeof(temppath), temppath);
+ logfile = NULL;
+#if _MSC_VER >= 1400
+ _wfopen_s(&logfile, temppath, L"w");
+#else
logfile = _wfopen(temppath, L"w");
-
+#endif
kherr_add_ctx_handler(debug_event_handler,
KHERR_CTX_BEGIN |
KHERR_CTX_END |
diff --git a/src/windows/identity/ui/htwnd.c b/src/windows/identity/ui/htwnd.c index a9472585b..9507fbdd0 100644 --- a/src/windows/identity/ui/htwnd.c +++ b/src/windows/identity/ui/htwnd.c @@ -121,6 +121,8 @@ typedef struct khui_htwnd_data_t { wchar_t * text;
int scroll_left;
int scroll_top;
+ int ext_width;
+ int ext_height;
COLORREF bk_color;
HCURSOR hc_hand;
int l_pixel_y;
@@ -630,6 +632,8 @@ static LRESULT htw_paint(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) int align;
int y;
wchar_t * par_start;
+ int ext_width = 0;
+ int ext_height = 0;
d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);
@@ -645,8 +649,11 @@ static LRESULT htw_paint(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) GetClientRect(hwnd, &r);
+#ifdef DRAW_HTWND_CLIENT_EDGE
+ /* for the moment, we are skipping on the client edge. */
if(d->flags & KHUI_HTWND_CLIENTEDGE)
DrawEdge(hdc, &r, EDGE_SUNKEN, BF_ADJUST | BF_RECT | BF_FLAT);
+#endif
hbk = CreateSolidBrush(RGB(255,255,255));
FillRect(hdc, &r, hbk);
@@ -728,8 +735,6 @@ static LRESULT htw_paint(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) p = par_start;
format_unwind(&s_stack, s_start); /* unwind format stack */
- //MoveToEx(hdc, x, y + l_height, NULL);
-
p_width = 0;
while(*p) {
@@ -766,13 +771,14 @@ static LRESULT htw_paint(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) SetTextColor(hdc, format_color(&s_stack));
GetTextExtentPoint32(hdc, p, (int)(c - p), &s);
- rd.left = x + p_width;
- rd.top = y;
- rd.right = x + p_width + s.cx;
- rd.bottom = y + l_height;
+ rd.left = x + p_width - d->scroll_left;
+ rd.top = y - d->scroll_top;
+ rd.right = x + p_width + s.cx - d->scroll_left;
+ rd.bottom = y + l_height - d->scroll_top;
if(IntersectRect(&rt, &rd, &r)) {
- DrawText(hdc, p, (int)(c - p), &rt, DT_BOTTOM | DT_LEFT | DT_SINGLELINE | DT_NOPREFIX);
+ DrawText(hdc, p, (int)(c - p), &rd,
+ DT_BOTTOM | DT_LEFT | DT_SINGLELINE | DT_NOPREFIX);
}
p_width += s.cx;
@@ -782,12 +788,86 @@ static LRESULT htw_paint(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) }
}
+ if (p_width > ext_width)
+ ext_width = p_width;
+
y += l_height;
par_start = p;
}
+ if (y > ext_height)
+ ext_height = y;
+
EndPaint(hwnd, &ps);
+ if (d->ext_width < ext_width) {
+ SCROLLINFO si;
+ LONG l;
+
+ /* the extents need to be adjusted. But first check if we
+ have exactly the right scroll bars we need. */
+ if ((ext_width > (r.right - r.left) &&
+ !(d->flags & KHUI_HTWND_HSCROLL)) ||
+ (ext_height > (r.bottom - r.top) &&
+ !(d->flags & KHUI_HTWND_VSCROLL)) ||
+
+ (ext_width <= (r.right - r.left) &&
+ (d->flags & KHUI_HTWND_HSCROLL)) ||
+ (ext_height <= (r.bottom - r.top) &&
+ (d->flags & KHUI_HTWND_VSCROLL))) {
+
+ /* need to add scroll bars */
+ if (ext_width > (r.right - r.left))
+ d->flags |= KHUI_HTWND_HSCROLL;
+ else
+ d->flags &= ~KHUI_HTWND_HSCROLL;
+
+ if (ext_height > (r.bottom - r.top))
+ d->flags |= KHUI_HTWND_VSCROLL;
+ else
+ d->flags &= ~KHUI_HTWND_VSCROLL;
+
+ l = GetWindowLongPtr(hwnd, GWL_STYLE);
+ l &= ~(WS_HSCROLL | WS_VSCROLL);
+
+ l |= ((d->flags & KHUI_HTWND_HSCROLL) ? WS_HSCROLL : 0) |
+ ((d->flags & KHUI_HTWND_VSCROLL) ? WS_VSCROLL : 0);
+
+ SetWindowLongPtr(hwnd, GWL_STYLE, l);
+
+ InvalidateRect(hwnd, NULL, FALSE);
+ /* since the client area changed, we do another redraw
+ before updating the scroll bar positions. */
+ } else {
+ d->ext_width = ext_width;
+ d->ext_height = ext_height;
+
+ if (d->flags & KHUI_HTWND_HSCROLL) {
+ ZeroMemory(&si, sizeof(si));
+ si.cbSize = sizeof(si);
+ si.fMask = SIF_ALL | SIF_DISABLENOSCROLL;
+ si.nMin = 0;
+ si.nMax = ext_width;
+ si.nPage = r.right - r.left;
+ si.nPos = d->scroll_left;
+
+ SetScrollInfo(hwnd, SB_HORZ, &si, TRUE);
+ }
+
+ if (d->flags & KHUI_HTWND_VSCROLL) {
+ ZeroMemory(&si, sizeof(si));
+ si.cbSize = sizeof(si);
+ si.fMask = SIF_ALL | SIF_DISABLENOSCROLL;
+ si.nMin = 0;
+ si.nMax = ext_height;
+ si.nPage = r.bottom - r.top;
+ si.nPos = d->scroll_top;
+
+ SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
+ }
+ }
+ }
+
return 0;
}
@@ -798,231 +878,328 @@ LRESULT CALLBACK khui_htwnd_proc(HWND hwnd, )
{
switch(uMsg) {
- case WM_CREATE:
- {
- CREATESTRUCT * cs;
- khui_htwnd_data * d;
- size_t cbsize;
+ case WM_CREATE:
+ {
+ CREATESTRUCT * cs;
+ khui_htwnd_data * d;
+ size_t cbsize;
- cs = (CREATESTRUCT *) lParam;
+ cs = (CREATESTRUCT *) lParam;
- d = PMALLOC(sizeof(*d));
- ZeroMemory(d, sizeof(*d));
+ d = PMALLOC(sizeof(*d));
+ ZeroMemory(d, sizeof(*d));
- if(cs->dwExStyle & WS_EX_TRANSPARENT) {
- d->flags |= KHUI_HTWND_TRANSPARENT;
- }
- if(cs->dwExStyle & WS_EX_CLIENTEDGE) {
- d->flags |= KHUI_HTWND_CLIENTEDGE;
- }
- d->id = (int)(INT_PTR) cs->hMenu;
+ if(cs->dwExStyle & WS_EX_TRANSPARENT) {
+ d->flags |= KHUI_HTWND_TRANSPARENT;
+ }
+ if(cs->dwExStyle & WS_EX_CLIENTEDGE) {
+ d->flags |= KHUI_HTWND_CLIENTEDGE;
+ }
+ if(cs->style & WS_HSCROLL) {
+ d->flags |= KHUI_HTWND_HSCROLL;
+ }
+ if(cs->style & WS_VSCROLL) {
+ d->flags |= KHUI_HTWND_VSCROLL;
+ }
+ d->id = (int)(INT_PTR) cs->hMenu;
- d->active_link = -1;
- d->bk_color = RGB(255,255,255);
- d->hc_hand = LoadCursor(NULL, IDC_HAND);
+ d->active_link = -1;
+ d->bk_color = RGB(255,255,255);
+ d->hc_hand = LoadCursor(NULL, IDC_HAND);
- if(SUCCEEDED(StringCbLength(cs->lpszName, KHUI_HTWND_MAXCB_TEXT, &cbsize))) {
- cbsize += sizeof(wchar_t);
- d->text = PMALLOC(cbsize);
- StringCbCopy(d->text, cbsize, cs->lpszName);
- }
+ if(SUCCEEDED(StringCbLength(cs->lpszName, KHUI_HTWND_MAXCB_TEXT, &cbsize))) {
+ cbsize += sizeof(wchar_t);
+ d->text = PMALLOC(cbsize);
+ StringCbCopy(d->text, cbsize, cs->lpszName);
+ }
+
+ /* this is just a flag to the WM_PAINT handler that the
+ extents haven't been set yet. */
+ d->ext_width = -1;
#pragma warning(push)
#pragma warning(disable: 4244)
- SetWindowLongPtr(hwnd, 0, (LONG_PTR) d);
+ SetWindowLongPtr(hwnd, 0, (LONG_PTR) d);
#pragma warning(pop)
- return 0;
+ return 0;
+ }
+ break;
+
+ case WM_SETTEXT:
+ {
+ wchar_t * newtext;
+ size_t cbsize;
+ khui_htwnd_data * d;
+ BOOL rv;
+
+ d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);
+ newtext = (wchar_t *) lParam;
+
+ if(d->text) {
+ PFREE(d->text);
+ d->text = NULL;
}
- break;
- case WM_SETTEXT:
- {
- wchar_t * newtext;
- size_t cbsize;
- khui_htwnd_data * d;
- BOOL rv;
+ if(SUCCEEDED(StringCbLength(newtext, KHUI_HTWND_MAXCB_TEXT, &cbsize))) {
+ cbsize += sizeof(wchar_t);
+ d->text = PMALLOC(cbsize);
+ StringCbCopy(d->text, cbsize, newtext);
+ rv = TRUE;
+ } else
+ rv = FALSE;
+
+ clear_styles(d);
+
+ d->ext_width = -1;
+ d->scroll_left = 0;
+ d->scroll_top = 0;
- d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);
- newtext = (wchar_t *) lParam;
+ InvalidateRect(hwnd, NULL, TRUE);
- if(d->text) {
- PFREE(d->text);
- d->text = NULL;
+ return rv;
+ }
+ break;
+
+ case WM_DESTROY:
+ {
+ khui_htwnd_data * d;
+ int i;
+
+ d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);
+ if(d->text)
+ PFREE(d->text);
+ d->text = 0;
+
+ if(d->links) {
+ for(i=0;i<d->max_links;i++) {
+ if(d->links[i])
+ PFREE(d->links[i]);
}
+ PFREE(d->links);
+ }
- if(SUCCEEDED(StringCbLength(newtext, KHUI_HTWND_MAXCB_TEXT, &cbsize))) {
- cbsize += sizeof(wchar_t);
- d->text = PMALLOC(cbsize);
- StringCbCopy(d->text, cbsize, newtext);
- rv = TRUE;
- } else
- rv = FALSE;
+ clear_styles(d);
- clear_styles(d);
+ PFREE(d);
+ }
+ break;
- InvalidateRect(hwnd, NULL, TRUE);
+ case WM_ERASEBKGND:
+ {
+ khui_htwnd_data * d;
+ d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);
- return rv;
- }
- break;
+ if(d->flags & KHUI_HTWND_TRANSPARENT)
+ return TRUE;
- case WM_DESTROY:
- {
- khui_htwnd_data * d;
- int i;
-
- d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);
- if(d->text)
- PFREE(d->text);
- d->text = 0;
-
- if(d->links) {
- for(i=0;i<d->max_links;i++) {
- if(d->links[i])
- PFREE(d->links[i]);
- }
- PFREE(d->links);
- }
+ return FALSE;
+ }
+
+ case WM_PAINT:
+ htw_paint(hwnd, uMsg, wParam, lParam);
+ break;
+
+ case WM_SETCURSOR:
+ {
+ khui_htwnd_data * d;
- clear_styles(d);
+ if(hwnd != (HWND)wParam)
+ break;
+
+ d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);
- PFREE(d);
+ if(d->active_link >= 0) {
+ SetCursor(d->hc_hand);
+ return TRUE;
}
- break;
+ }
+ break;
- case WM_ERASEBKGND:
- {
- khui_htwnd_data * d;
- d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);
+ case WM_SETFOCUS:
+ {
+ khui_htwnd_data * d;
- if(d->flags & KHUI_HTWND_TRANSPARENT)
- return TRUE;
+ d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);
- return FALSE;
- }
+ d->flags |= KHUI_HTWND_FOCUS;
- case WM_PAINT:
- htw_paint(hwnd, uMsg, wParam, lParam);
- break;
+ InvalidateRect(hwnd, NULL, TRUE);
+ }
+ break;
- case WM_SETCURSOR:
- {
- khui_htwnd_data * d;
+ case WM_KILLFOCUS:
+ {
+ khui_htwnd_data * d;
- if(hwnd != (HWND)wParam)
- break;
+ d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);
- d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);
+ d->flags &= ~KHUI_HTWND_FOCUS;
- if(d->active_link >= 0) {
- SetCursor(d->hc_hand);
- return TRUE;
- }
- }
- break;
+ InvalidateRect(hwnd, NULL, TRUE);
+ }
+ break;
+
+ case WM_LBUTTONDOWN:
+ {
+ khui_htwnd_data * d;
- case WM_SETFOCUS:
- {
- khui_htwnd_data * d;
+ d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);
- d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);
+ d->md_link = d->active_link;
- d->flags |= KHUI_HTWND_FOCUS;
+ SetCapture(hwnd);
+ }
+ break;
+
+ case WM_LBUTTONUP:
+ {
+ khui_htwnd_data * d;
- InvalidateRect(hwnd, NULL, TRUE);
+ d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);
+
+ if(d->md_link == d->active_link && d->md_link >= 0) {
+ /* clicked */
+ SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(d->id, BN_CLICKED), (LPARAM) d->links[d->md_link]);
}
- break;
- case WM_KILLFOCUS:
- {
- khui_htwnd_data * d;
+ ReleaseCapture();
+ }
+ break;
- d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);
+ case WM_HSCROLL:
+ {
+ khui_htwnd_data * d;
+ int old_pos;
+ int new_pos;
+ int ext;
+ SCROLLINFO si;
+ RECT r;
+
+ d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);
+
+ old_pos = new_pos = d->scroll_left;
+ ext = d->ext_width;
+
+ switch(HIWORD(wParam)) {
+ case SB_THUMBTRACK:
+ case SB_THUMBPOSITION:
+ ZeroMemory(&si, sizeof(si));
+ si.cbSize = sizeof(si);
+ si.fMask = SIF_TRACKPOS;
+ GetScrollInfo(hwnd, SB_HORZ, &si);
+ new_pos = si.nTrackPos;
+ break;
- d->flags &= ~KHUI_HTWND_FOCUS;
+ case SB_LINELEFT:
+ new_pos -= ext / 12; /* arbitrary unit */
+ break;
- InvalidateRect(hwnd, NULL, TRUE);
+ case SB_LINERIGHT:
+ new_pos += ext / 12; /* arbitrary unit */
+ break;
+
+ case SB_PAGELEFT:
+ GetClientRect(hwnd, &r);
+ new_pos -= r.right - r.left;
+ break;
+
+ case SB_PAGERIGHT:
+ GetClientRect(hwnd, &r);
+ new_pos += r.right - r.left;
+ break;
}
- break;
- case WM_LBUTTONDOWN:
- {
- khui_htwnd_data * d;
+ if (new_pos == old_pos)
+ break;
- d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);
+ GetClientRect(hwnd, &r);
- d->md_link = d->active_link;
+#if 0
+ if (new_pos > ext - (r.right - r.left))
+ new_pos = ext - (r.right - r.left);
+#endif
+ if (new_pos > ext)
+ new_pos = ext;
- SetCapture(hwnd);
- }
- break;
+ if (new_pos < 0)
+ new_pos = 0;
- case WM_LBUTTONUP:
- {
- khui_htwnd_data * d;
+ if (new_pos == old_pos)
+ break;
- d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);
+ ZeroMemory(&si, sizeof(si));
+ si.cbSize = sizeof(si);
+ si.fMask = SIF_POS;
+ si.nPos = new_pos;
+ SetScrollInfo(hwnd, SB_HORZ, &si, TRUE);
+ /* note that Windows sometimes adjusts the position after
+ setting it with SetScrollInfo. We have to look it up
+ again to see what value it ended up at. */
+ GetScrollInfo(hwnd, SB_HORZ, &si);
+ new_pos = si.nPos;
+
+ if (new_pos == old_pos)
+ break;
- if(d->md_link == d->active_link && d->md_link >= 0) {
- /* clicked */
- SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(d->id, BN_CLICKED), (LPARAM) d->links[d->md_link]);
- }
+ d->scroll_left = new_pos;
- ReleaseCapture();
- }
- break;
+ ScrollWindow(hwnd, old_pos - new_pos, 0, NULL, NULL);
- case WM_MOUSEMOVE:
- {
- khui_htwnd_data * d;
- int i;
- POINT p;
- int nl;
+ return 0;
+ }
+ break;
- p.x = GET_X_LPARAM(lParam);
- p.y = GET_Y_LPARAM(lParam);
- d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);
+ case WM_MOUSEMOVE:
+ {
+ khui_htwnd_data * d;
+ int i;
+ POINT p;
+ int nl;
+
+ d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);
+ p.x = GET_X_LPARAM(lParam) + d->scroll_left;
+ p.y = GET_Y_LPARAM(lParam) + d->scroll_top;
- for(i=0; i<d->n_links; i++) {
- if(d->links && d->links[i] && PtInRect(&(d->links[i]->r), p))
- break;
- }
+ for(i=0; i<d->n_links; i++) {
+ if(d->links && d->links[i] && PtInRect(&(d->links[i]->r), p))
+ break;
+ }
- if(i == d->n_links)
- nl = -1;
- else
- nl = i;
+ if(i == d->n_links)
+ nl = -1;
+ else
+ nl = i;
- if(d->active_link != nl) {
- if(d->active_link >= 0) {
- if(d->flags & KHUI_HTWND_TRANSPARENT)
+ if(d->active_link != nl) {
+ if(d->active_link >= 0) {
+ if(d->flags & KHUI_HTWND_TRANSPARENT)
{
HWND parent = GetParent(hwnd);
if(parent) {
InvalidateRect(parent, NULL, TRUE);
}
}
- /* although we are invalidating the rect before setting active_link,
- WM_PAINT will not be issued until wndproc returns */
- InvalidateRect(hwnd, &(d->links[d->active_link]->r), TRUE);
- }
- d->active_link = nl;
- if(d->active_link >= 0) {
- /* although we are invalidating the rect before setting active_link,
- WM_PAINT will not be issued until wndproc returns */
- if(d->flags & KHUI_HTWND_TRANSPARENT)
+ /* although we are invalidating the rect before setting active_link,
+ WM_PAINT will not be issued until wndproc returns */
+ InvalidateRect(hwnd, &(d->links[d->active_link]->r), TRUE);
+ }
+ d->active_link = nl;
+ if(d->active_link >= 0) {
+ /* although we are invalidating the rect before setting active_link,
+ WM_PAINT will not be issued until wndproc returns */
+ if(d->flags & KHUI_HTWND_TRANSPARENT)
{
HWND parent = GetParent(hwnd);
if(parent) {
InvalidateRect(parent, NULL, TRUE);
}
}
- InvalidateRect(hwnd, &(d->links[d->active_link]->r), TRUE);
- }
+ InvalidateRect(hwnd, &(d->links[d->active_link]->r), TRUE);
}
}
- break;
+ }
+ break;
}
return DefWindowProc(hwnd, uMsg,wParam,lParam);
diff --git a/src/windows/identity/ui/htwnd.h b/src/windows/identity/ui/htwnd.h index e83dbb684..2ca8c261b 100644 --- a/src/windows/identity/ui/htwnd.h +++ b/src/windows/identity/ui/htwnd.h @@ -40,6 +40,8 @@ We currently support the following tags: #define KHUI_HTWND_TRANSPARENT 1
#define KHUI_HTWND_CLIENTEDGE 2
+#define KHUI_HTWND_HSCROLL 4
+#define KHUI_HTWND_VSCROLL 8
#define KHUI_HTWND_FOCUS 2048
#define KHUI_HTWND_CLASS L"KhmHtWnd"
diff --git a/src/windows/identity/ui/newcredwnd.c b/src/windows/identity/ui/newcredwnd.c index 56c79294b..e263f7c87 100644 --- a/src/windows/identity/ui/newcredwnd.c +++ b/src/windows/identity/ui/newcredwnd.c @@ -967,7 +967,8 @@ nc_handle_wm_command(HWND hwnd, l->param_len < ARRAYLENGTH(sparam) &&
l->param_len > 0) {
- wcsncpy(sparam, l->param, l->param_len);
+ StringCchCopyN(sparam, ARRAYLENGTH(sparam),
+ l->param, l->param_len);
sparam[l->param_len] = L'\0';
} else {
@@ -1006,7 +1007,7 @@ nc_handle_wm_command(HWND hwnd, }
/* if it was for us, then we need to process the message */
- if(!wcsicmp(sid, CTLINKID_SWITCH_PANEL)) {
+ if(!_wcsicmp(sid, CTLINKID_SWITCH_PANEL)) {
khm_int32 credtype;
khui_new_creds_by_type * t;
@@ -1021,10 +1022,10 @@ nc_handle_wm_command(HWND hwnd, WMNC_DIALOG_SWITCH_PANEL),
0);
}
- } else if (!wcsicmp(sid, L"NotDef")) {
+ } else if (!_wcsicmp(sid, L"NotDef")) {
d->nc->set_default = FALSE;
nc_update_credtext(d);
- } else if (!wcsicmp(sid, L"MakeDef")) {
+ } else if (!_wcsicmp(sid, L"MakeDef")) {
d->nc->set_default = TRUE;
nc_update_credtext(d);
}
|
