String obfuscation and function names
-
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 warningPublic ReadOnly Property mcpGetName() As String ' <- because of this
Get
Return "xxx"
End Get
End PropertyAtara
-
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 warningPublic ReadOnly Property mcpGetName() As String ' <- because of this
Get
Return "xxx"
End Get
End PropertyAtara
You can change the name of the property right?
.: I love it when a plan comes together :. http://www.zonderpunt.nl
-
You can change the name of the property right?
.: I love it when a plan comes together :. http://www.zonderpunt.nl
-
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
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 -
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 -
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 warningPublic ReadOnly Property mcpGetName() As String ' <- because of this
Get
Return "xxx"
End Get
End PropertyAtara
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
-
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
-
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
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.
-
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.
-
Thanks. meanwhile I use .Net 2, for "old" computers, but I will keep this in mind when upgrading.
Atara
No problem. Actually, a correction, I think it will work on .NET 3.0+, but that still doesn't help you :)
-
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 warningPublic ReadOnly Property mcpGetName() As String ' <- because of this
Get
Return "xxx"
End Get
End PropertyAtara
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.