|
-
Sep 6th, 2014, 05:14 PM
#1
Thread Starter
Lively Member
-
Sep 6th, 2014, 08:49 PM
#2
Re: Extract string from exe file
You would get the text contents of that file the same way you would get the text contents of any file, the simplest way being to call File.ReadAllText. You may have to specify a particular Encoding to get the same result as Notepad produces. I'm guessing that it would use UTF8 but I'm not 100% sure.
-
Sep 7th, 2014, 04:35 AM
#3
Thread Starter
Lively Member
Re: Extract string from exe file
Thank you mr. jmcilhinney , but it gives me only this result in image .. when i use this code
Code:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim StrArray = System.IO.File.ReadAllLines("c:\WindowsApplication1.exe", Encoding.UTF8)
For Each L In StrArray
TextBox1.AppendText(L.ToString & vbNewLine)
Next
End Sub
it's not all the string!!
-
Sep 7th, 2014, 05:12 AM
#4
Re: Extract string from exe file
-
Sep 7th, 2014, 05:20 AM
#5
Thread Starter
Lively Member
Re: Extract string from exe file
if you mean this code
Code:
TextBox1.Text = System.IO.File.ReadAllText("c:\WindowsApplication1.exe", Encoding.UTF8)
it gives me only this
-
Sep 7th, 2014, 05:35 AM
#6
Re: Extract string from exe file
Did you try different Encodings?
-
Sep 7th, 2014, 05:48 AM
#7
Thread Starter
Lively Member
Re: Extract string from exe file
i try it all .. and no result
-
Sep 7th, 2014, 06:36 AM
#8
Re: Extract string from exe file
An .exe file will almost certainly contain bytes with value = 0. When converting the .exe to a string, these will typically be treated as Null chars (depends to some extent on the Encoding being used).
A Null char is considered by many languages to indicate the end of the string. When Windows renders text, any characters following a Null char are not rendered.
In order for Notepad to display the text as it does, it seems to replace Null chars (bytes whose value = 0) with Spaces (bytes whose value = 32).
You need to do the same if you want your output to look like Notepad's.
I think the encoding used in Notepad by default is an ANSI encoding, which would be Encoding.Default for me. Probably the same for you, but I'm not 100% sure. Something you can research.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|