Commit 75a839a0 authored by Alexandre Julliard's avatar Alexandre Julliard

Release 0.2.0

Tue Jul 13 20:31:31 1993 Bob Amstadt (bob at pooh) * [global.c] Completed global memory pool API Sun Jul 11 16:59:52 1993 Alexandre Julliard * [message.c] [user.c] [user.spec] [windows.h] Added emulation of Windows message queue. Thu Jul 8 19:29:27 1993 Bob Amstadt (bob at pooh) * [build.c] Original by Bob Amstadt * [callback.c] Original by Bob Amstadt, updates by Alexandre Julliard * [dump.c] Original by Bob Amstadt * [global.c] Original by Bob Amstadt * [heap.c] Original by Bob Amstadt * [kernel.c] Original by Bob Amstadt * [ldt.c] Original by Bob Amstadt * [ldtlib.c] Original by Bob Amstadt * [relay.c] Original by Bob Amstadt * [resource.c] Original by Bob Amstadt, updates by Alexandre Juliard * [selector.c] Original by Bob Amstadt, updates by Eric Youngdale * [user.c] Original by Bob Amstadt * [wine.c] Original by Bob Amstadt, updates by Eric Youngdale and Alexandre Julliard * [wintcl.c] Original by Regents of the University of California, updates by Peter MacDonald and Alexandre Julliard * [callback.h] Original by Bob Amstadt * [dlls.h] Original by Bob Amstadt * [heap.h] Original by Bob Amstadt * [neexe.h] Original by Bob Amstadt * [prototypes.h] Original by Bob Amstadt, updates by Eric Youngdale * [segmem.h] Original by Bob Amstadt * [tkInt.h] Original by Regents of the University of California * [windows.h] Original by Peter MacDonald, updates by Alexandre Julliard and Bob Amstadt * [wine.h] Original by Eric Youngdale * [kernel.spec] Original by Bob Amstadt, updates by Alexandre Julliard * [gdi.spec] Original by Bob Amstadt, updates by Alexandre Julliard * [shell.spec] Original by Bob Amstadt * [unixlib.spec] Original by Bob Amstadt * [user.spec] Original by Bob Amstadt, updates by Alexandre Julliard * [win87em.spec] Original by Bob Amstadt * [Windows.tcl] Original by Peter MacDonald, updates by Alexandre Julliard * [build-spec.txt] Original by Bob Amstadt * [if1632.S] Original by Bob Amstadt, updates by Eric Youngdale
parent 121bd98c
Tue Jul 13 20:31:31 1993 Bob Amstadt (bob at pooh)
* [global.c]
Completed global memory pool API
Sun Jul 11 16:59:52 1993 Alexandre Julliard
* [message.c] [user.c] [user.spec] [windows.h]
Added emulation of Windows message queue.
Thu Jul 8 19:29:27 1993 Bob Amstadt (bob at pooh)
* [build.c] Original by Bob Amstadt
* [callback.c] Original by Bob Amstadt, updates by
Alexandre Julliard
* [dump.c] Original by Bob Amstadt
* [global.c] Original by Bob Amstadt
* [heap.c] Original by Bob Amstadt
* [kernel.c] Original by Bob Amstadt
* [ldt.c] Original by Bob Amstadt
* [ldtlib.c] Original by Bob Amstadt
* [relay.c] Original by Bob Amstadt
* [resource.c] Original by Bob Amstadt, updates by
Alexandre Juliard
* [selector.c] Original by Bob Amstadt, updates by Eric Youngdale
* [user.c] Original by Bob Amstadt
* [wine.c] Original by Bob Amstadt, updates by Eric Youngdale and
Alexandre Julliard
* [wintcl.c] Original by Regents of the University of California,
updates by Peter MacDonald and Alexandre Julliard
* [callback.h] Original by Bob Amstadt
* [dlls.h] Original by Bob Amstadt
* [heap.h] Original by Bob Amstadt
* [neexe.h] Original by Bob Amstadt
* [prototypes.h] Original by Bob Amstadt, updates by
Eric Youngdale
* [segmem.h] Original by Bob Amstadt
* [tkInt.h] Original by Regents of the University of California
* [windows.h] Original by Peter MacDonald, updates by
Alexandre Julliard and Bob Amstadt
* [wine.h] Original by Eric Youngdale
* [kernel.spec] Original by Bob Amstadt, updates by
Alexandre Julliard
* [gdi.spec] Original by Bob Amstadt, updates by
Alexandre Julliard
* [shell.spec] Original by Bob Amstadt
* [unixlib.spec] Original by Bob Amstadt
* [user.spec] Original by Bob Amstadt, updates by Alexandre Julliard
* [win87em.spec] Original by Bob Amstadt
* [Windows.tcl] Original by Peter MacDonald, updates by
Alexandre Julliard
* [build-spec.txt] Original by Bob Amstadt
* [if1632.S] Original by Bob Amstadt, updates by Eric Youngdale
CFLAGS=-g -DDEBUG_RESOURCE -DDEBUG_HEAP -I./
CFLAGS=-g -DDEBUG_RESOURCE -I./
######################################################################
# FILES:
......@@ -19,10 +19,10 @@ MUST_BE_LINKED_FIRST=if1632.o $(BUILDOBJS)
OBJS=$(MUST_BE_LINKED_FIRST) \
callback.o dump.o global.o heap.o ldt.o kernel.o relay.o resource.o \
selector.o user.o wine.o wintcl.o
selector.o message.o user.o wine.o class.o win.o widgets.o event.o xt.o
TARGET=wine
LIBS=-L. -L/usr/X386/lib -L/dasd3/usr/lib -lldt -ltk -ltcl -lX11
LIBS=-L. -L/usr/X386/lib -lldt -lXt -lX11
all: $(TARGET)
......
......@@ -2,14 +2,28 @@ Copyright Robert J. Amstadt, 1993. All code is provided without
warranty. It is my intent to cover this code with the Gnu Public
License.
So here goes release 0.1.0 of the Windows loader. It will do some
So here goes release 0.2.0 of the Windows loader. It will do some
relocations and then run the program. I have successfully loaded
the Windows solitaire game. Try it. It currently stops a call to
GetObject().
WHAT'S NEW with version 0.2.0:
- Alexandre Julliard has provided a replacement for the Tcl code.
The new code uses Xlib and Xt directly with no intervening
interpretted language. This should reduce the learning
curve for casual hackers.
- I changed all GLOBAL_ names to Global.
WHAT'S NEW with version 0.1.1:
- I have completed global memory allocation, but I don't like it.
It is not 100% compatible with Windows. I need some more kernel
modifications for 100% compatibility.
- Alexandre Julliard has provided written better emulation for
the Windows message queue.
WHAT'S NEW with version 0.1.0:
- Integrated patches from Alexandre.
- Minor bug fix in if1632.S
- Latest patches from Alexandre Julliard.
- minor bug fix in if1632.S
WHAT'S NEW with version 0.0.5:
- Patches from Alexandre Julliard. Some integration with Tcl.
......@@ -59,9 +73,9 @@ TODO:
- Segment fixup code completion.
- Trap and handle DOS and DPMI calls.
- global memory allocation completion
- GlobalAlloc should support ZEROINIT.
- GlobalAlloc of code segments.
- Rewrite global memory support including kernel mods to allow
application to mess with page map.
- complete and improve local heap allocation.
- Handle self-loading applications.
- Resource loading
......@@ -85,6 +99,11 @@ you keep your kernel sources), untar this file it contains three files:
- This is a patch that must be applied to the kernel.
It updates two header files, and the kernel Makefile.
Or follow the same procedure with "ldt512.tar". This file contains
Eric Youngdales patches for ALPHA-pl11. These patches give the
emulator 512 ldt entries instead of the 32 available with the older
patch kit.
BUILD:
The documentation for the build program is in the file build-spec.txt
......
# Windows Tcl/Tk emulation scripts
# Initial implementation by Peter MacDonald pmacdona@sanjuan.uvic.ca
proc CreateWindow { f t x y h w } {
global baseframe
set baseframe $f
wm title . "$t"
frame .$f
pack append . .$f {top}
canvas .$f.canvas1 -scrollregion " $x $y $h $w " -width 15c -height 10c
pack append .$f .$f.canvas1 {top}
}
proc CreateMenuEntry { fn t x } {
global baseframe
menubutton .$fn -text "$t" -underline $x -menu .$fn.m
pack append .$baseframe .$fn left
menu .$fn.m
}
proc CreateMenuBar { f } {
global allmenus
global baseframe
set allmenus ""
frame .$f -relief raised -borderwidth 1
pack before .$baseframe .$f {top fillx}
}
proc AppendMenu { a b c d x } {
global allmenus
global baseframe
if { ($b == 0x10) } {
.$c configure -text "$d" -underline "$x"
pack append .$a .$c left
set allmenus "$allmenus $c"
tk_menuBar .$a $allmenus
tk_bindForTraversal .$baseframe.canvas1
} else { if { ($b == 0x0800) } {
.$a.m add separator
} else {
.$a.m add command -label "$d" -command "wincallback menu $a $b $c $d" -underline $x
}}
}
####################################################################
# Misc unimplemented stuff
####################################################################
proc LoadIcon { wind name } {
echo "LoadIcon"
}
proc LoadBitmap { wind name } {
echo "LoadBitmap"
}
proc LoadCursor { wind name } {
echo "LoadCursor"
}
proc GetObject { obj count ptr } {
echo "GetObject $obj $count $ptr"
}
proc GetStockObject { wind } {
echo "GetStockObject $wind"
}
proc DefWindowProc { a b c d } {
echo "DefWindowProc $a $b $c $d"
}
proc GetMenu { a } {
echo "GetMenu $a"
}
proc SetMenu { a b } {
echo "SetMenu $a $b"
}
proc MessageBeep {a } {
echo "MessageBeep $a"
}
proc MessageBox { wind msg title type } {
echo "MessageBox '$msg'"
}
proc DrawText { f t top left right bottom } {
.$f.canvas1 create text $top $left -text "$t" -anchor n
}
static char RCSId[] = "$Id: wine.c,v 1.2 1993/07/04 04:04:21 root Exp root $";
static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include "windows.h"
#include "callback.h"
#include "wine.h"
#include "segmem.h"
......@@ -106,3 +107,22 @@ CALLBACK_MakeProcInstance(void *func, int instance)
return tp->thunk;
}
/**********************************************************************
* CallWindowProc (USER.122)
*/
LONG CallWindowProc( FARPROC func, HWND hwnd, WORD message,
WORD wParam, LONG lParam )
{
if ((unsigned int)func & 0xffff0000)
{
PushOn16( CALLBACK_SIZE_WORD, hwnd );
PushOn16( CALLBACK_SIZE_WORD, message );
PushOn16( CALLBACK_SIZE_WORD, wParam );
PushOn16( CALLBACK_SIZE_LONG, lParam );
return CallTo16((unsigned int) func,
FindDataSegmentForCode((unsigned long) func));
}
else
return WIDGETS_Call32WndProc( func, hwnd, message, wParam, lParam );
}
......@@ -17,13 +17,4 @@ extern int CallTo16(unsigned int csip, unsigned short ds);
extern int CallBack16(void *func, int n_args, ...);
/*
* Windows procedure calling:
* f(a, b, c, d)
* wndprocfunc(HWND hwnd, WORD message, WORD wParam, LONG lParam)
*/
#define CALLWNDPROC(f, a, b, c, d) \
CallBack16((f), 4, CALLBACK_SIZE_WORD, (a), CALLBACK_SIZE_WORD, (b), \
CALLBACK_SIZE_WORD, (c), CALLBACK_SIZE_LONG, (d))
#endif /* CALLBACK_H */
/*
* Window classes functions
*
* Copyright 1993 Alexandre Julliard
*/
static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include "class.h"
static HCLASS firstClass = 0;
/***********************************************************************
* CLASS_FindClassByName
*
* Return a handle and a pointer to the class.
* The caller must GlobalUnlock the pointer.
*/
HCLASS CLASS_FindClassByName( char * name, CLASS **ptr )
{
HCLASS class, next;
class = firstClass;
while(class)
{
*ptr = (CLASS *) GlobalLock(class);
if (!strcmp( (*ptr)->wc.lpszClassName, name )) return class;
next = (*ptr)->hNext;
GlobalUnlock(class);
class = next;
}
return 0;
}
/***********************************************************************
* CLASS_FindClassPtr
*
* Return a pointer to the CLASS structure corresponding to a HCLASS.
* The caller must GlobalUnlock the pointer.
*/
CLASS * CLASS_FindClassPtr( HCLASS hclass )
{
CLASS * ptr;
if (!hclass) return NULL;
ptr = (CLASS *) GlobalLock( hclass );
if (ptr->wMagic != CLASS_MAGIC)
{
GlobalUnlock( hclass );
return NULL;
}
return ptr;
}
/***********************************************************************
* RegisterClass (USER.57)
*/
ATOM RegisterClass( LPWNDCLASS class )
{
CLASS * newClass;
HCLASS handle;
int i;
#ifdef DEBUG_CLASS
printf( "RegisterClass: wndproc=%08x hinst=%d name='%s'\n",
class->lpfnWndProc, class->hInstance, class->lpszClassName );
#endif
handle = GlobalAlloc( GMEM_MOVEABLE, sizeof(CLASS)+class->cbClsExtra );
if (!handle) return 0;
newClass = (CLASS *) GlobalLock( handle );
newClass->hNext = firstClass;
newClass->wMagic = CLASS_MAGIC;
newClass->atomName = handle; /* Should be an atom */
newClass->hDCE = 0; /* Should allocate a DCE if needed */
newClass->cWindows = 0;
newClass->wc = *class;
newClass->wc.lpszMenuName = 0;
/* Class name should also be set to zero. For now we need the
* name because we don't have atoms.
*/
newClass->wc.lpszClassName = (char *)malloc(strlen(class->lpszClassName)+1);
strcpy( newClass->wc.lpszClassName, class->lpszClassName );
if (class->cbClsExtra) memset( newClass->wExtra, 0, class->cbClsExtra );
GlobalUnlock( handle );
firstClass = handle;
return handle; /* Should be an atom */
}
/***********************************************************************
* UnregisterClass (USER.403)
*/
BOOL UnregisterClass( LPSTR className, HANDLE instance )
{
HANDLE class, next, prevClass;
CLASS * classPtr, * prevClassPtr;
/* Check if we can remove this class */
class = CLASS_FindClassByName( className, &classPtr );
if (!class) return FALSE;
if ((classPtr->wc.hInstance != instance) || (classPtr->cWindows > 0))
{
GlobalUnlock( class );
return FALSE;
}
/* Remove the class from the linked list */
if (firstClass == class) firstClass = classPtr->hNext;
else
{
prevClass = firstClass;
while (prevClass)
{
prevClassPtr = (CLASS *) GlobalLock(prevClass);
next == prevClassPtr->hNext;
if (next == class) break;
GlobalUnlock(prevClass);
prevClass = next;
}
if (!prevClass)
{
printf( "ERROR: Class list corrupted\n" );
return FALSE;
}
prevClassPtr->hNext = classPtr->hNext;
GlobalUnlock( prevClass );
}
GlobalUnlock( class );
GlobalFree( class );
return TRUE;
}
/*
* Window classes definitions
*
* Copyright 1993 Alexandre Julliard
*/
#ifndef CLASS_H
#define CLASS_H
#include "windows.h"
#define CLASS_MAGIC 0x4b4e /* 'NK' */
typedef struct tagCLASS
{
HCLASS hNext; /* Next class */
WORD wMagic; /* Magic number (must be CLASS_MAGIC) */
ATOM atomName; /* Name of the class */
HANDLE hDCE; /* Class DC Entry (if CS_CLASSDC) */
WORD cWindows; /* Count of existing windows of this class */
WNDCLASS wc __attribute__ ((packed)); /* Class information */
WORD wExtra[1]; /* Class extra bytes */
} CLASS;
/* The caller must GlobalUnlock the pointer returned
* by these functions (except when NULL).
*/
HCLASS CLASS_FindClassByName( char * name, CLASS **ptr );
CLASS * CLASS_FindClassPtr( HCLASS hclass );
#endif /* CLASS_H */
/*
* X events handling functions
*
* Copyright 1993 Alexandre Julliard
*/
static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <X11/Core.h>
#include "windows.h"
#define NB_BUTTONS 3 /* Windows can handle 3 buttons */
#define DBLCLICK_TIME 300 /* Max. time for a double click (milliseconds) */
/* Event handlers */
static void EVENT_expose();
static void EVENT_key();
static void EVENT_mouse_motion();
static void EVENT_mouse_button();
/***********************************************************************
* EVENT_AddHandlers
*
* Add the event handlers to the given window
*/
void EVENT_AddHandlers( Widget w, int hwnd )
{
XtAddEventHandler(w, ExposureMask, FALSE,
EVENT_expose, (XtPointer)hwnd );
XtAddEventHandler(w, KeyPressMask | KeyReleaseMask, FALSE,
EVENT_key, (XtPointer)hwnd );
XtAddEventHandler(w, PointerMotionMask, FALSE,
EVENT_mouse_motion, (XtPointer)hwnd );
XtAddEventHandler(w, ButtonPressMask | ButtonReleaseMask, FALSE,
EVENT_mouse_button, (XtPointer)hwnd );
}
/***********************************************************************
* EVENT_RemoveHandlers
*
* Remove the event handlers of the given window
*/
void EVENT_RemoveHandlers( Widget w, int hwnd )
{
XtRemoveEventHandler(w, ExposureMask, FALSE,
EVENT_expose, (XtPointer)hwnd );
XtRemoveEventHandler(w, KeyPressMask | KeyReleaseMask, FALSE,
EVENT_key, (XtPointer)hwnd );
XtRemoveEventHandler(w, PointerMotionMask, FALSE,
EVENT_mouse_motion, (XtPointer)hwnd );
XtRemoveEventHandler(w, ButtonPressMask | ButtonReleaseMask, FALSE,
EVENT_mouse_button, (XtPointer)hwnd );
}
/***********************************************************************
* EVENT_XStateToKeyState
*
* Translate a X event state (Button1Mask, ShiftMask, etc...) to
* a Windows key state (MK_SHIFT, MK_CONTROL, etc...)
*/
static WORD EVENT_XStateToKeyState( int state )
{
int kstate = 0;
if (state & Button1Mask) kstate |= MK_LBUTTON;
if (state & Button2Mask) kstate |= MK_MBUTTON;
if (state & Button3Mask) kstate |= MK_RBUTTON;
if (state & ShiftMask) kstate |= MK_SHIFT;
if (state & ControlMask) kstate |= MK_CONTROL;
return kstate;
}
/***********************************************************************
* EVENT_expose
*
* Handle a X expose event
*/
static void EVENT_expose( Widget w, int hwnd, XEvent *event,
Boolean *cont_dispatch )
{
MSG msg;
XExposeEvent * expEvt = (XExposeEvent *)expEvt;
msg.hwnd = hwnd;
msg.message = WM_PAINT;
msg.wParam = 0;
msg.lParam = 0;
msg.time = 0;
msg.pt.x = 0;
msg.pt.y = 0;
MSG_AddMsg( &msg, 0 );
}
/***********************************************************************
* EVENT_key
*
* Handle a X key event
*/
static void EVENT_key( Widget w, int hwnd, XKeyEvent *event,
Boolean *cont_dispatch )
{
MSG msg;
msg.hwnd = hwnd;
msg.message = (event->type == KeyRelease) ? WM_KEYUP : WM_KEYDOWN;
msg.wParam = 0;
msg.lParam = (event->x & 0xffff) | (event->y << 16);
msg.time = event->time;
msg.pt.x = event->x & 0xffff;
msg.pt.y = event->y & 0xffff;
MSG_AddMsg( &msg );
}
/***********************************************************************
* EVENT_mouse_motion
*
* Handle a X mouse motion event
*/
static void EVENT_mouse_motion( Widget w, int hwnd, XMotionEvent *event,
Boolean *cont_dispatch )
{
MSG msg;
msg.hwnd = hwnd;
msg.message = WM_MOUSEMOVE;
msg.wParam = EVENT_XStateToKeyState( event->state );
msg.lParam = (event->x & 0xffff) | (event->y << 16);
msg.time = event->time;
msg.pt.x = event->x & 0xffff;
msg.pt.y = event->y & 0xffff;
MSG_AddMsg( &msg );
}
/***********************************************************************
* EVENT_mouse_button
*
* Handle a X mouse button event
*/
static void EVENT_mouse_button( Widget w, int hwnd, XButtonEvent *event,
Boolean *cont_dispatch )
{
static WORD messages[3][NB_BUTTONS] =
{
{ WM_LBUTTONDOWN, WM_MBUTTONDOWN, WM_RBUTTONDOWN },
{ WM_LBUTTONUP, WM_MBUTTONUP, WM_RBUTTONUP },
{ WM_LBUTTONDBLCLK, WM_MBUTTONDBLCLK, WM_RBUTTONDBLCLK }
};
static unsigned long lastClickTime[NB_BUTTONS] = { 0, 0, 0 };
MSG msg;
int buttonNum, prevTime, type;
buttonNum = event->button-1;
if (buttonNum >= NB_BUTTONS) return;
if (event->type == ButtonRelease) type = 1;
else
{ /* Check if double-click */
prevTime = lastClickTime[buttonNum];
lastClickTime[buttonNum] = event->time;
type = (event->time - prevTime < DBLCLICK_TIME) ? 2 : 0;
}
msg.hwnd = hwnd;
msg.message = messages[type][buttonNum];
msg.wParam = EVENT_XStateToKeyState( event->state );
msg.lParam = (event->x & 0xffff) | (event->y << 16);
msg.time = event->time;
msg.pt.x = event->x & 0xffff;
msg.pt.y = event->y & 0xffff;
MSG_AddMsg( &msg );
}
......@@ -61,6 +61,11 @@ HEAP_Alloc(MDESC **free_list, int flags, int bytes)
m->prev = m;
m->next = m;
if (flags & GLOBAL_FLAGS_ZEROINIT)
memset(m + 1, 0, bytes);
#ifdef DEBUG_HEAP
printf("HeapAlloc: returning %08x\n", (m + 1));
#endif
return (void *) (m + 1);
}
}
......@@ -77,12 +82,31 @@ HEAP_Alloc(MDESC **free_list, int flags, int bytes)
m->prev = m;
m->next = m;
if (flags & GLOBAL_FLAGS_ZEROINIT)
memset(m + 1, 0, bytes);
#ifdef DEBUG_HEAP
printf("HeapAlloc: returning %08x\n", (m + 1));
#endif
return (void *) (m + 1);
}
#ifdef DEBUG_HEAP
printf("HeapAlloc: returning %08x\n", 0);
#endif
return 0;
}
/**********************************************************************
* HEAP_ReAlloc
*/
void *
HEAP_ReAlloc(MDESC **free_list, void *old_block,
int new_size, unsigned int flags)
{
return 0;
}
/**********************************************************************
* HEAP_Free
*/
......@@ -209,3 +233,20 @@ HEAP_LocalAlloc(int flags, int bytes)
#endif
return m;
}
/**********************************************************************
* HEAP_LocalCompact
*/
int
HEAP_LocalCompact(int min_free)
{
MDESC *m;
int max_block;
max_block = 0;
for (m = LOCAL_FreeList; m != NULL; m = m->next)
if (m->length > max_block)
max_block = m->length;
return max_block;
}
......@@ -15,5 +15,7 @@ typedef struct heap_mem_desc_s
extern void HEAP_Init(MDESC **free_list, void *start, int length);
extern void *HEAP_Alloc(MDESC **free_list, int flags, int bytes);
extern void HEAP_Free(MDESC **free_list, void *block);
extern void *HEAP_ReAlloc(MDESC **free_list, void *old_block,
int new_size, unsigned int flags);
#endif /* HEAP_H */
......@@ -8,17 +8,6 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
extern unsigned short *Stack16Frame;
/**********************************************************************
* KERNEL_GetVersion
*
* Return the version of Windows that we emulate.
*/
int
KERNEL_GetVersion(void)
{
return 0x0301;
}
/**********************************************************************
* KERNEL_LockSegment
*/
int
......
......@@ -6,11 +6,17 @@ length 410
3 return GetVersion 0 0x301
5 pascal LocalAlloc(word word) HEAP_LocalAlloc(1 2)
15 pascal GlobalAlloc(word long) GLOBAL_Alloc(1 2)
17 pascal GlobalFree(word) GLOBAL_Free(1)
18 pascal GLobalLock(word) GLOBAL_Lock(1)
15 pascal GlobalAlloc(word long) GlobalAlloc(1 2)
16 pascal GlobalReAlloc(word long word) GlobalReAlloc(1 2 3)
17 pascal GlobalFree(word) GlobalFree(1)
18 pascal GlobalLock(word) GlobalLock(1)
19 pascal GlobalUnlock(word) GlobalUnlock(1)
20 pascal GlobalSize(word) GlobalSize(1)
21 pascal GlobalHandle(word) GlobalHandle(1)
22 pascal GlobalFlags(word) GlobalFlags(1)
23 pascal LockSegment(s_word) KERNEL_LockSegment(1)
24 pascal UnlockSegment(s_word) KERNEL_UnlockSegment(1)
25 pascal GlobalCompact(long) GlobalCompact(1)
30 pascal WaitEvent(word) KERNEL_WaitEvent(1)
49 pascal GetModuleFileName(word ptr s_word) KERNEL_GetModuleFileName(1 2 3)
51 pascal MakeProcInstance(ptr word) CALLBACK_MakeProcInstance(1 2)
......@@ -18,6 +24,17 @@ length 410
102 register DOS3Call(word word word word word
word word word word word)
KERNEL_DOS3Call(1 2 3 4 5 6 7 8 9 10)
111 pascal GlobalWire(word) GlobalLock(1)
112 pascal GlobalUnWire(word) GlobalUnlock(1)
131 pascal GetDOSEnvironment() GetDOSEnvironment()
132 return GetWinFlags 0 0x413
154 return GlobalNotify 4 0
163 pascal GlobalLRUOldest(word) ReturnArg(1)
164 pascal GlobalLRUNewest(word) ReturnArg(1)
178 equate __WINFLAGS 0x413
184 return GlobalDOSAlloc 4 0
185 return GlobalDOSFree 2 0
191 pascal GlobalPageLock(word) GlobalLock(1)
192 pascal GlobalPageUnlock(word) GlobalUnlock(1)
197 pascal GlobalFix(word) GlobalLock(1)
198 pascal GlobalUnfix(word) GlobalUnlock(1)
File added
This diff is collapsed. Click to expand it.
/*
* Message queues definitions
*
* Copyright 1993 Alexandre Julliard
*/
#ifndef MESSAGE_H
#define MESSAGE_H
#include "windows.h"
/* Message as stored in the queue (contains the extraInfo field) */
typedef struct tagQMSG
{
MSG msg;
DWORD extraInfo __attribute__ ((packed)); /* Only in 3.1 */
} QMSG;
typedef struct tagMESSAGEQUEUE
{
WORD next;
WORD hTask; /* hTask owning the queue */
WORD msgSize; /* Size of messages in the queue */
WORD msgCount; /* Number of waiting messages */
WORD nextMessage; /* Next message to be retrieved */
WORD nextFreeMessage; /* Next available slot in the queue */
WORD queueSize; /* Size of the queue */
DWORD GetMessageTimeVal; /* Value returned by GetMessageTime */
DWORD GetMessagePosVal; /* Value returned by GetMessagePos */
WORD GetMessageExtraInfoVal; /* Value returned by GetMessageExtraInfo */
DWORD lParam; /* Next four values set by SetMessage */
WORD wParam;
WORD msg;
WORD hWnd;
WORD wPostQMsg; /* PostQuitMessage flag */
WORD wExitCode; /* PostQuitMessage exit code */
WORD InSendMessageHandle; /* Handle of task that sent a message */
WORD tempStatus; /* State reset by GetQueueStatus */
WORD status; /* Queue state */
QMSG messages[1]; /* Queue messages */
} MESSAGEQUEUE;
#endif /* MESSAGE_H */
......@@ -27,10 +27,6 @@ extern unsigned int GetEntryPointFromOrdinal(struct w_files * wpnt,
extern struct segment_descriptor_s *GetNextSegment(unsigned int flags,
unsigned int limit);
extern unsigned int GLOBAL_Alloc(unsigned int flags, unsigned long size);
extern unsigned int GLOBAL_Free(unsigned int block);
extern void *GLOBAL_Lock(unsigned int block);
extern struct mz_header_s *CurrentMZHeader;
extern struct ne_header_s *CurrentNEHeader;
extern int CurrentNEFile;
......
......@@ -200,3 +200,11 @@ FindOrdinalFromName(struct dll_table_entry_s *dll_table, char *func_name)
return 0;
}
/**********************************************************************
* ReturnArg
*/
int
ReturnArg(int arg)
{
return arg;
}
......@@ -40,9 +40,13 @@ ConvertCoreBitmap(BITMAPCOREHEADER *image, int image_size)
int n_colors;
n_colors = 1 << image->bcBitCount;
handle = GLOBAL_Alloc(GMEM_MOVEABLE,
handle = GlobalAlloc(GMEM_MOVEABLE,
image_size + sizeof(*new_image) + n_colors);
new_image = GLOBAL_Lock(handle);
new_image = GlobalLock(handle);
#ifdef DEBUG_RESOURCE
printf("ConvertCoreBitmap: handle = %04x, new image = %08x\n",
handle, new_image);
#endif
if (new_image == NULL)
return NULL;
......@@ -96,6 +100,11 @@ ConvertCoreBitmap(BITMAPCOREHEADER *image, int image_size)
void *
ConvertInfoBitmap(BITMAPINFOHEADER *image, int image_size)
{
#ifdef DEBUG_RESOURCE
printf("ConvertInfoBitmap: \n");
#endif
return NULL;
}
/**********************************************************************
......@@ -142,6 +151,9 @@ AddResource(int type, void *data)
r->resource_type = type;
r->resource_data = data;
#ifdef DEBUG_RESOURCE
printf("AddResource: return handle %d\n", i + 1);
#endif
/*
* Return a unique handle.
*/
......@@ -325,6 +337,9 @@ RSC_LoadResource(int instance, char *rsc_name, int type)
free(image);
#ifdef DEBUG_RESOURCE
printf("LoadResource: rsc_image = %08x\n", rsc_image);
#endif
/*
* Add to resource list.
*/
......
# Tcl autoload index file: each line identifies a Tcl
# procedure and the file where that procedure is
# defined. Generated by the "auto_mkindex" command.
CreateWindow Windows.tcl
CreateMenuBar Windows.tcl
AppendMenu Windows.tcl
# Unimplemented stuff
LoadIcon Windows.tcl
LoadCursor Windows.tcl
GetStockObject Windows.tcl
DefWindowProc Windows.tcl
This diff is collapsed. Click to expand it.
......@@ -5,6 +5,9 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <stdlib.h>
#include "prototypes.h"
#define DEFAULT_MSG_QUEUE_SIZE 8
/**********************************************************************
* USER_InitApp
*
......@@ -13,5 +16,11 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
int
USER_InitApp(int hInstance)
{
/* Initialize built-in window classes */
WIDGETS_Init();
/* Create task message queue */
if (!SetMessageQueue( DEFAULT_MSG_QUEUE_SIZE )) return 0;
return 1;
}
......@@ -13,14 +13,20 @@ length 540
41 pascal CreateWindow(ptr ptr long word word word word word word word ptr)
CreateWindow(1 2 3 4 5 6 7 8 9 10 11)
42 pascal ShowWindow(word word) ShowWindow(1 2)
53 pascal DestroyWindow(word) DestroyWindow(1)
57 pascal RegisterClass(ptr) RegisterClass(1)
66 pascal GetDC(word) GetDC(1)
85 pascal DrawText(word ptr word ptr word) DrawText(1 2 3 4 5)
85 pascal DrawText(word ptr s_word ptr word) DrawText(1 2 3 4 5)
104 pascal MessageBeep(word) MessageBeep(1)
107 pascal DefWindowProc(word word word long) DefWindowProc(1 2 3 4)
108 pascal GetMessage(ptr word word word) GetMessage(1 2 3 4)
109 pascal PeekMessage(ptr word word word word) PeekMessage(1 2 3 4 5)
110 pascal PostMessage(word word word word) PostMessage(1 2 3 4)
111 pascal SendMessage(word word word word) SendMessage(1 2 3 4)
113 pascal TranslateMessage(ptr) TranslateMessage(1)
114 pascal DispatchMessage(ptr) DispatchMessage(1)
119 pascal GetMessagePos() GetMessagePos()
120 pascal GetMessageTime() GetMessageTime()
124 pascal UpdateWindow(word) UpdateWindow(1)
151 pascal CreateMenu() CreateMenu()
157 pascal GetMenu(word) GetMenu(1)
......@@ -29,4 +35,9 @@ length 540
174 pascal LoadIcon(word ptr) RSC_LoadIcon(1 2)
175 pascal LoadBitmap(word ptr) RSC_LoadBitmap(1 2)
176 pascal LoadString(word word ptr s_word) RSC_LoadString(1 2 3 4)
266 pascal SetMessageQueue(word) SetMessageQueue(1)
288 pascal GetMessageExtraInfo() GetMessageExtraInfo()
334 pascal GetQueueStatus(word) GetQueueStatus(1)
335 pascal GetInputState() GetInputState()
403 pascal UnregisterClass(ptr word) UnregisterClass(1 2)
411 pascal AppendMenu(word word word ptr) AppendMenu(1 2 3 4)
/*
* Windows widgets (built-in window classes)
*
* Copyright 1993 Alexandre Julliard
*/
static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include "windows.h"
static LONG WIDGETS_ButtonWndProc( HWND hwnd, WORD message,
WORD wParam, LONG lParam );
static LONG WIDGETS_StaticWndProc( HWND hwnd, WORD message,
WORD wParam, LONG lParam );
#define NB_BUILTIN_CLASSES 2
static WNDCLASS WIDGETS_BuiltinClasses[NB_BUILTIN_CLASSES] =
{
{ 0, WIDGETS_ButtonWndProc, 0, 0, 0, 0, 0, 0, NULL, "BUTTON" },
{ 0, WIDGETS_StaticWndProc, 0, 0, 0, 0, 0, 0, NULL, "STATIC" }
};
static FARPROC WndProc32[NB_BUILTIN_CLASSES];
/***********************************************************************
* WIDGETS_Init
*
* Initialize the built-in window classes.
*/
BOOL WIDGETS_Init()
{
int i;
WNDCLASS * pClass = WIDGETS_BuiltinClasses;
for (i = 0; i < NB_BUILTIN_CLASSES; i++, pClass++)
{
WndProc32[i] = pClass->lpfnWndProc;
pClass->lpfnWndProc = (FARPROC) i+1;
if (!RegisterClass(pClass)) return FALSE;
}
return TRUE;
}
/**********************************************************************
* WIDGETS_Call32WndProc
*
* Call the window procedure of a built-in class.
*/
LONG WIDGETS_Call32WndProc( FARPROC func, HWND hwnd, WORD message,
WORD wParam, LONG lParam )
{
unsigned int i = (unsigned int) func;
if (!i || (i > NB_BUILTIN_CLASSES)) return 0;
return (*WndProc32[i-1])( hwnd, message, wParam, lParam );
}
/***********************************************************************
* WIDGETS_ButtonWndProc
*/
static LONG WIDGETS_ButtonWndProc( HWND hwnd, WORD message,
WORD wParam, LONG lParam )
{
switch(message)
{
case WM_CREATE:
return 0;
case WM_PAINT:
{
HDC hdc;
PAINTSTRUCT ps;
RECT rect;
hdc = BeginPaint( hwnd, &ps );
GetClientRect( hwnd, &rect );
DrawText(hdc, "Button", -1, &rect,
DT_SINGLELINE | DT_CENTER | DT_VCENTER );
EndPaint( hwnd, &ps );
return 0;
}
default:
return DefWindowProc( hwnd, message, wParam, lParam );
}
}
/***********************************************************************
* WIDGETS_StaticWndProc
*/
static LONG WIDGETS_StaticWndProc( HWND hwnd, WORD message,
WORD wParam, LONG lParam )
{
switch(message)
{
case WM_CREATE:
return 0;
case WM_PAINT:
{
HDC hdc;
PAINTSTRUCT ps;
RECT rect;
hdc = BeginPaint( hwnd, &ps );
GetClientRect( hwnd, &rect );
DrawText(hdc, "Static", -1, &rect,
DT_SINGLELINE | DT_CENTER | DT_VCENTER );
EndPaint( hwnd, &ps );
return 0;
}
default:
return DefWindowProc( hwnd, message, wParam, lParam );
}
}
/*
* Window related functions
*
* Copyright 1993 Alexandre Julliard
*/
static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <X11/Core.h>
#include <X11/Shell.h>
#include "class.h"
#include "win.h"
extern Widget XT_topLevelWidget;
static HWND firstWindow = 0;
/***********************************************************************
* WIN_FindWndPtr
*
* Return a pointer to the WND structure corresponding to a HWND.
* The caller must GlobalUnlock the pointer.
*/
WND * WIN_FindWndPtr( HWND hwnd )
{
WND * ptr;
if (!hwnd) return NULL;
ptr = (WND *) GlobalLock( hwnd );
if (ptr->dwMagic != WND_MAGIC)
{
GlobalUnlock( hwnd );
return NULL;
}
return ptr;
}
/***********************************************************************
* CreateWindow (USER.41)
*/
HWND CreateWindow( LPSTR className, LPSTR windowName,
DWORD style, int x, int y, int width, int height,
HWND parent, HMENU menu, HANDLE instance, LPSTR data )
{
HANDLE class, hwnd;
CLASS *classPtr;
WND *wndPtr, *parentPtr = NULL;
CREATESTRUCT createStruct;
Widget parentWidget = 0;
printf( "CreateWindow: %s\n", windowName );
if (x == CW_USEDEFAULT) x = 0;
if (y == CW_USEDEFAULT) y = 0;
if (width == CW_USEDEFAULT) width = 600;
if (height == CW_USEDEFAULT) height = 400;
/* Find the parent and class */
if (parent)
{
/* Check if parent is valid */
parentPtr = WIN_FindWndPtr( parent );
if (!parentPtr) return 0;
}
else if (style & WS_CHILD) return 0; /* WS_CHILD needs a parent */
if (!(class = CLASS_FindClassByName( className, &classPtr )))
{
GlobalUnlock( parent );
return 0;
}
/* Create the window structure */
hwnd = GlobalAlloc( GMEM_MOVEABLE, sizeof(WND)+classPtr->wc.cbWndExtra );
if (!hwnd)
{
GlobalUnlock( parent );
GlobalUnlock( class );
return 0;
}
/* Fill the structure */
wndPtr = (WND *) GlobalLock( hwnd );
wndPtr->hwndNext = 0;
wndPtr->hwndChild = 0;
wndPtr->dwMagic = WND_MAGIC;
wndPtr->hwndParent = parent;
wndPtr->hwndOwner = parent; /* What else? */
wndPtr->hClass = class;
wndPtr->hInstance = instance;
wndPtr->rectClient.left = x;
wndPtr->rectClient.top = y;
wndPtr->rectClient.right = x + width;
wndPtr->rectClient.bottom = y + height;
wndPtr->rectWindow = wndPtr->rectClient;
wndPtr->hrgnUpdate = 0;
wndPtr->hwndLastActive = 0;
wndPtr->lpfnWndProc = classPtr->wc.lpfnWndProc;
wndPtr->dwStyle = style;
wndPtr->hDCE = 0;
wndPtr->hmenuSystem = 0;
wndPtr->wIDmenu = menu;
if (classPtr->wc.cbWndExtra)
memset( wndPtr->wExtra, 0, classPtr->wc.cbWndExtra );
classPtr->cWindows++;
/* Insert the window in the linked list */
if (parent)
{
wndPtr->hwndNext = parentPtr->hwndChild;
parentPtr->hwndChild = hwnd;
}
else /* Top-level window */
{
wndPtr->hwndNext = firstWindow;
firstWindow = hwnd;
}
/* Fill the CREATESTRUCT */
createStruct.lpCreateParams = data;
createStruct.hInstance = instance;
createStruct.hMenu = menu;
createStruct.hwndParent = parent;
createStruct.cx = width;
createStruct.cy = height;
createStruct.x = x;
createStruct.y = y;
createStruct.style = style;
createStruct.lpszName = windowName;
createStruct.lpszClass = className;
createStruct.dwExStyle = 0;
/* Create the widgets */
if (style & WS_CHILD)
{
wndPtr->shellWidget = 0;
wndPtr->winWidget = XtVaCreateManagedWidget(className,
coreWidgetClass,
parentPtr->winWidget,
XtNx, x,
XtNy, y,
XtNwidth, width,
XtNheight, height,
NULL );
}
else
{
wndPtr->shellWidget = XtVaAppCreateShell(className,
windowName,
topLevelShellWidgetClass,
XtDisplay(XT_topLevelWidget),
XtNx, x,
XtNy, y,
NULL );
wndPtr->winWidget = XtVaCreateManagedWidget(className,
compositeWidgetClass,
wndPtr->shellWidget,
XtNwidth, width,
XtNheight, height,
NULL );
}
/* Send the WM_CREATE message */
if (CallWindowProc( wndPtr->lpfnWndProc, hwnd,
WM_CREATE, 0, (LONG) &createStruct ) == -1)
{
/* Abort window creation */
if (wndPtr->shellWidget) XtDestroyWidget( wndPtr->shellWidget );
else XtDestroyWidget( wndPtr->winWidget );
GlobalUnlock( parent );
GlobalUnlock( class );
GlobalUnlock( hwnd );
GlobalFree( hwnd );
return 0;
}
EVENT_AddHandlers( wndPtr->winWidget, hwnd );
GlobalUnlock( parent );
GlobalUnlock( class );
GlobalUnlock( hwnd );
return hwnd;
}
/***********************************************************************
* DestroyWindow (USER.53)
*/
BOOL DestroyWindow( HWND hwnd )
{
WND *wndPtr, *parentPtr;
CLASS * classPtr;
wndPtr = WIN_FindWndPtr( hwnd );
if (!wndPtr) return FALSE;
if (wndPtr->hwndParent)
{
parentPtr = WIN_FindWndPtr( wndPtr->hwndParent );
printf( "INTERNAL ERROR: DestroyWindow: Invalid window parent\n" );
return FALSE;
}
classPtr = CLASS_FindClassPtr( wndPtr->hClass );
if (!classPtr)
{
printf( "INTERNAL ERROR: DestroyWindow: Invalid window class\n" );
return FALSE;
}
SendMessage( hwnd, WM_DESTROY, 0, 0 );
/* Destroy all children */
/* ........... */
/* Remove the window from the linked list */
/* ........... */
/* Destroy the window */
if (wndPtr->shellWidget) XtDestroyWidget( wndPtr->shellWidget );
else XtDestroyWidget( wndPtr->winWidget );
classPtr->cWindows--;
GlobalUnlock( wndPtr->hClass );
if (wndPtr->hwndParent) GlobalUnlock( wndPtr->hwndParent );
GlobalUnlock( hwnd );
GlobalFree( hwnd );
return TRUE;
}
/***********************************************************************
* GetClientRect (USER.33)
*/
void GetClientRect( HWND hwnd, LPRECT rect )
{
WND * wndPtr = WIN_FindWndPtr( hwnd );
rect->left = rect->top = rect->right = rect->bottom = 0;
if (wndPtr)
{
XtVaGetValues(wndPtr->winWidget,
XtNwidth, &rect->right,
XtNheight, &rect->bottom,
NULL );
GlobalUnlock( hwnd );
}
}
/***********************************************************************
* ShowWindow (USER.42)
*/
BOOL ShowWindow( HWND hwnd, int cmd )
{
WND * wndPtr = WIN_FindWndPtr( hwnd );
if (wndPtr)
{
if (wndPtr->shellWidget) XtRealizeWidget( wndPtr->shellWidget );
GlobalUnlock( hwnd );
}
return TRUE;
}
/***********************************************************************
* UpdateWindow (USER.124)
*/
void UpdateWindow( HWND hwnd )
{
SendMessage( hwnd, WM_PAINT, 0, 0 );
}
/*
* Window definitions
*
* Copyright 1993 Alexandre Julliard
*/
#ifndef WIN_H
#define WIN_H
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <X11/Core.h>
#include "windows.h"
#define WND_MAGIC 0x444e4957 /* 'WIND' */
typedef struct tagWND
{
HWND hwndNext; /* Next sibling */
HWND hwndChild; /* First child */
DWORD dwMagic; /* Magic number (must be WND_MAGIC) */
HWND hwndParent; /* Window parent (from CreateWindow) */
HWND hwndOwner; /* Window owner */
HCLASS hClass; /* Window class */
HANDLE hInstance; /* Window hInstance (from CreateWindow) */
RECT rectClient; /* Window client area screen coords */
RECT rectWindow; /* Window whole area screen coords */
HRGN hrgnUpdate; /* Update region */
HWND hwndLastActive; /* Last active popup hwnd */
FARPROC lpfnWndProc; /* Window procedure */
DWORD dwStyle; /* Window style (from CreateWindow) */
HANDLE hDCE; /* Window DC Entry (if CS_OWNDC) */
HMENU hmenuSystem; /* System menu */
WORD wIDmenu; /* ID or hmenu (from CreateWindow) */
Widget shellWidget; /* For top-level windows */
Widget winWidget; /* For all windows */
WORD wExtra[1]; /* Window extra bytes */
} WND;
/* The caller must GlobalUnlock the pointer returned
* by this function (except when NULL).
*/
WND * WIN_FindWndPtr( HWND hwnd );
#endif /* WIN_H */
/* Initial draft attempt of windows.h, by Peter MacDonald, pmacdona@sanjuan.uvic.ca */
#ifndef WINDOWS_H
#define WINDOWS_H
#ifndef _WINARGS
typedef unsigned short WORD;
......@@ -12,19 +15,20 @@ typedef long LONG;
typedef WORD HANDLE;
typedef HANDLE HWND;
typedef HANDLE HDC;
typedef HANDLE HCLASS;
typedef HANDLE HCURSOR;
typedef HANDLE HFONT;
typedef HANDLE HPEN;
typedef HANDLE HRGN;
typedef HANDLE HPALETTE;
typedef HANDLE HICON;
typedef HANDLE HINSTANCE;
typedef HANDLE HMENU;
typedef HANDLE HBITMAP;
typedef HANDLE HBRUSH;
typedef HANDLE LOCALHANDLE;
typedef char *LPSTR;
typedef char *NPSTR;
typedef char *LPMSG;
typedef int *LPINT;
typedef void *LPVOID;
typedef long (*FARPROC)();
......@@ -66,25 +70,44 @@ typedef struct {
HICON hIcon;
HCURSOR hCursor;
HBRUSH hbrBackground;
LPSTR lpszMenuName, lpszClassName;
LPSTR lpszMenuName __attribute__ ((packed));
LPSTR lpszClassName __attribute__ ((packed));
} WNDCLASS;
typedef WNDCLASS * PWNDCLASS;
typedef WNDCLASS * NPWNDCLASS;
typedef WNDCLASS * LPWNDCLASS;
typedef struct { int x, y; } POINT;
typedef struct {
void * lpCreateParams;
HINSTANCE hInstance;
HMENU hMenu;
HWND hwndParent;
short cy;
short cx;
short y;
short x;
LONG style __attribute__ ((packed));
char * lpszName __attribute__ ((packed));
char * lpszClass __attribute__ ((packed));
DWORD dwExStyle __attribute__ ((packed));
} CREATESTRUCT, *LPCREATESTRUCT;
typedef struct { short x, y; } POINT;
typedef POINT *PPOINT;
typedef POINT *NPPOINT;
typedef POINT *LPPOINT;
typedef struct {
HWND hwnd;
WORD message, wParam;
long lParam;
DWORD time;
POINT pt;
} MSG;
typedef struct tagMSG
{
HWND hwnd;
WORD message;
WORD wParam;
DWORD lParam __attribute__ ((packed));
DWORD time __attribute__ ((packed));
POINT pt __attribute__ ((packed));
} MSG, *LPMSG;
typedef WORD ATOM;
......@@ -270,7 +293,57 @@ enum { WM_NULL, WM_CREATE, WM_DESTROY, WM_MOVE, WM_UNUSED0, WM_SIZE, WM_ACTIVATE
WM_DELETEITEM, WM_VKEYTOITEM,
WM_CHARTOITEM, WM_SETFONT, WM_GETFONT };
#define WM_COMMAND 0x0111
/* Keyboard messages */
#define WM_KEYDOWN 0x0100
#define WM_KEYUP 0x0101
#define WM_CHAR 0x0102
#define WM_DEADCHAR 0x0103
#define WM_SYSKEYDOWN 0x0104
#define WM_SYSKEYUP 0x0105
#define WM_SYSCHAR 0x0106
#define WM_SYSDEADCHAR 0x0107
#define WM_KEYFIRST WM_KEYDOWN
#define WM_KEYLAST 0x0108
#define WM_COMMAND 0x0111
#define WM_TIMER 0x0113
/* Mouse messages */
#define WM_MOUSEMOVE 0x0200
#define WM_LBUTTONDOWN 0x0201
#define WM_LBUTTONUP 0x0202
#define WM_LBUTTONDBLCLK 0x0203
#define WM_RBUTTONDOWN 0x0204
#define WM_RBUTTONUP 0x0205
#define WM_RBUTTONDBLCLK 0x0206
#define WM_MBUTTONDOWN 0x0207
#define WM_MBUTTONUP 0x0208
#define WM_MBUTTONDBLCLK 0x0209
#define WM_MOUSEFIRST WM_MOUSEMOVE
#define WM_MOUSELAST WM_MBUTTONDBLCLK
/* Key status flags for mouse events */
#define MK_LBUTTON 0x0001
#define MK_RBUTTON 0x0002
#define MK_SHIFT 0x0004
#define MK_CONTROL 0x0008
#define MK_MBUTTON 0x0010
/* Queue status flags */
#define QS_KEY 0x0001
#define QS_MOUSEMOVE 0x0002
#define QS_MOUSEBUTTON 0x0004
#define QS_MOUSE (QS_MOUSEMOVE | QS_MOUSEBUTTON)
#define QS_POSTMESSAGE 0x0008
#define QS_TIMER 0x0010
#define QS_PAINT 0x0020
#define QS_SENDMESSAGE 0x0040
#define QS_ALLINPUT 0x007f
/* PeekMessage() options */
#define PM_NOREMOVE 0x0000
#define PM_REMOVE 0x0001
#define PM_NOYIELD 0x0002
enum { SW_HIDE, SW_SHOWNORMAL, SW_NORMAL, SW_SHOWMINIMIZED, SW_SHOWMAXIMIZED,
SW_MAXIMIZE, SW_SHOWNOACTIVATE, SW_SHOW, SW_MINIMIZE,
......@@ -400,16 +473,23 @@ int wsprintf(LPSTR a,LPSTR b,...);
/* Implemented functions */
F(HMENU,CreateMenu)
F(BOOL,GetInputState)
F(LPSTR,GetDOSEnvironment)
F(DWORD,GetMessagePos)
F(LONG,GetMessageTime)
F(LONG,GetMessageExtraInfo)
Fa(BOOL,IsCharAlpha,char,ch)
Fa(BOOL,IsCharAlphaNumeric,char,ch)
Fa(BOOL,IsCharLower,char,ch)
Fa(BOOL,IsCharUpper,char,ch)
Fa(BOOL,RegisterClass,LPWNDCLASS,a)
Fa(ATOM,RegisterClass,LPWNDCLASS,a)
Fa(BOOL,TranslateMessage,LPMSG,a)
Fa(void,PostQuitMessage,int,a)
Fa(BOOL,SetMessageQueue,int,a)
Fa(int,_lclose,int,a)
Fb(int,_lopen,LPSTR,a,int,b)
Fa(int,lstrlen,LPSTR,a)
Fa(long,DispatchMessage,MSG *,msg)
Fa(LONG,DispatchMessage,LPMSG,msg)
Fa(void,UpdateWindow,HWND,a)
Fb(BOOL,ExitWindows,DWORD,dwReserved,WORD,wReturnCode)
Fb(BOOL,ShowWindow,HWND,a,int,b)
......@@ -421,6 +501,7 @@ Fb(int,lstrcmp,LPSTR,a,LPSTR,b )
Fb(int,lstrcmpi,LPSTR,a,LPSTR,b )
Fb(void,EndPaint,HWND,a,LPPAINTSTRUCT,b)
Fb(void,GetClientRect,HWND,a,LPRECT,b)
Fb(BOOL,UnregisterClass,LPSTR,a,HANDLE,b)
Fc(BOOL,LineTo,HDC,a,int,b,int,c)
Fc(LONG,_llseek,int,a,long,b,int,c)
Fc(WORD,_lread,int,a,LPSTR,b,int,c)
......@@ -428,9 +509,13 @@ Fc(WORD,_lwrite,int,a,LPSTR,b,int,c)
Fc(int,FillRect,HDC,a,LPRECT,b,HBRUSH,c)
Fc(DWORD,MoveTo,HDC,a,int,b,int,c)
Fd(BOOL,AppendMenu,HMENU,a,WORD,b,WORD,c,LPSTR,d)
Fd(BOOL,PostMessage,HWND,a,WORD,b,WORD,c,LONG,d)
Fd(LONG,SendMessage,HWND,a,WORD,b,WORD,c,LONG,d)
Fd(BOOL,GetMessage,LPMSG,msg,HWND,b,WORD,c,WORD,d)
Fe(BOOL,Rectangle,HDC,a,int,xLeft,int,yTop,int,xRight,int,yBottom)
Fe(int,DrawText,HDC,a,LPSTR,str,int,c,LPRECT,d,WORD,flag)
Fe(BOOL,PeekMessage,LPMSG,a,HWND,b,WORD,c,WORD,d,WORD,e)
Fe(LONG,CallWindowProc,FARPROC,a,HWND,b,WORD,c,WORD,d,LONG,e)
Fi(BOOL,Arc,HDC,a,int,xLeft,int,yTop,int,xRight,int,yBottom,int,xStart,int,yStart,int,xEnd,int,yEnd)
Fi(BOOL,Chord,HDC,a,int,xLeft,int,yTop,int,xRight,int,yBottom,int,xStart,int,yStart,int,xEnd,int,yEnd)
Fi(BOOL,Pie,HDC,a,int,xLeft,int,yTop,int,xRight,int,yBottom,int,xStart,int,yStart,int,xEnd,int,yEnd)
......@@ -440,10 +525,8 @@ Fk(HWND,CreateWindow,LPSTR,szAppName,LPSTR,Label,DWORD,ol,int,x,int,y,int,w,int,
F(BOOL,AnyPopup)
F(BOOL,CloseClipboard)
F(BOOL,EmptyClipboard)
F(BOOL,GetInputState)
F(BOOL,InSendMessage)
F(DWORD,GetCurrentTime)
F(DWORD,GetMessagePos)
F(DWORD,GetTickCount)
F(HANDLE,GetCurrentTask)
F(HMENU,CreatePopupMenu)
......@@ -456,10 +539,8 @@ F(HWND,GetDesktopWindow)
F(HWND,GetFocus)
F(HWND,GetSysModalWindow)
F(LONG,GetMenuCheckMarkDimensions)
F(LONG,GetMessageTime)
F(LONG,GetWinFlags)
F(LPINT,GetThresholdEvent)
/*F(LPSTR,GetDOSEnvironment)*/
F(LPSTR,ValidateFreeSpaces)
F(void,ValidateCodeSegments)
F(WORD,GetCaretBlinkTime)
......@@ -521,7 +602,6 @@ Fa(BOOL,OpenClipboard,HWND,a)
Fa(BOOL,OpenIcon,HWND,a)
Fa(BOOL,RemoveFontResource,LPSTR,a)
Fa(BOOL,SetErrorMode,WORD,a)
Fa(BOOL,SetMessageQueue,int,a)
Fa(BOOL,SwapMouseButton,BOOL,a)
Fa(BOOL,UnrealizeObject,HBRUSH,a)
Fa(BYTE,GetTempDrive,BYTE,a)
......@@ -656,7 +736,6 @@ Fa(void,GetKeyboardState,BYTE FAR*,a)
Fa(void,HideCaret,HWND,a)
Fa(void,MessageBeep,WORD,a)
Fa(void,OutputDebugString,LPSTR,a)
Fa(void,PostQuitMessage,int,a)
Fa(void,ReplyMessage,LONG,a)
Fa(void,SetCaretBlinkTime,WORD,a)
Fa(void,SetDoubleClickTime,WORD,a)
......@@ -688,7 +767,6 @@ Fb(BOOL,SetConvertParams,int,a,int,b)
Fb(BOOL,SetMenu,HWND,a,HMENU,b)
Fb(BOOL,TranslateMDISysAccel,HWND,a,LPMSG,b)
Fb(BOOL,UnhookWindowsHook,int,a,FARPROC,b)
Fb(BOOL,UnregisterClass,LPSTR,a,HANDLE,b)
Fb(DWORD,GetNearestColor,HDC,a,DWORD,b)
Fb(DWORD,SetBkColor,HDC,a,DWORD,b)
Fb(DWORD,SetMapperFlags,HDC,a,DWORD,b)
......@@ -885,7 +963,6 @@ Fd(BOOL,GetCharWidth,HDC,a,WORD,b,WORD,c,LPINT,d)
Fd(BOOL,HiliteMenuItem,HWND,a,HMENU,b,WORD,c,WORD,d)
Fd(BOOL,PolyPolygon,HDC,a,LPPOINT,b,LPINT,c,int,d)
Fd(BOOL,PostAppMessage,HANDLE,a,WORD,b,WORD,c,LONG,d)
Fd(BOOL,PostMessage,HWND,a,WORD,b,WORD,c,LONG,d)
Fd(BOOL,WinHelp,HWND,hwndMain,LPSTR,lpszHelp,WORD,usCommand,DWORD,ulData)
Fd(BOOL,WritePrivateProfileString,LPSTR,a,LPSTR,b,LPSTR,c,LPSTR,d)
Fd(DWORD,DefHookProc,int,a,WORD,b,DWORD,c,FARPROC FAR*,d)
......@@ -900,7 +977,6 @@ Fd(HWND,CreateDialogIndirect,HANDLE,a,LPSTR,b,HWND,c,FARPROC,d)
Fd(LONG,DefDlgProc,HWND,a,WORD,b,WORD,c,LONG,d)
Fd(LONG,DefMDIChildProc,HWND,a,WORD,b,WORD,c,LONG,d)
Fd(LONG,DefWindowProc,HWND,a,WORD,b,WORD,c,LONG,d)
Fd(LONG,SendMessage,HWND,a,WORD,b,WORD,c,LONG,d)
Fd(WORD,GetDlgItemInt,HWND,a,int,b,BOOL FAR*,c,BOOL,d)
Fd(WORD,GetPaletteEntries,HPALETTE,a,WORD,b,WORD,c,LPPALETTEENTRY,d)
Fd(WORD,GetPrivateProfileInt,LPSTR,a,LPSTR,b,int,c,LPSTR,d)
......@@ -931,7 +1007,6 @@ Fe(BOOL,ExtFloodFill,HDC,a,int,b,int,c,DWORD,d,WORD,e)
Fe(BOOL,FrameRgn,HDC,a,HRGN,b,HBRUSH,e,int,c,int,d)
Fe(BOOL,InsertMenu,HMENU,a,WORD,b,WORD,c,WORD,d,LPSTR,e)
Fe(BOOL,ModifyMenu,HMENU,a,WORD,b,WORD,c,WORD,d,LPSTR,e)
Fe(BOOL,PeekMessage,LPMSG,a,HWND,b,WORD,c,WORD,d,WORD,e)
Fe(BOOL,SetMenuItemBitmaps,HMENU,a,WORD,b,WORD,c,HBITMAP,d,HBITMAP,e)
Fe(BOOL,TextOut,HDC,a,int,b,int,c,LPSTR,d,int,e)
Fe(DWORD,GetTabbedTextExtent,HDC,a,LPSTR,b,int,c,int,d,LPINT,e)
......@@ -940,7 +1015,6 @@ Fe(DWORD,ScaleWindowExt,HDC,a,int,b,int,c,int,d,int,e)
Fe(HBITMAP,CreateBitmap,int,a,int,b,BYTE,c,BYTE,d,LPSTR,e)
Fe(HWND,CreateDialogIndirectParam,HANDLE,a,LPSTR,b,HWND,c,FARPROC,d,LONG,e)
Fe(HWND,CreateDialogParam,HANDLE,a,LPSTR,b,HWND,c,FARPROC,d,LONG,e)
Fe(LONG,CallWindowProc,FARPROC,a,HWND,b,WORD,c,WORD,d,LONG,e)
Fe(LONG,DefFrameProc,HWND,a,HWND,b,WORD,c,WORD,d,LONG,e)
Fe(LONG,SendDlgItemMessage,HWND,a,int,b,WORD,c,WORD,d,LONG,e)
Fe(int,DialogBoxIndirectParam,HANDLE,a,HANDLE,b,HWND,c,FARPROC,d,LONG,e)
......@@ -982,3 +1056,5 @@ Fl(HWND,CreateWindowEx,DWORD,a,LPSTR,b,LPSTR,c,DWORD,d,int,e,int,f,int,g,int,h,H
Fl(int,SetDIBitsToDevice,HDC,a,WORD,b,WORD,c,WORD,d,WORD,e,WORD,f,WORD,g,WORD,h,WORD,i,LPSTR,j,LPBITMAPINFO,k,WORD,l)
Fm(int,StretchDIBits,HDC,a,WORD,b,WORD,c,WORD,d,WORD,e,WORD,f,WORD,g,WORD,h,WORD,i,LPSTR,j,LPBITMAPINFO,k,WORD,l,DWORD,m)
Fn(HFONT,CreateFont,int,a,int,b,int,c,int,d,int,e,BYTE,f,BYTE,g,BYTE,h,BYTE,i,BYTE,j,BYTE,k,BYTE,l,BYTE,m,LPSTR,n)
#endif /* WINDOWS_H */
/*
* X toolkit functions
*
* Copyright 1993 Alexandre Julliard
*/
static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <X11/Core.h>
#include <X11/Shell.h>
#include "message.h"
#include "callback.h"
#include "win.h"
Widget XT_topLevelWidget;
static XtAppContext app_context;
/***********************************************************************
* main
*/
void main(int argc, char **argv)
{
XT_topLevelWidget = XtVaAppInitialize(&app_context,
"XWine", /* Application class */
NULL, 0, /* Option list */
&argc, argv, /* Command line args */
NULL, /* Fallback resources */
NULL );
_WinMain( argc, argv );
}
/***********************************************************************
* GetMessage (USER.108)
*/
BOOL GetMessage( LPMSG msg, HWND hwnd, WORD first, WORD last )
{
XEvent event;
while(1)
{
if (PeekMessage( msg, hwnd, first, last, PM_REMOVE )) break;
XtAppNextEvent( app_context, &event );
XtDispatchEvent( &event );
}
return (msg->message != WM_QUIT);
}
/***********************************************************************
* DefWindowProc (USER.107)
*/
LONG DefWindowProc( HWND hwnd, WORD msg, WORD wParam, LONG lParam )
{
PAINTSTRUCT paintstruct;
printf( "DefWindowProc: %d %d %d %d\n", hwnd, msg, wParam, lParam );
switch(msg)
{
case WM_PAINT:
BeginPaint( hwnd, &paintstruct );
EndPaint( hwnd, &paintstruct );
return 0;
case WM_CREATE:
return 0;
}
return 0;
}
/********************************************************************
*
* Miscellaneous partially implemented functions.
*
*/
HDC BeginPaint( HWND hwnd, LPPAINTSTRUCT lps )
{
return hwnd;
}
void EndPaint( HWND hwnd, LPPAINTSTRUCT lps )
{
MSG_EndPaint();
}
int DrawText( HDC hdc, LPSTR str, int count, LPRECT rect, WORD flags )
{
WND * wndPtr = WIN_FindWndPtr( hdc );
int x = rect->left, y = rect->top;
if (flags & DT_CENTER) x = (rect->left + rect->right) / 2;
if (flags & DT_VCENTER) y = (rect->top + rect->bottom) / 2;
if (count == -1) count = strlen(str);
printf( "DrawText: %d,%d '%s'\n", x, y, str );
if (wndPtr)
{
XDrawString( XtDisplay(wndPtr->winWidget),
XtWindow(wndPtr->winWidget),
DefaultGCOfScreen(XtScreen(wndPtr->winWidget)),
x, y, str, count );
GlobalUnlock( hdc );
}
}
int MessageBox( HWND hwnd, LPSTR str, LPSTR title, WORD type )
{
printf( "MessageBox: '%s'\n", str );
}
void MessageBeep( WORD i )
{
printf( "MessageBeep: %d\n", i );
}
HDC GetDC( HWND hwnd ) { }
HMENU CreateMenu() { }
HMENU GetMenu( HWND hwnd ) { }
BOOL SetMenu( HWND hwnd, HMENU hmenu ) { }
BOOL AppendMenu( HMENU hmenu, WORD flags, WORD id, LPSTR text ) { }
BOOL Rectangle( HDC hdc, int left, int top, int right, int bottom ) { }
HANDLE GetStockObject( int obj ) { }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment