Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. VB6 dll calls from WCF

VB6 dll calls from WCF

Scheduled Pinned Locked Moved .NET (Core and Framework)
csharphelpwcfhosting
27 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    Emanuela Meraglia
    wrote on last edited by
    #1

    Hi everyone, I created a library of the WCF service, which recalls a VB6 dll. The problem is this: in the procedures of the VB6 dll (not my owner) strange errors occur (especially with dates), if the initial process that hosts it is the WCF service. Everything works correctly if the initial process is a VB6 executable, a VB.NET executable, or if I run the VB6 project in debug. Among the many attempts I set all my projects with CPUs targeting x86, and although I had no problems compiling the WCF service, I also tried to replace WcfSvcHost.exe with the same in 32-bit mode (with the command "corflags / 32BIT + / FORCE WcfSvcHost.exe "), but the problem persists. Actually I don't think it's even necessary, as the hosting of the WCF library is an application console. I have no idea how to solve ... can anyone help me?

    L Richard DeemingR D E 5 Replies Last reply
    0
    • E Emanuela Meraglia

      Hi everyone, I created a library of the WCF service, which recalls a VB6 dll. The problem is this: in the procedures of the VB6 dll (not my owner) strange errors occur (especially with dates), if the initial process that hosts it is the WCF service. Everything works correctly if the initial process is a VB6 executable, a VB.NET executable, or if I run the VB6 project in debug. Among the many attempts I set all my projects with CPUs targeting x86, and although I had no problems compiling the WCF service, I also tried to replace WcfSvcHost.exe with the same in 32-bit mode (with the command "corflags / 32BIT + / FORCE WcfSvcHost.exe "), but the problem persists. Actually I don't think it's even necessary, as the hosting of the WCF library is an application console. I have no idea how to solve ... can anyone help me?

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Emanuela Meraglia wrote:

      strange errors occur

      Please don't keep them secret.

      E 1 Reply Last reply
      0
      • E Emanuela Meraglia

        Hi everyone, I created a library of the WCF service, which recalls a VB6 dll. The problem is this: in the procedures of the VB6 dll (not my owner) strange errors occur (especially with dates), if the initial process that hosts it is the WCF service. Everything works correctly if the initial process is a VB6 executable, a VB.NET executable, or if I run the VB6 project in debug. Among the many attempts I set all my projects with CPUs targeting x86, and although I had no problems compiling the WCF service, I also tried to replace WcfSvcHost.exe with the same in 32-bit mode (with the command "corflags / 32BIT + / FORCE WcfSvcHost.exe "), but the problem persists. Actually I don't think it's even necessary, as the hosting of the WCF library is an application console. I have no idea how to solve ... can anyone help me?

        Richard DeemingR Offline
        Richard DeemingR Offline
        Richard Deeming
        wrote on last edited by
        #3

        You're going to need to provide more details on the errors you're getting. My guess would be something to do with the regional settings for the session that's hosting your WCF service. But without any details, it's just a guess.


        "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

        "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

        E 2 Replies Last reply
        0
        • E Emanuela Meraglia

          Hi everyone, I created a library of the WCF service, which recalls a VB6 dll. The problem is this: in the procedures of the VB6 dll (not my owner) strange errors occur (especially with dates), if the initial process that hosts it is the WCF service. Everything works correctly if the initial process is a VB6 executable, a VB.NET executable, or if I run the VB6 project in debug. Among the many attempts I set all my projects with CPUs targeting x86, and although I had no problems compiling the WCF service, I also tried to replace WcfSvcHost.exe with the same in 32-bit mode (with the command "corflags / 32BIT + / FORCE WcfSvcHost.exe "), but the problem persists. Actually I don't think it's even necessary, as the hosting of the WCF library is an application console. I have no idea how to solve ... can anyone help me?

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Does it run under the same user credentials as a normal executable?

          Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

          E 1 Reply Last reply
          0
          • Richard DeemingR Richard Deeming

            You're going to need to provide more details on the errors you're getting. My guess would be something to do with the regional settings for the session that's hosting your WCF service. But without any details, it's just a guess.


            "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

            E Offline
            E Offline
            Emanuela Meraglia
            wrote on last edited by
            #5

            I don't have the error because the VB6 dll is not mine, but with SQL profiler I found errors in the queries due to lack or incorrect formatting of dates.

            Richard DeemingR 1 Reply Last reply
            0
            • L Lost User

              Emanuela Meraglia wrote:

              strange errors occur

              Please don't keep them secret.

              E Offline
              E Offline
              Emanuela Meraglia
              wrote on last edited by
              #6

              I don't have the error because the VB6 dll is not mine, but with SQL profiler I found errors in the queries due to lack or incorrect formatting of dates.

              A 1 Reply Last reply
              0
              • Richard DeemingR Richard Deeming

                You're going to need to provide more details on the errors you're getting. My guess would be something to do with the regional settings for the session that's hosting your WCF service. But without any details, it's just a guess.


                "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                E Offline
                E Offline
                Emanuela Meraglia
                wrote on last edited by
                #7

                The error also occurs on my development PC, on which everything is executed. So I don't think it's a problem of regional settings.

                S 1 Reply Last reply
                0
                • L Lost User

                  Does it run under the same user credentials as a normal executable?

                  Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                  E Offline
                  E Offline
                  Emanuela Meraglia
                  wrote on last edited by
                  #8

                  I start the service without credentials:

                  Private Sub AvviaServizio(ByVal t As Type, ByVal uri As String, ByVal classe As String)
                  Dim binding As New BasicHttpBinding
                  binding.OpenTimeout = New TimeSpan(0, 10, 0)
                  binding.CloseTimeout = New TimeSpan(0, 10, 0)
                  binding.SendTimeout = New TimeSpan(0, 10, 0
                  'binding.ReceiveTimeout = New TimeSpan(0, 10, 0)
                  'binding.Security.Mode = SecurityMode.Transport
                  'binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None
                  'binding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.None
                  binding.MaxBufferPoolSize = 2147483647
                  binding.MaxBufferSize = 2147483647
                  binding.MaxReceivedMessageSize = 2147483647
                  binding.MessageEncoding = WSMessageEncoding.Text

                      Dim host As New ServiceModel.ServiceHost(t)
                      host.AddServiceEndpoint(classe, binding, New Uri(uri & classe))
                      Try
                          host.Description.Behaviors.Add(New ServiceMetadataBehavior With {
                              .HttpGetEnabled = True,
                              .HttpGetUrl = New Uri(uri & classe)
                          })
                          host.Open()
                  
                          \_service.Add(host)
                      Catch ex As Exception
                          host.Abort()
                          Throw
                      End Try
                  End Sub
                  
                  L 1 Reply Last reply
                  0
                  • E Emanuela Meraglia

                    I start the service without credentials:

                    Private Sub AvviaServizio(ByVal t As Type, ByVal uri As String, ByVal classe As String)
                    Dim binding As New BasicHttpBinding
                    binding.OpenTimeout = New TimeSpan(0, 10, 0)
                    binding.CloseTimeout = New TimeSpan(0, 10, 0)
                    binding.SendTimeout = New TimeSpan(0, 10, 0
                    'binding.ReceiveTimeout = New TimeSpan(0, 10, 0)
                    'binding.Security.Mode = SecurityMode.Transport
                    'binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None
                    'binding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.None
                    binding.MaxBufferPoolSize = 2147483647
                    binding.MaxBufferSize = 2147483647
                    binding.MaxReceivedMessageSize = 2147483647
                    binding.MessageEncoding = WSMessageEncoding.Text

                        Dim host As New ServiceModel.ServiceHost(t)
                        host.AddServiceEndpoint(classe, binding, New Uri(uri & classe))
                        Try
                            host.Description.Behaviors.Add(New ServiceMetadataBehavior With {
                                .HttpGetEnabled = True,
                                .HttpGetUrl = New Uri(uri & classe)
                            })
                            host.Open()
                    
                            \_service.Add(host)
                        Catch ex As Exception
                            host.Abort()
                            Throw
                        End Try
                    End Sub
                    
                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #9

                    That doesn't answer my question; write the name of the current user to a logfile or similar to check.

                    Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                    E 1 Reply Last reply
                    0
                    • L Lost User

                      That doesn't answer my question; write the name of the current user to a logfile or similar to check.

                      Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                      E Offline
                      E Offline
                      Emanuela Meraglia
                      wrote on last edited by
                      #10

                      I don't understand which user you're referring to

                      L 1 Reply Last reply
                      0
                      • E Emanuela Meraglia

                        Hi everyone, I created a library of the WCF service, which recalls a VB6 dll. The problem is this: in the procedures of the VB6 dll (not my owner) strange errors occur (especially with dates), if the initial process that hosts it is the WCF service. Everything works correctly if the initial process is a VB6 executable, a VB.NET executable, or if I run the VB6 project in debug. Among the many attempts I set all my projects with CPUs targeting x86, and although I had no problems compiling the WCF service, I also tried to replace WcfSvcHost.exe with the same in 32-bit mode (with the command "corflags / 32BIT + / FORCE WcfSvcHost.exe "), but the problem persists. Actually I don't think it's even necessary, as the hosting of the WCF library is an application console. I have no idea how to solve ... can anyone help me?

                        D Offline
                        D Offline
                        Dave Kreskowiak
                        wrote on last edited by
                        #11

                        VB6 can only make COM-exposed .DLL's. I don't know if that means or affects anything, but there it is. Without seeing the code that's calling the functions in the .DLL, and the error messages coming back from SQL Server, it's going to be impossible to tell you anything useful. The biggest problem is we can see the code in the VB6 .DLL, so we don't know what it expects in the function calls.

                        Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
                        Dave Kreskowiak

                        E 1 Reply Last reply
                        0
                        • E Emanuela Meraglia

                          I don't understand which user you're referring to

                          L Offline
                          L Offline
                          Lost User
                          wrote on last edited by
                          #12

                          Environment.UserName All the code runs under specific credentials. Your hosted service may not be running as a default user.

                          Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                          E 1 Reply Last reply
                          0
                          • D Dave Kreskowiak

                            VB6 can only make COM-exposed .DLL's. I don't know if that means or affects anything, but there it is. Without seeing the code that's calling the functions in the .DLL, and the error messages coming back from SQL Server, it's going to be impossible to tell you anything useful. The biggest problem is we can see the code in the VB6 .DLL, so we don't know what it expects in the function calls.

                            Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
                            Dave Kreskowiak

                            E Offline
                            E Offline
                            Emanuela Meraglia
                            wrote on last edited by
                            #13

                            I do not have the VB6 dll source from my provider, so I have no way of getting the error.
                            I am attaching images of errors captured by SQL Profiler, but I don't think they can help.
                            The 1.png, 2.png and 3.png files are screenshots of the SQL profiler traces captured at Runtime, while the 1_Debug.png, 2_Debug.png and 3_Debug.png files are screenshots of the SQL profiler traces captured in Debug (so working).

                            Since the errors do not occur by calling the VB6 dll from VB6 or VB.NET applications, or by debugging my VB6 project which instantiates the external dll, I thought the problem lies in the process that hosts it.

                            https://drive.google.com/open?id=1Wziux18JvKzx-7DtBMTSfrOT5TuANVVF

                            L S 2 Replies Last reply
                            0
                            • L Lost User

                              Environment.UserName All the code runs under specific credentials. Your hosted service may not be running as a default user.

                              Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                              E Offline
                              E Offline
                              Emanuela Meraglia
                              wrote on last edited by
                              #14

                              I wrote the current user in my log file, and it matches with the Windows credentials I logged in with ... so it's ok.

                              L 1 Reply Last reply
                              0
                              • E Emanuela Meraglia

                                I do not have the VB6 dll source from my provider, so I have no way of getting the error.
                                I am attaching images of errors captured by SQL Profiler, but I don't think they can help.
                                The 1.png, 2.png and 3.png files are screenshots of the SQL profiler traces captured at Runtime, while the 1_Debug.png, 2_Debug.png and 3_Debug.png files are screenshots of the SQL profiler traces captured in Debug (so working).

                                Since the errors do not occur by calling the VB6 dll from VB6 or VB.NET applications, or by debugging my VB6 project which instantiates the external dll, I thought the problem lies in the process that hosts it.

                                https://drive.google.com/open?id=1Wziux18JvKzx-7DtBMTSfrOT5TuANVVF

                                L Offline
                                L Offline
                                Lost User
                                wrote on last edited by
                                #15

                                Your link points to this page.

                                E 1 Reply Last reply
                                0
                                • L Lost User

                                  Your link points to this page.

                                  E Offline
                                  E Offline
                                  Emanuela Meraglia
                                  wrote on last edited by
                                  #16

                                  Errori.zip - Google Drive[^]

                                  L 1 Reply Last reply
                                  0
                                  • E Emanuela Meraglia

                                    I don't have the error because the VB6 dll is not mine, but with SQL profiler I found errors in the queries due to lack or incorrect formatting of dates.

                                    Richard DeemingR Offline
                                    Richard DeemingR Offline
                                    Richard Deeming
                                    wrote on last edited by
                                    #17

                                    Emanuela Meraglia wrote:

                                    errors in the queries due to lack or incorrect formatting of dates

                                    That would suggest that the VB6 code is vulnerable to SQL Injection[^]. It it was using properly parameterized queries, date formatting wouldn't be an issue. This is a serious security vulnerability. You should either get the author to rewrite the VB6 code, or find some way to replace it.


                                    "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                                    "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

                                    E 1 Reply Last reply
                                    0
                                    • E Emanuela Meraglia

                                      I wrote the current user in my log file, and it matches with the Windows credentials I logged in with ... so it's ok.

                                      L Offline
                                      L Offline
                                      Lost User
                                      wrote on last edited by
                                      #18

                                      :thumbsup:

                                      Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                                      1 Reply Last reply
                                      0
                                      • Richard DeemingR Richard Deeming

                                        Emanuela Meraglia wrote:

                                        errors in the queries due to lack or incorrect formatting of dates

                                        That would suggest that the VB6 code is vulnerable to SQL Injection[^]. It it was using properly parameterized queries, date formatting wouldn't be an issue. This is a serious security vulnerability. You should either get the author to rewrite the VB6 code, or find some way to replace it.


                                        "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                                        E Offline
                                        E Offline
                                        Emanuela Meraglia
                                        wrote on last edited by
                                        #19

                                        They are rewriting it, but in the meantime I have to use their dll VB6! :(

                                        1 Reply Last reply
                                        0
                                        • E Emanuela Meraglia

                                          Errori.zip - Google Drive[^]

                                          L Offline
                                          L Offline
                                          Lost User
                                          wrote on last edited by
                                          #20

                                          All the messages seem to be complaining about the syntax of the SELECT clauses (assuming my innterpretation of the Italian is coorect), and suggesting that it has something to do with the Date values. I think the only way to resolve this is to talk to the owners of the DLL.

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups