473,322 Members | 1,494 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 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 10526
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, $str ="ABC"; needs to convert to something...
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 need to take the resulting Unicode and store it in a...
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 article author is using PictureBox for windows...
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: http://www.vbdotnetheaven.com/Code/Sept2003/2175.asp Right now, I saved images without any...
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 the local filesystem. What I want to do is use a...
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 through some file databases, and I have a huge...
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 for us) is there anyway to do a readline with this...
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 python 2.4 but I still don't have idea on what...
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 java so that you can conceal sensitive information...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.