Slashdot Log In
Native Windows PE File Loading on OS X?
Journal written by ozmanjusri (601766) and posted by
Zonk
on Saturday December 01, @04:25PM
from the to-what-purpose-and-determination dept.
from the to-what-purpose-and-determination dept.
ozmanjusri writes "Coders working on Wine for Mac have found that the Mac loader has gained its own undocumented ability to load and understand Windows Portable Executable (PE) files. They found PE loading capabilities in Leopard that weren't there in Tiger. Further dissection showed that Apple is masking references to 'Win' and 'PE' in the dll, which means it's not an accidental inclusion. Is Apple planning native PE execution within OS X?"
Related Stories
Native Windows PE File Loading on OSX?
|
Log In/Create an Account
| Top
| 397 comments
| Search Discussion
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
noooo FP (Score:5, Insightful)
Re:noooo FP (Score:5, Interesting)
Except windows malware is just that: malware written for Windows. While it could potentially run, malware wouldn't automatically become a problem. You'd have a much easier time accidently running OS X malware than Windows malware. Think of it as WINE for OS X (which is apparently exactly what it is or will be except Jaguar can load the binaries itself). People running Windows binaries via WINE on Linux don't experience the same problems with malware because the expected security flaws in the underlying OS and/or applications aren't there.
In short, if Apple plans to implement a built-in WINE-like ability to run some Windows binaries in OS X, there is no reason to suspect it will cause a breeding ground for Windows malware. Malware only has the opportunity to run if it can somehow get installed.
Re:noooo FP (Score:5, Informative)
Apple? NIH?!? Umm, the BSD subsystem, Webkit from KDE, OpenStep from Next, BeOS bits recreated, MAC from TrustedBSD, PDF as the basis for their display from Adobe, dtrace from Solaris, Apache, CalDav from Oracle... I could go on.
Apple might avoid the WINE codebase, but only because they have rights to much of an older version of the Windows API directly from having won a lawsuit against MS quite a while ago when MS stole their code. I don't think Apple would otherwise have a problem supporting WINE and I would not be surprised if Apple employees have submitted code to WINE or one of the offshoot projects. I think, however, they're probably content with the current ease of running Windows apps, inconvenient enough that not many mainstream developers can ignore OS X, but easy enough so that businesses are not put off and people are not afraid of trying OS X as their primary OS. I would not be surprised, actually, if this feature was added at the request of Parallels, whose latest RC supports making Windows apps the default for opening filetypes in OS X (which will launch the VM and open the file in the specified application.
Re:noooo FP (Score:4, Interesting)
Apple might even license Win32 code from Microsoft.
There's writing on a lot of walls for Microsoft.
The EU legal settlement will eventually, despite the bitter fighting, force them to open their APIs to anyone.
They're facing an onslaught of low-end Linux machines like Asus Eee PC and the Walmart $199 box. So far, their response has been to lower the price of Windows below $40 for Eee PC owners. That's going to be hard to sustain when other buyers balk at paying three times Asus' price.
Vista won't drive any new sales, and looks losing anyone who was waiting for a sign from above.
Essentially, all MS has left to sell on the OS front is compatibility with the enormous back-catalogue of Windows applications.
Being able to sell Win32/FX as an API pack to other OS vendors might be a way out for MS. The future of computing looks like hypervisors and VMs anyway. Most tech savvy people already run Windows in a VM on their preferred OS (or vice versa) already.
Selling a portable API would just be going with the flow.
Re:It's not quite NIH (Score:4, Insightful)
Partly I think this is because Apple relies upon secrecy in order to be competitive against MS's offerings so they don't like people looking at their codebase for future releases, unlike most OSS projects. They tend to wait until they have a project completely and ready to go before they let anyone outside Apple know it exists, which often means they've reworked code for a year and the original projects has a massive load of work dumped upon them at once.
That is actually a good example, although a bit clouded by all the nonsense people posted about it, when they had no idea what they're talking about. For some fairly obvious for business reasons Apple could not have let slip to MS they were working on their own browser, lest MS retaliate by canceling IE before it is ready, or introducing a lock-in into IE in some way. When Apple did release the code, they did not well document the evolution of their version. Someone commented on this in a forum and suddenly all sorts of people were claiming Apple was screwing over the Konquerer team, or intentionally obfuscating things, or violating the spirit of the license. Of course at that point, no one had asked anyone at Apple for a better breakdown and when someone did, the guys working at Apple went out of their way to help make things easier for them to re-integrate into KHTML. Mind you, because the Konquerer team was not happy with some of the design decisions Apple had made, they delayed implementing most of them. They had been used to being the only ones contributing and were not used to dealing with major contributions from other coders. Lately, they've come around with Apple and several other making regular contributions (something the Konquerer guys consider the best thing to come out of Apple's adoption) and they're moving to merging the WebKit and KHTML branches back together since Apple's contributions are more useful than the inconvenience caused by Apple's architectural decisions. The delay in getting Apple's changes incorporated, however, can't really be blamed on Apple, more than a few days, for the most part it was a conscious decision by the Konquerer developers.
Credit where credit is due, the BSD license does not require Apple to release their changes at all, so doing so on a delayed timetable is still a lot better than most vendors.
I doubt it. Why do you suppose Apple publishes the Darwin source or any of the other low-level technologies they code (ZeroConf, LaunchD, etc.). They publish them because they actually see the business case for sharing the work with other companies and gaining wider adoption of said technologies. Windows API re-implementations fit in that same category. If possible, Apple would try to share the load with other players. Realistically, I think they would be prevented from using WINE because of their license to MS's code nor do I think they have a lot interest in such a project.
Not for Win32 compatibility (Score:5, Interesting)
However, consider that the PE file format is also used by Microsoft's Common Language Runtime (CLR/.NET). Therefore, I think this is a preparatory move to start offering a native implementation of the
Re:Not for Win32 compatibility (Score:4, Insightful)
Re:Not for Win32 compatibility (Score:4, Interesting)
Even so, of course Photoshop should be rewritten for the new framework. After all, when a proprietary technology corporation decides to screw over their third-party developers and customers, isn't it the American Way to bear all the costs and keep paying them money?
Re:Not for Win32 compatibility (Score:5, Funny)
Yeah, most of my pet spywares fail to run correctly under wine.
Re:Not for Win32 compatibility (Score:5, Insightful)
No. The big selling points are what you can do with the Mac OS. Boot camp is more in the vein of removing a common barrier to a sale.
-jcr
Re:Not for Win32 compatibility (Score:4, Interesting)
Re:Not for Win32 compatibility (Score:5, Insightful)
A: I don't.
Mac OS, iTunes, the iTunes Music store, etc exist for one purpose: to sell Macs, iPhones, iPods, etc. The software simply isn't where the company makes the money. The old regime almost bankrupted Apple by switching to a Microsoft-like software licensing model... so I doubt that Apple would go back to that.
Re:Not for Win32 compatibility (Score:5, Insightful)
Re:Not for Win32 compatibility (Score:4, Insightful)
A bundle of hardware and software designed to work properly together. That's a big selling point, no hassle with drivers, no hardware conflicts etc.
Windows could never provide the same level of integration unless microsoft start producing hardware against (remember the jazz platform?) and linux could but would really need the hardware maker to roll their own distro.
The only other place you get good integration between hardware and software, is at the high end.. Think z/OS, Solaris/Sparc, AIX etc
Re:Not for Win32 compatibility (Score:5, Insightful)
A selling point is a reason why a product is superior to another product. A barrier to sale is a reason why a customer might be bound to stay with a different product.
You don't buy a Mac because it can run a windows app, since the cheap shit from Dell will do that, too. You buy the Mac for the things that it offers over and above what the Dell box can do.
-jcr
Re:Not for Win32 compatibility (Score:5, Informative)
You realise it's an open standard [wikipedia.org], do you? Hell, it's even ISO approved [iso.org].
Apple would gain a _lot_ by providing support for
Re:Not for Win32 compatibility (Score:5, Interesting)
Sure I can... a little.
Right now, the world's colleges and universities are churning out Java & C# programmers. Those are the popular languages, the ones for which you can almost literally open up a can of programmers for.
Not so with Objective C. It's even starting to get problematic to find competent C++ programmers.
Microsoft's seen the proverbial storm coming, and has been working on an alternative for their aging and clunky Win32 API. Remember a few years back, when the Redmontians announced that Vista (then called Longhorn) would only support
Meanwhile, Apple is tied to Objective C. A language few people are willing to learn (remember "Objectionable C"?). For very valid technical reasons, Apple is slowly moving its developer base over from C/C++-written Carbon apps to Cocoa apps written in Objective C. However, this makes it even harder for software vendors to find competent developers for their Mac OS X offerings.
So, enter
Is that enough of a quantification for you?
Re:Not for Win32 compatibility (Score:4, Insightful)
Not right now, no. But it's half past twelve here. In the morning. And I'm writing posts in a language that's not my mother tongue. I'm actually amazed my posts are halfway coherent and readable.
But to get back on the subject, you probably want to see hard numbers regarding this. Well, there aren't any. Developing a platform has always and will always depend on guesses. That's because we're dealing with people here, who have those nasty undefinable things called "preferences". We can only guess what's going to work out, and what isn't.
And right now,
Re:Not for Win32 compatibility (Score:5, Insightful)
Instead, Apple is offering Python and Ruby Objective-C bridges, and that makes a lot more sense. They've got bridging support for arbitrary scripting languages into the Objective-C runtime, enabling web developers to write native Mac OS X applications using native APIs. Whatever Apple does with respect to additional language support in the future, you can bet Objective-C will be a part of it. The language allows for a lot of dynamism and flexibility, and on top of that, it's a strict C superset, which means that there are no special wrappers required to call down to the POSIX layer. So it's just easy to bridge other languages with it.
At the end of the day, Objective-C just doesn't get the credit it deserves. It's a very well thought-out language with lots of power. Most people just don't see it because they think Objective-C is Apple's "proprietary" language or some such nonsense.
Re:Not for Win32 compatibility (Score:5, Informative)
I've said it before, and I'll say it again now: Objective C is exactly at the sweet spot for a computer language - it has all the power of C (it's a formal superset), the nice features of a true object-orientated language (OOP, garbage collection, protocols, etc.), adds in dynamic dispatch (thus removing the need for generics), and does it all by adding about a dozen commands to the C language. The only thing against it is the unfamiliar (to C/C++ programmers) syntax. Really, though, how hard is it to make the mental leap to [myObject insertObject:xxx atPosition:yyy] from myObject->insertObjectAtPosition(xxx,yyy) ? And which is the more readable ?
Plus, the class library is *very* well designed. It makes easy things easy, and hard things possible. A lot of hard things are pretty easy too... There's a site [dotnetdeve...ournal.com] that often compares
Objective C is a classic example of how a simple clear approach can reap huge rewards in terms of usability and flexibility. It's not the over-designed bloat-fest that is C++ (template metaprogramming ? Really ?), and it's not the raw pedal-to-the-metal-hear-the-engine-scream-in-protest of plain old C. I've never yet met anyone give it a fair try (ie: write a real program in it) and not end up loving the language.
Simon
Re:Not for Win32 compatibility (Score:5, Interesting)
You fail to differentiate between .Net and C#. By and large, I criticize the former. I can see where you might get the wrong idea, though, so I'll elaborate.
The .Net framework suggests that the prototype for an event is as follows: "ret_type event( Object sender, EventArgs_subclass e )". Compare with a "typical" windows callback mechanism: "ret_type function( HWND hParam, WPARAM wParam, LPARAM lParam )". Suspiciously similar, neh? HWND corresponds to "Object sender", and the W- and L- PARAM objects are wrapped into EventArgs.
EventArgs and its sub-classes encapsulate all of the data given to a particular handler, much like W- and L- params, which changed meanings depending on call context. Some EventArgs subclasses also perform odd tasks, for instance the CancelEventArgs.Cancel [microsoft.com] property. This is the downright stupidest OOP implementation I've ever seen. Cancel is not data, it's an action. I don't want to specify the "cancelness" of the data, I want to cancel an operation. A better design would be to send a message back to the sending object that says, "I can't validate this." Unfortunately, because .Net event handlers use the ambiguous "object handle." I'd need a cast before I could send my response.
The complexity of implementing a cancel message is likely greater than CancelEventArgs, but the solution is far more intuitive. We don't even need to go as far as sending a message, though. Provide a real type to the sender argument (for instance, ICancelableControl, or just Control), and provide a Cancel method, and I'd be happy.
Performance is a shoddy argument for the lack of a message passing system, because .Net treats the event system as a messaging network anyway. AFAIAC, use events, but add more formality to the event system. Call your EventArgs what they are -- a message--and type the sending object appropriately. Finally, differentiate functioanlly between events and multicast delegates. Events should manage their subscription list; if an object subscribing to an event is garbage collected, fail silently. If the event lacks subscribers, then succeed.
And now for something completely different.
Everyone knows MSDN is a steaming pile of crap. What's worse, Microsoft seems to be doing very little to correct that image. IMHO, this is a mistake. As a developer, my first exposure to .Net is through MSDN--fundamentally, it's marketing for techies. It should be thorough, describing how components interact, typical real-world use cases for code, the history or motivation of a particular interface, etc. MSDN should serve the same function as an O'Reilly book--set a mood and mindset for development.
MS can spend as much money developing the perfect language as they want, but without the proper supporting tools--and don't get me started on the woes of VS--their efforts piss people off. This is precisely the motivation for the GGP's note that Objective-C developers are so "happy" and my "bullshit" post.
Re:Not for Win32 compatibility (Score:5, Interesting)
However, consider that the PE file format is also used by Microsoft's Common Language Runtime (CLR/.NET). Therefore, I think this is a preparatory move to start offering a native implementation of the .NET platform for OS X.
I was just about to post this myself... It makes a lot of sense for Apple to support .NET on Mac OS X. For a start C# is now the flagship language for Windows development and not supporting it may be the difference between getting hundreds of ported apps and not getting them at all. As a Mac user and .NET developer I think it would be a big mistake for Apple to ignore .NET.
I wonder if this is how the sandboxed iPhone SDK, which is to be available in February, will be implemented
Re:Not for Win32 compatibility (Score:4, Interesting)
Adobe is pissed because it can't figure out how to squeeze more money out of a saturated market. Even though the design/print/pre-press market is large, it's finite and it's not growing much. Adobe has already sold everyone who wants or needs one a copy of Photoshop, and so they've been forced into release-constant-upgrades cycle to try and generate more revenue. So, I think Adobe's pissed they can't dump the print and pre-press market altogether and just move full scale into Flash, PDF and whatever other web technologies they can think of. And I think they're doubly pissed that, last I checked their annual report, about half the revenue from their print/design/pre-press sales come from the Apple world. So, instead of dumping that business, or spinning it off, they have to expend the time, money and effort to support two platforms. Adobe isn't pissed because of anything Apple's done. Adobe's pissed they can't dump their "legacy" apps and follow whatever will make them the most short-term profit, overall corporate health be damned.
Adobe hasn't been the same since Warnock and Company sold out and the bean counters took over. They're now a marketing company which happens to release some software from time to time. Their days as a company which produced technology which got you excited are long over.
Win32 on OS X -- goodness (Score:2)
Re:Win32 on OS X -- goodness (Score:5, Insightful)
Watch out microsoft (Score:1, Interesting)
Re:Watch out microsoft (Score:5, Funny)
-b
Re:Watch out microsoft (Score:5, Informative)
Umm, I've mostly heard complaints that the Windows version is buggier actually. There is plenty of software that is badly ported or not available on OS X, but you picked a crappy example. Of course it cuts both ways, since iTunes on Windows is pretty crappy by comparison, and you can't get OmniGraffle at all.
Some, but not as many as most people on Slashdot probably think. The hardcore gamer market is not as large as it is vocal. The casual gamer has a several year old machine and by the time they own one that can play a given game, most of them (especially outside the hardcore market) are ported to OS X. The top 10 games in a given year account for about half of game sales, and the last time I checked, 8 out of 10 had been ported within a year.
That's where a lot of people are misled. Most gamers could not run Halo on their machine for years, even if the owned a PC. And what most people care about is The Sims. In fact, if you look at the list of top selling games of all time, according to wikipedia you have:
Do you see how the average, gamer who is not hardcore would not be too perturbed by the lack of choice?
maybe OSX already have wine (Score:3, Interesting)
Hmm... (Score:4, Funny)
Now we find out that Leopard has some Windows compatibility. Maybe they're just making it bug-for-bug compatible?
How long until we hear Apple take up the "it's-not-a-bug-it's-a-feature" line?
Well then (Score:1)
More compatible than Vista (Score:2, Offtopic)
I'm no fan of OSX, but nor am I a fan of Vista. Unpopular as the view is I don't think Linux is "ready for the desktop" either. SO I'm going to be one of these sad people that clings to XP for as long as they can. The bottom line is I can't stand Vista for its restrictions (Microsoft has been behaving very badly in the last couple of years) and I can't stand OSX because I've suffered badly many years ago due to Apple's tactics and my own naivety as a child. I use XP at work and at home begrudingly. As far as I'm concerned the more cross compatibility the better since less of the apps I've spent time finding and learning to use will die a premature death.
Shush! (Score:1)
Seriously, 10.5 has got to be the clumsiest OSX release ever. It introduced a ton of problems.
Most likely there for EFI (Score:5, Informative)
If they want to natively host EFI development and not use Windows to do it, then some level PE support is required.
Just take a look at
Loading PE is not a big deal (Score:5, Insightful)
Lastly, "Is Apple planning native PE execution within OSX?" - if they were _planning_ that, they wouldn't include this into a production release of the OS. This means that it's already used for something. The big question is what exactly.
Something to ponder (Score:1)
This is either most likely do to Microsoft's monopoly on the desktop, or because of the nature of Apple zealotry, but if Microsoft included support for running OSX binaries, people would be crying "Anti-competition!" faster than it would take to load up Notepad.
No (Score:1, Redundant)
More likely this is related to EFI. Less likely this is something that a developer was playing around with and forgot to delete from his code before checking it in.
PE Loading on x86 is easy,,, (Score:4, Interesting)
The two wins are that we have one binary on all x86 platforms (which usually means testing on one platform is sufficient) and that the MS compiler generates faster binaries. The downside is that when you *do* have to debug on the non-native platforms, you must resort to printf-style debugging.
You also have to replace the default MS crt, because they make a lot of Win32 calls that you don't want to have to emulate. We just have a tiny OS layer for memory, file IO, threading, audio, and video that is native (about 30 functions).
Running Windows apps natively would make no sense (Score:5, Interesting)
The idea is to tell users "Yeah, you can run your Windows apps using Parallels or VMWare if you really have to, but if you can, we'd much rather you ran real Mac applications." Running Windows apps quasi-natively by implementing the APIs would send the wrong message; it would put Windows apps on the same or a similar level as Mac apps. That's a bad thing: The Mac relies on Mac-only or "better on Macs" applications; the high quality of software is one of the Mac's selling point. If developers could write Windows apps and they would run on Macs just fine, hey, why not write Windows apps and have five or ten times the market at no additional cost?
Of course, I'd personally love to see something like this; Office for Macs is about to lose support for Macros, so I'll probably have to run Office in Parallels, soon. Come to think of it... Maybe that's Apple's way of fixing Microsoft's Macro Mistake? Maybe the idea is to let Windows Office run natively on Macs?
Anyway, Apple's actions have been extremely hard to predict recently, so I'm not ruling out anything. Maybe they are indeed going to give the Windows APIs the Carbon treatment...
One possibility: Xen-like co-install (Score:2, Insightful)
Being a hook for Parallels (as some have suggested) isn't super efficient (a whole virtual PC just to run Windows apps is a lot of overhead; Parallels is awesome, but I doubt Apple is catering specifically to them).
Emulating or copying in some form or other the hundreds of COM objects isn't practical either.
But what if they allowed you to pop in your XP (or Vista, ugh) CD, and do an install of XP right inside OS X (a bit Xen-like) and cross-launch apps seamlessly, sharing the file system (in a Crossover Office-like way). That would really rock. (Keeping the Windows apps appropriately sandboxed of course.) Crossover Office (and coLinux, to a degree) achieve inter-OS compatibility by leveraging actual OS code, with native hooks into the host operating system. When it works, it's far more efficient that emulating an entire machine.
The more I think about it, the more I'm hoping that will be their approach.
If they can have XP (or Vista, once again, ugh) run, properly licensed, inside/alongside OS X seamlessly, it would bring people to Apple in droves. The switch to X86, allowing people to bail to Windows if their "switch" didn't work, and the efficiency of Parallels on an X86 platform (no emulation of every instruction), truly won over a lot of people to the Mac camp, myself included. This final step would be a major coup, and a natural final step in helping people get away from dependency upon Windows as their sole operating system...
Keeping my fingers crossed...
Safari OS X knows what .exe is (Score:2)
maybe supporting C#/CLR? (Score:2)
Furthermore, C# and CLR would be a reasonable platform for them to move to, given that Microsoft is not dogmatic about what libraries to use with the CLR; they could probably even create an Objective C to CLR compiler, giving people the choice of either running Objective C as native code or as CLR bytecodes. It would also make it easier for Windows developers to develop for Macintosh.
How prominently such support would feature in OS X would have to be seen; it might only be used for things like Silverlight, or it might become a full alternative to native development.
This is the catalyst (Score:1)
Update needed (Score:2)
My guess (Score:2)
My guess is that Apple has a secret project to integrate just enough of WINE/Crossover into OS X to support Microsoft Office, in the event that Microsoft backs down on its commitment to provide Office for Mac.
Microsoft screwed them over before on its promised releases of Office, and Office is a de facto requirement for corporate workstations.
Yes, iWork, OpenOffice, and Office-under-Parallels are good alternatives, but they are NOT feature-complete or performant, and are a much harder sell than "and it runs Microsoft Office too!"
binfmt_misc (Score:2)
Maybe they are using wine code (Score:1)
This could be a good reason to hide (still partial) support for window executables: wine is a very good project, and even with all its glitches it can run a lot of windows apps. Maybe OSX developers are using a lot o wine code but, since it's GPL, they want (and have to) keep it secret as long as they are able to rewrite it from scratch or include it in a way that don't violates GPL licence.
It may even be that they already violated the licence, this could be interesting to investigate, as having open source OSX would be quite nice ;-).
Unlikely (Score:4, Informative)
MOD PARENT DOWN (troll) (Score:1)