From 4c930799f1e4e072c7b2d0a5bffe9ab977a03d95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= Date: Mon, 22 Feb 2021 14:17:32 +0100 Subject: [PATCH] [RSYM/x64] Make command line compatible with x86 version x86 version needs input and output file names as arguments, even if is called with input file name = output file name. x86 version also accepts a -s argument to the root path of ReactOS sources Make x64 version take the same arguments. --- sdk/tools/rsym/rsym64.c | 42 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/sdk/tools/rsym/rsym64.c b/sdk/tools/rsym/rsym64.c index 746e5e4cfd0..8c3b0b3e85f 100644 --- a/sdk/tools/rsym/rsym64.c +++ b/sdk/tools/rsym/rsym64.c @@ -865,15 +865,47 @@ int main(int argc, char* argv[]) FILE_INFO File; FILE* outfile; int ret; + int arg, argstate = 0; + char *SourcePath = NULL; - if (argc != 3) + for (arg = 1; arg < argc; arg++) { - fprintf(stderr, "Usage: rsym \n"); - exit(1); + switch (argstate) + { + default: + argstate = -1; + break; + + case 0: + if (!strcmp(argv[arg], "-s")) + { + argstate = 1; + } + else + { + argstate = 2; + pszInFile = convert_path(argv[arg]); + } + break; + + case 1: + free(SourcePath); + SourcePath = strdup(argv[arg]); + argstate = 0; + break; + + case 2: + pszOutFile = convert_path(argv[arg]); + argstate = 3; + break; + } } - pszInFile = convert_path(argv[1]); - pszOutFile = convert_path(argv[2]); + if (argstate != 3) + { + fprintf(stderr, "Usage: rsym [-s ] \n"); + exit(1); + } File.FilePtr = load_file(pszInFile, &File.cbInFileSize); if (!File.FilePtr)