|
S.Haris wrote: if I had an app which was developed in vb.net and does similar function would i be able to get the source code out of it like actuall function etc.... I was able to get the funtions name and stuff but not the way the function was written ??
if so could you please shade some light in how to archive that goal
thanks
Hi,
Assuming that the .NET application has not been Obfuscated, you can get all the code, including functions, classes and form elements (100% of the code) back. One of my favorite .NET decompilers is Dis#, which will can give you back C# or VB.NET code out of .NET exe or dll (depending on which one you choose). It can be downloaded here:
http://www.netdecompiler.com/[^]
Pete Soheil
DigiOz Multimedia
http://www.digioz.com
|
|
|
|
|
as far as i know i dont think its been Obfuscated but on second hand how could i bee sure thats it has not been is there any way to tell
if so can you please shade some light I I dont mean to be a compelet Leacher... Sorry If I am being one...
|
|
|
|
|
S.Haris wrote: as far as i know i dont think its been Obfuscated but on second hand how could i bee sure thats it has not been is there any way to tell
Download the trial version of Dis# software and try to open it. If it opens it without a problem it means its not Obfuscated.
Pete Soheil
DigiOz Multimedia
http://www.digioz.com
|
|
|
|
|
You could always try using the suggested tool and see if it successfully completes and produces usable code..
Michael Davey
|
|
|
|
|
Apologies.. didn't see that the conversation had gone over the page!
Michael Davey
|
|
|
|
|
DigiOz Multimedia wrote: Assuming that the .NET application has not been Obfuscated, you can get all the code, including functions, classes and form elements (100% of the code) back.
Does that include comments and #ifdef'ed out sections? What reason exists for throwing all the source code into an executable? What purpose does it serve?
|
|
|
|
|
supercat9 wrote: Does that include comments and #ifdef'ed out sections?
You get the equivalent of the original code back. I don't believe you can get the comments back though, because the CLR just ignores those. Not sure about #ifdef.
supercat9 wrote: What reason exists for throwing all the source code into an executable? What purpose does it serve?
You don't throw the source code into the executable, the source code is used to compile the executable.
Pete Soheil
DigiOz Multimedia
http://www.digioz.com
|
|
|
|
|
Hi,
in general a decompiler returns a synthetic source code that, when compiled again,
results in the same EXE/DLL. It will not include parts the compiler did not need,
such as comments, code snippets ignored by preprocessing, redundant statements, etc.
And it will not necesserally look like the original:
- variable names may be fictitious (local variable names typically are not present in EXE);
- program flow control may look different (for, while, ...) but will be equivalent
- the optimization may have moved lines around;
etc.
A .NET decompile will resemble the original much closer, since there is a lot of metadata
in the assemblies; decompiling a debug build may look very similar to the original,
except for the comments. In fact, compile then decompile is one way to translate a
source file to another programming language (e.g. VB.NET to C#), again loosing comments.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
A .NET decompile will resemble the original much closer, since there is a lot of metadata
in the assemblies; decompiling a debug build may look very similar to the original,
except for the comments.
Okay, that makes sense. So it's not really storing the source--just enough information to figure out what the code is up to, plus (if debug information is enabled) a full symbol table.
BTW, why did compilers get in the habit of throwing debug information into a .EXE file? When debugging one could just as easily have the information in another file, and when not debugging it's not only useless bloat but it may also undermine any secrets stored within the application.
|
|
|
|
|
supercat9 wrote: why did compilers get in the habit of throwing debug information into a .EXE file? When debugging one could just as easily have the information in another file, and when not debugging it's not only useless bloat but it may also undermine any secrets stored within the application.
A lot of development systems (such as Visual Studio) give you a choice (Debug/Release,
several switches) about the amount of debug info in an EXE/DLL. They typically use extra
files (.PDB) for symbol definitions, and only use source files for showing the current file/function/line. Needing/wanting all these files is fine on the development machine,
it is troublesome on other machines where early testing shows some problems (files missing,
files out of sync, ...).
In .NET more info must be present in the EXE/DLL because of reflection: by default one can
interrogate an assembly as to what classes, fields, methods it is holding. Obfuscating
hides that information and would disable reflection, except for the names that are specially
flagged for this purpose.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
sample code from intro to vb using .net (dana l.wyatt)
is as follows
********************************
Private Sub btnShowAll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShowAll.Click
If lstAnimals.SelectedItems.Count < 1 Then
Exit Sub
End If
Dim s As String
Dim index As Integer
s = lstAnimals.SelectedItems.Item(0)
For index = 1 To lstAnimals.SelectedItems.Count - 1
s &= ", " & lstAnimals.SelectedItems.Item(index)
Next
MessageBox.Show(s, "Selected Animals")
End Sub
***************************
and it works
but in my program it doesnt
I have to add .ToString to avoid
Cast from type 'DataRowView' to type 'String' is not valid.
but then it prints "System.Data.DataRowView" instead of the value member I need
**************************************
my code
If ListBox1.SelectedItems.Count < 1 Then
Exit Sub
End If
Dim s As String
Dim index As Integer
s = ListBox1.SelectedItems.Item(0).ToString
For index = 1 To ListBox1.SelectedItems.Count - 1
Console.WriteLine(ListBox1.SelectedItems.Item(index).ToString)
Next
MessageBox.Show(s, "Selected Animals")
any assistance would be greatly appreciated
also get invalid cast when try this
Private Sub btnShowAll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShowAll.Click
Dim s As String = ""
For index As Integer = 0 To lstAnimals.SelectedItems.Count - 1
Dim drv As DataRowView = CType(lstAnimals.SelectedItem(index), DataRowView)
s &= drv.Item("name or index of field") & ControlChars.CrLf
Next
MessageBox.Show(s, "Selected Animals")
End Sub
|
|
|
|
|
I am using VB6 and am trying to copy the text from a form to the windows clipboard and paste it into another program (ie MSWord)
In my program I have a button, when clicked it runs, pulls the data of my
Clipbpard.SetText COPY_MY_DATA.TEXT
this appears to copy the text in the COPY_MY_DATA field. If I ctrl-v to another field with in my program I can past the data.
But
If I alt-tab to word and ctrl-v I get something totaly differant
How do I updated the windows clipboard so I can paste to any application?
|
|
|
|
|
Have you solved this problem?
"I've seen more information on a frickin' sticky note!" - Dave Kreskowiak
|
|
|
|
|
Yes thanks
Im my form I fill in my "CopyThisData" multiline text box.
Then I have a button that runs:
Clipboard.Clear
Clipboard.SetText CopyThisData.Text
When I Alt-Tab to MSWord and Ctrl-p I get the text that was copied.
Though, some times when I paste into word I dont get anything so I need to click the "Copy" button in my program again
|
|
|
|
|
If proper use of an object requires explicit disposal any time it's going out of scope, is there any way to have the system make a note of times this fails to occur, in such a way as to provide useful information about the stranded object? My understanding is that the finalize method is not supposed to do anything with any sort of managed object, so logging would seem to be difficult.
Also, is there any practical way to discover if the 'primary' reference to an item becomes stranded, even though secondary references exist? For example, suppose I have a class that's supposed to fire an event in response to something else occurring. When an instance is created, it sets a pointer to itself in some other object that will know about the occurrence. Even if the primary reference to that instance goes away (which would cause any event therein to fail) the other object would still point to it. Is there any good way to detect this condition and flag it?
|
|
|
|
|
I have a suggestion that touches your second topic: the WeakReference Class allows you
to hold a reference somewhere (say in a ArrayList/List) to items without keeping the gc
from collecting them. its IsAlive property will tell you the actual object status.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Thanks. I just did a search on "weakReference" and found a very helpful article on this web site (knowing the right words to search for helps a lot).
http://www.codeproject.com/dotnet/garbagecollection.asp
I'm still not sure the best way to log objects which get finalized before being disposed. I would guess that it should be possible to use some static variables to report that such things happen; perhaps that would be a good place to start.
|
|
|
|
|
Hi, adding a finalizer for the purpose of logging would disrupt the normal operation of the
memory management too much (objects with finalizer are handled differently, their disposal
is more expensive). So what I do occasionally is keep a list of "important" objects
using weak references, then periodically check what's Alive in the list.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Hmm... that actually sounds like that might be a better approach anyway. If my pool of objects contains weak references to the objects in question, then any time it discovers that an object in the pool has been deleted it could log an event and do a cleanup. The object itself would have a tight reference to the pool, but that shouldn't be an issue. Thanks for the suggestion.
|
|
|
|
|
-1- Is there any way to find out if data is available from a stream other than by trying to read it and getting a timeout exception? The stream will most likely be the basestream of a socket or serial port.
-2- If not, is there any way to stop the timeout exceptions from filling up the immediate window?
-3- What is the best way to set up a buffer stream for simultaneous non-seek reading and writing? When I go to output data to a stream, I'd like to at that time read the data from the stream and store it into a log file and into a buffer stream so that the it can be read at leisure. I just coded a rather clunky class to do that, but that's probably the wrong approach.
-4- If I want to make incoming data available to multiple handlers, some of which will want events when it comes in and some of which would be happier with input streams, what's the right approach?
|
|
|
|
|
I dont understand much about what you are trying to do, but have used a StreamReader to input from files. I use the .Peek command to tell if there is data before reading, as follows ..
Dim sr as New System.IO.StreamReader(txtFileName)
While sr.Peek <> -1
txtRecord = sr.ReadLine
End While
Sorry if this is irrelevant. I am a relative newbie
|
|
|
|
|
I'll have to see if Peek does what I'm looking for.
To better explain #3, I'd like a stream which starts out empty. If I write some number of bytes into it, I want to be able to read them back, in the same order, without doing a seek. So, for example:
Stuff "HEY THERE" in queue
Ask to read 6 bytes--get "HEY TH"
Stuff " MR. SMITH!" in queue
Ask to read 6 bytes--get "ERE MR"
Ask to read 6 bytes--get ". SMIT"
Ask to read 6 bytes--get "H!"
A memorystream doesn't seem to be quite what I'm after, since it would require seeking between the read and write operations. Further, from what I can tell, data in a memorystream will remain around forever even after it's been read.
As for #4, there will be a few types of data mixed in with a serial input stream and I'd like to be able to have the same data get passed through to different handlers (some of which may serve to log what's going on, and others of which may just look for particular items of interest). I'm still in the process of sketching out an application design, since I don't really know what's practical and what isn't.
|
|
|
|
|
Ive been trying to save a text file i opened up into a data grid.
Have searched all over this site and the net and have not found anything that helps.
|
|
|
|
|
One way would be to iterate through the rows and columns and to write each cell to the file using a streamwriter.
|
|
|
|
|
Hello,
Is there a way to detect the value of a property has been reapplied?
There is an event that fires for the 'enabled' property of all controls called 'EnabledChanged". This fires as expected when I changed the enabled property to true or false. Is there anyway to get it to fire regardless of the value being applied? Meaning if enabled=true - if I set it to true again then fire the event.
The reason is our users do not like the readability of the controls when they are disabled. I have been playing with "paint event overrides" and other techniques but not all controls lend themselves to this technique or the drawing is inconsistent.
Open to any ideas...
Thanks, Nathan
|
|
|
|