flat assembler
Message board for the users of flat assembler.
Index
> Windows > Drivers for 98/2000 Goto page Previous 1, 2, 3, 4, 5 Next |
Author |
|
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 }
|
|||||||||||
16 Oct 2003, 04:12 |
|
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 |
|||
28 Oct 2003, 15:39 |
|
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...
|
|||
28 Oct 2003, 16:06 |
|
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. |
|||
28 Jan 2004, 07:41 |
|
bitRAKE 03 Feb 2004, 05:46
|
|||
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. |
|||
08 Feb 2004, 11:34 |
|
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 |
|||
16 Apr 2004, 05:03 |
|
comrade 16 Apr 2004, 05:23
get old includes
|
|||
16 Apr 2004, 05:23 |
|
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?
|
|||
16 Apr 2004, 05:33 |
|
Tomasz Grysztar 16 Apr 2004, 11:56
The "data already defined" problem that occured on "data 12" directive is the bug - please download the updated 1.52 release (with 16 April date) which have it fixed. It's very strange noone noticed it earlier, as this bug seems to occur in all the releases since 1.50.
As for the %include%, it is also relict of old releases, later it was replaced with %fasminc% to avoid conflict of system variables. After setting up your FASMINC environment variable correctly (check the section 1.1.1 of FASM.PDF) just replace %include% with %fasminc% and it should work. The "endp" addition at the end of each procedure is also necessary due to some changes in the latest version of includes (look here for more info). Also, the INCLUDE variable is since 1.52 release recognized by fasm in the same way, as by the most of command line compilers - as a list of semicolon-separated paths where to search for includes that have no absolute path specified and cannot be found in current directory. So use of the %include% would no longer make any sense. As a summary, this is how your source should look like: Code: format PE DLL native 4.0 at 10000h entry Start include '%fasminc%\win32a.inc' section '.text' code readable executable notpageable proc Start,pDriverObject,pusRegistryPath 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 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 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 (compile it with the updated fasm 1.52) |
|||
16 Apr 2004, 11:56 |
|
Ralph 16 Apr 2004, 18:02
Great, thanks a lot. I got it working. One more quick thing I noticed though: While working on this, I called it test.sys, which would not load. To make it load, all I had to do is rename test.sys to any other file name (beep.sys, blah.sys, f00.sys, etc) and it worked. Since there is no reference to the filename inside the .sys file, I'm assuming it's because a service called test already exists, is reserved or something along those lines?
|
|||
16 Apr 2004, 18:02 |
|
LocoDelAssembly 22 May 2006, 14:45
What "data 12" means? I can't find the documentation of that
|
|||
22 May 2006, 14:45 |
|
okasvi 22 May 2006, 23:42
who knows, datadirectory nr. 12? no i think it's assembler-stage directive to tell assembler that IMAGE_IMPORT_DESCRIPTOR is there, or? anyway, library/import macros work inside separate import section now with drivers...
|
|||
22 May 2006, 23:42 |
|
Tomasz Grysztar 23 May 2006, 00:11
Yes, it's data directory no. 12.
manual, section 2.4.2 wrote: "data" directive begins the definition of special PE data, it should be followed by one of the data identifiers ("export", "import", "resource" or "fixups") or by the number of data entry in PE header. And thus "data 0" is the same as "data export", "data 2" is the same as "data resource" etc. There are 16 data directories in standard PE, and since only few of them have symbolical names in fasm, you have to use the raw numbers for the other ones. |
|||
23 May 2006, 00:11 |
|
LocoDelAssembly 23 May 2006, 01:49
Thanks!!
|
|||
23 May 2006, 01:49 |
|
vid 03 Aug 2006, 12:06
tomasz: update the example, there are old macros used
and due to thread name: is this right place? Aren't VxD drivers for 98/2000 and WDM for latter ones? |
|||
03 Aug 2006, 12:06 |
|
Tomasz Grysztar 03 Aug 2006, 15:59
VxD are for 95/98/Me line, while KMD and WDM are for NT/2000/XP line.
|
|||
03 Aug 2006, 15:59 |
|
Madis731 03 Aug 2006, 16:29
@Tomasz: Are the 16 not standardized or are there other reasons you left then unnamed? For completness it would be nice to have them.
|
|||
03 Aug 2006, 16:29 |
|
Tomasz Grysztar 03 Aug 2006, 17:08
I just don't want more reserved words. The ones like "import" or "fixups" were left just for compatibility, even though we could change to define them as equates instead.
|
|||
03 Aug 2006, 17:08 |
|
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.