summaryrefslogtreecommitdiffstats
path: root/src/windows/identity/ui
diff options
context:
space:
mode:
authorJeffrey Altman <jaltman@secure-endpoints.com>2005-11-29 22:05:23 +0000
committerJeffrey Altman <jaltman@secure-endpoints.com>2005-11-29 22:05:23 +0000
commita15641c1710ccb204f6dc66c539c42b7617a2ea9 (patch)
tree747a531f34cc909a1f30f91893366e4ac4d99ffc /src/windows/identity/ui
parent52e7daa850554e507f7df50e77041fd67ddbcca1 (diff)
downloadkrb5-a15641c1710ccb204f6dc66c539c42b7617a2ea9.tar.gz
krb5-a15641c1710ccb204f6dc66c539c42b7617a2ea9.tar.xz
krb5-a15641c1710ccb204f6dc66c539c42b7617a2ea9.zip
KFW Network Identity Manager (Beta 2)
All features completed except for: * Debug Window * KRB5.INI (aka Realm) Editor * Column Selection * Graphics are incomplete * Documentation is incomplete ticket: new status: resolved component: windows target_version: 1.4.4 tags: pullup git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17516 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/windows/identity/ui')
-rw-r--r--src/windows/identity/ui/Makefile16
-rw-r--r--src/windows/identity/ui/aboutwnd.c8
-rw-r--r--src/windows/identity/ui/aboutwnd.h2
-rw-r--r--src/windows/identity/ui/addrchange.c92
-rw-r--r--src/windows/identity/ui/addrchange.h36
-rw-r--r--src/windows/identity/ui/appglobal.h2
-rw-r--r--src/windows/identity/ui/appver.rc40
-rw-r--r--src/windows/identity/ui/cfg_general_wnd.c27
-rw-r--r--src/windows/identity/ui/cfg_identities_wnd.c74
-rw-r--r--src/windows/identity/ui/cfg_notif_wnd.c17
-rw-r--r--src/windows/identity/ui/cfg_plugins_wnd.c15
-rw-r--r--src/windows/identity/ui/configwnd.c70
-rw-r--r--src/windows/identity/ui/configwnd.h2
-rw-r--r--src/windows/identity/ui/credfuncs.c167
-rw-r--r--src/windows/identity/ui/credfuncs.h8
-rw-r--r--src/windows/identity/ui/credwnd.c544
-rw-r--r--src/windows/identity/ui/credwnd.h17
-rw-r--r--src/windows/identity/ui/htwnd.c26
-rw-r--r--src/windows/identity/ui/htwnd.h2
-rw-r--r--src/windows/identity/ui/images/Thumbs.dbbin116224 -> 0 bytes
-rw-r--r--src/windows/identity/ui/images/bitmap1.bmpbin1270 -> 0 bytes
-rw-r--r--src/windows/identity/ui/images/cfg_plugin.icobin0 -> 10134 bytes
-rw-r--r--src/windows/identity/ui/images/chpw.bmpbin2430 -> 2430 bytes
-rw-r--r--src/windows/identity/ui/images/help.bmpbin2430 -> 2430 bytes
-rw-r--r--src/windows/identity/ui/images/icon1.icobin766 -> 0 bytes
-rw-r--r--src/windows/identity/ui/images/id-dis-sm.bmpbin1014 -> 822 bytes
-rw-r--r--src/windows/identity/ui/images/import.bmpbin2430 -> 2430 bytes
-rw-r--r--src/windows/identity/ui/images/main_app_old.icobin7854 -> 0 bytes
-rw-r--r--src/windows/identity/ui/images/text1138.pngbin378 -> 0 bytes
-rw-r--r--src/windows/identity/ui/images/tk-delete.bmpbin2430 -> 2430 bytes
-rw-r--r--src/windows/identity/ui/images/tk-new.bmpbin2430 -> 2430 bytes
-rw-r--r--src/windows/identity/ui/images/tk-refresh.bmpbin2430 -> 2430 bytes
-rw-r--r--src/windows/identity/ui/images/vw-refresh.bmpbin2430 -> 2430 bytes
-rw-r--r--src/windows/identity/ui/images/wdg_collapsed.bmpbin1014 -> 774 bytes
-rw-r--r--src/windows/identity/ui/images/wdg_collapsed_hi.bmpbin1014 -> 774 bytes
-rw-r--r--src/windows/identity/ui/images/wdg_expanded.bmpbin1014 -> 774 bytes
-rw-r--r--src/windows/identity/ui/images/wdg_expanded_hi.bmpbin1014 -> 774 bytes
-rw-r--r--src/windows/identity/ui/images/wdg_stick.bmpbin0 -> 774 bytes
-rw-r--r--src/windows/identity/ui/images/wdg_stick_hi.bmpbin0 -> 774 bytes
-rw-r--r--src/windows/identity/ui/images/wdg_stuck.bmpbin0 -> 774 bytes
-rw-r--r--src/windows/identity/ui/images/wdg_stuck_hi.bmpbin0 -> 774 bytes
-rw-r--r--src/windows/identity/ui/images/wgt_arrow_collapse.icobin1406 -> 0 bytes
-rw-r--r--src/windows/identity/ui/images/wgt_arrow_expand.icobin1406 -> 0 bytes
-rw-r--r--src/windows/identity/ui/khmapp.h5
-rw-r--r--src/windows/identity/ui/lang/en_us/khapp.rc94
-rw-r--r--src/windows/identity/ui/main.c108
-rw-r--r--src/windows/identity/ui/mainmenu.c47
-rw-r--r--src/windows/identity/ui/mainmenu.h2
-rw-r--r--src/windows/identity/ui/mainwnd.c58
-rw-r--r--src/windows/identity/ui/mainwnd.h2
-rw-r--r--src/windows/identity/ui/newcredwnd.c18
-rw-r--r--src/windows/identity/ui/newcredwnd.h2
-rw-r--r--src/windows/identity/ui/notifier.c193
-rw-r--r--src/windows/identity/ui/notifier.h10
-rw-r--r--src/windows/identity/ui/passwnd.h2
-rw-r--r--src/windows/identity/ui/propertywnd.c14
-rw-r--r--src/windows/identity/ui/propertywnd.h2
-rw-r--r--src/windows/identity/ui/reqdaemon.c10
-rw-r--r--src/windows/identity/ui/reqdaemon.h2
-rw-r--r--src/windows/identity/ui/resource.h19
-rw-r--r--src/windows/identity/ui/statusbar.c95
-rw-r--r--src/windows/identity/ui/statusbar.h21
-rw-r--r--src/windows/identity/ui/timer.c81
-rw-r--r--src/windows/identity/ui/timer.h2
-rw-r--r--src/windows/identity/ui/toolbar.c45
-rw-r--r--src/windows/identity/ui/toolbar.h4
66 files changed, 1501 insertions, 500 deletions
diff --git a/src/windows/identity/ui/Makefile b/src/windows/identity/ui/Makefile
index 402fc5d885..4419444a30 100644
--- a/src/windows/identity/ui/Makefile
+++ b/src/windows/identity/ui/Makefile
@@ -47,24 +47,32 @@ OBJFILES= \
$(OBJ)\configwnd.obj \
$(OBJ)\aboutwnd.obj \
$(OBJ)\reqdaemon.obj \
+ $(OBJ)\addrchange.obj \
$(OBJ)\cfg_general_wnd.obj \
$(OBJ)\cfg_identities_wnd.obj \
$(OBJ)\cfg_notif_wnd.obj \
$(OBJ)\cfg_plugins_wnd.obj
-RESFILE=$(OBJ)\khapp.res
+RESFILES= \
+ $(OBJ)\khapp.res \
+ $(OBJ)\appver.res
LIBFILES= \
$(LIBDIR)\nidmgr32.lib
SDKLIBFILES= \
comctl32.lib \
- shell32.lib
+ shell32.lib \
+ htmlhelp.lib \
+ iphlpapi.lib
$(OBJ)\uiconfig.c: uiconfig.csv $(CONFDIR)\csvschema.cfg
$(CCSV) $** $@
-$(RESFILE): lang\en_us\khapp.rc
+$(OBJ)\khapp.res: lang\en_us\khapp.rc
+ $(RC2RES)
+
+$(OBJ)\appver.res: appver.rc
$(RC2RES)
!if "$(KH_BUILD)"=="RETAIL"
@@ -74,7 +82,7 @@ $(MANIFESTFILE): netidmgr.manifest.$(CPU).$(KH_CLVER).debug
!endif
$(CP) $** $@
-$(EXEFILE): $(OBJFILES) $(RESFILE) $(LIBFILES)
+$(EXEFILE): $(OBJFILES) $(RESFILES) $(LIBFILES)
$(EXEGUILINK) $(SDKLIBFILES)
all: mkdirs $(EXEFILE) $(MANIFESTFILE)
diff --git a/src/windows/identity/ui/aboutwnd.c b/src/windows/identity/ui/aboutwnd.c
index 2dde601a49..4f5d38ef48 100644
--- a/src/windows/identity/ui/aboutwnd.c
+++ b/src/windows/identity/ui/aboutwnd.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 Massachusetts Institute of Technology
+ * Copyright (c) 2005 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -25,7 +25,7 @@
/* $Id$ */
#include<khmapp.h>
-#include<khimaira_version.h>
+#include<netidmgr_intver.h>
#include<tlhelp32.h>
#if DEBUG
@@ -108,7 +108,11 @@ about_dlg_proc(HWND hwnd,
mod.dwSize = sizeof(mod);
} while(Module32Next(hsnap, &mod));
+#if (_WIN32_WINNT >= 0x501)
+ /* we are also setting the report style when creating
+ the control. this is actually optional. */
ListView_SetView(hw, LV_VIEW_DETAILS);
+#endif
_done_with_modules:
CloseHandle(hsnap);
diff --git a/src/windows/identity/ui/aboutwnd.h b/src/windows/identity/ui/aboutwnd.h
index a427b7dd0d..81b7e90470 100644
--- a/src/windows/identity/ui/aboutwnd.h
+++ b/src/windows/identity/ui/aboutwnd.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 Massachusetts Institute of Technology
+ * Copyright (c) 2005 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
diff --git a/src/windows/identity/ui/addrchange.c b/src/windows/identity/ui/addrchange.c
new file mode 100644
index 0000000000..8a671b3c9a
--- /dev/null
+++ b/src/windows/identity/ui/addrchange.c
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2005 Massachusetts Institute of Technology
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/* $Id$ */
+
+#include<khmapp.h>
+#include<iphlpapi.h>
+
+static HANDLE evt_terminate = NULL;
+static HANDLE h_thread = NULL;
+
+DWORD WINAPI
+addr_change_thread(LPVOID dummy) {
+
+ HANDLE h_waits[2];
+ HANDLE h_notify;
+
+ OVERLAPPED overlap;
+ DWORD ret;
+
+ ZeroMemory(&overlap, sizeof(overlap));
+
+ h_notify = NULL;
+ overlap.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
+
+ do {
+ ret = NotifyAddrChange(&h_notify, &overlap);
+
+ if (ret != ERROR_IO_PENDING) {
+ goto _end_thread; /* some error */
+ }
+
+ h_waits[0] = overlap.hEvent;
+ h_waits[1] = evt_terminate;
+
+ ret = WaitForMultipleObjects(2, h_waits, FALSE, INFINITE);
+
+ if ( ret == WAIT_OBJECT_0 ) {
+ kmq_post_message(KMSG_CRED, KMSG_CRED_ADDR_CHANGE,
+ 0, 0);
+ } else {
+ goto _end_thread;
+ }
+ } while(TRUE);
+
+ _end_thread:
+ ExitThread(0);
+ return 0; /* unreachable */
+}
+
+void
+khm_addr_change_notifier_init(void) {
+ evt_terminate = CreateEvent(NULL, FALSE, FALSE, NULL);
+ h_thread = CreateThread(NULL,
+ 64 * 4096,
+ addr_change_thread,
+ NULL,
+ 0,
+ NULL);
+}
+
+void
+khm_addr_change_notifier_exit(void) {
+ if (h_thread && evt_terminate) {
+ SetEvent(evt_terminate);
+ WaitForSingleObject(h_thread, INFINITE);
+
+ CloseHandle(h_thread);
+ CloseHandle(evt_terminate);
+ }
+}
diff --git a/src/windows/identity/ui/addrchange.h b/src/windows/identity/ui/addrchange.h
new file mode 100644
index 0000000000..08c15041f4
--- /dev/null
+++ b/src/windows/identity/ui/addrchange.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2005 Massachusetts Institute of Technology
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/* $Id$ */
+
+#ifndef __NETIDMGR_ADDRCHANGE_H
+#define __NETIDMGR_ADDRCHANGE_H
+
+void
+khm_addr_change_notifier_init(void);
+
+void
+khm_addr_change_notifier_exit(void);
+
+#endif
diff --git a/src/windows/identity/ui/appglobal.h b/src/windows/identity/ui/appglobal.h
index 41fca2d17e..d7e5667afb 100644
--- a/src/windows/identity/ui/appglobal.h
+++ b/src/windows/identity/ui/appglobal.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 Massachusetts Institute of Technology
+ * Copyright (c) 2005 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
diff --git a/src/windows/identity/ui/appver.rc b/src/windows/identity/ui/appver.rc
new file mode 100644
index 0000000000..9d2dbc4eba
--- /dev/null
+++ b/src/windows/identity/ui/appver.rc
@@ -0,0 +1,40 @@
+
+#include<windows.h>
+#include<netidmgr_intver.h>
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION KH_VERSION_LIST
+ PRODUCTVERSION KH_VERSION_LIST
+ FILEFLAGSMASK 0x17L
+ FILEFLAGS KH_VER_FILEFLAGS
+ FILEOS KH_VER_FILEOS
+ FILETYPE 0x0L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", KH_VERSTR_COMPANY_1033
+ VALUE "FileDescription", "Network Identity Manager"
+ VALUE "FileVersion", KH_VERSTR_VERSION_1033
+ VALUE "InternalName", "NetIDMgr"
+ VALUE "LegalCopyright", KH_VERSTR_COPYRIGHT_1033
+ VALUE "OriginalFilename", "netidmgr.exe"
+ VALUE "ProductName", "NetIDMgr"
+ VALUE "ProductVersion", KH_VERSTR_PRODUCT_1033
+#ifdef KH_VERSTR_COMMENT_1033
+ VALUE "Comment", KH_VERSTR_COMMENT_1033
+#endif
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
diff --git a/src/windows/identity/ui/cfg_general_wnd.c b/src/windows/identity/ui/cfg_general_wnd.c
index 37c7ba7d11..7b48975a97 100644
--- a/src/windows/identity/ui/cfg_general_wnd.c
+++ b/src/windows/identity/ui/cfg_general_wnd.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 Massachusetts Institute of Technology
+ * Copyright (c) 2005 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -81,6 +81,7 @@ static void
write_params(dlg_data * dd) {
cfg_data * d, * s;
khm_handle csp_cw;
+ BOOL applied = FALSE;
d = &dd->work;
s = &dd->saved;
@@ -93,25 +94,35 @@ write_params(dlg_data * dd) {
return;
}
- if (!!d->auto_init != !!s->auto_init)
+ if (!!d->auto_init != !!s->auto_init) {
khc_write_int32(csp_cw, L"AutoInit", d->auto_init);
+ applied = TRUE;
+ }
- if (!!d->auto_start != !!s->auto_start)
+ if (!!d->auto_start != !!s->auto_start) {
khc_write_int32(csp_cw, L"AutoStart", d->auto_start);
+ applied = TRUE;
+ }
- if (!!d->auto_import != !!s->auto_import)
+ if (!!d->auto_import != !!s->auto_import) {
khc_write_int32(csp_cw, L"AutoImport", d->auto_import);
+ applied = TRUE;
+ }
- if (!!d->keep_running != !!s->keep_running)
+ if (!!d->keep_running != !!s->keep_running) {
khc_write_int32(csp_cw, L"KeepRunning", d->keep_running);
+ applied = TRUE;
+ }
- if (!!d->auto_detect_net != !!s->auto_detect_net)
+ if (!!d->auto_detect_net != !!s->auto_detect_net) {
khc_write_int32(csp_cw, L"AutoDetectNet", d->auto_detect_net);
+ applied = TRUE;
+ }
khc_close_space(csp_cw);
khui_cfg_set_flags(dd->node,
- KHUI_CNFLAG_APPLIED,
+ (applied) ? KHUI_CNFLAG_APPLIED : 0,
KHUI_CNFLAG_APPLIED | KHUI_CNFLAG_MODIFIED);
*s = *d;
@@ -179,7 +190,7 @@ khm_cfg_general_proc(HWND hwnd,
switch(uMsg) {
case WM_INITDIALOG:
- d = malloc(sizeof(*d));
+ d = PMALLOC(sizeof(*d));
#ifdef DEBUG
assert(d != NULL);
#endif
diff --git a/src/windows/identity/ui/cfg_identities_wnd.c b/src/windows/identity/ui/cfg_identities_wnd.c
index 1cef2d7ce7..8b27c3334c 100644
--- a/src/windows/identity/ui/cfg_identities_wnd.c
+++ b/src/windows/identity/ui/cfg_identities_wnd.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 Massachusetts Institute of Technology
+ * Copyright (c) 2005 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -46,6 +46,7 @@ static void
add_subpanels(HWND hwnd,
khui_config_node ctx_node,
khui_config_node ref_node) {
+
HWND hw_tab;
HWND hw_target;
khui_config_node sub;
@@ -315,6 +316,7 @@ typedef struct tag_idents_data {
int idx_deleted;
HWND hwnd;
+ khui_config_init_data cfg;
} idents_data;
static idents_data cfg_idents = {FALSE, NULL, 0, 0, 0, NULL };
@@ -411,14 +413,9 @@ write_params_ident(ident_data * d) {
khc_write_int32(csp_ident, L"AllowAutoRenew", !!d->work.auto_renew);
if (d->saved.sticky != d->work.sticky) {
- khc_write_int32(csp_ident, L"Sticky", !!d->work.sticky);
- if (d->work.sticky) {
- kcdb_identity_set_flags(d->ident, KCDB_IDENT_FLAG_STICKY);
- } else {
- kcdb_identity_set_flags(d->ident,
- KCDB_IDENT_FLAG_STICKY |
- KCDB_IDENT_FLAG_INVERT);
- }
+ kcdb_identity_set_flags(d->ident,
+ (d->work.sticky)?KCDB_IDENT_FLAG_STICKY:0,
+ KCDB_IDENT_FLAG_STICKY);
}
khc_close_space(csp_ident);
@@ -476,8 +473,8 @@ init_idents_data(void) {
break;
if (widnames)
- free(widnames);
- widnames = malloc(cb);
+ PFREE(widnames);
+ widnames = PMALLOC(cb);
#ifdef DEBUG
assert(widnames);
#endif
@@ -497,7 +494,7 @@ init_idents_data(void) {
goto _cleanup;
}
- cfg_idents.idents = malloc(sizeof(*cfg_idents.idents) *
+ cfg_idents.idents = PMALLOC(sizeof(*cfg_idents.idents) *
cfg_idents.n_idents);
#ifdef DEBUG
assert(cfg_idents.idents);
@@ -518,7 +515,7 @@ init_idents_data(void) {
StringCbLength(t, KCDB_IDENT_MAXCB_NAME, &cb);
cb += sizeof(wchar_t);
- cfg_idents.idents[i].idname = malloc(cb);
+ cfg_idents.idents[i].idname = PMALLOC(cb);
#ifdef DEBUG
assert(cfg_idents.idents[i].idname);
#endif
@@ -540,7 +537,7 @@ init_idents_data(void) {
cfg_idents.valid = TRUE;
if (widnames)
- free(widnames);
+ PFREE(widnames);
}
static void
@@ -554,11 +551,11 @@ free_idents_data(void) {
if (cfg_idents.idents[i].ident)
kcdb_identity_release(cfg_idents.idents[i].ident);
if (cfg_idents.idents[i].idname)
- free(cfg_idents.idents[i].idname);
+ PFREE(cfg_idents.idents[i].idname);
}
if (cfg_idents.idents)
- free(cfg_idents.idents);
+ PFREE(cfg_idents.idents);
cfg_idents.idents = NULL;
cfg_idents.n_idents = 0;
@@ -658,8 +655,14 @@ refresh_view_idents_sel(HWND hwnd) {
BST_INDETERMINATE));
if (sel_count > 0) {
+ EnableWindow(GetDlgItem(hwnd, IDC_CFG_MONITOR), TRUE);
+ EnableWindow(GetDlgItem(hwnd, IDC_CFG_RENEW), TRUE);
+ EnableWindow(GetDlgItem(hwnd, IDC_CFG_STICKY), TRUE);
EnableWindow(GetDlgItem(hwnd, IDC_CFG_REMOVE), TRUE);
} else {
+ EnableWindow(GetDlgItem(hwnd, IDC_CFG_MONITOR), FALSE);
+ EnableWindow(GetDlgItem(hwnd, IDC_CFG_RENEW), FALSE);
+ EnableWindow(GetDlgItem(hwnd, IDC_CFG_STICKY), FALSE);
EnableWindow(GetDlgItem(hwnd, IDC_CFG_REMOVE), FALSE);
}
}
@@ -781,19 +784,14 @@ refresh_view_idents_state(HWND hwnd) {
{
khm_int32 flags = 0;
- khui_config_node node = NULL;
if (modified)
flags |= KHUI_CNFLAG_MODIFIED;
if (applied)
flags |= KHUI_CNFLAG_APPLIED;
- khui_cfg_open(NULL, L"KhmIdentities", &node);
-#ifdef DEBUG
- assert(node);
-#endif
- khui_cfg_set_flags(node, flags,
- KHUI_CNFLAG_APPLIED | KHUI_CNFLAG_MODIFIED);
+ khui_cfg_set_flags_inst(&cfg_idents.cfg, flags,
+ KHUI_CNFLAG_APPLIED | KHUI_CNFLAG_MODIFIED);
}
}
@@ -853,6 +851,7 @@ khm_cfg_ids_tab_proc(HWND hwnd,
hold_idents_data();
cfg_idents.hwnd = hwnd;
+ cfg_idents.cfg = *((khui_config_init_data *) lParam);
/* first add the column */
hw = GetDlgItem(hwnd, IDC_CFG_IDENTS);
@@ -875,12 +874,17 @@ khm_cfg_ids_tab_proc(HWND hwnd,
if (cfg_idents.hi_status)
goto _done_with_icons;
- cfg_idents.hi_status = ImageList_Create(SM_CXICON, SM_CYICON,
- ILC_COLOR8 | ILC_MASK,
- 4,4);
+ cfg_idents.hi_status =
+ ImageList_Create(GetSystemMetrics(SM_CXSMICON),
+ GetSystemMetrics(SM_CYSMICON),
+ ILC_COLOR8 | ILC_MASK,
+ 4,4);
- hicon = LoadImage(khm_hInstance, MAKEINTRESOURCE(IDI_ID),
- IMAGE_ICON, SM_CXICON, SM_CYICON, LR_DEFAULTCOLOR);
+ hicon =
+ LoadImage(khm_hInstance, MAKEINTRESOURCE(IDI_ID),
+ IMAGE_ICON,
+ GetSystemMetrics(SM_CXSMICON),
+ GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR);
cfg_idents.idx_id = ImageList_AddIcon(cfg_idents.hi_status,
hicon);
@@ -888,7 +892,8 @@ khm_cfg_ids_tab_proc(HWND hwnd,
DestroyIcon(hicon);
hicon = LoadImage(khm_hInstance, MAKEINTRESOURCE(IDI_CFG_DEFAULT),
- IMAGE_ICON, SM_CXICON, SM_CYICON, LR_DEFAULTCOLOR);
+ IMAGE_ICON, GetSystemMetrics(SM_CXSMICON),
+ GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR);
cfg_idents.idx_default = ImageList_AddIcon(cfg_idents.hi_status,
hicon) + 1;
@@ -896,7 +901,8 @@ khm_cfg_ids_tab_proc(HWND hwnd,
DestroyIcon(hicon);
hicon = LoadImage(khm_hInstance, MAKEINTRESOURCE(IDI_CFG_MODIFIED),
- IMAGE_ICON, SM_CXICON, SM_CYICON, LR_DEFAULTCOLOR);
+ IMAGE_ICON, GetSystemMetrics(SM_CXSMICON),
+ GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR);
cfg_idents.idx_modified = ImageList_AddIcon(cfg_idents.hi_status,
hicon) + 1;
@@ -904,7 +910,8 @@ khm_cfg_ids_tab_proc(HWND hwnd,
DestroyIcon(hicon);
hicon = LoadImage(khm_hInstance, MAKEINTRESOURCE(IDI_CFG_APPLIED),
- IMAGE_ICON, SM_CXICON, SM_CYICON, LR_DEFAULTCOLOR);
+ IMAGE_ICON, GetSystemMetrics(SM_CXSMICON),
+ GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR);
cfg_idents.idx_applied = ImageList_AddIcon(cfg_idents.hi_status,
hicon) + 1;
@@ -912,7 +919,8 @@ khm_cfg_ids_tab_proc(HWND hwnd,
DestroyIcon(hicon);
hicon = LoadImage(khm_hInstance, MAKEINTRESOURCE(IDI_CFG_DELETED),
- IMAGE_ICON, SM_CXICON, SM_CYICON, LR_DEFAULTCOLOR);
+ IMAGE_ICON, GetSystemMetrics(SM_CXSMICON),
+ GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR);
cfg_idents.idx_deleted = ImageList_AddIcon(cfg_idents.hi_status,
hicon) + 1;
@@ -938,7 +946,9 @@ khm_cfg_ids_tab_proc(HWND hwnd,
cfg_idents.idents[i].lv_idx = ListView_InsertItem(hw, &lvi);
}
+#if (_WIN32_WINNT >= 0x501)
ListView_SetView(hw, LV_VIEW_DETAILS);
+#endif
}
return FALSE;
diff --git a/src/windows/identity/ui/cfg_notif_wnd.c b/src/windows/identity/ui/cfg_notif_wnd.c
index aafa12d723..bca18012c7 100644
--- a/src/windows/identity/ui/cfg_notif_wnd.c
+++ b/src/windows/identity/ui/cfg_notif_wnd.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 Massachusetts Institute of Technology
+ * Copyright (c) 2005 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -30,6 +30,8 @@
typedef struct tag_notif_data {
khui_config_node node;
+ BOOL modified;
+
BOOL monitor;
BOOL renew;
BOOL warn1;
@@ -90,6 +92,8 @@ read_params(notif_data * d) {
d->tc_warn2.min = t;
khc_close_space(csp_cw);
+
+ d->modified = FALSE;
}
static void
@@ -112,10 +116,14 @@ check_for_modification(notif_data * d) {
KHUI_CNFLAG_MODIFIED,
KHUI_CNFLAG_MODIFIED);
+ d->modified = TRUE;
+
} else {
khui_cfg_set_flags(d->node,
0,
KHUI_CNFLAG_MODIFIED);
+
+ d->modified = FALSE;
}
}
@@ -124,6 +132,9 @@ write_params(notif_data * d) {
khm_handle csp_cw;
khm_int32 rv;
+ if (!d->modified)
+ return;
+
rv = khc_open_space(NULL, L"CredWindow", KHM_PERM_WRITE, &csp_cw);
assert(KHM_SUCCEEDED(rv));
@@ -215,7 +226,7 @@ khm_cfg_notifications_proc(HWND hwnd,
case WM_INITDIALOG: {
HWND hw;
- d = malloc(sizeof(*d));
+ d = PMALLOC(sizeof(*d));
#ifdef DEBUG
assert(d != NULL);
#endif
@@ -286,7 +297,7 @@ khm_cfg_notifications_proc(HWND hwnd,
khui_tracker_kill_controls(&d->tc_warn1);
khui_tracker_kill_controls(&d->tc_warn2);
- free(d);
+ PFREE(d);
SetWindowLongPtr(hwnd, DWLP_USER, 0);
diff --git a/src/windows/identity/ui/cfg_plugins_wnd.c b/src/windows/identity/ui/cfg_plugins_wnd.c
index 16a344275c..8bf767e8c3 100644
--- a/src/windows/identity/ui/cfg_plugins_wnd.c
+++ b/src/windows/identity/ui/cfg_plugins_wnd.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 Massachusetts Institute of Technology
+ * Copyright (c) 2005 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -60,7 +60,7 @@ khm_cfg_plugins_proc(HWND hwnd,
wchar_t buf[256];
- d = malloc(sizeof(*d));
+ d = PMALLOC(sizeof(*d));
#ifdef DEBUG
assert(d);
#endif
@@ -83,13 +83,13 @@ khm_cfg_plugins_proc(HWND hwnd,
#ifdef DEBUG
assert(d->info[i] == NULL);
#endif
- d->info[i] = malloc(sizeof(*(d->info[i])));
+ d->info[i] = PMALLOC(sizeof(*(d->info[i])));
#ifdef DEBUG
assert(d->info[i]);
#endif
if (KHM_FAILED(kmm_get_plugin_info_i(p, &d->info[i]->plugin))) {
- free(d->info[i]);
+ PFREE(d->info[i]);
d->info[i] = NULL;
break;
}
@@ -120,8 +120,9 @@ khm_cfg_plugins_proc(HWND hwnd,
#ifdef DEBUG
assert(hw);
#endif
+#if (_WIN32_WINNT >= 0x501)
ListView_SetView(hw, LV_VIEW_DETAILS);
-
+#endif
ZeroMemory(&lvc, sizeof(lvc));
lvc.mask = LVCF_TEXT | LVCF_WIDTH;
@@ -305,10 +306,10 @@ khm_cfg_plugins_proc(HWND hwnd,
#endif
kmm_release_plugin_info_i(&d->info[i]->plugin);
kmm_release_module_info_i(&d->info[i]->module);
- free(d->info[i]);
+ PFREE(d->info[i]);
}
- free(d);
+ PFREE(d);
khm_set_dialog_result(hwnd, 0);
}
diff --git a/src/windows/identity/ui/configwnd.c b/src/windows/identity/ui/configwnd.c
index 22a41eeb5a..970599e853 100644
--- a/src/windows/identity/ui/configwnd.c
+++ b/src/windows/identity/ui/configwnd.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 Massachusetts Institute of Technology
+ * Copyright (c) 2005 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -145,12 +145,12 @@ cfgui_initialize_dialog(HWND hwnd) {
/* create and fill the image list for the treeview */
- d->hi_status = ImageList_Create(SM_CXICON, SM_CYICON,
+ d->hi_status = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON),
ILC_COLOR8 | ILC_MASK,
4,4);
hicon = LoadImage(khm_hInstance, MAKEINTRESOURCE(IDI_CFG_DEFAULT),
- IMAGE_ICON, SM_CXICON, SM_CYICON, LR_DEFAULTCOLOR);
+ IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR);
/* note that we can't use index 0 because that is used to indicate
that there is no state image for the node */
@@ -161,14 +161,14 @@ cfgui_initialize_dialog(HWND hwnd) {
DestroyIcon(hicon);
hicon = LoadImage(khm_hInstance, MAKEINTRESOURCE(IDI_CFG_MODIFIED),
- IMAGE_ICON, SM_CXICON, SM_CYICON, LR_DEFAULTCOLOR);
+ IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR);
d->idx_modified = ImageList_AddIcon(d->hi_status, hicon);
DestroyIcon(hicon);
hicon = LoadImage(khm_hInstance, MAKEINTRESOURCE(IDI_CFG_APPLIED),
- IMAGE_ICON, SM_CXICON, SM_CYICON, LR_DEFAULTCOLOR);
+ IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR);
d->idx_applied = ImageList_AddIcon(d->hi_status, hicon);
@@ -253,6 +253,42 @@ cfgui_uninitialize_dialog(HWND hwnd) {
ImageList_Destroy(d->hi_status);
}
+static HWND
+cfgui_create_config_node_window(HWND hwnd, khui_config_node node) {
+ khui_config_node_reg reg;
+ khm_int32 rv;
+ HWND hw_new;
+
+ khui_config_node parent;
+
+ if (KHM_SUCCEEDED(khui_cfg_get_parent(node, &parent))) {
+ HWND hwp;
+
+ hwp = khui_cfg_get_hwnd(parent);
+
+ if (hwp == NULL)
+ cfgui_create_config_node_window(hwnd, parent);
+
+ khui_cfg_release(parent);
+ }
+
+ rv = khui_cfg_get_reg(node, &reg);
+#ifdef DEBUG
+ assert(KHM_SUCCEEDED(rv));
+#endif
+ hw_new = CreateDialogParam(reg.h_module,
+ reg.dlg_template,
+ hwnd,
+ reg.dlg_proc,
+ (LPARAM) node);
+#ifdef DEBUG
+ assert(hw_new);
+#endif
+ khui_cfg_set_hwnd(node, hw_new);
+
+ return hw_new;
+}
+
static void
cfgui_activate_node(HWND hwnd, khui_config_node node) {
@@ -273,25 +309,11 @@ cfgui_activate_node(HWND hwnd, khui_config_node node) {
if (node == NULL) {
hw_new = d->hw_generic_pane;
} else {
- khui_config_node_reg reg;
- khm_int32 rv;
hw_new = khui_cfg_get_hwnd(node);
if (hw_new == NULL) {
- rv = khui_cfg_get_reg(node, &reg);
-#ifdef DEBUG
- assert(KHM_SUCCEEDED(rv));
-#endif
- hw_new = CreateDialogParam(reg.h_module,
- reg.dlg_template,
- hwnd,
- reg.dlg_proc,
- (LPARAM) node);
-#ifdef DEBUG
- assert(hw_new);
-#endif
- khui_cfg_set_hwnd(node, hw_new);
+ hw_new = cfgui_create_config_node_window(hwnd, node);
}
}
@@ -513,7 +535,7 @@ cfgui_dlgproc(HWND hwnd,
khui_cfg_clear_params();
- d = malloc(sizeof(*d));
+ d = PMALLOC(sizeof(*d));
ZeroMemory(d, sizeof(*d));
d->hbr_white = CreateSolidBrush(RGB(255,255,255));
@@ -682,8 +704,8 @@ void khm_refresh_config(void) {
return;
if (idents)
- free(idents);
- idents = malloc(cb);
+ PFREE(idents);
+ idents = PMALLOC(cb);
#ifdef DEBUG
assert(idents);
#endif
@@ -749,7 +771,7 @@ void khm_refresh_config(void) {
khui_cfg_release(cfg_ids);
if (idents)
- free(idents);
+ PFREE(idents);
}
void khm_init_config(void) {
diff --git a/src/windows/identity/ui/configwnd.h b/src/windows/identity/ui/configwnd.h
index 64da771532..62747fcad1 100644
--- a/src/windows/identity/ui/configwnd.h
+++ b/src/windows/identity/ui/configwnd.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 Massachusetts Institute of Technology
+ * Copyright (c) 2005 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
diff --git a/src/windows/identity/ui/credfuncs.c b/src/windows/identity/ui/credfuncs.c
index b92e5d4a83..b88f3d14e9 100644
--- a/src/windows/identity/ui/credfuncs.c
+++ b/src/windows/identity/ui/credfuncs.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 Massachusetts Institute of Technology
+ * Copyright (c) 2005 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -214,7 +214,10 @@ kmsg_cred_completion(kmq_message *m)
khui_alert * alert;
kherr_event * evt;
kherr_context * ctx;
- wchar_t ws_title[1024];
+ wchar_t ws_tfmt[512];
+ wchar_t w_idname[KCDB_IDENT_MAXCCH_NAME];
+ wchar_t ws_title[ARRAYLENGTH(ws_tfmt) + KCDB_IDENT_MAXCCH_NAME];
+ khm_size cb;
ctx = kherr_peek_context();
evt = kherr_get_err_event(ctx);
@@ -224,10 +227,24 @@ kmsg_cred_completion(kmq_message *m)
if (nc->subtype == KMSG_CRED_PASSWORD)
LoadString(khm_hInstance, IDS_NC_PWD_FAILED_TITLE,
- ws_title, ARRAYLENGTH(ws_title));
+ ws_tfmt, ARRAYLENGTH(ws_tfmt));
+ else if (nc->subtype == KMSG_CRED_RENEW_CREDS)
+ LoadString(khm_hInstance, IDS_NC_REN_FAILED_TITLE,
+ ws_tfmt, ARRAYLENGTH(ws_tfmt));
else
LoadString(khm_hInstance, IDS_NC_FAILED_TITLE,
- ws_title, ARRAYLENGTH(ws_title));
+ ws_tfmt, ARRAYLENGTH(ws_tfmt));
+
+ if (nc->n_identities > 0) {
+ cb = sizeof(w_idname);
+ if (KHM_FAILED(kcdb_identity_get_name(nc->identities[0],
+ w_idname, &cb)))
+ StringCbCopy(w_idname, sizeof(w_idname), L"(?)");
+ } else {
+ StringCbCopy(w_idname, sizeof(w_idname), L"(?)");
+ }
+
+ StringCbPrintf(ws_title, sizeof(ws_title), ws_tfmt, w_idname);
khui_alert_set_title(alert, ws_title);
khui_alert_set_severity(alert, evt->severity);
@@ -267,8 +284,10 @@ kmsg_cred_completion(kmq_message *m)
if (nc->subtype == KMSG_CRED_NEW_CREDS ||
nc->subtype == KMSG_CRED_PASSWORD) {
+ /*
if (nc->subtype == KMSG_CRED_NEW_CREDS)
khui_context_reset();
+ */
khm_cred_end_dialog(nc->result);
}
@@ -300,7 +319,7 @@ kmsg_cred_completion(kmq_message *m)
assert(m->vparam != NULL);
#endif
khui_context_release((khui_action_context *) m->vparam);
- free(m->vparam);
+ PFREE(m->vparam);
kmq_post_message(KMSG_CRED, KMSG_CRED_REFRESH, 0, 0);
@@ -310,6 +329,10 @@ kmsg_cred_completion(kmq_message *m)
case KMSG_CRED_IMPORT:
khm_cred_process_commandline();
break;
+
+ case KMSG_CRED_REFRESH:
+ kcdb_identity_refresh_all();
+ break;
}
}
@@ -342,7 +365,7 @@ void khm_cred_destroy_creds(void)
{
khui_action_context * pctx;
- pctx = malloc(sizeof(*pctx));
+ pctx = PMALLOC(sizeof(*pctx));
#ifdef DEBUG
assert(pctx);
#endif
@@ -370,7 +393,7 @@ void khm_cred_destroy_creds(void)
KHERR_WARNING);
khui_context_release(pctx);
- free(pctx);
+ PFREE(pctx);
} else {
_begin_task(KHERR_CF_TRANSITIVE);
_report_sr0(KHERR_NONE, IDS_CTX_RENEW_CREDS);
@@ -472,7 +495,7 @@ void khm_cred_change_password(wchar_t * title)
if (SUCCEEDED(StringCbLength(title, KHUI_MAXCB_TITLE, &cb))) {
cb += sizeof(wchar_t);
- nc->window_title = malloc(cb);
+ nc->window_title = PMALLOC(cb);
#ifdef DEBUG
assert(nc->window_title);
#endif
@@ -487,7 +510,7 @@ void khm_cred_change_password(wchar_t * title)
&cb))) {
cb = (cb + 1) * sizeof(wchar_t);
- nc->window_title = malloc(cb);
+ nc->window_title = PMALLOC(cb);
#ifdef DEBUG
assert(nc->window_title);
#endif
@@ -526,13 +549,40 @@ void khm_cred_obtain_new_creds(wchar_t * title)
kcdb_identpro_get_ui_cb((void *) &nc->ident_cb);
- assert(nc->ident_cb);
+ if (nc->ident_cb == NULL) {
+ wchar_t title[256];
+ wchar_t msg[512];
+ wchar_t suggestion[512];
+ khui_alert * a;
+
+ LoadString(khm_hInstance, IDS_ERR_TITLE_NO_IDENTPRO,
+ title, ARRAYLENGTH(title));
+ LoadString(khm_hInstance, IDS_ERR_MSG_NO_IDENTPRO,
+ msg, ARRAYLENGTH(msg));
+ LoadString(khm_hInstance, IDS_ERR_SUGG_NO_IDENTPRO,
+ suggestion, ARRAYLENGTH(suggestion));
+
+ khui_alert_create_simple(title,
+ msg,
+ KHERR_ERROR,
+ &a);
+ khui_alert_set_suggestion(a, suggestion);
+
+ khui_alert_show(a);
+
+ khui_alert_release(a);
+
+ khui_context_release(&nc->ctx);
+ khui_cw_destroy_cred_blob(nc);
+ khm_cred_end_dialog(KHUI_NC_RESULT_CANCEL);
+ return;
+ }
if (title) {
if (SUCCEEDED(StringCbLength(title, KHUI_MAXCB_TITLE, &cb))) {
cb += sizeof(wchar_t);
- nc->window_title = malloc(cb);
+ nc->window_title = PMALLOC(cb);
#ifdef DEBUG
assert(nc->window_title);
#endif
@@ -547,7 +597,7 @@ void khm_cred_obtain_new_creds(wchar_t * title)
&cb))) {
cb = (cb + 1) * sizeof(wchar_t);
- nc->window_title = malloc(cb);
+ nc->window_title = PMALLOC(cb);
#ifdef DEBUG
assert(nc->window_title);
#endif
@@ -566,7 +616,9 @@ void khm_cred_obtain_new_creds(wchar_t * title)
_end_task();
} else {
+ khui_context_release(&nc->ctx);
khui_cw_destroy_cred_blob(nc);
+ khm_cred_end_dialog(KHUI_NC_RESULT_CANCEL);
}
}
@@ -825,3 +877,94 @@ khm_cred_begin_commandline(void) {
khm_cred_process_commandline();
}
+
+void
+khm_cred_refresh(void) {
+ kmq_post_message(KMSG_CRED, KMSG_CRED_REFRESH, 0, NULL);
+}
+
+void
+khm_cred_addr_change(void) {
+ khm_handle csp_cw = NULL;
+ khm_int32 check_net = 0;
+
+ wchar_t * ids = NULL;
+ wchar_t * t;
+ khm_size cb;
+ khm_size n_idents;
+
+ __int64 ft_now;
+ __int64 ft_exp;
+ __int64 ft_issue;
+
+ if (KHM_SUCCEEDED(khc_open_space(NULL, L"CredWindow",
+ 0, &csp_cw))) {
+ khc_read_int32(csp_cw, L"AutoDetectNet", &check_net);
+
+ khc_close_space(csp_cw);
+ }
+
+ if (!check_net)
+ return;
+
+ while(TRUE) {
+ if (ids)
+ PFREE(ids);
+ ids = NULL;
+
+ if (kcdb_identity_enum(KCDB_IDENT_FLAG_VALID |
+ KCDB_IDENT_FLAG_RENEWABLE,
+ KCDB_IDENT_FLAG_VALID |
+ KCDB_IDENT_FLAG_RENEWABLE,
+ NULL,
+ &cb,
+ &n_idents) != KHM_ERROR_TOO_LONG)
+ break;
+
+ ids = PMALLOC(cb);
+
+ if (KHM_SUCCEEDED
+ (kcdb_identity_enum(KCDB_IDENT_FLAG_VALID |
+ KCDB_IDENT_FLAG_RENEWABLE,
+ KCDB_IDENT_FLAG_VALID |
+ KCDB_IDENT_FLAG_RENEWABLE,
+ ids,
+ &cb,
+ &n_idents)))
+ break;
+ }
+
+ if (!ids)
+ return;
+
+ GetSystemTimeAsFileTime((LPFILETIME) &ft_now);
+
+ for (t=ids; t && *t; t = multi_string_next(t)) {
+ khm_handle ident;
+
+
+ if (KHM_FAILED
+ (kcdb_identity_create(t, 0, &ident)))
+ continue;
+
+ cb = sizeof(ft_issue);
+
+ if (KHM_SUCCEEDED
+ (kcdb_identity_get_attr(ident, KCDB_ATTR_ISSUE, NULL,
+ &ft_issue, &cb)) &&
+
+ (cb = sizeof(ft_exp)) &&
+ KHM_SUCCEEDED
+ (kcdb_identity_get_attr(ident, KCDB_ATTR_EXPIRE, NULL,
+ &ft_exp, &cb)) &&
+
+ ft_now > (ft_issue + ft_exp)/2 &&
+ ft_now < ft_exp) {
+
+ khm_cred_renew_identity(ident);
+
+ }
+
+ kcdb_identity_release(ident);
+ }
+}
diff --git a/src/windows/identity/ui/credfuncs.h b/src/windows/identity/ui/credfuncs.h
index b25b6630eb..6337830982 100644
--- a/src/windows/identity/ui/credfuncs.h
+++ b/src/windows/identity/ui/credfuncs.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 Massachusetts Institute of Technology
+ * Copyright (c) 2005 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -69,4 +69,10 @@ khm_cred_begin_commandline(void);
void
khm_cred_process_commandline(void);
+void
+khm_cred_refresh(void);
+
+void
+khm_cred_addr_change(void);
+
#endif
diff --git a/src/windows/identity/ui/credwnd.c b/src/windows/identity/ui/credwnd.c
index 784a7f90b9..be7610497a 100644
--- a/src/windows/identity/ui/credwnd.c
+++ b/src/windows/identity/ui/credwnd.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 Massachusetts Institute of Technology
+ * Copyright (c) 2005 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -60,6 +60,7 @@ cw_load_view(khui_credwnd_tbl * tbl, wchar_t * view, HWND hwnd) {
if(KHM_FAILED(khc_open_space(NULL, L"CredWindow", KHM_PERM_READ, &hc_cw)))
return;
+
if(KHM_FAILED(khc_open_space(hc_cw, L"Views", KHM_PERM_READ, &hc_vs)))
goto _exit;
@@ -80,14 +81,15 @@ cw_load_view(khui_credwnd_tbl * tbl, wchar_t * view, HWND hwnd) {
if(khc_read_multi_string(hc_v, L"ColumnList", NULL, &cbsize) != KHM_ERROR_TOO_LONG)
goto _exit;
- clist = malloc(cbsize);
+ /* temporary */
+ clist = PMALLOC(cbsize);
if(KHM_FAILED(khc_read_multi_string(hc_v, L"ColumnList", clist, &cbsize)))
goto _exit;
tbl->n_cols = (int) multi_string_length_n(clist);
tbl->n_total_cols = UBOUNDSS(tbl->n_cols, KHUI_CW_COL_INITIAL, KHUI_CW_COL_INCREMENT);
- tbl->cols = malloc(sizeof(khui_credwnd_col) * tbl->n_total_cols);
+ tbl->cols = PMALLOC(sizeof(khui_credwnd_col) * tbl->n_total_cols);
ZeroMemory(tbl->cols, sizeof(khui_credwnd_col) * tbl->n_total_cols);
iter = clist;
@@ -103,7 +105,7 @@ cw_load_view(khui_credwnd_tbl * tbl, wchar_t * view, HWND hwnd) {
if(kcdb_attrib_describe(attr_id, NULL, &cbsize, KCDB_TS_SHORT) != KHM_ERROR_TOO_LONG ||
cbsize == 0)
goto _skip_col;
- tbl->cols[i].title = malloc(cbsize);
+ tbl->cols[i].title = PMALLOC(cbsize);
kcdb_attrib_describe(attr_id, tbl->cols[i].title, &cbsize, KCDB_TS_SHORT);
} else {
/* All current custom attributes are represented by icons,
@@ -234,6 +236,7 @@ _skip_col:
tbl->hb_hdr_bg_crit = CreateSolidBrush(RGB(240,133,117));
tbl->hb_hdr_bg_warn = CreateSolidBrush(RGB(251,199,77));
tbl->hb_hdr_bg_exp = CreateSolidBrush(RGB(255,144,144));
+ tbl->hb_hdr_bg_def = CreateSolidBrush(RGB(186,254,184));
tbl->cr_normal = RGB(0,0,0);
tbl->cr_sel = RGB(0,0,0);
@@ -241,7 +244,7 @@ _skip_col:
tbl->cr_hdr_normal = RGB(0,0,0);
tbl->cr_hdr_sel = RGB(255,255,255);
- tbl->ilist = khui_create_ilist(KHUI_SMICON_CX, KHUI_SMICON_CY-1, 16, 8, 0);
+ tbl->ilist = khui_create_ilist(KHUI_SMICON_CX, KHUI_SMICON_CY-1, 20, 8, 0);
{
HBITMAP hbm;
@@ -265,6 +268,10 @@ _skip_col:
ADD_BITMAP(IDB_FLAG_WARN);
ADD_BITMAP(IDB_FLAG_EXPIRED);
ADD_BITMAP(IDB_FLAG_CRITICAL);
+ ADD_BITMAP(IDB_WDG_STUCK);
+ ADD_BITMAP(IDB_WDG_STUCK_HI);
+ ADD_BITMAP(IDB_WDG_STICK);
+ ADD_BITMAP(IDB_WDG_STICK_HI);
#undef ADD_BITMAP
}
@@ -285,7 +292,7 @@ _exit:
if(hc_cs)
khc_close_space(hc_cs);
if(clist)
- free(clist);
+ PFREE(clist);
}
void
@@ -316,13 +323,13 @@ cw_update_creds(khui_credwnd_tbl * tbl)
&delta);
/* now we need to figure out how to sort the credentials */
- fields = malloc(sizeof(kcdb_cred_comp_field) * tbl->n_cols);
+ fields = PMALLOC(sizeof(kcdb_cred_comp_field) * tbl->n_cols);
ZeroMemory(fields, sizeof(kcdb_cred_comp_field) * tbl->n_cols);
for(i=0, n=0; i<tbl->n_cols; i++) {
if((tbl->cols[i].flags & KHUI_CW_COL_SORT_INC) ||
- (tbl->cols[i].flags & KHUI_CW_COL_SORT_DEC) ||
- (tbl->cols[i].flags & KHUI_CW_COL_GROUP))
+ (tbl->cols[i].flags & KHUI_CW_COL_SORT_DEC) ||
+ (tbl->cols[i].flags & KHUI_CW_COL_GROUP))
{
int si;
/* we need to sort by this column */
@@ -377,15 +384,20 @@ cw_update_creds(khui_credwnd_tbl * tbl)
kcdb_credset_get_size(tbl->credset, &s);
for(i=0;i<s;i++) {
- if(KHM_FAILED(kcdb_credset_get_cred(tbl->credset, (khm_int32) i, &hc)))
+ if(KHM_FAILED(kcdb_credset_get_cred(tbl->credset,
+ (khm_int32) i, &hc)))
continue; /* lost a race */
- if(KHM_FAILED(kcdb_cred_get_attr(hc, khui_cw_flag_id, NULL, NULL, NULL))) {
+ if(KHM_FAILED(kcdb_cred_get_attr(hc, khui_cw_flag_id, NULL,
+ NULL, NULL))) {
flags = 0;
kcdb_cred_set_attr(hc, khui_cw_flag_id, &flags, sizeof(flags));
}
kcdb_cred_release(hc);
}
}
+
+ if (fields)
+ PFREE(fields);
}
void
@@ -399,10 +411,14 @@ cw_del_outline(khui_credwnd_outline *o) {
return;
if(o->header)
- free(o->header);
+ PFREE(o->header);
if ((o->flags & KHUI_CW_O_DATAALLOC) &&
o->data)
- free(o->data);
+ PFREE(o->data);
+
+ if ((o->flags & KHUI_CW_O_STICKY) &&
+ o->data)
+ kcdb_identity_release((khm_handle) o->data);
LPOP(&(o->children), &c);
while(c) {
@@ -410,7 +426,7 @@ cw_del_outline(khui_credwnd_outline *o) {
LPOP(&(o->children), &c);
}
- free(o);
+ PFREE(o);
}
khui_credwnd_outline *
@@ -418,12 +434,12 @@ cw_new_outline_node(wchar_t * heading) {
khui_credwnd_outline * o;
size_t cblen;
- o = malloc(sizeof(khui_credwnd_outline));
+ o = PMALLOC(sizeof(khui_credwnd_outline));
ZeroMemory(o, sizeof(khui_credwnd_outline));
if(SUCCEEDED(StringCbLength(heading, KHUI_MAXCB_HEADING, &cblen))) {
cblen += sizeof(wchar_t);
- o->header = malloc(cblen);
+ o->header = PMALLOC(cblen);
StringCbCopy(o->header, cblen, heading);
}
@@ -531,9 +547,9 @@ cw_set_tbl_row_cred(khui_credwnd_tbl * tbl,
khm_size newsize;
newsize = UBOUNDSS(row+1,KHUI_CW_ROW_INITIAL, KHUI_CW_ROW_INCREMENT);
- newrows = malloc(sizeof(khui_credwnd_row) * newsize);
+ newrows = PMALLOC(sizeof(khui_credwnd_row) * newsize);
memcpy(newrows, tbl->rows, sizeof(khui_credwnd_row) * tbl->n_rows);
- free(tbl->rows);
+ PFREE(tbl->rows);
tbl->rows = newrows;
tbl->n_total_rows = newsize;
}
@@ -564,9 +580,9 @@ cw_set_tbl_row_header(khui_credwnd_tbl * tbl,
khm_size newsize;
newsize = UBOUNDSS(row+1,KHUI_CW_ROW_INITIAL, KHUI_CW_ROW_INCREMENT);
- newrows = malloc(sizeof(khui_credwnd_row) * newsize);
+ newrows = PMALLOC(sizeof(khui_credwnd_row) * newsize);
memcpy(newrows, tbl->rows, sizeof(khui_credwnd_row) * tbl->n_rows);
- free(tbl->rows);
+ PFREE(tbl->rows);
tbl->rows = newrows;
tbl->n_total_rows = newsize;
}
@@ -635,9 +651,8 @@ cw_update_outline(khui_credwnd_tbl * tbl)
}
}
-
/* determine the grouping order */
- grouping = malloc(sizeof(khm_int32) * tbl->n_cols);
+ grouping = PMALLOC(sizeof(khm_int32) * tbl->n_cols);
for(i=0; i < (int) tbl->n_cols; i++)
grouping[i] = -1;
n_grouping = 0;
@@ -664,7 +679,7 @@ cw_update_outline(khui_credwnd_tbl * tbl)
/* we haven't allocated memory yet */
tbl->n_total_rows = KHUI_CW_ROW_INITIAL;
tbl->n_rows = 0;
- tbl->rows = malloc(sizeof(khui_credwnd_row) * tbl->n_total_rows);
+ tbl->rows = PMALLOC(sizeof(khui_credwnd_row) * tbl->n_total_rows);
} else {
/* kill any pending timers */
for(i=0; i < (int) tbl->n_rows; i++)
@@ -690,7 +705,8 @@ cw_update_outline(khui_credwnd_tbl * tbl)
this view, we skip it */
if(prevcred) {
for(j=0; j < (int) tbl->n_cols; j++) {
- if(kcdb_creds_comp_attr(prevcred, thiscred, tbl->cols[j].attr_id))
+ if(kcdb_creds_comp_attr(prevcred, thiscred,
+ tbl->cols[j].attr_id))
break;
}
@@ -708,7 +724,8 @@ cw_update_outline(khui_credwnd_tbl * tbl)
for(j=0; j < n_grouping; j++) {
/* determine the grouping level at which thiscred
differs from prevcred */
- if(kcdb_creds_comp_attr(prevcred,thiscred,tbl->cols[grouping[j]].attr_id))
+ if(kcdb_creds_comp_attr(prevcred,thiscred,
+ tbl->cols[grouping[j]].attr_id))
break;
}
level = j;
@@ -791,6 +808,7 @@ cw_update_outline(khui_credwnd_tbl * tbl)
} else if(tbl->cols[grouping[j]].attr_id ==
KCDB_ATTR_TYPE_NAME) {
khm_int32 t;
+
ol->attr_id = KCDB_ATTR_TYPE;
if(KHM_SUCCEEDED(kcdb_cred_get_type(thiscred, &t)))
ol->data = (void *)(ssize_t) t;
@@ -823,7 +841,7 @@ cw_update_outline(khui_credwnd_tbl * tbl)
if (rv != KHM_ERROR_TOO_LONG || cbbuf == 0) {
ol->data = NULL;
} else {
- ol->data = malloc(cbbuf);
+ ol->data = PMALLOC(cbbuf);
assert(ol->data);
rv = kcdb_cred_get_attr(thiscred,
alt_id,
@@ -945,8 +963,8 @@ cw_update_outline(khui_credwnd_tbl * tbl)
cb_names == 0)
goto _cleanup_sticky;
- idnames = malloc(cb_names);
- idarray = malloc(n_idents * sizeof(*idarray));
+ idnames = PMALLOC(cb_names);
+ idarray = PMALLOC(n_idents * sizeof(*idarray));
#ifdef DEBUG
assert(idnames);
assert(idarray);
@@ -966,6 +984,12 @@ cw_update_outline(khui_credwnd_tbl * tbl)
qsort(idarray, n_idents, sizeof(*idarray), iwcscmp);
for (i=0; i < (int) n_idents; i++) {
+ khm_handle h;
+
+ if (KHM_FAILED(kcdb_identity_create(idarray[i],
+ KCDB_IDENT_FLAG_CREATE, &h)))
+ continue;
+
for (o = tbl->outline; o; o = LNEXT(o)) {
if (!wcscmp(idarray[i], o->header))
break;
@@ -975,15 +999,23 @@ cw_update_outline(khui_credwnd_tbl * tbl)
/* found it */
if (o->start != -1) /* already visible? */
continue;
+ o->flags &= KHUI_CW_O_STICKY;
+ o->flags |= KHUI_CW_O_VISIBLE;
} else {
/* not found. create */
o = cw_new_outline_node(idarray[i]);
o->flags = KHUI_CW_O_VISIBLE;
o->level = 0;
o->col = grouping[0];
+ o->data = (void *) h;
}
- o->flags |= KHUI_CW_O_STICKY;
+ if (o->flags & KHUI_CW_O_STICKY)
+ kcdb_identity_release(h);
+ else
+ /* leave identity held in this case */
+ o->flags |= KHUI_CW_O_STICKY;
+
o->flags &= ~KHUI_CW_O_EXPAND;
o->start = n_rows;
o->length = 1;
@@ -996,9 +1028,9 @@ cw_update_outline(khui_credwnd_tbl * tbl)
_cleanup_sticky:
if (idnames)
- free(idnames);
+ PFREE(idnames);
if (idarray)
- free(idarray);
+ PFREE(idarray);
}
tbl->n_rows = n_rows;
@@ -1007,7 +1039,7 @@ cw_update_outline(khui_credwnd_tbl * tbl)
tbl->flags &= ~KHUI_CW_TBL_COL_DIRTY;
_exit:
if(grouping)
- free(grouping);
+ PFREE(grouping);
}
void
@@ -1033,6 +1065,7 @@ cw_unload_view(khui_credwnd_tbl * tbl)
SafeDeleteObject(tbl->hb_hdr_bg_crit);
SafeDeleteObject(tbl->hb_hdr_bg_exp);
SafeDeleteObject(tbl->hb_hdr_bg_warn);
+ SafeDeleteObject(tbl->hb_hdr_bg_def);
#undef SafeDeleteObject
@@ -1049,17 +1082,17 @@ cw_unload_view(khui_credwnd_tbl * tbl)
khm_size i;
for(i=0; i < tbl->n_cols; i++) {
if(tbl->cols[i].title)
- free(tbl->cols[i].title);
+ PFREE(tbl->cols[i].title);
Header_DeleteItem(tbl->hwnd_header, 0);
}
- free(tbl->cols);
+ PFREE(tbl->cols);
tbl->cols = NULL;
tbl->n_cols = 0;
tbl->n_total_cols = 0;
}
if(tbl->rows) {
- free(tbl->rows);
+ PFREE(tbl->rows);
tbl->rows = NULL;
tbl->n_rows = 0;
tbl->n_total_rows = 0;
@@ -1091,11 +1124,13 @@ cw_hditem_from_tbl_col(khui_credwnd_col * col, HDITEM *phi)
phi->fmt = HDF_CENTER | HDF_STRING;
}
phi->lParam = col->attr_id;
+#if (_WIN32_WINNT >= 0x501)
if(col->flags & KHUI_CW_COL_SORT_INC) {
phi->fmt |= HDF_SORTUP;
} else if(col->flags & KHUI_CW_COL_SORT_DEC) {
phi->fmt |= HDF_SORTDOWN;
}
+#endif
if(col->width < 0) {
/*TODO: come up with a better way to handle this case */
col->width = 200;
@@ -1328,7 +1363,8 @@ cw_draw_header(HDC hdc,
khui_credwnd_row * cr;
khui_credwnd_outline * o;
int selected = 0;
-
+ khm_int32 idf = 0;
+
/* each header consists of a 'expose' widget and some text */
/* we need to figure out the background color first */
@@ -1337,18 +1373,26 @@ cw_draw_header(HDC hdc,
colattr = tbl->cols[cr->col].attr_id;
+ if (colattr == KCDB_ATTR_ID_NAME) {
+ khm_handle ident = o->data;
+
+ kcdb_identity_get_flags(ident, &idf);
+ }
+
selected = o->flags & KHUI_CW_O_SELECTED;
{
HBRUSH hbr;
if(selected)
hbr = tbl->hb_hdr_bg_sel;
- else if((o->flags & CW_EXPSTATE_MASK) == CW_EXPSTATE_EXPIRED)
+ else if ((o->flags & CW_EXPSTATE_MASK) == CW_EXPSTATE_EXPIRED)
hbr = tbl->hb_hdr_bg_exp;
- else if((o->flags & CW_EXPSTATE_MASK) == CW_EXPSTATE_CRITICAL)
+ else if ((o->flags & CW_EXPSTATE_MASK) == CW_EXPSTATE_CRITICAL)
hbr = tbl->hb_hdr_bg_crit;
- else if((o->flags & CW_EXPSTATE_MASK) == CW_EXPSTATE_WARN)
+ else if ((o->flags & CW_EXPSTATE_MASK) == CW_EXPSTATE_WARN)
hbr = tbl->hb_hdr_bg_warn;
+ else if (idf & KCDB_IDENT_FLAG_DEFAULT)
+ hbr = tbl->hb_hdr_bg_def;
else
hbr = tbl->hb_hdr_bg;
@@ -1365,24 +1409,45 @@ cw_draw_header(HDC hdc,
if (o->flags & KHUI_CW_O_STICKY) {
/* khui_ilist_draw_id(tbl->ilist, IDB_TK_NEW_SM, hdc,
r->left, r->bottom - KHUI_SMICON_CY, 0); */
- } else if((tbl->mouse_state & CW_MOUSE_OUTLINE) && tbl->mouse_row == row) {
+ } else if((tbl->mouse_state & CW_MOUSE_WOUTLINE) &&
+ tbl->mouse_row == row) {
if(o->flags & KHUI_CW_O_EXPAND) {
- khui_ilist_draw_id(tbl->ilist, IDB_WDG_EXPAND_HI, hdc, r->left, r->bottom - KHUI_SMICON_CY, 0);
+ khui_ilist_draw_id(tbl->ilist, IDB_WDG_EXPAND_HI,
+ hdc, r->left, r->bottom - KHUI_SMICON_CY, 0);
} else {
- khui_ilist_draw_id(tbl->ilist, IDB_WDG_COLLAPSE_HI, hdc, r->left, r->bottom - KHUI_SMICON_CY, 0);
+ khui_ilist_draw_id(tbl->ilist, IDB_WDG_COLLAPSE_HI,
+ hdc, r->left, r->bottom - KHUI_SMICON_CY, 0);
}
} else {
if(o->flags & KHUI_CW_O_EXPAND) {
- khui_ilist_draw_id(tbl->ilist, IDB_WDG_EXPAND, hdc, r->left, r->bottom - KHUI_SMICON_CY, 0);
+ khui_ilist_draw_id(tbl->ilist, IDB_WDG_EXPAND,
+ hdc, r->left, r->bottom - KHUI_SMICON_CY, 0);
} else {
- khui_ilist_draw_id(tbl->ilist, IDB_WDG_COLLAPSE, hdc, r->left, r->bottom - KHUI_SMICON_CY, 0);
+ khui_ilist_draw_id(tbl->ilist, IDB_WDG_COLLAPSE,
+ hdc, r->left, r->bottom - KHUI_SMICON_CY, 0);
}
}
- r->left += KHUI_SMICON_CX * 2;
+ r->left += KHUI_SMICON_CX * 3 / 2;
/* try to draw the icon, if there is one */
if(colattr == KCDB_ATTR_ID_NAME) {
+
+ khui_ilist_draw_id(tbl->ilist,
+ (((tbl->mouse_state & CW_MOUSE_WSTICKY) &&
+ tbl->mouse_row == row)?
+ ((idf & KCDB_IDENT_FLAG_STICKY)?
+ IDB_WDG_STUCK_HI:
+ IDB_WDG_STICK_HI):
+ ((idf & KCDB_IDENT_FLAG_STICKY)?
+ IDB_WDG_STUCK:
+ IDB_WDG_STICK)),
+ hdc,
+ r->left, r->bottom - KHUI_SMICON_CY,
+ 0);
+
+ r->left += KHUI_SMICON_CX * 3 / 2;
+
khui_ilist_draw_id(tbl->ilist,
((o->flags & KHUI_CW_O_STICKY)?
IDB_ID_DIS_SM:
@@ -1404,6 +1469,23 @@ cw_draw_header(HDC hdc,
SetTextColor(hdc, tbl->cr_hdr_normal);
TextOut(hdc, r->left, r->bottom - tbl->vpad, o->header, (int) wcslen(o->header));
+
+ if (colattr == KCDB_ATTR_ID_NAME &&
+ (idf & KCDB_IDENT_FLAG_DEFAULT)) {
+ wchar_t defstr[64];
+ SIZE size;
+
+ LoadString(khm_hInstance, IDS_CW_DEFAULT,
+ defstr, ARRAYLENGTH(defstr));
+
+ GetTextExtentPoint32(hdc, o->header, (int) wcslen(o->header),
+ &size);
+
+ r->left += size.cx + KHUI_SMICON_CX * 2;
+
+ TextOut(hdc, r->left, r->bottom - tbl->vpad,
+ defstr, (int) wcslen(defstr));
+ }
}
LRESULT
@@ -1474,8 +1556,10 @@ cw_wm_create(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
khui_credwnd_tbl * tbl;
kmq_subscribe_hwnd(KMSG_CRED, hwnd);
+ kmq_subscribe_hwnd(KMSG_KCDB, hwnd);
- tbl = malloc(sizeof(*tbl));
+ /* freed in cw_wm_destroy */
+ tbl = PMALLOC(sizeof(*tbl));
ZeroMemory(tbl, sizeof(*tbl));
/* some versions of VC generate portability warnings for
@@ -1490,7 +1574,11 @@ cw_wm_create(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
WC_HEADER,
(LPWSTR) NULL,
WS_CHILD | HDS_BUTTONS |
- HDS_FULLDRAG | HDS_HORZ | HDS_HOTTRACK | HDS_FLAT,
+ HDS_FULLDRAG | HDS_HORZ | HDS_HOTTRACK
+#if (_WIN32_WINNT >= 0x501)
+ | HDS_FLAT
+#endif
+ ,
0,0,0,0,hwnd, (HMENU) 0, khm_hInstance, NULL);
cw_load_view(tbl, NULL /* default view */, hwnd);
@@ -1530,12 +1618,13 @@ cw_wm_destroy(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
khui_credwnd_tbl * tbl;
kmq_unsubscribe_hwnd(KMSG_CRED, hwnd);
+ kmq_unsubscribe_hwnd(KMSG_KCDB, hwnd);
tbl = (khui_credwnd_tbl *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);
cw_unload_view(tbl);
- free(tbl);
+ PFREE(tbl);
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
@@ -1838,19 +1927,42 @@ cw_kmq_wm_dispatch(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
kmq_wm_begin(lParam, &m);
if(m->type == KMSG_CRED) {
- if(m->subtype == KMSG_CRED_ROOTDELTA) {
+ switch (m->subtype) {
+ case KMSG_CRED_ROOTDELTA:
cw_update_creds(tbl);
cw_update_outline(tbl);
cw_update_extents(tbl, TRUE);
InvalidateRect(hwnd, NULL, FALSE);
- } else if(m->subtype == KMSG_CRED_PP_BEGIN) {
+ break;
+
+ case KMSG_CRED_PP_BEGIN:
cw_pp_begin((khui_property_sheet *) m->vparam);
- } else if(m->subtype == KMSG_CRED_PP_PRECREATE) {
+ break;
+
+ case KMSG_CRED_PP_PRECREATE:
cw_pp_precreate((khui_property_sheet *) m->vparam);
- } else if(m->subtype == KMSG_CRED_PP_END) {
+ break;
+
+ case KMSG_CRED_PP_END:
cw_pp_end((khui_property_sheet *) m->vparam);
- } else if(m->subtype == KMSG_CRED_PP_DESTROY) {
+ break;
+
+ case KMSG_CRED_PP_DESTROY:
cw_pp_destroy((khui_property_sheet *) m->vparam);
+ break;
+ }
+ } else if (m->type == KMSG_KCDB) {
+ if (m->subtype == KMSG_KCDB_IDENT &&
+ m->uparam == KCDB_OP_MODIFY) {
+
+ cw_update_outline(tbl);
+ cw_update_extents(tbl, TRUE);
+ InvalidateRect(hwnd, NULL, FALSE);
+ }
+ else if (m->subtype == KMSG_KCDB_IDENT &&
+ m->uparam == KCDB_OP_NEW_DEFAULT) {
+
+ InvalidateRect(hwnd, NULL, FALSE);
}
}
return kmq_wm_end(m, rv);
@@ -1963,6 +2075,15 @@ cw_set_row_context(khui_credwnd_tbl * tbl, int row)
khui_credwnd_outline * o;
BOOL set_context = TRUE;
+ if (row < 0 || row >= (int) tbl->n_rows) {
+ if (tbl->n_rows > 0)
+ row = 0;
+ else {
+ khui_context_reset();
+ return;
+ }
+ }
+
if (tbl->rows[row].flags & KHUI_CW_ROW_HEADER) {
o = (khui_credwnd_outline *) tbl->rows[row].data;
@@ -2077,6 +2198,28 @@ cw_set_row_context(khui_credwnd_tbl * tbl, int row)
}
}
+static void
+cw_select_all(khui_credwnd_tbl * tbl)
+{
+ khm_size i;
+
+ for(i=0; i<tbl->n_rows; i++) {
+ tbl->rows[i].flags |= KHUI_CW_ROW_SELECTED;
+ if (!(tbl->rows[i].flags & KHUI_CW_ROW_HEADER))
+ kcdb_cred_set_flags((khm_handle) tbl->rows[i].data,
+ KCDB_CRED_FLAG_SELECTED,
+ KCDB_CRED_FLAG_SELECTED);
+ }
+
+ cw_select_outline_level(tbl->outline, TRUE);
+
+ cw_update_selection_state(tbl);
+
+ cw_set_row_context(tbl, tbl->cursor_row);
+
+ InvalidateRect(tbl->hwnd, NULL, FALSE);
+}
+
static void
cw_select_row(khui_credwnd_tbl * tbl, int row, WPARAM wParam)
{
@@ -2231,11 +2374,10 @@ cw_wm_mouse(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
tbl = (khui_credwnd_tbl *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);
/* we are basically trying to capture events where the mouse is
- hovering over one of the 'hotspots'. There are two kinds of
- hotspots one is the little widget thinggy that you click on to
- expand or collapse an outline. The other is a text cell that is
- partially concealed.
- */
+ hovering over one of the 'hotspots'. There are two kinds of
+ hotspots one is the little widget thinggy that you click on to
+ expand or collapse an outline. The other is a text cell that
+ is partially concealed. */
x = GET_X_LPARAM(lParam);
y = GET_Y_LPARAM(lParam);
@@ -2246,10 +2388,10 @@ cw_wm_mouse(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
col = -1;
nm_state = CW_MOUSE_NONE;
nm_row = nm_col = -1;
+
for(i=0; i < (int) tbl->n_cols; i++) {
if(x >= tbl->cols[i].x &&
- x < tbl->cols[i].x + tbl->cols[i].width)
- {
+ x < tbl->cols[i].x + tbl->cols[i].width) {
col = i;
break;
}
@@ -2266,68 +2408,126 @@ cw_wm_mouse(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
/* are we on a widget then? */
x -= tbl->cols[tbl->rows[row].col].x;
if(x >= 0 && x < KHUI_SMICON_CX) /* hit */ {
- nm_state |= CW_MOUSE_OUTLINE;
+ nm_state |= CW_MOUSE_WOUTLINE | CW_MOUSE_WIDGET;
+ } else if (tbl->cols[tbl->rows[row].col].attr_id ==
+ KCDB_ATTR_ID_NAME &&
+ col == tbl->rows[row].col &&
+ x >= KHUI_SMICON_CX * 3 / 2 &&
+ x < KHUI_SMICON_CX * 5 / 2){
+ nm_state |= CW_MOUSE_WSTICKY | CW_MOUSE_WIDGET;
}
}
}
- if((tbl->mouse_state & CW_MOUSE_LDOWN) &&
- (tbl->mouse_state & CW_MOUSE_OUTLINE) &&
- (nm_row != tbl->mouse_row))
- {
- nm_state &= ~CW_MOUSE_OUTLINE;
+ /* did the user drag the cursor off the current row? */
+ if((tbl->mouse_state & CW_MOUSE_LDOWN) &&
+ (nm_row != tbl->mouse_row)) {
+ nm_state &= ~(CW_MOUSE_WIDGET | CW_MOUSE_WOUTLINE | CW_MOUSE_WSTICKY);
}
if(!(nm_state & CW_MOUSE_LDOWN) &&
- (tbl->mouse_state & CW_MOUSE_LDOWN)) {
+ (tbl->mouse_state & CW_MOUSE_LDOWN) &&
+ tbl->mouse_row == nm_row) {
- if((nm_state & CW_MOUSE_OUTLINE) &&
- (tbl->mouse_state & CW_MOUSE_OUTLINE)) {
- /* click on a widget */
+ if((nm_state & CW_MOUSE_WOUTLINE) &&
+ (tbl->mouse_state & CW_MOUSE_WOUTLINE)) {
+ /* click on an outline widget */
khui_credwnd_outline * o;
o = (khui_credwnd_outline *) tbl->rows[nm_row].data;
- tbl->mouse_state = CW_MOUSE_OUTLINE;
+ tbl->mouse_state = CW_MOUSE_WIDGET | CW_MOUSE_WOUTLINE;
cw_toggle_outline_state(tbl, o);
return 0;
- } else if(nm_row == tbl->mouse_row) {
+ } else if ((nm_state & CW_MOUSE_WSTICKY) &&
+ (tbl->mouse_state & CW_MOUSE_WSTICKY)) {
+
+ khui_credwnd_outline * o;
+ khm_handle ident;
+ khm_int32 idf = 0;
+
+ o = tbl->rows[nm_row].data;
+ ident = o->data;
+
+ kcdb_identity_get_flags(ident, &idf);
+ idf &= KCDB_IDENT_FLAG_STICKY;
+ kcdb_identity_set_flags(ident, (idf ^ KCDB_IDENT_FLAG_STICKY),
+ KCDB_IDENT_FLAG_STICKY);
+
+ tbl->mouse_state = CW_MOUSE_WIDGET | CW_MOUSE_WSTICKY;
+
+ return 0;
+ } else {
/* click on a row */
cw_select_row(tbl, nm_row, wParam);
}
-
}
- /*TODO: if a user clicks somewhere and drags on to an exand widget, it activates the widet. should not */
-
/* ok, now if we are changing state, we need to invalidate a few
regions */
- if((tbl->mouse_state ^ nm_state) & CW_MOUSE_OUTLINE) {
- if(tbl->mouse_state & CW_MOUSE_OUTLINE) {
+ if (((tbl->mouse_state ^ nm_state) & (CW_MOUSE_WIDGET |
+ CW_MOUSE_WOUTLINE |
+ CW_MOUSE_WSTICKY)) ||
+ tbl->mouse_row != nm_row) {
+
+ if(tbl->mouse_state & CW_MOUSE_WOUTLINE) {
r.left = tbl->cols[tbl->mouse_col].x - tbl->scr_left;
- r.top = tbl->mouse_row * tbl->cell_height + tbl->header_height - tbl->scr_top;
+ r.top = tbl->mouse_row * tbl->cell_height +
+ tbl->header_height - tbl->scr_top;
+ r.right = r.left + KHUI_SMICON_CX;
+ r.bottom = r.top + tbl->cell_height;
+ InvalidateRect(tbl->hwnd, &r, TRUE);
+ }
+ if(tbl->mouse_state & CW_MOUSE_WSTICKY) {
+ r.left = KHUI_SMICON_CX * 3 / 2 +
+ tbl->cols[tbl->mouse_col].x - tbl->scr_left;
+ r.top = tbl->mouse_row * tbl->cell_height +
+ tbl->header_height - tbl->scr_top;
r.right = r.left + KHUI_SMICON_CX;
r.bottom = r.top + tbl->cell_height;
InvalidateRect(tbl->hwnd, &r, TRUE);
}
- tbl->mouse_col = nm_col;
- tbl->mouse_row = nm_row;
+ if ((tbl->mouse_state & nm_state) & CW_MOUSE_LDOWN) {
+ if (tbl->mouse_row == nm_row)
+ tbl->mouse_col = nm_col;
+ } else {
+ tbl->mouse_col = nm_col;
+ tbl->mouse_row = nm_row;
+ }
tbl->mouse_state = nm_state;
/* same code block as above */
- if(tbl->mouse_state & CW_MOUSE_OUTLINE) {
+ if(tbl->mouse_state & CW_MOUSE_WOUTLINE) {
r.left = tbl->cols[tbl->mouse_col].x - tbl->scr_left;
- r.top = tbl->mouse_row * tbl->cell_height + tbl->header_height - tbl->scr_top;
+ r.top = tbl->mouse_row * tbl->cell_height +
+ tbl->header_height - tbl->scr_top;
+ r.right = r.left + KHUI_SMICON_CX;
+ r.bottom = r.top + tbl->cell_height;
+ InvalidateRect(tbl->hwnd, &r, TRUE);
+ }
+ if(tbl->mouse_state & CW_MOUSE_WSTICKY) {
+ r.left = KHUI_SMICON_CX * 3 / 2 +
+ tbl->cols[tbl->mouse_col].x - tbl->scr_left;
+ r.top = tbl->mouse_row * tbl->cell_height +
+ tbl->header_height - tbl->scr_top;
r.right = r.left + KHUI_SMICON_CX;
r.bottom = r.top + tbl->cell_height;
InvalidateRect(tbl->hwnd, &r, TRUE);
}
} else if(tbl->mouse_state != nm_state) {
- tbl->mouse_col = nm_col;
- tbl->mouse_row = nm_row;
- tbl->mouse_state = nm_state;
+
+ if ((tbl->mouse_state & nm_state) & CW_MOUSE_LDOWN) {
+ if (tbl->mouse_row == nm_row) {
+ tbl->mouse_col = nm_col;
+ tbl->mouse_state = nm_state;
+ }
+ } else {
+ tbl->mouse_col = nm_col;
+ tbl->mouse_row = nm_row;
+ tbl->mouse_state = nm_state;
+ }
}
/* if it was a double click, also show the property
@@ -2553,13 +2753,13 @@ static INT_PTR CALLBACK
cw_pp_ident_proc(HWND hwnd,
UINT uMsg,
WPARAM wParam,
- LPARAM lParam
- )
+ LPARAM lParam)
{
+ khui_property_sheet * s;
+
switch(uMsg) {
case WM_INITDIALOG:
{
- khui_property_sheet * s;
PROPSHEETPAGE * p;
khm_handle ident;
wchar_t idname[KCDB_IDENT_MAXCCH_NAME];
@@ -2582,23 +2782,108 @@ cw_pp_ident_proc(HWND hwnd,
kcdb_identity_get_flags(ident, &i);
- SendDlgItemMessage(hwnd,
- IDC_PP_IDDEF,
- BM_SETCHECK,
- (WPARAM) ((i & KCDB_IDENT_FLAG_DEFAULT)?BST_CHECKED:BST_UNCHECKED),
- 0);
+ CheckDlgButton(hwnd, IDC_PP_IDDEF,
+ ((i & KCDB_IDENT_FLAG_DEFAULT)?BST_CHECKED:
+ BST_UNCHECKED));
+
+ /* if it's default, you can't change it further */
+ if (i & KCDB_IDENT_FLAG_DEFAULT) {
+ EnableWindow(GetDlgItem(hwnd, IDC_PP_IDDEF), FALSE);
+ }
+
+ CheckDlgButton(hwnd, IDC_PP_IDSEARCH,
+ ((i & KCDB_IDENT_FLAG_SEARCHABLE)?BST_CHECKED:
+ BST_UNCHECKED));
- SendDlgItemMessage(
- hwnd,
- IDC_PP_IDSEARCH,
- BM_SETCHECK,
- (WPARAM) ((i & KCDB_IDENT_FLAG_SEARCHABLE)?BST_CHECKED:BST_UNCHECKED),
- 0);
+ CheckDlgButton(hwnd, IDC_PP_STICKY,
+ ((i & KCDB_IDENT_FLAG_STICKY)?BST_CHECKED:
+ BST_UNCHECKED));
khui_property_wnd_set_record(GetDlgItem(hwnd, IDC_PP_PROPLIST),
ident);
}
return TRUE;
+
+ case WM_COMMAND:
+ s = (khui_property_sheet *) (LONG_PTR)
+ GetWindowLongPtr(hwnd, DWLP_USER);
+
+ switch(wParam) {
+ case MAKEWPARAM(IDC_PP_IDDEF, BN_CLICKED):
+ /* fallthrough */
+ case MAKEWPARAM(IDC_PP_STICKY, BN_CLICKED):
+
+ if (s->status != KHUI_PS_STATUS_NONE)
+ PropSheet_Changed(s->hwnd, hwnd);
+ return TRUE;
+
+ case MAKEWPARAM(IDC_PP_CONFIG, BN_CLICKED):
+ {
+ khui_config_node cfg_ids = NULL;
+ khm_int32 rv;
+
+ khm_refresh_config();
+
+ rv = khui_cfg_open(NULL,
+ L"KhmIdentities",
+ &cfg_ids);
+
+ if (KHM_FAILED(rv))
+ return TRUE;
+
+ khm_show_config_pane(cfg_ids);
+
+ if (cfg_ids)
+ khui_cfg_release(cfg_ids);
+ }
+ return TRUE;
+ }
+ return FALSE;
+
+ case WM_NOTIFY:
+ {
+ LPPSHNOTIFY lpp;
+ khm_int32 flags;
+
+ lpp = (LPPSHNOTIFY) lParam;
+ s = (khui_property_sheet *) (LONG_PTR)
+ GetWindowLongPtr(hwnd, DWLP_USER);
+
+ switch(lpp->hdr.code) {
+ case PSN_APPLY:
+ flags = 0;
+ if (IsDlgButtonChecked(hwnd, IDC_PP_STICKY) == BST_CHECKED)
+ flags |= KCDB_IDENT_FLAG_STICKY;
+ if (IsDlgButtonChecked(hwnd, IDC_PP_IDDEF) == BST_CHECKED)
+ flags |= KCDB_IDENT_FLAG_DEFAULT;
+
+ kcdb_identity_set_flags(s->identity, flags,
+ KCDB_IDENT_FLAG_STICKY |
+ KCDB_IDENT_FLAG_DEFAULT);
+ return TRUE;
+
+ case PSN_RESET:
+ kcdb_identity_get_flags(s->identity, &flags);
+
+ CheckDlgButton(hwnd,
+ IDC_PP_IDDEF,
+ ((flags & KCDB_IDENT_FLAG_DEFAULT)?BST_CHECKED:
+ BST_UNCHECKED));
+
+ /* if it's default, you can't change it further */
+ if (flags & KCDB_IDENT_FLAG_DEFAULT) {
+ EnableWindow(GetDlgItem(hwnd, IDC_PP_IDDEF), FALSE);
+ }
+
+ CheckDlgButton(hwnd, IDC_PP_IDSEARCH,
+ ((flags & KCDB_IDENT_FLAG_SEARCHABLE)?BST_CHECKED:BST_UNCHECKED));
+
+ CheckDlgButton(hwnd, IDC_PP_STICKY,
+ ((flags & KCDB_IDENT_FLAG_STICKY)?BST_CHECKED:BST_UNCHECKED));
+ return TRUE;
+ }
+ }
+ break;
}
return FALSE;
}
@@ -2642,7 +2927,7 @@ cw_pp_begin(khui_property_sheet * s)
PROPSHEETPAGE *p;
if(s->identity) {
- p = malloc(sizeof(*p));
+ p = PMALLOC(sizeof(*p));
ZeroMemory(p, sizeof(*p));
p->dwSize = sizeof(*p);
@@ -2651,11 +2936,12 @@ cw_pp_begin(khui_property_sheet * s)
p->pszTemplate = MAKEINTRESOURCE(IDD_PP_IDENT);
p->pfnDlgProc = cw_pp_ident_proc;
p->lParam = (LPARAM) s;
- khui_ps_add_page(s, KHUI_PPCT_IDENTITY, 0, p, NULL);
+
+ khui_ps_add_page(s, KHUI_PPCT_IDENTITY, 129, p, NULL);
}
if(s->cred) {
- p = malloc(sizeof(*p));
+ p = PMALLOC(sizeof(*p));
ZeroMemory(p, sizeof(*p));
p->dwSize = sizeof(*p);
@@ -2664,7 +2950,8 @@ cw_pp_begin(khui_property_sheet * s)
p->pszTemplate = MAKEINTRESOURCE(IDD_PP_CRED);
p->pfnDlgProc = cw_pp_cred_proc;
p->lParam = (LPARAM) s;
- khui_ps_add_page(s, KHUI_PPCT_CREDENTIAL, 0, p, NULL);
+
+ khui_ps_add_page(s, KHUI_PPCT_CREDENTIAL, 128, p, NULL);
}
}
@@ -2683,7 +2970,7 @@ cw_pp_end(khui_property_sheet * s)
khui_ps_find_page(s, KHUI_PPCT_IDENTITY, &p);
if(p) {
- free(p->p_page);
+ PFREE(p->p_page);
p->p_page = NULL;
}
@@ -2691,7 +2978,7 @@ cw_pp_end(khui_property_sheet * s)
khui_ps_find_page(s, KHUI_PPCT_CREDENTIAL, &p);
if(p) {
- free(p->p_page);
+ PFREE(p->p_page);
p->p_page = NULL;
}
}
@@ -2701,24 +2988,26 @@ cw_pp_destroy(khui_property_sheet *ps)
{
if(ps->ctx.scope == KHUI_SCOPE_CRED) {
if(ps->header.pszCaption)
- free((LPWSTR) ps->header.pszCaption);
+ PFREE((LPWSTR) ps->header.pszCaption);
}
+ khui_context_release(&ps->ctx);
+
khui_ps_destroy_sheet(ps);
/* this is pretty weird because ps gets freed when
- khui_ps_destroy_sheet() is called. However, since destroying ps
- involves sending a WM_DESTROY message to the property sheet, we
- still need to keep it on the property sheet chain (or else the
- messages will not be delivered). This is only safe because we are
- not relinquishing the thread in-between destroying ps and removing
- it from the chain. */
-
- /*TODO: fix this */
+ khui_ps_destroy_sheet() is called. However, since destroying
+ ps involves sending a WM_DESTROY message to the property sheet,
+ we still need to keep it on the property sheet chain (or else
+ the messages will not be delivered). This is only safe because
+ we are not relinquishing the thread in-between destroying ps
+ and removing it from the chain. */
+
+ /* TODO: fix this */
khm_del_property_sheet(ps);
}
-LRESULT
+LRESULT
cw_properties(HWND hwnd)
{
/* show a property sheet of some sort */
@@ -2730,7 +3019,7 @@ cw_properties(HWND hwnd)
tbl = (khui_credwnd_tbl *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);
if(ctx.scope == KHUI_SCOPE_NONE) {
-
+ khui_context_release(&ctx);
return FALSE;
/* While it seems like a good idea, doing this is not */
@@ -2764,6 +3053,7 @@ cw_properties(HWND hwnd)
/* if still no context, then we can't show a property sheet */
if(ctx.scope == KHUI_SCOPE_NONE) {
+ khui_context_release(&ctx);
return FALSE;
}
@@ -2781,8 +3071,9 @@ cw_properties(HWND hwnd)
kcdb_identity_get_name(ident, NULL, &t);
if(t > 0) {
- ps->header.pszCaption = malloc(t);
- kcdb_identity_get_name(ident, (wchar_t *) ps->header.pszCaption, &t);
+ ps->header.pszCaption = PMALLOC(t);
+ kcdb_identity_get_name(ident,
+ (wchar_t *) ps->header.pszCaption, &t);
} else {
ps->header.pszCaption = NULL;
}
@@ -2813,7 +3104,7 @@ cw_properties(HWND hwnd)
something else */
kcdb_identity_get_name(ctx.identity, NULL, &t);
if (t > 0) {
- ps->header.pszCaption = malloc(t);
+ ps->header.pszCaption = PMALLOC(t);
kcdb_identity_get_name(ctx.identity, (wchar_t *) ps->header.pszCaption, &t);
} else {
ps->header.pszCaption = NULL;
@@ -2821,7 +3112,7 @@ cw_properties(HWND hwnd)
} else {
kcdb_credtype_describe(cred_type, NULL, &t, KCDB_TS_LONG);
if(t > 0) {
- ps->header.pszCaption = malloc(t);
+ ps->header.pszCaption = PMALLOC(t);
kcdb_credtype_describe(cred_type, (wchar_t *) ps->header.pszCaption, &t, KCDB_TS_LONG);
} else {
ps->header.pszCaption = NULL;
@@ -2840,7 +3131,7 @@ cw_properties(HWND hwnd)
ps->ctx = ctx;
kcdb_cred_get_name(cred, NULL, &t);
- ps->header.pszCaption = malloc(t);
+ ps->header.pszCaption = PMALLOC(t);
kcdb_cred_get_name(cred, (LPWSTR) ps->header.pszCaption, &t);
kcdb_cred_get_identity(cred, &ps->identity);
@@ -2849,10 +3140,13 @@ cw_properties(HWND hwnd)
kmq_post_message(KMSG_CRED, KMSG_CRED_PP_BEGIN, 0, (void *) ps);
} else {
+ khui_context_release(&ctx);
khui_ps_destroy_sheet(ps);
}
- khui_context_reset();
+ /* by the way, if we are actually opening a property sheet, we
+ leave ctx held (which is now copied to ps->ctx). it will be
+ released when the property sheet is destroyed */
return TRUE;
}
@@ -2989,6 +3283,12 @@ cw_wm_command(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
}
break;
+ case KHUI_PACTION_SELALL:
+ {
+ cw_select_all(tbl);
+ }
+ break;
+
case KHUI_PACTION_LEFT:
{ /* collapse and up*/
khui_credwnd_outline * o;
diff --git a/src/windows/identity/ui/credwnd.h b/src/windows/identity/ui/credwnd.h
index 66fc3d2fbc..5d1137f846 100644
--- a/src/windows/identity/ui/credwnd.h
+++ b/src/windows/identity/ui/credwnd.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 Massachusetts Institute of Technology
+ * Copyright (c) 2005 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -173,6 +173,7 @@ typedef struct khui_credwnd_tbl_t {
HBRUSH hb_hdr_bg_warn; /* header background color (warn) */
HBRUSH hb_hdr_bg_crit; /* header background color (critical) */
HBRUSH hb_hdr_bg_sel; /* header background color (selected) */
+ HBRUSH hb_hdr_bg_def; /* header background color (default) */
HCURSOR hc_hand; /* the HAND cursor */
khui_ilist * ilist; /* image list */
@@ -205,10 +206,16 @@ typedef struct khui_credwnd_tbl_t {
#define KHUI_CW_TBL_ACTIVE 0x00000100
/* mouse_state constants */
-#define CW_MOUSE_NONE 0 /* nothing interesting */
-#define CW_MOUSE_OUTLINE 1 /* mouse is highlighting an outline widget */
-#define CW_MOUSE_LDOWN 2 /* left button is down */
-#define CW_MOUSE_ROW 4 /* mouse is acive over a valid row */
+#define CW_MOUSE_NONE 0x00000000 /* nothing interesting */
+#define CW_MOUSE_WIDGET 0x00000001 /* mouse is highlighting a
+ widget */
+#define CW_MOUSE_LDOWN 0x00000002 /* left button is down */
+#define CW_MOUSE_ROW 0x00000004 /* mouse is acive over a valid
+ row */
+#define CW_MOUSE_WOUTLINE 0x00000008 /* mouse is highlighting an
+ outline widget */
+#define CW_MOUSE_WSTICKY 0x00000010 /* mouse is highlighting a
+ sticky widget */
void khm_unregister_credwnd_class(void);
diff --git a/src/windows/identity/ui/htwnd.c b/src/windows/identity/ui/htwnd.c
index 9acbac704e..0ad9c880f4 100644
--- a/src/windows/identity/ui/htwnd.c
+++ b/src/windows/identity/ui/htwnd.c
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2004 Massachusetts Institute of Technology
+* Copyright (c) 2005 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -384,7 +384,7 @@ static int htw_parse_tag(
khui_htwnd_link * l;
if(!d->links) {
- d->links = malloc(sizeof(khui_htwnd_link *) * HTW_LINK_ALLOC);
+ d->links = PMALLOC(sizeof(khui_htwnd_link *) * HTW_LINK_ALLOC);
ZeroMemory(d->links, sizeof(khui_htwnd_link *) * HTW_LINK_ALLOC);
d->max_links = HTW_LINK_ALLOC;
d->n_links = 0;
@@ -396,17 +396,17 @@ static int htw_parse_tag(
n_new = UBOUNDSS(d->n_links + 1, HTW_LINK_ALLOC, HTW_LINK_ALLOC);
- ll = malloc(sizeof(khui_htwnd_link *) * n_new);
+ ll = PMALLOC(sizeof(khui_htwnd_link *) * n_new);
ZeroMemory(ll, sizeof(khui_htwnd_link *) * n_new);
memcpy(ll, d->links, sizeof(khui_htwnd_link *) * d->max_links);
- free(d->links);
+ PFREE(d->links);
d->links = ll;
d->max_links = n_new;
}
l = d->links[d->n_links];
if(!l) {
- l = malloc(sizeof(khui_htwnd_link));
+ l = PMALLOC(sizeof(khui_htwnd_link));
d->links[d->n_links] = l;
}
@@ -807,7 +807,7 @@ LRESULT CALLBACK khui_htwnd_proc(HWND hwnd,
cs = (CREATESTRUCT *) lParam;
- d = malloc(sizeof(*d));
+ d = PMALLOC(sizeof(*d));
ZeroMemory(d, sizeof(*d));
if(cs->dwExStyle & WS_EX_TRANSPARENT) {
@@ -824,7 +824,7 @@ LRESULT CALLBACK khui_htwnd_proc(HWND hwnd,
if(SUCCEEDED(StringCbLength(cs->lpszName, KHUI_HTWND_MAXCB_TEXT, &cbsize))) {
cbsize += sizeof(wchar_t);
- d->text = malloc(cbsize);
+ d->text = PMALLOC(cbsize);
StringCbCopy(d->text, cbsize, cs->lpszName);
}
@@ -848,13 +848,13 @@ LRESULT CALLBACK khui_htwnd_proc(HWND hwnd,
newtext = (wchar_t *) lParam;
if(d->text) {
- free(d->text);
+ PFREE(d->text);
d->text = NULL;
}
if(SUCCEEDED(StringCbLength(newtext, KHUI_HTWND_MAXCB_TEXT, &cbsize))) {
cbsize += sizeof(wchar_t);
- d->text = malloc(cbsize);
+ d->text = PMALLOC(cbsize);
StringCbCopy(d->text, cbsize, newtext);
rv = TRUE;
} else
@@ -875,20 +875,20 @@ LRESULT CALLBACK khui_htwnd_proc(HWND hwnd,
d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);
if(d->text)
- free(d->text);
+ PFREE(d->text);
d->text = 0;
if(d->links) {
for(i=0;i<d->max_links;i++) {
if(d->links[i])
- free(d->links[i]);
+ PFREE(d->links[i]);
}
- free(d->links);
+ PFREE(d->links);
}
clear_styles(d);
- free(d);
+ PFREE(d);
}
break;
diff --git a/src/windows/identity/ui/htwnd.h b/src/windows/identity/ui/htwnd.h
index 9e74788038..e83dbb6844 100644
--- a/src/windows/identity/ui/htwnd.h
+++ b/src/windows/identity/ui/htwnd.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 Massachusetts Institute of Technology
+ * Copyright (c) 2005 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
diff --git a/src/windows/identity/ui/images/Thumbs.db b/src/windows/identity/ui/images/Thumbs.db
deleted file mode 100644
index a80265f867..0000000000
--- a/src/windows/identity/ui/images/Thumbs.db
+++ /dev/null
Binary files differ
diff --git a/src/windows/identity/ui/images/bitmap1.bmp b/src/windows/identity/ui/images/bitmap1.bmp
deleted file mode 100644
index 1f07309b90..0000000000
--- a/src/windows/identity/ui/images/bitmap1.bmp
+++ /dev/null
Binary files differ
diff --git a/src/windows/identity/ui/images/cfg_plugin.ico b/src/windows/identity/ui/images/cfg_plugin.ico
new file mode 100644
index 0000000000..710a962980
--- /dev/null
+++ b/src/windows/identity/ui/images/cfg_plugin.ico
Binary files differ
diff --git a/src/windows/identity/ui/images/chpw.bmp b/src/windows/identity/ui/images/chpw.bmp
index 688da40df3..71c95ad4ab 100644
--- a/src/windows/identity/ui/images/chpw.bmp
+++ b/src/windows/identity/ui/images/chpw.bmp
Binary files differ
diff --git a/src/windows/identity/ui/images/help.bmp b/src/windows/identity/ui/images/help.bmp
index d7d4eafacc..568c46bec8 100644
--- a/src/windows/identity/ui/images/help.bmp
+++ b/src/windows/identity/ui/images/help.bmp
Binary files differ
diff --git a/src/windows/identity/ui/images/icon1.ico b/src/windows/identity/ui/images/icon1.ico
deleted file mode 100644
index c2746b065c..0000000000
--- a/src/windows/identity/ui/images/icon1.ico
+++ /dev/null
Binary files differ
diff --git a/src/windows/identity/ui/images/id-dis-sm.bmp b/src/windows/identity/ui/images/id-dis-sm.bmp
index ff0c38e4d1..d028d84ca8 100644
--- a/src/windows/identity/ui/images/id-dis-sm.bmp
+++ b/src/windows/identity/ui/images/id-dis-sm.bmp
Binary files differ
diff --git a/src/windows/identity/ui/images/import.bmp b/src/windows/identity/ui/images/import.bmp
index 6a428c979e..b067166b73 100644
--- a/src/windows/identity/ui/images/import.bmp
+++ b/src/windows/identity/ui/images/import.bmp
Binary files differ
diff --git a/src/windows/identity/ui/images/main_app_old.ico b/src/windows/identity/ui/images/main_app_old.ico
deleted file mode 100644
index e3222e7fdd..0000000000
--- a/src/windows/identity/ui/images/main_app_old.ico
+++ /dev/null
Binary files differ
diff --git a/src/windows/identity/ui/images/text1138.png b/src/windows/identity/ui/images/text1138.png
deleted file mode 100644
index cf5ee376c3..0000000000
--- a/src/windows/identity/ui/images/text1138.png
+++ /dev/null
Binary files differ
diff --git a/src/windows/identity/ui/images/tk-delete.bmp b/src/windows/identity/ui/images/tk-delete.bmp
index 501ff6e241..a60bf81992 100644
--- a/src/windows/identity/ui/images/tk-delete.bmp
+++ b/src/windows/identity/ui/images/tk-delete.bmp
Binary files differ
diff --git a/src/windows/identity/ui/images/tk-new.bmp b/src/windows/identity/ui/images/tk-new.bmp
index e0e7bc0d65..9d0eec64fe 100644
--- a/src/windows/identity/ui/images/tk-new.bmp
+++ b/src/windows/identity/ui/images/tk-new.bmp
Binary files differ
diff --git a/src/windows/identity/ui/images/tk-refresh.bmp b/src/windows/identity/ui/images/tk-refresh.bmp
index 6e39f87748..9b8b1b0cb1 100644
--- a/src/windows/identity/ui/images/tk-refresh.bmp
+++ b/src/windows/identity/ui/images/tk-refresh.bmp
Binary files differ
diff --git a/src/windows/identity/ui/images/vw-refresh.bmp b/src/windows/identity/ui/images/vw-refresh.bmp
index 76b68ddf75..6d284a50e5 100644
--- a/src/windows/identity/ui/images/vw-refresh.bmp
+++ b/src/windows/identity/ui/images/vw-refresh.bmp
Binary files differ
diff --git a/src/windows/identity/ui/images/wdg_collapsed.bmp b/src/windows/identity/ui/images/wdg_collapsed.bmp
index f4d82977ca..4299854d37 100644
--- a/src/windows/identity/ui/images/wdg_collapsed.bmp
+++ b/src/windows/identity/ui/images/wdg_collapsed.bmp
Binary files differ
diff --git a/src/windows/identity/ui/images/wdg_collapsed_hi.bmp b/src/windows/identity/ui/images/wdg_collapsed_hi.bmp
index 90ab26d679..cb06b8acbf 100644
--- a/src/windows/identity/ui/images/wdg_collapsed_hi.bmp
+++ b/src/windows/identity/ui/images/wdg_collapsed_hi.bmp
Binary files differ
diff --git a/src/windows/identity/ui/images/wdg_expanded.bmp b/src/windows/identity/ui/images/wdg_expanded.bmp
index c590722309..76ee5b016d 100644
--- a/src/windows/identity/ui/images/wdg_expanded.bmp
+++ b/src/windows/identity/ui/images/wdg_expanded.bmp
Binary files differ
diff --git a/src/windows/identity/ui/images/wdg_expanded_hi.bmp b/src/windows/identity/ui/images/wdg_expanded_hi.bmp
index 6b2affc6df..8180b33337 100644
--- a/src/windows/identity/ui/images/wdg_expanded_hi.bmp
+++ b/src/windows/identity/ui/images/wdg_expanded_hi.bmp
Binary files differ
diff --git a/src/windows/identity/ui/images/wdg_stick.bmp b/src/windows/identity/ui/images/wdg_stick.bmp
new file mode 100644
index 0000000000..071a238c4d
--- /dev/null
+++ b/src/windows/identity/ui/images/wdg_stick.bmp
Binary files differ
diff --git a/src/windows/identity/ui/images/wdg_stick_hi.bmp b/src/windows/identity/ui/images/wdg_stick_hi.bmp
new file mode 100644
index 0000000000..8857fec220
--- /dev/null
+++ b/src/windows/identity/ui/images/wdg_stick_hi.bmp
Binary files differ
diff --git a/src/windows/identity/ui/images/wdg_stuck.bmp b/src/windows/identity/ui/images/wdg_stuck.bmp
new file mode 100644
index 0000000000..68295181d5
--- /dev/null
+++ b/src/windows/identity/ui/images/wdg_stuck.bmp
Binary files differ
diff --git a/src/windows/identity/ui/images/wdg_stuck_hi.bmp b/src/windows/identity/ui/images/wdg_stuck_hi.bmp
new file mode 100644
index 0000000000..3b78071291
--- /dev/null
+++ b/src/windows/identity/ui/images/wdg_stuck_hi.bmp
Binary files differ
diff --git a/src/windows/identity/ui/images/wgt_arrow_collapse.ico b/src/windows/identity/ui/images/wgt_arrow_collapse.ico
deleted file mode 100644
index b248bd9d6c..0000000000
--- a/src/windows/identity/ui/images/wgt_arrow_collapse.ico
+++ /dev/null
Binary files differ
diff --git a/src/windows/identity/ui/images/wgt_arrow_expand.ico b/src/windows/identity/ui/images/wgt_arrow_expand.ico
deleted file mode 100644
index 485b537b03..0000000000
--- a/src/windows/identity/ui/images/wgt_arrow_expand.ico
+++ /dev/null
Binary files differ
diff --git a/src/windows/identity/ui/khmapp.h b/src/windows/identity/ui/khmapp.h
index bd53bde28c..7f12c7ffaf 100644
--- a/src/windows/identity/ui/khmapp.h
+++ b/src/windows/identity/ui/khmapp.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 Massachusetts Institute of Technology
+ * Copyright (c) 2005 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -31,6 +31,7 @@
#include<windowsx.h>
#include<strsafe.h>
#include<commctrl.h>
+#include<htmlhelp.h>
#define KHERR_HMODULE khm_hInstance
#define KHERR_FACILITY khm_facility
@@ -46,6 +47,7 @@
#include<kmm.h>
#include<khhelp.h>
#include<khuidefs.h>
+#include<utils.h>
#include<resource.h>
#include<credfuncs.h>
@@ -65,5 +67,6 @@
#include<reqdaemon.h>
#include<notifier.h>
#include<timer.h>
+#include<addrchange.h>
#endif
diff --git a/src/windows/identity/ui/lang/en_us/khapp.rc b/src/windows/identity/ui/lang/en_us/khapp.rc
index a1b03b411c..eb2d4a9bb3 100644
--- a/src/windows/identity/ui/lang/en_us/khapp.rc
+++ b/src/windows/identity/ui/lang/en_us/khapp.rc
@@ -8,7 +8,7 @@
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
-#include <khimaira_version.h>
+
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
@@ -35,7 +35,6 @@ END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
- "#include <khimaira_version.h>\0"
END
3 TEXTINCLUDE
@@ -55,8 +54,6 @@ END
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_MAIN_APP ICON "..\\..\\images\\main_app.ico"
-IDI_WGT_COLLAPSE ICON "..\\..\\images\\wgt_arrow_collapse.ico"
-IDI_WGT_EXPAND ICON "..\\..\\images\\wgt_arrow_expand.ico"
IDI_ENABLED ICON "..\\..\\images\\enabled.ico"
IDI_DISABLED ICON "..\\..\\images\\disabled.ico"
IDI_NOTIFY_NONE ICON "..\\..\\images\\app_notify_none.ico"
@@ -71,45 +68,6 @@ IDI_ID ICON "..\\..\\images\\id.ico"
/////////////////////////////////////////////////////////////////////////////
//
-// Version
-//
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION 0,1,1,0
- PRODUCTVERSION 0,1,1,0
- FILEFLAGSMASK 0x17L
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x4L
- FILETYPE 0x0L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904b0"
- BEGIN
- VALUE "CompanyName", "Massachusetts Institute of Technology"
- VALUE "FileDescription", "Network Identity Manager"
- VALUE "FileVersion", "0.1.1.0"
- VALUE "InternalName", "NetIDMgr"
- VALUE "LegalCopyright", "Copyright (C) 2005 Massachusetts Institute of Technology"
- VALUE "OriginalFilename", "netidmgr.exe"
- VALUE "ProductName", "NetIDMgr"
- VALUE "ProductVersion", "0.1.1.0"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
-END
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
// Bitmap
//
@@ -170,6 +128,10 @@ IDB_CHPW BITMAP "..\\..\\images\\chpw.bmp"
IDB_CHPW_DIS BITMAP "..\\..\\images\\chpw-dis.bmp"
IDB_CHPW_DIS_SM BITMAP "..\\..\\images\\chpw-dis-sm.bmp"
IDB_TB_SPACE BITMAP "..\\..\\images\\tb-space.bmp"
+IDB_WDG_STUCK_HI BITMAP "..\\..\\images\\wdg_stuck_hi.bmp"
+IDB_WDG_STICK BITMAP "..\\..\\images\\wdg_stick.bmp"
+IDB_WDG_STICK_HI BITMAP "..\\..\\images\\wdg_stick_hi.bmp"
+IDB_WDG_STUCK BITMAP "..\\..\\images\\wdg_stuck.bmp"
/////////////////////////////////////////////////////////////////////////////
//
@@ -248,13 +210,15 @@ BEGIN
LTEXT "IdentityName",IDC_PP_IDNAME,34,7,194,12,NOT WS_GROUP,
WS_EX_CLIENTEDGE
CONTROL "Default identity",IDC_PP_IDDEF,"Button",BS_AUTOCHECKBOX |
- WS_TABSTOP,34,25,71,12
+ WS_TABSTOP,34,22,71,12
CONTROL "Searchable",IDC_PP_IDSEARCH,"Button",BS_AUTOCHECKBOX |
- WS_TABSTOP,34,43,74,12
+ WS_DISABLED | WS_TABSTOP,117,36,74,12
CONTROL "Custom1",IDC_PP_PROPLIST,"NetIDMgrPropertyWnd",
- WS_TABSTOP,7,61,221,88
+ WS_TABSTOP,7,51,221,80
CONTROL "Always visible (sticky)",IDC_PP_STICKY,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,117,25,85,10
+ BS_AUTOCHECKBOX | WS_TABSTOP,117,22,85,12
+ PUSHBUTTON "Identity configuration ...",IDC_PP_CONFIG,117,135,111,
+ 14
END
IDD_PP_CRED DIALOGEX 0, 0, 236, 158
@@ -272,7 +236,7 @@ IDD_CFG_MAIN DIALOGEX 0, 0, 357, 222
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
WS_SYSMENU
EXSTYLE WS_EX_CONTEXTHELP
-CAPTION "Khimaira Configuration"
+CAPTION "NetIDMgr Configuration"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
LTEXT "Title",IDC_CFG_TITLE,0,0,357,20,SS_CENTERIMAGE
@@ -311,7 +275,7 @@ BEGIN
IDC_CFG_KEEPRUNNING,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,16,78,158,10
CONTROL "Detect network connectivity",IDC_CFG_NETDETECT,"Button",
- BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,16,96,106,10
+ BS_AUTOCHECKBOX | WS_TABSTOP,16,96,106,10
CONTROL "A&utomatically import credentials from Windows",
IDC_CFG_AUTOIMPORT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
16,113,165,10
@@ -349,8 +313,8 @@ IDD_CFG_PLUGINS DIALOGEX 0, 0, 255, 182
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_SYSMENU
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
- CONTROL "",IDC_CFG_PLUGINS,"SysListView32",LVS_ALIGNLEFT |
- WS_BORDER | WS_TABSTOP,7,7,75,168
+ CONTROL "",IDC_CFG_PLUGINS,"SysListView32",LVS_REPORT |
+ LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,7,7,75,168
GROUPBOX "Plugin",IDC_CFG_PLUGINGRP,86,7,162,103
LTEXT "Description",IDC_CFG_LBL_DESC,90,20,36,8
EDITTEXT IDC_CFG_DESC,134,17,109,14,ES_AUTOHSCROLL | ES_READONLY
@@ -387,16 +351,17 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_SYSMENU
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
- CONTROL "",IDC_CFG_IDENTS,"SysListView32",LVS_SHAREIMAGELISTS |
- LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,7,7,221,72
+ CONTROL "",IDC_CFG_IDENTS,"SysListView32",LVS_REPORT |
+ LVS_SHAREIMAGELISTS | LVS_ALIGNLEFT | WS_BORDER |
+ WS_TABSTOP,7,7,221,72
GROUPBOX "Selected identity",IDC_CFG_IDENTITY,7,81,221,63
CONTROL "Monitor credential expiration",IDC_CFG_MONITOR,"Button",
- BS_3STATE | WS_TABSTOP,13,92,107,10
+ BS_3STATE | WS_DISABLED | WS_TABSTOP,13,92,107,10
CONTROL "Automatically renew",IDC_CFG_RENEW,"Button",BS_3STATE |
- WS_TABSTOP,13,106,81,10
+ WS_DISABLED | WS_TABSTOP,13,106,81,10
CONTROL "Always show in the credentials list (Sticky)",
- IDC_CFG_STICKY,"Button",BS_3STATE | WS_TABSTOP,13,120,
- 151,10
+ IDC_CFG_STICKY,"Button",BS_3STATE | WS_DISABLED |
+ WS_TABSTOP,13,120,151,10
PUSHBUTTON "&Remove",IDC_CFG_REMOVE,174,126,50,14,WS_DISABLED
END
@@ -425,8 +390,8 @@ BEGIN
IDC_COPYRIGHT,41,23,220,18,NOT WS_GROUP
LTEXT "BuildInfo",IDC_BUILDINFO,41,41,220,17,NOT WS_GROUP
ICON IDI_MAIN_APP,IDC_STATIC,6,7,21,20
- CONTROL "",IDC_MODULES,"SysListView32",LVS_ALIGNLEFT | WS_BORDER |
- WS_TABSTOP,41,72,220,91
+ CONTROL "",IDC_MODULES,"SysListView32",LVS_REPORT |
+ LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,41,72,220,91
LTEXT "Loaded modules",IDC_STATIC,41,60,52,8
END
@@ -709,6 +674,17 @@ BEGIN
IDS_CTX_PROC_PASSWORD "Changing password for %1!s!"
IDS_NC_PWD_FAILED_TITLE "Failed to change password"
IDS_CMDLINE_HELP "Command line options for NetIDMgr are :\n\n-a or --autoinit: Auto initialize credentials\n-i or --kinit: Obtain new credentials\n-d or --destroy: Destroy default identity\n-r or --renew: Renew all credentials"
+ IDS_PACTION_NEXT "Next alert..."
+ IDS_ERR_TITLE_NO_IDENTPRO "Cannot proceed without identity provider"
+END
+
+STRINGTABLE
+BEGIN
+ IDS_ERR_MSG_NO_IDENTPRO "There is no identity provider currently loaded. The identity provider is the component of Network Identity Manager that verifies and performs operations on actual identities. Without this provider, many critical operations cannot be performed."
+ IDS_ERR_SUGG_NO_IDENTPRO
+ "This is quite possibly caused by the identity provider module failing to load properly."
+ IDS_NC_REN_FAILED_TITLE "Failed to renew credentials"
+ IDS_CW_DEFAULT "(Default)"
END
#endif // English (U.S.) resources
diff --git a/src/windows/identity/ui/main.c b/src/windows/identity/ui/main.c
index b92c540b5b..4f1aa7d5de 100644
--- a/src/windows/identity/ui/main.c
+++ b/src/windows/identity/ui/main.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 Massachusetts Institute of Technology
+ * Copyright (c) 2005 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -41,13 +41,13 @@ void khm_init_gui(void) {
khui_init_rescache();
khui_init_menu();
khui_init_toolbar();
- khui_init_notifier();
+ khm_init_notifier();
khm_init_config();
}
void khm_exit_gui(void) {
khm_exit_config();
- khui_exit_notifier();
+ khm_exit_notifier();
khui_exit_toolbar();
khui_exit_menu();
khui_exit_rescache();
@@ -67,31 +67,36 @@ void khm_parse_commandline(void) {
for (i=1; i<wargc; i++) {
if (!wcscmp(wargs[i], L"-i") ||
- !wcscmp(wargs[i], L"--kinit")) {
+ !wcscmp(wargs[i], L"--kinit") ||
+ !wcscmp(wargs[i], L"-kinit")) {
khm_startup.init = TRUE;
khm_startup.exit = TRUE;
khm_startup.no_main_window = TRUE;
}
else if (!wcscmp(wargs[i], L"-m") ||
- !wcscmp(wargs[i], L"--import")) {
+ !wcscmp(wargs[i], L"--import") ||
+ !wcscmp(wargs[i], L"-import")) {
khm_startup.import = TRUE;
khm_startup.exit = TRUE;
khm_startup.no_main_window = TRUE;
}
else if (!wcscmp(wargs[i], L"-r") ||
- !wcscmp(wargs[i], L"--renew")) {
+ !wcscmp(wargs[i], L"--renew") ||
+ !wcscmp(wargs[i], L"-renew")) {
khm_startup.renew = TRUE;
khm_startup.exit = TRUE;
khm_startup.no_main_window = TRUE;
}
else if (!wcscmp(wargs[i], L"-d") ||
- !wcscmp(wargs[i], L"--destroy")) {
+ !wcscmp(wargs[i], L"--destroy") ||
+ !wcscmp(wargs[i], L"-destroy")) {
khm_startup.destroy = TRUE;
khm_startup.exit = TRUE;
khm_startup.no_main_window = TRUE;
}
else if (!wcscmp(wargs[i], L"-a") ||
- !wcscmp(wargs[i], L"--autoinit")) {
+ !wcscmp(wargs[i], L"--autoinit") ||
+ !wcscmp(wargs[i], L"-autoinit")) {
khm_startup.autoinit = TRUE;
}
else {
@@ -118,9 +123,11 @@ void khm_register_window_classes(void) {
ICC_BAR_CLASSES |
ICC_DATE_CLASSES |
ICC_HOTKEY_CLASS |
+#if (_WIN32_WINNT >= 0x501)
ICC_LINK_CLASS |
- ICC_LISTVIEW_CLASSES |
ICC_STANDARD_CLASSES |
+#endif
+ ICC_LISTVIEW_CLASSES |
ICC_TAB_CLASSES;
InitCommonControlsEx(&ics);
@@ -184,7 +191,7 @@ void khm_enter_modal(HWND hwnd) {
}
}
- khui_main_window_active = IsWindowEnabled(khm_hwnd_main);
+ khui_main_window_active = khm_is_main_window_active();
EnableWindow(khm_hwnd_main, FALSE);
khui_modal_dialog = hwnd;
@@ -200,7 +207,9 @@ void khm_leave_modal(void) {
}
}
- EnableWindow(khm_hwnd_main, khui_main_window_active);
+ EnableWindow(khm_hwnd_main, TRUE);
+ if (khui_main_window_active)
+ SetForegroundWindow(khm_hwnd_main);
khui_modal_dialog = NULL;
}
@@ -225,15 +234,15 @@ void khm_del_dialog(HWND dlg) {
BOOL khm_check_dlg_message(LPMSG pmsg) {
int i;
+ BOOL found = FALSE;
for(i=0;i<n_khui_dialogs;i++) {
- if(IsDialogMessage(khui_dialogs[i].hwnd, pmsg))
+ if(IsDialogMessage(khui_dialogs[i].hwnd, pmsg)) {
+ found = TRUE;
break;
+ }
}
- if(i<n_khui_dialogs)
- return TRUE;
- else
- return FALSE;
+ return found;
}
BOOL khm_is_dialog_active(void) {
@@ -324,6 +333,57 @@ WPARAM khm_message_loop(void) {
return msg.wParam;
}
+void KHMAPI
+khm_module_load_ctx_handler(enum kherr_ctx_event evt,
+ kherr_context * c) {
+ kherr_event * e;
+ khui_alert * a;
+
+ for(e = kherr_get_first_event(c);
+ e;
+ e = kherr_get_next_event(e)) {
+
+ kherr_evaluate_event(e);
+
+ if ((e->severity == KHERR_ERROR ||
+ e->severity == KHERR_WARNING) &&
+ e->short_desc &&
+ e->long_desc) {
+
+ khui_alert_create_empty(&a);
+
+ khui_alert_set_severity(a, e->severity);
+ khui_alert_set_title(a, e->short_desc);
+ khui_alert_set_message(a, e->long_desc);
+ if (e->suggestion)
+ khui_alert_set_suggestion(a, e->suggestion);
+
+ khui_alert_queue(a);
+
+ khui_alert_release(a);
+ }
+ }
+
+ kherr_remove_ctx_handler(khm_module_load_ctx_handler,
+ c->serial);
+}
+
+void khm_load_default_modules(void) {
+ kherr_context * c;
+
+ _begin_task(KHERR_CF_TRANSITIVE);
+
+ kmm_load_default_modules();
+
+ c = kherr_peek_context();
+ kherr_add_ctx_handler(khm_module_load_ctx_handler,
+ KHERR_CTX_END,
+ c->serial);
+ kherr_release_context(c);
+
+ _end_task();
+}
+
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
@@ -350,6 +410,14 @@ int WINAPI WinMain(HINSTANCE hInstance,
khc_load_schema(NULL, schema_uiconfig);
if(!slave) {
+
+ /* set this so that we don't accidently invoke an API that
+ inadvertently puts up the new creds dialog at an
+ inopportune moment, like, say, during the new creds dialog
+ is open. This only affects this process, and any child
+ processes started by plugins. */
+ SetEnvironmentVariable(L"KERBEROSLOGIN_NEVER_PROMPT", L"1");
+
/* we only open a main window if this is the only instance
of the application that is running. */
kmq_init();
@@ -359,7 +427,7 @@ int WINAPI WinMain(HINSTANCE hInstance,
kmq_set_completion_handler(KMSG_CRED, kmsg_cred_completion);
/* load the standard plugins */
- kmm_load_default_modules();
+ khm_load_default_modules();
khm_register_window_classes();
@@ -438,5 +506,11 @@ int WINAPI WinMain(HINSTANCE hInstance,
CloseHandle(hmap);
}
+#if 0
+ /* writes a report of memory leaks to the specified file. Should
+ only be enabled on development versions. */
+ PDUMP("memleak.txt");
+#endif
+
return rv;
}
diff --git a/src/windows/identity/ui/mainmenu.c b/src/windows/identity/ui/mainmenu.c
index 6115204f3b..c7bf94da1c 100644
--- a/src/windows/identity/ui/mainmenu.c
+++ b/src/windows/identity/ui/mainmenu.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 Massachusetts Institute of Technology
+ * Copyright (c) 2005 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -147,7 +147,8 @@ static HMENU mm_create_menu_from_def(khui_menu_def * def) {
hm = CreatePopupMenu();
act = def->items;
i = 0;
- while(act->action != KHUI_MENU_END) {
+ while((def->n_items == -1 && act->action != KHUI_MENU_END) ||
+ (def->n_items >= 0 && i < (int) def->n_items)) {
add_action_to_menu(hm,khui_find_action(act->action),i,act->flags);
act++; i++;
}
@@ -223,7 +224,6 @@ LRESULT khm_menu_activate(int menu_id) {
TB_SETHOTITEM,
menu_id,
0);
-
khm_menu_track_current();
@@ -321,7 +321,7 @@ LRESULT khm_menu_handle_select(WPARAM wParam, LPARAM lParam) {
if((HIWORD(wParam) == 0xffff && lParam == 0) ||
(HIWORD(wParam) & MF_POPUP)) {
/* the menu was closed */
- khui_statusbar_set_text(KHUI_SBPART_INFO, NULL);
+ khm_statusbar_set_part(KHUI_SBPART_INFO, NULL, NULL);
} else {
khui_action * act;
int id;
@@ -330,12 +330,12 @@ LRESULT khm_menu_handle_select(WPARAM wParam, LPARAM lParam) {
id = LOWORD(wParam);
act = khui_find_action(id);
if(act == NULL || act->is_tooltip == 0)
- khui_statusbar_set_text(KHUI_SBPART_INFO, NULL);
+ khm_statusbar_set_part(KHUI_SBPART_INFO, NULL, NULL);
else {
LoadString(khm_hInstance,
act->is_tooltip,
buf, ARRAYLENGTH(buf));
- khui_statusbar_set_text(KHUI_SBPART_INFO, buf);
+ khm_statusbar_set_part(KHUI_SBPART_INFO, NULL, buf);
}
}
return 0;
@@ -429,7 +429,7 @@ LRESULT khm_menu_notify_main(LPNMHDR notice) {
ret = TBDDRET_DEFAULT;
break;
- case TBN_HOTITEMCHANGE:
+ case TBN_HOTITEMCHANGE:
{
LPNMTBHOTITEM nmhi;
int new_item = -1;
@@ -485,21 +485,24 @@ void khm_menu_create_main(HWND rebar) {
mm = mmdef->items;
nmm = (int) khui_action_list_length(mm);
- hwtb = CreateWindowEx(
- TBSTYLE_EX_MIXEDBUTTONS,
- TOOLBARCLASSNAME,
- (LPWSTR) NULL,
- WS_CHILD |
- CCS_ADJUSTABLE |
- TBSTYLE_FLAT |
- TBSTYLE_AUTOSIZE |
- TBSTYLE_LIST |
- CCS_NORESIZE |
- CCS_NOPARENTALIGN |
- CCS_NODIVIDER,
- 0, 0, 0, 0, rebar,
- (HMENU) NULL, khm_hInstance,
- NULL);
+ hwtb = CreateWindowEx(0
+#if (_WIN32_IE >= 0x0501)
+ | TBSTYLE_EX_MIXEDBUTTONS
+#endif
+ ,
+ TOOLBARCLASSNAME,
+ (LPWSTR) NULL,
+ WS_CHILD |
+ CCS_ADJUSTABLE |
+ TBSTYLE_FLAT |
+ TBSTYLE_AUTOSIZE |
+ TBSTYLE_LIST |
+ CCS_NORESIZE |
+ CCS_NOPARENTALIGN |
+ CCS_NODIVIDER,
+ 0, 0, 0, 0, rebar,
+ (HMENU) NULL, khm_hInstance,
+ NULL);
if(!hwtb) {
#ifdef DEBUG
diff --git a/src/windows/identity/ui/mainmenu.h b/src/windows/identity/ui/mainmenu.h
index 7cd8e01ca9..59638cdd4e 100644
--- a/src/windows/identity/ui/mainmenu.h
+++ b/src/windows/identity/ui/mainmenu.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 Massachusetts Institute of Technology
+ * Copyright (c) 2005 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
diff --git a/src/windows/identity/ui/mainwnd.c b/src/windows/identity/ui/mainwnd.c
index 0f5c7e0439..5fbd1ec9b1 100644
--- a/src/windows/identity/ui/mainwnd.c
+++ b/src/windows/identity/ui/mainwnd.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 Massachusetts Institute of Technology
+ * Copyright (c) 2005 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -94,6 +94,7 @@ LRESULT CALLBACK khm_main_wnd_proc(
case WM_DESTROY:
kmq_unsubscribe_hwnd(KMSG_ACT, hwnd);
kmq_unsubscribe_hwnd(KMSG_CRED, hwnd);
+ HtmlHelp(NULL, NULL, HH_CLOSE_ALL, 0);
PostQuitMessage(0);
break;
@@ -105,15 +106,21 @@ LRESULT CALLBACK khm_main_wnd_proc(
return khm_toolbar_notify(lpnm);
} else if(lpnm->hwndFrom == khm_hwnd_rebar) {
return khm_rebar_notify(lpnm);
+ } else if(lpnm->hwndFrom == khm_hwnd_statusbar) {
+ return khm_statusbar_notify(lpnm);
}
break;
+ case WM_HELP:
+ MessageBox(khm_hwnd_main, L"WM_HELP", L"Notice", MB_OK);
+ break;
+
case WM_COMMAND:
switch(LOWORD(wParam)) {
/* general actions */
case KHUI_ACTION_VIEW_REFRESH:
+ khm_cred_refresh();
InvalidateRect(khm_hwnd_main_cred, NULL, FALSE);
- kmq_post_message(KMSG_CRED, KMSG_CRED_REFRESH, 0, NULL);
return 0;
case KHUI_ACTION_PASSWD_ID:
@@ -168,6 +175,21 @@ LRESULT CALLBACK khm_main_wnd_proc(
}
break;
+ case KHUI_ACTION_HELP_CTX:
+ HtmlHelp(khm_hwnd_main, NIDM_HELPFILE,
+ HH_HELP_CONTEXT, IDH_WELCOME);
+ break;
+
+ case KHUI_ACTION_HELP_CONTENTS:
+ HtmlHelp(khm_hwnd_main, NIDM_HELPFILE,
+ HH_DISPLAY_TOC, 0);
+ break;
+
+ case KHUI_ACTION_HELP_INDEX:
+ HtmlHelp(khm_hwnd_main, NIDM_HELPFILE,
+ HH_DISPLAY_INDEX, (DWORD_PTR) L"");
+ break;
+
case KHUI_ACTION_HELP_ABOUT:
khm_create_about_window();
break;
@@ -223,6 +245,7 @@ LRESULT CALLBACK khm_main_wnd_proc(
case KHUI_PACTION_DELETE:
+ case KHUI_PACTION_SELALL:
case KHUI_ACTION_LAYOUT_ID:
case KHUI_ACTION_LAYOUT_TYPE:
case KHUI_ACTION_LAYOUT_LOC:
@@ -301,10 +324,10 @@ LRESULT CALLBACK khm_main_wnd_proc(
/* resize the rebar control */
SendMessage(khm_hwnd_rebar, WM_SIZE, 0, 0);
- khui_update_statusbar(hwnd);
+ khm_update_statusbar(hwnd);
GetWindowRect(khm_hwnd_rebar, &r_rebar);
- GetWindowRect(khui_hwnd_statusbar, &r_status);
+ GetWindowRect(khm_hwnd_statusbar, &r_status);
/* the cred window fills the area between the rebar
and the status bar */
@@ -383,6 +406,9 @@ LRESULT CALLBACK khm_main_wnd_proc(
} else if (m->type == KMSG_CRED &&
m->subtype == KMSG_CRED_REFRESH) {
mw_restart_refresh_timer(hwnd);
+ } else if (m->type == KMSG_CRED &&
+ m->subtype == KMSG_CRED_ADDR_CHANGE) {
+ khm_cred_addr_change();
} else if (m->type == KMSG_KMM &&
m->subtype == KMSG_KMM_I_DONE) {
kmq_post_message(KMSG_ACT, KMSG_ACT_BEGIN_CMDLINE, 0, 0);
@@ -442,13 +468,14 @@ LRESULT CALLBACK khm_null_wnd_proc(
LRESULT khm_rebar_notify(LPNMHDR lpnm) {
switch(lpnm->code) {
+#if (_WIN32_WINNT >= 0x0501)
case RBN_AUTOBREAK:
{
LPNMREBARAUTOBREAK lpra = (LPNMREBARAUTOBREAK) lpnm;
lpra->fAutoBreak = TRUE;
}
break;
-
+#endif
case RBN_BEGINDRAG:
{
LPNMREBAR lprb = (LPNMREBAR) lpnm;
@@ -505,7 +532,7 @@ void khm_create_main_window_controls(HWND hwnd_main) {
/* self attach */
khm_menu_create_main(hwRebar);
khm_create_standard_toolbar(hwRebar);
- khui_create_statusbar(hwnd_main);
+ khm_create_statusbar(hwnd_main);
/* manual attach */
khm_hwnd_main_cred = khm_create_credwnd(hwnd_main);
@@ -517,7 +544,8 @@ void khm_create_main_window(void) {
khm_handle csp_mw = NULL;
int x,y,width,height;
- LoadString(khm_hInstance, IDS_MAIN_WINDOW_TITLE, buf, sizeof(buf)/sizeof(buf[0]));
+ LoadString(khm_hInstance, IDS_MAIN_WINDOW_TITLE,
+ buf, ARRAYLENGTH(buf));
khm_hwnd_null =
CreateWindow(MAKEINTATOM(khm_null_window_class),
@@ -573,8 +601,6 @@ void khm_create_main_window(void) {
NULL,
NULL);
- if (!khm_hwnd_main)
- return;
}
void khm_show_main_window(void) {
@@ -587,8 +613,14 @@ void khm_show_main_window(void) {
SetForegroundWindow(khm_hwnd_main);
}
- ShowWindow(khm_hwnd_main, khm_nCmdShow);
- UpdateWindow(khm_hwnd_main);
+ if (khm_nCmdShow == SW_SHOWMINIMIZED ||
+ khm_nCmdShow == SW_SHOWMINNOACTIVE ||
+ khm_nCmdShow == SW_MINIMIZE) {
+ khm_hide_main_window();
+ } else {
+ ShowWindow(khm_hwnd_main, khm_nCmdShow);
+ UpdateWindow(khm_hwnd_main);
+ }
khm_nCmdShow = SW_RESTORE;
}
@@ -597,11 +629,13 @@ void khm_hide_main_window(void) {
khm_handle csp_notices = NULL;
khm_int32 show_warning = FALSE;
- if (KHM_SUCCEEDED(khc_open_space(NULL, L"CredWindow\\Notices",
+ if (khm_nCmdShow != SW_MINIMIZE &&
+ KHM_SUCCEEDED(khc_open_space(NULL, L"CredWindow\\Notices",
KHM_PERM_WRITE, &csp_notices)) &&
KHM_SUCCEEDED(khc_read_int32(csp_notices, L"MinimizeWarning",
&show_warning)) &&
show_warning != 0) {
+
khui_alert * alert;
wchar_t title[KHUI_MAXCCH_TITLE];
wchar_t msg[KHUI_MAXCCH_MESSAGE];
diff --git a/src/windows/identity/ui/mainwnd.h b/src/windows/identity/ui/mainwnd.h
index cdaac1e968..95b28b7334 100644
--- a/src/windows/identity/ui/mainwnd.h
+++ b/src/windows/identity/ui/mainwnd.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 Massachusetts Institute of Technology
+ * Copyright (c) 2005 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
diff --git a/src/windows/identity/ui/newcredwnd.c b/src/windows/identity/ui/newcredwnd.c
index 4b6ce08bf3..6852846fb4 100644
--- a/src/windows/identity/ui/newcredwnd.c
+++ b/src/windows/identity/ui/newcredwnd.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 Massachusetts Institute of Technology
+ * Copyright (c) 2005 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -244,7 +244,7 @@ nc_update_credtext(khui_nc_wnd_data * d)
HWND hw = NULL;
size_t cch = 0;
- ctbuf = malloc(NC_MAXCB_CREDTEXT);
+ ctbuf = PMALLOC(NC_MAXCB_CREDTEXT);
assert(ctbuf != NULL);
@@ -308,7 +308,7 @@ nc_update_credtext(khui_nc_wnd_data * d)
a comma separated string */
/* d->nc->n_identities is at least 2 */
- ids_string = malloc((KCDB_IDENT_MAXCB_NAME + sizeof(id_fmt)) *
+ ids_string = PMALLOC((KCDB_IDENT_MAXCB_NAME + sizeof(id_fmt)) *
(d->nc->n_identities - 1));
cb_ids_string =
(KCDB_IDENT_MAXCB_NAME + sizeof(id_fmt)) *
@@ -365,7 +365,7 @@ nc_update_credtext(khui_nc_wnd_data * d)
StringCbPrintf(buf, NC_MAXCB_CREDTEXT - cch*sizeof(wchar_t),
main_fmt, id_string, ids_string);
- free(ids_string);
+ PFREE(ids_string);
}
} else {
LoadString(khm_hInstance, IDS_NC_CREDTEXT_ID_NONE,
@@ -393,7 +393,7 @@ nc_update_credtext(khui_nc_wnd_data * d)
SetDlgItemText(d->dlg_main, IDC_NC_CREDTEXT, ctbuf);
- free(ctbuf);
+ PFREE(ctbuf);
/* so depending on whether the primary identity was found to be
invalid, we need to disable the Ok button and set the title to
@@ -471,7 +471,7 @@ nc_handle_wm_create(HWND hwnd,
lpc = (LPCREATESTRUCT) lParam;
- ncd = malloc(sizeof(*ncd));
+ ncd = PMALLOC(sizeof(*ncd));
ZeroMemory(ncd, sizeof(*ncd));
c = (khui_new_creds *) lpc->lpCreateParams;
@@ -821,7 +821,7 @@ nc_handle_wm_destroy(HWND hwnd,
d->dlg_main = NULL;
d->dlg_ts = NULL;
- free(d);
+ PFREE(d);
return TRUE;
}
@@ -1188,7 +1188,7 @@ static LRESULT nc_handle_wm_nc_notify(HWND hwnd,
&cbsize,
KCDB_TS_SHORT) == KHM_ERROR_TOO_LONG) {
- name = malloc(cbsize);
+ name = PMALLOC(cbsize);
kcdb_credtype_describe(d->nc->types[i]->type,
name,
&cbsize,
@@ -1235,7 +1235,7 @@ static LRESULT nc_handle_wm_nc_notify(HWND hwnd,
x += width;
if(!(d->nc->types[i]->name))
- free(name);
+ PFREE(name);
/* Now set the position of the type panel */
ShowWindow(d->nc->types[i]->hwnd_panel, SW_HIDE);
diff --git a/src/windows/identity/ui/newcredwnd.h b/src/windows/identity/ui/newcredwnd.h
index d0b6764221..22505bc746 100644
--- a/src/windows/identity/ui/newcredwnd.h
+++ b/src/windows/identity/ui/newcredwnd.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 Massachusetts Institute of Technology
+ * Copyright (c) 2005 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
diff --git a/src/windows/identity/ui/notifier.c b/src/windows/identity/ui/notifier.c
index 0ebdbd4cb3..c795245b12 100644
--- a/src/windows/identity/ui/notifier.c
+++ b/src/windows/identity/ui/notifier.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 Massachusetts Institute of Technology
+ * Copyright (c) 2005 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -37,6 +37,8 @@
/* notifier message for notification icon */
#define KHUI_WM_NOTIFIER WM_COMMAND
+#define KHUI_ALERT_QUEUE_MAX 64
+
/* window class registration atom for message only notifier window
class */
ATOM atom_notifier = 0;
@@ -51,6 +53,70 @@ BOOL notifier_ready = FALSE;
khui_alert * current_alert = NULL;
+khui_alert * alert_queue[KHUI_ALERT_QUEUE_MAX];
+khm_int32 alert_queue_head = 0;
+khm_int32 alert_queue_tail = 0;
+
+#define is_alert_queue_empty() (alert_queue_head == alert_queue_tail)
+#define is_alert_queue_full() (((alert_queue_tail + 1) % KHUI_ALERT_QUEUE_MAX) == alert_queue_head)
+
+static void
+add_to_alert_queue(khui_alert * a) {
+ if (is_alert_queue_full()) return;
+ alert_queue[alert_queue_tail++] = a;
+ khui_alert_hold(a);
+ alert_queue_tail %= KHUI_ALERT_QUEUE_MAX;
+}
+
+static khui_alert *
+del_from_alert_queue(void) {
+ khui_alert * a;
+
+ if (is_alert_queue_empty()) return NULL;
+ a = alert_queue[alert_queue_head++];
+ alert_queue_head %= KHUI_ALERT_QUEUE_MAX;
+
+ return a; /* held */
+}
+
+static khui_alert *
+peek_alert_queue(void) {
+ if (is_alert_queue_empty()) return NULL;
+ return alert_queue[alert_queue_head];
+}
+
+static void
+check_for_queued_alerts(void) {
+ if (!is_alert_queue_empty()) {
+ khui_alert * a;
+
+ a = peek_alert_queue();
+
+ if (a->title) {
+ HICON hi;
+ int res;
+
+ if (a->severity == KHERR_ERROR)
+ res = OIC_ERROR;
+ else if (a->severity == KHERR_WARNING)
+ res = OIC_WARNING;
+ else
+ res = OIC_INFORMATION;
+
+ hi = LoadImage(0, MAKEINTRESOURCE(res),
+ IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON),
+ LR_SHARED);
+
+ khm_statusbar_set_part(KHUI_SBPART_NOTICE,
+ hi,
+ a->title);
+ }
+ } else {
+ khm_statusbar_set_part(KHUI_SBPART_NOTICE,
+ NULL, NULL);
+ }
+}
+
/* forward dcls */
static khm_int32
@@ -62,6 +128,9 @@ alert_show_minimized(khui_alert * a);
static khm_int32
alert_show_normal(khui_alert * a);
+static khm_int32
+alert_enqueue(khui_alert * a);
+
/**********************************************************************
Notifier
***********************************************************************
@@ -87,17 +156,41 @@ notifier_wnd_proc(HWND hwnd,
if(m->type == KMSG_ALERT) {
/* handle notifier messages */
switch(m->subtype) {
- case KMSG_ALERT_SHOW:
- rv = alert_show((khui_alert *) m->vparam);
- khui_alert_release((khui_alert *) m->vparam);
- break;
+ case KMSG_ALERT_SHOW:
+ rv = alert_show((khui_alert *) m->vparam);
+ khui_alert_release((khui_alert *) m->vparam);
+ break;
+
+ case KMSG_ALERT_QUEUE:
+ rv = alert_enqueue((khui_alert *) m->vparam);
+ khui_alert_release((khui_alert *) m->vparam);
+ break;
+
+ case KMSG_ALERT_CHECK_QUEUE:
+ check_for_queued_alerts();
+ break;
+
+ case KMSG_ALERT_SHOW_QUEUED:
+ if (current_alert == NULL) {
+ khui_alert * a;
+
+ a = del_from_alert_queue();
+ if (a) {
+ rv = alert_show(a);
+ check_for_queued_alerts();
+ khui_alert_release(a);
+ }
+ }
+ break;
}
} else if (m->type == KMSG_CRED &&
m->subtype == KMSG_CRED_ROOTDELTA) {
+
KillTimer(hwnd, KHUI_REFRESH_TIMER_ID);
SetTimer(hwnd, KHUI_REFRESH_TIMER_ID,
KHUI_REFRESH_TIMEOUT,
NULL);
+
}
return kmq_wm_end(m, rv);
@@ -140,26 +233,30 @@ notifier_wnd_proc(HWND hwnd,
khm_show_main_window();
break;
+#if (_WIN32_IE >= 0x0501)
case NIN_BALLOONUSERCLICK:
if (current_alert) {
if ((current_alert->flags & KHUI_ALERT_FLAG_DEFACTION) &&
current_alert->n_alert_commands > 0) {
PostMessage(khm_hwnd_main, WM_COMMAND,
- MAKEWPARAM(current_alert->alert_commands[0], 0),
+ MAKEWPARAM(current_alert->alert_commands[0],
+ 0),
0);
- } else if (current_alert->flags & KHUI_ALERT_FLAG_REQUEST_WINDOW) {
+ } else if (current_alert->flags &
+ KHUI_ALERT_FLAG_REQUEST_WINDOW) {
khm_show_main_window();
alert_show_normal(current_alert);
}
}
/* fallthrough */
case NIN_BALLOONTIMEOUT:
- khui_notify_icon_change(KHERR_NONE);
+ khm_notify_icon_change(KHERR_NONE);
if (current_alert) {
khui_alert_release(current_alert);
current_alert = NULL;
}
break;
+#endif
}
} else if (uMsg == WM_TIMER) {
if (wParam == KHUI_TRIGGER_TIMER_ID) {
@@ -175,7 +272,7 @@ notifier_wnd_proc(HWND hwnd,
}
ATOM
-khui_register_notifier_wnd_class(void)
+khm_register_notifier_wnd_class(void)
{
WNDCLASSEX wcx;
@@ -315,10 +412,12 @@ alert_show_minimized(khui_alert * a) {
a->flags |= KHUI_ALERT_FLAG_DISPLAY_BALLOON;
+#if (_WIN32_IE >= 0x0501)
current_alert = a;
khui_alert_hold(a);
+#endif
- khui_notify_icon_balloon(a->severity,
+ khm_notify_icon_balloon(a->severity,
tbuf,
mbuf,
NTF_TIMEOUT);
@@ -340,10 +439,14 @@ alert_show_normal(khui_alert * a) {
title = a->title;
/* if we don't have any commands, we just add a "close" button */
- if(a->n_alert_commands == 0) {
+ if (a->n_alert_commands == 0) {
khui_alert_add_command(a, KHUI_PACTION_CLOSE);
}
+ if (!is_alert_queue_empty()) {
+ khui_alert_add_command(a, KHUI_PACTION_NEXT);
+ }
+
/* we don't need to keep track of the window handle
because the window procedure adds it to the dialog
list automatically */
@@ -365,6 +468,12 @@ alert_show_normal(khui_alert * a) {
static khm_int32
alert_show(khui_alert * a) {
+ /* is there an alert already? If so, we just enqueue the message
+ and let it sit. */
+ if (current_alert) {
+ return alert_enqueue(a);
+ }
+
/* the window has already been shown */
if((a->flags & KHUI_ALERT_FLAG_DISPLAY_WINDOW) ||
((a->flags & KHUI_ALERT_FLAG_DISPLAY_BALLOON) &&
@@ -387,6 +496,17 @@ alert_show(khui_alert * a) {
return alert_show_minimized(a);
}
+static khm_int32
+alert_enqueue(khui_alert * a) {
+ if (is_alert_queue_full())
+ return KHM_ERROR_NO_RESOURCES;
+
+ add_to_alert_queue(a);
+ check_for_queued_alerts();
+
+ return KHM_ERROR_SUCCESS;
+}
+
/* the alerter window is actually a dialog */
static LRESULT CALLBACK
alerter_wnd_proc(HWND hwnd,
@@ -410,7 +530,7 @@ alerter_wnd_proc(HWND hwnd,
a = (khui_alert *) lpcs->lpCreateParams;
khui_alert_hold(a);
- d = malloc(sizeof(*d));
+ d = PMALLOC(sizeof(*d));
ZeroMemory(d, sizeof(*d));
d->alert = a;
@@ -570,7 +690,7 @@ alerter_wnd_proc(HWND hwnd,
}
}
- khui_notify_icon_change(a->severity);
+ khm_notify_icon_change(a->severity);
khui_alert_unlock(a);
@@ -603,9 +723,9 @@ alerter_wnd_proc(HWND hwnd,
DeleteObject(d->hfont);
- free(d);
+ PFREE(d);
- khui_notify_icon_change(KHERR_NONE);
+ khm_notify_icon_change(KHERR_NONE);
return TRUE;
}
@@ -659,7 +779,7 @@ alerter_wnd_proc(HWND hwnd,
hicon = LoadImage(NULL,
MAKEINTRESOURCE(iid),
IMAGE_ICON,
- SM_CXICON, SM_CYICON,
+ GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON),
LR_SHARED);
DrawIcon(hdc, x, y, hicon);
@@ -718,7 +838,7 @@ alerter_wnd_proc(HWND hwnd,
CopyRect(&ro, &r);
// adjust for icon and padding
- r.left += SM_CXICON + d->dx_suggest_pad * 2;
+ r.left += GetSystemMetrics(SM_CXSMICON) + d->dx_suggest_pad * 2;
r.top += d->dx_suggest_pad;
r.right -= d->dx_suggest_pad;
r.bottom -= d->dx_suggest_pad;
@@ -748,7 +868,7 @@ alerter_wnd_proc(HWND hwnd,
LoadImage(0,
MAKEINTRESOURCE(OIC_INFORMATION),
IMAGE_ICON,
- SM_CXICON, SM_CYICON,
+ GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON),
LR_SHARED);
assert(h_sug_ico != NULL);
@@ -757,7 +877,7 @@ alerter_wnd_proc(HWND hwnd,
ro.left + d->dx_suggest_pad,
ro.top + d->dx_suggest_pad,
h_sug_ico,
- SM_CXICON, SM_CYICON,
+ GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON),
0, NULL,
DI_NORMAL);
@@ -847,6 +967,9 @@ alerter_wnd_proc(HWND hwnd,
khm_leave_modal();
DestroyWindow(hwnd);
+
+ if (LOWORD(wParam) == KHUI_PACTION_NEXT)
+ kmq_post_message(KMSG_ALERT, KMSG_ALERT_SHOW_QUEUED, 0, 0);
return 0;
}
}
@@ -857,14 +980,18 @@ alerter_wnd_proc(HWND hwnd,
//return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
-ATOM khui_register_alerter_wnd_class(void)
+ATOM khm_register_alerter_wnd_class(void)
{
WNDCLASSEX wcx;
ZeroMemory(&wcx, sizeof(wcx));
wcx.cbSize = sizeof(wcx);
- wcx.style = CS_DROPSHADOW | CS_OWNDC;
+ wcx.style =
+#if(_WIN32_WINNT >= 0x0501)
+ CS_DROPSHADOW |
+#endif
+ CS_OWNDC;
wcx.lpfnWndProc = alerter_wnd_proc;
wcx.cbClsExtra = 0;
wcx.cbWndExtra = DLGWINDOWEXTRA + sizeof(LONG_PTR);
@@ -887,7 +1014,7 @@ ATOM khui_register_alerter_wnd_class(void)
#define KHUI_NOTIFY_ICON_ID 0
-void khui_notify_icon_add(void) {
+void khm_notify_icon_add(void) {
NOTIFYICONDATA ni;
wchar_t buf[256];
@@ -914,7 +1041,7 @@ void khui_notify_icon_add(void) {
}
void
-khui_notify_icon_balloon(khm_int32 severity,
+khm_notify_icon_balloon(khm_int32 severity,
wchar_t * title,
wchar_t * msg,
khm_int32 timeout) {
@@ -970,7 +1097,7 @@ khui_notify_icon_balloon(khm_int32 severity,
DestroyIcon(ni.hIcon);
}
-void khui_notify_icon_change(khm_int32 severity) {
+void khm_notify_icon_change(khm_int32 severity) {
NOTIFYICONDATA ni;
wchar_t buf[256];
int iid;
@@ -1004,7 +1131,7 @@ void khui_notify_icon_change(khm_int32 severity) {
DestroyIcon(ni.hIcon);
}
-void khui_notify_icon_remove(void) {
+void khm_notify_icon_remove(void) {
NOTIFYICONDATA ni;
ZeroMemory(&ni, sizeof(ni));
@@ -1020,12 +1147,12 @@ void khui_notify_icon_remove(void) {
Initialization
**********************************************************************/
-void khui_init_notifier(void)
+void khm_init_notifier(void)
{
- if(!khui_register_notifier_wnd_class())
+ if(!khm_register_notifier_wnd_class())
return;
- if(!khui_register_alerter_wnd_class())
+ if(!khm_register_alerter_wnd_class())
return;
hwnd_notifier = CreateWindowEx(0,
@@ -1043,7 +1170,7 @@ void khui_init_notifier(void)
kmq_subscribe_hwnd(KMSG_CRED, hwnd_notifier);
notifier_ready = TRUE;
- khui_notify_icon_add();
+ khm_notify_icon_add();
}
#ifdef DEBUG
else {
@@ -1051,14 +1178,18 @@ void khui_init_notifier(void)
}
#endif
khm_timer_init();
+
+ khm_addr_change_notifier_init();
}
-void khui_exit_notifier(void)
+void khm_exit_notifier(void)
{
+ khm_addr_change_notifier_exit();
+
khm_timer_exit();
if(hwnd_notifier != NULL) {
- khui_notify_icon_remove();
+ khm_notify_icon_remove();
kmq_unsubscribe_hwnd(KMSG_ALERT, hwnd_notifier);
kmq_unsubscribe_hwnd(KMSG_CRED, hwnd_notifier);
DestroyWindow(hwnd_notifier);
diff --git a/src/windows/identity/ui/notifier.h b/src/windows/identity/ui/notifier.h
index bfe9656b89..de9fb60fa9 100644
--- a/src/windows/identity/ui/notifier.h
+++ b/src/windows/identity/ui/notifier.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 Massachusetts Institute of Technology
+ * Copyright (c) 2005 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -28,16 +28,16 @@
#define __KHIMAIRA_NOTIFIER_H
void
-khui_init_notifier(void);
+khm_init_notifier(void);
void
-khui_exit_notifier(void);
+khm_exit_notifier(void);
void
-khui_notify_icon_change(khm_int32 severity);
+khm_notify_icon_change(khm_int32 severity);
void
-khui_notify_icon_balloon(khm_int32 severity,
+khm_notify_icon_balloon(khm_int32 severity,
wchar_t * title,
wchar_t * msg,
khm_int32 timeout);
diff --git a/src/windows/identity/ui/passwnd.h b/src/windows/identity/ui/passwnd.h
index f8c17f68e1..b0adcf6893 100644
--- a/src/windows/identity/ui/passwnd.h
+++ b/src/windows/identity/ui/passwnd.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 Massachusetts Institute of Technology
+ * Copyright (c) 2005 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
diff --git a/src/windows/identity/ui/propertywnd.c b/src/windows/identity/ui/propertywnd.c
index fe603c0154..79a6cc35a0 100644
--- a/src/windows/identity/ui/propertywnd.c
+++ b/src/windows/identity/ui/propertywnd.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 Massachusetts Institute of Technology
+ * Copyright (c) 2005 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -66,7 +66,7 @@ void pw_update_property_data(HWND hw, pw_data * d)
&attr_count)))
return;
- attrs = malloc(sizeof(khm_int32) * attr_count);
+ attrs = PMALLOC(sizeof(khm_int32) * attr_count);
assert(attrs != NULL);
kcdb_attrib_get_ids(
@@ -77,7 +77,7 @@ void pw_update_property_data(HWND hw, pw_data * d)
&attr_count);
cb_buf = sizeof(wchar_t) * 2048;
- buffer = malloc(cb_buf);
+ buffer = PMALLOC(cb_buf);
assert(buffer != NULL);
for(i=0; i<attr_count; i++) {
@@ -108,8 +108,8 @@ void pw_update_property_data(HWND hw, pw_data * d)
ListView_SetItem(hwnd_lv, &lvi);
}
- free(attrs);
- free(buffer);
+ PFREE(attrs);
+ PFREE(buffer);
}
}
@@ -131,7 +131,7 @@ LRESULT CALLBACK khui_property_wnd_proc(
cs = (CREATESTRUCT *) lParam;
- child = malloc(sizeof(*child));
+ child = PMALLOC(sizeof(*child));
ZeroMemory(child, sizeof(*child));
#pragma warning(push)
@@ -198,7 +198,7 @@ LRESULT CALLBACK khui_property_wnd_proc(
{
child = (pw_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);
kcdb_buf_release(child->record);
- free(child);
+ PFREE(child);
}
break;
diff --git a/src/windows/identity/ui/propertywnd.h b/src/windows/identity/ui/propertywnd.h
index 67250c96d9..89305dd7ba 100644
--- a/src/windows/identity/ui/propertywnd.h
+++ b/src/windows/identity/ui/propertywnd.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 Massachusetts Institute of Technology
+ * Copyright (c) 2005 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
diff --git a/src/windows/identity/ui/reqdaemon.c b/src/windows/identity/ui/reqdaemon.c
index b73ec4820b..620bdc54e6 100644
--- a/src/windows/identity/ui/reqdaemon.c
+++ b/src/windows/identity/ui/reqdaemon.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 Massachusetts Institute of Technology
+ * Copyright (c) 2005 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -172,7 +172,7 @@ reqdaemonwnd_proc(HWND hwnd,
#ifdef DEBUG
assert(FALSE);
#endif
- rv = KHM_ERROR_INVALID_PARM;
+ rv = KHM_ERROR_INVALID_PARAM;
goto _exit_tgt_with_lparam;
}
@@ -185,7 +185,7 @@ reqdaemonwnd_proc(HWND hwnd,
#ifdef DEBUG
assert(FALSE);
#endif
- rv = KHM_ERROR_INVALID_PARM;
+ rv = KHM_ERROR_INVALID_PARAM;
goto _exit_tgt_with_lparam;
}
@@ -198,7 +198,7 @@ reqdaemonwnd_proc(HWND hwnd,
#ifdef DEBUG
assert(FALSE);
#endif
- rv = KHM_ERROR_INVALID_PARM;
+ rv = KHM_ERROR_INVALID_PARAM;
goto _exit_tgt_with_lparam;
}
@@ -212,7 +212,7 @@ reqdaemonwnd_proc(HWND hwnd,
if (FAILED(StringCbPrintf(widname, sizeof(widname),
L"%hs@%hs", username, realm))) {
- rv = KHM_ERROR_INVALID_PARM;
+ rv = KHM_ERROR_INVALID_PARAM;
goto _exit_tgt_with_lparam;
}
diff --git a/src/windows/identity/ui/reqdaemon.h b/src/windows/identity/ui/reqdaemon.h
index 13b0ebd2c1..b55e93c992 100644
--- a/src/windows/identity/ui/reqdaemon.h
+++ b/src/windows/identity/ui/reqdaemon.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 Massachusetts Institute of Technology
+ * Copyright (c) 2005 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
diff --git a/src/windows/identity/ui/resource.h b/src/windows/identity/ui/resource.h
index a58cebb8d3..4bee5f206a 100644
--- a/src/windows/identity/ui/resource.h
+++ b/src/windows/identity/ui/resource.h
@@ -1,6 +1,6 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
-// Used by D:\work\khimaira\src\ui\lang\en_us\khapp.rc
+// Used by D:\work\pismere\athena\auth\krb5\src\windows\identity\ui\lang\en_us\khapp.rc
//
#define IDI_MAIN_APP 104
#define IDD_PROPPAGE_MEDIUM 106
@@ -94,9 +94,7 @@
#define IDS_NC_CREDTEXT_ID_MANY 148
#define IDB_LOGO_SHADE 149
#define IDS_NC_CREDTEXT_ID_INVALID 149
-#define IDI_WGT_COLLAPSE 150
#define IDS_WTPOST_INIT_CREDS 150
-#define IDI_WGT_EXPAND 151
#define IDS_WTPOST_NEW_CREDS 151
#define IDB_WDG_EXPAND 152
#define IDS_ACTION_RENEW_CRED 152
@@ -191,9 +189,13 @@
#define IDS_CFG_ID_TAB_SHORT 197
#define IDB_TB_SPACE 197
#define IDS_CFG_ID_TAB_LONG 198
+#define IDB_WDG_STUCK_HI 198
#define IDS_CFG_IDS_TAB_SHORT 199
+#define IDB_WDG_STICK 199
#define IDS_CFG_IDS_TAB_LONG 200
+#define IDB_WDG_STICK_HI 200
#define IDS_CFG_IDS_IDENTITY 201
+#define IDB_WDG_STUCK 201
#define IDS_ACTION_IMPORT 202
#define IDS_CTX_IMPORT 203
#define IDS_CFG_PI_COL_PLUGINS 204
@@ -214,6 +216,12 @@
#define IDS_CTX_PROC_PASSWORD 219
#define IDS_NC_PWD_FAILED_TITLE 220
#define IDS_CMDLINE_HELP 221
+#define IDS_PACTION_NEXT 222
+#define IDS_ERR_TITLE_NO_IDENTPRO 223
+#define IDS_ERR_MSG_NO_IDENTPRO 224
+#define IDS_ERR_SUGG_NO_IDENTPRO 225
+#define IDS_NC_REN_FAILED_TITLE 226
+#define IDS_CW_DEFAULT 227
#define IDC_NC_USERNAME 1007
#define IDC_NC_PASSWORD 1008
#define IDC_NC_CREDTEXT_LABEL 1009
@@ -293,6 +301,7 @@
#define IDC_BUILDINFO 1102
#define IDC_LIST1 1103
#define IDC_MODULES 1103
+#define IDC_PP_CONFIG 1104
#define IDA_ACTIVATE_MENU 40003
#define IDA_UP 40004
#define IDA_DOWN 40005
@@ -305,9 +314,9 @@
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 198
+#define _APS_NEXT_RESOURCE_VALUE 202
#define _APS_NEXT_COMMAND_VALUE 40010
-#define _APS_NEXT_CONTROL_VALUE 1104
+#define _APS_NEXT_CONTROL_VALUE 1105
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/src/windows/identity/ui/statusbar.c b/src/windows/identity/ui/statusbar.c
index 75f520c575..9a2f8e79c9 100644
--- a/src/windows/identity/ui/statusbar.c
+++ b/src/windows/identity/ui/statusbar.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 Massachusetts Institute of Technology
+ * Copyright (c) 2005 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -26,17 +26,41 @@
#include<khmapp.h>
-khui_statusbar_part khui_statusbar_parts[] = {
+khm_statusbar_part khm_statusbar_parts[] = {
{KHUI_SBPART_INFO, 0, KHUI_SB_WTYPE_FILLER},
{KHUI_SBPART_NOTICE, 40, KHUI_SB_WTYPE_RELATIVE},
{KHUI_SBPART_LOC, 40, KHUI_SB_WTYPE_ABSOLUTE}
};
-int khui_n_statusbar_parts = sizeof(khui_statusbar_parts) / sizeof(khui_statusbar_part);
+int khm_n_statusbar_parts = sizeof(khm_statusbar_parts) / sizeof(khm_statusbar_part);
-HWND khui_hwnd_statusbar = NULL;
+HWND khm_hwnd_statusbar = NULL;
-void khui_statusbar_set_parts(HWND parent) {
+LRESULT
+khm_statusbar_notify(LPNMHDR nmhdr) {
+ LPNMMOUSE pnmm;
+
+ switch(nmhdr->code) {
+ case NM_CLICK:
+ case NM_DBLCLK:
+ pnmm = (LPNMMOUSE) nmhdr;
+
+ if (pnmm->dwItemSpec >= (DWORD) khm_n_statusbar_parts)
+ return TRUE;
+
+ if (khm_statusbar_parts[pnmm->dwItemSpec].id == KHUI_SBPART_NOTICE) {
+ /* means, show next notification */
+ kmq_post_message(KMSG_ALERT, KMSG_ALERT_SHOW_QUEUED, 0, 0);
+ }
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+void
+khui_statusbar_set_parts(HWND parent) {
int i;
int fillerwidth;
int staticwidth;
@@ -50,28 +74,28 @@ void khui_statusbar_set_parts(HWND parent) {
/* calculate fillerwidth and staticwidth */
staticwidth = 0;
- for(i=0;i<khui_n_statusbar_parts;i++) {
- if(khui_statusbar_parts[i].wtype == KHUI_SB_WTYPE_ABSOLUTE) {
- staticwidth += khui_statusbar_parts[i].width;
- } else if(khui_statusbar_parts[i].wtype == KHUI_SB_WTYPE_RELATIVE) {
- staticwidth += (khui_statusbar_parts[i].width * width) / 100;
+ for(i=0;i<khm_n_statusbar_parts;i++) {
+ if(khm_statusbar_parts[i].wtype == KHUI_SB_WTYPE_ABSOLUTE) {
+ staticwidth += khm_statusbar_parts[i].width;
+ } else if(khm_statusbar_parts[i].wtype == KHUI_SB_WTYPE_RELATIVE) {
+ staticwidth += (khm_statusbar_parts[i].width * width) / 100;
}
}
fillerwidth = width - staticwidth;
- parts = malloc(sizeof(INT) * khui_n_statusbar_parts);
+ parts = PMALLOC(sizeof(INT) * khm_n_statusbar_parts);
lastx = 0;
- for(i=0;i<khui_n_statusbar_parts;i++) {
+ for(i=0;i<khm_n_statusbar_parts;i++) {
int w;
- switch(khui_statusbar_parts[i].wtype) {
+ switch(khm_statusbar_parts[i].wtype) {
case KHUI_SB_WTYPE_ABSOLUTE:
- w = khui_statusbar_parts[i].width;
+ w = khm_statusbar_parts[i].width;
break;
case KHUI_SB_WTYPE_RELATIVE:
- w = (khui_statusbar_parts[i].width * width) / 100;
+ w = (khm_statusbar_parts[i].width * width) / 100;
break;
case KHUI_SB_WTYPE_FILLER:
@@ -80,22 +104,22 @@ void khui_statusbar_set_parts(HWND parent) {
}
lastx += w;
- if(i==khui_n_statusbar_parts - 1)
+ if(i==khm_n_statusbar_parts - 1)
parts[i] = -1;
else
parts[i] = lastx;
}
SendMessage(
- khui_hwnd_statusbar,
+ khm_hwnd_statusbar,
SB_SETPARTS,
- khui_n_statusbar_parts,
+ khm_n_statusbar_parts,
(LPARAM) parts);
- free(parts);
+ PFREE(parts);
}
-void khui_create_statusbar(HWND parent) {
+void khm_create_statusbar(HWND parent) {
HWND hwsb;
hwsb = CreateWindowEx(
@@ -112,38 +136,47 @@ void khui_create_statusbar(HWND parent) {
if(!hwsb)
return;
- khui_hwnd_statusbar = hwsb;
+ khm_hwnd_statusbar = hwsb;
khui_statusbar_set_parts(parent);
+
+ kmq_post_message(KMSG_ALERT, KMSG_ALERT_CHECK_QUEUE, 0, 0);
}
-void khui_update_statusbar(HWND parent) {
- MoveWindow(khui_hwnd_statusbar, 0, 0, 0, 0, TRUE);
+void khm_update_statusbar(HWND parent) {
+ MoveWindow(khm_hwnd_statusbar, 0, 0, 0, 0, TRUE);
khui_statusbar_set_parts(parent);
}
int sb_find_index(int id) {
int i;
- for(i=0;i<khui_n_statusbar_parts;i++) {
- if(khui_statusbar_parts[i].id == id)
+ for(i=0;i<khm_n_statusbar_parts;i++) {
+ if(khm_statusbar_parts[i].id == id)
return i;
}
return -1;
}
-void khui_statusbar_set_text(int id, wchar_t * text) {
+void khm_statusbar_set_part(int id, HICON icon, wchar_t * text) {
int idx;
+ if (!khm_hwnd_statusbar)
+ return;
+
idx = sb_find_index(id);
if(idx < 0)
return;
- SendMessage(
- khui_hwnd_statusbar,
- SB_SETTEXT,
- idx,
- (LPARAM) text);
+ SendMessage(khm_hwnd_statusbar,
+ SB_SETICON,
+ idx,
+ (LPARAM) icon);
+
+ SendMessage(khm_hwnd_statusbar,
+ SB_SETTEXT,
+ idx,
+ (LPARAM) text);
}
diff --git a/src/windows/identity/ui/statusbar.h b/src/windows/identity/ui/statusbar.h
index b4f2a6e30f..2fd267e9e1 100644
--- a/src/windows/identity/ui/statusbar.h
+++ b/src/windows/identity/ui/statusbar.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 Massachusetts Institute of Technology
+ * Copyright (c) 2005 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -27,11 +27,11 @@
#ifndef __KHIMAIRA_STATUSBAR_H
#define __KHIMAIRA_STATUSBAR_H
-typedef struct khui_statusbar_part_t {
+typedef struct khm_statusbar_part_t {
int id;
int width;
int wtype; /* one of KHUI_SB_WTYPE_* */
-} khui_statusbar_part;
+} khm_statusbar_part;
#define KHUI_SB_WTYPE_RELATIVE 1
#define KHUI_SB_WTYPE_ABSOLUTE 2
@@ -42,12 +42,13 @@ typedef struct khui_statusbar_part_t {
#define KHUI_SBPART_NOTICE 2
#define KHUI_SBPART_LOC 3
-extern HWND khui_hwnd_statusbar;
-extern khui_statusbar_part khui_statusbar_parts[];
-extern int khui_n_statusbar_parts;
+extern HWND khm_hwnd_statusbar;
+extern khm_statusbar_part khm_statusbar_parts[];
+extern int khm_n_statusbar_parts;
-void khui_create_statusbar(HWND p);
-void khui_update_statusbar(HWND parent);
-void khui_statusbar_set_text(int id, wchar_t * text);
+void khm_create_statusbar(HWND p);
+void khm_update_statusbar(HWND parent);
+void khm_statusbar_set_part(int id, HICON icon, wchar_t * text);
+LRESULT khm_statusbar_notify(LPNMHDR nmhdr);
-#endif \ No newline at end of file
+#endif
diff --git a/src/windows/identity/ui/timer.c b/src/windows/identity/ui/timer.c
index bd5b30eff6..98957858c5 100644
--- a/src/windows/identity/ui/timer.c
+++ b/src/windows/identity/ui/timer.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 Massachusetts Institute of Technology
+ * Copyright (c) 2005 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -59,7 +59,7 @@ khm_timer_init(void) {
khui_nc_timers = KHUI_TIMER_ALLOC_INCR;
khui_n_timers = 0;
- khui_timers = malloc(sizeof(*khui_timers) * khui_nc_timers);
+ khui_timers = PMALLOC(sizeof(*khui_timers) * khui_nc_timers);
#ifdef DEBUG
assert(khui_timers != NULL);
@@ -68,12 +68,12 @@ khm_timer_init(void) {
InitializeCriticalSection(&cs_timers);
}
-void
+void
khm_timer_exit(void) {
EnterCriticalSection(&cs_timers);
if (khui_timers)
- free(khui_timers);
+ PFREE(khui_timers);
khui_timers = NULL;
khui_n_timers = 0;
khui_nc_timers = 0;
@@ -252,7 +252,7 @@ khm_timer_fire(HWND hwnd) {
static int
tmr_update(khm_handle key, khui_timer_type type, __int64 expire,
- __int64 offset, void * data) {
+ __int64 offset, void * data, khm_boolean reinstate) {
int i;
for (i=0; i < (int) khui_n_timers; i++) {
@@ -271,13 +271,13 @@ tmr_update(khm_handle key, khui_timer_type type, __int64 expire,
#endif
khui_nc_timers = UBOUNDSS(i+1, KHUI_TIMER_ALLOC_INCR,
KHUI_TIMER_ALLOC_INCR);
- nt = malloc(sizeof(*nt) * khui_nc_timers);
+ nt = PMALLOC(sizeof(*nt) * khui_nc_timers);
#ifdef DEBUG
assert(nt);
#endif
memcpy(nt, khui_timers, sizeof(*nt) * khui_n_timers);
- free(khui_timers);
+ PFREE(khui_timers);
khui_timers = nt;
}
@@ -292,6 +292,8 @@ tmr_update(khm_handle key, khui_timer_type type, __int64 expire,
khui_timers[i].data = data;
khui_timers[i].flags &= ~KHUI_TE_FLAG_STALE;
+ if (reinstate)
+ khui_timers[i].flags &= ~KHUI_TE_FLAG_EXPIRED;
return i;
}
@@ -328,6 +330,7 @@ tmr_cred_apply_proc(khm_handle cred, void * rock) {
__int64 ft_cred_expiry;
__int64 ft;
__int64 fte;
+ __int64 ft_reinst;
khm_size cb;
kcdb_cred_get_identity(cred, &ident);
@@ -351,10 +354,12 @@ tmr_cred_apply_proc(khm_handle cred, void * rock) {
/* and the current time */
GetSystemTimeAsFileTime((LPFILETIME) &ft_current);
+ TimetToFileTimeInterval(KHUI_TIMEEQ_ERROR, (LPFILETIME) &ft_reinst);
+
mark_idx = tmr_find(ident, KHUI_TTYPE_ID_MARK, 0, 0);
if (mark_idx < 0) {
- mark_idx = tmr_update(ident, KHUI_TTYPE_ID_MARK, 0, 0, 0);
+ mark_idx = tmr_update(ident, KHUI_TTYPE_ID_MARK, 0, 0, 0, FALSE);
kcdb_identity_hold(ident);
#ifdef DEBUG
assert(mark_idx >= 0);
@@ -426,12 +431,37 @@ tmr_cred_apply_proc(khm_handle cred, void * rock) {
khc_close_space(csp_id);
if (monitor && do_renew) {
+ int prev;
+
TimetToFileTimeInterval(to_renew, (LPFILETIME) &ft);
fte = ft_expiry - ft;
- if (fte > ft_current) {
- tmr_update(ident, KHUI_TTYPE_ID_RENEW, fte, ft, 0);
+ prev =
+ tmr_find(ident, KHUI_TTYPE_ID_RENEW, 0, 0);
+
+ /* we set off a renew notification immediately if the
+ renew threshold has passed but a renew was never sent.
+ This maybe because that NetIDMgr was started at the
+ last minute, or because for some reason the renew timer
+ could not be triggered earlier. */
+ if (fte > ft_current ||
+ prev == -1 ||
+ !(khui_timers[prev].flags & KHUI_TE_FLAG_EXPIRED)) {
+
+ if (fte <= ft_current)
+ fte = ft_current;
+
+ tmr_update(ident, KHUI_TTYPE_ID_RENEW,
+ fte, ft, 0, fte > ft_current + ft_reinst);
renew_done = TRUE;
+ } else {
+ /* special case. If the renew timer was in the past
+ and it was expired, then we retain the record as
+ long as the credentials are around. If the renewal
+ failed we don't want to automatically retry
+ everytime we check the timers. */
+ tmr_update(ident, KHUI_TTYPE_ID_RENEW,
+ fte, ft, 0, FALSE);
}
}
@@ -440,7 +470,8 @@ tmr_cred_apply_proc(khm_handle cred, void * rock) {
fte = ft_expiry - ft;
if (fte > ft_current)
- tmr_update(ident, KHUI_TTYPE_ID_WARN, fte, ft, 0);
+ tmr_update(ident, KHUI_TTYPE_ID_WARN,
+ fte, ft, 0, fte > ft_current + ft_reinst);
}
if (monitor && do_crit && !renew_done) {
@@ -448,12 +479,14 @@ tmr_cred_apply_proc(khm_handle cred, void * rock) {
fte = ft_expiry - ft;
if (fte > ft_current)
- tmr_update(ident, KHUI_TTYPE_ID_CRIT, fte, ft, 0);
+ tmr_update(ident, KHUI_TTYPE_ID_CRIT,
+ fte, ft, 0, fte > ft_current + ft_reinst);
}
if (monitor && !renew_done) {
if (ft_expiry > ft_current)
- tmr_update(ident, KHUI_TTYPE_ID_EXP, ft_expiry, 0, 0);
+ tmr_update(ident, KHUI_TTYPE_ID_EXP,
+ ft_expiry, 0, 0, fte > ft_current + ft_reinst);
}
_done_with_ident:
@@ -474,12 +507,13 @@ tmr_cred_apply_proc(khm_handle cred, void * rock) {
goto _cleanup;
if ((idx = tmr_find(ident, KHUI_TTYPE_ID_WARN, 0, 0)) >= 0 &&
- !(khui_timers[idx].flags & KHUI_TE_FLAG_STALE)) {
+ !(khui_timers[idx].flags & KHUI_TE_FLAG_STALE)) {
fte = ft_cred_expiry - khui_timers[idx].offset;
if (fte > ft_current) {
tmr_update(cred, KHUI_TTYPE_CRED_WARN, fte,
- khui_timers[idx].offset, 0);
+ khui_timers[idx].offset, 0,
+ fte > ft_current + ft_reinst);
kcdb_cred_hold(cred);
}
}
@@ -490,7 +524,8 @@ tmr_cred_apply_proc(khm_handle cred, void * rock) {
fte = ft_cred_expiry - khui_timers[idx].offset;
if (fte > ft_current) {
tmr_update(cred, KHUI_TTYPE_CRED_CRIT, fte,
- khui_timers[idx].offset, 0);
+ khui_timers[idx].offset, 0,
+ fte > ft_current + ft_reinst);
kcdb_cred_hold(cred);
}
}
@@ -501,7 +536,8 @@ tmr_cred_apply_proc(khm_handle cred, void * rock) {
fte = ft_cred_expiry - khui_timers[idx].offset;
if (fte > ft_current) {
tmr_update(cred, KHUI_TTYPE_CRED_RENEW, fte,
- khui_timers[idx].offset, 0);
+ khui_timers[idx].offset, 0,
+ fte > ft_current + ft_reinst);
kcdb_cred_hold(cred);
}
}
@@ -511,7 +547,8 @@ tmr_cred_apply_proc(khm_handle cred, void * rock) {
if (ft_cred_expiry > ft_current) {
tmr_update(cred, KHUI_TTYPE_CRED_EXP, ft_cred_expiry,
- 0, 0);
+ 0, 0,
+ ft_cred_expiry > ft_current + ft_reinst);
}
}
@@ -577,6 +614,7 @@ tmr_purge(void) {
khui_n_timers = j;
}
+/* go through all the credentials and set timers as appropriate. */
void
khm_timer_refresh(HWND hwnd) {
int i;
@@ -608,10 +646,11 @@ khm_timer_refresh(HWND hwnd) {
next_event = 0;
for (i=0; i < (int) khui_n_timers; i++) {
- if (next_event == 0 ||
- (!(khui_timers[i].flags & KHUI_TE_FLAG_EXPIRED) &&
- khui_timers[i].type != KHUI_TTYPE_ID_MARK &&
+ if (!(khui_timers[i].flags & KHUI_TE_FLAG_EXPIRED) &&
+ khui_timers[i].type != KHUI_TTYPE_ID_MARK &&
+ (next_event == 0 ||
next_event > khui_timers[i].expire))
+
next_event = khui_timers[i].expire;
}
diff --git a/src/windows/identity/ui/timer.h b/src/windows/identity/ui/timer.h
index 921b9dcc53..3a57917214 100644
--- a/src/windows/identity/ui/timer.h
+++ b/src/windows/identity/ui/timer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 Massachusetts Institute of Technology
+ * Copyright (c) 2005 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
diff --git a/src/windows/identity/ui/toolbar.c b/src/windows/identity/ui/toolbar.c
index d1a84e235b..fcc0d9ebd7 100644
--- a/src/windows/identity/ui/toolbar.c
+++ b/src/windows/identity/ui/toolbar.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 Massachusetts Institute of Technology
+ * Copyright (c) 2005 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -124,8 +124,7 @@ void khui_add_action_to_toolbar(HWND tb, khui_action *a, int opt, HIMAGELIST hiL
bn.fsStyle = BTNS_SEP;
bn.iBitmap = 3;
- lr = SendMessage(
- tb,
+ lr = SendMessage(tb,
TB_ADDBUTTONS,
1,
(LPARAM) &bn);
@@ -158,7 +157,9 @@ void khui_add_action_to_toolbar(HWND tb, khui_action *a, int opt, HIMAGELIST hiL
TB_ADDSTRING,
(WPARAM) NULL,
(LPARAM) buf);
+#if (_WIN32_IE >= 0x0501)
bn.fsStyle |= BTNS_SHOWTEXT;
+#endif
bn.iString = idx_caption;
}
}
@@ -170,8 +171,11 @@ void khui_add_action_to_toolbar(HWND tb, khui_action *a, int opt, HIMAGELIST hiL
if((opt & KHUI_TOOLBAR_ADD_BITMAP) && a->ib_normal) {
bn.fsStyle |= TBSTYLE_CUSTOMERASE;
bn.iBitmap = khui_tb_blank;
- } else
+ } else {
+#if (_WIN32_IE >= 0x0501)
bn.iBitmap = I_IMAGENONE;
+#endif
+ }
bn.idCommand = a->cmd;
@@ -242,21 +246,24 @@ void khm_create_standard_toolbar(HWND rebar) {
def = khui_find_menu(KHUI_TOOLBAR_STANDARD);
- hwtb = CreateWindowEx(
- TBSTYLE_EX_MIXEDBUTTONS,
- TOOLBARCLASSNAME,
- (LPWSTR) NULL,
- WS_CHILD |
- TBSTYLE_FLAT |
- TBSTYLE_AUTOSIZE |
- TBSTYLE_LIST |
- CCS_NORESIZE |
- CCS_NOPARENTALIGN |
- CCS_ADJUSTABLE |
- CCS_NODIVIDER,
- 0, 0, 0, 0, rebar,
- (HMENU) NULL, khm_hInstance,
- NULL);
+ hwtb = CreateWindowEx(0
+#if (_WIN32_IE >= 0x0501)
+ | TBSTYLE_EX_MIXEDBUTTONS
+#endif
+ ,
+ TOOLBARCLASSNAME,
+ (LPWSTR) NULL,
+ WS_CHILD |
+ TBSTYLE_FLAT |
+ TBSTYLE_AUTOSIZE |
+ TBSTYLE_LIST |
+ CCS_NORESIZE |
+ CCS_NOPARENTALIGN |
+ CCS_ADJUSTABLE |
+ CCS_NODIVIDER,
+ 0, 0, 0, 0, rebar,
+ (HMENU) NULL, khm_hInstance,
+ NULL);
if(!hwtb) {
#ifdef DEBUG
diff --git a/src/windows/identity/ui/toolbar.h b/src/windows/identity/ui/toolbar.h
index 65598debce..89700f2e4e 100644
--- a/src/windows/identity/ui/toolbar.h
+++ b/src/windows/identity/ui/toolbar.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 Massachusetts Institute of Technology
+ * Copyright (c) 2005 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -49,4 +49,4 @@ void khm_update_standard_toolbar(void);
#define KHUI_TOOLBAR_BGCOLOR RGB(0xd7,0xd7,0xd7)
#define KHUI_TOOLBAR_MAX_BTNS 64
-#endif \ No newline at end of file
+#endif