AnArrayOfFunctions
AnArrayOfFunctions

Reputation: 3754

Why are some of the old Win16 API's still supported in newer Windows versions?

I was recently fixing some IAT on MoleBox packed executable and saw that it links with kernel32 functions: '_lopen', '_lwrite' and '_lread'. This site states that those API's are provided for compatibility with 16-bit versions of Windows. I undesrtand that 'Win16' applications can't be executed in long mode (yes - I'm running Win8.1 x64) - so what is the purpose those to be still included in 'kernel32.dll'?

By the way those functions aren't even included in the 'msdn' library.

EDIT: It also seems that those function aren't actually 16-bit! They're taking 32-bit parameters on the stack.

Upvotes: 1

Views: 814

Answers (2)

David Heffernan
David Heffernan

Reputation: 613272

It's not that the functions can be called by 16 bit applications. Clearly they cannot because they live in 32 bit and 64 bit modules. The point is (was) to make it easier for developers to compile old programs without having to re-write them.

Now, in 2015 there's no real need to cater for developers that have 16 bit programs that they wish to re-compile. That is probably not happening any more to any significant level. But if you roll back the clock 20 years then this was a real concern. And hence MS included these compat crutches. And once they had been included, then MS probably decided to leave them there so as not to break binary compatibility. MS does go to great lengths to avoid breaking old programs. Were these functions to be removed, any programs that rely on them would break.

Upvotes: 7

MSalters
MSalters

Reputation: 179991

Microsoft doesn't remove functions "just because" they're old. They will remove these functions as soon as they would require a reimplementation, but for now it takes less work to keep them.

Upvotes: 1

Related Questions