flat assembler
Message board for the users of flat assembler.
![]() Goto page Previous 1, 2, 3, 4, 5 Next |
Author |
|
BiDark 17 Sep 2003, 11:05
That's why I had combine the two into one section (INIT section) and set it to share the same thunk table (may save some space? the system memory for the drivers is expensive?).
Okey, modified it already, thanks. |
|||
![]() |
|
comrade 22 Sep 2003, 02:45
I tried, but I think its still wrong .sys
![]() |
|||
![]() |
|
Tomasz Grysztar 22 Sep 2003, 07:57
Details?
|
|||
![]() |
|
Kevin_Zheng 22 Sep 2003, 12:30
Hi,Privalov:
I found must present the 'reloc' section, the sys file is OK. Please see the belowing code: Code: format PE DLL native 4.0 at 10000h entry main include '%include%\win32a.inc' section '.text' code readable executable notpageable proc MakeBeep1,dwPitch enter cli mov al,0B6h out 43h,al mov eax,[dwPitch] out 42h,al mov al,ah out 42h,al in al,61h or al,3 out 61h,al sti mov eax,1800000h .delay_loop: dec eax or eax,eax jnz .delay_loop cli in al,61h and al,0FCh out 61h,al sti return proc MakeBeep2,dwPitch enter cli push 0B6h push 43h call [imp_WRITE_PORT_UCHAR] mov eax,[dwPitch] push 0 movzx ax,al push ax push 42h call [imp_WRITE_PORT_UCHAR] mov eax,[dwPitch] push 0 mov al,ah movzx ax,al push ax push 42h call [imp_WRITE_PORT_UCHAR] push 61h call [imp_READ_PORT_UCHAR] or al,3 push 0 movzx ax,al push ax push 61h call [imp_WRITE_PORT_UCHAR] sti mov eax,1800000h .delay_loop: dec eax or eax,eax jnz .delay_loop cli push 61h call [imp_READ_PORT_UCHAR] and al,0FCh push 0 movzx ax,al push ax push 61h call [imp_WRITE_PORT_UCHAR] sti return proc main,pDriverObject,pDriverPath enter push 474h call MakeBeep1 push 389h call MakeBeep2 push 620h call [imp_HalMakeBeep] mov eax,1800000h .delay_loop: dec eax or eax,eax jnz .delay_loop push 0 call [imp_HalMakeBeep] mov eax,0C0000182h return section '.rdata' readable notpageable data 12 ImportLookup: dd rva szRead_port_uc dd rva szWrite_port_uc dd rva szHalmakebeep dd 0 end data section 'INIT' import readable notpageable dd rva ImportLookup dd 0 dd 0 dd rva szHal_dll dd rva ImportAddress times 5 dd 0 ImportAddress: imp_READ_PORT_UCHAR dd rva szRead_port_uc imp_WRITE_PORT_UCHAR dd rva szWrite_port_uc imp_HalMakeBeep dd rva szHalmakebeep szHalmakebeep dw 0 db 'HalMakeBeep',0 szRead_port_uc dw 0 db 'READ_PORT_UCHAR',0 szWrite_port_uc dw 0 db 'WRITE_PORT_UCHAR',0 szHal_dll db 'HAL.dll',0 section '.reloc' data fixups readable discardable And others, I have collect all the files, please used the build.bat for building all the files.
|
|||||||||||
![]() |
|
Tomasz Grysztar 22 Sep 2003, 13:56
Yes, of course it must contain the fixups - it was already discussed here (and BiDark's example has the relocation section).
|
|||
![]() |
|
BiDark 25 Sep 2003, 04:10
Ah..., I found out that when specified 'PE native' alone it doesn't produce .sys format. I have put 'DLL' by accident sorry hehe, so whether it have the 'DLL' flag or not it should produce .sys file (becuase the original doesn't have 'DLL' flag specified in File Header.
And others, If you have troble with 'Unable to load the driver' message, try this. Goto HKLM\System\ControlSet001\Service and find the 'beeper' entry, delete it and restart the machine. |
|||
![]() |
|
Tomasz Grysztar 25 Sep 2003, 09:09
BiDark wrote: Ah..., I found out that when specified 'PE native' alone it doesn't produce .sys format. It does. Or maybe do you mean that the .sys extension is not generated by FASMW in that case? |
|||
![]() |
|
BiDark 25 Sep 2003, 10:46
Privalov wrote:
Yes, FASMW doesn't generates .sys extension when specified the 'PE native' format without the 'DLL' flag, It generates .exe insteed. It should generates .sys in this case, sorry about my english hehe. |
|||
![]() |
|
comrade 15 Oct 2003, 04:01
Code: data 12 ImportLookup: dd rva szRead_port_uc dd rva szWrite_port_uc dd rva szHalmakebeep dd 0 end data What does data do? |
|||
![]() |
|
comrade 16 Oct 2003, 04:12
Here maybe this is clean example? Run "scm.exe beeper.sys"
Code: macro syslibrary [name,string] { forward local _label if ~ name#.needed dd RVA name,0,0,RVA _label,RVA name end if common dd 0,0,0,0,0 forward if ~ name#.needed _label db string,0 end if }
|
|||||||||||
![]() |
|
Kevin_Zheng 28 Oct 2003, 11:31
Dear All:
Why the returned value of DriverEntry is C000182H? Since standard WDM driver programmer guide, the return value should be 0. So I used 0 as return vaule. And then found the driver can't load more one. The error code is 1072. From MSDN, the error code is ERROR_SERVICE_MARKED_FOR_DELETE. And others, I used MASM for building the same as driver and returned value is zero, the driver can load more one and worked OK. Who known the reason about the result? I guest that it maybe FASM doesn't support fully sys file format. |
|||
![]() |
|
Kevin_Zheng 28 Oct 2003, 15:39
Hi,Privalov:
I have known the answer about the fasm doesn't support finally WDM sys format. Because the FASM set the DllCharacteristics of OptionHeader is 0000H, But the WDM file should be 2000H . I modifed the value and recaluate the checksum. The driver runed OK. Please see the web site for the description : Code: DllCharacteristics DLL characteristics of the image. The following values are defined. Value Meaning 0x0001 Reserved 0x0002 Reserved 0x0004 Reserved 0x0008 Reserved 0x2000 A WDM driver. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/debug/base/image_optional_header_str.asp |
|||
![]() |
|
Tomasz Grysztar 28 Oct 2003, 16:06
OK, fixed it (check the latest prerelease on this board). I was misguided by the fact, that none of WDM drivers I've found on my system actually have this flag set...
![]() |
|||
![]() |
|
ProgramMan 28 Jan 2004, 07:41
Greetings to all.
I write through PROMT. ![]() How to establish the control over file system, using the driver (*.sys) It is possible with examples. ![]() |
|||
![]() |
|
bitRAKE 03 Feb 2004, 05:46
|
|||
![]() |
|
ProgramMan 08 Feb 2004, 11:34
Also what?
How to establish the control over file system, using the driver (*.sys) It is possible with examples. |
|||
![]() |
|
Ralph 16 Apr 2004, 05:03
Hey,
I've been desperatly trying to get anything to assemble here, without any luck. All the examples provided here either error out with "unexpected end of file" or some macro error. Additionally %include% doesn't seem to work for me. I have to use absolute path names. I managed to patch together a version that assembled, but the .sys failed to load. I tried using fasm 1.52 for windows console as well as GUI, both produce the same errors. I hate to ask something like this, but could anyone please provide me with a concise version that actually assembles or maybe tell me how to make these assemble? This is the code I was trying to work with, it assembles but it wont load: Code: format PE DLL native 4.0 at 10000h entry Start include 'C:\tools\fasmw\INCLUDE\win32a.inc' ;%include& doesn't work section '.text' code readable executable notpageable proc Start,pDriverObject,pusRegistryPath enter cli ; speaker ON in al,61h or al,11b out 61h,al sti mov ecx,18000000h @@: loop @B cli ; speaker OFF in al,61h and al,11111100b out 61h,al sti .hal: stdcall [imp_HalMakeBeep],1568 mov ecx,18000000h @@: loop @B stdcall [imp_HalMakeBeep],0 .quit: mov eax,0C0000182h return endp ;i need this or else i get an unexpected end of file error section '.rdata' readable notpageable ;data 12 ;this errors out with "symbol already defined", and I have no idea what 'data' does ImportLookup: dd rva szRead_port_uc dd rva szWrite_port_uc dd rva szHalmakebeep dd 0 ;end data section 'INIT' import readable notpageable dd rva FirstThunk dd 0 dd 0 dd rva szHal_dll dd rva FirstThunk times 5 dd 0 FirstThunk: imp_READ_PORT_UCHAR dd rva szRead_port_uc imp_WRITE_PORT_UCHAR dd rva szWrite_port_uc imp_HalMakeBeep dd rva szHalmakebeep dd 0 szHalmakebeep dw 0 db 'HalMakeBeep',0 szRead_port_uc dw 0 db 'READ_PORT_UCHAR',0 szWrite_port_uc dw 0 db 'WRITE_PORT_UCHAR',0 szHal_dll db 'HAL.dll',0 section '.reloc' data fixups readable discardable Last edited by Ralph on 16 Apr 2004, 05:29; edited 1 time in total |
|||
![]() |
|
comrade 16 Apr 2004, 05:23
get old includes
|
|||
![]() |
|
Ralph 16 Apr 2004, 05:33
Thanks. What version and where can I get them? Why wouldn't the new includes work? Is there a way to make them work? Any idea why %include% doesn't work?
|
|||
![]() |
|
Goto page Previous 1, 2, 3, 4, 5 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.