/[winpt]/trunk/Src/wptKeylist.cpp
ViewVC logotype

Diff of /trunk/Src/wptKeylist.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 105 by twoaday, Wed Nov 30 10:22:00 2005 UTC revision 208 by twoaday, Mon May 1 12:22:18 2006 UTC
# Line 1  Line 1 
1  /* wptKeylist.cpp - Keylist element  /* wptKeylist.cpp - Keylist element
2   *      Copyright (C) 2001-2005 Timo Schulz   *      Copyright (C) 2001-2006 Timo Schulz
3   *      Copyright (C) 2004 Andreas Jobs   *      Copyright (C) 2004 Andreas Jobs
4   *   *
5   * This file is part of WinPT.   * This file is part of WinPT.
# Line 18  Line 18 
18   * along with WinPT; if not, write to the Free Software Foundation,   * along with WinPT; if not, write to the Free Software Foundation,
19   * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA   * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20   */   */
21    
22  #ifdef HAVE_CONFIG_H  #ifdef HAVE_CONFIG_H
23  #include <config.h>  #include <config.h>
24  #endif  #endif
# Line 37  Line 38 
38  #include "wptUTF8.h"  #include "wptUTF8.h"
39  #include "wptRegistry.h"  #include "wptRegistry.h"
40  #include "wptContext.h"  #include "wptContext.h"
41    #include "wptVersion.h"
42    #include "resource.h"
43    
44  #define key_is_useable(key) (!(key)->revoked && !(key)->expired && !(key)->disabled)  #define key_is_useable(key) (!(key)->revoked && !(key)->expired && !(key)->disabled)
45    
# Line 50  static int find_secret_key (gpgme_key_t Line 52  static int find_secret_key (gpgme_key_t
52    
53    
54  static key_array_s*  static key_array_s*
55  key_array_new( size_t items )  key_array_new (int items)
56  {  {
57      key_array_s *ka;      key_array_s *ka;
58      size_t j;      int j;
59            
60      if( items == 0 )      if (items == 0)
61          return NULL;          return NULL;
62      ka = new key_array_s[items + 1];      ka = new key_array_s[items + 1];
63      if( ka == NULL )      if (!ka)
64          return NULL;              BUG (NULL);
65      for ( j = 0; j < items; j++ )      for (j = 0; j < items; j++)
66          ka[j].checked = 0;          ka[j].checked = 0;
67      return ka;      return ka;
68  } /* key_array_new */  }
69    
70    
71  static void  static void
72  key_array_release( key_array_s *ka )  key_array_release (key_array_s *ka)
73  {  {
74      free_if_alloc( ka );      free_if_alloc (ka);
75  } /* key_array_release */  }
76    
77    
78    /* Check if the keyid @keyid is in the key array @ka.
79       Return value: 1 if it exists, 0 otherwise. */
80  static int  static int
81  key_array_search( key_array_s *ka, size_t items, const char *keyid )  key_array_search (key_array_s *ka, int items, const char *keyid)
82  {  {
83      size_t j;      int j;
84            
85      /* fixme: we need a faster search method */      for (j = 0; j < items; j++) {
86      for( j = 0; j < items; j++ ) {          if (!strcmp (keyid, ka[j].keyid ))
         if( !strcmp( keyid, ka[j].keyid ) )  
87              return 1;                return 1;  
88      }      }
       
89      return 0;      return 0;
90  } /* key_array_search */  }
91    
92    
93  gpgme_user_id_t  gpgme_user_id_t
# Line 150  count_subkeys (gpgme_key_t key) Line 152  count_subkeys (gpgme_key_t key)
152  }  }
153    
154    
155    /* Return the self signature of the key @keyid.
156       If first is set, the first self sig will be returned. */
157  gpgme_key_sig_t  gpgme_key_sig_t
158  get_selfsig (gpgme_user_id_t uid, const char *keyid, int first)  get_selfsig (gpgme_key_sig_t sigs, const char *keyid, int first)
159  {  {
160      gpgme_key_sig_t s, self_sig=NULL;      gpgme_key_sig_t s, self_sig=NULL;
161      long timestamp=0;      long timestamp=0;
162        int off = 0;
163    
164      for (s = uid->signatures; s; s = s->next) {      if (strlen (keyid) == 8)
165          if (!strcmp (s->keyid+8, keyid) && s->timestamp > timestamp) {          off = 8;
166    
167        for (s = sigs; s; s = s->next) {
168            if (!strcmp (s->keyid+off, keyid) && s->timestamp > timestamp) {
169              self_sig = s;              self_sig = s;
170              timestamp = s->timestamp;              timestamp = s->timestamp;
171              if (first)              if (first)
# Line 168  get_selfsig (gpgme_user_id_t uid, const Line 176  get_selfsig (gpgme_user_id_t uid, const
176  }  }
177    
178    
   
179  const char*  const char*
180  get_key_algo (gpgme_key_t key, int keyidx)  get_key_algo (gpgme_key_t key, int keyidx)
181  {  {
# Line 181  get_key_algo (gpgme_key_t key, int keyid Line 188  get_key_algo (gpgme_key_t key, int keyid
188      if (keyidx > 0) {      if (keyidx > 0) {
189          k = get_nth_key (key, keyidx-1);          k = get_nth_key (key, keyidx-1);
190          subalg =  get_key_pubalgo (k->pubkey_algo);          subalg =  get_key_pubalgo (k->pubkey_algo);
191          _snprintf( algo_id, DIM (algo_id)-1, "%s", subalg);          _snprintf (algo_id, DIM (algo_id)-1, "%s", subalg);
192          return algo_id;          return algo_id;
193      }      }
194      strcpy (alg, get_key_pubalgo (key->subkeys->pubkey_algo));      strcpy (alg, get_key_pubalgo (key->subkeys->pubkey_algo));
195      n = count_subkeys (key);      n = count_subkeys (key);
196      if (n > 1) {      if (n > 1) {
197          k = get_nth_key (key, n-1);          do {
198                k = get_nth_key (key, --n);
199                if (k->revoked || k->expired)
200                    continue;
201                else
202                    break;
203            } while (n > 0);
204          subalg = get_key_pubalgo (k->pubkey_algo);          subalg = get_key_pubalgo (k->pubkey_algo);
205          _snprintf (algo_id, DIM (algo_id)-1, "%s/%s", alg, subalg);          if (k == key->subkeys)
206                _snprintf (algo_id, DIM (algo_id)-1, "%s", subalg);
207            else
208                _snprintf (algo_id, DIM (algo_id)-1, "%s/%s", alg, subalg);
209          return algo_id;          return algo_id;
210      }      }
211      return get_key_pubalgo (key->subkeys->pubkey_algo);      return get_key_pubalgo (key->subkeys->pubkey_algo);
212  } /* get_key_algo */  }
213    
214    
215  const char*  const char*
# Line 201  get_key_created (long timestamp) Line 217  get_key_created (long timestamp)
217  {  {
218      static char timebuf[128];      static char timebuf[128];
219      struct tm *warp;      struct tm *warp;
220        const char *dat;
221    
222      if (timestamp == 0 || timestamp == -1)      if (timestamp < 1)
223          return "????" "-??" "-??";          return "????" "-??" "-??";
224      warp = localtime( &timestamp );      dat = get_locale_date (timestamp, timebuf, sizeof (timebuf)-1);
225      _snprintf( timebuf, sizeof timebuf - 1, "%04d-%02d-%02d",      if (dat)
226                  warp->tm_year + 1900, warp->tm_mon + 1, warp->tm_mday );          return dat;
227        warp = localtime (&timestamp);
228        _snprintf (timebuf, sizeof timebuf - 1, "%04d-%02d-%02d",
229                   warp->tm_year + 1900, warp->tm_mon + 1, warp->tm_mday);
230      return timebuf;      return timebuf;
231  } /* get_key_created */  }
232    
233    
234  /* Return a string presentation of the time @timestamp. */  /* Return a string presentation of the time @timestamp. */
# Line 217  get_key_expire_date (long timestamp) Line 237  get_key_expire_date (long timestamp)
237  {  {
238      static char timebuf[64];      static char timebuf[64];
239      struct tm *warp;      struct tm *warp;
240        const char *dat;
241    
242      if( !timestamp )      if (timestamp == 0)
243          return _("Never");          return _("Never");
244      warp = localtime( &timestamp );      dat = get_locale_date (timestamp, timebuf, sizeof (timebuf)-1);
245        if (dat)
246            return dat;
247        warp = localtime (&timestamp);
248      _snprintf (timebuf, sizeof timebuf -1, "%04d-%02d-%02d",      _snprintf (timebuf, sizeof timebuf -1, "%04d-%02d-%02d",
249                 warp->tm_year + 1900, warp->tm_mon + 1, warp->tm_mday);                 warp->tm_year + 1900, warp->tm_mon + 1, warp->tm_mday);
250      return timebuf;      return timebuf;
# Line 237  get_key_type (gpgme_key_t key) Line 261  get_key_type (gpgme_key_t key)
261      else if (type == 2)      else if (type == 2)
262          return _("Key Pair (Card)");          return _("Key Pair (Card)");
263      return _("Public Key");      return _("Public Key");
264  } /* get_key_type */  }
265    
266    
267  const char*  const char*
# Line 258  get_key_size (gpgme_key_t key, int keyid Line 282  get_key_size (gpgme_key_t key, int keyid
282      if (n > 1) {      if (n > 1) {
283          k = get_nth_key (key, n-1);          k = get_nth_key (key, n-1);
284          size_sub = k->length;          size_sub = k->length;
285          _snprintf( size_id, sizeof (size_id) - 1, "%d/%d", size_main, size_sub );          _snprintf (size_id, sizeof (size_id) - 1, "%d/%d",
286                        size_main, size_sub);
287          return size_id;          return size_id;
288      }      }
289      _snprintf( size_id, sizeof (size_id) - 1, "%d", size_main );      _snprintf( size_id, sizeof (size_id) - 1, "%d", size_main );
290      return size_id;      return size_id;
291  } /* get_key_size */  }
292    
293    
294    const char*
295    get_key_pubalgo2 (gpgme_pubkey_algo_t alg)
296    {
297        switch (alg) {
298        case GPGME_PK_DSA: return "D";
299        case GPGME_PK_RSA: return "R";
300        case GPGME_PK_ELG: return "G";
301        default: return "?";
302        }
303        return "?";
304    }
305    
306    
307  const char*  const char*
# Line 273  get_key_pubalgo (gpgme_pubkey_algo_t alg Line 311  get_key_pubalgo (gpgme_pubkey_algo_t alg
311      case GPGME_PK_DSA: return "DSA";      case GPGME_PK_DSA: return "DSA";
312      case GPGME_PK_ELG:      case GPGME_PK_ELG:
313      case GPGME_PK_ELG_E: return "ELG";      case GPGME_PK_ELG_E: return "ELG";
314        case 0: /* XXX: gpgme returned pubkey algo 0 for a RSA made sig. */
315      case GPGME_PK_RSA: return "RSA";      case GPGME_PK_RSA: return "RSA";
316      default: return "???";      default: return "???";
317      }      }
318      return "???";      return "???";
319  }  }
320    
321  const char *  const char*
322  get_key_fpr (gpgme_key_t key)  get_key_fpr (gpgme_key_t key)
323  {  {
324      static char fpr_md[64];      static char fpr_md[64];
# Line 308  get_key_fpr (gpgme_key_t key) Line 347  get_key_fpr (gpgme_key_t key)
347          }          }
348      }      }
349      return fpr_md;      return fpr_md;
350  } /* get_key_fpr */  }
351    
352    
353  const char *  /* Extract the key ID from the fingerprint.
354       A long ID will be converted into a short ID. */
355    const char*
356    get_keyid_from_fpr (const char *fpr)
357    {
358        if (!fpr)
359            return "????????";
360        if (strlen (fpr) == 40)
361            fpr += 32;
362        else if (strlen (fpr) == 32)
363            fpr += 24;
364        else if (strlen (fpr) == 16)
365            fpr += 8;
366        else
367            return "????????";
368        return fpr;
369    }
370    
371    
372    const char*
373  get_key_trust2 (gpgme_key_t key, int val, int uididx, int listmode)  get_key_trust2 (gpgme_key_t key, int val, int uididx, int listmode)
374  {  {
375      if (key)      if (key)
# Line 325  get_key_trust2 (gpgme_key_t key, int val Line 383  get_key_trust2 (gpgme_key_t key, int val
383      case GPGME_VALIDITY_MARGINAL:      case GPGME_VALIDITY_MARGINAL:
384          return _("Marginal");          return _("Marginal");
385      case GPGME_VALIDITY_FULL:      case GPGME_VALIDITY_FULL:
     case GPGME_VALIDITY_ULTIMATE:  
386          return _("Full");          return _("Full");
387        case GPGME_VALIDITY_ULTIMATE:
388            return _("Ultimate");
389      }      }
390      return "";      return "";
391  }  }
392    
393    
394  const char *  const char*
395  get_key_trust (gpgme_key_t key, int uididx, int listmode)  get_key_trust (gpgme_key_t key, int uididx, int listmode)
396  {  {
397      return get_key_trust2 (key, 0, uididx, listmode);      return get_key_trust2 (key, 0, uididx, listmode);
398  }  }
399    
400    
401  const char *  const char*
402  get_key_trust_str (int val)  get_key_trust_str (int val)
403  {  {
404      return get_key_trust2 (NULL, val, 0, 0);      return get_key_trust2 (NULL, val, 0, 0);
# Line 358  get_key_status (gpgme_key_t key, int uid Line 417  get_key_status (gpgme_key_t key, int uid
417          uididx = 0;          uididx = 0;
418      if (listmode) {      if (listmode) {
419          const char *s;          const char *s;
           
420          if (key->revoked)          if (key->revoked)
421              s = _("Revoked");              s = _("Revoked");
422          else if (key->expired)          else if (key->expired)
# Line 367  get_key_status (gpgme_key_t key, int uid Line 425  get_key_status (gpgme_key_t key, int uid
425              s = _("Disabled");              s = _("Disabled");
426          else          else
427              s = "";              s = "";
           
428          /* if the key has a special status, we don't continue to figure out          /* if the key has a special status, we don't continue to figure out
429             what any user-id validities. */             the user-id validities. */
430          if (*s)          if (*s)
431              return m_strdup (s);              return m_strdup (s);
432      }      }
# Line 380  get_key_status (gpgme_key_t key, int uid Line 437  get_key_status (gpgme_key_t key, int uid
437  }  }
438    
439    
440    /* Return human readable description of the key @key. */
441    char*
442    get_key_desc (gpgme_key_t key)
443    {
444        gpgme_key_t sk;
445        const char *state, *alg, *type;
446        char *p;
447    
448        /* XXX: problems with the German translation. */
449        state = "";
450        if (key->disabled)
451            state = _("Disabled");
452        if (key->expired)
453            state = _("Expired");
454        if (key->revoked)
455            state = _("Revoked");
456        alg = "OpenPGP";
457        if (strlen (key->subkeys->fpr) == 32)
458            alg = "RSA Legacy";
459        type = _("public key");
460        if (!get_seckey (key->subkeys->keyid+8, &sk))
461            type = _("key pair");
462        p = new char[strlen (state) + strlen (alg) + strlen (type) + 4 + 1];
463        if (!p)
464            BUG (0);
465        sprintf (p, "%s %s %s", state, alg, type);
466        return p;
467    }
468    
469    
470  /* Integer comparsion of @a and @b.  /* Integer comparsion of @a and @b.
471     Return values: same as in strcmp. */     Return values: same as in strcmp. */
472  static inline int  static inline int
# Line 401  get_ext_validity (gpgme_key_t k) Line 488  get_ext_validity (gpgme_key_t k)
488          return GPGME_VALIDITY_ULTIMATE+1;          return GPGME_VALIDITY_ULTIMATE+1;
489      else if (k->expired)      else if (k->expired)
490          return GPGME_VALIDITY_ULTIMATE+2;          return GPGME_VALIDITY_ULTIMATE+2;
491        else if (k->disabled)
492            return GPGME_VALIDITY_ULTIMATE+3;
493      return k->uids->validity;      return k->uids->validity;
494  }  }
495    
# Line 409  get_ext_validity (gpgme_key_t k) Line 498  get_ext_validity (gpgme_key_t k)
498  static int CALLBACK  static int CALLBACK
499  keylist_cmp_cb (LPARAM first, LPARAM second, LPARAM sortby)  keylist_cmp_cb (LPARAM first, LPARAM second, LPARAM sortby)
500  {  {
501        struct keycache_s *aa, *bb;
502      gpgme_key_t a, b;      gpgme_key_t a, b;
503      int cmpresult = 0;      int cmpresult = 0;
504            
505      a = (gpgme_key_t)first;      aa = (struct keycache_s *)first;
506      b = (gpgme_key_t)second;      bb = (struct keycache_s *)second;
507      if (!a || !b)      if (!aa || !bb)
508          BUG (NULL);          BUG (NULL);
509        a = aa->key;
510        b = bb->key;
511            
512      switch (sortby & ~KEYLIST_SORT_DESC) {      switch (sortby & ~KEYLIST_SORT_DESC) {
513      case KEY_SORT_USERID:      case KEY_SORT_USERID:
# Line 468  keylist_cmp_cb (LPARAM first, LPARAM sec Line 560  keylist_cmp_cb (LPARAM first, LPARAM sec
560  }  }
561    
562    
 /* Return the validity of the group @grp. */  
 static const char*  
 calc_validity (gpg_group_t grp)  
 {  
     int valid=0;  
     gpg_member_t mbr;  
     gpgme_key_t key;  
   
     for (mbr = grp->list; mbr; mbr = mbr->next) {  
         if (get_pubkey (mbr->name, &key))  
             continue;  
         valid = key->uids->validity;  
         switch (valid) {  
         case GPGME_VALIDITY_MARGINAL:  
         case GPGME_VALIDITY_NEVER:  
         case GPGME_VALIDITY_UNDEFINED:  
             return get_key_trust2 (NULL, valid, 0, 0);  
         }  
     }  
     return _("Full");  
 }  
   
   
563  int  int
564  keylist_add_groups( listview_ctrl_t lv )  keylist_add_groups (listview_ctrl_t lv)
565  {  {
 #if 0  
     gpg_optfile_t gh;  
     gpg_group_t grp;  
     const char *valid;  
   
     gh = km_groupdb_open( );      
     if( !gh )    
         return WPTERR_FILE_OPEN;  
   
     for( grp = gh->grp; grp; grp = grp->next ) {  
         valid = calc_validity( grp );  
         listview_add_item( lv, " " );    
         listview_add_sub_item( lv, 0, 0, grp->name );    
         listview_add_sub_item( lv, 0, 1, "gpg_group_t" );        
         listview_add_sub_item( lv, 0, 2, "" );    
         listview_add_sub_item( lv, 0, 3, "Unknown" );  
         listview_add_sub_item( lv, 0, 4, valid?valid : "Unknown" );  
     }  
 #endif  
566      return 0;      return 0;
567  } /* keylist_add_groups */  }
568    
569    
570  /* Create a listview for listing keys. Use the mode given in @mode  /* Create a listview for listing keys. Use the mode given in @mode
# Line 530  keylist_build (listview_ctrl_t *r_lv, HW Line 580  keylist_build (listview_ctrl_t *r_lv, HW
580      {5, 70, (char *)_("Validity")},      {5, 70, (char *)_("Validity")},
581      {0, 0, NULL}      {0, 0, NULL}
582      };      };
   
583      struct listview_column_s klist[] = {      struct listview_column_s klist[] = {
584      {0, 242, (char *)_("User ID")},      {0, 240, (char *)_("User ID")},
585      {1, 78, (char *)_("Key ID")},      {1, 78, (char *)_("Key ID")},
586      {2, 52, (char *)_("Type")},          {2, 52, (char *)_("Type")},    
587      {3, 68, (char *)_("Size")},      {3, 66, (char *)_("Size")},
588      {4, 66, (char *)_("Cipher")},      {4, 60, (char *)_("Cipher")},
589      {5, 70, (char *)_("Validity")},      {5, 66, (char *)_("Validity")},
590      {6, 40, (char *)_("Trust")},      {6, 58, (char *)_("Trust")},
591      {7, 72, (char *)_("Creation")},      {7, 72, (char *)_("Creation")},
592      {0, 0, NULL}      {0, 0, NULL}
593      };      };
594        HICON ico[2];
595      listview_ctrl_t lv;      listview_ctrl_t lv;
596      listview_column_t col;      listview_column_t col;
597      int j, n = 0;      int j, n = 0, ext_chk = 0;
     int kl_nolist = 0;  
598      int rc = 0;      int rc = 0;
599            
600      rc = listview_new (&lv);      listview_new (&lv, ctrl);
601      if (rc)      if (mode & KEYLIST_ENCRYPT_MIN) {
         return rc;  
       
     lv->ctrl = ctrl;  
     if ((mode & KEYLIST_ENCRYPT) || (mode & KEYLIST_ENCRYPT_MIN)) {  
602          col = klist_enc;          col = klist_enc;
603          n = (DIM(klist_enc) -1);          n = (DIM(klist_enc) -1);
604            ext_chk = 1;
605      }        }  
606      else if ((mode & KEYLIST_SIGN)) {      else if ((mode & KEYLIST_SIGN)) {
607          col = klist_enc;          col = klist_enc;
608          n = (DIM(klist_enc) - 1) - 1;          n = (DIM(klist_enc) - 1) - 1;
609            ext_chk = 1;
610      }      }
611      else {      else {
612          col = klist;          col = klist;
613          n = (DIM(klist) - 1);          n = (DIM(klist) - 1);
614      }      }
615            
616      for( j = 0; j < n; j++ )          for (j = 0; j < n; j++)
617          listview_add_column( lv, &col[j] );              listview_add_column (lv, &col[j]);    
618      listview_set_ext_style( lv );      listview_set_ext_style (lv);
619        if (ext_chk)
620            listview_set_chkbox_style (lv);
621        ico[0] = LoadIcon (glob_hinst, (LPCTSTR)IDI_PUBKEY);
622        ico[1] = LoadIcon (glob_hinst, (LPCTSTR)IDI_KEYPAIR);
623        listview_set_image_list (lv, 22, 14, ico, 2);
624        listview_del_all_items (lv);
625    
626      *r_lv = lv;      *r_lv = lv;
       
627      return 0;      return 0;
628  }  }
629    
# Line 582  keylist_load_keycache (listview_ctrl_t l Line 634  keylist_load_keycache (listview_ctrl_t l
634  {  {
635      gpgme_error_t err = gpg_error (GPG_ERR_NO_ERROR);      gpgme_error_t err = gpg_error (GPG_ERR_NO_ERROR);
636      gpgme_key_t key, skey;      gpgme_key_t key, skey;
637      const char * keyid;      struct keycache_s *c;
638        const char *keyid;
639    
640      if (pubkc && seckc) {      if (pubkc && seckc) {
641          gpg_keycache_rewind (pubkc);          gpg_keycache_rewind (pubkc);
642          while (!gpg_keycache_next_key (pubkc, 0, &key)) {          while (!gpg_keycache_next_key2 (pubkc, 0, &c, &key)) {
643              keyid = key->subkeys->keyid;              keyid = key->subkeys->keyid;
644              if (keyid && !gpg_keycache_find_key (seckc, keyid, 0, &skey))              if (keyid && !gpg_keycache_find_key (seckc, keyid, 0, &skey))
645                  keylist_add_key (lv, mode, key);                  keylist_add_key (lv, mode, c, key);
646          }                }      
647      }      }
648      else if (pubkc) {      else if (pubkc) {
649          gpg_keycache_rewind (pubkc);          gpg_keycache_rewind (pubkc);
650          while (!err) {              while (!err) {    
651              err = gpg_keycache_next_key (pubkc, 0, &key);              err = gpg_keycache_next_key2 (pubkc, 0, &c, &key);
652              if (!err)              if (!err)
653                  keylist_add_key (lv, mode, key);                  keylist_add_key (lv, mode, c, key);
654          }          }
655      }      }
656  }  }
# Line 617  keylist_load (HWND ctrl, gpg_keycache_t Line 670  keylist_load (HWND ctrl, gpg_keycache_t
670          return NULL;                      return NULL;            
671      keylist_load_keycache (lv, mode, pubkc, seckc);      keylist_load_keycache (lv, mode, pubkc, seckc);
672      keylist_sort (lv, sortby);      keylist_sort (lv, sortby);
673      if ((mode & KEYLIST_ENCRYPT) || (mode & KEYLIST_ENCRYPT_MIN))      if (mode & KEYLIST_ENCRYPT_MIN)
674          keylist_add_groups (lv);          keylist_add_groups (lv);
675      return lv;      return lv;
676  }  }
# Line 627  keylist_load (HWND ctrl, gpg_keycache_t Line 680  keylist_load (HWND ctrl, gpg_keycache_t
680  int  int
681  keylist_reload (listview_ctrl_t lv, gpg_keycache_t pubkc, int mode, int sortby)  keylist_reload (listview_ctrl_t lv, gpg_keycache_t pubkc, int mode, int sortby)
682  {  {
683      listview_del_all (lv);      listview_del_all_items (lv);
684      keylist_load_keycache( lv, mode, pubkc, NULL );      keylist_load_keycache (lv, mode, pubkc, NULL);
685      keylist_sort (lv, sortby);      keylist_sort (lv, sortby);
686      return 0;      return 0;
687  }  }
# Line 663  find_secret_key (gpgme_key_t key) Line 716  find_secret_key (gpgme_key_t key)
716    
717    
718  static int  static int
719  do_addkey (listview_ctrl_t lv, gpgme_key_t key, int uididx, int keyidx, int list)  do_addkey (listview_ctrl_t lv, struct keycache_s *ctx, gpgme_key_t key,
720               int uididx, int keyidx, int list)
721  {      {    
722      LV_ITEM lvi;      LV_ITEM lvi;
723      gpgme_user_id_t u;      gpgme_user_id_t u;
# Line 676  do_addkey (listview_ctrl_t lv, gpgme_key Line 730  do_addkey (listview_ctrl_t lv, gpgme_key
730      /* we check the pubkey algorithm here to make sure that no ElGamal      /* we check the pubkey algorithm here to make sure that no ElGamal
731         sign+encrypt key is used in _any_ mode */         sign+encrypt key is used in _any_ mode */
732      if (list != 1 && key->subkeys->pubkey_algo == GPGME_PK_ELG) {      if (list != 1 && key->subkeys->pubkey_algo == GPGME_PK_ELG) {
733          log_debug ("ElGamal (E+S) key found: %s (%s)\n",          log_debug ("ElGamal (E+S) key found: %s (%s)\n",
734                     key->uids->name, key->subkeys->keyid);                     key->uids->name, key->subkeys->keyid);
735          return 0;          return 0;
736      }      }
737    
738                if (listview_add_item2 (lv, " ", (void *)ctx))
     if (listview_add_item2 (lv, " ", (void *)key))        
739          return WPTERR_GENERAL;          return WPTERR_GENERAL;
740            
741      attr = key->uids->uid;      attr = ctx->uids->uid;
742      memset (&lvi, 0, sizeof lvi);      memset (&lvi, 0, sizeof lvi);
743      lvi.mask = LVIF_TEXT | LVIF_PARAM;      lvi.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE;
744      lvi.pszText = (char *)attr;      lvi.pszText = (char *)attr;
745      lvi.lParam = (LPARAM )key;      lvi.iImage = find_secret_key (key)? 1 : 0;
746      if (ListView_SetItem( lv->ctrl, &lvi ) == FALSE)      lvi.lParam = (LPARAM )ctx;
747        if (ListView_SetItem (lv->ctrl, &lvi) == FALSE)
748          return WPTERR_GENERAL;          return WPTERR_GENERAL;
749                    
750      if (uididx == -1) { /* request the primary user-id of the key. */      if (uididx == -1) { /* request the primary user-id of the key. */
751          attr = key->uids->uid;          attr = ctx->uids->uid;
752          uididx = 0;          uididx = 0;
753      }      }
754      else {      else {
755          u = get_nth_userid (key, uididx);          u = get_nth_userid (key, uididx);
756          if (!u || u->revoked || uididx < 0)          if (!u || u->revoked || uididx < 0)
757              uididx = 0; /* fixme: this happen sometimes but it's illegal! (<0) */              uididx = 0;
758          u = get_nth_userid (key, uididx);          u = get_nth_userid (key, uididx);
759          attr = u->uid;          attr = u->uid;
760      }      }
761      if (attr == NULL || strlen (attr) < 5) { /* normal userids are >= 5 chars */      if (attr == NULL || strlen (attr) < 5) { /* normal userids are > 5 chars */
762          attr = _("Invalid User ID");          attr = _("Invalid User ID");
763          listview_add_sub_item (lv, 0, idx++, attr);          listview_add_sub_item (lv, 0, idx++, attr);
764      }        }  
765      else {      else        
766          char *uid = utf8_to_wincp (attr, strlen (attr));          listview_add_sub_item (lv, 0, idx++, attr);
         if (uid) {  
             listview_add_sub_item (lv, 0, idx++, uid);  
             free (uid);  
         }  
     }  
767      k = get_nth_key (key, keyidx);      k = get_nth_key (key, keyidx);
768      if (k && k->keyid) {      if (k && k->keyid) {
769          _snprintf (fmt, sizeof fmt -1, "0x%s", k->keyid + 8);          _snprintf (fmt, sizeof fmt -1, "0x%s", k->keyid + 8);
770          listview_add_sub_item( lv, 0, idx++, fmt );          listview_add_sub_item (lv, 0, idx++, fmt);
771      }      }
772      if (list > 0) {      if (list > 0) {
773          key_attr = find_secret_key (key);          key_attr = find_secret_key (key);
# Line 738  do_addkey (listview_ctrl_t lv, gpgme_key Line 787  do_addkey (listview_ctrl_t lv, gpgme_key
787          if (attr)          if (attr)
788              listview_add_sub_item( lv, 0, idx++, attr);              listview_add_sub_item( lv, 0, idx++, attr);
789      }      }
790      if( lv->cols >= 4 ) {      if (lv->cols >= 4) {
791          p = get_key_status( key, uididx, list > 0? 1 : 0 );          p = get_key_status( key, uididx, list > 0? 1 : 0 );
792          if (!p)          if (!p)
793              return WPTERR_GENERAL;              return WPTERR_GENERAL;
# Line 762  do_addkey (listview_ctrl_t lv, gpgme_key Line 811  do_addkey (listview_ctrl_t lv, gpgme_key
811  }  }
812    
813    
814    /* Update a single column @col but for each element in the
815       listview @lv. */
816  void  void
817  keylist_upd_key (listview_ctrl_t lv, int pos, gpgme_key_t key)  keylist_upd_col (listview_ctrl_t lv, int col)
818  {  {
819        gpgme_key_t key;
820      const char *s;      const char *s;
821        char buf[32], *p;
822        int i;
823    
824        for (i=0; i < listview_count_items (lv, 0); i++) {
825            key = km_get_key_ptr (lv, i, NULL);
826            if (!key)
827                continue;
828            switch (col) {
829            case KM_COL_KEYID:
830                _snprintf (buf, sizeof (buf)-1, "0x%s", key->subkeys->keyid+8);
831                listview_add_sub_item (lv, i, col, buf);
832                break;
833    
834            case KM_COL_CIPHER:
835                s = get_key_algo (key, 0);
836                listview_add_sub_item (lv, i, col, s);
837                break;
838    
839            case KM_COL_TYPE:
840                s = find_secret_key (key)? "pub/sec" : "pub";
841                listview_add_sub_item (lv, i, col, s);
842                break;
843    
844            case KM_COL_CREAT:
845                s = get_key_created (key->subkeys->timestamp);
846                listview_add_sub_item (lv, i, col, s);
847                break;
848    
849            case KM_COL_DESC:
850                p = get_key_desc (key);
851                listview_add_sub_item (lv, i, col, p);
852                free_if_alloc (p);
853                break;
854            }
855        }
856    }
857    
858    
859    /* Update the listview item at position @pos with the data from
860       the key @key. */
861    void
862    keylist_upd_key (listview_ctrl_t lv, int pos,
863                     struct keycache_s *ctx, gpgme_key_t key)
864    {
865        const char *s;
866        char *p;
867      char tmp[32];      char tmp[32];
868    
869      listview_set_item2 (lv, pos, (void *)key);      listview_set_item2 (lv, pos, (void *)ctx);
870      /* the only mode we support is KYLIST_LIST in the Key Manager */      /* the only mode we support is KEYLIST_LIST in the Key Manager */
871            
872      s = key->uids->uid;      s = ctx->uids->uid;
873      if (s)      if (s)
874          listview_add_sub_item (lv, pos, 0, s);          listview_add_sub_item (lv, pos, KM_COL_UID, s);
875    
876      s = key->subkeys->keyid;      s = key->subkeys->keyid;
877      if (s) {      if (s) {
878          sprintf (tmp, "0x%s", s+8);          sprintf (tmp, "0x%s", s+8);
879          listview_add_sub_item (lv, pos, 1, tmp);          listview_add_sub_item (lv, pos, KM_COL_KEYID, tmp);
880      }      }
881    
882      s = find_secret_key (key)? "pub/sec" : "pub";      s = find_secret_key (key)? "pub/sec" : "pub";
883      listview_add_sub_item (lv, pos, 2, s);      listview_add_sub_item (lv, pos, KM_COL_TYPE, s);
884    
885      s = get_key_size (key, 0);      s = get_key_size (key, 0);
886      if (s)      if (s)
887          listview_add_sub_item (lv, pos, 3, s);          listview_add_sub_item (lv, pos, KM_COL_SIZE, s);
888    
889      s = get_key_algo (key, 0);      s = get_key_algo (key, 0);
890      if (s)      if (s)
891          listview_add_sub_item (lv, pos, 4, s);          listview_add_sub_item (lv, pos, KM_COL_CIPHER, s);
892    
893      s = get_key_status (key, 0, 1);      p = get_key_status (key, 0, 1);
894      if (s)      if (p) {
895          listview_add_sub_item (lv, pos, 5, s);          listview_add_sub_item (lv, pos, KM_COL_VALID, p);
896            free_if_alloc (p);
897        }
898    
899      s = get_key_trust (key, 0, 1);      s = get_key_trust (key, 0, 1);
900      if (s)      if (s)
901          listview_add_sub_item (lv, pos, 6, s);          listview_add_sub_item (lv, pos, KM_COL_TRUST, s);
902    
903      long t = key->subkeys->timestamp;      long t = key->subkeys->timestamp;
904      s = get_key_created (t);      s = get_key_created (t);
905      if (s)      if (s)
906          listview_add_sub_item (lv, pos, 7, s);          listview_add_sub_item (lv, pos, KM_COL_CREAT, s);
907  }  }
908    
909    
910  int  int
911  keylist_add_key (listview_ctrl_t lv, int mode, gpgme_key_t key)  keylist_add_key (listview_ctrl_t lv, int mode,
912                     struct keycache_s *ctx, gpgme_key_t key)
913  {  {
914      int uids, rc = 0, i;      int uids, rc = 0, i;
915      gpgme_subkey_t k;      gpgme_subkey_t k;
# Line 825  keylist_add_key (listview_ctrl_t lv, int Line 926  keylist_add_key (listview_ctrl_t lv, int
926    
927          if (mode & KEYLIST_ALL) {          if (mode & KEYLIST_ALL) {
928              uids = count_userids (key);              uids = count_userids (key);
929              rc = do_addkey (lv, key, uids, i, 0);              rc = do_addkey (lv, ctx, key, uids, i, 0);
930              if( rc )              if (rc)
931                  return rc;                  return rc;
932          }          }
933          else if (mode & KEYLIST_LIST)          else if (mode & KEYLIST_LIST)
934              return do_addkey (lv, key, -1, i, 1);              return do_addkey (lv, ctx, key, -1, i, 1);
935          else if (mode & KEYLIST_ENCRYPT) {          else if (mode & KEYLIST_ENCRYPT) {
936              if (k->can_encrypt && key_is_useable (k)) {              if (k->can_encrypt && key_is_useable (k)) {
937                  if (mode & KEYLIST_FLAG_FILE) {                  if (mode & KEYLIST_FLAG_FILE) {
938                      rc = do_addkey (lv, key, -1, i, -1);                      rc = do_addkey (lv, ctx, key, -1, i, -1);
939                      if (rc)                      if (rc)
940                          return rc;                          return rc;
941                  }                  }
942                  else {                  else {
943                      for( uids = 0;  uids < count_userids (key); uids++ ) {                      for (uids = 0;  uids < count_userids (key); uids++) {
944                          rc = do_addkey( lv, key, uids, i, -1 );                          rc = do_addkey (lv, ctx, key, uids, i, -1);
945                          if( rc )                          if (rc)
946                              return rc;                              return rc;
947                      }                      }
948                  }                  }
# Line 850  keylist_add_key (listview_ctrl_t lv, int Line 951  keylist_add_key (listview_ctrl_t lv, int
951          else if (mode & KEYLIST_ENCRYPT_MIN) {          else if (mode & KEYLIST_ENCRYPT_MIN) {
952              if( k->can_encrypt && key_is_useable (k))              if( k->can_encrypt && key_is_useable (k))
953              {              {
954                  rc = do_addkey (lv, key, -1, i, -1);                  rc = do_addkey (lv, ctx, key, -1, i, -1);
955                  return rc;                  return rc;
956              }              }
957          }                }      
# Line 858  keylist_add_key (listview_ctrl_t lv, int Line 959  keylist_add_key (listview_ctrl_t lv, int
959              if (k->can_sign              if (k->can_sign
960                  && find_secret_key (key)                  && find_secret_key (key)
961                  && key_is_useable (k)) {                  && key_is_useable (k)) {
962                  rc = do_addkey (lv, key, -1, i, -1);                  rc = do_addkey (lv, ctx, key, -1, i, -1);
963                  if (rc)                  if (rc)
964                      return rc;                        return rc;  
965              }              }
# Line 866  keylist_add_key (listview_ctrl_t lv, int Line 967  keylist_add_key (listview_ctrl_t lv, int
967      }      }
968    
969      return rc;        return rc;  
970  } /* keylist_add_key */  }
971    
972    
973  int  int
974  keylist_sort (listview_ctrl_t lv, int sortby)  keylist_sort (listview_ctrl_t lv, int sortby)
975  {        {
976      return listview_sort_items (lv, sortby, keylist_cmp_cb);      return listview_sort_items (lv, sortby, keylist_cmp_cb);
977  }  }
978    
979    
980  /* Check that the validity @validity is at least >= marginal. */  /* Check that the validity @validity is at least >= marginal. */
981  static int  static int
982  key_check_validity (const char *validity)  key_check_validity (gpgme_key_t key)
983  {      {
984      if (strstr (validity, _("Unknown")) ||      gpgme_user_id_t u;
985          strstr (validity, _("Undefined")) ||  
986          strstr (validity, _("Never")) ||      for (u=key->uids; u; u =u->next) {
987          strstr (validity, _("None")))          if (u->validity >= GPGME_VALIDITY_MARGINAL)
988          return 0;                return -1;
989      return 1;      }
990    
991        return 0;
992  }  }
993    
994    
# Line 896  key_check_validity (const char *validity Line 999  key_check_validity (const char *validity
999  gpgme_key_t*  gpgme_key_t*
1000  keylist_get_recipients (listview_ctrl_t lv, int *r_force_trust, int *r_count)  keylist_get_recipients (listview_ctrl_t lv, int *r_force_trust, int *r_count)
1001  {  {
1002        key_array_s *ka = NULL;
1003        keycache_s *c;
1004        gpgme_key_t *keybuf, key;
1005      int count = 0, force_trust = 0;      int count = 0, force_trust = 0;
1006      int n, j, ka_pos = 0, rc = 0;      int n, j, ka_pos = 0, rc = 0;
1007      int k_pos=0;      int k_pos=0;
     char keyid[32], valid[32], id[100];  
     key_array_s *ka = NULL;  
     gpgme_key_t *keybuf;  
1008    
1009      n = listview_count_items( lv, 0 );      n = listview_count_items (lv, 0);
1010            
1011      ka = key_array_new( n );      ka = key_array_new (n);
1012      if (!ka)      if (!ka)
1013          BUG (NULL);          BUG (NULL);
1014    
1015      keybuf = (gpgme_key_t*)calloc (n, sizeof (gpgme_key_t));      keybuf = (gpgme_key_t*)calloc (n+1, sizeof (gpgme_key_t));
1016      if (!keybuf)      if (!keybuf)
1017          BUG (NULL);          BUG (NULL);
1018                    
1019      for( j = 0; j < n; j++ ) {      for (j = 0; j < n; j++) {
1020          if( listview_get_item_state (lv, j) || n == 1) {          if (listview_get_item_state (lv, j) || n == 1) {
1021              listview_get_item_text (lv, j, 0, id, sizeof id-1);              key = km_get_key_ptr (lv, j, &c);
1022              listview_get_item_text (lv, j, 1, keyid, sizeof keyid - 1);                              if (!key)
1023              listview_get_item_text (lv, j, 4, valid, sizeof valid -1);                  BUG (0);
1024              if( !key_check_validity (valid)              if (!key_check_validity (key) &&
1025                   && !key_array_search( ka, ka_pos, keyid )) {                  !key_array_search (ka, ka_pos, key->subkeys->keyid)) {
1026                  char *warn = new char[512+strlen (id) + 1];                  char *warn = new char[512+strlen (c->uids->uid) + 1];
1027                  if (!warn)                  if (!warn)
1028                      BUG (0);                      BUG (0);
1029                  sprintf (warn,                  sprintf (warn,
# Line 928  keylist_get_recipients (listview_ctrl_t Line 1031  keylist_get_recipients (listview_ctrl_t
1031                        "named in the user ID.  If you *really* know what you are\n"                        "named in the user ID.  If you *really* know what you are\n"
1032                        "doing, you may answer the next question with yes\n"                        "doing, you may answer the next question with yes\n"
1033                        "\n"                        "\n"
1034                        "Use \"%s\" anyway?"), id);                        "Use \"%s\" anyway?"), c->uids->uid);
1035                  if (reg_prefs.always_trust)                  if (reg_prefs.always_trust)
1036                      rc = IDYES;                      rc = IDYES;
1037                  else                  else
1038                      rc = msg_box (NULL, warn, _("Recipients"), MB_ERR_ASK);                      rc = msg_box (NULL, warn, _("Recipients"), MB_ERR_ASK);
1039                  if (rc == IDYES) {                  if (rc == IDYES) {
1040                      gpgme_key_t k;                      keybuf[k_pos++] = key;
                     get_pubkey (keyid, &k);  
                     keybuf[k_pos++] = k;  
1041                      force_trust++;                      force_trust++;
1042                      ka[ka_pos].checked = 1;                      ka[ka_pos].checked = 1;
1043                      strcpy (ka[ka_pos++].keyid, keyid);                      strcpy (ka[ka_pos++].keyid, key->subkeys->keyid);
1044                      count++;                      count++;
1045                  }                  }
1046                  free_if_alloc (warn);                  free_if_alloc (warn);
1047              }              }
1048              else {              else {
1049                  gpgme_key_t k;                  keybuf[k_pos++] = key;
                 listview_get_item_text( lv, j, 1, keyid, sizeof keyid -1 );  
                 get_pubkey (keyid, &k);  
                 keybuf[k_pos++] = k;  
1050                  count++;                          count++;        
1051              }              }
1052          }          }
# Line 963  keylist_get_recipients (listview_ctrl_t Line 1061  keylist_get_recipients (listview_ctrl_t
1061    
1062    
1063  static int  static int
1064  keylist_get_keyflags (const char *buf, size_t buflen)  keylist_get_keyflags (gpgme_key_t key)
1065  {  {
1066      int c = 0, flags = 0;      int flags = KEYFLAG_NONE;
1067    
1068      if( *buf != '[' )      if (key->revoked)
1069          return KEYFLAG_NONE;          flags |= KEYFLAG_REVOKED;
1070      while (buf && c != ']')      if (key->expired)
1071      {          flags |= KEYFLAG_EXPIRED;
1072          c = *buf++;      if (key->disabled)
1073          if (c == 'R')          flags |= KEYFLAG_DISABLED;
             flags |= KEYFLAG_REVOKED;  
         if (c == 'E')  
             flags |= KEYFLAG_EXPIRED;  
         if (c == 'D')  
             flags |= KEYFLAG_DISABLED;  
     }  
1074    
1075      return flags;      return flags;
1076  } /* keylist_get_keyflags */  }
1077    
1078    
1079  gpgme_key_t*  gpgme_key_t*
1080  keylist_enum_recipients (listview_ctrl_t lv,  int listype, int *r_count)  keylist_enum_recipients (listview_ctrl_t lv,  int listype, int *r_count)
1081  {  {
1082      gpgme_key_t* rset;      struct keycache_s *c;
1083      gpgme_key_t k;      gpgme_key_t *rset;
1084        gpgme_key_t key;
1085      int i, n, id, k_pos=0;      int i, n, id, k_pos=0;
     char keyid[32], t[128], t2[128];  
1086    
1087      n = listview_count_items (lv, 0);      n = listview_count_items (lv, 0);
1088      if (!n)      if (!n)
1089          return 0;          return 0;
1090      rset = (gpgme_key_t*)calloc (n, sizeof (gpgme_key_t));      rset = (gpgme_key_t*)calloc (n+1, sizeof (gpgme_key_t));
1091      if (!rset)      if (!rset)
1092          BUG (NULL);          BUG (NULL);
1093      for( i = 0; i < n; i++ ) {      for (i = 0; i < n; i++) {
1094          if( !listview_get_item_state( lv, i ) )          if (!listview_get_item_state (lv, i))
1095              continue;              continue;
1096          listview_get_item_text( lv, i, 1, keyid, sizeof keyid - 1 );          key = km_get_key_ptr (lv, i, &c);
1097          switch( listype ) {          switch (listype) {
1098          case KEYLIST_LIST:          case KEYLIST_LIST:
1099              listview_get_item_text( lv, i, 5, t, sizeof t - 1 );              if (keylist_get_keyflags (key) & KEYFLAG_REVOKED) {
1100              if( keylist_get_keyflags( t, strlen( t ) ) & KEYFLAG_REVOKED ) {                  id = printf_box (_("Recipients"), MB_INFO|MB_YESNO,
1101                  _snprintf( t2, sizeof t2 -1,                  _("KeyID %s.\nDo you really want to export a revoked key?"),
1102                              _("KeyID %s.\nDo you really want to export a revoked key?"), keyid );                                   c->uids->uid);
1103                  id = msg_box( lv->ctrl, t2, _("Recipients"), MB_INFO|MB_YESNO );                  if (id == IDNO)
1104                  if( id == IDNO )                      continue;
                     continue;            
1105              }              }
1106              break;              break;
1107          }          }
1108          get_pubkey (keyid, &k);          rset[k_pos++] = key;
         rset[k_pos++] = k;  
1109      }      }
1110      if (r_count)      if (r_count)
1111          *r_count = k_pos;          *r_count = k_pos;
1112      return rset;      return rset;
1113  } /* keylist_enum_recipients */  }
1114    
1115    
1116  void  void
1117  seclist_destroy (keylist_t * list)  seclist_destroy (keylist_t *list)
1118  {  {
1119      keylist_t l2;      keylist_t l2;
1120      while (*list) {      while (*list) {
# Line 1033  seclist_destroy (keylist_t * list) Line 1123  seclist_destroy (keylist_t * list)
1123          *list = l2;              *list = l2;    
1124      }      }
1125      list = NULL;      list = NULL;
1126  } /* seclist_destroy */  }
1127    
1128    
1129  void  void
# Line 1070  seclist_init (HWND dlg, int ctlid, int f Line 1160  seclist_init (HWND dlg, int ctlid, int f
1160          if (key->disabled || !key_is_useable (key->subkeys))          if (key->disabled || !key_is_useable (key->subkeys))
1161              continue;              continue;
1162    
1163          uid = utf8_to_wincp (id, strlen (id));          uid = utf8_to_native (id);
1164          size = strlen( uid ) + strlen( keyid ) + 32;          size = strlen (uid) + strlen (keyid) + 32;
1165          inf = new char[size+1];          inf = new char[size+1];
1166          if( !inf )          if (!inf)
1167              BUG( NULL );              BUG (NULL);
1168          _snprintf (inf, size, "%s (%s/0x%s)", uid,          _snprintf (inf, size, "%s (%s/0x%s)", uid,
1169                     get_key_pubalgo (key->subkeys->pubkey_algo), keyid + 8);                     get_key_pubalgo (key->subkeys->pubkey_algo), keyid + 8);
1170          combox_add_string (kb, inf);          combox_add_string (kb, inf);
1171          free_if_alloc (inf);          free_if_alloc (inf);
# Line 1092  seclist_init (HWND dlg, int ctlid, int f Line 1182  seclist_init (HWND dlg, int ctlid, int f
1182              l2->next = l;              l2->next = l;
1183          }          }
1184      }      }
1185      for( pos = 0, l2=list; pos < SendMessage( kb, CB_GETCOUNT, 0, 0 ); pos++, l2=l2->next )      for (pos = 0, l2=list; pos < SendMessage (kb, CB_GETCOUNT, 0, 0);
1186          SendMessage( kb, CB_SETITEMDATA, pos, (LPARAM)(DWORD)l2->key );           pos++, l2=l2->next)
1187      SendMessage( kb, CB_SETCURSEL, 0, 0 );          SendMessage (kb, CB_SETITEMDATA, pos, (LPARAM)(DWORD)l2->key);
1188        SendMessage (kb, CB_SETCURSEL, 0, 0);
1189      *ret_list = list;      *ret_list = list;
1190  }  }
1191                    

Legend:
Removed from v.105  
changed lines
  Added in v.208

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26