Quantcast
Channel: Embarcadero Community - Embarcadero Community
Viewing all 1963 articles
Browse latest View live

How to enable Windows Authentication for HTTP Requests from Delphi

$
0
0

Hi,

We are making web http requests from our Delphi client. This works fine for Anonymous authentication. But we now want to go with windows authentication for our new requirement. For some reason, this do not work for us and the client windows credentials is not coming to the server as we would expect.

Anyone have any idea what could be going wrong when http request is made from the Delph client with Windows Authentation set as enabled in IIS please? We would expect the client windows credentials to reach the server side for us to do the authentication. 

This works fine when we tried the same URL and same http requests in Fiddler and Postman. So there is something which Delphi is missing?

How Delphi client application provides/handles windows credentials?

 

Thanks

Tomy

tomy.chacko@allscripts.com

 

 

 

 

  


Demo Samples no working on 10.2 -- Map, Gyroscope

$
0
0

The Gyroscope demo runs and I can check that the timer code is running but nothing is displayed.

On the Map_Object demo I now get ---------------------------

Error

---------------------------

Unable to install C:\Users\Public\Documents\Embarcadero\Studio\19.0\Samples\Object Pascal\Multi-Device Samples\Device Sensors and Services\Map Type Selector\Android\Debug\Map_ObjectPascal\bin\Map_ObjectPascal.apk.

Failure [INSTALL_PARSE_FAILED_MANIFEST_MALFORMED].

---------------------------

OK   

---------------------------

 

Will try on another PC later today.  Do these samples work for anyone else using 10.2 ?

Clark

 

 

Compiling HiRedis, the official C Client of the Windows port of Redis with C++ Builder

$
0
0

Hi all,

I'm in the process of building Hiredis, the official C client library for Redis (Windows port of course) using C++ Builder.

Windows port of Redis is a fork maintained by Microsoft Open Tech community and is of course tight to MS compiler and libraries. In fact, there is no luck in trying to compile the source just "out of the box" as Visual Studio does, even if the source is straight standard C (well, at last the original Redis code).

The source can be found here: Windows port of Redis 

I know there is a Delphi client available, but it really sounds sad (and frustrating) to me having to import the Delphi code because the "native C source" cannot be used. No way. That's why I decided to give it a try. 

To compare sources an libraries involved, I'm using C++ Builder 10.1.2 (Berlin Update 2) on one side and Visual Studio Community 2017 on the other side. The basic steps using C++ Builder are:

(Edit: I edited the post and removed all code formatting features because I had problems with it. Also, for the same reason all #include in the post has standard parenthesis instead of "minor and major" chars. Sorry for that.)

  1. Download of source version redis-win-3.2.100
  2. Create a new Static Library project called Hiredis and add some files contained in the "redis-win-3.2.100\deps\hiredis" subfolder: from the deps\hiredis folder:
    • async.c 
    • hiredis.c
    • net.c
    • sds.c

      (from src\Win32_Interop folder):
    • Win32_ANSI.c
    • Win32_Common.cpp
    • Win32_Error.c
    • Win32_EventLog.cpp
    • Win32_FDAPI.cpp
    • Win32_fdapi_crt.cpp
    • Win32_RedisLog.c 
    • Win32_rfdmap.cpp 
    • Win32_Time.c
    • Win32_VariadicFunctor.cpp
  3. Setup the project to use Clang based compiler (not really needed as this should be standard C code, but see later)
  4. Add project conditional defines:
    • _STDC__=1 (required to cut off (re)definition of “off_t” inside stdio.h)  
    • __SSIZE_T_DEFINED=1 (required to cut off (re)definition of type ssize_t inside _stddef.h)  
    • _OFF_T_DEFINED (required to cut off (re)definition of type off_t inside sys\types.h; needs C Standard Header modification, see below.)
  5. Build

The project fails to compile as I said, here is a step by step description of the issues and fixes I used. After each fix I usually compile the single unit or directly build the whole project. Each fix provided must not break the original source which still compiles using MSVC, this will be eventually a requirement when talking about pushing the code to the MSOpen Tech community.

  • [bcc32c Error] Win32_Error.h(37): unknown type name 'size_t'
    Fix: added a conditional block and the relative include to the header that contains that type. 

    #ifdef __BORLANDC__
    #include (stdlib.h)
    #endif

    This error is due to the fact that inside Win32_Error.h there is another include and this header in MS C Runtime Library version contains another include to a Visual C header. (Kudos to Embarcadero C Runtime Library version)

  • [bcc32c Error] stdio.h(56): typedef redefinition with different types ('long' vs 'long long')
    This error is due to the re-definition of the type off_t inside the file win32_types.h provided in the hiredis source.

    Now, according to the info in "win32_types.h" they need to re-define both off_t and _off_t types to match Posix version of Redis.
    But, in order to use this definition without conflicts you need to include this header before any other inclusion of the original header "sys\types.h", which contains the original types definitions under a conditional define (_OFF_T_DEFINED). 

    Win32_types.h will also define _OFF_T_DEFINED to avoid subsequent types re-definitions. (anyway MSVC has an additional conditional define _OFF_T_DEFINED at project level.)

    Now, on MS Visual Studio C Runtime Library, "stdio.h" does not contain "off_t" type definition, that's why it everything works. Moreover, Embarcadero C Runtime Library has no conditional defs to skip off_t and _off_t definitions inside "sys\types.h" as MS does.

    First Fix: I'd rather not modify C Runtime Library headers at all, but at the moment I have no other options here than modifying Embarcadero C Runtime Library header file "sys\types.h" and wrap the off_t type definition with the above mentioned _OFF_T_DEFINED, just as in MS Visual Studion C Runtime headers:

    #ifndef _OFF_T_DEFINED
    #define _OFF_T_DEFINED
    typedef long off_t;
    #endif

  • [bcc32c Error] Win32_variadicFunctor.cpp(61) expected '(' after 'for'
    Fix: replace MS style “for each” with standard C++11 “for ( range_declaration : range_expression )” 

  • [bcc32c Error] Win32_fdapi_crt.cpp(35): use of undeclared identifier '_pipe'
    Fix 1: add #include
    Fix 2: replace functions _setmode(), _isatty() with setmode() and isatty()

  • Win32_time.c/.h errors
    Fix 1: move struct timezone definition from .c to .h
    Fix 2: include time.h in Win32_time.h

  • [CLANG Error] sds.h(53): expected identifier
    The file contains an helper macro to pack structs. The macro uses __pragma() compiler extension to allow the usage of pragma "in-a-macro". According to the compiler documentation, also thanks to this answer on StackOverflow from Remy Lebeau, old BCC32 does not support this statements. But Clang based compilers do. This is the first fix that is tight to Clang compiler, even if we could build a different solution by using #pragma as stated in stakoverflow post by Remy to have BCC32 working.
    Anyway, I was not able to make __pragma() work that way, so I created another macro using _Pragma() instead and that worked fine.

    #if defined(__BORLANDC__) && defined(__clang__)
    #define PACK( __Declaration__ ) _Pragma( "pack(push, 1)" ) _Declaration__ _Pragma( "pack(pop)" )
    #else
    #define PACK( __Declaration__ ) __pragma( pack(push, 1) ) __Declaration__ __pragma( pack(pop) )
    #endif
     
  • [CLANG Error] hiredis.c(1041): conflicting types for 'redisConnectWithTimeout'
    hiredis.h(184): previous declaration is here
    (unresolved)
    As sometime happens the compiler message is not really helpful. In fact the problem is not 'redisConnectWithTimeout' function prototype but rather one of the parameter types used in it, timeval which is defined in "winsock2.h".
    For some strange reason, on MSVC this type definition is known in hiredis.h at function declaration, even if winsock2.h is not included by any of the include entries, nor in any sub-includes. Unfortunately, any inclusion of winsock2.h leads to an incredible amount of other errors which make me think about searching for another solution.

  • [bcc32c Error] types.h(65): expected unqualified-id (unresolved)
  • [bcc32c Error] types.h(69): no member named 'off_t' in namespace 'std' (unresolved)
    At last the second error comes from the conditional define to wrap off_t. 

Here is where I lay by now, welcome contributions from anyone can help.

Thanks.

Alex B.



Legal using two Delphi Starter instances

$
0
0

Hello to all!

I am trying to learn to programming and since this I am there with one question.

Recently I have downloaded a new Delphi Tokyo 10.2 Starter edition (which is free). This is a cool IDE (early I have been using Lazarus a little a bit). I have install Delphi Starter on my main home machine, but sometimes I do a lot of stuff outside my home (not related with programming), so my home computer is not available for me. But when I am outside of home, all free time which I have could be spent to improve my programming skills. Having my personal laptop I am wondering, if I can legally install Delphi Starter Tokyo 10.2 on my laptop and work with it when I am not at home. But in the same time I want to be able also to have Delphi Starter Tokyo 10.2 to be installed on my home machine, so when I get at home I could use my home machine to programming.

Programming is just my hobby and I don't want to break the law with illegal installing Delphi on my personal laptop.

The clear question is: can I legally install Delphi Starter Tokyo 10.2 on two my personal machines?

FAQ for Delphi Starte Tokyo 10.2 says next:

"If a single user starts two instances of a Starter edition product, does that count as two toward the maximum of five?

Yes, if they are on separate machines or separate virtual machines."

(https://www.embarcadero.com/products/delphi/starter-faq)

But I would like to have more info about this question.

 

Thanks in advance for your help!

P.S.

Sorry for my poor English(

Application Deployment

$
0
0

Hi, I need supply export library of my dll to other teem working on VC.

Witch tool can convert the library from OMF to COFF format?

Thank You.

ISAPI DLL TWebRequest Broken

$
0
0

Does anybody know when ISAPI DLL TWebRequest->Content is going to be fixed?  It's been broken since Seattle 10.1 update 2.  It's null inside function.  Thanks Marshall  

FMX C++ Builder App on MacOS crash on start with 10.2

$
0
0

Have a project that worked fine with 10.1 Berlin for the three target environments: Win32, Win64, and MacOS/OSX.

Load the project up in 10.2 Win32 and Win64 work fine, but MacOS/OSX version crashes during startup (before executing any of the .cpp files in the project). Thus have been unable to debug it.

As a further test: I created a blank project which works fine in all 3 (just to make sure everything is correct) started adding the same components to the FMX Form on the test project--everything worked...

2nd test: Create a blank FMX application and then add all the files from the original project to it. This results with the same crash as with the original application.

Looking at the stack trace the crash appears to be related to styles (there is no stylebook associated with the form, and even if one is added the application still crashes in MacOS/OSX).

 My 10.2 is up to date (including the latest patch recently released).

uploading and download images Rad Server

$
0
0

Hi,

Im trying to develop a solution with Rad Server, but i need to upload and download images and some files, i been playing with the server, but i can't send or get images.

 

any hints?

 

Thank you

MH


Delphi keeps trying to launch application but it keeps closing

$
0
0

Referring to thread: http://community.embarcadero.com/answers/ios-app-won-t-launch

I got confused by the exact solution of that thread. I'm having the exact same issue, trying launch an iOS app from Delphi Berlin 10.1 Update 1 to an iPhone 5 with iOS 10 (using XCode 8). Delphi keeps "Launching" the app, the app actually opens in the iPhone but then immediately closes, then Delphi tries to launch it again, and it keeps going in a loop.

I have deleted any "entitlements" and "pInfo" file in:

a) PAServer scratch dir in Mac

b) The AppData/Roaming/Embarcadero/BDS/18.0 folder

c) My project folder

None of this work. Can someone help me out? Thanks a lot!

 

 

Loading DataModule on IDE Delphi XE7

$
0
0

I have a project that upgraded from Delphi7 to DelphiXE7, this project has over 15 years of development, the point is that when I open a datamodule with third-party components ( memory tables ) around 600, it takes me four minutes to open , but in Delphi7 it is opened without delay.

Furthermore, when the DFM has links to other forms it takes more time , it seems that creates other forms first.

And if the DFM has links to X form and that form has link to DFM I'm trying to open the IDE hangs .

And hope you can help me with this problem. best regards.

Armand

How to generate SOAP-Response with Class including object-array or list of objects?

$
0
0

Hello,

I want to program a SOAP-Server and Client using TRemotable. I tried the tutorial of Craig Chapman.

It runs well and I implemented a new methode for respond an object.

I want to read records from a ADO database and store them in the service's result-object.

Database access runs well.

Anyone knows a good example?

Thank You

Marcus

How to add a Client Certificate authentication to my SOAP server?

$
0
0

Hello!

I made a SOAP server application.

 

On a start I do somethings:

  FServer := TIdHTTPWebBrokerBridge.Create(Self);
  LIOHandleSSL := TIdServerIOHandlerSSLOpenSSL.Create(FServer);
  LIOHandleSSL.SSLOptions.CertFile := 'c:\share\testcert\server.crt';
  LIOHandleSSL.SSLOptions.Mode := sslmServer;
  LIOHandleSSL.SSLOptions.KeyFile := 'c:\share\testcert\server.key';

  LIOHandleSSL.OnVerifyPeer := IdSSLIOHandlerSocketOpenSSL1VerifyPeerCertificate;

  LIOHandleSSL.SSLOptions.VerifyDepth := 1;
  LIOHandleSSL.SSLOptions.VerifyMode := [sslvrfPeer, sslvrfClientOnce];

  LIOHandleSSL.OnGetPassword := OnGetSSLPassword;
  FServer.IOHandler := LIOHandleSSL;

I created a self-signed certificate to establish an SSL connection.

As I can see, my this pair of Public and private keys is used for establishing SSL connection, and it works from a browser.

But how can I add c second-side public certificate to authenticate needed client?

Any examples?

 

Thank you very much!

 

Facing issue related to combox in the firemonkey application in delphi 10.1 berlin

$
0
0

We are facing issue with the combo box in the fire monkey application. As we add the values in the combo box with special character then in the drop down it is not showing the special character instead it is showing the underscore character.Please help us in this. For example : add  "delphi$123"  in the combo box. In the drop down it is showing "delphi_123" 

Problem with form height in IDE

$
0
0

Form 800x600 being resized to 800x580 when the form is opened in the IDE. What to do?

Failed to find standard type 'TObject'

$
0
0

Hi. I'm getting this error when trying to create a class in delphi. Someone know how to solve? It's apparently a no-reason error because if I just try a new unit and try to create a class it returns me this error.


Rest Server using text/html is removing carriage returns

$
0
0

In the delphi rest server project wizard evidently there is a bug that causes it to always return json.  

I found a post on board that said to add this code to override it as in code below. As shown i have set it to text/htm; charset=utf8 and that does cause it to return document with html wrapper.  After setting this i take the string and convert it to a stream using stringtostream also shown below.  The problem is even though the string and the resultant stream contain line seperators with 0D0A, the data that comes back in the browser is lacking the carriage return (has 0A only).  Makes for hard reading in some editors.  

Any ideas of why it would remove the cr?

================================================

procedure TWebModule1.WebModuleAfterDispatch(Sender: TObject;

  Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);

begin

   if ContentTypeHeaderToUse<>'' then begin

    Response.ContentType := 'text/html; charset=utf-8';//ContentTypeHeaderToUse;

 

    ContentTypeHeaderToUse := ''; // Reset global variable

  end;

end;

 

=====================

function TServerMethods1.StringToStream(s: String) : tStream;

var

  st : tStringStream;

begin

  st:=tStringStream.Create(s);

  result:=st;

end;

 

 

C++ Builder Win64 Access Violation in xlocale

$
0
0

I've create a project which is working fine under OSX. 

I now wish to port this project to Win64.

This project was developed using RAD Studio C++ Builder Berlin Anniversary Edition 10.1 Update 2 Enterprise. Target Win64.

When running the application, an access violation occurs during the main form creation.

Running in Debug, the error occurs in 'xlocale' at line # 2171 which reads as follows:

*(size_t *)&table_size = 1 << CHAR_BIT;// force space reservation

I should also mention that this line is bounded by "#ifdef __BORLANDC__" and "#endif".

Also, during application startup, I am not using streams in the constructor; therefore, I truly don't understand how the compiler is setting up the application for launch.

Doing some googling, I have found this issue appears to persist through multiple versions of C++ Builder. The results tend to be work-arounds that may or may not work.

For kicks and giggles, I tried one of them which appeared the least invasive to my project and the overall installation of RAD Studio. The suggestion was to declare a stream within the module that initializes the application, creates any pre-created forms, and launches the main form. Curiously, this duplicated the error; however, the call stack now referenced the "main" module instead of the "main" form. The error location was exactly the same!

So, is there a problem with the STL files for C++ Builder?

Could some kindly provide a work-around to this situation?

Any help or suggestions will be greatly appreciated.

Using Delphi 10.2 and can't turn off "Enable runtime themes"

$
0
0

I'm using Delphi 10.2 and can't turn off enable runtime themes. I uncheck the option in the Project Options -> Application page, then click the OK button, then re-open Project Options, and the box is checked again! What am I missing? How do I uncheck this option?`

10.2 Debugger not showing values of variables

$
0
0

By hovering over a variable in a breakpoint the debugger shows me the same as in design-time.

What I'd like to see is the value of the variable as in preceding versions. Is this a bug or a setting I have to configure?

(by explicitly asking for it with Ctrl F7 I get the value)

 

10.1 Debugger not showing structure or value of variables

$
0
0

Hi,
I have a program that was written in the 7.0 debugger, however when I open that program in the 10.1 debugger, I can't view the structure of the program. I tried creating a new project and importing the files but the result was the same. The other error is that the program refuses to show the values of variables while debugging (with breakpoints). I can't really write everything from scratch again as a) the program is not mine, I have to edit it. (b) it is a very huge program and writing it again as well as designing the forums will set me quite a bit. Is this a bug or is the debugger just not compatible with the older versions? (Which is very infuriating) if this is the case, can someone please link me to the 7.0 debugger as I can't find it anymore.

Viewing all 1963 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>