flat assembler
Message board for the users of flat assembler.
Index
> Windows > Access I/O Ports Under WindowsXP/NT |
Author |
|
Torrey 17 Jun 2005, 07:17
It might be possible by using CreateFile and obtaining the handle for "\\\\.\\LPT1" then if successful using communications api to handle the calls to that device.
[edit] To be exact, this will return a handle. Code: invoke CreateFile,lpDevice,GENERIC_READ,0,0,OPEN_EXISTING,0,0 mov [hDevice],eax lpDevice db '\\\\.\\LPT1',0 hDevice dd ? After you get that handle use the communications api to work with the device. |
|||
17 Jun 2005, 07:17 |
|
Feryno 17 Jun 2005, 11:12
1.
A public known method for access every port, e.g. when you must access CMOS (ports 70h,71h), or when you need make own hardware monitor (CPU temperature, FAN RPMS, voltages...) The solution: Copy giveio.sys to c:\windows\system32\drivers run install_giveio.exe c:\windows\system32\drivers\giveio.sys run start_giveio.exe Your program: opening device giveio.sys set access permission to ports put this in your code: push 0 push FILE_ATTRIBUTE_NORMAL push OPEN_EXISTING push 0 push 0 ;FILE_SHARE_WRITE push GENERIC_READ push devicename call [CreateFile] cmp eax,INVALID_HANDLE_VALUE jz exit ; can't open device giveio push eax call [CloseHandle] put here code with port operations... data devicename db '\\.\giveio',0 2. French hackers coded masm direct switch to ring0 - hard to recode to fasm see ring0.mas
|
|||||||||||
17 Jun 2005, 11:12 |
|
Torrey 17 Jun 2005, 12:18
What's the story about promoting French hackers? If I was a Caucasian one, would that make me cool too?
|
|||
17 Jun 2005, 12:18 |
|
farrier 17 Jun 2005, 12:32
kidscracker,
You can use CreateFile, ReadFile, and Writefile to read/write to/from both parallel and serial ports without using any tricks. This will work if you are only transferring data, if you want to control the bits in the control registers of the hardware, you will have to try something else. Code: hPrinter dd ? nobw dd ? PPort db "LPT1", 0 emph_p db 27, 69 sizeof.emph_p = $ - emph_p invoke CreateFile, PPort, GENERIC_READ or GENERIC_WRITE, \ NULL, NULL, OPEN_EXISTING, NULL, NULL .if eax, e, INVALID_HANDLE_VALUE jmp .error_handler .endif mov [hPrinter], eax invoke WriteFile, [hPrinter], emph_p, sizeof.emph_p, nobw, NULL invoke CloseHandle, [hPrinter] hth, farrier _________________ Some Assembly Required It's a good day to code! U.S.Constitution; Bill of Rights; Amendment 1: ... the right of the people peaceably to assemble, ... The code is dark, and full of errors! |
|||
17 Jun 2005, 12:32 |
|
f0dder 19 Jun 2005, 12:19
Quote:
You shouldn't use this if you want your application to work smoothly on future windows versions... besides, it requires administrative privileges, so you can't use it from a restricted user account. |
|||
19 Jun 2005, 12:19 |
|
coconut 19 Jun 2005, 16:07
|
|||
19 Jun 2005, 16:07 |
|
@L.chemist 27 Jun 2005, 15:29
You can also try this.
it's my own simple driver (r0pc.sys) written in FASM & a couple of very simple examples. with a little help of r0pc.sys you can .1 execute user-mode code in ring-0 .2 read/write ports under winnt to compile driver you must have KMD.inc http://board.flatassembler.net/viewtopic.php?t=648 !!! tested under win2k only YOU'LL FIND THE SOURCE IN MY LAST POST Last edited by @L.chemist on 12 Aug 2005, 08:34; edited 3 times in total |
|||
27 Jun 2005, 15:29 |
|
@L.chemist 28 Jun 2005, 07:27
bug fix in fasm test program
YOU'LL FIND THE SOURCE IN MY LAST POST Last edited by @L.chemist on 12 Aug 2005, 12:21; edited 1 time in total |
|||
28 Jun 2005, 07:27 |
|
Sem 29 Jun 2005, 08:16
No driver:
Call NtSetInformationProcess and set ProcessInformationClass.ProcessUserModeIOPL = 3. But you must enable&create SE_TCB_PRIVILEGE for you process. Sources,
|
|||||||||||
29 Jun 2005, 08:16 |
|
@L.chemist 12 Aug 2005, 08:13
fix collision of new irp FASM directive & IRP structure in KMD.inc
|
|||||||||||
12 Aug 2005, 08:13 |
|
@L.chemist 16 Aug 2005, 11:56
New import macros.
Now IDA doesn't scream about damaged import section. Thanks to Feryno for remarks.
|
|||||||||||
16 Aug 2005, 11:56 |
|
12345 19 Dec 2011, 02:22
My code doesn't work in xp with giveio installed and started!
Code: ORG 100h USE16 ;push ds ;push cs ;pop ds ;mov ax, 3d00h ;open file ;mov dx, devicename ;int 21h MOV DX,filename;Start mem loc of giveio.sys MOV AL,00H ;Normal Read/Write file attribute MOV AH,3DH ;Open File function INT 21H ;Open File ;File handle is in AX mov al,0EDh ;ED command - Send LED bits. The next byte written to port 60h updates the LEDs on the keyboard. out 60h,al ;out on port 60h mov al,00000111b ;led status - all leds on. bits 3-7 = reserved(zero) out 60h,al ;out on port 60h mov ah,01 int 21h mov ah,4ch int 21h filename:db '\\.\giveio',0 ;devicename: db '\\.\giveio',0 |
|||
19 Dec 2011, 02:22 |
|
revolution 19 Dec 2011, 02:26
12345: giveio is a 32-bit driver for Windows. You won't be able to use it from the 16-bit DOS VDM.
|
|||
19 Dec 2011, 02:26 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.