mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
Formatting: normalise back to 4-space indentation.
In several pieces of development recently I've run across the occasional code block in the middle of a function which suddenly switched to 2-space indent from this code base's usual 4. I decided I was tired of it, so I ran the whole code base through a re-indenter, which made a huge mess, and then manually sifted out the changes that actually made sense from that pass. Indeed, this caught quite a few large sections with 2-space indent level, a couple with 8, and a handful of even weirder things like 3 spaces or 12. This commit fixes them all.
This commit is contained in:
parent
b6d7c81d43
commit
3a42a09dad
@ -103,7 +103,7 @@ int charset_from_localenc(const char *name)
|
|||||||
p = name;
|
p = name;
|
||||||
q = localencs[i].name;
|
q = localencs[i].name;
|
||||||
while (*p || *q) {
|
while (*p || *q) {
|
||||||
if (tolower((unsigned char)*p) != tolower((unsigned char)*q))
|
if (tolower((unsigned char)*p) != tolower((unsigned char)*q))
|
||||||
break;
|
break;
|
||||||
p++; q++;
|
p++; q++;
|
||||||
}
|
}
|
||||||
|
@ -207,7 +207,7 @@ int charset_from_mimeenc(const char *name)
|
|||||||
p = name;
|
p = name;
|
||||||
q = mimeencs[i].name;
|
q = mimeencs[i].name;
|
||||||
while (*p || *q) {
|
while (*p || *q) {
|
||||||
if (tolower((unsigned char)*p) != tolower((unsigned char)*q))
|
if (tolower((unsigned char)*p) != tolower((unsigned char)*q))
|
||||||
break;
|
break;
|
||||||
p++; q++;
|
p++; q++;
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ int charset_from_xenc(const char *name)
|
|||||||
p = name;
|
p = name;
|
||||||
q = xencs[i].name;
|
q = xencs[i].name;
|
||||||
while (*p || *q) {
|
while (*p || *q) {
|
||||||
if (tolower((unsigned char)*p) != tolower((unsigned char)*q))
|
if (tolower((unsigned char)*p) != tolower((unsigned char)*q))
|
||||||
break;
|
break;
|
||||||
p++; q++;
|
p++; q++;
|
||||||
}
|
}
|
||||||
|
200
cmdgen.c
200
cmdgen.c
@ -299,73 +299,73 @@ int main(int argc, char **argv)
|
|||||||
while (*p && *p != '=')
|
while (*p && *p != '=')
|
||||||
p++; /* find end of option */
|
p++; /* find end of option */
|
||||||
if (*p == '=') {
|
if (*p == '=') {
|
||||||
*p++ = '\0';
|
*p++ = '\0';
|
||||||
val = p;
|
val = p;
|
||||||
} else
|
} else
|
||||||
val = NULL;
|
val = NULL;
|
||||||
|
|
||||||
if (!strcmp(opt, "-help")) {
|
if (!strcmp(opt, "-help")) {
|
||||||
if (val) {
|
if (val) {
|
||||||
errs = true;
|
errs = true;
|
||||||
fprintf(stderr, "puttygen: option `-%s'"
|
fprintf(stderr, "puttygen: option `-%s'"
|
||||||
" expects no argument\n", opt);
|
" expects no argument\n", opt);
|
||||||
} else {
|
} else {
|
||||||
help();
|
help();
|
||||||
nogo = true;
|
nogo = true;
|
||||||
}
|
}
|
||||||
} else if (!strcmp(opt, "-version")) {
|
} else if (!strcmp(opt, "-version")) {
|
||||||
if (val) {
|
if (val) {
|
||||||
errs = true;
|
errs = true;
|
||||||
fprintf(stderr, "puttygen: option `-%s'"
|
fprintf(stderr, "puttygen: option `-%s'"
|
||||||
" expects no argument\n", opt);
|
" expects no argument\n", opt);
|
||||||
} else {
|
} else {
|
||||||
showversion();
|
showversion();
|
||||||
nogo = true;
|
nogo = true;
|
||||||
}
|
}
|
||||||
} else if (!strcmp(opt, "-pgpfp")) {
|
} else if (!strcmp(opt, "-pgpfp")) {
|
||||||
if (val) {
|
if (val) {
|
||||||
errs = true;
|
errs = true;
|
||||||
fprintf(stderr, "puttygen: option `-%s'"
|
fprintf(stderr, "puttygen: option `-%s'"
|
||||||
" expects no argument\n", opt);
|
" expects no argument\n", opt);
|
||||||
} else {
|
} else {
|
||||||
/* support --pgpfp for consistency */
|
/* support --pgpfp for consistency */
|
||||||
pgp_fingerprints();
|
pgp_fingerprints();
|
||||||
nogo = true;
|
nogo = true;
|
||||||
}
|
}
|
||||||
} else if (!strcmp(opt, "-old-passphrase")) {
|
} else if (!strcmp(opt, "-old-passphrase")) {
|
||||||
if (!val && argc > 1)
|
if (!val && argc > 1)
|
||||||
--argc, val = *++argv;
|
--argc, val = *++argv;
|
||||||
if (!val) {
|
if (!val) {
|
||||||
errs = true;
|
|
||||||
fprintf(stderr, "puttygen: option `-%s'"
|
|
||||||
" expects an argument\n", opt);
|
|
||||||
} else {
|
|
||||||
old_passphrase = readpassphrase(val);
|
|
||||||
if (!old_passphrase)
|
|
||||||
errs = true;
|
errs = true;
|
||||||
}
|
fprintf(stderr, "puttygen: option `-%s'"
|
||||||
|
" expects an argument\n", opt);
|
||||||
|
} else {
|
||||||
|
old_passphrase = readpassphrase(val);
|
||||||
|
if (!old_passphrase)
|
||||||
|
errs = true;
|
||||||
|
}
|
||||||
} else if (!strcmp(opt, "-new-passphrase")) {
|
} else if (!strcmp(opt, "-new-passphrase")) {
|
||||||
if (!val && argc > 1)
|
if (!val && argc > 1)
|
||||||
--argc, val = *++argv;
|
--argc, val = *++argv;
|
||||||
if (!val) {
|
if (!val) {
|
||||||
errs = true;
|
|
||||||
fprintf(stderr, "puttygen: option `-%s'"
|
|
||||||
" expects an argument\n", opt);
|
|
||||||
} else {
|
|
||||||
new_passphrase = readpassphrase(val);
|
|
||||||
if (!new_passphrase)
|
|
||||||
errs = true;
|
errs = true;
|
||||||
}
|
fprintf(stderr, "puttygen: option `-%s'"
|
||||||
|
" expects an argument\n", opt);
|
||||||
|
} else {
|
||||||
|
new_passphrase = readpassphrase(val);
|
||||||
|
if (!new_passphrase)
|
||||||
|
errs = true;
|
||||||
|
}
|
||||||
} else if (!strcmp(opt, "-random-device")) {
|
} else if (!strcmp(opt, "-random-device")) {
|
||||||
if (!val && argc > 1)
|
if (!val && argc > 1)
|
||||||
--argc, val = *++argv;
|
--argc, val = *++argv;
|
||||||
if (!val) {
|
if (!val) {
|
||||||
errs = true;
|
errs = true;
|
||||||
fprintf(stderr, "puttygen: option `-%s'"
|
fprintf(stderr, "puttygen: option `-%s'"
|
||||||
" expects an argument\n", opt);
|
" expects an argument\n", opt);
|
||||||
} else {
|
} else {
|
||||||
random_device = val;
|
random_device = val;
|
||||||
}
|
}
|
||||||
} else if (!strcmp(opt, "-dump")) {
|
} else if (!strcmp(opt, "-dump")) {
|
||||||
outtype = TEXT;
|
outtype = TEXT;
|
||||||
} else if (!strcmp(opt, "-cert-info") ||
|
} else if (!strcmp(opt, "-cert-info") ||
|
||||||
@ -401,15 +401,15 @@ int main(int argc, char **argv)
|
|||||||
} else if (!strcmp(opt, "-strong-rsa")) {
|
} else if (!strcmp(opt, "-strong-rsa")) {
|
||||||
strong_rsa = true;
|
strong_rsa = true;
|
||||||
} else if (!strcmp(opt, "-certificate")) {
|
} else if (!strcmp(opt, "-certificate")) {
|
||||||
if (!val && argc > 1)
|
if (!val && argc > 1)
|
||||||
--argc, val = *++argv;
|
--argc, val = *++argv;
|
||||||
if (!val) {
|
if (!val) {
|
||||||
errs = true;
|
errs = true;
|
||||||
fprintf(stderr, "puttygen: option `-%s'"
|
fprintf(stderr, "puttygen: option `-%s'"
|
||||||
" expects an argument\n", opt);
|
" expects an argument\n", opt);
|
||||||
} else {
|
} else {
|
||||||
certfile = val;
|
certfile = val;
|
||||||
}
|
}
|
||||||
} else if (!strcmp(opt, "-remove-certificate")) {
|
} else if (!strcmp(opt, "-remove-certificate")) {
|
||||||
remove_cert = true;
|
remove_cert = true;
|
||||||
} else if (!strcmp(opt, "-reencrypt")) {
|
} else if (!strcmp(opt, "-reencrypt")) {
|
||||||
@ -490,9 +490,9 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
errs = true;
|
errs = true;
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"puttygen: no such option `-%s'\n", opt);
|
"puttygen: no such option `-%s'\n", opt);
|
||||||
}
|
}
|
||||||
p = NULL;
|
p = NULL;
|
||||||
break;
|
break;
|
||||||
@ -1334,29 +1334,29 @@ int main(int argc, char **argv)
|
|||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
if (outfile) {
|
if (outfile) {
|
||||||
fp = f_open(outfilename, "w", false);
|
fp = f_open(outfilename, "w", false);
|
||||||
if (!fp) {
|
if (!fp) {
|
||||||
fprintf(stderr, "unable to open output file\n");
|
fprintf(stderr, "unable to open output file\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fp = stdout;
|
fp = stdout;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sshver == 1) {
|
if (sshver == 1) {
|
||||||
ssh1_write_pubkey(fp, ssh1key);
|
ssh1_write_pubkey(fp, ssh1key);
|
||||||
} else {
|
} else {
|
||||||
if (!ssh2blob) {
|
if (!ssh2blob) {
|
||||||
assert(ssh2key);
|
assert(ssh2key);
|
||||||
ssh2blob = strbuf_new();
|
ssh2blob = strbuf_new();
|
||||||
ssh_key_public_blob(ssh2key->key, BinarySink_UPCAST(ssh2blob));
|
ssh_key_public_blob(ssh2key->key, BinarySink_UPCAST(ssh2blob));
|
||||||
}
|
}
|
||||||
|
|
||||||
ssh2_write_pubkey(fp, ssh2key ? ssh2key->comment : origcomment,
|
ssh2_write_pubkey(fp, ssh2key ? ssh2key->comment : origcomment,
|
||||||
ssh2blob->s, ssh2blob->len,
|
ssh2blob->s, ssh2blob->len,
|
||||||
(outtype == PUBLIC ?
|
(outtype == PUBLIC ?
|
||||||
SSH_KEYTYPE_SSH2_PUBLIC_RFC4716 :
|
SSH_KEYTYPE_SSH2_PUBLIC_RFC4716 :
|
||||||
SSH_KEYTYPE_SSH2_PUBLIC_OPENSSH));
|
SSH_KEYTYPE_SSH2_PUBLIC_OPENSSH));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (outfile)
|
if (outfile)
|
||||||
@ -1370,26 +1370,26 @@ int main(int argc, char **argv)
|
|||||||
char *fingerprint;
|
char *fingerprint;
|
||||||
|
|
||||||
if (sshver == 1) {
|
if (sshver == 1) {
|
||||||
assert(ssh1key);
|
assert(ssh1key);
|
||||||
fingerprint = rsa_ssh1_fingerprint(ssh1key);
|
fingerprint = rsa_ssh1_fingerprint(ssh1key);
|
||||||
} else {
|
} else {
|
||||||
if (ssh2key) {
|
if (ssh2key) {
|
||||||
fingerprint = ssh2_fingerprint(ssh2key->key, fptype);
|
fingerprint = ssh2_fingerprint(ssh2key->key, fptype);
|
||||||
} else {
|
} else {
|
||||||
assert(ssh2blob);
|
assert(ssh2blob);
|
||||||
fingerprint = ssh2_fingerprint_blob(
|
fingerprint = ssh2_fingerprint_blob(
|
||||||
ptrlen_from_strbuf(ssh2blob), fptype);
|
ptrlen_from_strbuf(ssh2blob), fptype);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (outfile) {
|
if (outfile) {
|
||||||
fp = f_open(outfilename, "w", false);
|
fp = f_open(outfilename, "w", false);
|
||||||
if (!fp) {
|
if (!fp) {
|
||||||
fprintf(stderr, "unable to open output file\n");
|
fprintf(stderr, "unable to open output file\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fp = stdout;
|
fp = stdout;
|
||||||
}
|
}
|
||||||
fprintf(fp, "%s\n", fingerprint);
|
fprintf(fp, "%s\n", fingerprint);
|
||||||
if (outfile)
|
if (outfile)
|
||||||
|
@ -430,7 +430,7 @@ static void blowfish_msb_decrypt_cbc(unsigned char *blk, int len,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void blowfish_msb_sdctr(unsigned char *blk, int len,
|
static void blowfish_msb_sdctr(unsigned char *blk, int len,
|
||||||
BlowfishContext * ctx)
|
BlowfishContext * ctx)
|
||||||
{
|
{
|
||||||
uint32_t b[2], iv0, iv1, tmp;
|
uint32_t b[2], iv0, iv1, tmp;
|
||||||
|
|
||||||
|
4
import.c
4
import.c
@ -1249,8 +1249,8 @@ static struct openssh_new_key *load_openssh_new_key(BinarySource *filesrc,
|
|||||||
ret->kdfopts.bcrypt.rounds = get_uint32(opts);
|
ret->kdfopts.bcrypt.rounds = get_uint32(opts);
|
||||||
|
|
||||||
if (get_err(opts)) {
|
if (get_err(opts)) {
|
||||||
errmsg = "failed to parse bcrypt options string";
|
errmsg = "failed to parse bcrypt options string";
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -717,15 +717,15 @@ static char *supdup_init(const BackendVtable *x, Seat *seat,
|
|||||||
*backend_handle = &supdup->backend;
|
*backend_handle = &supdup->backend;
|
||||||
|
|
||||||
switch (conf_get_int(supdup->conf, CONF_supdup_ascii_set)) {
|
switch (conf_get_int(supdup->conf, CONF_supdup_ascii_set)) {
|
||||||
case SUPDUP_CHARSET_ASCII:
|
case SUPDUP_CHARSET_ASCII:
|
||||||
supdup->print = print_ascii;
|
supdup->print = print_ascii;
|
||||||
break;
|
break;
|
||||||
case SUPDUP_CHARSET_ITS:
|
case SUPDUP_CHARSET_ITS:
|
||||||
supdup->print = print_its;
|
supdup->print = print_its;
|
||||||
break;
|
break;
|
||||||
case SUPDUP_CHARSET_WAITS:
|
case SUPDUP_CHARSET_WAITS:
|
||||||
supdup->print = print_waits;
|
supdup->print = print_waits;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -452,7 +452,7 @@ static void process_subneg(Telnet *telnet)
|
|||||||
eval != NULL;
|
eval != NULL;
|
||||||
eval = conf_get_str_strs(telnet->conf, CONF_environmt,
|
eval = conf_get_str_strs(telnet->conf, CONF_environmt,
|
||||||
ekey, &ekey))
|
ekey, &ekey))
|
||||||
bsize += strlen(ekey) + strlen(eval) + 2;
|
bsize += strlen(ekey) + strlen(eval) + 2;
|
||||||
user = get_remote_username(telnet->conf);
|
user = get_remote_username(telnet->conf);
|
||||||
if (user)
|
if (user)
|
||||||
bsize += 6 + strlen(user);
|
bsize += 6 + strlen(user);
|
||||||
|
@ -431,8 +431,8 @@ static SeatPromptResult sshproxy_confirm_ssh_host_key(
|
|||||||
}
|
}
|
||||||
|
|
||||||
static SeatPromptResult sshproxy_confirm_weak_crypto_primitive(
|
static SeatPromptResult sshproxy_confirm_weak_crypto_primitive(
|
||||||
Seat *seat, const char *algtype, const char *algname,
|
Seat *seat, const char *algtype, const char *algname,
|
||||||
void (*callback)(void *ctx, SeatPromptResult result), void *ctx)
|
void (*callback)(void *ctx, SeatPromptResult result), void *ctx)
|
||||||
{
|
{
|
||||||
SshProxy *sp = container_of(seat, SshProxy, seat);
|
SshProxy *sp = container_of(seat, SshProxy, seat);
|
||||||
|
|
||||||
@ -457,8 +457,8 @@ static SeatPromptResult sshproxy_confirm_weak_crypto_primitive(
|
|||||||
}
|
}
|
||||||
|
|
||||||
static SeatPromptResult sshproxy_confirm_weak_cached_hostkey(
|
static SeatPromptResult sshproxy_confirm_weak_cached_hostkey(
|
||||||
Seat *seat, const char *algname, const char *betteralgs,
|
Seat *seat, const char *algname, const char *betteralgs,
|
||||||
void (*callback)(void *ctx, SeatPromptResult result), void *ctx)
|
void (*callback)(void *ctx, SeatPromptResult result), void *ctx)
|
||||||
{
|
{
|
||||||
SshProxy *sp = container_of(seat, SshProxy, seat);
|
SshProxy *sp = container_of(seat, SshProxy, seat);
|
||||||
|
|
||||||
|
@ -85,31 +85,31 @@ char *format_telnet_command(SockAddr *addr, int port, Conf *conf,
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
eo++;
|
|
||||||
if (fmt[eo] >= '0' && fmt[eo] <= '9')
|
|
||||||
v += fmt[eo] - '0';
|
|
||||||
else if (fmt[eo] >= 'a' && fmt[eo] <= 'f')
|
|
||||||
v += fmt[eo] - 'a' + 10;
|
|
||||||
else if (fmt[eo] >= 'A' && fmt[eo] <= 'F')
|
|
||||||
v += fmt[eo] - 'A' + 10;
|
|
||||||
else {
|
|
||||||
/* non hex character, so we abort and just
|
|
||||||
* send the whole thing unescaped (including \x)
|
|
||||||
*/
|
|
||||||
put_byte(buf, '\\');
|
|
||||||
eo = so + 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* we only extract two hex characters */
|
|
||||||
if (i == 1) {
|
|
||||||
put_byte(buf, v);
|
|
||||||
eo++;
|
eo++;
|
||||||
break;
|
if (fmt[eo] >= '0' && fmt[eo] <= '9')
|
||||||
}
|
v += fmt[eo] - '0';
|
||||||
|
else if (fmt[eo] >= 'a' && fmt[eo] <= 'f')
|
||||||
|
v += fmt[eo] - 'a' + 10;
|
||||||
|
else if (fmt[eo] >= 'A' && fmt[eo] <= 'F')
|
||||||
|
v += fmt[eo] - 'A' + 10;
|
||||||
|
else {
|
||||||
|
/* non hex character, so we abort and just
|
||||||
|
* send the whole thing unescaped (including \x)
|
||||||
|
*/
|
||||||
|
put_byte(buf, '\\');
|
||||||
|
eo = so + 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
i++;
|
/* we only extract two hex characters */
|
||||||
v <<= 4;
|
if (i == 1) {
|
||||||
|
put_byte(buf, v);
|
||||||
|
eo++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
i++;
|
||||||
|
v <<= 4;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
4
pscp.c
4
pscp.c
@ -645,8 +645,8 @@ void scp_sftp_listdir(const char *dirname)
|
|||||||
dirh = fxp_opendir_recv(pktin, req);
|
dirh = fxp_opendir_recv(pktin, req);
|
||||||
|
|
||||||
if (dirh == NULL) {
|
if (dirh == NULL) {
|
||||||
tell_user(stderr, "Unable to open %s: %s\n", dirname, fxp_error());
|
tell_user(stderr, "Unable to open %s: %s\n", dirname, fxp_error());
|
||||||
errs++;
|
errs++;
|
||||||
} else {
|
} else {
|
||||||
struct list_directory_from_sftp_ctx *ctx =
|
struct list_directory_from_sftp_ctx *ctx =
|
||||||
list_directory_from_sftp_new();
|
list_directory_from_sftp_new();
|
||||||
|
8
psftp.c
8
psftp.c
@ -2565,10 +2565,10 @@ static void usage(void)
|
|||||||
|
|
||||||
static void version(void)
|
static void version(void)
|
||||||
{
|
{
|
||||||
char *buildinfo_text = buildinfo("\n");
|
char *buildinfo_text = buildinfo("\n");
|
||||||
printf("psftp: %s\n%s\n", ver, buildinfo_text);
|
printf("psftp: %s\n%s\n", ver, buildinfo_text);
|
||||||
sfree(buildinfo_text);
|
sfree(buildinfo_text);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
4
putty.h
4
putty.h
@ -1544,7 +1544,7 @@ const char *nullseat_get_x_display(Seat *seat);
|
|||||||
bool nullseat_get_windowid(Seat *seat, long *id_out);
|
bool nullseat_get_windowid(Seat *seat, long *id_out);
|
||||||
bool nullseat_get_window_pixel_size(Seat *seat, int *width, int *height);
|
bool nullseat_get_window_pixel_size(Seat *seat, int *width, int *height);
|
||||||
StripCtrlChars *nullseat_stripctrl_new(
|
StripCtrlChars *nullseat_stripctrl_new(
|
||||||
Seat *seat, BinarySink *bs_out, SeatInteractionContext sic);
|
Seat *seat, BinarySink *bs_out, SeatInteractionContext sic);
|
||||||
void nullseat_set_trust_status(Seat *seat, bool trusted);
|
void nullseat_set_trust_status(Seat *seat, bool trusted);
|
||||||
bool nullseat_can_set_trust_status_yes(Seat *seat);
|
bool nullseat_can_set_trust_status_yes(Seat *seat);
|
||||||
bool nullseat_can_set_trust_status_no(Seat *seat);
|
bool nullseat_can_set_trust_status_no(Seat *seat);
|
||||||
@ -1573,7 +1573,7 @@ SeatPromptResult console_confirm_weak_cached_hostkey(
|
|||||||
Seat *seat, const char *algname, const char *betteralgs,
|
Seat *seat, const char *algname, const char *betteralgs,
|
||||||
void (*callback)(void *ctx, SeatPromptResult result), void *ctx);
|
void (*callback)(void *ctx, SeatPromptResult result), void *ctx);
|
||||||
StripCtrlChars *console_stripctrl_new(
|
StripCtrlChars *console_stripctrl_new(
|
||||||
Seat *seat, BinarySink *bs_out, SeatInteractionContext sic);
|
Seat *seat, BinarySink *bs_out, SeatInteractionContext sic);
|
||||||
void console_set_trust_status(Seat *seat, bool trusted);
|
void console_set_trust_status(Seat *seat, bool trusted);
|
||||||
bool console_can_set_trust_status(Seat *seat);
|
bool console_can_set_trust_status(Seat *seat);
|
||||||
bool console_has_mixed_input_stream(Seat *seat);
|
bool console_has_mixed_input_stream(Seat *seat);
|
||||||
|
@ -84,10 +84,10 @@ static inline bool chan_want_close(Channel *ch, bool leof, bool reof)
|
|||||||
static inline bool chan_rcvd_exit_status(Channel *ch, int status)
|
static inline bool chan_rcvd_exit_status(Channel *ch, int status)
|
||||||
{ return ch->vt->rcvd_exit_status(ch, status); }
|
{ return ch->vt->rcvd_exit_status(ch, status); }
|
||||||
static inline bool chan_rcvd_exit_signal(
|
static inline bool chan_rcvd_exit_signal(
|
||||||
Channel *ch, ptrlen sig, bool core, ptrlen msg)
|
Channel *ch, ptrlen sig, bool core, ptrlen msg)
|
||||||
{ return ch->vt->rcvd_exit_signal(ch, sig, core, msg); }
|
{ return ch->vt->rcvd_exit_signal(ch, sig, core, msg); }
|
||||||
static inline bool chan_rcvd_exit_signal_numeric(
|
static inline bool chan_rcvd_exit_signal_numeric(
|
||||||
Channel *ch, int sig, bool core, ptrlen msg)
|
Channel *ch, int sig, bool core, ptrlen msg)
|
||||||
{ return ch->vt->rcvd_exit_signal_numeric(ch, sig, core, msg); }
|
{ return ch->vt->rcvd_exit_signal_numeric(ch, sig, core, msg); }
|
||||||
static inline bool chan_run_shell(Channel *ch)
|
static inline bool chan_run_shell(Channel *ch)
|
||||||
{ return ch->vt->run_shell(ch); }
|
{ return ch->vt->run_shell(ch); }
|
||||||
|
@ -113,15 +113,15 @@ bool ssh1_handle_direction_specific_packet(
|
|||||||
BinarySource_UPCAST(pktin), 1);
|
BinarySource_UPCAST(pktin), 1);
|
||||||
|
|
||||||
if (get_err(pktin)) {
|
if (get_err(pktin)) {
|
||||||
ppl_logevent("Unable to decode pty request packet");
|
ppl_logevent("Unable to decode pty request packet");
|
||||||
success = false;
|
success = false;
|
||||||
} else if (!chan_allocate_pty(
|
} else if (!chan_allocate_pty(
|
||||||
s->mainchan_chan, termtype, width, height,
|
s->mainchan_chan, termtype, width, height,
|
||||||
pixwidth, pixheight, modes)) {
|
pixwidth, pixheight, modes)) {
|
||||||
ppl_logevent("Unable to allocate a pty");
|
ppl_logevent("Unable to allocate a pty");
|
||||||
success = false;
|
success = false;
|
||||||
} else {
|
} else {
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
pktout = ssh_bpp_new_pktout(
|
pktout = ssh_bpp_new_pktout(
|
||||||
|
@ -1565,8 +1565,8 @@ static void ssh2_delete_sharing_channel(ConnectionLayer *cl, unsigned localid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void ssh2_send_packet_from_downstream(
|
static void ssh2_send_packet_from_downstream(
|
||||||
ConnectionLayer *cl, unsigned id, int type,
|
ConnectionLayer *cl, unsigned id, int type,
|
||||||
const void *data, int datalen, const char *additional_log_text)
|
const void *data, int datalen, const char *additional_log_text)
|
||||||
{
|
{
|
||||||
struct ssh2_connection_state *s =
|
struct ssh2_connection_state *s =
|
||||||
container_of(cl, struct ssh2_connection_state, cl);
|
container_of(cl, struct ssh2_connection_state, cl);
|
||||||
|
@ -1073,7 +1073,7 @@ static int sblines(Terminal *term)
|
|||||||
int sblines = count234(term->scrollback);
|
int sblines = count234(term->scrollback);
|
||||||
if (term->erase_to_scrollback &&
|
if (term->erase_to_scrollback &&
|
||||||
term->alt_which && term->alt_screen) {
|
term->alt_which && term->alt_screen) {
|
||||||
sblines += term->alt_sblines;
|
sblines += term->alt_sblines;
|
||||||
}
|
}
|
||||||
return sblines;
|
return sblines;
|
||||||
}
|
}
|
||||||
|
@ -10,34 +10,34 @@ static const TermWinVtable fuzz_termwin_vt;
|
|||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
char blk[512];
|
char blk[512];
|
||||||
size_t len;
|
size_t len;
|
||||||
Terminal *term;
|
Terminal *term;
|
||||||
Conf *conf;
|
Conf *conf;
|
||||||
struct unicode_data ucsdata;
|
struct unicode_data ucsdata;
|
||||||
TermWin termwin;
|
TermWin termwin;
|
||||||
|
|
||||||
termwin.vt = &fuzz_termwin_vt;
|
termwin.vt = &fuzz_termwin_vt;
|
||||||
|
|
||||||
conf = conf_new();
|
conf = conf_new();
|
||||||
do_defaults(NULL, conf);
|
do_defaults(NULL, conf);
|
||||||
init_ucs(&ucsdata, conf_get_str(conf, CONF_line_codepage),
|
init_ucs(&ucsdata, conf_get_str(conf, CONF_line_codepage),
|
||||||
conf_get_bool(conf, CONF_utf8_override),
|
conf_get_bool(conf, CONF_utf8_override),
|
||||||
CS_NONE, conf_get_int(conf, CONF_vtmode));
|
CS_NONE, conf_get_int(conf, CONF_vtmode));
|
||||||
|
|
||||||
term = term_init(conf, &ucsdata, &termwin);
|
term = term_init(conf, &ucsdata, &termwin);
|
||||||
term_size(term, 24, 80, 10000);
|
term_size(term, 24, 80, 10000);
|
||||||
term->ldisc = NULL;
|
term->ldisc = NULL;
|
||||||
/* Tell american fuzzy lop that this is a good place to fork. */
|
/* Tell american fuzzy lop that this is a good place to fork. */
|
||||||
#ifdef __AFL_HAVE_MANUAL_CONTROL
|
#ifdef __AFL_HAVE_MANUAL_CONTROL
|
||||||
__AFL_INIT();
|
__AFL_INIT();
|
||||||
#endif
|
#endif
|
||||||
while (!feof(stdin)) {
|
while (!feof(stdin)) {
|
||||||
len = fread(blk, 1, sizeof(blk), stdin);
|
len = fread(blk, 1, sizeof(blk), stdin);
|
||||||
term_data(term, blk, len);
|
term_data(term, blk, len);
|
||||||
}
|
}
|
||||||
term_update(term);
|
term_update(term);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* functions required by terminal.c */
|
/* functions required by terminal.c */
|
||||||
|
@ -479,20 +479,20 @@ static dr_emit_flags_t instrument_instr(
|
|||||||
*/
|
*/
|
||||||
opnd_t shiftcount = instr_get_src(instr, 0);
|
opnd_t shiftcount = instr_get_src(instr, 0);
|
||||||
if (!opnd_is_immed(shiftcount)) {
|
if (!opnd_is_immed(shiftcount)) {
|
||||||
reg_id_t r0;
|
reg_id_t r0;
|
||||||
drreg_status_t st;
|
drreg_status_t st;
|
||||||
st = drreg_reserve_register(drcontext, bb, instr, NULL, &r0);
|
st = drreg_reserve_register(drcontext, bb, instr, NULL, &r0);
|
||||||
DR_ASSERT(st == DRREG_SUCCESS);
|
DR_ASSERT(st == DRREG_SUCCESS);
|
||||||
opnd_t op_r0 = opnd_create_reg(r0);
|
opnd_t op_r0 = opnd_create_reg(r0);
|
||||||
instr_t *movzx = INSTR_CREATE_movzx(drcontext, op_r0, shiftcount);
|
instr_t *movzx = INSTR_CREATE_movzx(drcontext, op_r0, shiftcount);
|
||||||
instr_set_translation(movzx, instr_get_app_pc(instr));
|
instr_set_translation(movzx, instr_get_app_pc(instr));
|
||||||
instrlist_preinsert(bb, instr, movzx);
|
instrlist_preinsert(bb, instr, movzx);
|
||||||
instr_format_location(instr, &loc);
|
instr_format_location(instr, &loc);
|
||||||
dr_insert_clean_call(
|
dr_insert_clean_call(
|
||||||
drcontext, bb, instr, (void *)log_var_shift, false,
|
drcontext, bb, instr, (void *)log_var_shift, false,
|
||||||
2, op_r0, OPND_CREATE_INTPTR(loc));
|
2, op_r0, OPND_CREATE_INTPTR(loc));
|
||||||
st = drreg_unreserve_register(drcontext, bb, instr, r0);
|
st = drreg_unreserve_register(drcontext, bb, instr, r0);
|
||||||
DR_ASSERT(st == DRREG_SUCCESS);
|
DR_ASSERT(st == DRREG_SUCCESS);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -150,9 +150,9 @@ static int cmpfortree(void *av, void *bv)
|
|||||||
if (as > bs)
|
if (as > bs)
|
||||||
return +1;
|
return +1;
|
||||||
if (a < b)
|
if (a < b)
|
||||||
return -1;
|
return -1;
|
||||||
if (a > b)
|
if (a > b)
|
||||||
return +1;
|
return +1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -655,14 +655,14 @@ static int try_connect(NetSocket *sock)
|
|||||||
} else {
|
} else {
|
||||||
err = errno;
|
err = errno;
|
||||||
if (err != EADDRINUSE) /* failed, for a bad reason */
|
if (err != EADDRINUSE) /* failed, for a bad reason */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (localport == 0)
|
if (localport == 0)
|
||||||
break; /* we're only looping once */
|
break; /* we're only looping once */
|
||||||
localport--;
|
localport--;
|
||||||
if (localport == 0)
|
if (localport == 0)
|
||||||
break; /* we might have got to the end */
|
break; /* we might have got to the end */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (err)
|
if (err)
|
||||||
|
98
unix/plink.c
98
unix/plink.c
@ -442,57 +442,57 @@ static void from_tty(void *vbuf, unsigned len)
|
|||||||
p = buf; end = buf + len;
|
p = buf; end = buf + len;
|
||||||
while (p < end) {
|
while (p < end) {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case NORMAL:
|
case NORMAL:
|
||||||
if (*p == '\xff') {
|
if (*p == '\xff') {
|
||||||
p++;
|
p++;
|
||||||
state = FF;
|
state = FF;
|
||||||
} else {
|
} else {
|
||||||
q = memchr(p, '\xff', end - p);
|
q = memchr(p, '\xff', end - p);
|
||||||
if (q == NULL) q = end;
|
if (q == NULL) q = end;
|
||||||
backend_send(backend, p, q - p);
|
backend_send(backend, p, q - p);
|
||||||
p = q;
|
p = q;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case FF:
|
case FF:
|
||||||
if (*p == '\xff') {
|
if (*p == '\xff') {
|
||||||
backend_send(backend, p, 1);
|
backend_send(backend, p, 1);
|
||||||
p++;
|
|
||||||
state = NORMAL;
|
|
||||||
} else if (*p == '\0') {
|
|
||||||
p++;
|
|
||||||
state = FF00;
|
|
||||||
} else abort();
|
|
||||||
break;
|
|
||||||
case FF00:
|
|
||||||
if (*p == '\0') {
|
|
||||||
backend_special(backend, SS_BRK, 0);
|
|
||||||
} else {
|
|
||||||
/*
|
|
||||||
* Pretend that PARMRK wasn't set. This involves
|
|
||||||
* faking what INPCK and IGNPAR would have done if
|
|
||||||
* we hadn't overridden them. Unfortunately, we
|
|
||||||
* can't do this entirely correctly because INPCK
|
|
||||||
* distinguishes between framing and parity
|
|
||||||
* errors, but PARMRK format represents both in
|
|
||||||
* the same way. We assume that parity errors are
|
|
||||||
* more common than framing errors, and hence
|
|
||||||
* treat all input errors as being subject to
|
|
||||||
* INPCK.
|
|
||||||
*/
|
|
||||||
if (orig_termios.c_iflag & INPCK) {
|
|
||||||
/* If IGNPAR is set, we throw away the character. */
|
|
||||||
if (!(orig_termios.c_iflag & IGNPAR)) {
|
|
||||||
/* PE/FE get passed on as NUL. */
|
|
||||||
*p = 0;
|
|
||||||
backend_send(backend, p, 1);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* INPCK not set. Assume we got a parity error. */
|
|
||||||
backend_send(backend, p, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
p++;
|
p++;
|
||||||
state = NORMAL;
|
state = NORMAL;
|
||||||
|
} else if (*p == '\0') {
|
||||||
|
p++;
|
||||||
|
state = FF00;
|
||||||
|
} else abort();
|
||||||
|
break;
|
||||||
|
case FF00:
|
||||||
|
if (*p == '\0') {
|
||||||
|
backend_special(backend, SS_BRK, 0);
|
||||||
|
} else {
|
||||||
|
/*
|
||||||
|
* Pretend that PARMRK wasn't set. This involves
|
||||||
|
* faking what INPCK and IGNPAR would have done if
|
||||||
|
* we hadn't overridden them. Unfortunately, we
|
||||||
|
* can't do this entirely correctly because INPCK
|
||||||
|
* distinguishes between framing and parity
|
||||||
|
* errors, but PARMRK format represents both in
|
||||||
|
* the same way. We assume that parity errors are
|
||||||
|
* more common than framing errors, and hence
|
||||||
|
* treat all input errors as being subject to
|
||||||
|
* INPCK.
|
||||||
|
*/
|
||||||
|
if (orig_termios.c_iflag & INPCK) {
|
||||||
|
/* If IGNPAR is set, we throw away the character. */
|
||||||
|
if (!(orig_termios.c_iflag & IGNPAR)) {
|
||||||
|
/* PE/FE get passed on as NUL. */
|
||||||
|
*p = 0;
|
||||||
|
backend_send(backend, p, 1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* INPCK not set. Assume we got a parity error. */
|
||||||
|
backend_send(backend, p, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
p++;
|
||||||
|
state = NORMAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -582,9 +582,9 @@ static INT_PTR GenericMainDlgProc(HWND hwnd, UINT msg, WPARAM wParam,
|
|||||||
|
|
||||||
c = strrchr(s->pathname, '/');
|
c = strrchr(s->pathname, '/');
|
||||||
if (!c)
|
if (!c)
|
||||||
c = s->pathname;
|
c = s->pathname;
|
||||||
else
|
else
|
||||||
c++;
|
c++;
|
||||||
|
|
||||||
item = treeview_insert(&tvfaff, j, c, s->pathname);
|
item = treeview_insert(&tvfaff, j, c, s->pathname);
|
||||||
if (!hfirst) {
|
if (!hfirst) {
|
||||||
|
@ -716,10 +716,10 @@ void remove_session_from_jumplist(const char * const sessionname)
|
|||||||
|
|
||||||
bool set_explicit_app_user_model_id(void)
|
bool set_explicit_app_user_model_id(void)
|
||||||
{
|
{
|
||||||
DECL_WINDOWS_FUNCTION(static, HRESULT, SetCurrentProcessExplicitAppUserModelID,
|
DECL_WINDOWS_FUNCTION(
|
||||||
(PCWSTR));
|
static, HRESULT, SetCurrentProcessExplicitAppUserModelID, (PCWSTR));
|
||||||
|
|
||||||
static HMODULE shell32_module = 0;
|
static HMODULE shell32_module = 0;
|
||||||
|
|
||||||
if (!shell32_module)
|
if (!shell32_module)
|
||||||
{
|
{
|
||||||
@ -738,7 +738,7 @@ bool set_explicit_app_user_model_id(void)
|
|||||||
const wchar_t *id = get_app_user_model_id();
|
const wchar_t *id = get_app_user_model_id();
|
||||||
if (p_SetCurrentProcessExplicitAppUserModelID(id) == S_OK)
|
if (p_SetCurrentProcessExplicitAppUserModelID(id) == S_OK)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -927,7 +927,7 @@ static DWORD try_connect(NetSocket *sock)
|
|||||||
goto ret;
|
goto ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetHandleInformation((HANDLE)s, HANDLE_FLAG_INHERIT, 0);
|
SetHandleInformation((HANDLE)s, HANDLE_FLAG_INHERIT, 0);
|
||||||
|
|
||||||
if (sock->oobinline) {
|
if (sock->oobinline) {
|
||||||
BOOL b = true;
|
BOOL b = true;
|
||||||
@ -1708,9 +1708,9 @@ void select_result(WPARAM wParam, LPARAM lParam)
|
|||||||
t = p_accept(s->s,(struct sockaddr *)&isa,&addrlen);
|
t = p_accept(s->s,(struct sockaddr *)&isa,&addrlen);
|
||||||
if (t == INVALID_SOCKET)
|
if (t == INVALID_SOCKET)
|
||||||
{
|
{
|
||||||
err = p_WSAGetLastError();
|
err = p_WSAGetLastError();
|
||||||
if (err == WSATRY_AGAIN)
|
if (err == WSATRY_AGAIN)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
actx.p = (void *)t;
|
actx.p = (void *)t;
|
||||||
@ -1723,9 +1723,9 @@ void select_result(WPARAM wParam, LPARAM lParam)
|
|||||||
if (s->localhost_only && !ipv4_is_local_addr(isa.sin_addr))
|
if (s->localhost_only && !ipv4_is_local_addr(isa.sin_addr))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
p_closesocket(t); /* dodgy WinSock let nonlocal through */
|
p_closesocket(t); /* dodgy WinSock let nonlocal through */
|
||||||
} else if (plug_accepting(s->plug, sk_net_accept, actx)) {
|
} else if (plug_accepting(s->plug, sk_net_accept, actx)) {
|
||||||
p_closesocket(t); /* denied or error */
|
p_closesocket(t); /* denied or error */
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -622,9 +622,9 @@ static INT_PTR CALLBACK KeyListProc(HWND hwnd, UINT msg,
|
|||||||
GetWindowLongPtr(hwnd, GWL_EXSTYLE) |
|
GetWindowLongPtr(hwnd, GWL_EXSTYLE) |
|
||||||
WS_EX_CONTEXTHELP);
|
WS_EX_CONTEXTHELP);
|
||||||
else {
|
else {
|
||||||
HWND item = GetDlgItem(hwnd, IDC_KEYLIST_HELP);
|
HWND item = GetDlgItem(hwnd, IDC_KEYLIST_HELP);
|
||||||
if (item)
|
if (item)
|
||||||
DestroyWindow(item);
|
DestroyWindow(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
keylist = hwnd;
|
keylist = hwnd;
|
||||||
@ -852,9 +852,9 @@ static INT_PTR CALLBACK KeyListProc(HWND hwnd, UINT msg,
|
|||||||
topic = WINHELP_CTX_pageant_deferred; break;
|
topic = WINHELP_CTX_pageant_deferred; break;
|
||||||
}
|
}
|
||||||
if (topic) {
|
if (topic) {
|
||||||
launch_help(hwnd, topic);
|
launch_help(hwnd, topic);
|
||||||
} else {
|
} else {
|
||||||
MessageBeep(0);
|
MessageBeep(0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1312,8 +1312,8 @@ static LRESULT CALLBACK TrayWndProc(HWND hwnd, UINT message,
|
|||||||
|
|
||||||
if((INT_PTR)ShellExecute(hwnd, NULL, putty_path, cmdline,
|
if((INT_PTR)ShellExecute(hwnd, NULL, putty_path, cmdline,
|
||||||
_T(""), SW_SHOW) <= 32) {
|
_T(""), SW_SHOW) <= 32) {
|
||||||
MessageBox(NULL, "Unable to execute PuTTY!",
|
MessageBox(NULL, "Unable to execute PuTTY!",
|
||||||
"Error", MB_OK | MB_ICONERROR);
|
"Error", MB_OK | MB_ICONERROR);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1371,25 +1371,25 @@ static LRESULT CALLBACK TrayWndProc(HWND hwnd, UINT message,
|
|||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
if(wParam >= IDM_SESSIONS_BASE && wParam <= IDM_SESSIONS_MAX) {
|
if(wParam >= IDM_SESSIONS_BASE && wParam <= IDM_SESSIONS_MAX) {
|
||||||
MENUITEMINFO mii;
|
MENUITEMINFO mii;
|
||||||
TCHAR buf[MAX_PATH + 1];
|
TCHAR buf[MAX_PATH + 1];
|
||||||
TCHAR param[MAX_PATH + 1];
|
TCHAR param[MAX_PATH + 1];
|
||||||
memset(&mii, 0, sizeof(mii));
|
memset(&mii, 0, sizeof(mii));
|
||||||
mii.cbSize = sizeof(mii);
|
mii.cbSize = sizeof(mii);
|
||||||
mii.fMask = MIIM_TYPE;
|
mii.fMask = MIIM_TYPE;
|
||||||
mii.cch = MAX_PATH;
|
mii.cch = MAX_PATH;
|
||||||
mii.dwTypeData = buf;
|
mii.dwTypeData = buf;
|
||||||
GetMenuItemInfo(session_menu, wParam, false, &mii);
|
GetMenuItemInfo(session_menu, wParam, false, &mii);
|
||||||
param[0] = '\0';
|
param[0] = '\0';
|
||||||
if (restrict_putty_acl)
|
if (restrict_putty_acl)
|
||||||
strcat(param, "&R");
|
strcat(param, "&R");
|
||||||
strcat(param, "@");
|
strcat(param, "@");
|
||||||
strcat(param, mii.dwTypeData);
|
strcat(param, mii.dwTypeData);
|
||||||
if((INT_PTR)ShellExecute(hwnd, NULL, putty_path, param,
|
if((INT_PTR)ShellExecute(hwnd, NULL, putty_path, param,
|
||||||
_T(""), SW_SHOW) <= 32) {
|
_T(""), SW_SHOW) <= 32) {
|
||||||
MessageBox(NULL, "Unable to execute PuTTY!", "Error",
|
MessageBox(NULL, "Unable to execute PuTTY!", "Error",
|
||||||
MB_OK | MB_ICONERROR);
|
MB_OK | MB_ICONERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1425,10 +1425,10 @@ static LRESULT CALLBACK wm_copydata_WndProc(HWND hwnd, UINT message,
|
|||||||
err = answer_filemapping_message(mapname);
|
err = answer_filemapping_message(mapname);
|
||||||
if (err) {
|
if (err) {
|
||||||
#ifdef DEBUG_IPC
|
#ifdef DEBUG_IPC
|
||||||
debug("IPC failed: %s\n", err);
|
debug("IPC failed: %s\n", err);
|
||||||
#endif
|
#endif
|
||||||
sfree(err);
|
sfree(err);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -438,9 +438,9 @@ static INT_PTR CALLBACK PPKParamsProc(HWND hwnd, UINT msg,
|
|||||||
topic = WINHELP_CTX_puttygen_kdfparam; break;
|
topic = WINHELP_CTX_puttygen_kdfparam; break;
|
||||||
}
|
}
|
||||||
if (topic) {
|
if (topic) {
|
||||||
launch_help(hwnd, topic);
|
launch_help(hwnd, topic);
|
||||||
} else {
|
} else {
|
||||||
MessageBeep(0);
|
MessageBeep(0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2353,9 +2353,9 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg,
|
|||||||
topic = WINHELP_CTX_puttygen_conversions; break;
|
topic = WINHELP_CTX_puttygen_conversions; break;
|
||||||
}
|
}
|
||||||
if (topic) {
|
if (topic) {
|
||||||
launch_help(hwnd, topic);
|
launch_help(hwnd, topic);
|
||||||
} else {
|
} else {
|
||||||
MessageBeep(0);
|
MessageBeep(0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -175,7 +175,7 @@ bool make_private_security_descriptor(DWORD permissions,
|
|||||||
*error = NULL;
|
*error = NULL;
|
||||||
|
|
||||||
if (!getsids(error))
|
if (!getsids(error))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
memset(ea, 0, sizeof(ea));
|
memset(ea, 0, sizeof(ea));
|
||||||
ea[0].grfAccessPermissions = permissions;
|
ea[0].grfAccessPermissions = permissions;
|
||||||
|
382
windows/window.c
382
windows/window.c
@ -1923,7 +1923,7 @@ static void reset_window(int reinit) {
|
|||||||
static RECT ss;
|
static RECT ss;
|
||||||
int width, height;
|
int width, height;
|
||||||
|
|
||||||
get_fullscreen_rect(&ss);
|
get_fullscreen_rect(&ss);
|
||||||
|
|
||||||
width = (ss.right - ss.left - extra_width) / font_width;
|
width = (ss.right - ss.left - extra_width) / font_width;
|
||||||
height = (ss.bottom - ss.top - extra_height) / font_height;
|
height = (ss.bottom - ss.top - extra_height) / font_height;
|
||||||
@ -2283,52 +2283,52 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
|||||||
argprefix = "";
|
argprefix = "";
|
||||||
|
|
||||||
if (wParam == IDM_DUPSESS) {
|
if (wParam == IDM_DUPSESS) {
|
||||||
/*
|
/*
|
||||||
* Allocate a file-mapping memory chunk for the
|
* Allocate a file-mapping memory chunk for the
|
||||||
* config structure.
|
* config structure.
|
||||||
*/
|
*/
|
||||||
SECURITY_ATTRIBUTES sa;
|
SECURITY_ATTRIBUTES sa;
|
||||||
strbuf *serbuf;
|
strbuf *serbuf;
|
||||||
void *p;
|
void *p;
|
||||||
int size;
|
int size;
|
||||||
|
|
||||||
serbuf = strbuf_new();
|
serbuf = strbuf_new();
|
||||||
conf_serialise(BinarySink_UPCAST(serbuf), conf);
|
conf_serialise(BinarySink_UPCAST(serbuf), conf);
|
||||||
size = serbuf->len;
|
size = serbuf->len;
|
||||||
|
|
||||||
sa.nLength = sizeof(sa);
|
sa.nLength = sizeof(sa);
|
||||||
sa.lpSecurityDescriptor = NULL;
|
sa.lpSecurityDescriptor = NULL;
|
||||||
sa.bInheritHandle = true;
|
sa.bInheritHandle = true;
|
||||||
filemap = CreateFileMapping(INVALID_HANDLE_VALUE,
|
filemap = CreateFileMapping(INVALID_HANDLE_VALUE,
|
||||||
&sa,
|
&sa,
|
||||||
PAGE_READWRITE,
|
PAGE_READWRITE,
|
||||||
0, size, NULL);
|
0, size, NULL);
|
||||||
if (filemap && filemap != INVALID_HANDLE_VALUE) {
|
if (filemap && filemap != INVALID_HANDLE_VALUE) {
|
||||||
p = MapViewOfFile(filemap, FILE_MAP_WRITE, 0, 0, size);
|
p = MapViewOfFile(filemap, FILE_MAP_WRITE, 0, 0, size);
|
||||||
if (p) {
|
if (p) {
|
||||||
memcpy(p, serbuf->s, size);
|
memcpy(p, serbuf->s, size);
|
||||||
UnmapViewOfFile(p);
|
UnmapViewOfFile(p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
strbuf_free(serbuf);
|
strbuf_free(serbuf);
|
||||||
inherit_handles = true;
|
inherit_handles = true;
|
||||||
cl = dupprintf("putty %s&%p:%u", argprefix,
|
cl = dupprintf("putty %s&%p:%u", argprefix,
|
||||||
filemap, (unsigned)size);
|
filemap, (unsigned)size);
|
||||||
} else if (wParam == IDM_SAVEDSESS) {
|
} else if (wParam == IDM_SAVEDSESS) {
|
||||||
unsigned int sessno = ((lParam - IDM_SAVED_MIN)
|
unsigned int sessno = ((lParam - IDM_SAVED_MIN)
|
||||||
/ MENU_SAVED_STEP) + 1;
|
/ MENU_SAVED_STEP) + 1;
|
||||||
if (sessno < (unsigned)sesslist.nsessions) {
|
if (sessno < (unsigned)sesslist.nsessions) {
|
||||||
const char *session = sesslist.sessions[sessno];
|
const char *session = sesslist.sessions[sessno];
|
||||||
cl = dupprintf("putty %s@%s", argprefix, session);
|
cl = dupprintf("putty %s@%s", argprefix, session);
|
||||||
inherit_handles = false;
|
inherit_handles = false;
|
||||||
} else
|
} else
|
||||||
break;
|
break;
|
||||||
} else /* IDM_NEWSESS */ {
|
} else /* IDM_NEWSESS */ {
|
||||||
cl = dupprintf("putty%s%s",
|
cl = dupprintf("putty%s%s",
|
||||||
*argprefix ? " " : "",
|
*argprefix ? " " : "",
|
||||||
argprefix);
|
argprefix);
|
||||||
inherit_handles = false;
|
inherit_handles = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetModuleFileName(NULL, b, sizeof(b) - 1);
|
GetModuleFileName(NULL, b, sizeof(b) - 1);
|
||||||
@ -2374,24 +2374,24 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
|||||||
hwnd, conf, backend ? backend_cfg_info(backend) : 0);
|
hwnd, conf, backend ? backend_cfg_info(backend) : 0);
|
||||||
reconfiguring = false;
|
reconfiguring = false;
|
||||||
if (!reconfig_result) {
|
if (!reconfig_result) {
|
||||||
conf_free(prev_conf);
|
conf_free(prev_conf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
conf_cache_data();
|
conf_cache_data();
|
||||||
|
|
||||||
resize_action = conf_get_int(conf, CONF_resize_action);
|
resize_action = conf_get_int(conf, CONF_resize_action);
|
||||||
{
|
{
|
||||||
/* Disable full-screen if resizing forbidden */
|
/* Disable full-screen if resizing forbidden */
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < lenof(popup_menus); i++)
|
for (i = 0; i < lenof(popup_menus); i++)
|
||||||
EnableMenuItem(popup_menus[i].menu, IDM_FULLSCREEN,
|
EnableMenuItem(popup_menus[i].menu, IDM_FULLSCREEN,
|
||||||
MF_BYCOMMAND |
|
MF_BYCOMMAND |
|
||||||
(resize_action == RESIZE_DISABLED
|
(resize_action == RESIZE_DISABLED
|
||||||
? MF_GRAYED : MF_ENABLED));
|
? MF_GRAYED : MF_ENABLED));
|
||||||
/* Gracefully unzoom if necessary */
|
/* Gracefully unzoom if necessary */
|
||||||
if (IsZoomed(hwnd) && (resize_action == RESIZE_DISABLED))
|
if (IsZoomed(hwnd) && (resize_action == RESIZE_DISABLED))
|
||||||
ShowWindow(hwnd, SW_RESTORE);
|
ShowWindow(hwnd, SW_RESTORE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Pass new config data to the logging module */
|
/* Pass new config data to the logging module */
|
||||||
@ -2403,8 +2403,8 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
|||||||
* case where local editing has just been disabled.
|
* case where local editing has just been disabled.
|
||||||
*/
|
*/
|
||||||
if (ldisc) {
|
if (ldisc) {
|
||||||
ldisc_configure(ldisc, conf);
|
ldisc_configure(ldisc, conf);
|
||||||
ldisc_echoedit_update(ldisc);
|
ldisc_echoedit_update(ldisc);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (conf_get_bool(conf, CONF_system_colour) !=
|
if (conf_get_bool(conf, CONF_system_colour) !=
|
||||||
@ -2443,90 +2443,90 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
|||||||
|
|
||||||
/* Enable or disable the scroll bar, etc */
|
/* Enable or disable the scroll bar, etc */
|
||||||
{
|
{
|
||||||
LONG nflg, flag = GetWindowLongPtr(hwnd, GWL_STYLE);
|
LONG nflg, flag = GetWindowLongPtr(hwnd, GWL_STYLE);
|
||||||
LONG nexflag, exflag =
|
LONG nexflag, exflag =
|
||||||
GetWindowLongPtr(hwnd, GWL_EXSTYLE);
|
GetWindowLongPtr(hwnd, GWL_EXSTYLE);
|
||||||
|
|
||||||
nexflag = exflag;
|
nexflag = exflag;
|
||||||
if (conf_get_bool(conf, CONF_alwaysontop) !=
|
if (conf_get_bool(conf, CONF_alwaysontop) !=
|
||||||
conf_get_bool(prev_conf, CONF_alwaysontop)) {
|
conf_get_bool(prev_conf, CONF_alwaysontop)) {
|
||||||
if (conf_get_bool(conf, CONF_alwaysontop)) {
|
if (conf_get_bool(conf, CONF_alwaysontop)) {
|
||||||
nexflag |= WS_EX_TOPMOST;
|
nexflag |= WS_EX_TOPMOST;
|
||||||
SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0,
|
SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0,
|
||||||
SWP_NOMOVE | SWP_NOSIZE);
|
SWP_NOMOVE | SWP_NOSIZE);
|
||||||
} else {
|
} else {
|
||||||
nexflag &= ~(WS_EX_TOPMOST);
|
nexflag &= ~(WS_EX_TOPMOST);
|
||||||
SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0,
|
SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0,
|
||||||
SWP_NOMOVE | SWP_NOSIZE);
|
SWP_NOMOVE | SWP_NOSIZE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
if (conf_get_bool(conf, CONF_sunken_edge))
|
||||||
if (conf_get_bool(conf, CONF_sunken_edge))
|
nexflag |= WS_EX_CLIENTEDGE;
|
||||||
nexflag |= WS_EX_CLIENTEDGE;
|
else
|
||||||
else
|
nexflag &= ~(WS_EX_CLIENTEDGE);
|
||||||
nexflag &= ~(WS_EX_CLIENTEDGE);
|
|
||||||
|
|
||||||
nflg = flag;
|
nflg = flag;
|
||||||
if (conf_get_bool(conf, is_full_screen() ?
|
if (conf_get_bool(conf, is_full_screen() ?
|
||||||
CONF_scrollbar_in_fullscreen :
|
CONF_scrollbar_in_fullscreen :
|
||||||
CONF_scrollbar))
|
CONF_scrollbar))
|
||||||
nflg |= WS_VSCROLL;
|
nflg |= WS_VSCROLL;
|
||||||
else
|
else
|
||||||
nflg &= ~WS_VSCROLL;
|
nflg &= ~WS_VSCROLL;
|
||||||
|
|
||||||
if (resize_action == RESIZE_DISABLED ||
|
if (resize_action == RESIZE_DISABLED ||
|
||||||
is_full_screen())
|
is_full_screen())
|
||||||
nflg &= ~WS_THICKFRAME;
|
nflg &= ~WS_THICKFRAME;
|
||||||
else
|
else
|
||||||
nflg |= WS_THICKFRAME;
|
nflg |= WS_THICKFRAME;
|
||||||
|
|
||||||
if (resize_action == RESIZE_DISABLED)
|
if (resize_action == RESIZE_DISABLED)
|
||||||
nflg &= ~WS_MAXIMIZEBOX;
|
nflg &= ~WS_MAXIMIZEBOX;
|
||||||
else
|
else
|
||||||
nflg |= WS_MAXIMIZEBOX;
|
nflg |= WS_MAXIMIZEBOX;
|
||||||
|
|
||||||
if (nflg != flag || nexflag != exflag) {
|
if (nflg != flag || nexflag != exflag) {
|
||||||
if (nflg != flag)
|
if (nflg != flag)
|
||||||
SetWindowLongPtr(hwnd, GWL_STYLE, nflg);
|
SetWindowLongPtr(hwnd, GWL_STYLE, nflg);
|
||||||
if (nexflag != exflag)
|
if (nexflag != exflag)
|
||||||
SetWindowLongPtr(hwnd, GWL_EXSTYLE, nexflag);
|
SetWindowLongPtr(hwnd, GWL_EXSTYLE, nexflag);
|
||||||
|
|
||||||
SetWindowPos(hwnd, NULL, 0, 0, 0, 0,
|
SetWindowPos(hwnd, NULL, 0, 0, 0, 0,
|
||||||
SWP_NOACTIVATE | SWP_NOCOPYBITS |
|
SWP_NOACTIVATE | SWP_NOCOPYBITS |
|
||||||
SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER |
|
SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER |
|
||||||
SWP_FRAMECHANGED);
|
SWP_FRAMECHANGED);
|
||||||
|
|
||||||
init_lvl = 2;
|
init_lvl = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Oops */
|
/* Oops */
|
||||||
if (resize_action == RESIZE_DISABLED && IsZoomed(hwnd)) {
|
if (resize_action == RESIZE_DISABLED && IsZoomed(hwnd)) {
|
||||||
force_normal(hwnd);
|
force_normal(hwnd);
|
||||||
init_lvl = 2;
|
init_lvl = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
FontSpec *font = conf_get_fontspec(conf, CONF_font);
|
FontSpec *font = conf_get_fontspec(conf, CONF_font);
|
||||||
FontSpec *prev_font = conf_get_fontspec(prev_conf,
|
FontSpec *prev_font = conf_get_fontspec(prev_conf,
|
||||||
CONF_font);
|
CONF_font);
|
||||||
|
|
||||||
if (!strcmp(font->name, prev_font->name) ||
|
if (!strcmp(font->name, prev_font->name) ||
|
||||||
!strcmp(conf_get_str(conf, CONF_line_codepage),
|
!strcmp(conf_get_str(conf, CONF_line_codepage),
|
||||||
conf_get_str(prev_conf, CONF_line_codepage)) ||
|
conf_get_str(prev_conf, CONF_line_codepage)) ||
|
||||||
font->isbold != prev_font->isbold ||
|
font->isbold != prev_font->isbold ||
|
||||||
font->height != prev_font->height ||
|
font->height != prev_font->height ||
|
||||||
font->charset != prev_font->charset ||
|
font->charset != prev_font->charset ||
|
||||||
conf_get_int(conf, CONF_font_quality) !=
|
conf_get_int(conf, CONF_font_quality) !=
|
||||||
conf_get_int(prev_conf, CONF_font_quality) ||
|
conf_get_int(prev_conf, CONF_font_quality) ||
|
||||||
conf_get_int(conf, CONF_vtmode) !=
|
conf_get_int(conf, CONF_vtmode) !=
|
||||||
conf_get_int(prev_conf, CONF_vtmode) ||
|
conf_get_int(prev_conf, CONF_vtmode) ||
|
||||||
conf_get_int(conf, CONF_bold_style) !=
|
conf_get_int(conf, CONF_bold_style) !=
|
||||||
conf_get_int(prev_conf, CONF_bold_style) ||
|
conf_get_int(prev_conf, CONF_bold_style) ||
|
||||||
resize_action == RESIZE_DISABLED ||
|
resize_action == RESIZE_DISABLED ||
|
||||||
resize_action == RESIZE_EITHER ||
|
resize_action == RESIZE_EITHER ||
|
||||||
resize_action != conf_get_int(prev_conf,
|
resize_action != conf_get_int(prev_conf,
|
||||||
CONF_resize_action))
|
CONF_resize_action))
|
||||||
init_lvl = 2;
|
init_lvl = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
InvalidateRect(hwnd, NULL, true);
|
InvalidateRect(hwnd, NULL, true);
|
||||||
@ -2734,9 +2734,9 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
|||||||
static LPARAM lp = 0;
|
static LPARAM lp = 0;
|
||||||
if (wParam != wp || lParam != lp ||
|
if (wParam != wp || lParam != lp ||
|
||||||
last_mousemove != WM_MOUSEMOVE) {
|
last_mousemove != WM_MOUSEMOVE) {
|
||||||
show_mouseptr(true);
|
show_mouseptr(true);
|
||||||
wp = wParam; lp = lParam;
|
wp = wParam; lp = lParam;
|
||||||
last_mousemove = WM_MOUSEMOVE;
|
last_mousemove = WM_MOUSEMOVE;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Add the mouse position and message time to the random
|
* Add the mouse position and message time to the random
|
||||||
@ -2765,9 +2765,9 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
|||||||
static LPARAM lp = 0;
|
static LPARAM lp = 0;
|
||||||
if (wParam != wp || lParam != lp ||
|
if (wParam != wp || lParam != lp ||
|
||||||
last_mousemove != WM_NCMOUSEMOVE) {
|
last_mousemove != WM_NCMOUSEMOVE) {
|
||||||
show_mouseptr(true);
|
show_mouseptr(true);
|
||||||
wp = wParam; lp = lParam;
|
wp = wParam; lp = lParam;
|
||||||
last_mousemove = WM_NCMOUSEMOVE;
|
last_mousemove = WM_NCMOUSEMOVE;
|
||||||
}
|
}
|
||||||
noise_ultralight(NOISE_SOURCE_MOUSEPOS, lParam);
|
noise_ultralight(NOISE_SOURCE_MOUSEPOS, lParam);
|
||||||
break;
|
break;
|
||||||
@ -2786,8 +2786,8 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
|||||||
HideCaret(hwnd);
|
HideCaret(hwnd);
|
||||||
hdc = BeginPaint(hwnd, &p);
|
hdc = BeginPaint(hwnd, &p);
|
||||||
if (pal) {
|
if (pal) {
|
||||||
SelectPalette(hdc, pal, true);
|
SelectPalette(hdc, pal, true);
|
||||||
RealizePalette(hdc);
|
RealizePalette(hdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2838,40 +2838,40 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
|||||||
p.rcPaint.right >= offset_width + font_width*term->cols ||
|
p.rcPaint.right >= offset_width + font_width*term->cols ||
|
||||||
p.rcPaint.bottom>= offset_height + font_height*term->rows)
|
p.rcPaint.bottom>= offset_height + font_height*term->rows)
|
||||||
{
|
{
|
||||||
HBRUSH fillcolour, oldbrush;
|
HBRUSH fillcolour, oldbrush;
|
||||||
HPEN edge, oldpen;
|
HPEN edge, oldpen;
|
||||||
fillcolour = CreateSolidBrush (
|
fillcolour = CreateSolidBrush (
|
||||||
colours[ATTR_DEFBG>>ATTR_BGSHIFT]);
|
colours[ATTR_DEFBG>>ATTR_BGSHIFT]);
|
||||||
oldbrush = SelectObject(hdc, fillcolour);
|
oldbrush = SelectObject(hdc, fillcolour);
|
||||||
edge = CreatePen(PS_SOLID, 0,
|
edge = CreatePen(PS_SOLID, 0,
|
||||||
colours[ATTR_DEFBG>>ATTR_BGSHIFT]);
|
colours[ATTR_DEFBG>>ATTR_BGSHIFT]);
|
||||||
oldpen = SelectObject(hdc, edge);
|
oldpen = SelectObject(hdc, edge);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Jordan Russell reports that this apparently
|
* Jordan Russell reports that this apparently
|
||||||
* ineffectual IntersectClipRect() call masks a
|
* ineffectual IntersectClipRect() call masks a
|
||||||
* Windows NT/2K bug causing strange display
|
* Windows NT/2K bug causing strange display
|
||||||
* problems when the PuTTY window is taller than
|
* problems when the PuTTY window is taller than
|
||||||
* the primary monitor. It seems harmless enough...
|
* the primary monitor. It seems harmless enough...
|
||||||
*/
|
*/
|
||||||
IntersectClipRect(hdc,
|
IntersectClipRect(hdc,
|
||||||
p.rcPaint.left, p.rcPaint.top,
|
p.rcPaint.left, p.rcPaint.top,
|
||||||
p.rcPaint.right, p.rcPaint.bottom);
|
p.rcPaint.right, p.rcPaint.bottom);
|
||||||
|
|
||||||
ExcludeClipRect(hdc,
|
ExcludeClipRect(hdc,
|
||||||
offset_width, offset_height,
|
offset_width, offset_height,
|
||||||
offset_width+font_width*term->cols,
|
offset_width+font_width*term->cols,
|
||||||
offset_height+font_height*term->rows);
|
offset_height+font_height*term->rows);
|
||||||
|
|
||||||
Rectangle(hdc, p.rcPaint.left, p.rcPaint.top,
|
Rectangle(hdc, p.rcPaint.left, p.rcPaint.top,
|
||||||
p.rcPaint.right, p.rcPaint.bottom);
|
p.rcPaint.right, p.rcPaint.bottom);
|
||||||
|
|
||||||
/* SelectClipRgn(hdc, NULL); */
|
/* SelectClipRgn(hdc, NULL); */
|
||||||
|
|
||||||
SelectObject(hdc, oldbrush);
|
SelectObject(hdc, oldbrush);
|
||||||
DeleteObject(fillcolour);
|
DeleteObject(fillcolour);
|
||||||
SelectObject(hdc, oldpen);
|
SelectObject(hdc, oldpen);
|
||||||
DeleteObject(edge);
|
DeleteObject(edge);
|
||||||
}
|
}
|
||||||
SelectObject(hdc, GetStockObject(SYSTEM_FONT));
|
SelectObject(hdc, GetStockObject(SYSTEM_FONT));
|
||||||
SelectObject(hdc, GetStockObject(WHITE_PEN));
|
SelectObject(hdc, GetStockObject(WHITE_PEN));
|
||||||
@ -3314,33 +3314,33 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
|||||||
n = ImmGetCompositionStringW(hIMC, GCS_RESULTSTR, NULL, 0);
|
n = ImmGetCompositionStringW(hIMC, GCS_RESULTSTR, NULL, 0);
|
||||||
|
|
||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
int i;
|
int i;
|
||||||
buff = snewn(n, char);
|
buff = snewn(n, char);
|
||||||
ImmGetCompositionStringW(hIMC, GCS_RESULTSTR, buff, n);
|
ImmGetCompositionStringW(hIMC, GCS_RESULTSTR, buff, n);
|
||||||
/*
|
/*
|
||||||
* Jaeyoun Chung reports that Korean character
|
* Jaeyoun Chung reports that Korean character
|
||||||
* input doesn't work correctly if we do a single
|
* input doesn't work correctly if we do a single
|
||||||
* term_keyinputw covering the whole of buff. So
|
* term_keyinputw covering the whole of buff. So
|
||||||
* instead we send the characters one by one.
|
* instead we send the characters one by one.
|
||||||
*/
|
*/
|
||||||
/* don't divide SURROGATE PAIR */
|
/* don't divide SURROGATE PAIR */
|
||||||
if (ldisc) {
|
if (ldisc) {
|
||||||
for (i = 0; i < n; i += 2) {
|
for (i = 0; i < n; i += 2) {
|
||||||
WCHAR hs = *(unsigned short *)(buff+i);
|
WCHAR hs = *(unsigned short *)(buff+i);
|
||||||
if (IS_HIGH_SURROGATE(hs) && i+2 < n) {
|
if (IS_HIGH_SURROGATE(hs) && i+2 < n) {
|
||||||
WCHAR ls = *(unsigned short *)(buff+i+2);
|
WCHAR ls = *(unsigned short *)(buff+i+2);
|
||||||
if (IS_LOW_SURROGATE(ls)) {
|
if (IS_LOW_SURROGATE(ls)) {
|
||||||
term_keyinputw(
|
term_keyinputw(
|
||||||
term, (unsigned short *)(buff+i), 2);
|
term, (unsigned short *)(buff+i), 2);
|
||||||
i += 2;
|
i += 2;
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
term_keyinputw(
|
||||||
|
term, (unsigned short *)(buff+i), 1);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
term_keyinputw(
|
|
||||||
term, (unsigned short *)(buff+i), 1);
|
|
||||||
}
|
}
|
||||||
}
|
free(buff);
|
||||||
free(buff);
|
|
||||||
}
|
}
|
||||||
ImmReleaseContext(hwnd, hIMC);
|
ImmReleaseContext(hwnd, hIMC);
|
||||||
return 1;
|
return 1;
|
||||||
@ -5688,7 +5688,7 @@ static void wintw_move(TermWin *tw, int x, int y)
|
|||||||
if (resize_action == RESIZE_DISABLED ||
|
if (resize_action == RESIZE_DISABLED ||
|
||||||
resize_action == RESIZE_FONT ||
|
resize_action == RESIZE_FONT ||
|
||||||
IsZoomed(wgs.term_hwnd))
|
IsZoomed(wgs.term_hwnd))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SetWindowPos(wgs.term_hwnd, NULL, x, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
|
SetWindowPos(wgs.term_hwnd, NULL, x, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
|
||||||
}
|
}
|
||||||
@ -5763,7 +5763,7 @@ static bool get_fullscreen_rect(RECT * ss)
|
|||||||
ss->right = GetSystemMetrics(SM_CXSCREEN);
|
ss->right = GetSystemMetrics(SM_CXSCREEN);
|
||||||
ss->bottom = GetSystemMetrics(SM_CYSCREEN);
|
ss->bottom = GetSystemMetrics(SM_CYSCREEN);
|
||||||
*/
|
*/
|
||||||
return GetClientRect(GetDesktopWindow(), ss);
|
return GetClientRect(GetDesktopWindow(), ss);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -5774,12 +5774,12 @@ static bool get_fullscreen_rect(RECT * ss)
|
|||||||
static void make_full_screen()
|
static void make_full_screen()
|
||||||
{
|
{
|
||||||
DWORD style;
|
DWORD style;
|
||||||
RECT ss;
|
RECT ss;
|
||||||
|
|
||||||
assert(IsZoomed(wgs.term_hwnd));
|
assert(IsZoomed(wgs.term_hwnd));
|
||||||
|
|
||||||
if (is_full_screen())
|
if (is_full_screen())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Remove the window furniture. */
|
/* Remove the window furniture. */
|
||||||
style = GetWindowLongPtr(wgs.term_hwnd, GWL_STYLE);
|
style = GetWindowLongPtr(wgs.term_hwnd, GWL_STYLE);
|
||||||
@ -5791,7 +5791,7 @@ static void make_full_screen()
|
|||||||
SetWindowLongPtr(wgs.term_hwnd, GWL_STYLE, style);
|
SetWindowLongPtr(wgs.term_hwnd, GWL_STYLE, style);
|
||||||
|
|
||||||
/* Resize ourselves to exactly cover the nearest monitor. */
|
/* Resize ourselves to exactly cover the nearest monitor. */
|
||||||
get_fullscreen_rect(&ss);
|
get_fullscreen_rect(&ss);
|
||||||
SetWindowPos(wgs.term_hwnd, HWND_TOP, ss.left, ss.top,
|
SetWindowPos(wgs.term_hwnd, HWND_TOP, ss.left, ss.top,
|
||||||
ss.right - ss.left, ss.bottom - ss.top, SWP_FRAMECHANGED);
|
ss.right - ss.left, ss.bottom - ss.top, SWP_FRAMECHANGED);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user