Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Driver compiling on X64 OS

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
fjfc
Advanced Cheater
Reputation: 0

Joined: 21 Sep 2006
Posts: 91

PostPosted: Fri Jul 10, 2009 12:30 am    Post subject: Driver compiling on X64 OS Reply with quote

Here's the thing, i'm trying to compile one of my drivers to use on XP X64 edition.
So compiling it with the WDK for Windows server 2008 (microsoft website tolt us to compile drivers to use on xp x64 with this environment)
i realized that i cannot use __asm...
so i need help because i use one of the famous
__asm
{
cli
mov eax, cr0
mov _cr0, eax
and eax, 0fffeffffh
mov cr0, eax
}

on my driver and i don't know how to make it w/out the __asm statemente. someone can help me? thanks
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Fri Jul 10, 2009 1:20 am    Post subject: Reply with quote

intrinsics?
Back to top
View user's profile Send private message
fjfc
Advanced Cheater
Reputation: 0

Joined: 21 Sep 2006
Posts: 91

PostPosted: Fri Jul 10, 2009 8:53 am    Post subject: Reply with quote

how?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25796
Location: The netherlands

PostPosted: Fri Jul 10, 2009 9:36 am    Post subject: Reply with quote

64-bit microsoft c compilers, do not support inline assembler.

If you want to use assembler, then create a separate assembler file compile that in, and call the functions of the assembler file from your c-code

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
fjfc
Advanced Cheater
Reputation: 0

Joined: 21 Sep 2006
Posts: 91

PostPosted: Fri Jul 10, 2009 11:04 am    Post subject: Reply with quote

I've tried that DB... i've included one func.asm in my sources, like:

TARGETNAME=x
TARGETPATH=obj
TARGETTYPE=DRIVER
SOURCES=x.c y.c func.asm

but then i get this error:

BUILD: Examining d:\x directory for files to compile.
skipping post pass 0 command
Compiling and Linking d:\x *************
'nmake.exe /nologo BUILDMSG=Stop. -i /nologo /f d:\winddk\6001.18001\bin\makefile.def BUILD_PASS=PASS2 LINKONLY=1 NOPASS0=1 MAKEDIR_RELATIVE_TO_BASEDIR='
d:\x: TARGETPATH is obj
NMAKE : fatal error U1073: don't know how to make 'd:\x\objfre_wlh_ia64\ia64\func.obj'
errors in directory d:\bypass
NMAKE : fatal error U1073: don't know how to make 'd:\x\objfre_wlh_ia64\ia64\func.obj'
Stop.
errors in directory d:\x
nmake.exe /nologo BUILDMSG=Stop. -i /nologo /f d:\winddk\6001.18001\bin\makefile.def BUILD_PASS=PASS2 LINKONLY=1 NOPASS0=1 MAKEDIR_RELATIVE_TO_BASEDIR= failed - rc = 2
Back to top
View user's profile Send private message
Zerith
Master Cheater
Reputation: 1

Joined: 07 Oct 2007
Posts: 468

PostPosted: Sat Jul 11, 2009 2:24 am    Post subject: Reply with quote

Microsoft C compiler isn't suppose to know how to compile ASM files..
I would suggest making the functions extern and linking an object file generated from these asm files (keep note that i have no knowledge at 64bit microsoft compilers)
Back to top
View user's profile Send private message MSN Messenger
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25796
Location: The netherlands

PostPosted: Wed Sep 09, 2009 11:56 am    Post subject: Reply with quote

bump for those that have the same question but don't know the answer

Code:

TARGETNAME=x
TARGETPATH=obj
TARGETTYPE=DRIVER
AMD64_SOURCES=func.asm
SOURCES=x.c y.c


and func.asm needs to be in the amd64 folder

while i'm at it:
Quote:

NMAKE : fatal error U1073: don't know how to make 'd:\x\objfre_wlh_ia64\ia64\func.obj'

That's the wrong build environment. Should have picked amd64 or x64 (depending on which wdk you use), not ia64

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Guy
Expert Cheater
Reputation: 0

Joined: 30 May 2009
Posts: 187

PostPosted: Wed Sep 09, 2009 8:00 pm    Post subject: Reply with quote

Like slovach said, use intrinsics:

__readcr0 - http://msdn.microsoft.com/en-us/library/xd9dtxk3.aspx
__writecr0 - http://msdn.microsoft.com/en-us/library/ewd38ezs.aspx

_disable - http://msdn.microsoft.com/en-us/library/y14401ab.aspx
_enable - http://msdn.microsoft.com/en-us/library/ad820yz3.aspx

Code:

_disable( );
_cr0 = __readcr0( );
__writecr0( _cr0 & 0xFFFEFFFF );
_enable( );


Good luck Wink

edit: Oops, old post. Oh well, for anyone else, see above.

_________________
Has anyone seen Hitler around..? If so, PM me!
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25796
Location: The netherlands

PostPosted: Wed Sep 09, 2009 9:20 pm    Post subject: Reply with quote

of course, there's still some reasons to use assembler.
e.g: the intrinsic to get the GDT address and limit (sgdt) is missing.

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites