Overriding dirverentry for a driver

Hi,

I am trying to build a UEFI driver and these UEFI drivers uses a different driverentry point called _moduleentry. In the sources file Im trying to override the entry point using

TARGETTYPE=DRIVER
LINKER_FLAGS=/ENTRY:_ModuleEntryPoint /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER in my sources file.

But linker seems to overriding my options and giving me a linker error. Can some one help me how to solve this problem please.

Hmmmm… I haven’t done this, but I’m pretty sure you do not want to specify TARGETTYPE=DRIVER… That means you’re building a Windows driver.

Have you tried, oh, I don’t know… TARGETTYPE=PROGRAM, for example? That would be my first guess.

Peter
OSR

There is a sources directive to set the entry point iirc. Perhaps ENTRY_POINT, spelunking the global makefile.inc will tell you for sure

d

debt from my phone


From: xxxxx@gmail.com
Sent: 7/12/2012 12:24 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Overriding dirverentry for a driver

Hi,

I am trying to build a UEFI driver and these UEFI drivers uses a different driverentry point called _moduleentry. In the sources file Im trying to override the entry point using

TARGETTYPE=DRIVER
LINKER_FLAGS=/ENTRY:_ModuleEntryPoint /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER in my sources file.

But linker seems to overriding my options and giving me a linker error. Can some one help me how to solve this problem please.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Is there any specific reason not using edk/udk for UEFI driver? A UEFI
driver needs efi runtime support. I’m pretty sure ddk doesn’t have it
although I never bother to look.

Calvin

On Thu, Jul 12, 2012 at 12:25 PM, wrote:

> Hi,
>
> I am trying to build a UEFI driver and these UEFI drivers uses a
> different driverentry point called _moduleentry. In the sources file Im
> trying to override the entry point using
>
> TARGETTYPE=DRIVER
> LINKER_FLAGS=/ENTRY:_ModuleEntryPoint /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER
> in my sources file.
>
> But linker seems to overriding my options and giving me a linker error.
> Can some one help me how to solve this problem please.
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

@peter when I use TARGETTYPE=PROGRAM Im getting linker errors regarding /GS flag like unresolved external symbol __security_check_cookie eventhough I disabled the flag using /GS- linker option.

You need to the sources directives to turn off stuff like /gs. Directives provide a more declarative way to holistically enable/disable features vs flag smashing. In this case, you can link against bufferoverflowu.lib to get /gs cookie support

d

debt from my phone


From: xxxxx@gmail.com
Sent: 7/12/2012 1:52 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Overriding dirverentry for a driver

@peter when I use TARGETTYPE=PROGRAM Im getting linker errors regarding /GS flag like unresolved external symbol __security_check_cookie eventhough I disabled the flag using /GS- linker option.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Absolutely correct. Clearly, flag smashing is a bad idea because you’re effectively fighting flags that get set automagically via the WDK’s makefile.new

I seem to recall that there’s a UMENTRY that applies if you do TARGETTYPE=PROGRAM… and I also seem to recall that there’s no way to override the default entry point for a driver. All that stuff got munged when /GS was added and back in S03 when we did Call Usage Verifier. I admit, I haven’t looked at it in ages, however. Should be easy to find in makefile.new… start by looking for DriverEntry and wander backwards from there.

Peter
OSR

UEFI is a modified PE image. The EFI specific linker options allow you to
generate binaries in such modified PE format. You need more than that to
generate a useful UEFI image. Get the EDK/UDK for that purpose.
Calvin

Why are you building UEFI drivers with MS’s tools? UEFI is not Windows.

Use the UEFI tools for this.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

wrote in message news:xxxxx@ntdev…
> Hi,
>
> I am trying to build a UEFI driver and these UEFI drivers uses a different driverentry point called _moduleentry. In the sources file Im trying to override the entry point using
>
> TARGETTYPE=DRIVER
> LINKER_FLAGS=/ENTRY:_ModuleEntryPoint /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER in my sources file.
>
> But linker seems to overriding my options and giving me a linker error. Can some one help me how to solve this problem please.
>