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. Visual Basic
  4. String obfuscation and function names

String obfuscation and function names

Scheduled Pinned Locked Moved Visual Basic
comquestion
11 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.
  • A Atara

    Can I change the following code and safely obfuscate it ? or that I must exclude it from obfuscating (e.g. http://stackoverflow.com/questions/2555355/obfuscating-asp-net-dll-breaks-web-application/2555497#2555497[^] )

    Dim fontNames As New ArrayList
    . . .

    Me.myCtrlCmbFontName.DataSource = fontNames
    Me.myCtrlCmbFontName.DisplayMember = "mcpGetName" ' <- Here I get a warning

    Public ReadOnly Property mcpGetName() As String ' <- because of this
    Get
    Return "xxx"
    End Get
    End Property

    Atara

    E Offline
    E Offline
    Eduard Keilholz
    wrote on last edited by
    #2

    You can change the name of the property right?

    .: I love it when a plan comes together :. http://www.zonderpunt.nl

    A 1 Reply Last reply
    0
    • E Eduard Keilholz

      You can change the name of the property right?

      .: I love it when a plan comes together :. http://www.zonderpunt.nl

      A Offline
      A Offline
      Atara
      wrote on last edited by
      #3

      The obfuscator changes the name of the property. But I cannot tell it to change DisplayMember accordingly. Can I re-write this code so the DisplayMember is not a string with a function name? Atara

      Atara

      D 1 Reply Last reply
      0
      • A Atara

        The obfuscator changes the name of the property. But I cannot tell it to change DisplayMember accordingly. Can I re-write this code so the DisplayMember is not a string with a function name? Atara

        Atara

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

        Depends on the obfuscator. Most won't change the string, so you'd have to exclude it.

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak

        A 1 Reply Last reply
        0
        • D Dave Kreskowiak

          Depends on the obfuscator. Most won't change the string, so you'd have to exclude it.

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak

          A Offline
          A Offline
          Atara
          wrote on last edited by
          #5

          Ok, Thanks.

          Atara

          1 Reply Last reply
          0
          • A Atara

            Can I change the following code and safely obfuscate it ? or that I must exclude it from obfuscating (e.g. http://stackoverflow.com/questions/2555355/obfuscating-asp-net-dll-breaks-web-application/2555497#2555497[^] )

            Dim fontNames As New ArrayList
            . . .

            Me.myCtrlCmbFontName.DataSource = fontNames
            Me.myCtrlCmbFontName.DisplayMember = "mcpGetName" ' <- Here I get a warning

            Public ReadOnly Property mcpGetName() As String ' <- because of this
            Get
            Return "xxx"
            End Get
            End Property

            Atara

            F Offline
            F Offline
            Former employee
            wrote on last edited by
            #6

            Hi, In DeepSea Obfuscator, you can obfuscate this if you exclude the property from renaming by attaching the standard Obfuscation attribute to it. Kind regards, Ewout Prangsma

            A 1 Reply Last reply
            0
            • F Former employee

              Hi, In DeepSea Obfuscator, you can obfuscate this if you exclude the property from renaming by attaching the standard Obfuscation attribute to it. Kind regards, Ewout Prangsma

              A Offline
              A Offline
              Atara
              wrote on last edited by
              #7

              It seems that I must exclude it. and there is no way to re-write the code so I donot use function-name as a string. Thanks

              Atara

              M 1 Reply Last reply
              0
              • A Atara

                It seems that I must exclude it. and there is no way to re-write the code so I donot use function-name as a string. Thanks

                Atara

                M Offline
                M Offline
                Mike Marynowski
                wrote on last edited by
                #8

                There actually is a way if you are using .NET 3.5 or higher, using expression trees. You would create a helper method called GetPropertyName(Expression propEx), and call it like: this.myCtrlCmbFontName.DisplayMember = GetPropertyName(() => this.mcpGetName); (sorry, C# syntax, I'm not too familiar with VB, but I think you get the idea). The GetPropertyName method would traverse the expression tree and find the appropriate property name being accessed by the provided expression. You will have to do some Googling from here to figure out the rest, but if you have any specific questions once you get going, feel free to ask.

                A 1 Reply Last reply
                0
                • M Mike Marynowski

                  There actually is a way if you are using .NET 3.5 or higher, using expression trees. You would create a helper method called GetPropertyName(Expression propEx), and call it like: this.myCtrlCmbFontName.DisplayMember = GetPropertyName(() => this.mcpGetName); (sorry, C# syntax, I'm not too familiar with VB, but I think you get the idea). The GetPropertyName method would traverse the expression tree and find the appropriate property name being accessed by the provided expression. You will have to do some Googling from here to figure out the rest, but if you have any specific questions once you get going, feel free to ask.

                  A Offline
                  A Offline
                  Atara
                  wrote on last edited by
                  #9

                  Thanks. meanwhile I use .Net 2, for "old" computers, but I will keep this in mind when upgrading.

                  Atara

                  M 1 Reply Last reply
                  0
                  • A Atara

                    Thanks. meanwhile I use .Net 2, for "old" computers, but I will keep this in mind when upgrading.

                    Atara

                    M Offline
                    M Offline
                    Mike Marynowski
                    wrote on last edited by
                    #10

                    No problem. Actually, a correction, I think it will work on .NET 3.0+, but that still doesn't help you :)

                    1 Reply Last reply
                    0
                    • A Atara

                      Can I change the following code and safely obfuscate it ? or that I must exclude it from obfuscating (e.g. http://stackoverflow.com/questions/2555355/obfuscating-asp-net-dll-breaks-web-application/2555497#2555497[^] )

                      Dim fontNames As New ArrayList
                      . . .

                      Me.myCtrlCmbFontName.DataSource = fontNames
                      Me.myCtrlCmbFontName.DisplayMember = "mcpGetName" ' <- Here I get a warning

                      Public ReadOnly Property mcpGetName() As String ' <- because of this
                      Get
                      Return "xxx"
                      End Get
                      End Property

                      Atara

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

                      Yes, you will need to exlcude it from obfuscation. BTW which obfuscator are you using? Crypto Obfuscator has a cool feature which lists all such code points which need attention.

                      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