I have looked WDOSX, it seems to me interesting. But are somewhere some simple examples? And except all. Two days ago I worked with the program Partition Magic. Its version for DOS looks almost as well as in Windows. So can I write similar using WDOSX?
Posted on 2002-03-12 11:50:20 by Mike
If you go through the effort of reprogramming a large part of the
win32 API, sure :). While WDOSX loads PE files and supports DLLs,
only a (very) limited subset of the win32 API has been implemented.
It's not supposed to be a win32 environment, just something that's
nice and easy to use for 32bit dos, and allows a few console mode
apps to run...
Posted on 2002-03-12 12:42:24 by f0dder
I download WDOSX, after this I create one MZ and simple PE without dll loading. Sometimes when I use Adam Seyshell's dos extender I load dll because there are some function in int31. There are no examples how to create simplest module for Windows subset.
Something I write (see code below) but it is not working

Posted on 2002-03-13 04:30:31 by Mike
What's the problem with the code? (I don't think you have to manually
loadlibrary kernel32/user32 btw, wdosx should handle implicit DLL
binding just fine - and iirc you should specify .dll names, not .wdl).
Posted on 2002-03-13 07:31:54 by f0dder
Now I change my program as you sayd but it is not working. How about a litle sample, program than starts, call MessageBox and exiting?! May be WDOSX is great but without samples I not sure...
Posted on 2002-03-13 10:41:15 by Mike

.model flat,stdcall
option casemap:none
option proc:private

include <windows.inc>
include <kernel32.inc>
includelib <kernel32.lib>
include <user32.inc>
includelib <user32.lib>

; DATA section
szText db "text", 0
szCaption db "caption", 9

; CODE section

invoke MessageBox, NULL, offset szText, offset szCaption, MB_OK
invoke ExitProcess, 0

END entry32

ml /c /coff test.exe
link /subsystem:windows /fixed:no test.obj
stubit test.exe
Posted on 2002-03-13 10:51:20 by f0dder
WDOSX can't emulate Win32 functions!


WDOSX ported some of Win32 functions to *proper* WDOSX's own routines.

For example,

MessageBox -> WDOSX's Simple console print
WriteFile -> WDOSX's file writing routine (Extended DOS API - INT 21h)

WDOSX just simulate *some* of console&input/output function of Win32 API.

WDOSX doesn't emulate Win32 functions.
Posted on 2002-03-13 18:56:16 by nyam
Well duh ;). It's just more convenient to use the win32 api than
the (wdosx) extended int21h stuff, plus you can write apps that
can be built for either win32 or (w)dos(x)32. Nasm, for instance.
Posted on 2002-03-14 04:39:58 by f0dder
Thank you, f0dder

I understand that WDOSX replaces some calls to Windows dlls
with it's own, e.g. MessageBox. Let there are no any graphics
or windows control functions such as CreateWindow, bitblt etc.
Yes, I can see data in black and white. Good. Everybody know that Windows store it's data in registry. If I can't read registry
I can't understand nothing about Windows (users, drivers,
system and application program parameters and so on - all
are there. This simple program was written to test registry
functions (see it's code below).

; ************************************************
; That's source:
.model flat, stdcall
option casemap :none

include \MASM32\INCLUDE\windows.inc
include \MASM32\INCLUDE\user32.inc
include \MASM32\INCLUDE\kernel32.inc
include \MASM32\INCLUDE\advapi32.inc
include \MASM32\INCLUDE\masm32.inc

includelib \MASM32\LIB\user32.lib
includelib \MASM32\LIB\kernel32.lib
includelib \MASM32\LIB\advapi32.lib
includelib \MASM32\LIB\masm32.lib

szSectName db "Network\Logon",0
szKey db "username",0
keyread db "User Name",0
szErr1 db "Open Error No", 0
szErr2 db "Read Error No", 0

hKey dd ?
MaxValueLen dd ?
szData db 100 DUP (?)

invoke RegOpenKeyEx, HKEY_LOCAL_MACHINE, addr szSectName, 0, KEY_QUERY_VALUE, ADDR hKey
.IF !eax
mov MaxValueLen, 100
invoke RegQueryValueEx, hKey, addr szKey, 0, 0, addr szData, ADDR MaxValueLen
.if !eax
invoke MessageBox, 0, ADDR szData, ADDR keyread, MB_OK
invoke dwtoa, eax, addr szData
invoke MessageBox, 0, ADDR szData, ADDR szErr2, MB_OK
invoke RegCloseKey, hKey

invoke dwtoa, eax, addr szData
invoke MessageBox, 0, ADDR szData, ADDR szErr1, MB_OK


invoke ExitProcess, 0

end start

; *************************************************
; That's makeit.bat file:

ml /c /coff ReadKey.asm
link /subsystem:windows /fixed:no ReadKey.obj
stubit ReadKey.exe
del ReadKeyW.exe
del ReadKeyW.obj
ren ReadKey.bak ReadKeyW.exe
echo OK

; **************************************************

Windows version (ReadKeyW.exe) works properly and shows me
my logon (it is "mike") and WDOSX version (ReadKey.exe) shows
me only "Read Error No -1".
Yes, may be I done something wrong but what and why it works
only under Windows?!

Posted on 2002-03-14 05:22:59 by Mike
The WDOSX documentation shows which API calls are supported
(the table is a little out of date, but it's a good start). It also says that

"Some API functions are implemented as phantom calls since your
program wants to import them. However, they do not get called
ever, usually...".

I find it likely that the registry functions are such phantom calls.
Looking at the WDOSX source code confirms this.

And no, don't expect to interact with windows in *any* way from
your dos-extended programs :). (There's a few things that can be
done, like setting the title of the dos box, and handling close notifications,
but that's about it).
Posted on 2002-03-14 05:34:55 by f0dder
Thanks to all. Now I nothing expect from WDOS32. But I shall remind my question. Two days ago I worked with the program Partition Magic. Its version for DOS looks almost as well as in Windows. Someone already has made what I only write about. It's interesting to me how?


PS Phantom calls - it's great idea! Using they I can program all Windows and all versions of Unix-likes...
Posted on 2002-03-14 09:39:16 by Mike
Obviously the partitionmagic guys have spent "some time" programming
graphics & windowing routines for their application. I don't know of
any freely available library that gives you that much win32 api
implementation for dos32 (I expect that PM is programmed using
win32 api, otherwise there'd be a helluva lot code difference from
the windows and dos versions - but what do I know.)

As for phantom apis... they are there to make a few apps run that
import these functions without actually using them. Try reading the
WDOSX documentation?
Posted on 2002-03-14 09:45:26 by f0dder