319{
321 char fullhostname[64];
327 struct passwd *pw;
332 int username_option = 0;
334 int run_count = 0;
337
340
341 This->keylayout = 0x409;
342 This->keyboard_type = 0x4;
343 This->keyboard_subtype = 0x0;
344 This->keyboard_functionkeys = 0xc;
346
347
348
349
351 This->server_depth = -1;
355 This->bitmap_cache_persist_enable =
False;
360 This->polygon_ellipse_orders =
True;
374
375#define NOT_SET -1
382
383#ifdef HAVE_ICONV
385#endif
386
388
389#ifdef HAVE_LOCALE_H
390
393 {
395 }
396
397#endif
399 prompt_password =
False;
402
403 This->num_devices = 0;
404
405#ifdef RDP2VNC
406#define VNCOPT "V:Q:"
407#else
408#define VNCOPT
409#endif
410
412 VNCOPT "Au:L:d:s:c:p:n:k:g:fbBeEmzCDKS:T:NX:a:x:Pr:045h?")) != -1)
413 {
415 {
416#ifdef RDP2VNC
417 case 'V':
419 if (
This->rfb_port < 100)
420 This->rfb_port += 5900;
421 break;
422
423 case 'Q':
425 if (
This->defer_time < 0)
426 This->defer_time = 0;
427 break;
428#endif
429
430 case 'A':
432 break;
433
434 case 'u':
436 username_option = 1;
437 break;
438
439 case 'L':
440#ifdef HAVE_ICONV
442#else
443 error(
"iconv support not available\n");
444#endif
445 break;
446
447 case 'd':
449 break;
450
451 case 's':
453 break;
454
455 case 'c':
457 break;
458
459 case 'p':
461 {
462 prompt_password =
True;
463 break;
464 }
465
468
469
473 break;
474
475 case 'n':
477 break;
478
479 case 'k':
481 break;
482
483 case 'g':
484 geometry_option =
True;
487 {
489 break;
490 }
491
493 if (
This->width <= 0)
494 {
495 error(
"invalid geometry\n");
496 return 1;
497 }
498
501
502 if (
This->height <= 0)
503 {
504 error(
"invalid geometry\n");
505 return 1;
506 }
507
509 {
512 }
513
514 if (*
p ==
'+' || *
p ==
'-')
515 {
516 This->pos |= (*
p ==
'-') ? 2 : 1;
518
519 }
520 if (*
p ==
'+' || *
p ==
'-')
521 {
522 This->pos |= (*
p ==
'-') ? 4 : 1;
524 }
525
526 break;
527
528 case 'f':
530 break;
531
532 case 'b':
534 break;
535
536 case 'B':
538 break;
539
540 case 'e':
542 break;
543 case 'E':
545 break;
546 case 'm':
548 break;
549
550 case 'C':
552 break;
553
554 case 'D':
556 break;
557
558 case 'K':
560 break;
561
562 case 'S':
564 {
565 This->win_button_size = 18;
566 break;
567 }
568
570
572 {
573 error(
"invalid button size\n");
574 return 1;
575 }
576
577 break;
578
579 case 'T':
581 break;
582
583 case 'N':
585 break;
586
587 case 'X':
589 break;
590
591 case 'a':
593 if (
This->server_depth != 8 &&
594 This->server_depth != 16 &&
595 This->server_depth != 15 &&
This->server_depth != 24)
596 {
597 error(
"Invalid server colour depth.\n");
598 return 1;
599 }
600 break;
601
602 case 'z':
603 DEBUG((
"rdp compression enabled\n"));
605 break;
606
607 case 'x':
609 {
610 This->rdp5_performanceflags =
613 }
615 {
617 }
619 {
621 }
622 else
623 {
625 }
626 break;
627
628 case 'P':
629 This->bitmap_cache_persist_enable =
True;
630 break;
631
632 case 'r':
633
635 {
637
639 {
642 {
645
647#ifdef WITH_RDPSND
649#else
650 warning(
"Not compiled with sound support\n");
651#endif
652
654#ifdef WITH_RDPSND
656#else
657 warning(
"Not compiled with sound support\n");
658#endif
659
661 }
662 }
663 else
664 {
665#ifdef WITH_RDPSND
667#else
668 warning(
"Not compiled with sound support\n");
669#endif
670 }
671 }
673 {
674
676 }
678 {
680 }
682 {
684 }
686 {
688 }
690 {
692 }
694 {
697 }
699 {
701
703 {
705
708 else
710 }
711 else
713 }
714 else
715 {
716 warning(
"Unknown -r argument\n\n\tPossible arguments are: comport, disk, lptport, printer, sound, clipboard\n");
717 }
718 break;
719
720 case '0':
722 break;
723
724 case '4':
726 break;
727
728 case '5':
730 break;
731
732 case 'h':
733 case '?':
734 default:
736 return 1;
737 }
738 }
739
741 {
743 return 1;
744 }
745
748
749 if (
This->seamless_rdp)
750 {
751 if (
This->win_button_size)
752 {
753 error(
"You cannot use -S and -A at the same time\n");
754 return 1;
755 }
756 This->rdp5_performanceflags &= ~RDP5_NO_FULLWINDOWDRAG;
757 if (geometry_option)
758 {
759 error(
"You cannot use -g and -A at the same time\n");
760 return 1;
761 }
762 if (
This->fullscreen)
763 {
764 error(
"You cannot use -f and -A at the same time\n");
765 return 1;
766 }
767 if (
This->hide_decorations)
768 {
769 error(
"You cannot use -D and -A at the same time\n");
770 return 1;
771 }
773 {
774 error(
"You cannot use -X and -A at the same time\n");
775 return 1;
776 }
778 {
779 error(
"You cannot use -4 and -A at the same time\n");
780 return 1;
781 }
784 }
785
786 if (!username_option)
787 {
789 if ((pw ==
NULL) || (pw->pw_name ==
NULL))
790 {
791 error(
"could not determine username, use -u\n");
792 return 1;
793 }
794
796 }
797
798#ifdef HAVE_ICONV
799 if (
This->codepage[0] == 0)
800 {
802 {
804 }
805 else
806 {
808 }
809 }
810#endif
811
812 if (
This->hostname[0] == 0)
813 {
814 if (
gethostname(fullhostname,
sizeof(fullhostname)) == -1)
815 {
816 error(
"could not determine local hostname, use -n\n");
817 return 1;
818 }
819
823
825 }
826
827 if (
This->keymapname[0] == 0)
828 {
830 {
832 }
833 else
834 {
836 }
837 }
840
841
844
845 if (
This->title[0] == 0)
846 {
849 }
850
851#ifdef RDP2VNC
853 return 0;
854#else
855
857 return 1;
858
859#ifdef WITH_RDPSND
860 if (
This->rdpsnd_enabled)
862#endif
863
864 if (
This->lspci_enabled)
866
868
869 while (run_count < 2 && continue_connect)
870 {
871 if (run_count == 0)
872 {
874 return 1;
875 }
878 return 1;
879
880
881
882 if (!
This->packet_encryption)
884
885
886 DEBUG((
"Connection successful.\n"));
888
889 if (run_count == 0)
891 continue_connect =
False;
892
893 if (continue_connect)
895
896 DEBUG((
"Disconnecting...\n"));
898
899 if ((
This->redirect ==
True) && (run_count == 0))
900 {
901
903
909
911 }
912 else
913 {
914 continue_connect =
False;
916 break;
917 }
918
919 run_count++;
920 }
921
924
927
929 {
930
931 return 0;
932 }
933 else
934 {
937 {
938
939 return 0;
940 }
941 else
942 {
943
944 return 2;
945 }
946 }
947
948#endif
949
950}
int strcmp(const char *String1, const char *String2)
char * strncat(char *DstString, const char *SrcString, ACPI_SIZE Count)
char * strchr(const char *String, int ch)
void cache_save_state(void)
#define exDiscReasonAPIInitiatedDisconnect
#define exDiscReasonAPIInitiatedLogoff
int serial_enum_devices(uint32 *id, char *optarg)
void rdp_disconnect(void)
void ui_destroy_window(void)
RD_BOOL rdp_connect(char *server, uint32 flags, char *domain, char *password, char *command, char *directory, RD_BOOL reconnect)
RD_BOOL ui_create_window(void)
RD_BOOL xkeymap_from_locale(const char *locale)
int disk_enum_devices(uint32 *id, char *optarg)
int parallel_enum_devices(uint32 *id, char *optarg)
int printer_enum_devices(uint32 *id, char *optarg)
void cliprdr_set_mode(const char *optarg)
void rdp_main_loop(RD_BOOL *deactivated, uint32 *ext_disc_reason)
RD_BOOL rdpsnd_init(char *optarg)
#define STRNCPY(dst, src, n)
int getopt(int nargc, char *const *nargv, const char *ostr)
void shell(int argc, const char *argv[])
INT WSAAPI gethostname(OUT char FAR *name, IN INT namelen)
GLsizeiptr const GLvoid GLenum usage
_Check_return_ long __cdecl strtol(_In_z_ const char *_Str, _Out_opt_ _Deref_post_z_ char **_EndPtr, _In_ int _Radix)
#define RDP5_NO_MENUANIMATIONS
#define RDP_LOGON_COMPRESSION
#define RDP_LOGON_LEAVE_AUDIO
#define RDP5_DISABLE_NOTHING
#define RDP5_NO_FULLWINDOWDRAG
#define RDP5_NO_WALLPAPER
#define RDP_LOGON_COMPRESSION2
BOOL rdp_reconnect(RDPCLIENT *This, char *server, uint32 flags, wchar_t *username, wchar_t *domain, wchar_t *password, wchar_t *command, wchar_t *directory, wchar_t *hostname, char *cookie)
static void rdesktop_reset_state(RDPCLIENT *This)
char * xstrdup(const char *s)
char * next_arg(char *src, char needle)
static void print_disconnect_reason(uint16 reason)
BOOL str_startswith(const char *s, const char *prefix)
static BOOL read_password(char *password, int size)
static void parse_server_and_port(RDPCLIENT *This, char *server)
void rdp2vnc_connect(char *server, uint32 flags, char *domain, char *password, char *shell, char *directory)
static rfbScreenInfoPtr server