flat assembler
Message board for the users of flat assembler.

Index > Windows > Running fasm Code in a Windows Kernel Mode Driver

Goto page Previous  1, 2
Author
Thread Post new topic Reply to topic
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 23 Feb 2007, 16:50
HyperVista: you could manually edit .obj file created by FASM, to change type of symbol.

Just open .obj file in some hexeditor, and find name "@feat.00". The name takes 8 bytes, and should be followed by dword value 1, this is the value. Next comes word FFFF, that is section number (-1 means absolute). Next comes word 0, that is type (T_NULL). And then comes "class" word , FASM sets it to 2 (C_EXT), and it should be 3 (C_STAT). So change it to 2.

so, before:
Code:
40 66 65 61 74 2E 30 30 | 01 00 00 00 | FF FF | 00 00 | 02 00    

after:
Code:
40 66 65 61 74 2E 30 30 | 01 00 00 00 | FF FF | 00 00 | 03 00    


If object file works after this patching, then it's up to Tomasz to add this type of symbol into FASM.
Post 23 Feb 2007, 16:50
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
HyperVista



Joined: 18 Apr 2005
Posts: 691
Location: Virginia, USA
HyperVista 23 Feb 2007, 16:56
Thanks vid! I'll give that a try first thing when I get home tonight (it's not even lunch time here in my timezone).

P.S. - wow, that was your 3,500th post!
Post 23 Feb 2007, 16:56
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 23 Feb 2007, 17:09
Quote:
P.S. - wow, that was your 3,500th post!
wow... i'm over tomasz now... last time i checked i was about 100 posts short Smile

PS: what is your time shift against central european time (UTC+1) ? (i am lazy to find out myself...)
Post 23 Feb 2007, 17:09
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 23 Feb 2007, 17:15
my proposal would be COFF-specific directive "symbol" for placing symbol into symbol table. It would allow definitions of absolute symbols directly by value, and would allow flags to be specified:

Code:
symbol 0FFFFh:1,0,3 as "@feat.00"  ;full-featured definition
symbol 1, 0, 3 as "@feat.00" ;same as previous
@feat.00=1
symbol @feat.00,0,3 ;same as previous
symbol @feat.00,0,2 ;same as "public @feat.00"
... etc ...    


such feature would even make it possible to provide some debugging information with macros Wink
Post 23 Feb 2007, 17:15
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
HyperVista



Joined: 18 Apr 2005
Posts: 691
Location: Virginia, USA
HyperVista 23 Feb 2007, 18:08
Quote:
what is your time shift against central european time (UTC+1) ?


UTC -5
Post 23 Feb 2007, 18:08
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 25 Feb 2007, 16:22
so... did you try it? Wink
Post 25 Feb 2007, 16:22
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo 26 Feb 2007, 00:38
He can't ... he's got to wait a few hours before he can read the posts here. Laughing (Sorry for being off-topic, but I'm a ham.)
Post 26 Feb 2007, 00:38
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 26 Feb 2007, 12:10
Quote:
He can't ... he's got to wait a few hours before he can read the posts here

somehow, i am not getting your humor. Even if we did take time difference into account, it's 2 days, not few hours
Post 26 Feb 2007, 12:10
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
HyperVista



Joined: 18 Apr 2005
Posts: 691
Location: Virginia, USA
HyperVista 26 Feb 2007, 13:10
vid - my sincere apologies for not responding sooner. I had a minor "crisis" at work on Friday and I didn't get home until very late. Saturday I was celebrating my daughter's 12th Brithday (a hord of other 12 yr. old girls and an evening out at a local roller skating rink, followed by a spirited sleep over, which was NOT condusive to programming). Yesterday we had an unexpected heavy snow/ice storm and spend a good portion of the day shoveling the driveway and sidewalk with my son.

The good news is, your suggested hex edit worked!!

[edit] Here's what your handy work looks like in action Cool

Image

Oh, and SOURCES file does NOT include "NO_SAFESEH=1" statement.


Code:
TARGETNAME=hypervista
TARGETPATH=.\lib
TARGETTYPE=DRIVER
TARGETLIBS= myrdmsr.lib
SOURCES=safesehtestdriver.c     


Last edited by HyperVista on 26 Feb 2007, 14:20; edited 2 times in total
Post 26 Feb 2007, 13:10
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 26 Feb 2007, 13:32
no problem, i just warned you whether you haven't forgotten. it was unexpectedly snowing here too, but not that much

Quote:
The good news is, your suggested hex edit worked!!

That means we should convice Tomasz to add some feature to exporting any kind of symbol in COFF and MS-COFF. I think this would suit FASM "philosophy" pretty well, and it would also make it possible to provide some symbolic information with macros!
Post 26 Feb 2007, 13:32
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.