Hyeonseo Yang
Hyeonseo Yang

Reputation: 1128

Why should Windows driver's entry name be "DriverEntry"? (Or WinMain/DllMain too)

Why should Windows driver's entry name be "DriverEntry"? Can't Windows find the driver's entry point using the PE header or, say, just call main() function to initialize the driver?

Also

In case of WinMain, too.

I think main() or MainCRTSetup()should be main() or MainCRTSetup() unless we change the compiler setting, to let the compiler know that is the entry of our program.

However that is for compiler, isn't it? Why does Windows require the entry function name of drivers be DriverEntry?

Upvotes: 3

Views: 669

Answers (1)

mksteve
mksteve

Reputation: 13085

The people at Microsoft decided that the Entry point for a .sys file would be DriverEntry, and that is the value that gets added to the PE header.

I think they made it incompatible with a windows EXE or DLL to ensure that an exe could not be used in place of a .SYS

Upvotes: 3

Related Questions