472,351 Members | 1,470 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,351 software developers and data experts.

Convert string to hex and write file

Tim
Hi,

What I am trying to accomplish is to initiate remote desktop session from
within my C# application to XP Pro machine NOT terminal services to a
server.

I have not found any way to do this with code (if you know of a way then I
would love to hear about it). What I have created so far is;

1. Write RDP file to the HD from the code
2. Start process with file as argument

Process rdp = new Process();
rdp.StartInfo.FileName = "mstsc.exe"; //remote desktop
rdp.StartInfo.WorkingDirectory = WorkingDirectory; //dir of rdp file
rdp.StartInfo.Arguments = Arguments; //rdp file
rdp.Start();

This works however I want to save the username and password so that it just
logs the user in automatically.
If you look at an RDP file in notepad you will see that it is all text. If
right click and choose edit you can input a password and click save
password. If you save your changes you get a long binary hash password.

If you open it in notepad and copy everything and paste it into an empty
text file and rename it RDP, you would think you have the same thing. Not
so. Original is 5k, copied version is 3k. There is in fact a whole bunch of
hidden characters. If you open the original in a hex editor then you will
see that the whole file is prepended by ff fe and there is 00 in between
every character.

This is what makes up the extra 2k.So my question is; how do I parse each
line of text (comes from DB), convert it to HEX, insert the 00 value
(whatever that is) and then write it out as a file with a .rdp extension?

I would appreciate any help. Right now I am using
FileStream file = new FileStream(WorkingDirectory + "\\" + Arguments,
System.IO.FileMode.Create);
StreamWriter sw = new StreamWriter(file);
to write the file. Can I use the same thing to write HEX?

Thanks

Tim
Jan 28 '06 #1
1 10422
IIRC the 00 between each character in the hex view shows that the
orginal file is Unicode. When you save the file in notepad it defaults
to ANSI.

Jan 28 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: David Lawson | last post by:
I know how to conver a string to an array of strings, but I need to convert an ascii string to an array of integers (really unsigned chars). Eg, ...
3
by: hunterb | last post by:
I have a file which has no BOM and contains mostly single byte chars. There are numerous double byte chars (Japanese) which appear throughout. I...
4
by: Julia | last post by:
Hi, I need to convert unicode string to ansi string Thanks in adavance.
3
by: dale zhang | last post by:
Hi, I am trying to read an image from MS Access DB based on the following article: http://www.vbdotnetheaven.com/Code/Sept2003/2175.asp The...
4
by: dale zhang | last post by:
Hi, I am trying to save and read an image from MS Access DB based on the following article: ...
1
by: Daniel | last post by:
I have looked everywhere on the web for an answer to this and the only thing I can find is converting the image format when the file is present on...
17
by: David Scemama | last post by:
Hi, I'm writing a program using VB.NET that needs to communicate with a DOS Pascal program than cannot be modified. The communication channel is...
12
by: Brian Henry | last post by:
first question... I have a flat file which unfortinuatly has columns seperated by nulls instead of spaces (a higher up company created it this way...
3
by: GM | last post by:
Dear all, Could you all give me some guide on how to convert my big5 string to unicode using python? I already knew that I might use cjkcodecs or...
0
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.