summaryrefslogtreecommitdiffstats
path: root/src/windows/identity/uilib
diff options
context:
space:
mode:
Diffstat (limited to 'src/windows/identity/uilib')
-rw-r--r--src/windows/identity/uilib/accel.csv5
-rw-r--r--src/windows/identity/uilib/action.c36
-rw-r--r--src/windows/identity/uilib/actions.csv1
-rw-r--r--src/windows/identity/uilib/alert.c46
-rw-r--r--src/windows/identity/uilib/configui.c137
-rw-r--r--src/windows/identity/uilib/configui.h2
-rw-r--r--src/windows/identity/uilib/creddlg.c76
-rw-r--r--src/windows/identity/uilib/khaction.h2
-rw-r--r--src/windows/identity/uilib/khactiondef.h4
-rw-r--r--src/windows/identity/uilib/khalerts.h12
-rw-r--r--src/windows/identity/uilib/khconfigui.h19
-rw-r--r--src/windows/identity/uilib/khhtlink.h2
-rw-r--r--src/windows/identity/uilib/khnewcred.h8
-rw-r--r--src/windows/identity/uilib/khprops.h9
-rw-r--r--src/windows/identity/uilib/khremote.h2
-rw-r--r--src/windows/identity/uilib/khrescache.h2
-rw-r--r--src/windows/identity/uilib/khtracker.h3
-rw-r--r--src/windows/identity/uilib/khuidefs.h2
-rw-r--r--src/windows/identity/uilib/propsheet.c104
-rw-r--r--src/windows/identity/uilib/propwnd.c2
-rw-r--r--src/windows/identity/uilib/rescache.c12
-rw-r--r--src/windows/identity/uilib/trackerwnd.c23
-rw-r--r--src/windows/identity/uilib/uilibmain.c7
23 files changed, 342 insertions, 174 deletions
diff --git a/src/windows/identity/uilib/accel.csv b/src/windows/identity/uilib/accel.csv
index 80b6ad05f..05b945514 100644
--- a/src/windows/identity/uilib/accel.csv
+++ b/src/windows/identity/uilib/accel.csv
@@ -12,6 +12,7 @@ KHUI_PACTION_ENTER,FVIRTKEY,VK_RETURN,KHUI_ACCEL_SCOPE_GLOBAL
KHUI_PACTION_ESC,FVIRTKEY,VK_ESCAPE,KHUI_ACCEL_SCOPE_GLOBAL
#KHUI_PACTION_DELETE,FVIRTKEY,VK_DELETE,KHUI_ACCEL_SCOPE_GLOBAL
KHUI_ACTION_DESTROY_CRED,FVIRTKEY,VK_DELETE,KHUI_ACCEL_SCOPE_GLOBAL
-KHUI_ACTION_EXIT,FCONTROL,\'X\',KHUI_ACCEL_SCOPE_GLOBAL
+KHUI_ACTION_EXIT,FCONTROL|FVIRTKEY,\'X\',KHUI_ACCEL_SCOPE_GLOBAL
KHUI_ACTION_VIEW_REFRESH,FVIRTKEY,VK_F5,KHUI_ACCEL_SCOPE_GLOBAL
-KHUI_ACTION_NEW_CRED,FCONTROL,\'N\',KHUI_ACCEL_SCOPE_GLOBAL
+KHUI_ACTION_NEW_CRED,FCONTROL|FVIRTKEY,\'N\',KHUI_ACCEL_SCOPE_GLOBAL
+KHUI_PACTION_SELALL,FCONTROL|FVIRTKEY,\'A\',KHUI_ACCEL_SCOPE_GLOBAL
diff --git a/src/windows/identity/uilib/action.c b/src/windows/identity/uilib/action.c
index cc383c689..0ebb9ae0c 100644
--- a/src/windows/identity/uilib/action.c
+++ b/src/windows/identity/uilib/action.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,6 +26,7 @@
#define NOEXPORT
#include<khuidefs.h>
+#include<utils.h>
#include<assert.h>
khui_action_ref khui_main_menu[] = {
@@ -212,12 +213,13 @@ KHMEXP khui_menu_def * KHMAPI
khui_menu_create(int cmd)
{
khui_menu_def * d;
- d = malloc(sizeof(*d));
+
+ d = PMALLOC(sizeof(*d));
ZeroMemory(d, sizeof(*d));
d->cmd = cmd;
d->nc_items = MENU_NC_ITEMS;
- d->items = malloc(sizeof(*(d->items)) * d->nc_items);
+ d->items = PMALLOC(sizeof(*(d->items)) * d->nc_items);
d->state = KHUI_MENUSTATE_ALLOCD;
@@ -261,12 +263,12 @@ khui_menu_delete(khui_menu_def * d)
for(i=0; i< (int) d->n_items; i++) {
if(d->items[i].flags & KHUI_ACTIONREF_FREE_PACTION)
- free(d->items[i].p_action);
+ PFREE(d->items[i].p_action);
}
if(d->items)
- free(d->items);
- free(d);
+ PFREE(d->items);
+ PFREE(d);
}
static void khui_menu_assert_size(khui_menu_def * d, size_t n)
@@ -275,9 +277,9 @@ static void khui_menu_assert_size(khui_menu_def * d, size_t n)
khui_action_ref * ni;
d->nc_items = UBOUNDSS(n, MENU_NC_ITEMS, MENU_NC_ITEMS);
- ni = malloc(sizeof(*(d->items)) * d->nc_items);
+ ni = PMALLOC(sizeof(*(d->items)) * d->nc_items);
memcpy(ni, d->items, sizeof(*(d->items)) * d->n_items);
- free(d->items);
+ PFREE(d->items);
d->items = ni;
}
}
@@ -420,7 +422,7 @@ KHMEXP void KHMAPI khui_enable_actions(khui_menu_def * d, khm_boolean enable)
}
if(delta) {
- kmq_send_message(KMSG_ACT, KMSG_ACT_ENABLE, 0, 0);
+ kmq_post_message(KMSG_ACT, KMSG_ACT_ENABLE, 0, 0);
}
}
@@ -438,7 +440,7 @@ KHMEXP void KHMAPI khui_enable_action(int cmd, khm_boolean enable) {
} else
return;
- kmq_send_message(KMSG_ACT, KMSG_ACT_ENABLE, 0, 0);
+ kmq_post_message(KMSG_ACT, KMSG_ACT_ENABLE, 0, 0);
}
KHMEXP HACCEL KHMAPI khui_create_global_accel_table(void) {
@@ -446,7 +448,7 @@ KHMEXP HACCEL KHMAPI khui_create_global_accel_table(void) {
ACCEL * accels;
HACCEL ha;
- accels = malloc(sizeof(ACCEL) * khui_n_accel_global);
+ accels = PMALLOC(sizeof(ACCEL) * khui_n_accel_global);
for(i=0;i<khui_n_accel_global;i++) {
accels[i].cmd = khui_accel_global[i].cmd;
accels[i].fVirt = khui_accel_global[i].mod;
@@ -455,7 +457,7 @@ KHMEXP HACCEL KHMAPI khui_create_global_accel_table(void) {
ha = CreateAcceleratorTable(accels, khui_n_accel_global);
- free(accels);
+ PFREE(accels);
return ha;
}
@@ -623,10 +625,10 @@ khuiint_copy_context(khui_action_context * ctxdest,
if (ctxdest->int_cb_buf < cb_total) {
if (ctxdest->int_buf)
- free(ctxdest->int_buf);
+ PFREE(ctxdest->int_buf);
ctxdest->int_cb_buf = cb_total;
- ctxdest->int_buf = malloc(cb_total);
+ ctxdest->int_buf = PMALLOC(cb_total);
}
#ifdef DEBUG
@@ -680,7 +682,7 @@ khuiint_copy_context(khui_action_context * ctxdest,
khui_context_release() to free the allocated buffer */
#if 0
if (ctxsrc->vparam && ctxsrc->cb_vparam) {
- ctxdest->vparam = malloc(ctxsrc->cb_vparam);
+ ctxdest->vparam = PMALLOC(ctxsrc->cb_vparam);
#ifdef DEBUG
assert(ctxdest->vparam);
#endif
@@ -891,11 +893,11 @@ khui_context_release(khui_action_context * ctx)
}
ctx->credset = NULL;
if (ctx->int_buf)
- free(ctx->int_buf);
+ PFREE(ctx->int_buf);
ctx->int_buf = NULL;
#if 0
if (ctx->vparam && ctx->cb_vparam > 0) {
- free(ctx->vparam);
+ PFREE(ctx->vparam);
ctx->vparam = NULL;
}
ctx->cb_vparam = 0;
diff --git a/src/windows/identity/uilib/actions.csv b/src/windows/identity/uilib/actions.csv
index e317c7cc5..371fb8798 100644
--- a/src/windows/identity/uilib/actions.csv
+++ b/src/windows/identity/uilib/actions.csv
@@ -35,3 +35,4 @@ KHUI_PACTION_OK,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_PACTION_OK,0,0,0
KHUI_PACTION_CANCEL,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_PACTION_CANCEL,0,0,0
KHUI_PACTION_CLOSE,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_PACTION_CLOSE,0,0,0
KHUI_PACTION_BLANK,0,,IDB_TB_SPACE,0,IDB_TB_SPACE,IDB_TB_BLANK_SM,IDB_TB_BLANK_SM,0,0,0,KHUI_ACTIONSTATE_DISABLED
+KHUI_PACTION_NEXT,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_PACTION_NEXT,0,0,0
diff --git a/src/windows/identity/uilib/alert.c b/src/windows/identity/uilib/alert.c
index 69ef01f93..dd096063b 100644
--- a/src/windows/identity/uilib/alert.c
+++ b/src/windows/identity/uilib/alert.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,6 +25,7 @@
/* $Id$ */
#include<khuidefs.h>
+#include<utils.h>
#include<assert.h>
/***********************************************************************
@@ -51,7 +52,7 @@ khui_alert_create_empty(khui_alert ** result)
{
khui_alert * a;
- a = malloc(sizeof(*a));
+ a = PMALLOC(sizeof(*a));
ZeroMemory(a, sizeof(*a));
a->magic = KHUI_ALERT_MAGIC;
@@ -97,21 +98,21 @@ khui_alert_set_title(khui_alert * alert, const wchar_t * title)
if(title) {
if(FAILED(StringCbLength(title,
- KHUI_MAXCB_TITLE - sizeof(wchar_t),
+ KHUI_MAXCB_TITLE,
&cb))) {
- return KHM_ERROR_INVALID_PARM;
+ return KHM_ERROR_INVALID_PARAM;
}
cb += sizeof(wchar_t);
}
EnterCriticalSection(&cs_alerts);
if(alert->title && (alert->flags & KHUI_ALERT_FLAG_FREE_TITLE)) {
- free(alert->title);
+ PFREE(alert->title);
alert->title = NULL;
alert->flags &= ~KHUI_ALERT_FLAG_FREE_TITLE;
}
if(title) {
- alert->title = malloc(cb);
+ alert->title = PMALLOC(cb);
StringCbCopy(alert->title, cb, title);
alert->flags |= KHUI_ALERT_FLAG_FREE_TITLE;
}
@@ -126,7 +127,7 @@ khui_alert_set_flags(khui_alert * alert, khm_int32 mask, khm_int32 flags)
assert(alert->magic == KHUI_ALERT_MAGIC);
if (mask & ~KHUI_ALERT_FLAGMASK_RDWR)
- return KHM_ERROR_INVALID_PARM;
+ return KHM_ERROR_INVALID_PARAM;
EnterCriticalSection(&cs_alerts);
alert->flags =
@@ -160,7 +161,7 @@ khui_alert_set_suggestion(khui_alert * alert,
if(FAILED(StringCbLength(suggestion,
KHUI_MAXCB_MESSAGE - sizeof(wchar_t),
&cb))) {
- return KHM_ERROR_INVALID_PARM;
+ return KHM_ERROR_INVALID_PARAM;
}
cb += sizeof(wchar_t);
}
@@ -169,14 +170,14 @@ khui_alert_set_suggestion(khui_alert * alert,
if(alert->suggestion &&
(alert->flags & KHUI_ALERT_FLAG_FREE_SUGGEST)) {
- free(alert->suggestion);
+ PFREE(alert->suggestion);
alert->suggestion = NULL;
alert->flags &= ~KHUI_ALERT_FLAG_FREE_SUGGEST;
}
if(suggestion) {
- alert->suggestion = malloc(cb);
+ alert->suggestion = PMALLOC(cb);
StringCbCopy(alert->suggestion, cb, suggestion);
alert->flags |= KHUI_ALERT_FLAG_FREE_SUGGEST;
}
@@ -196,7 +197,7 @@ khui_alert_set_message(khui_alert * alert, const wchar_t * message)
if(FAILED(StringCbLength(message,
KHUI_MAXCB_MESSAGE - sizeof(wchar_t),
&cb))) {
- return KHM_ERROR_INVALID_PARM;
+ return KHM_ERROR_INVALID_PARAM;
}
cb += sizeof(wchar_t);
}
@@ -205,14 +206,14 @@ khui_alert_set_message(khui_alert * alert, const wchar_t * message)
if(alert->message &&
(alert->flags & KHUI_ALERT_FLAG_FREE_MESSAGE)) {
- free(alert->message);
+ PFREE(alert->message);
alert->message = NULL;
alert->flags &= ~KHUI_ALERT_FLAG_FREE_MESSAGE;
}
if(message) {
- alert->message = malloc(cb);
+ alert->message = PMALLOC(cb);
StringCbCopy(alert->message, cb, message);
alert->flags |= KHUI_ALERT_FLAG_FREE_MESSAGE;
}
@@ -262,6 +263,17 @@ khui_alert_show(khui_alert * alert)
return KHM_ERROR_SUCCESS;
}
+KHMEXP khm_int32 KHMAPI
+khui_alert_queue(khui_alert * alert)
+{
+ assert(alert->magic == KHUI_ALERT_MAGIC);
+
+ khui_alert_hold(alert);
+ kmq_post_message(KMSG_ALERT, KMSG_ALERT_QUEUE, 0, (void *) alert);
+
+ return KHM_ERROR_SUCCESS;
+}
+
KHMEXP khm_int32 KHMAPI
khui_alert_show_simple(const wchar_t * title,
const wchar_t * message,
@@ -303,26 +315,26 @@ free_alert(khui_alert * alert)
if(alert->flags & KHUI_ALERT_FLAG_FREE_TITLE) {
assert(alert->title);
- free(alert->title);
+ PFREE(alert->title);
alert->title = NULL;
alert->flags &= ~KHUI_ALERT_FLAG_FREE_TITLE;
}
if(alert->flags & KHUI_ALERT_FLAG_FREE_MESSAGE) {
assert(alert->message);
- free(alert->message);
+ PFREE(alert->message);
alert->message = NULL;
alert->flags &= ~KHUI_ALERT_FLAG_FREE_MESSAGE;
}
if(alert->flags & KHUI_ALERT_FLAG_FREE_SUGGEST) {
assert(alert->suggestion);
- free(alert->suggestion);
+ PFREE(alert->suggestion);
alert->suggestion = NULL;
alert->flags &= ~KHUI_ALERT_FLAG_FREE_SUGGEST;
}
if(alert->flags & KHUI_ALERT_FLAG_FREE_STRUCT) {
alert->flags &= ~KHUI_ALERT_FLAG_FREE_STRUCT;
alert->magic = 0;
- free(alert);
+ PFREE(alert);
}
}
diff --git a/src/windows/identity/uilib/configui.c b/src/windows/identity/uilib/configui.c
index 5c97c701f..51498c0b2 100644
--- a/src/windows/identity/uilib/configui.c
+++ b/src/windows/identity/uilib/configui.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
@@ -27,6 +27,7 @@
#include<khuidefs.h>
#include<kmm.h>
#include<configui.h>
+#include<utils.h>
#include<assert.h>
khm_int32 cfgui_node_serial;
@@ -39,7 +40,7 @@ static khui_config_node_i *
cfgui_create_new_node(void) {
khui_config_node_i * node;
- node = malloc(sizeof(*node));
+ node = PMALLOC(sizeof(*node));
#ifdef DEBUG
assert(node);
#endif
@@ -60,13 +61,13 @@ cfgui_free_node(khui_config_node_i * node) {
return;
if (node->reg.name)
- free((void *) node->reg.name);
+ PFREE((void *) node->reg.name);
if (node->reg.short_desc)
- free((void *) node->reg.short_desc);
+ PFREE((void *) node->reg.short_desc);
if (node->reg.long_desc)
- free((void *) node->reg.long_desc);
+ PFREE((void *) node->reg.long_desc);
node->magic = 0;
@@ -75,7 +76,7 @@ cfgui_free_node(khui_config_node_i * node) {
ZeroMemory(node, sizeof(*node));
- free(node);
+ PFREE(node);
}
@@ -145,7 +146,7 @@ khui_cfg_register(khui_config_node vparent,
&cb_long_desc)) ||
(vparent &&
!cfgui_is_valid_node_handle(vparent)))
- return KHM_ERROR_INVALID_PARM;
+ return KHM_ERROR_INVALID_PARAM;
if (KHM_SUCCEEDED(khui_cfg_open(vparent,
reg->name,
@@ -163,11 +164,11 @@ khui_cfg_register(khui_config_node vparent,
node->reg = *reg;
node->reg.flags &= KHUI_CNFLAGMASK_STATIC;
- name = malloc(cb_name);
+ name = PMALLOC(cb_name);
StringCbCopy(name, cb_name, reg->name);
- short_desc = malloc(cb_short_desc);
+ short_desc = PMALLOC(cb_short_desc);
StringCbCopy(short_desc, cb_short_desc, reg->short_desc);
- long_desc = malloc(cb_long_desc);
+ long_desc = PMALLOC(cb_long_desc);
StringCbCopy(long_desc, cb_long_desc, reg->long_desc);
node->reg.name = name;
@@ -204,7 +205,7 @@ khui_cfg_open(khui_config_node vparent,
!cfgui_is_valid_node_handle(vparent)) ||
FAILED(StringCbLength(name, KHUI_MAXCCH_NAME, &sz)) ||
!result)
- return KHM_ERROR_INVALID_PARM;
+ return KHM_ERROR_INVALID_PARAM;
EnterCriticalSection(&cs_cfgui);
if (vparent)
@@ -238,7 +239,7 @@ KHMEXP khm_int32 KHMAPI
khui_cfg_remove(khui_config_node vnode) {
khui_config_node_i * node;
if (!cfgui_is_valid_node_handle(vnode))
- return KHM_ERROR_INVALID_PARM;
+ return KHM_ERROR_INVALID_PARAM;
EnterCriticalSection(&cs_cfgui);
node = cfgui_node_i_from_handle(vnode);
@@ -251,7 +252,7 @@ khui_cfg_remove(khui_config_node vnode) {
KHMEXP khm_int32 KHMAPI
khui_cfg_hold(khui_config_node vnode) {
if (!cfgui_is_valid_node_handle(vnode))
- return KHM_ERROR_INVALID_PARM;
+ return KHM_ERROR_INVALID_PARAM;
cfgui_hold_node(cfgui_node_i_from_handle(vnode));
@@ -261,7 +262,7 @@ khui_cfg_hold(khui_config_node vnode) {
KHMEXP khm_int32 KHMAPI
khui_cfg_release(khui_config_node vnode) {
if (!cfgui_is_valid_node_handle(vnode))
- return KHM_ERROR_INVALID_PARM;
+ return KHM_ERROR_INVALID_PARAM;
cfgui_release_node(cfgui_node_i_from_handle(vnode));
@@ -269,6 +270,39 @@ khui_cfg_release(khui_config_node vnode) {
}
KHMEXP khm_int32 KHMAPI
+khui_cfg_get_parent(khui_config_node vnode,
+ khui_config_node * result) {
+
+ khui_config_node_i * node;
+ khui_config_node_i * parent;
+
+ if(!cfgui_is_valid_node_handle(vnode) ||
+ !result)
+ return KHM_ERROR_INVALID_PARAM;
+
+ EnterCriticalSection(&cs_cfgui);
+ if (cfgui_is_valid_node_handle(vnode)) {
+ node = cfgui_node_i_from_handle(vnode);
+ parent = TPARENT(node);
+ if (parent == cfgui_root_config)
+ parent = NULL;
+ } else {
+ parent = NULL;
+ }
+ if (parent) {
+ cfgui_hold_node(parent);
+ }
+ LeaveCriticalSection(&cs_cfgui);
+
+ *result = parent;
+
+ if (parent)
+ return KHM_ERROR_SUCCESS;
+ else
+ return KHM_ERROR_NOT_FOUND;
+}
+
+KHMEXP khm_int32 KHMAPI
khui_cfg_get_first_child(khui_config_node vparent,
khui_config_node * result) {
khui_config_node_i * parent;
@@ -278,7 +312,7 @@ khui_cfg_get_first_child(khui_config_node vparent,
if((vparent && !cfgui_is_valid_node_handle(vparent)) ||
!result)
- return KHM_ERROR_INVALID_PARM;
+ return KHM_ERROR_INVALID_PARAM;
EnterCriticalSection(&cs_cfgui);
if (cfgui_is_valid_node_handle(vparent)) {
@@ -319,7 +353,7 @@ khui_cfg_get_first_subpanel(khui_config_node vparent,
if((vparent && !cfgui_is_valid_node_handle(vparent)) ||
!result)
- return KHM_ERROR_INVALID_PARM;
+ return KHM_ERROR_INVALID_PARAM;
EnterCriticalSection(&cs_cfgui);
if (cfgui_is_valid_node_handle(vparent)) {
@@ -360,7 +394,7 @@ khui_cfg_get_next(khui_config_node vnode,
if (!cfgui_is_valid_node_handle(vnode) ||
!result)
- return KHM_ERROR_INVALID_PARM;
+ return KHM_ERROR_INVALID_PARAM;
EnterCriticalSection(&cs_cfgui);
if (cfgui_is_valid_node_handle(vnode)) {
@@ -393,7 +427,7 @@ khui_cfg_get_next_release(khui_config_node * pvnode) {
if (!pvnode ||
!cfgui_is_valid_node_handle(*pvnode))
- return KHM_ERROR_INVALID_PARM;
+ return KHM_ERROR_INVALID_PARAM;
EnterCriticalSection(&cs_cfgui);
if (cfgui_is_valid_node_handle(*pvnode)) {
@@ -429,7 +463,7 @@ khui_cfg_get_reg(khui_config_node vnode,
if ((vnode && !cfgui_is_valid_node_handle(vnode)) ||
!reg)
- return KHM_ERROR_INVALID_PARM;
+ return KHM_ERROR_INVALID_PARAM;
EnterCriticalSection(&cs_cfgui);
if (cfgui_is_valid_node_handle(vnode)) {
@@ -447,7 +481,7 @@ khui_cfg_get_reg(khui_config_node vnode,
if (node)
return KHM_ERROR_SUCCESS;
else
- return KHM_ERROR_INVALID_PARM;
+ return KHM_ERROR_INVALID_PARAM;
}
KHMEXP HWND KHMAPI
@@ -575,7 +609,7 @@ get_node_data(khui_config_node_i * node,
#ifdef DEBUG
assert(node->nc_data >= node->n_data + 1);
#endif
- newdata = malloc(sizeof(*newdata) * node->nc_data);
+ newdata = PMALLOC(sizeof(*newdata) * node->nc_data);
#ifdef DEBUG
assert(newdata);
#endif
@@ -583,7 +617,7 @@ get_node_data(khui_config_node_i * node,
if (node->data && node->n_data > 0) {
memcpy(newdata, node->data, node->n_data * sizeof(*newdata));
- free(node->data);
+ PFREE(node->data);
}
node->data = newdata;
}
@@ -790,11 +824,12 @@ khui_cfg_set_flags(khui_config_node vnode,
/* called with cs_cfgui held */
static void
-recalc_node_flags(khui_config_node vnode) {
+recalc_node_flags(khui_config_node vnode, khm_boolean plural) {
khui_config_node_i * node;
khui_config_node_i * parent;
+ khui_config_node_i * subpanel;
+ cfg_node_data * data;
khm_int32 flags;
- khm_size i;
#ifdef DEBUG
assert(cfgui_is_valid_node_handle(vnode));
@@ -802,33 +837,43 @@ recalc_node_flags(khui_config_node vnode) {
node = cfgui_node_i_from_handle(vnode);
- parent = TPARENT(node);
+ if (plural)
+ parent = TPARENT(node);
+ else
+ parent = node;
#ifdef DEBUG
assert(parent);
#endif
flags = 0;
- /* this code is wrong. we need to go through all the subpanels in
- the parent and pick the data record corresponding to this node
- and then merge the flags from there. */
- /* TODO: fix this */
- for (i=0; i < parent->n_data; i++) {
- if (parent->data[i].key == vnode)
- flags |= parent->data[i].flags;
+ for(subpanel = TFIRSTCHILD(parent); subpanel;
+ subpanel = LNEXT(subpanel)) {
+ if (!(subpanel->reg.flags & KHUI_CNFLAG_SUBPANEL) ||
+ (plural && !(subpanel->reg.flags & KHUI_CNFLAG_PLURAL)) ||
+ (!plural && (subpanel->reg.flags & KHUI_CNFLAG_PLURAL)))
+ continue;
+
+ data = get_node_data(subpanel,
+ vnode,
+ FALSE);
+
+ if (data) {
+ flags |= data->flags;
+ }
}
flags &= KHUI_CNFLAGMASK_DYNAMIC;
- if ((node->flags & flags) != flags) {
- node->flags = flags |
- (node->flags & ~KHUI_CNFLAGMASK_DYNAMIC);
+ if ((node->flags & KHUI_CNFLAGMASK_DYNAMIC) == flags)
+ return;
+
+ node->flags = (node->flags & ~KHUI_CNFLAGMASK_DYNAMIC) | flags;
- if (hwnd_cfgui)
- PostMessage(hwnd_cfgui, KHUI_WM_CFG_NOTIFY,
- MAKEWPARAM((WORD) node->flags, WMCFG_UPDATE_STATE),
- (LPARAM) vnode);
- }
+ if (hwnd_cfgui)
+ PostMessage(hwnd_cfgui, KHUI_WM_CFG_NOTIFY,
+ MAKEWPARAM((WORD) node->flags, WMCFG_UPDATE_STATE),
+ (LPARAM) vnode);
}
KHMEXP void KHMAPI
@@ -862,7 +907,9 @@ khui_cfg_set_flags_inst(khui_config_init_data * d,
data->flags = new_flags;
if (d->ctx_node != d->ref_node)
- recalc_node_flags(d->ctx_node);
+ recalc_node_flags(d->ctx_node, TRUE);
+ else
+ recalc_node_flags(d->ctx_node, FALSE);
}
}
}
@@ -900,7 +947,7 @@ khui_cfg_get_name(khui_config_node vnode,
if (!cb_buf ||
!cfgui_is_valid_node_handle(vnode))
- return KHM_ERROR_INVALID_PARM;
+ return KHM_ERROR_INVALID_PARAM;
EnterCriticalSection(&cs_cfgui);
if (cfgui_is_valid_node_handle(vnode) &&
@@ -919,7 +966,7 @@ khui_cfg_get_name(khui_config_node vnode,
*cb_buf = cb;
}
} else {
- rv = KHM_ERROR_INVALID_PARM;
+ rv = KHM_ERROR_INVALID_PARAM;
}
LeaveCriticalSection(&cs_cfgui);
@@ -936,7 +983,7 @@ khui_cfg_init_dialog_data(HWND hwnd_dlg,
khui_config_init_data * d;
cb = sizeof(khui_config_init_data) + cb_extra;
- d = malloc(cb);
+ d = PMALLOC(cb);
#ifdef DEBUG
assert(d);
#endif
@@ -994,7 +1041,7 @@ khui_cfg_free_dialog_data(HWND hwnd_dlg) {
#endif
if (d) {
- free(d);
+ PFREE(d);
}
return (d)?KHM_ERROR_SUCCESS: KHM_ERROR_NOT_FOUND;
diff --git a/src/windows/identity/uilib/configui.h b/src/windows/identity/uilib/configui.h
index 37d5e9705..c7ff88bdb 100644
--- a/src/windows/identity/uilib/configui.h
+++ b/src/windows/identity/uilib/configui.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/uilib/creddlg.c b/src/windows/identity/uilib/creddlg.c
index ccc27b401..2cb4e92f9 100644
--- a/src/windows/identity/uilib/creddlg.c
+++ b/src/windows/identity/uilib/creddlg.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,6 +25,7 @@
/* $Id$ */
#include<khuidefs.h>
+#include<utils.h>
#include<assert.h>
#define CW_ALLOC_INCR 8
@@ -46,7 +47,7 @@ khui_cw_create_cred_blob(khui_new_creds ** ppnc)
{
khui_new_creds * c;
- c = malloc(sizeof(*c));
+ c = PMALLOC(sizeof(*c));
ZeroMemory(c, sizeof(*c));
c->magic = KHUI_NC_MAGIC;
@@ -73,22 +74,25 @@ khui_cw_destroy_cred_blob(khui_new_creds *c)
LeaveCriticalSection(&c->cs);
DeleteCriticalSection(&c->cs);
- if(c->password) {
+ if (c->password) {
len = wcslen(c->password);
SecureZeroMemory(c->password, sizeof(wchar_t) * len);
- free(c->password);
+ PFREE(c->password);
}
- if(c->identities)
- free(c->identities);
+ if (c->identities)
+ PFREE(c->identities);
- if(c->types)
- free(c->types);
+ if (c->types)
+ PFREE(c->types);
+
+ if (c->type_subs)
+ PFREE(c->type_subs);
if (c->window_title)
- free(c->window_title);
+ PFREE(c->window_title);
- free(c);
+ PFREE(c);
return KHM_ERROR_SUCCESS;
}
@@ -121,7 +125,7 @@ khui_cw_add_identity(khui_new_creds * c,
if(c->identities == NULL) {
c->nc_identities = NC_N_IDENTITIES;
- c->identities = malloc(sizeof(*(c->identities)) *
+ c->identities = PMALLOC(sizeof(*(c->identities)) *
c->nc_identities);
c->n_identities = 0;
} else if(c->n_identities + 1 > c->nc_identities) {
@@ -130,10 +134,10 @@ khui_cw_add_identity(khui_new_creds * c,
c->nc_identities = UBOUNDSS(c->n_identities + 1,
NC_N_IDENTITIES,
NC_N_IDENTITIES);
- ni = malloc(sizeof(*(c->identities)) * c->nc_identities);
+ ni = PMALLOC(sizeof(*(c->identities)) * c->nc_identities);
memcpy(ni, c->identities,
sizeof(*(c->identities)) * c->n_identities);
- free(c->identities);
+ PFREE(c->identities);
c->identities = ni;
}
@@ -187,8 +191,8 @@ khui_cw_add_type(khui_new_creds * c,
if(c->types == NULL) {
c->nc_types = CW_ALLOC_INCR;
- c->types = malloc(sizeof(*(c->types)) * c->nc_types);
- c->type_subs = malloc(sizeof(*(c->type_subs)) * c->nc_types);
+ c->types = PMALLOC(sizeof(*(c->types)) * c->nc_types);
+ c->type_subs = PMALLOC(sizeof(*(c->type_subs)) * c->nc_types);
c->n_types = 0;
}
@@ -198,14 +202,14 @@ khui_cw_add_type(khui_new_creds * c,
n = UBOUNDSS(c->n_types + 1, CW_ALLOC_INCR, CW_ALLOC_INCR);
- t = malloc(sizeof(*(c->types)) * n);
+ t = PMALLOC(sizeof(*(c->types)) * n);
memcpy(t, (void *) c->types, sizeof(*(c->types)) * c->n_types);
- free(c->types);
+ PFREE(c->types);
c->types = t;
- t = malloc(sizeof(*(c->type_subs)) * n);
+ t = PMALLOC(sizeof(*(c->type_subs)) * n);
memcpy(t, (void *) c->type_subs, sizeof(*(c->type_subs)) * c->n_types);
- free(c->type_subs);
+ PFREE(c->type_subs);
c->type_subs = t;
c->nc_types = n;
@@ -329,22 +333,22 @@ cw_create_prompt(khm_size idx,
if(def && FAILED(StringCbLength(def, KHUI_MAXCB_PROMPT_VALUE, &cb_def)))
return NULL;
- p = malloc(sizeof(*p));
+ p = PMALLOC(sizeof(*p));
ZeroMemory(p, sizeof(*p));
if(prompt) {
cb_prompt += sizeof(wchar_t);
- p->prompt = malloc(cb_prompt);
+ p->prompt = PMALLOC(cb_prompt);
StringCbCopy(p->prompt, cb_prompt, prompt);
}
if(def) {
cb_def += sizeof(wchar_t);
- p->def = malloc(cb_def);
+ p->def = PMALLOC(cb_def);
StringCbCopy(p->def, cb_def, def);
}
- p->value = malloc(KHUI_MAXCB_PROMPT_VALUE);
+ p->value = PMALLOC(KHUI_MAXCB_PROMPT_VALUE);
ZeroMemory(p->value, KHUI_MAXCB_PROMPT_VALUE);
p->type = type;
@@ -361,22 +365,22 @@ cw_free_prompt(khui_new_creds_prompt * p) {
if(p->prompt) {
if(SUCCEEDED(StringCbLength(p->prompt, KHUI_MAXCB_PROMPT, &cb)))
SecureZeroMemory(p->prompt, cb);
- free(p->prompt);
+ PFREE(p->prompt);
}
if(p->def) {
if(SUCCEEDED(StringCbLength(p->def, KHUI_MAXCB_PROMPT, &cb)))
SecureZeroMemory(p->def, cb);
- free(p->def);
+ PFREE(p->def);
}
if(p->value) {
if(SUCCEEDED(StringCbLength(p->value, KHUI_MAXCB_PROMPT_VALUE, &cb)))
SecureZeroMemory(p->value, cb);
- free(p->value);
+ PFREE(p->value);
}
- free(p);
+ PFREE(p);
}
static void
@@ -385,12 +389,12 @@ cw_free_prompts(khui_new_creds * c)
khm_size i;
if(c->banner != NULL) {
- free(c->banner);
+ PFREE(c->banner);
c->banner = NULL;
}
if(c->pname != NULL) {
- free(c->pname);
+ PFREE(c->pname);
c->pname = NULL;
}
@@ -402,7 +406,7 @@ cw_free_prompts(khui_new_creds * c)
}
if(c->prompts != NULL) {
- free(c->prompts);
+ PFREE(c->prompts);
c->prompts = NULL;
}
@@ -443,7 +447,7 @@ khui_cw_begin_custom_prompts(khui_new_creds * c,
if(SUCCEEDED(StringCbLength(banner, KHUI_MAXCB_BANNER, &cb)) &&
cb > 0) {
cb += sizeof(wchar_t);
- c->banner = malloc(cb);
+ c->banner = PMALLOC(cb);
StringCbCopy(c->banner, cb, banner);
} else {
c->banner = NULL;
@@ -453,7 +457,7 @@ khui_cw_begin_custom_prompts(khui_new_creds * c,
cb > 0) {
cb += sizeof(wchar_t);
- c->pname = malloc(cb);
+ c->pname = PMALLOC(cb);
StringCbCopy(c->pname, cb, pname);
} else {
@@ -463,8 +467,7 @@ khui_cw_begin_custom_prompts(khui_new_creds * c,
}
if(n_prompts > 0) {
-
- c->prompts = malloc(sizeof(*(c->prompts)) * n_prompts);
+ c->prompts = PMALLOC(sizeof(*(c->prompts)) * n_prompts);
ZeroMemory(c->prompts, sizeof(*(c->prompts)) * n_prompts);
c->nc_prompts = n_prompts;
c->n_prompts = 0;
@@ -505,7 +508,7 @@ khui_cw_add_prompt(khui_new_creds * c,
p = cw_create_prompt(c->n_prompts, type, prompt, def, flags);
if(p == NULL) {
LeaveCriticalSection(&c->cs);
- return KHM_ERROR_INVALID_PARM;
+ return KHM_ERROR_INVALID_PARAM;
}
c->prompts[c->n_prompts++] = p;
LeaveCriticalSection(&c->cs);
@@ -637,6 +640,7 @@ khui_cw_set_response(khui_new_creds * c,
if(t) {
t->flags &= ~KHUI_NCMASK_RESULT;
t->flags |= (response & KHUI_NCMASK_RESULT);
+
if (!(response & KHUI_NC_RESPONSE_NOEXIT) &&
!(response & KHUI_NC_RESPONSE_PENDING))
t->flags |= KHUI_NC_RESPONSE_COMPLETED;
@@ -666,6 +670,6 @@ khui_cw_add_control_row(khui_new_creds * c,
return KHM_ERROR_SUCCESS;
} else {
- return KHM_ERROR_INVALID_PARM;
+ return KHM_ERROR_INVALID_PARAM;
}
}
diff --git a/src/windows/identity/uilib/khaction.h b/src/windows/identity/uilib/khaction.h
index 7b7c22a57..fccdab549 100644
--- a/src/windows/identity/uilib/khaction.h
+++ b/src/windows/identity/uilib/khaction.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/uilib/khactiondef.h b/src/windows/identity/uilib/khactiondef.h
index d01eb2add..b880721b6 100644
--- a/src/windows/identity/uilib/khactiondef.h
+++ b/src/windows/identity/uilib/khactiondef.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
@@ -89,6 +89,8 @@ context.
#define KHUI_PACTION_DOWN_EXTEND (KHUI_PACTION_BASE + 13)
#define KHUI_PACTION_DOWN_TOGGLE (KHUI_PACTION_BASE + 14)
#define KHUI_PACTION_BLANK (KHUI_PACTION_BASE + 15)
+#define KHUI_PACTION_NEXT (KHUI_PACTION_BASE + 16)
+#define KHUI_PACTION_SELALL (KHUI_PACTION_BASE + 17)
/*@}*/
/*! \name Menus
diff --git a/src/windows/identity/uilib/khalerts.h b/src/windows/identity/uilib/khalerts.h
index c41dddf1f..36b13a333 100644
--- a/src/windows/identity/uilib/khalerts.h
+++ b/src/windows/identity/uilib/khalerts.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
@@ -306,6 +306,16 @@ khui_alert_add_command(khui_alert * alert,
KHMEXP khm_int32 KHMAPI
khui_alert_show(khui_alert * alert);
+/*! \brief Queue an alert
+
+ Instead of displaying the alert immediately, the alert is queued
+ and the status bar updated to notify the user that there is a
+ pending alert. Once the user activates the pending alert, it will
+ be displayed as if khui_alert_show() was called.
+ */
+KHMEXP khm_int32 KHMAPI
+khui_alert_queue(khui_alert * alert);
+
/*! \brief Display a simple alert
\see khui_alert_show()
diff --git a/src/windows/identity/uilib/khconfigui.h b/src/windows/identity/uilib/khconfigui.h
index 9a96d41f9..ac9fc614c 100644
--- a/src/windows/identity/uilib/khconfigui.h
+++ b/src/windows/identity/uilib/khconfigui.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
@@ -246,7 +246,7 @@ typedef struct tag_khui_config_init_data {
required.
\retval KHM_ERROR_SUCCESS Success
- \retval KHM_ERROR_INVALID_PARM One or more parameters, or fields
+ \retval KHM_ERROR_INVALID_PARAM One or more parameters, or fields
of reg were invalid
\retval KHM_ERROR_DUPLICATE A node with the same name exists as a
child of the specified parent node.
@@ -293,6 +293,19 @@ khui_cfg_hold(khui_config_node node);
KHMEXP khm_int32 KHMAPI
khui_cfg_release(khui_config_node node);
+/*! \brief Get the parent of a node
+
+ Returns a held handle to the parent of the node, or NULL if the
+ current node is a top level node. The returned handle must be
+ released with khui_cfg_release().
+
+ \retval KHM_ERROR_SUCCESS The handle to the parent node is in \a result
+ \retval KHM_ERROR_NOT_FOUND The node is a top level node
+ */
+KHMEXP khm_int32 KHMAPI
+khui_cfg_get_parent(khui_config_node vnode,
+ khui_config_node * result);
+
/*! \brief Get a handle to the first child node
If the call is successful, \a result will receieve a handle to the
@@ -366,7 +379,7 @@ khui_cfg_get_next(khui_config_node node,
the function is released.
\retval KHM_ERROR_SUCCESS The next node is now in \a node
- \retval KHM_ERROR_INVALID_PARM \a node was not a valid handle
+ \retval KHM_ERROR_INVALID_PARAM \a node was not a valid handle
\retval KHM_ERROR_NOT_FOUND There are no more siblings. \a node
is set to NULL.
diff --git a/src/windows/identity/uilib/khhtlink.h b/src/windows/identity/uilib/khhtlink.h
index dcbf328ff..f5fb3deef 100644
--- a/src/windows/identity/uilib/khhtlink.h
+++ b/src/windows/identity/uilib/khhtlink.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/uilib/khnewcred.h b/src/windows/identity/uilib/khnewcred.h
index 1742f4a1a..ff693b3b1 100644
--- a/src/windows/identity/uilib/khnewcred.h
+++ b/src/windows/identity/uilib/khnewcred.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
@@ -146,6 +146,12 @@ enum khui_wm_nc_notifications {
internal message. */
};
+/*! \brief Plugins can use WMNC_NOTIFY message codes from here on up
+
+ \see ::KHUI_WM_NC_NOTIFY
+ */
+#define WMNC_USER 2048
+
/*! \brief Notifications to the identity provider
These notifications are sent through to the identity provider's UI
diff --git a/src/windows/identity/uilib/khprops.h b/src/windows/identity/uilib/khprops.h
index b77269021..fc5629dc9 100644
--- a/src/windows/identity/uilib/khprops.h
+++ b/src/windows/identity/uilib/khprops.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
@@ -141,7 +141,12 @@ khui_ps_create_sheet(khui_property_sheet ** sheet);
used to order the pages in a property sheet. The pages are
ordered based on ordinal first and then alphabetically by
credentials type name. If the type is unavailable, then the
- ordering is undefined.
+ ordering is undefined. Ordinals for credential type property
+ pages can be in the range from 0 to 127. Ordinals 128 and
+ above are reserved. Passing in 0 will work for credentials
+ providers unless they provide more than one property page per
+ credential, in which case the ordinal should be used to
+ enforce an order.
\param[in] ppage Pointer to structure that will be passed to
CreatePropertySheetPage() to create the property page. The
diff --git a/src/windows/identity/uilib/khremote.h b/src/windows/identity/uilib/khremote.h
index a5b9d67de..accff416b 100644
--- a/src/windows/identity/uilib/khremote.h
+++ b/src/windows/identity/uilib/khremote.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/uilib/khrescache.h b/src/windows/identity/uilib/khrescache.h
index 96bec88ab..eeb4f6585 100644
--- a/src/windows/identity/uilib/khrescache.h
+++ b/src/windows/identity/uilib/khrescache.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/uilib/khtracker.h b/src/windows/identity/uilib/khtracker.h
index f03d2b425..c12cd4fac 100644
--- a/src/windows/identity/uilib/khtracker.h
+++ b/src/windows/identity/uilib/khtracker.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
@@ -77,6 +77,7 @@ typedef struct tag_khui_tracker {
int lbl_y;
int lbl_lx;
int lbl_rx;
+ DWORD act_time;
time_t current; /*!< Current selection */
time_t min; /*!< Minimum (inclusive) */
diff --git a/src/windows/identity/uilib/khuidefs.h b/src/windows/identity/uilib/khuidefs.h
index d92eb6444..50214c373 100644
--- a/src/windows/identity/uilib/khuidefs.h
+++ b/src/windows/identity/uilib/khuidefs.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/uilib/propsheet.c b/src/windows/identity/uilib/propsheet.c
index 749aa53bf..705dd96a3 100644
--- a/src/windows/identity/uilib/propsheet.c
+++ b/src/windows/identity/uilib/propsheet.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,15 +25,29 @@
/* $Id$ */
#include<khuidefs.h>
+#include<utils.h>
#ifdef DEBUG
#include<assert.h>
#endif
-KHMEXP khm_int32 KHMAPI khui_ps_create_sheet(khui_property_sheet ** sheet)
+CRITICAL_SECTION cs_props;
+
+void
+ps_init(void) {
+ InitializeCriticalSection(&cs_props);
+}
+
+void
+ps_exit(void) {
+ DeleteCriticalSection(&cs_props);
+}
+
+KHMEXP khm_int32 KHMAPI
+khui_ps_create_sheet(khui_property_sheet ** sheet)
{
khui_property_sheet * ps;
- ps = malloc(sizeof(*ps));
+ ps = PMALLOC(sizeof(*ps));
ZeroMemory(ps, sizeof(*ps));
ps->header.dwSize = sizeof(ps->header);
@@ -45,24 +59,26 @@ KHMEXP khm_int32 KHMAPI khui_ps_create_sheet(khui_property_sheet ** sheet)
return KHM_ERROR_SUCCESS;
}
-KHMEXP khm_int32 KHMAPI khui_ps_add_page(
- khui_property_sheet * sheet,
- khm_int32 credtype,
- khm_int32 ordinal,
- LPPROPSHEETPAGE ppage,
- khui_property_page ** page)
+KHMEXP khm_int32 KHMAPI
+khui_ps_add_page(khui_property_sheet * sheet,
+ khm_int32 credtype,
+ khm_int32 ordinal,
+ LPPROPSHEETPAGE ppage,
+ khui_property_page ** page)
{
khui_property_page * p;
- p = malloc(sizeof(*p));
+ p = PMALLOC(sizeof(*p));
ZeroMemory(p, sizeof(*p));
p->credtype = credtype;
p->ordinal = ordinal;
p->p_page = ppage;
-
+
+ EnterCriticalSection(&cs_props);
QPUT(sheet, p);
sheet->n_pages++;
+ LeaveCriticalSection(&cs_props);
if(page)
*page = p;
@@ -70,13 +86,14 @@ KHMEXP khm_int32 KHMAPI khui_ps_add_page(
return KHM_ERROR_SUCCESS;
}
-KHMEXP khm_int32 KHMAPI khui_ps_find_page(
- khui_property_sheet * sheet,
- khm_int32 credtype,
- khui_property_page ** page)
+KHMEXP khm_int32 KHMAPI
+khui_ps_find_page(khui_property_sheet * sheet,
+ khm_int32 credtype,
+ khui_property_page ** page)
{
khui_property_page * p;
+ EnterCriticalSection(&cs_props);
p = QTOP(sheet);
while(p) {
@@ -84,6 +101,7 @@ KHMEXP khm_int32 KHMAPI khui_ps_find_page(
break;
p = QNEXT(p);
}
+ LeaveCriticalSection(&cs_props);
if(p) {
*page = p;
@@ -94,12 +112,22 @@ KHMEXP khm_int32 KHMAPI khui_ps_find_page(
}
}
-int __cdecl ps_order_func(const void *l, const void * r) {
- /* l is a ** */
- return 0;
+int __cdecl
+ps_order_func(const void *l, const void * r) {
+ khui_property_page * lp;
+ khui_property_page * rp;
+
+ lp = *(khui_property_page **)l;
+ rp = *(khui_property_page **)r;
+
+ if (lp->ordinal == rp->ordinal)
+ return lp->credtype - rp->credtype;
+ else
+ return lp->ordinal - rp->ordinal;
}
-KHMEXP HWND KHMAPI khui_ps_show_sheet(HWND parent, khui_property_sheet * s)
+KHMEXP HWND KHMAPI
+khui_ps_show_sheet(HWND parent, khui_property_sheet * s)
{
khui_property_page * p;
HPROPSHEETPAGE phpsp[KHUI_PS_MAX_PSP];
@@ -108,6 +136,8 @@ KHMEXP HWND KHMAPI khui_ps_show_sheet(HWND parent, khui_property_sheet * s)
INT_PTR prv;
HWND hw;
+ EnterCriticalSection(&cs_props);
+
s->header.hwndParent = parent;
s->header.nPages = s->n_pages;
@@ -118,16 +148,26 @@ KHMEXP HWND KHMAPI khui_ps_show_sheet(HWND parent, khui_property_sheet * s)
#ifdef DEBUG
assert(p->h_page);
#endif
- ppgs[i] = p;
- phpsp[i++] = p->h_page;
+ ppgs[i++] = p;
p = QNEXT(p);
}
- /*TODO: sort property sheets */
+#ifdef DEBUG
+ assert(i == s->n_pages);
+#endif
+
+ qsort(ppgs, s->n_pages, sizeof(ppgs[0]), ps_order_func);
+
+ for (i=0; i < s->n_pages; i++) {
+ phpsp[i] = ppgs[i]->h_page;
+ }
s->header.phpage = phpsp;
prv = PropertySheet(&s->header);
+
+ s->header.phpage = NULL;
+
if(prv <= 0) {
#ifdef DEBUG
assert(FALSE);
@@ -135,22 +175,20 @@ KHMEXP HWND KHMAPI khui_ps_show_sheet(HWND parent, khui_property_sheet * s)
/*TODO: better handling for this */
hw = NULL;
} else {
- DWORD dw;
-
- dw = GetLastError();
s->status = KHUI_PS_STATUS_RUNNING;
hw = (HWND) prv;
s->hwnd = hw;
s->hwnd_page = PropSheet_GetCurrentPageHwnd(hw);
}
+ LeaveCriticalSection(&cs_props);
return hw;
}
-KHMEXP LRESULT KHMAPI khui_ps_check_message(
- khui_property_sheet * sheet,
- PMSG pmsg)
+KHMEXP LRESULT KHMAPI
+khui_ps_check_message(khui_property_sheet * sheet,
+ PMSG pmsg)
{
LRESULT lr;
@@ -169,20 +207,24 @@ KHMEXP LRESULT KHMAPI khui_ps_check_message(
return lr;
}
-KHMEXP khm_int32 KHMAPI khui_ps_destroy_sheet(khui_property_sheet * sheet)
+KHMEXP khm_int32 KHMAPI
+khui_ps_destroy_sheet(khui_property_sheet * sheet)
{
khui_property_page * p;
+ EnterCriticalSection(&cs_props);
+
DestroyWindow(sheet->hwnd);
sheet->hwnd = NULL;
QGET(sheet, &p);
while(p) {
- free(p);
+ PFREE(p);
QGET(sheet, &p);
}
+ PFREE(sheet);
- free(sheet);
+ LeaveCriticalSection(&cs_props);
return KHM_ERROR_SUCCESS;
}
diff --git a/src/windows/identity/uilib/propwnd.c b/src/windows/identity/uilib/propwnd.c
index 4d5d5488d..5ae93a7a5 100644
--- a/src/windows/identity/uilib/propwnd.c
+++ b/src/windows/identity/uilib/propwnd.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
diff --git a/src/windows/identity/uilib/rescache.c b/src/windows/identity/uilib/rescache.c
index 57ff30907..6d5259142 100644
--- a/src/windows/identity/uilib/rescache.c
+++ b/src/windows/identity/uilib/rescache.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<khuidefs.h>
-#include<hashtable.h>
+#include<utils.h>
hashtable * h_bitmaps;
@@ -76,7 +76,7 @@ khui_create_ilist(int cx, int cy, int n, int ng, int opt) {
BITMAPV5HEADER head;
HDC hdc;
- khui_ilist * il = malloc(sizeof(khui_ilist));
+ khui_ilist * il = PMALLOC(sizeof(khui_ilist));
il->cx = cx;
il->cy = cy;
il->n = n;
@@ -102,7 +102,7 @@ khui_create_ilist(int cx, int cy, int n, int ng, int opt) {
head.bV5Reserved = 0;
il->img = CreateDIBitmap(hdc, (BITMAPINFOHEADER *) &head, 0, NULL, NULL, DIB_RGB_COLORS);
il->mask = CreateBitmap(cx * n, cy, 1, 1, NULL);
- il->idlist = malloc(sizeof(int) * n);
+ il->idlist = PMALLOC(sizeof(int) * n);
return il;
}
@@ -111,8 +111,8 @@ KHMEXP BOOL KHMAPI
khui_delete_ilist(khui_ilist * il) {
DeleteObject(il->img);
DeleteObject(il->mask);
- free(il->idlist);
- free(il);
+ PFREE(il->idlist);
+ PFREE(il);
return TRUE;
}
diff --git a/src/windows/identity/uilib/trackerwnd.c b/src/windows/identity/uilib/trackerwnd.c
index 04de09641..814e28808 100644
--- a/src/windows/identity/uilib/trackerwnd.c
+++ b/src/windows/identity/uilib/trackerwnd.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
@@ -261,7 +261,10 @@ create_edit_sliders(HWND hwnd,
TRACKBAR_CLASS,
L"NetIDMgrTimeTickerTrackbar",
WS_POPUP | TBS_AUTOTICKS | TBS_BOTTOM |
- TBS_DOWNISLEFT | TBS_HORZ | WS_CLIPCHILDREN,
+#if (_WIN32_IE >= 0x0501)
+ TBS_DOWNISLEFT |
+#endif
+ TBS_HORZ | WS_CLIPCHILDREN,
r.left,r.bottom,rs.right,rs.bottom,
hwnd,
NULL,
@@ -311,6 +314,8 @@ duration_edit_proc(HWND hwnd,
}
khui_tracker_reposition(tc);
ShowWindow(tc->hw_slider, SW_SHOWNOACTIVATE);
+
+ tc->act_time = GetTickCount();
//SetActiveWindow(p);
}
break;
@@ -347,6 +352,18 @@ duration_edit_proc(HWND hwnd,
}
return TRUE;
+ case WM_LBUTTONUP:
+ if (IsWindowVisible(tc->hw_slider)) {
+ DWORD tm;
+
+ tm = GetTickCount();
+ if (tm - tc->act_time > 500)
+ ShowWindow(tc->hw_slider, SW_HIDE);
+ } else {
+ ShowWindow(tc->hw_slider, SW_SHOWNOACTIVATE);
+ }
+ break;
+
/* these messages can potentially change the text in the edit
control. We intercept them and see what changed. We may
need to grab and handle them */
@@ -354,7 +371,9 @@ duration_edit_proc(HWND hwnd,
case EM_UNDO:
case WM_UNDO:
case WM_CHAR:
+#if (_WIN32_WINNT >= 0x0501)
case WM_UNICHAR:
+#endif
{
wchar_t buf[256];
size_t nchars;
diff --git a/src/windows/identity/uilib/uilibmain.c b/src/windows/identity/uilib/uilibmain.c
index 65fa7aff5..4d0b012f1 100644
--- a/src/windows/identity/uilib/uilibmain.c
+++ b/src/windows/identity/uilib/uilibmain.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
@@ -28,14 +28,17 @@
extern void alert_init(void);
extern void alert_exit(void);
+extern void ps_init(void);
+extern void ps_exit(void);
void
uilib_process_attach(void) {
alert_init();
+ ps_init();
}
void
uilib_process_detach(void) {
+ ps_exit();
alert_exit();
}
-