Really a console application?

Help
klenot
2010-10-26
2013-05-29
  • klenot

    klenot - 2010-10-26

    In the description, there is a statement, that it is a console application. I have windows 2000, and don't want to run it as a service, becasue mi IP address changes only when I start my cable modem. So after boot, it only have sense to update the IP address at afraid.org once. So I planned to run it as Autorun entry, with the parameters same as I used with rather buggy inadyn (plain inadyn, not -mt):
        -log_file %RD%\tmp\inadyn.log
        -alias mydomain.net,XXXXXXXX
        -dyndns_system default@freedns.afraid.org
        -iterations 1
    I tried just to display the supported parameters, to be able to check, whether the -mt version supports them all, so I typed:
        inadyn-mt -help
    and I got this error message:

    Tue Oct 26 15:44:23 2010:C:SERVICE_MAIN: Error attempting to open registry…  Non-zero error code: 2; related error string:  The system cannot find the file specified.

    What's wrong? For just displaying the supported switches, I do need it registered as a service? Bad design indeed.

     
  • Bryan Hoover

    Bryan Hoover - 2010-10-26

    Yes, if not installed as service, the command line - whether attempting to start inadyn-mt as a service, or simply running as console app - will return the error message you note.  You can safely ignore it.

    The program nevertheless, continues, and displays the help screen.  Hopefully, this is consistent with your experience.

    Bryan

     
  • Bryan Hoover

    Bryan Hoover - 2010-10-27

    For future reference, I should clarify my initial response.

    inadyn-mt can be run as a console app regardless of whether it is installed as a service.  If it is not installed as a service, the noted error message will appear - debug output can be a bit chatty - when run as a console app, and in such contexts may be safely ignored - while what the message is conveying may be true, it is of no consequence..

    -iterations parameter setting has no effect on whether inadyn-mt can be run as a service.  That is, as per OP, if iterations is set to 1, this does preclude running the program as a service - the service would quit, after a single iteration.

    Bryan

     
  • Bryan Hoover

    Bryan Hoover - 2010-10-27

    That last line in my previous post should be:

    That is, as per OP, if iterations is set to 1, this does NOT preclude running the program as a service - the service would quit, after a single iteration.

    :-)

    Bryan

     
  • klenot

    klenot - 2010-10-28

    Bryan,

    Thanks for your replies.

    Yes, if not installed as service, the command line - whether attempting to start inadyn-mt as a service, or simply running as console app - will return the error message you note. You can safely ignore it.

    The program nevertheless, continues, and displays the help screen. Hopefully, this is consistent with your experience.

    Unfortunately, not. It only displays that debug message, and does nothing else. I tried:

    C:\ws\net\inadyn > inadyn-mt.exe
    Thu Oct 28 22:33:02 2010:C:SERVICE_MAIN: Error attempting to open registry...  Non-zero error code: 2; related error string:  The system cannot find the file specified.
    C:\ws\net\inadyn > inadyn-mt.exe  /?
    Thu Oct 28 22:33:25 2010:C:SERVICE_MAIN: Error attempting to open registry...  Non-zero error code: 2; related error string:  The system cannot find the file specified.
    C:\ws\net\inadyn > inadyn-mt.exe  --help
    Thu Oct 28 22:34:07 2010:C:SERVICE_MAIN: Error attempting to open registry...  Non-zero error code: 2; related error string:  The system cannot find the file specified.
    C:\ws\net\inadyn > inadyn-mt.exe --log_file %RD%\tmp\inadyn-mt.log --alias mydoman.net,XXXXXX== --dyndns_system default@freedns.afraid.org --iterations 1
    Thu Oct 28 22:36:07 2010:C:SERVICE_MAIN: Error attempting to open registry...  Non-zero error code: 2; related error string:  The system cannot find the file specified.
    

    The last line is the syntax I use with inadyn. It did not even created the log file (not even an empty one). Simply, it does nothing on my rig (Windows 2000).

    Roman,

     
  • Bryan Hoover

    Bryan Hoover - 2010-10-28

    At the moment, I'm at a loss as to what it could be.  Works for me, but I'm looking into.

    While I do that, could you please install it as a service:

    inadyn-mt -i

    Then set the inadyn-mt AppParameters registry entry:

    HKEY_LOCAL_MACHINE\CurrentControlSet\Control\Services\inadyn-mt\AppParameters

    to your configuration file like so:

    -input_file x:\path\dir\inadyn.conf

    And then use the Windows services interface to start it.

    Let's see what happens.

    Obviously, if works, that still does not solve the problem, but it may help eliminate the possibility the problem is strictly command line interface related.

    You should also set the ServiceLog registry parameter, (full path, file name).  Look at both program, and service logs.

    Bryan

     
  • Bryan Hoover

    Bryan Hoover - 2010-10-29

    I've put here, https://secure.wecs.com/ftp/misc/inadyn-mt.exe an inadyn-mt exe version with some more debug output to try to isolate the problem.  The exe is the same version otherwise (changed the agent string to indicate the present context).  I've gone sufficiently deep to (hopefully) give some direction.

    To simplify things, if you installed as a service as per my previous message, uninstall that with: 

    inadyn-mt -x

    so we can look at screen log output only.

    If you need to obfuscate any of the output for privacy, let any spaces remain, etcetera, so the output is as analogous to actual as possible - don't want to miss anything that could be important.

    Can you please give me some info about your environment?  For instance, what's the locale set to?  That is, non-english locale, fonts, etcetera? 

    What's the path of current working directory look like (from cwd back up to root) - length, type of characters, etcetera.  Generally, is there anything unusual about your set up in this regard?  (please as much info as you can regardless of usual/unusual though). 

    I don't see any problems with any of these things with respect to program code, but…you seem to be cutting out just before attempt to open language strings file…

    Does the program return?  Or simply hangs after the registry error message?

    Bryan

     
  • klenot

    klenot - 2010-10-30

    Hello Bryan.

    Some good news: I found the cause of app failure. I describe step by step my progress:

    First I tried the debug version of app (02.18.42_audible-roman, thank you for it). I tried:
    1:  inadyn-mt.exe  -help
    2:  inadyn-mt.exe  -log_file ..  -alias ..  -dyndns_system ..  -iterations 1
    3:  inadyn-mt.exe  -i

    All attempts ended the same way: Displaying the one single line, the same as in my post #5, and no other action at all, no log file, no changes in registry, nothing. The version 02.18.50_audible did absolutely the same.

    Then, I noticed your question:

    Does the program return? Or simply hangs after the registry error message?

    I did check the Dr.Watson logs and found that inadyn-mt hangs. Or, better say: not inadyn-mt hangs, but ansi.dll hangs. Ansi.dll is part of Ansicon, a tiny program by Jason Hood, which interpretes ANSI color and cursor positiong sequences in stdout of console apps, and colorizes and moves the cursor in cmd window. Ansi.dll attaches itself some way to every console app. It attached itself to inadyn-mt.exe too. And hanged. Don't know why, but I don't care. If I will use inadyn-mt, I will run it from cmd without ansicon, so their incompatibility is not an issue for me.

    Well, that was the good news in detail. Now the not-so-good news in detail:

    Without ansicon, the inadyn-mt outputs far more lines, than just a single one. But .. I cannot get it doing what I do expect. Here is my progress described step by step:

    Step 1:  inadyn-mt.exe  -help

    Works. Shows all the switches.

    Step 2:  inadyn-mt.exe  -log_file ..  -alias ..  -dyndns_system ..  -iterations 1  -debug 7  -verbose 5

    Complains: W:MAIN: Main: Error RC_DYNDNS_INVALID_OR_MISSING_PARAMETERS (0x45).

    The log file is created, but stays empty (0 bytes after app finishes).

    I can't understand, what parameters are invalid or missing. In my humble opinion, the only crucial parameters should be the '-dyndns_system' and '-alias'. Am I right? Once it knows where (at which -dyndns_system) it should update the IP, and which alias should update there, it should work. All other parameters should be optional. The vanilla (non -mt) inadyn works this way. I use it with just 4 parameters:
        -log_file ..  -alias ..  -dyndns_system ..  -iterations 1
    and it works.

    Here is the complete std.output:

    C:\ws\net\inadyn\dbgexe > inadyn-mt.exe --log_file %RD%\tmp\inadyn.log --alias MyDomain.net,AccessHashXXXXXXXXXXX== --dyndns_system default@freedns.afraid.org --iterations 1 --debug 7 --verbose 5
    Sat Oct 30 20:40:58 2010:C:SERVICE_MAIN: Error attempting to open registry...  Non-zero error code: 2; related error string:  The system cannot find the file specified.
    Sat Oct 30 20:40:58 2010:C:OS_WIN: Returned from get_app_parameters.  Parsing command line...
    Sat Oct 30 20:40:58 2010:C:OS_WIN: Returned from parsing command line...
    Sat Oct 30 20:40:58 2010:C:OS_WIN: Freed utf_8 array...opening service log...
    Sat Oct 30 20:40:58 2010:C:OS_WIN: Opened service log...
    Sat Oct 30 20:40:58 2010:C:OS_WIN: Freed service log str...
    Sat Oct 30 20:40:58 2010:C:OS_WIN: Initializing lang strings...
    Sat Oct 30 20:40:58 2010:C:OS_WIN: setlocale returned English_United States.1252...
    Sat Oct 30 20:40:58 2010:I:LANG: Language file search locale:  English_United States.1252...
    Sat Oct 30 20:40:58 2010:E:LANG: Lang code start English...
    Sat Oct 30 20:40:58 2010:E:LANG: Lang code En...
    Sat Oct 30 20:40:58 2010:E:LANG: Returning en...
    Sat Oct 30 20:40:58 2010:C:LANG: searchedLangFile, looking for:  en.lng...
    Sat Oct 30 20:40:58 2010:C:PATH: normed_path:  lang\...
    Sat Oct 30 20:40:58 2010:C:PATH: cwd:  c:\ws\net\inadyn\dbgexe...
    Sat Oct 30 20:40:58 2010:C:LANG: searchedLangFile, found:  en.lng...
    Sat Oct 30 20:40:58 2010:C:LANG: searchedLangFile, looking for:  en.lng...
    Sat Oct 30 20:40:58 2010:C:PATH: normed_path:  lang\...
    Sat Oct 30 20:40:58 2010:C:PATH: cwd:  c:\ws\net\inadyn\dbgexe...
    Sat Oct 30 20:40:58 2010:C:LANG: searchedLangFile, found:  en.lng...
    Sat Oct 30 20:40:58 2010:W:LANG: Cannot open language file.  Will use english defaults, or default override (--lang_file <path/file_name>...)
    Sat Oct 30 20:40:58 2010:C:OS_WIN: Initialized lang strings...
    Sat Oct 30 20:40:58 2010:I:OS_WIN: Hello!  main() calling set_up_service...
    Sat Oct 30 20:40:58 2010:I:SERVICE_MAIN: Hello!  Entered set_up_service service server.  Appending log...
    Sat Oct 30 20:40:58 2010:I:SERVICE_MAIN: Non service server arugment at 1:  --log_file.  Passing to client...
    Sat Oct 30 20:40:58 2010:I:SERVICE_MAIN: Non service server arugment at 2:  Z:\tmp\inadyn.log.  Passing to client...
    Sat Oct 30 20:40:58 2010:I:SERVICE_MAIN: Non service server arugment at 3:  --alias.  Passing to client...
    Sat Oct 30 20:40:58 2010:I:SERVICE_MAIN: Non service server arugment at 4:  MyDomain.net,AccessHashXXXXXXXXXXX==.  Passing to client...
    Sat Oct 30 20:40:58 2010:I:SERVICE_MAIN: Non service server arugment at 5:  --dyndns_system.  Passing to client...
    Sat Oct 30 20:40:58 2010:I:SERVICE_MAIN: Non service server arugment at 6:  default@freedns.afraid.org.  Passing to client...
    Sat Oct 30 20:40:58 2010:I:SERVICE_MAIN: Non service server arugment at 7:  --iterations.  Passing to client...
    Sat Oct 30 20:40:58 2010:I:SERVICE_MAIN: Non service server arugment at 8:  1.  Passing to client...
    Sat Oct 30 20:40:58 2010:I:SERVICE_MAIN: Non service server arugment at 9:  --debug.  Passing to client...
    Sat Oct 30 20:40:58 2010:I:SERVICE_MAIN: Non service server arugment at 10:  7.  Passing to client...
    Sat Oct 30 20:40:58 2010:I:SERVICE_MAIN: Non service server arugment at 11:  --verbose.  Passing to client...
    Sat Oct 30 20:40:58 2010:I:SERVICE_MAIN: Non service server arugment at 12:  5.  Passing to client...
    Sat Oct 30 20:40:58 2010:I:MAIN: Entered inadyn_main...
    Sat Oct 30 20:40:58 2010:I:MAIN: Constructing dyndns structure...
    Sat Oct 30 20:40:58 2010:I:MAIN: Calling dyn_dns_main...
    Sat Oct 30 20:40:58 2010:C:PATH: normed_path:  extra\wav\...
    Sat Oct 30 20:40:58 2010:C:PATH: cwd:  c:\ws\net\inadyn\dbgexe...
    Sat Oct 30 20:40:58 2010:W:INADYN: Could not open default wave file, extra\wav\alarm.wav.  Using default, .\alarm.wav...
    Sat Oct 30 20:40:58 2010:I:INADYN: Main loop calling exit_online_test_threads...
    Sat Oct 30 20:40:58 2010:I:INADYN: Entered exit_online_thread.  Setting return flag...
    Sat Oct 30 20:40:58 2010:I:INADYN: Joining online test thread:  0...
    Sat Oct 30 20:40:58 2010:I:INADYN: Entered exit_alert_thread.  Setting return flag...
    Sat Oct 30 20:40:58 2010:I:INADYN: Joining alert thread:  0...
    Sat Oct 30 20:40:58 2010:I:INADYN: Returned from exit_online_test_threads...
    Sat Oct 30 20:40:58 2010:I:RASTRP: No RAS thread to kill -- NULL RAS_THREAD_DATA...
    Sat Oct 30 20:40:58 2010:I:MAIN: Returned from dyn_dns_main...
                            INADYN-MT Help
                                :
                                : all the help text here
                                
    Sat Oct 30 20:40:58 2010:W:MAIN: Main: Error RC_DYNDNS_INVALID_OR_MISSING_PARAMETERS (0x45).
    Sat Oct 30 20:40:58 2010:I:MAIN: inadyn_main, returning to service dispatcher...
    Sat Oct 30 20:40:58 2010:I:OS_WIN: main() returned from set_up_service.  Closing log file...
    

    Step 3:  inadyn-mt.exe  -i

    Installed the service. Created this key in the registry: , with the basic values and sub-keys in it. Here is the std.out:

    C:\ws\net\inadyn\dbgexe > inadyn-mt.exe  -i
    Sun Oct 31 00:36:49 2010:C:SERVICE_MAIN: Error attempting to open registry...  Non-zero error code: 2; related error string:  The system cannot find the file specified.
    Sun Oct 31 00:36:49 2010:C:OS_WIN: Returned from get_app_parameters.  Parsing command line...
    Sun Oct 31 00:36:49 2010:C:OS_WIN: Returned from parsing command line...
    Sun Oct 31 00:36:49 2010:C:OS_WIN: Freed utf_8 array...opening service log...
    Sun Oct 31 00:36:49 2010:C:OS_WIN: Opened service log...
    Sun Oct 31 00:36:49 2010:C:OS_WIN: Freed service log str...
    Sun Oct 31 00:36:49 2010:C:OS_WIN: Initializing lang strings...
    Sun Oct 31 00:36:49 2010:C:OS_WIN: setlocale returned English_United States.1252...
    Sun Oct 31 00:36:49 2010:I:LANG: Language file search locale:  English_United States.1252...
    Sun Oct 31 00:36:49 2010:E:LANG: Lang code start English...
    Sun Oct 31 00:36:49 2010:E:LANG: Lang code En...
    Sun Oct 31 00:36:49 2010:E:LANG: Returning en...
    Sun Oct 31 00:36:49 2010:C:LANG: searchedLangFile, looking for:  en.lng...
    Sun Oct 31 00:36:49 2010:C:PATH: normed_path:  lang\...
    Sun Oct 31 00:36:49 2010:C:PATH: cwd:  c:\ws\net\inadyn\dbgexe...
    Sun Oct 31 00:36:49 2010:C:LANG: searchedLangFile, found:  en.lng...
    Sun Oct 31 00:36:49 2010:C:LANG: searchedLangFile, looking for:  en.lng...
    Sun Oct 31 00:36:49 2010:C:PATH: normed_path:  lang\...
    Sun Oct 31 00:36:49 2010:C:PATH: cwd:  c:\ws\net\inadyn\dbgexe...
    Sun Oct 31 00:36:49 2010:C:LANG: searchedLangFile, found:  en.lng...
    Sun Oct 31 00:36:49 2010:W:LANG: Cannot open language file.  Will use english defaults, or default override (--lang_file <path/file_name>...)
    Sun Oct 31 00:36:49 2010:C:OS_WIN: Initialized lang strings...
    Sun Oct 31 00:36:49 2010:I:OS_WIN: Hello!  main() calling set_up_service...
    Sun Oct 31 00:36:49 2010:I:SERVICE_MAIN: Hello!  Entered set_up_service service server.  Appending log...
    Sun Oct 31 00:36:49 2010:I:SERVICE_MAIN: Calling service install...
    Sun Oct 31 00:36:49 2010:I:SERVICE_MAIN: Appears service (inadyn-mt) installed okay...
    Sun Oct 31 00:36:49 2010:I:SERVICE_MAIN: Attempting default registry set up for (inadyn-mt) ...
    Sun Oct 31 00:36:49 2010:I:SERVICE_MAIN: Appears default registry set up (inadyn-mt) went okay...
    Sun Oct 31 00:36:49 2010:I:SERVICE_MAIN: Appears set service description (inadyn-mt) okay...
    Sun Oct 31 00:36:49 2010:I:OS_WIN: main() returned from set_up_service.  Closing log file...
    

    Then I added these options:

    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\inadyn-mt\Parameters]
    "AppParameters"="--log_file Z:\\tmp\\inadyn-mt.log --alias MyDomain.net,AccessHashXXXXXXXXXXX== --dyndns_system default@freedns.afraid.org --iterations 1 --debug 7 --verbose 5"
    "ServiceLog"="Z:\\tmp\\inadyn-mt-service.log"
    

    And tried to start the service from the service manager. It failed, showin this message:

    Could not start the inadyn-mt service on Local Computer. The service did not return an error. This could be an internal Windows error or an internal service error.
    

    The file inadyn-mt.log was created, but was empty (0 bytes). The file inadyn-mt-service.log contains this:

    Sun Oct 31 01:06:41 2010:C:OS_WIN: Opened service log...
    Sun Oct 31 01:06:41 2010:C:OS_WIN: Freed service log str...
    Sun Oct 31 01:06:41 2010:C:OS_WIN: Initializing lang strings...
    Sun Oct 31 01:06:41 2010:C:OS_WIN: setlocale returned English_United States.1252...
    Sun Oct 31 01:06:41 2010:C:OS_WIN: Initialized lang strings...
    Sun Oct 31 01:06:41 2010:I:OS_WIN: Hello!  main() calling set_up_service...
    Sun Oct 31 01:06:41 2010:I:SERVICE_MAIN: Hello!  Entered set_up_service service server.  Appending log...
    Sun Oct 31 01:06:41 2010:I:SERVICE_MAIN: Calling StartServiceCtrlDispatchter for ServiceMain...
    Sun Oct 31 01:06:41 2010:I:SERVICE_MAIN: Entered ServiceMain...
    Sun Oct 31 01:06:41 2010:I:SERVICE_MAIN: Initing service_status structure...
    Sun Oct 31 01:06:41 2010:I:SERVICE_MAIN: Registering service handler, ServiceHandler...
    Sun Oct 31 01:06:41 2010:I:SERVICE_MAIN: Registered handler...
    Sun Oct 31 01:06:41 2010:I:SERVICE_MAIN: Setting status SERVICE_RUNNING...
    Sun Oct 31 01:06:41 2010:I:SERVICE_MAIN: Set status SERVICE_RUNNING...
    Sun Oct 31 01:06:41 2010:I:SERVICE_MAIN: Attempting service client thread launch...
    Sun Oct 31 01:06:41 2010:I:SERVICE_MAIN: Service work thread launched.  Entering wait for service client thread...
    Sun Oct 31 01:06:41 2010:I:SERVICE_MAIN: Entered service client thread...
    Sun Oct 31 01:06:41 2010:I:SERVICE_MAIN: Fixing up client arguments...
    Sun Oct 31 01:06:41 2010:I:SERVICE_MAIN: Calling client...
    Sun Oct 31 01:06:41 2010:I:MAIN: Entered inadyn_main...
    Sun Oct 31 01:06:41 2010:I:MAIN: Constructing dyndns structure...
    Sun Oct 31 01:06:41 2010:I:MAIN: Calling dyn_dns_main...
    Sun Oct 31 01:06:41 2010:I:MAIN: Returned from dyn_dns_main...
    Sun Oct 31 01:06:41 2010:W:MAIN: Main: Error RC_DYNDNS_INVALID_OR_MISSING_PARAMETERS (0x45).
    Sun Oct 31 01:06:41 2010:I:MAIN: inadyn_main, returning to service dispatcher...
    Sun Oct 31 01:06:41 2010:I:SERVICE_MAIN: Service client exited.  Stopping service...
    Sun Oct 31 01:06:41 2010:I:SERVICE_MAIN: Entered ServiceHandler...
    Sun Oct 31 01:06:41 2010:I:SERVICE_MAIN: ServiceHandler got stop request (1).  Asking client to return...
    Sun Oct 31 01:06:41 2010:I:SERVICE_MAIN: ServiceHandler got stop request (1).  Set pending...
    Sun Oct 31 01:06:41 2010:I:SERVICE_MAIN: Request for service stop succeded...
    Sun Oct 31 01:06:41 2010:I:SERVICE_MAIN: Service client thread returned from client...
    Sun Oct 31 01:06:41 2010:I:SERVICE_MAIN: Returned from wait for service client thread.  Setting SERVICE_STOPPED...
    Sun Oct 31 01:06:41 2010:I:SERVICE_MAIN: Returned from service dispatcher...
    Sun Oct 31 01:06:41 2010:I:SERVICE_MAIN: Entering wait for service dispatcher clean up...
    Sun Oct 31 01:06:41 2010:I:SERVICE_MAIN: Returned from wait for service dispatcher clean up...
    Sun Oct 31 01:06:41 2010:I:SERVICE_MAIN: Exiting set_up_service, returning to client (main())...
    Sun Oct 31 01:06:41 2010:I:OS_WIN: main() returned from set_up_service.  Closing log file...
    

    Again, it is missing some parameters ? .. RC_DYNDNS_INVALID_OR_MISSING_PARAMETERS (0x45)

    In this post I did replaced my real afraid.org alias by: "MyDomain.net,AccessHashXXXXXXXXXXX==" and the help content in std.out (all those switches) by string: "all the help text here." Otherwise it is unaltered.

    Roman.

     
  • Bryan Hoover

    Bryan Hoover - 2010-10-31

    Hi Roman,

    Glad you discovered the problem with the driver.  Not sure I'm doing anything particularly arcane regarding console output.  Perhaps I'll visit driver documentation, and see if there are any recommendations.  It may be because I'm using fwprintf, and WriteConsoleW for reasons of internationalization.

    As for the parameters error, looks like I may have gotten overzealous with error checking as I added tests for password, and username after command line parsing.

    You can work around this by simply adding these.  For freedns, these will be ignored.  So just do something like -username x
    -password x and that should get around it.

    I'll fix in upcoming, and much thanks for catching this.

    Regards,

    Bryan

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks