char *buf; char name[MAX_PATH];
char *buf = NULL; char name[MAX_PATH+1];
config_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam){    char *buf;    char name[MAX_PATH];    int n;    switch (msg) {    case WM_INITDIALOG:	center_window (dlg, 0);	if (!load_config_value (NULL, REGPATH, "gpgProgram", &buf)) {	    SetDlgItemText (dlg, IDC_OPT_GPGPRG, buf);	    free (buf);	}	if (!load_config_value (NULL, REGPATH, "HomeDir", &buf)) {	    SetDlgItemText (dlg, IDC_OPT_HOMEDIR, buf);	    free (buf);	}	if (!load_config_value (NULL, REGPATH, "keyManager", &buf)) {	    SetDlgItemText (dlg, IDC_OPT_KEYMAN, buf);	    free (buf);	}	break;    case WM_COMMAND:	switch (LOWORD(wparam)) {	case IDC_OPT_SELPRG:	    buf = get_open_file_name (NULL);	    if (buf && *buf)		SetDlgItemText(dlg, IDC_OPT_GPGPRG, buf);	    break;	case IDC_OPT_SELHOMEDIR:	    buf = get_folder ();	    if (buf && *buf)		SetDlgItemText(dlg, IDC_OPT_HOMEDIR, buf);	    break;	case IDC_OPT_SELKEYMAN:	    buf = get_open_file_name (NULL);	    if (buf && *buf)		SetDlgItemText (dlg, IDC_OPT_KEYMAN, buf);	    break;	case IDOK:	    n = GetDlgItemText (dlg, IDC_OPT_GPGPRG, name, MAX_PATH-1);	    if (n > 0) {		if (does_file_exist (name, 1))		    return FALSE;		if (store_config_value (NULL, REGPATH, "gpgProgram", name))		    error_box ("GPG Config");	    }	    n = GetDlgItemText (dlg, IDC_OPT_KEYMAN, name, MAX_PATH-1);	    if (n > 0) {		if (does_file_exist (name, 1))		    return FALSE;		if (store_config_value (NULL, REGPATH, "keyManager", name))		    error_box ("GPG Config");	    }	    n = GetDlgItemText (dlg, IDC_OPT_HOMEDIR, name, MAX_PATH-1);	    if (n > 0) {		if (store_config_value (NULL, REGPATH, "HomeDir", name))		    error_box ("GPG Config");	    }	    EndDialog (dlg, TRUE);	    break;	}	break;    }    return FALSE;}