6 Replies - 389 Views - Last Post: 12 March 2012 - 08:21 PM Rate Topic: -----

#1 immeraufdemhund  Icon User is offline

  • D.I.C Regular

Reputation: 79
  • View blog
  • Posts: 495
  • Joined: 29-March 10

Another question about reading/writing to ports

Posted 12 March 2012 - 06:03 PM

This may at first seem like a ask for the codez question but it's not. I've been working on a few different programs lately for work that involve reading/writing to a port (0x068 (read), 0x06C (write)). I have found 2 easy solutions to doing this. One being NTPort which is a good pay for utility, and the other io.dll. It is a open source one that i have been using but I have noticed that it doesn't always open up as needed. For a long time i've been banging my head up against a wall trying to find information on how to use DeviceIOControl and CreateFile pinvoke functions, but to no avail. A couple of days ago I got some code (written in C++) that reads and writes to that port without having to use ntport. they used DeviceIOControl. I must admit though that I am seemingly over my head in this because in the source code I understood all the calls but the CreateService() pinvoke function which basically loads a ECIoCtrl32.sys which gives me my Pointer. Then they use DeviceIOControl with some IOCTL codes i have never seen or heard of, let alone found on the internet. I read the properties to those .sys files and found them to be in the win2k ddk (driver development kit). But i can't find anyinformation bout them. Does any one know if I am on the right track? I can't post all the code because it is for the company, but i can post small snippets of it if it would help. Any ideas of were to look or what to do????

thank you in advance.

Is This A Good Question/Topic? 0
  • +

Replies To: Another question about reading/writing to ports

#2 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5436
  • View blog
  • Posts: 11,662
  • Joined: 02-June 10

Re: Another question about reading/writing to ports

Posted 12 March 2012 - 06:54 PM

When you are saying "to ports"... What kind of ports are you talking about? USB, Serial, Parallel, TCP/ip ports?

Serial port communication is VERY straightforward.
There is the System.IO.Ports.Serial.SerialPort class that you can use for this - Making all of your talk above into C++ gibberish.

If you're talking about some other kind of ports, you need to specify so we know what you're talking in reference to.
Was This Post Helpful? 0
  • +
  • -

#3 immeraufdemhund  Icon User is offline

  • D.I.C Regular

Reputation: 79
  • View blog
  • Posts: 495
  • Joined: 29-March 10

Re: Another question about reading/writing to ports

Posted 12 March 2012 - 07:13 PM

ok after i put my baby to bed tonight I will be way more specific. And the port i am talking about is the keyboard controller port (0x068, 0x06C) linky - http://www.geekhideout.com/iodll.shtml
Was This Post Helpful? 0
  • +
  • -

#4 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5436
  • View blog
  • Posts: 11,662
  • Joined: 02-June 10

Re: Another question about reading/writing to ports

Posted 12 March 2012 - 07:57 PM

Now this very much sounds like you're trying to intercept the keyboard data: Passwords etc., and or the credit card readers built into retail sales keyboards.
Was This Post Helpful? 0
  • +
  • -

#5 immeraufdemhund  Icon User is offline

  • D.I.C Regular

Reputation: 79
  • View blog
  • Posts: 495
  • Joined: 29-March 10

Re: Another question about reading/writing to ports

Posted 12 March 2012 - 08:15 PM

to the contrary it is not malicious in any sort. We use a embedded controller made by ITE. It is used in most all motherboards, but in our case the IT8512 is what is used. We have 5 different computers that we make for our company. Now on a normal computer yes that RANGE of IO ports is for the keyboard. But in our case it is actually the power management section of the embedded controller. The two aspects of the information I want to get are to write a serial number to the CPU board, read a serial number from the cpu board, and get battery information such as individual cell data, RSOC, FCC, and a few other tidbits of information. Although I have it working using IO.dll and or NTPort I want to make it more standalone. Finding that information is near to impossible without taking some sort of class. It's hard for me to explain in such a short thread all the information I have looked at and researched to get to were I am at now. But i will give a for instance.

To get the first character of the serial number on the cpu board I need address 0x10 from port 0x6C. In order to get said information I have to first check the status of that port to see if it is updating or doing something else. So basically what I do is make a loop of 5000 and check port 0x6C for status 0x01. If it is 1 then I can proceed to ask it the information I want. I then write to port 0x6C the address that I want. I then do a loop of 5000 on port 0x6C and check for a status of 0x02 (which I think means it is processing the command, not sure though), Once it completes it breaks the loop then starts another loop of 5000 to make sure that the processing is completed (status &0x02 == 0). once it returns true it breaks. I then read port 0x68 since it supposedly has the information that i seek. I return that value. There may be one loop that I am forgetting but mind you this is from memory and my work is at work. I found that our programmers in Taiwan do it a little bit differently and I plan on implementing what they have but i am making my program in C#.net and they used C++. I have never seen were you build the .exe then copy with a /b option before to copy the .sys files, but that is part of the batch command. I wonder if i have to do that too.

now with that LITTLE bit of information do you think I am still trying to be a crook?
Was This Post Helpful? 0
  • +
  • -

#6 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5436
  • View blog
  • Posts: 11,662
  • Joined: 02-June 10

Re: Another question about reading/writing to ports

Posted 12 March 2012 - 08:20 PM

This is why I pose questions like that. The script-kiddies trying to pull a fast one get stumped and can't write anything that sounds valid. The scammer's trying to steal just disappear. The rare person that is doing something honest, like yourself, then clear up the matter and better describe the project. Its a win-win for everyone.
Was This Post Helpful? 0
  • +
  • -

#7 immeraufdemhund  Icon User is offline

  • D.I.C Regular

Reputation: 79
  • View blog
  • Posts: 495
  • Joined: 29-March 10

Re: Another question about reading/writing to ports

Posted 12 March 2012 - 08:21 PM

very smart. So have you done something like this before? Do you mind if we chat via a IM service?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1