Skip to content
Snippets Groups Projects
Commit cdd09237 authored by Alexandre Julliard's avatar Alexandre Julliard
Browse files

Release 0.6

Tue Jan  4 13:01:33 1994  David Metcalfe <david@prism.demon.co.uk>

        * [window/caret.c]
        Modified code to use system timer.

Jan 9, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte)

	* [windows/win.c]
	Windows create if required new XLIB MenuBar & CaptionBar.

	* [windows/defwnd.c]
	WM_CALCSIZE Move & Resize caption, menubar & scrollbars.
	(I'm not sure it's the good place for it, but it work...)

	* [loader/resource.c]
	optimize in FindResourceByNumber, make lseek() if next type ...

	* [controls/scroll.c]
	scrollbar buttons are now using system resources bitmaps.

	* [controls/caption.c] - new file ...
	captionbar showing title, close button with SysMenu,
	and other buttons using system resources bitmaps.

	* [controls/menu.c]
	New functions: SetMenuItemBitmaps() with 'glues',
	Make new version of LoadMenu() & ParseMenu(),
	( put #define USE_POPUPMENU ).
	Implementation of MenuBar functions.
	
	* [sysres.dll]
	New bitmaps for system such OBM_CLOSE, OBM_MINIMIZE, OBM_UPARROWI.
	New SYSMENU menu, it don't work yet ! :-((

Tue Jan 11 05:27:45 1994  julliard@di.epfl.ch (Alexandre Julliard

	* [memory/atom.c]
	Fixed a bug that could cause atoms to be case-sensitive.

	* [misc/rect.c]
	Bug fix in SubtractRect().

	* [objects/clipping.c]
	Bug fix when setting the clip mask to an empty region.

	* [windows/dce.c]
	Bug fix in ReleaseDC().

	* [windows/dialog.c]
	Call AdjustWindowRectEx() before creating the dialog window.
	Added support for DS_MODALFRAME style.

	* [windows/event.c]
	Cleaned up event handling and removed old Xt stuff.
	Moved double-click handling to windows/message.c

	* [windows/focus.c]
	Bug fix: only set the X focus when the window is viewable.

	* [windows/graphics.c]
	Rewritten DrawReliefRect() to use brush instead of pen, and
	to use the system colors.

	* [windows/message.c]
	Implemented WM_NCHITTEST message sending, and non-client
	mouse messages.
	Cleaned up double-click handling, and removed the Xt code.

	* [windows/nonclient.c]  (New file)
	Implemented AdjustWindowRect().
	Implemented WM_NCCALCSIZE, WM_NCHITTEST and WM_NCPAINT handling.

	* [windows/painting.c]
	Added sending of the WM_NCPAINT message in BeginPaint().

	* [windows/sysmetrics.c] [include/sysmetrics.h]  (New files)
	Implemented system metrics.

	* [windows/win.c]
	Bug fix in setting the parent and owner in CreateWindow().
	Removed the Xt code.

	* [windows/winpos.c]
	Added sending of the WM_NCPAINT message in SetWindowPos().
	Removed the Xt code.
parent 5f721f81
No related branches found
No related tags found
No related merge requests found
Tue Jan 4 13:01:33 1994 David Metcalfe <david@prism.demon.co.uk>
* [window/caret.c]
Modified code to use system timer.
Jan 9, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte)
* [windows/win.c]
Windows create if required new XLIB MenuBar & CaptionBar.
* [windows/defwnd.c]
WM_CALCSIZE Move & Resize caption, menubar & scrollbars.
(I'm not sure it's the good place for it, but it work...)
* [loader/resource.c]
optimize in FindResourceByNumber, make lseek() if next type ...
* [controls/scroll.c]
scrollbar buttons are now using system resources bitmaps.
* [controls/caption.c] - new file ...
captionbar showing title, close button with SysMenu,
and other buttons using system resources bitmaps.
* [controls/menu.c]
New functions: SetMenuItemBitmaps() with 'glues',
Make new version of LoadMenu() & ParseMenu(),
( put #define USE_POPUPMENU ).
Implementation of MenuBar functions.
* [sysres.dll]
New bitmaps for system such OBM_CLOSE, OBM_MINIMIZE, OBM_UPARROWI.
New SYSMENU menu, it don't work yet ! :-((
Tue Jan 11 05:27:45 1994 julliard@di.epfl.ch (Alexandre Julliard
* [memory/atom.c]
Fixed a bug that could cause atoms to be case-sensitive.
* [misc/rect.c]
Bug fix in SubtractRect().
* [objects/clipping.c]
Bug fix when setting the clip mask to an empty region.
* [windows/dce.c]
Bug fix in ReleaseDC().
* [windows/dialog.c]
Call AdjustWindowRectEx() before creating the dialog window.
Added support for DS_MODALFRAME style.
* [windows/event.c]
Cleaned up event handling and removed old Xt stuff.
Moved double-click handling to windows/message.c
* [windows/focus.c]
Bug fix: only set the X focus when the window is viewable.
* [windows/graphics.c]
Rewritten DrawReliefRect() to use brush instead of pen, and
to use the system colors.
* [windows/message.c]
Implemented WM_NCHITTEST message sending, and non-client
mouse messages.
Cleaned up double-click handling, and removed the Xt code.
* [windows/nonclient.c] (New file)
Implemented AdjustWindowRect().
Implemented WM_NCCALCSIZE, WM_NCHITTEST and WM_NCPAINT handling.
* [windows/painting.c]
Added sending of the WM_NCPAINT message in BeginPaint().
* [windows/sysmetrics.c] [include/sysmetrics.h] (New files)
Implemented system metrics.
* [windows/win.c]
Bug fix in setting the parent and owner in CreateWindow().
Removed the Xt code.
* [windows/winpos.c]
Added sending of the WM_NCPAINT message in SetWindowPos().
Removed the Xt code.
----------------------------------------------------------------------
Sun Jan 2 12:38:53 1994 David Metcalfe <david@prism.demon.co.uk>
* [windows/class.c]
......@@ -101,7 +188,6 @@ Sat Jan 1 10:22:43 1994 Bob Amstadt (bob@pooh)
* loader/wine.c: Added support for relocation types 5 and 6.
----------------------------------------------------------------------
Mon Dec 27 11:06:03 1993 Erik Bos (erik@trashcan.hacktic.nl)
* [misc/comm.c]
......
######################################################################
# These variables are inherited by the sub-makefiles
DEBUGOPTS=-DUSE_XLIB
DEBUGOPTS=
COPTS=-O2 -m486
INCLUDE_DIR=include
LDFLAGS=
......
......@@ -41,6 +41,14 @@ For example: to run Windows' solitaire:
Have a nice game of solitaire, but be careful. Emulation isn't perfect.
So, occassionally it will crash.
WHAT'S NEW with version 0.6: (see ChangeLog for details)
- Working towards elimination of Xt-dependent code. Thanks to
Alexandre and Martin.
- Other bug fixes.
- I added a rudimentary spy facility which can be turned
on from the wine.ini file. See the sample wine.ini
for details
WHAT'S NEW with version 0.5: (see ChangeLog for details)
- Working towards elimination of Xt-dependent code.
- StretchBlt()
......
CFLAGS=$(COPTS) $(DEBUGOPTS) -I$(INCLUDE_DIR)
OBJS=menu.o widgets.o button.o scroll.o listbox.o combo.o static.o \
OBJS = menu.o caption.o widgets.o button.o \
scroll.o listbox.o combo.o static.o \
SmeMenuButto.o WinLabel.o WinCommand.o \
WinMenuButto.o
......
/*
* Interface code to CAPTION widget
*
* Copyright Martin Ayotte, 1994
*
*/
/*
#define DEBUG_CAPTION
*/
static char Copyright[] = "Copyright Martin Ayotte, 1994";
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include "windows.h"
#include "caption.h"
#include "heap.h"
#include "win.h"
#include <sys/types.h>
#include <dirent.h>
#include <sys/stat.h>
HBITMAP hStdClose = (HBITMAP)NULL;
HBITMAP hStdCloseD = (HBITMAP)NULL;
HBITMAP hStdMinim = (HBITMAP)NULL;
HBITMAP hStdMinimD = (HBITMAP)NULL;
HBITMAP hStdMaxim = (HBITMAP)NULL;
HBITMAP hStdMaximD = (HBITMAP)NULL;
HMENU hStdSysMenu = (HMENU)NULL;
LPHEADCAPTION CaptionBarGetWindowAndStorage(HWND hWnd, WND **wndPtr);
LPHEADCAPTION CaptionBarGetStorageHeader(HWND hWnd);
void SetMenuLogicalParent(HMENU hMenu, HWND hWnd);
/***********************************************************************
* CaptionBarWndProc
*/
LONG CaptionBarWndProc( HWND hWnd, WORD message, WORD wParam, LONG lParam )
{
WORD wRet;
short x, y;
short width, height;
WND *wndPtr;
LPHEADCAPTION lphs;
PAINTSTRUCT ps;
HDC hDC;
HDC hMemDC;
BITMAP bm;
RECT rect;
char str[128];
switch(message)
{
case WM_CREATE:
wndPtr = WIN_FindWndPtr(hWnd);
lphs = (LPHEADCAPTION)malloc(sizeof(HEADCAPTION));
if (lphs == 0) {
printf("Bad Memory Alloc on CAPTIONBAR !\n");
return 0;
}
memset(lphs, 0, sizeof(HEADCAPTION));
#ifdef DEBUG_CAPTION
printf("CreateCaptionBarStruct %lX !\n", lphs);
#endif
*((LPHEADCAPTION *)&wndPtr->wExtra[1]) = lphs;
if (hStdClose == (HBITMAP)NULL)
hStdClose = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_CLOSE));
lphs->hClose = hStdClose;
if (hStdMinim == (HBITMAP)NULL)
hStdMinim = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_REDUCE));
lphs->hMinim = hStdMinim;
if (hStdMaxim == (HBITMAP)NULL)
hStdMaxim = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_RESTORE));
lphs->hMaxim = hStdMaxim;
if (hStdCloseD == (HBITMAP)NULL)
hStdCloseD = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_CLOSE));
if (hStdMinimD == (HBITMAP)NULL)
hStdMinimD = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_REDUCED));
if (hStdMaximD == (HBITMAP)NULL)
hStdMaximD = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_RESTORED));
if (hStdSysMenu == (HBITMAP)NULL)
hStdSysMenu = LoadMenu((HINSTANCE)NULL, "SYSMENU");
lphs->hSysMenu = hStdSysMenu;
printf("CaptionBar SYSMENU %04X !\n", lphs->hSysMenu);
if (lphs->hSysMenu == 0) lphs->hSysMenu = CreatePopupMenu();
AppendMenu(lphs->hSysMenu, MF_STRING, 9999, "About &Wine ...");
GetClientRect(hWnd, &rect);
CopyRect(&lphs->rectClose, &rect);
CopyRect(&lphs->rectMaxim, &rect);
lphs->rectClose.right = lphs->rectClose.left +
lphs->rectClose.bottom + lphs->rectClose.top;
lphs->rectMaxim.left = lphs->rectMaxim.right -
lphs->rectMaxim.bottom + lphs->rectMaxim.top;
CopyRect(&lphs->rectMinim, &lphs->rectMaxim);
if (lphs->hMaxim != 0) {
lphs->rectMinim.left = lphs->rectMaxim.bottom + lphs->rectMaxim.top;
lphs->rectMinim.right = lphs->rectMaxim.bottom + lphs->rectMaxim.top;
}
if (lphs->hClose == 0) lphs->rectClose.right = lphs->rectClose.left;
printf("CAPTION Close.right=%d Maxim.left=%d Minim.left=%d !\n",
lphs->rectClose.right, lphs->rectMaxim.left, lphs->rectMinim.left);
return 0;
case WM_DESTROY:
lphs = CaptionBarGetWindowAndStorage(hWnd, &wndPtr);
if (lphs == 0) return 0;
#ifdef DEBUG_CAPTION
printf("CaptionBar WM_DESTROY %lX !\n", lphs);
#endif
DestroyMenu(lphs->hSysMenu);
free(lphs);
*((LPHEADCAPTION *)&wndPtr->wExtra[1]) = 0;
return 0;
case WM_COMMAND:
#ifdef DEBUG_CAPTION
printf("CaptionBar WM_COMMAND %04X %08X !\n", wParam, lParam);
#endif
lphs = CaptionBarGetWindowAndStorage(hWnd, &wndPtr);
if (wParam == 9999) {
printf("CaptionBar Show 'About Wine ...' !\n");
}
SendMessage(wndPtr->hwndParent, message, wParam, lParam);
break;
case WM_SIZE:
lphs = CaptionBarGetWindowAndStorage(hWnd, &wndPtr);
width = LOWORD(lParam);
height = HIWORD(lParam);
if (lphs->hClose != 0)
SetRect(&lphs->rectClose, 0, 0, height, height);
if (lphs->hMinim != 0) {
if (lphs->hMaxim != 0)
SetRect(&lphs->rectMinim, width - 2 * height, 0,
width - height, height);
else
SetRect(&lphs->rectMinim, width - height, 0, width, height);
}
if (lphs->hMaxim != 0)
SetRect(&lphs->rectMaxim, width - height, 0, width, height);
break;
case WM_LBUTTONDOWN:
lphs = CaptionBarGetWindowAndStorage(hWnd, &wndPtr);
SetCapture(hWnd);
x = LOWORD(lParam);
y = HIWORD(lParam);
hDC = GetDC(hWnd);
if (x > lphs->rectClose.left && x < lphs->rectClose.right) {
lphs->hClose = hStdCloseD;
InvalidateRect(hWnd, &lphs->rectClose, TRUE);
UpdateWindow(hWnd);
}
if (x > lphs->rectMinim.left && x < lphs->rectMinim.right) {
lphs->hMinim = hStdMinimD;
InvalidateRect(hWnd, &lphs->rectMinim, TRUE);
UpdateWindow(hWnd);
}
if (x > lphs->rectMaxim.left && x < lphs->rectMaxim.right &&
lphs->hMaxim != 0) {
lphs->hMaxim = hStdMaximD;
InvalidateRect(hWnd, &lphs->rectMaxim, TRUE);
UpdateWindow(hWnd);
}
ReleaseDC(hWnd, hDC);
break;
case WM_LBUTTONUP:
lphs = CaptionBarGetWindowAndStorage(hWnd, &wndPtr);
ReleaseCapture();
#ifdef DEBUG_CAPTION
printf("CaptionBar WM_LBUTTONUP %lX !\n", lParam);
#endif
x = LOWORD(lParam);
y = HIWORD(lParam);
if (x > lphs->rectClose.left && x < lphs->rectClose.right) {
lphs->hClose = hStdClose;
InvalidateRect(hWnd, &lphs->rectClose, TRUE);
UpdateWindow(hWnd);
TrackPopupMenu(lphs->hSysMenu, TPM_LEFTBUTTON, 0, -20,
0, wndPtr->hwndParent, (LPRECT)NULL);
SetMenuLogicalParent(lphs->hSysMenu, hWnd);
printf("CAPTION Pop the SYSMENU !\n");
break;
}
if (x > lphs->rectMinim.left && x < lphs->rectMinim.right) {
SendMessage(wndPtr->hwndParent, WM_SYSCOMMAND, SC_MINIMIZE, 0L);
lphs->hMinim = hStdMinim;
InvalidateRect(hWnd, &lphs->rectMinim, TRUE);
UpdateWindow(hWnd);
printf("CAPTION Minimize Window !\n");
break;
}
if (x > lphs->rectMaxim.left && x < lphs->rectMaxim.right) {
lphs->hMaxim = hStdMaxim;
InvalidateRect(hWnd, &lphs->rectMaxim, TRUE);
UpdateWindow(hWnd);
SendMessage(wndPtr->hwndParent, WM_SYSCOMMAND, SC_MAXIMIZE, 0L);
printf("CAPTION Maximize Window !\n");
break;
}
break;
case WM_LBUTTONDBLCLK:
lphs = CaptionBarGetWindowAndStorage(hWnd, &wndPtr);
#ifdef DEBUG_CAPTION
printf("CaptionBar WM_LBUTTONDBLCLK %lX !\n", lParam);
#endif
x = LOWORD(lParam);
y = HIWORD(lParam);
if (x > lphs->rectClose.left && x < lphs->rectClose.right) {
SendMessage(wndPtr->hwndParent, WM_SYSCOMMAND, SC_CLOSE, 0L);
printf("CAPTION DoubleClick Close Window !\n");
break;
}
break;
case WM_KEYDOWN:
case WM_KEYUP:
case WM_CHAR:
lphs = CaptionBarGetWindowAndStorage(hWnd, &wndPtr);
return(SendMessage(wndPtr->hwndParent, message, wParam, lParam));
case WM_PAINT:
GetWindowRect(hWnd, &rect);
#ifdef DEBUG_CAPTION
printf("CaptionBar WM_PAINT left=%d top=%d right=%d bottom=%d !\n",
rect.left, rect.top, rect.right, rect.bottom);
#endif
lphs = CaptionBarGetWindowAndStorage(hWnd, &wndPtr);
hDC = BeginPaint(hWnd, &ps);
hMemDC = CreateCompatibleDC(hDC);
if (lphs->hClose != 0) {
GetObject(lphs->hClose, sizeof(BITMAP), (LPSTR)&bm);
SelectObject(hMemDC, lphs->hClose);
BitBlt(hDC, 0, 0, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
}
if (lphs->hMinim != 0) {
GetObject(lphs->hMinim, sizeof(BITMAP), (LPSTR)&bm);
SelectObject(hMemDC, lphs->hMinim);
BitBlt(hDC, lphs->rectMinim.left, 0, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
}
if (lphs->hMaxim != 0) {
GetObject(lphs->hMaxim, sizeof(BITMAP), (LPSTR)&bm);
SelectObject(hMemDC, lphs->hMaxim);
BitBlt(hDC, lphs->rectMaxim.left, 0, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
}
DeleteDC(hMemDC);
GetClientRect(hWnd, &rect);
FrameRect(hDC, &rect, GetStockObject(BLACK_BRUSH));
rect.left = lphs->rectClose.right;
rect.right = lphs->rectMinim.left;
#ifdef DEBUG_CAPTION
printf("CaptionBar WM_PAINT left=%d top=%d right=%d bottom=%d !\n",
rect.left, rect.top, rect.right, rect.bottom);
#endif
FillRect(hDC, &rect, GetStockObject(GRAY_BRUSH));
if (GetWindowTextLength(wndPtr->hwndParent) > 0) {
GetWindowText(wndPtr->hwndParent, str, sizeof(str));
width = GetTextExtent(hDC, str, strlen(str));
DrawText(hDC, str, -1, &rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
}
EndPaint(hWnd, &ps);
break;
default:
return DefWindowProc( hWnd, message, wParam, lParam );
}
return(0);
}
LPHEADCAPTION CaptionBarGetWindowAndStorage(HWND hWnd, WND **wndPtr)
{
WND *Ptr;
LPHEADCAPTION lphs;
*(wndPtr) = Ptr = WIN_FindWndPtr(hWnd);
if (Ptr == 0) {
printf("Bad Window handle on CaptionBar !\n");
return 0;
}
lphs = *((LPHEADCAPTION *)&Ptr->wExtra[1]);
return lphs;
}
LPHEADCAPTION CaptionBarGetStorageHeader(HWND hWnd)
{
WND *wndPtr;
LPHEADCAPTION lphs;
wndPtr = WIN_FindWndPtr(hWnd);
if (wndPtr == 0) {
printf("Bad Window handle on CaptionBar !\n");
return 0;
}
lphs = *((LPHEADCAPTION *)&wndPtr->wExtra[1]);
return lphs;
}
This diff is collapsed.
......@@ -21,6 +21,15 @@ static char Copyright[] = "Copyright Martin Ayotte, 1993";
#include <dirent.h>
#include <sys/stat.h>
HBITMAP hUpArrow = 0;
HBITMAP hDnArrow = 0;
HBITMAP hLfArrow = 0;
HBITMAP hRgArrow = 0;
HBITMAP hUpArrowD = 0;
HBITMAP hDnArrowD = 0;
HBITMAP hLfArrowD = 0;
HBITMAP hRgArrowD = 0;
LPHEADSCROLL ScrollBarGetWindowAndStorage(HWND hwnd, WND **wndPtr);
LPHEADSCROLL ScrollBarGetStorageHeader(HWND hwnd);
void StdDrawScrollBar(HWND hwnd);
......@@ -34,9 +43,13 @@ LONG ScrollBarWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
{
WORD wRet;
short x, y;
short width, height;
WND *wndPtr;
LPHEADSCROLL lphs;
RECT rect;
LPDRAWITEMSTRUCT lpdis;
HDC hMemDC;
BITMAP bm;
RECT rect;
static RECT rectsel;
switch(message)
{
......@@ -45,6 +58,22 @@ LONG ScrollBarWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
#ifdef DEBUG_SCROLL
printf("ScrollBar Creation up=%X down=%X!\n", lphs->hWndUp, lphs->hWndDown);
#endif
if (hUpArrow == (HBITMAP)NULL)
hUpArrow = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_UPARROWI));
if (hDnArrow == (HBITMAP)NULL)
hDnArrow = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_DNARROWI));
if (hLfArrow == (HBITMAP)NULL)
hLfArrow = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_LFARROWI));
if (hRgArrow == (HBITMAP)NULL)
hRgArrow = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_RGARROWI));
if (hUpArrowD == (HBITMAP)NULL)
hUpArrowD = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_UPARROWD));
if (hDnArrowD == (HBITMAP)NULL)
hDnArrowD = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_DNARROWD));
if (hLfArrowD == (HBITMAP)NULL)
hLfArrowD = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_LFARROWD));
if (hRgArrowD == (HBITMAP)NULL)
hRgArrowD = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_RGARROWD));
return 0;
case WM_DESTROY:
lphs = ScrollBarGetWindowAndStorage(hwnd, &wndPtr);
......@@ -129,15 +158,6 @@ LONG ScrollBarWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
ReleaseCapture();
break;
case WM_KEYDOWN:
case WM_KEYUP:
case WM_CHAR:
lphs = ScrollBarGetWindowAndStorage(hwnd, &wndPtr);
return(SendMessage(wndPtr->hwndParent, message, wParam, lParam));
case WM_PAINT:
StdDrawScrollBar(hwnd);
break;
case WM_MOUSEMOVE:
if ((wParam & MK_LBUTTON) != 0) {
lphs = ScrollBarGetWindowAndStorage(hwnd, &wndPtr);
......@@ -150,12 +170,88 @@ LONG ScrollBarWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
x = (y * (lphs->MaxVal - lphs->MinVal) /
lphs->MaxPix) + lphs->MinVal;
#ifdef DEBUG_SCROLL
printf("WM_MOUSEMOVE val=%d pix=%d\n", x, y);
printf("Scroll WM_MOUSEMOVE val=%d pix=%d\n", x, y);
#endif
SendMessage(wndPtr->hwndParent, lphs->Direction,
SB_THUMBTRACK, MAKELONG(x, hwnd));
}
break;
case WM_KEYDOWN:
case WM_KEYUP:
case WM_CHAR:
lphs = ScrollBarGetWindowAndStorage(hwnd, &wndPtr);
return(SendMessage(wndPtr->hwndParent, message, wParam, lParam));
case WM_SIZE:
lphs = ScrollBarGetWindowAndStorage(hwnd, &wndPtr);
width = LOWORD(lParam);
height = HIWORD(lParam);
if (lphs->Direction == WM_VSCROLL) {
MoveWindow(lphs->hWndUp, 0, 0, width, width, TRUE);
MoveWindow(lphs->hWndDown, 0, height - width, width, width, TRUE);
}
else {
MoveWindow(lphs->hWndUp, 0, 0, height, height, TRUE);
MoveWindow(lphs->hWndDown, width - height, 0, height, height, TRUE);
}
break;
case WM_DRAWITEM:
#ifdef DEBUG_SCROLL
printf("Scroll WM_DRAWITEM w=%04X l=%08X\n", wParam, lParam);
#endif
lpdis = (LPDRAWITEMSTRUCT)lParam;
if (lpdis->CtlType == ODT_BUTTON && lpdis->itemAction == ODA_DRAWENTIRE) {
hMemDC = CreateCompatibleDC(lpdis->hDC);
if (lpdis->CtlID == 1) {
GetObject(hUpArrow, sizeof(BITMAP), (LPSTR)&bm);
SelectObject(hMemDC, hUpArrow);
BitBlt(lpdis->hDC, 0, 0, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
}
if (lpdis->CtlID == 2) {
GetObject(hDnArrow, sizeof(BITMAP), (LPSTR)&bm);
SelectObject(hMemDC, hDnArrow);
BitBlt(lpdis->hDC, 0, 0, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
}
if (lpdis->CtlID == 3) {
GetObject(hLfArrow, sizeof(BITMAP), (LPSTR)&bm);
SelectObject(hMemDC, hLfArrow);
BitBlt(lpdis->hDC, 0, 0, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
}
if (lpdis->CtlID == 4) {
GetObject(hRgArrow, sizeof(BITMAP), (LPSTR)&bm);
SelectObject(hMemDC, hRgArrow);
BitBlt(lpdis->hDC, 0, 0, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
}
DeleteDC(hMemDC);
}
if (lpdis->CtlType == ODT_BUTTON && lpdis->itemAction == ODA_SELECT) {
hMemDC = CreateCompatibleDC(lpdis->hDC);
if (lpdis->CtlID == 1) {
GetObject(hUpArrowD, sizeof(BITMAP), (LPSTR)&bm);
SelectObject(hMemDC, hUpArrowD);
BitBlt(lpdis->hDC, 0, 0, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
}
if (lpdis->CtlID == 2) {
GetObject(hDnArrowD, sizeof(BITMAP), (LPSTR)&bm);
SelectObject(hMemDC, hDnArrowD);
BitBlt(lpdis->hDC, 0, 0, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
}
if (lpdis->CtlID == 3) {
GetObject(hLfArrowD, sizeof(BITMAP), (LPSTR)&bm);
SelectObject(hMemDC, hLfArrowD);
BitBlt(lpdis->hDC, 0, 0, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
}
if (lpdis->CtlID == 4) {
GetObject(hRgArrowD, sizeof(BITMAP), (LPSTR)&bm);
SelectObject(hMemDC, hRgArrowD);
BitBlt(lpdis->hDC, 0, 0, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
}
DeleteDC(hMemDC);
}
break;
case WM_PAINT:
StdDrawScrollBar(hwnd);
break;
default:
return DefWindowProc( hwnd, message, wParam, lParam );
}
......@@ -274,10 +370,10 @@ int CreateScrollBarStruct(HWND hwnd)
lphs->MaxPix = height - 3 * width;
lphs->Direction = WM_VSCROLL;
lphs->hWndUp = CreateWindow("BUTTON", "",
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,
0, 0, width, width, hwnd, 1, wndPtr->hInstance, 0L);
lphs->hWndDown = CreateWindow("BUTTON", "",
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,
0, height - width, width, width, hwnd, 2,
wndPtr->hInstance, 0L);
}
......@@ -286,11 +382,11 @@ int CreateScrollBarStruct(HWND hwnd)
lphs->MaxPix = width - 3 * height;
lphs->Direction = WM_HSCROLL;
lphs->hWndUp = CreateWindow("BUTTON", "",
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
0, 0, height, height, hwnd, 0, wndPtr->hInstance, 0L);
WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,
0, 0, height, height, hwnd, 3, wndPtr->hInstance, 0L);
lphs->hWndDown = CreateWindow("BUTTON", "",
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
width - height, 0, height, height, hwnd, 0,
WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,
width - height, 0, height, height, hwnd, 4,
wndPtr->hInstance, 0L);
}
if (lphs->MaxPix < 1) lphs->MaxPix = 1;
......
......@@ -17,6 +17,7 @@ LONG ScrollBarWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam );
LONG ListBoxWndProc ( HWND hwnd, WORD message, WORD wParam, LONG lParam );
LONG ComboBoxWndProc ( HWND hwnd, WORD message, WORD wParam, LONG lParam );
LONG PopupMenuWndProc ( HWND hwnd, WORD message, WORD wParam, LONG lParam );
LONG CaptionBarWndProc ( HWND hwnd, WORD message, WORD wParam, LONG lParam );
static WNDCLASS WIDGETS_BuiltinClasses[] =
......@@ -33,6 +34,8 @@ static WNDCLASS WIDGETS_BuiltinClasses[] =
0, 0, 0, 0, NULL, "COMBOBOX" },
{ CS_GLOBALCLASS, (LONG(*)())PopupMenuWndProc, 0, 8,
0, 0, 0, 0, NULL, "POPUPMENU" },
{ CS_GLOBALCLASS, (LONG(*)())CaptionBarWndProc, 0, 8,
0, 0, 0, 0, NULL, "CAPTION" },
{ CS_GLOBALCLASS, (LONG(*)())DefDlgProc, 0, DLGWINDOWEXTRA,
0, 0, 0, 0, NULL, DIALOG_CLASS_NAME }
};
......
......@@ -172,7 +172,7 @@ void examine_memory(int addr, int count, char format){
pnt = (char *) addr;
for(i=0; i<count; i++)
{
fprintf(stderr," %w", *pnt++);
fprintf(stderr," %02.2x", (*pnt++) & 0xff);
if ((i % 32) == 7) {
fprintf(stderr,"\n");
print_address((unsigned int) pnt, stderr);
......
......@@ -19,6 +19,8 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include "prototypes.h"
#include "dlls.h"
/* #define DEBUG_RELAY */
#define N_BUILTINS 8
struct dll_name_table_entry_s dll_builtin_table[N_BUILTINS] =
......@@ -99,14 +101,6 @@ DLLRelay(unsigned int func_num, unsigned int seg_off)
IF1632_Saved16_esp, IF1632_Saved16_ebp,
IF1632_Saved16_ss);
if (strcmp("GetMessage", dll_p->export_name) == 0 &&
seg_off == 0x00972526 &&
*ret_addr == 0x004700cd &&
IF1632_Saved16_esp == 0x2526 &&
IF1632_Saved16_ebp == 0x2534 &&
IF1632_Saved16_ss == 0x0097)
printf("ACK!!\n");
#ifdef DEBUG_STACK
stack_p = (unsigned short *) seg_off;
for (i = 0; i < 24; i++, stack_p++)
......
......@@ -120,6 +120,7 @@ length 540
155 pascal EnableMenuItem(word word word) EnableMenuItem(1 2 3)
157 pascal GetMenu(word) GetMenu(1)
158 pascal SetMenu(word word) SetMenu(1 2)
160 pascal DrawMenuBar(word) DrawMenuBar(1)
163 pascal CreateCaret(word word word word) CreateCaret(1 2 3 4)
164 pascal DestroyCaret() DestroyCaret()
165 pascal SetCaretPos(word word) SetCaretPos(1 2)
......@@ -206,6 +207,8 @@ length 540
415 pascal CreatePopupMenu() CreatePopupMenu()
416 pascal TrackPopupMenu(word word word word word word ptr)
TrackPopupMenu(1 2 3 4 5 6 7)
418 pascal SetMenuItemBitmaps(word word word word word)
SetMenuItemBitmaps(1 2 3 4 5)
420 pascal wsprintf(ptr ptr) wsprintf(1 2)
421 pascal wvsprintf(ptr ptr ptr) wvsprintf(1 2 3)
430 pascal lstrcmp(ptr ptr) lstrcmp(1 2)
......@@ -220,6 +223,7 @@ length 540
452 pascal CreateWindowEx(long ptr ptr long s_word s_word s_word s_word
word word word ptr)
CreateWindowEx(1 2 3 4 5 6 7 8 9 10 11 12)
454 pascal AdjustWindowRectEx(ptr long word long) AdjustWindowRectEx(1 2 3 4)
457 pascal DestroyIcon(word) DestroyIcon(1)
458 pascal DestroyCursor(word) DestroyCursor(1)
471 pascal lstrcmpi(ptr ptr) lstrcmpi(1 2)
......
/*
* Caption Bar definitions
*/
typedef struct tagHEADCAPTION {
HBITMAP hClose;
HBITMAP hMinim;
HBITMAP hMaxim;
HMENU hSysMenu;
RECT rectClose;
RECT rectMinim;
RECT rectMaxim;
} HEADCAPTION;
typedef HEADCAPTION FAR* LPHEADCAPTION;
......@@ -282,7 +282,10 @@ extern HANDLE GDI_AllocObject( WORD, WORD );
extern BOOL GDI_FreeObject( HANDLE );
extern GDIOBJHDR * GDI_GetObjPtr( HANDLE, WORD );
extern Display * XT_display;
extern Screen * XT_screen;
extern Display * XT_display; /* Will be removed */
extern Screen * XT_screen; /* Will be removed */
extern Display * display;
extern Screen * screen;
#endif /* GDI_H */
......@@ -13,7 +13,6 @@
#include <X11/Xaw/Command.h>
#include <X11/Xaw/Box.h>
#include "windows.h"
typedef struct tagMENUITEM
{
......@@ -23,7 +22,9 @@ typedef struct tagMENUITEM
struct tagMENUITEM *parent;
WORD item_flags;
WORD item_id;
char *item_text;
WORD sel_key;
char *shortcut;
char *item_text;
Widget w;
Widget menu_w;
char menu_name[10];
......@@ -46,11 +47,15 @@ typedef struct tagMENUBAR
typedef struct tagPOPUPMENU
{
HWND hWnd; /* PopupMenu window handle */
HWND hWndParent; /* Parent opupMenu window handle */
HWND ownerWnd; /* Owner window */
WORD nItems; /* Number of items on menu */
MENUITEM *firstItem;
WORD FocusedItem;
WORD MouseFlags;
WORD BarFlags;
WORD Width;
WORD Height;
} POPUPMENU, *LPPOPUPMENU;
typedef struct
......
/*
* System metrics definitions
*
* Copyright 1994 Alexandre Julliard
*/
#ifndef SYSMETRICS_H
#define SYSMETRICS_H
#include "windows.h"
/* Constant system metrics */
#define SYSMETRICS_CXVSCROLL 16
#define SYSMETRICS_CYHSCROLL 16
#define SYSMETRICS_CYCAPTION 20
#define SYSMETRICS_CXBORDER 1
#define SYSMETRICS_CYBORDER 1
#define SYSMETRICS_CXDLGFRAME 4
#define SYSMETRICS_CYDLGFRAME 4
#define SYSMETRICS_CYVTHUMB 16
#define SYSMETRICS_CXHTHUMB 16
#define SYSMETRICS_CXICON 32
#define SYSMETRICS_CYICON 32
#define SYSMETRICS_CXCURSOR 32
#define SYSMETRICS_CYCURSOR 32
#define SYSMETRICS_CYMENU 18
#define SYSMETRICS_CYVSCROLL 16
#define SYSMETRICS_CXHSCROLL 16
#define SYSMETRICS_CXMIN 100
#define SYSMETRICS_CYMIN 28
#define SYSMETRICS_CXSIZE 18
#define SYSMETRICS_CYSIZE 18
#define SYSMETRICS_CXMINTRACK 100
#define SYSMETRICS_CYMINTRACK 28
#define SYSMETRICS_CXICONSPACING 20
#define SYSMETRICS_CYICONSPACING 20
/* Some non-constant system metrics */
#define SYSMETRICS_CXSCREEN sysMetrics[SM_CXSCREEN]
#define SYSMETRICS_CYSCREEN sysMetrics[SM_CYSCREEN]
#define SYSMETRICS_CXFULLSCREEN sysMetrics[SM_CXFULLSCREEN]
#define SYSMETRICS_CYFULLSCREEN sysMetrics[SM_CYFULLSCREEN]
#define SYSMETRICS_SWAPBUTTON sysMetrics[SM_SWAPBUTTON]
#define SYSMETRICS_CXFRAME sysMetrics[SM_CXFRAME]
#define SYSMETRICS_CYFRAME sysMetrics[SM_CYFRAME]
#define SYSMETRICS_CXDOUBLECLK sysMetrics[SM_CXDOUBLECLK]
#define SYSMETRICS_CYDOUBLECLK sysMetrics[SM_CYDOUBLECLK]
#define SYSMETRICS_MENUDROPALIGNMENT sysMetrics[SM_MENUDROPALIGNMENT]
extern short sysMetrics[SM_CMETRICS];
#endif
......@@ -7,7 +7,7 @@
#ifndef WIN_H
#define WIN_H
#include <X11/Intrinsic.h>
#include <X11/Xlib.h>
#include "windows.h"
#include "menu.h"
......@@ -40,11 +40,10 @@ typedef struct tagWND
WORD wIDmenu; /* ID or hmenu (from CreateWindow) */
HANDLE hText; /* Handle of window text */
WORD flags; /* Misc. flags */
Widget shellWidget; /* For top-level windows */
Widget winWidget; /* For all windows */
Widget compositeWidget;/* For top-level windows */
Window window; /* X window */
LPMENUBAR menuBarPtr; /* Menu bar */
HWND hWndMenuBar; /* Menu bar */
HWND hWndCaption; /* Caption bar */
WORD wExtra[1]; /* Window extra bytes */
} WND;
......@@ -54,6 +53,7 @@ typedef struct tagWND
#define WIN_GOT_SIZEMSG 0x04 /* WM_SIZE has been sent to the window */
#define WIN_OWN_DC 0x08 /* Win class has style CS_OWNDC */
#define WIN_CLASS_DC 0x10 /* Win class has style CS_CLASSDC */
#define WIN_DOUBLE_CLICKS 0x20 /* Win class has style CS_DBLCLKS */
/* Window functions */
WND *WIN_FindWndPtr( HWND hwnd );
......
......@@ -238,6 +238,49 @@ typedef struct
#define WVR_REDRAW (WVR_HREDRAW | WVR_VREDRAW)
#define WVR_VALIDRECTS 0x0400
/* WM_NCHITTEST return codes */
#define HTERROR (-2)
#define HTTRANSPARENT (-1)
#define HTNOWHERE 0
#define HTCLIENT 1
#define HTCAPTION 2
#define HTSYSMENU 3
#define HTSIZE 4
#define HTMENU 5
#define HTHSCROLL 6
#define HTVSCROLL 7
#define HTMINBUTTON 8
#define HTMAXBUTTON 9
#define HTLEFT 10
#define HTRIGHT 11
#define HTTOP 12
#define HTTOPLEFT 13
#define HTTOPRIGHT 14
#define HTBOTTOM 15
#define HTBOTTOMLEFT 16
#define HTBOTTOMRIGHT 17
#define HTBORDER 18
#define HTGROWBOX HTSIZE
#define HTREDUCE HTMINBUTTON
#define HTZOOM HTMAXBUTTON
/* WM_SYSCOMMAND parameters */
#define SC_SIZE 0xf000
#define SC_MOVE 0xf010
#define SC_MINIMIZE 0xf020
#define SC_MAXIMIZE 0xf030
#define SC_NEXTWINDOW 0xf040
#define SC_PREVWINDOW 0xf050
#define SC_CLOSE 0xf060
#define SC_VSCROLL 0xf070
#define SC_HSCROLL 0xf080
#define SC_MOUSEMENU 0xf090
#define SC_KEYMENU 0xf100
#define SC_ARRANGE 0xf110
#define SC_RESTORE 0xf120
#define SC_TASKLIST 0xf130
#define SC_SCREENSAVE 0xf140
#define SC_HOTKEY 0xf150
/* Dialogs */
......@@ -794,6 +837,8 @@ typedef METARECORD *PMETARECORD;
#define SM_PENWINDOWS 41
#define SM_DBCSENABLED 42
#define SM_CMETRICS 43
/* Device-independent bitmaps */
typedef struct { BYTE rgbBlue, rgbGreen, rgbRed, rgbReserved; } RGBQUAD;
......@@ -1058,6 +1103,63 @@ typedef HANDLETABLE *LPHANDLETABLE;
#define IDC_SIZEWE MAKEINTRESOURCE(32544)
#define IDC_SIZENS MAKEINTRESOURCE(32545)
/* OEM Resource Ordinal Numbers */
#define OBM_CLOSE 32754
#define OBM_UPARROW 32753
#define OBM_DNARROW 32752
#define OBM_RGARROW 32751
#define OBM_LFARROW 32750
#define OBM_REDUCE 32749
#define OBM_ZOOM 32748
#define OBM_RESTORE 32747
#define OBM_REDUCED 32746
#define OBM_ZOOMD 32745
#define OBM_RESTORED 32744
#define OBM_UPARROWD 32743
#define OBM_DNARROWD 32742
#define OBM_RGARROWD 32741
#define OBM_LFARROWD 32740
#define OBM_MNARROW 32739
#define OBM_COMBO 32738
#define OBM_UPARROWI 32737
#define OBM_DNARROWI 32736
#define OBM_RGARROWI 32735
#define OBM_LFARROWI 32734
#define OBM_OLD_CLOSE 32767
#define OBM_SIZE 32766
#define OBM_OLD_UPARROW 32765
#define OBM_OLD_DNARROW 32764
#define OBM_OLD_RGARROW 32763
#define OBM_OLD_LFARROW 32762
#define OBM_BTSIZE 32761
#define OBM_CHECK 32760
#define OBM_CHECKBOXES 32759
#define OBM_BTNCORNERS 32758
#define OBM_OLD_REDUCE 32757
#define OBM_OLD_ZOOM 32756
#define OBM_OLD_RESTORE 32755
#define OCR_NORMAL 32512
#define OCR_IBEAM 32513
#define OCR_WAIT 32514
#define OCR_CROSS 32515
#define OCR_UP 32516
#define OCR_SIZE 32640
#define OCR_ICON 32641
#define OCR_SIZENWSE 32642
#define OCR_SIZENESW 32643
#define OCR_SIZEWE 32644
#define OCR_SIZENS 32645
#define OCR_SIZEALL 32646
#define OCR_ICOCUR 32647
#define OIC_SAMPLE 32512
#define OIC_HAND 32513
#define OIC_QUES 32514
#define OIC_BANG 32515
#define OIC_NOTE 32516
/* Stock GDI objects for GetStockObject() */
#define WHITE_BRUSH 0
......@@ -1097,10 +1199,25 @@ enum { WM_NULL, WM_CREATE, WM_DESTROY, WM_MOVE, WM_UNUSED0, WM_SIZE, WM_ACTIVATE
#define WM_NCCREATE 0x0081
#define WM_NCDESTROY 0x0082
#define WM_NCCALCSIZE 0x0083
#define WM_NCCALCSIZE 0x0083
#define WM_NCHITTEST 0x0084
#define WM_NCPAINT 0x0085
#define WM_NCACTIVATE 0x0086
#define WM_GETDLGCODE 0x0087
/* Non-client mouse messages */
#define WM_NCMOUSEMOVE 0x00a0
#define WM_NCLBUTTONDOWN 0x00a1
#define WM_NCLBUTTONUP 0x00a2
#define WM_NCLBUTTONDBLCLK 0x00a3
#define WM_NCRBUTTONDOWN 0x00a4
#define WM_NCRBUTTONUP 0x00a5
#define WM_NCRBUTTONDBLCLK 0x00a6
#define WM_NCMBUTTONDOWN 0x00a7
#define WM_NCMBUTTONUP 0x00a8
#define WM_NCMBUTTONDBLCLK 0x00a9
/* Keyboard messages */
#define WM_KEYDOWN 0x0100
#define WM_KEYUP 0x0101
......@@ -1115,6 +1232,7 @@ enum { WM_NULL, WM_CREATE, WM_DESTROY, WM_MOVE, WM_UNUSED0, WM_SIZE, WM_ACTIVATE
#define WM_INITDIALOG 0x0110
#define WM_COMMAND 0x0111
#define WM_SYSCOMMAND 0x0112
#define WM_TIMER 0x0113
#define WM_SYSTIMER 0x0118
......@@ -1166,6 +1284,14 @@ enum { WM_NULL, WM_CREATE, WM_DESTROY, WM_MOVE, WM_UNUSED0, WM_SIZE, WM_ACTIVATE
#define PM_REMOVE 0x0001
#define PM_NOYIELD 0x0002
#define WM_SHOWWINDOW 0x0018
/* WM_SHOWWINDOW wParam codes */
#define SW_PARENTCLOSING 1
#define SW_OTHERMAXIMIZED 2
#define SW_PARENTOPENING 3
#define SW_OTHERRESTORED 4
enum { SW_HIDE, SW_SHOWNORMAL, SW_NORMAL, SW_SHOWMINIMIZED, SW_SHOWMAXIMIZED,
SW_MAXIMIZE, SW_SHOWNOACTIVATE, SW_SHOW, SW_MINIMIZE,
SW_SHOWMINNOACTIVE, SW_SHOWNA, SW_RESTORE };
......@@ -1284,9 +1410,7 @@ enum { SW_HIDE, SW_SHOWNORMAL, SW_NORMAL, SW_SHOWMINIMIZED, SW_SHOWMAXIMIZED,
#define DT_NOPREFIX 2048
#define DT_INTERNAL 4096
/* Window Styles */
#define WS_OVERLAPPED 0x00000000L
#define WS_POPUP 0x80000000L
#define WS_CHILD 0x40000000L
......@@ -2022,7 +2146,7 @@ Fa(WORD,GetPolyFillMode,HDC,a)
Fa(WORD,GetRelAbs,HDC,a)
Fa(WORD,GetROP2,HDC,a)
Fa(WORD,GetStretchBltMode,HDC,a)
Fa(int,GetSystemMetrics,short,a)
Fa(int,GetSystemMetrics,WORD,a)
Fa(int,GetWindowTextLength,HWND,a)
Fa(int,RestoreVisRgn,HDC,a)
Fa(int,SaveDC,HDC,a)
......@@ -2347,7 +2471,7 @@ Fd(int,LoadString,HANDLE,a,WORD,b,LPSTR,c,int,d)
Fd(int,MessageBox,HWND,a,LPSTR,b,LPSTR,c,WORD,d)
Fd(int,SetScrollPos,HWND,a,int,b,int,c,BOOL,d)
Fd(int,SetVoiceNote,int,a,int,b,int,c,int,d)
Fd(void,AdjustWindowRectEx,LPRECT,a,LONG,b,BOOL,c,DWORD,d)
Fd(void,AdjustWindowRectEx,LPRECT,a,DWORD,b,BOOL,c,DWORD,d)
Fd(void,AnimatePalette,HPALETTE,a,WORD,b,WORD,c,LPPALETTEENTRY,d)
Fd(void,CheckRadioButton,HWND,a,WORD,b,WORD,c,WORD,d)
Fd(void,CreateCaret,HWND,a,HBITMAP,b,short,c,short,d)
......
/* WINEOPTS.H
*/
#ifndef WINEOPTS_H
#define WINEOPTS_H
#include <stdio.h>
FILE *SpyFp;
#endif /* WINEOPTS_H */
......@@ -153,6 +153,7 @@ FindResourceByNumber(struct resource_nameinfo_s *result_p,
if (read(ResourceFd, &size_shift, sizeof(size_shift)) !=
sizeof(size_shift))
{
printf("FindResourceByNumber (%s) bad block size !\n", resource_id);
return -1;
}
......@@ -160,40 +161,38 @@ FindResourceByNumber(struct resource_nameinfo_s *result_p,
* Find resource.
*/
typeinfo.type_id = 0xffff;
while (typeinfo.type_id != 0)
{
while (typeinfo.type_id != 0) {
if (read(ResourceFd, &typeinfo, sizeof(typeinfo)) !=
sizeof(typeinfo))
{
sizeof(typeinfo)) {
printf("FindResourceByNumber (%X) bad typeinfo size !\n", resource_id);
return -1;
}
if (typeinfo.type_id != 0)
{
for (i = 0; i < typeinfo.count; i++)
{
}
#ifdef DEBUG_RESOURCE
printf("FindResourceByNumber type=%X count=%d\n",
typeinfo.type_id, typeinfo.count);
#endif
if (typeinfo.type_id == 0) break;
if (typeinfo.type_id == type_id || type_id == -1) {
for (i = 0; i < typeinfo.count; i++) {
if (read(ResourceFd, &nameinfo, sizeof(nameinfo)) !=
sizeof(nameinfo))
{
sizeof(nameinfo)) {
printf("FindResourceByNumber (%X) bad nameinfo size !\n", resource_id);
return -1;
}
#if defined(DEBUG_RESOURCE) && defined(VERBOSE_DEBUG)
if (type_id == typeinfo.type_id)
{
printf("FindResource: type id = %d, resource id = %x\n",
type_id, nameinfo.id);
}
}
#ifdef DEBUG_RESOURCE
printf("FindResource: search type=%X id=%X // type=%X id=%X\n",
type_id, resource_id, typeinfo.type_id, nameinfo.id);
#endif
if ((type_id == -1 || typeinfo.type_id == type_id) &&
nameinfo.id == resource_id)
{
if (nameinfo.id == resource_id) {
memcpy(result_p, &nameinfo, sizeof(nameinfo));
return size_shift;
}
}
}
}
}
}
else {
lseek(ResourceFd, (typeinfo.count * sizeof(nameinfo)), SEEK_CUR);
}
}
return -1;
}
......@@ -243,7 +242,7 @@ FindResourceByName(struct resource_nameinfo_s *result_p,
return -1;
}
#ifdef DEBUG_RESOURCE
printf("FindResourceByName typeinfo.type_id=%d type_id=%d\n",
printf("FindResourceByName typeinfo.type_id=%X type_id=%X\n",
typeinfo.type_id, type_id);
#endif
if (typeinfo.type_id == 0) break;
......@@ -269,7 +268,7 @@ FindResourceByName(struct resource_nameinfo_s *result_p,
lseek(ResourceFd, old_pos, SEEK_SET);
name[nbytes] = '\0';
#ifdef DEBUG_RESOURCE
printf("FindResourceByName type_id=%d name='%s' resource_name='%s'\n",
printf("FindResourceByName type_id=%X name='%s' resource_name='%s'\n",
typeinfo.type_id, name, resource_name);
#endif
if (strcasecmp(name, resource_name) == 0)
......@@ -281,7 +280,7 @@ FindResourceByName(struct resource_nameinfo_s *result_p,
}
else {
lseek(ResourceFd, (typeinfo.count * sizeof(nameinfo)), SEEK_CUR);
}
}
}
return -1;
}
......@@ -681,9 +680,6 @@ LoadBitmap(HANDLE instance, LPSTR bmp_name)
printf("LoadBitmap: instance = %04x, name = %08x\n",
instance, bmp_name);
#endif
printf("LoadBitmap: instance = %04x, name = %08x\n",
instance, bmp_name);
if (instance == (HANDLE)NULL) instance = hSysRes;
if (!(hdc = GetDC(GetDesktopWindow()))) return 0;
......@@ -706,7 +702,6 @@ printf("before GlobalLock\n");
else if (*lp == sizeof(BITMAPINFOHEADER))
hbitmap = ConvertInfoBitmap( hdc, (BITMAPINFO *) lp );
else hbitmap = 0;
printf("LoadBitmap %04X\n", hbitmap);
GlobalFree(rsc_mem);
ReleaseDC( 0, hdc );
return hbitmap;
......
......@@ -21,6 +21,9 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include "dlls.h"
#include "wine.h"
#include "windows.h"
#include "wineopts.h"
/* #define DEBUG_FIXUP */
extern int CallToInit16(unsigned long csip, unsigned long sssp,
unsigned short ds);
......@@ -46,6 +49,8 @@ HINSTANCE hSysRes;
static char *Extensions[] = { "dll", "exe", NULL };
static char *WinePath = NULL;
FILE *SpyFp = NULL;
/**********************************************************************
* DebugPrintString
*/
......@@ -110,6 +115,19 @@ HINSTANCE LoadImage(char *modulename)
unsigned int status;
char buffer[256];
/*
* search file
*/
if (FindFile(buffer, sizeof(buffer), modulename, Extensions, WindowsPath)
==NULL)
{
fprintf(stderr,"LoadImage: I can't find %s !\n",modulename);
return (HINSTANCE) NULL;
}
fprintf(stderr,"LoadImage: loading %s (%s)\n", modulename, buffer);
/* First allocate a spot to store the info we collect, and add it to
* our linked list.
*/
......@@ -124,20 +142,6 @@ HINSTANCE LoadImage(char *modulename)
};
wpnt->next = NULL;
/*
* search file
*/
if (FindFile(buffer, sizeof(buffer), modulename, Extensions, WindowsPath)
==NULL)
{
char temp[256];
sprintf(temp,"LoadImage: I can't find %s !\n",modulename);
myerror(temp);
}
fprintf(stderr,"LoadImage: loading %s (%s)\n", modulename, buffer);
/*
* Open file for reading.
*/
......@@ -251,6 +255,31 @@ HINSTANCE LoadImage(char *modulename)
return(wpnt->hinstance);
}
/**********************************************************************
* ParseArgs
*/
void
ParseArgs(int argc, char **argv)
{
if (argc < 2)
{
fprintf(stderr, "usage: %s [-spy FILENAME] FILENAME\n", argv[0]);
exit(1);
}
Argc = argc - 1;
for (Argv = argv + 1; **Argv == '-' && Argc > 0; Argv++)
{
if (strcmp(*Argv, "-spy") == 0)
{
if (strcmp(*(++Argv), "-") == 0)
SpyFp = stdout;
else
SpyFp = fopen(*Argv, "a");
}
}
}
/**********************************************************************
* main
......@@ -260,6 +289,7 @@ _WinMain(int argc, char **argv)
int segment;
char *p;
char *sysresname;
char filename[100];
char syspath[256];
char exe_path[256];
#ifdef WINESTAT
......@@ -269,15 +299,8 @@ _WinMain(int argc, char **argv)
int cs_reg, ds_reg, ss_reg, ip_reg, sp_reg;
int i;
int rv;
Argc = argc - 1;
Argv = argv + 1;
if (argc < 2)
{
fprintf(stderr, "usage: %s FILENAME\n", argv[0]);
exit(1);
}
ParseArgs(argc, argv);
p = getenv("WINEPATH");
WinePath = malloc(256 + strlen(p));
......@@ -285,27 +308,17 @@ _WinMain(int argc, char **argv)
strcat(WinePath, ";");
strcat(WinePath, p);
LoadImage(argv[1]);
hSysRes = LoadImage("sysres.dll");
LoadImage(Argv[0]);
GetPrivateProfileString("wine", "SystemResources", "sysres.dll",
filename, sizeof(filename),
WINE_INI);
hSysRes = LoadImage(filename);
if (hSysRes == (HINSTANCE)NULL)
printf("Error Loading System Resources !!!\n");
else
printf("System Resources Loaded // hSysRes='%04X'\n", hSysRes);
if(ran_out) exit(1);
#ifdef DEBUG
{
int dummy1, dummy2;
GetEntryDLLName("USER", "INITAPP", &dummy1, &dummy2);
}
for(i=0; i<1024; i++) {
int j;
j = GetEntryPointFromOrdinal(wine_files, i);
if(j == 0) break;
fprintf(stderr," %d %x\n", i, j);
};
#endif
/*
* Fixup references.
*/
......@@ -442,8 +455,10 @@ FixupSegment(struct w_files * wpnt, int segment_num)
seg = &seg_table[segment_num];
sel = &selector_table[segment_num];
fprintf(stderr, "Segment fixups for %s, segment %d, selector %x\n",
wpnt->name, segment_num, (int) sel->base_addr >> 16);
#ifdef DEBUG_FIXUP
printf("Segment fixups for %s, segment %d, selector %x\n",
wpnt->name, segment_num, (int) sel->base_addr >> 16);
#endif
if ((seg->seg_data_offset == 0) ||
!(seg->seg_flags & NE_SEGFLAGS_RELOC_DATA))
......@@ -589,13 +604,6 @@ FixupSegment(struct w_files * wpnt, int segment_num)
rep->target1, rep->target2);
free(rep1);
return -1;
#if 0
sp = (unsigned short *) ((char *) sel->base_addr + rep->offset);
fprintf(stderr, " FIXUP ADDRESS %04.4x:%04.4x\n",
(int) sel->base_addr >> 16, rep->offset);
WineForceFail = 1;
continue;
#endif
}
/*
......@@ -619,6 +627,10 @@ FixupSegment(struct w_files * wpnt, int segment_num)
{
case NE_RADDR_OFFSET16:
do {
#ifdef DEBUG_FIXUP
printf(" %04.4x:%04.4x:%04.4x OFFSET16\n",
(unsigned long) sp >> 16, (int) sp & 0xFFFF, *sp);
#endif
next_addr = *sp;
*sp = (unsigned short) address;
if (additive == 2)
......@@ -631,6 +643,10 @@ FixupSegment(struct w_files * wpnt, int segment_num)
case NE_RADDR_POINTER32:
do {
#ifdef DEBUG_FIXUP
printf(" %04.4x:%04.4x:%04.4x POINTER32\n",
(unsigned long) sp >> 16, (int) sp & 0xFFFF, *sp);
#endif
next_addr = *sp;
*sp = (unsigned short) address;
if (additive == 2)
......@@ -644,11 +660,15 @@ FixupSegment(struct w_files * wpnt, int segment_num)
case NE_RADDR_SELECTOR:
do {
#ifdef DEBUG_FIXUP
printf(" %04.4x:%04.4x:%04.4x SELECTOR\n",
(unsigned long) sp >> 16, (int) sp & 0xFFFF, *sp);
#endif
next_addr = *sp;
*sp = (unsigned short) selector;
sp = (unsigned short *) ((char *) sel->base_addr + next_addr);
if (rep->relocation_type == NE_RELTYPE_INT1) break;
if (rep->relocation_type == NE_RELTYPE_INT1)
break;
}
while (next_addr != 0xffff && !additive);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment