Jump to content

alank2

Members
  • Content Count

    176
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by alank2


  1. I have a C++ Builder service application that uses a timer TProcess to do something every 60 seconds.  The "something" was processing some data and making a SQL call.  I was accessing one of the query columns outside of a try catch block and it was throwing an exception because I was accessing it as an integer and it was a bit type and needed to be accessed as a boolean.  I get the error and how to fix it, but I am trying to troubleshoot how to stop the exception from being unhandled at a higher lever then leaving the service in a stuck state.

     

    
      try
        {
          while (!Terminated || !TProcess->Enabled) //do not quit if process is running until it is finished
            {
              ServiceThread->ProcessRequests(true);
              Sleep(250);
            }
        }
      catch(Exception &exception)
        {
          log1.Logf(L"ERROR: %s (main loop)", exception.Message.w_str());
        }
    
    

     

    At first I just had what was in the try block above on its own.  Then I wrapped it in the try block and expected that this would catch the exception and at least log it.  What I don't understand is why the above did not catch the exception.  I repeated the test and it still hung with no log message.  When I moved the code that accesses the SQL field into its own try catch block with logging, it did log the error related to the issue.


  2. Thanks for the tips - I'll take a look at the two pas files and see if anything jumps out.

     

    >You might also try tracing through the different messages passed during the handshaking to see where it dies.

     

    I'm not sure how to do this exactly.  Could I attach the .pas to my project and then set some breakpoints?

     

    >Are your two environments running the Windows Server version?  

     

    They say they are the same, but I have to think there is something different.

     

    I appreciate the help!


  3. I am using TSslHttpCli to access a webapi that requires NTLM.  An odd thing is happening.  With their production environment, it works, but with their development environment, it doesn't.  I have tested both with curl using the --ntlm option and with curl, they both work, but with my code/ICS, only the production works.  With the development I get a "401 - Unauthorized: Access is denied due to invalid credentials." returned.  I thought it was their login in formation, but since it works with curl I have to assume there is something different in their webapi between the two environments.  Are there any settings or things I can configure in ICS to try something different?  I am setting:

     

    SslHttpCli1->ServerAuth=httpAuthNtlm;

     

    currently.

     

    I also upgraded from ICS 859 to 869 with no change in behavior.  production api still works, development api does not.


  4. That really is the question isn't it.  What I've *been doing* is using wchar_t in cppbuilder, but looking at that now, I'm wonder if that is the best approach or not.  Most of the text I work with is going to fit in 7-bit ASCII, but if wchar_t has to use surrogates to support all of Unicodes 17 planes anyway, why not just use UTF-8 which is perhaps more efficient as well anyway?

     

    I found this site which is certainly pro UTF-8:

    http://utf8everywhere.org/

     

    My question is, for modern cppbuilder development, is it better to use wchar_t or go back to char and assume it is UTF-8?  Both have the issue of variable code points possibly being one character anyway.  If so, then are the conversions to and from the UnicodeString's that VCL/FMX uses worth dealing with, or does it make more sense to just store them in a wchar_t.  So many things have to be converted to char for the outside world anyway.

     

    I know there may not be a one thought fits all on this, so I just wanted to get everyone's opinion.


  5. There are a whole list of functions here, but it seems some are depreciated and others not:

     

    https://docwiki.embarcadero.com/RADStudio/Alexandria/en/UTF-8_Conversion_Routines

     

    Many VCL/FMX properties use UnicodeString, so when working with them, if you want to convert to UTF-8 and back, what do you use?

     

    One is UTF8ToUnicodeString, but I don't see its reverse which I would have expected to possibly be UnicodeStringToUTF8 ?


  6. Thanks - after failing and returning from the succeeded function, EAX is 80040265

     

    https://www.remosoftware.com/info/how-to-fix-80040265-error-in-windows-media-player

     

    I also found this page:

     

    https://docwiki.embarcadero.com/Libraries/Alexandria/en/FMX.Media.TMediaCodecManager

     

    It shows in windows that mp4 is a registered extension in the top table, but then below it only shows avi and wmv for windows video...


  7. I created a Delphi project to try to dig into this.  Debug dcu's are on.

     

    I trace it down to this function, but if I try to trace into it first must call the PChar and then with trace into it looks like it ends up in the windows message loop so I'm not sure how to find the RenderFile method to see what is going on there.

     

    image.thumb.png.cc3b83e1e1d7b0fa82664e70afb84d14.png

     

    Some more searching and I found Winapi.DirectShow9.pas which contains information about RenderFile

     

    image.thumb.png.db88a426e436f559622ec896f000d1b7.png

     

    I tried to set a breakpoint on it, but it doesn't stop.

     

    Is there a way I can find out the HRESULT it is returning?  It looks like they are listed here:

    https://docs.microsoft.com/en-us/windows/win32/api/strmif/nf-strmif-igraphbuilder-renderfile

     

    Could AddSourceFilter have something to do with solving this?

×