How does Wine simulates Windows presence?

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
fafner
Newbie
Newbie
Posts: 2
Joined: Sat Nov 08, 2008 4:11 pm

How does Wine simulates Windows presence?

Post by fafner »

Here is a rather technical (and maybe strange) question: how does Wine simulates Windows presence at the low level?
I know that operating systems usually make themselves present using interrupts (for i386 at least), for example interrupt 0x21 for DOS and 0x80 for Linux. I suppose there is another interrupt used by Windows too. What I am wondering is how Wine makes it available to the Windows executable loaded in memory. I have read a big amount of source code from Wine (although not even 1% I'm sure), but so far no clue about where this small initialization code is hidden. Could someone point me to where it is, or even better, to a documentation?

Thanks in advance :-)

PS: In case you wonder why this would interest me, the reason is I just want to mess with this mecanism for fun :-P
vitamin
Moderator
Moderator
Posts: 6605
Joined: Sat Feb 23, 2008 2:29 pm

Re: How does Wine simulates Windows presence?

Post by vitamin »

fafner wrote:Here is a rather technical (and maybe strange) question: how does Wine simulates Windows presence?
By providing the same API.

What "low level" are you talking about? Kernel? Native API?

What ever you said about interrupts makes no sense to me. Wine does emulate DOS interrupt calls. However windows apps don't use any interrupt calls.
fafner
Newbie
Newbie
Posts: 2
Joined: Sat Nov 08, 2008 4:11 pm

Re: How does Wine simulates Windows presence?

Post by fafner »

vitamin wrote:Wine does emulate DOS interrupt calls.
In fact, that's how Wine manages to make the interrupts calls available to the application that interests me. In the "old days", one would directly write in the vector table located at address 0, or call the BIOS interrupt with the "change interrupt address" function if my memory serves me well. I know the former doesn't work in virtual address space (program crashes at the exact location of dereferencing a NULL pointer by accident is a good enough proof for me, not to mention no address mapped at 0 in the map table). And for using BIOS interrupts in a modern operating system, the one that allows direct access to hard/floppy disks sectors... I didn't even took my chance :-P
However windows apps don't use any interrupt calls.
So my assumption was wrong :-D I would be curious about how the Windows APIs manage to communicate with the kernel though, but that's only curiosity.
vitamin
Moderator
Moderator
Posts: 6605
Joined: Sat Feb 23, 2008 2:29 pm

Re: How does Wine simulates Windows presence?

Post by vitamin »

fafner wrote:So my assumption was wrong :-D I would be curious about how the Windows APIs manage to communicate with the kernel though, but that's only curiosity.
Via "native API" - ntdll.dll which in turn calls int 0x2e. However the int 0x2e is 100% undocumented and should never be used.
Locked