- Timestamp:
- Apr 4, 2024 9:37:12 AM (10 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-global/win/VBoxSDS.cpp
r104149 r104152 109 109 #include <iprt/path.h> 110 110 #include <iprt/message.h> 111 #include <iprt/stream.h> 111 112 #include <iprt/string.h> 112 113 113 114 #include <VBox/com/microatl.h> 115 116 #include <package-generated.h> 117 #include "product-generated.h" 118 119 #include <VBox/version.h> 114 120 115 121 #define _ATL_FREE_THREADED /** @todo r=bird: WTF? */ … … 763 769 } 764 770 #endif 771 772 /** 773 * Shows an information message box. 774 * 775 * @param pszFormat The message text. 776 * @param ... Format string arguments. 777 */ 778 static void vboxSdsShowInfoMsgBox(const char *pszFormat, ...) 779 { 780 va_list va; 781 va_start(va, pszFormat); 782 783 char *psz = NULL; 784 int vrc = RTStrAPrintfV(&psz, pszFormat, va); 785 AssertRCReturnVoid(vrc); 786 787 va_end(va); 788 789 PRTUTF16 pwsz = NULL; 790 vrc = RTStrToUtf16(psz, &pwsz); 791 AssertRCReturnVoid(vrc); 792 793 MessageBoxW(NULL, pwsz, L"VBoxSDS", MB_OK | MB_ICONINFORMATION); 794 795 RTUtf16Free(pwsz); 796 RTStrFree(psz); 797 } 798 799 /** 800 * Shows tool usage text. 801 * 802 * @returns RTEXITCODE_SYNTAX 803 */ 804 static RTEXITCODE vboxSdsShowUsage(void) 805 { 806 vboxSdsShowInfoMsgBox( 807 VBOX_PRODUCT " VBoxSDS (System Directory Service) Version " VBOX_VERSION_STRING " - r%s\n" 808 "Copyright (C) " VBOX_C_YEAR " " VBOX_VENDOR "\n" 809 "\n" 810 " Service handling:\n" 811 " --regservice, /RegService\n" 812 " Registers COM out-of-proc service\n" 813 " --unregservice, /UnregService\n" 814 " Unregisters COM out-of-proc service\n" 815 " --reregservice, /ReregService\n" 816 " Unregisters and registers COM service\n" 817 "\n" 818 " Common options:\n" 819 " -V, --version\n" 820 " Displays version\n" 821 " -h, -?, --help\n" 822 " Displays help\n" 823 "\n" 824 " Logging options:\n" 825 " --logfile, /logfile </path/to/log>\n" 826 " Specifies the log file destination\n" 827 " --logsize, /logsize <bytes>\n" 828 " Specifies the maximum log size (in bytes)\n" 829 " --loginterval, /loginterval <s>\n" 830 " Specifies the maximum log time (in seconds)\n", 831 RTBldCfgRevisionStr()); 832 833 return RTEXITCODE_SYNTAX; 834 } 765 835 766 836 … … 815 885 { "/?", 'h', RTGETOPT_REQ_NOTHING }, /* Most Windows programs use '/?', so have this as an alias. */ 816 886 { "/h", 'h', RTGETOPT_REQ_NOTHING }, /* Ditto for '/h'. */ 817 { "/help", 'h', RTGETOPT_REQ_NOTHING } /* Ditto for '/help'. */ 887 { "/help", 'h', RTGETOPT_REQ_NOTHING }, /* Ditto for '/help'. */ 888 { "--version", 'V', RTGETOPT_REQ_NOTHING }, 889 { "/V", 'V', RTGETOPT_REQ_NOTHING }, 890 { "/version", 'V', RTGETOPT_REQ_NOTHING } 818 891 }; 819 892 … … 863 936 864 937 case 'S': 865 uHistoryFileSize = ValueUnion.u64; 938 uHistoryFileSize = ValueUnion.u64; /** @todo r=andy Too fine grained (bytes), MB would be enough, I think. */ 866 939 break; 867 940 868 941 case 'I': 869 uHistoryFileTime = ValueUnion.u32; 942 uHistoryFileTime = ValueUnion.u32; /** @todo r=andy Too fine grained (seconds), minutes/hours would be enough, I think. */ 870 943 break; 871 944 872 945 case 'h': 873 946 { 874 static WCHAR const s_wszHelpText[] = 875 L"Options:\n" 876 L"\n" 877 L"/RegService\t" L"register COM out-of-proc service\n" 878 L"/UnregService\t" L"unregister COM out-of-proc service\n" 879 L"/ReregService\t" L"unregister and register COM service\n" 880 L"no options\t" L"run the service"; 881 MessageBoxW(NULL, s_wszHelpText, L"VBoxSDS - Usage", MB_OK); 882 return 0; 947 vboxSdsShowUsage(); 948 return RTEXITCODE_SUCCESS; 883 949 } 884 950 885 951 case 'V': 886 952 { 887 char *pszText = NULL; 888 RTStrAPrintf(&pszText, "%sr%s\n", RTBldCfgVersion(), RTBldCfgRevisionStr()); 889 890 PRTUTF16 pwszText = NULL; 891 RTStrToUtf16(pszText, &pwszText); 892 893 MessageBoxW(NULL, pwszText, L"VBoxSDS - Version", MB_OK); 894 895 RTStrFree(pszText); 896 RTUtf16Free(pwszText); 897 return 0; 953 vboxSdsShowInfoMsgBox("%sr%s\n", RTBldCfgVersion(), RTBldCfgRevisionStr()); 954 return RTEXITCODE_SUCCESS; 898 955 } 899 956 900 957 default: 901 { 902 char szTmp[256]; 903 RTGetOptFormatError(szTmp, sizeof(szTmp), vrc, &ValueUnion); 904 905 PRTUTF16 pwszText = NULL; 906 RTStrToUtf16(szTmp, &pwszText); 907 908 MessageBoxW(NULL, pwszText, L"VBoxSDS - Syntax error", MB_OK | MB_ICONERROR); 909 910 RTUtf16Free(pwszText); 911 return RTEXITCODE_SYNTAX; 912 } 958 return vboxSdsShowUsage(); 913 959 } 914 960 }
Note:
See TracChangeset
for help on using the changeset viewer.